Showing preview only (3,686K chars total). Download the full file or copy to clipboard to get everything.
Repository: MathProgrammer/CodeForces
Branch: master
Commit: e3483c1ac4a7
Files: 2576
Total size: 3.0 MB
Directory structure:
gitextract_wq208o93/
├── 2020/
│ ├── Combined Divisions/
│ │ ├── 621 Div 1 + 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Cow and Fields Explanation.txt
│ │ │ │ ├── Cow and Friend Explanation.txt
│ │ │ │ ├── Cow and Haybales Explanation.txt
│ │ │ │ ├── Cow and Message Explanation.txt
│ │ │ │ └── Cows and Treats Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Cow and Fields.cpp
│ │ │ ├── Cow and Haybales.cpp
│ │ │ ├── Cow and Message.cpp
│ │ │ └── Cows and Treats.cpp
│ │ ├── CodeForces Global Round 7/
│ │ │ ├── Explanations/
│ │ │ │ ├── Bad Ugly Numbers Explanation.txt
│ │ │ │ ├── Maximums Explanation.txt
│ │ │ │ ├── Permutation Partitions Explanation.txt
│ │ │ │ └── Prefix Suffix Palindrome (Easy Version) Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Bad Ugly Numbers.cpp
│ │ │ ├── Maximums.cpp
│ │ │ ├── Permutation Partitions.cpp
│ │ │ └── Prefix Suffix Palindrome (Easy Version).cpp
│ │ └── Ozone Tech Challenge 2020/
│ │ ├── Explanations/
│ │ │ ├── Kuroni and Impossible Calculation Explanation.txt
│ │ │ ├── Kuroni and Punishment Explanation.txt
│ │ │ ├── Kuroni and Simple Strings Explanation.txt
│ │ │ ├── Kuroni and the Celebration Explanation.txt
│ │ │ └── Kuroni and the Gifts Explanation.txt
│ │ └── Programs/
│ │ ├── Kuroni and Impossible Calculation.cpp
│ │ ├── Kuroni and Punishment.cpp
│ │ ├── Kuroni and Simple Strings.cpp
│ │ ├── Kuroni and the Celebration.cpp
│ │ └── Kuroni and the Gifts.cpp
│ ├── Div 2/
│ │ ├── 606 Div 2 Technocup 2020 Elimination Round 4/
│ │ │ ├── Explanations/
│ │ │ │ ├── As Simple as One and Two Explanation.txt
│ │ │ │ ├── Happy Birthday Polycarp Explanation.txt
│ │ │ │ └── Make Them Odd Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── As Simple as One and Two.cpp
│ │ │ ├── Happy Birthday Polycarp.cpp
│ │ │ └── Make Them Odd.cpp
│ │ ├── 609 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Domino for Young Explanation.txt
│ │ │ │ ├── Equation Explanation.txt
│ │ │ │ ├── Long Beautiful Integer Explanation.txt
│ │ │ │ └── Modulo Equality Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Domino for Young.cpp
│ │ │ ├── Equation.cpp
│ │ │ ├── Long Beautiful Integer.cpp
│ │ │ └── Modulo Equality.cpp
│ │ ├── 612 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Angry Students Explanation.txt
│ │ │ │ ├── Hyperset Explanation.txt
│ │ │ │ └── Madhouse (Easy Version) Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Angry Students.cpp
│ │ │ ├── Hyperset.cpp
│ │ │ └── Madhouse (Easy Version).cpp
│ │ ├── 613 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Dr Evil Underscores Explanation.txt
│ │ │ │ ├── Fadi and LCM Explanation.txt
│ │ │ │ ├── Just Eat It Explanation.txt
│ │ │ │ └── Mezo Playing Zoma Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Dr Evil Underscores.cpp
│ │ │ ├── Fadi and LCM.cpp
│ │ │ ├── Just Eat It.cpp
│ │ │ └── Mezo Playing Zoma.cpp
│ │ ├── 616 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Array Sharpening Explanation.txt
│ │ │ │ ├── Even But Not Even Explanation.txt
│ │ │ │ └── Mind Control Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Array Sharpening.cpp
│ │ │ ├── Even But Not Even.cpp
│ │ │ └── Mind Control.cpp
│ │ ├── 618 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ └── Anu has a Function Explanation.txt
│ │ │ └── Programs/
│ │ │ └── Anu has a Function.cpp
│ │ ├── 619 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Ayoub's Function Explanation.txt
│ │ │ │ ├── Motarack's Birthday Explanation.txt
│ │ │ │ ├── Three Strings Explanation.txt
│ │ │ │ └── Time to Run Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Ayoub's Function.cpp
│ │ │ ├── Motarack's Birthday.cpp
│ │ │ ├── Three Strings.cpp
│ │ │ └── Time to Run.cpp
│ │ ├── 620 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── 1-Trees and Queries Explanation.txt
│ │ │ │ ├── Air Conditioner Explanation.txt
│ │ │ │ ├── Longest Palindrome Explanation.txt
│ │ │ │ ├── Shortest and Longest LIS Explanation.txt
│ │ │ │ └── Two Rabbits Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── 1-Trees and Queries.cpp
│ │ │ ├── Air Conditioner.cpp
│ │ │ ├── Longest Palindrome.cpp
│ │ │ ├── Shortest and Longest LIS.cpp
│ │ │ └── Two Rabbits.cpp
│ │ ├── 622 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Fast Food Restaurant Explanation.txt
│ │ │ │ ├── Sky Scrapers (Hard Version) Explanation.txt
│ │ │ │ └── Skyscrapers (Easy Version) Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Fast Food Restaurants.cpp
│ │ │ ├── Skyscrapers (Easy Version).cpp
│ │ │ └── Skyscrapers (Hard Version).cpp
│ │ ├── 623 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Dead Pixel Explanation.txt
│ │ │ │ ├── Homecoming Explanation.txt
│ │ │ │ ├── Recommendations Explanation.txt
│ │ │ │ └── Restoring Permutation Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Dead Pixel.cpp
│ │ │ ├── Homecoming.cpp
│ │ │ ├── Recommendations.cpp
│ │ │ └── Restoring Permutations.cpp
│ │ ├── 625 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Contest for Robots Explanation.txt
│ │ │ │ ├── Journey Planning Explanation.txt
│ │ │ │ ├── Navigation System Explanation.txt
│ │ │ │ └── Remove Adjacent Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Contest for Robotos.cpp
│ │ │ ├── Journey Planning.cpp
│ │ │ ├── Navigation System.cpp
│ │ │ └── Remove Adjacent.cpp
│ │ ├── 626 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Count Subrectangles Explanation.txt
│ │ │ │ ├── Even Subset Sum Problem Explanation.txt
│ │ │ │ └── Unusual Competitions Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Counting Subrectangles.cpp
│ │ │ ├── Even Subset Sum Problem.cpp
│ │ │ └── Unusual Competitions.cpp
│ │ ├── 628 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Copy Copy Copy Copy Copy Explanation.txt
│ │ │ │ ├── Ehab and GCD Explanation.txt
│ │ │ │ ├── Ehab and Path-etic MEX Explanation.txt
│ │ │ │ └── Ehab and XORcist Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Copy Copy Copy Copy Copy.cpp
│ │ │ ├── Ehab and GCD.cpp
│ │ │ ├── Ehab and Pathetic MEX.cpp
│ │ │ └── Ehab and XORcist.cpp
│ │ ├── 630 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Composite Coloring Explanation.txt
│ │ │ │ ├── Exercising Walk Explanation.txt
│ │ │ │ ├── Height All The Same Explanation.txt
│ │ │ │ ├── K Complete Word Explanation.txt
│ │ │ │ └── Walk on Matrix Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Composite Coloring.cpp
│ │ │ ├── Exercising Walk.cpp
│ │ │ ├── Height All the Same.cpp
│ │ │ ├── K Complete Word.cpp
│ │ │ └── Walk on Matrix.cpp
│ │ ├── 631 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Dreamoon Likes Coloring Explanation.txt
│ │ │ │ ├── Dreamoon Likes Permutations Explanation.txt
│ │ │ │ ├── Dreamoon Likes Sequences Explanation.txt
│ │ │ │ └── Dreamoon and Ranking Collection Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Dreamoon Likes Coloring.cpp
│ │ │ ├── Dreamoon Likes Permutations.cpp
│ │ │ ├── Dreamoon Likes Sequences.cpp
│ │ │ └── Dreamoon and Ranking Collection.cpp
│ │ ├── 632 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Eugene and Array Explanation.txt
│ │ │ │ ├── Kate and Imperfection Explanation.txt
│ │ │ │ ├── Kind Anton Explanation.txt
│ │ │ │ └── Little Artem Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Eugene and Array.cpp
│ │ │ ├── Kate and Imperfection.cpp
│ │ │ ├── Kind Anton.cpp
│ │ │ └── Little Artem.cpp
│ │ ├── 633 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Filling Diamonds Explanation.txt
│ │ │ │ ├── Powered Addition Explanation.txt
│ │ │ │ └── Sorted Adjacent Differences Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Filling Diamonds.cpp
│ │ │ ├── Powered Addition.cpp
│ │ │ └── Sorted Adjacent Differences.cpp
│ │ ├── 635 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Ichime and Triangle Explanation.txt
│ │ │ │ ├── Kana and Dragon Quest Game Explanation.txt
│ │ │ │ ├── Linova and Kingdom Explanation.txt
│ │ │ │ └── Xenia and Colourful Gems Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Ichihime and Triangle.cpp
│ │ │ ├── Kana and Dragon Quest game.cpp
│ │ │ ├── Linova and Kingdom.cpp
│ │ │ └── Xenia and Colourful Gems.cpp
│ │ ├── 637 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Nastya and Door Explanation.txt
│ │ │ │ ├── Nastya and Rice Explanation.txt
│ │ │ │ ├── Nastya and Scoreboard Explanation.txt
│ │ │ │ └── Nastya and Strange Generator Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Nastya and Door.cpp
│ │ │ ├── Nastya and Rice.cpp
│ │ │ ├── Nastya and Scoreboard.cpp
│ │ │ └── Nastya and Strange Generator.cpp
│ │ ├── 638 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ └── Pheonix and Balance Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Pheonix and Balance.cpp
│ │ │ └── Phoenix and Balance.cpp
│ │ ├── 639 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Card Construction Explanation.txt
│ │ │ │ ├── Hilbert Hotel Explanation.txt
│ │ │ │ ├── Monopole Magnets Explanation.txt
│ │ │ │ ├── Puzzle Pieces Explanation.txt
│ │ │ │ ├── Quantifier Question Explanation.txt
│ │ │ │ ├── Resume Review Explanation.txt
│ │ │ │ └── Resume Review.cpp
│ │ │ └── Programs/
│ │ │ ├── Card Construction.cpp
│ │ │ ├── Hilbert Hotel.cpp
│ │ │ ├── Monopole Magnets.cpp
│ │ │ ├── Puzzle Pieces.cpp
│ │ │ ├── Quantifier Question.cpp
│ │ │ └── Resume Review.cpp
│ │ ├── 641 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Orac and Factors Explanation.txt
│ │ │ │ ├── Orac and LCM Explanation.txt
│ │ │ │ └── Orac and Models Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Orac and Factors.cpp
│ │ │ ├── Orac and LCM.cpp
│ │ │ └── Orac and Models.cpp
│ │ ├── 643 Div 2/
│ │ │ ├── Explanation/
│ │ │ │ ├── Counting Triangles Explanation.txt.txt
│ │ │ │ ├── Game with Array Explanation.txt
│ │ │ │ ├── Restorer Distance Explanation.txt
│ │ │ │ ├── Sequence with Digits Explanation.txt
│ │ │ │ └── Young Explorer Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Counting Triangles.cpp
│ │ │ ├── Game with Array.cpp
│ │ │ ├── Restorer Distance.cpp
│ │ │ ├── Sequence with Digits.cpp
│ │ │ └── Young Explorer.cpp
│ │ ├── 647 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Johnny and Ancient Computers Explanation.txt
│ │ │ │ ├── Johnny and Another Rating Drop Explanation.txt
│ │ │ │ ├── Johnny and Contribution Explanation.txt
│ │ │ │ └── Johnny and His Hobbies Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Johnny and Ancient Computers.cpp
│ │ │ ├── Johnny and Another Rating Drop.cpp
│ │ │ ├── Johnny and Contribution.cpp
│ │ │ └── Johnny and His Hobbies.cpp
│ │ ├── 648 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Maximum Subsequence Value Explanation.txt
│ │ │ │ ├── Secure Password Explanation.txt.txt
│ │ │ │ └── Swaps Again Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Matrix Game.cpp
│ │ │ ├── Maximum Subsequence Value.cpp
│ │ │ ├── Rotation Matching.cpp
│ │ │ ├── Secure Password.cpp
│ │ │ ├── Swaps Again.cpp
│ │ │ └── Trouble Sort.cpp
│ │ ├── 651 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Binary Subsequence Rotation Explanation.txt
│ │ │ │ ├── GCD Compression Explanation.txt
│ │ │ │ ├── Maximum GCD Explanation.txt
│ │ │ │ ├── Number Game Explanation.txt
│ │ │ │ └── Odd Even Subsequence Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Binary Subsequence Rotation.cpp
│ │ │ ├── GCD Compression.cpp
│ │ │ ├── Maximum GCD.cpp
│ │ │ ├── Number Game.cpp
│ │ │ └── Odd-Even Subsequence.cpp
│ │ ├── 658 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Common Subsequence Explanation.txt
│ │ │ │ ├── Sequential Nim Explanation.txt
│ │ │ │ └── Unmerge Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Common Subsequence.cpp
│ │ │ ├── Sequential Nim.cpp
│ │ │ └── Unmerge.cpp
│ │ ├── 659 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Common Prefix Explanation.txt
│ │ │ │ ├── Prefix Flip (Easy Version) Explanation.txt
│ │ │ │ ├── Prefix Flip (Hard Version) Explanation.txt
│ │ │ │ └── String Transformation 1 Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Common Prefixes.cpp
│ │ │ ├── Prefix Flip (Easy Version).cpp
│ │ │ ├── Prefix Flip (Hard Version).cpp
│ │ │ └── String Transformation 1.cpp
│ │ ├── 660 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Captain Flint and Crew Recruitment Explanation.txt
│ │ │ │ └── Captain Flint and a Long Voyage Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Captain Flint and Crew Recruitment.cpp
│ │ │ └── Captain Flint and a Long Voyage.cpp
│ │ ├── 662 Div 2/
│ │ │ └── Programs/
│ │ │ └── Rainbow Dash, Fluttershy and Chess Coloring.cpp
│ │ ├── 678 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Bandit in a City Explanation.txt
│ │ │ │ ├── Binary Search Explanation.txt
│ │ │ │ ├── Complicated Computations Explanation.txt
│ │ │ │ ├── Prime Square Explanation.txt
│ │ │ │ ├── Reorder Explanation.txt
│ │ │ │ └── Sum Over Subsets Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Bandit in a City.cpp
│ │ │ ├── Binary Search.cpp
│ │ │ ├── Complicated Computations.cpp
│ │ │ ├── Prime Square.cpp
│ │ │ ├── Reorder.cpp
│ │ │ └── Sum Over Subsets.cpp
│ │ ├── 684 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Binary Table Explanation.txt
│ │ │ │ ├── Buy the String Explanation.txt
│ │ │ │ ├── Graph Subset Problem Explanation.txt
│ │ │ │ ├── Greedy Shopping Explanation.txt
│ │ │ │ └── Sum of Medians Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Binary Table.cpp
│ │ │ ├── Buy the String.cpp
│ │ │ ├── Graph Subset Problem.cpp
│ │ │ ├── Greedy Shopping.cpp
│ │ │ └── Sum of Medians.cpp
│ │ ├── 685 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Bitwise Queries Explanation.txt
│ │ │ │ ├── Circle Game Explanation.txt
│ │ │ │ ├── Non Substring Subsequence Explanation.txt
│ │ │ │ ├── Nullify the Matrix Explanation.txt
│ │ │ │ ├── String Equality Explanation.txt
│ │ │ │ └── Subtract or Divide Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Bitwise Queries (Hard Version).cpp
│ │ │ ├── Bitwise Queries.cpp
│ │ │ ├── Circle Game.cpp
│ │ │ ├── Non-Substring Subsequence .cpp
│ │ │ ├── Nullify the Matrix.cpp
│ │ │ ├── String Equality.cpp
│ │ │ └── Subtract or Divide .cpp
│ │ ├── 687 Div 2 Technocup 2021 Elimination Round 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Bouncing Ball Explanation.txt
│ │ │ │ ├── New Game Plus Explanation.txt
│ │ │ │ ├── Prison Break Explanation.txt
│ │ │ │ ├── Repainting Street Explanation.txt
│ │ │ │ └── XOR Gun Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Bouncing Ball.cpp
│ │ │ ├── New Game Plus.cpp
│ │ │ ├── Prison Break.cpp
│ │ │ ├── Repainting Street.cpp
│ │ │ └── XOR Gun.cpp
│ │ ├── 688 Div 2/
│ │ │ ├── Explanation/
│ │ │ │ └── Suffix Operations Explanation.txt
│ │ │ └── Programs/
│ │ │ └── Suffix Operations.cpp
│ │ ├── 689 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Divide and Summarize Explanation.txt
│ │ │ │ ├── Find a Spruce Explanation.txt
│ │ │ │ ├── Mathematical Expression Explanation.txt
│ │ │ │ ├── Random Events Explanation.txt
│ │ │ │ ├── String Generation Explanation.txt
│ │ │ │ └── Water Level Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Divide and Summarize.cpp
│ │ │ ├── Find the Spruce.cpp
│ │ │ ├── Mathematical Expression.cpp
│ │ │ ├── Random Events.cpp
│ │ │ ├── String Generation.cpp
│ │ │ └── Water Level.cpp
│ │ ├── 691 Div 2/
│ │ │ ├── Explanation/
│ │ │ │ ├── Move and Turn Explanation.txt
│ │ │ │ ├── Red Blue Shuffle Explanation.txt
│ │ │ │ └── Row GCD Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Move and Turn.cpp
│ │ │ ├── Red Blue Shuffle.cpp
│ │ │ └── Row GCD.cpp
│ │ ├── 692 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── Fair Numbers Explanation.txt
│ │ │ │ └── In Game Chat Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Fair Numbers.cpp
│ │ │ └── In Game Chat.cpp
│ │ └── CodeCraft 2020/
│ │ ├── Explanations/
│ │ │ ├── Grade Allocation Explanation.txt
│ │ │ ├── Nash Matrix Explanation.txt
│ │ │ ├── Primitive Primes Explanation.txt
│ │ │ ├── String Modification Explanation.txt
│ │ │ └── Team Building Explanation.txt
│ │ └── Programs/
│ │ ├── Grade Allocation.cpp
│ │ ├── Nash Matrix.cpp
│ │ ├── Primitive Primes.cpp
│ │ ├── String Modification.cpp
│ │ └── Team Building.cpp
│ ├── Div 3/
│ │ ├── 605 Div 3/
│ │ │ ├── Explanations/
│ │ │ │ ├── Nearly Opposite Parity.cpp
│ │ │ │ └── Remove One Element Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Nearly Opposite Parity.cpp
│ │ │ └── Remove One Element.cpp
│ │ ├── 611 Div 3/
│ │ │ ├── Explanations/
│ │ │ │ ├── Candies Division Explanation.txt
│ │ │ │ ├── Christmas Trees Explanation.txt
│ │ │ │ ├── DIY Garland Explanation.txt
│ │ │ │ ├── Friends and Gifts Explanation.txt
│ │ │ │ ├── Minutes Before the New Year Explanation.txt
│ │ │ │ └── New Year Parties Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Candies Division.cpp
│ │ │ ├── Christmas Trees.cpp
│ │ │ ├── DIY Garland.cpp
│ │ │ ├── Friends and Gifts.cpp
│ │ │ ├── Minutes Before the New Year.cpp
│ │ │ └── New Year Parties.cpp
│ │ ├── 615 Div 3/
│ │ │ ├── Explanations/
│ │ │ │ ├── Collecting Coins Explanation.txt
│ │ │ │ ├── Collecting Packages Explanation.txt
│ │ │ │ ├── MEX Maximising Explanation.txt
│ │ │ │ ├── Obtain a Permutation Explanation.txt
│ │ │ │ ├── Product of Three Numbers Explanation.txt
│ │ │ │ └── Three Paths on a Tree Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Collecting Coins.cpp
│ │ │ ├── Collecting Packages.cpp
│ │ │ ├── MEX Maximising.cpp
│ │ │ ├── Obtain a Permutation.cpp
│ │ │ ├── Paths on a Tree.cpp
│ │ │ └── Product of Three Numbers.cpp
│ │ ├── 617 Div 3/
│ │ │ ├── Explanations/
│ │ │ │ ├── Array with Odd Sum Explanation.txt
│ │ │ │ ├── Fight with Monsters Explanation.txt
│ │ │ │ ├── Food Buying Explanation.txt
│ │ │ │ ├── String Colouring (Easy Version) Explanation.txt
│ │ │ │ ├── String Colouring (Hard Version) Explanation.txt
│ │ │ │ └── Yet Another Walking Robot Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Array with Odd Sum.cpp
│ │ │ ├── Fight with Monsters.cpp
│ │ │ ├── Food Buying.cpp
│ │ │ ├── String Coloring (Hard Version).cpp
│ │ │ ├── String Colouring (Easy Version).cpp
│ │ │ └── Yet Another Walking Robot.cpp
│ │ ├── 624 Div 3/
│ │ │ ├── Explanations/
│ │ │ │ ├── Add Odd or Subtract Even Explanation.txt
│ │ │ │ ├── Construct the Binary Tree Explanation.txt
│ │ │ │ ├── Moving Points Explanation.txt
│ │ │ │ ├── Perform the Combo Explanation.txt
│ │ │ │ ├── Three Integers Explanation.txt
│ │ │ │ └── WeirdSort Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Add Odd or Subtract Even.cpp
│ │ │ ├── Construct the Binary Tree.cpp
│ │ │ ├── Moving Points.cpp
│ │ │ ├── Perform the Combo.cpp
│ │ │ ├── Three Integers.cpp
│ │ │ └── Weirdsort.cpp
│ │ ├── 627 Div 3/
│ │ │ ├── Explanations/
│ │ │ │ ├── Frog Jumps Explanation.txt
│ │ │ │ ├── Maximum White Subtree Explanation.txt
│ │ │ │ ├── Pair of Topics Explanation.txt
│ │ │ │ ├── Sleeping Schedule Explanation.txt
│ │ │ │ ├── Yet Another Palindrome Problem Explanation.txt
│ │ │ │ └── Yet Another Tetris Problem Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Frog Jumps.cpp
│ │ │ ├── Maximum White Subtree.cpp
│ │ │ ├── Pair of Topics.cpp
│ │ │ ├── Sleeping Schedule.cpp
│ │ │ ├── Yet Another Palindrome Problem.cpp
│ │ │ └── Yet Another Tetris Problem.cpp
│ │ ├── 629 Div 3/
│ │ │ ├── Explanations/
│ │ │ │ ├── Carousel Explanation.txt
│ │ │ │ ├── Divisibility Problem Explanation.txt
│ │ │ │ ├── Kth Beautiful String Explanation.txt
│ │ │ │ ├── Ternary XOR Explanation.txt
│ │ │ │ └── Tree Queries Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Carousel.cpp
│ │ │ ├── Divisibility Problem.cpp
│ │ │ ├── Kth Beautiful String.cpp
│ │ │ ├── Ternary XOR.cpp
│ │ │ └── Tree Queries.cpp
│ │ ├── 634 Div 3/
│ │ │ ├── Explanations/
│ │ │ │ ├── Anti Sudoku Explanation.txt
│ │ │ │ ├── Candies and Two Sisters Explanation.txt
│ │ │ │ ├── Construct the String Explanation.txt
│ │ │ │ ├── Robots on a Grid Explanation.txt
│ │ │ │ ├── Three Blocks Palindrome Explanation.txt
│ │ │ │ └── Two Teams Composing Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Anti Sudoku.cpp
│ │ │ ├── Candies and Two Sisters.cpp
│ │ │ ├── Construct the String.cpp
│ │ │ ├── Robots on a Grid.cpp
│ │ │ ├── Three Blocks Palindrome.cpp
│ │ │ └── Two Teams Composing.cpp
│ │ ├── 636 Div 3/
│ │ │ ├── Explanations/
│ │ │ │ └── Constant Palindrome Sum Explanation.txt
│ │ │ └── Programs/
│ │ │ └── Constant Palindrome Sum.cpp
│ │ ├── 661 Div 3/
│ │ │ ├── Explanations/
│ │ │ │ ├── Binary String to Subsequence Explanation.txt
│ │ │ │ ├── Boats Competition Explanation.txt
│ │ │ │ ├── Gifts Fixing Explanation.txt
│ │ │ │ └── Remove Smallest Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Binary String to Subsequences.cpp
│ │ │ ├── Boats Competition.cpp
│ │ │ ├── Gifts Fixing.cpp
│ │ │ └── Remove Smallest.cpp
│ │ ├── 674 Div 3/
│ │ │ └── Programs/
│ │ │ └── Number of Subsequences.cpp
│ │ ├── 686 Div 3/
│ │ │ ├── Explanations/
│ │ │ │ ├── Array Partition Explanation.txt
│ │ │ │ ├── Number Into Sequence Explanation.txt
│ │ │ │ ├── Number of Simple Paths Explanation.txt
│ │ │ │ ├── Sequence Transformation Explanation.txt
│ │ │ │ ├── Special Permutation Explanation.txt
│ │ │ │ └── Unique Bid Auction Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Array Partition.cpp
│ │ │ ├── Number Into Sequence.cpp
│ │ │ ├── Number of Simple Paths.cpp
│ │ │ ├── Sequence Transformation.cpp
│ │ │ ├── Special Permutation.cpp
│ │ │ └── Unique Bid Auction.cpp
│ │ └── Explanations/
│ │ └── Number of Subsequences Explanation.txt
│ ├── Educational Rounds/
│ │ ├── Educational Round 78/
│ │ │ ├── Explanations/
│ │ │ │ ├── Berry Jam Explanation.txt
│ │ │ │ ├── Cards Explanation.txt
│ │ │ │ ├── Shuffle Hashing Explanation.txt
│ │ │ │ └── Tests for Problem D Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── A and B.cpp
│ │ │ ├── Berry Jam.cpp
│ │ │ ├── Shuffle Hashing.cpp
│ │ │ └── Tests for Problem D.cpp
│ │ ├── Educational Round 79/
│ │ │ ├── Explanations/
│ │ │ │ ├── New Year Garland Explanation.txt
│ │ │ │ ├── Stack of Presents Explanation.txt
│ │ │ │ └── Verse for Santa Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── New Year Garland.cpp
│ │ │ ├── Stack of Presents.cpp
│ │ │ └── Verse for Santa.cpp
│ │ ├── Educational Round 80/
│ │ │ ├── Explanations/
│ │ │ │ ├── Deadline Explanation.txt
│ │ │ │ ├── Minimax Problem Explanation.txt
│ │ │ │ ├── Two Arrays Alternate Solution Explanation.txt
│ │ │ │ ├── Two Arrays Explanation.txt
│ │ │ │ └── Yet Another Meme Problem Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Deadline.cpp
│ │ │ ├── Minimax Problem.cpp
│ │ │ ├── Two Arrays Alternate Solution.cpp
│ │ │ ├── Two Arrays.cpp
│ │ │ └── Yet Another Meme Problem.cpp
│ │ ├── Educational Round 81/
│ │ │ ├── Explanation/
│ │ │ │ ├── Display the Number Explanation.txt
│ │ │ │ ├── Infinite Prefixes Explanation.txt
│ │ │ │ ├── Obtain the String Explanation.txt
│ │ │ │ └── Same GCDs Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Display the Number.cpp
│ │ │ ├── Infinite Prefixes.cpp
│ │ │ ├── Obtain the String.cpp
│ │ │ └── Same GCDs.cpp
│ │ ├── Educational Round 82/
│ │ │ ├── Explanations/
│ │ │ │ ├── Erasing Zeroes Explanation.txt
│ │ │ │ ├── National Project Explanation.txt
│ │ │ │ └── Perfect Keyboard Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Erasing Zeroes.cpp
│ │ │ ├── Fill the Bag.cpp
│ │ │ ├── National Project.cpp
│ │ │ └── Perfect Keyboard.cpp
│ │ ├── Educational Round 83/
│ │ │ ├── Explanations/
│ │ │ │ ├── Adding Powers Explanation.txt
│ │ │ │ ├── Array Shrinking Explanation.txt
│ │ │ │ ├── Bogosort Explanation.txt
│ │ │ │ ├── Count the Arrays Explanation.txt
│ │ │ │ └── Two Regular Polygons Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Adding Powers.cpp
│ │ │ ├── Array Shrinking.cpp
│ │ │ ├── Bogosort.cpp
│ │ │ ├── Count the Arrays.cpp
│ │ │ └── Two Regular Polygons.cpp
│ │ ├── Educational Round 84/
│ │ │ ├── Explanations/
│ │ │ │ ├── Count the Blocks Explanation.txt
│ │ │ │ └── Sum of Odd Integers Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Count the Blocks.cpp
│ │ │ └── Sum of Odd Integers.cpp
│ │ ├── Educational Round 85/
│ │ │ ├── Explanations/
│ │ │ │ ├── Circle of Monsters Explanation.txt
│ │ │ │ ├── Divisor Paths Explanation.txt
│ │ │ │ ├── Level Statistics Explanation.txt
│ │ │ │ ├── Middle Class Explanation.txt
│ │ │ │ └── Minimum Euler Cycle Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Circle of Monsters.cpp
│ │ │ ├── Divisor Paths.cpp
│ │ │ ├── Level Statistics.cpp
│ │ │ ├── Middle Class.cpp
│ │ │ └── Minimum Euler Cycle.cpp
│ │ ├── Educational Round 86/
│ │ │ ├── Explanations/
│ │ │ │ ├── Binary Period Explanation.txt
│ │ │ │ ├── Road to Zero Explanation.txt
│ │ │ │ └── Yet Another Counting Problem Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Binary Period.cpp
│ │ │ ├── Road to Zero.cpp
│ │ │ └── Yet Another Counting Problem.cpp
│ │ ├── Educational Round 90/
│ │ │ ├── Explanations/
│ │ │ │ ├── 01 Game Explanation.txt
│ │ │ │ ├── Donut Shops Explanation.txt
│ │ │ │ ├── Maximum Sum on Even Positions Explanation.txt
│ │ │ │ └── Pluses and Minuses Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── 01 Game.cpp
│ │ │ ├── Donut Shops.cpp
│ │ │ ├── Maximum Sum on Even Positions.cpp
│ │ │ └── Pluses and Minuses.cpp
│ │ ├── Educational Round 92/
│ │ │ ├── Explanations/
│ │ │ │ └── Good String Explanation.txt
│ │ │ └── Programs/
│ │ │ └── Good String.cpp
│ │ └── Educational Round 93/
│ │ ├── Explanations/
│ │ │ ├── Bad Triangle Explanation.txt
│ │ │ ├── Colored Rectangles Explanation.txt
│ │ │ ├── Good Subarrays Explanation.txt
│ │ │ └── Substring Removal Game Explanation.txt
│ │ └── Programs/
│ │ ├── Bad Triangle.cpp
│ │ ├── Colored Rectangles.cpp
│ │ ├── Good Subarrays.cpp
│ │ └── Substring Removal Game.cpp
│ ├── Good Bye 2019/
│ │ ├── Explanations/
│ │ │ ├── Card Game Explanation.txt
│ │ │ ├── Interesting Subarray Explanation
│ │ │ └── Make Good Explanation.txt
│ │ └── Programs/
│ │ ├── Card Game.cpp
│ │ ├── Interesting Subarray.cpp
│ │ └── Make Good.cpp
│ ├── Hello 2020/
│ │ ├── Explanations/
│ │ │ ├── New Year and Ascent Sequences Explanation.txt
│ │ │ ├── New Year and Conferences Explanation.txt
│ │ │ ├── New Year and Naming Explanation
│ │ │ └── New Year and Permutation Explanation.txt
│ │ └── Programs/
│ │ ├── New Year and Ascent Sequences.cpp
│ │ ├── New Year and Conferences.cpp
│ │ ├── New Year and Naming.cpp
│ │ └── New Year and Permutation.cpp
│ └── Practice/
│ ├── Explanations/
│ │ ├── Alternative Thinking Explanation.txt
│ │ ├── Ant Colony Explanation.txt
│ │ ├── Anton and Chess Explanation.txt
│ │ ├── Anton and Ira Explanation.txt
│ │ ├── Ants in Leaves Explanation.txt
│ │ ├── Army Creation Explanation.txt
│ │ ├── Bargain Explanation.txt
│ │ ├── Concatenated Multiples Explanation.txt
│ │ ├── Count Pairs Explanation.txt
│ │ ├── Cram Time Explanation.txt
│ │ ├── Cycles Explanation.txt
│ │ ├── Elections Explanation.txt
│ │ ├── Fight Against Traffic Explanation.txt
│ │ ├── Hacker, Pack your Bags Explanation.txt
│ │ ├── Imbalance Array Explanation.txt
│ │ ├── Laboratory Work Explanation.txt
│ │ ├── Lieges of Legendre Explanation.txt
│ │ ├── Line Explanation.txt
│ │ ├── Marina and Vyasa Explanation.txt
│ │ ├── Match Points Explanation.txt
│ │ ├── Molly and Chemicals Explanation.txt
│ │ ├── Moodular Arithmetic Explanation.txt
│ │ ├── Mouse Hunt Explanation.txt
│ │ ├── Multiplicity Explanation.txt
│ │ ├── Multipliers Explanation.txt
│ │ ├── My Pretty Girl Nora Explanation.txt
│ │ ├── Optimal Number Permutation Explanation.txt
│ │ ├── Pair of Numbers Explanation.txt
│ │ ├── Pashmak and Graph Explanation.txt
│ │ ├── Pavel and Triangles Explanation.txt
│ │ ├── Plus and XOR Explanation.txt
│ │ ├── Points Explanation.txt
│ │ ├── Prime Number Explanation.txt
│ │ ├── Ramesses and Corner Inversion Explanation.txt
│ │ ├── Scheme.cpp
│ │ ├── Secret Passwords Explanation.txt
│ │ ├── Segments Explanation.txt
│ │ ├── Special Segments of Permutation Explanation.txt
│ │ ├── The Sum of the k-th Powers Explanation.txt
│ │ ├── The Treasure of Segments Explanation.txt
│ │ └── Winter is Here Explanation.txt
│ └── Programs/
│ ├── Alternative Thinking.cpp
│ ├── Ant Colony.cpp
│ ├── Anton and Chess.cpp
│ ├── Anton and Ira.cpp
│ ├── Ants in Leaves.cpp
│ ├── Army Creation.cpp
│ ├── Bargain.cpp
│ ├── Concatenated Multiples.cpp
│ ├── Count Pairs.cpp
│ ├── Cram Time.cpp
│ ├── Cycles.cpp
│ ├── Elections.cpp
│ ├── Fight Against Traffic.cpp
│ ├── Hacker, pack your Bags.cpp
│ ├── Imbalanced Array.cpp
│ ├── Laboratory Work.cpp
│ ├── Lieges of Legendre.cpp
│ ├── Line.cpp
│ ├── Marina and Vyasa.cpp
│ ├── Match Points.cpp
│ ├── Molly and Chemicals.cpp
│ ├── Moodular Arithmetic.cpp
│ ├── Mouse Hunt.cpp
│ ├── Multiplicity.cpp
│ ├── Multipliers.cpp
│ ├── My Pretty Girl Nora.cpp
│ ├── Optimal Number Permutation.cpp
│ ├── Pair of Numbers.cpp
│ ├── Pashmak and Graph.cpp
│ ├── Pavel and Triangles.cpp
│ ├── Plus and Xor.cpp
│ ├── Points.cpp
│ ├── Prime Number.cpp
│ ├── Ramesses and Corner Inversion.cpp
│ ├── Scheme.cpp
│ ├── Secret Passwords.cpp
│ ├── Segments.cpp
│ ├── Special Segments of Permutation.cpp
│ ├── The Sum of the k-th Powers.cpp
│ ├── The Treasure of Segments.cpp
│ └── Winter is Here.cpp
├── 2021/
│ ├── Combined Divisions/
│ │ └── Deltix Round Summer 2021/
│ │ ├── Explanations/
│ │ │ └── Take a Guess Explanation.txt
│ │ └── Programs/
│ │ └── Take a Guess.cpp
│ ├── Div 2/
│ │ ├── 694/
│ │ │ ├── Explanations/
│ │ │ │ ├── Strange Definition Explanation.txt
│ │ │ │ ├── Strange Housing Explanation.txt
│ │ │ │ └── Strange Shuffle Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Strange Birthday Party.cpp
│ │ │ ├── Strange Definition.cpp
│ │ │ ├── Strange Housing.cpp
│ │ │ ├── Strange List.cpp
│ │ │ ├── Strange Partition.cpp
│ │ │ └── Strange Shuffle.cpp
│ │ ├── 708/
│ │ │ ├── Explanations/
│ │ │ │ ├── Genius Explanation.txt
│ │ │ │ ├── M Arrays Explanation.txt.txt
│ │ │ │ ├── Meximization Explanation.txt.txt
│ │ │ │ ├── Square Free Division Explanation.txt.txt
│ │ │ │ └── k-LCM Explanation.txt.txt
│ │ │ └── Programs/
│ │ │ ├── Genius.cpp
│ │ │ ├── M Arrays.cpp
│ │ │ ├── Meximization.cpp
│ │ │ ├── Square Free Division.cpp
│ │ │ └── k-LCM.cpp
│ │ ├── 711 CodeCraft 2021/
│ │ │ ├── Explanations/
│ │ │ │ ├── Bananas in a MIrcorwave Explanation.txt.txt
│ │ │ │ ├── Box Fitting Explanation.txt
│ │ │ │ ├── GCD Sum Explanation.txt.txt
│ │ │ │ └── Two Houses Explanation.txt.txt
│ │ │ └── Programs/
│ │ │ ├── Bananas in a Microwave.cpp
│ │ │ ├── Box Fitting.cpp
│ │ │ ├── GCD Sum.cpp
│ │ │ └── Two Houses.cpp
│ │ ├── 712 Div 2/
│ │ │ ├── Explanations/
│ │ │ │ ├── 3 Colouring Explanation.txt
│ │ │ │ ├── Deja Vu Explanation.txt.txt
│ │ │ │ └── Flip the Bits Explanation.txt.txt
│ │ │ └── Programs/
│ │ │ ├── 3 Colouring.cpp
│ │ │ ├── Déjà Vu.cpp
│ │ │ └── Flip the Bits.cpp
│ │ ├── 714 Division by Zero 2021/
│ │ │ ├── Explanations/
│ │ │ │ ├── AND Sequences Explanation.txt.txt
│ │ │ │ ├── Add One Explanation.txt.txt
│ │ │ │ ├── Arrays and Peaks Explanation.txt.txt
│ │ │ │ ├── Cost Equilibrium Explanation.txt.txt
│ │ │ │ ├── GCD and MST Explanation.txt
│ │ │ │ ├── GCD and MST Explanation.txt.txt
│ │ │ │ └── Swapping Problem Explanation.txt.txt
│ │ │ └── Programs/
│ │ │ ├── AND Sequences.cpp
│ │ │ ├── Add One.cpp
│ │ │ ├── Arrays and Peaks.cpp
│ │ │ ├── Cost Equilibrium.cpp
│ │ │ ├── GCD and MST.cpp
│ │ │ └── Swapping Problem.cpp
│ │ ├── 716 Div 2/
│ │ │ └── Programs/
│ │ │ └── Product 1 mod N.cpp
│ │ ├── 722/
│ │ │ ├── Explanations/
│ │ │ │ └── Parsa and Humungous Tree Explanation.txt
│ │ │ └── Programs/
│ │ │ └── Parsa and Humungous Tree.cpp
│ │ ├── 724/
│ │ │ ├── Diluc and Kaeye Explanation.txt
│ │ │ ├── Explanations/
│ │ │ │ └── Diluc and Kaeye Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Diluc and Kaeya.cpp
│ │ │ ├── Omkar and Bad Story.cpp
│ │ │ ├── Omkar and Forest.cpp
│ │ │ └── Prinzessin der Verurteilung.cpp
│ │ ├── 726/
│ │ │ ├── Explanations/
│ │ │ │ ├── Arithemtic Array Explanation.txt.txt
│ │ │ │ ├── Bad Boy Explanation.txt.txt
│ │ │ │ ├── Challenging Cliffs Explanation.txt.txt
│ │ │ │ ├── Deleting Divisors Explanation.txt.txt
│ │ │ │ └── Erase and Extend (Easy Version) Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Arithmetic Array.cpp
│ │ │ ├── Bad Boy.cpp
│ │ │ ├── Challenging Cliffs.cpp
│ │ │ ├── Deleting Divisors.cpp
│ │ │ ├── Erase and Extend (Easy Version).cpp
│ │ │ └── Figure Fixing.cpp
│ │ ├── 727/
│ │ │ ├── Explanations/
│ │ │ │ ├── Constest Start Time Explanation.txt
│ │ │ │ ├── Love Song Explanation.txt.txt
│ │ │ │ ├── Price Fixed Explanation.txt.txt
│ │ │ │ └── Stable Groups Explanation.txt.txt
│ │ │ └── Programs/
│ │ │ ├── Contest Start.cpp
│ │ │ ├── Love Song.cpp
│ │ │ ├── PriceFixed.cpp
│ │ │ └── Stable Groups.cpp
│ │ ├── 740/
│ │ │ └── Programs/
│ │ │ ├── Deep Down Below Binary Search.cpp
│ │ │ └── Deep Down Below.cpp
│ │ ├── 742/
│ │ │ ├── Explanations/
│ │ │ │ └── Carrying Conundrum Explanation.txt
│ │ │ └── Programs/
│ │ │ └── Carrying Conundrum.cpp
│ │ └── 750/
│ │ ├── Explanations/
│ │ │ └── Pchelyonok and Segments Explanation.txt
│ │ └── Programs/
│ │ └── Pchelyonok and Segments.cpp
│ ├── Div 3/
│ │ ├── 710/
│ │ │ ├── Explanations/
│ │ │ │ ├── Double Ended Strings Explanation.txt.txt
│ │ │ │ ├── Epic Transformation Explanation.txt.txt
│ │ │ │ ├── Maximize the Remaining String Explanation.txt
│ │ │ │ ├── Partial Replacement.txt.txt
│ │ │ │ ├── Strange Table Explanation.txt.txt
│ │ │ │ └── Triangular Paths Explanation.txt.txt
│ │ │ └── Programs/
│ │ │ ├── Double Ended Strings.cpp
│ │ │ ├── Epic Transformation.cpp
│ │ │ ├── Maximize the Remaining String.cpp
│ │ │ ├── Partial Replacement.cpp
│ │ │ ├── Strange Table.cpp
│ │ │ └── Triangular Paths.cpp
│ │ ├── 713/
│ │ │ ├── Explanations/
│ │ │ │ ├── A-B Palindrome Explanation.txt.txt
│ │ │ │ ├── Almost Rectange Explanation.txt.txt
│ │ │ │ ├── Corrupted Array Explanation.txt.txt
│ │ │ │ ├── Education Explanation.txt.txt
│ │ │ │ ├── Short Task Explanation.txt
│ │ │ │ └── Spy Detected Explanation.txt.txt
│ │ │ └── Programs/
│ │ │ ├── A-B Palindrome.cpp
│ │ │ ├── Almost Rectangle.cpp
│ │ │ ├── Corrupted Array.cpp
│ │ │ ├── Education.cpp
│ │ │ ├── Short Task.cpp
│ │ │ └── Spy Detected.cpp
│ │ └── 744/
│ │ └── Programs/
│ │ └── Array Optimization by Deque.cpp
│ ├── Educational Round 109/
│ │ ├── Explanations/
│ │ │ └── Permutation Sort Explanation.txt
│ │ └── Programs/
│ │ └── Permutation Sort.cpp
│ └── Practice/
│ ├── Explanations/
│ │ ├── Anton and Making Potions Explanation.txt
│ │ ├── Anton and Tree Explanation.txt.txt
│ │ ├── Counter Attack Explanation.txt.txt
│ │ ├── Game of Stones Explanation.txt.txt
│ │ ├── Lost Tree Explanation.txt.txt
│ │ └── Maximum Absurdity Explanation.txt.txt
│ └── Programs/
│ ├── Anton and Making Potions.cpp
│ ├── Anton and Tree.cpp
│ ├── Counter Attack.cpp
│ ├── Game of Stones.cpp
│ ├── Lost Tree.cpp
│ └── Maximum Absurdity.cpp
├── 2022/
│ └── Contests/
│ ├── Combined Divisions/
│ │ └── CodeTON/
│ │ ├── Explanations/
│ │ │ ├── Good Pairs Explanation.txt.txt
│ │ │ ├── Make Equal with Mod Explanation.txt.txt
│ │ │ └── Subtract Operations Explanation.txt
│ │ └── Programs/
│ │ ├── Good Pairs.cpp
│ │ ├── K-good.cpp
│ │ ├── Make Equal With Mod.cpp
│ │ └── Subtract Operation.cpp
│ ├── Div 2/
│ │ ├── 766/
│ │ │ └── Programs/
│ │ │ ├── Not Adding.cpp
│ │ │ ├── Not Assigning.cpp
│ │ │ ├── Not Shading.cpp
│ │ │ └── Not Sitting.cpp
│ │ ├── 767/
│ │ │ ├── Explanations/
│ │ │ │ └── Meximum Array Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Download More RAM.cpp
│ │ │ ├── GCD Arrays.cpp
│ │ │ ├── Game On Sum Easy Version.cpp
│ │ │ ├── Game on Sum Hard Version.cpp
│ │ │ ├── Grid XOR.cpp
│ │ │ ├── Meximum Array.cpp
│ │ │ └── Peculiar Movie Preferences.cpp
│ │ ├── 777/
│ │ │ └── Programs/
│ │ │ ├── Madoka and Math Dad.cpp
│ │ │ └── Makoda and Childish Pranks.cpp
│ │ ├── 778/
│ │ │ ├── Explanations/
│ │ │ │ ├── Alice and the Cake Explanation.txt.txt
│ │ │ │ ├── Maximum Cake Tastiness Explanation.txt
│ │ │ │ └── Prefix Removals Explanation.txt.txt
│ │ │ └── Programs/
│ │ │ ├── Alice and the Cake.cpp
│ │ │ ├── Maximum Cake Tastiness.cpp
│ │ │ └── Prefix Removals.cpp
│ │ ├── 789/
│ │ │ ├── Explanation/
│ │ │ │ ├── Tokitsukaze and All Zero Sequence Explanation.txt.txt
│ │ │ │ ├── Tokitsukaze and Good 01-String (easy version) Explanation.txt.txt
│ │ │ │ └── Tokitsukaze and Strange Inequality Explanation.txt
│ │ │ └── Programs/
│ │ │ ├── Tokitsukaze and Good 01-String (easy version).cpp
│ │ │ └── Tokitsukaze and Strange Inequality.cpp
│ │ ├── 792/
│ │ │ ├── Explanations/
│ │ │ │ ├── AvtoBus Explanation.txt
│ │ │ │ ├── Rooks Defenders Explanation.txt.txt
│ │ │ │ └── Stone Age Problem Explanation.txt.txt
│ │ │ └── Programs/
│ │ │ ├── AvtoBus.cpp
│ │ │ ├── Rooks Defenders.cpp
│ │ │ └── Stone Age Problem.cpp
│ │ └── 809/
│ │ └── Programs/
│ │ └── Qpwoeirut And The City.cpp
│ ├── Div 3/
│ │ └── 828/
│ │ └── Programs/
│ │ ├── Divisibility by 2^n.cpp
│ │ ├── Divisible Numbers Easy Version.cpp
│ │ ├── Even-Odd Increments.cpp
│ │ ├── Number Replacement.cpp
│ │ └── Traffic Light.cpp
│ ├── Educational Round 125/
│ │ ├── Explanations/
│ │ │ ├── By Gamers For Gamers Explanation.txt
│ │ │ ├── Integer Moves Explanation.txt.txt
│ │ │ └── XY Sequence Explanation.txt.txt
│ │ └── Programs/
│ │ ├── Bracket Sequence Deletion.cpp
│ │ ├── By Gamers For Gamers.cpp
│ │ ├── Integer Moves.cpp
│ │ └── XY Sequence.cpp
│ └── Educational Rounds/
│ ├── Educational Round 125/
│ │ └── EExplanations/
│ │ └── Bracket Sequence Deletion Explanation.txt
│ └── Educational Round 127/
│ ├── Explanations/
│ │ ├── Consecutive Points Segment Explanation.txt.txt
│ │ ├── Dolce Vita Explanation.txt.txt
│ │ ├── Insert a Progression Explanation.txt
│ │ └── String Building Explanation.txt.txt
│ └── Programs/
│ ├── Consecutive Points Segment.cpp
│ ├── Dolce Vita.cpp
│ ├── Insert a Progression.cpp
│ └── String Building.cpp
├── 2023/
│ └── Contests/
│ └── Div 2/
│ ├── 810/
│ │ ├── Explanations/
│ │ │ └── XOR Triangle Explanation.txt
│ │ └── Programs/
│ │ └── XOR Triangle.cpp
│ └── 857/
│ └── Programs/
│ ├── Buying Gifts.cpp
│ ├── Likes.cpp
│ ├── Settlement of Guinea Pigs.cpp
│ └── The Very Beautiful Blanket.cpp
├── C Programs/
│ ├── C Programs - 1/
│ │ ├── Bear_and_Big_Brother.c
│ │ ├── Beautiful_Matrix.c
│ │ ├── Boy_or_Girl.c
│ │ ├── Complicated_GCD.c
│ │ ├── Compote.c
│ │ ├── Dasha_and_Stairs.c
│ │ ├── Elephant.c
│ │ ├── Even_Odds.c
│ │ ├── Fancy_Fence.c
│ │ ├── Holiday_of_Equality.c
│ │ ├── I_Love_Username.c
│ │ ├── Ilya_Bank_Account.c
│ │ ├── Little_Elephant_Rozdil.c
│ │ ├── Lucky_Division.c
│ │ ├── Memory_and_Crow.c
│ │ ├── Nearly_Lucky_Number.c
│ │ ├── Opponents.c
│ │ ├── Petr_and_Calendar.c
│ │ ├── Shell_Game.c
│ │ ├── Sherlock_New_Girlfriend.c
│ │ ├── Taymr_is_Calling_You.c
│ │ ├── The_Wall.c
│ │ ├── Translation.c
│ │ ├── Vitya_in_the_Countryside.c
│ │ └── Vladik_and_Flights.c
│ ├── C Programs - 2/
│ │ ├── A_and_B_Chess.c
│ │ ├── Again_Twenty_Five.c
│ │ ├── Anton_and_Danik.c
│ │ ├── Bachgold_Problem.c
│ │ ├── Bit++.c
│ │ ├── Buy_a_Shovel.c
│ │ ├── Chat_Room.c
│ │ ├── Chips.c
│ │ ├── Cinema_Line.c
│ │ ├── Domino_Piling.c
│ │ ├── Drazil_and_Date.c
│ │ ├── George_and_Accomodation.c
│ │ ├── Gravity_Flip.c
│ │ ├── Infinite_Sequence.c
│ │ ├── Interview_with_Oleg.c
│ │ ├── Pasha_and_Stick.c
│ │ ├── Pineapple_Incident.c
│ │ ├── Serial_Killer.c
│ │ ├── Soldier_and_Bananas.c
│ │ ├── Spider_Man.c
│ │ ├── Stones_on_a_Table.c
│ │ ├── Transform_A_to_B.c
│ │ ├── Triangular_Numbers.c
│ │ ├── Watermelon.c
│ │ └── Word_Capitalisation.c
│ ├── C Programs - 3/
│ │ ├── Anton_and_Polyhedron.c
│ │ ├── Calculating_Function.c
│ │ ├── Cheap_Travel.c
│ │ ├── Checking_the_Calendar.c
│ │ ├── Currency_System_in_Geraldion.c
│ │ ├── Die_Roll.c
│ │ ├── Domino_Effect.c
│ │ ├── Expression.c
│ │ ├── Fedya_and_Maths.c
│ │ ├── Filya_and_Homework.c
│ │ ├── Game.c
│ │ ├── Initial_Bet.c
│ │ ├── LCM_Challenge.c
│ │ ├── Maximum_Increase.c
│ │ ├── Mishka_and_Game.c
│ │ ├── Multiplication_Table.c
│ │ ├── Next_Round.c
│ │ ├── Party.c
│ │ ├── Police_Recruits.c
│ │ ├── Raising_Bacteria.c
│ │ ├── Save_Luke.c
│ │ ├── Taxes.c
│ │ ├── Tennis_Tournament.c
│ │ ├── The_Number_of_Positions.c
│ │ └── Theatre_Square.c
│ ├── C Programs - 4/
│ │ ├── Aloyna_Numbers.c
│ │ ├── Arpa_Hard_Problem_Mehrad_Naive_Cheat.c
│ │ ├── Benches.c
│ │ ├── Challenge_Pendants.c
│ │ ├── Chewbacca_and_Number.c
│ │ ├── Chocolate.c
│ │ ├── Design_Tutorial_Learn_From_Math.c
│ │ ├── Divisibility.c
│ │ ├── Fedor_and_New_Game.c
│ │ ├── Game_test.c
│ │ ├── Hexagons.c
│ │ ├── Hulk.c
│ │ ├── Indivisibility.c
│ │ ├── Interview.c
│ │ ├── King_Moves.c
│ │ ├── Lineland_Mail.c
│ │ ├── Lucky_Numbers.c
│ │ ├── PolandBall_and_Hypothesis.c
│ │ ├── Professor_Gukiz_Robot.c
│ │ ├── Random_Teams.c
│ │ ├── Reconnaissance_2.c
│ │ ├── Selection_of_Personnel.c
│ │ ├── Tetrahedron.c
│ │ ├── Vasya_and_Petya_Game.c
│ │ └── Way_Too_Long_Words.c
│ ├── C Programs - 5/
│ │ ├── Bear_and_Poker.c
│ │ ├── Boredom.c
│ │ ├── Cut_Ribbon.c
│ │ ├── Display_Size.c
│ │ ├── Duff_in_Love.c
│ │ ├── Flipping_Game.c
│ │ ├── Flowers.cpp
│ │ ├── Fox_and_Dividing_Cheese.c
│ │ ├── Hungry_Sequence.c
│ │ ├── K_Interesting_Pair_of_Integers.c
│ │ ├── Kefa_and_First_Step.c
│ │ ├── Making_a_String.c
│ │ ├── Non_Square_Equation.c
│ │ ├── Odd_Sum.c
│ │ ├── Parking_Lot.c
│ │ ├── Perfect_Permutation.c
│ │ ├── Preparing_for_Olympiad.c
│ │ ├── Star.c
│ │ ├── Table_Tennis_Game_2.c
│ │ ├── Tavas_and_Saddas.c
│ │ ├── Team.c
│ │ ├── Tetrahedron_Efficiently.c
│ │ ├── Tricky_Sum.c
│ │ ├── Vacations.c
│ │ └── Vanya_and_Table.c
│ ├── C Programs - 6/
│ │ ├── A_Shell_Game.c
│ │ ├── Accounting.c
│ │ ├── Anton_and_Digits.c
│ │ ├── Black_Square.c
│ │ ├── Dinner_with_Emma.c
│ │ ├── Ebony_and_Ivory.c
│ │ ├── Find Amir.c
│ │ ├── Game_with_Sticks.c
│ │ ├── Increasing_Sequence.c
│ │ ├── Insomnia_Cure.c
│ │ ├── Jumping_Ball.c
│ │ ├── K_Tree.c
│ │ ├── Lovely_Palindromes.c
│ │ ├── Luxurious_Buildings.c
│ │ ├── Meeting_of_Old_Friends.c
│ │ ├── Oleg_and_Shares.c
│ │ ├── Patrick_and_Shopping.c
│ │ ├── Plate_Game.c
│ │ ├── Rewards.c
│ │ ├── Round_House.c
│ │ ├── System_of_Equations.c
│ │ ├── Vanya_and_Fence.c
│ │ ├── Vanya_and_Lanterns.c
│ │ ├── Vasya_and_Hipster.c
│ │ └── Wizard_Duel.c
│ ├── C Programs - 7/
│ │ ├── 3_Palindrome.c
│ │ ├── Alena_Schedule.c
│ │ ├── Alice_and_Bob.c
│ │ ├── An_Abandoned_Sentiment_From_Past.c
│ │ ├── Andrushya_and_Socks.c
│ │ ├── Combination Lock.cpp
│ │ ├── Devu_Singer_Charu_Joker.c
│ │ ├── Fake_NP.c
│ │ ├── Fence.c
│ │ ├── Find_Marble.c
│ │ ├── Free Ice Cream.cpp
│ │ ├── Hexadecimal's Theorem Alternate Solution.cpp
│ │ ├── Hexadecimal's Theorem.cpp
│ │ ├── IQ_Test.c
│ │ ├── Magnets.c
│ │ ├── Mahmod_Longest_Uncommon_Subsequence.c
│ │ ├── Monster_and_Squirrel.c
│ │ ├── New Year Transportation.cpp
│ │ ├── Optimal_Point_on_a_Line.cpp
│ │ ├── Pashmak_and_Flowers.c
│ │ ├── Potions_Homework.cpp
│ │ ├── Pythagorean Triples.cpp
│ │ ├── Red_Blue_Balls.c
│ │ ├── The_Contest.c
│ │ └── Young_Physicist.c
│ ├── C Programs - 8/
│ │ ├── A and B Team Training.cpp
│ │ ├── Almost Prime.cpp
│ │ ├── Brian's Photos.cpp
│ │ ├── Caisa and Pylons.cpp
│ │ ├── Choosing Teams.cpp
│ │ ├── Ciel and Flowers.cpp
│ │ ├── Diverse Permutation.cpp
│ │ ├── HQ9+.cpp
│ │ ├── Hexadecimal's Numbers.cpp
│ │ ├── Infinite Sequence.cpp
│ │ ├── Jzzhu and Sequences.cpp
│ │ ├── K-Factorisation.cpp
│ │ ├── Noldbach Problem.cpp
│ │ ├── Olesya and Rodion.cpp
│ │ ├── Petr and Book.cpp
│ │ ├── Petya and Strings.cpp
│ │ ├── Sum of Digits.cpp
│ │ ├── T Primes Alternate Solution.cpp
│ │ ├── T-Primes.cpp
│ │ ├── The Golden Age.cpp
│ │ ├── Two Bags of Potatos.cpp
│ │ ├── Vanya and Cards.cpp
│ │ ├── Vitaly and Night.cpp
│ │ ├── Wet Shark and Odd and Even.cpp
│ │ └── Yaroslav and Permutations.cpp
│ ├── C Programs - 9/
│ │ ├── Alyona and Copybooks.cpp
│ │ ├── Appleman and Toastman.cpp
│ │ ├── Array.cpp
│ │ ├── Bear and Five Cards.cpp
│ │ ├── Bus to Udayland.cpp
│ │ ├── Case of the Zeroes and Ones.cpp
│ │ ├── Circle Line.cpp
│ │ ├── Crazy Computer.cpp
│ │ ├── Crossword Solving.cpp
│ │ ├── Divisibility.cpp
│ │ ├── Fox and Number Game.cpp
│ │ ├── Haiku.cpp
│ │ ├── I'm Bored with Life.cpp
│ │ ├── Is your Horseshoe on the other hoof.cpp
│ │ ├── Kitahara Haruki's Gift.cpp
│ │ ├── Little Elephant and Function.cpp
│ │ ├── Little Elephant and Problem.cpp
│ │ ├── New Year and Days.cpp
│ │ ├── One Dimensional Japanese Crossword.cpp
│ │ ├── Present from Lena.cpp
│ │ ├── Prime Matrix.cpp
│ │ ├── String Task.cpp
│ │ ├── Subtractions.cpp
│ │ ├── Toy Army.cpp
│ │ └── k-th_Divisor.cpp
│ ├── C Programs 10/
│ │ ├── A and B Compilation Errors.cpp
│ │ ├── Amr and Music.cpp
│ │ ├── Arrival of General.cpp
│ │ ├── Bear and Game.cpp
│ │ ├── Beautiful Year.cpp
│ │ ├── Black Square.cpp
│ │ ├── Counterexample.cpp
│ │ ├── Difference Row.cpp
│ │ ├── Eugene and Array.cpp
│ │ ├── Interesting Drink.cpp
│ │ ├── Keyboard Layouts.cpp
│ │ ├── Life Without Zeroes.cpp
│ │ ├── Modified GCD.cpp
│ │ ├── Multi Judge Solving.cpp
│ │ ├── Next Test.cpp
│ │ ├── Presents.cpp
│ │ ├── Serega and Coat Rack.cpp
│ │ ├── Serega and Suffixes.cpp
│ │ ├── Slightly Decreasing Permutation.cpp
│ │ ├── SwapSort.cpp
│ │ ├── Taxi.cpp
│ │ ├── Toy Cars.cpp
│ │ ├── Unimodal Arrays.cpp
│ │ ├── Valera and Plates.cpp
│ │ └── Vanya and Cubes.cpp
│ ├── C Programs 11/
│ │ ├── BerSU Ball.cpp
│ │ ├── Elections.cpp
│ │ ├── Five in a Row.cpp
│ │ ├── Football.cpp
│ │ ├── Fortune Telling.cpp
│ │ ├── Free Cash Alternate Solution.cpp
│ │ ├── Free Cash.cpp
│ │ ├── Games.cpp
│ │ ├── Good Number.cpp
│ │ ├── Johnny Likes Numbers.cpp
│ │ ├── Lever.cpp
│ │ ├── Lunch Rush.cpp
│ │ ├── Magic Spheres.cpp
│ │ ├── New Year and Hurry.cpp
│ │ ├── Nicholas and Permutation.cpp
│ │ ├── Petya and Staircases.cpp
│ │ ├── Playing with Dice.cpp
│ │ ├── Saitama Destroys Hotel.cpp
│ │ ├── Sasha and Sticks.cpp
│ │ ├── Soft Drinking.cpp
│ │ ├── The Child and The Homework.cpp
│ │ ├── The New Year Meeting Friends Alternate Solution.cpp
│ │ ├── The New Year Meeting Friends.cpp
│ │ ├── Word.cpp
│ │ └── inc ARG.cpp
│ ├── C Programs 12/
│ │ ├── Anastasia and Pebbles.cpp
│ │ ├── Bear and Three Balls.cpp
│ │ ├── Buggy Sorting.cpp
│ │ ├── Co Prime Array.cpp
│ │ ├── Dima and Friends.cpp
│ │ ├── Dima and Sequence.cpp
│ │ ├── Dreamoon and Stairs Alternate Solution.cpp
│ │ ├── Dreamoon and Stairs.cpp
│ │ ├── Fashion in Berland.cpp
│ │ ├── Inbox (100500).cpp
│ │ ├── Key Races.cpp
│ │ ├── Ksusha and Arrays.cpp
│ │ ├── Lecture.cpp
│ │ ├── Little Elephant and Chess.cpp
│ │ ├── Little Girl and Maximum Sum.cpp
│ │ ├── Minimum Difficulty.cpp
│ │ ├── Pasha and Pixels.cpp
│ │ ├── Puzzles.cpp
│ │ ├── Santa Claus and Candies.cpp
│ │ ├── Sereja and Dima.cpp
│ │ ├── Shaas and Oskols.cpp
│ │ ├── Sleuth.cpp
│ │ ├── The Festive Evening.cpp
│ │ ├── The Number on The Board.cpp
│ │ └── Watching a Movie.cpp
│ ├── C Programs 13/
│ │ ├── A Good Contest.cpp
│ │ ├── Arpa's Obvious Problem and Mehrad's Terrible Solution.cpp
│ │ ├── Arrays.cpp
│ │ ├── Arya and Bran.cpp
│ │ ├── Bear and Elections.cpp
│ │ ├── Business Trip.cpp
│ │ ├── Cards.cpp
│ │ ├── Code Obfuscation.cpp
│ │ ├── Drinks.cpp
│ │ ├── Epic Game.cpp
│ │ ├── Functions Again.cpp
│ │ ├── Generous Kefa.cpp
│ │ ├── George and Job.cpp
│ │ ├── Godsend.cpp
│ │ ├── Ilya and Queries.cpp
│ │ ├── Kuriyama Mirai's Stones.cpp
│ │ ├── Lights Out.cpp
│ │ ├── Little Dima and Equation.cpp
│ │ ├── Little Elephant and Bits.cpp
│ │ ├── New Skateboard.cpp
│ │ ├── Oath of the Night's Watch.cpp
│ │ ├── Sort the Array.cpp
│ │ ├── Star Sky.cpp
│ │ ├── Vanya and Books.cpp
│ │ └── Vasya and Digital Root.cpp
│ ├── C Programs 14/
│ │ ├── Asphalting Roads.cpp
│ │ ├── Bicycle Chain.cpp
│ │ ├── Borze.cpp
│ │ ├── Building Permutation.cpp
│ │ ├── Chess Tourney.cpp
│ │ ├── Cormen - The Best Friend of Man.cpp
│ │ ├── DZY Loves Sequences.cpp
│ │ ├── Dragons.cpp
│ │ ├── Drazil and Factorial.cpp
│ │ ├── Football.cpp
│ │ ├── Helpful Maths.cpp
│ │ ├── Increase and Decrease.cpp
│ │ ├── Jeff and Digits.cpp
│ │ ├── Jzzhu and Children.cpp
│ │ ├── Modulo Sum.cpp
│ │ ├── Odds and Ends.cpp
│ │ ├── Panoramix's Prediction.cpp
│ │ ├── Permutation.cpp
│ │ ├── Powers of Two.cpp
│ │ ├── Queue at the School.cpp
│ │ ├── Rectangles.cpp
│ │ ├── Supercentral Point.cpp
│ │ ├── Tram.cpp
│ │ ├── Ultra Fast Mathematician.cpp
│ │ └── Vasya and String.cpp
│ ├── C Programs 15/
│ │ ├── Army.cpp
│ │ ├── Between the Offices.cpp
│ │ ├── Cableway.cpp
│ │ ├── Ciferia.cpp
│ │ ├── Coins.cpp
│ │ ├── Divisibility by Eight.cpp
│ │ ├── Exams.cpp
│ │ ├── Given Length and Sum of Digits.cpp
│ │ ├── Ilya and Sticks.cpp
│ │ ├── Inna and Huge Candy Matrix.cpp
│ │ ├── K-Multiple Free Set.cpp
│ │ ├── Kefa and Park.cpp
│ │ ├── Mahmoud and Ehab and the MEX.cpp
│ │ ├── Mahmoud and Ehab and the bipartiteness.cpp
│ │ ├── Mahmoud and Ehab and the xor.cpp
│ │ ├── Number of Ways.cpp
│ │ ├── Pearls in a Row.cpp
│ │ ├── Pie Rules.cpp
│ │ ├── Quasi-palindrome.cpp
│ │ ├── Soldier and Number Game.cpp
│ │ ├── Tanya and Toys.cpp
│ │ ├── Team.cpp
│ │ ├── The Eternal Immortality.cpp
│ │ ├── Triangle.cpp
│ │ └── USB Flash Drives.cpp
│ ├── C Programs 16/
│ │ ├── Amusing Joke.cpp
│ │ ├── Anton and Letters.cpp
│ │ ├── Cards with Numbers.cpp
│ │ ├── Classroom Watch.cpp
│ │ ├── Cupboards.cpp
│ │ ├── Dishonest Sellers.cpp
│ │ ├── Dubstep.cpp
│ │ ├── Easy Number Challenge.cpp
│ │ ├── Fox and Snake.cpp
│ │ ├── Greg and Array.cpp
│ │ ├── Hacking Cypher.cpp
│ │ ├── I Wanna Be The Guy.cpp
│ │ ├── IQ Test.cpp
│ │ ├── Jeff and Periods.cpp
│ │ ├── Pashmak and Garden.cpp
│ │ ├── Primes or Palindromes.cpp
│ │ ├── Quasi Binary.cpp
│ │ ├── Sereja and Bottles.cpp
│ │ ├── Team Olympiad.cpp
│ │ ├── The Fibonacci Segment.cpp
│ │ ├── Twins.cpp
│ │ ├── Valera and Tubes.cpp
│ │ ├── Xenia and Bit Operations.cpp
│ │ ├── Xenia and Ringroad.cpp
│ │ └── k-String.cpp
│ ├── C Programs 17/
│ │ ├── Adding Digits.cpp
│ │ ├── Christmas Spruce.cpp
│ │ ├── Dreamoon and Wi-Fi.cpp
│ │ ├── Exams - 122.cpp
│ │ ├── Garden.cpp
│ │ ├── Jamie and Alarm Snooze.cpp
│ │ ├── Jamie and Interesting Graph.cpp
│ │ ├── Kolya and Tanya.cpp
│ │ ├── Mashmokh and ACM.cpp
│ │ ├── Maximum Splitting.cpp
│ │ ├── Minimum Sum.cpp
│ │ ├── Modular Exponentiation.cpp
│ │ ├── New Year and Domino.cpp
│ │ ├── New Year's Eve.cpp
│ │ ├── Palindrome Pairs.cpp
│ │ ├── Perfect Number.cpp
│ │ ├── QAQ.cpp
│ │ ├── Seat Arrangements.cpp
│ │ ├── Supermarket.cpp
│ │ ├── Swap Adjacent Elements.cpp
│ │ ├── Tea Queue.cpp
│ │ ├── Testing Pants for Sadness.cpp
│ │ ├── The World is a Theatre.cpp
│ │ ├── Tricky Alchemy.cpp
│ │ └── Water the Gardens.cpp
│ ├── C Programs 18/
│ │ ├── Art Union.cpp
│ │ ├── Bear and Colours.cpp
│ │ ├── Cave Painting.cpp
│ │ ├── Cloning Toys.cpp
│ │ ├── Eternal Victory.cpp
│ │ ├── Hard Problem.cpp
│ │ ├── Joystick.cpp
│ │ ├── K-Special Tables.cpp
│ │ ├── Lucky Sum.cpp
│ │ ├── Magic Forest.cpp
│ │ ├── Marvolo Gaunt's Ring Alternate Solution.cpp
│ │ ├── Marvolo Gaunt's Ring.cpp
│ │ ├── Not Equal on a Segment.cpp
│ │ ├── Perfect Squares.cpp
│ │ ├── Petya and Inequiations.cpp
│ │ ├── Polo the Penguin and Matrix.cpp
│ │ ├── Polo the Penguin and Strings.cpp
│ │ ├── Replacement.cpp
│ │ ├── Robot Vaccuum Cleaner.cpp
│ │ ├── Rumour.cpp
│ │ ├── Search for Pretty Integers.cpp
│ │ ├── Tom Riddle's Diary.cpp
│ │ ├── Two Substrings.cpp
│ │ ├── Vladik and Fractions.cpp
│ │ └── Woodcutter.cpp
│ ├── C Programs 19/
│ │ ├── A Compatible Pair.cpp
│ │ ├── A Prosperous Lot.cpp
│ │ ├── Almost Identity Permutations.cpp
│ │ ├── Amr and Large Array.cpp
│ │ ├── Beautiful Sets of Points.cpp
│ │ ├── Buggy Robot.cpp
│ │ ├── Cellular Network.cpp
│ │ ├── Coder.cpp
│ │ ├── Diversity.cpp
│ │ ├── Guest From The Past.cpp
│ │ ├── Hamster Farm.cpp
│ │ ├── K-Dominant Character.cpp
│ │ ├── Little Artem and Grasshopper.cpp
│ │ ├── Longest K-Good Segment.cpp
│ │ ├── Love Triangle.cpp
│ │ ├── Nuts.cpp
│ │ ├── Palindrome Transformation.cpp
│ │ ├── Palindromic Supersequence.cpp
│ │ ├── Recursive Queries.cpp
│ │ ├── Run For Your Prize.cpp
│ │ ├── Simple Strings.cpp
│ │ ├── The Useless Toy.cpp
│ │ ├── Vasya and Socks.cpp
│ │ ├── Watchmen.cpp
│ │ └── Word Correction.cpp
│ ├── C Programs 20/
│ │ ├── Alena and the Heater.cpp
│ │ ├── Fafa and Ancient Alphabet.cpp
│ │ ├── Fafa and His Company.cpp
│ │ ├── Fafa and the Gates.cpp
│ │ ├── Fixing Typos.cpp
│ │ ├── Gargari and Bishops.cpp
│ │ ├── Gargari and Permutations Alternate Solution.cpp
│ │ ├── Gargari and Permutations.cpp
│ │ ├── Hard Process.cpp
│ │ ├── Lisa and Dima.cpp
│ │ ├── Love Rescue.cpp
│ │ ├── Mashmokh and Numbers.cpp
│ │ ├── Non-Secret Cypher.cpp
│ │ ├── Olympiad.cpp
│ │ ├── Partition.cpp
│ │ ├── Petya and His Friends Alternate Solution.cpp
│ │ ├── Petya and His Friends.cpp
│ │ ├── Phone Numbers.cpp
│ │ ├── Pocket Book.cpp
│ │ ├── Points on the Line.cpp
│ │ ├── Protect Sheep.cpp
│ │ ├── String Transformation.cpp
│ │ ├── Sum and Replace.cpp
│ │ ├── Vile Grasshoppers.cpp
│ │ └── Weird Subtraction Process.cpp
│ ├── C Programs 21/
│ │ ├── Aramic Script Bitmask Solution.cpp
│ │ ├── Aramic Script.cpp
│ │ ├── Arithmetic Progression.cpp
│ │ ├── Bash and a Tough Math Puzzle.cpp
│ │ ├── Consecutive Subsequences.cpp
│ │ ├── Cyclic Components.cpp
│ │ ├── Divide by Three, Multiply by Two Alternate Solution.cpp
│ │ ├── Divide by Three, Multiply by Two.cpp
│ │ ├── Dreamoon and Sets.cpp
│ │ ├── File Name.cpp
│ │ ├── Fox and Box Accumulation.cpp
│ │ ├── Ghosts.cpp
│ │ ├── Less or Equal.cpp
│ │ ├── Little Girl and Maximum XOR.cpp
│ │ ├── Lucky Sum of Digits.cpp
│ │ ├── Mahmoud and Ehab and another array construction task.cpp
│ │ ├── Mahmoud and Ehab and Even Odd Game.cpp
│ │ ├── Mahmoud and a Triangle.cpp
│ │ ├── Make a Square Alternate Solution.cpp
│ │ ├── Make a Square.cpp
│ │ ├── Mancala.cpp
│ │ ├── Mentors.cpp
│ │ ├── Pairs of Lines.cpp
│ │ ├── Two Gram.cpp
│ │ ├── Valhalla Seige.cpp
│ │ └── Wrong Subtraction.cpp
│ ├── C Programs 22/
│ │ ├── AND Graph.cpp
│ │ ├── Almost Arithmetic Progression.cpp
│ │ ├── Antipalindrome Alternate Solution.cpp
│ │ ├── Antipalindrome.cpp
│ │ ├── Ball.cpp
│ │ ├── Bits.cpp
│ │ ├── Bookshelves.cpp
│ │ ├── Businessman Problems.cpp
│ │ ├── Chess Placing.cpp
│ │ ├── Correct Solution.cpp
│ │ ├── Counting Kangaroos is Fun.cpp
│ │ ├── Fruits.cpp
│ │ ├── High School Become Human.cpp
│ │ ├── Infinity Gauntlet.cpp
│ │ ├── Knights of a Polygonal Table.cpp
│ │ ├── Letters.cpp
│ │ ├── Local Extrema.cpp
│ │ ├── Remove Duplicates.cpp
│ │ ├── Super Agent.cpp
│ │ ├── Switches and Lamps.cpp
│ │ ├── Tafurama.cpp
│ │ ├── Three Displays Segment Tree Solution.cpp
│ │ ├── Three Displays.cpp
│ │ └── Useful Decomposition.cpp
│ ├── C Programs 23/
│ │ ├── An Impassioned Circulation of Affection.cpp
│ │ ├── Another Problem on Strings.cpp
│ │ ├── Babaei and Birthday Cake.cpp
│ │ ├── Bear and Prime Numbers.cpp
│ │ ├── Cirriculum Vitae.cpp
│ │ ├── Classy Numbers Precomputing Solution.cpp
│ │ ├── Counting Arrays.cpp
│ │ ├── Crazy Town.cpp
│ │ ├── Find Maximum.cpp
│ │ ├── Fish.cpp
│ │ ├── Garbage Disposal.cpp
│ │ ├── Guest From The Past.cpp
│ │ ├── Ice Skater.cpp
│ │ ├── Lazyland.cpp
│ │ ├── Lesha and Array Splitting.cpp
│ │ ├── Lost Array.cpp
│ │ ├── Maximum Value.cpp
│ │ ├── Maze.cpp
│ │ ├── Minesweeper.cpp
│ │ ├── Minimum Diameter Tree.cpp
│ │ ├── No To Palindromes.cpp
│ │ ├── On Number of Decompositions into Multipliers.cpp
│ │ ├── Summarise to Powers of Two.cpp
│ │ ├── The Fair Nut and String.cpp
│ │ └── The Meaningless Game.cpp
│ └── C Programs 24/
│ ├── Brutality.cpp
│ ├── Connect.cpp
│ ├── Div Times Mod.cpp
│ ├── Diverse Garland.cpp
│ ├── Division and Union.cpp
│ ├── Finite or Not.cpp
│ ├── Illya and Escalator.cpp
│ ├── Increasing by Modulo.cpp
│ ├── Nice Garland.cpp
│ ├── Planning the Expedition.cpp
│ ├── Playing Piano.cpp
│ ├── Posterized.cpp
│ ├── Powers of Two.cpp
│ ├── Splitting into Digits.cpp
│ ├── Stages.cpp
│ ├── Tanya and Candies.cpp
│ ├── The Way to Home.cpp
│ ├── Vanya and Label.cpp
│ ├── Where_Do_I_Turn.c
│ └── Zero Quantity Maximisation.cpp
├── Contests/
│ ├── 463 Div 1 + 2 ICM Technex/
│ │ ├── Explanations/
│ │ │ └── Team Work Explanation.txt
│ │ └── Programs/
│ │ └── Team Work.cpp
│ ├── 607 Div 1 + 2/
│ │ ├── Explanations/
│ │ │ ├── Azamon Web Services Explanation.txt
│ │ │ ├── Beingawesomeism Explanation.txt
│ │ │ ├── Cut and Paste Explanation.txt
│ │ │ ├── Jeremy Bearimy Explanation.txt
│ │ │ └── Suffix Three Explanation.txt
│ │ └── Programs/
│ │ ├── Azamon Web Services.cpp
│ │ ├── Beingawesomeism.cpp
│ │ ├── Cut and Paste.cpp
│ │ ├── Jeremy Bearimy.cpp
│ │ └── Suffix Three.cpp
│ ├── 609 Div 2/
│ │ ├── Explanations/
│ │ │ └── Equation Explanation.txt
│ │ └── Programs/
│ │ └── Equation.cpp
│ ├── Avito Code Challenge 2018/
│ │ ├── Explanations/
│ │ │ ├── Antipalindrome Alternate Solution Explanation.txt
│ │ │ ├── Antipalindrome Explanation.txt
│ │ │ ├── Bookshelves Explanation.txt
│ │ │ ├── Businessman Problems Explanation.txt
│ │ │ └── Useful Decomposition Explanation.txt
│ │ └── Programs/
│ │ ├── Antipalindrome Alternate Solution.cpp
│ │ ├── Antipalindrome.cpp
│ │ ├── Bookshelves.cpp
│ │ ├── Businessman Problems.cpp
│ │ └── Useful Decomposition.cpp
│ ├── Avito Cool Challenge 2018/
│ │ ├── Explanation/
│ │ │ ├── Colourful Bricks Explanation.txt
│ │ │ └── Definite Game Explanation.txt
│ │ └── Programs/
│ │ ├── Colourful Bricks.cpp
│ │ └── Definite Game.cpp
│ ├── Barcelona Bootcamp 2018/
│ │ ├── Explanation/
│ │ │ ├── Maximum Sum of Digits Explanation.txt
│ │ │ ├── Phone Numbers Explanation.txt
│ │ │ └── Social Circles Explanation.txt
│ │ └── Programs/
│ │ ├── Maximum Sum of Digits.cpp
│ │ ├── Phone Numbers.cpp
│ │ └── Social Circles.cpp
│ ├── CodeForces Global Round 1/
│ │ ├── Explanations/
│ │ │ ├── Magic Stones Explanation.txt
│ │ │ ├── Meaningless Operations Explanation.txt
│ │ │ ├── Parity Explanation.txt
│ │ │ └── Tape Explanation.txt
│ │ └── Programs/
│ │ ├── Magic Stones.cpp
│ │ ├── Meaningless Operations.cpp
│ │ ├── Parity.cpp
│ │ └── Tape.cpp
│ ├── CodeForces Global Round 3/
│ │ ├── Explanations/
│ │ │ ├── Another One Bites the Dust Explanation.txt
│ │ │ ├── Born This Way Explanation.txt
│ │ │ ├── Crazy Diamond Explanation.txt
│ │ │ └── Dirty Deeds Done Dirt Cheap Explanation.txt
│ │ ├── Programs/
│ │ │ ├── Another One Bites the Dust.cpp
│ │ │ ├── Born This Way.cpp
│ │ │ ├── Crazy Diamond.cpp
│ │ │ └── Dirty Deeds Done Dirt Cheap.cpp
│ │ └── Rough Notes Link
│ ├── CodeForces Global Round 5/
│ │ ├── Explanations/
│ │ │ ├── Balanced Rating Changes Explanation.txt
│ │ │ └── Balanced Tunnel Explanation.txt
│ │ └── Programs/
│ │ ├── Balanced Rating Changes.cpp
│ │ └── Balanced Tunnel.cpp
│ ├── Dasha Code Championship Elimination Round 2019/
│ │ ├── Explanations/
│ │ │ ├── Cows and Snacks Explanation.txt
│ │ │ ├── Koala and Lights Explanation
│ │ │ ├── Paint The Digits Explanation
│ │ │ └── Paint Your Numbers Explanation
│ │ ├── Programs/
│ │ │ ├── Cows and Snacks.cpp
│ │ │ ├── Koala and Lights.cpp
│ │ │ ├── Paint The Digits.cpp
│ │ │ ├── Paint The Numbers.cpp
│ │ │ └── Paint Your Numbers.cpp
│ │ └── Rough Notes
│ ├── Div 1 492/
│ │ ├── Explanations/
│ │ │ ├── Game 995 Explanation.txt
│ │ │ ├── Leaving the Bar Explanation.txt
│ │ │ └── Suit and Tie Explanation.txt
│ │ └── Programs/
│ │ ├── Game 995D.cpp
│ │ ├── Leaving The Bar.cpp
│ │ └── Suit and Tie.cpp
│ ├── Div 2 12/
│ │ ├── Explanations/
│ │ │ ├── Ball Explanation.txt
│ │ │ ├── Correct Solution Explanation.txt
│ │ │ ├── Fruits Explanation.txt
│ │ │ └── Super Agent Explanation.txt
│ │ └── Programs/
│ │ ├── Ball.cpp
│ │ ├── Correct Solution.cpp
│ │ ├── Fruits.cpp
│ │ └── Super Agent.cpp
│ ├── Div 2 136/
│ │ ├── Explanations/
│ │ │ ├── Little Elephant And Array Segment Tree Explanation.txt
│ │ │ ├── Little Elephant and Arrays Explanation.txt
│ │ │ ├── Little Elephant and Function Explanation.txt
│ │ │ ├── Little Elephant and Numbers Explanation.txt
│ │ │ └── Little Elephant and Problem Explanation.txt
│ │ └── Programs/
│ │ ├── Little Elephant And Array Segment Tree Solution.cpp
│ │ ├── Little Elephant and Array.cpp
│ │ ├── Little Elephant and Function.cpp
│ │ ├── Little Elephant and Numbers.cpp
│ │ └── Little Elephant and Problem.cpp
│ ├── Div 2 197/
│ │ ├── Explanations/
│ │ │ ├── Helpful Maths Explanation.txt
│ │ │ ├── Xenia and Bit Operations Explanation.txt
│ │ │ ├── Xenia and Ringroad Explanation.txt
│ │ │ └── Xenia and Weights Explanation.txt
│ │ └── Programs/
│ │ ├── Helpful Maths.cpp
│ │ ├── Xenia and Bit Operations.cpp
│ │ ├── Xenia and Ringroad.cpp
│ │ └── Xenia and Weights.cpp
│ ├── Div 2 205/
│ │ ├── Explanation/
│ │ │ ├── Little Elephant and Cards Explanation.txt
│ │ │ └── Little Elephant and Rozdil - Explanation.txt
│ │ └── Programs/
│ │ ├── Little Elephant and Cards.cpp
│ │ ├── Little Elephant and Sorting.cpp
│ │ └── Little_Elephant_Rozdil.c
│ ├── Div 2 261/
│ │ ├── Explanation/
│ │ │ ├── Pashmak and Buses Explanation.txt
│ │ │ ├── Pashmak and Buses.cpp
│ │ │ ├── Pashmak and Flowers - Explanation.txt
│ │ │ ├── Pashmak and Garden Explanation.txt
│ │ │ ├── Pashmak and Graph Explanation.txt
│ │ │ └── Pashmak and Parmida's Problem Explanation.txt
│ │ └── Programs/
│ │ ├── Pashmak and Buses.cpp
│ │ ├── Pashmak and Garden.cpp
│ │ ├── Pashmak and Graph.cpp
│ │ ├── Pashmak and Parmida's Problem.cpp
│ │ └── Pashmak_and_Flowers.c
│ ├── Div 2 276/
│ │ ├── Explanations/
│ │ │ ├── Little Girl and Maximum Sum Explanation.txt
│ │ │ ├── Little Girl and Maximum XOR Explanation.txt
│ │ │ └── Lunch Rush Explanation.txt
│ │ └── Programs/
│ │ ├── Little Girl and Maximum Sum.cpp
│ │ ├── Little Girl and Maximum XOR.cpp
│ │ └── Lunch Rush.cpp
│ ├── Div 2 321/
│ │ └── Programs/
│ │ ├── Kefa and Company.cpp
│ │ ├── Kefa and Park.cpp
│ │ └── Kefa_and_First_Step.c
│ ├── Div 2 367/
│ │ ├── Explanation/
│ │ │ ├── Hard Problem Explanation.txt
│ │ │ └── Interesting Drink Explanation.txt
│ │ └── Programs/
│ │ ├── Hard Problem.cpp
│ │ └── Interesting Drink.cpp
│ ├── Div 2 371/
│ │ ├── Explanations/
│ │ │ ├── Filya and Homework - Explanation.txt
│ │ │ ├── Meeting of Old Friends - Explanation.txt
│ │ │ └── Sonya and Queries Explanation.txt
│ │ └── Programs/
│ │ ├── Filya_and_Homework.c
│ │ ├── Meeting_of_Old_Friends.c
│ │ └── Sonya and Queries.cpp
│ ├── Div 2 461/
│ │ ├── Explanations/
│ │ │ └── Cave Paintings Explanation.txt
│ │ └── Programs/
│ │ └── Cave Paintings.cpp
│ ├── Div 2 464/
│ │ └── Programs/
│ │ └── Love Triangle.cpp
│ ├── Div 2 473/
│ │ ├── Explanation/
│ │ │ ├── Mahmoud and Ehab and Another Array Construction Task Explanation.txt
│ │ │ └── Mahmoud and Ehab and Even Odd Game Explanation.txt
│ │ └── Programs/
│ │ ├── Mahmoud and Ehab and Another Array Construction Task.cpp
│ │ └── Mahmoud and Ehab and Even Odd Game.cpp
│ ├── Div 2 478/
│ │ ├── Explanations/
│ │ │ ├── Aramic Script Bitmask Solution.txt
│ │ │ ├── Aramic Script Explanation.txt
│ │ │ ├── Ghosts Explanation.txt
│ │ │ ├── Mancala Explanation.txt
│ │ │ └── Valhalla Siege Explanation.txt
│ │ └── Programs/
│ │ ├── Aramic Script Bitmask Solution.cpp
│ │ ├── Aramic Script.cpp
│ │ ├── Ghosts.cpp
│ │ ├── Mancala.cpp
│ │ └── Valhalla Siege.cpp
│ ├── Div 2 485/
│ │ ├── Explanations/
│ │ │ ├── AND Graph Explanation.txt
│ │ │ ├── Fair Explanation.txt
│ │ │ ├── High Schooll Become Human Explanation.txt
│ │ │ ├── Infinity Gauntlet Explanation.txt
│ │ │ ├── Petr and Permutations Explanation.txt
│ │ │ ├── Three Displays Explanation.txt
│ │ │ └── Three Displays Segment Tree Solution Explanation.txt
│ │ └── Programs/
│ │ ├── AND Graph.cpp
│ │ ├── Fair.cpp
│ │ ├── High School Become Human.cpp
│ │ ├── Infinity Gauntlet.cpp
│ │ ├── Petr and Permutations.cpp
│ │ ├── Three Displays Segment Tree Solution.cpp
│ │ └── Three Displays.cpp
│ ├── Div 2 489/
│ │ ├── Explanations/
│ │ │ ├── Nastya Studies Informatics Explanation.txt
│ │ │ ├── Nastya and Game Explanation.txt
│ │ │ ├── Nastya and King Shamans Alternate Solution Explanation.txt
│ │ │ ├── Nastya and King Shamans Explanation.txt
│ │ │ ├── Nastya and a Wardrobe Explanation.txt
│ │ │ └── Nastya and an Array Explanation.txt
│ │ └── Programs/
│ │ ├── Nastya Studies Informatics.cpp
│ │ ├── Nastya and Game.cpp
│ │ ├── Nastya and King-Shamans Alternate Solution.cpp
│ │ ├── Nastya and King-Shamans.cpp
│ │ ├── Nastya and a Wardrobe.cpp
│ │ └── Nastya and an Array.cpp
│ ├── Div 2 491/
│ │ ├── Explanations/
│ │ │ ├── Bishwock Explanation.txt
│ │ │ ├── Bus Number Explanation.txt
│ │ │ ├── Candies Explanation.txt
│ │ │ ├── Getting an A Explanation.txt
│ │ │ └── If At First You Don't Succeed Explanation.txt
│ │ └── Programs/
│ │ ├── Bishwock.cpp
│ │ ├── Bus Number.cpp
│ │ ├── Candies.cpp
│ │ ├── Getting an A.cpp
│ │ └── If At First You Don't Succeed.cpp
│ ├── Div 2 492/
│ │ ├── Explanation/
│ │ │ ├── Game 995 Explanation.txt
│ │ │ ├── Hit the Lottery Explanation.txt
│ │ │ ├── Leaving the Bar Explanation.txt
│ │ │ ├── Suit and Tie Explanation.txt
│ │ │ ├── Tesla Explanation.txt
│ │ │ └── World Cup Explanation.txt
│ │ └── Programs/
│ │ ├── Game 995D.cpp
│ │ ├── Hit the Lottery.cpp
│ │ ├── Leaving The Bar.cpp
│ │ ├── Suit and Tie.cpp
│ │ ├── Tesla.cpp
│ │ └── World Cup.cpp
│ ├── Div 2 497/
│ │ ├── Explanation/
│ │ │ ├── Reorder the Array Explanation.txt
│ │ │ ├── Romaji Explanation.txt
│ │ │ └── Turn The Rectangle Explanation.txt
│ │ └── Programs/
│ │ ├── Reorder the Array.cpp
│ │ ├── Romaji.cpp
│ │ └── Turn the Rectangle.cpp
│ ├── Div 2 508/
│ │ ├── Explanation/
│ │ │ ├── Equality Explanation.txt
│ │ │ ├── Gambling Explanation.txt
│ │ │ └── Non Coprime Partition Explanation.txt
│ │ └── Programs/
│ │ ├── Equality.cpp
│ │ ├── Gambling.cpp
│ │ └── Non Coprime Partition.cpp
│ ├── Div 2 511/
│ │ ├── Explanation/
│ │ │ ├── Enlarge GCD Explanation.txt
│ │ │ └── Little C Loves 3 I Explanation.txt
│ │ └── Programs/
│ │ └── Little C Loves 3 I.cpp
│ ├── Div 2 533/
│ │ ├── Explanations/
│ │ │ ├── Ayoub and Lost Array Explanation.txt
│ │ │ ├── Ayoub and Lost Array Matrix Exponentiation Explanation.txt
│ │ │ ├── Salem and Sticks Explanation.txt
│ │ │ └── Zuhair and Strings Explanation.txt
│ │ └── Programs/
│ │ ├── Ayoub and Lost Array Matrix Exponentiation.cpp
│ │ ├── Ayoub and Lost Array.cpp
│ │ ├── Salem and Sticks.cpp
│ │ └── Zuhair and Strings.cpp
│ ├── Div 2 538/
│ │ ├── Explanations/
│ │ │ ├── Arithmetic Progression Explanation.txt.txt
│ │ │ ├── Flood Fill Explanation.txt
│ │ │ ├── Got Any Grapes Explanation.txt
│ │ │ ├── Please Another Queries on Array Explanation.txt
│ │ │ ├── Trailing Loves Explanation.txt
│ │ │ ├── Yet Another Subarray Alternate Solution Explanation.txt
│ │ │ └── Yet Another Subarray Explanation.txt
│ │ └── Programs/
│ │ ├── Arithmetic Progression.cpp
│ │ ├── Flood Fill.cpp
│ │ ├── Got Any Grapes.cpp
│ │ ├── Please Another Queries on Array.cpp
│ │ ├── Trailing Loves.cpp
│ │ ├── Yet Another Subarray Problem Alternate Solution.cpp
│ │ └── Yet Another Subarray Problem.cpp
│ ├── Div 2 539/
│ │ ├── Explanations/
│ │ │ ├── Sasha and A Bit of Relax Explanation.txt
│ │ │ ├── Sasha and His Trip Explanation.txt
│ │ │ ├── Sasha and Magnetic Machine Explanation.txt
│ │ │ └── Sasha and One More Name Explanation.txt
│ │ └── Programs/
│ │ ├── Sasha and A Bit of Relax.cpp
│ │ ├── Sasha and His Trip.cpp
│ │ ├── Sasha and Magnetic Machine.cpp
│ │ └── Sasha and One More Name.cpp
│ ├── Div 2 546/
│ │ ├── Explanations/
│ │ │ ├── Nastya is Playing Computer Games Explanation.txt
│ │ │ └── Nastya is Transposing Matrices Explanation.txt
│ │ └── Programs/
│ │ ├── Nastya is Playing Computer Games.cpp
│ │ └── Nastya is Transposing Matrices.cpp
│ ├── Div 2 554/
│ │ ├── Explanations/
│ │ │ └── Neko Does Math Explanation.txt
│ │ └── Programs/
│ │ └── Neko Does Math.cpp
│ ├── Div 2 562/
│ │ ├── Explanations/
│ │ │ ├── Good Triple Explanation.txt
│ │ │ └── Pairs Explanation.txt
│ │ ├── Programs/
│ │ │ ├── Good Triple.cpp
│ │ │ ├── Increasing by Modulo.cpp
│ │ │ └── Pairs.cpp
│ │ └── Rough Notes Link
│ ├── Div 2 566/
│ │ ├── Explanations/
│ │ │ ├── Filing Shapes Explanation.txt
│ │ │ └── Plus From Picture Explanation.txt
│ │ ├── Programs/
│ │ │ ├── Filing Shapes.cpp
│ │ │ └── Plus From Picture.cpp
│ │ └── Rough Notes Link
│ ├── Div 2 585/
│ │ ├── Explanations/
│ │ │ ├── Swap Letters Explanation.txt
│ │ │ ├── The Number of Products Explanation.txt
│ │ │ └── Yellow Cards Explanation
│ │ ├── Programs/
│ │ │ ├── Swap Letters.cpp
│ │ │ ├── The Number of Products.cpp
│ │ │ └── Yellow Cards.cpp
│ │ └── Rough Notes
│ ├── Div 2 588/
│ │ ├── Explanations/
│ │ │ ├── Anadi and Domino Explanation.txt
│ │ │ ├── Ania and Minimizing Explanation.txt
│ │ │ ├── Dawid and Bags of Candies Explanation.txt
│ │ │ ├── Kamil and Making a Stream Explanation.txt
│ │ │ ├── Konrad and Company Evaluation Explanation.txt
│ │ │ └── Marcin and Training Camp Explanation.txt
│ │ └── Programs/
│ │ ├── Anadi and Domino.cpp
│ │ ├── Ania and Minimizing.cpp
│ │ ├── Dawid and Bags of Candies.cpp
│ │ ├── Kamil and Making a Stream.cpp
│ │ ├── Konrad and Company Evaluation.cpp
│ │ └── Marcin and Training Camp.cpp
│ ├── Div 2 589/
│ │ ├── Explanations/
│ │ │ ├── Complete Tripartite Explanation.txt
│ │ │ ├── Distinct Digits Explanation.txt
│ │ │ ├── Filing the Grid Explanation.txt
│ │ │ └── Primes and Multiplication Explanation.txt
│ │ └── Programs/
│ │ ├── Complete Tripartite.cpp
│ │ ├── Distinct Digits.cpp
│ │ ├── Filing the Grid.cpp
│ │ └── Primes and Multiplication.cpp
│ ├── Div 2 592/
│ │ ├── Explanations/
│ │ │ ├── Minimizing Difference Explanation.txt
│ │ │ ├── Pens and Pencils Explanation.txt
│ │ │ ├── Rooms and Staircases Explanation.txt
│ │ │ └── The Football Season Explanation.txt
│ │ └── Programs/
│ │ ├── Minimizing Difference.cpp
│ │ ├── Pens and Pencils.cpp
│ │ ├── Rooms and Staircases.cpp
│ │ └── The Football Season.cpp
│ ├── Div 2 596/
│ │ ├── Explanations/
│ │ │ ├── Forgetting Things Explanation.txt
│ │ │ ├── P Binary Explanation.txt
│ │ │ ├── Power Products Explanation.txt
│ │ │ └── TV Subscriptions Explanation.txt
│ │ └── Programs/
│ │ ├── Forgetting Things.cpp
│ │ ├── P-Binary.cpp
│ │ ├── Power Products.cpp
│ │ └── TV Subscriptions.cpp
│ ├── Div 2 597/
│ │ ├── Explanations/
│ │ │ ├── Constanze's Machine Explanation.txt
│ │ │ ├── Good Ol Number Colouring Explanation.txt
│ │ │ └── Restricted RPS Explanation.txt
│ │ └── Programs/
│ │ ├── Constanze's Machine.cpp
│ │ ├── Good Ol Number Colouring.cpp
│ │ └── Restricted RPS.cpp
│ ├── Div 2 599/
│ │ ├── Explanations/
│ │ │ ├── Character Swap Explanation.txt
│ │ │ ├── Maximum Square Explanation.txt
│ │ │ └── Tile Painting Explanation.txt
│ │ └── Programs/
│ │ ├── Character Swap.cpp
│ │ ├── Maximum Square.cpp
│ │ └── Tile Painting.cpp
│ ├── Div 2 600/
│ │ ├── Explanations/
│ │ │ ├── Antenna Coverage Explanation.txt.txt
│ │ │ ├── Harmonious Graph Explanation.txt
│ │ │ ├── Silly Mistakes Explanation.txt
│ │ │ ├── Single Push Explanation.txt
│ │ │ └── Sweets Eating Explanation.txt
│ │ └── Programs/
│ │ ├── Antenna Coverage.cpp
│ │ ├── Harmonious Graph.cpp
│ │ ├── Silly Mistakes.cpp
│ │ ├── Single Push.cpp
│ │ └── Sweets Eating.cpp
│ ├── Div 2 608/
│ │ └── Programs/
│ │ └── Shwarma Tent.cpp
│ ├── Div 2 85/
│ │ ├── Explanation/
│ │ │ ├── Petya and Divisors Explanation.txt
│ │ │ ├── Petya and Inequiations Explanation.txt
│ │ │ └── Petya and Strings Explanation.txt
│ │ └── Programs/
│ │ ├── Petya and Divisors.cpp
│ │ ├── Petya and Inequiations.cpp
│ │ └── Petya and Strings.cpp
│ ├── Div 3 479/
│ │ ├── Explanations/
│ │ │ ├── Consecutive Subsequences Explanation.txt
│ │ │ ├── Cyclic Components Explanation.txt
│ │ │ ├── Divide by Three Multiply by Two Alternate Solution Explanation.txt
│ │ │ ├── Divide by Three, Multiply by Two Explanation.txt
│ │ │ ├── Less or Equal Explanation.txt
│ │ │ ├── Two Gram Explanation.txt
│ │ │ └── Wrong Subtraction Explanation.txt
│ │ └── Programs/
│ │ ├── Consecutive Subsequences.cpp
│ │ ├── Cyclic Components.cpp
│ │ ├── Divide by Three, Multiply by Two Alternate Solution.cpp
│ │ ├── Divide by Three, Multiply by Two.cpp
│ │ ├── Less or Equal.cpp
│ │ ├── Two Gram.cpp
│ │ └── Wrong Subtraction.cpp
│ ├── Div 3 481/
│ │ ├── Explanations/
│ │ │ ├── Almost Arithmetic Progression Explanation.txt
│ │ │ ├── File Name Explanation.txt
│ │ │ ├── Letters Explanation.txt
│ │ │ ├── Mentors Explanation.txt
│ │ │ └── Remove Duplicates Explanation.txt
│ │ └── Programs/
│ │ ├── Almost Arithmetic Progression.cpp
│ │ ├── File Name.cpp
│ │ ├── Letters.cpp
│ │ ├── Mentors.cpp
│ │ └── Remove Duplicates.cpp
│ ├── Div 3 486/
│ │ ├── Explanation/
│ │ │ ├── Diverse Team Explanation.txt
│ │ │ ├── Divisibility by 25 Explanation.txt
│ │ │ ├── Equal Sums Explanation.txt
│ │ │ ├── Points and Powers of Two Explanation.txt
│ │ │ └── Substring Sort Explanation.txt
│ │ └── Programs/
│ │ ├── Diverse Team.cpp
│ │ ├── Divisibility by 25.cpp
│ │ ├── Equal Sums.cpp
│ │ ├── Points and Powers of Two.cpp
│ │ └── Substring Sort.cpp
│ ├── Div 3 490/
│ │ ├── Explanations/
│ │ │ ├── Alphabetic Removals Explanation.txt
│ │ │ ├── Equalise the Remainders Explanation.txt
│ │ │ ├── Mishika and Contests Explanation.txt
│ │ │ ├── Reachability from Capital Explanation.txt
│ │ │ └── Reversing Encryption Explanation.txt
│ │ └── Programs/
│ │ ├── Alphabetic Removals.cpp
│ │ ├── Equalise the Remainders.cpp
│ │ ├── Mishika and Contests.cpp
│ │ ├── Reachability from Capital.cpp
│ │ └── Reversing Encryption.cpp
│ ├── Div 3 494/
│ │ ├── Explanations/
│ │ │ ├── Binary String Constructing Explanation.txt
│ │ │ ├── Coins and Queries Explanation.txt
│ │ │ ├── Intense Heat Explanation.txt
│ │ │ └── Polycarp's Pockets Explanation.txt
│ │ └── Programs/
│ │ ├── Binary String Constructing.cpp
│ │ ├── Coins and Queries.cpp
│ │ ├── Intense Heat.cpp
│ │ └── Polycarp's Pockets.cpp
│ ├── Div 3 521/
│ │ ├── Explanations/
│ │ │ ├── Cutting Out Explanation.txt
│ │ │ ├── Disturbed People.txt
│ │ │ ├── Frog Jumping.txt
│ │ │ ├── Good Array.txt
│ │ │ └── Thematic Contests Explanation.txt
│ │ └── Programs/
│ │ ├── Cutting Out.cpp
│ │ ├── Disturbed People.cpp
│ │ ├── Frog Jumping.cpp
│ │ ├── Good Array.cpp
│ │ ├── Pictures with Kittens (Easy Version).cpp
│ │ └── Thematic Contests.cpp
│ ├── Div 3 531/
│ │ ├── Explanations/
│ │ │ ├── Array K Colouring Explanation.txt
│ │ │ └── Balanced Ternary String Explanation.txt
│ │ └── Programs/
│ │ ├── Array K Colouring.cpp
│ │ └── Balanced Ternary String.cpp
│ ├── Div 3 547/
│ │ ├── Explanations/
│ │ │ ├── Colored Boots Explanation.txt
│ │ │ ├── Game 23 Explanation.txt
│ │ │ ├── Maximal Continuous Rest Explanation.txt
│ │ │ ├── Polycarp Restores Permutation Explanation.txt
│ │ │ ├── Privatization of Roads in Berland Explanation.txt
│ │ │ ├── Same Sum Blocks Explanation.txt
│ │ │ └── Superhero Battle Explanation.txt
│ │ └── Programs/
│ │ ├── Colored Boots.cpp
│ │ ├── Game 23.cpp
│ │ ├── Maximal Continuous Rest.cpp
│ │ ├── Polycarp Restores Permutation.cpp
│ │ ├── Privatization of Roads in Berland.cpp
│ │ ├── Same Sum Blocks.cpp
│ │ └── Superhero Battle.cpp
│ ├── Div 3 590/
│ │ ├── Explanations/
│ │ │ ├── Special Permutations Explanation.txt
│ │ │ └── Yet Another Substring Reverse Explanation.txt
│ │ └── Programs/
│ │ ├── Special Permutations.cpp
│ │ └── Yet Another Substring Reverse.cpp
│ ├── Div 3 593/
│ │ ├── Explanations/
│ │ │ ├── Books Exchange Explanation.txt
│ │ │ ├── By Elevator or Stairs Explanation.txt
│ │ │ ├── Good Numbers Explanation.txt
│ │ │ └── Yet Another Dividing Into Teams Explanation.txt
│ │ └── Programs/
│ │ ├── Books Exchange.cpp
│ │ ├── Elevator or Stairs.cpp
│ │ ├── Good Numbers.cpp
│ │ └── Yet Another Dividing Into Teams.cpp
│ ├── Div 3 595/
│ │ ├── Explanations/
│ │ │ ├── Books Exchange Explanation.txt
│ │ │ ├── Good Numbers Explanation.txt
│ │ │ └── Yet Another Dividing Into Teams Explanation.txt
│ │ └── Programs/
│ │ ├── Books Exchange.cpp
│ │ ├── Good Numbers.cpp
│ │ └── Yet Another Dividing Into Teams.cpp
│ ├── Div 3 598/
│ │ ├── Explanations/
│ │ │ ├── Equalizing Two Strings Explanation.txt
│ │ │ ├── Minimize the Permutation Explanation.txt
│ │ │ └── Payment Without Change Explanation.txt
│ │ └── Programs/
│ │ ├── Binary String Minimizing.cpp
│ │ ├── Equalizing Two Strings.cpp
│ │ ├── Minimize the Permutation.cpp
│ │ └── Payment Without Change.cpp
│ ├── Educational Round 11/
│ │ ├── Explanations/
│ │ │ ├── Co Prime Array Explanation.txt
│ │ │ ├── Hard Process Explanation.txt
│ │ │ └── Number of Parallelograms Explanation.txt
│ │ └── Programs/
│ │ ├── Co Prime Array.cpp
│ │ ├── Hard Process.cpp
│ │ └── Number of Parallelograms.cpp
│ ├── Educational Round 32/
│ │ ├── Explanations/
│ │ │ ├── Almost Identity Permutations Explanation.txt
│ │ │ ├── Buggy Robot.cpp
│ │ │ ├── K-Dominant Character Explanation.txt
│ │ │ └── Local Extrema Explanation.txt
│ │ └── Programs/
│ │ ├── Almost Identity Permutations.cpp
│ │ ├── Buggy Robot.cpp
│ │ ├── K-Dominant Character.cpp
│ │ └── Local Extrema.cpp
│ ├── Educational Round 37/
│ │ ├── Explanation/
│ │ │ ├── Connected Components Explanation.txt.txt
│ │ │ ├── List of Integer Explanation.txt
│ │ │ ├── Sum and Replace Explanation.txt
│ │ │ ├── Swap Adjacent Elements Explanation.txt
│ │ │ ├── Tanks Explanation.txt.txt
│ │ │ ├── Tea Queue Explanation.txt
│ │ │ └── Water the Gardens Explanation.txt
│ │ └── Programs/
│ │ ├── Connected Components.cpp
│ │ ├── List of Integers.cpp
│ │ ├── Sum and Replace.cpp
│ │ ├── Swap Adjacent Elements.cpp
│ │ ├── Tanks.cpp
│ │ ├── Tea Queue.cpp
│ │ └── Water the Gardens.cpp
│ ├── Educational Round 44/
│ │ ├── Explanations/
│ │ │ ├── Chess Placing Explanation.txt
│ │ │ └── Switches and Lamps Explanation.txt
│ │ └── Programs/
│ │ ├── Chess Placing.cpp
│ │ └── Switches and Lamps.cpp
│ ├── Educational Round 46/
│ │ ├── Explanations/
│ │ │ ├── CodeHorses T Shirts Explanation.txt
│ │ │ ├── Covered Points Count Explanation.txt
│ │ │ └── Yet Another Problem on Subsequence Explanation.txt
│ │ └── Programs/
│ │ ├── CodeHorses T Shirts.cpp
│ │ ├── Covered Points Count.cpp
│ │ └── Yet Another Problem on Subsequence.cpp
│ ├── Educational Round 51/
│ │ ├── Explanation/
│ │ │ ├── Bicolourings Explanation.txt
│ │ │ ├── Relatively Prime Pairs Explanation.txt
│ │ │ ├── Vasya and Multisets Explanation.txt
│ │ │ └── Vasya and Password Explanation.txt
│ │ └── Programs/
│ │ ├── Bicolourings.cpp
│ │ ├── Relatively Prime Pairs.cpp
│ │ ├── Vasya and Multisets.cpp
│ │ └── Vasya and Password.cpp
│ ├── Educational Round 52/
│ │ ├── Explanations/
│ │ │ ├── Vasya and Chocolates Explanation.txt
│ │ │ └── Vasya and Isolated Vertices Explanation.txt
│ │ └── Programs/
│ │ ├── Vasya and Chocolates.cpp
│ │ └── Vasya and Isolated Vertices.cpp
│ ├── Educational Round 54/
│ │ ├── Explanation/
│ │ │ ├── Divisor Subtraction Explanation.txt
│ │ │ ├── Meme Problem Explanation.txt
│ │ │ └── Minimizing the String Explanation.txt
│ │ └── Programs/
│ │ ├── Divisor Subtraction.cpp
│ │ ├── Meme Problem.cpp
│ │ └── Minimizing the String.cpp
│ ├── Educational Round 55/
│ │ ├── Explanation/
│ │ │ └── Increasing Frequency Explanation.txt
│ │ └── Programs/
│ │ └── Increasing Frequency.cpp
│ ├── Educational Round 56/
│ │ ├── Explanations/
│ │ │ ├── Beautiful Graph Explanation.txt
│ │ │ ├── Dice Rolling Explanation.txt
│ │ │ ├── Letters Rearranging Explanation.txt
│ │ │ └── Mishka and Last Exam Explanation.txt
│ │ └── Programs/
│ │ ├── Beautiful Graph.cpp
│ │ ├── Dice Rolling.cpp
│ │ ├── Letters Rearranging.cpp
│ │ └── Mishka and Last Exam.cpp
│ ├── Educational Round 60/
│ │ ├── Explanations/
│ │ │ ├── Best Subsegment Explanation.txt
│ │ │ └── Emotes Explanation.txt
│ │ └── Programs/
│ │ ├── Best Subsegment.cpp
│ │ └── Emotes.cpp
│ ├── Educational Round 62/
│ │ ├── Explanations/
│ │ │ ├── Detective Book Explanation.txt
│ │ │ ├── Good Strings Explanation.txt
│ │ │ ├── Minimum Triangulation Explanation.txt
│ │ │ └── Playlist Explanation.txt
│ │ └── Programs/
│ │ ├── Detective Book.cpp
│ │ ├── Good Strings.cpp
│ │ ├── Minimum Triangulation.cpp
│ │ └── Playlist.cpp
│ ├── Educational Round 69/
│ │ ├── Explanations/
│ │ │ ├── Array Splitting Explanation.txt
│ │ │ ├── DIY Wooden Ladder Explanation.txt
│ │ │ └── Pillars Explanation.txt
│ │ ├── Programs/
│ │ │ ├── Array Splitting.cpp
│ │ │ ├── DIY Wooden Ladder.cpp
│ │ │ └── Pillars.cpp
│ │ └── Rough Notes Link
│ ├── Educational Round 73/
│ │ ├── Explanations/
│ │ │ ├── 2048 Game Explanation.txt
│ │ │ ├── Game With String Explanation.txt
│ │ │ ├── Knights Explanation.txt
│ │ │ ├── Make The Fence Great Again Explanation.txt
│ │ │ └── Perfect Team Explanation.txt
│ │ └── Programs/
│ │ ├── 2048 Game.cpp
│ │ ├── Game With String.cpp
│ │ ├── Knights.cpp
│ │ ├── Make The Fence Great Again.cpp
│ │ └── Perfect Team.cpp
│ ├── Educational Round 74/
│ │ ├── Explanations/
│ │ │ ├── AB String Explanation.txt
│ │ │ ├── Keyboard Purchase Explanation.txt
│ │ │ ├── Kill Em All Explanation.txt
│ │ │ └── Prime Subtraction Explanation.txt
│ │ └── Programs/
│ │ ├── AB String.cpp
│ │ ├── Keyboard Purchase.cpp
│ │ ├── Kill Em All Explanation.txt
│ │ └── Prime Subtraction.cpp
│ ├── Educational Round 77/
│ │ ├── Explanations/
│ │ │ └── Yet Another Monster Killing Problem Explanation.txt
│ │ └── Programs/
│ │ ├── Dominated Subarray.cpp
│ │ ├── Magic Stick.cpp
│ │ ├── Two Rival Students.cpp
│ │ └── Yet Another Monster Killing Problem.cpp
│ ├── Lyft Level 5 Challenge 2018 - Elimination Round/
│ │ ├── Explanation/
│ │ │ ├── Divisors.txt
│ │ │ ├── King Escape Explanation.txt
│ │ │ ├── Permutation Game Explanation.txt
│ │ │ └── Square Difference Explanation.txt
│ │ └── Programs/
│ │ ├── Divisors.cpp
│ │ ├── King Escape.cpp
│ │ ├── Permutation Game.cpp
│ │ └── Square Difference.cpp
│ ├── Mail.Ru Cup 2018 Round 1/
│ │ ├── Explanation/
│ │ │ ├── Appending Mex.txt
│ │ │ ├── Candies Distribution.txt
│ │ │ └── Changing the Array Explanation.txt
│ │ └── Programs/
│ │ ├── Appending Mex.cpp
│ │ ├── Candy Distribution.cpp
│ │ └── Changing the Array.cpp
│ ├── Manthan 2018/
│ │ ├── Explanation/
│ │ │ ├── Equalize Explanation.txt
│ │ │ ├── Packets Explanation.txt
│ │ │ ├── Reach Median Explanation.txt
│ │ │ └── Valid BFS Explanation.txt
│ │ └── Programs/
│ │ ├── Equalize.cpp
│ │ ├── Packets.cpp
│ │ ├── Reach Median.cpp
│ │ └── Valid BFS.cpp
│ ├── Moscow Team Olympiad 2018/
│ │ ├── Explanation/
│ │ │ ├── Equations of Mathematical Magic Explanation.txt
│ │ │ ├── Make a Triangle Explanation.txt
│ │ │ └── Oh Those Palindromes Explanation.txt
│ │ └── Programs/
│ │ ├── Equations of Mathematical Magic.cpp
│ │ ├── Make a Triangle.cpp
│ │ └── Oh Those Palindromes.cpp
│ ├── Technocup 2019 Elimination Round 1/
│ │ ├── Explanation/
│ │ │ ├── In Search of An Easy Problem Explanation.txt
│ │ │ ├── Vasya and Cornfield.txt
│ │ │ ├── Vasya and Golden Ticket Explanation.txt
│ │ │ ├── Vasya and Good Sequences Explanation.txt
│ │ │ └── Vasya and Triangle Explanation.txt
│ │ └── Programs/
│ │ ├── In Search of An Easy Problem.cpp
│ │ ├── Vasya and Cornfield.cpp
│ │ ├── Vasya and Golden Ticket.cpp
│ │ ├── Vasya and Good Sequences.cpp
│ │ └── Vasya and Triangle.cpp
│ └── Technocup 2019 Elimination Round 2/
│ ├── Explanation/
│ │ ├── Curiosity Has No Limits.txt
│ │ └── Golden Plate.txt
│ └── Programs/
│ ├── Curiosity Has No Limits.cpp
│ └── Golden Plate.cpp
├── Explanations/
│ ├── Explanations - 1/
│ │ ├── Again Twenty Five - Explanation.txt
│ │ ├── Bear and Big Brother - Explanation.txt
│ │ ├── Beautiful Matrix - Explanation.txt
│ │ ├── Boy or Girl - Explanation.txt
│ │ ├── Complicated GCD - Explanation.txt
│ │ ├── Compote - Explanation.txt
│ │ ├── Dasha and Stairs - Explanation.txt
│ │ ├── Elephant - Explanation.txt
│ │ ├── Even Odds - Explanation.txt
│ │ ├── Fancy Fence - Explanation.txt
│ │ ├── Holiday of Equality - Explanation.txt
│ │ ├── I Love Username - Explanation.txt
│ │ ├── Ilya Bank Account - Explanation.txt
│ │ ├── Little Elephant and Rozdil - Explanation.txt
│ │ ├── Lucky Division - Explanation.txt
│ │ ├── Nearly Lucky Number - Explanation.txt
│ │ ├── Opponents - Explanation.txt
│ │ ├── Petr and a Calendar - Explanation.txt
│ │ ├── Shell Game - Explanation.txt
│ │ ├── Sherlock's New Girlfriend - Explanation.txt
│ │ ├── Taymr is Calling You - Explanation.txt
│ │ ├── The Wall - Explanation.txt
│ │ ├── Translation - Explanation.txt
│ │ ├── Vitya in the Countryside - Explanation.txt
│ │ └── Vladik and Flights - Explanation.txt
│ ├── Explanations - 10/
│ │ ├── A and B Compilation Errors Explanation.txt
│ │ ├── Amr and Music Explanation.txt
│ │ ├── Arrival of General Explanation.txt
│ │ ├── Bear and Game Explanation.txt
│ │ ├── Beautiful Year Explanation.txt
│ │ ├── Black Square Explanation.txt
│ │ ├── Counterexample Explanation.txt
│ │ ├── Difference Row.txt
│ │ ├── Eugene and Array Explanation.txt
│ │ ├── Interesting Drink Explanation.txt
│ │ ├── Keyboard Layouts Explanation.txt
│ │ ├── Life Without Zeroes Explanation.txt
│ │ ├── Modified GCD Explanation.txt
│ │ ├── Multi Judge Solving Explanation.txt
│ │ ├── Next Test Explanation.txt
│ │ ├── Presents Explanation.txt
│ │ ├── Serega and Coat Rack Explanation.txt
│ │ ├── Serega and Suffixes Explanation.txt
│ │ ├── Slightly Decreasing Permutation Explanation.txt
│ │ ├── Swap Sort Explanation.txt
│ │ ├── Taxi Explanation.txt
│ │ ├── Toy Cars Explanation.txt
│ │ ├── Unimodal Arrays Explanation.txt
│ │ ├── Valera and Plates Explanation.txt
│ │ └── Vanya and Cubes Explanation.txt
│ ├── Explanations - 11/
│ │ ├── BerSU Ball Explanation.txt
│ │ ├── Elections Explanation.txt
│ │ ├── Five in a Row Explanation.txt
│ │ ├── Football Explanation.txt
│ │ ├── Fortune Telling Explanation.txt
│ │ ├── Free Cash Alternate Solution Explanation.txt
│ │ ├── Free Cash Explanation.txt
│ │ ├── Games.txt
│ │ ├── Good Number Explanation.txt
│ │ ├── Johnny Likes Numbers Explanation.txt
│ │ ├── Lever Explanation.txt
│ │ ├── Lunch Rush Explanation.txt
│ │ ├── Magic Spheres Explanation.txt
│ │ ├── New Year and Hurry Explanation.txt
│ │ ├── Nicholas and Permutation Explanation.txt
│ │ ├── Petya and Staircases Explanation.txt
│ │ ├── Playing with Dice Explanation.txt
│ │ ├── Saitama Destroys Hotel Explanation.txt
│ │ ├── Sasha and Sticks Explanation.txt
│ │ ├── Soft Drinking Explanation.txt
│ │ ├── The Child and The Homework Explanation.txt
│ │ ├── The New Year Meeting Friends Alternate Solution.txt
│ │ ├── The New Year Meeting Friends Explanation.txt
│ │ ├── Word Explanation.txt
│ │ └── inc ARG Explanation.txt
│ ├── Explanations - 2/
│ │ ├── A and B Chess - Explanation.txt
│ │ ├── Anton and Danik - Explanation.txt
│ │ ├── Bachgold Problem - Explanation.txt
│ │ ├── Bit++ - Explanation.txt
│ │ ├── Buy a Shovel - Explanation.txt
│ │ ├── Chat Room - Explanation.txt
│ │ ├── Chips - Explanation.txt
│ │ ├── Cinema Line - Explanation.txt
│ │ ├── Domino Piling - Explanation.txt
│ │ ├── Drazil and Date - Explanation.txt
│ │ ├── George and Accomodation - Explanation.txt
│ │ ├── Gravity Flip - Explanation.txt
│ │ ├── Infinite Sequence - Explanation.txt
│ │ ├── Interview with Oleg - Explanation.txt
│ │ ├── Memory and Crow - Explanation.txt
│ │ ├── Pasha and Stick - Explanation.txt
│ │ ├── Pineapple Incident - Explanation.txt
│ │ ├── Serial Killer - Explanation.txt
│ │ ├── Soldier and Bananas - Explanation.txt
│ │ ├── Spider Man - Explanation.txt
│ │ ├── Stones on a Table - Explanation.txt
│ │ ├── Transform A to B - Explanation.txt
│ │ ├── Triangular Numbers - Explanation.txt
│ │ ├── Watermelon - Explanation.txt
│ │ └── Word Capitalisation - Explanation.txt
│ ├── Explanations - 3/
│ │ ├── Anton and Polyhedron - Explanation.txt
│ │ ├── Calculating Function - Explanation.txt
│ │ ├── Cheap Travel - Explanation.txt
│ │ ├── Checking the Calendar - Expanation.txt
│ │ ├── Currency System in Geraldion - Explanation.txt
│ │ ├── Die Roll - Explanation.txt
│ │ ├── Domino Effect - Explanation.txt
│ │ ├── Expression - Explanation.txt
│ │ ├── Fedya and Maths - Explanation.txt
│ │ ├── Filya and Homework - Explanation.txt
│ │ ├── Game - Explanation.txt
│ │ ├── Initial Bet - Explanation.txt
│ │ ├── LCM Challenge - Explanation.txt
│ │ ├── Maximum Increase - Explanation.txt
│ │ ├── Mishka and Game - Explanation.txt
│ │ ├── Multiplication Table - Explanation.txt
│ │ ├── Next Round - Explanation.txt
│ │ ├── Party - Explanation.txt
│ │ ├── Police Recruits - Explanation.txt
│ │ ├── Raising Bacteria - Explanation.txt
│ │ ├── Save Luke - Explanation.txt
│ │ ├── Taxes - Explanation.txt
│ │ ├── Tennis Tournament - Explanation.txt
│ │ ├── The Number of Positions - Explanation.txt
│ │ └── Theatre Square - Explanation.txt
│ ├── Explanations - 4/
│ │ ├── Aloyna Numbers - Explanation.txt
│ │ ├── Arpa's Hard Problem and Mehrad's Naive Cheat - Explanation.txt
│ │ ├── Benches - Explanation.txt
│ │ ├── Challenge Pendants - Explanation.txt
│ │ ├── Chewbecca and Number - Explanation.txt
│ │ ├── Chocolate - Explanation.txt
│ │ ├── Design Tutorial - Learn From Math - Explanation.txt
│ │ ├── Divisibility - Explanation.txt
│ │ ├── Fedor and New Game - Explanation.txt
│ │ ├── Game-Test - Explanation.txt
│ │ ├── Hexagons - Explanation.txt
│ │ ├── Hulk - Explanation.txt
│ │ ├── Indivisibility - Explanation.txt
│ │ ├── Interview - Explanation.txt
│ │ ├── King Moves - Explanation.txt
│ │ ├── Lineland Mail - Explanation.txt
│ │ ├── Lucky Numbers - Explanation.txt
│ │ ├── Poland Ball and Hypothesis - Explanation.txt
│ │ ├── Professor Gukiz's Robot - Explanation.txt
│ │ ├── Random Teams- Explanation.txt
│ │ ├── Reconnaissance 2 - Explanation.txt
│ │ ├── Selection of Personnel - Explanation.txt
│ │ ├── Tetrahedron - Explanation.txt
│ │ ├── Vasya and Petya's Game - Explanation.txt
│ │ └── Way Too Long Words - Explanation.txt
│ ├── Explanations - 5/
│ │ ├── Bear and Poker - Explanation.txt
│ │ ├── Boredom - Explanation.txt
│ │ ├── Cut Ribbon - Explanation.txt
│ │ ├── Display Size - Explanation.txt
│ │ ├── Duff in Love - Explanation.txt
│ │ ├── Flipping Game - Explanation.txt
│ │ ├── Flowers - Explanation.txt
│ │ ├── Fox and Dividing Cheese - Explanation.txt
│ │ ├── Hungry Sequence - Explanation.txt
│ │ ├── K Interesting Pair of Integers - Explanation.txt
│ │ ├── Kefa and First Step - Explanation.txt
│ │ ├── Making a String - Explanation.txt
│ │ ├── Non Square Equation - Explanation.txt
│ │ ├── Odd Sum - Explanation.txt
│ │ ├── Parking Lot - Explanation.txt
│ │ ├── Perfect Permutation - Explanation.txt
│ │ ├── Preparing for Olympiad - Explanation.txt
│ │ ├── Star - Explanation.txt
│ │ ├── Table Tennis Game 2 - Explanation.txt
│ │ ├── Tavas and Saddas - Explanation.txt
│ │ ├── Team - Explanation.txt
│ │ ├── Tetrahedron - Efficiently Explanation.txt
│ │ ├── Tricky Sum - Explanation.txt
│ │ ├── Vacations - Explanation.txt
│ │ └── Vanya and Table.txt
│ ├── Explanations - 6/
│ │ ├── A Shell Game - Explanation.txt
│ │ ├── Accounting - Explanation.txt
│ │ ├── Anton and Digits - Explanation.txt
│ │ ├── Black Square - Explanation.txt
│ │ ├── Dinner with Emma - Explanation.txt
│ │ ├── Ebony and Ivory - Explanation.txt
│ │ ├── Find Amir - Explanation.txt
│ │ ├── Game with Sticks - Explanation.txt
│ │ ├── Increasing Sequence - Explanation.txt
│ │ ├── Insomnia Cure - Explanation.txt
│ │ ├── Jumping Ball - Explanation.txt
│ │ ├── K Tree - Explanation.txt
│ │ ├── Lovely Palindromes - Explanation.txt
│ │ ├── Luxurious Buildings - Explanation.txt
│ │ ├── Meeting of Old Friends - Explanation.txt
│ │ ├── Oleg and Shares - Explanation.txt
│ │ ├── Patrick and Shopping - Explanation.txt
│ │ ├── Plate Game - Explanation.txt
│ │ ├── Rewards - Explanation.txt
│ │ ├── Round House - Explanation.txt
│ │ ├── System of Equations - Explanation.txt
│ │ ├── Vanya and Fence - Explanation.txt
│ │ ├── Vanya and Lanterns - Explanation.txt
│ │ ├── Vasya and Hipster - Explanation.txt
│ │ └── Wizard's Duel - Explanation.txt
│ ├── Explanations - 7/
│ │ ├── 3 - Palindrome - Explanation.txt
│ │ ├── Alena's Schedule - Explanation.txt
│ │ ├── Alice and Bob - Explanation.txt
│ │ ├── An Abandoned Sentiment From The Past - Explanation.txt
│ │ ├── Andrushya and Socks - Explanation.txt
│ │ ├── Combination Lock Explanation.txt
│ │ ├── Devu, the Singer and Churu, the Joker - Explanation.txt
│ │ ├── Fake NP - Explanation.txt
│ │ ├── Fence - Explanation.txt
│ │ ├── Find Marble - Explanation.txt
│ │ ├── Free Ice Cream Explanation.txt
│ │ ├── Hexadecimal's Theorem Alternate Solution Explanation.txt
│ │ ├── Hexadecimal's Theorem Explanation.txt
│ │ ├── IQ Test - Explanation.txt
│ │ ├── Magnets - Explanation.txt
│ │ ├── Mahmod and Longest Uncommon Subsequence - Explanation.txt
│ │ ├── Monster and Squirrel - Explanation.txt
│ │ ├── New Year Transportation Explanation.txt
│ │ ├── Optimal Point on a Line - Explanation.txt
│ │ ├── Pashmak and Flowers - Explanation.txt
│ │ ├── Potions Homework - Explanation.txt
│ │ ├── Pythagorean Triples Explanation.txt
│ │ ├── Red and Blue Balls - Explanation.txt
│ │ ├── The Contest - Explanation.txt
│ │ └── Young Physicist - Explanation.txt
│ ├── Explanations - 8/
│ │ ├── A and B Team Training Explanation.txt
│ │ ├── Almost Primes Explanation.txt
│ │ ├── Brian's Photos.txt
│ │ ├── Caisa and Pylons Explanation.txt
│ │ ├── Ceil and Flowers Explanation.txt
│ │ ├── Choosing Teams Explanation.txt
│ │ ├── Diverse Permutation Explanation.txt
│ │ ├── Golden Age Explanation.txt
│ │ ├── HQ9+ Explanation.txt
│ │ ├── Hexadecimal's Numbers Explanation.txt
│ │ ├── Jzzhu and Sequences Explanation.txt
│ │ ├── K Factorisation Explanation.txt
│ │ ├── Noldbach Problem Explanation.txt
│ │ ├── Oleysa and Rodion Explanation.txt
│ │ ├── Petr and Book Explanation.txt
│ │ ├── Petya and Strings Explanation.txt
│ │ ├── Sum of Digits Explanation.txt
│ │ ├── T Primes Alternate Solution Explanation.txt
│ │ ├── T Primes Explanation.txt
│ │ ├── Two Bags of Potatos - Explanation.txt
│ │ ├── Vanya and Cards Explanation.txt
│ │ ├── Vitaly and Night Explanation.txt
│ │ ├── Wet Shark and Odd and Even Explanation.txt
│ │ └── Yarslav and Permutations Explanation.txt
│ ├── Explanations - 9/
│ │ ├── Alyona and Copybooks Explanation.txt
│ │ ├── Appleman and Toastman Explanation.txt
│ │ ├── Array Explanation.txt
│ │ ├── Bear and Five Cards Explanation.txt
│ │ ├── Bus to Udayland Explanation.txt
│ │ ├── Case of the Zeroes and Ones Explanation.txt
│ │ ├── Circle Line Explanation.txt
│ │ ├── Crazy Computer Explanation.txt
│ │ ├── Crossword Solving Explanation.txt
│ │ ├── Divisibility Explanation.txt
│ │ ├── Fox and Number Game Explanation.txt
│ │ ├── Haiku Explanation.txt
│ │ ├── I'm Bored with Life Explanation.txt
│ │ ├── Is your Horseshow on the Other Hoof Explanation.txt
│ │ ├── K-th Divisor Explanation.txt
│ │ ├── Kitahara Haruki's Gift Explanation.txt
│ │ ├── Little Elephant and Function Explanation.txt
│ │ ├── Little Elephant and Problem Explanation.txt
│ │ ├── New Year and Days Explanation.txt
│ │ ├── One Dimensional Japanese Crossword Explanation.txt
│ │ ├── Present from Lena Explanation.txt
│ │ ├── Prime Matrix.txt
│ │ ├── String Task Explanation.txt
│ │ ├── Subtractions Explanation.txt
│ │ └── Toy Army Explanation.txt
│ ├── Explanations 12/
│ │ ├── Anastasia and Pebbles Explanation.txt
│ │ ├── Bear and Three Balls Explanation.txt
│ │ ├── Buggy Sorting Explanation.txt
│ │ ├── Co Prime Array Explanation.txt
│ │ ├── Dima and Friends Explanation.txt
│ │ ├── Dima and Sequence Explanation.txt
│ │ ├── Dreamoon and Stairs Alternate Solution Explanation.txt
│ │ ├── Dreamoon and Stairs Explanation.txt
│ │ ├── Fashion in Berland Explanation.txt
│ │ ├── Inbox (100500) Explanation.txt
│ │ ├── Key Races Explanation.txt
│ │ ├── Ksusha and Arrays Explanation.txt
│ │ ├── Lecture Explanation.txt
│ │ ├── Little Elephant and Chess Explanation.txt
│ │ ├── Little Girl and Maximum Sum.txt
│ │ ├── Minimum Difficulty Explanation.txt
│ │ ├── Pahsa and Pixels Explanation.txt
│ │ ├── Puzzles Explanation.txt
│ │ ├── Santa Claus and Candies Explanation.txt
│ │ ├── Sergey and Dima Explanation.txt
│ │ ├── Shaas and Oskols Explanation.txt
│ │ ├── Sleuth Explanation.txt
│ │ ├── The Festive Evening Explanation.txt
│ │ ├── The Number on the Board Explanation.txt
│ │ └── Watching a Movie Explanation.txt
│ ├── Explanations 13/
│ │ ├── A Good Contest Explanation.txt
│ │ ├── Arpa's Obvious Problem and Mehrad's Terrible Solution Explanation.txt
│ │ ├── Arrays Explanation.txt
│ │ ├── Arya and Bran Explanation.txt
│ │ ├── Bear and Elections Explanation.txt
│ │ ├── Business Trip.txt
│ │ ├── Cards Explanation.txt
│ │ ├── Code Obfuscation Explanation.txt
│ │ ├── Drinks Explanation.txt
│ │ ├── Epic Game Explanation.txt
│ │ ├── Functions Again Explanation.txt
│ │ ├── Generous Kefa Explanation.txt
│ │ ├── George and Job Explanation.txt
│ │ ├── Godsend Explanation.txt
│ │ ├── Ilya and Queries Explanation.txt
│ │ ├── Kuriyama Mirai's Stones Explanation.txt
│ │ ├── Lights Out Explanation.txt
│ │ ├── Little Dima and Equation Explanation.txt
│ │ ├── Little Elephant and Bits Explanation.txt
│ │ ├── New Skateboard Explanation.txt
│ │ ├── Oath of the Night's Watch Explanation.txt
│ │ ├── Sort the Array Explanation.txt
│ │ ├── Star Sky Explanation.txt
│ │ ├── Vanya and Books Explanation.txt
│ │ └── Vasya and Digital Root Explanation.txt
│ ├── Explanations 14/
│ │ ├── Asphalting Roads Explanation.txt
│ │ ├── Bicycle Chain Explanation.txt
│ │ ├── Borze Explanation.txt
│ │ ├── Building Permutation Explanation.txt
│ │ ├── Chess Tourney Explanation.txt
│ │ ├── Cormen - The Best Friend of Man Explanation.txt
│ │ ├── DZY Loves Sequences Explanation.txt
│ │ ├── Dragons Explanation.txt
│ │ ├── Drazil and Factorial Explanation.txt
│ │ ├── Football Explanation.txt
│ │ ├── Helpful Maths Explanation.txt
│ │ ├── Increase and Decrease Explanation.txt
│ │ ├── Jeff and Digits Explanation.txt
│ │ ├── Jzzhu and Children Explanation.txt
│ │ ├── Modulo Sum Explanation.txt
│ │ ├── Odds and Ends Explanation.txt
│ │ ├── Panoramix's Prediction Explanation.txt
│ │ ├── Permutation Explanation.txt
│ │ ├── Powers of Two.txt
│ │ ├── Queue at the School Explanation.txt
│ │ ├── Rectangles Explanation.txt
│ │ ├── Supercentral Point Explanation.txt
│ │ ├── Tram Explanation.txt
│ │ ├── Ultra Fast Mathematician.txt
│ │ └── Vasya and String Explanation.txt
│ ├── Explanations 15/
│ │ ├── Army Explanation.txt
│ │ ├── Between the Offices Explanation.txt
│ │ ├── Cableway Explanation.txt
│ │ ├── Ciferia Explanation.txt
│ │ ├── Coins Explanation.txt
│ │ ├── Divisibility by Eight Explanation.txt
│ │ ├── Exams Explanation.txt
│ │ ├── Given Length and Sum of Digits.txt
│ │ ├── Ilya and Sticks Explanation.txt
│ │ ├── Inna and Huge Candy Matrix Explanation.txt
│ │ ├── K-Multiple Free Set Explanation.txt
│ │ ├── Kefa and Park Explanation.txt
│ │ ├── Mahmoud and Ehab and the MEX Explanation.txt
│ │ ├── Mahmoud and Ehab and the bipartiteness Explanation.txt
│ │ ├── Mahmoud and Ehab and the xor Explanation.txt
│ │ ├── Number of Ways Explanation.txt
│ │ ├── Pearls in a Row Explanation.txt
│ │ ├── Pie Rules Explanation.txt
│ │ ├── Quasi-palindrome Explanation.txt
│ │ ├── Soldier and Number Game Explanation.txt
│ │ ├── Tanya and Toys Explanation.txt
│ │ ├── Team Explanation.txt
│ │ ├── The Eternal Immortality Explanation.txt
│ │ ├── Triangle Explanation.txt
│ │ └── USB Flash Drives Explanation.txt
│ ├── Explanations 16/
│ │ ├── Amusing Joke Explanation.txt
│ │ ├── Anton and Letters Explanation.txt
│ │ ├── Cards with Numbers Explanation.txt
│ │ ├── Classroom Watch Explanation.txt
│ │ ├── Cupboards Explanation.txt
│ │ ├── Dishonest Sellers Explanation.txt
│ │ ├── Dubstep Explanation.txt
│ │ ├── Easy Number Challenge Explanation.txt
│ │ ├── Fox and Snake Explanation.txt
│ │ ├── Greg and Array Explanation.txt
│ │ ├── Hacking Cypher Explanation.txt
│ │ ├── I Wanna Be The Guy Explanation.txt
│ │ ├── IQ Test Explanation.txt
│ │ ├── Jeff and Periods Explanation.txt
│ │ ├── Pashmak and Garden Explanation.txt
│ │ ├── Primes or Palindromes Explanation.txt
│ │ ├── Quasi Binary Explanation.txt
│ │ ├── Sereja and Bottles Explanation.txt
│ │ ├── Team Olympiad Explanation.txt
│ │ ├── The Fibonacci Segment Explanation.txt
│ │ ├── Twins Explanation.txt
│ │ ├── Valera and Tubes Explanation.txt
│ │ ├── Xenia and Bit Operations.txt
│ │ ├── Xenia and Ringroad Explanation.txt
│ │ └── k-String Explanation.txt
│ ├── Explanations 17/
│ │ ├── Adding Digits Explanation.txt
│ │ ├── Christmas Spruce Explanation.txt
│ │ ├── Dreamoon and Wi-Fi Explanation.txt
│ │ ├── Exams Explanation.txt
│ │ ├── Garden Explanation.txt
│ │ ├── Jamie and Alarm Snooze Explanation.txt
│ │ ├── Jamie and Interesting Graph Explanation.txt
│ │ ├── Kolya and Tanya Explanation.txt
│ │ ├── Mashmokh and ACM Explanation.txt
│ │ ├── Maxmium Splitting Explanation.txt
│ │ ├── Minimum Sum Explanation.txt
│ │ ├── Modular Exponentiation Explanation.txt
│ │ ├── New Year and Domino Explanation.txt
│ │ ├── New Year's Eve Explanation.txt
│ │ ├── Palindrome Pairs Explanation.txt
│ │ ├── Perfect Number Explanation.txt
│ │ ├── QAQ Explanation.txt
│ │ ├── Seat Arrangements Explanation.txt
│ │ ├── Supermarket Explanation.txt
│ │ ├── Swap Adjacent Elements Explanation.txt
│ │ ├── Tea Queue Explanation.txt
│ │ ├── Testing Pants for Sadness Explanation.txt
│ │ ├── The World is a Theatre Explanation.txt
│ │ ├── Tricky Alchemy Explanation.txt
│ │ └── Water the Gardens Explanation.txt
│ ├── Explanations 18/
│ │ ├── Art Union Explanation.txt
│ │ ├── Bear and Colours Explanation.txt
│ │ ├── Cave Painting Explanation.txt
│ │ ├── Cloning Toys Explanation.txt
│ │ ├── Eternal Victory Explanation.txt
│ │ ├── Hard Problem Explanation.txt
│ │ ├── Joystick Explanation.txt
│ │ ├── K-Special Tables Explanation.txt
│ │ ├── Lucky Sum Explanation.txt
│ │ ├── Magic Forest Explanation.txt
│ │ ├── Marvolo Gaunt's Ring Alternate Solution Explanation.txt
│ │ ├── Marvolo Gaunt's Ring Explanation.txt
│ │ ├── Not Equal on a Segment Explanation.txt
│ │ ├── Perfect Squares Explanation.txt
│ │ ├── Petya and Inequiations Explanation.txt
│ │ ├── Polo the Penguin and Matrix Explanation.txt
│ │ ├── Polo the Penguin and Strings Explanation.txt
│ │ ├── Replacement Explanation.txt
│ │ ├── Robot Vaccuum Cleaner Explanation.txt
│ │ ├── Rumour Explanation.txt
│ │ ├── Search for Pretty Integers Explanation.txt
│ │ ├── Tom Riddle's Diary Explanation.txt
│ │ ├── Two Substrings Explanation.txt
│ │ ├── Vladik and Fractions Explanation.txt
│ │ └── Woodcutter.txt
│ ├── Explanations 19/
│ │ ├── A Compatipble Pair Explanation.txt
│ │ ├── A Prosperous Lot Explanation.txt
│ │ ├── Almost Identity Permutations Explanation.txt
│ │ ├── Amr and Large Array Explanation.txt
│ │ ├── Beautiful Sets of Points Explanation.txt
│ │ ├── Buggy Robot Explanation.txt
│ │ ├── Cellular Network Explanation.txt
│ │ ├── Coder Explanation.txt
│ │ ├── Diversity Explanation.txt
│ │ ├── Hamster Farm Explanation.txt
│ │ ├── K-Dominant Character Explanation.txt
│ │ ├── Little Artem and Grasshopper Explanation.txt
│ │ ├── Longest K Good Segment Explanation.txt
│ │ ├── Love Triangle Explanation.txt
│ │ ├── Nuts Explanation.txt
│ │ ├── Palindrome Transformation Explanation.txt
│ │ ├── Palindromic Supersequence Explanation.txt
│ │ ├── Recursive Queries Explanation.txt
│ │ ├── Run For Your Prize Explanation.txt
│ │ ├── Simple Strings Explanation.txt
│ │ ├── The Useless Toy Explanation.txt
│ │ ├── Vasya and Socks Explanation.txt
│ │ ├── Watchmen Explanation.txt
│ │ └── Word Correction Explanation.txt
│ ├── Explanations 20/
│ │ ├── Alena and the Heater Explanation.txt
│ │ ├── Fafa and Ancient Alphabet Explanation.txt
│ │ ├── Fafa and His Company Explanation.txt
│ │ ├── Fafa and the Gates Explanation.txt
│ │ ├── Fixing Typos Explanation.txt
│ │ ├── Gargari and Bishops Explanation.txt
│ │ ├── Gargari and Permutations Alternate Solution Explanation.txt
│ │ ├── Gargari and Permutations Explanation.txt
│ │ ├── Hard Process Explanation.txt
│ │ ├── Lisa and Dima Explanation.txt
│ │ ├── Love Rescue Explanation.txt
│ │ ├── Mashmok and Numbers Explanation.txt
│ │ ├── Non-Secret Cypher Explanation.txt
│ │ ├── Olympiad Explanation.txt
│ │ ├── Partition Explanation.txt
│ │ ├── Petya and His Friends Alternate Solution Explanation.txt
│ │ ├── Petya and His Friends Explanation.txt
│ │ ├── Phone Numbers Explanation.txt
│ │ ├── Pocket Book Explanation.txt
│ │ ├── Points on the Line Explanation.txt
│ │ ├── Protect Sheep Explanation.txt
│ │ ├── String Transformation Explanation.txt
│ │ ├── Sum and Replace Explanation.txt
│ │ ├── Vile Grasshoppers Explanation.txt
│ │ └── Weird Subtraction Process Explanation.txt
│ ├── Explanations 21/
│ │ ├── Aramic Script Bitmask Solution.txt
│ │ ├── Aramic Script Explanation.txt
│ │ ├── Arithmetic Progression Explanation.txt
│ │ ├── Bash and a Tough Math Puzzle Explanation.txt
│ │ ├── Consecutive Subsequences Explanation.txt
│ │ ├── Cyclic Components Explanation.txt
│ │ ├── Divide by Three Multiply by Two Alternate Solution Explanation.txt
│ │ ├── Divide by Three, Multiply by Two Explanation.txt
│ │ ├── Dreamoon and Sets Explanation.txt
│ │ ├── File Name Explanation.txt
│ │ ├── Fox and Box Accumulation Explanation.txt
│ │ ├── Ghosts Explanation.txt
│ │ ├── Less or Equal Explanation.txt
│ │ ├── Little Girl and Maximum XOR Explanation.txt
│ │ ├── Lucky Sum of Digits Explanation.txt
│ │ ├── Mahmoud and Ehab and Another Array Construction Test Explanation.txt
│ │ ├── Mahmoud and Ehab and Even Odd Game Explanation.txt
│ │ ├── Mahmoud and a Triangle Explanation.txt
│ │ ├── Make a Square Alternate Solution Explanation.txt
│ │ ├── Make a Square Explanation.txt
│ │ ├── Mancala Explanation.txt
│ │ ├── Pairs of Lines Explanation.txt
│ │ ├── Two Gram Explanation.txt
│ │ ├── Valhalla Siege Explanation.txt
│ │ └── Wrong Subtraction Explanation.txt
│ ├── Explanations 22/
│ │ ├── AND Graph Explanation.txt
│ │ ├── Almost Arithmetic Progression Explanation.txt
│ │ ├── Antipalindrome Alternate Solution Explanation.txt
│ │ ├── Antipalindrome Explanation.txt
│ │ ├── Ball Explanation.txt
│ │ ├── Bits Explanation.txt
│ │ ├── Bookshelves Explanation.txt
│ │ ├── Businessman Problems Explanation.txt
│ │ ├── Chess Placing Explanation.txt
│ │ ├── Correct Solution Explanation.txt
│ │ ├── Couting Kangaroos is Fun Explanation.txt
│ │ ├── Fruits Explanation.txt
│ │ ├── High Schooll Become Human Explanation.txt
│ │ ├── Infinity Gauntlet Explanation.txt
│ │ ├── Knights of a Polygonal Table Explanation.txt
│ │ ├── Letters Explanation.txt
│ │ ├── Local Extrema Explanation.txt
│ │ ├── Remove Duplicates Explanation.txt
│ │ ├── Super Agent Explanation.txt
│ │ ├── Switches and Lamps Explanation.txt
│ │ ├── Three Displays Explanation.txt
│ │ ├── Three Displays Segment Tree Solution Explanation.txt
│ │ ├── Tufurama Explanation.txt
│ │ └── Useful Decomposition Explanation.txt
│ ├── Explanations 23/
│ │ ├── An Impassioned Circulation of Affection Explanation.txt
│ │ ├── Another Problem on Strings Explanation.txt
│ │ ├── Babaei and Birthday Cake Explanation.txt
│ │ ├── Bear and Prime Numbers Explanation.txt
│ │ ├── Cirriculum Vitae Explanation.txt
│ │ ├── Classy Numbers Explanation.txt
│ │ ├── Counting Arrays Explanation.txt
│ │ ├── Crazy Town Explanation.txt
│ │ ├── Find Maximum Explanation.txt
│ │ ├── Fish Explanation.txt
│ │ ├── Garbage Disposal Explanation.txt
│ │ ├── Guest from the Past Explanation.txt
│ │ ├── Ice Skater Explanation.txt
│ │ ├── Lazyland Explanation.txt
│ │ ├── Lesha and Array Splitting Explanation.txt
│ │ ├── Lost Array Explanation.txt
│ │ ├── Maze Explanation.txt
│ │ ├── Minesweeper Explanation.txt
│ │ ├── Minimum Diameter Tree Explanation.txt
│ │ ├── No To Palindromes Explanation.txt
│ │ ├── On Number of Decompositions into Multipliers Explanation.txt
│ │ ├── Summarise to Powers of Two Explanation.txt
│ │ ├── The Fair Nut and String Explanation.txt
│ │ └── The Meaningless Game Explanation.txt
│ └── Explanations 24/
│ ├── Brutality Explanation.txt
│ ├── Connect Explanation.txt
│ ├── Div Times Mod Explanation.txt
│ ├── Diverse Garland Explanation.txt
│ ├── Division and Union Explanation.txt
│ ├── Finite or Not Explanation.txt
│ ├── Ilya and Escalator Explanation.txt
│ ├── Increasing by Modulo Explanation.txt
│ ├── Nice Garland Explanation.txt
│ ├── Planning the Expedition Explanation.txt
│ ├── Playing Piano Explanation.txt
│ ├── Posterized Explanation.txt
│ ├── Powers of Two Explanation.txt
│ ├── Splitting into Digits Explanation.txt
│ ├── Stages Explanation.txt
│ ├── Tanya and Candies Explanation.txt
│ ├── The Way to Home Explanation.txt
│ ├── Vanya and Label Explanation.txt
│ ├── Where Do I Turn Explanation.txt
│ └── Zero Quantity Maximisation Explanation.txt
└── README.md
================================================
FILE CONTENTS
================================================
================================================
FILE: 2020/Combined Divisions/621 Div 1 + 2/Explanations/Cow and Fields Explanation.txt
================================================
Let S[i] denote the distance of vertex i from source
Let T[i] denote the distance of vertex i from the target
We can determine both with a BFS.
-----
void bfs(int source, vector <int> &distance)
{
queue <int> Q;
Q.push(source);
distance[source] = 0;
while(!Q.empty())
{
int v = Q.front();
Q.pop();
for(int i = 0; i < graph[v].size(); i++)
{
int child = graph[v][i];
if(distance[child] >= oo)
{
distance[child] = distance[v] + 1;
Q.push(child);
}
}
}
}
-----
When we draw an edge between (x, y) the distance between (1, n) becomes
S[x] + 1 + T[y]
We will draw an edge so as to maximise this distance since we want to maximise the length of the shortest path.
Ultimately the shortest path will not be more than S[n]
Note that we can never increase the length of the shortest path.
So we will choose the edge which maximises the length (S[x] + 1 + T[y])
We can sort the vertices according to S[x] - T[x]
Since (S[x] + T[y] < S[y] + T[x]). As we visit the vertices in order, for every i, we will take the prefix maximum of T[i]
-----
int main()
{
int no_of_vertices, no_of_edges, no_of_special_vertices;
cin >> no_of_vertices >> no_of_edges >> no_of_special_vertices;
vector <int> special_vertices(no_of_special_vertices);
for(int i = 0; i < no_of_special_vertices; i++)
{
cin >> special_vertices[i];
}
for(int i = 1; i <= no_of_edges; i++)
{
int u, v;
cin >> u >> v;
graph[u].push_back(v);
graph[v].push_back(u);
}
vector <int> distance_1(no_of_vertices + 1, oo);
bfs(1, distance_1);
vector <int> distance_n(no_of_vertices + 1, oo);
bfs(no_of_vertices, distance_n);
sort(special_vertices.begin(), special_vertices.end(), [&] (int a, int b)
{
return (distance_1[a] - distance_n[a] < distance_1[b] - distance_n[b]);
});
int maximum_distance = 0;
int furthest_1 = distance_1[special_vertices[0]];
for(int i = 1; i < no_of_special_vertices; i++)
{
maximum_distance = max(maximum_distance,
furthest_1 + distance_n[special_vertices[i]] + 1);
furthest_1 = max(furthest_1, distance_1[special_vertices[i]]);
}
maximum_distance = min(maximum_distance, distance_n[1]);
cout << maximum_distance << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/621 Div 1 + 2/Explanations/Cow and Friend Explanation.txt
================================================
First of all, if x exists in the original array, then the answer is 1.
If there is at least one element A[i] such that is 2A[i]>= x,
then we can reach in 2 moves by making a triangle.
If even the greatest element x 2 < x, then we will keep on making linear steps
of length A[i] till x is within A[i]'s range.
Then if x = A[i], we will take a linear step.
Otherwise, we will make a triangle.
It is important to check if x [0, 2A[i]] as 2A[i] is the furthest we can get using A[i]
-----
void solve()
{
int no_of_elements;
long long distance;
cin >> no_of_elements >> distance;
vector <long long> A(no_of_elements);
for(int i = 0; i < no_of_elements; i++)
{
cin >> A[i];
}
sort(all(A));
if(binary_search(all(A), distance))
{
cout << "1\n";
return;
}
for(int i = 0; i < no_of_elements; i++)
{
if(A[i] + A[i] >= distance)
{
cout << "2\n";
return;
}
}
long long steps = distance/A[no_of_elements - 1] + (distance%A[no_of_elements - 1] != 0);
cout << steps << "\n";
}
================================================
FILE: 2020/Combined Divisions/621 Div 1 + 2/Explanations/Cow and Haybales Explanation.txt
================================================
We can simulate the process.
One by one, we will carry the i-th element over to A[2] and then transfer it to A[1]
-----
void solve()
{
int no_of_elements, no_of_days;
cin >> no_of_elements >> no_of_days;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
cin >> A[i];
for(int i = 2; i <= no_of_elements && no_of_days > 0; i++)
{
while(A[i] > 0 && no_of_days >= (i - 1))
{
A[i]--;
A[1]++;
no_of_days -= (i - 1);
}
}
cout << A[1] << "\n";
}
================================================
FILE: 2020/Combined Divisions/621 Div 1 + 2/Explanations/Cow and Message Explanation.txt
================================================
Observation - The number of good strings will be equal to the number of pairs
and single letters.
Proof -
It is clear that every single letter is good.
Every good string of length > 1, has 2 letters at the beginning
So, there is a bijection in between the starting pair of any good string and the rest of the string.
Why cannot the same argument be used to reduce 2 -> 1 ?
It is because of the property of arithmetic series.
The difference has to form an arithmetic progression so the first pair uniquely determine the rest of the string.
Whereas, when we look at pairs, they do not correspond to single digits because a single digit by itself
does not have any series and can be added to any digit through the entire array.
-----
int main()
{
string S;
cin >> S;
const int NO_OF_ALPHABETS = 26;
vector <long long> frequency(NO_OF_ALPHABETS, 0);
map <string, long long> pair_frequency;
for(int i = S.size() - 1; i >= 0; i--)
{
for(int alpha = 0; alpha < NO_OF_ALPHABETS; alpha++)
{
char second_letter = (char)('a' + alpha);
string current_pair;
current_pair += S[i];
current_pair += second_letter;
pair_frequency[current_pair] += frequency[alpha];
}
frequency[S[i] - 'a']++;
}
long long answer = 0;
for(auto it = pair_frequency.begin(); it != pair_frequency.end(); it++)
{
answer = max(answer, it->second);
}
for(int alpha = 0; alpha < NO_OF_ALPHABETS; alpha++)
{
answer = max(answer, frequency[alpha]);
}
cout << answer << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/621 Div 1 + 2/Explanations/Cows and Treats Explanation.txt
================================================
1. At most 2 cows can come and at most 1 from each side, one from the left, one from the right.
2. Suppose I know that cows {1, 3, 5} are there in the left set.
They can only be placed in 1 combination and cannot be changed. Because once one of the cows come, they will block the other cows.
3. We need to iterate over all possibilities. We can do this by iterating on the grass where the left border ends. This will enable us to do the counting. We will see for each sweetness, the possible endings of cows of that sweetness both on the left and right side
-----
We will count the number of cows that can go inside the left border.
Let it be L
We will count the number of cows that can go inside the right border.
Let it be R.
Then the number of pairs will be L*R - min(L, R)
The reason is that the same cow cannot go both on the left and on the right.
So, whichever is minimum among (L, R), those are cows which go on both sides and they can only go in one.
-----
int main()
{
int no_of_grass, no_of_cows;
cin >> no_of_grass >> no_of_cows;
vector <int> sweetness(no_of_grass + 1);
for(int i = 1; i <= no_of_grass; i++)
{
cin >> sweetness[i];
}
vector <vector <int> > cows(no_of_grass + 1);
for(int i = 1; i <= no_of_cows; i++)
{
int sweet, hunger;
cin >> sweet >> hunger;
cows[sweet].push_back(hunger);
}
for(int i = 1; i <= no_of_grass; i++)
{
sort(cows[i].begin(), cows[i].end());
}
const int MOD = 1e9 + 7;
int happy_cows = 0;
long long no_of_ways = 1;
for(int cut = 0; cut <= no_of_grass; cut++)
{
vector <int> left(no_of_grass + 1, 0);
vector <int> right(no_of_grass + 1, 0);
for(int i = 1; i <= cut; i++)
{
left[sweetness[i]]++;
}
for(int i = cut + 1; i <= no_of_grass; i++)
{
right[sweetness[i]]++;
}
int left_ending = (cut == 0 ? -1 : sweetness[cut]);
int happy_cows_here = 0;
long long no_of_ways_here = 1;
for(int i = 1; i <= no_of_grass; i++)
{
if(i == left_ending)
{
if(binary_search(cows[i].begin(), cows[i].end(), left[i]))
{
happy_cows_here++;
}
else
{
happy_cows_here = 0;
break;
}
int right_choices = 0;
for(int j = 0; j < cows[i].size(); j++)
{
if(cows[i][j] != left[i] && cows[i][j] <= right[i])
{
right_choices++;
}
}
if(right_choices >= 1)
{
happy_cows_here++;
no_of_ways_here *= right_choices;
}
}
else
{
int left_choices = 0, right_choices = 0;
for(int j = 0; j < cows[i].size(); j++)
{
if(cows[i][j] <= left[i])
{
left_choices++;
}
if(cows[i][j] <= right[i])
{
right_choices++;
}
}
int no_of_pairs = (left_choices*right_choices) - min(left_choices, right_choices);
if(no_of_pairs > 0)
{
happy_cows_here += 2;
no_of_ways_here *= no_of_pairs;
}
else if(left_choices > 0 || right_choices > 0)
{
happy_cows_here++;
no_of_ways_here *= (left_choices + right_choices);
}
}
no_of_ways_here %= MOD;
}
if(happy_cows_here > happy_cows)
{
happy_cows = happy_cows_here;
no_of_ways = no_of_ways_here;
}
else if(happy_cows_here == happy_cows && happy_cows_here > 0)
{
no_of_ways += no_of_ways_here;
no_of_ways %= MOD;
}
}
cout << happy_cows << " " << no_of_ways << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/621 Div 1 + 2/Programs/Cow and Fields.cpp
================================================
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
const int MAX_N = 5e5 + 5, oo = 1e9 + 9;
vector <int> graph[MAX_N];
void bfs(int source, vector <int> &distance)
{
queue <int> Q;
Q.push(source);
distance[source] = 0;
while(!Q.empty())
{
int v = Q.front();
Q.pop();
for(int i = 0; i < graph[v].size(); i++)
{
int child = graph[v][i];
if(distance[child] >= oo)
{
distance[child] = distance[v] + 1;
Q.push(child);
//cout << "Child = " << child << " Distance = " << distance[child] << "\n";
}
}
}
}
int main()
{
int no_of_vertices, no_of_edges, no_of_special_vertices;
cin >> no_of_vertices >> no_of_edges >> no_of_special_vertices;
vector <int> special_vertices(no_of_special_vertices);
for(int i = 0; i < no_of_special_vertices; i++)
{
cin >> special_vertices[i];
}
for(int i = 1; i <= no_of_edges; i++)
{
int u, v;
cin >> u >> v;
graph[u].push_back(v);
graph[v].push_back(u);
}
vector <int> distance_1(no_of_vertices + 1, oo);
bfs(1, distance_1);
vector <int> distance_n(no_of_vertices + 1, oo);
bfs(no_of_vertices, distance_n);
sort(special_vertices.begin(), special_vertices.end(), [&] (int a, int b)
{
return (distance_1[a] - distance_n[a] < distance_1[b] - distance_n[b]);
});
int maximum_distance = 0;
int furthest_1 = distance_1[special_vertices[0]];
for(int i = 1; i < no_of_special_vertices; i++)
{
maximum_distance = max(maximum_distance,
furthest_1 + distance_n[special_vertices[i]] + 1);
//cout << special_vertices[i] << "\n";
//cout << "Distance n = " << distance_n[special_vertices[i]] << " Furthest 1 = " << furthest_1 << "\n";
//cout << "Maximum Distance = " << maximum_distance << "\n";
furthest_1 = max(furthest_1, distance_1[special_vertices[i]]);
}
maximum_distance = min(maximum_distance, distance_n[1]);
cout << maximum_distance << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/621 Div 1 + 2/Programs/Cow and Haybales.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
void solve()
{
int no_of_elements, no_of_days;
cin >> no_of_elements >> no_of_days;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
cin >> A[i];
for(int i = 2; i <= no_of_elements && no_of_days > 0; i++)
{
while(A[i] > 0 && no_of_days >= (i - 1))
{
A[i]--;
A[1]++;
no_of_days -= (i - 1);
}
}
cout << A[1] << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Combined Divisions/621 Div 1 + 2/Programs/Cow and Message.cpp
================================================
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main()
{
string S;
cin >> S;
const int NO_OF_ALPHABETS = 26;
vector <long long> frequency(NO_OF_ALPHABETS, 0);
map <string, long long> pair_frequency;
for(int i = S.size() - 1; i >= 0; i--)
{
for(int alpha = 0; alpha < NO_OF_ALPHABETS; alpha++)
{
char second_letter = (char)('a' + alpha);
string current_pair;
current_pair += S[i];
current_pair += second_letter;
pair_frequency[current_pair] += frequency[alpha];
//cout << "Pair = " << current_pair << " Second Frequency = " << frequency[alpha] << "\n";
}
frequency[S[i] - 'a']++;
}
long long answer = 0;
for(auto it = pair_frequency.begin(); it != pair_frequency.end(); it++)
{
answer = max(answer, it->second);
}
for(int alpha = 0; alpha < NO_OF_ALPHABETS; alpha++)
{
answer = max(answer, frequency[alpha]);
}
cout << answer << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/621 Div 1 + 2/Programs/Cows and Treats.cpp
================================================
#include <iostream>
#include <vector>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
int main()
{
int no_of_grass, no_of_cows;
cin >> no_of_grass >> no_of_cows;
vector <int> sweetness(no_of_grass + 1);
for(int i = 1; i <= no_of_grass; i++)
{
cin >> sweetness[i];
}
vector <vector <int> > cows(no_of_grass + 1);
for(int i = 1; i <= no_of_cows; i++)
{
int sweet, hunger;
cin >> sweet >> hunger;
cows[sweet].push_back(hunger);
}
for(int i = 1; i <= no_of_grass; i++)
{
sort(cows[i].begin(), cows[i].end());
}
const int MOD = 1e9 + 7;
int happy_cows = 0;
long long no_of_ways = 1;
for(int cut = 0; cut <= no_of_grass; cut++)
{
vector <int> left(no_of_grass + 1, 0);
vector <int> right(no_of_grass + 1, 0);
for(int i = 1; i <= cut; i++)
{
left[sweetness[i]]++;
}
for(int i = cut + 1; i <= no_of_grass; i++)
{
right[sweetness[i]]++;
}
int left_ending = (cut == 0 ? -1 : sweetness[cut]);
int happy_cows_here = 0;
long long no_of_ways_here = 1;
for(int i = 1; i <= no_of_grass; i++)
{
if(i == left_ending)
{
if(binary_search(cows[i].begin(), cows[i].end(), left[i]))
{
happy_cows_here++;
}
else
{
happy_cows_here = 0;
break;
}
int right_choices = 0;
for(int j = 0; j < cows[i].size(); j++)
{
if(cows[i][j] != left[i] && cows[i][j] <= right[i])
{
right_choices++;
}
}
if(right_choices >= 1)
{ //cout << "Left = " << left[i] << "\n";
//cout << "Right Choices = " << right_choices << "\n";
happy_cows_here++;
no_of_ways_here *= right_choices;
}
}
else
{
int left_choices = 0, right_choices = 0;
for(int j = 0; j < cows[i].size(); j++)
{
if(cows[i][j] <= left[i])
{
left_choices++;
}
if(cows[i][j] <= right[i])
{
right_choices++;
}
}
//cout << "Sweetness = " << i << " L = " << left_choices << " R = " << right_choices << "\n";
int no_of_pairs = (left_choices*right_choices) - min(left_choices, right_choices);
if(no_of_pairs > 0)
{
happy_cows_here += 2;
no_of_ways_here *= no_of_pairs;
}
else if(left_choices > 0 || right_choices > 0)
{
happy_cows_here++;
no_of_ways_here *= (left_choices + right_choices);
//cout << "Reached and No of Ways = " << no_of_ways_here << "\n";
}
}
no_of_ways_here %= MOD;
}
if(happy_cows_here > happy_cows)
{
happy_cows = happy_cows_here;
no_of_ways = no_of_ways_here;
}
else if(happy_cows_here == happy_cows && happy_cows_here > 0)
{
no_of_ways += no_of_ways_here;
no_of_ways %= MOD;
}
//cout << "Cut = " << cut << " Maximum = " << happy_cows << " No of ways = " << no_of_ways << "\n";
}
cout << happy_cows << " " << no_of_ways << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/CodeForces Global Round 7/Explanations/Bad Ugly Numbers Explanation.txt
================================================
Let us think of the divisibility rules of each number.
A number is divisible by 5 only if the last digit if 5 or 0
So, we can make every digit except the last = 5
What do we put as the last digit ?
We will put 4, as a number is divisible by 4 if it's last 2 digits are a multiple of 4
and 54 is not a multiple of 4
-----
Another solution is that we can have a string of (n - 1) 3s and 1 2.
Just avoid putting 2 in the last position
This way the integer will not be even and the sum of digits = 2 (mod 3) so it will
not be a multiple of 3
-----
void solve()
{
int n;
cin >> n;
if(n == 1)
{
cout << "-1\n";
return;
}
for(int i = 1; i <= n - 1; i++)
{
cout << "5";
}
cout << "4\n";
}
================================================
FILE: 2020/Combined Divisions/CodeForces Global Round 7/Explanations/Maximums Explanation.txt
================================================
We will just simulate the process.
We will keep track of the maximum element in B[1, ... , i]
A[i] = B[i] + prefix_max[i]
-----
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> B(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> B[i];
}
vector <int> A(no_of_elements + 1);
vector <int> prefix_max(no_of_elements + 5, 0);
for(int i = 1; i <= no_of_elements; i++)
{
A[i] = B[i] + prefix_max[i];
prefix_max[i + 1] = max(prefix_max[i], A[i]);
}
for(int i = 1; i <= no_of_elements; i++)
{
cout << A[i] << " ";
}
cout << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/CodeForces Global Round 7/Explanations/Permutation Partitions Explanation.txt
================================================
Ultimately, the K greatest integers will be the best sum
It is always possible to make segments in such a way the K greatest integers are chosen.
Let us re-write the array and put a 1 if A[i] is one of the K greatest integers and a 0
otherwise
Suppose we have
1 0 0 0 1
Now, here are the possible divisions
1 | 0 0 0 1
1 0 | 0 0 1
1 0 0 | 0 1
1 0 0 0 | 1
All of these divisions satisfy the condition
-----
We will keep track of all the indices of the k greatest integers.
Suppose the consecutive indices are I[i] and I[i + 1], then the i-th barrier has
I[i] - I[i - 1] ways and the first barrier is at A[1] and the last barrier is at A[n]
We will simply multiply the number of ways to place the other (K - 1) barriers
-----
#include <iostream>
#include <vector>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
long long get_sum(long long n)
{
return (n*(n + 1))/2;
}
int main()
{
int no_of_elements, no_of_parts;
cin >> no_of_elements >> no_of_parts;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
vector <long long> indices;
for(int i = 1; i <= no_of_elements; i++)
{
if(A[i] > no_of_elements - no_of_parts)
{
indices.push_back(i);
}
}
sort(all(indices));
long long best_sum = get_sum(no_of_elements) - get_sum(no_of_elements - no_of_parts);
long long no_of_ways = 1;
const long long MOD = 998244353;
for(int i = 1; i < no_of_parts; i++)
{
no_of_ways *= (indices[i] - indices[i - 1]);
no_of_ways %= MOD;
}
cout << best_sum << " " << no_of_ways << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/CodeForces Global Round 7/Explanations/Prefix Suffix Palindrome (Easy Version) Explanation.txt
================================================
The optimal string consists of
1. Some set of matching prefix and suffix of the string
2. And then some palindrome that is either completely in the prefix or completely in the suffix.
-----
First, we will find out the maximum matching part of the prefix and the suffix.
Then, we will calculate the longest palindrome in both the prefix and the suffix using a DP
-----
pair <int, int> get_prefix_suffix(string S)
{
for(int length = 1; length <= S.size(); length++)
{
for(int left = 0, right = left + length - 1; right < S.size(); left++, right++)
{
max_palindrome_in[left][right] = 0;
if(length == 1)
{
max_palindrome_in[left][right] = 1;
continue;
}
if(length == 2)
{
max_palindrome_in[left][right] = (S[left] == S[right] ? 2 : 0);
continue;
}
if(S[left] == S[right] && max_palindrome_in[left + 1][right - 1] != 0)
{
max_palindrome_in[left][right] = 2 + max_palindrome_in[left + 1][right - 1];
}
}
}
int best_prefix = 0;
for(int i = 0; i < S.size(); i++)
{
best_prefix = max(best_prefix, max_palindrome_in[0][i]);
}
int best_suffix = 0;
for(int i = S.size() - 1; i >= 0; i--)
{
best_suffix = max(best_suffix, max_palindrome_in[i][S.size() - 1]);
}
return make_pair(best_prefix, best_suffix);
}
void solve()
{
string S;
cin >> S;
int matching_part = 0, prefix_palindrome = 0, suffix_palindrome = 0;
for(int i = 0, j = S.size() - 1; i < j; i++, j--)
{
if(S[i] == S[j])
{
matching_part++;
}
else
{
break;
}
}
string remaining_S;
for(int i = matching_part; i < S.size() - matching_part; i++)
{
remaining_S += S[i];
}
//cout << "Remaining = " << remaining_S << "\n";
pair <int, int> prefix_suffix = get_prefix_suffix(remaining_S);
prefix_palindrome = prefix_suffix.first;
suffix_palindrome = prefix_suffix.second;
if(prefix_palindrome > suffix_palindrome)
{
suffix_palindrome = 0;
}
else
{
prefix_palindrome = 0;
}
string answer;
for(int i = 0; i < matching_part; i++)
{
answer += S[i];
}
for(int i = 0; i < prefix_palindrome; i++)
{
answer += remaining_S[i];
}
for(int i = remaining_S.size() - suffix_palindrome; i < remaining_S.size(); i++)
{
answer += remaining_S[i];
}
for(int i = S.size() - matching_part; i < S.size(); i++)
{
answer += S[i];
}
cout << answer << "\n";
}
================================================
FILE: 2020/Combined Divisions/CodeForces Global Round 7/Programs/Bad Ugly Numbers.cpp
================================================
#include <iostream>
using namespace std;
void solve()
{
int n;
cin >> n;
if(n == 1)
{
cout << "-1\n";
return;
}
for(int i = 1; i <= n - 1; i++)
{
cout << "5";
}
cout << "4\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Combined Divisions/CodeForces Global Round 7/Programs/Maximums.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> B(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> B[i];
}
vector <int> A(no_of_elements + 1);
vector <int> prefix_max(no_of_elements + 5, 0);
for(int i = 1; i <= no_of_elements; i++)
{
A[i] = B[i] + prefix_max[i];
prefix_max[i + 1] = max(prefix_max[i], A[i]);
}
for(int i = 1; i <= no_of_elements; i++)
{
cout << A[i] << " ";
}
cout << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/CodeForces Global Round 7/Programs/Permutation Partitions.cpp
================================================
#include <iostream>
#include <vector>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
long long get_sum(long long n)
{
return (n*(n + 1))/2;
}
int main()
{
int no_of_elements, no_of_parts;
cin >> no_of_elements >> no_of_parts;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
vector <long long> indices;
for(int i = 1; i <= no_of_elements; i++)
{
if(A[i] > no_of_elements - no_of_parts)
{
indices.push_back(i);
}
}
sort(all(indices));
long long best_sum = get_sum(no_of_elements) - get_sum(no_of_elements - no_of_parts);
long long no_of_ways = 1;
const long long MOD = 998244353;
for(int i = 1; i < no_of_parts; i++)
{
no_of_ways *= (indices[i] - indices[i - 1]);
no_of_ways %= MOD;
}
cout << best_sum << " " << no_of_ways << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/CodeForces Global Round 7/Programs/Prefix Suffix Palindrome (Easy Version).cpp
================================================
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
const int MAX_N = 5005;
int max_palindrome_in[MAX_N][MAX_N];
pair <int, int> get_prefix_suffix(string S)
{
for(int length = 1; length <= S.size(); length++)
{
for(int left = 0, right = left + length - 1; right < S.size(); left++, right++)
{
max_palindrome_in[left][right] = 0;
if(length == 1)
{
max_palindrome_in[left][right] = 1;
continue;
}
if(length == 2)
{
max_palindrome_in[left][right] = (S[left] == S[right] ? 2 : 0);
continue;
}
if(S[left] == S[right] && max_palindrome_in[left + 1][right - 1] != 0)
{
max_palindrome_in[left][right] = 2 + max_palindrome_in[left + 1][right - 1];
}
}
}
int best_prefix = 0;
for(int i = 0; i < S.size(); i++)
{
best_prefix = max(best_prefix, max_palindrome_in[0][i]);
}
int best_suffix = 0;
for(int i = S.size() - 1; i >= 0; i--)
{
best_suffix = max(best_suffix, max_palindrome_in[i][S.size() - 1]);
}
return make_pair(best_prefix, best_suffix);
}
void solve()
{
string S;
cin >> S;
int matching_part = 0, prefix_palindrome = 0, suffix_palindrome = 0;
for(int i = 0, j = S.size() - 1; i < j; i++, j--)
{
if(S[i] == S[j])
{
matching_part++;
}
else
{
break;
}
}
string remaining_S;
for(int i = matching_part; i < S.size() - matching_part; i++)
{
remaining_S += S[i];
}
//cout << "Remaining = " << remaining_S << "\n";
pair <int, int> prefix_suffix = get_prefix_suffix(remaining_S);
prefix_palindrome = prefix_suffix.first;
suffix_palindrome = prefix_suffix.second;
if(prefix_palindrome > suffix_palindrome)
{
suffix_palindrome = 0;
}
else
{
prefix_palindrome = 0;
}
string answer;
for(int i = 0; i < matching_part; i++)
{
answer += S[i];
}
for(int i = 0; i < prefix_palindrome; i++)
{
answer += remaining_S[i];
}
for(int i = remaining_S.size() - suffix_palindrome; i < remaining_S.size(); i++)
{
answer += remaining_S[i];
}
for(int i = S.size() - matching_part; i < S.size(); i++)
{
answer += S[i];
}
cout << answer << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Explanations/Kuroni and Impossible Calculation Explanation.txt
================================================
If there are two integers A[i] and A[j] such that (A[i] = A[j] (mod m))
Then (A[i] - A[j] = 0) (mod m)
There are only m possible remainders mod m = {0, 1, ... , m - 1}
By the Pigeonhole Principle, if there are more than m integers, at least 2 will have the same remainder.
This means, the answer will be 0 as 1 term (A[i] - A[j]) = 0 (mod m)
-----
If there are less than m terms, then there are less than 1000 terms and we can
find the answer in O(n^2) time
#include <iostream>
#include <vector>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
int main()
{
int no_of_elements, modulo;
cin >> no_of_elements >> modulo;
vector <long long> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
if(no_of_elements > modulo)
{
cout << "0\n";
return 0;
}
long long product = 1;
for(int i = 1; i <= no_of_elements; i++)
{
for(int j = i + 1; j <= no_of_elements; j++)
{
product *= abs(A[i] - A[j]);
product %= modulo;
}
}
cout << product << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Explanations/Kuroni and Punishment Explanation.txt
================================================
Firstly, we will notice that the answer will never be more than N.
We can always use at most one move for each element and make them all even.
So, the answer is always <= N
------
If the answer is < N, then at least one element is unchanged.
This means that the final gcd will be a divisor of one of the original no_of_elements
The number of distinct divisors will not be too many.
Unfortunately, we do not have enough time to factorise all the integers.
Instead, we will randomly pick around 100 of them and
take all the distinct prime factors of (A[i] - 1, A[i], A[i] + 1)
------
1. Ultimately we will change each element by some amount
2. We can always just make every integer even. This means that the total change is at most N.
3. If the total change <= N, then how many elements change by more than 1 ?
At most N/2 element change by more than 1 !
In other words, at least N/2 elements change by at most 1
4. That means there are at least N/2 elements for which the 'best' factor is a divisor is one of the divisors of (A[I] - 1, A[I], A[I] + 1)
5. There are two types of elements - Those that change by at most 1 and those that change by more than 1.
There are at least N/2 of the former. The probability of a random element belonging to the first set is at least 1/2
If we sample 100 elements randomly, the probability is 1/2^{100}
------
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <random>
using namespace std;
void factorise(set <long long> &F, long long n)
{
if(n <= 1)
{
return;
}
//cout << "N = " << n << "\n";
for(long long i = 2; i*i <= n; i++)
{
if(n%i == 0)
{
F.insert(i);
while(n%i == 0)
{
n /= i;
}
}
}
if(n > 1)
{
F.insert(n);
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int no_of_elements;
cin >> no_of_elements;
vector <long long> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
const int MAX_TRIES = 100;
random_shuffle(A.begin() + 1, A.end());
set <long long> factors;
for(int i = 1; i <= MAX_TRIES && i <= no_of_elements; i++)
{
factorise(factors, A[i]);
factorise(factors, A[i] - 1);
factorise(factors, A[i] + 1);
}
long long minimum_moves = no_of_elements;
for(auto it = factors.begin(); it != factors.end(); it++)
{
long long x = *it; //cout << "X = " << x << "\n";
long long moves_here = 0;
for(int i = 1; i <= no_of_elements; i++)
{
long long moves_for_this_elements = (x - A[i]%x);
if(A[i] >= x)
{
moves_for_this_elements = min(moves_for_this_elements, A[i]%x);
}
moves_here += moves_for_this_elements; //cout << "Moves = " << moves_for_this_elements << "\n";
}
minimum_moves = min(minimum_moves, moves_here);
}
cout << minimum_moves << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Explanations/Kuroni and Simple Strings Explanation.txt
================================================
It is best to be greedy.
We will remove '(' from the left.
And for each '(', we will look for an ')', as much to the right as possible
We will do as many such 'sweeps' as we can
While printing it, we will sort the indices in each 'sweep'
-----
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
int main()
{
string S;
cin >> S;
vector <vector <int> >indices;
vector <int> available(S.size() + 1, true);
for(int attempts = 1; attempts <= S.size(); attempts++)
{
vector <int> indices_here;
for(int front = 0, back = S.size() - 1; front < back;)
{
while(true)
{
if(front >= back)
{
break;
}
if(!available[front] || S[front] != '(')
{
front++;
continue;
}
break;
}
if(front >= back || S[front] != '(')
{
break;
}
while(true)
{
if(back <= front)
{
break;
}
if(!available[back] || S[back] != ')')
{
back--;
continue;
}
break;
}
if(back <= front || S[back] != ')')
{
break;
}
available[front] = false;
available[back] = false;
indices_here.push_back(front + 1);
indices_here.push_back(back + 1);
}
if(indices_here.size() > 0)
{
indices.push_back(indices_here);
}
}
cout << indices.size() << "\n";
for(int i = 0; i < indices.size(); i++)
{
cout << indices[i].size() << "\n";
sort(all(indices[i]));
for(int j = 0; j < indices[i].size(); j++)
{
cout << indices[i][j] << " ";
}
cout << "\n";
}
return 0;
}
================================================
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Explanations/Kuroni and the Celebration Explanation.txt
================================================
Let us keep all the leaves in a vector.
We will pick out two leaves u and v and query their LCA
If LCA(u, v) = u or v, then u or v is the root of the tree
If LCA(u, v) = w and w =/= u and w =/= v, then we will erase all vertices
in the path from (u, w) and all vertices in the path from (v, w)
In the process of doing this if w becomes a leaf, we will add it to our vector.
If at any point, the leaf vector has only 1 element, then it will be the root.
In every query, the size of the tree reduces by at least 2. So, the number of queries will not exceed (n/2)
-----
vector <set <int> > tree;
set <int> leaves;
void erase_till(int v, int child, int destination)
{
if(leaves.find(v) != leaves.end())
{
leaves.erase(v);
}
for(auto it = tree[v].begin(); it != tree[v].end(); it++)
{
int parent = *it;
if(parent == child)
{
continue;
}
if(parent == destination)
{
tree[destination].erase(v);
continue;
}
if(tree[parent].size() > 0)
{
erase_till(parent, v, destination);
}
}
tree[v].clear();
}
int main()
{
int no_of_vertices;
cin >> no_of_vertices;
tree.resize(no_of_vertices + 1);
int no_of_edges = no_of_vertices - 1;
for(int i = 1; i <= no_of_edges; i++)
{
int u, v;
cin >> u >> v;
tree[u].insert(v);
tree[v].insert(u);
}
for(int v = 1; v <= no_of_vertices; v++)
{
if(tree[v].size() == 1)
{
leaves.insert(v);
}
}
int root = 0;
while(leaves.size() > 1)
{
int u = *(leaves.begin()); leaves.erase(u);
int v = *(leaves.begin()); leaves.erase(v);
int w;
cout << "? " << u << " " << v << "\n" << flush;
cin >> w;
if(w == u || w == v)
{
root = w;
break;
}
erase_till(u, 0, w);
erase_till(v, 0, w);
if(tree[w].size() <= 1)
{
leaves.insert(w);
}
}
if(root == 0)
{
root = *(leaves.begin());
}
cout << "! " << root << "\n" << flush;
return 0;
}
================================================
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Explanations/Kuroni and the Gifts Explanation.txt
================================================
The elements of both A and B are distinct.
The smallest possible sum is A[1] + B[1]
We will sort the elements and (A[i] + B[i]) as each element.
As (A[i + 1] > A[i]) and (B[i + 1] > B[i]), this means
(A[i + 1] + B[i + 1]) > (A[i] + B[i])
This helps us prove that the entire array is distinct
-----
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
sort(all(A));
vector <int> B(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> B[i];
}
sort(all(B));
for(int i = 1; i <= no_of_elements; i++)
{
cout << A[i] << " ";
}
cout << "\n";
for(int i = 1; i <= no_of_elements; i++)
{
cout << B[i] << " ";
}
cout << "\n";
}
================================================
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and Impossible Calculation.cpp
================================================
#include <iostream>
#include <vector>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
int main()
{
int no_of_elements, modulo;
cin >> no_of_elements >> modulo;
vector <long long> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
if(no_of_elements > modulo)
{
cout << "0\n";
return 0;
}
long long product = 1;
for(int i = 1; i <= no_of_elements; i++)
{
for(int j = i + 1; j <= no_of_elements; j++)
{
product *= abs(A[i] - A[j]);
product %= modulo;
}
}
cout << product << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and Punishment.cpp
================================================
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <random>
using namespace std;
void factorise(set <long long> &F, long long n)
{
if(n <= 1)
{
return;
}
//cout << "N = " << n << "\n";
for(long long i = 2; i*i <= n; i++)
{
if(n%i == 0)
{
F.insert(i);
while(n%i == 0)
{
n /= i;
}
}
}
if(n > 1)
{
F.insert(n);
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int no_of_elements;
cin >> no_of_elements;
vector <long long> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
const int MAX_TRIES = 100;
random_shuffle(A.begin() + 1, A.end());
set <long long> factors;
for(int i = 1; i <= MAX_TRIES && i <= no_of_elements; i++)
{
factorise(factors, A[i]);
factorise(factors, A[i] - 1);
factorise(factors, A[i] + 1);
}
long long minimum_moves = no_of_elements;
for(auto it = factors.begin(); it != factors.end(); it++)
{
long long x = *it; //cout << "X = " << x << "\n";
long long moves_here = 0;
for(int i = 1; i <= no_of_elements; i++)
{
long long moves_for_this_elements = (x - A[i]%x);
if(A[i] >= x)
{
moves_for_this_elements = min(moves_for_this_elements, A[i]%x);
}
moves_here += moves_for_this_elements; //cout << "Moves = " << moves_for_this_elements << "\n";
}
minimum_moves = min(minimum_moves, moves_here);
}
cout << minimum_moves << "\n";
return 0;
}
================================================
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and Simple Strings.cpp
================================================
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
int main()
{
string S;
cin >> S;
vector <vector <int> >indices;
vector <int> available(S.size() + 1, true);
for(int attempts = 1; attempts <= S.size(); attempts++)
{
vector <int> indices_here;
for(int front = 0, back = S.size() - 1; front < back;)
{
while(true)
{
if(front >= back)
{
break;
}
if(!available[front] || S[front] != '(')
{
front++;
continue;
}
break;
}
if(front >= back || S[front] != '(')
{
break;
}
while(true)
{
if(back <= front)
{
break;
}
if(!available[back] || S[back] != ')')
{
back--;
continue;
}
break;
}
if(back <= front || S[back] != ')')
{
break;
}
available[front] = false;
available[back] = false;
indices_here.push_back(front + 1);
indices_here.push_back(back + 1);
}
if(indices_here.size() > 0)
{
indices.push_back(indices_here);
}
}
cout << indices.size() << "\n";
for(int i = 0; i < indices.size(); i++)
{
cout << indices[i].size() << "\n";
sort(all(indices[i]));
for(int j = 0; j < indices[i].size(); j++)
{
cout << indices[i][j] << " ";
}
cout << "\n";
}
return 0;
}
================================================
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and the Celebration.cpp
================================================
#include <iostream>
#include <vector>
#include <set>
using namespace std;
vector <set <int> > tree;
set <int> leaves;
void erase_till(int v, int child, int destination)
{
if(leaves.find(v) != leaves.end())
{
leaves.erase(v);
}
for(auto it = tree[v].begin(); it != tree[v].end(); it++)
{
int parent = *it;
if(parent == child)
{
continue;
}
if(parent == destination)
{
tree[destination].erase(v);
continue;
}
if(tree[parent].size() > 0)
{
erase_till(parent, v, destination);
}
}
tree[v].clear();
}
int main()
{
int no_of_vertices;
cin >> no_of_vertices;
tree.resize(no_of_vertices + 1);
int no_of_edges = no_of_vertices - 1;
for(int i = 1; i <= no_of_edges; i++)
{
int u, v;
cin >> u >> v;
tree[u].insert(v);
tree[v].insert(u);
}
for(int v = 1; v <= no_of_vertices; v++)
{
if(tree[v].size() == 1)
{
leaves.insert(v);
}
}
int root = 0;
while(leaves.size() > 1)
{
int u = *(leaves.begin()); leaves.erase(u);
int v = *(leaves.begin()); leaves.erase(v);
int w;
cout << "? " << u << " " << v << "\n" << flush;
cin >> w;
if(w == u || w == v)
{
root = w;
break;
}
erase_till(u, 0, w);
erase_till(v, 0, w);
if(tree[w].size() <= 1)
{
leaves.insert(w);
}
}
if(root == 0)
{
root = *(leaves.begin());
}
cout << "! " << root << "\n" << flush;
return 0;
}
================================================
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and the Gifts.cpp
================================================
#include <iostream>
#include <vector>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
sort(all(A));
vector <int> B(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> B[i];
}
sort(all(B));
for(int i = 1; i <= no_of_elements; i++)
{
cout << A[i] << " ";
}
cout << "\n";
for(int i = 1; i <= no_of_elements; i++)
{
cout << B[i] << " ";
}
cout << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while (no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Explanations/As Simple as One and Two Explanation.txt
================================================
We will make 2 passes through the string.
1. In Pass 1, we will remove all the 'o' which are common to both "one" and "two".
2. In Pass 2, we will remove any one of the letters for either "one" or "two".
-----
void solve()
{
string S;
cin >> S;
vector <int> answer;
for(int i = 4; i < S.size(); i++)
{
if(S[i] == 'e' and S[i - 1] == 'n' and S[i - 2] == 'o'
and S[i - 3] == 'w' and S[i - 4] == 't')
{
S[i - 2] = 'x';
answer.push_back(i - 2 + 1);
}
}
for(int i = 2; i < S.size(); i++)
{
if(S[i] == 'o' and S[i - 1] == 'w' && S[i - 2] == 't')
{
answer.push_back(i - 1 + 1);
}
if(S[i] == 'e' and S[i - 1] == 'n' && S[i - 2] == 'o')
{
answer.push_back(i - 1 + 1);
}
}
cout << answer.size() << "\n";
for(int i = 0; i < answer.size(); i++)
{
cout << answer[i] << " ";
}
cout << "\n";
}
================================================
FILE: 2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Explanations/Happy Birthday Polycarp Explanation.txt
================================================
If the number has d digits, then all strings upto length (d - 1) are automatically good.
So the answer is initially 9(d - 1).
We will try all 9 D digit numbers and check how many of them are < n.
-----
int no_of_digits(int n)
{
int digits = 0;
while(n > 0)
{
n /= 10;
digits++;
}
return digits;
}
void solve()
{
int n;
cin >> n;
int answer = 9*(no_of_digits(n) - 1);
for(int i = 1, x = 0; i <= 9; i++)
{
x = 0;
for(int d = 1; d <= no_of_digits(n); d++)
{
x = x*10 + i;
}
if(x > n)
{
break;
}
answer++;
}
cout << answer << "\n";
}
================================================
FILE: 2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Explanations/Make Them Odd Explanation.txt
================================================
In every step, we will keep dividing the largest element till it becomes odd.
Use a set to hit only distinct elements.
This also takes care of the situation when x/2 is already there in the array.
------
void solve()
{
int no_of_elements;
cin >> no_of_elements;
set <int> S;
for(int i = 1; i <= no_of_elements; i++)
{
int x;
cin >> x;
if(x%2 == 0)
{
S.insert(x);
}
}
int no_of_steps = 0;
while(!S.empty())
{
int maximum = *(S.rbegin());
while(maximum%2 == 0)
{
if(S.find(maximum) != S.end())
{
S.erase(S.find(maximum));
}
maximum /= 2;
no_of_steps++;
}
}
cout << no_of_steps << "\n";
}
================================================
FILE: 2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Programs/As Simple as One and Two.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
void solve()
{
string S;
cin >> S;
vector <int> answer;
for(int i = 4; i < S.size(); i++)
{
if(S[i] == 'e' and S[i - 1] == 'n' and S[i - 2] == 'o'
and S[i - 3] == 'w' and S[i - 4] == 't')
{
S[i - 2] = 'x';
answer.push_back(i - 2 + 1);
}
}
for(int i = 2; i < S.size(); i++)
{
if(S[i] == 'o' and S[i - 1] == 'w' && S[i - 2] == 't')
{
answer.push_back(i - 1 + 1);
}
if(S[i] == 'e' and S[i - 1] == 'n' && S[i - 2] == 'o')
{
answer.push_back(i - 1 + 1);
}
}
cout << answer.size() << "\n";
for(int i = 0; i < answer.size(); i++)
{
cout << answer[i] << " ";
}
cout << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Programs/Happy Birthday Polycarp.cpp
================================================
#include <iostream>
using namespace std;
int no_of_digits(int n)
{
int digits = 0;
while(n > 0)
{
n /= 10;
digits++;
}
return digits;
}
void solve()
{
int n;
cin >> n;
int answer = 9*(no_of_digits(n) - 1);
for(int i = 1, x = 0; i <= 9; i++)
{
x = 0;
for(int d = 1; d <= no_of_digits(n); d++)
{
x = x*10 + i;
}
if(x > n)
{
break;
}
answer++;
}
cout << answer << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Programs/Make Them Odd.cpp
================================================
#include <iostream>
#include <vector>
#include <set>
using namespace std;
void solve()
{
int no_of_elements;
cin >> no_of_elements;
set <int> S;
for(int i = 1; i <= no_of_elements; i++)
{
int x;
cin >> x;
if(x%2 == 0)
{
S.insert(x);
}
}
int no_of_steps = 0;
while(!S.empty())
{
int maximum = *(S.rbegin());
while(maximum%2 == 0)
{
if(S.find(maximum) != S.end())
{
S.erase(S.find(maximum));
}
maximum /= 2;
no_of_steps++;
}
}
cout << no_of_steps << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/609 Div 2/Explanations/Domino for Young Explanation.txt
================================================
We can think of it as a chessboard.Each domino covers one square of each colour.
The answer is whichever is minimum - black or white squares.
-----
#include <iostream>
using namespace std;
int main()
{
int no_of_columns;
cin >> no_of_columns;
long long black = 0, white = 0;
for(int i = 1; i <= no_of_columns; i++)
{
int no_of_rows;
cin >> no_of_rows;
black += (no_of_rows/2) + (no_of_rows%2 == 1 && i%2 == 0);
white += (no_of_rows/2) + (no_of_rows%2 == 1 && i%2 == 1);
}
long long dominos = min(black, white);
cout << dominos << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/609 Div 2/Explanations/Equation Explanation.txt
================================================
We can just print 9n and 8n.
gcd(8, 9) = 1 and 9n - 8n = 1
-----
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
cout << 9*n << " " << 8*n << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/609 Div 2/Explanations/Long Beautiful Integer Explanation.txt
================================================
The first k characters determine the entire string.
We will first set B[i] = B[i%k] for every i.
If B >= A like this, then we are done.
This is the smallest beautiful integer as it matches the longest prefix.
Otherwise if B < A, then, we will look at the last digit which is not 9 in the prefix.
We will increment it and make all the 9's from there till k = 0
Now, B > A and has the longest matching prefix.
-----
#include <iostream>
#include <string>
using namespace std;
int main()
{
int no_of_digits, k;
string S;
cin >> no_of_digits >> k >> S;
string answer = S;
for(int i = k; i < no_of_digits; i++)
{
answer[i] = answer[i%k];
}
int is_lesser = false;
for(int i = 0; i < no_of_digits; i++)
{
if(answer[i] > S[i])
{
break;
}
if(answer[i] < S[i])
{
is_lesser = true;
break;
}
}
if(!is_lesser)
{
cout << no_of_digits << "\n" << answer << "\n";
return 0;
}
int change_point = -1;
for(int i = k - 1; i >= 0; i--)
{
if(S[i] != '9')
{
change_point = i;
answer[i] = answer[i] + 1;
break;
}
}
for(int i = change_point + 1; change_point != -1 && i < k; i++)
{
answer[i] = '0';
}
for(int i = k; i < no_of_digits; i++)
{
answer[i] = answer[i%k];
}
cout << no_of_digits << "\n" << answer << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/609 Div 2/Explanations/Modulo Equality Explanation.txt
================================================
Let us check all possible candidates that we can add to A to make it equal to B.
When A = B, then A[1] is equal to some element in B.
We will iterate over all B, and check if x = (B[i] - A[1]) satisfies the condition.
We will add x to the entire array A and then check if A = B.
This can be done by comparing the sorted arrays A and B.
-----
int add_and_check_equality(vector <int> A, vector <int> B, int m, int x)
{
for(int i = 1; i < A.size(); i++)
{
A[i] = (A[i] + x)%m;
}
sort(all(A));
for(int i = 1; i < B.size(); i++)
{
if(A[i] != B[i])
{
return false;
}
}
return true;
}
int main()
{
int no_of_elements, m;
cin >> no_of_elements >> m;
vector <int> A(no_of_elements + 1, 0);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
A[i] %= m;
}
vector <int> B(no_of_elements + 1, 0);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> B[i];
B[i] %= m;
}
sort(all(B));
int minimum_moves = m;
for(int i = 1; i <= no_of_elements; i++)
{
int to_add = (B[i] - A[1] + m)%m;
if(add_and_check_equality(A, B, m, to_add))
{
minimum_moves = min(minimum_moves, to_add);
}
}
cout << minimum_moves << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/609 Div 2/Programs/Domino for Young.cpp
================================================
#include <iostream>
using namespace std;
int main()
{
int no_of_columns;
cin >> no_of_columns;
long long black = 0, white = 0;
for(int i = 1; i <= no_of_columns; i++)
{
int no_of_rows;
cin >> no_of_rows;
black += (no_of_rows/2) + (no_of_rows%2 == 1 && i%2 == 0);
white += (no_of_rows/2) + (no_of_rows%2 == 1 && i%2 == 1);
}
long long dominos = min(black, white);
cout << dominos << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/609 Div 2/Programs/Equation.cpp
================================================
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
cout << 9*n << " " << 8*n << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/609 Div 2/Programs/Long Beautiful Integer.cpp
================================================
#include <iostream>
#include <string>
using namespace std;
int main()
{
int no_of_digits, k;
string S;
cin >> no_of_digits >> k >> S;
string answer = S;
for(int i = k; i < no_of_digits; i++)
{
answer[i] = answer[i%k];
}
int is_lesser = false;
for(int i = 0; i < no_of_digits; i++)
{
if(answer[i] > S[i])
{
break;
}
if(answer[i] < S[i])
{
is_lesser = true;
break;
}
}
if(!is_lesser)
{
cout << no_of_digits << "\n" << answer << "\n";
return 0;
}
int change_point = -1;
for(int i = k - 1; i >= 0; i--)
{
if(S[i] != '9')
{
change_point = i;
answer[i] = answer[i] + 1;
break;
}
}
for(int i = change_point + 1; change_point != -1 && i < k; i++)
{
answer[i] = '0';
}
for(int i = k; i < no_of_digits; i++)
{
answer[i] = answer[i%k];
}
cout << no_of_digits << "\n" << answer << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/609 Div 2/Programs/Modulo Equality.cpp
================================================
#include <iostream>
#include <vector>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
int add_and_check_equality(vector <int> A, vector <int> B, int m, int x)
{
for(int i = 1; i < A.size(); i++)
{
A[i] = (A[i] + x)%m;
}
sort(all(A));
for(int i = 1; i < B.size(); i++)
{
if(A[i] != B[i])
{
return false;
}
}
return true;
}
int main()
{
int no_of_elements, m;
cin >> no_of_elements >> m;
vector <int> A(no_of_elements + 1, 0);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
A[i] %= m;
}
vector <int> B(no_of_elements + 1, 0);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> B[i];
B[i] %= m;
}
sort(all(B));
int minimum_moves = m;
for(int i = 1; i <= no_of_elements; i++)
{
int to_add = (B[i] - A[1] + m)%m;
if(add_and_check_equality(A, B, m, to_add))
{
minimum_moves = min(minimum_moves, to_add);
}
}
cout << minimum_moves << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/612 Div 2/Explanations/Angry Students Explanation.txt
================================================
The prefix of P's will not be changed.
For every other P, the amount of time taken to change it is equal to the distance of the leftmost A.
We can compute this in one linear sweep.
-----
void solve()
{
int length;
string S;
cin >> length >> S;
const int oo = 1e7;
vector <int> nearest_a(length + 1, oo);
nearest_a[0] = (S[0] == 'A' ? 0 : oo);
for(int i = 1; i < length; i++)
{
nearest_a[i] = (S[i] == 'A' ? 0 : nearest_a[i - 1] + 1);
}
int answer = 0;
for(int i = 0; i < length; i++)
{
//Skip the prefix
if(nearest_a[i] >= oo)
{
continue;
}
answer = max(answer, nearest_a[i]);
}
cout << answer << "\n";
}
================================================
FILE: 2020/Div 2/612 Div 2/Explanations/Hyperset Explanation.txt
================================================
Let us notice something.
Suppose we fix 2 strings A and B.
There can only be 1 string C, such that (A, B, C) is a set.
For each of the K positions, if
A[i] = B[i], then C[i] also has to be = A[i]
If A[i] != B[i], then C[i] must be the third character not equal to both (A[i], B[i]).
-----
Let us iterate over every pair of strings. The third string C is only one.
For every pair (A[i], A[j]), add the frequency of Complement(A[i], A[j]) to the answer.
The only observation is that every triplet (A, B, C) is counted three times.
1. When we fix (A, B)
2. When we fix (B, C)
3. When we fix (C, A)
So, we will divide the number of triplets by 3.
----
We need to notice something. What about identical triplets - when all three strings are the same - (A, A, A) ?
If we add it in the same way, then we will be counting such triplets 6 times.
When we fix (A, A) and add frequency of Complement(A, A) = A to the answer, the answer overcounts by 2.
Each such triplet is counted 3x2 = 6 times.
That is why, in my solution I count same triplets first, and then different triplets seperately.
----
Note that we do not have to deal with the condition where A = B =/= C because of the definition of the triplet :)
----
char get_third(char a, char b)
{
switch(a)
{
case 'S' : return (b == 'E' ? 'T' : 'E');
case 'E' : return (b == 'T' ? 'S' : 'T');
case 'T' : return (b == 'S' ? 'E' : 'S');
}
return 0;
}
long long choose_3(long long n)
{
long long numerator = n*(n - 1)*(n - 2);
long long denominator = 3*2*1;
return numerator/denominator;
}
int main()
{
int no_of_cards, no_of_features;
cin >> no_of_cards >> no_of_features;
vector <string> card(no_of_cards + 1);
map <string, int> frequency;
for(int i = 1; i <= no_of_cards; i++)
{
cin >> card[i];
frequency[card[i]]++;
}
long long same_triplets = 0;
for(auto it = frequency.begin(); it != frequency.end(); it++)
{
same_triplets += choose_3(it->second);
}
long long different_triplets = 0;
for(int i = 1; i <= no_of_cards; i++)
{
for(int j = i + 1; j <= no_of_cards; j++)
{
if(card[i] == card[j])
{
continue;
}
string complement;
for(int k = 0; k < no_of_features; k++)
{
if(card[i][k] == card[j][k])
{
complement += card[i][k];
}
else
{
complement += get_third(card[i][k], card[j][k]);
}
}
different_triplets += frequency[complement];
}
}
different_triplets /= 3;
long long no_of_triplets = same_triplets + different_triplets;
cout << no_of_triplets << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/612 Div 2/Explanations/Madhouse (Easy Version) Explanation.txt
================================================
Let us do this.
Since we are given random permutations of every substring, we will collect a vector of length 26
denoting the frequency of each of the alphabets instead of the actual string.
We will first get all the substrings of length [1, n].
We will then get all the substrings of length [2, n].
We will store all the vectors of length 26 inside a multiset.
We will delete all the vectors from [2, n] that are present.
This leaves us with n substrings -
[1, 1], [1, 2], [1, 3], ... , [1, n].
----
Notice that [1, 1] is the only letter.
To get the second letter, we must search for which letter is there in [1, 2] but not in [1, 1].
Similarly, we will repeat this process. To get the i-th alphabet, we will search for which letter
is there in [1, i] but not there in [1, i - 1].
-----
int sort_by_frequency(vector <int> &A, vector <int> &B)
{
const int NO_OF_ALPHABETS = 26;
int a_sum = 0, b_sum = 0;
for(int i = 0; i < NO_OF_ALPHABETS; i++)
{
a_sum += A[i];
b_sum += B[i];
}
return (b_sum > a_sum);
}
int main()
{
int length;
cin >> length;
const int NO_OF_ALPHABETS = 26;
cout << "? 1 " << length << endl;
multiset <vector <int> >subarray;
for(int i = 1; i <= length; i++)
{
for(int j = i; j <= length; j++)
{
string S;
cin >> S;
if(length == 1)
{
cout << "! " << S << endl;
return 0;
}
vector <int> frequency(NO_OF_ALPHABETS, 0);
for(int k = 0; k < S.size(); k++)
{
frequency[S[k] - 'a']++;
}
subarray.insert(frequency);
}
}
cout << "? 2 " << length << endl;
for(int i = 2; i <= length; i++)
{
for(int j = i; j <= length; j++)
{
string S;
cin >> S;
vector <int> frequency(NO_OF_ALPHABETS, 0);
for(int k = 0; k < S.size(); k++)
{
frequency[S[k] - 'a']++;
}
subarray.erase(subarray.find((frequency)));
}
}
vector <vector <int> >subarrays_from_1;
for(auto it = subarray.begin(); it != subarray.end(); it++)
{
subarrays_from_1.push_back(*it);
}
sort(all(subarrays_from_1), sort_by_frequency);
string answer;
vector <int> current_frequency(NO_OF_ALPHABETS, 0);
for(int i = 0; i < length; i++)
{
for(int alpha = 0; alpha < NO_OF_ALPHABETS; alpha++)
{
if(subarrays_from_1[i][alpha] > current_frequency[alpha])
{
answer += (char)('a' + alpha);
current_frequency[alpha]++;
}
}
}
cout << "! " << answer << endl;
return 0;
}
================================================
FILE: 2020/Div 2/612 Div 2/Programs/Angry Students.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
void solve()
{
int length;
string S;
cin >> length >> S;
const int oo = 1e7;
vector <int> nearest_a(length + 1, oo);
nearest_a[0] = (S[0] == 'A' ? 0 : oo);
for(int i = 1; i < length; i++)
{
nearest_a[i] = (S[i] == 'A' ? 0 : nearest_a[i - 1] + 1);
}
int answer = 0;
for(int i = 0; i < length; i++)
{
//Skip the prefix
if(nearest_a[i] >= oo)
{
continue;
}
answer = max(answer, nearest_a[i]);
}
cout << answer << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/612 Div 2/Programs/Hyperset.cpp
================================================
#include <iostream>
#include <map>
#include <vector>
using namespace std;
char get_third(char a, char b)
{
switch(a)
{
case 'S' : return (b == 'E' ? 'T' : 'E');
case 'E' : return (b == 'T' ? 'S' : 'T');
case 'T' : return (b == 'S' ? 'E' : 'S');
}
return 0;
}
long long choose_3(long long n)
{
long long numerator = n*(n - 1)*(n - 2);
long long denominator = 3*2*1;
return numerator/denominator;
}
int main()
{
int no_of_cards, no_of_features;
cin >> no_of_cards >> no_of_features;
vector <string> card(no_of_cards + 1);
map <string, int> frequency;
for(int i = 1; i <= no_of_cards; i++)
{
cin >> card[i];
frequency[card[i]]++;
}
long long same_triplets = 0;
for(auto it = frequency.begin(); it != frequency.end(); it++)
{
same_triplets += choose_3(it->second);
}
long long different_triplets = 0;
for(int i = 1; i <= no_of_cards; i++)
{
for(int j = i + 1; j <= no_of_cards; j++)
{
if(card[i] == card[j])
{
continue;
}
string complement;
for(int k = 0; k < no_of_features; k++)
{
if(card[i][k] == card[j][k])
{
complement += card[i][k];
}
else
{
complement += get_third(card[i][k], card[j][k]);
}
}
different_triplets += frequency[complement];
}
}
different_triplets /= 3;
long long no_of_triplets = same_triplets + different_triplets;
cout << no_of_triplets << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/612 Div 2/Programs/Madhouse (Easy Version).cpp
================================================
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
int sort_by_frequency(vector <int> &A, vector <int> &B)
{
const int NO_OF_ALPHABETS = 26;
int a_sum = 0, b_sum = 0;
for(int i = 0; i < NO_OF_ALPHABETS; i++)
{
a_sum += A[i];
b_sum += B[i];
}
return (b_sum > a_sum);
}
int main()
{
int length;
cin >> length;
const int NO_OF_ALPHABETS = 26;
cout << "? 1 " << length << endl;
multiset <vector <int> >subarray;
for(int i = 1; i <= length; i++)
{
for(int j = i; j <= length; j++)
{
string S;
cin >> S;
if(length == 1)
{
cout << "! " << S << endl;
return 0;
}
vector <int> frequency(NO_OF_ALPHABETS, 0);
for(int k = 0; k < S.size(); k++)
{
frequency[S[k] - 'a']++;
}
subarray.insert(frequency);
}
}
cout << "? 2 " << length << endl;
for(int i = 2; i <= length; i++)
{
for(int j = i; j <= length; j++)
{
string S;
cin >> S;
vector <int> frequency(NO_OF_ALPHABETS, 0);
for(int k = 0; k < S.size(); k++)
{
frequency[S[k] - 'a']++;
}
subarray.erase(subarray.find((frequency)));
}
}
vector <vector <int> >subarrays_from_1;
for(auto it = subarray.begin(); it != subarray.end(); it++)
{
subarrays_from_1.push_back(*it);
}
sort(all(subarrays_from_1), sort_by_frequency);
string answer;
vector <int> current_frequency(NO_OF_ALPHABETS, 0);
for(int i = 0; i < length; i++)
{
for(int alpha = 0; alpha < NO_OF_ALPHABETS; alpha++)
{
if(subarrays_from_1[i][alpha] > current_frequency[alpha])
{
answer += (char)('a' + alpha);
current_frequency[alpha]++;
}
}
}
cout << "! " << answer << endl;
return 0;
}
================================================
FILE: 2020/Div 2/613 Div 2/Explanations/Dr Evil Underscores Explanation.txt
================================================
If all the integers have a 1 in a bit position or a 0 in a bit position,
then the answer will have a 0 there if we put a bit in X.
If some integers have a 1 and some integers have a 0, then the answer will have
that bit set in answer regardless of what we put in X.
-----
Suppose we are dealing with bit b,
What we will do is put all the integers with that bit set in A,
We will put all the integers with that bit unset in B
We will solve the problem for the remaining bits in A and B seperately and add it to 2^b
-----
long long solve(int bit, vector <long long> &A)
{
if(bit < 0 || A.size() == 0)
{
return 0;
}
vector <long long> set, unset;
for(int i = 0; i < A.size(); i++)
{
if(is_bit_set(A[i], bit))
{
set.push_back(A[i]);
}
else
{
unset.push_back(A[i]);
}
}
if(set.size() == 0)
{
return solve(bit - 1, unset);
}
if(unset.size() == 0)
{
return solve(bit - 1, set);
}
return ( (1LL << bit) + min(solve(bit - 1, set), solve(bit - 1, unset)) );
}
================================================
FILE: 2020/Div 2/613 Div 2/Explanations/Fadi and LCM Explanation.txt
================================================
Let us notice something.
Suppose p is a prime integer.
The LCM of (p^a, p^b) is p^{max(a, b)}
If X = p1^a1 p2^a2 ... pn^an
If we have to split their prime factors among a and b.
We must give p1^a1 to at least one of (a, b).
Since we want to minimise the maximum, we will give p1^a1 to one of them and 1 to the other.
In the given range, the number of distinct prime factors is not too much (Around 11).
We will use bitmasks to check how many of the 11 factors we give to a and how many we give to b and choose the best pair.
------
int main()
{
long long n;
cin >> n;
vector <long long> prime_factors;
factorise(n, prime_factors);
long long best_x = 1, best_y = n;
int number_of_uniques = prime_factors.size();
for(long long mask = 0; mask < (1LL << number_of_uniques); mask++)
{
long long x = 1, y = 1;
for(int bit = 0; bit < number_of_uniques; bit++)
{
if(is_bit_set(mask, bit))
{
x *= prime_factors[bit];
}
else
{
y *= prime_factors[bit];
}
}
if(max(x, y) < max(best_x, best_y))
{
best_x = x;
best_y = y;
}
}
cout << best_x << " " << best_y << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/613 Div 2/Explanations/Just Eat It Explanation.txt
================================================
We will use Kandane's Algorithm to find out the best segment that can be chosen at each point.
The only exception is when we are at the last element.
We have to be careful that the segment we are choosing at the last element is not the entire array.
We will check that if we are at the last element, the best segment sum is not the entire prefix sum.
The only way we are allowed to take a sum = the entire prefix sum at i = n is if there is some point where prefix[i] = 0
Then, prefix[n] - prefix[i] = prefix[n]
------
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <long long> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
int is_zero = false;
vector <long long> prefix_sum(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
prefix_sum[i] = A[i] + prefix_sum[i - 1];
if(prefix_sum[i] == 0)
{
is_zero = true;
}
}
long long best_choice = -1e10;
vector <long long> max_sum(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
max_sum[i] = max(A[i], A[i] + max_sum[i - 1]);
if(i == no_of_elements && max_sum[i] == prefix_sum[i] && is_zero == false)
{
continue;
}
best_choice = max(best_choice, max_sum[i]);
}
cout << (prefix_sum[no_of_elements] > best_choice ? "YES\n" : "NO\n");
}
================================================
FILE: 2020/Div 2/613 Div 2/Explanations/Mezo Playing Zoma Explanation.txt
================================================
If there are L lefts and R rights, then we can end up anywhere between [-L, R]
The answer = (L + R + 1)
------
int main()
{
int length;
string S;
cin >> length >> S;
int lefts = 0, rights = 0;
for(int i = 0; i < length; i++)
{
switch(S[i])
{
case 'L' : lefts++; break;
case 'R' : rights++; break;
}
}
int answer = (lefts + rights + 1);
cout << answer << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/613 Div 2/Programs/Dr Evil Underscores.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
int is_bit_set(long long n, int bit)
{
return ( (n&(1LL << bit)) != 0 );
}
long long solve(int bit, vector <long long> &A)
{
if(bit < 0 || A.size() == 0)
{
return 0;
}
vector <long long> set, unset;
for(int i = 0; i < A.size(); i++)
{
if(is_bit_set(A[i], bit))
{
set.push_back(A[i]);
}
else
{
unset.push_back(A[i]);
}
}
if(set.size() == 0)
{
return solve(bit - 1, unset);
}
if(unset.size() == 0)
{
return solve(bit - 1, set);
}
return ( (1LL << bit) + min(solve(bit - 1, set), solve(bit - 1, unset)) );
}
int main()
{
int no_of_elements;
cin >> no_of_elements;
vector <long long> A(no_of_elements);
for(int i = 0; i < no_of_elements; i++)
{
cin >> A[i];
}
long long answer = solve(31, A);
cout << answer << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/613 Div 2/Programs/Fadi and LCM.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
int is_bit_set(long long n, int bit)
{
return ( ( n&(1LL << bit) ) != 0);
}
void factorise(long long x, vector <long long> &P)
{
for(long long i = 2; i*i <= x; i++)
{
if(x%i == 0)
{
long long p = 1;
while(x%i == 0)
{
x /= i;
p *= i;
}
P.push_back(p);
}
}
if(x > 1)
{
P.push_back(x);
}
}
int main()
{
long long n;
cin >> n;
vector <long long> prime_factors;
factorise(n, prime_factors);
long long best_x = 1, best_y = n;
int number_of_uniques = prime_factors.size();
for(long long mask = 0; mask < (1LL << number_of_uniques); mask++)
{
long long x = 1, y = 1;
for(int bit = 0; bit < number_of_uniques; bit++)
{
if(is_bit_set(mask, bit))
{
x *= prime_factors[bit];
}
else
{
y *= prime_factors[bit];
}
}
if(max(x, y) < max(best_x, best_y))
{
best_x = x;
best_y = y;
}
}
cout << best_x << " " << best_y << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/613 Div 2/Programs/Just Eat It.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <long long> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
int is_zero = false;
vector <long long> prefix_sum(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
prefix_sum[i] = A[i] + prefix_sum[i - 1];
if(prefix_sum[i] == 0)
{
is_zero = true;
}
}
long long best_choice = -1e10;
vector <long long> max_sum(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
max_sum[i] = max(A[i], A[i] + max_sum[i - 1]);
if(i == no_of_elements && max_sum[i] == prefix_sum[i] && is_zero == false)
{
continue;
}
best_choice = max(best_choice, max_sum[i]);
}
cout << (prefix_sum[no_of_elements] > best_choice ? "YES\n" : "NO\n");
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/613 Div 2/Programs/Mezo Playing Zoma.cpp
================================================
#include <iostream>
using namespace std;
int main()
{
int length;
string S;
cin >> length >> S;
int lefts = 0, rights = 0;
for(int i = 0; i < length; i++)
{
switch(S[i])
{
case 'L' : lefts++; break;
case 'R' : rights++; break;
}
}
int answer = (lefts + rights + 1);
cout << answer << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/616 Div 2/Explanations/Array Sharpening Explanation.txt
================================================
Let us make an observation here
If it is possible to make (A[1] < A[2] < A[3] < ... < A[k]),
then it is possible to make them = (0 < 1 < 2 < ... < (k - 1))
We can do this by simply subtracting more.
Let prefix[i] = true, if it is possible to make [1, i] = (0, 1, ... , i - 1)
Let suffix[i] = true, if it is possible to make [i, n] = (n - i, ... , 2, 1, 0)
We will then go through the entire array and see if we can find an i such that
prefix[i - 1] = true and suffix[i + 1] = true and A[i] >= max(i - 1, n - i)
Then, we have got our array if even there is a single i that satisfies this condition !
-----
#include <iostream>
#include <vector>
using namespace std;
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
vector <int> prefix_possible(no_of_elements + 1, false);
for(int i = 1; i <= no_of_elements; i++)
{
if(A[i] < i - 1)
{
break;
}
prefix_possible[i] = true;
}
vector <int> suffix_possible(no_of_elements + 1, false);
for(int i = no_of_elements; i >= 1; i--)
{
if(A[i] < (no_of_elements - i))
{
break;
}
suffix_possible[i] = true;
}
int possible = (no_of_elements == 1 ? true : false);
for(int i = 1; i <= no_of_elements; i++)
{
if(i == 1)
{
if(A[i] >= (no_of_elements - i) && suffix_possible[i + 1])
{
possible = true;
break;
}
}
if(i == no_of_elements)
{
if(A[i] >= (i - 1) && prefix_possible[i - 1])
{
possible = true;
break;
}
}
if(A[i] >= (i - 1) && prefix_possible[i - 1] && A[i] >= (no_of_elements - i) && suffix_possible[i + 1])
{
possible = true;
break;
}
}
cout << (possible ? "Yes\n" : "No\n");
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/616 Div 2/Explanations/Even But Not Even Explanation.txt
================================================
The sum of 2 odd numbers is even.
If there are at least 2 odd numbers, we will print them in order
Otherwise, it is not possible.
-----
void solve()
{
int length;
string S;
cin >> length >> S;
int odd_count = 0;
for(int i = 0; i < length; i++)
{
odd_count += (S[i] - '0')%2;
}
if(odd_count < 2)
{
cout << "-1\n";
return;
}
string answer;
for(int i = 0; i < length && answer.size() < 2; i++)
{
if( (S[i] - '0')%2 == 1)
{
answer += S[i];
}
}
cout << answer << "\n";
}
================================================
FILE: 2020/Div 2/616 Div 2/Explanations/Mind Control Explanation.txt
================================================
1. Suppose there are (k - 1) people in front of you.
Ultimately, we will have p elements taken from the prefix and s elements taken from the suffix where (p + x = k - 1)
2. Suppose we can control C people.
Out of these C people, we will make some of them take the prefix and some of them take the suffix.
Out of the U people we can't control, u people will take the prefix and (U - u) will take the suffix.
3. Let us say we make c people out of C take the prefix.
The U people we can't control will make their choice so as to minimise our sum.
4. We will iterate over all possibilities. We will first fix that we will choose c people to take the prefix and (C - c) to take the suffix.
The U people we can't control will make their choice in such a way as to minimise our sum.
5. We will choose the value of (c, u) that gives us our maximum sum.
-----
void solve()
{
int no_of_elements, position, controlled;
cin >> no_of_elements >> position >> controlled;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
controlled = min(controlled, position - 1);
int uncontrolled = (position - 1) - controlled;
int best_answer = 0;
for(int c = 0; c <= controlled; c++)
{
int best_answer_for_c = 1e9 + 5;
for(int i = 0; i <= uncontrolled; i++)
{
int prefix = c + i, suffix = no_of_elements - (controlled - c) - (uncontrolled - i) + 1;//Last element is n, not (n - 1) so add +1
int answer_here = max(A[prefix + 1], A[suffix - 1]);
best_answer_for_c = min(answer_here, best_answer_for_c);
}
best_answer = max(best_answer, best_answer_for_c);
}
cout << best_answer << "\n";
}
================================================
FILE: 2020/Div 2/616 Div 2/Programs/Array Sharpening.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
vector <int> prefix_possible(no_of_elements + 1, false);
for(int i = 1; i <= no_of_elements; i++)
{
if(A[i] < i - 1)
{
break;
}
prefix_possible[i] = true;
}
vector <int> suffix_possible(no_of_elements + 1, false);
for(int i = no_of_elements; i >= 1; i--)
{
if(A[i] < (no_of_elements - i))
{
break;
}
suffix_possible[i] = true;
}
int possible = (no_of_elements == 1 ? true : false);
for(int i = 1; i <= no_of_elements; i++)
{
if(i == 1)
{
if(A[i] >= (no_of_elements - i) && suffix_possible[i + 1])
{
possible = true;
break;
}
}
if(i == no_of_elements)
{
if(A[i] >= (i - 1) && prefix_possible[i - 1])
{
possible = true;
break;
}
}
if(A[i] >= (i - 1) && prefix_possible[i - 1] && A[i] >= (no_of_elements - i) && suffix_possible[i + 1])
{
possible = true;
break;
}
}
cout << (possible ? "Yes\n" : "No\n");
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/616 Div 2/Programs/Even But Not Even.cpp
================================================
#include <iostream>
using namespace std;
void solve()
{
int length;
string S;
cin >> length >> S;
int odd_count = 0;
for(int i = 0; i < length; i++)
{
odd_count += (S[i] - '0')%2;
}
if(odd_count < 2)
{
cout << "-1\n";
return;
}
string answer;
for(int i = 0; i < length && answer.size() < 2; i++)
{
if( (S[i] - '0')%2 == 1)
{
answer += S[i];
}
}
cout << answer << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/616 Div 2/Programs/Mind Control.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
void solve()
{
int no_of_elements, position, controlled;
cin >> no_of_elements >> position >> controlled;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
controlled = min(controlled, position - 1);
int uncontrolled = (position - 1) - controlled;
int best_answer = 0;
for(int c = 0; c <= controlled; c++)
{
int best_answer_for_c = 1e9 + 5;
for(int i = 0; i <= uncontrolled; i++)
{
int prefix = c + i, suffix = no_of_elements - (controlled - c) - (uncontrolled - i) + 1;//Last element is n, not (n - 1) so add +1
int answer_here = max(A[prefix + 1], A[suffix - 1]);
best_answer_for_c = min(answer_here, best_answer_for_c);
}
best_answer = max(best_answer, best_answer_for_c);
}
cout << best_answer << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/618 Div 2/Explanations/Anu has a Function Explanation.txt
================================================
Observation - f(x, y) will only have the bits that are set in x
Every bit in y is subtracted so we cannot add any new bits to x, by performing f(x, y)
-----
This means that the value of a[1], represents the value of the entire function.
For every A[i], we will calculate the value of the function if we place A[i] at A[1].
The answer will have all the bits set that are set only once in A[i] and not in any other array element.
If any bit is set in some other element A[j], it will get subtracted when we peform f(x, A[j])
-----
#include <iostream>
#include <vector>
using namespace std;
int is_bit_set(long long n, int bit)
{
return ((n & (1LL << bit)) != 0);
}
int main()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
const int NO_OF_BITS = 31;
vector <int> bit_frequency(NO_OF_BITS + 1, 0);
for(int i = 1; i <= no_of_elements; i++)
{
for(int b = 0; b <= NO_OF_BITS; b++)
{
if(is_bit_set(A[i], b))
{
bit_frequency[b]++;
}
}
}
long long answer = 0;
for(int i = 1; i <= no_of_elements; i++)
{
long long answer_here = 0;
for(int b = 0; b <= NO_OF_BITS; b++)
{
if(is_bit_set(A[i], b) && bit_frequency[b] == 1)
{
answer_here |= (1LL << b);
}
}
if(answer_here > answer)
{
swap(A[i], A[1]);
answer = answer_here;
}
}
for(int i = 1; i <= no_of_elements; i++)
{
cout << A[i] << " ";
}
cout << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/618 Div 2/Programs/Anu has a Function.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
int is_bit_set(long long n, int bit)
{
return ((n & (1LL << bit)) != 0);
}
int main()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
const int NO_OF_BITS = 31;
vector <int> bit_frequency(NO_OF_BITS + 1, 0);
for(int i = 1; i <= no_of_elements; i++)
{
for(int b = 0; b <= NO_OF_BITS; b++)
{
if(is_bit_set(A[i], b))
{
bit_frequency[b]++;
}
}
}
long long answer = 0;
for(int i = 1; i <= no_of_elements; i++)
{
long long answer_here = 0;
for(int b = 0; b <= NO_OF_BITS; b++)
{
if(is_bit_set(A[i], b) && bit_frequency[b] == 1)
{
answer_here |= (1LL << b);
}
}
if(answer_here > answer)
{
swap(A[i], A[1]);
answer = answer_here;
}
}
for(int i = 1; i <= no_of_elements; i++)
{
cout << A[i] << " ";
}
cout << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/619 Div 2/Explanations/Ayoub's Function Explanation.txt
================================================
We need to maximise the number of substrings containing at least 1 one.
This is the same as minimizing the number of substrings containing only 0s.
Let us see how to do this with an example.
If we want to minimize the number of 0s,
it is best to make each group of 0s as small as possible.
(2 groups of length 1 is smaller than 1 group of length 2)
0, 0 has 2 substrings
00 has 3 substrings
Suppose we have 10 0s and 5 1s
00 | 00 | 00 | 00 | 0 | 0
The best way to distribute them is like this
If there are d 1s, then we divide the 0s into (D + 1) parts.
----
First, we will divide them equally
0 | 0 | 0 | 0 | 0 | 0
-----
We will have some remainder.
In this case 10 (mod 6) = 4
So, we will add the 4 extra 0s to different parts to keep the sum of 0s minimum
So 4 segments, will have an extra 0
-----
How to calculate this ?
1. Find out the length of each 0 segment. The number of 0 substrings will be
l(l - 1)/2 + l
2. When we add a 0 to a segment of length z, we will be create (z + 1) new 0-substrings
Each remainder contributes (z + 1) to the answer, where z is the length of a 0-substring
----
long long count_substrings(long long n)
{
return (n*(n + 1))/2;
}
void solve()
{
long long length, no_of_1s;
cin >> length >> no_of_1s;
long long no_of_0s = (length - no_of_1s);
long long total_substrings = count_substrings(length);
long long dividers = (no_of_1s + 1);
long long full_zero_islands_size = (no_of_0s/dividers);
long long zero_substrings = dividers*count_substrings(full_zero_islands_size);
if(no_of_0s%dividers != 0)
{
long long remaining_zeroes = no_of_0s - dividers*(full_zero_islands_size);
zero_substrings += remaining_zeroes*(full_zero_islands_size + 1);
}
long long one_substrings = total_substrings - zero_substrings;
cout << one_substrings << "\n";
}
================================================
FILE: 2020/Div 2/619 Div 2/Explanations/Motarack's Birthday Explanation.txt
================================================
Let us look at the elements which -1 is adjacent to.
Let them be {F1, F2, ... , Fm}
The maximum value of |k - Fi| for some Fi in this set will be either
with the smallest or largest element.
So, the best choice for k is (F1 + Fm)/2 as this is the optimal distance between both
After we replace all k's with (F1 + Fm)/2, we will calculate the value of max|A[i] - A[i - 1]|
-----
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <long long> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
vector <long long> fixed;
for(int i = 2; i <= no_of_elements; i++)
{
if(A[i - 1] == -1 && A[i] != -1)
{
fixed.push_back(A[i]);
}
}
for(int i = 1; i < no_of_elements; i++)
{
if(A[i + 1] == -1 && A[i] != -1)
{
fixed.push_back(A[i]);
}
}
sort(all(fixed));
long long mid;
if(fixed.size() == 0)
{
mid = 0;
}
else
{
mid = (fixed[0] + fixed.back())/2;
}
for(int i = 1; i <= no_of_elements; i++)
{
if(A[i] == -1)
{
A[i] = mid;
}
}
long long m = 0;
for(int i = 2; i <= no_of_elements; i++)
{
m = max(m, abs(A[i] - A[i - 1]));
}
cout << m << " " << mid << "\n";
}
================================================
FILE: 2020/Div 2/619 Div 2/Explanations/Three Strings Explanation.txt
================================================
For each position i,
We must swap either (A[i], C[i]) or (B[i], C[i])
This means that either (B[i] = C[i]) or (A[i] = C[i]) respectively
-----
void solve()
{
string A, B, C;
cin >> A >> B >> C;
for(int i = 0; i < A.size(); i++)
{
if(A[i] == C[i] || B[i] == C[i])
{
continue;
}
cout << "NO\n";
return;
}
cout << "YES\n";
}
================================================
FILE: 2020/Div 2/619 Div 2/Explanations/Time to Run Explanation.txt
================================================
We will start from (1, 1)
In any given row, we will go left till we reach the end of that row.
Then, we will go UDR, till we reach the first cell of the row.
Then, we will go to the next row and repeat.
If we are at the last row, then we will go U till we reach (1, 1).
-----
int range(int max_1, int distance, int size, int &steps)
{
int taken;
if(distance*size <= steps)
{
taken = distance;
}
else
{
taken = steps/size;
}
steps -= taken*size;
return taken;
}
int main()
{
int rows, columns, steps;
cin >> rows >> columns >> steps;
if(steps > 4*rows*columns - 2*rows - 2*columns)
{
cout << "NO\n";
return 0;
}
cout << "YES\n";
vector < pair <int, string> > journey;
for(int r = 1; r <= rows && steps > 0; r++)
{
int steps_taken;
steps_taken = range(steps, columns - 1, 1, steps);
if(steps_taken > 0)
{
journey.push_back(make_pair(steps_taken, "R"));
}
if(r < rows)
{
steps_taken = range(steps, columns - 1, 3, steps);
if(steps_taken > 0)
{
journey.push_back(make_pair(steps_taken, "DUL"));
}
if(steps_taken < columns - 1 && steps < 3 && steps > 0)
{
switch(steps)
{
case 2 : journey.push_back(make_pair(1, "DU")); steps -= 2; break;
case 1 : journey.push_back(make_pair(1, "D")); steps--; break;
}
}
if(steps > 0)
{
journey.push_back(make_pair(1, "D"));
steps--;
}
continue;
}
if(r == rows)
{
steps_taken = range(steps, columns - 1, 1, steps);
if(steps_taken > 0)
{
journey.push_back(make_pair(steps_taken, "L"));
}
if(steps > 0)
{
steps_taken = range(steps, rows - 1, 1, steps);
journey.push_back(make_pair(steps_taken, "U"));
}
}
}
cout << journey.size() << "\n";
for(int i = 0; i < journey.size(); i++)
{
cout << journey[i].first << " " << journey[i].second << "\n";
}
return 0;
}
================================================
FILE: 2020/Div 2/619 Div 2/Programs/Ayoub's Function.cpp
================================================
#include <iostream>
#include <vector>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
long long count_substrings(long long n)
{
return (n*(n + 1))/2;
}
void solve()
{
long long length, no_of_1s;
cin >> length >> no_of_1s;
long long no_of_0s = (length - no_of_1s);
long long total_substrings = count_substrings(length);
long long dividers = (no_of_1s + 1);
long long full_zero_islands_size = (no_of_0s/dividers);
long long zero_substrings = dividers*count_substrings(full_zero_islands_size);
if(no_of_0s%dividers != 0)
{
long long remaining_zeroes = no_of_0s - dividers*(full_zero_islands_size);
zero_substrings += remaining_zeroes*(full_zero_islands_size + 1);
}
long long one_substrings = total_substrings - zero_substrings;
cout << one_substrings << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/619 Div 2/Programs/Motarack's Birthday.cpp
================================================
#include <iostream>
#include <vector>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <long long> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
vector <long long> fixed;
for(int i = 2; i <= no_of_elements; i++)
{
if(A[i - 1] == -1 && A[i] != -1)
{
fixed.push_back(A[i]);
}
}
for(int i = 1; i < no_of_elements; i++)
{
if(A[i + 1] == -1 && A[i] != -1)
{
fixed.push_back(A[i]);
}
}
sort(all(fixed));
long long mid;
if(fixed.size() == 0)
{
mid = 0;
}
else
{
mid = (fixed[0] + fixed.back())/2;
}
for(int i = 1; i <= no_of_elements; i++)
{
if(A[i] == -1)
{
A[i] = mid;
}
}
long long m = 0;
for(int i = 2; i <= no_of_elements; i++)
{
m = max(m, abs(A[i] - A[i - 1]));
}
cout << m << " " << mid << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/619 Div 2/Programs/Three Strings.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
void solve()
{
string A, B, C;
cin >> A >> B >> C;
for(int i = 0; i < A.size(); i++)
{
if(A[i] == C[i] || B[i] == C[i])
{
continue;
}
cout << "NO\n";
return;
}
cout << "YES\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/619 Div 2/Programs/Time to Run.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
int range(int max_1, int distance, int size, int &steps)
{
int taken;
if(distance*size <= steps)
{
taken = distance;
}
else
{
taken = steps/size;
}
steps -= taken*size;
return taken;
}
int main()
{
int rows, columns, steps;
cin >> rows >> columns >> steps;
if(steps > 4*rows*columns - 2*rows - 2*columns)
{
cout << "NO\n";
return 0;
}
cout << "YES\n";
vector < pair <int, string> > journey;
for(int r = 1; r <= rows && steps > 0; r++)
{
int steps_taken;
steps_taken = range(steps, columns - 1, 1, steps);
if(steps_taken > 0)
{
journey.push_back(make_pair(steps_taken, "R"));
}
if(r < rows)
{
steps_taken = range(steps, columns - 1, 3, steps);
if(steps_taken > 0)
{
journey.push_back(make_pair(steps_taken, "DUL"));
}
if(steps_taken < columns - 1 && steps < 3 && steps > 0)
{
switch(steps)
{
case 2 : journey.push_back(make_pair(1, "DU")); steps -= 2; break;
case 1 : journey.push_back(make_pair(1, "D")); steps--; break;
}
}
if(steps > 0)
{
journey.push_back(make_pair(1, "D"));
steps--;
}
continue;
}
if(r == rows)
{
steps_taken = range(steps, columns - 1, 1, steps);
if(steps_taken > 0)
{
journey.push_back(make_pair(steps_taken, "L"));
}
if(steps > 0)
{
steps_taken = range(steps, rows - 1, 1, steps);
journey.push_back(make_pair(steps_taken, "U"));
}
}
}
cout << journey.size() << "\n";
for(int i = 0; i < journey.size(); i++)
{
cout << journey[i].first << " " << journey[i].second << "\n";
}
return 0;
}
================================================
FILE: 2020/Div 2/620 Div 2/Explanations/1-Trees and Queries Explanation.txt
================================================
There is a crucial insight that we can make here.
We can make a 'waiting' move.
After we travel from a -> b, we can keep going back and forth on the same edge.
b-> c -> b
We can keep going back and forth to one of the neighbours of b.
This way, we can make an unlimited number of moves !
----
Suppose we have a path of length L.
There is a path of length (L + 2X) for every integer X.
----
Now, there are 3 Simple Paths from (a, b)
1. a -> b
2. a -> x -> y -> b
3. a -> y -> x -> b
----
If any of these path lengths <= k and have the same parity as k,
then we can use the required number of waiting moves to go from (a, b) and
use exactly k moves.
----
We can use LCA to calculate the distance between 2 vertices.
We can do O(N Log N) precompute and answer each query in O(Log N) time.
-----
int main()
{
int no_of_vertices;
cin >> no_of_vertices;
int no_of_edges = no_of_vertices - 1;
for(int i = 1; i <= no_of_edges; i++)
{
int u, v;
cin >> u >> v;
tree[u].push_back(v);
tree[v].push_back(u);
}
depth[0] = 0;
dfs(1, 0);
precompute_parents(no_of_vertices);
int no_of_queries;
cin >> no_of_queries;
for(int i = 1; i <= no_of_queries; i++)
{
int x, y, a, b, k;
cin >> x >> y >> a >> b >> k;
int path_1 = distance(a, b);
int path_2 = distance(a, x) + distance(b, y) + 1;
int path_3 = distance(a, y) + distance(b, x) + 1;
if( (path_1 <= k && path_1%2 == k%2) ||
(path_2 <= k && path_2%2 == k%2) ||
(path_3 <= k && path_3%2 == k%2) )
{
cout << "YES\n";
}
else
{
cout << "NO\n";
}
}
return 0;
}
================================================
FILE: 2020/Div 2/620 Div 2/Explanations/Air Conditioner Explanation.txt
================================================
We can interpret this problem geometrically and it would help greatly.
Let us visualise the time on the y-axis and the temperature on the x axis.
We are given a set of segments and we must determine if it is possible to draw
a line that passes through each of them.
Instead of keeping track of a line, we will keep track of the possible range of the line.
Let the line always lie between [A, B] on the x axis.
In the time between two events, the minimum can reduce by at most (T[i] - T[i - 1])
and the maximum can reduce by at most (T[i] - T[i - 1])
However, we have to be careful of one thing.
The minimum range of the line cannot be lesser than the Left boundary of any event.
The maximum range of the line cannot be greater than the Right boundary of any event.
So at every point, we just have to update the minimum and maximum range of the line.
We are keeping the range as large as possible at every step.
If a line exists, it has to do so within this range.
The beauty of this approach is that we don't have to find the actual line. Just knowing it's range is enough. :)
-----
struct customer
{
int time, left, right;
customer(){}
customer(int T, int L, int R)
{
time = T; left = L; right = R;
}
};
int sort_by_time(customer &A, customer &B)
{
if(A.time == B.time)
{
return (A.left < B.left);
}
return (A.time < B.time);
}
void solve()
{
int no_of_customers, starting;
cin >> no_of_customers >> starting;
vector <customer> C(no_of_customers, customer(0, 0, 0));
for(int i = 0; i < no_of_customers; i++)
{
cin >> C[i].time >> C[i].left >> C[i].right;
}
sort(all(C), sort_by_time);
int minimum = starting, maximum = starting;
int possible = true;
for(int i = 0; i < no_of_customers && possible; i++)
{
if(i == 0)
{
minimum = starting - C[i].time;
maximum = starting + C[i].time;
}
else
{
minimum = minimum - (C[i].time - C[i - 1].time);
maximum = maximum + (C[i].time - C[i - 1].time);
}
if(minimum > C[i].right || maximum < C[i].left)
{
possible = false;
break;
}
minimum = max(minimum, C[i].left);
maximum = min(maximum, C[i].right);
}
cout << (possible ? "YES\n" : "NO\n");
}
================================================
FILE: 2020/Div 2/620 Div 2/Explanations/Longest Palindrome Explanation.txt
================================================
Let R[S] be the reverse of string S
The final palindrome looks like this
S1 S2 S3 ... Sm (M)R[Sm] ... R[S3]R[S2]R[S1]
And M is a palindrome that can be placed in the middle.
The constraints are small enough that we can check every pair of strings.
For each string S[i], we will check if it's reverse R(S[i]) is also present in the array.
We will store all the strings in one vector and all their reverses in another vector.
Suppose S[i] is the 3rd string in the list of strings we will print,
then R(S[i]) is the 3rd last string that we need to print.
Lastly, we can have at most 1 palindromic string in the middle.
We will check if any of the strings are palindromes.
If they are, we will use one in the middle.
-----
int main()
{
int no_of_strings, length;
cin >> no_of_strings >> length;
vector <string> S(no_of_strings + 1);
for(int i = 1; i <= no_of_strings; i++)
{
cin >> S[i];
}
vector <int> strings_index;
vector <int> reverse_strings_index;
for(int i = 1; i <= no_of_strings; i++)
{
for(int j = i + 1; j <= no_of_strings; j++)
{
if(is_palindrome(S[i] + S[j]))
{
strings_index.push_back(i);
reverse_strings_index.push_back(j);
}
}
}
string middle;
for(int i = 1; i <= no_of_strings; i++)
{
if(is_palindrome(S[i]))
{
middle = S[i];
}
}
int final_length = strings_index.size() + (middle.size() != 0) + reverse_strings_index.size();
final_length *= length;
cout << final_length << "\n";
for(int i = 0; i < strings_index.size(); i++)
{
cout << S[strings_index[i]];
}
if(middle.size() != 0)
{
cout << middle;
}
for(int i = reverse_strings_index.size() - 1; i >= 0; i--)
{
cout << S[reverse_strings_index[i]];
}
cout << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/620 Div 2/Explanations/Shortest and Longest LIS Explanation.txt
================================================
1. If we want to make the shortest LIS possible, we must make sure 1 comes as late as possible as it matches with every element. Then, 2 must come as much to the right as possible and so on.
2. We will start from the right end and whenever a sequence of <<< is there, we will start filling from 1, 2, 3
3. For making the longest LIS possible, we will fill each digit as much to the left as possible to ensure it has as many digits as possible to match. So, we will start from the left and fill <<< 1,2,3
-----
#include <iostream>
#include <vector>
using namespace std;
void solve()
{
int length;
string S;
cin >> length >> S;
vector <int> longest_chain_from(length + 1, 1);
for(int i = length - 1; i >= 1; i--)
{
if(S[i - 1] == '<')
{
longest_chain_from[i] = 1 + longest_chain_from[i + 1];
}
}
vector <int> shortest_lis(length + 1);
for(int i = length, last = 1; i >= 1; last++)
{
int j = i;
for(j = i; j >= 1 && longest_chain_from[j] + 1 == longest_chain_from[j - 1]; j--)
{ //cout << "J = " << j << "\n";
last++;
}
shortest_lis[i] = last;
//cout << "J = " << j << " i = " << i << "\n";
for(int k = i - 1; k >= j; k--)
{
shortest_lis[k] = shortest_lis[k + 1] - 1;
}
i = j - 1;
}
for(int i = 1; i <= length; i++)
{
cout << shortest_lis[i] << " ";
}
cout << "\n";
vector <int> longest_lis(length + 1);
for(int i = 1, last = 1; i <= length; i++, last++)
{
int j = i;
for(j = i; (j <= length - 1 && S[j - 1] == '>'); j++)
{
last++;
}
//cout << "J = " << j << "\n";
longest_lis[i] = last;
for(int k = i + 1; k <= j; k++)
{
longest_lis[k] = longest_lis[k - 1] - 1;
}
i = j;
}
for(int i = 1; i <= length; i++)
{
cout << longest_lis[i] << " ";
}
cout << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/620 Div 2/Explanations/Two Rabbits Explanation.txt
================================================
There are two rabbits.
The distance between them reduces by (a + b)
in 1 second.
The total distance to be covered is (x - y).
The rabbits will meet if (x - y) is a multiple of (a + b).
Otherwise, they will never complement
-----
void solve()
{
long long position_1, position_2, distance_1, distance_2;
cin >> position_1 >> position_2 >> distance_1 >> distance_2;
long long time = ((position_2 - position_1)%(distance_1 + distance_2) == 0 ? (position_2 - position_1)/(distance_1 + distance_2) : -1);
cout << time << "\n";
}
================================================
FILE: 2020/Div 2/620 Div 2/Programs/1-Trees and Queries.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
const int MAX_N = 1e5 + 5, MAX_L = 25;
vector <int> tree[MAX_N];
int parent[MAX_N][MAX_L], depth[MAX_N];
int is_bit_set(long long n, int bit)
{
return ( (n&(1LL << bit)) != 0);
}
void dfs(int v, int parent_v)
{
parent[v][0] = parent_v;
depth[v] = depth[parent_v] + 1;
for(int i = 0; i < tree[v].size(); i++)
{
int child_v = tree[v][i];
if(child_v == parent_v)
{
continue;
}
dfs(child_v, v);
}
}
void precompute_parents(int no_of_vertices)
{
for(int l = 1; l < MAX_L; l++)
{
for(int v = 1; v <= no_of_vertices; v++)
{
int ancestor = parent[v][l - 1];
parent[v][l] = parent[ancestor][l - 1];
}
}
}
int LCA(int u, int v)
{
if(depth[v] < depth[u])
{
swap(u, v);
}
int difference = depth[v] - depth[u];
for(int i = MAX_L - 1; i >= 0; i--)
{
if(is_bit_set(difference, i))
{
v = parent[v][i];
}
}
if(u == v)
{
return v;
}
for(int i = MAX_L - 1; i >= 0; i--)
{
if(parent[v][i] != parent[u][i])
{
v = parent[v][i];
u = parent[u][i];
}
}
return parent[v][0];
}
int distance(int u, int v)
{
int l = LCA(u, v);
if(l == u)
{
return (depth[v] - depth[l]);
}
if(l == v)
{
return (depth[u] - depth[l]);
}
return (depth[v] - depth[l]) + (depth[u] - depth[l]);
}
int main()
{
int no_of_vertices;
cin >> no_of_vertices;
int no_of_edges = no_of_vertices - 1;
for(int i = 1; i <= no_of_edges; i++)
{
int u, v;
cin >> u >> v;
tree[u].push_back(v);
tree[v].push_back(u);
}
depth[0] = 0;
dfs(1, 0);
precompute_parents(no_of_vertices);
int no_of_queries;
cin >> no_of_queries;
for(int i = 1; i <= no_of_queries; i++)
{
int x, y, a, b, k;
cin >> x >> y >> a >> b >> k;
int path_1 = distance(a, b);
int path_2 = distance(a, x) + distance(b, y) + 1;
int path_3 = distance(a, y) + distance(b, x) + 1;
if( (path_1 <= k && path_1%2 == k%2) ||
(path_2 <= k && path_2%2 == k%2) ||
(path_3 <= k && path_3%2 == k%2) )
{
cout << "YES\n";
}
else
{
cout << "NO\n";
}
}
return 0;
}
================================================
FILE: 2020/Div 2/620 Div 2/Programs/Air Conditioner.cpp
================================================
#include <iostream>
#include <vector>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
struct customer
{
int time, left, right;
customer(){}
customer(int T, int L, int R)
{
time = T; left = L; right = R;
}
};
int sort_by_time(customer &A, customer &B)
{
if(A.time == B.time)
{
return (A.left < B.left);
}
return (A.time < B.time);
}
void solve()
{
int no_of_customers, starting;
cin >> no_of_customers >> starting;
vector <customer> C(no_of_customers, customer(0, 0, 0));
for(int i = 0; i < no_of_customers; i++)
{
cin >> C[i].time >> C[i].left >> C[i].right;
}
sort(all(C), sort_by_time);
int minimum = starting, maximum = starting;
int possible = true;
for(int i = 0; i < no_of_customers && possible; i++)
{
if(i == 0)
{
minimum = starting - C[i].time;
maximum = starting + C[i].time;
}
else
{
minimum = minimum - (C[i].time - C[i - 1].time);
maximum = maximum + (C[i].time - C[i - 1].time);
}
if(minimum > C[i].right || maximum < C[i].left)
{
possible = false;
break;
}
minimum = max(minimum, C[i].left);
maximum = min(maximum, C[i].right);
}
cout << (possible ? "YES\n" : "NO\n");
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/620 Div 2/Programs/Longest Palindrome.cpp
================================================
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#define all(v) (v).begin(), (v).end()
using namespace std;
int is_palindrome(string S)
{
for(int i = 0; i < S.size(); i++)
{
if(S[i] != S[S.size() - 1 - i])
{
return false;
}
}
return true;
}
int main()
{
int no_of_strings, length;
cin >> no_of_strings >> length;
vector <string> S(no_of_strings + 1);
for(int i = 1; i <= no_of_strings; i++)
{
cin >> S[i];
}
vector <int> strings_index;
vector <int> reverse_strings_index;
for(int i = 1; i <= no_of_strings; i++)
{
for(int j = i + 1; j <= no_of_strings; j++)
{
if(is_palindrome(S[i] + S[j]))
{
strings_index.push_back(i);
reverse_strings_index.push_back(j);
}
}
}
string middle;
for(int i = 1; i <= no_of_strings; i++)
{
if(is_palindrome(S[i]))
{
middle = S[i];
}
}
int final_length = strings_index.size() + (middle.size() != 0) + reverse_strings_index.size();
final_length *= length;
cout << final_length << "\n";
for(int i = 0; i < strings_index.size(); i++)
{
cout << S[strings_index[i]];
}
if(middle.size() != 0)
{
cout << middle;
}
for(int i = reverse_strings_index.size() - 1; i >= 0; i--)
{
cout << S[reverse_strings_index[i]];
}
cout << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/620 Div 2/Programs/Shortest and Longest LIS.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
void solve()
{
int length;
string S;
cin >> length >> S;
vector <int> longest_chain_from(length + 1, 1);
for(int i = length - 1; i >= 1; i--)
{
if(S[i - 1] == '<')
{
longest_chain_from[i] = 1 + longest_chain_from[i + 1];
}
}
vector <int> shortest_lis(length + 1);
for(int i = length, last = 1; i >= 1; last++)
{
int j = i;
for(j = i; j >= 1 && longest_chain_from[j] + 1 == longest_chain_from[j - 1]; j--)
{ //cout << "J = " << j << "\n";
last++;
}
shortest_lis[i] = last;
//cout << "J = " << j << " i = " << i << "\n";
for(int k = i - 1; k >= j; k--)
{
shortest_lis[k] = shortest_lis[k + 1] - 1;
}
i = j - 1;
}
for(int i = 1; i <= length; i++)
{
cout << shortest_lis[i] << " ";
}
cout << "\n";
vector <int> longest_lis(length + 1);
for(int i = 1, last = 1; i <= length; i++, last++)
{
int j = i;
for(j = i; (j <= length - 1 && S[j - 1] == '>'); j++)
{
last++;
}
//cout << "J = " << j << "\n";
longest_lis[i] = last;
for(int k = i + 1; k <= j; k++)
{
longest_lis[k] = longest_lis[k - 1] - 1;
}
i = j;
}
for(int i = 1; i <= length; i++)
{
cout << longest_lis[i] << " ";
}
cout << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/620 Div 2/Programs/Two Rabbits.cpp
================================================
#include <iostream>
using namespace std;
void solve()
{
long long position_1, position_2, distance_1, distance_2;
cin >> position_1 >> position_2 >> distance_1 >> distance_2;
long long time = ((position_2 - position_1)%(distance_1 + distance_2) == 0 ? (position_2 - position_1)/(distance_1 + distance_2) : -1);
cout << time << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/622 Div 2/Explanations/Fast Food Restaurant Explanation.txt
================================================
We will have a bitmask corresponding to each possibility.
Here is our strategy
001
010
100
011
101
110
111
-----
So, we will go through all the submasks and find out which masks correspond to
possible meals.
-----
void solve()
{
const int NO_OF_FOOD = 3;
vector <int> portions(NO_OF_FOOD);
for(int i = 0; i < NO_OF_FOOD; i++)
{
cin >> portions[i];
}
sort(all(portions));
reverse(all(portions));
int max_mask = (1 << NO_OF_FOOD);
int no_of_meals = 0;
for(int m = 1; m < max_mask; m++)
{
int good_mask = true;
for(int i = 0; i < NO_OF_FOOD; i++)
{
if(is_bit_set(m, i) && portions[i] <= 0)
{ //cout << "No " << i << "\n";
good_mask = false;
}
}
//cout << "Mask = " << m << "\n";
if(!good_mask)
{
continue;
}
//cout << "Good \n";
for(int i = 0; i < NO_OF_FOOD; i++)
{
if(is_bit_set(m, i))
{
portions[i]--;
}
}
no_of_meals++;
}
cout << no_of_meals << "\n";
}
================================================
FILE: 2020/Div 2/622 Div 2/Explanations/Sky Scrapers (Hard Version) Explanation.txt
================================================
This is the same as the Easy Version
For every A[i], we will calculate the total height if this were the peak.
Here, is what we will do if A[i] is the peak
We will make all A[j] = A[i], where j < i and A[j] >= A[i]
till we find a j such that A[j] < A[i]
We will do the same in both the left and right directions.
-----
For every A[i], we need to find the first j, such that A[j] < A[i]
We can do this with a Stack in O(1) time
1. Initially Stack is empty
2. When we reach A[i], we will pop all elements from the stack
as long as A[stack.top()] >= A[i]
3. Then, stack.top() will be the nearest element < A[i]
And we will put A[i] in the stack after this
This is optimal for the future steps as well.
-----
int main()
{
int no_of_plots;
cin >> no_of_plots;
vector <long long> max_height(no_of_plots + 5);
for(int i = 1; i <= no_of_plots; i++)
{
cin >> max_height[i];
}
stack <long long> greater_than;
greater_than.push(0);
vector <long long> left_contribution(no_of_plots + 1);
for(int i = 1; i <= no_of_plots; i++)
{
while(max_height[greater_than.top()] > max_height[i])
{
greater_than.pop();
}
left_contribution[i] = max_height[i]*(i - greater_than.top()) + left_contribution[greater_than.top()];
//cout << "Left " << i << " = " << left_contribution[i] << "\n";
greater_than.push(i);
}
greater_than.pop();
greater_than.push(no_of_plots + 1);
vector <long long> right_contribution(no_of_plots + 5);
for(int i = no_of_plots; i >= 1; i--)
{
while(max_height[greater_than.top()] > max_height[i])
{
greater_than.pop();
}
right_contribution[i] = max_height[i]*(greater_than.top() - i) + right_contribution[greater_than.top()];
greater_than.push(i);
//cout << "Right " << i << " = " << right_contribution[i] << "\n";
}
long long answer = 0;
for(int i = 1; i <= no_of_plots; i++)
{
answer = max(answer, left_contribution[i] + right_contribution[i] - max_height[i]);
}
//cout << answer << "\n";
int peak = 0;
for(int i = 1; i <= no_of_plots; i++)
{
if(answer == left_contribution[i] + right_contribution[i] - max_height[i])
{
peak = i;
break;
}
}
vector <long long> height(no_of_plots + 1);
height[peak] = max_height[peak];
for(int i = peak - 1; i >= 1; i--)
{
height[i] = min(max_height[i], height[i + 1]);
}
for(int i = peak + 1;i <= no_of_plots; i++)
{
height[i] = min(max_height[i], height[i - 1]);
}
for(int i = 1; i <= no_of_plots; i++)
{
cout << height[i] << " ";
}
cout <<"\n";
return 0;
}
================================================
FILE: 2020/Div 2/622 Div 2/Explanations/Skyscrapers (Easy Version) Explanation.txt
================================================
The array will be ascending for some time and then descending.
We will iterate over all N plots and find the total if the i-th plot is the peak.
-----
long long count(int P, vector <int> &limit, vector <int> &A)
{
A[P] = limit[P];
for(int i = P - 1; i >= 1; i--)
{
A[i] = min(limit[i], A[i + 1]);
}
for(int i = P + 1; i < limit.size(); i++)
{
A[i] = min(limit[i], A[i - 1]);
}
long long total = 0;
for(int i = 1; i < limit.size(); i++)
{
total += A[i];
}
return total;
}
int main()
{
int no_of_plots;
cin >> no_of_plots;
vector <int> max_height(no_of_plots + 1);
for(int i = 1; i <= no_of_plots; i++)
{
cin >> max_height[i];
}
long long max_count = 0;
vector <int> answer(no_of_plots + 1);
vector <int> this_answer(no_of_plots + 1);
for(int peak = 1; peak <= no_of_plots; peak++)
{
if(count(peak, max_height, this_answer) > max_count)
{
max_count = count(peak, max_height, this_answer);
answer = this_answer;
}
}
for(int i = 1; i <= no_of_plots; i++)
{
cout << answer[i] << " ";
}
cout << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/622 Div 2/Programs/Fast Food Restaurants.cpp
================================================
#include <iostream>
#include <vector>
#include <algorithm>
#define all(v) (v).begin(), (v).end()
using namespace std;
int is_bit_set(int n, int bit)
{
return ( (n&(1 << bit)) != 0) ;
}
void solve()
{
const int NO_OF_FOOD = 3;
vector <int> portions(NO_OF_FOOD);
for(int i = 0; i < NO_OF_FOOD; i++)
{
cin >> portions[i];
}
sort(all(portions));
reverse(all(portions));
int max_mask = (1 << NO_OF_FOOD);
int no_of_meals = 0;
for(int m = 1; m < max_mask; m++)
{
int good_mask = true;
for(int i = 0; i < NO_OF_FOOD; i++)
{
if(is_bit_set(m, i) && portions[i] <= 0)
{
good_mask = false;
}
}
if(!good_mask)
{
continue;
}
for(int i = 0; i < NO_OF_FOOD; i++)
{
if(is_bit_set(m, i))
{
portions[i]--;
}
}
no_of_meals++;
}
cout << no_of_meals << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/622 Div 2/Programs/Skyscrapers (Easy Version).cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
long long count(int P, vector <int> &limit, vector <int> &A)
{
A[P] = limit[P];
for(int i = P - 1; i >= 1; i--)
{
A[i] = min(limit[i], A[i + 1]);
}
for(int i = P + 1; i < limit.size(); i++)
{
A[i] = min(limit[i], A[i - 1]);
}
long long total = 0;
for(int i = 1; i < limit.size(); i++)
{
total += A[i];
}
return total;
}
int main()
{
int no_of_plots;
cin >> no_of_plots;
vector <int> max_height(no_of_plots + 1);
for(int i = 1; i <= no_of_plots; i++)
{
cin >> max_height[i];
}
long long max_count = 0;
vector <int> answer(no_of_plots + 1);
vector <int> this_answer(no_of_plots + 1);
for(int peak = 1; peak <= no_of_plots; peak++)
{
if(count(peak, max_height, this_answer) > max_count)
{
max_count = count(peak, max_height, this_answer);
answer = this_answer;
}
}
for(int i = 1; i <= no_of_plots; i++)
{
cout << answer[i] << " ";
}
cout << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/622 Div 2/Programs/Skyscrapers (Hard Version).cpp
================================================
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
int main()
{
int no_of_plots;
cin >> no_of_plots;
vector <long long> max_height(no_of_plots + 5);
for(int i = 1; i <= no_of_plots; i++)
{
cin >> max_height[i];
}
stack <long long> greater_than;
greater_than.push(0);
vector <long long> left_contribution(no_of_plots + 1);
for(int i = 1; i <= no_of_plots; i++)
{
while(max_height[greater_than.top()] > max_height[i])
{
greater_than.pop();
}
left_contribution[i] = max_height[i]*(i - greater_than.top()) + left_contribution[greater_than.top()];
//cout << "Left " << i << " = " << left_contribution[i] << "\n";
greater_than.push(i);
}
greater_than.pop();
greater_than.push(no_of_plots + 1);
vector <long long> right_contribution(no_of_plots + 5);
for(int i = no_of_plots; i >= 1; i--)
{
while(max_height[greater_than.top()] > max_height[i])
{
greater_than.pop();
}
right_contribution[i] = max_height[i]*(greater_than.top() - i) + right_contribution[greater_than.top()];
greater_than.push(i);
//cout << "Right " << i << " = " << right_contribution[i] << "\n";
}
long long answer = 0;
for(int i = 1; i <= no_of_plots; i++)
{
answer = max(answer, left_contribution[i] + right_contribution[i] - max_height[i]);
}
//cout << answer << "\n";
int peak = 0;
for(int i = 1; i <= no_of_plots; i++)
{
if(answer == left_contribution[i] + right_contribution[i] - max_height[i])
{
peak = i;
break;
}
}
vector <long long> height(no_of_plots + 1);
height[peak] = max_height[peak];
for(int i = peak - 1; i >= 1; i--)
{
height[i] = min(max_height[i], height[i + 1]);
}
for(int i = peak + 1;i <= no_of_plots; i++)
{
height[i] = min(max_height[i], height[i - 1]);
}
for(int i = 1; i <= no_of_plots; i++)
{
cout << height[i] << " ";
}
cout <<"\n";
return 0;
}
================================================
FILE: 2020/Div 2/623 Div 2/Explanations/Dead Pixel Explanation.txt
================================================
There are 4 possible areas
(x - 1)b
(a - x)b
a(y - 1)
a(b - y)
We will choose the maximum of the 4 areas
-----
#include <iostream>
using namespace std;
void solve()
{
int a, b, x, y;
cin >> a >> b >> x >> y;
x++; y++;
int area_1, area_2;
if(x > a/2)
{
area_1 = (x - 1)*b;
}
else
{
area_1 = (a - x)*b;
}
if(y > b/2)
{
area_2 = a*(y - 1);
}
else
{
area_2 = a*(b - y);
}
int answer = max(area_1, area_2);
cout << answer << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/623 Div 2/Explanations/Homecoming Explanation.txt
================================================
This is a tricky problem because of the condition that we will not
need to go anywhere from the last station.
We will scan the array from right to left.
Whenever we encounter a change in segments, we will see if the price range is in our budget.
If no, then we need to reach the (i + 1)-th spot by foot
-----
void solve()
{
int bus, tram, budget;
cin >> bus >> tram >> budget;
string city;
cin >> city;
int index = 0, money_so_far = 0;
for(int i = city.size() - 2; i >= 0; i--)
{
if(i == city.size() - 2 || (city[i] != city[i + 1]))
{
int money_here = (city[i] == 'A' ? bus : tram);
//cout << "Money at " << i + 1 << " = " << money_here << " T = " << money_so_far + money_here << "\n";
if(money_so_far + money_here > budget)
{
index = (i + 1);
break;
}
money_so_far += money_here;
}
}
cout << index + 1 << "\n";
}
================================================
FILE: 2020/Div 2/623 Div 2/Explanations/Recommendations Explanation.txt
================================================
The only operation that we are allowed is addition.
Let us start processing the elements in ascending order.
At any point in time A[1] is the smallest integer.
If A[1] < A[2], we can remove A[1] from the array and solve the same problem from
[2, n]
Otherwise, A[1] = A[2] = ... = A[i]
In this case, we have to increment (i - 1) elements no matter what.
So, we will increment all values except that which has the highest cost.
And we will discard the element with the largest cost and now we will have
A[1], A[2] + 1, A[3] + 1, ... , A[i] + 1
We have to check if (A[i + 1] == A[i] + 1)
If yes, then we will add the cost of (A[i] + 1) to our multiset of costs
and once again increment everything except the largest value.
Otherwise, we will repeat the same process till the multiset is empty.
-----
I have used a variable called current minima which keeps track of the current minimum
And a multiset which keeps track of all the costs of the current minimum.
At any one step, we will discard the largest cost.
And increment all the other equal elements by 1.
We will update the total cost incurred so far.
And we will add (A[i] + 1) cost into our multiset if current minima = (A[i] + 1)
And when the multiset is empty, we will make current minima = A[i] again
This is to prevent it from timing out by getting stuck
-----
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#define all(v) (v).begin(), (v).end()
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int no_of_magazines;
cin >> no_of_magazines;
vector <pair <int, long long> > M(no_of_magazines);
for(int i = 0; i < no_of_magazines; i++)
{
cin >> M[i].first;
}
for(int i = 0; i < no_of_magazines; i++)
{
cin >> M[i].second;
}
sort(all(M));
multiset <long long> equal_segment;
long long current_minima = 0, i = 0;
long long total_cost = 0, equal_segment_sum = 0;
while(i < M.size() || equal_segment.size() > 0)
{
while(i < M.size() && M[i].first == current_minima)
{
equal_segment.insert(M[i].second);
equal_segment_sum += M[i].second;
i++;
}
if(equal_segment.size() > 0)
{
auto it = equal_segment.rbegin();
long long largest = *it;
equal_segment.erase(equal_segment.find(largest)); //Erases only one instance of largest
equal_segment_sum -= largest;
total_cost += equal_segment_sum;
current_minima++;
}
else
{
current_minima = M[i].first;
}
}
cout << total_cost << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/623 Div 2/Explanations/Restoring Permutation Explanation.txt
================================================
We will be greedy.
We will keep a set of all integers not used so far.
For each B[i], we will take the smallest integer > B[i] which is available
and place it in A[2i]
If there is no such element, then we will declare it is not possible.
We have to erase the element after we use it
-----
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> B(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> B[i];
}
set <int> available;
for(int i = 1; i <= 2*no_of_elements; i++)
{
available.insert(i);
}
for(int i = 1; i <= no_of_elements; i++)
{
available.erase(B[i]);
}
int possible = true;
vector <int> A(2*no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
auto it = available.lower_bound(B[i]);
if(it == available.end())
{
possible = false;
break;
}
A[2*i - 1] = B[i];
A[2*i] = *(it);
available.erase(it);
}
if(!possible)
{
cout << "-1\n";
return;
}
for(int i = 1; i <= 2*no_of_elements; i++)
{
cout << A[i] << " ";
}
cout << "\n";
}
================================================
FILE: 2020/Div 2/623 Div 2/Programs/Dead Pixel.cpp
================================================
#include <iostream>
using namespace std;
void solve()
{
int a, b, x, y;
cin >> a >> b >> x >> y;
x++; y++;
int area_1, area_2;
if(x > a/2)
{
area_1 = (x - 1)*b;
}
else
{
area_1 = (a - x)*b;
}
if(y > b/2)
{
area_2 = a*(y - 1);
}
else
{
area_2 = a*(b - y);
}
int answer = max(area_1, area_2);
cout << answer << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/623 Div 2/Programs/Homecoming.cpp
================================================
#include <iostream>
using namespace std;
void solve()
{
int bus, tram, budget;
cin >> bus >> tram >> budget;
string city;
cin >> city;
int index = 0, money_so_far = 0;
for(int i = city.size() - 2; i >= 0; i--)
{
if(i == city.size() - 2 || (city[i] != city[i + 1]))
{
int money_here = (city[i] == 'A' ? bus : tram);
//cout << "Money at " << i + 1 << " = " << money_here << " T = " << money_so_far + money_here << "\n";
if(money_so_far + money_here > budget)
{
index = (i + 1);
break;
}
money_so_far += money_here;
}
}
cout << index + 1 << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/623 Div 2/Programs/Recommendations.cpp
================================================
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#define all(v) (v).begin(), (v).end()
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int no_of_magazines;
cin >> no_of_magazines;
vector <pair <int, long long> > M(no_of_magazines);
for(int i = 0; i < no_of_magazines; i++)
{
cin >> M[i].first;
}
for(int i = 0; i < no_of_magazines; i++)
{
cin >> M[i].second;
}
sort(all(M));
multiset <long long> equal_segment;
long long current_minima = 0, i = 0;
long long total_cost = 0, equal_segment_sum = 0;
while(i < M.size() || equal_segment.size() > 0)
{
while(i < M.size() && M[i].first == current_minima)
{
equal_segment.insert(M[i].second);
equal_segment_sum += M[i].second;
i++;
}
if(equal_segment.size() > 0)
{
auto it = equal_segment.rbegin();
long long largest = *it;
equal_segment.erase(equal_segment.find(largest)); //Erases only one instance of largest
equal_segment_sum -= largest;
total_cost += equal_segment_sum;
current_minima++;
}
else
{
current_minima = M[i].first;
}
}
cout << total_cost << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/623 Div 2/Programs/Restoring Permutations.cpp
================================================
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> B(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> B[i];
}
set <int> available;
for(int i = 1; i <= 2*no_of_elements; i++)
{
available.insert(i);
}
for(int i = 1; i <= no_of_elements; i++)
{
available.erase(B[i]);
}
int possible = true;
vector <int> A(2*no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
auto it = available.lower_bound(B[i]);
if(it == available.end())
{
possible = false;
break;
}
A[2*i - 1] = B[i];
A[2*i] = *(it);
available.erase(it);
}
if(!possible)
{
cout << "-1\n";
return;
}
for(int i = 1; i <= 2*no_of_elements; i++)
{
cout << A[i] << " ";
}
cout << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/625 Div 2/Explanations/Contest for Robots Explanation.txt
================================================
Let us count the number of problems, A, which A solves and B does not
And B = The number of problems B solves which A does not
If (A = 0), then it is impossible to make A win
If (A > B), then we can give each problem 1 point and A wins
If (A < B), then we can give each problem A solves (B/A) number of points
and each problem B solves 1 point.
Then, we will start giving problems 1 extra point till their total is > B
The answer = (B/A) + 1
-----
int main()
{
int no_of_robots;
cin >> no_of_robots;
vector <int> A(no_of_robots + 1);
for(int i = 1; i <= no_of_robots; i++)
{
cin >> A[i];
}
vector <int> B(no_of_robots + 1);
for(int i = 1; i <= no_of_robots; i++)
{
cin >> B[i];
}
int a_points = 0, b_points = 0;
for(int i = 1; i <= no_of_robots; i++)
{
if(A[i] != 0 && B[i] == 0)
{
a_points++;
}
else if(A[i] == 0 && B[i] != 0)
{
b_points++;
}
}
int answer = 0;
if(a_points == 0)
{
answer = -1;
}
else if(a_points > b_points)
{
answer = 1;
}
else
{
answer = (b_points/a_points) + 1;
}
cout << answer << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/625 Div 2/Explanations/Journey Planning Explanation.txt
================================================
We are told that if we move from i to j, then
j - i = A[j] - A[i]
A[i] - i = A[j] - j
This insight is easier to come upon if we think of the problem geometrically
and think of the indices as X-axis and the values as Y-axis
The value of (A[i] - i) is invariant for a subsequence.
So, we will find out the total sum of all possible (A[i] - i) and then give the maximum
------
int main()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> beauty(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> beauty[i];
}
map <int, long long> answer_for;
for(int i = 1; i <= no_of_elements; i++)
{
answer_for[i - beauty[i]] += beauty[i];
}
long long answer = 0;
for(auto it = answer_for.begin(); it != answer_for.end(); it++)
{
answer = max(answer, it->second);
}
cout << answer << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/625 Div 2/Explanations/Navigation System Explanation.txt
================================================
Let us find the shortest distance of each vertex from the source.
Let it be in D
To find D in a directed graph, we have to do BFS on the transpose graph
-----
void bfs(int source)
{
queue <int> Q;
Q.push(source);
D[source] = 0;
while(!Q.empty())
{
int v = Q.front();
Q.pop();
for(int i = 0; i < transpose_graph[v].size(); i++)
{
int child = transpose_graph[v][i];
if(D[child] == -1)
{
D[child] = D[v] + 1;
Q.push(child);
}
}
}
}
-----
Let us go through the stops in order.
Suppose we are at stop i,
1. If D[next] + 1 =/= D[v],
Then the path will be forced to rebuild
This will increase both the minimum and maximum paths by 1
2. If D[next] + 1 = D[v],
We will count the number of options
If there is more than 1 valid option from v, then
The maximum number of paths will increase by 1
-----
int main()
{
int no_of_vertices, no_of_edges;
cin >> no_of_vertices >> no_of_edges;
for(int i = 1; i <= no_of_edges; i++)
{
int u, v;
cin >> u >> v;
graph[u].push_back(v);
transpose_graph[v].push_back(u);
}
int no_of_stops;
cin >> no_of_stops;
vector <int> stops(no_of_stops + 1, 0);
for(int i = 1; i <= no_of_stops; i++)
{
cin >> stops[i];
}
int source = stops[no_of_stops];
bfs(source);
int minimum_paths = 0, maximum_paths = 0;
for(int i = 1; i < no_of_stops; i++)
{
if(D[stops[i + 1]] + 1 != D[stops[i]])
{
minimum_paths++;
maximum_paths++;
continue;
}
int no_of_options = 0;
for(int j = 0; j < graph[stops[i]].size(); j++)
{
int next = graph[stops[i]][j];
if(D[next] + 1 == D[stops[i]])
{
no_of_options++;
}
}
if(no_of_options > 1)
{
maximum_paths++;
}
}
cout << minimum_paths << " " << maximum_paths << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/625 Div 2/Explanations/Remove Adjacent Explanation.txt
================================================
We can be greedy and start removing alphabets one by one from Z to A
We need S[i - 1] to remove S[i]. We do not need any other alphabets.
So, we will remove alphabets starting from the greatest to the least
-----
#include <iostream>
#include <string>
using namespace std;
int main()
{
int length;
string S;
cin >> length >> S;
int removed = 0;
for(int alpha = 'z'; alpha > 'a'; alpha--)
{
for(int attempts = 1; attempts <= length; attempts++)
{
for(int i = 0; i < length; i++)
{
if( (i + 1) < length && S[i] == alpha && S[i] == S[i + 1] + 1)
{
S.erase(i, 1);
removed++;
continue;
}
if( (i - 1) >= 0 && S[i] == alpha && S[i] == S[i - 1] + 1)
{
S.erase(i, 1);
removed++;
}
}
}
}
cout << removed << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/625 Div 2/Programs/Contest for Robotos.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int no_of_robots;
cin >> no_of_robots;
vector <int> A(no_of_robots + 1);
for(int i = 1; i <= no_of_robots; i++)
{
cin >> A[i];
}
vector <int> B(no_of_robots + 1);
for(int i = 1; i <= no_of_robots; i++)
{
cin >> B[i];
}
int a_points = 0, b_points = 0;
for(int i = 1; i <= no_of_robots; i++)
{
if(A[i] != 0 && B[i] == 0)
{
a_points++;
}
else if(A[i] == 0 && B[i] != 0)
{
b_points++;
}
}
int answer = 0;
if(a_points == 0)
{
answer = -1;
}
else if(a_points > b_points)
{
answer = 1;
}
else
{
answer = (b_points/a_points) + 1;
}
cout << answer << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/625 Div 2/Programs/Journey Planning.cpp
================================================
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> beauty(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> beauty[i];
}
map <int, long long> answer_for;
for(int i = 1; i <= no_of_elements; i++)
{
answer_for[i - beauty[i]] += beauty[i];
}
long long answer = 0;
for(auto it = answer_for.begin(); it != answer_for.end(); it++)
{
answer = max(answer, it->second);
}
cout << answer << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/625 Div 2/Programs/Navigation System.cpp
================================================
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
const int MAX_N = 2e5 + 5;
vector <int> graph[MAX_N];
vector <int> transpose_graph[MAX_N];
vector <int> D(MAX_N, -1);
void bfs(int source)
{
queue <int> Q;
Q.push(source);
D[source] = 0;
while(!Q.empty())
{
int v = Q.front();
Q.pop();
for(int i = 0; i < transpose_graph[v].size(); i++)
{
int child = transpose_graph[v][i];
if(D[child] == -1)
{
D[child] = D[v] + 1;
Q.push(child);
}
}
}
}
int main()
{
int no_of_vertices, no_of_edges;
cin >> no_of_vertices >> no_of_edges;
for(int i = 1; i <= no_of_edges; i++)
{
int u, v;
cin >> u >> v;
graph[u].push_back(v);
transpose_graph[v].push_back(u);
}
int no_of_stops;
cin >> no_of_stops;
vector <int> stops(no_of_stops + 1, 0);
for(int i = 1; i <= no_of_stops; i++)
{
cin >> stops[i];
}
int source = stops[no_of_stops];
bfs(source);
int minimum_paths = 0, maximum_paths = 0;
for(int i = 1; i < no_of_stops; i++)
{
if(D[stops[i + 1]] + 1 != D[stops[i]])
{
minimum_paths++;
maximum_paths++;
continue;
}
int no_of_options = 0;
for(int j = 0; j < graph[stops[i]].size(); j++)
{
int next = graph[stops[i]][j];
if(D[next] + 1 == D[stops[i]])
{
no_of_options++;
}
}
if(no_of_options > 1)
{
maximum_paths++;
}
}
cout << minimum_paths << " " << maximum_paths << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/625 Div 2/Programs/Remove Adjacent.cpp
================================================
#include <iostream>
#include <string>
using namespace std;
int main()
{
int length;
string S;
cin >> length >> S;
int removed = 0;
for(int alpha = 'z'; alpha > 'a'; alpha--)
{
for(int attempts = 1; attempts <= length; attempts++)
{
for(int i = 0; i < length; i++)
{
if( (i + 1) < length && S[i] == alpha && S[i] == S[i + 1] + 1)
{
S.erase(i, 1);
removed++;
continue;
}
if( (i - 1) >= 0 && S[i] == alpha && S[i] == S[i - 1] + 1)
{
S.erase(i, 1);
removed++;
}
}
}
}
cout << removed << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/626 Div 2/Explanations/Count Subrectangles Explanation.txt
================================================
1. If A[i] = 0, then the whole i-th row is 0.
If B[j] = 0, the whole column j is 0
-----
2. Ultimately, the matrix consists of some islands (rectangles) of ones seperated by entire lines of 0s.
We will keep track of the length of the consecutive segments of 1's both
row-wise and column-wise.
int rows, columns, area;
cin >> rows >> columns >> area;
vector <int> A(rows + 5, 0);
for(int i = 1; i <= rows; i++)
{
cin >> A[i];
}
vector <int> B(columns + 5, 0);
for(int i = 1; i <= columns; i++)
{
cin >> B[i];
}
vector <int> row_segments;
row_segments.push_back(0);
int segment = 0;
for(int i = 1; i <= rows + 1; i++)
{
if(A[i] == 0 || i == rows + 1)
{
row_segments.push_back(segment);
segment = 0;
continue;
}
segment++;
}
sort(all(row_segments));
vector <long long> row_sum(row_segments.size(), 0);
for(int i = 1; i < row_segments.size(); i++)
{
row_sum[i] = row_sum[i - 1] + row_segments[i];
}
vector <int> column_segments;
column_segments.push_back(0);
segment = 0;
for(int i = 1; i <= columns + 1; i++)
{
if(B[i] == 0 || i == columns + 1)
{
column_segments.push_back(segment);
segment = 0;
continue;
}
segment++;
}
sort(all(column_segments));
vector <long long> column_sum(column_segments.size(), 0);
for(int i = 1; i < column_segments.size(); i++)
{
column_sum[i] = column_sum[i - 1] + column_segments[i];
}
-----
3. Iterate over all factors (f1, f2) of K.
Let us count the number of 'row segments' which are more than K
and the number of 'column segments' which are more than K
Suppose (f1 = 5, f2 = 3)
Let us count the number of ways of selecting a row of 5 continuous ones
Suppose the lengths of the row segments are - {1, 3, 5, 7, 9}
The number of ways of choosing a row segment of length 5 is
= (5 - 5 + 1) + (7 - 5 + 1) + (9 - 5 + 1)
= 1 + 3 + 4
= 8
So, we need to know
1. The number of elements >= 5
2. The sum of elements >= 5
Then, the number of ways = (9 + 7 + 5) - 3(5 - 1)
long long no_of_subrectangles = 0;
for(long long i = 1; i*i <= area; i++)
{
if(area%i == 0)
{
long long f1 = i, f2 = area/i;
long long row_contribution = 0;
if(f1 <= row_segments.back())
{
int j = upper_bound(all(row_segments), f1 - 1) - row_segments.begin();
row_contribution = (row_sum.back() - row_sum[j - 1]) -
(row_segments.size() - 1 - (j - 1))*(f1 - 1);
//cout << "Sum = " << (row_sum.back() - row_sum[j - 1]) << " - "
//<< (row_segments.size() - 1 - (j - 1))*(f2 - 1) << "\n";
}
long long column_contribution = 0;
if(f2 <= column_segments.back())
{
int j = upper_bound(all(column_segments), f2 - 1) - column_segments.begin();
column_contribution = (column_sum.back() - column_sum[j - 1]) -
(column_segments.size() - 1 - (j - 1))*(f2 - 1);
}
//cout << "Fr = " << f1 << " Fc = " << f2 << " = ";
no_of_subrectangles += row_contribution*column_contribution;
//cout << no_of_subrectangles << " = " << row_contribution << "x" << column_contribution << "\n";
if(f1 == f2)
{
continue;
}
column_contribution = 0;
if(f1 <= column_segments.back())
{
int j = upper_bound(all(column_segments), f1 - 1) - column_segments.begin();
column_contribution = (column_sum.back() - column_sum[j - 1]) -
(column_segments.size() - 1 - (j - 1))*(f1 - 1);
}
row_contribution = 0;
//cout << "F2 = " << f2 << " Back = " << row_segments.back() << "\n";
if(f2 <= row_segments.back())
{
int j = upper_bound(all(row_segments), f2 - 1) - row_segments.begin();
row_contribution = (row_sum.back() - row_sum[j - 1]) -
(row_segments.size() - 1 - (j - 1))*(f2 - 1);
//cout << "Sum = " << (row_sum.back() - row_sum[j - 1]) << " - "
//<< (row_segments.size() - 1 - (j - 1))*(f2 - 1) << "\n";
}
//cout << "Fr = " << f2 << " Fc = " << f1 << " = ";
no_of_subrectangles += row_contribution*column_contribution;
//cout << no_of_subrectangles << " = " << row_contribution << "x" << column_contribution << "\n";
}
}
cout << no_of_subrectangles << "\n";
return 0;
================================================
FILE: 2020/Div 2/626 Div 2/Explanations/Even Subset Sum Problem Explanation.txt
================================================
We will either print 1 even integer or 2 odd integers
If there is only 1 odd integer, it is not possible
-----
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> odd;
vector <int> even;
for(int i = 1; i <= no_of_elements; i++)
{
int x;
cin >> x;
if(x%2 == 1)
{
odd.push_back(i);
}
else
{
even.push_back(i);
}
}
if(odd.size() >= 2)
{
cout << "2\n";
cout << odd[0] << " " << odd[1] << "\n";
return;
}
if(even.size() >= 1)
{
cout << "1\n";
cout << even[0] << "\n";
return;
}
cout << "-1\n";
}
================================================
FILE: 2020/Div 2/626 Div 2/Explanations/Unusual Competitions Explanation.txt
================================================
Let us replace the '(' by +1 and the ')' by -1
We will keep track of the prefix sum
If at some point, the sum goes below 0, then we will start our segment from there
We will close the segment as soon as the sum reaches 0
This greedy solution works because we ensure each segment is as small as possible
-----
int main()
{
int length;
string S;
cin >> length >> S;
int sum = 0;
int answer = 0;
for(int left = -1, right = 0; right < length; right++)
{
sum += (S[right] == '(' ? 1 : -1);
if(sum == -1 && left == -1)
{
left = right;
continue;
}
if(sum == 0)
{
if(left != -1)
{
answer += (right - (left - 1));
left = -1;
continue;
}
}
}
if(sum != 0)
{
answer = -1;
}
cout << answer << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/626 Div 2/Programs/Counting Subrectangles.cpp
================================================
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#define all(v) (v).begin(), (v).end()
using namespace std;
int main()
{
int rows, columns, area;
cin >> rows >> columns >> area;
vector <int> A(rows + 5, 0);
for(int i = 1; i <= rows; i++)
{
cin >> A[i];
}
vector <int> B(columns + 5, 0);
for(int i = 1; i <= columns; i++)
{
cin >> B[i];
}
map <int, int> row_frequency;
vector <int> row_segments;
row_segments.push_back(0);
int segment = 0;
for(int i = 1; i <= rows + 1; i++)
{
if(A[i] == 0 || i == rows + 1)
{
row_frequency[segment]++;
row_segments.push_back(segment);
segment = 0;
continue;
}
segment++;
}
sort(all(row_segments));
vector <long long> row_sum(row_segments.size(), 0);
for(int i = 1; i < row_segments.size(); i++)
{
row_sum[i] = row_sum[i - 1] + row_segments[i];
}
map <int, int> column_frequency;
vector <int> column_segments;
column_segments.push_back(0);
segment = 0;
for(int i = 1; i <= columns + 1; i++)
{
if(B[i] == 0 || i == columns + 1)
{
column_frequency[segment]++;
column_segments.push_back(segment);
segment = 0;
continue;
}
segment++;
}
sort(all(column_segments));
vector <long long> column_sum(column_segments.size(), 0);
for(int i = 1; i < column_segments.size(); i++)
{
column_sum[i] = column_sum[i - 1] + column_segments[i];
}
long long no_of_subrectangles = 0;
for(long long i = 1; i*i <= area; i++)
{
if(area%i == 0)
{
long long f1 = i, f2 = area/i;
long long row_contribution = 0;
if(f1 <= row_segments.back())
{
int j = upper_bound(all(row_segments), f1 - 1) - row_segments.begin();
row_contribution = (row_sum.back() - row_sum[j - 1]) -
(row_segments.size() - 1 - (j - 1))*(f1 - 1);
//cout << "Sum = " << (row_sum.back() - row_sum[j - 1]) << " - "
//<< (row_segments.size() - 1 - (j - 1))*(f2 - 1) << "\n";
}
long long column_contribution = 0;
if(f2 <= column_segments.back())
{
int j = upper_bound(all(column_segments), f2 - 1) - column_segments.begin();
column_contribution = (column_sum.back() - column_sum[j - 1]) -
(column_segments.size() - 1 - (j - 1))*(f2 - 1);
}
//cout << "Fr = " << f1 << " Fc = " << f2 << " = ";
no_of_subrectangles += row_contribution*column_contribution;
//cout << no_of_subrectangles << " = " << row_contribution << "x" << column_contribution << "\n";
if(f1 == f2)
{
continue;
}
column_contribution = 0;
if(f1 <= column_segments.back())
{
int j = upper_bound(all(column_segments), f1 - 1) - column_segments.begin();
column_contribution = (column_sum.back() - column_sum[j - 1]) -
(column_segments.size() - 1 - (j - 1))*(f1 - 1);
}
row_contribution = 0;
//cout << "F2 = " << f2 << " Back = " << row_segments.back() << "\n";
if(f2 <= row_segments.back())
{
int j = upper_bound(all(row_segments), f2 - 1) - row_segments.begin();
row_contribution = (row_sum.back() - row_sum[j - 1]) -
(row_segments.size() - 1 - (j - 1))*(f2 - 1);
//cout << "Sum = " << (row_sum.back() - row_sum[j - 1]) << " - "
//<< (row_segments.size() - 1 - (j - 1))*(f2 - 1) << "\n";
}
//cout << "Fr = " << f2 << " Fc = " << f1 << " = ";
no_of_subrectangles += row_contribution*column_contribution;
//cout << no_of_subrectangles << " = " << row_contribution << "x" << column_contribution << "\n";
}
}
cout << no_of_subrectangles << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/626 Div 2/Programs/Even Subset Sum Problem.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> odd;
vector <int> even;
for(int i = 1; i <= no_of_elements; i++)
{
int x;
cin >> x;
if(x%2 == 1)
{
odd.push_back(i);
}
else
{
even.push_back(i);
}
}
if(odd.size() >= 2)
{
cout << "2\n";
cout << odd[0] << " " << odd[1] << "\n";
return;
}
if(even.size() >= 1)
{
cout << "1\n";
cout << even[0] << "\n";
return;
}
cout << "-1\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/626 Div 2/Programs/Unusual Competitions.cpp
================================================
#include <iostream>
#include <string>
using namespace std;
int main()
{
int length;
string S;
cin >> length >> S;
int sum = 0;
int answer = 0;
for(int left = -1, right = 0; right < length; right++)
{
sum += (S[right] == '(' ? 1 : -1);
if(sum == -1 && left == -1)
{
left = right;
continue;
}
if(sum == 0)
{
if(left != -1)
{
answer += (right - (left - 1));
left = -1;
continue;
}
}
}
if(sum != 0)
{
answer = -1;
}
cout << answer << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/628 Div 2/Explanations/Copy Copy Copy Copy Copy Explanation.txt
================================================
We concatenate the array N times with itself
We can pick all the distinct elements of the array and that will be the longest increasing subsequence
The length of the Longest increasing subsequence cannot be more than the number of distinct elements
As there is no element greater than the maximum element
-----
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
set <int> distinct;
for(int i = 1; i <= no_of_elements; i++)
{
distinct.insert(A[i]);
}
cout << distinct.size() << "\n";
}
================================================
FILE: 2020/Div 2/628 Div 2/Explanations/Ehab and GCD Explanation.txt
================================================
We can use (1, x - 1)
gcd(1, x - 1) = 1
lcm(1, x - 1) = x - 1
gcd(1, x - 1) + lcm(1, x - 1) = x
-----
#include <iostream>
using namespace std;
void solve()
{
long long x;
cin >> x;
cout << "1 " << x - 1 << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/628 Div 2/Explanations/Ehab and Path-etic MEX Explanation.txt
================================================
The crucial insight here is that there will always be a path running through
any 2 edges.
So, there will always be a path that runs through both 0 and 1 and will have MEX = 2
Now, is there a way, we can avoid having 2 on the same path as (0, 1) ?
The only way to do this is if some vertex had degree >= 3 and we label it 0, 1, 2
The mex of every path not containing 0 or 1 will be 0 or 1
The mex of every path containing both 0 and 1 will be 2
------
My strategy was to start with the leaves and maintain a queue of them.
After labelling an edge (u, v), we delete the edge and add u to our queue if u is now a leaf
If the tree has at least 3 leaves,
then it ensures that there is no path passing through (0, 1, 2)
since there can be no path that hits 3 leaves.
If the tree has only 2 leaves, then it is a bamboo and any labelling we do won't matter
----
================================================
FILE: 2020/Div 2/628 Div 2/Explanations/Ehab and XORcist Explanation.txt
================================================
Suppose
U = 110001 V = 1100001
I will keep track of the frequency of all 64 bits
So initially, it will be U = 110001
Now, the sum I have to still make is V - U = 110000
So here is what I will do
First 4 bits nothing
Then, I'll go to the fifth bit
[11:34 PM, 3/14/2020] Saikat: Presently, my answer is 110001
The sum has a 2^5 in the fifth spot
I cannot make it 120001
The reason is the XOR in that spot is 1
So instead of adding 2^5, I will add two 2^4's
11 2 001
Then, I will go to the sixth bit
I can't add a 1 in there.
Here are my options -
(2) 12001
1 (3) 2001
11 (6) 001
112 (8) 01
1120 (16) 1
11200 (32)
Among all these options, 1 3 2001 is the best
-----
1. Keep track of frequency of each bit
2. Initially, set it to XOR
3. Then, look at the remaining sum
4. After that go bit by bit. If the i-th bit is set in the remaining sum, then we can either
Add 2 bits of (i - 1)
Add 4 bits of (i - 2)
Add 8 bits of (i - 3)
Add 16 bits of (i - 4)
.
.
Add 2^m bits of (i - m)
All these choices add an even number of summands so XOR does not change
Among all these options,
we will choose the one which minimises the number of summands
-----
It is not possible if (u > v) or if u =!= v (mod 2)
The reason is that the bits in the last position must be either even or odd and can't be both
If u = v = 0, then the answer is 0
Else if u = v, the answer is 1
-----
There is a simpler solution
If the answer is possible and not 0 or 1, then it is always at most 3
(u + v)/2, (u - v)/2, v works
-----
int some_non_zero(vector <int> &A)
{
for(int i = 0; i < A.size(); i++)
{
if(A[i] > 0)
{
return true;
}
}
return false;
}
int is_bit_set(long long n, int bit)
{
return ( (n&(1LL << bit)) != 0);
}
int main()
{
long long array_xor, array_sum;
cin >> array_xor >> array_sum;
if(array_xor > array_sum || (array_xor%2 != array_sum%2))
{
cout << "-1\n";
return 0;
}
if(array_xor == array_sum)
{
if(array_xor == 0)
{
cout << "0\n";
}
else
{
cout << "1\n";
cout << array_xor << "\n";
}
return 0;
}
const int MAX_BITS = 63;
vector <int> frequency(MAX_BITS, 0);
for(int bit = 0; bit < MAX_BITS; bit++)
{
if(is_bit_set(array_xor, bit))
{
array_sum -= (1LL << bit);
frequency[bit]++;
}
}
for(int bit = 0; bit < MAX_BITS; bit++)
{
if(is_bit_set(array_sum, bit))
{
int best_spot = max(bit - 1, 0);
long long best_no_of_terms = frequency[best_spot] + 2;
for(int i = bit - 1; i >= 0; i--)
{
if(frequency[i] + (1LL << (bit - i)) <= best_no_of_terms)
{
best_no_of_terms = frequency[i] + (1LL << (bit - i));
best_spot = i;
}
}
frequency[best_spot] += (1LL << (bit - best_spot));
array_sum -= (1LL << bit);
}
}
vector <long long> A;
while(some_non_zero(frequency))
{
long long current = 0;
for(int bit = 0; bit < MAX_BITS; bit++)
{
if(frequency[bit] > 0)
{
current |= (1LL << bit);
frequency[bit]--;
}
}
A.push_back(current);
}
long long xorr = 0, sum = 0;
cout << A.size() << "\n";
for(int i = 0; i < A.size(); i++)
{
cout << A[i] << " ";
xorr ^= A[i];
sum += A[i];
}
cout << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/628 Div 2/Programs/Copy Copy Copy Copy Copy.cpp
================================================
#include <iostream>
#include <vector>
#include <set>
using namespace std;
void solve()
{
int no_of_elements;
cin >> no_of_elements;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
set <int> distinct;
for(int i = 1; i <= no_of_elements; i++)
{
distinct.insert(A[i]);
}
cout << distinct.size() << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/628 Div 2/Programs/Ehab and GCD.cpp
================================================
#include <iostream>
using namespace std;
void solve()
{
long long x;
cin >> x;
cout << "1 " << x - 1 << "\n";
}
int main()
{
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
solve();
return 0;
}
================================================
FILE: 2020/Div 2/628 Div 2/Programs/Ehab and Pathetic MEX.cpp
================================================
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;
const int MAX_N = 1e5 + 5;
vector <set <int> > tree;
queue <int> leaves;
void remove(int u, int v)
{
tree[u].erase(v);
tree[v].erase(u);
if(tree[u].size() == 1)
{
leaves.push(u);
}
if(tree[v].size() == 1)
{
leaves.push(v);
}
}
int main()
{
int no_of_vertices;
cin >> no_of_vertices;
int no_of_edges = no_of_vertices - 1;
tree.resize(no_of_vertices + 1);
map <pair <int, int>, int> edge_no;
for(int i = 1; i <= no_of_edges; i++)
{
int u, v;
cin >> u >> v;
tree[u].insert(v);
tree[v].insert(u);
edge_no[make_pair(u, v)] = i;
edge_no[make_pair(v, u)] = i;
}
for(int i = 1; i <= no_of_vertices; i++)
{
if(tree[i].size() == 1)
{
leaves.push(i);
}
}
int last_label = 0;
vector <int> label(no_of_edges + 1, 0);
while(leaves.size() > 0)
{
int current_v = leaves.front();
leaves.pop();
auto v_it = tree[current_v].begin();
int current_u = *v_it;
remove(current_u, current_v);
/* cout << "L = " << current_v << "," << current_u
<< " Edge No = " << edge_no[make_pair(current_u, current_v)] <<
" edgeLabel = " << last_label << "\n";*/
label[edge_no[make_pair(current_u, current_v)]] = last_label++;
}
for(int i = 1; i <= no_of_edges; i++)
{
cout << label[i] << "\n";
}
return 0;
}
================================================
FILE: 2020/Div 2/628 Div 2/Programs/Ehab and XORcist.cpp
================================================
#include <iostream>
#include <vector>
using namespace std;
int some_non_zero(vector <int> &A)
{
for(int i = 0; i < A.size(); i++)
{
if(A[i] > 0)
{
return true;
}
}
return false;
}
int is_bit_set(long long n, int bit)
{
return ( (n&(1LL << bit)) != 0);
}
int main()
{
long long array_xor, array_sum;
cin >> array_xor >> array_sum;
if(array_xor > array_sum || (array_xor%2 != array_sum%2))
{
cout << "-1\n";
return 0;
}
if(array_xor == array_sum)
{
if(array_xor == 0)
{
cout << "0\n";
}
else
{
cout << "1\n";
cout << array_xor << "\n";
}
return 0;
}
const int MAX_BITS = 63;
vector <int> frequency(MAX_BITS, 0);
for(int bit = 0; bit < MAX_BITS; bit++)
{
if(is_bit_set(array_xor, bit))
{
array_sum -= (1LL << bit);
frequency[bit]++;
}
}
for(int bit = 0; bit < MAX_BITS; bit++)
{
if(is_bit_set(array_sum, bit))
{
int best_spot = max(bit - 1, 0);
long long best_no_of_terms = frequency[best_spot] + 2;
for(int i = bit - 1; i >= 0; i--)
{
if(frequency[i] + (1LL << (bit - i)) <= best_no_of_terms)
{
best_no_of_terms = frequency[i] + (1LL << (bit - i));
best_spot = i;
}
}
frequency[best_spot] += (1LL << (bit - best_spot));
array_sum -= (1LL << bit);
}
}
vector <long long> A;
while(some_non_zero(frequency))
{
long long current = 0;
for(int bit = 0; bit < MAX_BITS; bit++)
{
if(frequency[bit] > 0)
{
current |= (1LL << bit);
frequency[bit]--;
}
}
A.push_back(current);
}
long long xorr = 0, sum = 0;
cout << A.size() << "\n";
for(int i = 0; i < A.size(); i++)
{
cout << A[i] << " ";
xorr ^= A[i];
sum += A[i];
}
cout << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/630 Div 2/Explanations/Composite Coloring Explanation.txt
================================================
We need to make 1 observation
If a number is smaller than 1000, it must have at least 1 prime factor <= 31
If a number has 2 prime factors > 31, then it's product will be
at least 37*37 > 1000
This means that the smallest prime factor of n will be one of
{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}
We will colour all integers with the same 'smallest prime factor'
the same colour
This guarantees that two integers with the same 'smallest prime factor'
are not coprime as their gcd = common smallest prime factor
-----
void precompute(vector <int> &lowest_prime_factor, int N)
{
for(long long i = 2; i < N; i++)
{
if(lowest_prime_factor[i] != 0)
{
continue;
}
for(long long multiple = i; multiple < N; multiple += i)
{
if(lowest_prime_factor[multiple] == 0)
{
lowest_prime_factor[multiple] = i;
}
}
}
}
void solve(vector <int> &lowest_prime_factor)
{
int no_of_elements;
cin >> no_of_elements;
vector <int> A(no_of_elements + 1);
for(int i = 1; i <= no_of_elements; i++)
{
cin >> A[i];
}
vector <int> position({2, 3, 5, 7, 11, 13, 17, 19, 23, 27, 31});
vector <int> colour(no_of_elements + 1, 0);
set <int> distinct;
vector <int> distinct_colours;
for(int i = 1; i <= no_of_elements; i++)
{
colour[i] = upper_bound(position.begin(), position.end(), lowest_prime_factor[A[i]]) - position.begin();
if(distinct.find(colour[i]) == distinct.end())
{
distinct.insert(colour[i]);
distinct_colours.push_back(colour[i]);
}
}
sort(distinct_colours.begin(), distinct_colours.end());
int no_of_colours = 0;
for(int i = 1; i <= no_of_elements; i++)
{
colour[i] = upper_bound(distinct_colours.begin(), distinct_colours.end(), colour[i]) - distinct_colours.begin();
no_of_colours = max(no_of_colours, colour[i]);
}
cout << no_of_colours << "\n";
for(int i = 1; i <= no_of_elements; i++)
{
cout << colour[i] << " ";
}
cout << "\n";
}
int main()
{
const int MAX_N = 1001;
vector <int> lowest_prime_factor(MAX_N, 0);
precompute(lowest_prime_factor, MAX_N);
int no_of_test_cases;
cin >> no_of_test_cases;
while(no_of_test_cases--)
{
solve(lowest_prime_factor);
}
return 0;
}
================================================
FILE: 2020/Div 2/630 Div 2/Explanations/Exercising Walk Explanation.txt
================================================
The X and Y axes are independent of each other.
The optimal solution is to use a 'waiting' move.
Keep going [L, R] till there is only one path left and then follow it
It has to be within [X1, X2] and [Y1, Y2]
We have to check the case where (X1 = X2) or (Y1 = Y2) seperately as it is not possible to make even 1 move
-----
void solve()
{
long long up, down, left, right;
cin >> left >> right >> down >> up;
long long x, y, x1, y1, x2, y2;
cin >> x >> y >> x1 >> y1 >> x2 >> y2;
if(x1 == x2)
{
if(left + right > 0)
{
cout << "NO\n";
return;
}
}
else
{
long long end = x - left + right;
if(end < x1 || x2 < end)
{
cout << "NO\n";
return;
}
}
if(y1 == y2)
{
if(up + down > 0)
{
cout << "NO\n";
return;
}
}
else
{
long long end = y - down + up;
if(end < y1 || y2 < end)
{
cout << "NO\n";
return;
}
}
cout << "Yes\n";
}
================================================
FILE: 2020/Div 2/630 Div 2/Explanations/Height All The Same Explanation.txt
================================================
We have to make 2 crucial observations
1. The integer doesn't matter. Only the parity matters.
We can make all integers of the same parity equal.
2. It is possible to flip the parities of two cells u and v on the board,
no matter where they are !
Suppose there is a path from u to v
u t1 t2 t3 ... tk v
We will apply the second operation to
(u, t1)
(t1, t2)
.
.
,
(tk, v)
u and v increase by 1 whereas all others increase by 2.
This means that we can flip the parities of any two cells together.
-----
If there are an even number of even cells, we can make them all odd
If there are an even number of odd cells, we can make them all even
The only situation where we can't make all integers equal is when
there are an odd number of even as well odd number of odd cells
-----
Now, let us try to count the number of boards.
Let G = MN
Let the number of ways to fill a cell be R - (L - 1) = N
Now, if G is odd, then there must be either an even number of odd cells or an even number of even cells
So every board is good.
In that case, the answer = N^G
------
What is G is even ?
We want the cases where either there are an even number of Even cells or even number of Odd cells
Let the number of ways to fill a cell with an even number be E
Let the number of ways to fill a cell with an odd number be O
We want
C(G, 0) E^0 O^G + C(G, 2) E^2 O^{G - 2} + ... + C(G, G) E^G O^0
There is a beautiful combinatoric trick for this
This is basically the expansion of (O + E)^G with the odd terms removed
Let us look at the expansion of (O + E)^G !
Here, all the odd terms have a negative sign !
So, (O + E)^G + (O + E)^G gives us twice the number we want.
So, we have to divide this by 2.
We have to be careful that we are dealing it via MOD, so we have to multiply with inverse(2) rather than divide by 2
-----
#include <iostream>
using namespace std;
long long power_mod(long long x, long long power, long long MOD)
{
long long result = 1;
while(power)
{
if(power%2)
result = (result*x)%MOD;
x = (x*x)%MOD;
power = power >> 1;
}
return result;
}
long long inverse(long long x, long long MOD)
{
return power_mod(x, MOD - 2, MOD);
}
int main()
{
long long rows, columns, left, right;
cin >> rows >> columns >> left >> right;
long long grid = rows*columns;
long long answer = 1;
const int MOD = 998244353;
if(grid%2 == 1)
{
long long one_cell = right - (left - 1);
answer = power_mod(one_cell, grid, MOD);
}
else
{
long long even_cells = right/2 - (left - 1)/2;
long long odd_cells = (right - (left - 1)) - even_cells;
answer = (power_mod(odd_cells + even_cells, grid, MOD) + power_mod(even_cells - odd_cells, grid, MOD))%MOD;
answer *= inverse(2, MOD);
answer %= MOD;
}
cout << answer << "\n";
return 0;
}
================================================
FILE: 2020/Div 2/630 Div 2/Explanations/K Complete Word Explanation.txt
================================================
Let f(i, alpha) be the frequency of alphabet 'alpha' in positions = i (mod k)
We will compute this first.
Now, the character at 0 (mod k) must be the same character at K - 1 (mod k)
-----
We will go through all positions mod k and find the cost of making it = alpha
The number of steps in making all positions = i and j (mod k) = alpha is
total_i - frequency(i, alpha) + total_j - frequency(j, alpha)
-----
void solve()
{
const int NO_OF_ALPHABETS = 26;
int length, period;
cin >> length >> period;
vector <vector <int> > frequency(period, vector <int> (NO_OF_ALPHABETS + 1, 0));
string S;
cin >> S;
for(int i = 0; i < length; i++)
{
frequency[i%period][S[i] - 'a']++;
}
int minimum_moves = 0;
for(int i = 0, j = period - 1; i <= j; i++, j--)
{
int moves_here = length;
if(i == j)
{
int total = length/period + (length%period >= i && i > 0);
for(int alpha = 0; alpha < NO_OF_ALPHABETS; alpha++)
{
moves_here = min(moves_here, total - frequency[i][alpha]);
}
}
else
{
int total_i = length/period + (length%period >= i && i > 0);
int total_j = length/period + (length%period >= j);
for(int alpha = 0; alpha < NO_OF_ALPHABETS; alpha++)
{
moves_here = min(moves_here, total_i - frequency[i][alpha] + total_j - frequency[j][alpha]);
}
}
//cout << "I = " << i << " J = " << j << " Moves = " << moves_here << "\n";
minimum_moves += moves_here;
}
cout << minimum_moves << "\n";
}
================================================
FILE: 2020/Div 2/630 Div 2/Explanations/Walk on Matrix Explanation.txt
================================================
Here is the basic idea -
We will make a matrix such that the DP matrix gives 0 as the answer and the actual answer
is k.
Here, is what we will do.
Suppose, k = 10101
We need 3 integers
1. The 'Full Form' = 111111
2. The MSB = 100000
3. Complement = 101010
Here is the 3x3 matrix we will create -
111111 010101 101010
100000 010101 101010
111111 111111 010101
-----
Here is the DP Matrix
111111 010101 000000
100000 010101 000000
100000 100000 000000
-----
The Answer in the DP Matrix is 0, and the answer in the original matrix is 010101,
Which is what is required.
-----
k = 0 is a special case where we will print a single integer
-----
How do we get this idea ?
Look at the example test case given.
We must create a matrix where following the DP path will always gives 0.
We do this by adding an additional bit and setting it so it has no bit in common with k
And then try to create a path in such a way that the DP path will give the answer = 0
The DP Path makes the answer 0
The optimal path gives us the answer k
-----
int is_bit_set(int n, int bit)
{
return ((n&(1LL << bit)) != 0);
}
int all_ones(int n)
{
return ( (n&(n + 1)) == 0);
}
int get_msb(int n)
{
for(int bit = MAX_BITS; bit >= 0; bit--)
{
if(is_bit_set(n, bit))
{
return bit;
}
}
return 0;
}
int complete(int n)
{
int most_significant_bit = get_msb(n);
int complete_n = 0;
for(int bit = most_significant_bit; bit >= 0; bit--)
{
complete_n |= (1LL << bit);
}
return complete_n;
}
int main()
{
int n;
cin >> n;
if(n == 0)
{
cout << "1 1\n";
cout << "1\n";
return 0;
}
int full_form = (all_ones(n) ? 4*n + 3: 2*complete(n) + 1);
int complement = full_form - n;
int msb = (1 << get_msb(full_form));
matrix[1][1] = full_form; matrix[1][2] = n; matrix[1][3] = complement;
m
gitextract_wq208o93/ ├── 2020/ │ ├── Combined Divisions/ │ │ ├── 621 Div 1 + 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Cow and Fields Explanation.txt │ │ │ │ ├── Cow and Friend Explanation.txt │ │ │ │ ├── Cow and Haybales Explanation.txt │ │ │ │ ├── Cow and Message Explanation.txt │ │ │ │ └── Cows and Treats Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Cow and Fields.cpp │ │ │ ├── Cow and Haybales.cpp │ │ │ ├── Cow and Message.cpp │ │ │ └── Cows and Treats.cpp │ │ ├── CodeForces Global Round 7/ │ │ │ ├── Explanations/ │ │ │ │ ├── Bad Ugly Numbers Explanation.txt │ │ │ │ ├── Maximums Explanation.txt │ │ │ │ ├── Permutation Partitions Explanation.txt │ │ │ │ └── Prefix Suffix Palindrome (Easy Version) Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Bad Ugly Numbers.cpp │ │ │ ├── Maximums.cpp │ │ │ ├── Permutation Partitions.cpp │ │ │ └── Prefix Suffix Palindrome (Easy Version).cpp │ │ └── Ozone Tech Challenge 2020/ │ │ ├── Explanations/ │ │ │ ├── Kuroni and Impossible Calculation Explanation.txt │ │ │ ├── Kuroni and Punishment Explanation.txt │ │ │ ├── Kuroni and Simple Strings Explanation.txt │ │ │ ├── Kuroni and the Celebration Explanation.txt │ │ │ └── Kuroni and the Gifts Explanation.txt │ │ └── Programs/ │ │ ├── Kuroni and Impossible Calculation.cpp │ │ ├── Kuroni and Punishment.cpp │ │ ├── Kuroni and Simple Strings.cpp │ │ ├── Kuroni and the Celebration.cpp │ │ └── Kuroni and the Gifts.cpp │ ├── Div 2/ │ │ ├── 606 Div 2 Technocup 2020 Elimination Round 4/ │ │ │ ├── Explanations/ │ │ │ │ ├── As Simple as One and Two Explanation.txt │ │ │ │ ├── Happy Birthday Polycarp Explanation.txt │ │ │ │ └── Make Them Odd Explanation.txt │ │ │ └── Programs/ │ │ │ ├── As Simple as One and Two.cpp │ │ │ ├── Happy Birthday Polycarp.cpp │ │ │ └── Make Them Odd.cpp │ │ ├── 609 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Domino for Young Explanation.txt │ │ │ │ ├── Equation Explanation.txt │ │ │ │ ├── Long Beautiful Integer Explanation.txt │ │ │ │ └── Modulo Equality Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Domino for Young.cpp │ │ │ ├── Equation.cpp │ │ │ ├── Long Beautiful Integer.cpp │ │ │ └── Modulo Equality.cpp │ │ ├── 612 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Angry Students Explanation.txt │ │ │ │ ├── Hyperset Explanation.txt │ │ │ │ └── Madhouse (Easy Version) Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Angry Students.cpp │ │ │ ├── Hyperset.cpp │ │ │ └── Madhouse (Easy Version).cpp │ │ ├── 613 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Dr Evil Underscores Explanation.txt │ │ │ │ ├── Fadi and LCM Explanation.txt │ │ │ │ ├── Just Eat It Explanation.txt │ │ │ │ └── Mezo Playing Zoma Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Dr Evil Underscores.cpp │ │ │ ├── Fadi and LCM.cpp │ │ │ ├── Just Eat It.cpp │ │ │ └── Mezo Playing Zoma.cpp │ │ ├── 616 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Array Sharpening Explanation.txt │ │ │ │ ├── Even But Not Even Explanation.txt │ │ │ │ └── Mind Control Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Array Sharpening.cpp │ │ │ ├── Even But Not Even.cpp │ │ │ └── Mind Control.cpp │ │ ├── 618 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ └── Anu has a Function Explanation.txt │ │ │ └── Programs/ │ │ │ └── Anu has a Function.cpp │ │ ├── 619 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Ayoub's Function Explanation.txt │ │ │ │ ├── Motarack's Birthday Explanation.txt │ │ │ │ ├── Three Strings Explanation.txt │ │ │ │ └── Time to Run Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Ayoub's Function.cpp │ │ │ ├── Motarack's Birthday.cpp │ │ │ ├── Three Strings.cpp │ │ │ └── Time to Run.cpp │ │ ├── 620 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── 1-Trees and Queries Explanation.txt │ │ │ │ ├── Air Conditioner Explanation.txt │ │ │ │ ├── Longest Palindrome Explanation.txt │ │ │ │ ├── Shortest and Longest LIS Explanation.txt │ │ │ │ └── Two Rabbits Explanation.txt │ │ │ └── Programs/ │ │ │ ├── 1-Trees and Queries.cpp │ │ │ ├── Air Conditioner.cpp │ │ │ ├── Longest Palindrome.cpp │ │ │ ├── Shortest and Longest LIS.cpp │ │ │ └── Two Rabbits.cpp │ │ ├── 622 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Fast Food Restaurant Explanation.txt │ │ │ │ ├── Sky Scrapers (Hard Version) Explanation.txt │ │ │ │ └── Skyscrapers (Easy Version) Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Fast Food Restaurants.cpp │ │ │ ├── Skyscrapers (Easy Version).cpp │ │ │ └── Skyscrapers (Hard Version).cpp │ │ ├── 623 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Dead Pixel Explanation.txt │ │ │ │ ├── Homecoming Explanation.txt │ │ │ │ ├── Recommendations Explanation.txt │ │ │ │ └── Restoring Permutation Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Dead Pixel.cpp │ │ │ ├── Homecoming.cpp │ │ │ ├── Recommendations.cpp │ │ │ └── Restoring Permutations.cpp │ │ ├── 625 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Contest for Robots Explanation.txt │ │ │ │ ├── Journey Planning Explanation.txt │ │ │ │ ├── Navigation System Explanation.txt │ │ │ │ └── Remove Adjacent Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Contest for Robotos.cpp │ │ │ ├── Journey Planning.cpp │ │ │ ├── Navigation System.cpp │ │ │ └── Remove Adjacent.cpp │ │ ├── 626 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Count Subrectangles Explanation.txt │ │ │ │ ├── Even Subset Sum Problem Explanation.txt │ │ │ │ └── Unusual Competitions Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Counting Subrectangles.cpp │ │ │ ├── Even Subset Sum Problem.cpp │ │ │ └── Unusual Competitions.cpp │ │ ├── 628 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Copy Copy Copy Copy Copy Explanation.txt │ │ │ │ ├── Ehab and GCD Explanation.txt │ │ │ │ ├── Ehab and Path-etic MEX Explanation.txt │ │ │ │ └── Ehab and XORcist Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Copy Copy Copy Copy Copy.cpp │ │ │ ├── Ehab and GCD.cpp │ │ │ ├── Ehab and Pathetic MEX.cpp │ │ │ └── Ehab and XORcist.cpp │ │ ├── 630 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Composite Coloring Explanation.txt │ │ │ │ ├── Exercising Walk Explanation.txt │ │ │ │ ├── Height All The Same Explanation.txt │ │ │ │ ├── K Complete Word Explanation.txt │ │ │ │ └── Walk on Matrix Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Composite Coloring.cpp │ │ │ ├── Exercising Walk.cpp │ │ │ ├── Height All the Same.cpp │ │ │ ├── K Complete Word.cpp │ │ │ └── Walk on Matrix.cpp │ │ ├── 631 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Dreamoon Likes Coloring Explanation.txt │ │ │ │ ├── Dreamoon Likes Permutations Explanation.txt │ │ │ │ ├── Dreamoon Likes Sequences Explanation.txt │ │ │ │ └── Dreamoon and Ranking Collection Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Dreamoon Likes Coloring.cpp │ │ │ ├── Dreamoon Likes Permutations.cpp │ │ │ ├── Dreamoon Likes Sequences.cpp │ │ │ └── Dreamoon and Ranking Collection.cpp │ │ ├── 632 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Eugene and Array Explanation.txt │ │ │ │ ├── Kate and Imperfection Explanation.txt │ │ │ │ ├── Kind Anton Explanation.txt │ │ │ │ └── Little Artem Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Eugene and Array.cpp │ │ │ ├── Kate and Imperfection.cpp │ │ │ ├── Kind Anton.cpp │ │ │ └── Little Artem.cpp │ │ ├── 633 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Filling Diamonds Explanation.txt │ │ │ │ ├── Powered Addition Explanation.txt │ │ │ │ └── Sorted Adjacent Differences Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Filling Diamonds.cpp │ │ │ ├── Powered Addition.cpp │ │ │ └── Sorted Adjacent Differences.cpp │ │ ├── 635 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Ichime and Triangle Explanation.txt │ │ │ │ ├── Kana and Dragon Quest Game Explanation.txt │ │ │ │ ├── Linova and Kingdom Explanation.txt │ │ │ │ └── Xenia and Colourful Gems Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Ichihime and Triangle.cpp │ │ │ ├── Kana and Dragon Quest game.cpp │ │ │ ├── Linova and Kingdom.cpp │ │ │ └── Xenia and Colourful Gems.cpp │ │ ├── 637 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Nastya and Door Explanation.txt │ │ │ │ ├── Nastya and Rice Explanation.txt │ │ │ │ ├── Nastya and Scoreboard Explanation.txt │ │ │ │ └── Nastya and Strange Generator Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Nastya and Door.cpp │ │ │ ├── Nastya and Rice.cpp │ │ │ ├── Nastya and Scoreboard.cpp │ │ │ └── Nastya and Strange Generator.cpp │ │ ├── 638 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ └── Pheonix and Balance Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Pheonix and Balance.cpp │ │ │ └── Phoenix and Balance.cpp │ │ ├── 639 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Card Construction Explanation.txt │ │ │ │ ├── Hilbert Hotel Explanation.txt │ │ │ │ ├── Monopole Magnets Explanation.txt │ │ │ │ ├── Puzzle Pieces Explanation.txt │ │ │ │ ├── Quantifier Question Explanation.txt │ │ │ │ ├── Resume Review Explanation.txt │ │ │ │ └── Resume Review.cpp │ │ │ └── Programs/ │ │ │ ├── Card Construction.cpp │ │ │ ├── Hilbert Hotel.cpp │ │ │ ├── Monopole Magnets.cpp │ │ │ ├── Puzzle Pieces.cpp │ │ │ ├── Quantifier Question.cpp │ │ │ └── Resume Review.cpp │ │ ├── 641 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Orac and Factors Explanation.txt │ │ │ │ ├── Orac and LCM Explanation.txt │ │ │ │ └── Orac and Models Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Orac and Factors.cpp │ │ │ ├── Orac and LCM.cpp │ │ │ └── Orac and Models.cpp │ │ ├── 643 Div 2/ │ │ │ ├── Explanation/ │ │ │ │ ├── Counting Triangles Explanation.txt.txt │ │ │ │ ├── Game with Array Explanation.txt │ │ │ │ ├── Restorer Distance Explanation.txt │ │ │ │ ├── Sequence with Digits Explanation.txt │ │ │ │ └── Young Explorer Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Counting Triangles.cpp │ │ │ ├── Game with Array.cpp │ │ │ ├── Restorer Distance.cpp │ │ │ ├── Sequence with Digits.cpp │ │ │ └── Young Explorer.cpp │ │ ├── 647 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Johnny and Ancient Computers Explanation.txt │ │ │ │ ├── Johnny and Another Rating Drop Explanation.txt │ │ │ │ ├── Johnny and Contribution Explanation.txt │ │ │ │ └── Johnny and His Hobbies Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Johnny and Ancient Computers.cpp │ │ │ ├── Johnny and Another Rating Drop.cpp │ │ │ ├── Johnny and Contribution.cpp │ │ │ └── Johnny and His Hobbies.cpp │ │ ├── 648 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Maximum Subsequence Value Explanation.txt │ │ │ │ ├── Secure Password Explanation.txt.txt │ │ │ │ └── Swaps Again Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Matrix Game.cpp │ │ │ ├── Maximum Subsequence Value.cpp │ │ │ ├── Rotation Matching.cpp │ │ │ ├── Secure Password.cpp │ │ │ ├── Swaps Again.cpp │ │ │ └── Trouble Sort.cpp │ │ ├── 651 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Binary Subsequence Rotation Explanation.txt │ │ │ │ ├── GCD Compression Explanation.txt │ │ │ │ ├── Maximum GCD Explanation.txt │ │ │ │ ├── Number Game Explanation.txt │ │ │ │ └── Odd Even Subsequence Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Binary Subsequence Rotation.cpp │ │ │ ├── GCD Compression.cpp │ │ │ ├── Maximum GCD.cpp │ │ │ ├── Number Game.cpp │ │ │ └── Odd-Even Subsequence.cpp │ │ ├── 658 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Common Subsequence Explanation.txt │ │ │ │ ├── Sequential Nim Explanation.txt │ │ │ │ └── Unmerge Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Common Subsequence.cpp │ │ │ ├── Sequential Nim.cpp │ │ │ └── Unmerge.cpp │ │ ├── 659 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Common Prefix Explanation.txt │ │ │ │ ├── Prefix Flip (Easy Version) Explanation.txt │ │ │ │ ├── Prefix Flip (Hard Version) Explanation.txt │ │ │ │ └── String Transformation 1 Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Common Prefixes.cpp │ │ │ ├── Prefix Flip (Easy Version).cpp │ │ │ ├── Prefix Flip (Hard Version).cpp │ │ │ └── String Transformation 1.cpp │ │ ├── 660 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Captain Flint and Crew Recruitment Explanation.txt │ │ │ │ └── Captain Flint and a Long Voyage Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Captain Flint and Crew Recruitment.cpp │ │ │ └── Captain Flint and a Long Voyage.cpp │ │ ├── 662 Div 2/ │ │ │ └── Programs/ │ │ │ └── Rainbow Dash, Fluttershy and Chess Coloring.cpp │ │ ├── 678 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Bandit in a City Explanation.txt │ │ │ │ ├── Binary Search Explanation.txt │ │ │ │ ├── Complicated Computations Explanation.txt │ │ │ │ ├── Prime Square Explanation.txt │ │ │ │ ├── Reorder Explanation.txt │ │ │ │ └── Sum Over Subsets Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Bandit in a City.cpp │ │ │ ├── Binary Search.cpp │ │ │ ├── Complicated Computations.cpp │ │ │ ├── Prime Square.cpp │ │ │ ├── Reorder.cpp │ │ │ └── Sum Over Subsets.cpp │ │ ├── 684 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Binary Table Explanation.txt │ │ │ │ ├── Buy the String Explanation.txt │ │ │ │ ├── Graph Subset Problem Explanation.txt │ │ │ │ ├── Greedy Shopping Explanation.txt │ │ │ │ └── Sum of Medians Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Binary Table.cpp │ │ │ ├── Buy the String.cpp │ │ │ ├── Graph Subset Problem.cpp │ │ │ ├── Greedy Shopping.cpp │ │ │ └── Sum of Medians.cpp │ │ ├── 685 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Bitwise Queries Explanation.txt │ │ │ │ ├── Circle Game Explanation.txt │ │ │ │ ├── Non Substring Subsequence Explanation.txt │ │ │ │ ├── Nullify the Matrix Explanation.txt │ │ │ │ ├── String Equality Explanation.txt │ │ │ │ └── Subtract or Divide Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Bitwise Queries (Hard Version).cpp │ │ │ ├── Bitwise Queries.cpp │ │ │ ├── Circle Game.cpp │ │ │ ├── Non-Substring Subsequence .cpp │ │ │ ├── Nullify the Matrix.cpp │ │ │ ├── String Equality.cpp │ │ │ └── Subtract or Divide .cpp │ │ ├── 687 Div 2 Technocup 2021 Elimination Round 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Bouncing Ball Explanation.txt │ │ │ │ ├── New Game Plus Explanation.txt │ │ │ │ ├── Prison Break Explanation.txt │ │ │ │ ├── Repainting Street Explanation.txt │ │ │ │ └── XOR Gun Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Bouncing Ball.cpp │ │ │ ├── New Game Plus.cpp │ │ │ ├── Prison Break.cpp │ │ │ ├── Repainting Street.cpp │ │ │ └── XOR Gun.cpp │ │ ├── 688 Div 2/ │ │ │ ├── Explanation/ │ │ │ │ └── Suffix Operations Explanation.txt │ │ │ └── Programs/ │ │ │ └── Suffix Operations.cpp │ │ ├── 689 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Divide and Summarize Explanation.txt │ │ │ │ ├── Find a Spruce Explanation.txt │ │ │ │ ├── Mathematical Expression Explanation.txt │ │ │ │ ├── Random Events Explanation.txt │ │ │ │ ├── String Generation Explanation.txt │ │ │ │ └── Water Level Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Divide and Summarize.cpp │ │ │ ├── Find the Spruce.cpp │ │ │ ├── Mathematical Expression.cpp │ │ │ ├── Random Events.cpp │ │ │ ├── String Generation.cpp │ │ │ └── Water Level.cpp │ │ ├── 691 Div 2/ │ │ │ ├── Explanation/ │ │ │ │ ├── Move and Turn Explanation.txt │ │ │ │ ├── Red Blue Shuffle Explanation.txt │ │ │ │ └── Row GCD Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Move and Turn.cpp │ │ │ ├── Red Blue Shuffle.cpp │ │ │ └── Row GCD.cpp │ │ ├── 692 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── Fair Numbers Explanation.txt │ │ │ │ └── In Game Chat Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Fair Numbers.cpp │ │ │ └── In Game Chat.cpp │ │ └── CodeCraft 2020/ │ │ ├── Explanations/ │ │ │ ├── Grade Allocation Explanation.txt │ │ │ ├── Nash Matrix Explanation.txt │ │ │ ├── Primitive Primes Explanation.txt │ │ │ ├── String Modification Explanation.txt │ │ │ └── Team Building Explanation.txt │ │ └── Programs/ │ │ ├── Grade Allocation.cpp │ │ ├── Nash Matrix.cpp │ │ ├── Primitive Primes.cpp │ │ ├── String Modification.cpp │ │ └── Team Building.cpp │ ├── Div 3/ │ │ ├── 605 Div 3/ │ │ │ ├── Explanations/ │ │ │ │ ├── Nearly Opposite Parity.cpp │ │ │ │ └── Remove One Element Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Nearly Opposite Parity.cpp │ │ │ └── Remove One Element.cpp │ │ ├── 611 Div 3/ │ │ │ ├── Explanations/ │ │ │ │ ├── Candies Division Explanation.txt │ │ │ │ ├── Christmas Trees Explanation.txt │ │ │ │ ├── DIY Garland Explanation.txt │ │ │ │ ├── Friends and Gifts Explanation.txt │ │ │ │ ├── Minutes Before the New Year Explanation.txt │ │ │ │ └── New Year Parties Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Candies Division.cpp │ │ │ ├── Christmas Trees.cpp │ │ │ ├── DIY Garland.cpp │ │ │ ├── Friends and Gifts.cpp │ │ │ ├── Minutes Before the New Year.cpp │ │ │ └── New Year Parties.cpp │ │ ├── 615 Div 3/ │ │ │ ├── Explanations/ │ │ │ │ ├── Collecting Coins Explanation.txt │ │ │ │ ├── Collecting Packages Explanation.txt │ │ │ │ ├── MEX Maximising Explanation.txt │ │ │ │ ├── Obtain a Permutation Explanation.txt │ │ │ │ ├── Product of Three Numbers Explanation.txt │ │ │ │ └── Three Paths on a Tree Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Collecting Coins.cpp │ │ │ ├── Collecting Packages.cpp │ │ │ ├── MEX Maximising.cpp │ │ │ ├── Obtain a Permutation.cpp │ │ │ ├── Paths on a Tree.cpp │ │ │ └── Product of Three Numbers.cpp │ │ ├── 617 Div 3/ │ │ │ ├── Explanations/ │ │ │ │ ├── Array with Odd Sum Explanation.txt │ │ │ │ ├── Fight with Monsters Explanation.txt │ │ │ │ ├── Food Buying Explanation.txt │ │ │ │ ├── String Colouring (Easy Version) Explanation.txt │ │ │ │ ├── String Colouring (Hard Version) Explanation.txt │ │ │ │ └── Yet Another Walking Robot Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Array with Odd Sum.cpp │ │ │ ├── Fight with Monsters.cpp │ │ │ ├── Food Buying.cpp │ │ │ ├── String Coloring (Hard Version).cpp │ │ │ ├── String Colouring (Easy Version).cpp │ │ │ └── Yet Another Walking Robot.cpp │ │ ├── 624 Div 3/ │ │ │ ├── Explanations/ │ │ │ │ ├── Add Odd or Subtract Even Explanation.txt │ │ │ │ ├── Construct the Binary Tree Explanation.txt │ │ │ │ ├── Moving Points Explanation.txt │ │ │ │ ├── Perform the Combo Explanation.txt │ │ │ │ ├── Three Integers Explanation.txt │ │ │ │ └── WeirdSort Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Add Odd or Subtract Even.cpp │ │ │ ├── Construct the Binary Tree.cpp │ │ │ ├── Moving Points.cpp │ │ │ ├── Perform the Combo.cpp │ │ │ ├── Three Integers.cpp │ │ │ └── Weirdsort.cpp │ │ ├── 627 Div 3/ │ │ │ ├── Explanations/ │ │ │ │ ├── Frog Jumps Explanation.txt │ │ │ │ ├── Maximum White Subtree Explanation.txt │ │ │ │ ├── Pair of Topics Explanation.txt │ │ │ │ ├── Sleeping Schedule Explanation.txt │ │ │ │ ├── Yet Another Palindrome Problem Explanation.txt │ │ │ │ └── Yet Another Tetris Problem Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Frog Jumps.cpp │ │ │ ├── Maximum White Subtree.cpp │ │ │ ├── Pair of Topics.cpp │ │ │ ├── Sleeping Schedule.cpp │ │ │ ├── Yet Another Palindrome Problem.cpp │ │ │ └── Yet Another Tetris Problem.cpp │ │ ├── 629 Div 3/ │ │ │ ├── Explanations/ │ │ │ │ ├── Carousel Explanation.txt │ │ │ │ ├── Divisibility Problem Explanation.txt │ │ │ │ ├── Kth Beautiful String Explanation.txt │ │ │ │ ├── Ternary XOR Explanation.txt │ │ │ │ └── Tree Queries Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Carousel.cpp │ │ │ ├── Divisibility Problem.cpp │ │ │ ├── Kth Beautiful String.cpp │ │ │ ├── Ternary XOR.cpp │ │ │ └── Tree Queries.cpp │ │ ├── 634 Div 3/ │ │ │ ├── Explanations/ │ │ │ │ ├── Anti Sudoku Explanation.txt │ │ │ │ ├── Candies and Two Sisters Explanation.txt │ │ │ │ ├── Construct the String Explanation.txt │ │ │ │ ├── Robots on a Grid Explanation.txt │ │ │ │ ├── Three Blocks Palindrome Explanation.txt │ │ │ │ └── Two Teams Composing Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Anti Sudoku.cpp │ │ │ ├── Candies and Two Sisters.cpp │ │ │ ├── Construct the String.cpp │ │ │ ├── Robots on a Grid.cpp │ │ │ ├── Three Blocks Palindrome.cpp │ │ │ └── Two Teams Composing.cpp │ │ ├── 636 Div 3/ │ │ │ ├── Explanations/ │ │ │ │ └── Constant Palindrome Sum Explanation.txt │ │ │ └── Programs/ │ │ │ └── Constant Palindrome Sum.cpp │ │ ├── 661 Div 3/ │ │ │ ├── Explanations/ │ │ │ │ ├── Binary String to Subsequence Explanation.txt │ │ │ │ ├── Boats Competition Explanation.txt │ │ │ │ ├── Gifts Fixing Explanation.txt │ │ │ │ └── Remove Smallest Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Binary String to Subsequences.cpp │ │ │ ├── Boats Competition.cpp │ │ │ ├── Gifts Fixing.cpp │ │ │ └── Remove Smallest.cpp │ │ ├── 674 Div 3/ │ │ │ └── Programs/ │ │ │ └── Number of Subsequences.cpp │ │ ├── 686 Div 3/ │ │ │ ├── Explanations/ │ │ │ │ ├── Array Partition Explanation.txt │ │ │ │ ├── Number Into Sequence Explanation.txt │ │ │ │ ├── Number of Simple Paths Explanation.txt │ │ │ │ ├── Sequence Transformation Explanation.txt │ │ │ │ ├── Special Permutation Explanation.txt │ │ │ │ └── Unique Bid Auction Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Array Partition.cpp │ │ │ ├── Number Into Sequence.cpp │ │ │ ├── Number of Simple Paths.cpp │ │ │ ├── Sequence Transformation.cpp │ │ │ ├── Special Permutation.cpp │ │ │ └── Unique Bid Auction.cpp │ │ └── Explanations/ │ │ └── Number of Subsequences Explanation.txt │ ├── Educational Rounds/ │ │ ├── Educational Round 78/ │ │ │ ├── Explanations/ │ │ │ │ ├── Berry Jam Explanation.txt │ │ │ │ ├── Cards Explanation.txt │ │ │ │ ├── Shuffle Hashing Explanation.txt │ │ │ │ └── Tests for Problem D Explanation.txt │ │ │ └── Programs/ │ │ │ ├── A and B.cpp │ │ │ ├── Berry Jam.cpp │ │ │ ├── Shuffle Hashing.cpp │ │ │ └── Tests for Problem D.cpp │ │ ├── Educational Round 79/ │ │ │ ├── Explanations/ │ │ │ │ ├── New Year Garland Explanation.txt │ │ │ │ ├── Stack of Presents Explanation.txt │ │ │ │ └── Verse for Santa Explanation.txt │ │ │ └── Programs/ │ │ │ ├── New Year Garland.cpp │ │ │ ├── Stack of Presents.cpp │ │ │ └── Verse for Santa.cpp │ │ ├── Educational Round 80/ │ │ │ ├── Explanations/ │ │ │ │ ├── Deadline Explanation.txt │ │ │ │ ├── Minimax Problem Explanation.txt │ │ │ │ ├── Two Arrays Alternate Solution Explanation.txt │ │ │ │ ├── Two Arrays Explanation.txt │ │ │ │ └── Yet Another Meme Problem Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Deadline.cpp │ │ │ ├── Minimax Problem.cpp │ │ │ ├── Two Arrays Alternate Solution.cpp │ │ │ ├── Two Arrays.cpp │ │ │ └── Yet Another Meme Problem.cpp │ │ ├── Educational Round 81/ │ │ │ ├── Explanation/ │ │ │ │ ├── Display the Number Explanation.txt │ │ │ │ ├── Infinite Prefixes Explanation.txt │ │ │ │ ├── Obtain the String Explanation.txt │ │ │ │ └── Same GCDs Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Display the Number.cpp │ │ │ ├── Infinite Prefixes.cpp │ │ │ ├── Obtain the String.cpp │ │ │ └── Same GCDs.cpp │ │ ├── Educational Round 82/ │ │ │ ├── Explanations/ │ │ │ │ ├── Erasing Zeroes Explanation.txt │ │ │ │ ├── National Project Explanation.txt │ │ │ │ └── Perfect Keyboard Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Erasing Zeroes.cpp │ │ │ ├── Fill the Bag.cpp │ │ │ ├── National Project.cpp │ │ │ └── Perfect Keyboard.cpp │ │ ├── Educational Round 83/ │ │ │ ├── Explanations/ │ │ │ │ ├── Adding Powers Explanation.txt │ │ │ │ ├── Array Shrinking Explanation.txt │ │ │ │ ├── Bogosort Explanation.txt │ │ │ │ ├── Count the Arrays Explanation.txt │ │ │ │ └── Two Regular Polygons Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Adding Powers.cpp │ │ │ ├── Array Shrinking.cpp │ │ │ ├── Bogosort.cpp │ │ │ ├── Count the Arrays.cpp │ │ │ └── Two Regular Polygons.cpp │ │ ├── Educational Round 84/ │ │ │ ├── Explanations/ │ │ │ │ ├── Count the Blocks Explanation.txt │ │ │ │ └── Sum of Odd Integers Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Count the Blocks.cpp │ │ │ └── Sum of Odd Integers.cpp │ │ ├── Educational Round 85/ │ │ │ ├── Explanations/ │ │ │ │ ├── Circle of Monsters Explanation.txt │ │ │ │ ├── Divisor Paths Explanation.txt │ │ │ │ ├── Level Statistics Explanation.txt │ │ │ │ ├── Middle Class Explanation.txt │ │ │ │ └── Minimum Euler Cycle Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Circle of Monsters.cpp │ │ │ ├── Divisor Paths.cpp │ │ │ ├── Level Statistics.cpp │ │ │ ├── Middle Class.cpp │ │ │ └── Minimum Euler Cycle.cpp │ │ ├── Educational Round 86/ │ │ │ ├── Explanations/ │ │ │ │ ├── Binary Period Explanation.txt │ │ │ │ ├── Road to Zero Explanation.txt │ │ │ │ └── Yet Another Counting Problem Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Binary Period.cpp │ │ │ ├── Road to Zero.cpp │ │ │ └── Yet Another Counting Problem.cpp │ │ ├── Educational Round 90/ │ │ │ ├── Explanations/ │ │ │ │ ├── 01 Game Explanation.txt │ │ │ │ ├── Donut Shops Explanation.txt │ │ │ │ ├── Maximum Sum on Even Positions Explanation.txt │ │ │ │ └── Pluses and Minuses Explanation.txt │ │ │ └── Programs/ │ │ │ ├── 01 Game.cpp │ │ │ ├── Donut Shops.cpp │ │ │ ├── Maximum Sum on Even Positions.cpp │ │ │ └── Pluses and Minuses.cpp │ │ ├── Educational Round 92/ │ │ │ ├── Explanations/ │ │ │ │ └── Good String Explanation.txt │ │ │ └── Programs/ │ │ │ └── Good String.cpp │ │ └── Educational Round 93/ │ │ ├── Explanations/ │ │ │ ├── Bad Triangle Explanation.txt │ │ │ ├── Colored Rectangles Explanation.txt │ │ │ ├── Good Subarrays Explanation.txt │ │ │ └── Substring Removal Game Explanation.txt │ │ └── Programs/ │ │ ├── Bad Triangle.cpp │ │ ├── Colored Rectangles.cpp │ │ ├── Good Subarrays.cpp │ │ └── Substring Removal Game.cpp │ ├── Good Bye 2019/ │ │ ├── Explanations/ │ │ │ ├── Card Game Explanation.txt │ │ │ ├── Interesting Subarray Explanation │ │ │ └── Make Good Explanation.txt │ │ └── Programs/ │ │ ├── Card Game.cpp │ │ ├── Interesting Subarray.cpp │ │ └── Make Good.cpp │ ├── Hello 2020/ │ │ ├── Explanations/ │ │ │ ├── New Year and Ascent Sequences Explanation.txt │ │ │ ├── New Year and Conferences Explanation.txt │ │ │ ├── New Year and Naming Explanation │ │ │ └── New Year and Permutation Explanation.txt │ │ └── Programs/ │ │ ├── New Year and Ascent Sequences.cpp │ │ ├── New Year and Conferences.cpp │ │ ├── New Year and Naming.cpp │ │ └── New Year and Permutation.cpp │ └── Practice/ │ ├── Explanations/ │ │ ├── Alternative Thinking Explanation.txt │ │ ├── Ant Colony Explanation.txt │ │ ├── Anton and Chess Explanation.txt │ │ ├── Anton and Ira Explanation.txt │ │ ├── Ants in Leaves Explanation.txt │ │ ├── Army Creation Explanation.txt │ │ ├── Bargain Explanation.txt │ │ ├── Concatenated Multiples Explanation.txt │ │ ├── Count Pairs Explanation.txt │ │ ├── Cram Time Explanation.txt │ │ ├── Cycles Explanation.txt │ │ ├── Elections Explanation.txt │ │ ├── Fight Against Traffic Explanation.txt │ │ ├── Hacker, Pack your Bags Explanation.txt │ │ ├── Imbalance Array Explanation.txt │ │ ├── Laboratory Work Explanation.txt │ │ ├── Lieges of Legendre Explanation.txt │ │ ├── Line Explanation.txt │ │ ├── Marina and Vyasa Explanation.txt │ │ ├── Match Points Explanation.txt │ │ ├── Molly and Chemicals Explanation.txt │ │ ├── Moodular Arithmetic Explanation.txt │ │ ├── Mouse Hunt Explanation.txt │ │ ├── Multiplicity Explanation.txt │ │ ├── Multipliers Explanation.txt │ │ ├── My Pretty Girl Nora Explanation.txt │ │ ├── Optimal Number Permutation Explanation.txt │ │ ├── Pair of Numbers Explanation.txt │ │ ├── Pashmak and Graph Explanation.txt │ │ ├── Pavel and Triangles Explanation.txt │ │ ├── Plus and XOR Explanation.txt │ │ ├── Points Explanation.txt │ │ ├── Prime Number Explanation.txt │ │ ├── Ramesses and Corner Inversion Explanation.txt │ │ ├── Scheme.cpp │ │ ├── Secret Passwords Explanation.txt │ │ ├── Segments Explanation.txt │ │ ├── Special Segments of Permutation Explanation.txt │ │ ├── The Sum of the k-th Powers Explanation.txt │ │ ├── The Treasure of Segments Explanation.txt │ │ └── Winter is Here Explanation.txt │ └── Programs/ │ ├── Alternative Thinking.cpp │ ├── Ant Colony.cpp │ ├── Anton and Chess.cpp │ ├── Anton and Ira.cpp │ ├── Ants in Leaves.cpp │ ├── Army Creation.cpp │ ├── Bargain.cpp │ ├── Concatenated Multiples.cpp │ ├── Count Pairs.cpp │ ├── Cram Time.cpp │ ├── Cycles.cpp │ ├── Elections.cpp │ ├── Fight Against Traffic.cpp │ ├── Hacker, pack your Bags.cpp │ ├── Imbalanced Array.cpp │ ├── Laboratory Work.cpp │ ├── Lieges of Legendre.cpp │ ├── Line.cpp │ ├── Marina and Vyasa.cpp │ ├── Match Points.cpp │ ├── Molly and Chemicals.cpp │ ├── Moodular Arithmetic.cpp │ ├── Mouse Hunt.cpp │ ├── Multiplicity.cpp │ ├── Multipliers.cpp │ ├── My Pretty Girl Nora.cpp │ ├── Optimal Number Permutation.cpp │ ├── Pair of Numbers.cpp │ ├── Pashmak and Graph.cpp │ ├── Pavel and Triangles.cpp │ ├── Plus and Xor.cpp │ ├── Points.cpp │ ├── Prime Number.cpp │ ├── Ramesses and Corner Inversion.cpp │ ├── Scheme.cpp │ ├── Secret Passwords.cpp │ ├── Segments.cpp │ ├── Special Segments of Permutation.cpp │ ├── The Sum of the k-th Powers.cpp │ ├── The Treasure of Segments.cpp │ └── Winter is Here.cpp ├── 2021/ │ ├── Combined Divisions/ │ │ └── Deltix Round Summer 2021/ │ │ ├── Explanations/ │ │ │ └── Take a Guess Explanation.txt │ │ └── Programs/ │ │ └── Take a Guess.cpp │ ├── Div 2/ │ │ ├── 694/ │ │ │ ├── Explanations/ │ │ │ │ ├── Strange Definition Explanation.txt │ │ │ │ ├── Strange Housing Explanation.txt │ │ │ │ └── Strange Shuffle Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Strange Birthday Party.cpp │ │ │ ├── Strange Definition.cpp │ │ │ ├── Strange Housing.cpp │ │ │ ├── Strange List.cpp │ │ │ ├── Strange Partition.cpp │ │ │ └── Strange Shuffle.cpp │ │ ├── 708/ │ │ │ ├── Explanations/ │ │ │ │ ├── Genius Explanation.txt │ │ │ │ ├── M Arrays Explanation.txt.txt │ │ │ │ ├── Meximization Explanation.txt.txt │ │ │ │ ├── Square Free Division Explanation.txt.txt │ │ │ │ └── k-LCM Explanation.txt.txt │ │ │ └── Programs/ │ │ │ ├── Genius.cpp │ │ │ ├── M Arrays.cpp │ │ │ ├── Meximization.cpp │ │ │ ├── Square Free Division.cpp │ │ │ └── k-LCM.cpp │ │ ├── 711 CodeCraft 2021/ │ │ │ ├── Explanations/ │ │ │ │ ├── Bananas in a MIrcorwave Explanation.txt.txt │ │ │ │ ├── Box Fitting Explanation.txt │ │ │ │ ├── GCD Sum Explanation.txt.txt │ │ │ │ └── Two Houses Explanation.txt.txt │ │ │ └── Programs/ │ │ │ ├── Bananas in a Microwave.cpp │ │ │ ├── Box Fitting.cpp │ │ │ ├── GCD Sum.cpp │ │ │ └── Two Houses.cpp │ │ ├── 712 Div 2/ │ │ │ ├── Explanations/ │ │ │ │ ├── 3 Colouring Explanation.txt │ │ │ │ ├── Deja Vu Explanation.txt.txt │ │ │ │ └── Flip the Bits Explanation.txt.txt │ │ │ └── Programs/ │ │ │ ├── 3 Colouring.cpp │ │ │ ├── Déjà Vu.cpp │ │ │ └── Flip the Bits.cpp │ │ ├── 714 Division by Zero 2021/ │ │ │ ├── Explanations/ │ │ │ │ ├── AND Sequences Explanation.txt.txt │ │ │ │ ├── Add One Explanation.txt.txt │ │ │ │ ├── Arrays and Peaks Explanation.txt.txt │ │ │ │ ├── Cost Equilibrium Explanation.txt.txt │ │ │ │ ├── GCD and MST Explanation.txt │ │ │ │ ├── GCD and MST Explanation.txt.txt │ │ │ │ └── Swapping Problem Explanation.txt.txt │ │ │ └── Programs/ │ │ │ ├── AND Sequences.cpp │ │ │ ├── Add One.cpp │ │ │ ├── Arrays and Peaks.cpp │ │ │ ├── Cost Equilibrium.cpp │ │ │ ├── GCD and MST.cpp │ │ │ └── Swapping Problem.cpp │ │ ├── 716 Div 2/ │ │ │ └── Programs/ │ │ │ └── Product 1 mod N.cpp │ │ ├── 722/ │ │ │ ├── Explanations/ │ │ │ │ └── Parsa and Humungous Tree Explanation.txt │ │ │ └── Programs/ │ │ │ └── Parsa and Humungous Tree.cpp │ │ ├── 724/ │ │ │ ├── Diluc and Kaeye Explanation.txt │ │ │ ├── Explanations/ │ │ │ │ └── Diluc and Kaeye Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Diluc and Kaeya.cpp │ │ │ ├── Omkar and Bad Story.cpp │ │ │ ├── Omkar and Forest.cpp │ │ │ └── Prinzessin der Verurteilung.cpp │ │ ├── 726/ │ │ │ ├── Explanations/ │ │ │ │ ├── Arithemtic Array Explanation.txt.txt │ │ │ │ ├── Bad Boy Explanation.txt.txt │ │ │ │ ├── Challenging Cliffs Explanation.txt.txt │ │ │ │ ├── Deleting Divisors Explanation.txt.txt │ │ │ │ └── Erase and Extend (Easy Version) Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Arithmetic Array.cpp │ │ │ ├── Bad Boy.cpp │ │ │ ├── Challenging Cliffs.cpp │ │ │ ├── Deleting Divisors.cpp │ │ │ ├── Erase and Extend (Easy Version).cpp │ │ │ └── Figure Fixing.cpp │ │ ├── 727/ │ │ │ ├── Explanations/ │ │ │ │ ├── Constest Start Time Explanation.txt │ │ │ │ ├── Love Song Explanation.txt.txt │ │ │ │ ├── Price Fixed Explanation.txt.txt │ │ │ │ └── Stable Groups Explanation.txt.txt │ │ │ └── Programs/ │ │ │ ├── Contest Start.cpp │ │ │ ├── Love Song.cpp │ │ │ ├── PriceFixed.cpp │ │ │ └── Stable Groups.cpp │ │ ├── 740/ │ │ │ └── Programs/ │ │ │ ├── Deep Down Below Binary Search.cpp │ │ │ └── Deep Down Below.cpp │ │ ├── 742/ │ │ │ ├── Explanations/ │ │ │ │ └── Carrying Conundrum Explanation.txt │ │ │ └── Programs/ │ │ │ └── Carrying Conundrum.cpp │ │ └── 750/ │ │ ├── Explanations/ │ │ │ └── Pchelyonok and Segments Explanation.txt │ │ └── Programs/ │ │ └── Pchelyonok and Segments.cpp │ ├── Div 3/ │ │ ├── 710/ │ │ │ ├── Explanations/ │ │ │ │ ├── Double Ended Strings Explanation.txt.txt │ │ │ │ ├── Epic Transformation Explanation.txt.txt │ │ │ │ ├── Maximize the Remaining String Explanation.txt │ │ │ │ ├── Partial Replacement.txt.txt │ │ │ │ ├── Strange Table Explanation.txt.txt │ │ │ │ └── Triangular Paths Explanation.txt.txt │ │ │ └── Programs/ │ │ │ ├── Double Ended Strings.cpp │ │ │ ├── Epic Transformation.cpp │ │ │ ├── Maximize the Remaining String.cpp │ │ │ ├── Partial Replacement.cpp │ │ │ ├── Strange Table.cpp │ │ │ └── Triangular Paths.cpp │ │ ├── 713/ │ │ │ ├── Explanations/ │ │ │ │ ├── A-B Palindrome Explanation.txt.txt │ │ │ │ ├── Almost Rectange Explanation.txt.txt │ │ │ │ ├── Corrupted Array Explanation.txt.txt │ │ │ │ ├── Education Explanation.txt.txt │ │ │ │ ├── Short Task Explanation.txt │ │ │ │ └── Spy Detected Explanation.txt.txt │ │ │ └── Programs/ │ │ │ ├── A-B Palindrome.cpp │ │ │ ├── Almost Rectangle.cpp │ │ │ ├── Corrupted Array.cpp │ │ │ ├── Education.cpp │ │ │ ├── Short Task.cpp │ │ │ └── Spy Detected.cpp │ │ └── 744/ │ │ └── Programs/ │ │ └── Array Optimization by Deque.cpp │ ├── Educational Round 109/ │ │ ├── Explanations/ │ │ │ └── Permutation Sort Explanation.txt │ │ └── Programs/ │ │ └── Permutation Sort.cpp │ └── Practice/ │ ├── Explanations/ │ │ ├── Anton and Making Potions Explanation.txt │ │ ├── Anton and Tree Explanation.txt.txt │ │ ├── Counter Attack Explanation.txt.txt │ │ ├── Game of Stones Explanation.txt.txt │ │ ├── Lost Tree Explanation.txt.txt │ │ └── Maximum Absurdity Explanation.txt.txt │ └── Programs/ │ ├── Anton and Making Potions.cpp │ ├── Anton and Tree.cpp │ ├── Counter Attack.cpp │ ├── Game of Stones.cpp │ ├── Lost Tree.cpp │ └── Maximum Absurdity.cpp ├── 2022/ │ └── Contests/ │ ├── Combined Divisions/ │ │ └── CodeTON/ │ │ ├── Explanations/ │ │ │ ├── Good Pairs Explanation.txt.txt │ │ │ ├── Make Equal with Mod Explanation.txt.txt │ │ │ └── Subtract Operations Explanation.txt │ │ └── Programs/ │ │ ├── Good Pairs.cpp │ │ ├── K-good.cpp │ │ ├── Make Equal With Mod.cpp │ │ └── Subtract Operation.cpp │ ├── Div 2/ │ │ ├── 766/ │ │ │ └── Programs/ │ │ │ ├── Not Adding.cpp │ │ │ ├── Not Assigning.cpp │ │ │ ├── Not Shading.cpp │ │ │ └── Not Sitting.cpp │ │ ├── 767/ │ │ │ ├── Explanations/ │ │ │ │ └── Meximum Array Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Download More RAM.cpp │ │ │ ├── GCD Arrays.cpp │ │ │ ├── Game On Sum Easy Version.cpp │ │ │ ├── Game on Sum Hard Version.cpp │ │ │ ├── Grid XOR.cpp │ │ │ ├── Meximum Array.cpp │ │ │ └── Peculiar Movie Preferences.cpp │ │ ├── 777/ │ │ │ └── Programs/ │ │ │ ├── Madoka and Math Dad.cpp │ │ │ └── Makoda and Childish Pranks.cpp │ │ ├── 778/ │ │ │ ├── Explanations/ │ │ │ │ ├── Alice and the Cake Explanation.txt.txt │ │ │ │ ├── Maximum Cake Tastiness Explanation.txt │ │ │ │ └── Prefix Removals Explanation.txt.txt │ │ │ └── Programs/ │ │ │ ├── Alice and the Cake.cpp │ │ │ ├── Maximum Cake Tastiness.cpp │ │ │ └── Prefix Removals.cpp │ │ ├── 789/ │ │ │ ├── Explanation/ │ │ │ │ ├── Tokitsukaze and All Zero Sequence Explanation.txt.txt │ │ │ │ ├── Tokitsukaze and Good 01-String (easy version) Explanation.txt.txt │ │ │ │ └── Tokitsukaze and Strange Inequality Explanation.txt │ │ │ └── Programs/ │ │ │ ├── Tokitsukaze and Good 01-String (easy version).cpp │ │ │ └── Tokitsukaze and Strange Inequality.cpp │ │ ├── 792/ │ │ │ ├── Explanations/ │ │ │ │ ├── AvtoBus Explanation.txt │ │ │ │ ├── Rooks Defenders Explanation.txt.txt │ │ │ │ └── Stone Age Problem Explanation.txt.txt │ │ │ └── Programs/ │ │ │ ├── AvtoBus.cpp │ │ │ ├── Rooks Defenders.cpp │ │ │ └── Stone Age Problem.cpp │ │ └── 809/ │ │ └── Programs/ │ │ └── Qpwoeirut And The City.cpp │ ├── Div 3/ │ │ └── 828/ │ │ └── Programs/ │ │ ├── Divisibility by 2^n.cpp │ │ ├── Divisible Numbers Easy Version.cpp │ │ ├── Even-Odd Increments.cpp │ │ ├── Number Replacement.cpp │ │ └── Traffic Light.cpp │ ├── Educational Round 125/ │ │ ├── Explanations/ │ │ │ ├── By Gamers For Gamers Explanation.txt │ │ │ ├── Integer Moves Explanation.txt.txt │ │ │ └── XY Sequence Explanation.txt.txt │ │ └── Programs/ │ │ ├── Bracket Sequence Deletion.cpp │ │ ├── By Gamers For Gamers.cpp │ │ ├── Integer Moves.cpp │ │ └── XY Sequence.cpp │ └── Educational Rounds/ │ ├── Educational Round 125/ │ │ └── EExplanations/ │ │ └── Bracket Sequence Deletion Explanation.txt │ └── Educational Round 127/ │ ├── Explanations/ │ │ ├── Consecutive Points Segment Explanation.txt.txt │ │ ├── Dolce Vita Explanation.txt.txt │ │ ├── Insert a Progression Explanation.txt │ │ └── String Building Explanation.txt.txt │ └── Programs/ │ ├── Consecutive Points Segment.cpp │ ├── Dolce Vita.cpp │ ├── Insert a Progression.cpp │ └── String Building.cpp ├── 2023/ │ └── Contests/ │ └── Div 2/ │ ├── 810/ │ │ ├── Explanations/ │ │ │ └── XOR Triangle Explanation.txt │ │ └── Programs/ │ │ └── XOR Triangle.cpp │ └── 857/ │ └── Programs/ │ ├── Buying Gifts.cpp │ ├── Likes.cpp │ ├── Settlement of Guinea Pigs.cpp │ └── The Very Beautiful Blanket.cpp ├── C Programs/ │ ├── C Programs - 1/ │ │ ├── Bear_and_Big_Brother.c │ │ ├── Beautiful_Matrix.c │ │ ├── Boy_or_Girl.c │ │ ├── Complicated_GCD.c │ │ ├── Compote.c │ │ ├── Dasha_and_Stairs.c │ │ ├── Elephant.c │ │ ├── Even_Odds.c │ │ ├── Fancy_Fence.c │ │ ├── Holiday_of_Equality.c │ │ ├── I_Love_Username.c │ │ ├── Ilya_Bank_Account.c │ │ ├── Little_Elephant_Rozdil.c │ │ ├── Lucky_Division.c │ │ ├── Memory_and_Crow.c │ │ ├── Nearly_Lucky_Number.c │ │ ├── Opponents.c │ │ ├── Petr_and_Calendar.c │ │ ├── Shell_Game.c │ │ ├── Sherlock_New_Girlfriend.c │ │ ├── Taymr_is_Calling_You.c │ │ ├── The_Wall.c │ │ ├── Translation.c │ │ ├── Vitya_in_the_Countryside.c │ │ └── Vladik_and_Flights.c │ ├── C Programs - 2/ │ │ ├── A_and_B_Chess.c │ │ ├── Again_Twenty_Five.c │ │ ├── Anton_and_Danik.c │ │ ├── Bachgold_Problem.c │ │ ├── Bit++.c │ │ ├── Buy_a_Shovel.c │ │ ├── Chat_Room.c │ │ ├── Chips.c │ │ ├── Cinema_Line.c │ │ ├── Domino_Piling.c │ │ ├── Drazil_and_Date.c │ │ ├── George_and_Accomodation.c │ │ ├── Gravity_Flip.c │ │ ├── Infinite_Sequence.c │ │ ├── Interview_with_Oleg.c │ │ ├── Pasha_and_Stick.c │ │ ├── Pineapple_Incident.c │ │ ├── Serial_Killer.c │ │ ├── Soldier_and_Bananas.c │ │ ├── Spider_Man.c │ │ ├── Stones_on_a_Table.c │ │ ├── Transform_A_to_B.c │ │ ├── Triangular_Numbers.c │ │ ├── Watermelon.c │ │ └── Word_Capitalisation.c │ ├── C Programs - 3/ │ │ ├── Anton_and_Polyhedron.c │ │ ├── Calculating_Function.c │ │ ├── Cheap_Travel.c │ │ ├── Checking_the_Calendar.c │ │ ├── Currency_System_in_Geraldion.c │ │ ├── Die_Roll.c │ │ ├── Domino_Effect.c │ │ ├── Expression.c │ │ ├── Fedya_and_Maths.c │ │ ├── Filya_and_Homework.c │ │ ├── Game.c │ │ ├── Initial_Bet.c │ │ ├── LCM_Challenge.c │ │ ├── Maximum_Increase.c │ │ ├── Mishka_and_Game.c │ │ ├── Multiplication_Table.c │ │ ├── Next_Round.c │ │ ├── Party.c │ │ ├── Police_Recruits.c │ │ ├── Raising_Bacteria.c │ │ ├── Save_Luke.c │ │ ├── Taxes.c │ │ ├── Tennis_Tournament.c │ │ ├── The_Number_of_Positions.c │ │ └── Theatre_Square.c │ ├── C Programs - 4/ │ │ ├── Aloyna_Numbers.c │ │ ├── Arpa_Hard_Problem_Mehrad_Naive_Cheat.c │ │ ├── Benches.c │ │ ├── Challenge_Pendants.c │ │ ├── Chewbacca_and_Number.c │ │ ├── Chocolate.c │ │ ├── Design_Tutorial_Learn_From_Math.c │ │ ├── Divisibility.c │ │ ├── Fedor_and_New_Game.c │ │ ├── Game_test.c │ │ ├── Hexagons.c │ │ ├── Hulk.c │ │ ├── Indivisibility.c │ │ ├── Interview.c │ │ ├── King_Moves.c │ │ ├── Lineland_Mail.c │ │ ├── Lucky_Numbers.c │ │ ├── PolandBall_and_Hypothesis.c │ │ ├── Professor_Gukiz_Robot.c │ │ ├── Random_Teams.c │ │ ├── Reconnaissance_2.c │ │ ├── Selection_of_Personnel.c │ │ ├── Tetrahedron.c │ │ ├── Vasya_and_Petya_Game.c │ │ └── Way_Too_Long_Words.c │ ├── C Programs - 5/ │ │ ├── Bear_and_Poker.c │ │ ├── Boredom.c │ │ ├── Cut_Ribbon.c │ │ ├── Display_Size.c │ │ ├── Duff_in_Love.c │ │ ├── Flipping_Game.c │ │ ├── Flowers.cpp │ │ ├── Fox_and_Dividing_Cheese.c │ │ ├── Hungry_Sequence.c │ │ ├── K_Interesting_Pair_of_Integers.c │ │ ├── Kefa_and_First_Step.c │ │ ├── Making_a_String.c │ │ ├── Non_Square_Equation.c │ │ ├── Odd_Sum.c │ │ ├── Parking_Lot.c │ │ ├── Perfect_Permutation.c │ │ ├── Preparing_for_Olympiad.c │ │ ├── Star.c │ │ ├── Table_Tennis_Game_2.c │ │ ├── Tavas_and_Saddas.c │ │ ├── Team.c │ │ ├── Tetrahedron_Efficiently.c │ │ ├── Tricky_Sum.c │ │ ├── Vacations.c │ │ └── Vanya_and_Table.c │ ├── C Programs - 6/ │ │ ├── A_Shell_Game.c │ │ ├── Accounting.c │ │ ├── Anton_and_Digits.c │ │ ├── Black_Square.c │ │ ├── Dinner_with_Emma.c │ │ ├── Ebony_and_Ivory.c │ │ ├── Find Amir.c │ │ ├── Game_with_Sticks.c │ │ ├── Increasing_Sequence.c │ │ ├── Insomnia_Cure.c │ │ ├── Jumping_Ball.c │ │ ├── K_Tree.c │ │ ├── Lovely_Palindromes.c │ │ ├── Luxurious_Buildings.c │ │ ├── Meeting_of_Old_Friends.c │ │ ├── Oleg_and_Shares.c │ │ ├── Patrick_and_Shopping.c │ │ ├── Plate_Game.c │ │ ├── Rewards.c │ │ ├── Round_House.c │ │ ├── System_of_Equations.c │ │ ├── Vanya_and_Fence.c │ │ ├── Vanya_and_Lanterns.c │ │ ├── Vasya_and_Hipster.c │ │ └── Wizard_Duel.c │ ├── C Programs - 7/ │ │ ├── 3_Palindrome.c │ │ ├── Alena_Schedule.c │ │ ├── Alice_and_Bob.c │ │ ├── An_Abandoned_Sentiment_From_Past.c │ │ ├── Andrushya_and_Socks.c │ │ ├── Combination Lock.cpp │ │ ├── Devu_Singer_Charu_Joker.c │ │ ├── Fake_NP.c │ │ ├── Fence.c │ │ ├── Find_Marble.c │ │ ├── Free Ice Cream.cpp │ │ ├── Hexadecimal's Theorem Alternate Solution.cpp │ │ ├── Hexadecimal's Theorem.cpp │ │ ├── IQ_Test.c │ │ ├── Magnets.c │ │ ├── Mahmod_Longest_Uncommon_Subsequence.c │ │ ├── Monster_and_Squirrel.c │ │ ├── New Year Transportation.cpp │ │ ├── Optimal_Point_on_a_Line.cpp │ │ ├── Pashmak_and_Flowers.c │ │ ├── Potions_Homework.cpp │ │ ├── Pythagorean Triples.cpp │ │ ├── Red_Blue_Balls.c │ │ ├── The_Contest.c │ │ └── Young_Physicist.c │ ├── C Programs - 8/ │ │ ├── A and B Team Training.cpp │ │ ├── Almost Prime.cpp │ │ ├── Brian's Photos.cpp │ │ ├── Caisa and Pylons.cpp │ │ ├── Choosing Teams.cpp │ │ ├── Ciel and Flowers.cpp │ │ ├── Diverse Permutation.cpp │ │ ├── HQ9+.cpp │ │ ├── Hexadecimal's Numbers.cpp │ │ ├── Infinite Sequence.cpp │ │ ├── Jzzhu and Sequences.cpp │ │ ├── K-Factorisation.cpp │ │ ├── Noldbach Problem.cpp │ │ ├── Olesya and Rodion.cpp │ │ ├── Petr and Book.cpp │ │ ├── Petya and Strings.cpp │ │ ├── Sum of Digits.cpp │ │ ├── T Primes Alternate Solution.cpp │ │ ├── T-Primes.cpp │ │ ├── The Golden Age.cpp │ │ ├── Two Bags of Potatos.cpp │ │ ├── Vanya and Cards.cpp │ │ ├── Vitaly and Night.cpp │ │ ├── Wet Shark and Odd and Even.cpp │ │ └── Yaroslav and Permutations.cpp │ ├── C Programs - 9/ │ │ ├── Alyona and Copybooks.cpp │ │ ├── Appleman and Toastman.cpp │ │ ├── Array.cpp │ │ ├── Bear and Five Cards.cpp │ │ ├── Bus to Udayland.cpp │ │ ├── Case of the Zeroes and Ones.cpp │ │ ├── Circle Line.cpp │ │ ├── Crazy Computer.cpp │ │ ├── Crossword Solving.cpp │ │ ├── Divisibility.cpp │ │ ├── Fox and Number Game.cpp │ │ ├── Haiku.cpp │ │ ├── I'm Bored with Life.cpp │ │ ├── Is your Horseshoe on the other hoof.cpp │ │ ├── Kitahara Haruki's Gift.cpp │ │ ├── Little Elephant and Function.cpp │ │ ├── Little Elephant and Problem.cpp │ │ ├── New Year and Days.cpp │ │ ├── One Dimensional Japanese Crossword.cpp │ │ ├── Present from Lena.cpp │ │ ├── Prime Matrix.cpp │ │ ├── String Task.cpp │ │ ├── Subtractions.cpp │ │ ├── Toy Army.cpp │ │ └── k-th_Divisor.cpp │ ├── C Programs 10/ │ │ ├── A and B Compilation Errors.cpp │ │ ├── Amr and Music.cpp │ │ ├── Arrival of General.cpp │ │ ├── Bear and Game.cpp │ │ ├── Beautiful Year.cpp │ │ ├── Black Square.cpp │ │ ├── Counterexample.cpp │ │ ├── Difference Row.cpp │ │ ├── Eugene and Array.cpp │ │ ├── Interesting Drink.cpp │ │ ├── Keyboard Layouts.cpp │ │ ├── Life Without Zeroes.cpp │ │ ├── Modified GCD.cpp │ │ ├── Multi Judge Solving.cpp │ │ ├── Next Test.cpp │ │ ├── Presents.cpp │ │ ├── Serega and Coat Rack.cpp │ │ ├── Serega and Suffixes.cpp │ │ ├── Slightly Decreasing Permutation.cpp │ │ ├── SwapSort.cpp │ │ ├── Taxi.cpp │ │ ├── Toy Cars.cpp │ │ ├── Unimodal Arrays.cpp │ │ ├── Valera and Plates.cpp │ │ └── Vanya and Cubes.cpp │ ├── C Programs 11/ │ │ ├── BerSU Ball.cpp │ │ ├── Elections.cpp │ │ ├── Five in a Row.cpp │ │ ├── Football.cpp │ │ ├── Fortune Telling.cpp │ │ ├── Free Cash Alternate Solution.cpp │ │ ├── Free Cash.cpp │ │ ├── Games.cpp │ │ ├── Good Number.cpp │ │ ├── Johnny Likes Numbers.cpp │ │ ├── Lever.cpp │ │ ├── Lunch Rush.cpp │ │ ├── Magic Spheres.cpp │ │ ├── New Year and Hurry.cpp │ │ ├── Nicholas and Permutation.cpp │ │ ├── Petya and Staircases.cpp │ │ ├── Playing with Dice.cpp │ │ ├── Saitama Destroys Hotel.cpp │ │ ├── Sasha and Sticks.cpp │ │ ├── Soft Drinking.cpp │ │ ├── The Child and The Homework.cpp │ │ ├── The New Year Meeting Friends Alternate Solution.cpp │ │ ├── The New Year Meeting Friends.cpp │ │ ├── Word.cpp │ │ └── inc ARG.cpp │ ├── C Programs 12/ │ │ ├── Anastasia and Pebbles.cpp │ │ ├── Bear and Three Balls.cpp │ │ ├── Buggy Sorting.cpp │ │ ├── Co Prime Array.cpp │ │ ├── Dima and Friends.cpp │ │ ├── Dima and Sequence.cpp │ │ ├── Dreamoon and Stairs Alternate Solution.cpp │ │ ├── Dreamoon and Stairs.cpp │ │ ├── Fashion in Berland.cpp │ │ ├── Inbox (100500).cpp │ │ ├── Key Races.cpp │ │ ├── Ksusha and Arrays.cpp │ │ ├── Lecture.cpp │ │ ├── Little Elephant and Chess.cpp │ │ ├── Little Girl and Maximum Sum.cpp │ │ ├── Minimum Difficulty.cpp │ │ ├── Pasha and Pixels.cpp │ │ ├── Puzzles.cpp │ │ ├── Santa Claus and Candies.cpp │ │ ├── Sereja and Dima.cpp │ │ ├── Shaas and Oskols.cpp │ │ ├── Sleuth.cpp │ │ ├── The Festive Evening.cpp │ │ ├── The Number on The Board.cpp │ │ └── Watching a Movie.cpp │ ├── C Programs 13/ │ │ ├── A Good Contest.cpp │ │ ├── Arpa's Obvious Problem and Mehrad's Terrible Solution.cpp │ │ ├── Arrays.cpp │ │ ├── Arya and Bran.cpp │ │ ├── Bear and Elections.cpp │ │ ├── Business Trip.cpp │ │ ├── Cards.cpp │ │ ├── Code Obfuscation.cpp │ │ ├── Drinks.cpp │ │ ├── Epic Game.cpp │ │ ├── Functions Again.cpp │ │ ├── Generous Kefa.cpp │ │ ├── George and Job.cpp │ │ ├── Godsend.cpp │ │ ├── Ilya and Queries.cpp │ │ ├── Kuriyama Mirai's Stones.cpp │ │ ├── Lights Out.cpp │ │ ├── Little Dima and Equation.cpp │ │ ├── Little Elephant and Bits.cpp │ │ ├── New Skateboard.cpp │ │ ├── Oath of the Night's Watch.cpp │ │ ├── Sort the Array.cpp │ │ ├── Star Sky.cpp │ │ ├── Vanya and Books.cpp │ │ └── Vasya and Digital Root.cpp │ ├── C Programs 14/ │ │ ├── Asphalting Roads.cpp │ │ ├── Bicycle Chain.cpp │ │ ├── Borze.cpp │ │ ├── Building Permutation.cpp │ │ ├── Chess Tourney.cpp │ │ ├── Cormen - The Best Friend of Man.cpp │ │ ├── DZY Loves Sequences.cpp │ │ ├── Dragons.cpp │ │ ├── Drazil and Factorial.cpp │ │ ├── Football.cpp │ │ ├── Helpful Maths.cpp │ │ ├── Increase and Decrease.cpp │ │ ├── Jeff and Digits.cpp │ │ ├── Jzzhu and Children.cpp │ │ ├── Modulo Sum.cpp │ │ ├── Odds and Ends.cpp │ │ ├── Panoramix's Prediction.cpp │ │ ├── Permutation.cpp │ │ ├── Powers of Two.cpp │ │ ├── Queue at the School.cpp │ │ ├── Rectangles.cpp │ │ ├── Supercentral Point.cpp │ │ ├── Tram.cpp │ │ ├── Ultra Fast Mathematician.cpp │ │ └── Vasya and String.cpp │ ├── C Programs 15/ │ │ ├── Army.cpp │ │ ├── Between the Offices.cpp │ │ ├── Cableway.cpp │ │ ├── Ciferia.cpp │ │ ├── Coins.cpp │ │ ├── Divisibility by Eight.cpp │ │ ├── Exams.cpp │ │ ├── Given Length and Sum of Digits.cpp │ │ ├── Ilya and Sticks.cpp │ │ ├── Inna and Huge Candy Matrix.cpp │ │ ├── K-Multiple Free Set.cpp │ │ ├── Kefa and Park.cpp │ │ ├── Mahmoud and Ehab and the MEX.cpp │ │ ├── Mahmoud and Ehab and the bipartiteness.cpp │ │ ├── Mahmoud and Ehab and the xor.cpp │ │ ├── Number of Ways.cpp │ │ ├── Pearls in a Row.cpp │ │ ├── Pie Rules.cpp │ │ ├── Quasi-palindrome.cpp │ │ ├── Soldier and Number Game.cpp │ │ ├── Tanya and Toys.cpp │ │ ├── Team.cpp │ │ ├── The Eternal Immortality.cpp │ │ ├── Triangle.cpp │ │ └── USB Flash Drives.cpp │ ├── C Programs 16/ │ │ ├── Amusing Joke.cpp │ │ ├── Anton and Letters.cpp │ │ ├── Cards with Numbers.cpp │ │ ├── Classroom Watch.cpp │ │ ├── Cupboards.cpp │ │ ├── Dishonest Sellers.cpp │ │ ├── Dubstep.cpp │ │ ├── Easy Number Challenge.cpp │ │ ├── Fox and Snake.cpp │ │ ├── Greg and Array.cpp │ │ ├── Hacking Cypher.cpp │ │ ├── I Wanna Be The Guy.cpp │ │ ├── IQ Test.cpp │ │ ├── Jeff and Periods.cpp │ │ ├── Pashmak and Garden.cpp │ │ ├── Primes or Palindromes.cpp │ │ ├── Quasi Binary.cpp │ │ ├── Sereja and Bottles.cpp │ │ ├── Team Olympiad.cpp │ │ ├── The Fibonacci Segment.cpp │ │ ├── Twins.cpp │ │ ├── Valera and Tubes.cpp │ │ ├── Xenia and Bit Operations.cpp │ │ ├── Xenia and Ringroad.cpp │ │ └── k-String.cpp │ ├── C Programs 17/ │ │ ├── Adding Digits.cpp │ │ ├── Christmas Spruce.cpp │ │ ├── Dreamoon and Wi-Fi.cpp │ │ ├── Exams - 122.cpp │ │ ├── Garden.cpp │ │ ├── Jamie and Alarm Snooze.cpp │ │ ├── Jamie and Interesting Graph.cpp │ │ ├── Kolya and Tanya.cpp │ │ ├── Mashmokh and ACM.cpp │ │ ├── Maximum Splitting.cpp │ │ ├── Minimum Sum.cpp │ │ ├── Modular Exponentiation.cpp │ │ ├── New Year and Domino.cpp │ │ ├── New Year's Eve.cpp │ │ ├── Palindrome Pairs.cpp │ │ ├── Perfect Number.cpp │ │ ├── QAQ.cpp │ │ ├── Seat Arrangements.cpp │ │ ├── Supermarket.cpp │ │ ├── Swap Adjacent Elements.cpp │ │ ├── Tea Queue.cpp │ │ ├── Testing Pants for Sadness.cpp │ │ ├── The World is a Theatre.cpp │ │ ├── Tricky Alchemy.cpp │ │ └── Water the Gardens.cpp │ ├── C Programs 18/ │ │ ├── Art Union.cpp │ │ ├── Bear and Colours.cpp │ │ ├── Cave Painting.cpp │ │ ├── Cloning Toys.cpp │ │ ├── Eternal Victory.cpp │ │ ├── Hard Problem.cpp │ │ ├── Joystick.cpp │ │ ├── K-Special Tables.cpp │ │ ├── Lucky Sum.cpp │ │ ├── Magic Forest.cpp │ │ ├── Marvolo Gaunt's Ring Alternate Solution.cpp │ │ ├── Marvolo Gaunt's Ring.cpp │ │ ├── Not Equal on a Segment.cpp │ │ ├── Perfect Squares.cpp │ │ ├── Petya and Inequiations.cpp │ │ ├── Polo the Penguin and Matrix.cpp │ │ ├── Polo the Penguin and Strings.cpp │ │ ├── Replacement.cpp │ │ ├── Robot Vaccuum Cleaner.cpp │ │ ├── Rumour.cpp │ │ ├── Search for Pretty Integers.cpp │ │ ├── Tom Riddle's Diary.cpp │ │ ├── Two Substrings.cpp │ │ ├── Vladik and Fractions.cpp │ │ └── Woodcutter.cpp │ ├── C Programs 19/ │ │ ├── A Compatible Pair.cpp │ │ ├── A Prosperous Lot.cpp │ │ ├── Almost Identity Permutations.cpp │ │ ├── Amr and Large Array.cpp │ │ ├── Beautiful Sets of Points.cpp │ │ ├── Buggy Robot.cpp │ │ ├── Cellular Network.cpp │ │ ├── Coder.cpp │ │ ├── Diversity.cpp │ │ ├── Guest From The Past.cpp │ │ ├── Hamster Farm.cpp │ │ ├── K-Dominant Character.cpp │ │ ├── Little Artem and Grasshopper.cpp │ │ ├── Longest K-Good Segment.cpp │ │ ├── Love Triangle.cpp │ │ ├── Nuts.cpp │ │ ├── Palindrome Transformation.cpp │ │ ├── Palindromic Supersequence.cpp │ │ ├── Recursive Queries.cpp │ │ ├── Run For Your Prize.cpp │ │ ├── Simple Strings.cpp │ │ ├── The Useless Toy.cpp │ │ ├── Vasya and Socks.cpp │ │ ├── Watchmen.cpp │ │ └── Word Correction.cpp │ ├── C Programs 20/ │ │ ├── Alena and the Heater.cpp │ │ ├── Fafa and Ancient Alphabet.cpp │ │ ├── Fafa and His Company.cpp │ │ ├── Fafa and the Gates.cpp │ │ ├── Fixing Typos.cpp │ │ ├── Gargari and Bishops.cpp │ │ ├── Gargari and Permutations Alternate Solution.cpp │ │ ├── Gargari and Permutations.cpp │ │ ├── Hard Process.cpp │ │ ├── Lisa and Dima.cpp │ │ ├── Love Rescue.cpp │ │ ├── Mashmokh and Numbers.cpp │ │ ├── Non-Secret Cypher.cpp │ │ ├── Olympiad.cpp │ │ ├── Partition.cpp │ │ ├── Petya and His Friends Alternate Solution.cpp │ │ ├── Petya and His Friends.cpp │ │ ├── Phone Numbers.cpp │ │ ├── Pocket Book.cpp │ │ ├── Points on the Line.cpp │ │ ├── Protect Sheep.cpp │ │ ├── String Transformation.cpp │ │ ├── Sum and Replace.cpp │ │ ├── Vile Grasshoppers.cpp │ │ └── Weird Subtraction Process.cpp │ ├── C Programs 21/ │ │ ├── Aramic Script Bitmask Solution.cpp │ │ ├── Aramic Script.cpp │ │ ├── Arithmetic Progression.cpp │ │ ├── Bash and a Tough Math Puzzle.cpp │ │ ├── Consecutive Subsequences.cpp │ │ ├── Cyclic Components.cpp │ │ ├── Divide by Three, Multiply by Two Alternate Solution.cpp │ │ ├── Divide by Three, Multiply by Two.cpp │ │ ├── Dreamoon and Sets.cpp │ │ ├── File Name.cpp │ │ ├── Fox and Box Accumulation.cpp │ │ ├── Ghosts.cpp │ │ ├── Less or Equal.cpp │ │ ├── Little Girl and Maximum XOR.cpp │ │ ├── Lucky Sum of Digits.cpp │ │ ├── Mahmoud and Ehab and another array construction task.cpp │ │ ├── Mahmoud and Ehab and Even Odd Game.cpp │ │ ├── Mahmoud and a Triangle.cpp │ │ ├── Make a Square Alternate Solution.cpp │ │ ├── Make a Square.cpp │ │ ├── Mancala.cpp │ │ ├── Mentors.cpp │ │ ├── Pairs of Lines.cpp │ │ ├── Two Gram.cpp │ │ ├── Valhalla Seige.cpp │ │ └── Wrong Subtraction.cpp │ ├── C Programs 22/ │ │ ├── AND Graph.cpp │ │ ├── Almost Arithmetic Progression.cpp │ │ ├── Antipalindrome Alternate Solution.cpp │ │ ├── Antipalindrome.cpp │ │ ├── Ball.cpp │ │ ├── Bits.cpp │ │ ├── Bookshelves.cpp │ │ ├── Businessman Problems.cpp │ │ ├── Chess Placing.cpp │ │ ├── Correct Solution.cpp │ │ ├── Counting Kangaroos is Fun.cpp │ │ ├── Fruits.cpp │ │ ├── High School Become Human.cpp │ │ ├── Infinity Gauntlet.cpp │ │ ├── Knights of a Polygonal Table.cpp │ │ ├── Letters.cpp │ │ ├── Local Extrema.cpp │ │ ├── Remove Duplicates.cpp │ │ ├── Super Agent.cpp │ │ ├── Switches and Lamps.cpp │ │ ├── Tafurama.cpp │ │ ├── Three Displays Segment Tree Solution.cpp │ │ ├── Three Displays.cpp │ │ └── Useful Decomposition.cpp │ ├── C Programs 23/ │ │ ├── An Impassioned Circulation of Affection.cpp │ │ ├── Another Problem on Strings.cpp │ │ ├── Babaei and Birthday Cake.cpp │ │ ├── Bear and Prime Numbers.cpp │ │ ├── Cirriculum Vitae.cpp │ │ ├── Classy Numbers Precomputing Solution.cpp │ │ ├── Counting Arrays.cpp │ │ ├── Crazy Town.cpp │ │ ├── Find Maximum.cpp │ │ ├── Fish.cpp │ │ ├── Garbage Disposal.cpp │ │ ├── Guest From The Past.cpp │ │ ├── Ice Skater.cpp │ │ ├── Lazyland.cpp │ │ ├── Lesha and Array Splitting.cpp │ │ ├── Lost Array.cpp │ │ ├── Maximum Value.cpp │ │ ├── Maze.cpp │ │ ├── Minesweeper.cpp │ │ ├── Minimum Diameter Tree.cpp │ │ ├── No To Palindromes.cpp │ │ ├── On Number of Decompositions into Multipliers.cpp │ │ ├── Summarise to Powers of Two.cpp │ │ ├── The Fair Nut and String.cpp │ │ └── The Meaningless Game.cpp │ └── C Programs 24/ │ ├── Brutality.cpp │ ├── Connect.cpp │ ├── Div Times Mod.cpp │ ├── Diverse Garland.cpp │ ├── Division and Union.cpp │ ├── Finite or Not.cpp │ ├── Illya and Escalator.cpp │ ├── Increasing by Modulo.cpp │ ├── Nice Garland.cpp │ ├── Planning the Expedition.cpp │ ├── Playing Piano.cpp │ ├── Posterized.cpp │ ├── Powers of Two.cpp │ ├── Splitting into Digits.cpp │ ├── Stages.cpp │ ├── Tanya and Candies.cpp │ ├── The Way to Home.cpp │ ├── Vanya and Label.cpp │ ├── Where_Do_I_Turn.c │ └── Zero Quantity Maximisation.cpp ├── Contests/ │ ├── 463 Div 1 + 2 ICM Technex/ │ │ ├── Explanations/ │ │ │ └── Team Work Explanation.txt │ │ └── Programs/ │ │ └── Team Work.cpp │ ├── 607 Div 1 + 2/ │ │ ├── Explanations/ │ │ │ ├── Azamon Web Services Explanation.txt │ │ │ ├── Beingawesomeism Explanation.txt │ │ │ ├── Cut and Paste Explanation.txt │ │ │ ├── Jeremy Bearimy Explanation.txt │ │ │ └── Suffix Three Explanation.txt │ │ └── Programs/ │ │ ├── Azamon Web Services.cpp │ │ ├── Beingawesomeism.cpp │ │ ├── Cut and Paste.cpp │ │ ├── Jeremy Bearimy.cpp │ │ └── Suffix Three.cpp │ ├── 609 Div 2/ │ │ ├── Explanations/ │ │ │ └── Equation Explanation.txt │ │ └── Programs/ │ │ └── Equation.cpp │ ├── Avito Code Challenge 2018/ │ │ ├── Explanations/ │ │ │ ├── Antipalindrome Alternate Solution Explanation.txt │ │ │ ├── Antipalindrome Explanation.txt │ │ │ ├── Bookshelves Explanation.txt │ │ │ ├── Businessman Problems Explanation.txt │ │ │ └── Useful Decomposition Explanation.txt │ │ └── Programs/ │ │ ├── Antipalindrome Alternate Solution.cpp │ │ ├── Antipalindrome.cpp │ │ ├── Bookshelves.cpp │ │ ├── Businessman Problems.cpp │ │ └── Useful Decomposition.cpp │ ├── Avito Cool Challenge 2018/ │ │ ├── Explanation/ │ │ │ ├── Colourful Bricks Explanation.txt │ │ │ └── Definite Game Explanation.txt │ │ └── Programs/ │ │ ├── Colourful Bricks.cpp │ │ └── Definite Game.cpp │ ├── Barcelona Bootcamp 2018/ │ │ ├── Explanation/ │ │ │ ├── Maximum Sum of Digits Explanation.txt │ │ │ ├── Phone Numbers Explanation.txt │ │ │ └── Social Circles Explanation.txt │ │ └── Programs/ │ │ ├── Maximum Sum of Digits.cpp │ │ ├── Phone Numbers.cpp │ │ └── Social Circles.cpp │ ├── CodeForces Global Round 1/ │ │ ├── Explanations/ │ │ │ ├── Magic Stones Explanation.txt │ │ │ ├── Meaningless Operations Explanation.txt │ │ │ ├── Parity Explanation.txt │ │ │ └── Tape Explanation.txt │ │ └── Programs/ │ │ ├── Magic Stones.cpp │ │ ├── Meaningless Operations.cpp │ │ ├── Parity.cpp │ │ └── Tape.cpp │ ├── CodeForces Global Round 3/ │ │ ├── Explanations/ │ │ │ ├── Another One Bites the Dust Explanation.txt │ │ │ ├── Born This Way Explanation.txt │ │ │ ├── Crazy Diamond Explanation.txt │ │ │ └── Dirty Deeds Done Dirt Cheap Explanation.txt │ │ ├── Programs/ │ │ │ ├── Another One Bites the Dust.cpp │ │ │ ├── Born This Way.cpp │ │ │ ├── Crazy Diamond.cpp │ │ │ └── Dirty Deeds Done Dirt Cheap.cpp │ │ └── Rough Notes Link │ ├── CodeForces Global Round 5/ │ │ ├── Explanations/ │ │ │ ├── Balanced Rating Changes Explanation.txt │ │ │ └── Balanced Tunnel Explanation.txt │ │ └── Programs/ │ │ ├── Balanced Rating Changes.cpp │ │ └── Balanced Tunnel.cpp │ ├── Dasha Code Championship Elimination Round 2019/ │ │ ├── Explanations/ │ │ │ ├── Cows and Snacks Explanation.txt │ │ │ ├── Koala and Lights Explanation │ │ │ ├── Paint The Digits Explanation │ │ │ └── Paint Your Numbers Explanation │ │ ├── Programs/ │ │ │ ├── Cows and Snacks.cpp │ │ │ ├── Koala and Lights.cpp │ │ │ ├── Paint The Digits.cpp │ │ │ ├── Paint The Numbers.cpp │ │ │ └── Paint Your Numbers.cpp │ │ └── Rough Notes │ ├── Div 1 492/ │ │ ├── Explanations/ │ │ │ ├── Game 995 Explanation.txt │ │ │ ├── Leaving the Bar Explanation.txt │ │ │ └── Suit and Tie Explanation.txt │ │ └── Programs/ │ │ ├── Game 995D.cpp │ │ ├── Leaving The Bar.cpp │ │ └── Suit and Tie.cpp │ ├── Div 2 12/ │ │ ├── Explanations/ │ │ │ ├── Ball Explanation.txt │ │ │ ├── Correct Solution Explanation.txt │ │ │ ├── Fruits Explanation.txt │ │ │ └── Super Agent Explanation.txt │ │ └── Programs/ │ │ ├── Ball.cpp │ │ ├── Correct Solution.cpp │ │ ├── Fruits.cpp │ │ └── Super Agent.cpp │ ├── Div 2 136/ │ │ ├── Explanations/ │ │ │ ├── Little Elephant And Array Segment Tree Explanation.txt │ │ │ ├── Little Elephant and Arrays Explanation.txt │ │ │ ├── Little Elephant and Function Explanation.txt │ │ │ ├── Little Elephant and Numbers Explanation.txt │ │ │ └── Little Elephant and Problem Explanation.txt │ │ └── Programs/ │ │ ├── Little Elephant And Array Segment Tree Solution.cpp │ │ ├── Little Elephant and Array.cpp │ │ ├── Little Elephant and Function.cpp │ │ ├── Little Elephant and Numbers.cpp │ │ └── Little Elephant and Problem.cpp │ ├── Div 2 197/ │ │ ├── Explanations/ │ │ │ ├── Helpful Maths Explanation.txt │ │ │ ├── Xenia and Bit Operations Explanation.txt │ │ │ ├── Xenia and Ringroad Explanation.txt │ │ │ └── Xenia and Weights Explanation.txt │ │ └── Programs/ │ │ ├── Helpful Maths.cpp │ │ ├── Xenia and Bit Operations.cpp │ │ ├── Xenia and Ringroad.cpp │ │ └── Xenia and Weights.cpp │ ├── Div 2 205/ │ │ ├── Explanation/ │ │ │ ├── Little Elephant and Cards Explanation.txt │ │ │ └── Little Elephant and Rozdil - Explanation.txt │ │ └── Programs/ │ │ ├── Little Elephant and Cards.cpp │ │ ├── Little Elephant and Sorting.cpp │ │ └── Little_Elephant_Rozdil.c │ ├── Div 2 261/ │ │ ├── Explanation/ │ │ │ ├── Pashmak and Buses Explanation.txt │ │ │ ├── Pashmak and Buses.cpp │ │ │ ├── Pashmak and Flowers - Explanation.txt │ │ │ ├── Pashmak and Garden Explanation.txt │ │ │ ├── Pashmak and Graph Explanation.txt │ │ │ └── Pashmak and Parmida's Problem Explanation.txt │ │ └── Programs/ │ │ ├── Pashmak and Buses.cpp │ │ ├── Pashmak and Garden.cpp │ │ ├── Pashmak and Graph.cpp │ │ ├── Pashmak and Parmida's Problem.cpp │ │ └── Pashmak_and_Flowers.c │ ├── Div 2 276/ │ │ ├── Explanations/ │ │ │ ├── Little Girl and Maximum Sum Explanation.txt │ │ │ ├── Little Girl and Maximum XOR Explanation.txt │ │ │ └── Lunch Rush Explanation.txt │ │ └── Programs/ │ │ ├── Little Girl and Maximum Sum.cpp │ │ ├── Little Girl and Maximum XOR.cpp │ │ └── Lunch Rush.cpp │ ├── Div 2 321/ │ │ └── Programs/ │ │ ├── Kefa and Company.cpp │ │ ├── Kefa and Park.cpp │ │ └── Kefa_and_First_Step.c │ ├── Div 2 367/ │ │ ├── Explanation/ │ │ │ ├── Hard Problem Explanation.txt │ │ │ └── Interesting Drink Explanation.txt │ │ └── Programs/ │ │ ├── Hard Problem.cpp │ │ └── Interesting Drink.cpp │ ├── Div 2 371/ │ │ ├── Explanations/ │ │ │ ├── Filya and Homework - Explanation.txt │ │ │ ├── Meeting of Old Friends - Explanation.txt │ │ │ └── Sonya and Queries Explanation.txt │ │ └── Programs/ │ │ ├── Filya_and_Homework.c │ │ ├── Meeting_of_Old_Friends.c │ │ └── Sonya and Queries.cpp │ ├── Div 2 461/ │ │ ├── Explanations/ │ │ │ └── Cave Paintings Explanation.txt │ │ └── Programs/ │ │ └── Cave Paintings.cpp │ ├── Div 2 464/ │ │ └── Programs/ │ │ └── Love Triangle.cpp │ ├── Div 2 473/ │ │ ├── Explanation/ │ │ │ ├── Mahmoud and Ehab and Another Array Construction Task Explanation.txt │ │ │ └── Mahmoud and Ehab and Even Odd Game Explanation.txt │ │ └── Programs/ │ │ ├── Mahmoud and Ehab and Another Array Construction Task.cpp │ │ └── Mahmoud and Ehab and Even Odd Game.cpp │ ├── Div 2 478/ │ │ ├── Explanations/ │ │ │ ├── Aramic Script Bitmask Solution.txt │ │ │ ├── Aramic Script Explanation.txt │ │ │ ├── Ghosts Explanation.txt │ │ │ ├── Mancala Explanation.txt │ │ │ └── Valhalla Siege Explanation.txt │ │ └── Programs/ │ │ ├── Aramic Script Bitmask Solution.cpp │ │ ├── Aramic Script.cpp │ │ ├── Ghosts.cpp │ │ ├── Mancala.cpp │ │ └── Valhalla Siege.cpp │ ├── Div 2 485/ │ │ ├── Explanations/ │ │ │ ├── AND Graph Explanation.txt │ │ │ ├── Fair Explanation.txt │ │ │ ├── High Schooll Become Human Explanation.txt │ │ │ ├── Infinity Gauntlet Explanation.txt │ │ │ ├── Petr and Permutations Explanation.txt │ │ │ ├── Three Displays Explanation.txt │ │ │ └── Three Displays Segment Tree Solution Explanation.txt │ │ └── Programs/ │ │ ├── AND Graph.cpp │ │ ├── Fair.cpp │ │ ├── High School Become Human.cpp │ │ ├── Infinity Gauntlet.cpp │ │ ├── Petr and Permutations.cpp │ │ ├── Three Displays Segment Tree Solution.cpp │ │ └── Three Displays.cpp │ ├── Div 2 489/ │ │ ├── Explanations/ │ │ │ ├── Nastya Studies Informatics Explanation.txt │ │ │ ├── Nastya and Game Explanation.txt │ │ │ ├── Nastya and King Shamans Alternate Solution Explanation.txt │ │ │ ├── Nastya and King Shamans Explanation.txt │ │ │ ├── Nastya and a Wardrobe Explanation.txt │ │ │ └── Nastya and an Array Explanation.txt │ │ └── Programs/ │ │ ├── Nastya Studies Informatics.cpp │ │ ├── Nastya and Game.cpp │ │ ├── Nastya and King-Shamans Alternate Solution.cpp │ │ ├── Nastya and King-Shamans.cpp │ │ ├── Nastya and a Wardrobe.cpp │ │ └── Nastya and an Array.cpp │ ├── Div 2 491/ │ │ ├── Explanations/ │ │ │ ├── Bishwock Explanation.txt │ │ │ ├── Bus Number Explanation.txt │ │ │ ├── Candies Explanation.txt │ │ │ ├── Getting an A Explanation.txt │ │ │ └── If At First You Don't Succeed Explanation.txt │ │ └── Programs/ │ │ ├── Bishwock.cpp │ │ ├── Bus Number.cpp │ │ ├── Candies.cpp │ │ ├── Getting an A.cpp │ │ └── If At First You Don't Succeed.cpp │ ├── Div 2 492/ │ │ ├── Explanation/ │ │ │ ├── Game 995 Explanation.txt │ │ │ ├── Hit the Lottery Explanation.txt │ │ │ ├── Leaving the Bar Explanation.txt │ │ │ ├── Suit and Tie Explanation.txt │ │ │ ├── Tesla Explanation.txt │ │ │ └── World Cup Explanation.txt │ │ └── Programs/ │ │ ├── Game 995D.cpp │ │ ├── Hit the Lottery.cpp │ │ ├── Leaving The Bar.cpp │ │ ├── Suit and Tie.cpp │ │ ├── Tesla.cpp │ │ └── World Cup.cpp │ ├── Div 2 497/ │ │ ├── Explanation/ │ │ │ ├── Reorder the Array Explanation.txt │ │ │ ├── Romaji Explanation.txt │ │ │ └── Turn The Rectangle Explanation.txt │ │ └── Programs/ │ │ ├── Reorder the Array.cpp │ │ ├── Romaji.cpp │ │ └── Turn the Rectangle.cpp │ ├── Div 2 508/ │ │ ├── Explanation/ │ │ │ ├── Equality Explanation.txt │ │ │ ├── Gambling Explanation.txt │ │ │ └── Non Coprime Partition Explanation.txt │ │ └── Programs/ │ │ ├── Equality.cpp │ │ ├── Gambling.cpp │ │ └── Non Coprime Partition.cpp │ ├── Div 2 511/ │ │ ├── Explanation/ │ │ │ ├── Enlarge GCD Explanation.txt │ │ │ └── Little C Loves 3 I Explanation.txt │ │ └── Programs/ │ │ └── Little C Loves 3 I.cpp │ ├── Div 2 533/ │ │ ├── Explanations/ │ │ │ ├── Ayoub and Lost Array Explanation.txt │ │ │ ├── Ayoub and Lost Array Matrix Exponentiation Explanation.txt │ │ │ ├── Salem and Sticks Explanation.txt │ │ │ └── Zuhair and Strings Explanation.txt │ │ └── Programs/ │ │ ├── Ayoub and Lost Array Matrix Exponentiation.cpp │ │ ├── Ayoub and Lost Array.cpp │ │ ├── Salem and Sticks.cpp │ │ └── Zuhair and Strings.cpp │ ├── Div 2 538/ │ │ ├── Explanations/ │ │ │ ├── Arithmetic Progression Explanation.txt.txt │ │ │ ├── Flood Fill Explanation.txt │ │ │ ├── Got Any Grapes Explanation.txt │ │ │ ├── Please Another Queries on Array Explanation.txt │ │ │ ├── Trailing Loves Explanation.txt │ │ │ ├── Yet Another Subarray Alternate Solution Explanation.txt │ │ │ └── Yet Another Subarray Explanation.txt │ │ └── Programs/ │ │ ├── Arithmetic Progression.cpp │ │ ├── Flood Fill.cpp │ │ ├── Got Any Grapes.cpp │ │ ├── Please Another Queries on Array.cpp │ │ ├── Trailing Loves.cpp │ │ ├── Yet Another Subarray Problem Alternate Solution.cpp │ │ └── Yet Another Subarray Problem.cpp │ ├── Div 2 539/ │ │ ├── Explanations/ │ │ │ ├── Sasha and A Bit of Relax Explanation.txt │ │ │ ├── Sasha and His Trip Explanation.txt │ │ │ ├── Sasha and Magnetic Machine Explanation.txt │ │ │ └── Sasha and One More Name Explanation.txt │ │ └── Programs/ │ │ ├── Sasha and A Bit of Relax.cpp │ │ ├── Sasha and His Trip.cpp │ │ ├── Sasha and Magnetic Machine.cpp │ │ └── Sasha and One More Name.cpp │ ├── Div 2 546/ │ │ ├── Explanations/ │ │ │ ├── Nastya is Playing Computer Games Explanation.txt │ │ │ └── Nastya is Transposing Matrices Explanation.txt │ │ └── Programs/ │ │ ├── Nastya is Playing Computer Games.cpp │ │ └── Nastya is Transposing Matrices.cpp │ ├── Div 2 554/ │ │ ├── Explanations/ │ │ │ └── Neko Does Math Explanation.txt │ │ └── Programs/ │ │ └── Neko Does Math.cpp │ ├── Div 2 562/ │ │ ├── Explanations/ │ │ │ ├── Good Triple Explanation.txt │ │ │ └── Pairs Explanation.txt │ │ ├── Programs/ │ │ │ ├── Good Triple.cpp │ │ │ ├── Increasing by Modulo.cpp │ │ │ └── Pairs.cpp │ │ └── Rough Notes Link │ ├── Div 2 566/ │ │ ├── Explanations/ │ │ │ ├── Filing Shapes Explanation.txt │ │ │ └── Plus From Picture Explanation.txt │ │ ├── Programs/ │ │ │ ├── Filing Shapes.cpp │ │ │ └── Plus From Picture.cpp │ │ └── Rough Notes Link │ ├── Div 2 585/ │ │ ├── Explanations/ │ │ │ ├── Swap Letters Explanation.txt │ │ │ ├── The Number of Products Explanation.txt │ │ │ └── Yellow Cards Explanation │ │ ├── Programs/ │ │ │ ├── Swap Letters.cpp │ │ │ ├── The Number of Products.cpp │ │ │ └── Yellow Cards.cpp │ │ └── Rough Notes │ ├── Div 2 588/ │ │ ├── Explanations/ │ │ │ ├── Anadi and Domino Explanation.txt │ │ │ ├── Ania and Minimizing Explanation.txt │ │ │ ├── Dawid and Bags of Candies Explanation.txt │ │ │ ├── Kamil and Making a Stream Explanation.txt │ │ │ ├── Konrad and Company Evaluation Explanation.txt │ │ │ └── Marcin and Training Camp Explanation.txt │ │ └── Programs/ │ │ ├── Anadi and Domino.cpp │ │ ├── Ania and Minimizing.cpp │ │ ├── Dawid and Bags of Candies.cpp │ │ ├── Kamil and Making a Stream.cpp │ │ ├── Konrad and Company Evaluation.cpp │ │ └── Marcin and Training Camp.cpp │ ├── Div 2 589/ │ │ ├── Explanations/ │ │ │ ├── Complete Tripartite Explanation.txt │ │ │ ├── Distinct Digits Explanation.txt │ │ │ ├── Filing the Grid Explanation.txt │ │ │ └── Primes and Multiplication Explanation.txt │ │ └── Programs/ │ │ ├── Complete Tripartite.cpp │ │ ├── Distinct Digits.cpp │ │ ├── Filing the Grid.cpp │ │ └── Primes and Multiplication.cpp │ ├── Div 2 592/ │ │ ├── Explanations/ │ │ │ ├── Minimizing Difference Explanation.txt │ │ │ ├── Pens and Pencils Explanation.txt │ │ │ ├── Rooms and Staircases Explanation.txt │ │ │ └── The Football Season Explanation.txt │ │ └── Programs/ │ │ ├── Minimizing Difference.cpp │ │ ├── Pens and Pencils.cpp │ │ ├── Rooms and Staircases.cpp │ │ └── The Football Season.cpp │ ├── Div 2 596/ │ │ ├── Explanations/ │ │ │ ├── Forgetting Things Explanation.txt │ │ │ ├── P Binary Explanation.txt │ │ │ ├── Power Products Explanation.txt │ │ │ └── TV Subscriptions Explanation.txt │ │ └── Programs/ │ │ ├── Forgetting Things.cpp │ │ ├── P-Binary.cpp │ │ ├── Power Products.cpp │ │ └── TV Subscriptions.cpp │ ├── Div 2 597/ │ │ ├── Explanations/ │ │ │ ├── Constanze's Machine Explanation.txt │ │ │ ├── Good Ol Number Colouring Explanation.txt │ │ │ └── Restricted RPS Explanation.txt │ │ └── Programs/ │ │ ├── Constanze's Machine.cpp │ │ ├── Good Ol Number Colouring.cpp │ │ └── Restricted RPS.cpp │ ├── Div 2 599/ │ │ ├── Explanations/ │ │ │ ├── Character Swap Explanation.txt │ │ │ ├── Maximum Square Explanation.txt │ │ │ └── Tile Painting Explanation.txt │ │ └── Programs/ │ │ ├── Character Swap.cpp │ │ ├── Maximum Square.cpp │ │ └── Tile Painting.cpp │ ├── Div 2 600/ │ │ ├── Explanations/ │ │ │ ├── Antenna Coverage Explanation.txt.txt │ │ │ ├── Harmonious Graph Explanation.txt │ │ │ ├── Silly Mistakes Explanation.txt │ │ │ ├── Single Push Explanation.txt │ │ │ └── Sweets Eating Explanation.txt │ │ └── Programs/ │ │ ├── Antenna Coverage.cpp │ │ ├── Harmonious Graph.cpp │ │ ├── Silly Mistakes.cpp │ │ ├── Single Push.cpp │ │ └── Sweets Eating.cpp │ ├── Div 2 608/ │ │ └── Programs/ │ │ └── Shwarma Tent.cpp │ ├── Div 2 85/ │ │ ├── Explanation/ │ │ │ ├── Petya and Divisors Explanation.txt │ │ │ ├── Petya and Inequiations Explanation.txt │ │ │ └── Petya and Strings Explanation.txt │ │ └── Programs/ │ │ ├── Petya and Divisors.cpp │ │ ├── Petya and Inequiations.cpp │ │ └── Petya and Strings.cpp │ ├── Div 3 479/ │ │ ├── Explanations/ │ │ │ ├── Consecutive Subsequences Explanation.txt │ │ │ ├── Cyclic Components Explanation.txt │ │ │ ├── Divide by Three Multiply by Two Alternate Solution Explanation.txt │ │ │ ├── Divide by Three, Multiply by Two Explanation.txt │ │ │ ├── Less or Equal Explanation.txt │ │ │ ├── Two Gram Explanation.txt │ │ │ └── Wrong Subtraction Explanation.txt │ │ └── Programs/ │ │ ├── Consecutive Subsequences.cpp │ │ ├── Cyclic Components.cpp │ │ ├── Divide by Three, Multiply by Two Alternate Solution.cpp │ │ ├── Divide by Three, Multiply by Two.cpp │ │ ├── Less or Equal.cpp │ │ ├── Two Gram.cpp │ │ └── Wrong Subtraction.cpp │ ├── Div 3 481/ │ │ ├── Explanations/ │ │ │ ├── Almost Arithmetic Progression Explanation.txt │ │ │ ├── File Name Explanation.txt │ │ │ ├── Letters Explanation.txt │ │ │ ├── Mentors Explanation.txt │ │ │ └── Remove Duplicates Explanation.txt │ │ └── Programs/ │ │ ├── Almost Arithmetic Progression.cpp │ │ ├── File Name.cpp │ │ ├── Letters.cpp │ │ ├── Mentors.cpp │ │ └── Remove Duplicates.cpp │ ├── Div 3 486/ │ │ ├── Explanation/ │ │ │ ├── Diverse Team Explanation.txt │ │ │ ├── Divisibility by 25 Explanation.txt │ │ │ ├── Equal Sums Explanation.txt │ │ │ ├── Points and Powers of Two Explanation.txt │ │ │ └── Substring Sort Explanation.txt │ │ └── Programs/ │ │ ├── Diverse Team.cpp │ │ ├── Divisibility by 25.cpp │ │ ├── Equal Sums.cpp │ │ ├── Points and Powers of Two.cpp │ │ └── Substring Sort.cpp │ ├── Div 3 490/ │ │ ├── Explanations/ │ │ │ ├── Alphabetic Removals Explanation.txt │ │ │ ├── Equalise the Remainders Explanation.txt │ │ │ ├── Mishika and Contests Explanation.txt │ │ │ ├── Reachability from Capital Explanation.txt │ │ │ └── Reversing Encryption Explanation.txt │ │ └── Programs/ │ │ ├── Alphabetic Removals.cpp │ │ ├── Equalise the Remainders.cpp │ │ ├── Mishika and Contests.cpp │ │ ├── Reachability from Capital.cpp │ │ └── Reversing Encryption.cpp │ ├── Div 3 494/ │ │ ├── Explanations/ │ │ │ ├── Binary String Constructing Explanation.txt │ │ │ ├── Coins and Queries Explanation.txt │ │ │ ├── Intense Heat Explanation.txt │ │ │ └── Polycarp's Pockets Explanation.txt │ │ └── Programs/ │ │ ├── Binary String Constructing.cpp │ │ ├── Coins and Queries.cpp │ │ ├── Intense Heat.cpp │ │ └── Polycarp's Pockets.cpp │ ├── Div 3 521/ │ │ ├── Explanations/ │ │ │ ├── Cutting Out Explanation.txt │ │ │ ├── Disturbed People.txt │ │ │ ├── Frog Jumping.txt │ │ │ ├── Good Array.txt │ │ │ └── Thematic Contests Explanation.txt │ │ └── Programs/ │ │ ├── Cutting Out.cpp │ │ ├── Disturbed People.cpp │ │ ├── Frog Jumping.cpp │ │ ├── Good Array.cpp │ │ ├── Pictures with Kittens (Easy Version).cpp │ │ └── Thematic Contests.cpp │ ├── Div 3 531/ │ │ ├── Explanations/ │ │ │ ├── Array K Colouring Explanation.txt │ │ │ └── Balanced Ternary String Explanation.txt │ │ └── Programs/ │ │ ├── Array K Colouring.cpp │ │ └── Balanced Ternary String.cpp │ ├── Div 3 547/ │ │ ├── Explanations/ │ │ │ ├── Colored Boots Explanation.txt │ │ │ ├── Game 23 Explanation.txt │ │ │ ├── Maximal Continuous Rest Explanation.txt │ │ │ ├── Polycarp Restores Permutation Explanation.txt │ │ │ ├── Privatization of Roads in Berland Explanation.txt │ │ │ ├── Same Sum Blocks Explanation.txt │ │ │ └── Superhero Battle Explanation.txt │ │ └── Programs/ │ │ ├── Colored Boots.cpp │ │ ├── Game 23.cpp │ │ ├── Maximal Continuous Rest.cpp │ │ ├── Polycarp Restores Permutation.cpp │ │ ├── Privatization of Roads in Berland.cpp │ │ ├── Same Sum Blocks.cpp │ │ └── Superhero Battle.cpp │ ├── Div 3 590/ │ │ ├── Explanations/ │ │ │ ├── Special Permutations Explanation.txt │ │ │ └── Yet Another Substring Reverse Explanation.txt │ │ └── Programs/ │ │ ├── Special Permutations.cpp │ │ └── Yet Another Substring Reverse.cpp │ ├── Div 3 593/ │ │ ├── Explanations/ │ │ │ ├── Books Exchange Explanation.txt │ │ │ ├── By Elevator or Stairs Explanation.txt │ │ │ ├── Good Numbers Explanation.txt │ │ │ └── Yet Another Dividing Into Teams Explanation.txt │ │ └── Programs/ │ │ ├── Books Exchange.cpp │ │ ├── Elevator or Stairs.cpp │ │ ├── Good Numbers.cpp │ │ └── Yet Another Dividing Into Teams.cpp │ ├── Div 3 595/ │ │ ├── Explanations/ │ │ │ ├── Books Exchange Explanation.txt │ │ │ ├── Good Numbers Explanation.txt │ │ │ └── Yet Another Dividing Into Teams Explanation.txt │ │ └── Programs/ │ │ ├── Books Exchange.cpp │ │ ├── Good Numbers.cpp │ │ └── Yet Another Dividing Into Teams.cpp │ ├── Div 3 598/ │ │ ├── Explanations/ │ │ │ ├── Equalizing Two Strings Explanation.txt │ │ │ ├── Minimize the Permutation Explanation.txt │ │ │ └── Payment Without Change Explanation.txt │ │ └── Programs/ │ │ ├── Binary String Minimizing.cpp │ │ ├── Equalizing Two Strings.cpp │ │ ├── Minimize the Permutation.cpp │ │ └── Payment Without Change.cpp │ ├── Educational Round 11/ │ │ ├── Explanations/ │ │ │ ├── Co Prime Array Explanation.txt │ │ │ ├── Hard Process Explanation.txt │ │ │ └── Number of Parallelograms Explanation.txt │ │ └── Programs/ │ │ ├── Co Prime Array.cpp │ │ ├── Hard Process.cpp │ │ └── Number of Parallelograms.cpp │ ├── Educational Round 32/ │ │ ├── Explanations/ │ │ │ ├── Almost Identity Permutations Explanation.txt │ │ │ ├── Buggy Robot.cpp │ │ │ ├── K-Dominant Character Explanation.txt │ │ │ └── Local Extrema Explanation.txt │ │ └── Programs/ │ │ ├── Almost Identity Permutations.cpp │ │ ├── Buggy Robot.cpp │ │ ├── K-Dominant Character.cpp │ │ └── Local Extrema.cpp │ ├── Educational Round 37/ │ │ ├── Explanation/ │ │ │ ├── Connected Components Explanation.txt.txt │ │ │ ├── List of Integer Explanation.txt │ │ │ ├── Sum and Replace Explanation.txt │ │ │ ├── Swap Adjacent Elements Explanation.txt │ │ │ ├── Tanks Explanation.txt.txt │ │ │ ├── Tea Queue Explanation.txt │ │ │ └── Water the Gardens Explanation.txt │ │ └── Programs/ │ │ ├── Connected Components.cpp │ │ ├── List of Integers.cpp │ │ ├── Sum and Replace.cpp │ │ ├── Swap Adjacent Elements.cpp │ │ ├── Tanks.cpp │ │ ├── Tea Queue.cpp │ │ └── Water the Gardens.cpp │ ├── Educational Round 44/ │ │ ├── Explanations/ │ │ │ ├── Chess Placing Explanation.txt │ │ │ └── Switches and Lamps Explanation.txt │ │ └── Programs/ │ │ ├── Chess Placing.cpp │ │ └── Switches and Lamps.cpp │ ├── Educational Round 46/ │ │ ├── Explanations/ │ │ │ ├── CodeHorses T Shirts Explanation.txt │ │ │ ├── Covered Points Count Explanation.txt │ │ │ └── Yet Another Problem on Subsequence Explanation.txt │ │ └── Programs/ │ │ ├── CodeHorses T Shirts.cpp │ │ ├── Covered Points Count.cpp │ │ └── Yet Another Problem on Subsequence.cpp │ ├── Educational Round 51/ │ │ ├── Explanation/ │ │ │ ├── Bicolourings Explanation.txt │ │ │ ├── Relatively Prime Pairs Explanation.txt │ │ │ ├── Vasya and Multisets Explanation.txt │ │ │ └── Vasya and Password Explanation.txt │ │ └── Programs/ │ │ ├── Bicolourings.cpp │ │ ├── Relatively Prime Pairs.cpp │ │ ├── Vasya and Multisets.cpp │ │ └── Vasya and Password.cpp │ ├── Educational Round 52/ │ │ ├── Explanations/ │ │ │ ├── Vasya and Chocolates Explanation.txt │ │ │ └── Vasya and Isolated Vertices Explanation.txt │ │ └── Programs/ │ │ ├── Vasya and Chocolates.cpp │ │ └── Vasya and Isolated Vertices.cpp │ ├── Educational Round 54/ │ │ ├── Explanation/ │ │ │ ├── Divisor Subtraction Explanation.txt │ │ │ ├── Meme Problem Explanation.txt │ │ │ └── Minimizing the String Explanation.txt │ │ └── Programs/ │ │ ├── Divisor Subtraction.cpp │ │ ├── Meme Problem.cpp │ │ └── Minimizing the String.cpp │ ├── Educational Round 55/ │ │ ├── Explanation/ │ │ │ └── Increasing Frequency Explanation.txt │ │ └── Programs/ │ │ └── Increasing Frequency.cpp │ ├── Educational Round 56/ │ │ ├── Explanations/ │ │ │ ├── Beautiful Graph Explanation.txt │ │ │ ├── Dice Rolling Explanation.txt │ │ │ ├── Letters Rearranging Explanation.txt │ │ │ └── Mishka and Last Exam Explanation.txt │ │ └── Programs/ │ │ ├── Beautiful Graph.cpp │ │ ├── Dice Rolling.cpp │ │ ├── Letters Rearranging.cpp │ │ └── Mishka and Last Exam.cpp │ ├── Educational Round 60/ │ │ ├── Explanations/ │ │ │ ├── Best Subsegment Explanation.txt │ │ │ └── Emotes Explanation.txt │ │ └── Programs/ │ │ ├── Best Subsegment.cpp │ │ └── Emotes.cpp │ ├── Educational Round 62/ │ │ ├── Explanations/ │ │ │ ├── Detective Book Explanation.txt │ │ │ ├── Good Strings Explanation.txt │ │ │ ├── Minimum Triangulation Explanation.txt │ │ │ └── Playlist Explanation.txt │ │ └── Programs/ │ │ ├── Detective Book.cpp │ │ ├── Good Strings.cpp │ │ ├── Minimum Triangulation.cpp │ │ └── Playlist.cpp │ ├── Educational Round 69/ │ │ ├── Explanations/ │ │ │ ├── Array Splitting Explanation.txt │ │ │ ├── DIY Wooden Ladder Explanation.txt │ │ │ └── Pillars Explanation.txt │ │ ├── Programs/ │ │ │ ├── Array Splitting.cpp │ │ │ ├── DIY Wooden Ladder.cpp │ │ │ └── Pillars.cpp │ │ └── Rough Notes Link │ ├── Educational Round 73/ │ │ ├── Explanations/ │ │ │ ├── 2048 Game Explanation.txt │ │ │ ├── Game With String Explanation.txt │ │ │ ├── Knights Explanation.txt │ │ │ ├── Make The Fence Great Again Explanation.txt │ │ │ └── Perfect Team Explanation.txt │ │ └── Programs/ │ │ ├── 2048 Game.cpp │ │ ├── Game With String.cpp │ │ ├── Knights.cpp │ │ ├── Make The Fence Great Again.cpp │ │ └── Perfect Team.cpp │ ├── Educational Round 74/ │ │ ├── Explanations/ │ │ │ ├── AB String Explanation.txt │ │ │ ├── Keyboard Purchase Explanation.txt │ │ │ ├── Kill Em All Explanation.txt │ │ │ └── Prime Subtraction Explanation.txt │ │ └── Programs/ │ │ ├── AB String.cpp │ │ ├── Keyboard Purchase.cpp │ │ ├── Kill Em All Explanation.txt │ │ └── Prime Subtraction.cpp │ ├── Educational Round 77/ │ │ ├── Explanations/ │ │ │ └── Yet Another Monster Killing Problem Explanation.txt │ │ └── Programs/ │ │ ├── Dominated Subarray.cpp │ │ ├── Magic Stick.cpp │ │ ├── Two Rival Students.cpp │ │ └── Yet Another Monster Killing Problem.cpp │ ├── Lyft Level 5 Challenge 2018 - Elimination Round/ │ │ ├── Explanation/ │ │ │ ├── Divisors.txt │ │ │ ├── King Escape Explanation.txt │ │ │ ├── Permutation Game Explanation.txt │ │ │ └── Square Difference Explanation.txt │ │ └── Programs/ │ │ ├── Divisors.cpp │ │ ├── King Escape.cpp │ │ ├── Permutation Game.cpp │ │ └── Square Difference.cpp │ ├── Mail.Ru Cup 2018 Round 1/ │ │ ├── Explanation/ │ │ │ ├── Appending Mex.txt │ │ │ ├── Candies Distribution.txt │ │ │ └── Changing the Array Explanation.txt │ │ └── Programs/ │ │ ├── Appending Mex.cpp │ │ ├── Candy Distribution.cpp │ │ └── Changing the Array.cpp │ ├── Manthan 2018/ │ │ ├── Explanation/ │ │ │ ├── Equalize Explanation.txt │ │ │ ├── Packets Explanation.txt │ │ │ ├── Reach Median Explanation.txt │ │ │ └── Valid BFS Explanation.txt │ │ └── Programs/ │ │ ├── Equalize.cpp │ │ ├── Packets.cpp │ │ ├── Reach Median.cpp │ │ └── Valid BFS.cpp │ ├── Moscow Team Olympiad 2018/ │ │ ├── Explanation/ │ │ │ ├── Equations of Mathematical Magic Explanation.txt │ │ │ ├── Make a Triangle Explanation.txt │ │ │ └── Oh Those Palindromes Explanation.txt │ │ └── Programs/ │ │ ├── Equations of Mathematical Magic.cpp │ │ ├── Make a Triangle.cpp │ │ └── Oh Those Palindromes.cpp │ ├── Technocup 2019 Elimination Round 1/ │ │ ├── Explanation/ │ │ │ ├── In Search of An Easy Problem Explanation.txt │ │ │ ├── Vasya and Cornfield.txt │ │ │ ├── Vasya and Golden Ticket Explanation.txt │ │ │ ├── Vasya and Good Sequences Explanation.txt │ │ │ └── Vasya and Triangle Explanation.txt │ │ └── Programs/ │ │ ├── In Search of An Easy Problem.cpp │ │ ├── Vasya and Cornfield.cpp │ │ ├── Vasya and Golden Ticket.cpp │ │ ├── Vasya and Good Sequences.cpp │ │ └── Vasya and Triangle.cpp │ └── Technocup 2019 Elimination Round 2/ │ ├── Explanation/ │ │ ├── Curiosity Has No Limits.txt │ │ └── Golden Plate.txt │ └── Programs/ │ ├── Curiosity Has No Limits.cpp │ └── Golden Plate.cpp ├── Explanations/ │ ├── Explanations - 1/ │ │ ├── Again Twenty Five - Explanation.txt │ │ ├── Bear and Big Brother - Explanation.txt │ │ ├── Beautiful Matrix - Explanation.txt │ │ ├── Boy or Girl - Explanation.txt │ │ ├── Complicated GCD - Explanation.txt │ │ ├── Compote - Explanation.txt │ │ ├── Dasha and Stairs - Explanation.txt │ │ ├── Elephant - Explanation.txt │ │ ├── Even Odds - Explanation.txt │ │ ├── Fancy Fence - Explanation.txt │ │ ├── Holiday of Equality - Explanation.txt │ │ ├── I Love Username - Explanation.txt │ │ ├── Ilya Bank Account - Explanation.txt │ │ ├── Little Elephant and Rozdil - Explanation.txt │ │ ├── Lucky Division - Explanation.txt │ │ ├── Nearly Lucky Number - Explanation.txt │ │ ├── Opponents - Explanation.txt │ │ ├── Petr and a Calendar - Explanation.txt │ │ ├── Shell Game - Explanation.txt │ │ ├── Sherlock's New Girlfriend - Explanation.txt │ │ ├── Taymr is Calling You - Explanation.txt │ │ ├── The Wall - Explanation.txt │ │ ├── Translation - Explanation.txt │ │ ├── Vitya in the Countryside - Explanation.txt │ │ └── Vladik and Flights - Explanation.txt │ ├── Explanations - 10/ │ │ ├── A and B Compilation Errors Explanation.txt │ │ ├── Amr and Music Explanation.txt │ │ ├── Arrival of General Explanation.txt │ │ ├── Bear and Game Explanation.txt │ │ ├── Beautiful Year Explanation.txt │ │ ├── Black Square Explanation.txt │ │ ├── Counterexample Explanation.txt │ │ ├── Difference Row.txt │ │ ├── Eugene and Array Explanation.txt │ │ ├── Interesting Drink Explanation.txt │ │ ├── Keyboard Layouts Explanation.txt │ │ ├── Life Without Zeroes Explanation.txt │ │ ├── Modified GCD Explanation.txt │ │ ├── Multi Judge Solving Explanation.txt │ │ ├── Next Test Explanation.txt │ │ ├── Presents Explanation.txt │ │ ├── Serega and Coat Rack Explanation.txt │ │ ├── Serega and Suffixes Explanation.txt │ │ ├── Slightly Decreasing Permutation Explanation.txt │ │ ├── Swap Sort Explanation.txt │ │ ├── Taxi Explanation.txt │ │ ├── Toy Cars Explanation.txt │ │ ├── Unimodal Arrays Explanation.txt │ │ ├── Valera and Plates Explanation.txt │ │ └── Vanya and Cubes Explanation.txt │ ├── Explanations - 11/ │ │ ├── BerSU Ball Explanation.txt │ │ ├── Elections Explanation.txt │ │ ├── Five in a Row Explanation.txt │ │ ├── Football Explanation.txt │ │ ├── Fortune Telling Explanation.txt │ │ ├── Free Cash Alternate Solution Explanation.txt │ │ ├── Free Cash Explanation.txt │ │ ├── Games.txt │ │ ├── Good Number Explanation.txt │ │ ├── Johnny Likes Numbers Explanation.txt │ │ ├── Lever Explanation.txt │ │ ├── Lunch Rush Explanation.txt │ │ ├── Magic Spheres Explanation.txt │ │ ├── New Year and Hurry Explanation.txt │ │ ├── Nicholas and Permutation Explanation.txt │ │ ├── Petya and Staircases Explanation.txt │ │ ├── Playing with Dice Explanation.txt │ │ ├── Saitama Destroys Hotel Explanation.txt │ │ ├── Sasha and Sticks Explanation.txt │ │ ├── Soft Drinking Explanation.txt │ │ ├── The Child and The Homework Explanation.txt │ │ ├── The New Year Meeting Friends Alternate Solution.txt │ │ ├── The New Year Meeting Friends Explanation.txt │ │ ├── Word Explanation.txt │ │ └── inc ARG Explanation.txt │ ├── Explanations - 2/ │ │ ├── A and B Chess - Explanation.txt │ │ ├── Anton and Danik - Explanation.txt │ │ ├── Bachgold Problem - Explanation.txt │ │ ├── Bit++ - Explanation.txt │ │ ├── Buy a Shovel - Explanation.txt │ │ ├── Chat Room - Explanation.txt │ │ ├── Chips - Explanation.txt │ │ ├── Cinema Line - Explanation.txt │ │ ├── Domino Piling - Explanation.txt │ │ ├── Drazil and Date - Explanation.txt │ │ ├── George and Accomodation - Explanation.txt │ │ ├── Gravity Flip - Explanation.txt │ │ ├── Infinite Sequence - Explanation.txt │ │ ├── Interview with Oleg - Explanation.txt │ │ ├── Memory and Crow - Explanation.txt │ │ ├── Pasha and Stick - Explanation.txt │ │ ├── Pineapple Incident - Explanation.txt │ │ ├── Serial Killer - Explanation.txt │ │ ├── Soldier and Bananas - Explanation.txt │ │ ├── Spider Man - Explanation.txt │ │ ├── Stones on a Table - Explanation.txt │ │ ├── Transform A to B - Explanation.txt │ │ ├── Triangular Numbers - Explanation.txt │ │ ├── Watermelon - Explanation.txt │ │ └── Word Capitalisation - Explanation.txt │ ├── Explanations - 3/ │ │ ├── Anton and Polyhedron - Explanation.txt │ │ ├── Calculating Function - Explanation.txt │ │ ├── Cheap Travel - Explanation.txt │ │ ├── Checking the Calendar - Expanation.txt │ │ ├── Currency System in Geraldion - Explanation.txt │ │ ├── Die Roll - Explanation.txt │ │ ├── Domino Effect - Explanation.txt │ │ ├── Expression - Explanation.txt │ │ ├── Fedya and Maths - Explanation.txt │ │ ├── Filya and Homework - Explanation.txt │ │ ├── Game - Explanation.txt │ │ ├── Initial Bet - Explanation.txt │ │ ├── LCM Challenge - Explanation.txt │ │ ├── Maximum Increase - Explanation.txt │ │ ├── Mishka and Game - Explanation.txt │ │ ├── Multiplication Table - Explanation.txt │ │ ├── Next Round - Explanation.txt │ │ ├── Party - Explanation.txt │ │ ├── Police Recruits - Explanation.txt │ │ ├── Raising Bacteria - Explanation.txt │ │ ├── Save Luke - Explanation.txt │ │ ├── Taxes - Explanation.txt │ │ ├── Tennis Tournament - Explanation.txt │ │ ├── The Number of Positions - Explanation.txt │ │ └── Theatre Square - Explanation.txt │ ├── Explanations - 4/ │ │ ├── Aloyna Numbers - Explanation.txt │ │ ├── Arpa's Hard Problem and Mehrad's Naive Cheat - Explanation.txt │ │ ├── Benches - Explanation.txt │ │ ├── Challenge Pendants - Explanation.txt │ │ ├── Chewbecca and Number - Explanation.txt │ │ ├── Chocolate - Explanation.txt │ │ ├── Design Tutorial - Learn From Math - Explanation.txt │ │ ├── Divisibility - Explanation.txt │ │ ├── Fedor and New Game - Explanation.txt │ │ ├── Game-Test - Explanation.txt │ │ ├── Hexagons - Explanation.txt │ │ ├── Hulk - Explanation.txt │ │ ├── Indivisibility - Explanation.txt │ │ ├── Interview - Explanation.txt │ │ ├── King Moves - Explanation.txt │ │ ├── Lineland Mail - Explanation.txt │ │ ├── Lucky Numbers - Explanation.txt │ │ ├── Poland Ball and Hypothesis - Explanation.txt │ │ ├── Professor Gukiz's Robot - Explanation.txt │ │ ├── Random Teams- Explanation.txt │ │ ├── Reconnaissance 2 - Explanation.txt │ │ ├── Selection of Personnel - Explanation.txt │ │ ├── Tetrahedron - Explanation.txt │ │ ├── Vasya and Petya's Game - Explanation.txt │ │ └── Way Too Long Words - Explanation.txt │ ├── Explanations - 5/ │ │ ├── Bear and Poker - Explanation.txt │ │ ├── Boredom - Explanation.txt │ │ ├── Cut Ribbon - Explanation.txt │ │ ├── Display Size - Explanation.txt │ │ ├── Duff in Love - Explanation.txt │ │ ├── Flipping Game - Explanation.txt │ │ ├── Flowers - Explanation.txt │ │ ├── Fox and Dividing Cheese - Explanation.txt │ │ ├── Hungry Sequence - Explanation.txt │ │ ├── K Interesting Pair of Integers - Explanation.txt │ │ ├── Kefa and First Step - Explanation.txt │ │ ├── Making a String - Explanation.txt │ │ ├── Non Square Equation - Explanation.txt │ │ ├── Odd Sum - Explanation.txt │ │ ├── Parking Lot - Explanation.txt │ │ ├── Perfect Permutation - Explanation.txt │ │ ├── Preparing for Olympiad - Explanation.txt │ │ ├── Star - Explanation.txt │ │ ├── Table Tennis Game 2 - Explanation.txt │ │ ├── Tavas and Saddas - Explanation.txt │ │ ├── Team - Explanation.txt │ │ ├── Tetrahedron - Efficiently Explanation.txt │ │ ├── Tricky Sum - Explanation.txt │ │ ├── Vacations - Explanation.txt │ │ └── Vanya and Table.txt │ ├── Explanations - 6/ │ │ ├── A Shell Game - Explanation.txt │ │ ├── Accounting - Explanation.txt │ │ ├── Anton and Digits - Explanation.txt │ │ ├── Black Square - Explanation.txt │ │ ├── Dinner with Emma - Explanation.txt │ │ ├── Ebony and Ivory - Explanation.txt │ │ ├── Find Amir - Explanation.txt │ │ ├── Game with Sticks - Explanation.txt │ │ ├── Increasing Sequence - Explanation.txt │ │ ├── Insomnia Cure - Explanation.txt │ │ ├── Jumping Ball - Explanation.txt │ │ ├── K Tree - Explanation.txt │ │ ├── Lovely Palindromes - Explanation.txt │ │ ├── Luxurious Buildings - Explanation.txt │ │ ├── Meeting of Old Friends - Explanation.txt │ │ ├── Oleg and Shares - Explanation.txt │ │ ├── Patrick and Shopping - Explanation.txt │ │ ├── Plate Game - Explanation.txt │ │ ├── Rewards - Explanation.txt │ │ ├── Round House - Explanation.txt │ │ ├── System of Equations - Explanation.txt │ │ ├── Vanya and Fence - Explanation.txt │ │ ├── Vanya and Lanterns - Explanation.txt │ │ ├── Vasya and Hipster - Explanation.txt │ │ └── Wizard's Duel - Explanation.txt │ ├── Explanations - 7/ │ │ ├── 3 - Palindrome - Explanation.txt │ │ ├── Alena's Schedule - Explanation.txt │ │ ├── Alice and Bob - Explanation.txt │ │ ├── An Abandoned Sentiment From The Past - Explanation.txt │ │ ├── Andrushya and Socks - Explanation.txt │ │ ├── Combination Lock Explanation.txt │ │ ├── Devu, the Singer and Churu, the Joker - Explanation.txt │ │ ├── Fake NP - Explanation.txt │ │ ├── Fence - Explanation.txt │ │ ├── Find Marble - Explanation.txt │ │ ├── Free Ice Cream Explanation.txt │ │ ├── Hexadecimal's Theorem Alternate Solution Explanation.txt │ │ ├── Hexadecimal's Theorem Explanation.txt │ │ ├── IQ Test - Explanation.txt │ │ ├── Magnets - Explanation.txt │ │ ├── Mahmod and Longest Uncommon Subsequence - Explanation.txt │ │ ├── Monster and Squirrel - Explanation.txt │ │ ├── New Year Transportation Explanation.txt │ │ ├── Optimal Point on a Line - Explanation.txt │ │ ├── Pashmak and Flowers - Explanation.txt │ │ ├── Potions Homework - Explanation.txt │ │ ├── Pythagorean Triples Explanation.txt │ │ ├── Red and Blue Balls - Explanation.txt │ │ ├── The Contest - Explanation.txt │ │ └── Young Physicist - Explanation.txt │ ├── Explanations - 8/ │ │ ├── A and B Team Training Explanation.txt │ │ ├── Almost Primes Explanation.txt │ │ ├── Brian's Photos.txt │ │ ├── Caisa and Pylons Explanation.txt │ │ ├── Ceil and Flowers Explanation.txt │ │ ├── Choosing Teams Explanation.txt │ │ ├── Diverse Permutation Explanation.txt │ │ ├── Golden Age Explanation.txt │ │ ├── HQ9+ Explanation.txt │ │ ├── Hexadecimal's Numbers Explanation.txt │ │ ├── Jzzhu and Sequences Explanation.txt │ │ ├── K Factorisation Explanation.txt │ │ ├── Noldbach Problem Explanation.txt │ │ ├── Oleysa and Rodion Explanation.txt │ │ ├── Petr and Book Explanation.txt │ │ ├── Petya and Strings Explanation.txt │ │ ├── Sum of Digits Explanation.txt │ │ ├── T Primes Alternate Solution Explanation.txt │ │ ├── T Primes Explanation.txt │ │ ├── Two Bags of Potatos - Explanation.txt │ │ ├── Vanya and Cards Explanation.txt │ │ ├── Vitaly and Night Explanation.txt │ │ ├── Wet Shark and Odd and Even Explanation.txt │ │ └── Yarslav and Permutations Explanation.txt │ ├── Explanations - 9/ │ │ ├── Alyona and Copybooks Explanation.txt │ │ ├── Appleman and Toastman Explanation.txt │ │ ├── Array Explanation.txt │ │ ├── Bear and Five Cards Explanation.txt │ │ ├── Bus to Udayland Explanation.txt │ │ ├── Case of the Zeroes and Ones Explanation.txt │ │ ├── Circle Line Explanation.txt │ │ ├── Crazy Computer Explanation.txt │ │ ├── Crossword Solving Explanation.txt │ │ ├── Divisibility Explanation.txt │ │ ├── Fox and Number Game Explanation.txt │ │ ├── Haiku Explanation.txt │ │ ├── I'm Bored with Life Explanation.txt │ │ ├── Is your Horseshow on the Other Hoof Explanation.txt │ │ ├── K-th Divisor Explanation.txt │ │ ├── Kitahara Haruki's Gift Explanation.txt │ │ ├── Little Elephant and Function Explanation.txt │ │ ├── Little Elephant and Problem Explanation.txt │ │ ├── New Year and Days Explanation.txt │ │ ├── One Dimensional Japanese Crossword Explanation.txt │ │ ├── Present from Lena Explanation.txt │ │ ├── Prime Matrix.txt │ │ ├── String Task Explanation.txt │ │ ├── Subtractions Explanation.txt │ │ └── Toy Army Explanation.txt │ ├── Explanations 12/ │ │ ├── Anastasia and Pebbles Explanation.txt │ │ ├── Bear and Three Balls Explanation.txt │ │ ├── Buggy Sorting Explanation.txt │ │ ├── Co Prime Array Explanation.txt │ │ ├── Dima and Friends Explanation.txt │ │ ├── Dima and Sequence Explanation.txt │ │ ├── Dreamoon and Stairs Alternate Solution Explanation.txt │ │ ├── Dreamoon and Stairs Explanation.txt │ │ ├── Fashion in Berland Explanation.txt │ │ ├── Inbox (100500) Explanation.txt │ │ ├── Key Races Explanation.txt │ │ ├── Ksusha and Arrays Explanation.txt │ │ ├── Lecture Explanation.txt │ │ ├── Little Elephant and Chess Explanation.txt │ │ ├── Little Girl and Maximum Sum.txt │ │ ├── Minimum Difficulty Explanation.txt │ │ ├── Pahsa and Pixels Explanation.txt │ │ ├── Puzzles Explanation.txt │ │ ├── Santa Claus and Candies Explanation.txt │ │ ├── Sergey and Dima Explanation.txt │ │ ├── Shaas and Oskols Explanation.txt │ │ ├── Sleuth Explanation.txt │ │ ├── The Festive Evening Explanation.txt │ │ ├── The Number on the Board Explanation.txt │ │ └── Watching a Movie Explanation.txt │ ├── Explanations 13/ │ │ ├── A Good Contest Explanation.txt │ │ ├── Arpa's Obvious Problem and Mehrad's Terrible Solution Explanation.txt │ │ ├── Arrays Explanation.txt │ │ ├── Arya and Bran Explanation.txt │ │ ├── Bear and Elections Explanation.txt │ │ ├── Business Trip.txt │ │ ├── Cards Explanation.txt │ │ ├── Code Obfuscation Explanation.txt │ │ ├── Drinks Explanation.txt │ │ ├── Epic Game Explanation.txt │ │ ├── Functions Again Explanation.txt │ │ ├── Generous Kefa Explanation.txt │ │ ├── George and Job Explanation.txt │ │ ├── Godsend Explanation.txt │ │ ├── Ilya and Queries Explanation.txt │ │ ├── Kuriyama Mirai's Stones Explanation.txt │ │ ├── Lights Out Explanation.txt │ │ ├── Little Dima and Equation Explanation.txt │ │ ├── Little Elephant and Bits Explanation.txt │ │ ├── New Skateboard Explanation.txt │ │ ├── Oath of the Night's Watch Explanation.txt │ │ ├── Sort the Array Explanation.txt │ │ ├── Star Sky Explanation.txt │ │ ├── Vanya and Books Explanation.txt │ │ └── Vasya and Digital Root Explanation.txt │ ├── Explanations 14/ │ │ ├── Asphalting Roads Explanation.txt │ │ ├── Bicycle Chain Explanation.txt │ │ ├── Borze Explanation.txt │ │ ├── Building Permutation Explanation.txt │ │ ├── Chess Tourney Explanation.txt │ │ ├── Cormen - The Best Friend of Man Explanation.txt │ │ ├── DZY Loves Sequences Explanation.txt │ │ ├── Dragons Explanation.txt │ │ ├── Drazil and Factorial Explanation.txt │ │ ├── Football Explanation.txt │ │ ├── Helpful Maths Explanation.txt │ │ ├── Increase and Decrease Explanation.txt │ │ ├── Jeff and Digits Explanation.txt │ │ ├── Jzzhu and Children Explanation.txt │ │ ├── Modulo Sum Explanation.txt │ │ ├── Odds and Ends Explanation.txt │ │ ├── Panoramix's Prediction Explanation.txt │ │ ├── Permutation Explanation.txt │ │ ├── Powers of Two.txt │ │ ├── Queue at the School Explanation.txt │ │ ├── Rectangles Explanation.txt │ │ ├── Supercentral Point Explanation.txt │ │ ├── Tram Explanation.txt │ │ ├── Ultra Fast Mathematician.txt │ │ └── Vasya and String Explanation.txt │ ├── Explanations 15/ │ │ ├── Army Explanation.txt │ │ ├── Between the Offices Explanation.txt │ │ ├── Cableway Explanation.txt │ │ ├── Ciferia Explanation.txt │ │ ├── Coins Explanation.txt │ │ ├── Divisibility by Eight Explanation.txt │ │ ├── Exams Explanation.txt │ │ ├── Given Length and Sum of Digits.txt │ │ ├── Ilya and Sticks Explanation.txt │ │ ├── Inna and Huge Candy Matrix Explanation.txt │ │ ├── K-Multiple Free Set Explanation.txt │ │ ├── Kefa and Park Explanation.txt │ │ ├── Mahmoud and Ehab and the MEX Explanation.txt │ │ ├── Mahmoud and Ehab and the bipartiteness Explanation.txt │ │ ├── Mahmoud and Ehab and the xor Explanation.txt │ │ ├── Number of Ways Explanation.txt │ │ ├── Pearls in a Row Explanation.txt │ │ ├── Pie Rules Explanation.txt │ │ ├── Quasi-palindrome Explanation.txt │ │ ├── Soldier and Number Game Explanation.txt │ │ ├── Tanya and Toys Explanation.txt │ │ ├── Team Explanation.txt │ │ ├── The Eternal Immortality Explanation.txt │ │ ├── Triangle Explanation.txt │ │ └── USB Flash Drives Explanation.txt │ ├── Explanations 16/ │ │ ├── Amusing Joke Explanation.txt │ │ ├── Anton and Letters Explanation.txt │ │ ├── Cards with Numbers Explanation.txt │ │ ├── Classroom Watch Explanation.txt │ │ ├── Cupboards Explanation.txt │ │ ├── Dishonest Sellers Explanation.txt │ │ ├── Dubstep Explanation.txt │ │ ├── Easy Number Challenge Explanation.txt │ │ ├── Fox and Snake Explanation.txt │ │ ├── Greg and Array Explanation.txt │ │ ├── Hacking Cypher Explanation.txt │ │ ├── I Wanna Be The Guy Explanation.txt │ │ ├── IQ Test Explanation.txt │ │ ├── Jeff and Periods Explanation.txt │ │ ├── Pashmak and Garden Explanation.txt │ │ ├── Primes or Palindromes Explanation.txt │ │ ├── Quasi Binary Explanation.txt │ │ ├── Sereja and Bottles Explanation.txt │ │ ├── Team Olympiad Explanation.txt │ │ ├── The Fibonacci Segment Explanation.txt │ │ ├── Twins Explanation.txt │ │ ├── Valera and Tubes Explanation.txt │ │ ├── Xenia and Bit Operations.txt │ │ ├── Xenia and Ringroad Explanation.txt │ │ └── k-String Explanation.txt │ ├── Explanations 17/ │ │ ├── Adding Digits Explanation.txt │ │ ├── Christmas Spruce Explanation.txt │ │ ├── Dreamoon and Wi-Fi Explanation.txt │ │ ├── Exams Explanation.txt │ │ ├── Garden Explanation.txt │ │ ├── Jamie and Alarm Snooze Explanation.txt │ │ ├── Jamie and Interesting Graph Explanation.txt │ │ ├── Kolya and Tanya Explanation.txt │ │ ├── Mashmokh and ACM Explanation.txt │ │ ├── Maxmium Splitting Explanation.txt │ │ ├── Minimum Sum Explanation.txt │ │ ├── Modular Exponentiation Explanation.txt │ │ ├── New Year and Domino Explanation.txt │ │ ├── New Year's Eve Explanation.txt │ │ ├── Palindrome Pairs Explanation.txt │ │ ├── Perfect Number Explanation.txt │ │ ├── QAQ Explanation.txt │ │ ├── Seat Arrangements Explanation.txt │ │ ├── Supermarket Explanation.txt │ │ ├── Swap Adjacent Elements Explanation.txt │ │ ├── Tea Queue Explanation.txt │ │ ├── Testing Pants for Sadness Explanation.txt │ │ ├── The World is a Theatre Explanation.txt │ │ ├── Tricky Alchemy Explanation.txt │ │ └── Water the Gardens Explanation.txt │ ├── Explanations 18/ │ │ ├── Art Union Explanation.txt │ │ ├── Bear and Colours Explanation.txt │ │ ├── Cave Painting Explanation.txt │ │ ├── Cloning Toys Explanation.txt │ │ ├── Eternal Victory Explanation.txt │ │ ├── Hard Problem Explanation.txt │ │ ├── Joystick Explanation.txt │ │ ├── K-Special Tables Explanation.txt │ │ ├── Lucky Sum Explanation.txt │ │ ├── Magic Forest Explanation.txt │ │ ├── Marvolo Gaunt's Ring Alternate Solution Explanation.txt │ │ ├── Marvolo Gaunt's Ring Explanation.txt │ │ ├── Not Equal on a Segment Explanation.txt │ │ ├── Perfect Squares Explanation.txt │ │ ├── Petya and Inequiations Explanation.txt │ │ ├── Polo the Penguin and Matrix Explanation.txt │ │ ├── Polo the Penguin and Strings Explanation.txt │ │ ├── Replacement Explanation.txt │ │ ├── Robot Vaccuum Cleaner Explanation.txt │ │ ├── Rumour Explanation.txt │ │ ├── Search for Pretty Integers Explanation.txt │ │ ├── Tom Riddle's Diary Explanation.txt │ │ ├── Two Substrings Explanation.txt │ │ ├── Vladik and Fractions Explanation.txt │ │ └── Woodcutter.txt │ ├── Explanations 19/ │ │ ├── A Compatipble Pair Explanation.txt │ │ ├── A Prosperous Lot Explanation.txt │ │ ├── Almost Identity Permutations Explanation.txt │ │ ├── Amr and Large Array Explanation.txt │ │ ├── Beautiful Sets of Points Explanation.txt │ │ ├── Buggy Robot Explanation.txt │ │ ├── Cellular Network Explanation.txt │ │ ├── Coder Explanation.txt │ │ ├── Diversity Explanation.txt │ │ ├── Hamster Farm Explanation.txt │ │ ├── K-Dominant Character Explanation.txt │ │ ├── Little Artem and Grasshopper Explanation.txt │ │ ├── Longest K Good Segment Explanation.txt │ │ ├── Love Triangle Explanation.txt │ │ ├── Nuts Explanation.txt │ │ ├── Palindrome Transformation Explanation.txt │ │ ├── Palindromic Supersequence Explanation.txt │ │ ├── Recursive Queries Explanation.txt │ │ ├── Run For Your Prize Explanation.txt │ │ ├── Simple Strings Explanation.txt │ │ ├── The Useless Toy Explanation.txt │ │ ├── Vasya and Socks Explanation.txt │ │ ├── Watchmen Explanation.txt │ │ └── Word Correction Explanation.txt │ ├── Explanations 20/ │ │ ├── Alena and the Heater Explanation.txt │ │ ├── Fafa and Ancient Alphabet Explanation.txt │ │ ├── Fafa and His Company Explanation.txt │ │ ├── Fafa and the Gates Explanation.txt │ │ ├── Fixing Typos Explanation.txt │ │ ├── Gargari and Bishops Explanation.txt │ │ ├── Gargari and Permutations Alternate Solution Explanation.txt │ │ ├── Gargari and Permutations Explanation.txt │ │ ├── Hard Process Explanation.txt │ │ ├── Lisa and Dima Explanation.txt │ │ ├── Love Rescue Explanation.txt │ │ ├── Mashmok and Numbers Explanation.txt │ │ ├── Non-Secret Cypher Explanation.txt │ │ ├── Olympiad Explanation.txt │ │ ├── Partition Explanation.txt │ │ ├── Petya and His Friends Alternate Solution Explanation.txt │ │ ├── Petya and His Friends Explanation.txt │ │ ├── Phone Numbers Explanation.txt │ │ ├── Pocket Book Explanation.txt │ │ ├── Points on the Line Explanation.txt │ │ ├── Protect Sheep Explanation.txt │ │ ├── String Transformation Explanation.txt │ │ ├── Sum and Replace Explanation.txt │ │ ├── Vile Grasshoppers Explanation.txt │ │ └── Weird Subtraction Process Explanation.txt │ ├── Explanations 21/ │ │ ├── Aramic Script Bitmask Solution.txt │ │ ├── Aramic Script Explanation.txt │ │ ├── Arithmetic Progression Explanation.txt │ │ ├── Bash and a Tough Math Puzzle Explanation.txt │ │ ├── Consecutive Subsequences Explanation.txt │ │ ├── Cyclic Components Explanation.txt │ │ ├── Divide by Three Multiply by Two Alternate Solution Explanation.txt │ │ ├── Divide by Three, Multiply by Two Explanation.txt │ │ ├── Dreamoon and Sets Explanation.txt │ │ ├── File Name Explanation.txt │ │ ├── Fox and Box Accumulation Explanation.txt │ │ ├── Ghosts Explanation.txt │ │ ├── Less or Equal Explanation.txt │ │ ├── Little Girl and Maximum XOR Explanation.txt │ │ ├── Lucky Sum of Digits Explanation.txt │ │ ├── Mahmoud and Ehab and Another Array Construction Test Explanation.txt │ │ ├── Mahmoud and Ehab and Even Odd Game Explanation.txt │ │ ├── Mahmoud and a Triangle Explanation.txt │ │ ├── Make a Square Alternate Solution Explanation.txt │ │ ├── Make a Square Explanation.txt │ │ ├── Mancala Explanation.txt │ │ ├── Pairs of Lines Explanation.txt │ │ ├── Two Gram Explanation.txt │ │ ├── Valhalla Siege Explanation.txt │ │ └── Wrong Subtraction Explanation.txt │ ├── Explanations 22/ │ │ ├── AND Graph Explanation.txt │ │ ├── Almost Arithmetic Progression Explanation.txt │ │ ├── Antipalindrome Alternate Solution Explanation.txt │ │ ├── Antipalindrome Explanation.txt │ │ ├── Ball Explanation.txt │ │ ├── Bits Explanation.txt │ │ ├── Bookshelves Explanation.txt │ │ ├── Businessman Problems Explanation.txt │ │ ├── Chess Placing Explanation.txt │ │ ├── Correct Solution Explanation.txt │ │ ├── Couting Kangaroos is Fun Explanation.txt │ │ ├── Fruits Explanation.txt │ │ ├── High Schooll Become Human Explanation.txt │ │ ├── Infinity Gauntlet Explanation.txt │ │ ├── Knights of a Polygonal Table Explanation.txt │ │ ├── Letters Explanation.txt │ │ ├── Local Extrema Explanation.txt │ │ ├── Remove Duplicates Explanation.txt │ │ ├── Super Agent Explanation.txt │ │ ├── Switches and Lamps Explanation.txt │ │ ├── Three Displays Explanation.txt │ │ ├── Three Displays Segment Tree Solution Explanation.txt │ │ ├── Tufurama Explanation.txt │ │ └── Useful Decomposition Explanation.txt │ ├── Explanations 23/ │ │ ├── An Impassioned Circulation of Affection Explanation.txt │ │ ├── Another Problem on Strings Explanation.txt │ │ ├── Babaei and Birthday Cake Explanation.txt │ │ ├── Bear and Prime Numbers Explanation.txt │ │ ├── Cirriculum Vitae Explanation.txt │ │ ├── Classy Numbers Explanation.txt │ │ ├── Counting Arrays Explanation.txt │ │ ├── Crazy Town Explanation.txt │ │ ├── Find Maximum Explanation.txt │ │ ├── Fish Explanation.txt │ │ ├── Garbage Disposal Explanation.txt │ │ ├── Guest from the Past Explanation.txt │ │ ├── Ice Skater Explanation.txt │ │ ├── Lazyland Explanation.txt │ │ ├── Lesha and Array Splitting Explanation.txt │ │ ├── Lost Array Explanation.txt │ │ ├── Maze Explanation.txt │ │ ├── Minesweeper Explanation.txt │ │ ├── Minimum Diameter Tree Explanation.txt │ │ ├── No To Palindromes Explanation.txt │ │ ├── On Number of Decompositions into Multipliers Explanation.txt │ │ ├── Summarise to Powers of Two Explanation.txt │ │ ├── The Fair Nut and String Explanation.txt │ │ └── The Meaningless Game Explanation.txt │ └── Explanations 24/ │ ├── Brutality Explanation.txt │ ├── Connect Explanation.txt │ ├── Div Times Mod Explanation.txt │ ├── Diverse Garland Explanation.txt │ ├── Division and Union Explanation.txt │ ├── Finite or Not Explanation.txt │ ├── Ilya and Escalator Explanation.txt │ ├── Increasing by Modulo Explanation.txt │ ├── Nice Garland Explanation.txt │ ├── Planning the Expedition Explanation.txt │ ├── Playing Piano Explanation.txt │ ├── Posterized Explanation.txt │ ├── Powers of Two Explanation.txt │ ├── Splitting into Digits Explanation.txt │ ├── Stages Explanation.txt │ ├── Tanya and Candies Explanation.txt │ ├── The Way to Home Explanation.txt │ ├── Vanya and Label Explanation.txt │ ├── Where Do I Turn Explanation.txt │ └── Zero Quantity Maximisation Explanation.txt └── README.md
Showing preview only (218K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (2626 symbols across 1314 files)
FILE: 2020/Combined Divisions/621 Div 1 + 2/Programs/Cow and Fields.cpp
function bfs (line 11) | void bfs(int source, vector <int> &distance)
function main (line 39) | int main()
FILE: 2020/Combined Divisions/621 Div 1 + 2/Programs/Cow and Haybales.cpp
function solve (line 6) | void solve()
function main (line 30) | int main()
FILE: 2020/Combined Divisions/621 Div 1 + 2/Programs/Cow and Message.cpp
function main (line 7) | int main()
FILE: 2020/Combined Divisions/621 Div 1 + 2/Programs/Cows and Treats.cpp
function main (line 8) | int main()
FILE: 2020/Combined Divisions/CodeForces Global Round 7/Programs/Bad Ugly Numbers.cpp
function solve (line 5) | void solve()
function main (line 25) | int main()
FILE: 2020/Combined Divisions/CodeForces Global Round 7/Programs/Maximums.cpp
function main (line 6) | int main()
FILE: 2020/Combined Divisions/CodeForces Global Round 7/Programs/Permutation Partitions.cpp
function get_sum (line 8) | long long get_sum(long long n)
function main (line 13) | int main()
FILE: 2020/Combined Divisions/CodeForces Global Round 7/Programs/Prefix Suffix Palindrome (Easy Version).cpp
function get_prefix_suffix (line 10) | pair <int, int> get_prefix_suffix(string S)
function solve (line 52) | void solve()
function main (line 113) | int main()
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and Impossible Calculation.cpp
function main (line 8) | int main()
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and Punishment.cpp
function factorise (line 9) | void factorise(set <long long> &F, long long n)
function main (line 36) | int main()
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and Simple Strings.cpp
function main (line 9) | int main()
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and the Celebration.cpp
function erase_till (line 10) | void erase_till(int v, int child, int destination)
function main (line 42) | int main()
FILE: 2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and the Gifts.cpp
function solve (line 8) | void solve()
function main (line 44) | int main()
FILE: 2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Programs/As Simple as One and Two.cpp
function solve (line 6) | void solve()
function main (line 47) | int main()
FILE: 2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Programs/Happy Birthday Polycarp.cpp
function no_of_digits (line 5) | int no_of_digits(int n)
function solve (line 18) | void solve()
function main (line 45) | int main()
FILE: 2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Programs/Make Them Odd.cpp
function solve (line 7) | void solve()
function main (line 45) | int main()
FILE: 2020/Div 2/609 Div 2/Programs/Domino for Young.cpp
function main (line 5) | int main()
FILE: 2020/Div 2/609 Div 2/Programs/Equation.cpp
function main (line 5) | int main()
FILE: 2020/Div 2/609 Div 2/Programs/Long Beautiful Integer.cpp
function main (line 6) | int main()
FILE: 2020/Div 2/609 Div 2/Programs/Modulo Equality.cpp
function add_and_check_equality (line 8) | int add_and_check_equality(vector <int> A, vector <int> B, int m, int x)
function main (line 28) | int main()
FILE: 2020/Div 2/612 Div 2/Programs/Angry Students.cpp
function solve (line 6) | void solve()
function main (line 36) | int main()
FILE: 2020/Div 2/612 Div 2/Programs/Hyperset.cpp
function get_third (line 7) | char get_third(char a, char b)
function choose_3 (line 19) | long long choose_3(long long n)
function main (line 27) | int main()
FILE: 2020/Div 2/612 Div 2/Programs/Madhouse (Easy Version).cpp
function sort_by_frequency (line 10) | int sort_by_frequency(vector <int> &A, vector <int> &B)
function main (line 24) | int main()
FILE: 2020/Div 2/613 Div 2/Programs/Dr Evil Underscores.cpp
function is_bit_set (line 6) | int is_bit_set(long long n, int bit)
function solve (line 11) | long long solve(int bit, vector <long long> &A)
function main (line 44) | int main()
FILE: 2020/Div 2/613 Div 2/Programs/Fadi and LCM.cpp
function is_bit_set (line 6) | int is_bit_set(long long n, int bit)
function factorise (line 11) | void factorise(long long x, vector <long long> &P)
function main (line 36) | int main()
FILE: 2020/Div 2/613 Div 2/Programs/Just Eat It.cpp
function solve (line 6) | void solve()
function main (line 46) | int main()
FILE: 2020/Div 2/613 Div 2/Programs/Mezo Playing Zoma.cpp
function main (line 5) | int main()
FILE: 2020/Div 2/616 Div 2/Programs/Array Sharpening.cpp
function solve (line 6) | void solve()
function main (line 71) | int main()
FILE: 2020/Div 2/616 Div 2/Programs/Even But Not Even.cpp
function solve (line 5) | void solve()
function main (line 37) | int main()
FILE: 2020/Div 2/616 Div 2/Programs/Mind Control.cpp
function solve (line 6) | void solve()
function main (line 40) | int main()
FILE: 2020/Div 2/618 Div 2/Programs/Anu has a Function.cpp
function is_bit_set (line 6) | int is_bit_set(long long n, int bit)
function main (line 11) | int main()
FILE: 2020/Div 2/619 Div 2/Programs/Ayoub's Function.cpp
function count_substrings (line 8) | long long count_substrings(long long n)
function solve (line 13) | void solve()
function main (line 40) | int main()
FILE: 2020/Div 2/619 Div 2/Programs/Motarack's Birthday.cpp
function solve (line 8) | void solve()
function main (line 67) | int main()
FILE: 2020/Div 2/619 Div 2/Programs/Three Strings.cpp
function solve (line 6) | void solve()
function main (line 26) | int main()
FILE: 2020/Div 2/619 Div 2/Programs/Time to Run.cpp
function range (line 6) | int range(int max_1, int distance, int size, int &steps)
function main (line 24) | int main()
FILE: 2020/Div 2/620 Div 2/Programs/1-Trees and Queries.cpp
function is_bit_set (line 10) | int is_bit_set(long long n, int bit)
function dfs (line 15) | void dfs(int v, int parent_v)
function precompute_parents (line 34) | void precompute_parents(int no_of_vertices)
function LCA (line 47) | int LCA(int u, int v)
function distance (line 81) | int distance(int u, int v)
function main (line 98) | int main()
FILE: 2020/Div 2/620 Div 2/Programs/Air Conditioner.cpp
type customer (line 8) | struct customer
method customer (line 12) | customer(){}
method customer (line 14) | customer(int T, int L, int R)
function sort_by_time (line 20) | int sort_by_time(customer &A, customer &B)
function solve (line 30) | void solve()
function main (line 72) | int main()
FILE: 2020/Div 2/620 Div 2/Programs/Longest Palindrome.cpp
function is_palindrome (line 10) | int is_palindrome(string S)
function main (line 23) | int main()
FILE: 2020/Div 2/620 Div 2/Programs/Shortest and Longest LIS.cpp
function solve (line 6) | void solve()
function main (line 74) | int main()
FILE: 2020/Div 2/620 Div 2/Programs/Two Rabbits.cpp
function solve (line 5) | void solve()
function main (line 14) | int main()
FILE: 2020/Div 2/622 Div 2/Programs/Fast Food Restaurants.cpp
function is_bit_set (line 8) | int is_bit_set(int n, int bit)
function solve (line 13) | void solve()
function main (line 58) | int main()
FILE: 2020/Div 2/622 Div 2/Programs/Skyscrapers (Easy Version).cpp
function count (line 6) | long long count(int P, vector <int> &limit, vector <int> &A)
function main (line 29) | int main()
FILE: 2020/Div 2/622 Div 2/Programs/Skyscrapers (Hard Version).cpp
function main (line 7) | int main()
FILE: 2020/Div 2/623 Div 2/Programs/Dead Pixel.cpp
function solve (line 5) | void solve()
function main (line 36) | int main()
FILE: 2020/Div 2/623 Div 2/Programs/Homecoming.cpp
function solve (line 5) | void solve()
function main (line 34) | int main()
FILE: 2020/Div 2/623 Div 2/Programs/Recommendations.cpp
function main (line 10) | int main()
FILE: 2020/Div 2/623 Div 2/Programs/Restoring Permutations.cpp
function solve (line 8) | void solve()
function main (line 64) | int main()
FILE: 2020/Div 2/625 Div 2/Programs/Contest for Robotos.cpp
function main (line 6) | int main()
FILE: 2020/Div 2/625 Div 2/Programs/Journey Planning.cpp
function main (line 7) | int main()
FILE: 2020/Div 2/625 Div 2/Programs/Navigation System.cpp
function bfs (line 12) | void bfs(int source)
function main (line 38) | int main()
FILE: 2020/Div 2/625 Div 2/Programs/Remove Adjacent.cpp
function main (line 6) | int main()
FILE: 2020/Div 2/626 Div 2/Programs/Counting Subrectangles.cpp
function main (line 9) | int main()
FILE: 2020/Div 2/626 Div 2/Programs/Even Subset Sum Problem.cpp
function solve (line 6) | void solve()
function main (line 47) | int main()
FILE: 2020/Div 2/626 Div 2/Programs/Unusual Competitions.cpp
function main (line 6) | int main()
FILE: 2020/Div 2/628 Div 2/Programs/Copy Copy Copy Copy Copy.cpp
function solve (line 7) | void solve()
function main (line 27) | int main()
FILE: 2020/Div 2/628 Div 2/Programs/Ehab and GCD.cpp
function solve (line 5) | void solve()
function main (line 13) | int main()
FILE: 2020/Div 2/628 Div 2/Programs/Ehab and Pathetic MEX.cpp
function remove (line 13) | void remove(int u, int v)
function main (line 29) | int main()
FILE: 2020/Div 2/628 Div 2/Programs/Ehab and XORcist.cpp
function some_non_zero (line 6) | int some_non_zero(vector <int> &A)
function is_bit_set (line 19) | int is_bit_set(long long n, int bit)
function main (line 24) | int main()
FILE: 2020/Div 2/630 Div 2/Programs/Composite Coloring.cpp
function precompute (line 8) | void precompute(vector <int> &lowest_prime_factor, int N)
function solve (line 27) | void solve(vector <int> &lowest_prime_factor)
function main (line 75) | int main()
FILE: 2020/Div 2/630 Div 2/Programs/Exercising Walk.cpp
function solve (line 5) | void solve()
function main (line 54) | int main()
FILE: 2020/Div 2/630 Div 2/Programs/Height All the Same.cpp
function power_mod (line 5) | long long power_mod(long long x, long long power, long long MOD)
function inverse (line 21) | long long inverse(long long x, long long MOD)
function main (line 26) | int main()
FILE: 2020/Div 2/630 Div 2/Programs/K Complete Word.cpp
function solve (line 6) | void solve()
function main (line 53) | int main()
FILE: 2020/Div 2/630 Div 2/Programs/Walk on Matrix.cpp
function is_bit_set (line 8) | int is_bit_set(int n, int bit)
function all_ones (line 13) | int all_ones(int n)
function get_msb (line 18) | int get_msb(int n)
function complete (line 31) | int complete(int n)
function main (line 44) | int main()
FILE: 2020/Div 2/631 Div 2/Programs/Dreamoon Likes Coloring.cpp
function main (line 6) | int main()
FILE: 2020/Div 2/631 Div 2/Programs/Dreamoon Likes Permutations.cpp
function solve (line 6) | void solve()
function main (line 66) | int main()
FILE: 2020/Div 2/631 Div 2/Programs/Dreamoon Likes Sequences.cpp
function is_bit_set (line 6) | int is_bit_set(long long n, int bit)
function solve (line 11) | void solve()
function main (line 78) | int main()
FILE: 2020/Div 2/631 Div 2/Programs/Dreamoon and Ranking Collection.cpp
function solve (line 6) | void solve()
function main (line 42) | int main()
FILE: 2020/Div 2/632 Div 2/Programs/Eugene and Array.cpp
function main (line 10) | int main()
FILE: 2020/Div 2/632 Div 2/Programs/Kate and Imperfection.cpp
function main (line 7) | int main()
FILE: 2020/Div 2/632 Div 2/Programs/Kind Anton.cpp
function solve (line 6) | void solve()
function main (line 55) | int main()
FILE: 2020/Div 2/632 Div 2/Programs/Little Artem.cpp
function solve (line 8) | void solve()
function main (line 43) | int main()
FILE: 2020/Div 2/633 Div 2/Programs/Filling Diamonds.cpp
function solve (line 6) | void solve()
function main (line 14) | int main()
FILE: 2020/Div 2/633 Div 2/Programs/Powered Addition.cpp
function is_bit_set (line 6) | int is_bit_set(long long n, int bit)
function msb (line 11) | int msb(long long n)
function solve (line 25) | void solve()
function main (line 55) | int main()
FILE: 2020/Div 2/633 Div 2/Programs/Sorted Adjacent Differences.cpp
function solve (line 7) | void solve()
function main (line 41) | int main()
FILE: 2020/Div 2/635 Div 2/Programs/Ichihime and Triangle.cpp
function solve (line 5) | void solve()
function main (line 13) | int main()
FILE: 2020/Div 2/635 Div 2/Programs/Kana and Dragon Quest game.cpp
function solve (line 5) | void solve()
function main (line 21) | int main()
FILE: 2020/Div 2/635 Div 2/Programs/Linova and Kingdom.cpp
function dfs (line 13) | void dfs(int v, int parent_v)
function main (line 37) | int main()
FILE: 2020/Div 2/635 Div 2/Programs/Xenia and Colourful Gems.cpp
function square (line 9) | long long square(long long n)
function find_best (line 14) | void find_best(vector <long long> &X, vector <long long> &Y, vector <lon...
function solve (line 36) | void solve()
function main (line 72) | int main()
FILE: 2020/Div 2/637 Div 2/Programs/Nastya and Door.cpp
function solve (line 6) | void solve()
function main (line 49) | int main()
FILE: 2020/Div 2/637 Div 2/Programs/Nastya and Rice.cpp
function solve (line 5) | void solve()
function main (line 19) | int main()
FILE: 2020/Div 2/637 Div 2/Programs/Nastya and Scoreboard.cpp
function hardcode (line 12) | void hardcode()
function steps_to_convert (line 26) | int steps_to_convert(string ¤t, int number)
function main (line 49) | int main()
FILE: 2020/Div 2/637 Div 2/Programs/Nastya and Strange Generator.cpp
function solve (line 8) | void solve()
function main (line 37) | int main()
FILE: 2020/Div 2/638 Div 2/Programs/Pheonix and Balance.cpp
function solve (line 5) | void solve()
function main (line 25) | int main()
FILE: 2020/Div 2/638 Div 2/Programs/Phoenix and Balance.cpp
function solve (line 5) | void solve()
function main (line 25) | int main()
FILE: 2020/Div 2/639 Div 2/Explanations/Resume Review.cpp
function no_of_steps (line 9) | long long no_of_steps(long long x)
function main (line 41) | int main()
FILE: 2020/Div 2/639 Div 2/Programs/Card Construction.cpp
function precompute (line 11) | void precompute()
function solve (line 25) | void solve()
function main (line 54) | int main()
FILE: 2020/Div 2/639 Div 2/Programs/Hilbert Hotel.cpp
function solve (line 7) | void solve()
function main (line 45) | int main()
FILE: 2020/Div 2/639 Div 2/Programs/Monopole Magnets.cpp
function inside_grid (line 16) | int inside_grid(int x, int y)
function dfs (line 21) | void dfs(int x, int y)
function main (line 37) | int main()
FILE: 2020/Div 2/639 Div 2/Programs/Puzzle Pieces.cpp
function solve (line 5) | void solve()
function main (line 19) | int main()
FILE: 2020/Div 2/639 Div 2/Programs/Quantifier Question.cpp
function dfs_cycle_reverse (line 12) | int dfs_cycle_reverse(int v)
function dfs_cycle (line 37) | int dfs_cycle(int v)
function main (line 62) | int main()
FILE: 2020/Div 2/639 Div 2/Programs/Resume Review.cpp
function no_of_steps (line 9) | long long no_of_steps(long long x)
function main (line 41) | int main()
FILE: 2020/Div 2/641 Div 2/Programs/Orac and Factors.cpp
function precompute (line 9) | void precompute()
function solve (line 23) | void solve()
function main (line 36) | int main()
FILE: 2020/Div 2/641 Div 2/Programs/Orac and LCM.cpp
function precompute (line 1) | void precompute()
function main (line 24) | int main()
FILE: 2020/Div 2/641 Div 2/Programs/Orac and Models.cpp
function solve (line 6) | void solve()
function main (line 39) | int main()
FILE: 2020/Div 2/643 Div 2/Programs/Counting Triangles.cpp
function main (line 6) | int main()
FILE: 2020/Div 2/643 Div 2/Programs/Game with Array.cpp
function main (line 5) | int main()
FILE: 2020/Div 2/643 Div 2/Programs/Restorer Distance.cpp
function calculate (line 13) | long long calculate(long long h)
function main (line 41) | int main()
FILE: 2020/Div 2/643 Div 2/Programs/Sequence with Digits.cpp
function max_min_digit (line 5) | pair <int, int> max_min_digit(long long n)
function solve (line 22) | void solve()
function main (line 35) | int main()
FILE: 2020/Div 2/643 Div 2/Programs/Young Explorer.cpp
function solve (line 7) | void solve()
function main (line 34) | int main()
FILE: 2020/Div 2/647 Div 2/Programs/Johnny and Ancient Computers.cpp
function ceil (line 5) | long long ceil(long long n, long long d)
function solve (line 10) | void solve()
function main (line 33) | int main()
FILE: 2020/Div 2/647 Div 2/Programs/Johnny and Another Rating Drop.cpp
function is_bit_set (line 6) | int is_bit_set(long long n, int bit)
function ceil (line 11) | long long ceil(long long n, long long d)
function solve (line 16) | void solve()
function main (line 46) | int main()
FILE: 2020/Div 2/647 Div 2/Programs/Johnny and Contribution.cpp
function update_mex (line 15) | void update_mex(int v)
function main (line 28) | int main()
FILE: 2020/Div 2/647 Div 2/Programs/Johnny and His Hobbies.cpp
function possible (line 7) | int possible(int k, set <int> &S)
function solve (line 22) | void solve()
function main (line 56) | int main()
FILE: 2020/Div 2/648 Div 2/Programs/Matrix Game.cpp
function solve (line 6) | void solve()
function main (line 43) | int main()
FILE: 2020/Div 2/648 Div 2/Programs/Maximum Subsequence Value.cpp
function is_bit_set (line 7) | int is_bit_set(long long n, int bit)
function main (line 12) | int main()
FILE: 2020/Div 2/648 Div 2/Programs/Rotation Matching.cpp
function calculate_left_shifts (line 6) | int calculate_left_shifts(int source, int target, int no_of_elements)
function calculate_right_shifts (line 16) | int calculate_right_shifts(int source, int target, int no_of_elements)
function get_matches (line 26) | int get_matches(vector <int> &A, vector <int> &B)
function main (line 67) | int main()
FILE: 2020/Div 2/648 Div 2/Programs/Secure Password.cpp
function no_of_bits (line 6) | int no_of_bits(int mask)
function is_bit_set (line 19) | int is_bit_set(long long n, int bit)
function main (line 24) | int main()
FILE: 2020/Div 2/648 Div 2/Programs/Swaps Again.cpp
function solve (line 7) | void solve()
function main (line 69) | int main()
FILE: 2020/Div 2/648 Div 2/Programs/Trouble Sort.cpp
function solve (line 6) | void solve()
function main (line 38) | int main()
FILE: 2020/Div 2/651 Div 2/Programs/Binary Subsequence Rotation.cpp
function no_of_1s (line 6) | int no_of_1s(string S)
function main (line 18) | int main()
FILE: 2020/Div 2/651 Div 2/Programs/GCD Compression.cpp
function solve (line 6) | void solve()
function main (line 67) | int main()
FILE: 2020/Div 2/651 Div 2/Programs/Maximum GCD.cpp
function solve (line 5) | void solve()
function main (line 13) | int main()
FILE: 2020/Div 2/651 Div 2/Programs/Number Game.cpp
function is_power_of_2 (line 5) | int is_power_of_2(int n)
function get_prime_divisor_count (line 10) | int get_prime_divisor_count(int n)
function solve (line 32) | void solve()
function main (line 62) | int main()
FILE: 2020/Div 2/651 Div 2/Programs/Odd-Even Subsequence.cpp
function possible (line 6) | int possible(vector <int> &A, int x, int parity, int total_subsequence_l...
function main (line 28) | int main()
FILE: 2020/Div 2/658 Div 2/Programs/Common Subsequence.cpp
function solve (line 8) | void solve()
function main (line 44) | int main()
FILE: 2020/Div 2/658 Div 2/Programs/Sequential Nim.cpp
function solve (line 6) | void solve()
function main (line 33) | int main()
FILE: 2020/Div 2/658 Div 2/Programs/Unmerge.cpp
function solve (line 6) | void solve()
function main (line 66) | int main()
FILE: 2020/Div 2/659 Div 2/Programs/Common Prefixes.cpp
function solve (line 6) | void solve()
function main (line 51) | int main()
FILE: 2020/Div 2/659 Div 2/Programs/Prefix Flip (Easy Version).cpp
function solve (line 6) | void solve()
function main (line 34) | int main()
FILE: 2020/Div 2/659 Div 2/Programs/Prefix Flip (Hard Version).cpp
function solve (line 6) | void solve()
function main (line 44) | int main()
FILE: 2020/Div 2/659 Div 2/Programs/String Transformation 1.cpp
function solve (line 7) | void solve()
function main (line 59) | int main()
FILE: 2020/Div 2/660 Div 2/Programs/Captain Flint and Crew Recruitment.cpp
function solve (line 5) | void solve()
function main (line 29) | int main()
FILE: 2020/Div 2/660 Div 2/Programs/Captain Flint and a Long Voyage.cpp
function solve (line 5) | void solve()
function main (line 27) | int main()
FILE: 2020/Div 2/662 Div 2/Programs/Rainbow Dash, Fluttershy and Chess Coloring.cpp
function solve (line 5) | void solve()
function main (line 15) | int main()
FILE: 2020/Div 2/678 Div 2/Programs/Bandit in a City.cpp
function ceil (line 11) | long long ceil(long long n, long long d)
function dfs (line 16) | void dfs(int v)
function main (line 43) | int main()
FILE: 2020/Div 2/678 Div 2/Programs/Binary Search.cpp
function power_mod (line 7) | long long power_mod(long long x, long long power)
function inverse (line 29) | long long inverse(long long n)
function factorial (line 34) | long long factorial(long long n)
function choose (line 45) | long long choose(long long n, long long r)
function main (line 57) | int main()
FILE: 2020/Div 2/678 Div 2/Programs/Complicated Computations.cpp
function update (line 13) | void update(int n, int left, int right, int position, int value)
function get_first_smaller (line 33) | int get_first_smaller(int n, int left, int right, int x)
function main (line 56) | int main()
FILE: 2020/Div 2/678 Div 2/Programs/Prime Square.cpp
function solve (line 6) | void solve()
function main (line 33) | int main()
FILE: 2020/Div 2/678 Div 2/Programs/Reorder.cpp
function solve (line 6) | void solve()
function main (line 23) | int main()
FILE: 2020/Div 2/678 Div 2/Programs/Sum Over Subsets.cpp
function square (line 12) | long long square(long long n)
function power_mod (line 17) | long long power_mod(long long x, long long power)
function precompute (line 33) | void precompute()
function count_with_gcd (line 60) | long long count_with_gcd(int x)
function main (line 107) | int main()
FILE: 2020/Div 2/684 Div 2/Programs/Binary Table.cpp
function flip (line 7) | int flip(int x)
function perform (line 12) | void perform(vector <vector <int> > &M, vector <pair <int, int> > &op, i...
function perform (line 19) | void perform(vector <vector <int> > &M, vector <pair <int, int> > &op, p...
function flip_corner_L (line 26) | void flip_corner_L(vector <vector <int> > &M, vector <pair <int, int> > ...
function flip_down_corner_L (line 37) | void flip_down_corner_L(vector <vector <int> > &M, vector <pair <int, in...
function flip_down_L (line 48) | void flip_down_L(vector <vector <int> > &M, vector <pair <int, int> > &o...
function flip_down_back_L (line 59) | void flip_down_back_L(vector <vector <int> > &M, vector <pair <int, int>...
function flip_up_L (line 70) | void flip_up_L(vector <vector <int> > &M, vector <pair <int, int> > &op,...
function flip_down_up_L (line 81) | void flip_down_up_L(vector <vector <int> > &M, vector <pair <int, int> >...
function solve_3 (line 98) | void solve_3(vector <vector <int> > &M, vector <pair <int, int> > &op, v...
function solve_2 (line 109) | void solve_2(vector <vector <int> > &M, vector <pair <int, int> > &op, v...
function solve_1 (line 131) | void solve_1(vector <vector <int> > &M, vector <pair <int, int> > &op, v...
function solve_4 (line 152) | void solve_4(vector <vector <int> > &M, vector <pair <int, int> > &op, v...
function get (line 160) | void get(vector <vector <int> > &M, vector <pair <int, int> > &op, vecto...
function solve (line 177) | void solve()
function main (line 268) | int main()
FILE: 2020/Div 2/684 Div 2/Programs/Buy the String.cpp
function solve (line 5) | void solve()
function main (line 41) | int main()
FILE: 2020/Div 2/684 Div 2/Programs/Graph Subset Problem.cpp
function solve (line 8) | void solve()
function main (line 117) | int main()
FILE: 2020/Div 2/684 Div 2/Programs/Greedy Shopping.cpp
type node (line 8) | struct node
method node (line 12) | node()
method node (line 17) | node(long long S, long long Min, long long Max)
function node (line 24) | node merge(node &L, node &R)
method node (line 12) | node()
method node (line 17) | node(long long S, long long Min, long long Max)
function propagate (line 32) | void propagate(int n, int left, int right)
function update (line 52) | void update(int n, int left, int right, int query_left, int query_right,...
function find_first (line 76) | int find_first(int n, int left, int right, int x)
function go_right (line 100) | void go_right(int n, int left, int right, int query_left, int query_righ...
function main (line 129) | int main()
FILE: 2020/Div 2/684 Div 2/Programs/Sum of Medians.cpp
function solve (line 9) | void solve()
function main (line 39) | int main()
FILE: 2020/Div 2/685 Div 2/Programs/Bitwise Queries (Hard Version).cpp
function ask (line 7) | void ask(int i, int j, string operation, int &result)
function main (line 15) | int main()
FILE: 2020/Div 2/685 Div 2/Programs/Bitwise Queries.cpp
function ask (line 6) | void ask(int i, int j, string operation, int &result)
function main (line 14) | int main()
FILE: 2020/Div 2/685 Div 2/Programs/Circle Game.cpp
function ceil (line 5) | long long ceil(long long n, long long d)
function square (line 10) | long long square(long long n)
function solve (line 15) | void solve()
function main (line 40) | int main()
FILE: 2020/Div 2/685 Div 2/Programs/Non-Substring Subsequence .cpp
function solve (line 5) | void solve()
function main (line 53) | int main()
FILE: 2020/Div 2/685 Div 2/Programs/Nullify the Matrix.cpp
function solve (line 6) | void solve()
function main (line 32) | int main()
FILE: 2020/Div 2/685 Div 2/Programs/String Equality.cpp
function solve (line 6) | void solve()
function main (line 46) | int main()
FILE: 2020/Div 2/685 Div 2/Programs/Subtract or Divide .cpp
function solve (line 5) | void solve()
function main (line 28) | int main()
FILE: 2020/Div 2/687 Div 2 Technocup 2021 Elimination Round 2/Programs/Bouncing Ball.cpp
function solve (line 6) | void solve()
function main (line 36) | int main()
FILE: 2020/Div 2/687 Div 2 Technocup 2021 Elimination Round 2/Programs/New Game Plus.cpp
function main (line 8) | int main()
FILE: 2020/Div 2/687 Div 2 Technocup 2021 Elimination Round 2/Programs/Prison Break.cpp
function solve (line 7) | void solve()
function main (line 19) | int main()
FILE: 2020/Div 2/687 Div 2 Technocup 2021 Elimination Round 2/Programs/Repainting Street.cpp
function ceil (line 7) | int ceil(int n, int d)
function calculate (line 12) | int calculate(vector <int> &A, int k, int chosen)
function solve (line 29) | void solve()
function main (line 50) | int main()
FILE: 2020/Div 2/687 Div 2 Technocup 2021 Elimination Round 2/Programs/XOR Gun.cpp
function is_bit_set (line 6) | int is_bit_set(int n, int bit)
function msb (line 11) | int msb(int n)
function main (line 26) | int main()
FILE: 2020/Div 2/688 Div 2/Programs/Suffix Operations.cpp
function solve (line 6) | void solve()
function main (line 38) | int main()
FILE: 2020/Div 2/689 Div 2/Programs/Divide and Summarize.cpp
function get_sum (line 11) | long long get_sum(int left, int right)
function check (line 16) | void check(map <long long, int> &S, int left, int right)
function solve (line 34) | void solve()
function main (line 65) | int main()
FILE: 2020/Div 2/689 Div 2/Programs/Find the Spruce.cpp
function solve (line 6) | void solve()
function main (line 82) | int main()
FILE: 2020/Div 2/689 Div 2/Programs/Mathematical Expression.cpp
function solve (line 11) | void solve(int left, int right, vector <char> &S, vector <int> &A)
function main (line 88) | int main()
FILE: 2020/Div 2/689 Div 2/Programs/Random Events.cpp
function solve (line 7) | void solve()
function main (line 41) | int main()
FILE: 2020/Div 2/689 Div 2/Programs/String Generation.cpp
function solve (line 6) | void solve()
function main (line 32) | int main()
FILE: 2020/Div 2/689 Div 2/Programs/Water Level.cpp
function in_between (line 6) | int in_between(long long x, long long left, long long right)
function main (line 11) | int main()
FILE: 2020/Div 2/691 Div 2/Programs/Move and Turn.cpp
function main (line 5) | int main()
FILE: 2020/Div 2/691 Div 2/Programs/Red Blue Shuffle.cpp
function solve (line 5) | void solve()
function main (line 34) | int main()
FILE: 2020/Div 2/691 Div 2/Programs/Row GCD.cpp
function gcd (line 10) | long long gcd(long long a, long long b)
function main (line 18) | int main()
FILE: 2020/Div 2/692 Div 2/Programs/Fair Numbers.cpp
function fair (line 5) | int fair(long long n)
function solve (line 24) | void solve()
function main (line 36) | int main()
FILE: 2020/Div 2/692 Div 2/Programs/In Game Chat.cpp
function solve (line 5) | void solve()
function main (line 29) | int main()
FILE: 2020/Div 2/CodeCraft 2020/Programs/Grade Allocation.cpp
function solve (line 6) | void solve()
function main (line 28) | int main()
FILE: 2020/Div 2/CodeCraft 2020/Programs/Nash Matrix.cpp
function find_looping_partner (line 15) | void find_looping_partner(int i, int j)
function dfs (line 32) | void dfs(int i, int j, int final_x, int final_y, char D)
function main (line 53) | int main()
FILE: 2020/Div 2/CodeCraft 2020/Programs/Primitive Primes.cpp
function main (line 6) | int main()
FILE: 2020/Div 2/CodeCraft 2020/Programs/String Modification.cpp
function solve (line 7) | void solve()
function main (line 45) | int main()
FILE: 2020/Div 2/CodeCraft 2020/Programs/Team Building.cpp
function no_of_bits (line 12) | int no_of_bits(int n)
function is_bit_set (line 26) | int is_bit_set(int n, int bit)
function main (line 31) | int main()
FILE: 2020/Div 3/605 Div 3/Explanations/Nearly Opposite Parity.cpp
function will (line 16) | will do the same for all even integers
FILE: 2020/Div 3/605 Div 3/Programs/Nearly Opposite Parity.cpp
function bfs (line 11) | void bfs(vector <int> &A, vector <int> &answer, int parity)
function main (line 53) | int main()
FILE: 2020/Div 3/605 Div 3/Programs/Remove One Element.cpp
function main (line 14) | int main()
FILE: 2020/Div 3/611 Div 3/Programs/Candies Division.cpp
function solve (line 5) | void solve()
function main (line 20) | int main()
FILE: 2020/Div 3/611 Div 3/Programs/Christmas Trees.cpp
function main (line 10) | int main()
FILE: 2020/Div 3/611 Div 3/Programs/DIY Garland.cpp
function main (line 6) | int main()
FILE: 2020/Div 3/611 Div 3/Programs/Friends and Gifts.cpp
function main (line 7) | int main()
FILE: 2020/Div 3/611 Div 3/Programs/Minutes Before the New Year.cpp
function solve (line 5) | void solve()
function main (line 16) | int main()
FILE: 2020/Div 3/611 Div 3/Programs/New Year Parties.cpp
function min_3 (line 9) | int min_3(int a, int b, int c)
function maximise_houses (line 14) | int maximise_houses(int n, vector <int> X)
function minimise_houses (line 36) | int minimise_houses(int n, vector <int> X)
function main (line 91) | int main()
FILE: 2020/Div 3/615 Div 3/Programs/Collecting Coins.cpp
function solve (line 5) | void solve()
function main (line 14) | int main()
FILE: 2020/Div 3/615 Div 3/Programs/Collecting Packages.cpp
type point (line 8) | struct point
method point (line 12) | point(){}
function sort_by_x (line 15) | int sort_by_x(point &P, point &Q)
function solve (line 25) | void solve()
function main (line 74) | int main()
FILE: 2020/Div 3/615 Div 3/Programs/MEX Maximising.cpp
function main (line 9) | int main()
FILE: 2020/Div 3/615 Div 3/Programs/Obtain a Permutation.cpp
function ceil (line 9) | long long ceil(long long n, long long d)
function calculate_best_cost (line 14) | long long calculate_best_cost(int column_no)
function main (line 61) | int main()
FILE: 2020/Div 3/615 Div 3/Programs/Paths on a Tree.cpp
function is_bit_set (line 12) | int is_bit_set(long long n, int bit)
function dfs (line 17) | void dfs(int v, int parent_v)
function dfs (line 36) | int dfs(int v, int parent_v, int destination)
function precompute_parents (line 63) | void precompute_parents(int no_of_vertices)
function LCA (line 76) | int LCA(int u, int v)
function tree_distance (line 110) | int tree_distance(int u, int v)
function main (line 115) | int main()
FILE: 2020/Div 3/615 Div 3/Programs/Product of Three Numbers.cpp
function factorise (line 8) | void factorise(int n, vector <int> &P, vector <int> &E)
function solve (line 34) | void solve()
function main (line 82) | int main()
FILE: 2020/Div 3/617 Div 3/Programs/Array with Odd Sum.cpp
function solve (line 6) | void solve()
function main (line 23) | int main()
FILE: 2020/Div 3/617 Div 3/Programs/Fight with Monsters.cpp
function ceil (line 7) | int ceil(int a, int b)
function main (line 12) | int main()
FILE: 2020/Div 3/617 Div 3/Programs/Food Buying.cpp
function solve (line 6) | void solve()
function main (line 25) | int main()
FILE: 2020/Div 3/617 Div 3/Programs/String Coloring (Hard Version).cpp
function main (line 6) | int main()
FILE: 2020/Div 3/617 Div 3/Programs/String Colouring (Easy Version).cpp
function other (line 10) | int other(int c)
function main (line 15) | int main()
FILE: 2020/Div 3/617 Div 3/Programs/Yet Another Walking Robot.cpp
function solve (line 7) | void solve()
function main (line 52) | int main()
FILE: 2020/Div 3/624 Div 3/Programs/Add Odd or Subtract Even.cpp
function solve (line 6) | void solve()
function main (line 27) | int main()
FILE: 2020/Div 3/624 Div 3/Programs/Construct the Binary Tree.cpp
function is_power_of_2 (line 6) | int is_power_of_2(int n)
function solve (line 11) | void solve()
function main (line 93) | int main()
FILE: 2020/Div 3/624 Div 3/Programs/Moving Points.cpp
type Point (line 11) | struct Point
method Point (line 15) | Point(){}
method Point (line 17) | Point(long long D, long long V)
function sort_by_distance (line 24) | int sort_by_distance(const Point &P, const Point &Q)
function update (line 32) | void update(int n, int left, int right, int position, long long value)
function get (line 59) | pair <long long, int> get(int n, int left, int right, int query_left, in...
function main (line 83) | int main()
FILE: 2020/Div 3/624 Div 3/Programs/Perform the Combo.cpp
function solve (line 8) | void solve()
function main (line 61) | int main()
FILE: 2020/Div 3/624 Div 3/Programs/Three Integers.cpp
function solve (line 6) | void solve()
function main (line 40) | int main()
FILE: 2020/Div 3/624 Div 3/Programs/Weirdsort.cpp
function solve (line 8) | void solve()
function main (line 56) | int main()
FILE: 2020/Div 3/627 Div 3/Programs/Frog Jumps.cpp
function solve (line 8) | void solve()
function main (line 27) | int main()
FILE: 2020/Div 3/627 Div 3/Programs/Maximum White Subtree.cpp
function dfs (line 10) | void dfs(int v, int parent_v)
function dfs_adjust (line 29) | void dfs_adjust(int v, int parent_v)
function main (line 56) | int main()
FILE: 2020/Div 3/627 Div 3/Programs/Pair of Topics.cpp
function update (line 15) | void update(int n, int left, int right, int position, int value)
function get_sum (line 37) | int get_sum(int n, int left, int right, int query_left, int query_right)
function main (line 56) | int main()
FILE: 2020/Div 3/627 Div 3/Programs/Sleeping Schedule.cpp
function main (line 9) | int main()
FILE: 2020/Div 3/627 Div 3/Programs/Yet Another Palindrome Problem.cpp
function solve (line 6) | void solve()
function main (line 34) | int main()
FILE: 2020/Div 3/627 Div 3/Programs/Yet Another Tetris Problem.cpp
function solve (line 8) | void solve()
function main (line 26) | int main()
FILE: 2020/Div 3/629 Div 3/Programs/Carousel.cpp
function solve (line 7) | void solve()
function main (line 97) | int main()
FILE: 2020/Div 3/629 Div 3/Programs/Divisibility Problem.cpp
function solve (line 5) | void solve()
function main (line 16) | int main()
FILE: 2020/Div 3/629 Div 3/Programs/Kth Beautiful String.cpp
function solve (line 5) | void solve()
function main (line 32) | int main()
FILE: 2020/Div 3/629 Div 3/Programs/Ternary XOR.cpp
function solve (line 7) | void solve()
function main (line 52) | int main()
FILE: 2020/Div 3/629 Div 3/Programs/Tree Queries.cpp
function dfs (line 9) | void dfs(int v, int parent_v, int &time)
function solve (line 31) | void solve()
function main (line 76) | int main()
FILE: 2020/Div 3/634 Div 3/Programs/Anti Sudoku.cpp
function solve (line 6) | void solve()
function main (line 52) | int main()
FILE: 2020/Div 3/634 Div 3/Programs/Candies and Two Sisters.cpp
function solve (line 5) | void solve()
function main (line 14) | int main()
FILE: 2020/Div 3/634 Div 3/Programs/Construct the String.cpp
function solve (line 5) | void solve()
function main (line 33) | int main()
FILE: 2020/Div 3/634 Div 3/Programs/Robots on a Grid.cpp
function label (line 14) | int label(int x, int y)
function is_bit_set (line 19) | int is_bit_set(int n, int bit)
function get_next (line 24) | int get_next(int x, int y)
function dfs (line 37) | void dfs(int v)
function solve (line 55) | void solve()
function main (line 151) | int main()
FILE: 2020/Div 3/634 Div 3/Programs/Three Blocks Palindrome.cpp
function solve (line 7) | void solve()
function main (line 66) | int main()
FILE: 2020/Div 3/634 Div 3/Programs/Two Teams Composing.cpp
function solve (line 10) | void solve()
function main (line 44) | int main()
FILE: 2020/Div 3/636 Div 3/Programs/Constant Palindrome Sum.cpp
function solve (line 6) | void solve()
function main (line 52) | int main()
FILE: 2020/Div 3/661 Div 3/Programs/Binary String to Subsequences.cpp
function solve (line 9) | void solve()
function main (line 57) | int main()
FILE: 2020/Div 3/661 Div 3/Programs/Boats Competition.cpp
function solve (line 8) | void solve()
function main (line 51) | int main()
FILE: 2020/Div 3/661 Div 3/Programs/Gifts Fixing.cpp
function solve (line 8) | void solve()
function main (line 45) | int main()
FILE: 2020/Div 3/661 Div 3/Programs/Remove Smallest.cpp
function solve (line 8) | void solve()
function main (line 35) | int main()
FILE: 2020/Div 3/674 Div 3/Programs/Number of Subsequences.cpp
function sum_till (line 6) | long long sum_till(long long n)
function sum (line 11) | long long sum(long long L, long long R)
function main (line 16) | int main()
FILE: 2020/Div 3/686 Div 3/Programs/Array Partition.cpp
function compress_coordinates (line 14) | void compress_coordinates(int no_of_elements)
function compute_prefix_and_suffix_max (line 39) | void compute_prefix_and_suffix_max(int no_of_elements, vector <int> &pre...
function compute_borders (line 53) | void compute_borders(int no_of_elements, vector <int> &left_border, vect...
function solve (line 84) | void solve()
function main (line 200) | int main()
FILE: 2020/Div 3/686 Div 3/Programs/Number Into Sequence.cpp
function solve (line 6) | void solve()
function main (line 51) | int main()
FILE: 2020/Div 3/686 Div 3/Programs/Number of Simple Paths.cpp
function dfs (line 14) | void dfs(int v, int parent_v)
function dfs_without_cycle (line 59) | int dfs_without_cycle(int v, int parent_v)
function choose_2 (line 78) | long long choose_2(long long n)
function solve (line 83) | void solve()
function main (line 130) | int main()
FILE: 2020/Div 3/686 Div 3/Programs/Sequence Transformation.cpp
function solve (line 7) | void solve()
function main (line 48) | int main()
FILE: 2020/Div 3/686 Div 3/Programs/Special Permutation.cpp
function solve (line 5) | void solve()
function main (line 18) | int main()
FILE: 2020/Div 3/686 Div 3/Programs/Unique Bid Auction.cpp
function solve (line 7) | void solve()
function main (line 37) | int main()
FILE: 2020/Educational Rounds/Educational Round 78/Programs/A and B.cpp
function possible (line 5) | int possible(int x, int d)
function solve (line 12) | void solve()
function main (line 26) | int main()
FILE: 2020/Educational Rounds/Educational Round 78/Programs/Berry Jam.cpp
function solve (line 7) | void solve()
function main (line 53) | int main()
FILE: 2020/Educational Rounds/Educational Round 78/Programs/Shuffle Hashing.cpp
function solve (line 8) | void solve()
function main (line 44) | int main()
FILE: 2020/Educational Rounds/Educational Round 78/Programs/Tests for Problem D.cpp
function dfs (line 11) | void dfs(int v, int parent_v)
function main (line 37) | int main()
FILE: 2020/Educational Rounds/Educational Round 79/Programs/New Year Garland.cpp
function max_3 (line 5) | long long max_3(long long a, long long b, long long c)
function solve (line 10) | void solve()
function main (line 22) | int main()
FILE: 2020/Educational Rounds/Educational Round 79/Programs/Stack of Presents.cpp
function solve (line 6) | void solve()
function main (line 45) | int main()
FILE: 2020/Educational Rounds/Educational Round 79/Programs/Verse for Santa.cpp
function solve (line 8) | void solve()
function main (line 56) | int main()
FILE: 2020/Educational Rounds/Educational Round 80/Programs/Deadline.cpp
function ceil (line 5) | int ceil(int n, int d)
function solve (line 10) | void solve()
function main (line 38) | int main()
FILE: 2020/Educational Rounds/Educational Round 80/Programs/Minimax Problem.cpp
function possible (line 10) | int possible(int x, int &i, int &j)
function main (line 50) | int main()
FILE: 2020/Educational Rounds/Educational Round 80/Programs/Two Arrays Alternate Solution.cpp
function power (line 8) | long long power(long long x, long long p)
function precompute (line 24) | void precompute()
function combinations (line 40) | long long combinations(long long n, long long k)
function main (line 53) | int main()
FILE: 2020/Educational Rounds/Educational Round 80/Programs/Two Arrays.cpp
function power (line 8) | long long power(long long x, long long p)
function precompute (line 24) | void precompute()
function combinations (line 40) | long long combinations(long long n, long long k)
function count (line 55) | long long count(long long left, long long right, long long length)
function main (line 64) | int main()
FILE: 2020/Educational Rounds/Educational Round 80/Programs/Yet Another Meme Problem.cpp
function digit_count (line 5) | int digit_count(int n)
function solve (line 19) | void solve()
function main (line 37) | int main()
FILE: 2020/Educational Rounds/Educational Round 81/Programs/Display the Number.cpp
function solve (line 6) | void solve()
function main (line 38) | int main()
FILE: 2020/Educational Rounds/Educational Round 81/Programs/Infinite Prefixes.cpp
function solve (line 6) | void solve()
function main (line 48) | int main()
FILE: 2020/Educational Rounds/Educational Round 81/Programs/Obtain the String.cpp
function solve (line 9) | void solve()
function main (line 52) | int main()
FILE: 2020/Educational Rounds/Educational Round 81/Programs/Same GCDs.cpp
function gcd (line 6) | long long gcd(long long x, long long y)
function totient (line 16) | long long totient(long long n)
function solve (line 43) | void solve()
function main (line 55) | int main()
FILE: 2020/Educational Rounds/Educational Round 82/Programs/Erasing Zeroes.cpp
function solve (line 5) | void solve()
function main (line 39) | int main()
FILE: 2020/Educational Rounds/Educational Round 82/Programs/Fill the Bag.cpp
function is_bit_set (line 6) | int is_bit_set(long long n, int bit)
function solve (line 11) | void solve()
function main (line 80) | int main()
FILE: 2020/Educational Rounds/Educational Round 82/Programs/National Project.cpp
function ceil (line 5) | long long ceil(long long n, long long d)
function possible (line 10) | int possible(long long x, long long n, long long g, long long b)
function solve (line 44) | void solve()
function main (line 68) | int main()
FILE: 2020/Educational Rounds/Educational Round 82/Programs/Perfect Keyboard.cpp
function dfs (line 11) | void dfs(int v, int parent_v, int c)
function solve (line 29) | void solve()
function main (line 149) | int main()
FILE: 2020/Educational Rounds/Educational Round 83/Programs/Adding Powers.cpp
function solve (line 7) | void solve()
function main (line 60) | int main()
FILE: 2020/Educational Rounds/Educational Round 83/Programs/Array Shrinking.cpp
function main (line 6) | int main()
FILE: 2020/Educational Rounds/Educational Round 83/Programs/Bogosort.cpp
function solve (line 9) | void solve()
function main (line 31) | int main()
FILE: 2020/Educational Rounds/Educational Round 83/Programs/Count the Arrays.cpp
function power (line 9) | long long power(long long x, long long p)
function inverse (line 27) | long long inverse(long long n)
function precompute_factorials (line 32) | void precompute_factorials()
function choose (line 48) | long long choose(long long n, long long r)
function main (line 56) | int main()
FILE: 2020/Educational Rounds/Educational Round 83/Programs/Two Regular Polygons.cpp
function solve (line 5) | void solve()
function main (line 13) | int main()
FILE: 2020/Educational Rounds/Educational Round 84/Programs/Count the Blocks.cpp
function power (line 5) | long long power(long long x, long long p, long long mod)
function main (line 23) | int main()
FILE: 2020/Educational Rounds/Educational Round 84/Programs/Sum of Odd Integers.cpp
function solve (line 5) | void solve()
function main (line 16) | int main()
FILE: 2020/Educational Rounds/Educational Round 85/Programs/Circle of Monsters.cpp
function solve (line 6) | void solve()
function main (line 44) | int main()
FILE: 2020/Educational Rounds/Educational Round 85/Programs/Divisor Paths.cpp
function gcd (line 10) | long long gcd(long long x, long long y)
function power_mod (line 20) | long long power_mod(long long x, long long power)
function factorise (line 37) | void factorise(long long d)
function precompute_factorial (line 58) | void precompute_factorial()
function get_count (line 75) | long long get_count(long long x, long long y)
function main (line 125) | int main()
FILE: 2020/Educational Rounds/Educational Round 85/Programs/Level Statistics.cpp
function solve (line 6) | void solve()
function main (line 35) | int main()
FILE: 2020/Educational Rounds/Educational Round 85/Programs/Middle Class.cpp
function solve (line 9) | void solve()
function main (line 39) | int main()
FILE: 2020/Educational Rounds/Educational Round 85/Programs/Minimum Euler Cycle.cpp
function solve (line 5) | void solve()
function main (line 79) | int main()
FILE: 2020/Educational Rounds/Educational Round 86/Programs/Binary Period.cpp
function is_periodic (line 6) | int is_periodic(string S, int period)
function other (line 19) | char other(char ch)
function solve (line 24) | void solve()
function main (line 53) | int main()
FILE: 2020/Educational Rounds/Educational Round 86/Programs/Road to Zero.cpp
function solve (line 5) | void solve()
function main (line 25) | int main()
FILE: 2020/Educational Rounds/Educational Round 86/Programs/Yet Another Counting Problem.cpp
function gcd (line 6) | long long gcd(long long x, long long y)
function get_count (line 16) | long long get_count(vector <long long> &sum, long long lcm, long long N)
function solve (line 23) | void solve()
function main (line 53) | int main()
FILE: 2020/Educational Rounds/Educational Round 90/Programs/01 Game.cpp
function solve (line 5) | void solve()
function main (line 28) | int main()
FILE: 2020/Educational Rounds/Educational Round 90/Programs/Donut Shops.cpp
function solve (line 5) | void solve()
function main (line 16) | int main()
FILE: 2020/Educational Rounds/Educational Round 90/Programs/Maximum Sum on Even Positions.cpp
function solve (line 6) | void solve()
function main (line 54) | int main()
FILE: 2020/Educational Rounds/Educational Round 90/Programs/Pluses and Minuses.cpp
function solve (line 6) | void solve()
function main (line 38) | int main()
FILE: 2020/Educational Rounds/Educational Round 92/Programs/Good String.cpp
function get_length (line 7) | int get_length(int x, int y, string &S)
function solve (line 37) | void solve()
function main (line 67) | int main()
FILE: 2020/Educational Rounds/Educational Round 93/Programs/Bad Triangle.cpp
function solve (line 6) | void solve()
function main (line 27) | int main()
FILE: 2020/Educational Rounds/Educational Round 93/Programs/Colored Rectangles.cpp
function any_two_zero (line 12) | int any_two_zero(int r, int g, int b)
function main (line 19) | int main()
FILE: 2020/Educational Rounds/Educational Round 93/Programs/Good Subarrays.cpp
function solve (line 7) | void solve()
function main (line 42) | int main()
FILE: 2020/Educational Rounds/Educational Round 93/Programs/Substring Removal Game.cpp
function solve (line 8) | void solve()
function main (line 50) | int main()
FILE: 2020/Good Bye 2019/Programs/Card Game.cpp
function solve (line 6) | void solve()
function main (line 30) | int main()
FILE: 2020/Good Bye 2019/Programs/Interesting Subarray.cpp
function solve (line 6) | void solve()
function main (line 31) | int main()
FILE: 2020/Good Bye 2019/Programs/Make Good.cpp
function solve (line 6) | void solve()
function main (line 39) | int main()
FILE: 2020/Hello 2020/Programs/New Year and Ascent Sequences.cpp
function main (line 6) | int main()
FILE: 2020/Hello 2020/Programs/New Year and Conferences.cpp
type event (line 9) | struct event
method event (line 13) | event(){}
method event (line 15) | event(int T, int S, int E, int is_E)
function same_intersections (line 31) | int same_intersections(vector <int> start_a, vector <int> end_a, vector ...
function main (line 72) | int main()
FILE: 2020/Hello 2020/Programs/New Year and Naming.cpp
function main (line 6) | int main()
FILE: 2020/Hello 2020/Programs/New Year and Permutation.cpp
function main (line 6) | int main()
FILE: 2020/Practice/Explanations/Scheme.cpp
function dfs (line 14) | void dfs(int v)
function main (line 33) | int main()
FILE: 2020/Practice/Programs/Alternative Thinking.cpp
function main (line 6) | int main()
FILE: 2020/Practice/Programs/Ant Colony.cpp
type node (line 8) | struct node
method node (line 12) | node(){}
method node (line 14) | node(int G, int M, int F)
function gcd (line 24) | int gcd(int a, int b)
function node (line 34) | node merge(node &A, node &B)
method node (line 12) | node(){}
method node (line 14) | node(int G, int M, int F)
function build (line 59) | void build(int n, int left, int right)
function node (line 75) | node query(int n, int left, int right, int query_left, int query_right)
method node (line 12) | node(){}
method node (line 14) | node(int G, int M, int F)
function main (line 96) | int main()
FILE: 2020/Practice/Programs/Anton and Chess.cpp
function check (line 8) | int check(int x, vector <pair <long long, char> > &A, char attacker_1, c...
function main (line 29) | int main()
FILE: 2020/Practice/Programs/Anton and Ira.cpp
function main (line 6) | int main()
FILE: 2020/Practice/Programs/Ants in Leaves.cpp
function dfs (line 13) | void dfs(int v, int parent_v, int depth)
function get_answer (line 31) | int get_answer(int v)
function main (line 53) | int main()
FILE: 2020/Practice/Programs/Army Creation.cpp
function merge (line 15) | vector <int> merge(vector <int> &L, vector <int> &R)
function build (line 46) | void build(int n, int left, int right)
function query (line 72) | int query(int n, int left, int right, int query_left, int query_right, i...
function main (line 90) | int main()
FILE: 2020/Practice/Programs/Bargain.cpp
function power_mod (line 6) | long long power_mod(long long x, long long power, long long mod)
function inverse (line 24) | long long inverse(long long x, long long mod)
function choose_2 (line 29) | long long choose_2(long long n, long long mod)
function main (line 34) | int main()
FILE: 2020/Practice/Programs/Concatenated Multiples.cpp
function no_of_digits (line 7) | int no_of_digits(int n)
function main (line 21) | int main()
FILE: 2020/Practice/Programs/Count Pairs.cpp
function choose_2 (line 7) | long long choose_2(long long n)
function main (line 12) | int main()
FILE: 2020/Practice/Programs/Cram Time.cpp
function display (line 6) | void display(vector <long long> &A)
function main (line 18) | int main()
FILE: 2020/Practice/Programs/Cycles.cpp
function choose_3 (line 10) | long long choose_3(long long n)
function choose_2 (line 15) | long long choose_2(long long n)
function add_edge (line 20) | void add_edge(int u, int v)
function main (line 26) | int main()
FILE: 2020/Practice/Programs/Elections.cpp
function cost_if_final_count (line 10) | long long cost_if_final_count(int n)
function main (line 50) | int main()
FILE: 2020/Practice/Programs/Fight Against Traffic.cpp
function bfs (line 12) | void bfs(int source, vector <int> &distance)
function main (line 38) | int main()
FILE: 2020/Practice/Programs/Hacker, pack your Bags.cpp
type Point (line 9) | struct Point
method Point (line 13) | Point(){}
method Point (line 15) | Point(int X, int C, int D, int is_L)
function sort_by_point (line 24) | int sort_by_point(Point &A, Point &B)
function main (line 34) | int main()
FILE: 2020/Practice/Programs/Imbalanced Array.cpp
function compute_max_borders (line 7) | void compute_max_borders(int n, vector <int> &A, vector <int> &L, vector...
function compute_min_borders (line 41) | void compute_min_borders(int n, vector <int> &A, vector <int> &L, vector...
function main (line 74) | int main()
FILE: 2020/Practice/Programs/Laboratory Work.cpp
function main (line 8) | int main()
FILE: 2020/Practice/Programs/Lieges of Legendre.cpp
function get_grundy (line 6) | int get_grundy(int n, int k)
function main (line 48) | int main()
FILE: 2020/Practice/Programs/Line.cpp
function extended_gcd (line 7) | long long extended_gcd(long long A, long long B, long long &x, long long...
function main (line 25) | int main()
FILE: 2020/Practice/Programs/Marina and Vyasa.cpp
function other (line 5) | char other(char c1, char c2)
function main (line 22) | int main()
FILE: 2020/Practice/Programs/Match Points.cpp
function main (line 8) | int main()
FILE: 2020/Practice/Programs/Molly and Chemicals.cpp
function precompute (line 7) | void precompute(vector <long long> &P, long long k)
function main (line 30) | int main()
FILE: 2020/Practice/Programs/Moodular Arithmetic.cpp
function power_mod (line 5) | long long power_mod(long long x, long long power, long long m)
function order (line 21) | int order(int k, int m)
function main (line 43) | int main()
FILE: 2020/Practice/Programs/Mouse Hunt.cpp
function dfs (line 9) | void dfs(int v, int &total_cost)
function main (line 38) | int main()
FILE: 2020/Practice/Programs/Multiplicity.cpp
function main (line 7) | int main()
FILE: 2020/Practice/Programs/Multipliers.cpp
function power_mod (line 8) | long long power_mod(long long x, long long power, long long mod)
function ceil (line 24) | long long ceil(long long n, long long x)
function main (line 32) | int main()
FILE: 2020/Practice/Programs/My Pretty Girl Nora.cpp
function main (line 5) | int main()
FILE: 2020/Practice/Programs/Optimal Number Permutation.cpp
function main (line 6) | int main()
FILE: 2020/Practice/Programs/Pair of Numbers.cpp
function gcd (line 11) | int gcd(int x, int y)
function is_bit_set (line 21) | int is_bit_set(int n, int bit)
function precompute (line 26) | void precompute()
function compute (line 48) | pair <int, int> compute(int i, int length)
function possible (line 65) | int possible(int length)
function main (line 83) | int main()
FILE: 2020/Practice/Programs/Pashmak and Graph.cpp
type Edge (line 8) | struct Edge
function main (line 18) | int main()
FILE: 2020/Practice/Programs/Pavel and Triangles.cpp
function main (line 6) | int main()
FILE: 2020/Practice/Programs/Plus and Xor.cpp
function main (line 5) | int main()
FILE: 2020/Practice/Programs/Points.cpp
function calculate (line 6) | long long calculate(vector <long long> &P, int n)
function main (line 29) | int main()
FILE: 2020/Practice/Programs/Prime Number.cpp
function power_mod (line 10) | long long power_mod(long long x, long long power, long long mod)
function main (line 26) | int main()
FILE: 2020/Practice/Programs/Ramesses and Corner Inversion.cpp
function read (line 6) | void read(vector <vector <int> > &A)
function compute (line 17) | void compute(vector <vector <int> > &A, vector <int> &row_sum, vector <i...
function main (line 29) | int main()
FILE: 2020/Practice/Programs/Scheme.cpp
function dfs (line 14) | void dfs(int v)
function main (line 33) | int main()
FILE: 2020/Practice/Programs/Secret Passwords.cpp
type DSU (line 7) | struct DSU
method DSU (line 12) | DSU() {}
method DSU (line 14) | DSU(int n)
method get_parent (line 23) | int get_parent(int n)
method unite (line 35) | void unite(int x, int y)
function is_set (line 48) | int is_set(long long n, int bit)
function main (line 53) | int main()
FILE: 2020/Practice/Programs/Segments.cpp
type segment (line 11) | struct segment
method segment (line 15) | segment(){}
method segment (line 17) | segment(int P, int T, int I)
function sort_by_left (line 23) | int sort_by_left(segment &S_1, segment &S_2)
function main (line 33) | int main()
FILE: 2020/Practice/Programs/Special Segments of Permutation.cpp
function get_count (line 12) | int get_count(int left_1, int right_1, int left_2, int right_2, int tota...
function main (line 35) | int main()
FILE: 2020/Practice/Programs/The Sum of the k-th Powers.cpp
function power_mod (line 8) | long long power_mod(long long x, long long power)
function inverse (line 24) | long long inverse(long long x)
function main (line 29) | int main()
FILE: 2020/Practice/Programs/The Treasure of Segments.cpp
function solve (line 11) | void solve()
function main (line 44) | int main()
FILE: 2020/Practice/Programs/Winter is Here.cpp
function power_mod (line 6) | long long power_mod(long long x, long long power, long long mod)
function main (line 22) | int main()
FILE: 2021/Combined Divisions/Deltix Round Summer 2021/Programs/Take a Guess.cpp
function ask (line 8) | int ask(int i, int j, string S)
function main (line 18) | int main()
FILE: 2021/Div 2/694/Programs/Strange Birthday Party.cpp
function solve (line 7) | void solve()
function main (line 43) | int main()
FILE: 2021/Div 2/694/Programs/Strange Definition.cpp
function sieve (line 12) | void sieve(int n)
function solve (line 47) | void solve()
function main (line 95) | int main()
FILE: 2021/Div 2/694/Programs/Strange Housing.cpp
function solve (line 9) | void solve()
function main (line 80) | int main()
FILE: 2021/Div 2/694/Programs/Strange List.cpp
function solve (line 7) | void solve()
function main (line 45) | int main()
FILE: 2021/Div 2/694/Programs/Strange Partition.cpp
function ceil (line 6) | long long ceil(long long n, long long d)
function solve (line 11) | void solve()
function main (line 42) | int main()
FILE: 2021/Div 2/694/Programs/Strange Shuffle.cpp
function ask (line 9) | int ask(int i)
function main (line 19) | int main()
FILE: 2021/Div 2/708/Programs/Genius.cpp
function solve (line 6) | void solve()
function main (line 48) | int main()
FILE: 2021/Div 2/708/Programs/M Arrays.cpp
function solve (line 6) | void solve()
function main (line 41) | int main()
FILE: 2021/Div 2/708/Programs/Meximization.cpp
function solve (line 7) | void solve()
function main (line 45) | int main()
FILE: 2021/Div 2/708/Programs/Square Free Division.cpp
function sieve (line 12) | void sieve(int n)
function solve (line 47) | void solve()
function main (line 128) | int main()
FILE: 2021/Div 2/708/Programs/k-LCM.cpp
function solve_3 (line 5) | void solve_3(int n)
function solve (line 17) | void solve()
function main (line 30) | int main()
FILE: 2021/Div 2/711 CodeCraft 2021/Programs/Bananas in a Microwave.cpp
function ceil (line 8) | long long ceil(long long n, long long d)
function operate (line 13) | long long operate(int type, long long b, long long x)
function main (line 23) | int main()
FILE: 2021/Div 2/711 CodeCraft 2021/Programs/Box Fitting.cpp
function solve (line 8) | void solve()
function main (line 56) | int main()
FILE: 2021/Div 2/711 CodeCraft 2021/Programs/GCD Sum.cpp
function sum_of_digits (line 6) | long long sum_of_digits(long long n)
function solve (line 20) | void solve()
function main (line 32) | int main()
FILE: 2021/Div 2/711 CodeCraft 2021/Programs/Two Houses.cpp
function main (line 7) | int main()
FILE: 2021/Div 2/712 Div 2/Programs/3 Colouring.cpp
function display (line 6) | void display(vector <vector <int> > &grid)
function colour (line 18) | pair <int, int> colour(vector <vector <int> > &grid, int n, int parity, ...
function main (line 36) | int main()
FILE: 2021/Div 2/712 Div 2/Programs/Déjà Vu.cpp
function solve (line 7) | void solve()
function main (line 51) | int main()
FILE: 2021/Div 2/712 Div 2/Programs/Flip the Bits.cpp
function other (line 7) | char other(char ch)
function solve (line 12) | void solve()
function main (line 84) | int main()
FILE: 2021/Div 2/714 Division by Zero 2021/Programs/AND Sequences.cpp
function factorial (line 7) | long long factorial(long long n, long long mod)
function choose_2 (line 18) | long long choose_2(long long n, long long mod)
function solve (line 25) | void solve()
function main (line 53) | int main()
FILE: 2021/Div 2/714 Division by Zero 2021/Programs/Add One.cpp
function precompute (line 10) | void precompute()
function solve (line 25) | void solve()
function main (line 47) | int main()
FILE: 2021/Div 2/714 Division by Zero 2021/Programs/Arrays and Peaks.cpp
function solve (line 6) | void solve()
function main (line 37) | int main()
FILE: 2021/Div 2/714 Division by Zero 2021/Programs/Cost Equilibrium.cpp
function power_mod (line 10) | long long power_mod(long long x, long long power, long long mod)
function precompute (line 26) | void precompute()
function multinomial (line 44) | long long multinomial(vector <long long> &frequency)
function stars_and_bars (line 65) | long long stars_and_bars(long long stars, long long bars)
function main (line 73) | int main()
FILE: 2021/Div 2/714 Division by Zero 2021/Programs/GCD and MST.cpp
function solve (line 7) | void solve()
function main (line 73) | int main()
FILE: 2021/Div 2/714 Division by Zero 2021/Programs/Swapping Problem.cpp
function update_prefix_max (line 7) | void update_prefix_max(map <int, int> &M)
function main (line 18) | int main()
FILE: 2021/Div 2/716 Div 2/Programs/Product 1 mod N.cpp
function main (line 7) | int main()
FILE: 2021/Div 2/722/Programs/Parsa and Humungous Tree.cpp
function initialize (line 11) | void initialize(int no_of_vertices)
function dfs (line 20) | void dfs(int v, int parent_v)
function solve (line 46) | void solve()
function main (line 73) | int main()
FILE: 2021/Div 2/724/Programs/Diluc and Kaeya.cpp
function solve (line 9) | void solve()
function main (line 54) | int main()
FILE: 2021/Div 2/724/Programs/Omkar and Bad Story.cpp
function solve (line 6) | void solve()
function main (line 40) | int main()
FILE: 2021/Div 2/724/Programs/Omkar and Forest.cpp
function power_mod (line 6) | long long power_mod(long long x, long long power, long long mod)
function solve (line 22) | void solve()
function main (line 54) | int main()
FILE: 2021/Div 2/724/Programs/Prinzessin der Verurteilung.cpp
function precompute (line 9) | void precompute()
function solve (line 32) | void solve()
function main (line 62) | int main()
FILE: 2021/Div 2/726/Programs/Arithmetic Array.cpp
function solve (line 6) | void solve()
function main (line 37) | int main()
FILE: 2021/Div 2/726/Programs/Bad Boy.cpp
function solve (line 6) | void solve()
function main (line 20) | int main()
FILE: 2021/Div 2/726/Programs/Challenging Cliffs.cpp
function solve (line 8) | void solve()
function main (line 50) | int main()
FILE: 2021/Div 2/726/Programs/Deleting Divisors.cpp
function is_prime (line 6) | int is_prime(int n)
function is_odd_power_of_2 (line 19) | int is_odd_power_of_2(int n)
function solve (line 32) | void solve()
function main (line 46) | int main()
FILE: 2021/Div 2/726/Programs/Erase and Extend (Easy Version).cpp
function string (line 6) | string concatenate_prefix(string S, int prefix, int k)
function main (line 16) | int main()
FILE: 2021/Div 2/726/Programs/Figure Fixing.cpp
function other (line 8) | int other(int colour)
function dfs_bipartite_check (line 13) | int dfs_bipartite_check(vector <vector <int> > &graph, int v, vector <in...
function solve (line 36) | void solve()
function main (line 92) | int main()
FILE: 2021/Div 2/727/Programs/Contest Start.cpp
function get_sum (line 6) | long long get_sum(long long n)
function solve (line 11) | void solve()
function main (line 28) | int main()
FILE: 2021/Div 2/727/Programs/Love Song.cpp
function main (line 6) | int main()
FILE: 2021/Div 2/727/Programs/PriceFixed.cpp
function sort_by_second (line 7) | int sort_by_second(pair <long long, long long> &P, pair <long long, long...
function main (line 17) | int main()
FILE: 2021/Div 2/727/Programs/Stable Groups.cpp
function ceil (line 10) | long long ceil(long long numerator, long long denominator)
function main (line 15) | int main()
FILE: 2021/Div 2/740/Programs/Deep Down Below Binary Search.cpp
function possible (line 7) | int possible(vector <pair <long long, long long> > &L, long long x)
function solve (line 22) | void solve()
function main (line 65) | int main()
FILE: 2021/Div 2/740/Programs/Deep Down Below.cpp
function possible (line 7) | int possible(vector <pair <long long, long long> > &L, long long x)
function solve (line 22) | void solve()
function main (line 57) | int main()
FILE: 2021/Div 2/742/Programs/Carrying Conundrum.cpp
function solve (line 5) | void solve()
function main (line 30) | int main()
FILE: 2021/Div 2/750/Programs/Pchelyonok and Segments.cpp
function get_largest_k (line 6) | long long get_largest_k(long long n)
function solve (line 27) | void solve()
function main (line 80) | int main()
FILE: 2021/Div 3/710/Programs/Double Ended Strings.cpp
function solve (line 11) | void solve()
function main (line 47) | int main()
FILE: 2021/Div 3/710/Programs/Epic Transformation.cpp
function solve (line 9) | void solve()
function main (line 43) | int main()
FILE: 2021/Div 3/710/Programs/Maximize the Remaining String.cpp
function solve (line 11) | void solve()
function main (line 52) | int main()
FILE: 2021/Div 3/710/Programs/Partial Replacement.cpp
function solve (line 6) | void solve()
function main (line 46) | int main()
FILE: 2021/Div 3/710/Programs/Strange Table.cpp
function solve (line 5) | void solve()
function main (line 18) | int main()
FILE: 2021/Div 3/710/Programs/Triangular Paths.cpp
function is_even (line 9) | int is_even(long long r, long long c)
function solve (line 14) | void solve()
function main (line 59) | int main()
FILE: 2021/Div 3/713/Programs/A-B Palindrome.cpp
function solve (line 7) | void solve()
function main (line 88) | int main()
FILE: 2021/Div 3/713/Programs/Almost Rectangle.cpp
function solve (line 7) | void solve()
function main (line 56) | int main()
FILE: 2021/Div 3/713/Programs/Corrupted Array.cpp
function solve (line 7) | void solve()
function main (line 65) | int main()
FILE: 2021/Div 3/713/Programs/Education.cpp
function ceil (line 6) | long long ceil(long long n, long long d)
function solve (line 16) | void solve()
function main (line 54) | int main()
FILE: 2021/Div 3/713/Programs/Short Task.cpp
function sieve (line 9) | void sieve()
function solve (line 28) | void solve()
function main (line 35) | int main()
FILE: 2021/Div 3/713/Programs/Spy Detected.cpp
function solve (line 7) | void solve()
function main (line 27) | int main()
FILE: 2021/Div 3/744/Programs/Array Optimization by Deque.cpp
function build (line 17) | void build(int n, int left, int right)
function update (line 32) | void update(int n, int left, int right, int position, int value)
function get_sum (line 54) | int get_sum(int n, int left, int right, int query_left, int query_right)
function compress_coordinates (line 73) | void compress_coordinates(int no_of_elements, vector <int> &A)
function solve (line 96) | void solve()
function main (line 125) | int main()
FILE: 2021/Educational Round 109/Programs/Permutation Sort.cpp
function solve (line 7) | void solve()
function main (line 49) | int main()
FILE: 2021/Practice/Programs/Anton and Making Potions.cpp
function main (line 7) | int main()
FILE: 2021/Practice/Programs/Anton and Tree.cpp
function ceil (line 14) | int ceil(int n, int d)
function dfs_component (line 19) | void dfs_component(int v, int parent_v, int component_no)
function get_component_graph_diameter (line 32) | int get_component_graph_diameter(int n)
function main (line 106) | int main()
FILE: 2021/Practice/Programs/Counter Attack.cpp
function dfs (line 13) | void dfs(int v)
function main (line 36) | int main()
FILE: 2021/Practice/Programs/Game of Stones.cpp
function is_bit_set (line 11) | int is_bit_set(long long n, int bit)
function unset (line 16) | long long unset(long long n, int bit)
function get_grundy (line 23) | int get_grundy(int n, long long mask)
function main (line 71) | int main()
FILE: 2021/Practice/Programs/Lost Tree.cpp
function ask (line 6) | void ask(int v, vector <int> &D, int n)
function add_neighbours (line 17) | void add_neighbours(int v, vector <int> &D, vector <vector <int> > &T)
function main (line 28) | int main()
FILE: 2021/Practice/Programs/Maximum Absurdity.cpp
function main (line 6) | int main()
FILE: 2022/Contests/Combined Divisions/CodeTON/Programs/Good Pairs.cpp
function solve (line 6) | void solve()
function main (line 33) | int main()
FILE: 2022/Contests/Combined Divisions/CodeTON/Programs/K-good.cpp
function get_odd_part (line 7) | long long get_odd_part(long long n)
function solve (line 17) | void solve()
function main (line 48) | int main()
FILE: 2022/Contests/Combined Divisions/CodeTON/Programs/Make Equal With Mod.cpp
function solve (line 7) | void solve()
function main (line 45) | int main()
FILE: 2022/Contests/Combined Divisions/CodeTON/Programs/Subtract Operation.cpp
function solve (line 7) | void solve()
function main (line 37) | int main()
FILE: 2022/Contests/Div 2/766/Programs/Not Adding.cpp
function main (line 8) | int main()
FILE: 2022/Contests/Div 2/766/Programs/Not Assigning.cpp
function other (line 8) | int other(int p)
function dfs (line 13) | void dfs(vector < vector <int> > &T, int parent_v, int v, map <pair <int...
function solve (line 34) | void solve()
function main (line 90) | int main()
FILE: 2022/Contests/Div 2/766/Programs/Not Shading.cpp
function solve (line 6) | void solve()
function main (line 63) | int main()
FILE: 2022/Contests/Div 2/766/Programs/Not Sitting.cpp
function solve (line 7) | void solve()
function main (line 34) | int main()
FILE: 2022/Contests/Div 2/767/Programs/Download More RAM.cpp
function solve (line 7) | void solve()
function main (line 37) | int main()
FILE: 2022/Contests/Div 2/767/Programs/GCD Arrays.cpp
function odd_till (line 7) | int odd_till(int n)
function solve (line 12) | void solve()
function main (line 22) | int main()
FILE: 2022/Contests/Div 2/767/Programs/Game On Sum Easy Version.cpp
function power_mod (line 6) | long long power_mod(long long x, long long power, long long m)
function inverse (line 22) | long long inverse(long long x, long long m)
function solve (line 27) | void solve()
function main (line 58) | int main()
FILE: 2022/Contests/Div 2/767/Programs/Game on Sum Hard Version.cpp
function power_mod (line 9) | long long power_mod(long long x, long long power, long long m)
function inverse (line 25) | long long inverse(long long x, long long m)
function precompute (line 30) | void precompute()
function choose (line 45) | long long choose(long long n, long long r)
function solve (line 53) | void solve()
function main (line 88) | int main()
FILE: 2022/Contests/Div 2/767/Programs/Grid XOR.cpp
function get_colour (line 8) | int get_colour(int x, int y)
function is_inside (line 13) | int is_inside(int i, int j, int rows, int columns)
function get_xor_sum (line 18) | int get_xor_sum(vector <vector <int> > &G, int n, int colour)
function solve (line 65) | void solve()
function main (line 83) | int main()
FILE: 2022/Contests/Div 2/767/Programs/Meximum Array.cpp
function solve (line 8) | void solve()
function main (line 75) | int main()
FILE: 2022/Contests/Div 2/767/Programs/Peculiar Movie Preferences.cpp
function is_palindrome (line 9) | int is_palindrome(string &S)
function check_self (line 22) | int check_self(vector <string> &S, int n)
function check_full_concatenation (line 35) | int check_full_concatenation(vector <string> &S, int n)
function check_length_3 (line 54) | int check_length_3(vector <string> &S, int n)
function check_length_4 (line 104) | int check_length_4(vector <string> &S, int n)
function check_length_5 (line 160) | int check_length_5(vector <string> &S, int n)
function solve (line 215) | void solve()
function main (line 236) | int main()
FILE: 2022/Contests/Div 2/777/Programs/Madoka and Math Dad.cpp
function solve (line 6) | void solve()
function main (line 33) | int main()
FILE: 2022/Contests/Div 2/777/Programs/Makoda and Childish Pranks.cpp
type rectangle (line 10) | struct rectangle
method rectangle (line 14) | rectangle(int X1, int Y1, int X2, int Y2)
function solve (line 23) | void solve()
function main (line 66) | int main()
FILE: 2022/Contests/Div 2/778/Programs/Alice and the Cake.cpp
function solve (line 8) | void solve()
function main (line 56) | int main()
FILE: 2022/Contests/Div 2/778/Programs/Maximum Cake Tastiness.cpp
function solve (line 7) | void solve()
function main (line 25) | int main()
FILE: 2022/Contests/Div 2/778/Programs/Prefix Removals.cpp
function solve (line 7) | void solve()
function main (line 40) | int main()
FILE: 2022/Contests/Div 2/789/Programs/Tokitsukaze and Good 01-String (easy version).cpp
function flip (line 8) | char flip(char ch)
function solve (line 13) | void solve()
function main (line 47) | int main()
FILE: 2022/Contests/Div 2/789/Programs/Tokitsukaze and Strange Inequality.cpp
function solve (line 11) | void solve()
function main (line 65) | int main()
FILE: 2022/Contests/Div 2/792/Programs/AvtoBus.cpp
function solve (line 6) | void solve()
function main (line 35) | int main()
FILE: 2022/Contests/Div 2/792/Programs/Rooks Defenders.cpp
function update (line 13) | void update(int n, int left, int right, int index, int value, int tree_i...
function get_sum (line 35) | int get_sum(int n, int left, int right, int query_left, int query_right,...
function main (line 54) | int main()
FILE: 2022/Contests/Div 2/792/Programs/Stone Age Problem.cpp
function main (line 6) | int main()
FILE: 2022/Contests/Div 2/809/Programs/Qpwoeirut And The City.cpp
function solve (line 8) | void solve()
function main (line 64) | int main()
FILE: 2022/Contests/Div 3/828/Programs/Divisibility by 2^n.cpp
function power_2 (line 9) | int power_2(int n)
function solve (line 22) | void solve()
function main (line 59) | int main()
FILE: 2022/Contests/Div 3/828/Programs/Divisible Numbers Easy Version.cpp
function solve (line 8) | void solve()
function main (line 36) | int main()
FILE: 2022/Contests/Div 3/828/Programs/Even-Odd Increments.cpp
function solve (line 8) | void solve()
function main (line 82) | int main()
FILE: 2022/Contests/Div 3/828/Programs/Number Replacement.cpp
function solve (line 8) | void solve()
function main (line 41) | int main()
FILE: 2022/Contests/Div 3/828/Programs/Traffic Light.cpp
function solve (line 8) | void solve()
function main (line 56) | int main()
FILE: 2022/Contests/Educational Round 125/Programs/Bracket Sequence Deletion.cpp
function solve (line 7) | void solve()
function main (line 44) | int main()
FILE: 2022/Contests/Educational Round 125/Programs/By Gamers For Gamers.cpp
function main (line 8) | int main()
FILE: 2022/Contests/Educational Round 125/Programs/Integer Moves.cpp
function is_square (line 5) | int is_square(int n)
function solve (line 18) | void solve()
function main (line 40) | int main()
FILE: 2022/Contests/Educational Round 125/Programs/XY Sequence.cpp
function solve (line 6) | void solve()
function main (line 30) | int main()
FILE: 2022/Contests/Educational Rounds/Educational Round 127/Programs/Consecutive Points Segment.cpp
function is_possible (line 7) | int is_possible(vector <int> &A, int n)
function solve (line 20) | void solve()
function main (line 43) | int main()
FILE: 2022/Contests/Educational Rounds/Educational Round 127/Programs/Dolce Vita.cpp
function solve (line 7) | void solve()
function main (line 63) | int main()
FILE: 2022/Contests/Educational Rounds/Educational Round 127/Programs/Insert a Progression.cpp
function solve (line 7) | void solve()
function main (line 55) | int main()
FILE: 2022/Contests/Educational Rounds/Educational Round 127/Programs/String Building.cpp
function solve (line 5) | void solve()
function main (line 42) | int main()
FILE: 2023/Contests/Div 2/810/Programs/XOR Triangle.cpp
function is_bit_set (line 10) | int is_bit_set(int n, int bit)
function main (line 15) | int main()
FILE: 2023/Contests/Div 2/857/Programs/Buying Gifts.cpp
function solve (line 8) | void solve()
function main (line 82) | int main()
FILE: 2023/Contests/Div 2/857/Programs/Likes.cpp
function solve (line 6) | void solve()
function main (line 65) | int main()
FILE: 2023/Contests/Div 2/857/Programs/Settlement of Guinea Pigs.cpp
function solve (line 6) | void solve()
function main (line 62) | int main()
FILE: 2023/Contests/Div 2/857/Programs/The Very Beautiful Blanket.cpp
function solve (line 7) | void solve()
function main (line 43) | int main()
FILE: C Programs/C Programs - 1/Bear_and_Big_Brother.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 1/Beautiful_Matrix.c
function main (line 10) | int main()
function read_matrix (line 20) | void read_matrix(short matrix[][NO_OF_COLUMNS], short *row_of_1, short *...
function find_no_of_moves_to_centralise_1 (line 39) | short find_no_of_moves_to_centralise_1(short no_of_rows, short no_of_col...
FILE: C Programs/C Programs - 1/Boy_or_Girl.c
function main (line 13) | int main()
function check_if_username_is_female (line 26) | short check_if_username_is_female(char username[])
function prepare_advisory_message (line 57) | void prepare_advisory_message(char message_of_advice[], short is_a_girl)
FILE: C Programs/C Programs - 1/Complicated_GCD.c
function main (line 6) | int main()
FILE: C Programs/C Programs - 1/Compote.c
function main (line 4) | int main()
function min (line 21) | unsigned int min(unsigned int a, unsigned int b, unsigned int c)
FILE: C Programs/C Programs - 1/Dasha_and_Stairs.c
function main (line 5) | int main()
FILE: C Programs/C Programs - 1/Elephant.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 1/Even_Odds.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 1/Fancy_Fence.c
function main (line 6) | int main()
function check_if_regular_polygon_exists (line 27) | void check_if_regular_polygon_exists(int angle, char answers[][ANSWER_SI...
FILE: C Programs/C Programs - 1/Holiday_of_Equality.c
function main (line 7) | int main()
function find_maximum_wealth (line 27) | unsigned int find_maximum_wealth(unsigned int *wealth_of_citizen, short ...
function sum_of_amount_given_to_everyone (line 43) | unsigned int sum_of_amount_given_to_everyone(unsigned int *wealth_of_cit...
FILE: C Programs/C Programs - 1/I_Love_Username.c
function main (line 5) | int main()
function find_no_of_amazing_performances (line 25) | short find_no_of_amazing_performances(unsigned int *coder_score_list,sho...
FILE: C Programs/C Programs - 1/Ilya_Bank_Account.c
function main (line 8) | int main()
function copy_part_of_string (line 50) | void copy_part_of_string(char destination[], char source[], int start_in...
FILE: C Programs/C Programs - 1/Little_Elephant_Rozdil.c
function main (line 7) | int main()
function read_time_taken_to_each_city (line 30) | void read_time_taken_to_each_city(unsigned int no_of_cities,unsigned lon...
function find_which_city_elephant_goes_to (line 40) | void find_which_city_elephant_goes_to(unsigned int no_of_cities,unsigned...
FILE: C Programs/C Programs - 1/Lucky_Division.c
function main (line 10) | int main()
function check_if_num_is_lucky (line 30) | short check_if_num_is_lucky(unsigned int num)
function check_if_num_is_almost_lucky (line 45) | short check_if_num_is_almost_lucky(unsigned int num)
FILE: C Programs/C Programs - 1/Memory_and_Crow.c
function main (line 7) | int main()
function get_crow_answer (line 25) | void get_crow_answer(long *crow_answer, long no_of_numbers)
function get_original_series (line 35) | void get_original_series(long *crow_answer, long *original_series, long ...
function display_original_series (line 47) | void display_original_series(long *original_series, long no_of_numbers)
FILE: C Programs/C Programs - 1/Nearly_Lucky_Number.c
function main (line 8) | int main()
function check_if_nearly_lucky (line 28) | short check_if_nearly_lucky(char number[])
FILE: C Programs/C Programs - 1/Opponents.c
function main (line 14) | int main()
function make_list_of_aryan_wins (line 41) | void make_list_of_aryan_wins(char opponent_schedule[][100],short *aryan_...
function check_if_aryan_wins_on_a_day (line 60) | short check_if_aryan_wins_on_a_day(char one_day_opponent_list[], short n...
function count_no_of_wins_after_last_defeat (line 77) | void count_no_of_wins_after_last_defeat(short *consecutive_wins_after_la...
function find_maximum_consecutive_wins (line 95) | short find_maximum_consecutive_wins(short *consecutive_wins_after_last_d...
FILE: C Programs/C Programs - 1/Petr_and_Calendar.c
function main (line 6) | int main()
function find_no_of_calendar_columns (line 19) | short find_no_of_calendar_columns(short starting_day, short no_of_days_i...
function find_no_of_days_in (line 36) | short find_no_of_days_in(short month_no)
FILE: C Programs/C Programs - 1/Shell_Game.c
function main (line 4) | int main()
function find_initial_position (line 28) | short find_initial_position(short current_ball_position, short turn_no)
FILE: C Programs/C Programs - 1/Sherlock_New_Girlfriend.c
function main (line 10) | int main()
function initial_marking (line 42) | void initial_marking(unsigned int size, short array[], short initial_value)
function sunduram_sieve (line 53) | void sunduram_sieve(unsigned int target, short is_prime[])
function make_prime_list (line 89) | void make_prime_list(unsigned int target, short is_prime[],short auxilia...
FILE: C Programs/C Programs - 1/Taymr_is_Calling_You.c
function main (line 4) | int main()
function gcd (line 20) | unsigned int gcd(unsigned int u,unsigned int v)
FILE: C Programs/C Programs - 1/The_Wall.c
function main (line 4) | int main()
function gcd (line 19) | unsigned int gcd(unsigned int u,unsigned int v)
FILE: C Programs/C Programs - 1/Translation.c
function main (line 9) | int main()
FILE: C Programs/C Programs - 1/Vitya_in_the_Countryside.c
function main (line 5) | int main()
FILE: C Programs/C Programs - 1/Vladik_and_Flights.c
function main (line 4) | int main()
FILE: C Programs/C Programs - 2/A_and_B_Chess.c
function main (line 10) | int main()
function read_chessboard (line 24) | void read_chessboard(char chessboard[][NO_OF_ROWS + 1])
function find_strength_of_colour (line 35) | void find_strength_of_colour(short *white_strength, short *black_strengt...
function find_the_weight (line 60) | short find_the_weight(char chess_piece)
function determine_stronger_colour (line 86) | void determine_stronger_colour(short white_strength, short black_strengt...
FILE: C Programs/C Programs - 2/Again_Twenty_Five.c
function main (line 4) | int main()
FILE: C Programs/C Programs - 2/Anton_and_Danik.c
function main (line 6) | int main()
function find_who_won_more (line 33) | short find_who_won_more(char *results, unsigned int no_of_games)
FILE: C Programs/C Programs - 2/Bachgold_Problem.c
function main (line 8) | int main()
function get_prime_series_sum_to_n (line 26) | void get_prime_series_sum_to_n(short *prime_series_sum_n, unsigned int n)
function display_prime_series_that_sums_to_n (line 41) | void display_prime_series_that_sums_to_n(short *prime_series_sum_n, unsi...
function fill_with_2 (line 51) | void fill_with_2(short *prime_series_sum_n, short start, unsigned int no...
FILE: C Programs/C Programs - 2/Bit++.c
function main (line 5) | int main()
function read_and_execute_program (line 16) | int read_and_execute_program(unsigned int lines_of_code)
FILE: C Programs/C Programs - 2/Buy_a_Shovel.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 2/Chat_Room.c
function main (line 8) | int main()
function is_hello_there (line 27) | short is_hello_there(char message[])
FILE: C Programs/C Programs - 2/Chips.c
function main (line 5) | int main()
function find_no_of_chips_at_end (line 17) | short find_no_of_chips_at_end(short no_of_walruses, unsigned int no_of_c...
FILE: C Programs/C Programs - 2/Cinema_Line.c
function main (line 10) | int main()
function read_money_with_each_person (line 34) | void read_money_with_each_person(unsigned int no_of_people, unsigned int...
function check_if_clerk_always_has_change (line 44) | short check_if_clerk_always_has_change(unsigned int no_of_people, unsign...
FILE: C Programs/C Programs - 2/Domino_Piling.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 2/Drazil_and_Date.c
function main (line 7) | int main()
function check_if_possible (line 33) | short check_if_possible(long x_coordinate,long y_coordinate,unsigned lo...
FILE: C Programs/C Programs - 2/George_and_Accomodation.c
function main (line 7) | int main()
function get_room_details (line 26) | void get_room_details(short *no_of_room_occupants, short *capacity_room,...
function find_no_of_accomodating_rooms (line 36) | short find_no_of_accomodating_rooms(short *no_of_room_occupants, short *...
FILE: C Programs/C Programs - 2/Gravity_Flip.c
function main (line 8) | int main()
function read (line 24) | void read(short *blocks, short no_of_columns)
function display (line 34) | void display(short *blocks, short no_of_columns)
function selection_sort (line 44) | void selection_sort(short *blocks, short no_of_columns)
FILE: C Programs/C Programs - 2/Infinite_Sequence.c
function main (line 8) | int main()
function check_if_term_falls_in_sequence (line 27) | short check_if_term_falls_in_sequence(long first_term,long term_to_be_ch...
FILE: C Programs/C Programs - 2/Interview_with_Oleg.c
function main (line 13) | int main()
function remove_filler_from_interview (line 33) | void remove_filler_from_interview(char *interview, char *interview_witho...
function find_filler_length_from_here (line 60) | short find_filler_length_from_here(char *interview, short i)
function search_for_additional_filler (line 94) | short search_for_additional_filler(char *interview, short here)
FILE: C Programs/C Programs - 2/Pasha_and_Stick.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 2/Pineapple_Incident.c
function main (line 8) | int main()
function check_if_pineapple_barks (line 27) | short check_if_pineapple_barks(unsigned long first_bark_time,unsigned lo...
FILE: C Programs/C Programs - 2/Serial_Killer.c
function main (line 5) | int main()
FILE: C Programs/C Programs - 2/Soldier_and_Bananas.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 2/Spider_Man.c
function main (line 8) | int main()
function make_winner_list (line 30) | void make_winner_list(short *winner, unsigned int *no_of_vertices,unsig...
function read (line 48) | void read(unsigned int *no_of_vertices, unsigned int no_of_tests)
function display (line 58) | void display(short *winner, unsigned int no_of_tests)
FILE: C Programs/C Programs - 2/Stones_on_a_Table.c
function main (line 5) | int main()
function find_minimum_stones_to_be_removed (line 20) | short find_minimum_stones_to_be_removed(char *colour_of_stones)
FILE: C Programs/C Programs - 2/Transform_A_to_B.c
function main (line 7) | int main()
function find_path (line 31) | void find_path(unsigned long start_number,unsigned long end_number,short...
function display_path_of_numbers (line 56) | void display_path_of_numbers(unsigned long path_of_numbers[], short no_o...
FILE: C Programs/C Programs - 2/Triangular_Numbers.c
function main (line 7) | int main()
function check_if_triangular (line 26) | short check_if_triangular(unsigned int num)
FILE: C Programs/C Programs - 2/Watermelon.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 2/Word_Capitalisation.c
function main (line 4) | int main()
FILE: C Programs/C Programs - 3/Anton_and_Polyhedron.c
function main (line 7) | int main()
function read_faces_of_polyhedara (line 21) | void read_faces_of_polyhedara(short *polyhedra_face, unsigned int no_of_...
function get_total_number_of_faces (line 53) | unsigned int get_total_number_of_faces(short *polyhedra_face, unsigned i...
FILE: C Programs/C Programs - 3/Calculating_Function.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 3/Cheap_Travel.c
function main (line 4) | int main()
function find_minimum_cost (line 16) | unsigned int find_minimum_cost(unsigned int no_of_rides, unsigned int sp...
FILE: C Programs/C Programs - 3/Checking_the_Calendar.c
function main (line 11) | int main()
function check_if_consecutive_months_start_with (line 30) | short check_if_consecutive_months_start_with(char day_1[], char day_2[])
function get_day_no (line 51) | short get_day_no(char day[])
FILE: C Programs/C Programs - 3/Currency_System_in_Geraldion.c
function main (line 10) | int main()
function read (line 35) | void read(unsigned int *currency_notes, unsigned int no_of_denominations)
function search_for_1 (line 45) | short search_for_1(unsigned int *currency_notes, unsigned int no_of_deno...
FILE: C Programs/C Programs - 3/Die_Roll.c
function main (line 4) | int main()
function maximum (line 27) | short maximum(short a, short b)
FILE: C Programs/C Programs - 3/Domino_Effect.c
function main (line 5) | int main()
function find_no_of_standing_dominos (line 42) | int find_no_of_standing_dominos(char *domino_line)
FILE: C Programs/C Programs - 3/Expression.c
function main (line 6) | int main()
function find_maximum_value (line 18) | unsigned int find_maximum_value(short a, short b, short c)
function maximum (line 31) | unsigned int maximum(unsigned int a, unsigned int b)
FILE: C Programs/C Programs - 3/Fedya_and_Maths.c
function main (line 6) | int main()
function get_answer (line 22) | short get_answer(short second_last_digit, short last_digit)
FILE: C Programs/C Programs - 3/Filya_and_Homework.c
function main (line 12) | int main()
function count_no_of_distinct_elements (line 44) | short count_no_of_distinct_elements(unsigned long *list_of_numbers,unsig...
function check_if_set_is_in_AP (line 73) | short check_if_set_is_in_AP(unsigned long distinct_element[], short dist...
function get_answer (line 92) | void get_answer(char answer[], short is_possible)
FILE: C Programs/C Programs - 3/Game.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 3/Initial_Bet.c
function main (line 4) | int main()
FILE: C Programs/C Programs - 3/LCM_Challenge.c
function main (line 4) | int main()
FILE: C Programs/C Programs - 3/Maximum_Increase.c
function main (line 7) | int main()
function read (line 22) | void read(unsigned long *number_sequence, unsigned int no_of_numbers)
function find_length_max_increasing_subsequence (line 32) | unsigned int find_length_max_increasing_subsequence(unsigned long *numbe...
FILE: C Programs/C Programs - 3/Mishka_and_Game.c
function main (line 6) | int main()
function read_results (line 36) | void read_results(short *mishka_results, short *chris_results, short no_...
function find_who_won_more (line 45) | short find_who_won_more(short *mishka_results, short *chris_results, sho...
FILE: C Programs/C Programs - 3/Multiplication_Table.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 3/Next_Round.c
function main (line 7) | int main()
function read (line 22) | void read(short *score, short no_of_players)
function find_no_of_winners (line 32) | short find_no_of_winners(short *score, short no_of_players, short winnin...
FILE: C Programs/C Programs - 3/Party.c
function main (line 12) | int main()
function read (line 32) | void read(int *immediate_manager, unsigned int no_of_people)
function find_depth_of_employee (line 46) | unsigned int find_depth_of_employee(int current_person, int *immediate_m...
function find_depths_of_all_employees (line 61) | void find_depths_of_all_employees(int *depth_of_employee, int *immediate...
function find_no_of_groups (line 89) | unsigned int find_no_of_groups(int *depth_of_employee, unsigned int no_o...
FILE: C Programs/C Programs - 3/Police_Recruits.c
function main (line 7) | int main()
function read (line 23) | void read(short *events, int no_of_events)
function find_no_untreated_crimes (line 33) | int find_no_untreated_crimes(short *events, int no_of_events)
FILE: C Programs/C Programs - 3/Raising_Bacteria.c
function main (line 10) | int main()
function find_no_of_1_in_binary (line 22) | unsigned long long find_no_of_1_in_binary(unsigned long long target_bact...
FILE: C Programs/C Programs - 3/Save_Luke.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 3/Taxes.c
function main (line 9) | int main()
function is_prime (line 20) | short is_prime(unsigned long n)
function find_minimum_tax (line 48) | short find_minimum_tax(unsigned long tax)
FILE: C Programs/C Programs - 3/Tennis_Tournament.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 3/The_Number_of_Positions.c
function main (line 4) | int main()
function minimum (line 18) | unsigned int minimum(unsigned int a, unsigned int b)
FILE: C Programs/C Programs - 3/Theatre_Square.c
function main (line 4) | int main()
FILE: C Programs/C Programs - 4/Aloyna_Numbers.c
function main (line 4) | int main()
function count_pairs_multiple_5 (line 13) | unsigned long long count_pairs_multiple_5(unsigned long long m, unsigned...
FILE: C Programs/C Programs - 4/Arpa_Hard_Problem_Mehrad_Naive_Cheat.c
function main (line 4) | int main()
function get_last_digit (line 15) | short get_last_digit(unsigned long power)
FILE: C Programs/C Programs - 4/Benches.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 4/Challenge_Pendants.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 4/Chewbacca_and_Number.c
function main (line 5) | int main()
function transform_n_to_minimum (line 14) | void transform_n_to_minimum(char number[])
FILE: C Programs/C Programs - 4/Chocolate.c
function main (line 11) | int main()
function read (line 28) | void read(short *chocolate, short no_of_pieces)
function check_if_divison_exists (line 38) | short check_if_divison_exists(short *chocolate, short no_of_pieces)
function find_no_of_divisions (line 53) | long long find_no_of_divisions(short *chocolate, short no_of_pieces)
FILE: C Programs/C Programs - 4/Design_Tutorial_Learn_From_Math.c
function main (line 4) | int main()
function get_composite_summands (line 14) | void get_composite_summands(unsigned long number, unsigned long *composi...
FILE: C Programs/C Programs - 4/Divisibility.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 4/Fedor_and_New_Game.c
function main (line 13) | int main()
function read (line 30) | void read(int *army, int no_of_soldiers)
function find_maximum_number_of_friends (line 40) | int find_maximum_number_of_friends(int *army, int no_of_soldiers,int max...
function population_count (line 55) | int population_count(int x)
FILE: C Programs/C Programs - 4/Game_test.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 4/Hexagons.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 4/Hulk.c
function main (line 5) | int main()
function get_final_emotions (line 16) | void get_final_emotions(char emotions[], short no_of_layers)
FILE: C Programs/C Programs - 4/Indivisibility.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 4/Interview.c
function main (line 7) | int main()
function read (line 27) | void read(unsigned long *list_1, unsigned long *list_2, unsigned int no_...
function get_maximum (line 42) | unsigned long get_maximum(unsigned long *list_1, unsigned long *list_2, ...
FILE: C Programs/C Programs - 4/King_Moves.c
function main (line 4) | int main()
function count_no_of_legal_king_moves (line 16) | short count_no_of_legal_king_moves(char king_position[])
FILE: C Programs/C Programs - 4/Lineland_Mail.c
function main (line 11) | int main()
function read (line 32) | void read(long *city, unsigned int no_of_cities)
function display (line 42) | void display(long *minimum, long *maximum, unsigned int no_of_cities)
function get_minimum (line 52) | void get_minimum(long *minimum, long *city, unsigned int no_of_cities)
function min (line 65) | long min(long a, long b)
function max (line 73) | long max(long a, long b)
function get_maximum (line 81) | void get_maximum(long *maximum, long *city, unsigned int no_of_cities)
FILE: C Programs/C Programs - 4/Lucky_Numbers.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 4/PolandBall_and_Hypothesis.c
function main (line 4) | int main()
function find_counterexample (line 13) | int find_counterexample(int n)
FILE: C Programs/C Programs - 4/Professor_Gukiz_Robot.c
function main (line 6) | int main()
function maximum (line 20) | long maximum(long a, long b)
FILE: C Programs/C Programs - 4/Random_Teams.c
function main (line 5) | int main()
function find_minimum (line 29) | unsigned long long find_minimum(unsigned long long no_of_people,unsigned...
function find_maximum (line 42) | unsigned long long find_maximum(unsigned long long no_of_people,unsigned...
FILE: C Programs/C Programs - 4/Reconnaissance_2.c
function main (line 6) | int main()
function get_difference_of_consecutive_soldiers (line 38) | void get_difference_of_consecutive_soldiers(unsigned int *heights_of_sol...
function get_position_of_first_reconnaisance_soldier (line 49) | short get_position_of_first_reconnaisance_soldier(unsigned int *consecut...
FILE: C Programs/C Programs - 4/Selection_of_Personnel.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 4/Tetrahedron.c
function main (line 6) | int main()
function find_no_of_cycles (line 15) | unsigned long long find_no_of_cycles(unsigned long long no_of_moves)
FILE: C Programs/C Programs - 4/Vasya_and_Petya_Game.c
function main (line 8) | int main()
function display (line 22) | void display(unsigned int *question_sequence, unsigned int no_of_questions)
function get_question_sequence (line 33) | void get_question_sequence(unsigned int *question_sequence, unsigned int...
function sundaram_sieve (line 58) | void sundaram_sieve(unsigned int *primes, unsigned int target, unsigned ...
FILE: C Programs/C Programs - 4/Way_Too_Long_Words.c
function main (line 4) | int main()
FILE: C Programs/C Programs - 5/Bear_and_Poker.c
function main (line 11) | int main()
function is_possible (line 25) | short is_possible(int *bid, int no_of_players)
function reduce_bid (line 36) | void reduce_bid(int *bid, int no_of_players)
function read (line 52) | void read(int *bid, int no_of_players)
FILE: C Programs/C Programs - 5/Boredom.c
function main (line 9) | int main()
function find_maximum_score (line 21) | long long find_maximum_score(int frequency[],int max_in_array)
function read_frequency (line 42) | void read_frequency(int frequency[], int no_of_numbers, int *max_in_array)
function max (line 54) | long long max(long long a, long long b)
FILE: C Programs/C Programs - 5/Cut_Ribbon.c
function main (line 7) | int main()
function find_maximum_number_of_pieces (line 18) | int find_maximum_number_of_pieces(int total_length, int a, int b, int c)
function max (line 46) | int max(int a, int b)
FILE: C Programs/C Programs - 5/Display_Size.c
function main (line 4) | int main()
FILE: C Programs/C Programs - 5/Duff_in_Love.c
function main (line 3) | int main()
function find_product_all_prime_factors (line 12) | unsigned long long find_product_all_prime_factors(unsigned long long n)
FILE: C Programs/C Programs - 5/Flipping_Game.c
function main (line 9) | int main()
function read (line 26) | void read(short *gain, short no_of_numbers)
function find_maximum_number_of_ones_after_move (line 40) | short find_maximum_number_of_ones_after_move(short *gain, short no_of_nu...
function greatest_continuous_sum (line 58) | short greatest_continuous_sum(short *gain, short no_of_numbers)
function max (line 71) | int max(int a, int b)
FILE: C Programs/C Programs - 5/Flowers.cpp
function count (line 5) | void count(vector <int> &no_of_ways, int group, int LIMIT)
function main (line 19) | int main()
FILE: C Programs/C Programs - 5/Fox_and_Dividing_Cheese.c
function main (line 5) | int main()
function find_common_power (line 20) | int find_common_power(int *piece_1, int *piece_2, int prime)
FILE: C Programs/C Programs - 5/Hungry_Sequence.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 5/K_Interesting_Pair_of_Integers.c
function main (line 9) | int main()
function build_population_count (line 25) | void build_population_count(unsigned int population_count[])
function count_k_interesting_pairs (line 47) | unsigned long long count_k_interesting_pairs(int count[],int k, unsigned...
function read_and_find_frequency (line 80) | void read_and_find_frequency(int count[], unsigned int no_of_elements)
FILE: C Programs/C Programs - 5/Kefa_and_First_Step.c
function main (line 8) | int main()
function find_length_longest_non_decreasing_streak (line 23) | unsigned int find_length_longest_non_decreasing_streak(unsigned long *mo...
function read (line 38) | void read(unsigned long *money_made, unsigned int no_of_days)
function max (line 48) | unsigned long max(unsigned long a, unsigned long b)
FILE: C Programs/C Programs - 5/Making_a_String.c
function main (line 9) | int main()
function find_longest_string (line 26) | long long find_longest_string(long long*occurence_of_letter, short no_of...
function min (line 41) | long long min(long long a, long long b)
function read (line 49) | void read(long long*occurence_of_letter, short no_of_letters)
function selection_sort_descending (line 59) | void selection_sort_descending(long long*occurence_of_letter, short no_o...
FILE: C Programs/C Programs - 5/Non_Square_Equation.c
function main (line 7) | int main()
function find_solution (line 18) | long long find_solution(long long n)
function sum_of_digits (line 38) | int sum_of_digits(long long num)
FILE: C Programs/C Programs - 5/Odd_Sum.c
function main (line 7) | int main()
function find_longest_subsequence_odd_sum (line 17) | int find_longest_subsequence_odd_sum(int no_of_elements)
function abs (line 47) | int abs(int a)
FILE: C Programs/C Programs - 5/Parking_Lot.c
function main (line 3) | int main()
function power (line 15) | unsigned long long power(unsigned long long base, unsigned long long exp...
FILE: C Programs/C Programs - 5/Perfect_Permutation.c
function main (line 3) | int main()
function display_perfect_permutation (line 22) | void display_perfect_permutation(unsigned int no_of_elements)
FILE: C Programs/C Programs - 5/Preparing_for_Olympiad.c
function main (line 8) | int main()
function count_no_of_problem_sets (line 24) | long count_no_of_problem_sets(long *problem_difficulty, int no_of_proble...
function read (line 67) | void read(long *problem_difficulty, int no_of_problems)
function min (line 76) | long min(long a, long b)
function max (line 83) | long max(long a, long b)
FILE: C Programs/C Programs - 5/Star.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 5/Table_Tennis_Game_2.c
function main (line 5) | int main()
function find_no_of_sets (line 15) | long find_no_of_sets(unsigned long no_of_points_in_a_set,unsigned long m...
FILE: C Programs/C Programs - 5/Tavas_and_Saddas.c
function main (line 5) | int main()
function get_index (line 18) | unsigned int get_index(char lucky_number[])
FILE: C Programs/C Programs - 5/Team.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 5/Tetrahedron_Efficiently.c
function main (line 9) | int main()
function find_no_of_cycles (line 19) | unsigned long long find_no_of_cycles(int no_of_moves)
function raise_matrix_power (line 41) | void raise_matrix_power(unsigned long long matrix[][2], int exponent)
function multiply (line 62) | void multiply(unsigned long long matrix_1[][2], unsigned long long matri...
function copy (line 83) | void copy(unsigned long long matrix_1[][2], unsigned long long matrix_2[...
FILE: C Programs/C Programs - 5/Tricky_Sum.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 5/Vacations.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 5/Vanya_and_Table.c
function main (line 3) | int main()
function count_cells_covered (line 12) | unsigned int count_cells_covered(unsigned int no_of_rectangles)
FILE: C Programs/C Programs - 6/A_Shell_Game.c
function main (line 4) | int main()
FILE: C Programs/C Programs - 6/Accounting.c
function main (line 7) | int main()
function find_coefficient_of_income (line 24) | int find_coefficient_of_income(int money_at_beginning,int money_at_end, ...
function power (line 62) | int power(int x,int n)
FILE: C Programs/C Programs - 6/Anton_and_Digits.c
function main (line 6) | int main()
FILE: C Programs/C Programs - 6/Black_Square.c
function main (line 4) | int main()
FILE: C Programs/C Programs - 6/Dinner_with_Emma.c
function main (line 6) | int main()
FILE: C Programs/C Programs - 6/Ebony_and_Ivory.c
function main (line 7) | int main()
FILE: C Programs/C Programs - 6/Find Amir.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 6/Game_with_Sticks.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 6/Increasing_Sequence.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 6/Insomnia_Cure.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 6/Jumping_Ball.c
function main (line 5) | int main()
function find_eventually_falling_bumpers (line 20) | int find_eventually_falling_bumpers(char *bumpers, int no_of_bumpers)
FILE: C Programs/C Programs - 6/K_Tree.c
function main (line 5) | int main()
function calculate_no_of_paths (line 15) | unsigned long calculate_no_of_paths(short sum, short no_of_children, sho...
FILE: C Programs/C Programs - 6/Lovely_Palindromes.c
function main (line 6) | int main()
FILE: C Programs/C Programs - 6/Luxurious_Buildings.c
function main (line 10) | int main()
function make_every_building_luxurious (line 26) | void make_every_building_luxurious(int *no_of_floors, int *no_of_floors_...
function read (line 38) | void read(int *no_of_floors, int no_of_buildings)
function display (line 47) | void display(int *no_of_floors_to_be_added, int no_of_buildings)
FILE: C Programs/C Programs - 6/Meeting_of_Old_Friends.c
function main (line 5) | int main()
FILE: C Programs/C Programs - 6/Oleg_and_Shares.c
function main (line 10) | int main()
function find_no_of_days_equalise_shares (line 25) | long long find_no_of_days_equalise_shares(int *share, int no_of_shares,i...
function read_and_find_minimum (line 45) | int read_and_find_minimum(int *share, int no_of_shares)
FILE: C Programs/C Programs - 6/Patrick_and_Shopping.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 6/Plate_Game.c
function main (line 4) | int main()
FILE: C Programs/C Programs - 6/Rewards.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 6/Round_House.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 6/System_of_Equations.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 6/Vanya_and_Fence.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 6/Vanya_and_Lanterns.c
function main (line 10) | int main()
function find_maximum_radius (line 27) | float find_maximum_radius(int *lantern_position, int no_of_lanterns, int...
function read (line 43) | void read(int *lantern_position, int no_of_lanterns)
function selection_sort (line 53) | void selection_sort(int *lantern_position, int no_of_lanterns)
FILE: C Programs/C Programs - 6/Vasya_and_Hipster.c
function main (line 5) | int main()
FILE: C Programs/C Programs - 6/Wizard_Duel.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 7/3_Palindrome.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 7/Alena_Schedule.c
function main (line 6) | int main()
FILE: C Programs/C Programs - 7/Alice_and_Bob.c
function find_gcd (line 6) | int find_gcd(int a, int b)
function main (line 26) | int main()
FILE: C Programs/C Programs - 7/An_Abandoned_Sentiment_From_Past.c
function main (line 7) | int main()
FILE: C Programs/C Programs - 7/Andrushya_and_Socks.c
function main (line 7) | int main()
FILE: C Programs/C Programs - 7/Combination Lock.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs - 7/Devu_Singer_Charu_Joker.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 7/Fake_NP.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 7/Fence.c
function main (line 6) | int main()
FILE: C Programs/C Programs - 7/Find_Marble.c
function main (line 4) | int main()
FILE: C Programs/C Programs - 7/Free Ice Cream.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs - 7/Hexadecimal's Theorem Alternate Solution.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs - 7/Hexadecimal's Theorem.cpp
function precompute_fibonacci (line 9) | void precompute_fibonacci()
function main (line 20) | int main()
FILE: C Programs/C Programs - 7/IQ_Test.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 7/Magnets.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 7/Mahmod_Longest_Uncommon_Subsequence.c
function main (line 6) | int main()
FILE: C Programs/C Programs - 7/Monster_and_Squirrel.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 7/New Year Transportation.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs - 7/Optimal_Point_on_a_Line.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs - 7/Pashmak_and_Flowers.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 7/Potions_Homework.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs - 7/Pythagorean Triples.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs - 7/Red_Blue_Balls.c
function main (line 4) | int main()
FILE: C Programs/C Programs - 7/The_Contest.c
function main (line 5) | int main()
FILE: C Programs/C Programs - 7/Young_Physicist.c
function main (line 3) | int main()
FILE: C Programs/C Programs - 8/A and B Team Training.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs - 8/Almost Prime.cpp
function precompute_primes (line 8) | void precompute_primes()
function main (line 29) | int main()
FILE: C Programs/C Programs - 8/Brian's Photos.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs - 8/Caisa and Pylons.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs - 8/Choosing Teams.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs - 8/Ciel and Flowers.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs - 8/Diverse Permutation.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs - 8/HQ9+.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs - 8/Hexadecimal's Numbers.cpp
function corresponding_decimal (line 3) | int corresponding_decimal(int bitmask)
function main (line 16) | int main()
FILE: C Programs/C Programs - 8/Infinite Sequence.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs - 8/Jzzhu and Sequences.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs - 8/K-Factorisation.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs - 8/Noldbach Problem.cpp
function precompute_noldbach (line 9) | void precompute_noldbach()
function main (line 34) | int main()
FILE: C Programs/C Programs - 8/Olesya and Rodion.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs - 8/Petr and Book.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs - 8/Petya and Strings.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs - 8/Sum of Digits.cpp
function find_digit_sum (line 5) | int find_digit_sum(int n)
function main (line 17) | int main()
FILE: C Programs/C Programs - 8/T Primes Alternate Solution.cpp
function precompute_prime_squares (line 9) | void precompute_prime_squares()
function main (line 20) | int main()
FILE: C Programs/C Programs - 8/T-Primes.cpp
function precompute_prime_squares (line 9) | void precompute_prime_squares()
function main (line 25) | int main()
FILE: C Programs/C Programs - 8/The Golden Age.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs - 8/Two Bags of Potatos.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs - 8/Vanya and Cards.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs - 8/Vitaly and Night.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs - 8/Wet Shark and Odd and Even.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs - 8/Yaroslav and Permutations.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs - 9/Alyona and Copybooks.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs - 9/Appleman and Toastman.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs - 9/Array.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs - 9/Bear and Five Cards.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs - 9/Bus to Udayland.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs - 9/Case of the Zeroes and Ones.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs - 9/Circle Line.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs - 9/Crazy Computer.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs - 9/Crossword Solving.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs - 9/Divisibility.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs - 9/Fox and Number Game.cpp
function gcd (line 6) | int gcd(int a, int b)
function main (line 14) | int main()
FILE: C Programs/C Programs - 9/Haiku.cpp
function is_vowel (line 5) | bool is_vowel(char ch)
function main (line 20) | int main()
FILE: C Programs/C Programs - 9/I'm Bored with Life.cpp
function factorial (line 5) | int factorial(int n)
function main (line 18) | int main()
FILE: C Programs/C Programs - 9/Is your Horseshoe on the other hoof.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs - 9/Kitahara Haruki's Gift.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs - 9/Little Elephant and Function.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs - 9/Little Elephant and Problem.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs - 9/New Year and Days.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs - 9/One Dimensional Japanese Crossword.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs - 9/Present from Lena.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs - 9/Prime Matrix.cpp
function precompute_prime_distance (line 10) | void precompute_prime_distance()
function main (line 36) | int main()
FILE: C Programs/C Programs - 9/String Task.cpp
function is_vowel (line 11) | bool is_vowel(char ch)
function main (line 27) | int main()
FILE: C Programs/C Programs - 9/Subtractions.cpp
function no_of_steps_in_finding_gcd (line 6) | int no_of_steps_in_finding_gcd(int a, int b)
function solve (line 17) | void solve()
function main (line 24) | int main()
FILE: C Programs/C Programs - 9/Toy Army.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs - 9/k-th_Divisor.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 10/A and B Compilation Errors.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 10/Amr and Music.cpp
function main (line 10) | int main()
FILE: C Programs/C Programs 10/Arrival of General.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 10/Bear and Game.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 10/Beautiful Year.cpp
function is_beautiful (line 6) | int is_beautiful(int year)
function main (line 23) | int main()
FILE: C Programs/C Programs 10/Black Square.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 10/Counterexample.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 10/Difference Row.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 10/Eugene and Array.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 10/Interesting Drink.cpp
function main (line 10) | int main()
FILE: C Programs/C Programs 10/Keyboard Layouts.cpp
function main (line 13) | int main()
FILE: C Programs/C Programs 10/Life Without Zeroes.cpp
function reverse (line 3) | long long reverse(long long n)
function zeroless (line 15) | long long zeroless(long long n)
function main (line 30) | int main()
FILE: C Programs/C Programs 10/Modified GCD.cpp
function get_gcd (line 9) | int get_gcd(int a, int b)
function main (line 17) | int main()
FILE: C Programs/C Programs 10/Multi Judge Solving.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 10/Next Test.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 10/Presents.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 10/Serega and Coat Rack.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 10/Serega and Suffixes.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 10/Slightly Decreasing Permutation.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 10/SwapSort.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 10/Taxi.cpp
function main (line 4) | int main()
FILE: C Programs/C Programs 10/Toy Cars.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 10/Unimodal Arrays.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 10/Valera and Plates.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 10/Vanya and Cubes.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 11/BerSU Ball.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 11/Elections.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 11/Five in a Row.cpp
function horizontal_win (line 5) | bool horizontal_win(char grid[][NO_OF_COLUMNS + 2], int i, int j)
function vertical_win (line 18) | bool vertical_win(char grid[][NO_OF_COLUMNS + 2], int i, int j)
function diagonal_win (line 31) | bool diagonal_win(char grid[][NO_OF_COLUMNS + 2], int i, int j)
function anti_diagonal_win (line 44) | bool anti_diagonal_win(char grid[][NO_OF_COLUMNS + 2], int i, int j)
function main (line 57) | int main()
FILE: C Programs/C Programs 11/Football.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 11/Fortune Telling.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 11/Free Cash Alternate Solution.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 11/Free Cash.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 11/Games.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 11/Good Number.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 11/Johnny Likes Numbers.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 11/Lever.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 11/Lunch Rush.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 11/Magic Spheres.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 11/New Year and Hurry.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 11/Nicholas and Permutation.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 11/Petya and Staircases.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 11/Playing with Dice.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 11/Saitama Destroys Hotel.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 11/Sasha and Sticks.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 11/Soft Drinking.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 11/The Child and The Homework.cpp
function main (line 11) | int main()
FILE: C Programs/C Programs 11/The New Year Meeting Friends Alternate Solution.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 11/The New Year Meeting Friends.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 11/Word.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 11/inc ARG.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 12/Anastasia and Pebbles.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 12/Bear and Three Balls.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 12/Buggy Sorting.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 12/Co Prime Array.cpp
function gcd (line 6) | int gcd(int a, int b)
function main (line 14) | int main()
FILE: C Programs/C Programs 12/Dima and Friends.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 12/Dima and Sequence.cpp
function population_count (line 6) | int population_count(int x)
function main (line 24) | int main()
FILE: C Programs/C Programs 12/Dreamoon and Stairs Alternate Solution.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 12/Dreamoon and Stairs.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 12/Fashion in Berland.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 12/Inbox (100500).cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 12/Key Races.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 12/Ksusha and Arrays.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 12/Lecture.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 12/Little Elephant and Chess.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 12/Little Girl and Maximum Sum.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 12/Minimum Difficulty.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 12/Pasha and Pixels.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 12/Puzzles.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 12/Santa Claus and Candies.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 12/Sereja and Dima.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 12/Shaas and Oskols.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 12/Sleuth.cpp
function is_vowel (line 8) | bool is_vowel(char ch)
function main (line 22) | int main()
FILE: C Programs/C Programs 12/The Festive Evening.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 12/The Number on The Board.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 12/Watching a Movie.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 13/A Good Contest.cpp
function main (line 4) | int main()
FILE: C Programs/C Programs 13/Arpa's Obvious Problem and Mehrad's Terrible Solution.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 13/Arrays.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 13/Arya and Bran.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 13/Bear and Elections.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 13/Business Trip.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 13/Cards.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 13/Code Obfuscation.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 13/Drinks.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 13/Epic Game.cpp
function gcd (line 5) | int gcd(int a, int b)
function main (line 13) | int main()
FILE: C Programs/C Programs 13/Functions Again.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 13/Generous Kefa.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 13/George and Job.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 13/Godsend.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 13/Ilya and Queries.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 13/Kuriyama Mirai's Stones.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 13/Lights Out.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 13/Little Dima and Equation.cpp
function int_power (line 6) | long long int_power(int x, int n)
function sum_of_digits (line 16) | int sum_of_digits(int x)
function main (line 29) | int main()
FILE: C Programs/C Programs 13/Little Elephant and Bits.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 13/New Skateboard.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 13/Oath of the Night's Watch.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 13/Sort the Array.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 13/Star Sky.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 13/Vanya and Books.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 13/Vasya and Digital Root.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 14/Asphalting Roads.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 14/Bicycle Chain.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 14/Borze.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 14/Building Permutation.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 14/Chess Tourney.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 14/Cormen - The Best Friend of Man.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 14/DZY Loves Sequences.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 14/Dragons.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 14/Drazil and Factorial.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 14/Football.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 14/Helpful Maths.cpp
function main (line 10) | int main()
FILE: C Programs/C Programs 14/Increase and Decrease.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 14/Jeff and Digits.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 14/Jzzhu and Children.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 14/Modulo Sum.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 14/Odds and Ends.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 14/Panoramix's Prediction.cpp
function is_prime (line 3) | int is_prime(int n)
function main (line 12) | int main()
FILE: C Programs/C Programs 14/Permutation.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 14/Powers of Two.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 14/Queue at the School.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 14/Rectangles.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 14/Supercentral Point.cpp
type Point (line 6) | struct Point
function main (line 11) | int main()
FILE: C Programs/C Programs 14/Tram.cpp
function main (line 4) | int main()
FILE: C Programs/C Programs 14/Ultra Fast Mathematician.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 14/Vasya and String.cpp
function get_max_window_length (line 6) | int get_max_window_length(char string[], char changed_char, int max_chan...
function main (line 26) | int main()
FILE: C Programs/C Programs 15/Army.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 15/Between the Offices.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 15/Cableway.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 15/Ciferia.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 15/Coins.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 15/Divisibility by Eight.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 15/Exams.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 15/Given Length and Sum of Digits.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 15/Ilya and Sticks.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 15/Inna and Huge Candy Matrix.cpp
function swap (line 3) | inline void swap(int &a, int &b)
function horizontal_rotate (line 8) | inline void horizontal_rotate(int &column, int no_of_columns)
function clockwise_transformation (line 13) | inline void clockwise_transformation(int &row, int &column, int &no_of_r...
function anti_clockwise_transformation (line 23) | inline void anti_clockwise_transformation(int &row, int &column, int &no...
function main (line 33) | int main()
FILE: C Programs/C Programs 15/K-Multiple Free Set.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 15/Kefa and Park.cpp
function dfs (line 14) | void dfs(int current_park, int &no_of_paths)
function main (line 35) | int main()
FILE: C Programs/C Programs 15/Mahmoud and Ehab and the MEX.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 15/Mahmoud and Ehab and the bipartiteness.cpp
function dfs_and_colour (line 12) | void dfs_and_colour(int v, int current_colour)
function main (line 26) | int main()
FILE: C Programs/C Programs 15/Mahmoud and Ehab and the xor.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 15/Number of Ways.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 15/Pearls in a Row.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 15/Pie Rules.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 15/Quasi-palindrome.cpp
function is_palindrome (line 3) | int is_palindrome(int n)
function palindrome_without_trailing_zeroes (line 16) | int palindrome_without_trailing_zeroes(int n)
function main (line 24) | int main()
FILE: C Programs/C Programs 15/Soldier and Number Game.cpp
function precompute (line 6) | void precompute(vector <int> &no_of_prime_divisors_till, int LIMIT)
function main (line 26) | int main()
FILE: C Programs/C Programs 15/Tanya and Toys.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 15/Team.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 15/The Eternal Immortality.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 15/Triangle.cpp
function triangle (line 3) | int triangle(int side_a, int side_b, int side_c)
function segment (line 8) | int segment(int side_a, int side_b, int side_c)
function main (line 13) | int main()
FILE: C Programs/C Programs 15/USB Flash Drives.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 16/Amusing Joke.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 16/Anton and Letters.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 16/Cards with Numbers.cpp
type card (line 10) | struct card
function sort_by_value (line 15) | bool sort_by_value(const card &A, const card &B)
function main (line 20) | int main()
FILE: C Programs/C Programs 16/Classroom Watch.cpp
function digit_sum (line 6) | int digit_sum(int n)
function main (line 19) | int main()
FILE: C Programs/C Programs 16/Cupboards.cpp
function main (line 4) | int main()
FILE: C Programs/C Programs 16/Dishonest Sellers.cpp
type prices (line 9) | struct prices
function sort_By_Difference (line 14) | bool sort_By_Difference(const prices &A, const prices &B)
function main (line 19) | int main()
FILE: C Programs/C Programs 16/Dubstep.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 16/Easy Number Challenge.cpp
function precompute (line 6) | void precompute(vector <int> &number_of_divisors, int LIMIT)
function main (line 32) | int main()
FILE: C Programs/C Programs 16/Fox and Snake.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 16/Greg and Array.cpp
type operation (line 6) | struct operation
function main (line 12) | int main()
FILE: C Programs/C Programs 16/Hacking Cypher.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 16/I Wanna Be The Guy.cpp
function main (line 4) | int main()
FILE: C Programs/C Programs 16/IQ Test.cpp
function possible_to_make_square (line 3) | int possible_to_make_square(char square[][5], int x, int y)
function main (line 11) | int main()
FILE: C Programs/C Programs 16/Jeff and Periods.cpp
type number (line 5) | struct number
method number (line 9) | number(){ last_index = second_last_index = 0; difference = NOT_POSSIBLE;}
function main (line 12) | int main()
FILE: C Programs/C Programs 16/Pashmak and Garden.cpp
function main (line 4) | int main()
FILE: C Programs/C Programs 16/Primes or Palindromes.cpp
function reverse (line 6) | int reverse(int n)
function is_palindrome (line 17) | int is_palindrome(int n)
function precompute (line 22) | void precompute(vector <int> &no_of_primes_till, vector <int> &no_of_pal...
function main (line 48) | int main()
FILE: C Programs/C Programs 16/Quasi Binary.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 16/Sereja and Bottles.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 16/Team Olympiad.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 16/The Fibonacci Segment.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 16/Twins.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 16/Valera and Tubes.cpp
function get_next (line 9) | void get_next(int &x, int &y, int columns)
function main (line 20) | int main()
FILE: C Programs/C Programs 16/Xenia and Bit Operations.cpp
function perform (line 8) | int perform(int a, int operation, int b)
function other (line 17) | int other(int operation)
function build (line 22) | void build(int node, int start, int end, int operation)
function update (line 38) | void update(int node, int start, int end, int index, int value, int oper...
function main (line 60) | int main()
FILE: C Programs/C Programs 16/Xenia and Ringroad.cpp
function get_travel_time (line 3) | int get_travel_time(int previous, int current, int no_of_houses)
function main (line 8) | int main()
FILE: C Programs/C Programs 16/k-String.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 17/Adding Digits.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 17/Christmas Spruce.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 17/Dreamoon and Wi-Fi.cpp
function choose (line 3) | int choose(int n, int r)
function main (line 16) | int main()
FILE: C Programs/C Programs 17/Exams - 122.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 17/Garden.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 17/Jamie and Alarm Snooze.cpp
function is_lucky (line 3) | int is_lucky(int n)
function main (line 16) | int main()
FILE: C Programs/C Programs 17/Jamie and Interesting Graph.cpp
function is_prime (line 3) | int is_prime(int n)
function find_nearest_prime (line 15) | int find_nearest_prime(int n)
function main (line 24) | int main()
FILE: C Programs/C Programs 17/Kolya and Tanya.cpp
function power_mod (line 3) | long long power_mod(long long x, int power, int MOD)
function main (line 19) | int main()
FILE: C Programs/C Programs 17/Mashmokh and ACM.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 17/Maximum Splitting.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 17/Minimum Sum.cpp
type code (line 6) | struct code
method code (line 10) | code(){
function compare (line 15) | int compare(const code &A, const code &B)
function main (line 20) | int main()
FILE: C Programs/C Programs 17/Modular Exponentiation.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 17/New Year and Domino.cpp
function main (line 4) | int main()
FILE: C Programs/C Programs 17/New Year's Eve.cpp
function no_of_bits (line 3) | int no_of_bits(long long n)
function main (line 16) | int main()
FILE: C Programs/C Programs 17/Palindrome Pairs.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 17/Perfect Number.cpp
function sum_of_digits (line 6) | int sum_of_digits(int n)
function main (line 19) | int main()
FILE: C Programs/C Programs 17/QAQ.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 17/Seat Arrangements.cpp
function main (line 4) | int main()
FILE: C Programs/C Programs 17/Supermarket.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 17/Swap Adjacent Elements.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 17/Tea Queue.cpp
function solve (line 6) | void solve()
function main (line 34) | int main()
FILE: C Programs/C Programs 17/Testing Pants for Sadness.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 17/The World is a Theatre.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 17/Tricky Alchemy.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 17/Water the Gardens.cpp
function solve (line 6) | void solve()
function main (line 31) | int main()
FILE: C Programs/C Programs 18/Art Union.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 18/Bear and Colours.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 18/Cave Painting.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 18/Cloning Toys.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 18/Eternal Victory.cpp
function dfs (line 11) | void dfs(int v, int parent_v)
function main (line 29) | int main()
FILE: C Programs/C Programs 18/Hard Problem.cpp
function string (line 10) | string rev(string s)
function main (line 17) | int main()
FILE: C Programs/C Programs 18/Joystick.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 18/K-Special Tables.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 18/Lucky Sum.cpp
function compute (line 9) | void compute(vector <long long> &lucky_numbers, long long last_lucky_num...
function get_answer (line 20) | long long get_answer(vector <long long> &lucky_numbers, int limit)
function main (line 35) | int main()
FILE: C Programs/C Programs 18/Magic Forest.cpp
function is_nondegenerate_triangle (line 3) | int is_nondegenerate_triangle(int a, int b, int c)
function main (line 8) | int main()
FILE: C Programs/C Programs 18/Marvolo Gaunt's Ring Alternate Solution.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 18/Marvolo Gaunt's Ring.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 18/Not Equal on a Segment.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 18/Perfect Squares.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 18/Petya and Inequiations.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 18/Polo the Penguin and Matrix.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 18/Polo the Penguin and Strings.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 18/Replacement.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 18/Robot Vaccuum Cleaner.cpp
type info (line 10) | struct info
function compare (line 16) | int compare(const info &A, const info &B)
function main (line 27) | int main()
FILE: C Programs/C Programs 18/Rumour.cpp
function dfs_and_mark_component (line 13) | void dfs_and_mark_component(int v, int component_no)
function main (line 27) | int main()
FILE: C Programs/C Programs 18/Search for Pretty Integers.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 18/Tom Riddle's Diary.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 18/Two Substrings.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 18/Vladik and Fractions.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 18/Woodcutter.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 19/A Compatible Pair.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 19/A Prosperous Lot.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 19/Almost Identity Permutations.cpp
function choose (line 3) | long long choose(int n, int r)
function derangements (line 13) | long long derangements(int n)
function main (line 25) | int main()
FILE: C Programs/C Programs 19/Amr and Large Array.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 19/Beautiful Sets of Points.cpp
function main (line 4) | int main()
FILE: C Programs/C Programs 19/Buggy Robot.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 19/Cellular Network.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 19/Coder.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 19/Diversity.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 19/Guest From The Past.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 19/Hamster Farm.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 19/K-Dominant Character.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 19/Little Artem and Grasshopper.cpp
function main (line 4) | int main()
FILE: C Programs/C Programs 19/Longest K-Good Segment.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 19/Love Triangle.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 19/Nuts.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 19/Palindrome Transformation.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 19/Palindromic Supersequence.cpp
function string (line 6) | string reverse(string A)
function main (line 16) | int main()
FILE: C Programs/C Programs 19/Recursive Queries.cpp
function non_zero_digit_product (line 9) | int non_zero_digit_product(int n)
function precompute (line 22) | void precompute()
function main (line 43) | int main()
FILE: C Programs/C Programs 19/Run For Your Prize.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 19/Simple Strings.cpp
function some_char_other_than (line 6) | char some_char_other_than(char a, char b)
function main (line 13) | int main()
FILE: C Programs/C Programs 19/The Useless Toy.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 19/Vasya and Socks.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 19/Watchmen.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 19/Word Correction.cpp
function is_vowel (line 6) | int is_vowel(char ch)
function main (line 21) | int main()
FILE: C Programs/C Programs 20/Alena and the Heater.cpp
function main (line 13) | int main()
FILE: C Programs/C Programs 20/Fafa and Ancient Alphabet.cpp
function power (line 6) | long long power(long long n, long long power, int MOD)
function inverse (line 22) | long long inverse(long long n, long long m)
function choose_2 (line 27) | long long choose_2(long long n)
function main (line 32) | int main()
FILE: C Programs/C Programs 20/Fafa and His Company.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 20/Fafa and the Gates.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 20/Fixing Typos.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 20/Gargari and Bishops.cpp
function colour (line 9) | int colour(int x, int y)
function get_principal_diagonal_no (line 16) | int get_principal_diagonal_no(int x, int y, int n)
function get_secondary_diagonal_no (line 21) | int get_secondary_diagonal_no(int x, int y)
function main (line 26) | int main()
FILE: C Programs/C Programs 20/Gargari and Permutations Alternate Solution.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 20/Gargari and Permutations.cpp
function get_longest_path (line 14) | int get_longest_path(int v)
function main (line 31) | int main()
FILE: C Programs/C Programs 20/Hard Process.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 20/Lisa and Dima.cpp
function is_prime (line 6) | int is_prime(int n)
function sieve (line 15) | void sieve(vector <int> &is_prime)
function break_into_sum_of_primes (line 32) | void break_into_sum_of_primes(int N, int &prime_1, int &prime_2)
function main (line 48) | int main()
FILE: C Programs/C Programs 20/Love Rescue.cpp
function mark (line 11) | void mark(int v, int component_no)
function main (line 25) | int main()
FILE: C Programs/C Programs 20/Mashmokh and Numbers.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 20/Non-Secret Cypher.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 20/Olympiad.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 20/Partition.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 20/Petya and His Friends Alternate Solution.cpp
function precompute (line 6) | void precompute(vector <int> &primes, int LIMIT)
function nearest_power_of_2_greater_than (line 25) | int nearest_power_of_2_greater_than(int n)
function is_bit_set (line 35) | int is_bit_set(int n, int position)
function main (line 40) | int main()
FILE: C Programs/C Programs 20/Petya and His Friends.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 20/Phone Numbers.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 20/Pocket Book.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 20/Points on the Line.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 20/Protect Sheep.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 20/String Transformation.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 20/Sum and Replace.cpp
function precompute_divisors (line 16) | void precompute_divisors()
function build (line 43) | void build(int n, int left, int right)
function get_sum (line 59) | long long get_sum(int n, int left, int right, int query_left, int query_...
function update (line 74) | void update(int n, int left, int right, int query_left, int query_right)
function main (line 95) | int main()
FILE: C Programs/C Programs 20/Vile Grasshoppers.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 20/Weird Subtraction Process.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 21/Aramic Script Bitmask Solution.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 21/Aramic Script.cpp
function main (line 10) | int main()
FILE: C Programs/C Programs 21/Arithmetic Progression.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 21/Bash and a Tough Math Puzzle.cpp
function gcd (line 12) | int gcd(int a, int b)
function build (line 20) | void build(int n, int left, int right)
function update (line 36) | void update(int n, int left, int right, int index, int value)
function get_first_indivisible_element (line 54) | int get_first_indivisible_element(int n, int left, int right, int query_...
function solve (line 74) | void solve()
function main (line 108) | int main()
FILE: C Programs/C Programs 21/Consecutive Subsequences.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 21/Cyclic Components.cpp
function dfs_and_mark_component (line 12) | void dfs_and_mark_component(int v, int no)
function main (line 26) | int main()
FILE: C Programs/C Programs 21/Divide by Three, Multiply by Two Alternate Solution.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 21/Divide by Three, Multiply by Two.cpp
type info (line 10) | struct info
function compare (line 16) | int compare(const info &A, const info &B)
function main (line 24) | int main()
FILE: C Programs/C Programs 21/Dreamoon and Sets.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 21/File Name.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 21/Fox and Box Accumulation.cpp
function is_possible (line 9) | int is_possible(vector <int> &strength, int no_of_piles)
function main (line 34) | int main()
FILE: C Programs/C Programs 21/Ghosts.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 21/Less or Equal.cpp
function main (line 10) | int main()
FILE: C Programs/C Programs 21/Little Girl and Maximum XOR.cpp
function all_ones (line 3) | long long all_ones(int n)
function main (line 8) | int main()
FILE: C Programs/C Programs 21/Lucky Sum of Digits.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 21/Mahmoud and Ehab and another array construction task.cpp
function sieve (line 6) | void sieve(vector <int> &is_prime, int LIMIT)
function all_prime_factors_available (line 21) | int all_prime_factors_available(int n, vector <int> &used)
function mark_prime_factors (line 38) | void mark_prime_factors(int n, vector <int> &used)
function main (line 54) | int main()
FILE: C Programs/C Programs 21/Mahmoud and Ehab and Even Odd Game.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 21/Mahmoud and a Triangle.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 21/Make a Square Alternate Solution.cpp
function no_of_digits (line 3) | int no_of_digits(int n)
function square (line 16) | long long square(long long n)
function is_subsequence (line 21) | int is_subsequence(int sequence, int n)
function main (line 39) | int main()
FILE: C Programs/C Programs 21/Make a Square.cpp
function is_bit_set (line 3) | int is_bit_set(int n, int position)
function no_of_ones (line 8) | int no_of_ones(int n)
function no_of_digits (line 22) | int no_of_digits(int n)
function square (line 35) | long long square(long long n)
function is_square (line 40) | int is_square(int n)
function main (line 68) | int main()
FILE: C Programs/C Programs 21/Mancala.cpp
function score_by_distributing (line 6) | long long score_by_distributing(int chosen, vector <long long> stone, in...
function main (line 38) | int main()
FILE: C Programs/C Programs 21/Mentors.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 21/Pairs of Lines.cpp
type Point (line 6) | struct Point{
function is_on_line (line 12) | int is_on_line(Point a, Point b, Point c)
function check_line (line 18) | int check_line(vector <Point> &line)
function check_one_line_passing_through (line 27) | int check_one_line_passing_through(int a, int b, vector <Point> &P)
function main (line 41) | int main()
FILE: C Programs/C Programs 21/Two Gram.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 21/Valhalla Seige.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 21/Wrong Subtraction.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 22/AND Graph.cpp
function complement (line 10) | int complement(int x, int no_of_bits)
function dfs (line 15) | void dfs(int mask, int no_of_bits)
function main (line 35) | int main()
FILE: C Programs/C Programs 22/Almost Arithmetic Progression.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 22/Antipalindrome Alternate Solution.cpp
function is_palindrome (line 6) | int is_palindrome(string S, int left, int right)
function main (line 17) | int main()
FILE: C Programs/C Programs 22/Antipalindrome.cpp
function is_palindrome (line 5) | int is_palindrome(string S)
function main (line 14) | int main()
FILE: C Programs/C Programs 22/Ball.cpp
type info (line 16) | struct info
function sort_by_beauty (line 21) | int sort_by_beauty(info &A, info &B)
function insert_richness (line 26) | void insert_richness(int n, int left, int right, int index, int value)
function get_max_richness (line 44) | int get_max_richness(int n, int left, int right, int query_left, int que...
function main (line 59) | int main()
FILE: C Programs/C Programs 22/Bits.cpp
function all_ones (line 3) | long long all_ones(int n)
function is_set (line 8) | int is_set(long long n, int bit)
function no_of_bits (line 13) | int no_of_bits(long long n)
function solve (line 26) | void solve()
function main (line 62) | int main()
FILE: C Programs/C Programs 22/Bookshelves.cpp
function is_possible (line 11) | int is_possible(LL goal)
function main (line 35) | int main()
FILE: C Programs/C Programs 22/Businessman Problems.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 22/Chess Placing.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 22/Correct Solution.cpp
function string (line 9) | string solve(string S)
function main (line 33) | int main()
FILE: C Programs/C Programs 22/Counting Kangaroos is Fun.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 22/Fruits.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 22/High School Become Human.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 22/Infinity Gauntlet.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 22/Knights of a Polygonal Table.cpp
type knight (line 12) | struct knight
function sort_by_power (line 17) | int sort_by_power(const knight &A, const knight &B)
function main (line 22) | int main()
FILE: C Programs/C Programs 22/Letters.cpp
function main (line 8) | int main()
FILE: C Programs/C Programs 22/Local Extrema.cpp
function is_extrema (line 6) | int is_extrema(int mid, int start, int end)
function main (line 11) | int main()
FILE: C Programs/C Programs 22/Remove Duplicates.cpp
function main (line 10) | int main()
FILE: C Programs/C Programs 22/Super Agent.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 22/Switches and Lamps.cpp
function main (line 10) | int main()
FILE: C Programs/C Programs 22/Tafurama.cpp
function update (line 11) | void update(int n, int left, int right, int index, int value)
function get_sum (line 29) | int get_sum(int n, int left, int right, int query_left, int query_right)
function main (line 44) | int main()
FILE: C Programs/C Programs 22/Three Displays Segment Tree Solution.cpp
type info (line 13) | struct info
function compare_by_size (line 21) | int compare_by_size(const info &A, const info &B)
function build_min_tree (line 29) | void build_min_tree(int n, int left, int right)
function update_min (line 44) | void update_min(int n, int left, int right, int position, int value)
function get_min (line 62) | long long get_min(int n, int left, int right, int query_left, int query_...
function main (line 77) | int main()
FILE: C Programs/C Programs 22/Three Displays.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 22/Useful Decomposition.cpp
function dfs_leaf_from (line 9) | int dfs_leaf_from(int v, int parent)
function main (line 24) | int main()
FILE: C Programs/C Programs 23/An Impassioned Circulation of Affection.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 23/Another Problem on Strings.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 23/Babaei and Birthday Cake.cpp
function insert (line 15) | void insert(int n, int left, int right, double value, int position)
function get_max (line 34) | double get_max(int n, int left, int right, int query_left, int query_right)
function main (line 49) | int main()
FILE: C Programs/C Programs 23/Bear and Prime Numbers.cpp
function precompute (line 6) | void precompute(vector <int> &is_prime, int N)
function main (line 25) | int main()
FILE: C Programs/C Programs 23/Cirriculum Vitae.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 23/Classy Numbers Precomputing Solution.cpp
function precompute (line 11) | void precompute(int position, int non_zero_count, long long current_num)
function main (line 28) | int main()
FILE: C Programs/C Programs 23/Counting Arrays.cpp
function sieve (line 11) | void sieve()
function power_mod (line 30) | long long power_mod(long long x, long long power)
function precompute (line 46) | void precompute()
function choose (line 57) | long long choose(long long n, long long r)
function factorise (line 65) | void factorise(int n, map <int, int> &exponent)
function solve (line 81) | void solve()
function main (line 106) | int main()
FILE: C Programs/C Programs 23/Crazy Town.cpp
function main (line 3) | int main()
FILE: C Programs/C Programs 23/Find Maximum.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 23/Fish.cpp
function is_alive (line 7) | int is_alive(int n, int bit)
function kill (line 12) | int kill(int n, int bit)
function no_of_set_bits (line 17) | int no_of_set_bits(int n)
function choose_2 (line 30) | int choose_2(int n)
function main (line 35) | int main()
FILE: C Programs/C Programs 23/Garbage Disposal.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 23/Guest From The Past.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 23/Ice Skater.cpp
function dfs (line 10) | void dfs(int v)
function main (line 23) | int main()
FILE: C Programs/C Programs 23/Lazyland.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 23/Lesha and Array Splitting.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 23/Lost Array.cpp
function is_possible (line 6) | int is_possible(vector <int> &A, int k)
function main (line 17) | int main()
FILE: C Programs/C Programs 23/Maximum Value.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 23/Maze.cpp
function dfs (line 10) | void dfs(int r, int c, int target)
function main (line 35) | int main()
FILE: C Programs/C Programs 23/Minesweeper.cpp
function neighbour_bomb_count (line 7) | int neighbour_bomb_count(int x, int y)
function main (line 22) | int main()
FILE: C Programs/C Programs 23/Minimum Diameter Tree.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 23/No To Palindromes.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 23/On Number of Decompositions into Multipliers.cpp
function sieve (line 11) | void sieve()
function power_mod (line 32) | long long power_mod(long long x, long long power)
function precompute (line 48) | void precompute()
function choose (line 59) | long long choose(long long n, long long r)
function factorise (line 67) | void factorise(int n, map <int, int> &exponent)
function main (line 83) | int main()
FILE: C Programs/C Programs 23/Summarise to Powers of Two.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 23/The Fair Nut and String.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 23/The Meaningless Game.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 24/Brutality.cpp
function main (line 12) | int main()
FILE: C Programs/C Programs 24/Connect.cpp
type Point (line 8) | struct Point
method Point (line 12) | Point(){}
method Point (line 14) | Point(int X, int Y)
function calculate_distance (line 26) | int calculate_distance(Point P, Point Q)
function is_outside (line 31) | int is_outside(int x, int y, int n)
function dfs (line 36) | void dfs(int x, int y, int n, int number)
function main (line 49) | int main()
FILE: C Programs/C Programs 24/Div Times Mod.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 24/Diverse Garland.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 24/Division and Union.cpp
type line (line 8) | struct line
method line (line 12) | line(int l, int r, int p)
function solve (line 23) | void solve()
function main (line 73) | int main()
FILE: C Programs/C Programs 24/Finite or Not.cpp
function LL (line 8) | LL gcd(LL x, LL y)
function solve (line 16) | void solve()
function main (line 37) | int main()
FILE: C Programs/C Programs 24/Illya and Escalator.cpp
function main (line 11) | int main()
FILE: C Programs/C Programs 24/Increasing by Modulo.cpp
function possible (line 6) | int possible(int operations, int m, vector <int> &A)
function main (line 24) | int main()
FILE: C Programs/C Programs 24/Nice Garland.cpp
function replacements (line 6) | int replacements(string &R, string &S)
function main (line 16) | int main()
FILE: C Programs/C Programs 24/Planning the Expedition.cpp
function possible (line 8) | int possible(vector <int> A, int days, int min_participants)
function main (line 20) | int main()
FILE: C Programs/C Programs 24/Playing Piano.cpp
function main (line 10) | int main()
FILE: C Programs/C Programs 24/Posterized.cpp
function main (line 6) | int main()
FILE: C Programs/C Programs 24/Powers of Two.cpp
function is_bit_set (line 6) | int is_bit_set(int position, int n)
function main (line 11) | int main()
FILE: C Programs/C Programs 24/Splitting into Digits.cpp
function main (line 5) | int main()
FILE: C Programs/C Programs 24/Stages.cpp
function main (line 10) | int main()
FILE: C Programs/C Programs 24/Tanya and Candies.cpp
function main (line 9) | int main()
FILE: C Programs/C Programs 24/The Way to Home.cpp
function main (line 7) | int main()
FILE: C Programs/C Programs 24/Vanya and Label.cpp
function is_bit_set (line 7) | int is_bit_set(int n, int position)
function value (line 12) | int value(char n)
function main (line 21) | int main()
FILE: C Programs/C Programs 24/Where_Do_I_Turn.c
function main (line 3) | int main()
FILE: C Programs/C Programs 24/Zero Quantity Maximisation.cpp
type fraction (line 10) | struct fraction
method fraction (line 14) | fraction(){}
method fraction (line 16) | fraction(long long N, long long D)
function main (line 36) | int main()
FILE: Contests/463 Div 1 + 2 ICM Technex/Programs/Team Work.cpp
function power_mod (line 9) | long long power_mod(long long x, long long power)
function f (line 25) | long long f(long long differentiations, long long b, long long c)
function main (line 46) | int main()
FILE: Contests/607 Div 1 + 2/Programs/Azamon Web Services.cpp
function solve (line 5) | void solve()
function main (line 34) | int main()
FILE: Contests/607 Div 1 + 2/Programs/Beingawesomeism.cpp
function full_row_a (line 8) | int full_row_a(int r, int columns)
function full_column_a (line 21) | int full_column_a(int rows, int c)
function all_p (line 34) | int all_p(int rows, int columns)
function all_a (line 50) | int all_a(int rows, int columns)
function corner_square (line 66) | int corner_square(int rows, int columns)
function corner_edge_square (line 72) | int corner_edge_square(int rows, int columns)
function full_corner_edges (line 93) | int full_corner_edges(int rows, int columns)
function any_full_edge (line 108) | int any_full_edge(int rows, int columns)
function solve (line 129) | void solve()
function main (line 175) | int main()
FILE: Contests/607 Div 1 + 2/Programs/Cut and Paste.cpp
function solve (line 5) | void solve()
function main (line 50) | int main()
FILE: Contests/607 Div 1 + 2/Programs/Jeremy Bearimy.cpp
type Edge (line 6) | struct Edge
method Edge (line 11) | Edge(){}
method Edge (line 13) | Edge(int U, int V, long long W)
function dfs (line 24) | void dfs(int v, int parent_v)
function solve (line 44) | void solve()
function main (line 102) | int main()
FILE: Contests/607 Div 1 + 2/Programs/Suffix Three.cpp
function solve (line 5) | void solve()
function main (line 18) | int main()
FILE: Contests/609 Div 2/Programs/Equation.cpp
function main (line 5) | int main()
FILE: Contests/Avito Code Challenge 2018/Programs/Antipalindrome Alternate Solution.cpp
function is_palindrome (line 6) | int is_palindrome(string S, int left, int right)
function main (line 17) | int main()
FILE: Contests/Avito Code Challenge 2018/Programs/Antipalindrome.cpp
function is_palindrome (line 5) | int is_palindrome(string S)
function main (line 14) | int main()
FILE: Contests/Avito Code Challenge 2018/Programs/Bookshelves.cpp
function is_possible (line 11) | int is_possible(LL goal)
function main (line 35) | int main()
FILE: Contests/Avito Code Challenge 2018/Programs/Businessman Problems.cpp
function main (line 6) | int main()
FILE: Contests/Avito Code Challenge 2018/Programs/Useful Decomposition.cpp
function dfs_leaf_from (line 9) | int dfs_leaf_from(int v, int parent)
function main (line 24) | int main()
FILE: Contests/Avito Cool Challenge 2018/Programs/Colourful Bricks.cpp
function power_mod (line 6) | long long power_mod(long long base, long long power, long long mod)
function inverse (line 22) | long long inverse(long long n, long long mod)
function choose (line 27) | long long choose(long long n, long long r, long long mod)
function main (line 45) | int main()
FILE: Contests/Avito Cool Challenge 2018/Programs/Definite Game.cpp
function main (line 5) | int main()
FILE: Contests/Barcelona Bootcamp 2018/Programs/Maximum Sum of Digits.cpp
function digit_sum (line 5) | int digit_sum(long long n)
function to_int (line 18) | long long to_int(string &S)
function main (line 28) | int main()
FILE: Contests/Barcelona Bootcamp 2018/Programs/Phone Numbers.cpp
function main (line 7) | int main()
FILE: Contests/Barcelona Bootcamp 2018/Programs/Social Circles.cpp
function main (line 8) | int main()
FILE: Contests/CodeForces Global Round 1/Programs/Magic Stones.cpp
function LL (line 10) | LL is_permutation(vector <LL> A, vector <LL> B)
function read (line 28) | void read(vector <LL> &A, int n)
function get_difference (line 34) | void get_difference(vector <LL> &A, vector <LL> &D)
function main (line 42) | int main()
FILE: Contests/CodeForces Global Round 1/Programs/Meaningless Operations.cpp
function all_ones (line 8) | int all_ones(int n)
function no_of_bits (line 13) | int no_of_bits(int n)
function is_all_ones (line 27) | int is_all_ones(int n)
function solve (line 32) | void solve()
function precompute (line 41) | void precompute()
function main (line 71) | int main()
FILE: Contests/CodeForces Global Round 1/Programs/Parity.cpp
function main (line 5) | int main()
FILE: Contests/CodeForces Global Round 1/Programs/Tape.cpp
type Point (line 8) | struct Point
method Point (line 12) | Point(int p, int d)
function main (line 23) | int main()
FILE: Contests/CodeForces Global Round 3/Programs/Another One Bites the Dust.cpp
function main (line 5) | int main()
FILE: Contests/CodeForces Global Round 3/Programs/Born This Way.cpp
function main (line 7) | int main()
FILE: Contests/CodeForces Global Round 3/Programs/Crazy Diamond.cpp
function arrange_swaps (line 12) | void arrange_swaps(int start, int destination)
function main (line 23) | int main()
FILE: Contests/CodeForces Global Round 3/Programs/Dirty Deeds Done Dirt Cheap.cpp
type pairs (line 8) | struct pairs
method pairs (line 12) | pairs()
method pairs (line 17) | pairs(int A, int B, int I)
function sort_increasing_pairs (line 24) | int sort_increasing_pairs(pairs &P, pairs &Q)
function sort_decreasing_pairs (line 30) | int sort_decreasing_pairs(pairs&P, pairs &Q)
function main (line 35) | int main()
FILE: Contests/CodeForces Global Round 5/Programs/Balanced Rating Changes.cpp
function main (line 7) | int main()
FILE: Contests/CodeForces Global Round 5/Programs/Balanced Tunnel.cpp
type cars (line 8) | struct cars
method cars (line 12) | cars(){}
function main (line 20) | int main()
FILE: Contests/Dasha Code Championship Elimination Round 2019/Programs/Cows and Snacks.cpp
function dfs_component_size (line 10) | int dfs_component_size(int v)
function main (line 34) | int main()
FILE: Contests/Dasha Code Championship Elimination Round 2019/Programs/Koala and Lights.cpp
function main (line 7) | int main()
FILE: Contests/Dasha Code Championship Elimination Round 2019/Programs/Paint The Digits.cpp
function is_non_decreasing (line 8) | int is_non_decreasing(string S)
function possible_to_split (line 19) | int possible_to_split(string S, int n)
function solve (line 38) | void solve()
function main (line 108) | int main()
FILE: Contests/Dasha Code Championship Elimination Round 2019/Programs/Paint The Numbers.cpp
function main (line 8) | int main()
FILE: Contests/Dasha Code Championship Elimination Round 2019/Programs/Paint Your Numbers.cpp
function main (line 8) | int main()
FILE: Contests/Div 1 492/Programs/Game 995D.cpp
function main (line 6) | int main()
FILE: Contests/Div 1 492/Programs/Leaving The Bar.cpp
type Point (line 10) | struct Point
method Point (line 15) | Point(LL a = 0, LL b = 0, int index = 0)
method Point (line 20) | Point operator+(const Point &P)
method Point (line 24) | Point operator-(const Point &P)
function LL (line 30) | LL square(LL n)
function LL (line 35) | LL square_norm(Point P)
function main (line 40) | int main()
FILE: Contests/Div 1 492/Programs/Suit and Tie.cpp
function main (line 7) | int main()
FILE: Contests/Div 2 12/Programs/Ball.cpp
type info (line 16) | struct info
function sort_by_beauty (line 21) | int sort_by_beauty(info &A, info &B)
function insert_richness (line 26) | void insert_richness(int n, int left, int right, int index, int value)
function get_max_richness (line 44) | int get_max_richness(int n, int left, int right, int query_left, int que...
function main (line 59) | int main()
FILE: Contests/Div 2 12/Programs/Correct Solution.cpp
function string (line 9) | string solve(string S)
function main (line 33) | int main()
FILE: Contests/Div 2 12/Programs/Fruits.cpp
function main (line 9) | int main()
FILE: Contests/Div 2 12/Programs/Super Agent.cpp
function main (line 3) | int main()
FILE: Contests/Div 2 136/Programs/Little Elephant And Array Segment Tree Solution.cpp
type info (line 12) | struct info
function update (line 26) | void update(int n, int left, int right, int position, int value)
function get_sum (line 44) | int get_sum(int n, int left, int right, int query_left, int query_right)
function main (line 59) | int main()
FILE: Contests/Div 2 136/Programs/Little Elephant and Array.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 136/Programs/Little Elephant and Function.cpp
function main (line 3) | int main()
FILE: Contests/Div 2 136/Programs/Little Elephant and Numbers.cpp
function get (line 6) | void get(int n, vector <int> &frequency)
function common_digit (line 16) | int common_digit(int a, int b)
function main (line 31) | int main()
FILE: Contests/Div 2 136/Programs/Little Elephant and Problem.cpp
function main (line 9) | int main()
FILE: Contests/Div 2 197/Programs/Helpful Maths.cpp
function main (line 10) | int main()
FILE: Contests/Div 2 197/Programs/Xenia and Bit Operations.cpp
function perform (line 8) | int perform(int a, int operation, int b)
function other (line 17) | int other(int operation)
function build (line 22) | void build(int node, int start, int end, int operation)
function update (line 38) | void update(int node, int start, int end, int index, int value, int oper...
function main (line 60) | int main()
FILE: Contests/Div 2 197/Programs/Xenia and Ringroad.cpp
function get_travel_time (line 3) | int get_travel_time(int previous, int current, int no_of_houses)
function main (line 8) | int main()
FILE: Contests/Div 2 197/Programs/Xenia and Weights.cpp
function possible (line 10) | int possible(int difference, int current_weigh_no, int no_of_weighs)
function main (line 35) | int main()
FILE: Contests/Div 2 205/Programs/Little Elephant and Cards.cpp
function main (line 7) | int main()
FILE: Contests/Div 2 205/Programs/Little Elephant and Sorting.cpp
function main (line 8) | int main()
FILE: Contests/Div 2 205/Programs/Little_Elephant_Rozdil.c
function main (line 7) | int main()
function read_time_taken_to_each_city (line 30) | void read_time_taken_to_each_city(unsigned int no_of_cities,unsigned lon...
function find_which_city_elephant_goes_to (line 40) | void find_which_city_elephant_goes_to(unsigned int no_of_cities,unsigned...
FILE: Contests/Div 2 261/Explanation/Pashmak and Buses.cpp
function possible (line 6) | int possible(int people, int buses, int days)
function main (line 18) | int main()
FILE: Contests/Div 2 261/Programs/Pashmak and Buses.cpp
function possible (line 6) | int possible(int people, int buses, int days)
function main (line 18) | int main()
FILE: Contests/Div 2 261/Programs/Pashmak and Garden.cpp
function main (line 4) | int main()
FILE: Contests/Div 2 261/Programs/Pashmak and Graph.cpp
type Edge (line 8) | struct Edge
function main (line 18) | int main()
FILE: Contests/Div 2 261/Programs/Pashmak and Parmida's Problem.cpp
function update (line 15) | void update(int n, int left, int right, int position, int value)
function LL (line 35) | LL get_sum(int n, int left, int right, int query_left, int query_right)
function main (line 51) | int main()
FILE: Contests/Div 2 261/Programs/Pashmak_and_Flowers.c
function main (line 3) | int main()
FILE: Contests/Div 2 276/Programs/Little Girl and Maximum Sum.cpp
function main (line 9) | int main()
FILE: Contests/Div 2 276/Programs/Little Girl and Maximum XOR.cpp
function all_ones (line 3) | long long all_ones(int n)
function main (line 8) | int main()
FILE: Contests/Div 2 276/Programs/Lunch Rush.cpp
function main (line 5) | int main()
FILE: Contests/Div 2 321/Programs/Kefa and Company.cpp
type info (line 8) | struct info
function sort_by_money (line 13) | int sort_by_money(const info &A, const info &B)
function main (line 18) | int main()
FILE: Contests/Div 2 321/Programs/Kefa and Park.cpp
function dfs (line 14) | void dfs(int current_park, int &no_of_paths)
function main (line 35) | int main()
FILE: Contests/Div 2 321/Programs/Kefa_and_First_Step.c
function main (line 8) | int main()
function find_length_longest_non_decreasing_streak (line 23) | unsigned int find_length_longest_non_decreasing_streak(unsigned long *mo...
function read (line 38) | void read(unsigned long *money_made, unsigned int no_of_days)
function max (line 48) | unsigned long max(unsigned long a, unsigned long b)
FILE: Contests/Div 2 367/Programs/Hard Problem.cpp
function string (line 10) | string rev(string s)
function main (line 17) | int main()
FILE: Contests/Div 2 367/Programs/Interesting Drink.cpp
function main (line 10) | int main()
FILE: Contests/Div 2 371/Programs/Filya_and_Homework.c
function main (line 12) | int main()
function count_no_of_distinct_elements (line 44) | short count_no_of_distinct_elements(unsigned long *list_of_numbers,unsig...
function check_if_set_is_in_AP (line 73) | short check_if_set_is_in_AP(unsigned long distinct_element[], short dist...
function get_answer (line 92) | void get_answer(char answer[], short is_possible)
FILE: Contests/Div 2 371/Programs/Meeting_of_Old_Friends.c
function main (line 5) | int main()
FILE: Contests/Div 2 371/Programs/Sonya and Queries.cpp
function to_integer (line 7) | int to_integer(string S)
function get_mask (line 20) | int get_mask(long long n)
function main (line 37) | int main()
FILE: Contests/Div 2 461/Programs/Cave Paintings.cpp
function main (line 3) | int main()
FILE: Contests/Div 2 464/Programs/Love Triangle.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 473/Programs/Mahmoud and Ehab and Another Array Construction Task.cpp
function sieve (line 6) | void sieve(vector <int> &is_prime, int LIMIT)
function all_prime_factors_available (line 21) | int all_prime_factors_available(int n, vector <int> &used)
function mark_prime_factors (line 38) | void mark_prime_factors(int n, vector <int> &used)
function main (line 54) | int main()
FILE: Contests/Div 2 473/Programs/Mahmoud and Ehab and Even Odd Game.cpp
function main (line 3) | int main()
FILE: Contests/Div 2 478/Programs/Aramic Script Bitmask Solution.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 478/Programs/Aramic Script.cpp
function main (line 10) | int main()
FILE: Contests/Div 2 478/Programs/Ghosts.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 478/Programs/Mancala.cpp
function score_by_distributing (line 6) | long long score_by_distributing(int chosen, vector <long long> stone, in...
function main (line 38) | int main()
FILE: Contests/Div 2 478/Programs/Valhalla Siege.cpp
function main (line 8) | int main()
FILE: Contests/Div 2 485/Programs/AND Graph.cpp
function complement (line 10) | int complement(int x, int no_of_bits)
function dfs (line 15) | void dfs(int mask, int no_of_bits)
function main (line 35) | int main()
FILE: Contests/Div 2 485/Programs/Fair.cpp
function main (line 15) | int main()
FILE: Contests/Div 2 485/Programs/High School Become Human.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 485/Programs/Infinity Gauntlet.cpp
function main (line 7) | int main()
FILE: Contests/Div 2 485/Programs/Petr and Permutations.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 485/Programs/Three Displays Segment Tree Solution.cpp
type info (line 13) | struct info
function compare_by_size (line 21) | int compare_by_size(const info &A, const info &B)
function build_min_tree (line 29) | void build_min_tree(int n, int left, int right)
function update_min (line 44) | void update_min(int n, int left, int right, int position, int value)
function get_min (line 62) | long long get_min(int n, int left, int right, int query_left, int query_...
function main (line 77) | int main()
FILE: Contests/Div 2 485/Programs/Three Displays.cpp
function main (line 7) | int main()
FILE: Contests/Div 2 489/Programs/Nastya Studies Informatics.cpp
function gcd_ (line 12) | long long gcd_(long long p, long long q)
function main (line 20) | int main()
FILE: Contests/Div 2 489/Programs/Nastya and Game.cpp
function overflow (line 8) | int overflow(LL a, LL b)
function main (line 13) | int main()
FILE: Contests/Div 2 489/Programs/Nastya and King-Shamans Alternate Solution.cpp
type info (line 7) | struct info
method info (line 11) | info(int v = 0, int p = 0)
function build (line 32) | void build(int n, int left, int right)
function update (line 47) | void update(int n, int left, int right, int index, int new_value)
function LL (line 66) | LL get_sum(int n, int left, int right, int query_left, int query_right)
function no_of_bits (line 81) | int no_of_bits(int n)
function get_answer (line 94) | int get_answer()
function remove_from_multiset (line 111) | void remove_from_multiset(info element, int multiset_no)
function solve (line 119) | void solve()
function main (line 135) | int main()
FILE: Contests/Div 2 489/Programs/Nastya and King-Shamans.cpp
function build (line 14) | void build(int n, int left, int right)
function update (line 30) | void update(int n, int left, int right, int index, int new_value)
function LL (line 50) | LL get_sum(int n, int left, int right, int query_left, int query_right)
function first_index (line 65) | int first_index(int n, int left, int right, int query_left, int query_ri...
function get_answer (line 82) | int get_answer()
function solve (line 102) | void solve()
function main (line 113) | int main()
FILE: Contests/Div 2 489/Programs/Nastya and a Wardrobe.cpp
function LL (line 5) | LL power_mod(LL x, LL power, LL MOD)
function main (line 21) | int main()
FILE: Contests/Div 2 489/Programs/Nastya and an Array.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 491/Programs/Bishwock.cpp
function main (line 7) | int main()
FILE: Contests/Div 2 491/Programs/Bus Number.cpp
function is_bit_set (line 12) | int is_bit_set(int n, int position)
function precompute (line 17) | void precompute()
function get (line 25) | void get(string S, vector <int> &frequency)
function get_count (line 33) | long long get_count(vector <int> &frequency)
function solve (line 49) | long long solve(string S)
function main (line 83) | int main()
FILE: Contests/Div 2 491/Programs/Candies.cpp
function LL (line 14) | LL taken_candies(LL total_candies, LL k)
function main (line 32) | int main()
FILE: Contests/Div 2 491/Programs/Getting an A.cpp
function main (line 8) | int main()
FILE: Contests/Div 2 491/Programs/If At First You Don't Succeed.cpp
function main (line 12) | int main()
FILE: Contests/Div 2 492/Programs/Game 995D.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 492/Programs/Hit the Lottery.cpp
function main (line 3) | int main()
FILE: Contests/Div 2 492/Programs/Leaving The Bar.cpp
type Point (line 10) | struct Point
method Point (line 15) | Point(LL a = 0, LL b = 0, int index = 0)
method Point (line 20) | Point operator+(const Point &P)
method Point (line 24) | Point operator-(const Point &P)
function LL (line 30) | LL square(LL n)
function LL (line 35) | LL square_norm(Point P)
function main (line 40) | int main()
FILE: Contests/Div 2 492/Programs/Suit and Tie.cpp
function main (line 7) | int main()
FILE: Contests/Div 2 492/Programs/Tesla.cpp
type Move (line 9) | struct Move
method Move (line 13) | Move(){}
method Move (line 15) | Move(int I, int R, int C)
function park (line 21) | void park(vector <Move> &Moves, int no_of_columns)
function rotate (line 41) | void rotate(vector <Move> &Moves, int no_of_columns)
function check_empty (line 142) | int check_empty(int no_of_columns)
function print (line 158) | void print()
function main (line 173) | int main()
FILE: Contests/Div 2 492/Programs/World Cup.cpp
function ceil (line 6) | int ceil(int numerator, int denominator)
function main (line 14) | int main()
FILE: Contests/Div 2 497/Programs/Reorder the Array.cpp
function main (line 8) | int main()
FILE: Contests/Div 2 497/Programs/Romaji.cpp
function is_vowel (line 9) | int is_vowel(char ch)
function main (line 23) | int main()
FILE: Contests/Div 2 497/Programs/Turn the Rectangle.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 508/Programs/Equality.cpp
function main (line 10) | int main()
FILE: Contests/Div 2 508/Programs/Gambling.cpp
function main (line 10) | int main()
FILE: Contests/Div 2 508/Programs/Non Coprime Partition.cpp
function main (line 10) | int main()
FILE: Contests/Div 2 511/Programs/Little C Loves 3 I.cpp
function main (line 3) | int main()
FILE: Contests/Div 2 533/Programs/Ayoub and Lost Array Matrix Exponentiation.cpp
function load_identity (line 8) | void load_identity(long long I[][SIZE])
function copy (line 15) | void copy(long long source[][SIZE], long long target[][SIZE])
function multiply (line 22) | void multiply(long long A[][SIZE], long long B[][SIZE])
function power (line 44) | void power(long long X[][SIZE], long long power)
function get_count (line 61) | int get_count(int limit, int remainder)
function main (line 69) | int main()
FILE: Contests/Div 2 533/Programs/Ayoub and Lost Array.cpp
function get_count (line 9) | int get_count(int limit, int remainder)
function main (line 17) | int main()
FILE: Contests/Div 2 533/Programs/Salem and Sticks.cpp
function calculate_cost (line 7) | int calculate_cost(vector <int> &A, int t)
function main (line 20) | int main()
FILE: Contests/Div 2 533/Programs/Zuhair and Strings.cpp
function main (line 7) | int main()
FILE: Contests/Div 2 538/Programs/Arithmetic Progression.cpp
function find_maximum (line 12) | int find_maximum(int &queries)
function find_difference (line 37) | int find_difference(int &queries, int greatest, int no_of_elements)
function main (line 78) | int main()
FILE: Contests/Div 2 538/Programs/Flood Fill.cpp
function main (line 10) | int main()
FILE: Contests/Div 2 538/Programs/Got Any Grapes.cpp
function main (line 5) | int main()
FILE: Contests/Div 2 538/Programs/Please Another Queries on Array.cpp
function is_bit_set (line 17) | int is_bit_set(LL n, int position)
function set_bit (line 22) | void set_bit(LL &n, int position)
function LL (line 27) | LL fast_power(LL base, LL power)
function precompute_primes (line 43) | void precompute_primes()
function precompute_prime_inverse (line 61) | void precompute_prime_inverse()
function precompute_mask (line 71) | void precompute_mask()
type Product_Tree (line 87) | struct Product_Tree
method Product_Tree (line 91) | Product_Tree(){}
method Product_Tree (line 93) | Product_Tree(int n)
method propagate (line 99) | void propagate(int n, int left, int right)
method update (line 113) | void update(int n, int left, int right, int query_left, int query_righ...
method LL (line 142) | LL get_product(int n, int left, int right, int query_left, int query_r...
type OR_Tree (line 170) | struct OR_Tree
method OR_Tree (line 174) | OR_Tree(){}
method OR_Tree (line 176) | OR_Tree(int n)
method propagate (line 182) | void propagate(int n, int left, int right)
method update (line 195) | void update(int n, int left, int right, int query_left, int query_righ...
method LL (line 224) | LL get_mask(int n, int left, int right, int query_left, int query_right)
function read_input (line 254) | void read_input()
function solve (line 271) | void solve()
function main (line 304) | int main()
FILE: Contests/Div 2 538/Programs/Trailing Loves.cpp
function factorise (line 8) | void factorise(vector <LL> &F, vector <int> &E, LL n)
function LL (line 35) | LL get_exponent_sum(LL n, LL p, int e)
function main (line 49) | int main()
FILE: Contests/Div 2 538/Programs/Yet Another Subarray Problem Alternate Solution.cpp
type info (line 8) | struct info
method info (line 12) | info(int i, int v)
function main (line 23) | int main()
FILE: Contests/Div 2 538/Programs/Yet Another Subarray Problem.cpp
type info (line 8) | struct info
method info (line 12) | info(int i, int v)
function main (line 23) | int main()
FILE: Contests/Div 2 539/Programs/Sasha and A Bit of Relax.cpp
function main (line 9) | int main()
FILE: Contests/Div 2 539/Programs/Sasha and His Trip.cpp
function main (line 5) | int main()
FILE: Contests/Div 2 539/Programs/Sasha and Magnetic Machine.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 539/Programs/Sasha and One More Name.cpp
function increment (line 6) | void increment(int &i, int n)
function decrement (line 11) | void decrement(int &i, int n)
function is_palindrome (line 16) | int is_palindrome(string &S, int left)
function is_equal (line 31) | int is_equal(string &S, int start)
function is_cut_impossible (line 44) | int is_cut_impossible(string &S)
function main (line 57) | int main()
FILE: Contests/Div 2 546/Programs/Nastya is Playing Computer Games.cpp
function main (line 4) | int main()
FILE: Contests/Div 2 546/Programs/Nastya is Transposing Matrices.cpp
function main (line 8) | int main()
FILE: Contests/Div 2 554/Programs/Neko Does Math.cpp
function LL (line 9) | LL lcm(LL a, LL b)
function factorise (line 14) | void factorise(LL n, vector <int> &F)
function main (line 28) | int main()
FILE: Contests/Div 2 562/Programs/Good Triple.cpp
function is_good (line 6) | int is_good(string &S)
function main (line 22) | int main()
FILE: Contests/Div 2 562/Programs/Increasing by Modulo.cpp
function possible (line 6) | int possible(int operations, int m, vector <int> &A)
function main (line 24) | int main()
FILE: Contests/Div 2 562/Programs/Pairs.cpp
function check_for_x (line 10) | int check_for_x(int n)
function main (line 38) | int main()
FILE: Contests/Div 2 566/Programs/Filing Shapes.cpp
function main (line 5) | int main()
FILE: Contests/Div 2 566/Programs/Plus From Picture.cpp
function main (line 9) | int main()
FILE: Contests/Div 2 585/Programs/Swap Letters.cpp
function main (line 7) | int main()
FILE: Contests/Div 2 585/Programs/The Number of Products.cpp
function choose_2 (line 6) | long long choose_2(long long n)
function main (line 11) | int main()
FILE: Contests/Div 2 585/Programs/Yellow Cards.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 588/Programs/Anadi and Domino.cpp
function main (line 9) | int main()
FILE: Contests/Div 2 588/Programs/Ania and Minimizing.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 588/Programs/Dawid and Bags of Candies.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 588/Programs/Kamil and Making a Stream.cpp
function gcd (line 13) | long long gcd(long long x, long long y)
function dfs (line 21) | void dfs(int v, map <long long, int> frequency)
function main (line 54) | int main()
FILE: Contests/Div 2 588/Programs/Konrad and Company Evaluation.cpp
function contribution (line 11) | long long contribution(int v)
function main (line 16) | int main()
FILE: Contests/Div 2 588/Programs/Marcin and Training Camp.cpp
function is_submask (line 10) | int is_submask(long long mask, long long submask)
function main (line 15) | int main()
FILE: Contests/Div 2 589/Programs/Complete Tripartite.cpp
function main (line 7) | int main()
FILE: Contests/Div 2 589/Programs/Distinct Digits.cpp
function distinct_digits (line 6) | int distinct_digits(int n)
function main (line 23) | int main()
FILE: Contests/Div 2 589/Programs/Filing the Grid.cpp
function LL (line 8) | LL power_mod(LL n, LL power, LL mod)
function main (line 24) | int main()
FILE: Contests/Div 2 589/Programs/Primes and Multiplication.cpp
function LL (line 8) | LL get_exponent(LL n, LL p)
function factorise (line 23) | void factorise(LL n, vector <LL> &P)
function LL (line 44) | LL power_mod(LL n, LL power, LL mod)
function main (line 60) | int main()
FILE: Contests/Div 2 592/Programs/Minimizing Difference.cpp
function main (line 8) | int main()
FILE: Contests/Div 2 592/Programs/Pens and Pencils.cpp
function ceil (line 6) | int ceil(int n, int d)
function solve (line 11) | void solve()
function main (line 29) | int main()
FILE: Contests/Div 2 592/Programs/Rooms and Staircases.cpp
function solve (line 6) | void solve()
function main (line 24) | int main()
FILE: Contests/Div 2 592/Programs/The Football Season.cpp
function main (line 5) | int main()
FILE: Contests/Div 2 596/Programs/Forgetting Things.cpp
function main (line 5) | int main()
FILE: Contests/Div 2 596/Programs/P-Binary.cpp
function main (line 7) | int main()
FILE: Contests/Div 2 596/Programs/Power Products.cpp
function sieve (line 12) | void sieve()
function get_factors (line 36) | void get_factors(vector <pair <int, int> > &F, long long &n)
function get_complement (line 65) | long long get_complement(long long n, long long power)
function main (line 133) | int main()
FILE: Contests/Div 2 596/Programs/TV Subscriptions.cpp
function solve (line 7) | void solve()
function main (line 54) | int main()
FILE: Contests/Div 2 597/Programs/Constanze's Machine.cpp
function main (line 7) | int main()
FILE: Contests/Div 2 597/Programs/Good Ol Number Colouring.cpp
function solve (line 8) | void solve()
function main (line 16) | int main()
FILE: Contests/Div 2 597/Programs/Restricted RPS.cpp
function solve (line 8) | void solve()
function main (line 107) | int main()
FILE: Contests/Div 2 599/Programs/Character Swap.cpp
function solve (line 8) | void solve()
function main (line 77) | int main()
FILE: Contests/Div 2 599/Programs/Maximum Square.cpp
function solve (line 6) | void solve()
function main (line 33) | int main()
FILE: Contests/Div 2 599/Programs/Tile Painting.cpp
function factorise (line 6) | void factorise(long long n, vector <long long> &F)
function main (line 27) | int main()
FILE: Contests/Div 2 600/Programs/Antenna Coverage.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 600/Programs/Harmonious Graph.cpp
type component (line 12) | struct component
method component (line 16) | component()
method component (line 21) | component(int Min, int Max)
function dfs (line 27) | void dfs(int v, component &C)
function main (line 47) | int main()
FILE: Contests/Div 2 600/Programs/Silly Mistakes.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 600/Programs/Single Push.cpp
function solve (line 6) | void solve()
function main (line 46) | int main()
FILE: Contests/Div 2 600/Programs/Sweets Eating.cpp
function main (line 8) | int main()
FILE: Contests/Div 2 608/Programs/Shwarma Tent.cpp
function max_3 (line 6) | int max_3(int a, int b, int c)
function main (line 11) | int main()
FILE: Contests/Div 2 85/Programs/Petya and Divisors.cpp
function main (line 6) | int main()
FILE: Contests/Div 2 85/Programs/Petya and Inequiations.cpp
function main (line 3) | int main()
FILE: Contests/Div 2 85/Programs/Petya and Strings.cpp
function main (line 7) | int main()
FILE: Contests/Div 3 479/Programs/Consecutive Subsequences.cpp
function main (line 7) | int main()
FILE: Contests/Div 3 479/Programs/Cyclic Components.cpp
function dfs_and_mark_component (line 12) | void dfs_and_mark_component(int v, int no)
function main (line 26) | int main()
FILE: Contests/Div 3 479/Programs/Divide by Three, Multiply by Two Alternate Solution.cpp
function main (line 9) | int main()
FILE: Contests/Div 3 479/Programs/Divide by Three, Multiply by Two.cpp
type info (line 10) | struct info
function compare (line 16) | int compare(const info &A, const info &B)
function main (line 24) | int main()
FILE: Contests/Div 3 479/Programs/Less or Equal.cpp
function main (line 10) | int main()
FILE: Contests/Div 3 479/Programs/Two Gram.cpp
function main (line 7) | int main()
FILE: Contests/Div 3 479/Programs/Wrong Subtraction.cpp
function main (line 3) | int main()
FILE: Contests/Div 3 481/Programs/Almost Arithmetic Progression.cpp
function main (line 7) | int main()
FILE: Contests/Div 3 481/Programs/File Name.cpp
function main (line 6) | int main()
FILE: Contests/Div 3 481/Programs/Letters.cpp
function main (line 8) | int main()
FILE: Contests/Div 3 481/Programs/Mentors.cpp
function main (line 8) | int main()
FILE: Contests/Div 3 481/Programs/Remove Duplicates.cpp
function main (line 10) | int main()
FILE: Contests/Div 3 486/Programs/Diverse Team.cpp
function main (line 12) | int main()
FILE: Contests/Div 3 486/Programs/Divisibility by 25.cpp
function min_moves_for_suffix (line 9) | int min_moves_for_suffix(string S, string suffix)
function main (line 54) | int main()
FILE: Contests/Div 3 486/Programs/Equal Sums.cpp
function main (line 7) | int main()
FILE: Contests/Div 3 486/Programs/Points and Powers of Two.cpp
function main (line 9) | int main()
FILE: Contests/Div 3 486/Programs/Substring Sort.cpp
function sort_by_length (line 9) | int sort_by_length(const string &A, const string &B)
function substring_of (line 14) | int substring_of(string S, string sub_S)
function main (line 35) | int main()
FILE: Contests/Div 3 490/Programs/Alphabetic Removals.cpp
function main (line 7) | int main()
FILE: Contests/Div 3 490/Programs/Equalise the Remainders.cpp
function main (line 9) | int main()
FILE: Contests/Div 3 490/Programs/Mishika and Contests.cpp
function main (line 6) | int main()
FILE: Contests/Div 3 490/Programs/Reachability from Capital.cpp
function dfs (line 20) | void dfs(int v)
function reverse_dfs (line 35) | void reverse_dfs(int v, in
Condensed preview — 2576 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,557K chars).
[
{
"path": "2020/Combined Divisions/621 Div 1 + 2/Explanations/Cow and Fields Explanation.txt",
"chars": 2468,
"preview": "Let S[i] denote the distance of vertex i from source\n\nLet T[i] denote the distance of vertex i from the target\n\nWe can d"
},
{
"path": "2020/Combined Divisions/621 Div 1 + 2/Explanations/Cow and Friend Explanation.txt",
"chars": 1112,
"preview": "First of all, if x exists in the original array, then the answer is 1.\n\nIf there is at least one element A[i] such that "
},
{
"path": "2020/Combined Divisions/621 Div 1 + 2/Explanations/Cow and Haybales Explanation.txt",
"chars": 573,
"preview": "We can simulate the process.\n\nOne by one, we will carry the i-th element over to A[2] and then transfer it to A[1]\n\n----"
},
{
"path": "2020/Combined Divisions/621 Div 1 + 2/Explanations/Cow and Message Explanation.txt",
"chars": 1638,
"preview": "Observation - The number of good strings will be equal to the number of pairs\nand single letters.\n\nProof -\n\nIt is clear "
},
{
"path": "2020/Combined Divisions/621 Div 1 + 2/Explanations/Cows and Treats Explanation.txt",
"chars": 4282,
"preview": "1. At most 2 cows can come and at most 1 from each side, one from the left, one from the right.\n\n2. Suppose I know that "
},
{
"path": "2020/Combined Divisions/621 Div 1 + 2/Programs/Cow and Fields.cpp",
"chars": 2326,
"preview": "#include <iostream>\n#include <vector>\n#include <queue>\n#include <algorithm>\n\nusing namespace std;\n\nconst int MAX_N = 5e5"
},
{
"path": "2020/Combined Divisions/621 Div 1 + 2/Programs/Cow and Haybales.cpp",
"chars": 689,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements, no_of_days;\n cin "
},
{
"path": "2020/Combined Divisions/621 Div 1 + 2/Programs/Cow and Message.cpp",
"chars": 1165,
"preview": "#include <iostream>\n#include <vector>\n#include <map>\n\nusing namespace std;\n\nint main()\n{\n string S;\n cin >> S;\n "
},
{
"path": "2020/Combined Divisions/621 Div 1 + 2/Programs/Cows and Treats.cpp",
"chars": 4109,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\nusing namespace std;\n\n"
},
{
"path": "2020/Combined Divisions/CodeForces Global Round 7/Explanations/Bad Ugly Numbers Explanation.txt",
"chars": 755,
"preview": "Let us think of the divisibility rules of each number.\n\nA number is divisible by 5 only if the last digit if 5 or 0\n\nSo,"
},
{
"path": "2020/Combined Divisions/CodeForces Global Round 7/Explanations/Maximums Explanation.txt",
"chars": 740,
"preview": "We will just simulate the process.\n\nWe will keep track of the maximum element in B[1, ... , i]\n\nA[i] = B[i] + prefix_max"
},
{
"path": "2020/Combined Divisions/CodeForces Global Round 7/Explanations/Permutation Partitions Explanation.txt",
"chars": 1710,
"preview": "Ultimately, the K greatest integers will be the best sum\nIt is always possible to make segments in such a way the K grea"
},
{
"path": "2020/Combined Divisions/CodeForces Global Round 7/Explanations/Prefix Suffix Palindrome (Easy Version) Explanation.txt",
"chars": 2744,
"preview": "The optimal string consists of\n\n1. Some set of matching prefix and suffix of the string\n2. And then some palindrome that"
},
{
"path": "2020/Combined Divisions/CodeForces Global Round 7/Programs/Bad Ugly Numbers.cpp",
"chars": 406,
"preview": "#include <iostream>\n\nusing namespace std;\n\nvoid solve()\n{\n int n;\n cin >> n;\n \n if(n == 1)\n {\n cou"
},
{
"path": "2020/Combined Divisions/CodeForces Global Round 7/Programs/Maximums.cpp",
"chars": 632,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nint main()\n{\n int no_of_elements;\n cin >> no_of_eleme"
},
{
"path": "2020/Combined Divisions/CodeForces Global Round 7/Programs/Permutation Partitions.cpp",
"chars": 1016,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\nusing namespace std;\n\n"
},
{
"path": "2020/Combined Divisions/CodeForces Global Round 7/Programs/Prefix Suffix Palindrome (Easy Version).cpp",
"chars": 2733,
"preview": "#include <iostream>\n#include <vector>\n#include <cstring>\n\nusing namespace std;\n\nconst int MAX_N = 5005;\nint max_palindro"
},
{
"path": "2020/Combined Divisions/Ozone Tech Challenge 2020/Explanations/Kuroni and Impossible Calculation Explanation.txt",
"chars": 1156,
"preview": "If there are two integers A[i] and A[j] such that (A[i] = A[j] (mod m))\n\nThen (A[i] - A[j] = 0) (mod m)\n\nThere are only "
},
{
"path": "2020/Combined Divisions/Ozone Tech Challenge 2020/Explanations/Kuroni and Punishment Explanation.txt",
"chars": 3099,
"preview": "Firstly, we will notice that the answer will never be more than N.\n\nWe can always use at most one move for each element "
},
{
"path": "2020/Combined Divisions/Ozone Tech Challenge 2020/Explanations/Kuroni and Simple Strings Explanation.txt",
"chars": 2149,
"preview": "It is best to be greedy.\n\nWe will remove '(' from the left.\n\nAnd for each '(', we will look for an ')', as much to the r"
},
{
"path": "2020/Combined Divisions/Ozone Tech Challenge 2020/Explanations/Kuroni and the Celebration Explanation.txt",
"chars": 2216,
"preview": "Let us keep all the leaves in a vector.\n\nWe will pick out two leaves u and v and query their LCA\n\nIf LCA(u, v) = u or v,"
},
{
"path": "2020/Combined Divisions/Ozone Tech Challenge 2020/Explanations/Kuroni and the Gifts Explanation.txt",
"chars": 862,
"preview": "The elements of both A and B are distinct.\n\nThe smallest possible sum is A[1] + B[1]\n\nWe will sort the elements and (A[i"
},
{
"path": "2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and Impossible Calculation.cpp",
"chars": 727,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\nusing namespace std;\n\n"
},
{
"path": "2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and Punishment.cpp",
"chars": 1823,
"preview": "#include <iostream>\n#include <vector>\n#include <set>\n#include <algorithm>\n#include <random>\n\nusing namespace std;\n\nvoid "
},
{
"path": "2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and Simple Strings.cpp",
"chars": 2075,
"preview": "#include <iostream>\n#include <string>\n#include <vector>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\nusin"
},
{
"path": "2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and the Celebration.cpp",
"chars": 1820,
"preview": "#include <iostream>\n#include <vector>\n#include <set>\n\nusing namespace std;\n\nvector <set <int> > tree;\nset <int> leaves;\n"
},
{
"path": "2020/Combined Divisions/Ozone Tech Challenge 2020/Programs/Kuroni and the Gifts.cpp",
"chars": 851,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\nusing namespace std;\n\n"
},
{
"path": "2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Explanations/As Simple as One and Two Explanation.txt",
"chars": 1036,
"preview": "We will make 2 passes through the string. \n\n1. In Pass 1, we will remove all the 'o' which are common to both \"one\" and "
},
{
"path": "2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Explanations/Happy Birthday Polycarp Explanation.txt",
"chars": 695,
"preview": "If the number has d digits, then all strings upto length (d - 1) are automatically good.\n\nSo the answer is initially 9(d"
},
{
"path": "2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Explanations/Make Them Odd Explanation.txt",
"chars": 801,
"preview": "In every step, we will keep dividing the largest element till it becomes odd.\n\nUse a set to hit only distinct elements.\n"
},
{
"path": "2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Programs/As Simple as One and Two.cpp",
"chars": 1025,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n string S;\n cin >> S;\n \n vector "
},
{
"path": "2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Programs/Happy Birthday Polycarp.cpp",
"chars": 718,
"preview": "#include <iostream>\n\nusing namespace std;\n\nint no_of_digits(int n)\n{\n int digits = 0;\n \n while(n > 0)\n {\n "
},
{
"path": "2020/Div 2/606 Div 2 Technocup 2020 Elimination Round 4/Programs/Make Them Odd.cpp",
"chars": 863,
"preview": "#include <iostream>\n#include <vector>\n#include <set>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements;\n c"
},
{
"path": "2020/Div 2/609 Div 2/Explanations/Domino for Young Explanation.txt",
"chars": 625,
"preview": "We can think of it as a chessboard.Each domino covers one square of each colour.\n\nThe answer is whichever is minimum - b"
},
{
"path": "2020/Div 2/609 Div 2/Explanations/Equation Explanation.txt",
"chars": 205,
"preview": "We can just print 9n and 8n.\n\ngcd(8, 9) = 1 and 9n - 8n = 1\n\n-----\n\n#include <iostream>\n\nusing namespace std;\n\nint main("
},
{
"path": "2020/Div 2/609 Div 2/Explanations/Long Beautiful Integer Explanation.txt",
"chars": 1504,
"preview": "The first k characters determine the entire string.\nWe will first set B[i] = B[i%k] for every i.\n\nIf B >= A like this, t"
},
{
"path": "2020/Div 2/609 Div 2/Explanations/Modulo Equality Explanation.txt",
"chars": 1347,
"preview": "Let us check all possible candidates that we can add to A to make it equal to B.\n\nWhen A = B, then A[1] is equal to some"
},
{
"path": "2020/Div 2/609 Div 2/Programs/Domino for Young.cpp",
"chars": 496,
"preview": "#include <iostream>\n \nusing namespace std;\n \nint main()\n{\n int no_of_columns;\n cin >> no_of_columns;\n \n long"
},
{
"path": "2020/Div 2/609 Div 2/Programs/Equation.cpp",
"chars": 141,
"preview": "#include <iostream>\n\nusing namespace std;\n\nint main()\n{\n int n;\n cin >> n;\n \n cout << 9*n << \" \" << 8*n << \""
},
{
"path": "2020/Div 2/609 Div 2/Programs/Long Beautiful Integer.cpp",
"chars": 1121,
"preview": "#include <iostream>\n#include <string>\n\nusing namespace std;\n\nint main()\n{\n int no_of_digits, k;\n string S;\n cin"
},
{
"path": "2020/Div 2/609 Div 2/Programs/Modulo Equality.cpp",
"chars": 1175,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\nusing namespace std;\n\n"
},
{
"path": "2020/Div 2/612 Div 2/Explanations/Angry Students Explanation.txt",
"chars": 730,
"preview": "The prefix of P's will not be changed.\n\nFor every other P, the amount of time taken to change it is equal to the distanc"
},
{
"path": "2020/Div 2/612 Div 2/Explanations/Hyperset Explanation.txt",
"chars": 2961,
"preview": "Let us notice something. \n\nSuppose we fix 2 strings A and B. \n\nThere can only be 1 string C, such that (A, B, C) is a se"
},
{
"path": "2020/Div 2/612 Div 2/Explanations/Madhouse (Easy Version) Explanation.txt",
"chars": 2802,
"preview": "Let us do this.\n\nSince we are given random permutations of every substring, we will collect a vector of length 26\ndenoti"
},
{
"path": "2020/Div 2/612 Div 2/Programs/Angry Students.cpp",
"chars": 766,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n int length;\n string S;\n cin >> len"
},
{
"path": "2020/Div 2/612 Div 2/Programs/Hyperset.cpp",
"chars": 1796,
"preview": "#include <iostream>\n#include <map>\n#include <vector>\n\nusing namespace std;\n\nchar get_third(char a, char b)\n{\n switch("
},
{
"path": "2020/Div 2/612 Div 2/Programs/Madhouse (Easy Version).cpp",
"chars": 2284,
"preview": "#include <iostream>\n#include <vector>\n#include <map>\n#include <set>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v"
},
{
"path": "2020/Div 2/613 Div 2/Explanations/Dr Evil Underscores Explanation.txt",
"chars": 1115,
"preview": "If all the integers have a 1 in a bit position or a 0 in a bit position, \nthen the answer will have a 0 there if we put "
},
{
"path": "2020/Div 2/613 Div 2/Explanations/Fadi and LCM Explanation.txt",
"chars": 1307,
"preview": "Let us notice something.\n\nSuppose p is a prime integer.\n\nThe LCM of (p^a, p^b) is p^{max(a, b)}\n\nIf X = p1^a1 p2^a2 ... "
},
{
"path": "2020/Div 2/613 Div 2/Explanations/Just Eat It Explanation.txt",
"chars": 1442,
"preview": "We will use Kandane's Algorithm to find out the best segment that can be chosen at each point.\n\nThe only exception is wh"
},
{
"path": "2020/Div 2/613 Div 2/Explanations/Mezo Playing Zoma Explanation.txt",
"chars": 466,
"preview": "If there are L lefts and R rights, then we can end up anywhere between [-L, R]\n\nThe answer = (L + R + 1)\n\n------\n\nint ma"
},
{
"path": "2020/Div 2/613 Div 2/Programs/Dr Evil Underscores.cpp",
"chars": 1028,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nint is_bit_set(long long n, int bit)\n{\n return ( (n&(1LL"
},
{
"path": "2020/Div 2/613 Div 2/Programs/Fadi and LCM.cpp",
"chars": 1339,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nint is_bit_set(long long n, int bit)\n{\n return ( ( n&(1L"
},
{
"path": "2020/Div 2/613 Div 2/Programs/Just Eat It.cpp",
"chars": 1163,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements;\n cin >> no_of_ele"
},
{
"path": "2020/Div 2/613 Div 2/Programs/Mezo Playing Zoma.cpp",
"chars": 403,
"preview": "#include <iostream>\n\nusing namespace std;\n\nint main()\n{\n int length;\n string S;\n cin >> length >> S;\n \n i"
},
{
"path": "2020/Div 2/616 Div 2/Explanations/Array Sharpening Explanation.txt",
"chars": 2179,
"preview": "Let us make an observation here\n\nIf it is possible to make (A[1] < A[2] < A[3] < ... < A[k]),\n\nthen it is possible to ma"
},
{
"path": "2020/Div 2/616 Div 2/Explanations/Even But Not Even Explanation.txt",
"chars": 596,
"preview": "The sum of 2 odd numbers is even.\n\nIf there are at least 2 odd numbers, we will print them in order\n\nOtherwise, it is no"
},
{
"path": "2020/Div 2/616 Div 2/Explanations/Mind Control Explanation.txt",
"chars": 1816,
"preview": "1. Suppose there are (k - 1) people in front of you. \nUltimately, we will have p elements taken from the prefix and s el"
},
{
"path": "2020/Div 2/616 Div 2/Programs/Array Sharpening.cpp",
"chars": 1629,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements;\n cin >> no_of_ele"
},
{
"path": "2020/Div 2/616 Div 2/Programs/Even But Not Even.cpp",
"chars": 669,
"preview": "#include <iostream>\n\nusing namespace std;\n\nvoid solve()\n{\n int length;\n string S;\n \n cin >> length >> S;\n "
},
{
"path": "2020/Div 2/616 Div 2/Programs/Mind Control.cpp",
"chars": 1155,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements, position, controlled"
},
{
"path": "2020/Div 2/618 Div 2/Explanations/Anu has a Function Explanation.txt",
"chars": 1776,
"preview": "Observation - f(x, y) will only have the bits that are set in x\n\nEvery bit in y is subtracted so we cannot add any new b"
},
{
"path": "2020/Div 2/618 Div 2/Programs/Anu has a Function.cpp",
"chars": 1235,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nint is_bit_set(long long n, int bit)\n{\n return ((n & (1L"
},
{
"path": "2020/Div 2/619 Div 2/Explanations/Ayoub's Function Explanation.txt",
"chars": 1870,
"preview": "We need to maximise the number of substrings containing at least 1 one.\nThis is the same as minimizing the number of sub"
},
{
"path": "2020/Div 2/619 Div 2/Explanations/Motarack's Birthday Explanation.txt",
"chars": 1361,
"preview": "Let us look at the elements which -1 is adjacent to.\n\nLet them be {F1, F2, ... , Fm}\n\nThe maximum value of |k - Fi| for "
},
{
"path": "2020/Div 2/619 Div 2/Explanations/Three Strings Explanation.txt",
"chars": 431,
"preview": "For each position i, \n\nWe must swap either (A[i], C[i]) or (B[i], C[i])\n\nThis means that either (B[i] = C[i]) or (A[i] ="
},
{
"path": "2020/Div 2/619 Div 2/Explanations/Time to Run Explanation.txt",
"chars": 2346,
"preview": "We will start from (1, 1)\n\nIn any given row, we will go left till we reach the end of that row.\nThen, we will go UDR, ti"
},
{
"path": "2020/Div 2/619 Div 2/Programs/Ayoub's Function.cpp",
"chars": 1054,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\nusing namespace std;\n\n"
},
{
"path": "2020/Div 2/619 Div 2/Programs/Motarack's Birthday.cpp",
"chars": 1280,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\nusing namespace std;\n\n"
},
{
"path": "2020/Div 2/619 Div 2/Programs/Three Strings.cpp",
"chars": 486,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n string A, B, C;\n cin >> A >> B >> C;\n"
},
{
"path": "2020/Div 2/619 Div 2/Programs/Time to Run.cpp",
"chars": 2295,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nint range(int max_1, int distance, int size, int &steps)\n{\n"
},
{
"path": "2020/Div 2/620 Div 2/Explanations/1-Trees and Queries Explanation.txt",
"chars": 1741,
"preview": "There is a crucial insight that we can make here.\nWe can make a 'waiting' move.\n\nAfter we travel from a -> b, we can kee"
},
{
"path": "2020/Div 2/620 Div 2/Explanations/Air Conditioner Explanation.txt",
"chars": 2376,
"preview": "We can interpret this problem geometrically and it would help greatly.\n\nLet us visualise the time on the y-axis and the "
},
{
"path": "2020/Div 2/620 Div 2/Explanations/Longest Palindrome Explanation.txt",
"chars": 1933,
"preview": "Let R[S] be the reverse of string S\n\nThe final palindrome looks like this\n\nS1 S2 S3 ... Sm (M)R[Sm] ... R[S3]R[S2]R[S1]\n"
},
{
"path": "2020/Div 2/620 Div 2/Explanations/Shortest and Longest LIS Explanation.txt",
"chars": 2160,
"preview": "1. If we want to make the shortest LIS possible, we must make sure 1 comes as late as possible as it matches with every "
},
{
"path": "2020/Div 2/620 Div 2/Explanations/Two Rabbits Explanation.txt",
"chars": 543,
"preview": "There are two rabbits.\nThe distance between them reduces by (a + b)\nin 1 second.\nThe total distance to be covered is (x "
},
{
"path": "2020/Div 2/620 Div 2/Programs/1-Trees and Queries.cpp",
"chars": 2621,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nconst int MAX_N = 1e5 + 5, MAX_L = 25;\nvector <int> tree[MA"
},
{
"path": "2020/Div 2/620 Div 2/Programs/Air Conditioner.cpp",
"chars": 1590,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\nusing namespace std;\n\n"
},
{
"path": "2020/Div 2/620 Div 2/Programs/Longest Palindrome.cpp",
"chars": 1591,
"preview": "#include <iostream>\n#include <vector>\n#include <map>\n#include <algorithm>\n#include <string>\n\n#define all(v) (v).begin(),"
},
{
"path": "2020/Div 2/620 Div 2/Programs/Shortest and Longest LIS.cpp",
"chars": 1718,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n int length;\n string S;\n cin >> len"
},
{
"path": "2020/Div 2/620 Div 2/Programs/Two Rabbits.cpp",
"chars": 500,
"preview": "#include <iostream>\n\nusing namespace std;\n\nvoid solve()\n{\n long long position_1, position_2, distance_1, distance_2;\n"
},
{
"path": "2020/Div 2/622 Div 2/Explanations/Fast Food Restaurant Explanation.txt",
"chars": 1173,
"preview": "We will have a bitmask corresponding to each possibility.\n\nHere is our strategy \n\n001\n010\n100\n011\n101\n110\n111\n\n-----\n\nSo"
},
{
"path": "2020/Div 2/622 Div 2/Explanations/Sky Scrapers (Hard Version) Explanation.txt",
"chars": 2788,
"preview": "This is the same as the Easy Version\n\nFor every A[i], we will calculate the total height if this were the peak.\n\nHere, i"
},
{
"path": "2020/Div 2/622 Div 2/Explanations/Skyscrapers (Easy Version) Explanation.txt",
"chars": 1226,
"preview": "The array will be ascending for some time and then descending.\n\nWe will iterate over all N plots and find the total if t"
},
{
"path": "2020/Div 2/622 Div 2/Programs/Fast Food Restaurants.cpp",
"chars": 1199,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\nusing namespace std;\n\n"
},
{
"path": "2020/Div 2/622 Div 2/Programs/Skyscrapers (Easy Version).cpp",
"chars": 1185,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nlong long count(int P, vector <int> &limit, vector <int> &A"
},
{
"path": "2020/Div 2/622 Div 2/Programs/Skyscrapers (Hard Version).cpp",
"chars": 2254,
"preview": "#include <iostream>\n#include <vector>\n#include <stack>\n\nusing namespace std;\n\nint main()\n{\n int no_of_plots;\n cin "
},
{
"path": "2020/Div 2/623 Div 2/Explanations/Dead Pixel Explanation.txt",
"chars": 677,
"preview": "There are 4 possible areas\n\n(x - 1)b\n(a - x)b\na(y - 1)\na(b - y)\n\nWe will choose the maximum of the 4 areas\n\n-----\n\n#incl"
},
{
"path": "2020/Div 2/623 Div 2/Explanations/Homecoming Explanation.txt",
"chars": 988,
"preview": "This is a tricky problem because of the condition that we will not\nneed to go anywhere from the last station.\n\nWe will s"
},
{
"path": "2020/Div 2/623 Div 2/Explanations/Recommendations Explanation.txt",
"chars": 2732,
"preview": "The only operation that we are allowed is addition.\n\nLet us start processing the elements in ascending order.\n\nAt any po"
},
{
"path": "2020/Div 2/623 Div 2/Explanations/Restoring Permutation Explanation.txt",
"chars": 1224,
"preview": "We will be greedy.\n\nWe will keep a set of all integers not used so far.\n\nFor each B[i], we will take the smallest intege"
},
{
"path": "2020/Div 2/623 Div 2/Programs/Dead Pixel.cpp",
"chars": 590,
"preview": "#include <iostream>\n\nusing namespace std;\n\nvoid solve()\n{\n int a, b, x, y;\n cin >> a >> b >> x >> y;\n \n x++;"
},
{
"path": "2020/Div 2/623 Div 2/Programs/Homecoming.cpp",
"chars": 895,
"preview": "#include <iostream>\n\nusing namespace std;\n\nvoid solve()\n{\n int bus, tram, budget;\n cin >> bus >> tram >> budget;\n "
},
{
"path": "2020/Div 2/623 Div 2/Programs/Recommendations.cpp",
"chars": 1476,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n#include <set>\n#include <map>\n\n#define all(v) (v).begin(), (v"
},
{
"path": "2020/Div 2/623 Div 2/Programs/Restoring Permutations.cpp",
"chars": 1232,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n#include <set>\n\nusing namespace std;\n\nvoid solve()\n{\n int "
},
{
"path": "2020/Div 2/625 Div 2/Explanations/Contest for Robots Explanation.txt",
"chars": 1249,
"preview": "Let us count the number of problems, A, which A solves and B does not\nAnd B = The number of problems B solves which A do"
},
{
"path": "2020/Div 2/625 Div 2/Explanations/Journey Planning Explanation.txt",
"chars": 931,
"preview": "We are told that if we move from i to j, then \n\nj - i = A[j] - A[i]\n\nA[i] - i = A[j] - j\n\nThis insight is easier to come"
},
{
"path": "2020/Div 2/625 Div 2/Explanations/Navigation System Explanation.txt",
"chars": 2095,
"preview": "Let us find the shortest distance of each vertex from the source.\nLet it be in D\n\nTo find D in a directed graph, we have"
},
{
"path": "2020/Div 2/625 Div 2/Explanations/Remove Adjacent Explanation.txt",
"chars": 1016,
"preview": "We can be greedy and start removing alphabets one by one from Z to A\n\nWe need S[i - 1] to remove S[i]. We do not need an"
},
{
"path": "2020/Div 2/625 Div 2/Programs/Contest for Robotos.cpp",
"chars": 880,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nint main()\n{\n int no_of_robots;\n cin >> no_of_robots;"
},
{
"path": "2020/Div 2/625 Div 2/Programs/Journey Planning.cpp",
"chars": 622,
"preview": "#include <iostream>\n#include <vector>\n#include <map>\n\nusing namespace std;\n\nint main()\n{\n int no_of_elements;\n cin"
},
{
"path": "2020/Div 2/625 Div 2/Programs/Navigation System.cpp",
"chars": 1866,
"preview": "#include <iostream>\n#include <vector>\n#include <queue>\n\nusing namespace std;\n\nconst int MAX_N = 2e5 + 5;\nvector <int> gr"
},
{
"path": "2020/Div 2/625 Div 2/Programs/Remove Adjacent.cpp",
"chars": 843,
"preview": "#include <iostream>\n#include <string>\n\nusing namespace std;\n\nint main()\n{\n int length;\n string S;\n cin >> lengt"
},
{
"path": "2020/Div 2/626 Div 2/Explanations/Count Subrectangles Explanation.txt",
"chars": 5131,
"preview": "1. If A[i] = 0, then the whole i-th row is 0. \nIf B[j] = 0, the whole column j is 0\n\n-----\n\n2. Ultimately, the matrix co"
},
{
"path": "2020/Div 2/626 Div 2/Explanations/Even Subset Sum Problem Explanation.txt",
"chars": 712,
"preview": "We will either print 1 even integer or 2 odd integers\n\nIf there is only 1 odd integer, it is not possible\n\n-----\n\nvoid s"
},
{
"path": "2020/Div 2/626 Div 2/Explanations/Unusual Competitions Explanation.txt",
"chars": 936,
"preview": "Let us replace the '(' by +1 and the ')' by -1\n\nWe will keep track of the prefix sum\n\nIf at some point, the sum goes be"
},
{
"path": "2020/Div 2/626 Div 2/Programs/Counting Subrectangles.cpp",
"chars": 4578,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n#include <map>\n\n#define all(v) (v).begin(), (v).end()\nusing n"
},
{
"path": "2020/Div 2/626 Div 2/Programs/Even Subset Sum Problem.cpp",
"chars": 841,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements;\n cin >> no_of_ele"
},
{
"path": "2020/Div 2/626 Div 2/Programs/Unusual Competitions.cpp",
"chars": 746,
"preview": "#include <iostream>\n#include <string>\n\nusing namespace std;\n\nint main()\n{\n int length;\n string S;\n cin >> lengt"
},
{
"path": "2020/Div 2/628 Div 2/Explanations/Copy Copy Copy Copy Copy Explanation.txt",
"chars": 654,
"preview": "We concatenate the array N times with itself\n\nWe can pick all the distinct elements of the array and that will be the lo"
},
{
"path": "2020/Div 2/628 Div 2/Explanations/Ehab and GCD Explanation.txt",
"chars": 367,
"preview": "We can use (1, x - 1)\n\ngcd(1, x - 1) = 1\nlcm(1, x - 1) = x - 1\n\ngcd(1, x - 1) + lcm(1, x - 1) = x\n\n-----\n\n#include <iost"
},
{
"path": "2020/Div 2/628 Div 2/Explanations/Ehab and Path-etic MEX Explanation.txt",
"chars": 862,
"preview": "The crucial insight here is that there will always be a path running through\nany 2 edges.\n\nSo, there will always be a pa"
},
{
"path": "2020/Div 2/628 Div 2/Explanations/Ehab and XORcist Explanation.txt",
"chars": 3671,
"preview": "Suppose\n\nU = 110001 V = 1100001\n\nI will keep track of the frequency of all 64 bits\n\nSo initially, it will be U = 110001\n"
},
{
"path": "2020/Div 2/628 Div 2/Programs/Copy Copy Copy Copy Copy.cpp",
"chars": 568,
"preview": "#include <iostream>\n#include <vector>\n#include <set>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements;\n c"
},
{
"path": "2020/Div 2/628 Div 2/Programs/Ehab and GCD.cpp",
"chars": 273,
"preview": "#include <iostream>\n\nusing namespace std;\n\nvoid solve()\n{\n long long x;\n cin >> x;\n \n cout << \"1 \" << x - 1 "
},
{
"path": "2020/Div 2/628 Div 2/Programs/Ehab and Pathetic MEX.cpp",
"chars": 1683,
"preview": "#include <iostream>\n#include <vector>\n#include <set>\n#include <map>\n#include <queue>\n\nusing namespace std;\n\nconst int MA"
},
{
"path": "2020/Div 2/628 Div 2/Programs/Ehab and XORcist.cpp",
"chars": 2354,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nint some_non_zero(vector <int> &A)\n{\n for(int i = 0; i <"
},
{
"path": "2020/Div 2/630 Div 2/Explanations/Composite Coloring Explanation.txt",
"chars": 2424,
"preview": "We need to make 1 observation\nIf a number is smaller than 1000, it must have at least 1 prime factor <= 31\n\nIf a number "
},
{
"path": "2020/Div 2/630 Div 2/Explanations/Exercising Walk Explanation.txt",
"chars": 1103,
"preview": "The X and Y axes are independent of each other.\n\nThe optimal solution is to use a 'waiting' move.\n\nKeep going [L, R] til"
},
{
"path": "2020/Div 2/630 Div 2/Explanations/Height All The Same Explanation.txt",
"chars": 2908,
"preview": "We have to make 2 crucial observations\n\n1. The integer doesn't matter. Only the parity matters.\nWe can make all integers"
},
{
"path": "2020/Div 2/630 Div 2/Explanations/K Complete Word Explanation.txt",
"chars": 1664,
"preview": "Let f(i, alpha) be the frequency of alphabet 'alpha' in positions = i (mod k)\n\nWe will compute this first.\n\nNow, the cha"
},
{
"path": "2020/Div 2/630 Div 2/Explanations/Walk on Matrix Explanation.txt",
"chars": 2548,
"preview": "Here is the basic idea -\n\nWe will make a matrix such that the DP matrix gives 0 as the answer and the actual answer\nis k"
},
{
"path": "2020/Div 2/630 Div 2/Programs/Composite Coloring.cpp",
"chars": 2079,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n#include <set>\n\nusing namespace std;\n\nvoid precompute(vector "
},
{
"path": "2020/Div 2/630 Div 2/Programs/Exercising Walk.cpp",
"chars": 991,
"preview": "#include <iostream>\n\nusing namespace std;\n\nvoid solve()\n{\n long long up, down, left, right;\n cin >> left >> right "
},
{
"path": "2020/Div 2/630 Div 2/Programs/Height All the Same.cpp",
"chars": 1382,
"preview": "#include <iostream>\n\nusing namespace std;\n\nlong long power_mod(long long x, long long power, long long MOD)\n{\n long l"
},
{
"path": "2020/Div 2/630 Div 2/Programs/K Complete Word.cpp",
"chars": 1504,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n const int NO_OF_ALPHABETS = 26;\n \n "
},
{
"path": "2020/Div 2/630 Div 2/Programs/Walk on Matrix.cpp",
"chars": 1723,
"preview": "#include <iostream>\n\nusing namespace std;\n\nconst int MAX_N = 3 + 2, MAX_BITS = 25;\nint matrix[MAX_N][MAX_N], dp[MAX_N][M"
},
{
"path": "2020/Div 2/631 Div 2/Explanations/Dreamoon Likes Coloring Explanation.txt",
"chars": 1702,
"preview": "Firstly, if the sum is less than N, it is not possible\n\nSecondly, if any A[i] > (n - i), then it means that it must begi"
},
{
"path": "2020/Div 2/631 Div 2/Explanations/Dreamoon Likes Permutations Explanation.txt",
"chars": 1575,
"preview": "1. Let p[i] represent the smallest integer which is not present in A[1, i]\n\n2. Let s[i] represent the smallest integer w"
},
{
"path": "2020/Div 2/631 Div 2/Explanations/Dreamoon Likes Sequences Explanation.txt",
"chars": 2889,
"preview": "Fact - Two consecutive integers in the sequence cannot have the same MSB\n\nSuppose, we have 2 elements A[i] and A[i + 1] "
},
{
"path": "2020/Div 2/631 Div 2/Explanations/Dreamoon and Ranking Collection Explanation.txt",
"chars": 975,
"preview": "The question is basically this\n\nAdd x elements to the array and give the greatest integer v such that\nall integers from "
},
{
"path": "2020/Div 2/631 Div 2/Programs/Dreamoon Likes Coloring.cpp",
"chars": 905,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nint main()\n{\n int no_of_cells, no_of_elements;\n cin >"
},
{
"path": "2020/Div 2/631 Div 2/Programs/Dreamoon Likes Permutations.cpp",
"chars": 1502,
"preview": "#include <iostream>\n#include <vector>\n#include <set>\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements;\n ci"
},
{
"path": "2020/Div 2/631 Div 2/Programs/Dreamoon Likes Sequences.cpp",
"chars": 1891,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nint is_bit_set(long long n, int bit)\n{\n return ( (n&(1LL"
},
{
"path": "2020/Div 2/631 Div 2/Programs/Dreamoon and Ranking Collection.cpp",
"chars": 846,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements, x;\n cin >> no_of_"
},
{
"path": "2020/Div 2/632 Div 2/Explanations/Eugene and Array Explanation.txt",
"chars": 2313,
"preview": "We will iterate from i = 1 to N, and count the number of good subarrays\nending at each i\n\nLet [L1, R1], [L2, R2], ... , "
},
{
"path": "2020/Div 2/632 Div 2/Explanations/Kate and Imperfection Explanation.txt",
"chars": 1520,
"preview": "Here is the optimal approach\n\n1. We will use all the prime numbers first. The imperfection remains 1\n\n2. Once we are don"
},
{
"path": "2020/Div 2/632 Div 2/Explanations/Kind Anton Explanation.txt",
"chars": 1245,
"preview": "The important constraint here is that the condition (j < i) is maintained\n\nSo, we will start transforming A from the las"
},
{
"path": "2020/Div 2/632 Div 2/Explanations/Little Artem Explanation.txt",
"chars": 1371,
"preview": "Case 1 - Suppose M, N are both odd\n\nWe will colour the board like a chessboard with the first square being black\nThe num"
},
{
"path": "2020/Div 2/632 Div 2/Programs/Eugene and Array.cpp",
"chars": 1137,
"preview": "#include <iostream>\n#include <vector>\n#include <map>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\n\nusing "
},
{
"path": "2020/Div 2/632 Div 2/Programs/Kate and Imperfection.cpp",
"chars": 532,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\nusing namespace std;\n\nint main()\n{\n int n;\n cin >> n;\n"
},
{
"path": "2020/Div 2/632 Div 2/Programs/Kind Anton.cpp",
"chars": 1108,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements;\n cin >> no_of_ele"
},
{
"path": "2020/Div 2/632 Div 2/Programs/Little Artem.cpp",
"chars": 872,
"preview": "#include <iostream>\n\nusing namespace std;\n\nconst int MAX_N = 105;\nchar grid[MAX_N][MAX_N];\n\nvoid solve()\n{\n int rows,"
},
{
"path": "2020/Div 2/633 Div 2/Explanations/Filling Diamonds Explanation.txt",
"chars": 431,
"preview": "It is difficult to explain this without drawing a diagram. \n\nThe main idea is that if we place a diamond vertically, the"
},
{
"path": "2020/Div 2/633 Div 2/Explanations/Powered Addition Explanation.txt",
"chars": 832,
"preview": "1. We will keep track of the Prefix Maximum as we go from i = 1 to N\n\n2. At every i, we will check if A[i] < prefix_max\n"
},
{
"path": "2020/Div 2/633 Div 2/Explanations/Sorted Adjacent Differences Explanation.txt",
"chars": 1211,
"preview": "What is the biggest difference ? A[1] - A[n]\n\nIf we replace, A[1] by any other element, it will get smaller and if we re"
},
{
"path": "2020/Div 2/633 Div 2/Programs/Filling Diamonds.cpp",
"chars": 291,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n long long n;\n cin >> n;\n \n cout"
},
{
"path": "2020/Div 2/633 Div 2/Programs/Powered Addition.cpp",
"chars": 1117,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nint is_bit_set(long long n, int bit)\n{\n return ( (n&(1LL"
},
{
"path": "2020/Div 2/633 Div 2/Programs/Sorted Adjacent Differences.cpp",
"chars": 874,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements;"
},
{
"path": "2020/Div 2/635 Div 2/Explanations/Ichime and Triangle Explanation.txt",
"chars": 213,
"preview": "The triangle inequality says (a + b > c)\n\nSo, we can just print b c c\n\nb + c > c\nc + c > b\n\n-----\n\nvoid solve()\n{\n in"
},
{
"path": "2020/Div 2/635 Div 2/Explanations/Kana and Dragon Quest Game Explanation.txt",
"chars": 534,
"preview": "The net reduction is H/2 or 10\n\nAs long as H/2 > 10, it is always better to do the first operation\n\nAnd then, we can do "
},
{
"path": "2020/Div 2/635 Div 2/Explanations/Linova and Kingdom Explanation.txt",
"chars": 1936,
"preview": "Let us try to calculate the contribution of a vertex to the sum if we add it.\n\n-----\n\nFirstly, it is always optimal to c"
},
{
"path": "2020/Div 2/635 Div 2/Explanations/Xenia and Colourful Gems Explanation.txt",
"chars": 2193,
"preview": "Let us imagine that X <= Y <= Z\n\nWe will iterate over the middle element.\n\nIf we fix Y, then we will look for the closes"
},
{
"path": "2020/Div 2/635 Div 2/Programs/Ichihime and Triangle.cpp",
"chars": 303,
"preview": "#include <iostream>\n\nusing namespace std;\n\nvoid solve()\n{\n int a, b, c, d;\n cin >> a >> b >> c >> d;\n \n cout"
},
{
"path": "2020/Div 2/635 Div 2/Programs/Kana and Dragon Quest game.cpp",
"chars": 463,
"preview": "#include <iostream>\n\nusing namespace std;\n\nvoid solve()\n{\n int total, type_1, type_2;\n cin >> total >> type_1 >> t"
},
{
"path": "2020/Div 2/635 Div 2/Programs/Linova and Kingdom.cpp",
"chars": 1382,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\nusing namespace std;\n#define all(v) (v).begin(), (v).end()\n\n"
},
{
"path": "2020/Div 2/635 Div 2/Programs/Xenia and Colourful Gems.cpp",
"chars": 1790,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n#include <climits>\n\n#define all(v) (v).begin(), (v).end()\nusi"
},
{
"path": "2020/Div 2/637 Div 2/Explanations/Nastya and Door Explanation.txt",
"chars": 1163,
"preview": "Let us make another array where P[i] = true, if A[i] is a peak and false otherwise\n\nWe will make a prefix sum of peaks\n\n"
},
{
"path": "2020/Div 2/637 Div 2/Explanations/Nastya and Rice Explanation.txt",
"chars": 579,
"preview": "The minimum weight we can make n(a - b) and the maximum weight we can make n(a + b)\n\nWe must check if the maximum weight"
},
{
"path": "2020/Div 2/637 Div 2/Explanations/Nastya and Scoreboard Explanation.txt",
"chars": 3470,
"preview": "Here is the best strategy -\n\nWe will try to make the left most strings as large an integer as possible.\n\nSuppose we have"
},
{
"path": "2020/Div 2/637 Div 2/Explanations/Nastya and Strange Generator Explanation.txt",
"chars": 1424,
"preview": "Let us try to simulate the process -\n\nWe start with an empty array.\n\n_ _ 1 _ _\n\nNow, for the next step, we have to put 2"
},
{
"path": "2020/Div 2/637 Div 2/Programs/Nastya and Door.cpp",
"chars": 1209,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements, k;\n cin >> no_of_"
},
{
"path": "2020/Div 2/637 Div 2/Programs/Nastya and Rice.cpp",
"chars": 567,
"preview": "#include <iostream>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_grains, a, b, c, d;\n cin >> no_of_grains >> a"
},
{
"path": "2020/Div 2/637 Div 2/Programs/Nastya and Scoreboard.cpp",
"chars": 2843,
"preview": "#include <iostream>\n#include <vector>\n#include <string>\n#include <cstring>\n\nusing namespace std;\n\nconst int MAX_N = 2015"
},
{
"path": "2020/Div 2/637 Div 2/Programs/Nastya and Strange Generator.cpp",
"chars": 792,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\nusing namespace std;\n\n"
},
{
"path": "2020/Div 2/638 Div 2/Explanations/Pheonix and Balance Explanation.txt",
"chars": 591,
"preview": "We can use 1 fact about binary integers and powers of 2\n\n2^i = (2^{i - 1} + 2^{i - 2} + ... + 2^1 + 2^0) + 1\n\nSo 2^n is "
},
{
"path": "2020/Div 2/638 Div 2/Programs/Pheonix and Balance.cpp",
"chars": 498,
"preview": "#include <iostream>\n\nusing namespace std;\n\nvoid solve()\n{\n int n;\n cin >> n;\n \n int heavy_pile = (1 << n);\n "
},
{
"path": "2020/Div 2/638 Div 2/Programs/Phoenix and Balance.cpp",
"chars": 498,
"preview": "#include <iostream>\n\nusing namespace std;\n\nvoid solve()\n{\n int n;\n cin >> n;\n \n int heavy_pile = (1 << n);\n "
},
{
"path": "2020/Div 2/639 Div 2/Explanations/Card Construction Explanation.txt",
"chars": 1505,
"preview": "Let us try to build a recurrence between the number of cards required for H levels and (H - 1) levels\n\nWe will use 2H ca"
},
{
"path": "2020/Div 2/639 Div 2/Explanations/Hilbert Hotel Explanation.txt",
"chars": 1224,
"preview": "Two integers i and j will intersect if\n\ni + A[i] = j + A[j] (mod N)\n\nSo, we have to ensure that all N moduli - (0 + A[0]"
},
{
"path": "2020/Div 2/639 Div 2/Explanations/Monopole Magnets Explanation.txt",
"chars": 4391,
"preview": "There can be no row or column with more than 1 black segment\n\nThe reason is that if there is a row with more than 1 blac"
},
{
"path": "2020/Div 2/639 Div 2/Explanations/Puzzle Pieces Explanation.txt",
"chars": 359,
"preview": "If we have only 1 row or 1 column, we can achieve any length of it \n\nOtherwise, we can only achieve 2x2 and no other com"
},
{
"path": "2020/Div 2/639 Div 2/Explanations/Quantifier Question Explanation.txt",
"chars": 3176,
"preview": "Let us draw an edge between every pair of vertices (u, v) if (u < v)\n\nThis will give us a directed graph.\n\nIt is importa"
},
{
"path": "2020/Div 2/639 Div 2/Explanations/Resume Review Explanation.txt",
"chars": 3342,
"preview": "Let us see what happens when we increment some B[i] from (x - 1) to x\n\nThe function changes by |x.(A[i] - x)^2| - |(x - "
},
{
"path": "2020/Div 2/639 Div 2/Explanations/Resume Review.cpp",
"chars": 1872,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nlong long no_of_elements, total_steps;\nvector <long long> A"
},
{
"path": "2020/Div 2/639 Div 2/Programs/Card Construction.cpp",
"chars": 1084,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\nusing namespace std;\n\n"
},
{
"path": "2020/Div 2/639 Div 2/Programs/Hilbert Hotel.cpp",
"chars": 965,
"preview": "#include <iostream>\n#include <vector>\n#include <map>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements;\n c"
},
{
"path": "2020/Div 2/639 Div 2/Programs/Monopole Magnets.cpp",
"chars": 3261,
"preview": "#include <iostream>\n#include <cstdio>\n#include <vector>\n#include <cstring>\n\nusing namespace std;\n\nconst int MAX_N = 1005"
},
{
"path": "2020/Div 2/639 Div 2/Programs/Puzzle Pieces.cpp",
"chars": 406,
"preview": "#include <iostream>\n\nusing namespace std;\n\nvoid solve()\n{\n int rows, columns;\n cin >> rows >> columns;\n \n if"
},
{
"path": "2020/Div 2/639 Div 2/Programs/Quantifier Question.cpp",
"chars": 2209,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nconst int MAX_N = 2e5 + 5;\nvector <int> graph[MAX_N], rever"
},
{
"path": "2020/Div 2/639 Div 2/Programs/Resume Review.cpp",
"chars": 1872,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nlong long no_of_elements, total_steps;\nvector <long long> A"
},
{
"path": "2020/Div 2/641 Div 2/Explanations/Orac and Factors Explanation.txt",
"chars": 691,
"preview": "Let us notice that f(n) = 2 for all even integers.\n\nIf n is odd, then (f(n) + n) is even\n\nSo, we can do n = (f(n) + n) f"
},
{
"path": "2020/Div 2/641 Div 2/Explanations/Orac and LCM Explanation.txt",
"chars": 3786,
"preview": "The gcd of this set should divide every element of the set.\n\nLet us look at each prime seperately.\n\n-----\n\nCase 1 - Ther"
},
{
"path": "2020/Div 2/641 Div 2/Explanations/Orac and Models Explanation.txt",
"chars": 933,
"preview": "Let us modify a sieve logic to get the answer\n\nFor every integer i, we can go from i to some multiple of i\n\nWe will chec"
},
{
"path": "2020/Div 2/641 Div 2/Programs/Orac and Factors.cpp",
"chars": 729,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nconst int MAX_N = 1e6 + 5;\nvector <int> smallest_multiple(M"
},
{
"path": "2020/Div 2/641 Div 2/Programs/Orac and LCM.cpp",
"chars": 3276,
"preview": "void precompute()\n{\n vector <int> is_prime(MAX_N, true);\n \n for(int i = 2; i < MAX_N; i++)\n {\n if(is_"
},
{
"path": "2020/Div 2/641 Div 2/Programs/Orac and Models.cpp",
"chars": 1011,
"preview": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements;\n cin >> no_of_ele"
},
{
"path": "2020/Div 2/643 Div 2/Explanation/Counting Triangles Explanation.txt.txt",
"chars": 1296,
"preview": "- We know $x < y \\< z$ so we will count the number of triplets where $z < x + y$\r\n- $x + y \\in [A + B, A + C]$\r\n- For ev"
},
{
"path": "2020/Div 2/643 Div 2/Explanation/Game with Array Explanation.txt",
"chars": 1358,
"preview": "A win is always possible if S > 2n\n\nIn the array [2, 2, 2, ... 2, S - 2(n - 1)],\n\nthere is no subarray with sum either 1"
},
{
"path": "2020/Div 2/643 Div 2/Explanation/Restorer Distance Explanation.txt",
"chars": 2547,
"preview": "What is the cost to make each tower = height H ?\n\nWe can set M = min(M, A + R) because moving a block is the same as\nadd"
},
{
"path": "2020/Div 2/643 Div 2/Explanation/Sequence with Digits Explanation.txt",
"chars": 656,
"preview": "We will keep performing the operation till the minimum digit is 0.\n\nThis will always happen. After this, there is no cha"
},
{
"path": "2020/Div 2/643 Div 2/Explanation/Young Explorer Explanation.txt",
"chars": 1047,
"preview": "Let the sorted array be\n\nA[1] < A[2] < ... < A[n]\n\nNow, if A[L, ... R] is a group, then the number of people should be A"
},
{
"path": "2020/Div 2/643 Div 2/Programs/Counting Triangles.cpp",
"chars": 883,
"preview": "#include <iostream>\r\n#include <vector>\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n int A, B, C, D;\r\n cin >> A >> B "
},
{
"path": "2020/Div 2/643 Div 2/Programs/Game with Array.cpp",
"chars": 466,
"preview": "#include <iostream>\n\nusing namespace std;\n\nint main()\n{\n int no_of_elements, sum;\n cin >> no_of_elements >> sum;\n "
},
{
"path": "2020/Div 2/643 Div 2/Programs/Restorer Distance.cpp",
"chars": 1977,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\n#define all(v) (v).begin(), (v).end()\nusing namespace std;\n\n"
},
{
"path": "2020/Div 2/643 Div 2/Programs/Sequence with Digits.cpp",
"chars": 727,
"preview": "#include <iostream>\n\nusing namespace std;\n\npair <int, int> max_min_digit(long long n)\n{\n pair <int, int> max_min = ma"
},
{
"path": "2020/Div 2/643 Div 2/Programs/Young Explorer.cpp",
"chars": 786,
"preview": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\nusing namespace std;\n\nvoid solve()\n{\n int no_of_elements;"
},
{
"path": "2020/Div 2/647 Div 2/Explanations/Johnny and Ancient Computers Explanation.txt",
"chars": 644,
"preview": "We can never remove any 1 from an integer. \nThe only operation we can do is append 0 and remove trailing 0's. \n\nSo, with"
},
{
"path": "2020/Div 2/647 Div 2/Explanations/Johnny and Another Rating Drop Explanation.txt",
"chars": 1473,
"preview": "Let us look at each bit seperately ?\n\nHow much does the last bit contribute to the sum ?\nThe last bit is always 01 01 01"
},
{
"path": "2020/Div 2/647 Div 2/Explanations/Johnny and Contribution Explanation.txt",
"chars": 3600,
"preview": "We will model this by a graph.\n\nA blog is a vertex and two vertices will share an edge\nif there is a reference from one "
}
]
// ... and 2376 more files (download for full content)
About this extraction
This page contains the full source code of the MathProgrammer/CodeForces GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 2576 files (3.0 MB), approximately 924.3k tokens, and a symbol index with 2626 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.