# Category Archives: Competitive Programming

## Input/Output from external file in C/C++, Java and Python for Competitive Programming | Set 2

Prerequisites : Input/Output from external file in C/C++, Java and Python for Competitive Programming In above post,  we saw a way to have standard input/output… Read More »

## Using Chinese Remainder Theorem to Combine Modular equations

Given N modular equations: A ≅ x1mod(m1) . . A ≅ xnmod(mn) Find x in the equation A ≅ xmod(m1*m2*m3..*mn) where mi is prime, or… Read More »

## Prefix Sum Array – Implementation and Applications in Competitive Programming

Given an array arr[] of size n, its prefix sum array is another array prefixSum[] of same size such that the value of prefixSum[i] is… Read More »

## NZEC error in Python

While coding in various competitive sites, many people must have have encountered NZEC error. NZEC (non zero exit code) as the name suggests occurs when… Read More »

## Modulo 10^9+7 (1000000007)

In most of the programming competitions, we are required to answer the result in 10^9+7 modulo. The reason behind this is, if problem constraints are… Read More »

## Digit DP | Introduction

Prerequisite : How to solve a Dynamic Programming Problem ? There are many types of problems that ask to count the number of integers ‘x‘… Read More »

## Project Euler

What is Project Euler? Project Euler is a series of challenging problems that require mathematical and programming skills. Somebody who enjoys learning new area of… Read More »

## Palindromic Tree | Introduction & Implementation

We encounter various problems like Maximum length palindrome in a string, number of palindromic substrings and many more interesting problems on palindromic substrings . Mostly… Read More »

## Python Input Methods for Competitive Programming

Python is an amazingly user-friendly language with the only flaw of being slow. In comparison to C, C++ and Java, it is quite slower. On… Read More »

## Input/Output from external file in C/C++, Java and Python for Competitive Programming

In Competitive Programming, most of the time we need to enter input for checking our code manually. But it would become cumbersome if we have… Read More »

## Writing C/C++ code efficiently in Competitive programming

First of all you need to know about Template, Macros and Vectors before moving on the next phase! Templates are the foundation of generic programming,… Read More »

## Sqrt (or Square Root) Decomposition | Set 2 (LCA of Tree in O(sqrt(height)) time)

Prerequisite : Introduction and DFS The task is to find LCA of two given nodes in a tree (not necessarily a Binary Tree). In previous… Read More »

## What to do at the time of Wrong Answer (WA)?

There is been always a case that a wrong answer gives too much pain rather than TLE (Time Limit Exceed), as in former you couldn’t… Read More »

## Sqrt (or Square Root) Decomposition Technique | Set 1 (Introduction)

Sqrt (or Square Root) Decomposition Technique is one of the most common query optimization technique used by competitive programmers. This technique helps us to reduce… Read More »

## Graph implementation using STL for competitive programming | Set 2 (Weighted graph)

In Set 1, unweighted graph is discussed. In this post, weighted graph representation using STL is discussed. The implementation is for adjacency list representation of… Read More »