├── .all-contributorsrc ├── .gitattributes ├── .github └── workflows │ └── greetings.yml ├── .mergify.yml ├── ALGORITHMS ├── Array │ ├── Array Subset of Another Array │ │ └── Array Subset of Another Array.py │ ├── Boyre Moore Algorithm │ │ └── Boyre_moore.cpp │ ├── Chocolate Distribution Problem │ │ └── Chocolate Distribution Problem.py │ ├── Common Elements (3 Arrays) │ │ └── Common Elements (3 Arrays).py │ ├── Count Inversion │ │ └── Count Inversion.py │ ├── Count Pairs with Given Sum │ │ └── Count Pairs with Given Sum .py │ ├── DNF_sort.cpp │ ├── Deletion.cpp │ ├── FreqInUnsortedArray.cpp │ ├── FreqOfElementsInSortedArray.cpp │ ├── Insertion.cpp │ ├── Java │ │ ├── 1. Sum of elements │ │ │ ├── Main.java │ │ │ └── readme.md │ │ ├── 2. Find the Duplicates │ │ │ ├── Main.java │ │ │ └── readme.md │ │ ├── 3. Minimum and Maximum │ │ │ └── readme.md │ │ └── readme.md │ ├── Kadane's Algorithm │ │ ├── Kadane's Algo.js │ │ ├── kadanesAlgo.cpp │ │ └── readme.md │ ├── Kadane's algorithm(subarray) python │ │ ├── README.md │ │ └── kadane's.py │ ├── LargestElement.cpp │ ├── LeadersInArray.cpp │ ├── LeftRotateByD.cpp │ ├── LongestOddEvenSubArray.cpp │ ├── MaxCircularSum.cpp │ ├── MaxLengthOfConsecutiveOnes.cpp │ ├── MaximumDiffInArray.cpp │ ├── MaximumSubarraySum.cpp │ ├── Merge Two Sorted Array │ │ ├── mergeTwoSortedArray.cpp │ │ └── readme.md │ ├── MinFlips.cpp │ ├── MovingZerosInArrayToEnd.cpp │ ├── N_bonacci.cpp │ ├── README.md │ ├── RemovingDuplicatesFromAnArray.cpp │ ├── ReversingArray.cpp │ ├── SecondLargestElement.cpp │ ├── Stonks.cpp │ ├── SubarrrayWithGivenSum.cpp │ ├── Three Sum Problem │ │ ├── readme.md │ │ └── threeSumProblem.cpp │ ├── TrappingRainProblem.cpp │ ├── WindowSlidingTechnique.cpp │ └── catalan.cpp ├── Backtracking │ ├── Knapsack Problem │ │ ├── KnapsackProblem.cpp │ │ └── readme.md │ ├── M-coloring.cpp │ ├── N Queen Problem │ │ ├── NQueen.cpp │ │ └── readme.md │ ├── README.md │ ├── Rat In A Maze Problem │ │ ├── ratInAMaze.cpp │ │ └── readme.md │ └── tugofwar.cpp ├── Bit Algorithms │ ├── Count Total Set Bits │ │ ├── Count Total Set Bits.cpp │ │ └── readme.md │ └── README.md ├── Dynamic Programming │ ├── 01_knapsack.cpp │ ├── Dice Combinations │ │ ├── Dice Combinations.cpp │ │ └── readme.md │ ├── Grid Path Problem │ │ ├── Grid Path Problem.cpp │ │ └── readme.md │ ├── Merge Elements │ │ ├── mergeElements.cpp │ │ └── readme.md │ ├── Minimising Coins problem │ │ ├── Minimising coins.cpp │ │ └── readme.md │ ├── Minimum Steps to One │ │ └── MinimumStepsToOne.cpp │ └── Minimum fountains │ │ └── minimum_fountains.cpp ├── GCD │ ├── Euclidean Algorithm │ │ ├── EuclidAlgorithm.cpp │ │ └── readme.md │ └── Sieve of Eratosthenes │ │ ├── Sieve of Eratosthenes.cpp │ │ └── readme.md ├── Graph │ ├── Cycle in directed graph.cpp │ ├── Cycle in undirected graph using DSU.cpp │ ├── Kruskal │ │ └── kruskal.cpp │ ├── Prim's Algorithm │ │ ├── Prim'sAlgorithm.cpp │ │ └── readme.md │ ├── README.md │ ├── Topological-Sort.cpp │ └── dijsktra.cpp ├── Greedy │ ├── Car_Fueling │ │ └── car_fueling.py │ ├── Fractional_Knapsack │ │ └── Fractional-Knapsack.py │ ├── Kruskal's Algorithm.cpp │ ├── README.md │ └── StableMatching │ │ └── stablematching.cpp ├── Hashing │ ├── README.md │ ├── collisionres_technique.c │ └── insert_divmethod.c ├── Heap │ ├── HEAPSORT.CPP │ └── README.md ├── Linked List │ ├── Level Order Traversal │ │ ├── levelOrderTraversal.cpp │ │ └── readme.md │ ├── Merge Two Sorted LinkedList │ │ ├── mergeTwoSortedLinkedList.cpp │ │ └── readme.md │ ├── Put Even After Odd LinkedList │ │ ├── putEvenAfterOddLinkedList.cpp │ │ └── readme.md │ ├── README.md │ ├── Reverse │ │ ├── reverse.c │ │ ├── reverse.java │ │ └── reverse.py │ ├── Shortest Path in Binary Tree │ │ └── shortest_path.cpp │ ├── Singly Linked List │ │ ├── DoublyLinkedList.cpp │ │ └── SinglyLinkedList.cpp │ ├── Sum Of Nodes At kth Level │ │ ├── SumOfNodesAtkthLevel.cpp │ │ └── readme.md │ ├── Tortoise-Hare Algorithm │ │ ├── Tortoise-HareAlgo.cpp │ │ └── readme.md │ └── spiral_linked_list │ │ └── spiral_linked_list.cpp ├── Mathematical Algorithms │ ├── All_factors.cpp │ ├── Armstrong_Numbers.cpp │ ├── Binomial_Coefficient.cpp │ ├── Chinese_Remainder_Theorem.cpp │ ├── Count_digits.cpp │ ├── Factorial.cpp │ ├── GCD or HCF │ │ ├── GCD-HCF.cpp │ │ └── readme.md │ ├── GCD.cpp │ ├── Iterative_power.cpp │ ├── Kaprekar_Numbers.cpp │ ├── LCM.cpp │ ├── Palindrome.cpp │ ├── Prime.cpp │ ├── Prime_factors.cpp │ ├── README.md │ ├── Sieve of Eratosthenes │ │ ├── Sieve_of_eratosthenes.cpp │ │ └── readme.md │ ├── Sieve_of_eratothenes.cpp │ ├── Zeros_in_factorial.cpp │ ├── armstrong_number.py │ ├── count_digits.py │ ├── factorial.py │ ├── fermats_little_theorem.cpp │ ├── gcd.py │ ├── kaprekar_number.py │ ├── lcm.py │ ├── nextPermutation.cpp │ ├── palindrome.py │ └── prime.py ├── Matrix │ ├── Idempotent matrix │ │ └── Idempotent_matrix.cpp │ ├── Matrix Addition │ │ ├── matrixAddition.cpp │ │ └── matrixAddition.py │ ├── Matrix Multiplication │ │ ├── matrixMultiplication.c │ │ └── matrixMultiplication.py │ ├── README.md │ └── TransposeOfMatrix.cpp ├── Memory │ ├── Best Fit │ │ └── bestFit.c │ ├── First Fit │ │ └── firstFit.c │ ├── Next Fit │ │ └── nextFit.c │ ├── README.md │ └── Worst Fit │ │ └── worstFit.c ├── Queue │ ├── README.md │ └── Sliding Window Maximum Using Dequeue │ │ ├── readme.md │ │ └── slidingWindowMaximumUsingDeque.cpp ├── README.md ├── Reccursion │ ├── Factorial │ │ ├── Factorial.cpp │ │ ├── Factorial.py │ │ └── readme.md │ ├── Fibonacci Sequence │ │ ├── Fibonacci Sequence.cpp │ │ ├── Fibonacci Sequence.py │ │ └── readme.md │ ├── GeoMetric Sum │ │ └── GeometricSum.cpp │ ├── NQueens │ │ └── readme.md │ └── Tower Of Hanoi │ │ ├── TowerOfHanoi.cpp │ │ └── readme.md ├── Recursion │ └── NQueens │ │ └── NQueens.cpp ├── Root to leaf paths │ └── RootToLeafPaths.c ├── Searching │ ├── Binary Search │ │ ├── BinarySearch.cpp │ │ ├── BinarySearch.go │ │ ├── BinarySearch.java │ │ ├── Binarysearch.py │ │ ├── binarysearch.cpp │ │ └── readme.md │ ├── Interpolation Search │ │ ├── InterpolationSearch.cpp │ │ └── InterpolationSearch.md │ ├── Jump Search │ │ ├── .ipynb_checkpoints │ │ │ └── jumpsearch-checkpoint.ipynb │ │ ├── JumpSearch.cpp │ │ ├── JumpSearch.md │ │ └── jumpsearch.ipynb │ ├── Linear Search │ │ ├── LinearSearch.cpp │ │ ├── LinearSearch.go │ │ ├── LinearSearch.py │ │ └── readme.md │ ├── README.md │ └── Ternary Search │ │ ├── TernarySearch.cpp │ │ └── TernarySearch.md ├── Sorting │ ├── Bubble Sort │ │ ├── BubbleSort.cpp │ │ ├── BubbleSort.py │ │ ├── Bubble_Sort.cpp │ │ ├── bubble sort.cpp │ │ ├── bubbleSort.py │ │ ├── modifiedBubbleSort.py │ │ ├── readme.md │ │ └── recur_bubblesort.cpp │ ├── Count Sort │ │ ├── CountSort.cpp │ │ └── readme.md │ ├── CountSort.cpp │ ├── Dnf Sort │ │ ├── dnfSort.cpp │ │ └── readme.md │ ├── HeapSort │ │ ├── HeapSort.cpp │ │ ├── HeapSort.py │ │ └── readme.md │ ├── Insertion Sort │ │ ├── insertionSort.cpp │ │ ├── insertionSort.py │ │ └── readme.md │ ├── Merge Sort │ │ ├── mergeSort.cpp │ │ └── readme.md │ ├── MergeSort │ │ ├── MergeSort.cpp │ │ ├── MergeSort.py │ │ └── readme.md │ ├── Quick Sort │ │ ├── QuickSort.cpp │ │ └── readme.md │ ├── QuickSort │ │ └── QuickSort.c │ ├── README.md │ ├── RadixSort │ │ ├── RadixSort.cpp │ │ └── readme.md │ ├── Selection Sort │ │ ├── SelectionSort.cpp │ │ ├── readme.md │ │ └── selection sort.cpp │ ├── SelectionSort │ │ └── SelectionSort.cpp │ ├── Sort using STL │ │ ├── STL_Sort.cpp │ │ └── readme.md │ └── Wave Sort │ │ ├── WaveSort.cpp │ │ └── readme.md ├── Stack │ ├── Largest Rectangle In A Histogram │ │ ├── LargestRectangleInAHistogram.cpp │ │ └── readme.md │ ├── README.md │ ├── Reductant Parenthesis │ │ ├── readme.md │ │ └── reductantParenthesis.cpp │ ├── Sort the element in Stack using Recursion.cpp │ ├── Stockspan Problem │ │ ├── readme.md │ │ └── stockSpanProblem.cpp │ ├── Trapping RainDrop Harvesting │ │ ├── readme.md │ │ └── trappingRainDropHarvesting.cpp │ └── infix_to_postfix.c ├── Strings │ ├── Palindrome │ │ └── palindrome.c │ ├── README.md │ └── String Palindrome.cpp └── Tree │ ├── BST_to_wave │ └── wave_array.cpp │ ├── Balanced Height Tree │ ├── BalancedHeightTree.cpp │ └── readme.md │ ├── Binary Tree │ ├── Lowest_common_ancestors.py │ └── README.md │ ├── Binary_Search_Tree │ └── Binary_search_tree.py │ ├── Count All The Nodes In A BinaryTree │ ├── countAllTheNodesInABinaryTree.cpp │ └── readme.md │ ├── Diameter of a binarytree │ ├── diameterOfABinaryTree.cpp │ └── readme.md │ ├── Height of a binary Tree │ ├── HeightofabinaryTree.cpp │ └── readme.md │ ├── InvertingBinarySearchTree.cpp │ ├── Linked_list_in _binary_tree │ └── LinkedListInBinaryTree.cpp │ ├── Lowest Common Ancestor in a BST │ └── LowestCommonAncestor.c │ ├── Number of non lead nodes in a tree │ └── No. of non leaf nodes.c │ ├── README.md │ ├── Sum All The Nodes IN A BinaryTree │ ├── SumAllTheNodesINABinaryTree.cpp │ └── readme.md │ ├── Sum Replacement In A Binary Tree │ ├── readme.md │ └── sumReplacementInABinaryTree.cpp │ └── Tree Traversals │ ├── Inorder_traversal.cpp │ ├── Levelorder_traversal.cpp │ ├── Postorder_traversal.cpp │ └── Preorder_traversal.cpp ├── Beginner ├── A - Books (BIT2A) │ ├── books.cpp │ ├── books.dart │ ├── books.go │ ├── books.java │ ├── books.js │ ├── books.py │ └── readme.md ├── A Balanced Contest (PERFCONT) │ ├── BalancedCont.cpp │ ├── BalancedContest.dart │ ├── BalancedContest.go │ ├── BalancedContest.java │ ├── BalancedContest.js │ ├── BalancedContest.py │ └── readme.md ├── A Big Sale (BIGSALE) │ ├── readme.md │ ├── sale.cpp │ ├── sale.js │ └── sale.py ├── A Good Set (GOODSET) │ ├── GoodSet.js │ ├── GoodSet.py │ └── readme.md ├── A Problem on Sticks │ ├── readme.md │ ├── sticks.cpp │ ├── sticks.js │ └── sticks.py ├── ATM (HS08TEST) │ ├── atm.c │ ├── atm.cpp │ ├── atm.go │ ├── atm.java │ ├── atm.js │ ├── atm.php │ ├── atm.py │ └── readme.md ├── ATM Machine (ATM2) │ ├── atm2.c │ ├── atm2.cpp │ ├── atm2.java │ ├── atm2.py │ └── readme.md ├── ATM │ ├── atm.c │ ├── atm.cpp │ └── readme.md ├── Ada King (ADAKNG) │ ├── adakng.cpp │ └── readme.md ├── Ada School (ADASCOOL) │ ├── ada.cpp │ ├── ada.go │ ├── ada.java │ ├── ada.php │ ├── ada.py │ └── readme.md ├── Ada and crayons (ADACRA) │ ├── crayons.cpp │ ├── crayons.java │ ├── crayons.py │ └── readme.md ├── Ada and the Staircase (ADASTAIR) │ ├── adastair.cpp │ └── readme.md ├── Add Two Numbers (FLOW001) │ ├── add.c │ ├── add.cpp │ ├── add.go │ ├── add.java │ ├── add.js │ ├── add.php │ ├── add.py │ ├── add.rb │ └── readme.md ├── Akhil And Colored Balls (ACBALL) │ ├── acball.cpp │ └── readme.md ├── Alternating subarray prefix (ALTARAY) │ ├── altaray.cpp │ ├── alternating.py │ └── readme.md ├── Ambiguous Permutations (PERMUT2) │ ├── permutation.java │ ├── permutation.py │ └── readme.md ├── Appy and Contest (HMAPPY2) │ ├── contest.cpp │ ├── contest.py │ └── readme.md ├── Area OR Perimeter (AREAPERI) │ ├── areaperi.c │ ├── areaperi.cpp │ ├── areaperi.java │ ├── areaperi.js │ ├── areaperi.py │ ├── areaperi.rb │ └── readme.md ├── At the Gates (POPGATES) │ ├── gates.cpp │ ├── gates.js │ ├── gates.py │ └── readme.md ├── Attendance (ATTND) │ ├── attendance.cpp │ ├── attendance.go │ ├── attendance.java │ ├── attendance.py │ └── readme.md ├── Audible Range │ └── audible_range.rb ├── Average Number (AVG) │ ├── avg.c │ ├── avg.cpp │ ├── avg.go │ ├── avg.java │ ├── avg.py │ └── readme.md ├── Balsa For The Three (BFTT) │ ├── readme.md │ ├── three.cpp │ └── three.py ├── Bear and Candies 123 (CANDY123) │ ├── candy.cpp │ ├── candy.js │ ├── candy.py │ └── readme.md ├── Bear and Ladder (BRLADDER) │ ├── ladder.cpp │ ├── ladder.js │ ├── ladder.py │ └── readme.md ├── Bear and Milky Cookies (COOMILK) │ ├── cookies.cpp │ ├── cookies.py │ └── readme.md ├── Bear and Segment 01 (SEGM01) │ ├── readme.md │ ├── segment.cpp │ └── segment.py ├── Bidding │ ├── Bidding.py │ └── README.md ├── Body Mass Index (BMI) │ ├── BMI.cpp │ ├── Body Mass Index (BMI).cpp │ ├── bmi.cpp │ ├── bmi.py │ └── readme.md ├── Bodybuilder (BUILDB) │ ├── bodybuilder.cpp │ └── readme.md ├── Breaking Bricks (BRKBKS) │ ├── BreakingBricks.cpp │ ├── BreakingBricks.java │ └── readme.md ├── Buggy Calculator (BUGCAL) │ ├── Buggy_calc.py │ └── README.md ├── Buying New Tablet (TABLET) │ ├── code.cpp │ ├── readme.md │ ├── tablet.java │ ├── tablet.js │ └── tablet.py ├── CV (CV) │ ├── cv.cpp │ ├── cv.py │ └── readme.md ├── Candy Love (CNDLOVE) │ ├── candy.c │ ├── candy.cpp │ ├── candy.py │ └── readme.md ├── Cats and Dogs (CATSDOGS) │ ├── catsdogs.cpp │ ├── catsdogs.py │ └── readme.md ├── Change It (CHNGIT) │ ├── change.cpp │ ├── change.java │ └── readme.md ├── Chef And Coloring (COLOR) │ ├── code.cpp │ ├── color.java │ ├── color.py │ └── readme.md ├── Chef And His Characters(CHEFCHR) │ ├── README.md │ ├── solution.cpp │ └── solution.py ├── Chef And Operators (CHOPRT) │ ├── chef.c │ ├── chef.cpp │ ├── chef.java │ ├── chef.js │ ├── chef.py │ └── readme.md ├── Chef Chick (CHFCHK) │ ├── chick.cpp │ ├── chick.java │ ├── chick.py │ └── readme.md ├── Chef Diet (DIET) │ ├── diet.cpp │ ├── diet.py │ └── readme.md ├── Chef Feeds Cats (CATFEED) │ ├── Cats.cpp │ ├── cats.py │ └── readme.md ├── Chef Judges a Competition (CO92JUDG) │ ├── judge.java │ ├── judge.py │ └── readme.md ├── Chef Wars - Return of the Jedi (CHEFWARS) │ ├── CHEFWARS.cpp │ ├── ChefWars.java │ └── readme.md ├── Chef and Bored Games (PCJ18B) │ ├── bored.py │ └── readme.md ├── Chef and Cook-Off (CCOOK) │ ├── cook.c │ ├── cook.cpp │ ├── cook.java │ ├── cook.py │ └── readme.md ├── Chef and Distinct Numbers (CEQUAL) │ ├── ChefAndDistinctNumbers.java │ ├── readme.md │ └── solution.cpp ├── Chef and Dolls (MISSP) │ ├── dolls.java │ ├── dolls.py │ └── readme.md ├── Chef and Easy Queries (CHEFEZQ) │ ├── ChefAndEasyQueries.java │ ├── EasyQueries.cpp │ └── readme.md ├── Chef and Eid (EID) │ ├── chefeid.java │ └── readme.md ├── Chef and Employment Test (CK87MEDI) │ ├── employement.cpp │ ├── employement.py │ └── readme.md ├── Chef and Fruits (FRUITS) │ ├── fruits.c │ ├── fruits.cpp │ ├── fruits.exe │ ├── fruits.java │ ├── fruits.js │ ├── fruits.py │ └── readme.md ├── Chef and Glove (CHEGLOVE) │ ├── glove.cpp │ ├── glove.py │ └── readme.md ├── Chef and Interactive Contests (CHFINTRO) │ ├── interactive.cpp │ ├── interactive.py │ └── readme.md ├── Chef and Price Control (PRICECON) │ ├── price.cpp │ ├── price.py │ └── readme.md ├── Chef and Rainbow Array (RAINBOWA) │ ├── rainbow.c │ └── rainbow.py ├── Chef and Remissness (REMISS) │ ├── readme.md │ ├── remiss.c │ ├── remiss.cpp │ ├── remiss.java │ └── remiss.py ├── Chef and Serves (CHSERVE) │ ├── readme.md │ ├── serves.cpp │ └── serves.py ├── Chef and SnackDown (SNCKYEAR) │ ├── readme.md │ ├── snackdown.cpp │ ├── snackdown.java │ └── snackdown.py ├── Chef and String (CHRL2) │ ├── CHRL2.java │ └── readme.md ├── Chef and Strings (CHEFSTR1) │ ├── CHEFSTR1.py │ └── README.md ├── Chef and Table Tennis (TTENIS) │ ├── readme.md │ ├── tabletennis.java │ └── tabletennis.py ├── Chef and Two Strings (CHEFSTLT) │ ├── chef.cpp │ ├── chef.java │ ├── chef.py │ └── readme.md ├── Chef and Typing (TYPING) │ ├── ChefAndTyping.java │ └── readme.md ├── Chef and digits of a number (LONGSEQ) │ ├── chefdigits.cpp │ ├── chefdigits.java │ ├── chefdigits.py │ └── readme.md ├── Chef and his Sequence (CHEFSQ) │ ├── readme.md │ ├── sequence.cpp │ ├── sequence.java │ └── sequence.py ├── Chef and his Students (CHEFSTUD) │ ├── readme.md │ ├── students.cpp │ └── students.py ├── Chef and the Wildcard Matching (TWOSTR) │ ├── readme.md │ ├── wildcard.java │ └── wildcard.py ├── Chef vs Doof (CLLCM) │ ├── doof.cpp │ ├── doof.py │ └── readme.md ├── Ciel and Receipt (CIELRCPT) │ ├── ceil.cpp │ └── readme.md ├── Closing the Tweets (TWTCLOSE) │ ├── TWTCLOSE.cpp │ ├── readme.md │ ├── tweets.java │ └── tweets.py ├── Coder Life Matters (CODERLIF) │ ├── coder.cpp │ ├── coder.py │ └── readme.md ├── Coins And Triangle (TRICOIN) │ ├── coins.java │ ├── coins.py │ └── readme.md ├── Coldplay (SLOOP) │ ├── README.md │ └── coldplay.py ├── Cops and the Thief Devu (COPS) │ ├── cops.java │ ├── cops.py │ └── readme.md ├── Cops and the Thief Devu(COPS) │ ├── cops.cpp │ └── readme.md ├── Count Subarrays (SUBINC) │ ├── readme.md │ ├── subarrays.cpp │ ├── subarrays.java │ └── subarrays.py ├── Covid Run (CVDRUN) │ ├── covid_run.cpp │ ├── covid_run.java │ ├── covid_run.py │ ├── covid_run.scala │ └── readme.md ├── Cut The Sticks (CUTSTICK) │ ├── CutTheSticks.java │ └── readme.md ├── Cut the Board (CUTBOARD) │ ├── board.cpp │ ├── board.py │ └── readme.md ├── Cutting Recipes (RECIPE) │ ├── readme.md │ ├── recipe.c │ └── recipe.py ├── Decrement OR Increment (DECINC) │ ├── DECINC.cpp │ ├── DECINC.cs │ ├── DECINC.java │ ├── DECINC.py │ ├── DECINC.sh │ ├── decinc.c │ └── readme.md ├── Devu and friendship testing (CFRTEST) │ ├── friendship.cpp │ ├── friendship.java │ ├── friendship.py │ └── readme.md ├── Download file (DWNLD) │ ├── download.java │ ├── download.py │ └── readme.md ├── Easy Math (RPD) │ ├── easy.cpp │ ├── easy.py │ └── readme.md ├── Encoded String │ └── Encoded_String.cpp ├── Enormous Input Test (INTEST) │ ├── intest.c │ ├── intest.cpp │ ├── intest.go │ ├── intest.java │ ├── intest.js │ ├── intest.py │ └── readme.md ├── Even-tual Reduction (EVENTUAL) │ ├── eventual.cpp │ └── readme.md ├── Fancy Quotes (FANCY) │ ├── fancy.py │ └── readme.md ├── Farmer And His Plot (RECTSQ) │ ├── farmer.c │ ├── farmer.cpp │ ├── farmer.java │ ├── farmer.py │ └── readme.md ├── Farmer Feb (POTATOES) │ ├── farmer.c │ ├── farmer.java │ ├── farmer.py │ └── readme.md ├── Find Remainder (FLOW002) │ ├── readme.md │ ├── remainder.c │ ├── remainder.cpp │ ├── remainder.java │ └── remainder.py ├── Find Your Gift (GIFTSRC) │ ├── gift.cpp │ ├── gift.py │ └── readme.md ├── Find the Maximum Value (LOSTMAX) │ ├── maximum.py │ └── readme.md ├── Finding Square Roots (FSQRT) │ ├── fsqrt.c │ ├── fsqrt.cpp │ ├── fsqrt.java │ ├── fsqrt.py │ └── readme.md ├── First and Last Digit (FLOW004) │ ├── fl.cpp │ ├── fl.java │ ├── fl.py │ └── readme.md ├── Fit Squares in Triangle (TRISQ) │ ├── readme.md │ ├── squares.cpp │ ├── squares.java │ └── squares.py ├── FlatLand (ICL1902) │ ├── flatland.py │ └── readme.md ├── Food Chain │ ├── Food Chain Solution.md │ └── readme.md ├── Football (MSNSADM1) │ ├── football.py │ └── readme.md ├── Football Match (FBMT) │ ├── football.py │ └── readme.md ├── Forgotten Language (FRGTNLNG) │ ├── language.java │ ├── language.py │ └── readme.md ├── From heaven to earth (ELEVSTRS) │ ├── heaven.cpp │ ├── heaven.py │ └── readme.md ├── GCD and LCM (FLOW016) │ ├── gcdlcm.c │ ├── gcdlcm.cpp │ ├── gcdlcm.java │ ├── gcdlcm.py │ └── readme.md ├── Good Joke! (RRJOKE) │ ├── joke.cpp │ └── readme.md ├── Good and Bad Persons (GOODBAD) │ ├── goodbad.py │ └── readme.md ├── Grade The Steel (FLOW014) │ ├── readme.md │ ├── steel.c │ ├── steel.cpp │ ├── steel.java │ └── steel.py ├── Greedy puppy (GDOG) │ ├── greedypuppy.cpp │ ├── puppy.c │ ├── puppy.java │ ├── puppy.py │ └── readme.md ├── Gross Salary (FLOW011) │ ├── readme.md │ ├── salary.c │ ├── salary.cpp │ ├── salary.java │ └── salary.py ├── HOW MANY DIGITS DO I HAVE (HOWMANY) │ ├── digits.cpp │ ├── digits.cs │ ├── digits.java │ ├── digits.py │ ├── howmany.py │ └── readme.md ├── Hard sequence(HRDSEQ) │ └── Hard_sequence.java ├── Helping Chef (FLOW008) │ ├── chef.cpp │ ├── chef.java │ ├── chef.py │ └── readme.md ├── Highest divisor (HDIVISR) │ ├── highest_divisor.py │ └── readme.md ├── How much Scholarship (ZCOSCH) │ ├── readme.md │ ├── scholarship.cpp │ └── scholarship.py ├── IPL and RCB (CLIPLX) │ ├── rcb.cpp │ ├── rcb.py │ └── readme.md ├── Id and Ship (FLOW010) │ ├── readme.md │ ├── ship.cpp │ ├── ship.java │ └── ship.py ├── Is it a Cakewalk Problem │ ├── ISITCAKE.cpp │ ├── ISITCAKE.py │ └── readme.md ├── Is it a VOWEL or CONSONANT (VOWELTB) │ ├── readme.md │ ├── vowel.cpp │ ├── vowel.java │ └── vowel.py ├── J - Reached Safely Or Not (ZUBREACH) │ ├── J - Reached Safely Or Not.cpp │ ├── ZUBREACH.py │ └── readme.md ├── Judging Delay (JDELAY) │ ├── delay.py │ └── readme.md ├── Kitchen Timetable (KTTABLE) │ ├── kitchen.java │ ├── kitchen.py │ ├── kitchen_timetable.c │ └── readme.md ├── Laddu (LADDU) │ ├── Laddu (LADDU).cpp │ └── readme.md ├── Lapindromes (LAPIN) │ ├── Lapindromes.c │ ├── lapindromes.py │ └── readme.md ├── Lazy Jem (TALAZY) │ ├── lazy.py │ └── readme.md ├── Lost Weekends (LOSTWKND) │ ├── readme.md │ ├── weekends.cpp │ └── weekends.py ├── Lucky Four (LUCKFOUR) │ ├── luck4.java │ ├── lucky4.c │ ├── lucky4.cpp │ ├── lucky4.py │ └── readme.md ├── Mahasena (AMR15A) │ ├── mahasena.cpp │ ├── mahasena.java │ ├── mahasena.py │ └── readme.md ├── Making a Meal (CFMM) │ ├── making.cpp │ ├── making.py │ └── readme.md ├── Malvika is peculiar about color of balloons (CHN09) │ ├── balloon.c │ ├── balloon.java │ ├── balloon.py │ └── readme.md ├── Marathon (MARARUN) │ ├── README.md │ └── marathon.py ├── Mathison and pangrams (MATPAN) │ ├── mathison.cpp │ ├── mathison.py │ └── readme.md ├── Maximise the Sum (NOMATCH) │ ├── readme.md │ └── sum.cpp ├── Maximum Remaining (MAXREM) │ ├── maximum.c │ ├── maximum.py │ └── readme.md ├── Maximum Submissions │ └── Maximum_Submissions.rb ├── Medel (MDL) │ ├── medel.cpp │ ├── medel.py │ └── readme.md ├── Minimum Maximum (MNMX) │ ├── minmax.cpp │ ├── minmax.java │ ├── minmax.py │ └── readme.md ├── Movie Weekend (MOVIEWKN) │ ├── movie.py │ └── readme.md ├── Movie Weekends │ ├── MOVIEWKN.cpp │ └── readme.md ├── Multiple Choice Exam (EXAM1) │ ├── exam.cpp │ ├── exam.py │ └── readme.md ├── Mutated Minions (CHN15A) │ ├── minions.cpp │ ├── minions.java │ ├── minions.py │ └── readme.md ├── My very 1st contest! │ ├── README.md │ └── myvery1stcontest.py ├── Number Mirror (START01) │ ├── NumberMirror.cpp │ ├── mirror.c │ ├── mirror.java │ ├── mirror.py │ ├── mirror.rb │ └── readme.md ├── Packaging Cupcakes (MUFFINS3) │ ├── muffin.cpp │ ├── muffin.py │ └── readme.md ├── Palindromic substrings (STRPALIN) │ ├── palindrome.cpp │ ├── palindrome.py │ └── readme.md ├── Passing marks (PSGRADE) │ ├── README.md │ └── mark.py ├── Peak Finding (UWCOI20A) │ ├── finding.py │ └── readme.md ├── Phone Prices (S10E) │ ├── readme.md │ └── s10e.cpp ├── Piece of cake (LCH15JAB) │ ├── cake.py │ └── readme.md ├── Play Piano (PLAYPIAN) │ ├── piano.cpp │ ├── piano.py │ └── readme.md ├── Playing with Matches (MATCHES) │ ├── matches.cpp │ ├── matches.py │ └── readme.md ├── Playing with Strings (PLAYSTR) │ ├── playstr.py │ └── readme.md ├── Primality Test (PRB01) │ ├── prime.cpp │ ├── prime.java │ ├── prime.py │ └── readme.md ├── Print Pattern (PPATTERN) │ ├── pattern.c │ ├── pattern.cpp │ └── readme.md ├── Program Your Own CALCULATOR (URCALC) │ ├── calculator.cpp │ ├── calculator.cs │ ├── calculator.java │ ├── calculator.js │ ├── calculator.py │ ├── calculator.rb │ └── readme.md ├── Puppy and Sum (PPSUM) │ ├── puppy.c │ ├── puppy.java │ ├── puppy.py │ └── readme.md ├── Quentin Tarantino (KOL16J) │ ├── quentin.cpp │ └── readme.md ├── Random Pair (RNDPAIR) │ ├── randompair.py │ └── readme.md ├── Ranklist Pages │ └── Ranklist_Pages.rb ├── Reach the Target │ └── Reach_the_Target.rb ├── Rectangle (RECTANGL) │ ├── readme.md │ ├── rectangle.c │ ├── rectangle.cpp │ ├── rectangle.java │ └── rectangle.py ├── Reverse The Number (FLOW007) │ ├── readme.md │ ├── reverse.cpp │ ├── reverse.java │ ├── reverse.py │ └── reverse.rb ├── Say No To Drugs (NODRUGS) │ └── SayNoToDrugs.cpp.cpp ├── Second Largest (FLOW017) │ ├── readme.md │ ├── second.cpp │ ├── second.java │ └── second.py ├── Sed Sequences (SEDARR) │ ├── README.md │ └── sed_sequences.py ├── Similar Dishes (SIMDISH) │ ├── SimilarDishes.java │ ├── dishes.cpp │ ├── dishes.py │ └── readme.md ├── Simple Statistics (SIMPSTAT) │ ├── readme.md │ ├── statistics.java │ ├── statistics.py │ └── statistics.scala ├── Small Factorial (FLOW018) │ ├── readme.md │ ├── sFactorial.c │ ├── sFactorial.cpp │ ├── sFactorial.go │ └── sFactorial.py ├── Small factorials (FCTRL2) │ ├── factorial.c │ ├── factorial.cpp │ ├── factorial.java │ ├── factorial.py │ └── readme.md ├── Smallest Numbers of Notes (FLOW005) │ ├── notes.c │ ├── notes.cpp │ ├── notes.java │ ├── notes.py │ └── readme.md ├── Smart Strategy (SMRSTR) │ ├── readme.md │ └── smrstr.c ├── Snake Procession (SNAKPROC) │ ├── readme.md │ └── snake.py ├── Solubility (SOLBLTY) │ ├── README.md │ └── solubility.py ├── Speciality │ └── Speciality.rb ├── Split the Str Ing (SPLITIT) │ ├── README.md │ └── SPLITIT.cpp ├── Sticks (STICKS) │ ├── readme.md │ └── sticks.py ├── Strange Number (STRNO) │ ├── README.md │ └── StrangeNumber.java ├── Studying Alphabet (ALPHABET) │ ├── alphabet.cpp │ ├── alphabet.py │ └── readme.md ├── Sum OR Difference (DIFFSUM) │ ├── diffsum.c │ ├── diffsum.cpp │ ├── diffsum.java │ ├── diffsum.py │ ├── diffsum.rb │ └── readme.md ├── Sum Of Digits (FLOW006) │ ├── readme.md │ ├── sumofdigits.c │ ├── sumofdigits.cpp │ ├── sumofdigits.go │ ├── sumofdigits.java │ ├── sumofdigits.js │ └── sumofdigits.py ├── Sums in a Triangle (SUMTRIAN) │ ├── readme.md │ ├── triangle.java │ └── triangle.py ├── Tanu and Head-bob (HEADBOB) │ ├── headbob.cpp │ ├── headbob.java │ ├── headbob.py │ └── readme.md ├── Task for Alexey (ALEXTASK) │ ├── alextask.cpp │ └── readme.md ├── Temple Land (TEMPLELA) │ ├── readme.md │ └── temple.py ├── Testing Robot (TSTROBOT) │ ├── readme.md │ └── robot.py ├── The Block Game (PALL01) │ ├── block.cpp │ ├── block.java │ ├── block.py │ └── readme.md ├── The Cheaper Cab │ └── CABS_START33.rb ├── The Deadly Sin (SINS) │ ├── deadly.py │ └── readme.md ├── The Last Problem │ ├── code.cpp │ └── readme.md ├── The Lead Game (TLG) │ ├── readme.md │ ├── tlg.cpp │ ├── tlg.java │ └── tlg.py ├── The Preparations (SUPCHEF) ├── The Promised Land (ISHVALA) │ ├── ThePromisedLand.java │ └── readme.md ├── The Smallest Pair (SMPAIR) │ ├── readme.md │ ├── smallest.c │ ├── smallest.java │ └── smallest.py ├── Three Friends (THREEFR) │ ├── friends.cpp │ ├── friends.py │ └── readme.md ├── Three Way Communications (COMM3) │ ├── comm.java │ └── comm.py ├── Tickets (TICKETS5) │ ├── readme.md │ ├── tickets.cpp │ └── tickets.py ├── Total Expenses (FLOW009) │ ├── expense.cpp │ ├── expense.java │ ├── expense.py │ ├── expenses.c │ └── readme.md ├── Train Partner (ANKTRAIN) │ ├── readme.md │ └── train.py ├── Turbo Sort (TSORT) │ ├── readme.md │ ├── tsort.c │ ├── tsort.cpp │ ├── tsort.java │ └── tsort.py ├── Two Dishes (TWODISH) │ ├── readme.md │ └── twoDishes.cpp ├── Two Numbers (TWONMS) │ ├── readme.md │ ├── two.c │ ├── two.cpp │ ├── two.java │ └── two.py ├── Two vs Ten (TWOVSTEN) │ ├── readme.md │ ├── twovsten.c │ ├── twovsten.java │ └── twovsten.py ├── Valid Triangles (FLOW013) │ ├── readme.md │ ├── valid.c │ ├── valid.cpp │ ├── valid.java │ └── valid.py ├── Version Control System (VCS) │ ├── readme.md │ └── vcs.py ├── Villages and Tribes (VILTRIBE) │ ├── readme.md │ ├── village.cpp │ └── village.java ├── Weird Modulo Problem (EXUNA) │ ├── modulo.cpp │ └── readme.md ├── Whats in the Name (NITIKA) │ ├── name.js │ ├── name.py │ ├── readme.md │ └── whats_in_the_name.cpp ├── Who is taller! │ └── Who _is_taller!.rb ├── Workers (CHEFWORK) │ ├── chefwork.cpp │ ├── chefwork.go │ └── readme.md ├── Xenny and Alternating Tasks (XENTASK) │ ├── alternating.cpp │ ├── alternating.py │ └── readme.md ├── biryani-classes │ ├── README.md │ └── biryaniclsses.py └── total-prize-money │ ├── README.md │ └── total_prize_money.py ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── CodeChef starters 13 div 3 - Magical Doors ├── Code for Magical Doors in cpp.cpp └── README.md ├── Contests ├── August Long Challenge 2021 Division 3 │ ├── Array Filling (ARRFILL) │ │ ├── ARRFILL.cpp │ │ └── readme.md │ ├── Charge Scheduling (CHARGE) │ │ ├── CHARGE.cpp │ │ └── readme.md │ ├── Chef and Bulb Invention (CHFINVNT) │ │ ├── CHFINVNT.cpp │ │ ├── CHFINVNT.py │ │ └── readme.md │ ├── Olympics Ranking (OLYRANK) │ │ ├── OLYRANK.cpp │ │ ├── OLYRANK.py │ │ └── readme.md │ ├── Problem Difficulties (PROBDIFF) │ │ ├── PROBDIFF.cpp │ │ ├── PROBDIFF.java │ │ ├── PROBDIFF.py │ │ └── readme.md │ └── Special Triplets (SPCTRIPS) │ │ ├── SPCTRIPS.cpp │ │ ├── SPCTRIPS.java │ │ ├── SPCTRIPS.py │ │ └── readme.md ├── CODECHEF STARTERS 13 DIVISION 3 │ ├── Add and Divide │ │ ├── ADDNDIV.cpp │ │ └── README.md │ ├── Chef in Vaccination Queue │ │ ├── README.md │ │ ├── VACCINQ.cpp │ │ └── VACCINQ.py │ ├── Magical Doors │ │ ├── MAGDOORS.cpp │ │ ├── MAGDOORS.py │ │ └── README.md │ ├── Make that Array! │ │ ├── README.md │ │ └── SWAPGAME.cpp │ └── Maximum Light Up │ │ ├── DIWALI1.cpp │ │ └── README.md ├── Codechef Starters 10 Division 2 │ ├── Magical Flips.cpp │ └── Remove One Element.cpp ├── Codeforces #744 Div3 │ ├── Casimir's_String_Solitaire.cpp │ ├── Casimir's_String_Solitare.py │ └── Productivity Meeting.cpp ├── February_Challenge_2021_Division_3 │ ├── FROGS │ │ ├── FROGS.py │ │ └── README.md │ ├── MAXFUN │ │ ├── MAXFUN.cpp │ │ └── README.md │ ├── MEET │ │ ├── MEET.cpp │ │ └── README.md │ ├── PRIGAME │ │ ├── PRIGAME.cpp │ │ └── README.md │ └── TEAMNAME │ │ ├── README.md │ │ └── TEAMNAME.py ├── July Long Challenge 2021 Division 3 │ ├── 1_Maximum Production(EITA) │ │ ├── 1_Maximum Production.cpp │ │ └── readme.md │ ├── 2_Relativity (RELATIVE) │ │ ├── 2_Relativity.cpp │ │ └── readme.md │ ├── 3_XxOoRr(XXOORR) │ │ ├── 3_XxOoRr.cpp │ │ └── readme.md │ ├── 4_Optimal Denomination(MINNOTES) │ │ ├── 4_Optimal Denomination.cpp │ │ └── readme.md │ └── 5_Chef vs Bharat(CHEFORA) │ │ ├── 5_Chef vs Bharat.cpp │ │ └── readme.md ├── June Starters Div 3 │ ├── Chess_Match.py │ ├── Cyclic_Quadrilateral.py │ └── HTML_Tags.py ├── March Challenge Div 2 │ ├── Interesting XOR (IRSTXOR).cpp │ └── Space Arrays (SPACRARR).cpp ├── MarchCookOff │ ├── ConsecutiveDeletions .cpp │ └── Matrix_XOR.cpp ├── May Cook-off 2021 Div 3 │ ├── cook129c.cpp │ └── readme.md ├── NoChange(NOCHANGE) │ ├── nochange.cpp │ └── readme.md ├── RCB and Playoffs │ ├── Question.txt │ ├── README.md │ └── Solution.cpp ├── README.md ├── September Long Challenge 2021 Division 3 │ ├── 2-D Point Meeting (POINTMEE) │ │ ├── POINTMEE.cpp │ │ └── readme.md │ ├── Airline Restrictions (AIRLINE) │ │ ├── AIRLINE.cpp │ │ └── readme.md │ ├── Minimize Digit Sum (MNDIGSUM) │ │ ├── MNDIGSUM.cpp │ │ └── readme.md │ ├── Shuffling Parities (SHUFFLIN) │ │ ├── SHUFFLIN.py │ │ └── readme.md │ ├── Travel Pass (TRAVELPS) │ │ ├── TRAVELPS.cpp │ │ └── readme.md │ └── XOR Equal (PALINT) │ │ ├── PALINT.cpp │ │ └── readme.md ├── Starter 13 Div. 2 │ ├── Add and Divide │ │ └── ADDNDIV.cpp │ ├── Chef in Vaccination Queue │ │ ├── README.md │ │ └── VACCINQ.cpp │ ├── Interesting Pairs │ │ ├── DIVPAIRS.cpp │ │ └── README.md │ ├── Magical Doors │ │ ├── MAGDOORS.cpp │ │ └── README.md │ ├── Make that Array! │ │ ├── README.md │ │ └── SWAPGAME.cpp │ └── Maximum Light Up │ │ ├── DIWALI1.cpp │ │ └── README.md ├── Starters 14 Div 3 │ ├── BININVER │ ├── DIAGMOVE │ ├── RCBPLAY │ ├── RCBPLAY.py │ ├── TASKTIME.cpp │ ├── TASKTIME.py │ ├── TUPCOUNT.cpp │ └── fixfix.cpp ├── Starters 7 Div 3 │ ├── CEILSUM.py │ └── MAXARXOR.py ├── Starters11 Div. 2 │ ├── Obtain the Sum.cpp │ └── The Grid Fill Problem.cpp ├── Strong Language (SSCRIPT) │ ├── Readme.md │ └── SSCRIPT.py ├── Summer Heat (COCONUT) │ ├── COCONUT.py │ └── Readme.md ├── Tic Tac Toe (TCTCTOE) │ ├── Readme.md │ ├── TCTCTOE.py │ └── code.cpp ├── Tom And Jerry 1 (TANDJ1) │ ├── Readme.md │ └── TANDJ1.py ├── Two Dishes (TWODISHES) │ ├── Readme.md │ └── twodish.cpp ├── Vaccine Dates (VDATES) │ ├── Readme.md │ └── vdates.cpp ├── Worthy Matrix (KAVGMAT) │ ├── KAVGMAT.cpp │ └── Readme.md └── Yet another SOD problem (SOD3) │ ├── Readme.md │ └── sod3.cpp ├── Easy ├── 1 - Binary Distance │ ├── README.md │ └── sol.cpp ├── 1 - Make a Convex Polygon │ ├── README.md │ └── sol.cpp ├── A Weird Device (ICL1901) │ ├── device.c │ ├── device.cpp │ ├── device.java │ ├── device.py │ └── readme.md ├── ADTFraction │ └── ADTFraction.java ├── Ada Matrix(ADAMAT) │ └── ada_matrix.cpp ├── Add and Divide(ADDNDIV) │ ├── ADDNDIV.cpp │ ├── ADDNDIV.py │ └── Readme.md ├── Another Card Game Problem (CRDGAME3) │ ├── card.cpp │ ├── card.java │ ├── card.py │ └── readme.md ├── Antimatching (ANTMAT) │ ├── Antimatching.cpp │ └── readme.md ├── Array Rotation Returns │ └── ArrayRotationReturns.cpp ├── Array Swap │ └── ArraySwap.cpp ├── BILLRD │ └── BILLRD.cpp ├── Beautiful Pairs (BUTY PAIR) │ ├── BUTY_PAIR.cpp │ └── output.png ├── Beautiful Sequence Array (FREQARRY) │ └── frequency_array.cpp ├── Beautiful Triplets │ ├── Beautiful Triplets.cpp │ └── README.md ├── Bench Press(BENCHP) │ └── bench_press.cpp ├── Binary Concatenation │ ├── binary_concatenation.cpp │ ├── binary_concatenation.java │ └── binary_concatenation.py ├── Binary String on Steroids │ ├── Binary String on Steroids.cpp │ └── Readme.md ├── Birthday Gifts- (TWINGFT) │ ├── birthday.cpp │ ├── output.png │ └── problem_intro ├── Bowling Strategy │ └── Bowling Strategy.cpp ├── Buying Sweets ( BUYING2) │ ├── buying_sweets.cpp │ ├── buying_sweets.py │ └── readme.md ├── Carvans (CARVANS) │ ├── carvans.c │ ├── carvans.cpp │ ├── carvans.rb │ └── readme.md ├── Chang and Perfect Quadruples (CHNGSUM) │ ├── chang.py │ └── chang_quadruples.cpp ├── Chef And Apple Trees │ ├── Chef_And_Apple_Trees.cpp │ ├── Chef_And_Apple_Trees.py │ └── Chef_and_apple_trees.cpp ├── Chef and Div 3 │ └── div3.cpp ├── Chef and Rainbow Array(RAINBOWA) │ ├── RAINBOWA.py │ └── Readme.md ├── Chef and Work │ └── Chef and Work.cpp ├── Chess Match │ ├── Chess Match.cpp │ └── Readme.md ├── Ciel and A-B Problem (CIELAB) │ └── cielab.py ├── Coin Flip (CONFLIP) │ ├── CONFLIP.java │ ├── coinflip.cpp │ ├── coinflip.js │ ├── coinflip.py │ └── readme.md ├── College Life 2 │ ├── College Life 2.cpp │ └── Readme.md ├── Count Substrings │ ├── README.md │ ├── countSubstrings.java │ ├── countSubstrings.py │ └── output.png ├── Counting Pretty Numbers (NUM239) │ ├── code.cpp │ ├── pretty.c │ ├── pretty.py │ └── readme.md ├── DELSORT │ └── DELSORT.CPP ├── Decreasing Srrnmieeda (DECREM) │ ├── decrem.cpp │ └── readme.md ├── Deja Vu │ ├── Deja_vu.cpp │ └── readme.md ├── Diagonal movement(DIAGMOVE) │ ├── DIAGMOVE.cpp │ └── Readme.md ├── Distinct Codes (DISTCODE) │ ├── distinct.c │ ├── distinct.cpp │ ├── distinct.py │ └── readme.md ├── Dividing Stamps (DIVIDING) │ ├── dividing_stamps.cpp │ ├── dividing_stamps.py │ └── readme.md ├── Doctor Chef (DRCHEF) │ ├── doctor_chef.py │ ├── drchef.cpp │ └── readme.md ├── Double Distance Query(DDQUERY) │ ├── Double_Distance_Query.cpp │ ├── Double_Distance_Query.py │ └── readme.md ├── Eat Twice (EATTWICE) │ ├── eat.cpp │ ├── eat.py │ ├── eattwice.c │ └── readme.md ├── Even Matrix (EVENM) │ ├── code.cpp │ ├── even_matrix.c │ ├── evenmatrix.py │ └── readme.md ├── FIXFIX Starters codechef │ ├── FIXFIX.cpp │ └── Readme.md ├── Factorial (FCTRL) │ ├── factorial │ ├── factorial.c │ ├── factorial.cpp │ ├── factorial.java │ ├── factorial.js │ ├── factorial.php │ ├── factorial.py │ └── readme.md ├── Find Digits │ ├── Find Digits.js │ ├── Find digits.cpp │ └── README.md ├── Flappy Bird │ ├── Flappy Bird.cpp │ └── Readme.md ├── Frog Sort │ └── Frong_Sort.cpp ├── FromRationToBinary(RealBin │ └── Solution.cpp ├── GCD Operations (GCDOPS) │ ├── gcdops.cpp │ └── readme.md ├── Game of life │ ├── README.md │ ├── index.html │ └── sketch.js ├── Game on a Strip (ARRGAME) │ ├── arrgame.cpp │ └── readme.md ├── Hail XOR │ └── Hail_XOR.cpp ├── Help Martha │ └── Help Martha.cpp ├── Infinite Increments (INFTINCR) │ ├── Infinite_Increments.c │ ├── Infinite_Increments.cpp │ ├── Infinite_Increments.py │ └── readme.md.txt ├── K - balanced string │ ├── README.md │ └── kbalance.cpp ├── K-Concatenation │ ├── K-Concatenation.c │ ├── K-Concatenation.cpp │ ├── K-concatenation │ └── ReadME.md ├── K-Foldable String │ ├── K-Foldable String.cpp │ └── Readme.md ├── Life, the Universe, and Everything (TEST) │ ├── readme.md │ ├── test.c │ ├── test.c++ │ ├── test.go │ ├── test.java │ └── test.py ├── Logarithmic Equation (LOG_EQN) │ ├── logarithmic_equation.cpp │ └── logarithmic_euation.c ├── Matrix Problem │ └── MatrixProblem.cpp ├── Maximum Size(Problem code RISK) │ └── Maximum Size.cpp ├── Missing a Point (PTMISSING) │ ├── ptmissing.cpp │ ├── ptmissing.py │ └── readme.md ├── Nuclear Reactors (NUKES) │ ├── NuclearReactors.py │ ├── README.md │ └── output.png ├── Obtain The Sum (BIGARRAY) │ ├── Bigarray.cpp │ └── readme.md ├── Odd GCD (BININVER) │ ├── bininver.cpp │ └── bininver.md ├── PAIRDIST-Chef and Pairwise distance │ ├── PAIRDIST.cpp │ └── Readme.md ├── Please like me (PLSLYKME) │ ├── PLEASE LIKE ME.py │ └── README.md ├── Positive Prefixes │ └── Positive Prefixes.cpp ├── Positive Spewing(POSSPEW) │ ├── POSSPEW.cpp │ └── Readme.md ├── Prime Game │ └── Prime_game.cpp ├── Processing A String (KOL15A) │ └── processing_a_string.py ├── Processing a string (KOL15A) │ ├── Processing.java │ ├── readme.md │ └── solution.cpp ├── Racing Horses (HORSES) │ ├── HORSES.py │ └── Readme.md ├── Ready Bitwise (REBIT) │ ├── Ready_Bitwise.c │ ├── Ready_Bitwise.cpp │ ├── Ready_Bitwise.py │ └── readme.md ├── Red-blue Trees │ └── Red-blue Trees.cpp ├── Root the Tree (ROOTTREE) │ ├── readme.md │ ├── roottree.cpp │ └── roottree.java ├── Sleep Cycle │ ├── Readme.md │ └── Sleep Cycle.cpp ├── Small Factorial │ └── Small Factorials.cpp ├── Smallest KMP (SKMP) │ ├── readme.md │ ├── smallest_kmp.cpp │ └── smallest_kmp.py ├── Space Arrays │ └── Space_Arrays.cpp ├── Special Triplets │ ├── readme.md │ └── specialtriplets.cpp ├── Splitting Candies │ ├── readme.md │ ├── spcandy.cpp │ └── spcandy.py ├── Stacks of Disc │ ├── README.md │ └── answer.py ├── Team Name │ └── Team_Name.cpp ├── The Best Box (J7) │ ├── box.c │ ├── box.cpp │ ├── box.py │ └── readme.md ├── Transform the Expression │ ├── README.md │ └── transform_the_expression.cpp ├── Unpleasant Ones (UNONE) │ ├── ones.cpp │ └── readme.md ├── Weight Balance (WEIGHTBL) │ └── README.md ├── Weird Competition(WEICOM) │ └── weird_competition.cpp ├── Weird Walk │ ├── readme.md │ └── weird walk.cpp ├── chef in the heaven │ └── Chef in Heaven.java ├── diwali1 │ └── diwali1.cpp └── nth smallest │ └── BinarySearchTree.java ├── Hard ├── Arithmetic Progressions (COUNTARI) │ ├── arithmetic_progressions.c │ ├── arithmetic_progressions.cpp │ └── readme.md ├── Big Search Trees (BIGTREE) │ ├── Big_search_trees.cpp │ └── readme.md ├── Dynamic GCD (DGCD) │ ├── dynamic_gcd.cpp │ ├── dynamic_gcd.java │ └── readme.md ├── Ordering the Soldiers (ORDERS) │ ├── orderingSoldiers.cpp │ ├── orders.java │ └── readme.md └── Overlapping discs │ ├── overlapping_discs.cpp │ └── readme.md ├── ImportantResource.md ├── LICENSE ├── MORE CODING PLATFORMS ├── Codeforces │ ├── 1401 D Maximum Distributed Tree │ │ └── 1401 D Maximum Distributed Tree.cpp │ ├── 1546 C AquaMoon and Strange Sort │ │ └── 1546 C AquaMoon and Strange Sort.cpp │ ├── 1550 C Manhattan Subarrays │ │ └── 1550 C Manhattan Subarrays.cpp │ ├── Array Optimization by Deque.cpp │ ├── Average height │ │ ├── Average height.cpp │ │ └── readme.md │ ├── Balanced Substring │ │ ├── Balanced substring.cpp │ │ └── readme.md │ ├── CQXYM Count Permutations │ │ └── CQXYM Count Permutations.cpp │ ├── Carrying Corundrum │ │ ├── index.cpp │ │ └── readme.md │ ├── Casimir's String Solitaire │ │ ├── Casimir's string solitaire.cpp │ │ └── readme.md │ ├── Chocolates │ │ ├── Chocolates.cpp │ │ └── README.md │ ├── Countdown │ │ ├── Countdown.cpp │ │ └── readme.md │ ├── Diameter of Graph │ │ └── Diameter of Graph.cpp │ ├── Domino Disaster │ │ ├── Domino Disaster.cpp │ │ └── readme.md │ ├── Permutation Minimization By Deque │ │ ├── permutation minimization by deque.cpp │ │ └── readme.md │ ├── Permutation Minimization by Deque │ │ └── Permutation Minimization by Deque.CPP │ ├── Polycarp and Coins │ │ ├── Polycarp and coins.cpp │ │ └── readme.md │ ├── Portal │ │ └── Portal.cpp │ ├── Productive Meeting │ │ └── Productive Meeting.cpp │ ├── README.md │ ├── Regular Bracket Sequences │ │ ├── Regular Bracket sequences.cpp │ │ └── readme.md │ ├── Songs Compression │ │ ├── ReadMe.md │ │ └── Songs_Compression.cpp │ ├── The Strongest Build │ │ ├── Readme.md │ │ └── code.cpp │ ├── Ticks │ │ ├── readme.md │ │ └── ticks.cpp │ ├── Young Physicist │ │ ├── README.md │ │ └── Young Physicist.cpp │ └── vanyaAndTheLanterns │ │ ├── README.md │ │ ├── a.exe │ │ ├── vanyaAndTheLanterns.cpp │ │ └── vanyaAndTheLanterns.py ├── Codewars │ └── README.md ├── Hackerearth │ ├── Data Structures and Algorithms │ │ ├── Boring not Boring Problem.cpp │ │ ├── Gift for Almas.cpp │ │ └── Segments maybe Super Segments.cpp │ ├── Math │ │ ├── Alice_and_candies.cpp │ │ ├── Archery.cpp │ │ ├── Mancunian_and_Pandigital_Numbers.cpp │ │ └── Rhezo_and_Big_Powers.cpp │ ├── October Easy '21 │ │ └── Good String.cpp │ └── README.md ├── Hackerrank │ ├── Array Manipulation │ │ ├── array_manipulation.cpp │ │ └── readme.md │ ├── Attribute Parser │ │ ├── attribute_parser.cpp │ │ └── readme.md │ ├── Class │ │ ├── class.cpp │ │ └── readme.md │ ├── Extra Long Factorials │ │ ├── extra_long_facorials.cpp │ │ └── readme.md │ ├── FizzBuzz │ │ ├── FizzBuzz.cpp │ │ └── readme.md │ ├── For_Loop │ │ └── ForLoop.cpp │ ├── Functions │ │ ├── functions.cpp │ │ └── readme.md │ ├── Jumping On Clouds Revisited │ │ ├── Jumping on the Cloudcpp.cpp │ │ └── readme.md │ ├── Operators │ │ └── Operators.cpp │ ├── Pointer │ │ └── Pointer.cpp │ ├── README.md │ ├── String Construction │ │ ├── README.md │ │ └── solution.cpp │ ├── StringStream │ │ ├── readme.md │ │ └── string_stream.cpp │ ├── Strings │ │ ├── readme.md │ │ └── strings.cpp │ ├── Structs │ │ ├── readme.md │ │ └── structs.cpp │ ├── Vector │ │ └── vector_sort.cpp │ └── Word_Order │ │ └── Word_Order.py ├── InterviewBit │ ├── Burn a Tree │ │ ├── Burn a Tree.cpp │ │ └── README.md │ ├── Implement Power Function │ │ ├── Implement Power Function.CPP │ │ └── README.md │ ├── Integer To Roman │ │ ├── Integer To Roman.CPP │ │ └── README.md │ └── Max Depth of Binary Tree │ │ ├── Max Depth of a Binary Tree.cpp │ │ └── README.md ├── LeetCode │ ├── 3Sum │ │ ├── 3sum_Readme.md │ │ └── 3sum_Solution.java │ ├── Best Time to Buy and Sell Stock II │ │ ├── README.md │ │ └── Solution.cpp │ ├── Best Time to Buy and Sell Stock │ │ ├── README.md │ │ └── solution.cpp │ ├── Climbing Stairs │ │ ├── README.md │ │ └── Solution.cpp │ ├── Container With Most Water │ │ ├── Container With Most Water.CPP │ │ └── README.md │ ├── Count And Say │ │ ├── README.md │ │ └── solution.cpp │ ├── Fibonacci Number (Dynamic Programming) │ │ ├── readme.md │ │ └── solution.cpp │ ├── Find First and Last Position of Element in Sorted Array │ │ ├── README.md │ │ └── Solution.cpp │ ├── Find Numbers with Even Number of Digits │ │ ├── README.md │ │ └── solution.java │ ├── Is Subsequence │ │ ├── Readme.md │ │ └── solution.cpp │ ├── Jump Game III │ │ ├── README.md │ │ └── solution.java │ ├── Jump Game │ │ ├── README.md │ │ └── solution.cpp │ ├── Longest Uncommon Subsequence II │ │ ├── README.md │ │ └── solution.cpp │ ├── Longest Valid Parentheses │ │ ├── README.md │ │ └── solution.cpp │ ├── Median of two sorted array │ │ ├── README.md │ │ └── Solution.cpp │ ├── Merge Intervals │ │ ├── README.md │ │ └── solution.cpp │ ├── Minimum Deletions to Make Character Frequencies Unique │ │ ├── README.md │ │ └── solution.java │ ├── Next Permutation │ │ ├── README.md │ │ └── solution.cpp │ ├── Prime Arrangements │ │ ├── README.md │ │ └── solution.cpp │ ├── README.md │ ├── Reverse An Integer │ │ ├── README.md │ │ └── solution.cpp │ ├── Rotting Oranges │ │ ├── readme.md │ │ └── solution.cpp │ ├── Text Justification │ │ ├── README.md │ │ └── Solution.cpp │ ├── Trapping Rain Water │ │ ├── README.md │ │ └── solution.cpp │ └── ZigZag Conversion │ │ ├── README.md │ │ └── ZigZag Conversion.CPP └── SPOJ │ ├── Crucial Equation (CEQU) │ ├── Crucial Equation.cpp │ └── README.md │ ├── README.md │ └── The last digit (LASTDIG) │ ├── README.md │ └── lastdig.cpp ├── Medium ├── A Counting Problem(COUNTA) │ ├── COUNTA.cpp │ └── Readme.md ├── ABC-Strings (ABCSTR) │ ├── ABC-Strings.cpp │ └── Readme.md ├── Alphabets in order with numbers │ └── alphabets.py ├── Array Rotation Returns (ARRT) │ ├── Array_Rotation_Returns(ARRT).cpp │ └── Question.md ├── Array rotation │ └── Array Rotation.java ├── Boolean Game │ ├── Readme.md │ └── boolean.cpp ├── Bytelandian gold coins (COINS) │ ├── Bytelandian_gold_coins.c │ ├── coins.cpp │ ├── coins.java │ ├── coins.py │ └── readme.md ├── Chef and Cube │ ├── Chef and Cube Solution.md │ └── readme.md ├── Chef and Laddus for Children │ ├── READme.md │ └── chef_and_laddus ├── Compress all Subsegments (SEGCOMPR) │ └── compress_all_subsegments.cpp ├── Dividing into Regions (REGIONS) │ └── dividing_into_regions.cpp ├── Dual Nim (TWONIM) │ ├── dual_nim.cpp │ ├── dual_nim.java │ ├── dual_nim.py │ └── readme.md ├── Flipping Coins(FLIPCOIN) │ ├── Flipping Coins.py │ ├── flipcoin.cpp │ └── readme.md ├── Graph Labelling │ ├── Graph_labelling.cpp │ └── readme.md ├── Guess my Age (GUESSAGE) │ ├── guess_my_age.cpp │ └── readme.md ├── Increasing Xor Sequence(INCXOR) │ ├── incxor.cpp │ └── readme.md ├── Integer Sequences (SEQUENCE) │ ├── integer_sequences.cpp │ └── readme.md ├── Knapsack Problem(KNPSK) │ ├── knpsk.cpp │ └── readme.md ├── Kth Numbers (KTH97) │ └── kth_numbers.cpp ├── Little Elephant and Filling (LUCKFILL) │ └── Little_elephant_and_filling.cpp ├── Marbles(MARBLES) │ ├── marbles.cpp │ └── readme.md ├── Online Shopping (COUPON) │ └── code.cpp ├── Optical Denomination │ ├── Optical Denomination.md │ └── readme.md ├── Optimal Splitting(OPTSPL) │ └── optimal_splitting.cpp ├── Palindromes Machine (PALMACH) │ ├── Palindromes_Machine.cpp │ └── readme.md ├── Paths (CLTREE) │ └── paths.cpp ├── Professors De (PROFDE) │ ├── professors_de.cpp │ ├── professors_de.py │ └── readme.md ├── Root of the Problem(TREEROOT) │ ├── readme.md │ ├── treeroot.cpp │ └── treeroot.py ├── Shift The String(TASHIFT) │ ├── README.md │ ├── TASHIFT.c │ ├── TASHIFT.cpp │ ├── TASHIFT.java │ └── TASHIFT.py ├── Sorting Vases (SORTVS) │ ├── Sorting_vases.py │ └── readme.md ├── Special Power Strings │ └── special_power_strings.cpp ├── SudokuX (J1) │ └── sudoku_x.cpp ├── The Illusionist (PROC18F) │ ├── readme.md │ └── the_illusionist.cpp ├── The Kingdom of Ererraveth (CLERVT) │ └── the_kingdom_of_ererraveth.cpp ├── The Reverse Game(REVGAME) │ ├── Readme.md │ └── The_Reverse_Game.py └── bench press │ └── Bench Press.java ├── October Challenge 2021 div 3 - Longest AND Subarray ├── README.md └── october challenge 2021 div3-longest AND subarray solution.cpp ├── October challenge 2021 div 3 - THREE BOXES ├── README.md └── october challenge 2021 div3-three boxes solution.cpp ├── README.md ├── RECOURCES.md ├── September Lunchtime 2021 div 3 - Prefix Sums ├── README.md └── september lunchtime div3-prefix sums.cpp └── Ticket_Fine.py /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/workflows/greetings.yml: -------------------------------------------------------------------------------- 1 | name: Greetings 2 | 3 | on: [issues] 4 | 5 | jobs: 6 | greeting: 7 | runs-on: ubuntu-latest 8 | permissions: 9 | issues: write 10 | steps: 11 | - uses: actions/first-interaction@v1 12 | with: 13 | repo-token: ${{ secrets.GITHUB_TOKEN }} 14 | issue-message: 'Hello, Thank You for raising this Issue. Our Team will look into the issue and discuss with you' 15 | -------------------------------------------------------------------------------- /.mergify.yml: -------------------------------------------------------------------------------- 1 | pull_request_rules: 2 | - name: Automatic comment on approval 3 | conditions: 4 | - "#approved-reviews-by>=1" 5 | actions: 6 | comment: 7 | message: Hello there, Happy Hacktoberfest. Dont't forget to :star:! the repo. -------------------------------------------------------------------------------- /ALGORITHMS/Array/Java/1. Sum of elements/Main.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | class Solution { 4 | public static ArrayList sum(int arr[], int n) { 5 | // code here 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /ALGORITHMS/Array/Java/1. Sum of elements/readme.md: -------------------------------------------------------------------------------- 1 | ## Problem 2 | Given an array **arr** of size **n** (*integers*)
Your task is to find and return the **sum** of all elements in the array. 3 | 4 | ### Example 1 5 | ``` 6 | Input: 7 | n = 6 8 | arr[] = {3, 10, 1, 56, 2, 25} 9 | Output: 10 | sum = 97 11 | ``` 12 | ### Example 2 13 | ``` 14 | Input: 15 | n = 5 16 | arr[] = {1, 3, -2, 20, -5} 17 | Output: 18 | sum = 17 19 | ``` 20 | -------------------------------------------------------------------------------- /ALGORITHMS/Array/Java/2. Find the Duplicates/Main.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | class Solution { 4 | public static ArrayList duplicates(int arr[], int n) { 5 | // code here 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /ALGORITHMS/Array/Java/2. Find the Duplicates/readme.md: -------------------------------------------------------------------------------- 1 | ## Problem 2 | Given an array **arr** of size **n** of integers.
Your task is to find the **duplicate** elements in the array. 3 | 4 | ### Example 1 5 | ``` 6 | Input: 7 | n = 6 8 | arr[] = {3, 167, 1, 56, 1, 167} 9 | Output: 10 | {1, 167} 11 | ``` 12 | ### Example 2 13 | ``` 14 | Input: 15 | n = 5 16 | arr[] = {1, 345, 234, 21, 56789} 17 | Output: 18 | -1 19 | ``` 20 | -------------------------------------------------------------------------------- /ALGORITHMS/Array/Kadane's Algorithm/Kadane's Algo.js: -------------------------------------------------------------------------------- 1 | const arr = [-2, 1, -3, 4, -1, 2, 1, -5, 4]; 2 | const maxSequence = (arr = []) => { 3 | let currentSum = 0 4 | let maxSum = 0 5 | 6 | for (let elem of arr) { 7 | const nextSum = currentSum + elem 8 | maxSum = Math.max(maxSum, nextSum) 9 | currentSum = Math.max(nextSum, 0) 10 | } 11 | 12 | return maxSum 13 | }; 14 | console.log(maxSequence(arr)); 15 | -------------------------------------------------------------------------------- /ALGORITHMS/Array/Kadane's Algorithm/readme.md: -------------------------------------------------------------------------------- 1 | # Kadane's Algorithm 2 | 3 | Codes available in C++ and JavaScript. 4 | -------------------------------------------------------------------------------- /ALGORITHMS/Array/Kadane's algorithm(subarray) python/README.md: -------------------------------------------------------------------------------- 1 | > Sample input : arr = [-2, -3, 4, -1, -2, 5, -3] -------------------------------------------------------------------------------- /ALGORITHMS/Array/Merge Two Sorted Array/readme.md: -------------------------------------------------------------------------------- 1 | # Merge Two Sorted Array -------------------------------------------------------------------------------- /ALGORITHMS/Array/Three Sum Problem/readme.md: -------------------------------------------------------------------------------- 1 | # Three Sum Problem -------------------------------------------------------------------------------- /ALGORITHMS/Backtracking/Knapsack Problem/readme.md: -------------------------------------------------------------------------------- 1 | # Knapsack Problem -------------------------------------------------------------------------------- /ALGORITHMS/Backtracking/N Queen Problem/readme.md: -------------------------------------------------------------------------------- 1 | # N Queen Problem -------------------------------------------------------------------------------- /ALGORITHMS/Backtracking/README.md: -------------------------------------------------------------------------------- 1 | # Backtracking -------------------------------------------------------------------------------- /ALGORITHMS/Backtracking/Rat In A Maze Problem/readme.md: -------------------------------------------------------------------------------- 1 | # Rat in a maze -------------------------------------------------------------------------------- /ALGORITHMS/Bit Algorithms/Count Total Set Bits/readme.md: -------------------------------------------------------------------------------- 1 | #Count Total Set Bits 2 | This algorithm counts total number of set bits in the binary representation of all the numbers from 1 to n. -------------------------------------------------------------------------------- /ALGORITHMS/Bit Algorithms/README.md: -------------------------------------------------------------------------------- 1 | # Bit Algorithms -------------------------------------------------------------------------------- /ALGORITHMS/Dynamic Programming/Dice Combinations/readme.md: -------------------------------------------------------------------------------- 1 | The Dice problem is a problem in which we have to find out the nuumber of ways to generatea sum *n* by throwing a dice 1 or more than one types. -------------------------------------------------------------------------------- /ALGORITHMS/Dynamic Programming/Minimising Coins problem/readme.md: -------------------------------------------------------------------------------- 1 | This problem involves us to use *n* coins to get a sum of *x*, we have to find out the minimum number of coins needed to be used to get *x* -------------------------------------------------------------------------------- /ALGORITHMS/GCD/Euclidean Algorithm/EuclidAlgorithm.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int gcd(int a, int b) { 5 | 6 | while(b != 0) { 7 | int rem = a%b; 8 | a = b; 9 | b = rem; 10 | } 11 | return a; 12 | } 13 | 14 | int main() { 15 | int a,b; 16 | cin >> a >> b; 17 | cout << gcd(a, b) << endl; 18 | return 0; 19 | } -------------------------------------------------------------------------------- /ALGORITHMS/GCD/Euclidean Algorithm/readme.md: -------------------------------------------------------------------------------- 1 | # Euclidean algorithm -------------------------------------------------------------------------------- /ALGORITHMS/GCD/Sieve of Eratosthenes/readme.md: -------------------------------------------------------------------------------- 1 | # Sieve of Eratosthenes -------------------------------------------------------------------------------- /ALGORITHMS/Graph/Prim's Algorithm/readme.md: -------------------------------------------------------------------------------- 1 | # Prim's Algorithm -------------------------------------------------------------------------------- /ALGORITHMS/Graph/README.md: -------------------------------------------------------------------------------- 1 | # Graph -------------------------------------------------------------------------------- /ALGORITHMS/Greedy/README.md: -------------------------------------------------------------------------------- 1 | # Greedy Algorithms 2 | -------------------------------------------------------------------------------- /ALGORITHMS/Hashing/README.md: -------------------------------------------------------------------------------- 1 | # Hashing -------------------------------------------------------------------------------- /ALGORITHMS/Heap/README.md: -------------------------------------------------------------------------------- 1 | # Heap -------------------------------------------------------------------------------- /ALGORITHMS/Linked List/Level Order Traversal/readme.md: -------------------------------------------------------------------------------- 1 | # Level Order Traversal -------------------------------------------------------------------------------- /ALGORITHMS/Linked List/Merge Two Sorted LinkedList/readme.md: -------------------------------------------------------------------------------- 1 | # Merge Two Sorted LinkedList -------------------------------------------------------------------------------- /ALGORITHMS/Linked List/Put Even After Odd LinkedList/readme.md: -------------------------------------------------------------------------------- 1 | # Put Even After Odd LinkedList -------------------------------------------------------------------------------- /ALGORITHMS/Linked List/README.md: -------------------------------------------------------------------------------- 1 | # Linked List -------------------------------------------------------------------------------- /ALGORITHMS/Linked List/Sum Of Nodes At kth Level/readme.md: -------------------------------------------------------------------------------- 1 | # Sum Of Nodes At kth Level -------------------------------------------------------------------------------- /ALGORITHMS/Linked List/Tortoise-Hare Algorithm/readme.md: -------------------------------------------------------------------------------- 1 | # Tortoise-Hare Algorithm -------------------------------------------------------------------------------- /ALGORITHMS/Mathematical Algorithms/Count_digits.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define ll long long 3 | using namespace std; 4 | long long digits(int n) 5 | { 6 | return floor(log10(n)+1); 7 | } 8 | int main(){ 9 | int n; 10 | cin>>n; 11 | cout< 2 | #define ll long long 3 | using namespace std; 4 | long long factorial(int n) 5 | { 6 | if(n==0) 7 | { 8 | return 1; 9 | } 10 | return n*factorial(n-1); 11 | } 12 | int main(){ 13 | int n; 14 | cin>>n; 15 | cout< 2 | #define ll long long 3 | using namespace std; 4 | long long gcd(int a,int b) 5 | { 6 | if(b==0) 7 | { 8 | return a; 9 | } 10 | return gcd(b,a%b); 11 | } 12 | int main() 13 | { 14 | int n,m; 15 | cin >> n>>m; 16 | cout << gcd(n,m) << endl; 17 | return 0; 18 | } -------------------------------------------------------------------------------- /ALGORITHMS/Mathematical Algorithms/Sieve of Eratosthenes/readme.md: -------------------------------------------------------------------------------- 1 | # Sieve of Eratosthenes 2 | This algorithm finds all the prime numbers less than or equal to a given number n. -------------------------------------------------------------------------------- /ALGORITHMS/Mathematical Algorithms/count_digits.py: -------------------------------------------------------------------------------- 1 | #return digit count as int for positive numbers 2 | #return digit count +1 (extra 1 for - sign) for negative numbers 3 | def count_digits(n): 4 | if n < 0: 5 | n = n*-10 # for negative numbers. - sign will be counted as a digit 6 | if n < 10 and n >= 0: 7 | return 1 8 | else: 9 | return 1+count_digits(n//10) 10 | -------------------------------------------------------------------------------- /ALGORITHMS/Mathematical Algorithms/factorial.py: -------------------------------------------------------------------------------- 1 | #return factorical for whole numbers as int 2 | #return ValueError for negative numbers 3 | def factorial(n): 4 | if n >= 0: 5 | if n == 1 or n == 0: 6 | return 1 7 | else: 8 | return n*factorial(n-1) 9 | else: 10 | raise ValueError 11 | -------------------------------------------------------------------------------- /ALGORITHMS/Mathematical Algorithms/gcd.py: -------------------------------------------------------------------------------- 1 | #return hcf(or gcd) of 2 numbers as int 2 | def gcd(a, b): 3 | if a == 0: 4 | return b 5 | elif b == 0: 6 | return a 7 | elif a == b: 8 | return a 9 | elif a > b: 10 | return gcd(a-b, b) 11 | else: 12 | return gcd(a, b-a) 13 | -------------------------------------------------------------------------------- /ALGORITHMS/Mathematical Algorithms/lcm.py: -------------------------------------------------------------------------------- 1 | #return lcm of 2 numbers as int 2 | def lcm(a, b): 3 | def gcd(a, b): 4 | if a == 0: 5 | return b 6 | elif b == 0: 7 | return a 8 | elif a == b: 9 | return a 10 | elif a > b: 11 | return gcd(a-b, b) 12 | else: 13 | return gcd(a, b-a) 14 | 15 | lcm = (a*b)//gcd(a, b) 16 | return lcm 17 | -------------------------------------------------------------------------------- /ALGORITHMS/Matrix/README.md: -------------------------------------------------------------------------------- 1 | # Matrix -------------------------------------------------------------------------------- /ALGORITHMS/Memory/README.md: -------------------------------------------------------------------------------- 1 | # Memory Allocation 2 | -------------------------------------------------------------------------------- /ALGORITHMS/Queue/README.md: -------------------------------------------------------------------------------- 1 | # Queue -------------------------------------------------------------------------------- /ALGORITHMS/Queue/Sliding Window Maximum Using Dequeue/readme.md: -------------------------------------------------------------------------------- 1 | # Sliding Window Maximum Using Deque -------------------------------------------------------------------------------- /ALGORITHMS/README.md: -------------------------------------------------------------------------------- 1 | # ALGORITHMS 2 | 3 | ## How to add an Algorithm? 4 | 5 | * Create a folder for the algorithm if it doesn't already exists. 6 | * Create a Readme.md file inside the folder and add the Algorithm name (and description if needed). 7 | * Add the algorithm with proper language extension. 8 | -------------------------------------------------------------------------------- /ALGORITHMS/Reccursion/Factorial/Factorial.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int factorial(int n) { 5 | if (n > 1) n *= factorial(n - 1); 6 | 7 | return n; 8 | } 9 | 10 | int main() { 11 | int n; 12 | cin >> n; 13 | 14 | cout << factorial(n) << endl; 15 | 16 | return 0; 17 | } 18 | 19 | // Complexity of the above program is O(n) -------------------------------------------------------------------------------- /ALGORITHMS/Reccursion/Factorial/Factorial.py: -------------------------------------------------------------------------------- 1 | def factorial(n): 2 | if (n > 1): 3 | n *= factorial(n - 1) 4 | return n 5 | 6 | n = int(input()) 7 | 8 | print(factorial(n)) 9 | 10 | # Complexity of the above program is O(n) -------------------------------------------------------------------------------- /ALGORITHMS/Reccursion/Factorial/readme.md: -------------------------------------------------------------------------------- 1 | This folder contains code for calculating factorials using recursion. -------------------------------------------------------------------------------- /ALGORITHMS/Reccursion/Fibonacci Sequence/Fibonacci Sequence.py: -------------------------------------------------------------------------------- 1 | def fibo(n): 2 | if 1 >= n: 3 | return n 4 | else: 5 | return fibo(n - 1) + fibo(n - 2) 6 | 7 | n = int(input()) 8 | print(fibo(n)) -------------------------------------------------------------------------------- /ALGORITHMS/Reccursion/Fibonacci Sequence/readme.md: -------------------------------------------------------------------------------- 1 | This folder contains codes for calculating nth term of fibonacci sequence using recursion. -------------------------------------------------------------------------------- /ALGORITHMS/Reccursion/NQueens/readme.md: -------------------------------------------------------------------------------- 1 | #N-Queens 2 | The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. -------------------------------------------------------------------------------- /ALGORITHMS/Reccursion/Tower Of Hanoi/readme.md: -------------------------------------------------------------------------------- 1 | # Tower of Hanoi -------------------------------------------------------------------------------- /ALGORITHMS/Searching/Binary Search/BinarySearch.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func bubbleSort(arr []int) []int { 4 | swapped := true 5 | for swapped { 6 | swapped = false 7 | for i := 0; i < len(arr)-1; i++ { 8 | if arr[i+1] < arr[i] { 9 | arr[i+1], arr[i] = arr[i], arr[i+1] 10 | swapped = true 11 | } 12 | } 13 | } 14 | return arr 15 | } 16 | -------------------------------------------------------------------------------- /ALGORITHMS/Searching/Linear Search/LinearSearch.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func Linear(array []int, query int) int { 4 | for i, item := range array { 5 | if item == query { 6 | return i 7 | } 8 | } 9 | return -1 10 | } 11 | -------------------------------------------------------------------------------- /ALGORITHMS/Searching/Linear Search/LinearSearch.py: -------------------------------------------------------------------------------- 1 | 2 | def search(arr, n, x): 3 | 4 | for i in range(0, n): 5 | if (arr[i] == x): 6 | return i 7 | return -1 8 | 9 | 10 | 11 | arr = [2, 31, 4, 10, 45] 12 | x = 10 13 | n = len(arr) 14 | 15 | 16 | result = search(arr, n, x) 17 | if(result == -1): 18 | print("Element is not present in array") 19 | else: 20 | print("Element is present at index", result) 21 | -------------------------------------------------------------------------------- /ALGORITHMS/Searching/Linear Search/readme.md: -------------------------------------------------------------------------------- 1 | # LinearSearch -------------------------------------------------------------------------------- /ALGORITHMS/Searching/README.md: -------------------------------------------------------------------------------- 1 | # Searching Algorithms -------------------------------------------------------------------------------- /ALGORITHMS/Searching/Ternary Search/TernarySearch.md: -------------------------------------------------------------------------------- 1 | **Ternary Search** 2 | 3 | The Ternary Search is an improvement over Binary Search where array is divided into three parts instead of two parts. The array can be divided into three parts using mid1 and mid2. 4 | Time complexity: O(log3n) 5 | -------------------------------------------------------------------------------- /ALGORITHMS/Sorting/Bubble Sort/readme.md: -------------------------------------------------------------------------------- 1 | 2 | # BubbleSort 3 | Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order.\ 4 | Time Complexity of this algorithm is O(n²). 5 | -------------------------------------------------------------------------------- /ALGORITHMS/Sorting/Count Sort/readme.md: -------------------------------------------------------------------------------- 1 | # CountSort 2 | 3 | ## Counting sort is a sorting technique based on keys between a specific range. It works by counting the number of objects having distinct key values (kind of hashing). Then doing some arithmetic to calculate the position of each object in the output sequence. 4 | -------------------------------------------------------------------------------- /ALGORITHMS/Sorting/Dnf Sort/readme.md: -------------------------------------------------------------------------------- 1 | # dnfSort -------------------------------------------------------------------------------- /ALGORITHMS/Sorting/HeapSort/readme.md: -------------------------------------------------------------------------------- 1 | # Heap Sort 2 | Heap sort is an in-place sorting algorithm. It is the representation of binary heap in the form of an array.\ 3 | Time Complexity is O(nlogn). 4 | -------------------------------------------------------------------------------- /ALGORITHMS/Sorting/Insertion Sort/insertionSort.py: -------------------------------------------------------------------------------- 1 | def insertionSort(arr): 2 | for i in range(1, len(arr)): 3 | key = arr[i] 4 | j = i - 1 5 | while j >= 0 and key < arr[j] : 6 | arr[j + 1] = arr[j] 7 | j -= 1 8 | arr[j + 1] = key 9 | 10 | 11 | lst = [1, 2, 3, 5, 4] 12 | insertionSort(lst) 13 | # since lists are mutable 14 | # the main list itself changes 15 | print(lst) -------------------------------------------------------------------------------- /ALGORITHMS/Sorting/Insertion Sort/readme.md: -------------------------------------------------------------------------------- 1 | # InsertionSort -------------------------------------------------------------------------------- /ALGORITHMS/Sorting/MergeSort/readme.md: -------------------------------------------------------------------------------- 1 | # Merge Sort 2 | Mergesort is a divide and conquer algorithm that was invented by John von Neumann in 1945. 3 | 4 | It recursively divides the input array into two halves, calls itself for the two halves, and then merges the two sorted halves. 5 | 6 | Time Complexity is O(nlogn). -------------------------------------------------------------------------------- /ALGORITHMS/Sorting/README.md: -------------------------------------------------------------------------------- 1 | # SORTING ALGORITHMS 2 | -------------------------------------------------------------------------------- /ALGORITHMS/Sorting/RadixSort/readme.md: -------------------------------------------------------------------------------- 1 | # Radix Sort 2 | 3 | The idea of Radix Sort is to do digit by digit sort starting from least significant digit to most significant digit. Radix sort uses counting sort as a subroutine to sort. -------------------------------------------------------------------------------- /ALGORITHMS/Sorting/Wave Sort/readme.md: -------------------------------------------------------------------------------- 1 | # WaveSort 2 | 3 | ## Given an unsorted array of integers, sort the array into a wave like array. An array ‘arr[0..n-1]’ is sorted in wave form if arr[0] >= arr[1] <= arr[2] >= arr[3] <= arr[4] >= ….. 4 | -------------------------------------------------------------------------------- /ALGORITHMS/Stack/Largest Rectangle In A Histogram/readme.md: -------------------------------------------------------------------------------- 1 | # Largest Rectangle In A Histogram -------------------------------------------------------------------------------- /ALGORITHMS/Stack/README.md: -------------------------------------------------------------------------------- 1 | # Stack -------------------------------------------------------------------------------- /ALGORITHMS/Stack/Reductant Parenthesis/readme.md: -------------------------------------------------------------------------------- 1 | # Reductant Parenthesis -------------------------------------------------------------------------------- /ALGORITHMS/Stack/Stockspan Problem/readme.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hhhrrrttt222111/CodeChef/fe5a76f2dc83e90b39e5af266385eb3be4d3f889/ALGORITHMS/Stack/Stockspan Problem/readme.md -------------------------------------------------------------------------------- /ALGORITHMS/Stack/Trapping RainDrop Harvesting/readme.md: -------------------------------------------------------------------------------- 1 | # Trapping RainDrop Harvesting -------------------------------------------------------------------------------- /ALGORITHMS/Strings/README.md: -------------------------------------------------------------------------------- 1 | # Strings -------------------------------------------------------------------------------- /ALGORITHMS/Tree/Balanced Height Tree/readme.md: -------------------------------------------------------------------------------- 1 | # Balanced Height Tree -------------------------------------------------------------------------------- /ALGORITHMS/Tree/Binary Tree/README.md: -------------------------------------------------------------------------------- 1 | This is lowest common ancestor of binary tree traversal in python. -------------------------------------------------------------------------------- /ALGORITHMS/Tree/Count All The Nodes In A BinaryTree/readme.md: -------------------------------------------------------------------------------- 1 | # Count All The Nodes In A BinaryTree -------------------------------------------------------------------------------- /ALGORITHMS/Tree/Diameter of a binarytree/readme.md: -------------------------------------------------------------------------------- 1 | # Diameter of a Binary Tree -------------------------------------------------------------------------------- /ALGORITHMS/Tree/Height of a binary Tree/readme.md: -------------------------------------------------------------------------------- 1 | # Height of a binary Tree -------------------------------------------------------------------------------- /ALGORITHMS/Tree/README.md: -------------------------------------------------------------------------------- 1 | # Tree 2 | 3 | -> This directory will contain the algorithms about Trees (including Binary Search Trees) 4 | -------------------------------------------------------------------------------- /ALGORITHMS/Tree/Sum All The Nodes IN A BinaryTree/readme.md: -------------------------------------------------------------------------------- 1 | # Sum All The Nodes IN A BinaryTree -------------------------------------------------------------------------------- /ALGORITHMS/Tree/Sum Replacement In A Binary Tree/readme.md: -------------------------------------------------------------------------------- 1 | # Sum Replacement In A BinaryTree -------------------------------------------------------------------------------- /Beginner/A - Books (BIT2A)/books.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | N = int(input()) 6 | A = list(map(int, input().split())) 7 | 8 | c = 0 9 | for i in range(N): 10 | for j in range(i+1, N): 11 | if A[i] 2 | 3 | int main(void) { 4 | int x; 5 | float y; 6 | 7 | scanf("%d",&x); 8 | scanf("%f",&y); 9 | if(x%5==0 && (y-0.5)>=x) 10 | { 11 | y=(float)(y-x-0.50); 12 | printf("%.2f\n",y); 13 | 14 | } 15 | else 16 | { 17 | printf("%.2f",y); 18 | } 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /Beginner/ATM (HS08TEST)/atm.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(){ 5 | 6 | int withdraw; 7 | double balance; 8 | 9 | cin >> withdraw >> balance; 10 | 11 | if (withdraw % 5 == 0 && withdraw + 0.5 <= balance) 12 | { 13 | cout << balance - withdraw - 0.5 << endl; 14 | } 15 | else 16 | { 17 | cout << balance; 18 | } 19 | 20 | return 0; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Beginner/ATM (HS08TEST)/atm.py: -------------------------------------------------------------------------------- 1 | w, b = input().split() 2 | w = int(w) 3 | b = float(b) 4 | if (w % 5 == 0 and b>(w+.5)): 5 | b = b - w - 0.5 6 | print('%.2f' % b) 7 | else: 8 | print('%.2f' % b) -------------------------------------------------------------------------------- /Beginner/ATM (HS08TEST)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/HS08TEST -------------------------------------------------------------------------------- /Beginner/ATM Machine (ATM2)/atm2.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | N, K = map(int, input().split()) 6 | 7 | arr = list(map(int, input().split())) 8 | 9 | for i in arr: 10 | if i>K: 11 | print(0, end='') 12 | else: 13 | print(1, end='') 14 | K = K-i 15 | print() 16 | t = t-1 -------------------------------------------------------------------------------- /Beginner/ATM Machine (ATM2)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CHEFARRP -------------------------------------------------------------------------------- /Beginner/ATM/atm.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | float bal; 5 | int ta; 6 | printf("Enter the amount to be withdrawed and current account balance\n"); 7 | scanf("%d %f",&ta,&bal); 8 | if(ta<=bal && ta%5==0){ 9 | bal = bal -(ta+.50); 10 | } 11 | printf("%.2f\n", bal); 12 | } 13 | -------------------------------------------------------------------------------- /Beginner/ATM/atm.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int x; 6 | float y; 7 | cin>>x>>y; 8 | 9 | if((x%5==0)&&(y>float(x+0.50))&&(x>0)) 10 | { 11 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | int T; 6 | cin >> T; 7 | while(T--){ 8 | int N,M; 9 | cin >> N >> M; 10 | if((N*M)%2==0){ 11 | std::cout << "YES" << std::endl; 12 | } 13 | else { 14 | std::cout << "NO" << std::endl; 15 | } 16 | } 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Beginner/Ada School (ADASCOOL)/ada.php: -------------------------------------------------------------------------------- 1 | 0) { 5 | $input = fgets(STDIN); 6 | $array = explode(' ', $input); 7 | $n = (int)$array[0]; 8 | $m = (int)$array[1]; 9 | if(($n*$m)%2 == 0) { 10 | printf("YES\n"); 11 | } else { 12 | printf("NO\n"); 13 | } 14 | $totalLine -= 1; 15 | } 16 | -------------------------------------------------------------------------------- /Beginner/Ada School (ADASCOOL)/ada.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | N, M = map(int, input().split()) 5 | 6 | if (N*M)%2 == 0: 7 | print('YES') 8 | else: 9 | print('NO') 10 | 11 | t = t-1 12 | -------------------------------------------------------------------------------- /Beginner/Ada School (ADASCOOL)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/ADASCOOL -------------------------------------------------------------------------------- /Beginner/Ada and crayons (ADACRA)/crayons.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | S = input() 6 | 7 | c=0 8 | for i in range(len(S)-1): 9 | if S[i]!=S[i+1]: 10 | c+=1 11 | if c%2==0: 12 | print(c//2) 13 | else: 14 | print((c//2)+1) 15 | 16 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Ada and crayons (ADACRA)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/ADACRA -------------------------------------------------------------------------------- /Beginner/Ada and the Staircase (ADASTAIR)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/ADASTAIR 2 | -------------------------------------------------------------------------------- /Beginner/Add Two Numbers (FLOW001)/add.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | 5 | int t; 6 | scanf("%d", &t); 7 | while (t--) { 8 | int a, b; 9 | scanf("%d %d", &a, &b); 10 | int ans = a + b; 11 | printf("%d\n", ans); 12 | } 13 | 14 | return 0; 15 | } -------------------------------------------------------------------------------- /Beginner/Add Two Numbers (FLOW001)/add.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | int T; 8 | scanf("%d", &T); 9 | while (T--) { 10 | int a, b; 11 | cin >> a >> b; 12 | 13 | int ans = a + b; 14 | cout << ans; 15 | } 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Beginner/Add Two Numbers (FLOW001)/add.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Beginner/Add Two Numbers (FLOW001)/add.py: -------------------------------------------------------------------------------- 1 | T = int(input()) 2 | for tc in range(T): 3 | # Read integers a and b. 4 | (a, b) = map(int, input().split(' ')) 5 | 6 | ans = a + b 7 | print(ans) -------------------------------------------------------------------------------- /Beginner/Add Two Numbers (FLOW001)/add.rb: -------------------------------------------------------------------------------- 1 | total = gets 2 | for i in 1..total.to_i 3 | num = gets 4 | temp = num.split(" ") 5 | add = (temp[0].to_i) + (temp[1].to_i) 6 | puts add 7 | end -------------------------------------------------------------------------------- /Beginner/Add Two Numbers (FLOW001)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FLOW001 -------------------------------------------------------------------------------- /Beginner/Akhil And Colored Balls (ACBALL)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/ACBALL -------------------------------------------------------------------------------- /Beginner/Alternating subarray prefix (ALTARAY)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/ALTARAY 2 | -------------------------------------------------------------------------------- /Beginner/Ambiguous Permutations (PERMUT2)/permutation.py: -------------------------------------------------------------------------------- 1 | while True : 2 | n = int(input()) 3 | if n == 0 : 4 | break 5 | else : 6 | arr = input().split() 7 | check = True 8 | for i in range(n) : 9 | if int(arr[int(arr[i]) - 1]) != i + 1 : 10 | check = False 11 | if check : 12 | print('ambiguous') 13 | else : 14 | print('not ambiguous') -------------------------------------------------------------------------------- /Beginner/Ambiguous Permutations (PERMUT2)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/PERMUT2 -------------------------------------------------------------------------------- /Beginner/Appy and Contest (HMAPPY2)/contest.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | for i in range(t): 4 | n, a, b, k = map(int, input().split()) 5 | 6 | f = 0 7 | c = max(a, b) 8 | d = min(a, b) 9 | if c % d != 0: 10 | f = n//c + n//d - 2 * (n//(c*d)) 11 | if c % d == 0: 12 | f = n//d - n//c 13 | 14 | if k <= f: 15 | print("Win") 16 | else: 17 | print("Lose") 18 | 19 | -------------------------------------------------------------------------------- /Beginner/Appy and Contest (HMAPPY2)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/HMAPPY2 2 | 3 | -------------------------------------------------------------------------------- /Beginner/Area OR Perimeter (AREAPERI)/areaperi.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int l, b; 5 | scanf("%d",&l); 6 | scanf("%d",&b); 7 | int area = l*b; 8 | int peri = 2*(l+b); 9 | if(area > peri ){ 10 | printf("Area: %d\n", area); 11 | 12 | } 13 | else if(area peri: 8 | print('Area') 9 | print(area) 10 | elif areap 8 | puts "Area" 9 | puts a 10 | elsif a

0: 7 | print(int(x)) 8 | else: 9 | print(-1) 10 | -------------------------------------------------------------------------------- /Beginner/Average Number (AVG)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/AVG 2 | -------------------------------------------------------------------------------- /Beginner/Balsa For The Three (BFTT)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/BFTT -------------------------------------------------------------------------------- /Beginner/Balsa For The Three (BFTT)/three.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | for i in range(t): 4 | N = int(input()) 5 | s = N+1 6 | 7 | while(True): 8 | c = str(s) 9 | if c.count('3') >= 3: 10 | break 11 | s = s+1 12 | print(s) 13 | -------------------------------------------------------------------------------- /Beginner/Bear and Candies 123 (CANDY123)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CANDY123 -------------------------------------------------------------------------------- /Beginner/Bear and Ladder (BRLADDER)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/BRLADDER -------------------------------------------------------------------------------- /Beginner/Bear and Milky Cookies (COOMILK)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/COOMILK -------------------------------------------------------------------------------- /Beginner/Bear and Segment 01 (SEGM01)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/SEGM01 -------------------------------------------------------------------------------- /Beginner/Bear and Segment 01 (SEGM01)/segment.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | S = input().strip("0") 6 | 7 | if "0" not in S and "1" in S: 8 | print("YES") 9 | else: 10 | print("NO") 11 | 12 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Bidding/Bidding.py: -------------------------------------------------------------------------------- 1 | # cook your dish here 2 | t=int(input()) 3 | for i in range(t): 4 | x,y,z=map(int,input().split()) 5 | if(x>y and x>z): 6 | print("Alice") 7 | if(y>z and y>x): 8 | print("Bob") 9 | if(z>y and z>x): 10 | print("charlie") -------------------------------------------------------------------------------- /Beginner/Body Mass Index (BMI)/bmi.py: -------------------------------------------------------------------------------- 1 | for _ in range(int(input())): 2 | m,h = map(int,input().split()) 3 | bmi = m / (h ** 2) 4 | if bmi <= 18: 5 | print(1) 6 | elif bmi > 18 and bmi < 25: 7 | print(2) 8 | elif bmi > 24 and bmi < 30: 9 | print(3) 10 | elif bmi >= 30: 11 | print(4) -------------------------------------------------------------------------------- /Beginner/Body Mass Index (BMI)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/BMI -------------------------------------------------------------------------------- /Beginner/Bodybuilder (BUILDB)/readme.md: -------------------------------------------------------------------------------- 1 | # Link : https://www.codechef.com/problems/BUILDB -------------------------------------------------------------------------------- /Beginner/Breaking Bricks (BRKBKS)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/BRKBKS -------------------------------------------------------------------------------- /Beginner/Buggy Calculator (BUGCAL)/Buggy_calc.py: -------------------------------------------------------------------------------- 1 | (a,b) = map(str,input().split()) 2 | value = '' 3 | while len(a) > 0: 4 | if int(a[-1]) + int(b[-1]) > 10: 5 | a = a[:len(a)-1] 6 | b = b[:len(b)-1] 7 | print(a) 8 | print(b) 9 | value += str(int(a[-1]) + int(b[-1])) 10 | print(value) 11 | -------------------------------------------------------------------------------- /Beginner/Buggy Calculator (BUGCAL)/README.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/BUGCAL -------------------------------------------------------------------------------- /Beginner/Buying New Tablet (TABLET)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TABLET -------------------------------------------------------------------------------- /Beginner/Buying New Tablet (TABLET)/tablet.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | N, B = map(int, input().split()) 5 | 6 | area = [0] 7 | for i in range(N): 8 | W, H, P = map(int, input().split()) 9 | if P <= B: 10 | area.append(int(W*H)) 11 | if max(area) > 0: 12 | print(max(area)) 13 | else: 14 | print('no tablet') 15 | 16 | t = t-1 -------------------------------------------------------------------------------- /Beginner/CV (CV)/cv.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | V = ['a', 'e', 'i', 'o', 'u'] 3 | 4 | while t: 5 | N = int(input()) 6 | S = input() 7 | c = 0 8 | 9 | for i in range((len(S)-1)): 10 | if (S[i] not in V) and (S[i+1] in V): 11 | c = c+1 12 | 13 | print(c) 14 | 15 | t = t-1 -------------------------------------------------------------------------------- /Beginner/CV (CV)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CV -------------------------------------------------------------------------------- /Beginner/Candy Love (CNDLOVE)/candy.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | N = int(input()) 6 | A = list(map(int, input().split())) 7 | 8 | s = sum(A) 9 | if s%2==0: 10 | print('NO') 11 | else: 12 | print('YES') 13 | 14 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Candy Love (CNDLOVE)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CNDLOVE -------------------------------------------------------------------------------- /Beginner/Cats and Dogs (CATSDOGS)/catsdogs.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | C, D, L = map(int, input().split()) 5 | 6 | M = C*4 + D*4 7 | m = D*4 8 | if C > 2*D: 9 | m += (C-2*D)*4 10 | if m <= L <= M and L % 4 == 0: 11 | print('yes') 12 | else: 13 | print('no') 14 | 15 | t = t-1 16 | -------------------------------------------------------------------------------- /Beginner/Cats and Dogs (CATSDOGS)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CATSDOGS -------------------------------------------------------------------------------- /Beginner/Change It (CHNGIT)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CHNGIT -------------------------------------------------------------------------------- /Beginner/Chef And Coloring (COLOR)/color.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | N = int(input()) 6 | col = list(input()) 7 | 8 | r = col.count('R') 9 | g = col.count('G') 10 | b = col.count('B') 11 | 12 | s = max(r, g, b) 13 | 14 | print(N-s) 15 | 16 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Chef And Coloring (COLOR)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/COLOR -------------------------------------------------------------------------------- /Beginner/Chef And His Characters(CHEFCHR)/README.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CHEFCHR -------------------------------------------------------------------------------- /Beginner/Chef And His Characters(CHEFCHR)/solution.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | for _ in range(t): 3 | s = input() 4 | n = len(s) 5 | count = 0 6 | for i in range(n-3): 7 | g = s[i:i+4] 8 | if(g.count('c')==1 and g.count('h')==1 and g.count('e')==1 and g.count('f')==1): 9 | count+=1 10 | if(count==0): 11 | print("normal") 12 | else: 13 | print("lovely ",count) 14 | -------------------------------------------------------------------------------- /Beginner/Chef And Operators (CHOPRT)/chef.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | a, b = map(int, input().split(" ")) 5 | 6 | if a > b: 7 | print('>') 8 | elif a < b: 9 | print('<') 10 | else: 11 | print('=') 12 | 13 | t = t-1 14 | -------------------------------------------------------------------------------- /Beginner/Chef And Operators (CHOPRT)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CHOPRT -------------------------------------------------------------------------------- /Beginner/Chef Chick (CHFCHK)/chick.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std ; 3 | 4 | int main() { 5 | int t; 6 | cin>>t; 7 | while(t--) { 8 | int n ; 9 | cin>>n; 10 | int a[n]; 11 | for(int i=0;i>a[i]; 13 | } 14 | sort(a,a+n); 15 | cout< 2 | using namespace std; 3 | 4 | int main(){ 5 | int t; 6 | cin >> t; 7 | while(t--) { 8 | int N, K; 9 | cin >> N >> K; 10 | int arr[N+1]; 11 | for(int i = 0;i < N;i++) 12 | cin >> arr[i]; 13 | sort(arr, arr+N); 14 | 15 | cout< 2 | 3 | int main() { 4 | 5 | int t; 6 | scanf("%d", &t); 7 | while(t--) { 8 | int N, M, K, diff; 9 | scanf("%d%d%d",&N,&M,&K); 10 | diff = N>M ? N-M : M-N; 11 | if(diff 3 | using namespace std; 4 | typedef long long int ll; 5 | int main() 6 | { 7 | ll t; 8 | cin>>t; 9 | while(t--) 10 | { 11 | ll n,m,k,mi=0,ma=0; 12 | cin>>n>>m>>k; 13 | ma=max(n,m); 14 | mi=min(n,m); 15 | cout<M: 8 | M = M+1 9 | elif M>N: 10 | N = N+1 11 | else: 12 | break 13 | 14 | print(abs(N-M)) 15 | 16 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Chef and Fruits (FRUITS)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FRUITS -------------------------------------------------------------------------------- /Beginner/Chef and Glove (CHEGLOVE)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CHEGLOVE -------------------------------------------------------------------------------- /Beginner/Chef and Interactive Contests (CHFINTRO)/interactive.py: -------------------------------------------------------------------------------- 1 | N, r = map(int, input().split()) 2 | 3 | for i in range(N): 4 | R = int(input()) 5 | 6 | if R>=r: 7 | print('Good boi') 8 | else: 9 | print('Bad boi') -------------------------------------------------------------------------------- /Beginner/Chef and Interactive Contests (CHFINTRO)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CHFINTRO -------------------------------------------------------------------------------- /Beginner/Chef and Price Control (PRICECON)/price.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | N, K = map(int, input().split()) 5 | 6 | P = list(map(int, input().split())) 7 | tot = sum(P) 8 | 9 | for i in range(len(P)): 10 | if P[i]>K: 11 | P[i] = K 12 | 13 | rev = sum(P) 14 | print(tot - rev) 15 | 16 | t = t-1 17 | -------------------------------------------------------------------------------- /Beginner/Chef and Price Control (PRICECON)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/PRICECON -------------------------------------------------------------------------------- /Beginner/Chef and Rainbow Array (RAINBOWA)/rainbow.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | n = int(input()) 6 | a = list(map(int,input().split())) 7 | r = {1,2,3,4,5,6,7} 8 | d = a[::-1] 9 | if a == d and set(a) == r: 10 | print('yes') 11 | else: 12 | print('no') 13 | 14 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Chef and Remissness (REMISS)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/REMISS -------------------------------------------------------------------------------- /Beginner/Chef and Remissness (REMISS)/remiss.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int t,a,b; 6 | cin>>t; 7 | while(t--) 8 | { 9 | cin>>a>>b; 10 | if(a>b) 11 | cout<b: 7 | print(a, a+b) 8 | elif a 2 | using namespace std; 3 | 4 | int main() { 5 | long long t; 6 | cin>>t; 7 | while(t--) { 8 | long long p1,p2,k; 9 | cin>>p1>>p2>>k; 10 | long long total=p1+p2; 11 | long long x=total/k; 12 | if(x%2==0) 13 | cout<<"CHEF"< 2 | using namespace std; 3 | 4 | int main() { 5 | int a ; 6 | int b ; 7 | cin >> a ; 8 | while(a--){ 9 | cin >> b ; 10 | if(b == 2010 || b == 2015 || b == 2016 || b == 2017 || b == 2019){ 11 | cout << "HOSTED"<< endl ; 12 | } 13 | else { 14 | cout << "NOT HOSTED"<< endl ; 15 | } 16 | } 17 | return 0; 18 | } -------------------------------------------------------------------------------- /Beginner/Chef and SnackDown (SNCKYEAR)/snackdown.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | year = [2010, 2015, 2016, 2017, 2019] 4 | 5 | while t: 6 | a = int(input()) 7 | if a in year: 8 | print('HOSTED') 9 | else: 10 | print('NOT HOSTED') 11 | 12 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Chef and String (CHRL2)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CHRL2 2 | -------------------------------------------------------------------------------- /Beginner/Chef and Strings (CHEFSTR1)/CHEFSTR1.py: -------------------------------------------------------------------------------- 1 | T = int(input()) 2 | 3 | for i in range(T): 4 | N = int(input()) 5 | 6 | S = list(map(int, input().split()[:N])) 7 | 8 | suma = 0 9 | 10 | for j in range(N - 1): 11 | suma += abs(S[j + 1] - S[j]) - 1 12 | 13 | print(suma) -------------------------------------------------------------------------------- /Beginner/Chef and Strings (CHEFSTR1)/README.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CHEFSTR1 -------------------------------------------------------------------------------- /Beginner/Chef and Table Tennis (TTENIS)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TTENIS -------------------------------------------------------------------------------- /Beginner/Chef and Table Tennis (TTENIS)/tabletennis.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | s = list(map(int, input().split())) 5 | 6 | L = s.count(0) 7 | W = s.count(1) 8 | 9 | if L>W: 10 | print('LOSE') 11 | else: 12 | print('WIN') 13 | 14 | t = t-1 15 | -------------------------------------------------------------------------------- /Beginner/Chef and Two Strings (CHEFSTLT)/chef.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | str1 = input() 5 | str2 = input() 6 | A = 0 7 | B = 0 8 | for i in range(len(str1)): 9 | if str1[i]=="?" or str2[i]=="?": 10 | B += 1 11 | elif str1[i]!=str2[i]: 12 | A += 1 13 | B += 1 14 | print(A,B) 15 | 16 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Chef and Two Strings (CHEFSTLT)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CHEFSTLT -------------------------------------------------------------------------------- /Beginner/Chef and Typing (TYPING)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/TYPING -------------------------------------------------------------------------------- /Beginner/Chef and digits of a number (LONGSEQ)/chefdigits.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | num=input() 6 | if num.count(str(0))==1: 7 | print("Yes") 8 | elif num.count(str(1))==1: 9 | print("Yes") 10 | else: 11 | print("No") 12 | 13 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Chef and digits of a number (LONGSEQ)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/LONGSEQ -------------------------------------------------------------------------------- /Beginner/Chef and his Sequence (CHEFSQ)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CHEFSQ -------------------------------------------------------------------------------- /Beginner/Chef and his Students (CHEFSTUD)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CHEFSTUD -------------------------------------------------------------------------------- /Beginner/Chef and the Wildcard Matching (TWOSTR)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TWOSTR -------------------------------------------------------------------------------- /Beginner/Chef and the Wildcard Matching (TWOSTR)/wildcard.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | a = input() 6 | b = input() 7 | c = 0 8 | for i in range(len(a)): 9 | if a[i]!='?' and b[i]!='?' : 10 | if a[i] != b[i]: 11 | c += 1 12 | if c==0: 13 | print('Yes') 14 | else: 15 | print('No') 16 | 17 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Chef vs Doof (CLLCM)/doof.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | N = int(input()) 6 | 7 | A = list(map(int, input().split())) 8 | l = 1 9 | 10 | for i in A: 11 | l *= i 12 | 13 | if l%2==0: 14 | print("NO") 15 | else: 16 | print("YES") 17 | 18 | 19 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Chef vs Doof (CLLCM)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CLLCM -------------------------------------------------------------------------------- /Beginner/Ciel and Receipt (CIELRCPT)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CIELRCPT -------------------------------------------------------------------------------- /Beginner/Closing the Tweets (TWTCLOSE)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TWTCLOSE -------------------------------------------------------------------------------- /Beginner/Coder Life Matters (CODERLIF)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CODERLIF -------------------------------------------------------------------------------- /Beginner/Coins And Triangle (TRICOIN)/coins.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | n = int(input()) 6 | x = 1 7 | while n>0: 8 | n -= x 9 | x += 1 10 | if n < 0: 11 | print(x-2) 12 | elif n == 0: 13 | print(x-1) 14 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Coins And Triangle (TRICOIN)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TRICOIN -------------------------------------------------------------------------------- /Beginner/Coldplay (SLOOP)/README.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/SLOOP 2 | -------------------------------------------------------------------------------- /Beginner/Coldplay (SLOOP)/coldplay.py: -------------------------------------------------------------------------------- 1 | for _ in range(int(input())): 2 | m,s = map(int,input().split()) 3 | print(m//s) -------------------------------------------------------------------------------- /Beginner/Cops and the Thief Devu (COPS)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/COPS -------------------------------------------------------------------------------- /Beginner/Cops and the Thief Devu(COPS)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/COPS 2 | -------------------------------------------------------------------------------- /Beginner/Count Subarrays (SUBINC)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/SUBINC -------------------------------------------------------------------------------- /Beginner/Count Subarrays (SUBINC)/subarrays.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | N = int(input()) 5 | c=0 6 | r=0 7 | 8 | arr = list(map(int, input().split())) 9 | 10 | for i in range(1,N): 11 | if arr[i]>=arr[i-1]: 12 | c = c+1 13 | else: 14 | c = 0 15 | r = r+c 16 | print(r+N) 17 | 18 | t = t-1 19 | -------------------------------------------------------------------------------- /Beginner/Covid Run (CVDRUN)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CVDRUN -------------------------------------------------------------------------------- /Beginner/Cut The Sticks (CUTSTICK)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CUTSTICK -------------------------------------------------------------------------------- /Beginner/Cut the Board (CUTBOARD)/board.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int t; 6 | cin>>t; 7 | while(t--){ 8 | int n, m; 9 | cin >> n >> m; 10 | cout << (n-1)*(m-1) < 2 | using namespace std; 3 | 4 | int main() { 5 | int n; 6 | 7 | cin>> n; 8 | if(n%4==0) { 9 | cout< 2 | 3 | int main(){ 4 | int num; 5 | printf("Enter the number: "); 6 | scanf("%d",&num); 7 | if(num%4==0) 8 | num++; 9 | else 10 | num--; 11 | printf("%d\n",num); 12 | } 13 | -------------------------------------------------------------------------------- /Beginner/Decrement OR Increment (DECINC)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/DECINC -------------------------------------------------------------------------------- /Beginner/Devu and friendship testing (CFRTEST)/friendship.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | n = int(input()) 5 | arr = list(map(int, input().split())) 6 | 7 | arr = set(arr) 8 | print(len(arr)) 9 | 10 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Devu and friendship testing (CFRTEST)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CFRTEST -------------------------------------------------------------------------------- /Beginner/Download file (DWNLD)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/DWNLD -------------------------------------------------------------------------------- /Beginner/Easy Math (RPD)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/RPD -------------------------------------------------------------------------------- /Beginner/Enormous Input Test (INTEST)/intest.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int n, k,ans; 5 | scanf("%d %d", &n, &k); 6 | ans = 0; 7 | for (int i = 0; i < n; i++) { 8 | int t; 9 | scanf("%d", &t); 10 | 11 | if (t % k == 0) { 12 | ans++; 13 | } 14 | } 15 | printf("%d\n", ans); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /Beginner/Enormous Input Test (INTEST)/intest.py: -------------------------------------------------------------------------------- 1 | (n, k) = map(int, input().split(' ')) 2 | 3 | ans = 0 4 | 5 | for i in range(n): 6 | x = int(input()) 7 | if x % k == 0: 8 | ans += 1 9 | 10 | print(ans) -------------------------------------------------------------------------------- /Beginner/Enormous Input Test (INTEST)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/INTEST -------------------------------------------------------------------------------- /Beginner/Even-tual Reduction (EVENTUAL)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/EVENTUAL -------------------------------------------------------------------------------- /Beginner/Fancy Quotes (FANCY)/fancy.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | S = list(map(str, input().split(' '))) 6 | 7 | for i in S: 8 | if i == 'not': 9 | print('Real Fancy') 10 | break 11 | else: 12 | print('regularly fancy') 13 | 14 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Fancy Quotes (FANCY)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FANCY -------------------------------------------------------------------------------- /Beginner/Farmer And His Plot (RECTSQ)/farmer.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | int gcd(int A,int B) { 5 | if(B==0) 6 | return A; 7 | else 8 | return gcd(B,A%B); 9 | } 10 | 11 | int main() { 12 | int t, A, B, c; 13 | scanf("%d",&t); 14 | 15 | while(t--) { 16 | scanf("%d%d",&A,&B); 17 | c = gcd(A,B); 18 | printf("%d\n",(A*B)/(c*c)); 19 | } 20 | return 0; 21 | } -------------------------------------------------------------------------------- /Beginner/Farmer And His Plot (RECTSQ)/farmer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int t; 6 | cin>>t; 7 | while(t--){ 8 | int n,m; 9 | cin>>n>>m; 10 | int d = __gcd(n,m); 11 | int ans = (n/d)*(m/d); 12 | cout< 2 | 3 | int main() { 4 | // Read the number of test cases. 5 | int T; 6 | scanf("%d", &T); 7 | while (T>0) { 8 | // Read the input a, b 9 | int a, b; 10 | scanf("%d %d", &a, &b); 11 | 12 | // Compute the ans. 13 | // Complete the below line. 14 | int ans = a%b; 15 | printf("%d\n", ans); 16 | T--; 17 | } 18 | 19 | return 0; 20 | } -------------------------------------------------------------------------------- /Beginner/Find Remainder (FLOW002)/remainder.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | arr = [] 3 | 4 | for i in range(n): 5 | a, b = input().split() 6 | a = int(a) 7 | b = int(b) 8 | rem = a%b 9 | arr.append(rem) 10 | 11 | for i in range(n): 12 | print(arr[i]) 13 | -------------------------------------------------------------------------------- /Beginner/Find Your Gift (GIFTSRC)/readme.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hhhrrrttt222111/CodeChef/fe5a76f2dc83e90b39e5af266385eb3be4d3f889/Beginner/Find Your Gift (GIFTSRC)/readme.md -------------------------------------------------------------------------------- /Beginner/Find the Maximum Value (LOSTMAX)/maximum.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | N = list(map(int, input().split())) 5 | 6 | N.remove(len(N)-1) 7 | print(max(N)) 8 | 9 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Find the Maximum Value (LOSTMAX)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/LOSTMAX -------------------------------------------------------------------------------- /Beginner/Finding Square Roots (FSQRT)/fsqrt.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(){ 4 | int x,y; 5 | scanf("%d",&x); 6 | for (int i = 0;i 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t ; 7 | long n; 8 | cin >> t; 9 | while (t--) 10 | { 11 | cin >> n; 12 | cout << int(sqrt(n)) << "\n"; 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /Beginner/Finding Square Roots (FSQRT)/fsqrt.py: -------------------------------------------------------------------------------- 1 | # cook your dish here 2 | import math 3 | 4 | t = int(input()) 5 | 6 | for i in range(t): 7 | a = int(input()) 8 | sq = math.sqrt(a) 9 | print(int(sq)) -------------------------------------------------------------------------------- /Beginner/Finding Square Roots (FSQRT)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FSQRT -------------------------------------------------------------------------------- /Beginner/First and Last Digit (FLOW004)/fl.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | // your code goes here 6 | int t, n, f, l; 7 | cin >> t; 8 | while(t--){ 9 | cin >> n; 10 | l = n%10; 11 | while(n>0){ 12 | f = n%10; 13 | n /= 10; 14 | } 15 | cout << f+l << endl; 16 | } 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Beginner/First and Last Digit (FLOW004)/fl.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | def convertArray(i): 4 | arr=[] 5 | while i>0: 6 | rem = i % 10 7 | i = int(i / 10) 8 | arr.append(rem) 9 | return arr 10 | 11 | while t: 12 | n = int(input()) 13 | l = convertArray(n) 14 | print(l[0] + l[-1]) 15 | t = t-1 16 | -------------------------------------------------------------------------------- /Beginner/First and Last Digit (FLOW004)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FLOW004 -------------------------------------------------------------------------------- /Beginner/Fit Squares in Triangle (TRISQ)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TRISQ -------------------------------------------------------------------------------- /Beginner/Fit Squares in Triangle (TRISQ)/squares.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int t; 7 | cin >> t; 8 | while(t--) { 9 | int b; 10 | cin >> b; 11 | int ans = 0; 12 | ans = (b/2)*(b/2-1); 13 | ans = ans/2; 14 | cout << ans <<"\n"; 15 | } 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /Beginner/Fit Squares in Triangle (TRISQ)/squares.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | n = int(input()) // 2 - 1 5 | print(int(n * (n + 1) // 2)) 6 | -------------------------------------------------------------------------------- /Beginner/FlatLand (ICL1902)/flatland.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | N = int(input()) 6 | 7 | c = 0 8 | while(N > 0): 9 | N -= pow(int(pow(N , 0.5)) , 2) 10 | c += 1 11 | print(c) 12 | 13 | t = t-1 -------------------------------------------------------------------------------- /Beginner/FlatLand (ICL1902)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/ICL1902 -------------------------------------------------------------------------------- /Beginner/Food Chain/Food Chain Solution.md: -------------------------------------------------------------------------------- 1 | * In C++ 2 | ```c++ 3 | #include 4 | using namespace std; 5 | 6 | int main() { 7 | int t; 8 | cin>>t; 9 | while(t-->0) 10 | { 11 | int e,k,p=0; 12 | cin>>e>>k; 13 | while(e>0) 14 | { 15 | p++; 16 | e=e/k; 17 | } 18 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | int t; 6 | cin >> t; 7 | while (t--) { 8 | int n, a, b; 9 | cin >> n; 10 | for (int i = 0; i < n; ++i) 11 | cin >> a >> b; 12 | int ans = n; 13 | while (--n) 14 | ans ^= n; 15 | cout << ans << endl; 16 | } 17 | return 0; 18 | } -------------------------------------------------------------------------------- /Beginner/Good Joke! (RRJOKE)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/RRJOKE -------------------------------------------------------------------------------- /Beginner/Good and Bad Persons (GOODBAD)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/GOODBAD -------------------------------------------------------------------------------- /Beginner/Grade The Steel (FLOW014)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FLOW014 -------------------------------------------------------------------------------- /Beginner/Greedy puppy (GDOG)/puppy.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | a, b = map(int, input().split()) 5 | 6 | rem = -1 7 | for i in range(1, b+1): 8 | rem = max(a % i, rem) 9 | 10 | print(rem) 11 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Greedy puppy (GDOG)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/GDOG -------------------------------------------------------------------------------- /Beginner/Gross Salary (FLOW011)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FLOW011 -------------------------------------------------------------------------------- /Beginner/Gross Salary (FLOW011)/salary.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | 5 | int t; 6 | scanf("%d", &t); 7 | while(t--){ 8 | int n; 9 | float s; 10 | scanf("%d", &n); 11 | if(n<1500) { 12 | s = n+(0.1*n) + (0.9*n); 13 | } 14 | else { 15 | s = n+500 + (.98*n); 16 | } 17 | printf("%.2f\n", s); 18 | } 19 | return 0; 20 | } -------------------------------------------------------------------------------- /Beginner/Gross Salary (FLOW011)/salary.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | n = int(input()) 5 | 6 | if n < 1500: 7 | HRA = n*0.10 8 | DA = n*0.9 9 | else: 10 | HRA = 500 11 | DA = n*0.98 12 | 13 | print(n + HRA + DA) 14 | 15 | t = t-1 -------------------------------------------------------------------------------- /Beginner/HOW MANY DIGITS DO I HAVE (HOWMANY)/digits.py: -------------------------------------------------------------------------------- 1 | n = input() 2 | 3 | d = 0 4 | 5 | for i in range(len(n)): 6 | n = int(n) 7 | n = n/10 8 | d = d+1 9 | 10 | if d==1: 11 | print(1) 12 | elif d==2: 13 | print(2) 14 | elif d==3: 15 | print(3) 16 | else: 17 | print('More than 3 digits') -------------------------------------------------------------------------------- /Beginner/HOW MANY DIGITS DO I HAVE (HOWMANY)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/HOWMANY -------------------------------------------------------------------------------- /Beginner/Helping Chef (FLOW008)/chef.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int t; 6 | cin >> t; 7 | while(t--) { 8 | int n; 9 | cin >> n; 10 | if(n<10) 11 | cout <<"Thanks for helping Chef!"<< endl; 12 | else 13 | cout <<"-1"<< endl; 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /Beginner/Helping Chef (FLOW008)/chef.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | n = int(input()) 5 | if n < 10: 6 | print('Thanks for helping Chef!') 7 | else: 8 | print(-1) 9 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Helping Chef (FLOW008)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FLOW011 -------------------------------------------------------------------------------- /Beginner/Highest divisor (HDIVISR)/highest_divisor.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | l = [] 3 | for i in range(1,11): 4 | if n % i == 0: 5 | l.append(i) 6 | 7 | print(max(l)) -------------------------------------------------------------------------------- /Beginner/Highest divisor (HDIVISR)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/HDIVISR -------------------------------------------------------------------------------- /Beginner/How much Scholarship (ZCOSCH)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/ZCOSCH -------------------------------------------------------------------------------- /Beginner/How much Scholarship (ZCOSCH)/scholarship.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int R; 5 | 6 | cin>>R; 7 | 8 | if(R>=1 && R<=50) 9 | cout<<"100"; 10 | else if(R>=51 &&R <=100) 11 | cout<<"50"; 12 | else 13 | cout<<"0"; 14 | } 15 | -------------------------------------------------------------------------------- /Beginner/How much Scholarship (ZCOSCH)/scholarship.py: -------------------------------------------------------------------------------- 1 | R = int(input()) 2 | 3 | if R<=50: 4 | print(100) 5 | elif R<=100: 6 | print(50) 7 | else: 8 | print(0) -------------------------------------------------------------------------------- /Beginner/IPL and RCB (CLIPLX)/rcb.cpp: -------------------------------------------------------------------------------- 1 | using namespace std; 2 | 3 | #include 4 | 5 | 6 | int main() { 7 | 8 | int t; 9 | cin>>t; 10 | 11 | for(int i=0; i>X>>Y; 14 | 15 | if(X<=Y) { 16 | cout<<"0"<Y: 7 | print(X-Y) 8 | else: 9 | print(0) 10 | 11 | t = t-1 12 | 13 | 14 | -------------------------------------------------------------------------------- /Beginner/IPL and RCB (CLIPLX)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CLIPLX -------------------------------------------------------------------------------- /Beginner/Id and Ship (FLOW010)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FLOW010 -------------------------------------------------------------------------------- /Beginner/Id and Ship (FLOW010)/ship.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | c = input() 5 | if c=='b' or c=='B': 6 | print('BattleShip') 7 | if c=='c' or c=='C': 8 | print('Cruiser') 9 | if c=='D' or c=='d': 10 | print('Destroyer') 11 | if c=='F' or c=='f': 12 | print('Frigate') 13 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Is it a Cakewalk Problem/ISITCAKE.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | c = 0 5 | for i in range(10): 6 | A = list(map(int, input().split())) 7 | for j in range(10): 8 | if A[j] <= 30: 9 | c = c+1 10 | 11 | if c>=60: 12 | print('yes') 13 | else: 14 | print('no') 15 | 16 | t = t-1 17 | -------------------------------------------------------------------------------- /Beginner/Is it a Cakewalk Problem/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/ISITCAKE 2 | -------------------------------------------------------------------------------- /Beginner/Is it a VOWEL or CONSONANT (VOWELTB)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/VOWELTB -------------------------------------------------------------------------------- /Beginner/Is it a VOWEL or CONSONANT (VOWELTB)/vowel.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | char ch; 5 | cin >> ch; 6 | if (ch =='A'|| ch =='E'|| ch =='I'|| ch =='O'|| ch =='U') { 7 | cout << "Vowel"; 8 | } 9 | else { 10 | cout << "Consonant"; 11 | } 12 | return 0; 13 | } -------------------------------------------------------------------------------- /Beginner/Is it a VOWEL or CONSONANT (VOWELTB)/vowel.py: -------------------------------------------------------------------------------- 1 | c = input() 2 | 3 | vowels = ['A', 'E', 'I', 'O', 'U'] 4 | 5 | if c in vowels: 6 | print('Vowel') 7 | else: 8 | print('Consonant') -------------------------------------------------------------------------------- /Beginner/J - Reached Safely Or Not (ZUBREACH)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/ZUBREACH -------------------------------------------------------------------------------- /Beginner/Judging Delay (JDELAY)/delay.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | N = int(input()) 5 | c = 0 6 | 7 | for i in range(N): 8 | S, J = map(int, input().split()) 9 | if J-S >5: 10 | c += 1 11 | 12 | print(c) 13 | 14 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Judging Delay (JDELAY)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/JDELAY -------------------------------------------------------------------------------- /Beginner/Kitchen Timetable (KTTABLE)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/KTTABLE -------------------------------------------------------------------------------- /Beginner/Laddu (LADDU)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/LADDU 2 | -------------------------------------------------------------------------------- /Beginner/Lapindromes (LAPIN)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/LAPIN -------------------------------------------------------------------------------- /Beginner/Lazy Jem (TALAZY)/lazy.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | N, B, M = map(int, input().split()) 6 | T = 0 7 | 8 | while N>1: 9 | if N%2 == 0: 10 | T += (N//2)*M + B 11 | N -= N//2 12 | else: 13 | T += (N+1)//2*M + B 14 | N -= (N+1)//2 15 | M *= 2 16 | 17 | print(T+M) 18 | 19 | t = t-1 20 | -------------------------------------------------------------------------------- /Beginner/Lazy Jem (TALAZY)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://dropgalaxy.in/xuhhw5rkwb5x -------------------------------------------------------------------------------- /Beginner/Lost Weekends (LOSTWKND)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/LOSTWKND -------------------------------------------------------------------------------- /Beginner/Lost Weekends (LOSTWKND)/weekends.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | A1 , A2, A3, A4, A5 , P=map(int,input().split()) 6 | s = (A1 + A2 + A3 + A4 + A5)*P 7 | C = "No" 8 | if s>120: 9 | C ="Yes" 10 | print(C) 11 | 12 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Lucky Four (LUCKFOUR)/lucky4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | long long int t,n,f=0; 6 | cin>>t; 7 | while(t--) 8 | { 9 | cin>>n; f=0; 10 | while(n) 11 | { 12 | if(n%10==4) 13 | f++; 14 | n/=10; 15 | } 16 | cout< odd: 15 | print('READY FOR BATTLE') 16 | else: 17 | print('NOT READY') -------------------------------------------------------------------------------- /Beginner/Mahasena (AMR15A)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/AMR15A -------------------------------------------------------------------------------- /Beginner/Making a Meal (CFMM)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CFMM -------------------------------------------------------------------------------- /Beginner/Malvika is peculiar about color of balloons (CHN09)/balloon.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | S = input() 5 | 6 | a = S.count('a') 7 | b = S.count('b') 8 | 9 | if a>b: 10 | print(a) 11 | else: 12 | print(b) 13 | 14 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Malvika is peculiar about color of balloons (CHN09)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CHN09 -------------------------------------------------------------------------------- /Beginner/Marathon (MARARUN)/README.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/MARARUN -------------------------------------------------------------------------------- /Beginner/Marathon (MARARUN)/marathon.py: -------------------------------------------------------------------------------- 1 | for _ in range(int(input())): 2 | a = list(map(int,input().split())) 3 | 4 | value = a[0] * a[1] 5 | if value < 10: 6 | print(0) 7 | elif (value >= 10 and value < 21): 8 | print(a[2]) 9 | elif value >= 21 and value < 42: 10 | print(a[3]) 11 | else: 12 | print(a[4]) 13 | -------------------------------------------------------------------------------- /Beginner/Mathison and pangrams (MATPAN)/mathison.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | N = list(map(int,input().split())) 5 | S = input() 6 | letters = "abcdefghijklmnopqrstuvwxyz" 7 | arr=[] 8 | 9 | for i in range(26): 10 | if letters[i] not in S: 11 | arr.append(N[i]) 12 | print(sum(arr)) 13 | 14 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Mathison and pangrams (MATPAN)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/MATPAN -------------------------------------------------------------------------------- /Beginner/Maximise the Sum (NOMATCH)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/NOMATCH -------------------------------------------------------------------------------- /Beginner/Maximum Remaining (MAXREM)/maximum.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(void) 3 | { 4 | int n,a,max1=0,max2=0,i; 5 | scanf("%d",&n); 6 | for(i=0;imax1) 10 | { 11 | max2=max1; 12 | max1=a; 13 | } 14 | else if(a>max2 && a j: 11 | print(max(A), min(A)) 12 | else: 13 | print(min(A), max(A)) 14 | 15 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Medel (MDL)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/MDL -------------------------------------------------------------------------------- /Beginner/Minimum Maximum (MNMX)/minmax.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | n = int(input()) 6 | arr = [int(x) for x in input().split()] 7 | 8 | print(min(arr) * (len(arr) - 1)) 9 | 10 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Minimum Maximum (MNMX)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/MNMX -------------------------------------------------------------------------------- /Beginner/Movie Weekend (MOVIEWKN)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/MOVIEWKN -------------------------------------------------------------------------------- /Beginner/Movie Weekends/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/MOVIEWKN 2 | -------------------------------------------------------------------------------- /Beginner/Multiple Choice Exam (EXAM1)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/EXAM1 -------------------------------------------------------------------------------- /Beginner/Mutated Minions (CHN15A)/minions.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | N, K = map(int, input().split()) 6 | c = 0 7 | 8 | min = list(map(int, input().split())) 9 | 10 | for i in range(N): 11 | if (K+min[i])%7 == 0: 12 | c = c+1 13 | 14 | print(c) 15 | t = t-1 16 | -------------------------------------------------------------------------------- /Beginner/Mutated Minions (CHN15A)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/CHN15A -------------------------------------------------------------------------------- /Beginner/My very 1st contest!/myvery1stcontest.py: -------------------------------------------------------------------------------- 1 | # cook your dish here 2 | x,y,z=map(int,input().split()) 3 | s=x-y 4 | p=s-z 5 | print(s,end=" ") 6 | print(p) -------------------------------------------------------------------------------- /Beginner/Number Mirror (START01)/NumberMirror.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int num; 7 | cin>>num; 8 | cout << num; 9 | } 10 | -------------------------------------------------------------------------------- /Beginner/Number Mirror (START01)/mirror.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | char n[50]; 5 | scanf("%s",n); 6 | printf("%s",n); 7 | return 0; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /Beginner/Number Mirror (START01)/mirror.py: -------------------------------------------------------------------------------- 1 | # cook your dish here 2 | n = str(input()) 3 | print(n) -------------------------------------------------------------------------------- /Beginner/Number Mirror (START01)/mirror.rb: -------------------------------------------------------------------------------- 1 | # cook your code here 2 | n = gets 3 | puts n -------------------------------------------------------------------------------- /Beginner/Number Mirror (START01)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/START01 -------------------------------------------------------------------------------- /Beginner/Packaging Cupcakes (MUFFINS3)/muffin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int t; 5 | cin >> t; 6 | while(t--) 7 | { 8 | int m; 9 | cin >> m; 10 | cout << (m/2)+1 << endl; 11 | } 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /Beginner/Packaging Cupcakes (MUFFINS3)/muffin.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | for i in range(t): 4 | n = int(input()) 5 | print(int(n/2) +1 ) -------------------------------------------------------------------------------- /Beginner/Packaging Cupcakes (MUFFINS3)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/MUFFINS3 -------------------------------------------------------------------------------- /Beginner/Palindromic substrings (STRPALIN)/palindrome.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | A = input() 5 | B = input() 6 | f = False; 7 | for i in A: 8 | if i in B: 9 | f = True; 10 | break; 11 | if f == True: 12 | print("Yes") 13 | else: 14 | print("No") 15 | 16 | 17 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Palindromic substrings (STRPALIN)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/STRPALIN -------------------------------------------------------------------------------- /Beginner/Passing marks (PSGRADE)/README.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/PSGRADE -------------------------------------------------------------------------------- /Beginner/Passing marks (PSGRADE)/mark.py: -------------------------------------------------------------------------------- 1 | T= int(input()) 2 | for i in range(T): 3 | Amin,Bmin,Cmin,Tmin,A,B,C = map(int,input().split()) 4 | if ((Amin<=A) and (Bmin<=B) and (Cmin<=C) and (Tmin<=A+B+C)): 5 | print("YES") 6 | else: 7 | print("NO") -------------------------------------------------------------------------------- /Beginner/Peak Finding (UWCOI20A)/finding.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | N = int(input()) 5 | arr = [] 6 | 7 | for i in range(N): 8 | arr.append(int(input())) 9 | 10 | print(max(arr)) 11 | 12 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Peak Finding (UWCOI20A)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/UWCOI20A -------------------------------------------------------------------------------- /Beginner/Phone Prices (S10E)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/S10E 2 | -------------------------------------------------------------------------------- /Beginner/Piece of cake (LCH15JAB)/cake.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | n = str(input()) 5 | for i in list(n): 6 | if n.count(i) == (len(n)-n.count(i)): 7 | print("YES") 8 | break 9 | else: 10 | print("NO") 11 | 12 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Piece of cake (LCH15JAB)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/LCH15JAB -------------------------------------------------------------------------------- /Beginner/Play Piano (PLAYPIAN)/piano.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | P = input() 6 | s = 1 7 | 8 | for i in range(0, len(P), 2): 9 | if P[i]==P[i+1]: 10 | s = 0 11 | break 12 | else: 13 | s = 1 14 | if (s==0): 15 | print("no") 16 | else: 17 | print("yes") 18 | 19 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Play Piano (PLAYPIAN)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/PLAYPIAN -------------------------------------------------------------------------------- /Beginner/Playing with Matches (MATCHES)/matches.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | M = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6] 3 | 4 | while t: 5 | A, B = map(int, input().split()) 6 | m = 0 7 | 8 | S = str(A+B) 9 | for i in S: 10 | i = int(i) 11 | m = m + M[i] 12 | print(m) 13 | 14 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Playing with Matches (MATCHES)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/MATCHES -------------------------------------------------------------------------------- /Beginner/Playing with Strings (PLAYSTR)/playstr.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | N = int(input()) 5 | 6 | S = list(input()) 7 | R = list(input()) 8 | 9 | if S.count('1') == R.count('1'): 10 | print('YES') 11 | else: 12 | print('NO') 13 | 14 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Playing with Strings (PLAYSTR)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/PLAYSTR -------------------------------------------------------------------------------- /Beginner/Primality Test (PRB01)/prime.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | int main() { 5 | int t; 6 | cin >> t; 7 | while(t--) 8 | { 9 | int n; 10 | cin >> n; 11 | int c = 0; 12 | for(int i=1;i<=n;i++) { 13 | if(n%i==0) { 14 | c++; 15 | } 16 | } 17 | if(c==2) { 18 | cout << "yes" << endl; 19 | } 20 | else { 21 | cout << "no" << endl; 22 | } 23 | } 24 | return 0; 25 | } -------------------------------------------------------------------------------- /Beginner/Primality Test (PRB01)/prime.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | for i in range(t): 4 | n = int(input()) 5 | if n==1: 6 | print("no") 7 | elif n>1: 8 | for i in range(2, n): 9 | if n%i==0: 10 | print("no") 11 | break 12 | else: 13 | print("yes") -------------------------------------------------------------------------------- /Beginner/Primality Test (PRB01)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/PRB01 -------------------------------------------------------------------------------- /Beginner/Print Pattern (PPATTERN)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/PPATTERN -------------------------------------------------------------------------------- /Beginner/Program Your Own CALCULATOR (URCALC)/calculator.py: -------------------------------------------------------------------------------- 1 | A = int(input()) 2 | B = int(input()) 3 | C = input() 4 | 5 | if C == '+': 6 | print(A+B) 7 | elif C == '-': 8 | print(A-B) 9 | elif C == '*': 10 | print(A*B) 11 | else: 12 | print(A/B) -------------------------------------------------------------------------------- /Beginner/Program Your Own CALCULATOR (URCALC)/calculator.rb: -------------------------------------------------------------------------------- 1 | a = gets.chomp.to_f 2 | b = gets.chomp.to_f 3 | c = gets 4 | if c == "+" 5 | puts a+b 6 | elsif c == "-" 7 | puts a-b 8 | elsif c == "*" 9 | puts a*b 10 | elsif c == "/" 11 | puts a/b 12 | else 13 | puts "invalid choice" 14 | end 15 | -------------------------------------------------------------------------------- /Beginner/Program Your Own CALCULATOR (URCALC)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/URCALC -------------------------------------------------------------------------------- /Beginner/Puppy and Sum (PPSUM)/puppy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | int t; 5 | scanf("%d", &t); 6 | for(int i=0; i 2 | 3 | int main(void) { 4 | 5 | int t; 6 | scanf("%d", &t); 7 | while(t--){ 8 | int a, b, c, d; 9 | scanf("%d%d%d%d", &a, &b, &c, &d); 10 | if((a==b&&c==d)||(a==c&&b==d)||(a==d&&b==c)) 11 | printf("YES\n"); 12 | else 13 | printf("NO\n"); 14 | } 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Beginner/Rectangle (RECTANGL)/rectangle.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | rect = list(map(int, input().split())) 6 | rect.sort() 7 | 8 | if rect[1]==rect[0] and rect[2]==rect[3]: 9 | print("YES") 10 | else: 11 | print("NO") 12 | 13 | t = t-1 14 | 15 | -------------------------------------------------------------------------------- /Beginner/Reverse The Number (FLOW007)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FLOW007 -------------------------------------------------------------------------------- /Beginner/Reverse The Number (FLOW007)/reverse.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int T, N, digit, number; 5 | scanf("%d", &T); 6 | 7 | for(int i=0;i0){ 11 | digit = N%10; 12 | number += digit; 13 | number *= 10; 14 | N /= 10; 15 | } 16 | printf("%d\n", number/10); 17 | } 18 | return 0; 19 | } -------------------------------------------------------------------------------- /Beginner/Reverse The Number (FLOW007)/reverse.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | num = 0 4 | 5 | for i in range(t): 6 | a = int(input()) 7 | while a: 8 | digit = a % 10 9 | num = num*10 + digit 10 | a = a // 10 11 | print(num) 12 | num = 0 -------------------------------------------------------------------------------- /Beginner/Reverse The Number (FLOW007)/reverse.rb: -------------------------------------------------------------------------------- 1 | t = gets.chomp.to_i 2 | 3 | num = 0 4 | 5 | while t > 0 6 | a = gets.chomp() 7 | rev = a.reverse().to_i 8 | puts(rev) 9 | t-=1 10 | end -------------------------------------------------------------------------------- /Beginner/Second Largest (FLOW017)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FLOW017 -------------------------------------------------------------------------------- /Beginner/Second Largest (FLOW017)/second.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int t; 6 | cin >> t; 7 | while(t--){ 8 | int a, b, c; 9 | cin >> a>> b>> c; 10 | if((a>b && ac)) 11 | cout << a << endl; 12 | else if((b>a && bc)) 13 | cout << b << endl; 14 | else 15 | cout << c << endl; 16 | } 17 | return 0; 18 | } -------------------------------------------------------------------------------- /Beginner/Second Largest (FLOW017)/second.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | arr = [] 4 | 5 | while t: 6 | a, b, c = map(int, input().split(" ")) 7 | arr.clear() 8 | arr.append(a) 9 | arr.append(b) 10 | arr.append(c) 11 | arr.sort() 12 | print(arr[1]) 13 | 14 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Sed Sequences (SEDARR)/README.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/SEDARR -------------------------------------------------------------------------------- /Beginner/Sed Sequences (SEDARR)/sed_sequences.py: -------------------------------------------------------------------------------- 1 | for _ in range(int(input())): 2 | a,k = map(int,input().split()) 3 | 4 | l = list(map(int,input().split())) 5 | 6 | if sum(l) % k == 0: 7 | print(0) 8 | else: 9 | l[0] = l[0] + sum(l) % k 10 | print(1) -------------------------------------------------------------------------------- /Beginner/Similar Dishes (SIMDISH)/dishes.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | 4 | while t: 5 | A = list(map(str,input().split())) 6 | B = list(map(str,input().split())) 7 | 8 | s = 0 9 | 10 | for i in A: 11 | if i in B: 12 | s = s+1 13 | 14 | if s >= 2: 15 | print('similar') 16 | else: 17 | print('dissimilar') 18 | 19 | t = t-1 20 | -------------------------------------------------------------------------------- /Beginner/Similar Dishes (SIMDISH)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/SIMDISH -------------------------------------------------------------------------------- /Beginner/Simple Statistics (SIMPSTAT)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/SIMPSTAT -------------------------------------------------------------------------------- /Beginner/Simple Statistics (SIMPSTAT)/statistics.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | N, K = map(int,input().split()) 5 | A = list(map(int,input().split())) 6 | A.sort() 7 | s = 0 8 | for j in range(K,len(A)-K): 9 | s += A[j] 10 | print(s/(len(A)-(K*2))) 11 | 12 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Small Factorial (FLOW018)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FLOW018 -------------------------------------------------------------------------------- /Beginner/Small Factorial (FLOW018)/sFactorial.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | int t,n; 5 | scanf("%d",&t); 6 | for(int i=0;i=1;j--) 11 | { 12 | f=f*j; 13 | } 14 | printf("%d\n",f); 15 | } 16 | return 0; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Beginner/Small Factorial (FLOW018)/sFactorial.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int n; 6 | cin>>n; 7 | while(n--) 8 | { 9 | int x; 10 | cin>>x; 11 | long fact=1; 12 | for(int i=1;i<=x;++i) 13 | { 14 | fact=fact*i; 15 | } 16 | cout< 2 | 3 | int main(void) 4 | { 5 | int a, b, s; 6 | scanf("%d %d", &a, &b); 7 | if(a>b) { 8 | s = a-b; 9 | } 10 | else if(a<=b) { 11 | s = a+b; 12 | } 13 | printf("%d", s); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /Beginner/Sum OR Difference (DIFFSUM)/diffsum.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | ios_base::sync_with_stdio(0); 7 | cin.tie(0); 8 | int N1; 9 | cin >> N1; 10 | int N2; 11 | cin >> N2; 12 | if(N1 > N2) 13 | cout << N1-N2 << endl; 14 | else 15 | cout << N1+N2 << endl; 16 | return 0; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Beginner/Sum OR Difference (DIFFSUM)/diffsum.py: -------------------------------------------------------------------------------- 1 | # cook your dish here 2 | 3 | a = int(input()) 4 | b = int(input()) 5 | 6 | if a>b: 7 | print(a-b) 8 | else: 9 | print(a+b) -------------------------------------------------------------------------------- /Beginner/Sum OR Difference (DIFFSUM)/diffsum.rb: -------------------------------------------------------------------------------- 1 | num1 = gets.chomp.to_i 2 | num2 = gets.chomp.to_i 3 | 4 | if num1>num2 5 | puts (num1-num2) 6 | else 7 | puts (num1+num2) 8 | end 9 | -------------------------------------------------------------------------------- /Beginner/Sum OR Difference (DIFFSUM)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/DIFFSUM -------------------------------------------------------------------------------- /Beginner/Sum Of Digits (FLOW006)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FLOW006 -------------------------------------------------------------------------------- /Beginner/Sum Of Digits (FLOW006)/sumofdigits.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | // your code goes here 5 | int t; 6 | scanf("%d",&t); 7 | while(t) 8 | { 9 | int n,sum=0; 10 | scanf("%d",&n); 11 | while(n!=0) 12 | { 13 | sum+=n%10; 14 | n/=10; 15 | } 16 | printf("%d\n",sum); 17 | t--; 18 | } 19 | return 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /Beginner/Sum Of Digits (FLOW006)/sumofdigits.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int t,n,total,m; 6 | cin>>t; 7 | 8 | while(t--) 9 | { 10 | total=0; 11 | cin>>n; 12 | while(n>0) 13 | { 14 | m=n%10; 15 | total=total+m; 16 | n=n/10; 17 | } 18 | cout< S.count("I"): 9 | print("NOT INDIAN") 10 | elif "I" in S: 11 | print("INDIAN") 12 | else: 13 | print("NOT SURE") 14 | 15 | t = t-1 16 | -------------------------------------------------------------------------------- /Beginner/Tanu and Head-bob (HEADBOB)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/HEADBOB -------------------------------------------------------------------------------- /Beginner/Task for Alexey (ALEXTASK)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/ALEXTASK 2 | -------------------------------------------------------------------------------- /Beginner/Temple Land (TEMPLELA)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TEMPLELA -------------------------------------------------------------------------------- /Beginner/Testing Robot (TSTROBOT)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TSTROBOT -------------------------------------------------------------------------------- /Beginner/The Block Game (PALL01)/block.py: -------------------------------------------------------------------------------- 1 | # cook your dish here 2 | t = int(input()) 3 | 4 | for i in range(t): 5 | 6 | a = input() 7 | if a == a[::-1]: 8 | print("wins") 9 | else: 10 | print("loses") -------------------------------------------------------------------------------- /Beginner/The Block Game (PALL01)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/PALL01 -------------------------------------------------------------------------------- /Beginner/The Cheaper Cab/CABS_START33.rb: -------------------------------------------------------------------------------- 1 | # cook your code here 2 | number = gets.chomp.to_i 3 | for input in 1..number do 4 | price, price2 = gets.split.map(&:to_i) 5 | if price < price2 6 | puts "first" 7 | elsif price > price2 8 | puts "second" 9 | else 10 | puts "any" 11 | end 12 | end -------------------------------------------------------------------------------- /Beginner/The Deadly Sin (SINS)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/SINS -------------------------------------------------------------------------------- /Beginner/The Last Problem/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/TLAPM -------------------------------------------------------------------------------- /Beginner/The Lead Game (TLG)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TLG -------------------------------------------------------------------------------- /Beginner/The Lead Game (TLG)/tlg.py: -------------------------------------------------------------------------------- 1 | ply1 = 0 2 | ply2 = 0 3 | 4 | diff = 0 5 | 6 | t = int(input()) 7 | while(t>0): 8 | x, y = map(int,input().split(" ")) 9 | ply1 += x 10 | ply2 += y 11 | if(diff < ply1-ply2): 12 | p = 1 13 | diff = ply1-ply2 14 | if(diff < ply2-ply1): 15 | p = 2 16 | diff = ply2-ply1 17 | t -= 1 18 | print(p, " ", diff) -------------------------------------------------------------------------------- /Beginner/The Preparations (SUPCHEF): -------------------------------------------------------------------------------- 1 | //Cpp implementation of Codechef problem SUPCHEF 2 | #include 3 | using namespace std; 4 | 5 | int main() { 6 | // your code goes here 7 | int t; 8 | cin>>t; 9 | while(t--){ 10 | int m,n,k; 11 | cin>>m>>n>>k; 12 | if(n*k 2 | using namespace std; 3 | 4 | int main() { 5 | int t; 6 | cin >> t; 7 | while(t--) { 8 | int x,y,z; 9 | cin >> x >> y >> z; 10 | if((x==y+z) || (y==z+x) || (z==x+y)) { 11 | cout<<"yes"< 2 | 3 | int main(){ 4 | int t,quant,price; 5 | printf("Enter the total number of test cases: "); 6 | scanf("%d",&t); 7 | while(t>0){ 8 | printf("Enter the quantity and price:"); 9 | scanf("%d%d",&quant,&price); 10 | printf("%f\n",(float)(price*quant)); 11 | t--; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Beginner/Total Expenses (FLOW009)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FLOW009 -------------------------------------------------------------------------------- /Beginner/Train Partner (ANKTRAIN)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/ANKTRAIN -------------------------------------------------------------------------------- /Beginner/Turbo Sort (TSORT)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TSORT -------------------------------------------------------------------------------- /Beginner/Turbo Sort (TSORT)/tsort.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hhhrrrttt222111/CodeChef/fe5a76f2dc83e90b39e5af266385eb3be4d3f889/Beginner/Turbo Sort (TSORT)/tsort.c -------------------------------------------------------------------------------- /Beginner/Turbo Sort (TSORT)/tsort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int t,i; 6 | cin>>t; int a[t]; 7 | for(i=0;i>a[i]; 10 | 11 | 12 | } 13 | sort(a,a+t); 14 | 15 | for(i=0;i 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int t; cin >> t; 7 | while(t--) { 8 | int a,b,n; cin >> a>>b>> n; 9 | if(n%2!=0) { 10 | a=2*a; 11 | } 12 | cout << max(a,b)/min(a,b) << '\n'; 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /Beginner/Two Numbers (TWONMS)/two.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | A, B, N = map(int, input().split()) 5 | 6 | while N: 7 | if N%2 != 0: 8 | A = A*2 9 | else: 10 | B = B*2 11 | N = N-1 12 | 13 | print(int(max(A, B)/min(A, B))) 14 | 15 | t = t-1 -------------------------------------------------------------------------------- /Beginner/Two vs Ten (TWOVSTEN)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TWOVSTEN -------------------------------------------------------------------------------- /Beginner/Two vs Ten (TWOVSTEN)/twovsten.c: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int t; 6 | cin>>t; 7 | while(t--) { 8 | int n; 9 | int count =0; 10 | cin>>n; 11 | if(n%10==0) { 12 | cout<<"0"< 2 | 3 | int main() { 4 | 5 | int T, A, B, C; 6 | scanf("%d", &T); 7 | 8 | for(int i=1;i<=T;i++) { 9 | scanf("%d %d %d", &A, &B, &C); 10 | 11 | if(A+B+C==180) { 12 | printf("YES\n"); 13 | } 14 | else { 15 | printf("NO\n"); 16 | } 17 | } 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /Beginner/Valid Triangles (FLOW013)/valid.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int n; 6 | cin>>n; 7 | for(int i=0;i>a>>b>>c; 10 | if(a+b+c==180){ 11 | cout<<"YES"< sum_2: 10 | print(1) 11 | else: 12 | print(2) 13 | -------------------------------------------------------------------------------- /Contests/August Long Challenge 2021 Division 3/Olympics Ranking (OLYRANK)/readme.md: -------------------------------------------------------------------------------- 1 | # https://www.codechef.com/AUG21C/problems/OLYRANK -------------------------------------------------------------------------------- /Contests/August Long Challenge 2021 Division 3/Problem Difficulties (PROBDIFF)/readme.md: -------------------------------------------------------------------------------- 1 | # https://www.codechef.com/AUG21C/problems/PROBDIFF -------------------------------------------------------------------------------- /Contests/August Long Challenge 2021 Division 3/Special Triplets (SPCTRIPS)/readme.md: -------------------------------------------------------------------------------- 1 | # https://www.codechef.com/AUG21C/problems/SPCTRIPS -------------------------------------------------------------------------------- /Contests/CODECHEF STARTERS 13 DIVISION 3/Add and Divide/README.md: -------------------------------------------------------------------------------- 1 | ## Question Link: 2 | 3 | https://www.codechef.com/START13C/problems/ADDNDIV -------------------------------------------------------------------------------- /Contests/CODECHEF STARTERS 13 DIVISION 3/Chef in Vaccination Queue/README.md: -------------------------------------------------------------------------------- 1 | ## Question link 2 | 3 | https://www.codechef.com/START13C/problems/VACCINQ -------------------------------------------------------------------------------- /Contests/CODECHEF STARTERS 13 DIVISION 3/Chef in Vaccination Queue/VACCINQ.py: -------------------------------------------------------------------------------- 1 | for tc in range(int(input())): 2 | n,p,x,y=[int(i) for i in input().split()] 3 | l=[int(i) for i in input().split()] 4 | l=l[:p] 5 | c=0 6 | for i in l: 7 | if i==0: 8 | c+=x 9 | else: 10 | c+=y 11 | print(c) -------------------------------------------------------------------------------- /Contests/CODECHEF STARTERS 13 DIVISION 3/Magical Doors/README.md: -------------------------------------------------------------------------------- 1 | ## Question link: 2 | 3 | https://www.codechef.com/START13C/problems/MAGDOORS -------------------------------------------------------------------------------- /Contests/CODECHEF STARTERS 13 DIVISION 3/Make that Array!/README.md: -------------------------------------------------------------------------------- 1 | ##Question link 2 | 3 | https://www.codechef.com/START13C/problems/SWAPGAME -------------------------------------------------------------------------------- /Contests/CODECHEF STARTERS 13 DIVISION 3/Maximum Light Up/README.md: -------------------------------------------------------------------------------- 1 | ## Question link: 2 | 3 | https://www.codechef.com/START13C/problems/DIWALI1 -------------------------------------------------------------------------------- /Contests/Codeforces #744 Div3/Casimir's_String_Solitare.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | for _ in range(int(input())): 3 | inp=input() 4 | s=dict(Counter(list(inp))) 5 | a,b,c=0,0,0 6 | for i,j in s.items(): 7 | if i=='A': 8 | a=j 9 | elif i=='B': 10 | b=j 11 | else: 12 | c=j 13 | if a+c==b: 14 | print('YES') 15 | else: 16 | print('NO') -------------------------------------------------------------------------------- /Contests/February_Challenge_2021_Division_3/FROGS/README.md: -------------------------------------------------------------------------------- 1 | ## Problem Link 2 | 3 | https://www.codechef.com/FEB21C/problems/FROGS -------------------------------------------------------------------------------- /Contests/February_Challenge_2021_Division_3/MAXFUN/README.md: -------------------------------------------------------------------------------- 1 | ## Problem Link 2 | 3 | https://www.codechef.com/FEB21C/problems/MAXFUN 4 | -------------------------------------------------------------------------------- /Contests/February_Challenge_2021_Division_3/MEET/README.md: -------------------------------------------------------------------------------- 1 | ## Problem Link 2 | https://www.codechef.com/FEB21C/problems/MEET 3 | -------------------------------------------------------------------------------- /Contests/February_Challenge_2021_Division_3/PRIGAME/README.md: -------------------------------------------------------------------------------- 1 | ## Problem Link 2 | https://www.codechef.com/FEB21C/problems/PRIGAME 3 | -------------------------------------------------------------------------------- /Contests/February_Challenge_2021_Division_3/TEAMNAME/README.md: -------------------------------------------------------------------------------- 1 | ## Problem Link 2 | 3 | https://www.codechef.com/FEB21C/problems/TEAMNAME 4 | -------------------------------------------------------------------------------- /Contests/July Long Challenge 2021 Division 3/1_Maximum Production(EITA)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/JULY21C/problems/EITA 2 | -------------------------------------------------------------------------------- /Contests/July Long Challenge 2021 Division 3/2_Relativity (RELATIVE)/2_Relativity.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | ios::sync_with_stdio(0); 7 | cin.tie(0); 8 | cout.tie(0); 9 | int t; 10 | cin>>t; 11 | while(t--) 12 | { 13 | int g,c; 14 | cin>>g>>c; 15 | cout<<(c*c)/(2*g)<<'\n'; 16 | } 17 | return 0; 18 | } -------------------------------------------------------------------------------- /Contests/July Long Challenge 2021 Division 3/2_Relativity (RELATIVE)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/JULY21C/problems/RELATIVE 2 | -------------------------------------------------------------------------------- /Contests/July Long Challenge 2021 Division 3/3_XxOoRr(XXOORR)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/JULY21C/problems/XXOORR 2 | -------------------------------------------------------------------------------- /Contests/July Long Challenge 2021 Division 3/4_Optimal Denomination(MINNOTES)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/JULY21C/problems/MINNOTES -------------------------------------------------------------------------------- /Contests/July Long Challenge 2021 Division 3/5_Chef vs Bharat(CHEFORA)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/JULY21C/problems/CHEFORA -------------------------------------------------------------------------------- /Contests/June Starters Div 3/Chess_Match.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | for i in range(1,n+1): 3 | n,a,b = map(int, input().split()) 4 | x = (2*(180+n)) 5 | y = a + b 6 | z = x-y 7 | print(z) 8 | -------------------------------------------------------------------------------- /Contests/June Starters Div 3/Cyclic_Quadrilateral.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | for i in range(1,n+1): 3 | a,b,c,d = map(int, input().split()) 4 | if (a+c==180 and b+d==180): 5 | print("YES") 6 | else: 7 | print("NO") -------------------------------------------------------------------------------- /Contests/June Starters Div 3/HTML_Tags.py: -------------------------------------------------------------------------------- 1 | import re 2 | p = re.compile('<\/[a-z0-9]+>') 3 | t = int(input()) 4 | for i in range(1,t+1): 5 | mystr = input() 6 | if p.match(mystr): 7 | print("Success") 8 | else: 9 | print("Error") -------------------------------------------------------------------------------- /Contests/May Cook-off 2021 Div 3/readme.md: -------------------------------------------------------------------------------- 1 | [COOK129C](https://www.codechef.com/COOK129C) 2 | -------------------------------------------------------------------------------- /Contests/NoChange(NOCHANGE)/readme.md: -------------------------------------------------------------------------------- 1 | [a link](https://www.codechef.com/FEB20B/problems/NOCHANGE) -------------------------------------------------------------------------------- /Contests/RCB and Playoffs/README.md: -------------------------------------------------------------------------------- 1 | Question link 2 | https://www.codechef.com/START14C/problems/RCBPLAY 3 | -------------------------------------------------------------------------------- /Contests/README.md: -------------------------------------------------------------------------------- 1 | # Codechef monthly contests solutions 2 | 3 | ## Create a folder for each problem. 4 | -------------------------------------------------------------------------------- /Contests/September Long Challenge 2021 Division 3/2-D Point Meeting (POINTMEE)/readme.md: -------------------------------------------------------------------------------- 1 | # https://www.codechef.com/SEPT21C/problems/POINTMEE -------------------------------------------------------------------------------- /Contests/September Long Challenge 2021 Division 3/Airline Restrictions (AIRLINE)/readme.md: -------------------------------------------------------------------------------- 1 | # https://www.codechef.com/SEPT21C/problems/AIRLINE -------------------------------------------------------------------------------- /Contests/September Long Challenge 2021 Division 3/Minimize Digit Sum (MNDIGSUM)/readme.md: -------------------------------------------------------------------------------- 1 | Problem:[Minimize Digit Sum](https://www.codechef.com/SEPT21C/problems/MNDIGSUM) 2 | -------------------------------------------------------------------------------- /Contests/September Long Challenge 2021 Division 3/Shuffling Parities (SHUFFLIN)/SHUFFLIN.py: -------------------------------------------------------------------------------- 1 | # cook your dish here 2 | for _ in range(int(input())): 3 | n = int(input()) 4 | l = list(map(int, input().split())) 5 | flag = tmp = 0 6 | for i in l: 7 | if(i%2 == 1): 8 | flag += 1 9 | else: 10 | tmp += 1 11 | tt = min(flag, n//2) + min(tmp, (n + 1)// 2) 12 | print(tt) -------------------------------------------------------------------------------- /Contests/September Long Challenge 2021 Division 3/Shuffling Parities (SHUFFLIN)/readme.md: -------------------------------------------------------------------------------- 1 | # https://www.codechef.com/SEPT21C/problems/SHUFFLIN -------------------------------------------------------------------------------- /Contests/September Long Challenge 2021 Division 3/Travel Pass (TRAVELPS)/readme.md: -------------------------------------------------------------------------------- 1 | # https://www.codechef.com/SEPT21C/problems/TRAVELPS -------------------------------------------------------------------------------- /Contests/September Long Challenge 2021 Division 3/XOR Equal (PALINT)/readme.md: -------------------------------------------------------------------------------- 1 | # https://www.codechef.com/SEPT21C/problems/PALINT -------------------------------------------------------------------------------- /Contests/Starter 13 Div. 2/Chef in Vaccination Queue/README.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/START13B/problems/VACCINQ 2 | -------------------------------------------------------------------------------- /Contests/Starter 13 Div. 2/Interesting Pairs/README.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/START13B/problems/DIVPAIRS 2 | -------------------------------------------------------------------------------- /Contests/Starter 13 Div. 2/Magical Doors/README.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/START13B/problems/MAGDOORS 2 | -------------------------------------------------------------------------------- /Contests/Starter 13 Div. 2/Make that Array!/README.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/START13B/problems/SWAPGAME 2 | -------------------------------------------------------------------------------- /Contests/Starter 13 Div. 2/Maximum Light Up/README.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/START13B/problems/DIWALI1 2 | -------------------------------------------------------------------------------- /Contests/Starters 14 Div 3/RCBPLAY: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int t; cin>>t; 6 | while(t--){ 7 | int x, y, z; 8 | cin>>x>>y>>z; 9 | if((y-x) <= 2*z) 10 | cout<<"YES\n"; 11 | else 12 | cout<<"NO\n"; 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /Contests/Starters 14 Div 3/RCBPLAY.py: -------------------------------------------------------------------------------- 1 | for _ in range(int(input())): 2 | x,y,z=[int(i) for i in input().split()] 3 | if x+(2*z)>=y: 4 | print('YES') 5 | else: 6 | print('NO') -------------------------------------------------------------------------------- /Contests/Starters 7 Div 3/CEILSUM.py: -------------------------------------------------------------------------------- 1 | import math 2 | t = int(input()) 3 | for i in range(1,t+1): 4 | a,b = map(int, input().strip().split()) 5 | s = [] 6 | if (a!=b): 7 | for x in range(a,a+2): 8 | first = math.ceil((b-x)/2) 9 | part = math.ceil((x-a)/2) 10 | sum = (first+part) 11 | s.append(sum) 12 | print(max(s)) 13 | else: 14 | print(0) -------------------------------------------------------------------------------- /Contests/Starters 7 Div 3/MAXARXOR.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | for i in range(1,t+1): 3 | N,k= map(int, input().strip().split()) 4 | max=(2**N)-1 5 | if (k>=(2**(N-1))): 6 | k = (2**(N-1)) 7 | else : 8 | k = k 9 | any = (0^max) 10 | ans = any*(2*k) 11 | print(ans) -------------------------------------------------------------------------------- /Contests/Strong Language (SSCRIPT)/Readme.md: -------------------------------------------------------------------------------- 1 | Link to the Problem: https://www.codechef.com/APRIL21C/problems/SSCRIPT 2 | -------------------------------------------------------------------------------- /Contests/Summer Heat (COCONUT)/COCONUT.py: -------------------------------------------------------------------------------- 1 | T = int(input()) 2 | 3 | for _ in range(T): 4 | xa, xb, Xa, Xb = map(int, input().split()) 5 | print(int(Xa/xa + Xb/xb)) 6 | -------------------------------------------------------------------------------- /Contests/Summer Heat (COCONUT)/Readme.md: -------------------------------------------------------------------------------- 1 | Link for the question: https://www.codechef.com/JUNE21C/problems/COCONUT -------------------------------------------------------------------------------- /Contests/Tic Tac Toe (TCTCTOE)/Readme.md: -------------------------------------------------------------------------------- 1 | Link for the question: https://www.codechef.com/MAY21C/problems/TCTCTOE/ 2 | -------------------------------------------------------------------------------- /Contests/Tom And Jerry 1 (TANDJ1)/Readme.md: -------------------------------------------------------------------------------- 1 | Link for the question: https://www.codechef.com/LTIME96B/problems/TANDJ1 2 | -------------------------------------------------------------------------------- /Contests/Two Dishes (TWODISHES)/Readme.md: -------------------------------------------------------------------------------- 1 | Link for the question: https://www.codechef.com/LTIME100C/problems/TWODISH 2 | -------------------------------------------------------------------------------- /Contests/Vaccine Dates (VDATES)/Readme.md: -------------------------------------------------------------------------------- 1 | Link for the quetion: 2 | https://www.codechef.com/LTIME100C/problems/VDATES 3 | -------------------------------------------------------------------------------- /Contests/Worthy Matrix (KAVGMAT)/Readme.md: -------------------------------------------------------------------------------- 1 | Link to the Problem: https://www.codechef.com/APRIL21C/problems/KAVGMAT/ 2 | -------------------------------------------------------------------------------- /Contests/Yet another SOD problem (SOD3)/Readme.md: -------------------------------------------------------------------------------- 1 | ## Link for the question 2 | https://www.codechef.com/LTIME100C/problems/SOD3 3 | -------------------------------------------------------------------------------- /Easy/A Weird Device (ICL1901)/device.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | // your code goes here 6 | int t; cin>>t; 7 | while(t--) { 8 | long k,n; cin>>k>>n; 9 | int d1=k%10,d2=k/10%10,d3=k/100%10; 10 | if(d1!=d2 && d2!=d3 && d3!=d1) cout<<27; 11 | else if(d1==d2 && d2==d3 && d3==d1) cout<<1; 12 | else cout<<8; 13 | cout< 2 | using namespace std; 3 | 4 | int main() { 5 | long long t; 6 | cin>>t; 7 | while(t--) 8 | { 9 | long long l,r; 10 | cin>>l>>r; 11 | if(r<2*l) 12 | cout< 2 | 3 | ### https://www.codechef.com/START14B/problems/DIAGMOVE 4 | -------------------------------------------------------------------------------- /Easy/Distinct Codes (DISTCODE)/distinct.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | l = [input() for i in range(t)] 3 | for code in range(len(l)): 4 | check = [] 5 | for i in range(len(l[code])): 6 | if i < len(l[code]) - 1: 7 | value = l[code][i]+l[code][i+1] 8 | if value not in check: 9 | check.append(value) 10 | print(len(check)) 11 | 12 | -------------------------------------------------------------------------------- /Easy/Distinct Codes (DISTCODE)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/DISTCODE -------------------------------------------------------------------------------- /Easy/Dividing Stamps (DIVIDING)/dividing_stamps.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main() { 7 | 8 | ios::sync_with_stdio(0); 9 | cin.tie(0); 10 | int n,e,sum=0; 11 | cin>>n; 12 | int a[n]; 13 | for(e=0;e>a[e]; 16 | sum+=a[e]; 17 | sum-=(e+1); 18 | } 19 | if(sum==0) cout<<"YES"<<'\n'; 20 | else cout<<"NO"<<'\n'; 21 | return 0; 22 | } -------------------------------------------------------------------------------- /Easy/Dividing Stamps (DIVIDING)/readme.md: -------------------------------------------------------------------------------- 1 | Dividing Stamps (DIVIDING) 2 | https://www.codechef.com/problems/DIVIDING 3 | -------------------------------------------------------------------------------- /Easy/Doctor Chef (DRCHEF)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/DRCHEF -------------------------------------------------------------------------------- /Easy/Double Distance Query(DDQUERY)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://discuss.codechef.com/problems/DDQUERY 2 | -------------------------------------------------------------------------------- /Easy/Eat Twice (EATTWICE)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/EATTWICE -------------------------------------------------------------------------------- /Easy/Even Matrix (EVENM)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/EVENM 2 | -------------------------------------------------------------------------------- /Easy/FIXFIX Starters codechef/Readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/START14B/problems/FIXFIX/ -------------------------------------------------------------------------------- /Easy/Factorial (FCTRL)/factorial: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hhhrrrttt222111/CodeChef/fe5a76f2dc83e90b39e5af266385eb3be4d3f889/Easy/Factorial (FCTRL)/factorial -------------------------------------------------------------------------------- /Easy/Factorial (FCTRL)/factorial.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void){ 4 | long long t, n; 5 | scanf("%lld", &t); 6 | while (t --) 7 | { 8 | long long ans = 0; 9 | scanf("%lld", &n); 10 | int i; 11 | for(i=5;i<=n;i*=5){ 12 | ans += n/i; 13 | } 14 | printf("%lld\n", ans); 15 | } 16 | } -------------------------------------------------------------------------------- /Easy/Factorial (FCTRL)/factorial.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | // your code goes here 6 | long long int t, n; 7 | cin >> t; 8 | while(t--) { 9 | long long int ans=0; 10 | cin >> n; 11 | for(int i=5; i<=n; i=i*5) { 12 | ans = ans + (n/i); 13 | } 14 | cout<= 1; i--){ 7 | answer = answer * i; 8 | } 9 | return answer; 10 | } 11 | } 12 | let n = 4; 13 | answer = factorial(n) 14 | console.log("The factorial of " + n + " is " + answer); 15 | -------------------------------------------------------------------------------- /Easy/Factorial (FCTRL)/factorial.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t: 4 | a = int(input()) 5 | 6 | count = 0 7 | i = 5 8 | 9 | while (a/i>=1): 10 | count += int(a/i) 11 | i *= 5 12 | 13 | print(count) 14 | 15 | t = t-1 -------------------------------------------------------------------------------- /Easy/Factorial (FCTRL)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FCTRL -------------------------------------------------------------------------------- /Easy/Find Digits/README.md: -------------------------------------------------------------------------------- 1 | Link to the question - https://www.hackerrank.com/challenges/find-digits/problem -------------------------------------------------------------------------------- /Easy/Flappy Bird/Readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/START5A/problems/FLAPPYBD 2 | -------------------------------------------------------------------------------- /Easy/GCD Operations (GCDOPS)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/GCDOPS -------------------------------------------------------------------------------- /Easy/Game of life/README.md: -------------------------------------------------------------------------------- 1 | # Game of life 2 | 3 | Game of life - John Conway in Javascript and p5.js 4 | -------------------------------------------------------------------------------- /Easy/Game on a Strip (ARRGAME)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/ARRGAME -------------------------------------------------------------------------------- /Easy/Infinite Increments (INFTINCR)/Infinite_Increments.py: -------------------------------------------------------------------------------- 1 | for _ in range(int(input())): 2 | n = int(input()) 3 | a = list(map(int,input().split())) 4 | ans = a[0]-a[1] 5 | for i in range(1,n-1): 6 | m = a[i]-a[i+1] 7 | if ans > m : ans = m 8 | print(ans) -------------------------------------------------------------------------------- /Easy/Infinite Increments (INFTINCR)/readme.md.txt: -------------------------------------------------------------------------------- 1 | https://discuss.codechef.com/problems/INFTINCR -------------------------------------------------------------------------------- /Easy/K - balanced string/README.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/KBALANCE/ 2 | -------------------------------------------------------------------------------- /Easy/K-Concatenation/ReadME.md: -------------------------------------------------------------------------------- 1 | *Question Link* ----- 2 | [K-Concatenation](https://www.codechef.com/problems/KCON) 3 | -------------------------------------------------------------------------------- /Easy/K-Foldable String/Readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/COOK121B/problems/KFOLD/ 2 | -------------------------------------------------------------------------------- /Easy/Life, the Universe, and Everything (TEST)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TEST -------------------------------------------------------------------------------- /Easy/Life, the Universe, and Everything (TEST)/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int n; 5 | scanf("%d", &n); 6 | while(n!=42) { 7 | printf("%d\n", n); 8 | scanf("%d", &n); 9 | } 10 | return 0; 11 | } -------------------------------------------------------------------------------- /Easy/Life, the Universe, and Everything (TEST)/test.c++: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int currInp = 0; 6 | while(1) { 7 | cin >> currInp; 8 | if(currInp == 42) { 9 | break; 10 | } 11 | cout << currInp << endl; 12 | } 13 | return 0; 14 | } -------------------------------------------------------------------------------- /Easy/Life, the Universe, and Everything (TEST)/test.go: -------------------------------------------------------------------------------- 1 | package main 2 | import "fmt" 3 | 4 | func main(){ 5 | for { 6 | var a int 7 | fmt.Scanln(&a) 8 | if (a==42){ 9 | break 10 | } 11 | fmt.Println(a) 12 | } 13 | // your code goes here 14 | } 15 | -------------------------------------------------------------------------------- /Easy/Life, the Universe, and Everything (TEST)/test.py: -------------------------------------------------------------------------------- 1 | while True: 2 | 3 | n = int(input()) 4 | if (n==42): 5 | break 6 | else: 7 | print(n) -------------------------------------------------------------------------------- /Easy/Missing a Point (PTMISSING)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/PTMSSNG -------------------------------------------------------------------------------- /Easy/Nuclear Reactors (NUKES)/NuclearReactors.py: -------------------------------------------------------------------------------- 1 | 2 | A, N, K = map(int, input().split(' ')) 3 | N += 1 4 | 5 | for i in range(K): 6 | print(A%N, end=" ") 7 | A = A // N 8 | -------------------------------------------------------------------------------- /Easy/Nuclear Reactors (NUKES)/README.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/NUKES -------------------------------------------------------------------------------- /Easy/Nuclear Reactors (NUKES)/output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hhhrrrttt222111/CodeChef/fe5a76f2dc83e90b39e5af266385eb3be4d3f889/Easy/Nuclear Reactors (NUKES)/output.png -------------------------------------------------------------------------------- /Easy/Obtain The Sum (BIGARRAY)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/START11B/problems/BIGARRAY 2 | -------------------------------------------------------------------------------- /Easy/Odd GCD (BININVER)/bininver.md: -------------------------------------------------------------------------------- 1 | ## Link for the problem 2 | 3 | https://www.codechef.com/START14B/problems/BININVER 4 | 5 | -------------------------------------------------------------------------------- /Easy/PAIRDIST-Chef and Pairwise distance/Readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/COOK133B/problems/PAIRDIST 2 | -------------------------------------------------------------------------------- /Easy/Please like me (PLSLYKME)/PLEASE LIKE ME.py: -------------------------------------------------------------------------------- 1 | N=int(input("Enter the number of test cases:")) 2 | for i in range(0,N): 3 | L,D,S,C=map(int,input().split()) 4 | for i in range(1,D): 5 | if(S>=L): 6 | S+=C*S 7 | break 8 | if L<= S: 9 | print("ALIVE AND KICKING") 10 | else: 11 | print("DEAD AND ROTTING") -------------------------------------------------------------------------------- /Easy/Positive Spewing(POSSPEW)/Readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/POSSPEW -------------------------------------------------------------------------------- /Easy/Processing A String (KOL15A)/processing_a_string.py: -------------------------------------------------------------------------------- 1 | s= input("Enter ") 2 | add= 0 3 | for i in s: 4 | if( i.isnumeric() ): 5 | add= add+int(i) 6 | print(add) -------------------------------------------------------------------------------- /Easy/Processing a string (KOL15A)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/KOL15A -------------------------------------------------------------------------------- /Easy/Ready Bitwise (REBIT)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/REBIT 2 | -------------------------------------------------------------------------------- /Easy/Root the Tree (ROOTTREE)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/ROOTTREE -------------------------------------------------------------------------------- /Easy/Sleep Cycle/Readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/START5A/problems/SLPCYCLE 2 | -------------------------------------------------------------------------------- /Easy/Smallest KMP (SKMP)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/AUG20B/problems/SKMP -------------------------------------------------------------------------------- /Easy/Special Triplets/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/AUG21C/problems/SPCTRIPS -------------------------------------------------------------------------------- /Easy/Splitting Candies/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/SPCANDY 2 | -------------------------------------------------------------------------------- /Easy/Splitting Candies/spcandy.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | typedef long long int ll; 4 | 5 | 6 | int main() { 7 | int t; 8 | cin>>t; 9 | ll n,k,d,e; 10 | while(t--){ 11 | 12 | cin>>n>>k; 13 | if(k!=0){ 14 | d=ll(n/k); 15 | e=n%k; 16 | cout< 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | double n,x,y,a,b,total; 8 | double tip,tax; 9 | cin>>n; 10 | cin>>tip>>tax; 11 | x=tip/100; 12 | y=tax/100; 13 | a=n*x; 14 | b=n*y; 15 | total=n+a+b; 16 | cout< 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int a,b; 7 | cin>>a>>b; 8 | int sum=a+b; 9 | int dif=a-b; 10 | cout< 2 | #include 3 | using namespace std; 4 | 5 | int main() { 6 | string a,b; 7 | cin>>a>>b; 8 | cout<& prices) { 4 | int max_profit = 0; 5 | 6 | for(int i = 0; i < prices.size()-1; i++) 7 | { 8 | if(prices[i + 1] >= prices[i]) 9 | max_profit += prices[i + 1] - prices[i]; 10 | } 11 | return max_profit; 12 | } 13 | }; -------------------------------------------------------------------------------- /MORE CODING PLATFORMS/LeetCode/Climbing Stairs/Solution.cpp: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | int climbStairs(int n) { 4 | 5 | int dp[n+1]; 6 | 7 | dp[0] = 1; 8 | dp[1] = 1; 9 | 10 | for(int i = 2; i <= n; i++) 11 | { 12 | dp[i] = dp[i - 1] + dp[i - 2]; 13 | } 14 | return dp[n]; 15 | } 16 | }; -------------------------------------------------------------------------------- /MORE CODING PLATFORMS/LeetCode/README.md: -------------------------------------------------------------------------------- 1 | # [LeetCode](https://leetcode.com/) -------------------------------------------------------------------------------- /MORE CODING PLATFORMS/SPOJ/Crucial Equation (CEQU)/README.md: -------------------------------------------------------------------------------- 1 | PROBLEM LINK: 2 | 3 | https://www.spoj.com/problems/CEQU/ 4 | -------------------------------------------------------------------------------- /MORE CODING PLATFORMS/SPOJ/README.md: -------------------------------------------------------------------------------- 1 | # [SPOJ](https://www.spoj.com/) 2 | -------------------------------------------------------------------------------- /MORE CODING PLATFORMS/SPOJ/The last digit (LASTDIG)/README.md: -------------------------------------------------------------------------------- 1 | PROBLEM LINK: 2 | 3 | https://www.spoj.com/problems/LASTDIG/ 4 | -------------------------------------------------------------------------------- /Medium/A Counting Problem(COUNTA)/Readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/START11B/problems/COUNTA/ -------------------------------------------------------------------------------- /Medium/ABC-Strings (ABCSTR)/Readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/ABCSTR 2 | -------------------------------------------------------------------------------- /Medium/Alphabets in order with numbers/alphabets.py: -------------------------------------------------------------------------------- 1 | def alpha(a): 2 | c = 0 3 | for i in range(len(a)): 4 | if i==ord(a[i])-97 or i==ord(a[i])-65: 5 | c+=1 6 | return c 7 | 8 | a = input() 9 | print(alpha(a)) 10 | -------------------------------------------------------------------------------- /Medium/Array Rotation Returns (ARRT)/Question.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/LTIME98B/problems/ARRT 2 | -------------------------------------------------------------------------------- /Medium/Boolean Game/Readme.md: -------------------------------------------------------------------------------- 1 | Heya folks !! 2 | 3 | welcome to my readme file. So excited to see the codechef question? 4 | oh yes!! 5 | 6 | link - codechef.com/problems/BOOLGAME 7 | 8 | -------------------------------------------------------------------------------- /Medium/Bytelandian gold coins (COINS)/coins.py: -------------------------------------------------------------------------------- 1 | arr = {0:0,1:1} 2 | 3 | def coin(n): 4 | if n in arr: 5 | return arr[n] 6 | else: 7 | arr[n] = max(n, coin(n//2)+coin(n//3)+coin(n//4)) 8 | 9 | return arr[n] 10 | 11 | 12 | while True: 13 | try: 14 | a = (input()) 15 | print(coin(int(a))) 16 | except: 17 | break 18 | 19 | 20 | -------------------------------------------------------------------------------- /Medium/Bytelandian gold coins (COINS)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/COINS -------------------------------------------------------------------------------- /Medium/Chef and Cube/readme.md: -------------------------------------------------------------------------------- 1 | CHEF AND CUBE : https://www.codechef.com/JULY15/problems/CHCUBE/ 2 | -------------------------------------------------------------------------------- /Medium/Chef and Laddus for Children/READme.md: -------------------------------------------------------------------------------- 1 | `Chef and LAddus for Children:` 2 | https://www.codechef.com/problems/CCBTS03 3 | -------------------------------------------------------------------------------- /Medium/Dual Nim (TWONIM)/dual_nim.py: -------------------------------------------------------------------------------- 1 | for _ in range(int(input())): 2 | n=int(input()) 3 | a=list(map(int, input().split())) 4 | ans=0 5 | for i in a: 6 | ans^=i 7 | if(ans==0): 8 | print('First') 9 | else: 10 | if(n%2==0): 11 | print('First') 12 | else: 13 | print('Second') -------------------------------------------------------------------------------- /Medium/Dual Nim (TWONIM)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TWONIM 2 | -------------------------------------------------------------------------------- /Medium/Flipping Coins(FLIPCOIN)/Flipping Coins.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | try: 3 | n,q=map(int,input().split()) 4 | arr=np.zeros(n,dtype=bool) 5 | for i in range(q): 6 | t,a,b=map(int,input().split()) 7 | if t==0: 8 | arr[a:b+1]=~arr[a:b+1] 9 | else: 10 | print(np.count_nonzero(arr[a:b+1])) 11 | except: 12 | pass 13 | -------------------------------------------------------------------------------- /Medium/Flipping Coins(FLIPCOIN)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/FLIPCOIN 2 | -------------------------------------------------------------------------------- /Medium/Guess my Age (GUESSAGE)/readme.md: -------------------------------------------------------------------------------- 1 | https://www.codechef.com/problems/GUESSAGE 2 | -------------------------------------------------------------------------------- /Medium/Increasing Xor Sequence(INCXOR)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/INCXOR 2 | -------------------------------------------------------------------------------- /Medium/Integer Sequences (SEQUENCE)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/SEQUENCE -------------------------------------------------------------------------------- /Medium/Knapsack Problem(KNPSK)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/KNPSK 2 | -------------------------------------------------------------------------------- /Medium/Marbles(MARBLES)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/MARBLES 2 | -------------------------------------------------------------------------------- /Medium/Optical Denomination/readme.md: -------------------------------------------------------------------------------- 1 | OPTICAL DENOMINATION: https://www.codechef.com/JULY21C/problems/MINNOTES/ 2 | -------------------------------------------------------------------------------- /Medium/Palindromes Machine (PALMACH)/readme.md: -------------------------------------------------------------------------------- 1 | https://discuss.codechef.com/problems/PALMACH -------------------------------------------------------------------------------- /Medium/Professors De (PROFDE)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/PROFDE 2 | -------------------------------------------------------------------------------- /Medium/Root of the Problem(TREEROOT)/readme.md: -------------------------------------------------------------------------------- 1 | ### https://www.codechef.com/problems/TREEROOT 2 | -------------------------------------------------------------------------------- /Medium/Root of the Problem(TREEROOT)/treeroot.py: -------------------------------------------------------------------------------- 1 | t = int(input()) 2 | 3 | while t > 0: 4 | t -= 1 5 | n = int(input()) 6 | ans = 0 7 | for i in range(n): 8 | tmp = input().split(' ') 9 | ans += int(tmp[0]) - int(tmp[1]) 10 | print(ans) -------------------------------------------------------------------------------- /Medium/Shift The String(TASHIFT)/README.md: -------------------------------------------------------------------------------- 1 | # https://www.codechef.com/problems/TASHIFT 2 | -------------------------------------------------------------------------------- /Medium/Shift The String(TASHIFT)/TASHIFT.py: -------------------------------------------------------------------------------- 1 | n=int(input()) 2 | a=input() 3 | c=input() 4 | b=c+c 5 | res=0 6 | left=0 7 | right=n-1 8 | while(left<=right): 9 | mid=int((left+right)/2) 10 | d = a[:mid + 1] 11 | ans = b.find(d) 12 | if(ans==-1): 13 | right=mid-1 14 | else: 15 | left=mid+1 16 | if(res