From 8a429aa280b8fddf8baa08821dd8c22cdff2067e Mon Sep 17 00:00:00 2001 From: Manav Aggarwal Date: Wed, 5 Apr 2017 01:22:12 +0530 Subject: [PATCH] Push CodeList --- .DS_Store | Bin 0 -> 22532 bytes Cakewalk.cpp | 40 + ChandraguptaBST.cpp | 98 ++ Classic/.DS_Store | Bin 0 -> 8196 bytes Classic/Add.cpp | 22 + Classic/Add_Strings.cpp | 52 + Classic/BFS.cpp | 24 + Classic/Bin. Coeff.cpp | 44 + Classic/Bin.Coeff 2.cpp | 27 + Classic/Chess moves to a cell.cpp | 62 + Classic/Date To Day.cpp | 30 + Classic/DigitSum.cpp | 29 + Classic/Divide_Strings.cpp | 68 ++ Classic/Knapsack.cpp | 44 + Classic/Multiply_Strings.cpp | 87 ++ Classic/NumToString.cpp | 24 + Classic/Partition of a number.cpp | 39 + Classic/RomanNumerals.cpp | 35 + Classic/SegTree Lazy.cpp | 149 +++ Classic/SegTree RMQ.cpp | 96 ++ Classic/SegTree.cpp | 65 ++ Classic/Sieve of eratosthenes.cpp | 42 + Classic/StringToNum.cpp | 22 + Classic/Subtract_Strings.cpp | 50 + Classic/fenwickTree - PURQ.cpp | 45 + Classic/fenwickTree RUPQ.cpp | 36 + Classic/fenwickTree RURQ.cpp | 48 + Classic/fenwickTree.cpp | 45 + Classic/gcd.cpp | 12 + Classic/gmon.out | Bin 0 -> 242728 bytes Classic/isPalindrome in any base.cpp | 22 + Classic/output.out | 1 + CodeChef/.DS_Store | Bin 0 -> 16388 bytes CodeChef/ATM.cpp | 19 + CodeChef/Addition and Multiplication.cpp | 13 + CodeChef/Addition.cpp | 52 + CodeChef/Aditi and Magic Trick.cpp | 36 + CodeChef/Alien.cpp | 32 + CodeChef/Almost Sorted Permutation.cpp | 42 + CodeChef/Alok- Nath and his Sanskars.cpp | 34 + CodeChef/Anagram.cpp | 60 + CodeChef/Another Fibonacci.cpp | 34 + CodeChef/Antidote.cpp | 23 + CodeChef/Approximately II.cpp | 37 + CodeChef/Bread.cpp | 40 + CodeChef/Bytelandian gold coins.cpp | 37 + CodeChef/Cascading Style Sheets.cpp | 34 + CodeChef/Chain of Doughnuts.cpp | 49 + CodeChef/Charlie and Prime Numbers.cpp | 53 + CodeChef/Chef Anup.cpp | 64 ++ CodeChef/Chef and Chain.cpp | 42 + CodeChef/Chef and Complex String Coverage.cpp | 151 +++ CodeChef/Chef and Digits.cpp | 33 + CodeChef/Chef and Equality.cpp | 37 + CodeChef/Chef and Fibonacci.cpp | 29 + CodeChef/Chef and Frogs.cpp | 47 + CodeChef/Chef and Memory Limit.cpp | 32 + CodeChef/Chef and Notebook.cpp | 25 + CodeChef/Chef and Polygons.cpp | 59 + CodeChef/Chef and Powers.cpp | 2 + CodeChef/Chef and Prime Divisors.cpp | 33 + CodeChef/Chef and Red Black Tree.cpp | 82 ++ CodeChef/Chef and Shop.cpp | 42 + CodeChef/Chef and Strange Formula.cpp | 59 + CodeChef/Chef and Strings.cpp | 123 ++ CodeChef/Chef and easy problem.cpp | 27 + CodeChef/Chef and insomnia.cpp | 104 ++ CodeChef/Chef and medium problem 2.cpp | 92 ++ CodeChef/Chef and new recipe.cpp | 37 + CodeChef/Chef and stones.cpp | 30 + CodeChef/Chef and string.cpp | 61 + CodeChef/Chef and the Wildcard Matching.cpp | 36 + CodeChef/Chef and the XORed Number.cpp | 43 + .../Chef and voting for the best friend.cpp | 74 ++ CodeChef/Chef-jumping.cpp | 18 + CodeChef/Ciel and A-B.cpp | 28 + CodeChef/Ciel and Receipt.cpp | 34 + CodeChef/Closing The Tweets.cpp | 44 + CodeChef/Coin Flip.cpp | 34 + CodeChef/Compilers and Parsers.cpp | 37 + CodeChef/Cooling Pies.cpp | 40 + CodeChef/Count of Maximum.cpp | 34 + CodeChef/Delivering Bread.cpp | 14 + CodeChef/Delivery Man.cpp | 56 + CodeChef/Devu and Grapes.cpp | 40 + CodeChef/Devu and Manhattan Distance.cpp | 62 + CodeChef/Devu and binary string.cpp | 104 ++ CodeChef/Double Strings.cpp | 19 + CodeChef/Enormous Input Test.cpp | 20 + CodeChef/Factorial.cpp | 21 + CodeChef/Factorial1.cpp | 39 + CodeChef/Fit Squares in a Triangle.cpp | 34 + CodeChef/Flipping Coins.cpp | 93 ++ CodeChef/GCD and LCM.cpp | 30 + CodeChef/Greedy Puppy.cpp | 24 + CodeChef/Harrenhal.cpp | 34 + CodeChef/Holes in the text.cpp | 29 + CodeChef/How to Operate a Robot - Failed.cpp | 98 ++ CodeChef/How to Operate a Robot.cpp | 176 +++ CodeChef/Indhiran II.cpp | 47 + CodeChef/Kingdom Unity.cpp | 79 ++ CodeChef/Lack of Logic.cpp | 42 + CodeChef/Let us play with rank list.cpp | 44 + CodeChef/Library and Headcount.cpp | 49 + CodeChef/Little Elephant and Lemonade.cpp | 28 + CodeChef/Lucky Four.cpp | 24 + CodeChef/Lucky number.cpp | 21 + CodeChef/Magic Tricks.cpp | 38 + CodeChef/Marbles (Binomial Coeff.).cpp | 24 + CodeChef/Maximize Value.cpp | 44 + CodeChef/Mike and Matrices.cpp | 49 + CodeChef/Minimize a String.cpp | 31 + CodeChef/Modulo.cpp | 22 + CodeChef/Mr. Ignus.cpp | 29 + CodeChef/Nth number in the series.cpp | 26 + CodeChef/Number of Factors.cpp | 33 + CodeChef/Odd.cpp | 26 + CodeChef/One Dimensional Kingdoms.cpp | 35 + CodeChef/Packaging Cupcakes.cpp | 14 + CodeChef/Pair of numbers.cpp | 41 + CodeChef/Pairwise AND sum.cpp | 31 + CodeChef/Palindrome.cpp | 66 ++ CodeChef/Piece of Cake.cpp | 35 + CodeChef/Presti Digitator.cpp | 22 + CodeChef/Primality Test.cpp | 48 + CodeChef/Prime Generator.cpp | 34 + CodeChef/Prime palindromes.cpp | 19 + CodeChef/Problem 1.cpp | 42 + CodeChef/Problem 2.cpp | 36 + CodeChef/Problem 3.cpp | 35 + CodeChef/Pronites.cpp | 48 + CodeChef/Puppy and GCD.cpp | 26 + CodeChef/Puppy and Game.cpp | 25 + CodeChef/Racing Horses.cpp | 26 + CodeChef/Reduce Time.cpp | 22 + CodeChef/Riled.cpp | 22 + CodeChef/Rising Population.cpp | 53 + CodeChef/Root of The Problem.cpp | 23 + CodeChef/Save Olive.cpp | 32 + CodeChef/Sereja and vectors.cpp | 14 + CodeChef/Sereja and votes.cpp | 28 + CodeChef/Set Difference.cpp | 48 + CodeChef/Small Factorials.cpp | 22 + CodeChef/Snape and ladder.cpp | 19 + CodeChef/Statues.cpp | 31 + CodeChef/Steady Tables.cpp | 98 ++ CodeChef/Stepford houses.cpp | 29 + CodeChef/Stone.cpp | 50 + CodeChef/Strategy for the world cup.cpp | 48 + CodeChef/Sums in a triangle.cpp | 33 + CodeChef/Suraj Goes Shopping.cpp | 39 + CodeChef/Tanu and Head-bob.cpp | 42 + CodeChef/The First Cube.cpp | 131 +++ CodeChef/The Lead Game.cpp | 28 + CodeChef/The Leaking Robot.cpp | 71 ++ CodeChef/The Smallest Pair.cpp | 22 + CodeChef/The Warehouse.cpp | 41 + CodeChef/The festival of colours.cpp | 27 + CodeChef/The name list.cpp | 21 + CodeChef/The worst sister.cpp | 34 + CodeChef/Three Different Numbers.cpp | 19 + CodeChef/Tired Knights.cpp | 25 + CodeChef/Turbo Sort.cpp | 22 + CodeChef/Uncle Johny.cpp | 30 + CodeChef/Voters.cpp | 54 + CodeChef/What is this LOL!.cpp | 55 + CodeChef/Xor Matrix.cpp | 33 + CodeChef/Zombinatorial.cpp | 47 + CodeChef/gmon.out | Bin 0 -> 239436 bytes CodeChef/out.out | 2 + CodeChef/test.in | 6 + CodeJam/.DS_Store | Bin 0 -> 8196 bytes CodeJam/Google CodeJam 2015/.DS_Store | Bin 0 -> 8196 bytes CodeJam/Google CodeJam 2015/01.cpp | 38 + CodeJam/Google CodeJam 2015/01.out | 55 + CodeJam/Google CodeJam 2015/A-large.in | 101 ++ .../Google CodeJam 2015/A-small-attempt0.in | 56 + .../Google CodeJam 2015/A-small-attempt1.in | 56 + .../Google CodeJam 2015/A-small-attempt2.in | 56 + .../Google CodeJam 2015/A-small-attempt3.in | 56 + .../Google CodeJam 2015/B-Output-Small.out | 100 ++ .../Google CodeJam 2015/B-small-attempt0.in | 201 ++++ .../Google CodeJam 2015/B-small-attempt1.in | 201 ++++ CodeJam/Google CodeJam 2015/D-large.in | 101 ++ .../Google CodeJam 2015/D-small-attempt0.in | 65 ++ CodeJam/Google CodeJam 2015/Haircut.cpp | 38 + .../Infinite House of Pancakes.cpp | 37 + .../Google CodeJam 2015/Mushroom - small.in | 201 ++++ .../Google CodeJam 2015/Mushroom Monster.cpp | 45 + .../Mushroom-Monster-out.out | 100 ++ CodeJam/Google CodeJam 2015/Mushroom-large.in | 201 ++++ .../Ominous Omino-Large.cpp | 47 + .../Ominous Omino-Small.cpp | 73 ++ .../Ominous-Omino-Output-Large.out | 100 ++ .../Ominous-Omino-Output.out | 64 ++ .../Google CodeJam 2015/Standing Ovation.cpp | 35 + .../Standing-Ovation-Output.out | 100 ++ .../Standing-Ovation-Output1.out | 100 ++ CodeJam/Google CodeJam 2015/gmon.out | Bin 0 -> 244564 bytes CodeJam/Google CodeJam 2015/input.in | 5 + CodeJam/Google CodeJam 2015/test.in | 9 + CodeJam/Store Credit.cpp | 39 + Contests/.DS_Store | Bin 0 -> 6148 bytes Contests/Angry Professor.cpp | 31 + Contests/SherlockAndPermutations.cpp | 26 + Contests/Sum Queries.cpp | 40 + Contests/gmon.out | Bin 0 -> 239620 bytes Contests/test.in | 5 + Friends.cpp | 36 + GSS1.cpp | 50 + Gifts.cpp | 32 + HackerEarth/.DS_Store | Bin 0 -> 6148 bytes HackerEarth/Roy and Texting Robot.cpp | 126 +++ HackerEarth/Roy and his Matrix.cpp | 28 + HackerEarth/gmon.out | Bin 0 -> 240872 bytes HackerRank/.DS_Store | Bin 0 -> 8196 bytes HackerRank/ACM_ICPC.cpp | 57 + HackerRank/AltChar.cpp | 27 + HackerRank/AngryChildren.cpp | 43 + HackerRank/B'day Gift.cpp | 17 + HackerRank/ConnectingTowns.cpp | 21 + HackerRank/CutTheSticks.cpp | 38 + HackerRank/FillingJars.cpp | 23 + HackerRank/FindDigits.cpp | 36 + HackerRank/HalloweenParty.cpp | 14 + HackerRank/HandShakes.cpp | 19 + HackerRank/IsFibo.cpp | 45 + HackerRank/LoveLetterMytstery.cpp | 60 + HackerRank/MaximizingXor.cpp | 25 + HackerRank/MinDraws.cpp | 14 + HackerRank/SherlockAndPermutations.cpp | 23 + HackerRank/SherlocknSquares.cpp | 37 + HackerRank/UtopianTree.cpp | 31 + HackerRank/chocFeast.cpp | 32 + HackerRank/fibo_modified.cpp | 16 + HackerRank/flpbits.cpp | 15 + HackerRank/gmon.out | Bin 0 -> 239524 bytes HackerRank/is_panagram.cpp | 19 + HackerRank/maxSubArray.cpp | 42 + HackerRank/nextpal.cpp | 36 + HackerRank/randNumProb.cpp | 0 HackerRank/sample.cpp | 36 + HackerRank/test.in | 5 + HuntIt.cpp | 85 ++ IARCS/.DS_Store | Bin 0 -> 10244 bytes IARCS/01 Tiles.cpp | 23 + IARCS/Average.cpp | 56 + IARCS/Bickering Task Force.cpp | 91 ++ IARCS/Book Sorting.cpp | 32 + IARCS/BookList.cpp | 44 + IARCS/CRITINTS.cpp | 73 ++ IARCS/Cycles in Permutations.cpp | 63 ++ IARCS/Devious.cpp | 43 + IARCS/Dividing Sequences.cpp | 34 + IARCS/Draw Fixing.cpp | 73 ++ IARCS/Equal Gifts.cpp | 57 + IARCS/Find the Permutation.cpp | 49 + IARCS/Find the numbers.cpp | 77 ++ IARCS/High Speed Network.cpp | 58 + IARCS/Lead Game.cpp | 28 + IARCS/Longest Palindrome.cpp | 56 + IARCS/Minimum Turn Route.cpp | 109 ++ IARCS/NextPerm.cpp | 27 + IARCS/Number of Tilings.cpp | 24 + IARCS/Periodic Strings.cpp | 30 + IARCS/Pyramid.cpp | 28 + IARCS/README | 16 + IARCS/Railway Catering Contracts.cpp | 34 + IARCS/Rank Fraud.cpp | 97 ++ IARCS/Repetition-free numbers.cpp | 166 +++ IARCS/Reverse.cpp | 44 + IARCS/Sorting row of numbers.cpp | 42 + IARCS/Speculating on Buffaloes.cpp | 20 + IARCS/The End of Corruption.cpp | 28 + IARCS/The Great Escape.cpp | 74 ++ IARCS/The Leaf eaters.cpp | 27 + IARCS/The Medu Vada Maze.cpp | 125 +++ IARCS/The Siruseri Sports Stadium.cpp | 34 + IARCS/The Timber Auction.cpp | 34 + IARCS/Tiles.cpp | 18 + IARCS/Treasure.cpp | 63 ++ IARCS/Voters.cpp | 54 + IARCS/What is the Rank.cpp | 30 + IARCS/Word Hopping.cpp | 136 +++ IARCS/Word List.cpp | 44 + IARCS/gmon.out | Bin 0 -> 239564 bytes IARCS/test.in | 9 + INOI Workshop/.DS_Store | Bin 0 -> 8196 bytes INOI Workshop/Day 1/.DS_Store | Bin 0 -> 6148 bytes INOI Workshop/Day 1/Inversions.cpp | 41 + INOI Workshop/Day 1/Queen.cpp | 31 + INOI Workshop/Day 1/SubSum.cpp | 27 + INOI Workshop/Day 1/Subtractions.cpp | 32 + INOI Workshop/Day 1/Three.cpp | 26 + INOI Workshop/Day 2/.DS_Store | Bin 0 -> 6148 bytes INOI Workshop/Day 2/Cake.cpp | 70 ++ INOI Workshop/Day 2/Chemistry101.cpp | 69 ++ INOI Workshop/Day 2/Chemistry102.cpp | 55 + INOI Workshop/Day 2/NextSmallest.cpp | 44 + INOI Workshop/Day 2/Seinfield.cpp | 43 + INOI Workshop/Day 2/StreetParade.cpp | 56 + INOI Workshop/Day 3/.DS_Store | Bin 0 -> 6148 bytes INOI Workshop/Day 3/BinTrees.cpp | 29 + INOI Workshop/Day 3/DNA.cpp | 54 + INOI Workshop/Day 3/Kadanes.cpp | 40 + INOI Workshop/Hacker.cpp | 70 ++ INOI Workshop/Three-Prime.cpp | 44 + INOI/.DS_Store | Bin 0 -> 6148 bytes INOI/Brackets.cpp | 68 ++ INOI/Wealth.cpp | 56 + India Post.cpp | 57 + Laughter.cpp | 40 + Make Palindrome.cpp | 113 ++ Mario - Nexus Prelims.cpp | 80 ++ MaxMatchedSeq.cpp | 13 + Network.cpp | 63 ++ New.cpp | 12 + Pattern.cpp | 34 + Princess Farida.cpp | 32 + Project Euler/.DS_Store | Bin 0 -> 14340 bytes Project Euler/Project Euler 1.cpp | 20 + Project Euler/Project Euler 10.cpp | 41 + Project Euler/Project Euler 11.cpp | 55 + Project Euler/Project Euler 12.cpp | 81 ++ Project Euler/Project Euler 13.cpp | 44 + Project Euler/Project Euler 14.cpp | 42 + Project Euler/Project Euler 15.cpp | 28 + Project Euler/Project Euler 16.cpp | 37 + Project Euler/Project Euler 17.cpp | 53 + Project Euler/Project Euler 18.cpp | 46 + Project Euler/Project Euler 19.cpp | 40 + Project Euler/Project Euler 2.cpp | 27 + Project Euler/Project Euler 20.cpp | 37 + Project Euler/Project Euler 21.cpp | 50 + Project Euler/Project Euler 22.cpp | 46 + Project Euler/Project Euler 23.cpp | 60 + Project Euler/Project Euler 24.cpp | 45 + Project Euler/Project Euler 243.cpp | 73 ++ Project Euler/Project Euler 25.cpp | 38 + Project Euler/Project Euler 26.cpp | 33 + Project Euler/Project Euler 27.cpp | 62 + Project Euler/Project Euler 28.cpp | 46 + Project Euler/Project Euler 29.cpp | 66 ++ Project Euler/Project Euler 3.cpp | 25 + Project Euler/Project Euler 30.cpp | 50 + Project Euler/Project Euler 31.cpp | 27 + Project Euler/Project Euler 32.cpp | 104 ++ Project Euler/Project Euler 33.cpp | 88 ++ Project Euler/Project Euler 34.cpp | 71 ++ Project Euler/Project Euler 35.cpp | 119 ++ Project Euler/Project Euler 36.cpp | 36 + Project Euler/Project Euler 37.cpp | 75 ++ Project Euler/Project Euler 38.cpp | 35 + Project Euler/Project Euler 39.cpp | 29 + Project Euler/Project Euler 4.cpp | 41 + Project Euler/Project Euler 40.cpp | 35 + Project Euler/Project Euler 41.cpp | 58 + Project Euler/Project Euler 42.cpp | 61 + Project Euler/Project Euler 43.cpp | 46 + Project Euler/Project Euler 44.cpp | 37 + Project Euler/Project Euler 45.cpp | 44 + Project Euler/Project Euler 46.cpp | 75 ++ Project Euler/Project Euler 47.cpp | 61 + Project Euler/Project Euler 48.cpp | 30 + Project Euler/Project Euler 49.cpp | 83 ++ Project Euler/Project Euler 5.cpp | 19 + Project Euler/Project Euler 50!.cpp | 66 ++ Project Euler/Project Euler 51.cpp | 115 ++ Project Euler/Project Euler 52.cpp | 49 + Project Euler/Project Euler 53.cpp | 38 + Project Euler/Project Euler 54.cpp | 426 +++++++ Project Euler/Project Euler 55.cpp | 65 ++ Project Euler/Project Euler 56.cpp | 60 + Project Euler/Project Euler 57.cpp | 26 + Project Euler/Project Euler 58.cpp | 52 + Project Euler/Project Euler 59.cpp | 81 ++ Project Euler/Project Euler 6.cpp | 21 + Project Euler/Project Euler 60.cpp | 161 +++ Project Euler/Project Euler 61.cpp | 663 +++++++++++ Project Euler/Project Euler 62.cpp | 51 + Project Euler/Project Euler 63.cpp | 22 + Project Euler/Project Euler 64.cpp | 50 + Project Euler/Project Euler 65.cpp | 131 +++ Project Euler/Project Euler 66.cpp | 16 + Project Euler/Project Euler 67.cpp | 56 + Project Euler/Project Euler 69.cpp | 49 + Project Euler/Project Euler 7.cpp | 41 + Project Euler/Project Euler 70.cpp | 93 ++ Project Euler/Project Euler 71.cpp | 27 + Project Euler/Project Euler 72.cpp | 35 + Project Euler/Project Euler 73.cpp | 29 + Project Euler/Project Euler 74.cpp | 92 ++ Project Euler/Project Euler 75.cpp | 38 + Project Euler/Project Euler 76.cpp | 43 + Project Euler/Project Euler 77.cpp | 65 ++ Project Euler/Project Euler 78.cpp | 51 + Project Euler/Project Euler 79.cpp | 50 + Project Euler/Project Euler 8.cpp | 31 + Project Euler/Project Euler 80.cpp | 212 ++++ Project Euler/Project Euler 81.cpp | 61 + Project Euler/Project Euler 82.cpp | 72 ++ Project Euler/Project Euler 83.cpp | 100 ++ Project Euler/Project Euler 9.cpp | 24 + Project Euler/cipher.txt | 1 + Project Euler/gmon.out | Bin 0 -> 243252 bytes Project Euler/grid.txt | 5 + Project Euler/keylog.txt | 33 + Project Euler/matrix.txt | 80 ++ Project Euler/names.txt | 1 + Project Euler/output.out | 1 + Project Euler/poker.txt | 1000 +++++++++++++++++ Project Euler/poker1.txt | 1 + Project Euler/test.in | 7 + Project Euler/triangle.txt | 100 ++ Project Euler/words.txt | 1 + SPOJ/.DS_Store | Bin 0 -> 10244 bytes SPOJ/Adding Reversed Numbers.cpp | 29 + SPOJ/Advanced Fruits.cpp | 36 + SPOJ/Aggressive cows.cpp | 56 + SPOJ/Aibohphobia.cpp | 51 + SPOJ/Aliens at the train.cpp | 52 + SPOJ/Alphacode.cpp | 40 + SPOJ/Another Very Easy Problem.cpp | 53 + SPOJ/Baby.cpp | 46 + SPOJ/Chocolate - Chocola.cpp | 67 ++ SPOJ/Cross-Country.cpp | 68 ++ SPOJ/DQUERY.cpp | 82 ++ SPOJ/Die Hard.cpp | 60 + SPOJ/Divisor Summation.cpp | 67 ++ SPOJ/Euler Totient Function.cpp | 69 ++ SPOJ/GSS1.cpp | 12 + SPOJ/Histogram.cpp | 64 ++ SPOJ/Horrible Queries.cpp | 69 ++ SPOJ/Large Knapsack.cpp | 44 + SPOJ/Largest Rectangle in a Histogram.cpp | 52 + SPOJ/M3Tile.cpp | 28 + SPOJ/Make Psycho.cpp | 114 ++ SPOJ/Marbles.cpp | 29 + SPOJ/Minimum Knight Moves.cpp | 64 ++ SPOJ/Number Steps.cpp | 54 + SPOJ/Palindrome 2000.cpp | 40 + SPOJ/Party Schedule.cpp | 48 + SPOJ/Philosophers Stone.cpp | 65 ++ SPOJ/Prime Path.cpp | 100 ++ SPOJ/Prime or Not.cpp | 84 ++ SPOJ/Psycho.cpp | 48 + SPOJ/Pyscho Function.cpp | 99 ++ SPOJ/Rain.cpp | 105 ++ SPOJ/Rent your Airplane and Make Money.cpp | 77 ++ SPOJ/Scuba Diver.cpp | 45 + SPOJ/Seinfield.cpp | 43 + SPOJ/Shopping.cpp | 91 ++ SPOJ/Square Brackets.cpp | 47 + SPOJ/Street Parade.cpp | 56 + SPOJ/Sum of Product.cpp | 31 + SPOJ/Sums in a triangle.cpp | 2 + SPOJ/Sweet and Sour Rock.cpp | 64 ++ SPOJ/The Courier.cpp | 84 ++ SPOJ/The Knapsack Problem.cpp | 42 + SPOJ/Traffic Network.cpp | 75 ++ SPOJ/Treat for the Cows.cpp | 71 ++ SPOJ/Trip.cpp | 79 ++ SPOJ/Two Ends.cpp | 54 + SPOJ/Update the array!.cpp | 57 + SPOJ/Wachovia Bank.cpp | 39 + SPOJ/Where to Drink the Plonk.cpp | 34 + Shahblah.cpp | 48 + Square Country.cpp | 30 + Try.cpp | 16 + Try1.cpp | 119 ++ Wealth Disparity.cpp | 51 + fcs.cpp | 49 + gen.cpp | 13 + hackit.cpp | 60 + set.cpp | 28 + xor.cpp | 27 + xorc.cpp | 14 + 477 files changed, 24130 insertions(+) create mode 100644 .DS_Store create mode 100755 Cakewalk.cpp create mode 100755 ChandraguptaBST.cpp create mode 100644 Classic/.DS_Store create mode 100755 Classic/Add.cpp create mode 100755 Classic/Add_Strings.cpp create mode 100755 Classic/BFS.cpp create mode 100755 Classic/Bin. Coeff.cpp create mode 100755 Classic/Bin.Coeff 2.cpp create mode 100755 Classic/Chess moves to a cell.cpp create mode 100755 Classic/Date To Day.cpp create mode 100755 Classic/DigitSum.cpp create mode 100755 Classic/Divide_Strings.cpp create mode 100755 Classic/Knapsack.cpp create mode 100755 Classic/Multiply_Strings.cpp create mode 100755 Classic/NumToString.cpp create mode 100755 Classic/Partition of a number.cpp create mode 100755 Classic/RomanNumerals.cpp create mode 100755 Classic/SegTree Lazy.cpp create mode 100755 Classic/SegTree RMQ.cpp create mode 100755 Classic/SegTree.cpp create mode 100755 Classic/Sieve of eratosthenes.cpp create mode 100755 Classic/StringToNum.cpp create mode 100755 Classic/Subtract_Strings.cpp create mode 100755 Classic/fenwickTree - PURQ.cpp create mode 100755 Classic/fenwickTree RUPQ.cpp create mode 100755 Classic/fenwickTree RURQ.cpp create mode 100755 Classic/fenwickTree.cpp create mode 100755 Classic/gcd.cpp create mode 100755 Classic/gmon.out create mode 100755 Classic/isPalindrome in any base.cpp create mode 100755 Classic/output.out create mode 100644 CodeChef/.DS_Store create mode 100755 CodeChef/ATM.cpp create mode 100755 CodeChef/Addition and Multiplication.cpp create mode 100755 CodeChef/Addition.cpp create mode 100755 CodeChef/Aditi and Magic Trick.cpp create mode 100755 CodeChef/Alien.cpp create mode 100755 CodeChef/Almost Sorted Permutation.cpp create mode 100755 CodeChef/Alok- Nath and his Sanskars.cpp create mode 100755 CodeChef/Anagram.cpp create mode 100755 CodeChef/Another Fibonacci.cpp create mode 100755 CodeChef/Antidote.cpp create mode 100755 CodeChef/Approximately II.cpp create mode 100755 CodeChef/Bread.cpp create mode 100755 CodeChef/Bytelandian gold coins.cpp create mode 100755 CodeChef/Cascading Style Sheets.cpp create mode 100755 CodeChef/Chain of Doughnuts.cpp create mode 100755 CodeChef/Charlie and Prime Numbers.cpp create mode 100755 CodeChef/Chef Anup.cpp create mode 100755 CodeChef/Chef and Chain.cpp create mode 100755 CodeChef/Chef and Complex String Coverage.cpp create mode 100755 CodeChef/Chef and Digits.cpp create mode 100755 CodeChef/Chef and Equality.cpp create mode 100755 CodeChef/Chef and Fibonacci.cpp create mode 100755 CodeChef/Chef and Frogs.cpp create mode 100755 CodeChef/Chef and Memory Limit.cpp create mode 100755 CodeChef/Chef and Notebook.cpp create mode 100755 CodeChef/Chef and Polygons.cpp create mode 100755 CodeChef/Chef and Powers.cpp create mode 100755 CodeChef/Chef and Prime Divisors.cpp create mode 100755 CodeChef/Chef and Red Black Tree.cpp create mode 100755 CodeChef/Chef and Shop.cpp create mode 100755 CodeChef/Chef and Strange Formula.cpp create mode 100755 CodeChef/Chef and Strings.cpp create mode 100755 CodeChef/Chef and easy problem.cpp create mode 100755 CodeChef/Chef and insomnia.cpp create mode 100755 CodeChef/Chef and medium problem 2.cpp create mode 100755 CodeChef/Chef and new recipe.cpp create mode 100755 CodeChef/Chef and stones.cpp create mode 100755 CodeChef/Chef and string.cpp create mode 100755 CodeChef/Chef and the Wildcard Matching.cpp create mode 100755 CodeChef/Chef and the XORed Number.cpp create mode 100755 CodeChef/Chef and voting for the best friend.cpp create mode 100755 CodeChef/Chef-jumping.cpp create mode 100755 CodeChef/Ciel and A-B.cpp create mode 100755 CodeChef/Ciel and Receipt.cpp create mode 100755 CodeChef/Closing The Tweets.cpp create mode 100755 CodeChef/Coin Flip.cpp create mode 100755 CodeChef/Compilers and Parsers.cpp create mode 100755 CodeChef/Cooling Pies.cpp create mode 100755 CodeChef/Count of Maximum.cpp create mode 100755 CodeChef/Delivering Bread.cpp create mode 100755 CodeChef/Delivery Man.cpp create mode 100755 CodeChef/Devu and Grapes.cpp create mode 100755 CodeChef/Devu and Manhattan Distance.cpp create mode 100755 CodeChef/Devu and binary string.cpp create mode 100755 CodeChef/Double Strings.cpp create mode 100755 CodeChef/Enormous Input Test.cpp create mode 100755 CodeChef/Factorial.cpp create mode 100755 CodeChef/Factorial1.cpp create mode 100755 CodeChef/Fit Squares in a Triangle.cpp create mode 100755 CodeChef/Flipping Coins.cpp create mode 100755 CodeChef/GCD and LCM.cpp create mode 100755 CodeChef/Greedy Puppy.cpp create mode 100755 CodeChef/Harrenhal.cpp create mode 100755 CodeChef/Holes in the text.cpp create mode 100755 CodeChef/How to Operate a Robot - Failed.cpp create mode 100755 CodeChef/How to Operate a Robot.cpp create mode 100755 CodeChef/Indhiran II.cpp create mode 100755 CodeChef/Kingdom Unity.cpp create mode 100755 CodeChef/Lack of Logic.cpp create mode 100755 CodeChef/Let us play with rank list.cpp create mode 100755 CodeChef/Library and Headcount.cpp create mode 100755 CodeChef/Little Elephant and Lemonade.cpp create mode 100755 CodeChef/Lucky Four.cpp create mode 100755 CodeChef/Lucky number.cpp create mode 100755 CodeChef/Magic Tricks.cpp create mode 100755 CodeChef/Marbles (Binomial Coeff.).cpp create mode 100755 CodeChef/Maximize Value.cpp create mode 100755 CodeChef/Mike and Matrices.cpp create mode 100755 CodeChef/Minimize a String.cpp create mode 100755 CodeChef/Modulo.cpp create mode 100755 CodeChef/Mr. Ignus.cpp create mode 100755 CodeChef/Nth number in the series.cpp create mode 100755 CodeChef/Number of Factors.cpp create mode 100755 CodeChef/Odd.cpp create mode 100755 CodeChef/One Dimensional Kingdoms.cpp create mode 100755 CodeChef/Packaging Cupcakes.cpp create mode 100755 CodeChef/Pair of numbers.cpp create mode 100755 CodeChef/Pairwise AND sum.cpp create mode 100755 CodeChef/Palindrome.cpp create mode 100755 CodeChef/Piece of Cake.cpp create mode 100755 CodeChef/Presti Digitator.cpp create mode 100755 CodeChef/Primality Test.cpp create mode 100755 CodeChef/Prime Generator.cpp create mode 100755 CodeChef/Prime palindromes.cpp create mode 100755 CodeChef/Problem 1.cpp create mode 100755 CodeChef/Problem 2.cpp create mode 100755 CodeChef/Problem 3.cpp create mode 100755 CodeChef/Pronites.cpp create mode 100755 CodeChef/Puppy and GCD.cpp create mode 100755 CodeChef/Puppy and Game.cpp create mode 100755 CodeChef/Racing Horses.cpp create mode 100755 CodeChef/Reduce Time.cpp create mode 100755 CodeChef/Riled.cpp create mode 100755 CodeChef/Rising Population.cpp create mode 100755 CodeChef/Root of The Problem.cpp create mode 100755 CodeChef/Save Olive.cpp create mode 100755 CodeChef/Sereja and vectors.cpp create mode 100755 CodeChef/Sereja and votes.cpp create mode 100755 CodeChef/Set Difference.cpp create mode 100755 CodeChef/Small Factorials.cpp create mode 100755 CodeChef/Snape and ladder.cpp create mode 100755 CodeChef/Statues.cpp create mode 100755 CodeChef/Steady Tables.cpp create mode 100755 CodeChef/Stepford houses.cpp create mode 100755 CodeChef/Stone.cpp create mode 100755 CodeChef/Strategy for the world cup.cpp create mode 100755 CodeChef/Sums in a triangle.cpp create mode 100755 CodeChef/Suraj Goes Shopping.cpp create mode 100755 CodeChef/Tanu and Head-bob.cpp create mode 100755 CodeChef/The First Cube.cpp create mode 100755 CodeChef/The Lead Game.cpp create mode 100755 CodeChef/The Leaking Robot.cpp create mode 100755 CodeChef/The Smallest Pair.cpp create mode 100755 CodeChef/The Warehouse.cpp create mode 100755 CodeChef/The festival of colours.cpp create mode 100755 CodeChef/The name list.cpp create mode 100755 CodeChef/The worst sister.cpp create mode 100755 CodeChef/Three Different Numbers.cpp create mode 100755 CodeChef/Tired Knights.cpp create mode 100755 CodeChef/Turbo Sort.cpp create mode 100755 CodeChef/Uncle Johny.cpp create mode 100755 CodeChef/Voters.cpp create mode 100755 CodeChef/What is this LOL!.cpp create mode 100755 CodeChef/Xor Matrix.cpp create mode 100755 CodeChef/Zombinatorial.cpp create mode 100755 CodeChef/gmon.out create mode 100755 CodeChef/out.out create mode 100755 CodeChef/test.in create mode 100644 CodeJam/.DS_Store create mode 100644 CodeJam/Google CodeJam 2015/.DS_Store create mode 100755 CodeJam/Google CodeJam 2015/01.cpp create mode 100755 CodeJam/Google CodeJam 2015/01.out create mode 100755 CodeJam/Google CodeJam 2015/A-large.in create mode 100755 CodeJam/Google CodeJam 2015/A-small-attempt0.in create mode 100755 CodeJam/Google CodeJam 2015/A-small-attempt1.in create mode 100755 CodeJam/Google CodeJam 2015/A-small-attempt2.in create mode 100755 CodeJam/Google CodeJam 2015/A-small-attempt3.in create mode 100755 CodeJam/Google CodeJam 2015/B-Output-Small.out create mode 100755 CodeJam/Google CodeJam 2015/B-small-attempt0.in create mode 100755 CodeJam/Google CodeJam 2015/B-small-attempt1.in create mode 100755 CodeJam/Google CodeJam 2015/D-large.in create mode 100755 CodeJam/Google CodeJam 2015/D-small-attempt0.in create mode 100755 CodeJam/Google CodeJam 2015/Haircut.cpp create mode 100755 CodeJam/Google CodeJam 2015/Infinite House of Pancakes.cpp create mode 100755 CodeJam/Google CodeJam 2015/Mushroom - small.in create mode 100755 CodeJam/Google CodeJam 2015/Mushroom Monster.cpp create mode 100755 CodeJam/Google CodeJam 2015/Mushroom-Monster-out.out create mode 100755 CodeJam/Google CodeJam 2015/Mushroom-large.in create mode 100755 CodeJam/Google CodeJam 2015/Ominous Omino-Large.cpp create mode 100755 CodeJam/Google CodeJam 2015/Ominous Omino-Small.cpp create mode 100755 CodeJam/Google CodeJam 2015/Ominous-Omino-Output-Large.out create mode 100755 CodeJam/Google CodeJam 2015/Ominous-Omino-Output.out create mode 100755 CodeJam/Google CodeJam 2015/Standing Ovation.cpp create mode 100755 CodeJam/Google CodeJam 2015/Standing-Ovation-Output.out create mode 100755 CodeJam/Google CodeJam 2015/Standing-Ovation-Output1.out create mode 100755 CodeJam/Google CodeJam 2015/gmon.out create mode 100755 CodeJam/Google CodeJam 2015/input.in create mode 100755 CodeJam/Google CodeJam 2015/test.in create mode 100755 CodeJam/Store Credit.cpp create mode 100644 Contests/.DS_Store create mode 100755 Contests/Angry Professor.cpp create mode 100755 Contests/SherlockAndPermutations.cpp create mode 100755 Contests/Sum Queries.cpp create mode 100755 Contests/gmon.out create mode 100755 Contests/test.in create mode 100755 Friends.cpp create mode 100755 GSS1.cpp create mode 100755 Gifts.cpp create mode 100644 HackerEarth/.DS_Store create mode 100755 HackerEarth/Roy and Texting Robot.cpp create mode 100755 HackerEarth/Roy and his Matrix.cpp create mode 100755 HackerEarth/gmon.out create mode 100644 HackerRank/.DS_Store create mode 100755 HackerRank/ACM_ICPC.cpp create mode 100755 HackerRank/AltChar.cpp create mode 100755 HackerRank/AngryChildren.cpp create mode 100755 HackerRank/B'day Gift.cpp create mode 100755 HackerRank/ConnectingTowns.cpp create mode 100755 HackerRank/CutTheSticks.cpp create mode 100755 HackerRank/FillingJars.cpp create mode 100755 HackerRank/FindDigits.cpp create mode 100755 HackerRank/HalloweenParty.cpp create mode 100755 HackerRank/HandShakes.cpp create mode 100755 HackerRank/IsFibo.cpp create mode 100755 HackerRank/LoveLetterMytstery.cpp create mode 100755 HackerRank/MaximizingXor.cpp create mode 100755 HackerRank/MinDraws.cpp create mode 100755 HackerRank/SherlockAndPermutations.cpp create mode 100755 HackerRank/SherlocknSquares.cpp create mode 100755 HackerRank/UtopianTree.cpp create mode 100755 HackerRank/chocFeast.cpp create mode 100755 HackerRank/fibo_modified.cpp create mode 100755 HackerRank/flpbits.cpp create mode 100755 HackerRank/gmon.out create mode 100755 HackerRank/is_panagram.cpp create mode 100755 HackerRank/maxSubArray.cpp create mode 100755 HackerRank/nextpal.cpp create mode 100755 HackerRank/randNumProb.cpp create mode 100755 HackerRank/sample.cpp create mode 100755 HackerRank/test.in create mode 100755 HuntIt.cpp create mode 100644 IARCS/.DS_Store create mode 100755 IARCS/01 Tiles.cpp create mode 100755 IARCS/Average.cpp create mode 100755 IARCS/Bickering Task Force.cpp create mode 100755 IARCS/Book Sorting.cpp create mode 100755 IARCS/BookList.cpp create mode 100755 IARCS/CRITINTS.cpp create mode 100755 IARCS/Cycles in Permutations.cpp create mode 100755 IARCS/Devious.cpp create mode 100755 IARCS/Dividing Sequences.cpp create mode 100755 IARCS/Draw Fixing.cpp create mode 100755 IARCS/Equal Gifts.cpp create mode 100755 IARCS/Find the Permutation.cpp create mode 100755 IARCS/Find the numbers.cpp create mode 100755 IARCS/High Speed Network.cpp create mode 100755 IARCS/Lead Game.cpp create mode 100755 IARCS/Longest Palindrome.cpp create mode 100755 IARCS/Minimum Turn Route.cpp create mode 100755 IARCS/NextPerm.cpp create mode 100755 IARCS/Number of Tilings.cpp create mode 100755 IARCS/Periodic Strings.cpp create mode 100755 IARCS/Pyramid.cpp create mode 100755 IARCS/README create mode 100755 IARCS/Railway Catering Contracts.cpp create mode 100755 IARCS/Rank Fraud.cpp create mode 100755 IARCS/Repetition-free numbers.cpp create mode 100755 IARCS/Reverse.cpp create mode 100755 IARCS/Sorting row of numbers.cpp create mode 100755 IARCS/Speculating on Buffaloes.cpp create mode 100755 IARCS/The End of Corruption.cpp create mode 100755 IARCS/The Great Escape.cpp create mode 100755 IARCS/The Leaf eaters.cpp create mode 100755 IARCS/The Medu Vada Maze.cpp create mode 100755 IARCS/The Siruseri Sports Stadium.cpp create mode 100755 IARCS/The Timber Auction.cpp create mode 100755 IARCS/Tiles.cpp create mode 100755 IARCS/Treasure.cpp create mode 100755 IARCS/Voters.cpp create mode 100755 IARCS/What is the Rank.cpp create mode 100755 IARCS/Word Hopping.cpp create mode 100755 IARCS/Word List.cpp create mode 100755 IARCS/gmon.out create mode 100755 IARCS/test.in create mode 100644 INOI Workshop/.DS_Store create mode 100644 INOI Workshop/Day 1/.DS_Store create mode 100755 INOI Workshop/Day 1/Inversions.cpp create mode 100755 INOI Workshop/Day 1/Queen.cpp create mode 100755 INOI Workshop/Day 1/SubSum.cpp create mode 100755 INOI Workshop/Day 1/Subtractions.cpp create mode 100755 INOI Workshop/Day 1/Three.cpp create mode 100644 INOI Workshop/Day 2/.DS_Store create mode 100755 INOI Workshop/Day 2/Cake.cpp create mode 100755 INOI Workshop/Day 2/Chemistry101.cpp create mode 100755 INOI Workshop/Day 2/Chemistry102.cpp create mode 100755 INOI Workshop/Day 2/NextSmallest.cpp create mode 100755 INOI Workshop/Day 2/Seinfield.cpp create mode 100755 INOI Workshop/Day 2/StreetParade.cpp create mode 100644 INOI Workshop/Day 3/.DS_Store create mode 100755 INOI Workshop/Day 3/BinTrees.cpp create mode 100755 INOI Workshop/Day 3/DNA.cpp create mode 100755 INOI Workshop/Day 3/Kadanes.cpp create mode 100755 INOI Workshop/Hacker.cpp create mode 100755 INOI Workshop/Three-Prime.cpp create mode 100644 INOI/.DS_Store create mode 100755 INOI/Brackets.cpp create mode 100755 INOI/Wealth.cpp create mode 100755 India Post.cpp create mode 100755 Laughter.cpp create mode 100755 Make Palindrome.cpp create mode 100755 Mario - Nexus Prelims.cpp create mode 100755 MaxMatchedSeq.cpp create mode 100755 Network.cpp create mode 100755 New.cpp create mode 100755 Pattern.cpp create mode 100755 Princess Farida.cpp create mode 100644 Project Euler/.DS_Store create mode 100755 Project Euler/Project Euler 1.cpp create mode 100755 Project Euler/Project Euler 10.cpp create mode 100755 Project Euler/Project Euler 11.cpp create mode 100755 Project Euler/Project Euler 12.cpp create mode 100755 Project Euler/Project Euler 13.cpp create mode 100755 Project Euler/Project Euler 14.cpp create mode 100755 Project Euler/Project Euler 15.cpp create mode 100755 Project Euler/Project Euler 16.cpp create mode 100755 Project Euler/Project Euler 17.cpp create mode 100755 Project Euler/Project Euler 18.cpp create mode 100755 Project Euler/Project Euler 19.cpp create mode 100755 Project Euler/Project Euler 2.cpp create mode 100755 Project Euler/Project Euler 20.cpp create mode 100755 Project Euler/Project Euler 21.cpp create mode 100755 Project Euler/Project Euler 22.cpp create mode 100755 Project Euler/Project Euler 23.cpp create mode 100755 Project Euler/Project Euler 24.cpp create mode 100755 Project Euler/Project Euler 243.cpp create mode 100755 Project Euler/Project Euler 25.cpp create mode 100755 Project Euler/Project Euler 26.cpp create mode 100755 Project Euler/Project Euler 27.cpp create mode 100755 Project Euler/Project Euler 28.cpp create mode 100755 Project Euler/Project Euler 29.cpp create mode 100755 Project Euler/Project Euler 3.cpp create mode 100755 Project Euler/Project Euler 30.cpp create mode 100755 Project Euler/Project Euler 31.cpp create mode 100755 Project Euler/Project Euler 32.cpp create mode 100755 Project Euler/Project Euler 33.cpp create mode 100755 Project Euler/Project Euler 34.cpp create mode 100755 Project Euler/Project Euler 35.cpp create mode 100755 Project Euler/Project Euler 36.cpp create mode 100755 Project Euler/Project Euler 37.cpp create mode 100755 Project Euler/Project Euler 38.cpp create mode 100755 Project Euler/Project Euler 39.cpp create mode 100755 Project Euler/Project Euler 4.cpp create mode 100755 Project Euler/Project Euler 40.cpp create mode 100755 Project Euler/Project Euler 41.cpp create mode 100755 Project Euler/Project Euler 42.cpp create mode 100755 Project Euler/Project Euler 43.cpp create mode 100755 Project Euler/Project Euler 44.cpp create mode 100755 Project Euler/Project Euler 45.cpp create mode 100755 Project Euler/Project Euler 46.cpp create mode 100755 Project Euler/Project Euler 47.cpp create mode 100755 Project Euler/Project Euler 48.cpp create mode 100755 Project Euler/Project Euler 49.cpp create mode 100755 Project Euler/Project Euler 5.cpp create mode 100755 Project Euler/Project Euler 50!.cpp create mode 100755 Project Euler/Project Euler 51.cpp create mode 100755 Project Euler/Project Euler 52.cpp create mode 100755 Project Euler/Project Euler 53.cpp create mode 100755 Project Euler/Project Euler 54.cpp create mode 100755 Project Euler/Project Euler 55.cpp create mode 100755 Project Euler/Project Euler 56.cpp create mode 100755 Project Euler/Project Euler 57.cpp create mode 100755 Project Euler/Project Euler 58.cpp create mode 100755 Project Euler/Project Euler 59.cpp create mode 100755 Project Euler/Project Euler 6.cpp create mode 100755 Project Euler/Project Euler 60.cpp create mode 100755 Project Euler/Project Euler 61.cpp create mode 100755 Project Euler/Project Euler 62.cpp create mode 100755 Project Euler/Project Euler 63.cpp create mode 100755 Project Euler/Project Euler 64.cpp create mode 100755 Project Euler/Project Euler 65.cpp create mode 100755 Project Euler/Project Euler 66.cpp create mode 100755 Project Euler/Project Euler 67.cpp create mode 100755 Project Euler/Project Euler 69.cpp create mode 100755 Project Euler/Project Euler 7.cpp create mode 100755 Project Euler/Project Euler 70.cpp create mode 100755 Project Euler/Project Euler 71.cpp create mode 100755 Project Euler/Project Euler 72.cpp create mode 100755 Project Euler/Project Euler 73.cpp create mode 100755 Project Euler/Project Euler 74.cpp create mode 100755 Project Euler/Project Euler 75.cpp create mode 100755 Project Euler/Project Euler 76.cpp create mode 100755 Project Euler/Project Euler 77.cpp create mode 100755 Project Euler/Project Euler 78.cpp create mode 100755 Project Euler/Project Euler 79.cpp create mode 100755 Project Euler/Project Euler 8.cpp create mode 100755 Project Euler/Project Euler 80.cpp create mode 100755 Project Euler/Project Euler 81.cpp create mode 100755 Project Euler/Project Euler 82.cpp create mode 100755 Project Euler/Project Euler 83.cpp create mode 100755 Project Euler/Project Euler 9.cpp create mode 100755 Project Euler/cipher.txt create mode 100755 Project Euler/gmon.out create mode 100755 Project Euler/grid.txt create mode 100755 Project Euler/keylog.txt create mode 100755 Project Euler/matrix.txt create mode 100755 Project Euler/names.txt create mode 100755 Project Euler/output.out create mode 100755 Project Euler/poker.txt create mode 100755 Project Euler/poker1.txt create mode 100755 Project Euler/test.in create mode 100755 Project Euler/triangle.txt create mode 100755 Project Euler/words.txt create mode 100644 SPOJ/.DS_Store create mode 100755 SPOJ/Adding Reversed Numbers.cpp create mode 100755 SPOJ/Advanced Fruits.cpp create mode 100755 SPOJ/Aggressive cows.cpp create mode 100755 SPOJ/Aibohphobia.cpp create mode 100755 SPOJ/Aliens at the train.cpp create mode 100755 SPOJ/Alphacode.cpp create mode 100755 SPOJ/Another Very Easy Problem.cpp create mode 100755 SPOJ/Baby.cpp create mode 100755 SPOJ/Chocolate - Chocola.cpp create mode 100755 SPOJ/Cross-Country.cpp create mode 100755 SPOJ/DQUERY.cpp create mode 100755 SPOJ/Die Hard.cpp create mode 100755 SPOJ/Divisor Summation.cpp create mode 100755 SPOJ/Euler Totient Function.cpp create mode 100755 SPOJ/GSS1.cpp create mode 100755 SPOJ/Histogram.cpp create mode 100755 SPOJ/Horrible Queries.cpp create mode 100755 SPOJ/Large Knapsack.cpp create mode 100755 SPOJ/Largest Rectangle in a Histogram.cpp create mode 100755 SPOJ/M3Tile.cpp create mode 100755 SPOJ/Make Psycho.cpp create mode 100755 SPOJ/Marbles.cpp create mode 100755 SPOJ/Minimum Knight Moves.cpp create mode 100755 SPOJ/Number Steps.cpp create mode 100755 SPOJ/Palindrome 2000.cpp create mode 100755 SPOJ/Party Schedule.cpp create mode 100755 SPOJ/Philosophers Stone.cpp create mode 100755 SPOJ/Prime Path.cpp create mode 100755 SPOJ/Prime or Not.cpp create mode 100755 SPOJ/Psycho.cpp create mode 100755 SPOJ/Pyscho Function.cpp create mode 100755 SPOJ/Rain.cpp create mode 100755 SPOJ/Rent your Airplane and Make Money.cpp create mode 100755 SPOJ/Scuba Diver.cpp create mode 100755 SPOJ/Seinfield.cpp create mode 100755 SPOJ/Shopping.cpp create mode 100755 SPOJ/Square Brackets.cpp create mode 100755 SPOJ/Street Parade.cpp create mode 100755 SPOJ/Sum of Product.cpp create mode 100755 SPOJ/Sums in a triangle.cpp create mode 100755 SPOJ/Sweet and Sour Rock.cpp create mode 100755 SPOJ/The Courier.cpp create mode 100755 SPOJ/The Knapsack Problem.cpp create mode 100755 SPOJ/Traffic Network.cpp create mode 100755 SPOJ/Treat for the Cows.cpp create mode 100755 SPOJ/Trip.cpp create mode 100755 SPOJ/Two Ends.cpp create mode 100755 SPOJ/Update the array!.cpp create mode 100755 SPOJ/Wachovia Bank.cpp create mode 100755 SPOJ/Where to Drink the Plonk.cpp create mode 100755 Shahblah.cpp create mode 100755 Square Country.cpp create mode 100755 Try.cpp create mode 100755 Try1.cpp create mode 100755 Wealth Disparity.cpp create mode 100755 fcs.cpp create mode 100755 gen.cpp create mode 100755 hackit.cpp create mode 100755 set.cpp create mode 100755 xor.cpp create mode 100755 xorc.cpp diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..155bf117e3d09aa4d90563b22a3e9955c35aacd0 GIT binary patch literal 22532 zcmeHP4Qw3M5q@J|;=Op2tdlsgFHY^mltAMKn>YayNF2u`aej!KGl`u)=X|%ekDTw! z-Puk^Q>7}jfGS!jEvN-S`E^=RS_*BYs)(Nw1*t-S(jU^IwnC~XQU$71RFK;Ao40rC zw|je+9}FSs?dkUC?abS^^JZpezV~*85Y##xX%eDC2%+K6TSFJ3#4ki0wvG5_7e3Gb zoTU^cg#Q8jCxKsxh%m(l5fXzV!5r#h!KY0EC1?=$p%4Euu|_1+{!7MViFiNGa1Wz* z@oyKa#a7S-dq-14y|F|uNO|Oq|`TQa+&6zQqDi4V#@B|Kw>nQ4yA`v zt)b*jc@&M9y_x-vPnwKm)bjbLgrp>){>FUkhLx*mE=;22meeChE7hl57VIjVKUS?VwdwmpplkuMl zv0Nv%U|lD+Lxf4OPo%^E_J&4+<3bD#ntp$M3)>klnpgy3ZWh}>eUrFT+%KLKzZA#B zo8n#Z0hLiTEuclzOxMsVT2Jk?kvixLwAErR$+oG+I?k?XC-#(XiuE@I!->HmdEWOW z%S^MKm}M$%ixMbG;Qvwr88@Pp|6ksH@urIsC`zD^1lT{+;m_Na%=WOgm97IT4k7tG zhmdl?KJoxrR+rhfWVVN`tz-p{WX0BErA&%J7CXx8m>k=d%=WOgwb%t&?1C~^rc8!H z^6KELljMS0tZi{!lt57exe}Osy7Erc z>y}BbQSWPrwMe$FR9aasWtPrJJnqfK*Klyn1Q*LHj{7np5th+f$ezn0*m|~Btg`zVex1^8V$1Id<- zfkQiaQtC_r&S-cfgDTKZv#7$K4MV{d^r_RP8x=EVR?MoXtgM_pr?RTLdTx&~vo{pp z*PmoWU`-;HNVdj?&7J+pXe2lk3P@jAzNVl4iJ>x~42Zlg1YrH^K zw=QX#aarG%zP^;1?o#%JbTkp~-jxFC(VjL3+v9x+T#*5ZEkk@N zwarYXu+8D=>JBB7p?JU9dSG`f)N97J#9I^TbYhSxxwdd3o`E*HqS)tqsbBS;6sV|g z*_hqA#M&`Ly|n|e8`K$3#7}`e9GM{Op+M(4u!yqX-Gv4gpdL)LwMB;0VIh9&A3Gs$ zrXY3X45)_&6jVfS*eL9q)@cGVAt+dhszP~ zeM3E`I+!C?Dq-^tCdS=~`<%mhly>lyZ9bQ)m;occ5l>ZqHgkl;`1&xO+i4sh@OA|3 zKpc*sOmya_mTu!##cgOA>L%~nIm+>=^s@k1n`mDQZ5lue+wgo(;dyUG6X|@dX@$Hl9%tao zPf@{viIE9>UDW4o_}kQcIYzH9S4OXwHevMo_OlFsU1Cv!;L}gP1J&L^uo^E;bozY` z!r$DO-VTE8pw=rGmg%=62KJwF=-==h`riS4#$rdlUPJ$`4t2!8lbYWFyNg1Nf*=2@ zyg&}ccr5Hq;fRPQKggB1>Tt!ynv8^brVx7%Q}msd#piH2ZC?7OdvWdZjLqlJ7p-21 zqYzMzV2XC11H0L2@A+Z(IbG_o{K@m5^y>ClYNW%$_DdeiVjd@Gd=8gBHL!Nw+L?NL z0by(pCt|~c@l=md5e~(|!?94>Tpf!sJc%+lFseKUT&KErq!P(Az*bb&V;I9JbE}EE zq9bM-YD85YAZmS!gzkj!|6tmjn!3+^?y}~qRvwq|@GM>5fq7x^bhIyOCa)jm$zk20 zRM?D1fCg_L;hAAEvoj9IT;ZGJ_aC2OR7}^a19SbxGuo~QF1a}oVcv*56Q~ZX-VBl)rNyrl?u04f*4|NwD^^HR=g};$3(QZ#6N(> zd?@}S{tHY-BR`dsE+?kd(?!%sSJ8618WYr7F*$7$T}NA}lXlY{+Djqory;tLQk14I z(k=8=x{Yq9Z_#~pKRrMX(v$QHdXA3LtMnSZPJf~|>2LHdW#DZ43AX`St1R?S9OP4pgmb(RD*u*2h=U7uKxxBU2^awplkJFFoDSC!}Mn8wnK2I;uujwUvg??|Trmd}+F_^5vGK!U} zt!lhA)+uRoG+IR;^U*kBuBp-w=G5bgx;Q3N=J&dyCk#M{dzH-2MSb4JPI>10p6!5v zODvAZtbgTl2+>8McKDI2Wrycbj0f1>6pqfG@|>(>;#Lb#m8Cn3O!J6xTBMxXAv1Q4 zt*1F+YlXh3A8Kr^2*#lyrAOIG)0Nn+Xq4|ZVq!=>_kmHm)lNk--KaGke`KfzE^9`QKU|J4)( znupS11U!mYfKoAqf|L$}D3#%5o~ygeVv0jWwn9bXVxNLi_%P20?>IrNh47?xDih<8 z4i)s|QB>*uY$W^Xf2XGM;6c1a)5!1BG&MJ4_o}8P-jL*TFUVfa|3b}+`J{Q?02Jyd zd~W*tv5d=qya0uBUeMVClb#CibPgZR&)5B@2UN^H4}l7OmOeXQGNu3+{t7zam-(Co z1&}W3j>HZbnFV3Ys}2Oz+)&db!~6vSU8af1)hxn`7wWpq7LlJ>C5syLfR#l8t+3b{ zoAf|7n?&Mf6)s(-2kf+z0Sl{m`HDcmm82qV#5o`pt!R}Spvc~}0#j&Sso!Y;6(_`B z#5+g;-xnVMtYDy`lIBpA1S%HOWfG`ZiDYoK1S&c(i6kh2im*%t8K~eC@Sp@L?w~tm z3V0v=ke;9)Nuc6cItHNP1pV=hfC_JoKP6aEE5VAkB3NNz1^_E8P$HlH7-g0YGK4UH zL2a$UXoUqG(^8;(%V8vp*=eZJK#d-;(F<8+BsA8uCEBXOd+#tb< z5$Ndw30B+!sNz-$R@@D!;vNZBJPfGfF$q@ugq{Xm!C=J;^x_$S6`mUF2+R2W(L4c< z1GFeW=LpFr4dtybCm`ctW{%mTh}Ata37L1it;G3!Kh|`s_Pjit8>l?WyR%BTmwy_x zLhlUuICrAAaeF%F57sLO>s-vi&W*3s=xZWlt=tgH zcF$)x2s}O$5?0dO4PJ)}fP=54(6>);kUF#`6@BC~TNt6iG;s z$*w+8C2i0SMG|_c+aBHHy(I;GY_EkQdmx7My2-P!e^{2WY;u^ zJ-dS)d6cMoLOrM2_>r3>zs;vwxci*LzA;9q*6FhD0^h%I*({#6(q^Y;Y_|I6f)TXgXEf3D5_{$Go3oiDD7 z5-3XG0+s;z+JbGZxIs=5yp|Fa*5SVwe_ojGu(h>Wu;W7!f7VCChQS%RpnPv;m-!C! nKIZDlqEGxIKoj&;g<}3c{%Ozxxo0u||EM1rEg;;Fn*aX~X$k +using namespace std; +#define endl '\n' +#define ll long long + +ll gcd(ll a, ll b) +{ + if(b == 0) + { + return a; + } + else + { + return gcd(b, a%b); + } +} +ll lcm(ll a, ll b){return (a*b)/gcd(a,b);} +int main() { + + ll t; + cin >> t; + while(t--) + { + ll s, e1, e2, v1, v2, cmn = 0, lcmv; + cin >> s >> e1 >> e2 >> v1 >> v2; + e1 -= s; e2 -= s; + if(v1 > 0 && v2 < 0 || (v1 < 0 && v2 > 0)) + { + cout << 1 << endl; + continue; + } + e1 = abs(e1); e2 = abs(e2); + v1 = abs(v1); v2 = abs(v2); + lcmv = lcm(v1, v2); + cmn = (min(e1, e2))/ lcmv; + cout << cmn + 1 << endl; + } + return 0; +} diff --git a/ChandraguptaBST.cpp b/ChandraguptaBST.cpp new file mode 100755 index 0000000..be05dca --- /dev/null +++ b/ChandraguptaBST.cpp @@ -0,0 +1,98 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAX 300010 +ll MOD = 1e9 + 7; +struct node +{ + mutable bool left, right; + ll key; + mutable ll position, index; + bool operator < (node other) const + { + return key < other.key; + } +}; + +set vals; +ll arr[MAX]; +void insrt(node k) +{ + ll num; + if(k.index == 0) + { + k.position = 1; + num = 1; + vals.insert(k); + } + else + { + vals.insert(k); + auto it = vals.find(k); + auto it1 = it; it1++; + if(it == vals.begin()) + { + it++; + if(!(it -> left)) + { + it -> left = true; + num = ((it -> position)*2); + num %= MOD; + --it; + it -> position = num; + } + } + else if(it1 == vals.end()) + { + it1--; it1--; + if(!(it1->right)) + { + it1 -> right = true; + num = (it1 -> position)*2 + 1; + num %= MOD; + ++it1; + it1 -> position = num; + } + } + else + { + it--; + if(!(it -> right)) + { + it -> right = true; + num = (it -> position)*2 + 1; + num %= MOD; + ++it; + it -> position = num; + } + else if(!(it1 -> left)) + { + it1 -> left = true; + num = (it1 -> position)*2; + num %= MOD; + --it1; + it1 -> position = num; + } + } + } + arr[k.index] = num % MOD; +} +int main() +{ + ios_base::sync_with_stdio(0); cin.tie(0); + ll n, i, num; + cin >> n; + for(i = 0; i < n; i++) + { + node k; + cin >> k.key; + k.left = k.right = false; + k.index = i; + insrt(k); + num = arr[i] % MOD; + cout << num << " "; + } + return 0; +} diff --git a/Classic/.DS_Store b/Classic/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..67880f13f626dd03f202c3789295e3292b57fbd5 GIT binary patch literal 8196 zcmeI1-%isp6vt1uB@iJF4Ka{#(MxV5(I=QVO^knnLldu5wgIA(k!|3gt33t}TMh4-qk&$K87(D3s2NR$sTrrG?({8mpvJvFiOAi<0 z;bOwbCfrbr8y%c=-NiJ#%w=XEGce77-reWqfpmE`;`@8QO$&?3w2P zU@wtY?x)e!KNILx#{0l{Lmn%i8T-V&S?1iQW{2FNrpJ@C$Ibi{t>%KaCa4h@E3cdm zegBq5JJwGl-WH_^6Z_;5>>XoKa#Y7)jJxe{C*Zn_d@Y|BuLn zAMmd8xJ%xW*V2-gX?toX6S|g5b+yp5Ri;ONK%{Q*)xhS}dP?mvKUGh}YrVvtG`qxD z0X>IDI%O+IW2(@5p57Ws8qa-vIPzc0&R3d7jQJYbwg%rrIN2e_bQN^ry^jWEUf(qe z4~ZZvZGH`@Pg?D`i}fzbQ*b+cs~b|PN0T_mRg7Df=UCk%0uR9U82MW9q${&9ue!W& z5v;2q-b0dBI2L0oZg}pn00ysM@^{4Ks$+5BELZE*2bOZracFtd71f5pL7EH4VXW~M zF|WQ*5BS+ARy|d+6FN3y4NJ^@mx#DrP0zr8FWV7xWt$jZpTf8BPsuveHC;e2OrVq8 z>*_6_RzV$LweE%I{P}t7t~i8W-7^o#B`j!+SKdUP(OF!cA{r5%&7?hsv#5Yx27Qd* zRD(wH=$a7;mjyj+EHjv@e$Fd;|9@2e{eK3T$y3e@%nk#l*4%DxGG9|NXT57%@_Vu- w?Kk$)K`7jH99g4U+b{lM$Zs3!8bOY|q=od)KLq6SUun +using namespace std; +int add(int x, int y); +int main() +{ + int input1,input2,answer; + cin >> input1 >> input2; + answer = add(input1, input2); + cout << answer; + return 0; +} +int add(int x, int y) +{ + int carry; + while (y!=0) + { + carry = x & y; + x = x^y; + y = carry << 1; + } + return x; +} diff --git a/Classic/Add_Strings.cpp b/Classic/Add_Strings.cpp new file mode 100755 index 0000000..d2263f3 --- /dev/null +++ b/Classic/Add_Strings.cpp @@ -0,0 +1,52 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +string add_zeros(string str, ll n) +{ + while(n--) + { + str += '0'; + } + return str; +} +string add(string num1, string num2) +{ + string sum = "", a, b; + ll i, summer, carry = 0; + a = string(num1.rbegin(), num1.rend()); + b = string(num2.rbegin(), num2.rend()); + if(a.length() > b.length()) + { + b = add_zeros(b, a.length()-b.length()); + } + else + { + a = add_zeros(a, b.length() - a.length()); + } + for(i = 0; i < min(a.length(), b.length()); i++) + { + summer = (ll)(a[i] + b[i] - 2*(ll)('0') + carry); + carry = 0; + if(summer > 9) + { + carry = summer/10; + summer%= 10; + } + sum += (char)(summer + '0'); + } + if(carry!=0) + { + sum += (char)(carry + '0'); + } + return string(sum.rbegin(), sum.rend()); +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << add("42000", "1"); + return 0; +} diff --git a/Classic/BFS.cpp b/Classic/BFS.cpp new file mode 100755 index 0000000..ed3288b --- /dev/null +++ b/Classic/BFS.cpp @@ -0,0 +1,24 @@ +#include +using namespace std; +#define endl '\n' +void BFS(vector edges[], v) +{ + set visited; + queue q; + q.push(v); + visited.insert(v); + while(q.size() != 0) + { + v = q.front(); + q.pop(); + for(int i = 0; i < edges[v].size(); i++) + { + if(visited.count(edges[v][i]) == 0) + { + q.push(edges[v][i]); + visited.push(edges[v][i]); + } + } + } + +} diff --git a/Classic/Bin. Coeff.cpp b/Classic/Bin. Coeff.cpp new file mode 100755 index 0000000..800f9c7 --- /dev/null +++ b/Classic/Bin. Coeff.cpp @@ -0,0 +1,44 @@ +#include +using namespace std; +#define endl '\n' + +int min(int a, int b); + +// Returns value of Binomial Coefficient C(n, k) +int binomialCoeff(int n, int k) +{ + int C[n+1][k+1]; + int i, j; + + // Caculate value of Binomial Coefficient in bottom up manner + for (i = 0; i <= n; i++) + { + for (j = 0; j <= min(i, k); j++) + { + // Base Cases + if (j == 0 || j == i) + C[i][j] = 1; + + // Calculate value using previosly stored values + else + C[i][j] = C[i-1][j-1] + C[i-1][j]; + } + } + + return C[n][k]; +} + +// A utility function to return minimum of two integers +int min(int a, int b) +{ + return (a> n >> k; + cout << binomialCoeff(n, k); + return 0; +} diff --git a/Classic/Bin.Coeff 2.cpp b/Classic/Bin.Coeff 2.cpp new file mode 100755 index 0000000..3a38e89 --- /dev/null +++ b/Classic/Bin.Coeff 2.cpp @@ -0,0 +1,27 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll binomialCoeff(ll n, ll k) +{ + ll ans = 1, i; + if(k > n - k) + { + k = n-k; + } + + for(i = 0; i < k; i++) + { + ans *= (n - i); + ans /= (i+1); + } + return ans; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << binomialCoeff(5, 3); + return 0; +} diff --git a/Classic/Chess moves to a cell.cpp b/Classic/Chess moves to a cell.cpp new file mode 100755 index 0000000..a14957f --- /dev/null +++ b/Classic/Chess moves to a cell.cpp @@ -0,0 +1,62 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define mp make_pair +#define pci pair +bool isValid(pci p) +{ + if(p.first >= 'a' && p.first <= 'h' && p.second >= 1 && p.second <= 8) + { + return true; + } + return false; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + char a; + ll b; + cin >> a >> b; + map visited; + map came_from; + queue frontier; + frontier.push(mp('a', 1)); + pci curr; + while(!frontier.empty()) + { + curr = frontier.front(); + frontier.pop(); + visited[curr] = true; + if(curr.first == a && curr.second == b) + { + break; + } + pci h2fv1l = mp((char)(curr.first - 1), curr.second + 2), h2fv1r = mp((char)(curr.first + 1), curr.second + 2), h2bv1l = mp((char)(curr.first - 1), curr.second - 2); + pci h2bv1r = mp((char)(curr.first + 1), curr.second - 2), h1fv2l = mp((char)(curr.first - 2), curr.second + 1), h1fv2r = mp((char)(curr.first + 2), curr.second + 1); + pci h1bv2l = mp((char)(curr.first - 2), curr.second - 1), h1bv2r = mp((char)(curr.first + 2), curr.second - 1); + vector pairs; + pairs.push_back(h2fv1l), pairs.push_back(h2fv1r), pairs.push_back(h2bv1l), pairs.push_back(h2bv1r), pairs.push_back(h1fv2l), pairs.push_back(h1fv2r), pairs.push_back(h1bv2l), pairs.push_back(h1bv2r); + for(ll i = 0; i < pairs.size(); i++) + { + if((!visited[pairs[i]]) && isValid(pairs[i])) + { + came_from[pairs[i]] = curr; + frontier.push(pairs[i]); + visited[pairs[i]] = true; + } + } + } + vector path; + while(!(curr.first == 'a' && curr.second == 1)) + { + path.push_back(curr); + curr = came_from[curr]; + } + for(ll i = path.size()-1; i >= 0; i--) + { + cout << path[i].first << path[i].second << " "; + } + return 0; +} diff --git a/Classic/Date To Day.cpp b/Classic/Date To Day.cpp new file mode 100755 index 0000000..faaf34b --- /dev/null +++ b/Classic/Date To Day.cpp @@ -0,0 +1,30 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll DateToDay(ll day, ll month, ll year) //Valid for Dates above 1 Jan, 1900 +{ + ll days = 0; + ll months[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; + days += months[month-1]; + days += day - 1; + if(days < 59 && year % 4 == 0) + { + days--; + if(year % 100 == 0 && year % 400 != 0) + { + days++; + } + } + days += ( ( year - 1900) * 365) + ( (year-1900) / 4) - (year/100 - (1900/100) ) + (year/400 - 1900/400); + return (days + 1)%7; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << DateToDay(18, 3, 2000); //Birthday! + return 0; +} diff --git a/Classic/DigitSum.cpp b/Classic/DigitSum.cpp new file mode 100755 index 0000000..62c04a2 --- /dev/null +++ b/Classic/DigitSum.cpp @@ -0,0 +1,29 @@ +#include +using namespace std; +#define endl '\n' +long long int DigitSum(long long int n) +{ + int l = log10(n) + 1; + int sum = 0; + while(l--) + { + sum += n%10; + n= n/10; + } + if(sum >= 10) + { + return DigitSum(sum); + } + else{ + return sum; + } +} + +int main() +{ + ios_base::sync_with_stdio(0); + int n; + cin >> n; + cout << DigitSum(n); + return 0; +} diff --git a/Classic/Divide_Strings.cpp b/Classic/Divide_Strings.cpp new file mode 100755 index 0000000..650f0ce --- /dev/null +++ b/Classic/Divide_Strings.cpp @@ -0,0 +1,68 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pii make_pair + +string add_zeros(string str, ll n) +{ + while(n--) + { + str += '0'; + } + return str; +} +string subtract(string num1, string num2) +{ + string a, b, diff = ""; + ll i, holder, carry; + reverse(num1.begin(), num1.end()); + reverse(num2.begin(), num2.end()); + if(num1.length() > num2.length()) + { + num2 = add_zeros(num2, num1.length()-num2.length()); + } + else + { + num1 = add_zeros(num1, num2.length() - num1.length()); + } + carry = 0; + for(i = 0; i < num1.length(); i++) + { + holder = (ll)(num1[i] - num2[i] + carry); + carry = 0; + if(holder < 0) + { + holder += 10; + carry = -1; + } + diff += (char)(holder + '0'); + } + return string(diff.rbegin(), diff.rend()); +} + +bool isGreaterThan(string num1, string num2) +{ + reverse(num2.begin(), num2.end()); + num2 = add_zeros(num2, num1.length() - num2.length()); + reverse(num2.begin(), num2.end()); + return num1 > num2; +} +ll divide(string num1, string num2) +{ + ll quotient = 0; + while(isGreaterThan(num1, num2)) + { + num1 = subtract(num1, num2); + quotient++; + } + return quotient+1; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << divide("333", "111"); + return 0; +} diff --git a/Classic/Knapsack.cpp b/Classic/Knapsack.cpp new file mode 100755 index 0000000..1955f83 --- /dev/null +++ b/Classic/Knapsack.cpp @@ -0,0 +1,44 @@ +#include +using namespace std; +#define endl '\n' +void knpsck(long long weights[], long long vals[], int n, int Capacity) +{ + long long knapsack[n+1][Capacity+1]; + long long i, w, t; + for(i = 0; i <= n; i++) + { + for(w = 0; w <= Capacity; w++) + { + if(i == 0 || w == 0) + { + knapsack[i][w] = 0; + } + else + { + if(weights[i - 1] > w) + { + knapsack[i][w] = knapsack[i-1][w]; + } + else + { + t = knapsack[i][w] = max(knapsack[i-1][w], vals[i-1] + knapsack[i-1][w - weights[i-1]]); + } + } + } + } + cout << knapsack[n][Capacity] << endl; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int x, n, i; + cin >> x >> n; + long long weights[n], vals[n]; + for(i = 0; i < n; i++) + { + cin >> weights[i]; + cin >> vals[i]; + } + knpsck(weights, vals, n, x); + return 0; +} diff --git a/Classic/Multiply_Strings.cpp b/Classic/Multiply_Strings.cpp new file mode 100755 index 0000000..dda3ec4 --- /dev/null +++ b/Classic/Multiply_Strings.cpp @@ -0,0 +1,87 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +string add_zeros(string str, ll n) +{ + while(n--) + { + str += '0'; + } + return str; +} + +string add(string num1, string num2) +{ + string sum = "", a, b; + ll i, summer, carry = 0; + a = string(num1.rbegin(), num1.rend()); + b = string(num2.rbegin(), num2.rend()); + if(a.length() > b.length()) + { + b = add_zeros(b, a.length()-b.length()); + } + else + { + a = add_zeros(a, b.length() - a.length()); + } + for(i = 0; i < min(a.length(), b.length()); i++) + { + summer = (ll)(a[i] + b[i] - 2*(ll)('0') + carry); + carry = 0; + if(summer > 9) + { + carry = summer/10; + summer%= 10; + } + sum += (char)(summer + '0'); + } + if(carry!=0) + { + sum += (char)(carry + '0'); + } + return string(sum.rbegin(), sum.rend()); +} +string multiply(string num1, string num2) +{ + string product, a, b; + ll i, j, holder, carry; + vector toAdd; + a = string(num1.rbegin(), num1.rend()); + b = string(num2.rbegin(), num2.rend()); + for(i = 0; i < a.length(); i++) + { + carry = 0; + product = ""; + for(j = 0; j < b.length(); j++) + { + holder = ((ll)(a[i] - '0') * (ll)(b[j] - '0') ) + carry; + carry = 0; + if(holder > 9) + { + carry = holder/10; + holder%=10; + } + product += (char)(holder+'0'); + } + if(carry!=0) + { + product += (char)(carry+'0'); + } + toAdd.push_back(string(product.rbegin(), product.rend())); + } + product = toAdd[0]; + for(i = 1; i < toAdd.size(); i++) + { + product = add(product, add_zeros(toAdd[i], i)); + } + return product; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << multiply("1084483", "12"); + return 0; +} diff --git a/Classic/NumToString.cpp b/Classic/NumToString.cpp new file mode 100755 index 0000000..65425b5 --- /dev/null +++ b/Classic/NumToString.cpp @@ -0,0 +1,24 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +string numToString(ll num) +{ + ll i; + string str = ""; + while(num != 0) + { + str += (char)( (num%10) + '0'); + num/=10; + } + str = string(str.rbegin(), str.rend()); + return str; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << numToString(1234); + return 0; +} diff --git a/Classic/Partition of a number.cpp b/Classic/Partition of a number.cpp new file mode 100755 index 0000000..a1faf87 --- /dev/null +++ b/Classic/Partition of a number.cpp @@ -0,0 +1,39 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll partitions(ll num) +{ + ll i, partitions[num+1], partition, k, n, sign; + partitions[0] = partitions[1] = 1; + for(i = 2; i <= num; i++) + { + sign = 1; + partition = 0; + n = 1; + k = (3*n*n-n)/2; + while(k <= i) + { + partition += sign * partitions[i - k]; + n = -n; + k = (3*n*n-n)/2; + if(k <= i) + { + partition += sign * partitions[i-k]; + n = -n + 1; + } + sign = -sign; + k = (3*n*n-n)/2; + } + partitions[i] = partition; + } + return partitions[num]; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << partitions(55754); + return 0; +} diff --git a/Classic/RomanNumerals.cpp b/Classic/RomanNumerals.cpp new file mode 100755 index 0000000..1c92db9 --- /dev/null +++ b/Classic/RomanNumerals.cpp @@ -0,0 +1,35 @@ +#include +using namespace std; +#define ll long long +string to_roman(ll value) +{ + struct romandata_t { ll value; char const* numeral; }; + const struct romandata_t romandata[] = + { + {1000, "M"}, {900, "CM"}, + {500, "D"}, {400, "CD"}, + {100, "C"}, { 90, "XC"}, + { 50, "L"}, { 40, "XL"}, + { 10, "X"}, { 9, "IX"}, + { 5, "V"}, { 4, "IV"}, + { 1, "I"}, + { 0, NULL} // end marker + }; + + string result; + for (const romandata_t* current = romandata; current->value > 0; ++current) + { + while (value >= current->value) + { + result += current->numeral; + value -= current->value; + } + } + return result; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << to_roman(3000); + return 0; +} diff --git a/Classic/SegTree Lazy.cpp b/Classic/SegTree Lazy.cpp new file mode 100755 index 0000000..cf1a849 --- /dev/null +++ b/Classic/SegTree Lazy.cpp @@ -0,0 +1,149 @@ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAXN 1111111 +ll arr[MAXN], lazy[MAXN], n; +ll stringToNum(string str) +{ + ll i, num = 0; + for(i = 0; i < str.length(); i++) + { + num += (ll)str[i] - '0'; + num*= 10; + } + return num/10; +} +string numToString(ll num) +{ + ll i; + string str = ""; + while(num != 0) + { + str += (char)( (num%10) + '0'); + num/=10; + } + str = string(str.rbegin(), str.rend()); + return str; +} +string nextRotation(string str) +{ + char f = str[0]; + str = str.substr(1, str.length()-1); + str += f; + return str; +} +struct node +{ + node *next; + ll height; +} vals[MAXN]; +ll getMid(ll s, ll e) +{ + return (s + (e-s)/2); +} +ll getMaxUtil(ll *st, ll ss, ll se, ll qs, ll qe, ll index) +{ + if(ss > se || se < qs || ss > qe) + { + return 0; + } + if(lazy[index] != 0) + { + st[index] += lazy[index]; + if(ss != se) + { + lazy[2*index] += lazy[index]; + lazy[2*index + 1] += lazy[index]; + } + lazy[index] = 0; + } + if(ss >= qs && qe >= se) + { + return st[index]; + } + ll mid = getMid(ss, se); + return max(getMaxUtil(st, ss, mid, qs, qe, 2*index), getMaxUtil(st, mid+1, se, qs, qe, 2*index + 1)); +} +ll getMax(ll *st, ll n, ll qs, ll qe) +{ + return getMaxUtil(st, 1, n, qs, qe, 1); +} +void updateValUtil(ll *st, ll l, ll r, ll diff, ll ss, ll se, ll i) +{ + if(lazy[i] != 0) + { + st[i] += lazy[i]; + if(ss != se) + { + lazy[2*i] += lazy[i]; + lazy[2*i + 1] += lazy[i]; + } + lazy[i] = 0; + } + if (l > se || r < ss || ss > se) + return; + if(ss >= l && se <= r) + { + st[i] += diff; + if(ss != se) + { + lazy[2*i] += diff; + lazy[2*i + 1] += diff; + } + return; + } + ll mid = getMid(ss, se); + updateValUtil(st, l, r, diff, ss, mid, 2*i); + updateValUtil(st, l, r, diff, mid + 1, se, 2*i + 1); + st[i] = max(st[i*2], st[i*2 +1]); +} +void updateVal(ll *st, ll l, ll r, ll n, ll val) +{ + updateValUtil(st, l, r, val, 1, n, 1); +} +ll constructUtil(ll *tree, ll ss, ll se, ll index) +{ + if(ss == se) + { + tree[index] = arr[ss]; + return tree[index]; + } + else + { + ll mid = (ss+se)/2; + tree[index] = max(constructUtil(tree, ss, mid, 2*index), constructUtil(tree, mid+1, se, 2*index + 1)); + return tree[index]; + } +} +ll *constructSegTree(ll arr[]) +{ + ll x = ceil(log2(n)); + ll maxSize = 2*(pow(2, x))-1; + ll *tree = new ll[maxSize]; + constructUtil(tree, 1, n, 1); + return tree; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cin >> n; + ll i, j; + string ht; + for(i = 1; i <= n; i++) + { + cin >> ht; + vals[i].height = stringToNum(ht); + + for(j = 1; j < ht.length()-1; j++) + { + ht = nextRotation(ht); + nxt.height = stringToNum(ht); + curr.next = nxt; + + } + } + ll *tree = constructSegTree(arr); + + return 0; +} diff --git a/Classic/SegTree RMQ.cpp b/Classic/SegTree RMQ.cpp new file mode 100755 index 0000000..69a15d1 --- /dev/null +++ b/Classic/SegTree RMQ.cpp @@ -0,0 +1,96 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAXN 111111 +#define INF 0x7fffffff +ll n, *segTree, arr[MAXN]; + +ll updateTreeUtil(ll ss, ll se, ll index, ll i, ll val) +{ + if(ss > se) + { + return INF; + } + else if(ss == i && se == i) + { + segTree[index] = val; + return segTree[index]; + } + else if(ss != se) + { + ll mid = (ss + se)/2; + segTree[index] = min(updateTreeUtil(ss, mid, 2*index, i, val), updateTreeUtil(mid+1, se, 2*index + 1, i, val)); + return segTree[index]; + } + else + { + return segTree[index]; + } +} +ll updateTree(ll i, ll val) +{ + arr[i] = val; + return updateTreeUtil(1, n, 1, i, val); +} +ll getMinUtil(ll ss, ll se, ll l, ll r, ll index) +{ + if(l <= ss && se <= r) + { + return segTree[index]; + } + else if(se < l || ss > r) + { + return INF; + } + else + { + ll mid = (ss + se)/2; + segTree[index] = min(getMinUtil(ss, mid, l, r, 2*index), getMinUtil(mid+1, se, l, r, 2*index + 1)); + return segTree[index]; + } +} +ll getMin(ll l, ll r) +{ + return getMinUtil(1, n, l, r, 1); +} +ll constructUtil(ll *tree, ll ss, ll se, ll index) +{ + if(ss == se) + { + tree[index] = arr[ss]; + return tree[index]; + } + else + { + ll mid = (ss+se)/2; + tree[index] = min(constructUtil(tree, ss, mid, 2*index), constructUtil(tree, mid+1, se, 2*index + 1)); + return tree[index]; + } +} +ll *constructSegTree() +{ + ll x = ceil(log2(n)); + ll maxSize = 2*(pow(2, x))-1; + ll *tree = new ll[maxSize]; + constructUtil(tree, 1, n, 1); + return tree; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cin >> n; + ll i; + for(i = 1; i <= n; i++) + { + cin >> arr[i]; + } + segTree = constructSegTree(); + cout << getMin(1, n) << endl; + updateTree(5, 1); + cout << getMin(1, n) << endl; + updateTree(5, 101); + cout << getMin(1, n) << endl; + return 0; +} diff --git a/Classic/SegTree.cpp b/Classic/SegTree.cpp new file mode 100755 index 0000000..b927f2a --- /dev/null +++ b/Classic/SegTree.cpp @@ -0,0 +1,65 @@ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll getMid(ll s, ll e) +{ + return (s + (e-s)/2); +} +ll getSumUtil(ll *st, ll ss, ll se, ll qs, ll qe, ll index) +{ + if(qs <= ss && qe >= se) + { + return st[index]; + } + if(se < qs || ss > qe) + { + return 0; + } + ll mid = getMid(ss, se); + return getSumUtil(st, ss, mid, qs, qe, 2*index + 1) + getSumUtil(st, mid+1, se, qs, qe, 2*index + 2); +} +ll getSum(ll *st, ll n, ll qs, ll qe) +{ + return getSumUtil(st, 0, n-1, qs, qe, 0); +} +void updateValUtil(ll *st, ll index, ll diff, ll ss, ll se) +{ + st[index] += diff; + if(ss != se) + { + ll mid = getMid(ss, se); + updateValUtil(st, 2*index + 1, diff, ss, mid); + updateValUtil(st, 2*index + 2, diff, mid + 1, se); + } +} +void updateVal(ll *st, ll index, ll arr[], ll n, ll newVal) +{ + ll diff = newVal - arr[index]; + arr[index] = newVal; + updateValUtil(st, index, diff, 0, n-1); +} +ll constructSegTree(ll arr[], ll ss, ll se, ll *st, ll si) +{ + if(ss == se) + { + st[si] = arr[ss]; + return arr[ss]; + } + ll mid = getMid(ss, se); + st[si] = constructSegTree(arr, ss, mid, st, 2*si + 1) + constructSegTree(arr, mid + 1, se, st, 2*si + 2); + return st[si]; +} +ll *SegMake(ll arr[], ll n) +{ + ll x = (ll)(ceil(log2(n))); + ll max_size = 2*(ll)(pow(2, x)) - 1; + ll *st = new ll[max_size]; + constructSegTree(arr, 0, n-1, st, 0); + return st; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + return 0; +} diff --git a/Classic/Sieve of eratosthenes.cpp b/Classic/Sieve of eratosthenes.cpp new file mode 100755 index 0000000..8108791 --- /dev/null +++ b/Classic/Sieve of eratosthenes.cpp @@ -0,0 +1,42 @@ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll M = 100000; +ll arr[100001]; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + int n; + cin >> n; + cout << 2; + for(ll i = 3; i <= n; i+=2) + { + if(arr[i] == 1) + { + cout << i << ", "; + } + } + return 0; +} diff --git a/Classic/StringToNum.cpp b/Classic/StringToNum.cpp new file mode 100755 index 0000000..833ed06 --- /dev/null +++ b/Classic/StringToNum.cpp @@ -0,0 +1,22 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll stringToNum(string str) +{ + ll i, num = 0; + for(i = 0; i < str.length(); i++) + { + num += (ll)str[i] - '0'; + num*= 10; + } + return num/10; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << stringToNum("1234"); + return 0; +} diff --git a/Classic/Subtract_Strings.cpp b/Classic/Subtract_Strings.cpp new file mode 100755 index 0000000..5cf469e --- /dev/null +++ b/Classic/Subtract_Strings.cpp @@ -0,0 +1,50 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pii make_pair + +string add_zeros(string str, ll n) +{ + while(n--) + { + str += '0'; + } + return str; +} +string subtract(string num1, string num2) +{ + string a, b, diff = ""; + ll i, holder, carry; + reverse(num1.begin(), num1.end()); + reverse(num2.begin(), num2.end()); + if(num1.length() > num2.length()) + { + num2 = add_zeros(num2, num1.length()-num2.length()); + } + else + { + num1 = add_zeros(num1, num2.length() - num1.length()); + } + carry = 0; + for(i = 0; i < num1.length(); i++) + { + holder = (ll)(num1[i] - num2[i] + carry); + carry = 0; + if(holder < 0) + { + holder += 10; + carry = -1; + } + diff += (char)(holder + '0'); + } + return string(diff.rbegin(), diff.rend()); +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << subtract("123", "22"); + return 0; +} diff --git a/Classic/fenwickTree - PURQ.cpp b/Classic/fenwickTree - PURQ.cpp new file mode 100755 index 0000000..d27670c --- /dev/null +++ b/Classic/fenwickTree - PURQ.cpp @@ -0,0 +1,45 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +int getSum(int *fenwickTree, int n, int index) +{ + int sum = 0; + index++; + while(index > 0) + { + sum += fenwickTree[index]; + index -= index & (-index); + } + return sum; +} +void updateTree(int *fenwickTree, int n, int index, int val) +{ + index++; + while(index <= n) + { + fenwickTree[index] += val; + index += index & (-index); + } +} +int *buildTree(int arr[], int n) +{ + int *fenwickTree = new int[n+1]; + for(int i = 1; i <= n; i++) + { + fenwickTree[i] = 0; + } + for(int i = 0; i < n; i++) + { + updateTree(fenwickTree, n, i, arr[i]); + } + return fenwickTree; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int arr[] = {20, 10, 50, 40}; + int *fenwickTree = buildTree(arr, 4); + cout << getSum(fenwickTree, 4, 4); + return 0; +} diff --git a/Classic/fenwickTree RUPQ.cpp b/Classic/fenwickTree RUPQ.cpp new file mode 100755 index 0000000..4ddc682 --- /dev/null +++ b/Classic/fenwickTree RUPQ.cpp @@ -0,0 +1,36 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +int query(int *fenwickTree, int n, int index) +{ + int sum = 0; + while(index > 0) + { + sum += fenwickTree[index]; + index -= index & (-index); + } + return sum; +} +void updateTree(int *fenwickTree, int n, int index, int val) +{ + while(index <= n) + { + fenwickTree[index] += val; + index += index & (-index); + } +} +void updateTree(int *fenwickTree, int n, int a, int b, int val) +{ + updateTree(fenwickTree, n, a, val); + updateTree(fenwickTree, n, b+1, -val); +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int arr[] = {0, 0, 0, 0, 0}; + updateTree(arr, 5, 1, 3, 2); + updateTree(arr, 5, 3, 4, 2); + cout << query(arr, 5, 3); + return 0; +} diff --git a/Classic/fenwickTree RURQ.cpp b/Classic/fenwickTree RURQ.cpp new file mode 100755 index 0000000..1a52449 --- /dev/null +++ b/Classic/fenwickTree RURQ.cpp @@ -0,0 +1,48 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +int query(int *fenwickTree, int n, int index) +{ + int sum = 0; + while(index > 0) + { + sum += fenwickTree[index]; + index -= index & (-index); + } + return sum; +} +int query(int *fenwickTree1, int *fenwickTree2, int n, int index) +{ + return query(fenwickTree1, n, index)*index - query(fenwickTree2, n, index); +} +int query(int *fenwickTree1, int *fenwickTree2, int n, int a, int b) +{ + return query(fenwickTree1, fenwickTree2, n, b) - query(fenwickTree1, fenwickTree2, n, a-1); +} +void updateTree(int *fenwickTree, int n, int index, int val) +{ + while(index <= n) + { + fenwickTree[index] += val; + index += index & (-index); + } +} +void updateTree(int *fenwickTree1, int *fenwickTree2, int n, int a, int b, int val) +{ + updateTree(fenwickTree1, n, a, val); + updateTree(fenwickTree1, n, b+1, -val); + updateTree(fenwickTree2, n, a, val*(a-1)); + updateTree(fenwickTree2, n, b+1, -val*b); +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int arr1[] = {0, 0, 0, 0, 0}; + int arr2[] = {0, 0, 0, 0, 0}; + updateTree(arr1, arr2, 5, 1, 3, 2); + updateTree(arr1, arr2, 5, 3, 4, 2); + updateTree(arr1, arr2, 5, 1, 4, 10); + cout << query(arr1, arr2, 5, 1, 4); + return 0; +} diff --git a/Classic/fenwickTree.cpp b/Classic/fenwickTree.cpp new file mode 100755 index 0000000..a453d5e --- /dev/null +++ b/Classic/fenwickTree.cpp @@ -0,0 +1,45 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +int getSum(int *fenwickTree, int n, int index) +{ + int sum = 0; + index++; + while(index > 0) + { + sum += fenwickTree[index]; + index -= index & (-index); + } + return sum; +} +void updateTree(int *fenwickTree, int n, int index, int val) +{ + index++; + while(index <= n) + { + fenwickTree[index] += val; + index += index & (-index); + } +} +int *buildTree(int arr[], int n) +{ + int *fenwickTree = new int[n+1]; + for(int i = 1; i <= n; i++) + { + fenwickTree[i] = 0; + } + for(int i = 0; i < n; i++) + { + updateTree(fenwickTree, n, i, arr[i]); + } + return fenwickTree; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int arr[] = {20, 10, 50, 40}; + int *fenwickTree = buildTree(arr, 4); + cout << getSum(fenwickTree, 4, 0); + return 0; +} diff --git a/Classic/gcd.cpp b/Classic/gcd.cpp new file mode 100755 index 0000000..493a0ba --- /dev/null +++ b/Classic/gcd.cpp @@ -0,0 +1,12 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << gcd(4, 12); + return 0; +} diff --git a/Classic/gmon.out b/Classic/gmon.out new file mode 100755 index 0000000000000000000000000000000000000000..bf3ec74940329a91bd3a67b5f3b1e1fb2964c938 GIT binary patch literal 242728 zcmeIvKWkHA6bIl_(uyF6NdKXwRw%f1ERK2!u@Q7PAHYR$5Co}Mio0$u6~91-qOEoi z%;HuMY$p-AbZ~KVh~OaVd6Q`F>{fX0k{^fP`{vx|E=*Oix7v>0P9q-9PQ>kqnA!OL z;CDWYnLPvu5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009EWLtyN9tZ7RE1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfWUtVY)x0OzTb+mJl&ZY<(sorEKODYdG}lu zZ>QUFB0Fp6N1dPZRXiVdmd`fh-GyeH&Q4X!_lCJq&erngt!5lfG~-mxw=(bN*^)ai zTXCaWiPFDY%Nvw2Ck{XeeQcJlxL literal 0 HcmV?d00001 diff --git a/Classic/isPalindrome in any base.cpp b/Classic/isPalindrome in any base.cpp new file mode 100755 index 0000000..daa4e33 --- /dev/null +++ b/Classic/isPalindrome in any base.cpp @@ -0,0 +1,22 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll isPalin(ll num, ll base) +{ + ll reversed = 0; + ll n = num; + while(n) + { + reversed = base*reversed + n % base; + n /= base; + } + return num == reversed; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << isPalin(585, 2); + return 0; +} diff --git a/Classic/output.out b/Classic/output.out new file mode 100755 index 0000000..0a3f5bd --- /dev/null +++ b/Classic/output.out @@ -0,0 +1 @@ +2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537, 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609, 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091, 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161, 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227, 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377, 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433, 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491, 9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587, 9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649, 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733, 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857, 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973, 10007, 10009, 10037, 10039, 10061, 10067, 10069, 10079, 10091, 10093, 10099, 10103, 10111, 10133, 10139, 10141, 10151, 10159, 10163, 10169, 10177, 10181, 10193, 10211, 10223, 10243, 10247, 10253, 10259, 10267, 10271, 10273, 10289, 10301, 10303, 10313, 10321, 10331, 10333, 10337, 10343, 10357, 10369, 10391, 10399, 10427, 10429, 10433, 10453, 10457, 10459, 10463, 10477, 10487, 10499, 10501, 10513, 10529, 10531, 10559, 10567, 10589, 10597, 10601, 10607, 10613, 10627, 10631, 10639, 10651, 10657, 10663, 10667, 10687, 10691, 10709, 10711, 10723, 10729, 10733, 10739, 10753, 10771, 10781, 10789, 10799, 10831, 10837, 10847, 10853, 10859, 10861, 10867, 10883, 10889, 10891, 10903, 10909, 10937, 10939, 10949, 10957, 10973, 10979, 10987, 10993, 11003, 11027, 11047, 11057, 11059, 11069, 11071, 11083, 11087, 11093, 11113, 11117, 11119, 11131, 11149, 11159, 11161, 11171, 11173, 11177, 11197, 11213, 11239, 11243, 11251, 11257, 11261, 11273, 11279, 11287, 11299, 11311, 11317, 11321, 11329, 11351, 11353, 11369, 11383, 11393, 11399, 11411, 11423, 11437, 11443, 11447, 11467, 11471, 11483, 11489, 11491, 11497, 11503, 11519, 11527, 11549, 11551, 11579, 11587, 11593, 11597, 11617, 11621, 11633, 11657, 11677, 11681, 11689, 11699, 11701, 11717, 11719, 11731, 11743, 11777, 11779, 11783, 11789, 11801, 11807, 11813, 11821, 11827, 11831, 11833, 11839, 11863, 11867, 11887, 11897, 11903, 11909, 11923, 11927, 11933, 11939, 11941, 11953, 11959, 11969, 11971, 11981, 11987, 12007, 12011, 12037, 12041, 12043, 12049, 12071, 12073, 12097, 12101, 12107, 12109, 12113, 12119, 12143, 12149, 12157, 12161, 12163, 12197, 12203, 12211, 12227, 12239, 12241, 12251, 12253, 12263, 12269, 12277, 12281, 12289, 12301, 12323, 12329, 12343, 12347, 12373, 12377, 12379, 12391, 12401, 12409, 12413, 12421, 12433, 12437, 12451, 12457, 12473, 12479, 12487, 12491, 12497, 12503, 12511, 12517, 12527, 12539, 12541, 12547, 12553, 12569, 12577, 12583, 12589, 12601, 12611, 12613, 12619, 12637, 12641, 12647, 12653, 12659, 12671, 12689, 12697, 12703, 12713, 12721, 12739, 12743, 12757, 12763, 12781, 12791, 12799, 12809, 12821, 12823, 12829, 12841, 12853, 12889, 12893, 12899, 12907, 12911, 12917, 12919, 12923, 12941, 12953, 12959, 12967, 12973, 12979, 12983, 13001, 13003, 13007, 13009, 13033, 13037, 13043, 13049, 13063, 13093, 13099, 13103, 13109, 13121, 13127, 13147, 13151, 13159, 13163, 13171, 13177, 13183, 13187, 13217, 13219, 13229, 13241, 13249, 13259, 13267, 13291, 13297, 13309, 13313, 13327, 13331, 13337, 13339, 13367, 13381, 13397, 13399, 13411, 13417, 13421, 13441, 13451, 13457, 13463, 13469, 13477, 13487, 13499, 13513, 13523, 13537, 13553, 13567, 13577, 13591, 13597, 13613, 13619, 13627, 13633, 13649, 13669, 13679, 13681, 13687, 13691, 13693, 13697, 13709, 13711, 13721, 13723, 13729, 13751, 13757, 13759, 13763, 13781, 13789, 13799, 13807, 13829, 13831, 13841, 13859, 13873, 13877, 13879, 13883, 13901, 13903, 13907, 13913, 13921, 13931, 13933, 13963, 13967, 13997, 13999, 14009, 14011, 14029, 14033, 14051, 14057, 14071, 14081, 14083, 14087, 14107, 14143, 14149, 14153, 14159, 14173, 14177, 14197, 14207, 14221, 14243, 14249, 14251, 14281, 14293, 14303, 14321, 14323, 14327, 14341, 14347, 14369, 14387, 14389, 14401, 14407, 14411, 14419, 14423, 14431, 14437, 14447, 14449, 14461, 14479, 14489, 14503, 14519, 14533, 14537, 14543, 14549, 14551, 14557, 14561, 14563, 14591, 14593, 14621, 14627, 14629, 14633, 14639, 14653, 14657, 14669, 14683, 14699, 14713, 14717, 14723, 14731, 14737, 14741, 14747, 14753, 14759, 14767, 14771, 14779, 14783, 14797, 14813, 14821, 14827, 14831, 14843, 14851, 14867, 14869, 14879, 14887, 14891, 14897, 14923, 14929, 14939, 14947, 14951, 14957, 14969, 14983, 15013, 15017, 15031, 15053, 15061, 15073, 15077, 15083, 15091, 15101, 15107, 15121, 15131, 15137, 15139, 15149, 15161, 15173, 15187, 15193, 15199, 15217, 15227, 15233, 15241, 15259, 15263, 15269, 15271, 15277, 15287, 15289, 15299, 15307, 15313, 15319, 15329, 15331, 15349, 15359, 15361, 15373, 15377, 15383, 15391, 15401, 15413, 15427, 15439, 15443, 15451, 15461, 15467, 15473, 15493, 15497, 15511, 15527, 15541, 15551, 15559, 15569, 15581, 15583, 15601, 15607, 15619, 15629, 15641, 15643, 15647, 15649, 15661, 15667, 15671, 15679, 15683, 15727, 15731, 15733, 15737, 15739, 15749, 15761, 15767, 15773, 15787, 15791, 15797, 15803, 15809, 15817, 15823, 15859, 15877, 15881, 15887, 15889, 15901, 15907, 15913, 15919, 15923, 15937, 15959, 15971, 15973, 15991, 16001, 16007, 16033, 16057, 16061, 16063, 16067, 16069, 16073, 16087, 16091, 16097, 16103, 16111, 16127, 16139, 16141, 16183, 16187, 16189, 16193, 16217, 16223, 16229, 16231, 16249, 16253, 16267, 16273, 16301, 16319, 16333, 16339, 16349, 16361, 16363, 16369, 16381, 16411, 16417, 16421, 16427, 16433, 16447, 16451, 16453, 16477, 16481, 16487, 16493, 16519, 16529, 16547, 16553, 16561, 16567, 16573, 16603, 16607, 16619, 16631, 16633, 16649, 16651, 16657, 16661, 16673, 16691, 16693, 16699, 16703, 16729, 16741, 16747, 16759, 16763, 16787, 16811, 16823, 16829, 16831, 16843, 16871, 16879, 16883, 16889, 16901, 16903, 16921, 16927, 16931, 16937, 16943, 16963, 16979, 16981, 16987, 16993, 17011, 17021, 17027, 17029, 17033, 17041, 17047, 17053, 17077, 17093, 17099, 17107, 17117, 17123, 17137, 17159, 17167, 17183, 17189, 17191, 17203, 17207, 17209, 17231, 17239, 17257, 17291, 17293, 17299, 17317, 17321, 17327, 17333, 17341, 17351, 17359, 17377, 17383, 17387, 17389, 17393, 17401, 17417, 17419, 17431, 17443, 17449, 17467, 17471, 17477, 17483, 17489, 17491, 17497, 17509, 17519, 17539, 17551, 17569, 17573, 17579, 17581, 17597, 17599, 17609, 17623, 17627, 17657, 17659, 17669, 17681, 17683, 17707, 17713, 17729, 17737, 17747, 17749, 17761, 17783, 17789, 17791, 17807, 17827, 17837, 17839, 17851, 17863, 17881, 17891, 17903, 17909, 17911, 17921, 17923, 17929, 17939, 17957, 17959, 17971, 17977, 17981, 17987, 17989, 18013, 18041, 18043, 18047, 18049, 18059, 18061, 18077, 18089, 18097, 18119, 18121, 18127, 18131, 18133, 18143, 18149, 18169, 18181, 18191, 18199, 18211, 18217, 18223, 18229, 18233, 18251, 18253, 18257, 18269, 18287, 18289, 18301, 18307, 18311, 18313, 18329, 18341, 18353, 18367, 18371, 18379, 18397, 18401, 18413, 18427, 18433, 18439, 18443, 18451, 18457, 18461, 18481, 18493, 18503, 18517, 18521, 18523, 18539, 18541, 18553, 18583, 18587, 18593, 18617, 18637, 18661, 18671, 18679, 18691, 18701, 18713, 18719, 18731, 18743, 18749, 18757, 18773, 18787, 18793, 18797, 18803, 18839, 18859, 18869, 18899, 18911, 18913, 18917, 18919, 18947, 18959, 18973, 18979, 19001, 19009, 19013, 19031, 19037, 19051, 19069, 19073, 19079, 19081, 19087, 19121, 19139, 19141, 19157, 19163, 19181, 19183, 19207, 19211, 19213, 19219, 19231, 19237, 19249, 19259, 19267, 19273, 19289, 19301, 19309, 19319, 19333, 19373, 19379, 19381, 19387, 19391, 19403, 19417, 19421, 19423, 19427, 19429, 19433, 19441, 19447, 19457, 19463, 19469, 19471, 19477, 19483, 19489, 19501, 19507, 19531, 19541, 19543, 19553, 19559, 19571, 19577, 19583, 19597, 19603, 19609, 19661, 19681, 19687, 19697, 19699, 19709, 19717, 19727, 19739, 19751, 19753, 19759, 19763, 19777, 19793, 19801, 19813, 19819, 19841, 19843, 19853, 19861, 19867, 19889, 19891, 19913, 19919, 19927, 19937, 19949, 19961, 19963, 19973, 19979, 19991, 19993, 19997, 20011, 20021, 20023, 20029, 20047, 20051, 20063, 20071, 20089, 20101, 20107, 20113, 20117, 20123, 20129, 20143, 20147, 20149, 20161, 20173, 20177, 20183, 20201, 20219, 20231, 20233, 20249, 20261, 20269, 20287, 20297, 20323, 20327, 20333, 20341, 20347, 20353, 20357, 20359, 20369, 20389, 20393, 20399, 20407, 20411, 20431, 20441, 20443, 20477, 20479, 20483, 20507, 20509, 20521, 20533, 20543, 20549, 20551, 20563, 20593, 20599, 20611, 20627, 20639, 20641, 20663, 20681, 20693, 20707, 20717, 20719, 20731, 20743, 20747, 20749, 20753, 20759, 20771, 20773, 20789, 20807, 20809, 20849, 20857, 20873, 20879, 20887, 20897, 20899, 20903, 20921, 20929, 20939, 20947, 20959, 20963, 20981, 20983, 21001, 21011, 21013, 21017, 21019, 21023, 21031, 21059, 21061, 21067, 21089, 21101, 21107, 21121, 21139, 21143, 21149, 21157, 21163, 21169, 21179, 21187, 21191, 21193, 21211, 21221, 21227, 21247, 21269, 21277, 21283, 21313, 21317, 21319, 21323, 21341, 21347, 21377, 21379, 21383, 21391, 21397, 21401, 21407, 21419, 21433, 21467, 21481, 21487, 21491, 21493, 21499, 21503, 21517, 21521, 21523, 21529, 21557, 21559, 21563, 21569, 21577, 21587, 21589, 21599, 21601, 21611, 21613, 21617, 21647, 21649, 21661, 21673, 21683, 21701, 21713, 21727, 21737, 21739, 21751, 21757, 21767, 21773, 21787, 21799, 21803, 21817, 21821, 21839, 21841, 21851, 21859, 21863, 21871, 21881, 21893, 21911, 21929, 21937, 21943, 21961, 21977, 21991, 21997, 22003, 22013, 22027, 22031, 22037, 22039, 22051, 22063, 22067, 22073, 22079, 22091, 22093, 22109, 22111, 22123, 22129, 22133, 22147, 22153, 22157, 22159, 22171, 22189, 22193, 22229, 22247, 22259, 22271, 22273, 22277, 22279, 22283, 22291, 22303, 22307, 22343, 22349, 22367, 22369, 22381, 22391, 22397, 22409, 22433, 22441, 22447, 22453, 22469, 22481, 22483, 22501, 22511, 22531, 22541, 22543, 22549, 22567, 22571, 22573, 22613, 22619, 22621, 22637, 22639, 22643, 22651, 22669, 22679, 22691, 22697, 22699, 22709, 22717, 22721, 22727, 22739, 22741, 22751, 22769, 22777, 22783, 22787, 22807, 22811, 22817, 22853, 22859, 22861, 22871, 22877, 22901, 22907, 22921, 22937, 22943, 22961, 22963, 22973, 22993, 23003, 23011, 23017, 23021, 23027, 23029, 23039, 23041, 23053, 23057, 23059, 23063, 23071, 23081, 23087, 23099, 23117, 23131, 23143, 23159, 23167, 23173, 23189, 23197, 23201, 23203, 23209, 23227, 23251, 23269, 23279, 23291, 23293, 23297, 23311, 23321, 23327, 23333, 23339, 23357, 23369, 23371, 23399, 23417, 23431, 23447, 23459, 23473, 23497, 23509, 23531, 23537, 23539, 23549, 23557, 23561, 23563, 23567, 23581, 23593, 23599, 23603, 23609, 23623, 23627, 23629, 23633, 23663, 23669, 23671, 23677, 23687, 23689, 23719, 23741, 23743, 23747, 23753, 23761, 23767, 23773, 23789, 23801, 23813, 23819, 23827, 23831, 23833, 23857, 23869, 23873, 23879, 23887, 23893, 23899, 23909, 23911, 23917, 23929, 23957, 23971, 23977, 23981, 23993, 24001, 24007, 24019, 24023, 24029, 24043, 24049, 24061, 24071, 24077, 24083, 24091, 24097, 24103, 24107, 24109, 24113, 24121, 24133, 24137, 24151, 24169, 24179, 24181, 24197, 24203, 24223, 24229, 24239, 24247, 24251, 24281, 24317, 24329, 24337, 24359, 24371, 24373, 24379, 24391, 24407, 24413, 24419, 24421, 24439, 24443, 24469, 24473, 24481, 24499, 24509, 24517, 24527, 24533, 24547, 24551, 24571, 24593, 24611, 24623, 24631, 24659, 24671, 24677, 24683, 24691, 24697, 24709, 24733, 24749, 24763, 24767, 24781, 24793, 24799, 24809, 24821, 24841, 24847, 24851, 24859, 24877, 24889, 24907, 24917, 24919, 24923, 24943, 24953, 24967, 24971, 24977, 24979, 24989, 25013, 25031, 25033, 25037, 25057, 25073, 25087, 25097, 25111, 25117, 25121, 25127, 25147, 25153, 25163, 25169, 25171, 25183, 25189, 25219, 25229, 25237, 25243, 25247, 25253, 25261, 25301, 25303, 25307, 25309, 25321, 25339, 25343, 25349, 25357, 25367, 25373, 25391, 25409, 25411, 25423, 25439, 25447, 25453, 25457, 25463, 25469, 25471, 25523, 25537, 25541, 25561, 25577, 25579, 25583, 25589, 25601, 25603, 25609, 25621, 25633, 25639, 25643, 25657, 25667, 25673, 25679, 25693, 25703, 25717, 25733, 25741, 25747, 25759, 25763, 25771, 25793, 25799, 25801, 25819, 25841, 25847, 25849, 25867, 25873, 25889, 25903, 25913, 25919, 25931, 25933, 25939, 25943, 25951, 25969, 25981, 25997, 25999, 26003, 26017, 26021, 26029, 26041, 26053, 26083, 26099, 26107, 26111, 26113, 26119, 26141, 26153, 26161, 26171, 26177, 26183, 26189, 26203, 26209, 26227, 26237, 26249, 26251, 26261, 26263, 26267, 26293, 26297, 26309, 26317, 26321, 26339, 26347, 26357, 26371, 26387, 26393, 26399, 26407, 26417, 26423, 26431, 26437, 26449, 26459, 26479, 26489, 26497, 26501, 26513, 26539, 26557, 26561, 26573, 26591, 26597, 26627, 26633, 26641, 26647, 26669, 26681, 26683, 26687, 26693, 26699, 26701, 26711, 26713, 26717, 26723, 26729, 26731, 26737, 26759, 26777, 26783, 26801, 26813, 26821, 26833, 26839, 26849, 26861, 26863, 26879, 26881, 26891, 26893, 26903, 26921, 26927, 26947, 26951, 26953, 26959, 26981, 26987, 26993, 27011, 27017, 27031, 27043, 27059, 27061, 27067, 27073, 27077, 27091, 27103, 27107, 27109, 27127, 27143, 27179, 27191, 27197, 27211, 27239, 27241, 27253, 27259, 27271, 27277, 27281, 27283, 27299, 27329, 27337, 27361, 27367, 27397, 27407, 27409, 27427, 27431, 27437, 27449, 27457, 27479, 27481, 27487, 27509, 27527, 27529, 27539, 27541, 27551, 27581, 27583, 27611, 27617, 27631, 27647, 27653, 27673, 27689, 27691, 27697, 27701, 27733, 27737, 27739, 27743, 27749, 27751, 27763, 27767, 27773, 27779, 27791, 27793, 27799, 27803, 27809, 27817, 27823, 27827, 27847, 27851, 27883, 27893, 27901, 27917, 27919, 27941, 27943, 27947, 27953, 27961, 27967, 27983, 27997, 28001, 28019, 28027, 28031, 28051, 28057, 28069, 28081, 28087, 28097, 28099, 28109, 28111, 28123, 28151, 28163, 28181, 28183, 28201, 28211, 28219, 28229, 28277, 28279, 28283, 28289, 28297, 28307, 28309, 28319, 28349, 28351, 28387, 28393, 28403, 28409, 28411, 28429, 28433, 28439, 28447, 28463, 28477, 28493, 28499, 28513, 28517, 28537, 28541, 28547, 28549, 28559, 28571, 28573, 28579, 28591, 28597, 28603, 28607, 28619, 28621, 28627, 28631, 28643, 28649, 28657, 28661, 28663, 28669, 28687, 28697, 28703, 28711, 28723, 28729, 28751, 28753, 28759, 28771, 28789, 28793, 28807, 28813, 28817, 28837, 28843, 28859, 28867, 28871, 28879, 28901, 28909, 28921, 28927, 28933, 28949, 28961, 28979, 29009, 29017, 29021, 29023, 29027, 29033, 29059, 29063, 29077, 29101, 29123, 29129, 29131, 29137, 29147, 29153, 29167, 29173, 29179, 29191, 29201, 29207, 29209, 29221, 29231, 29243, 29251, 29269, 29287, 29297, 29303, 29311, 29327, 29333, 29339, 29347, 29363, 29383, 29387, 29389, 29399, 29401, 29411, 29423, 29429, 29437, 29443, 29453, 29473, 29483, 29501, 29527, 29531, 29537, 29567, 29569, 29573, 29581, 29587, 29599, 29611, 29629, 29633, 29641, 29663, 29669, 29671, 29683, 29717, 29723, 29741, 29753, 29759, 29761, 29789, 29803, 29819, 29833, 29837, 29851, 29863, 29867, 29873, 29879, 29881, 29917, 29921, 29927, 29947, 29959, 29983, 29989, 30011, 30013, 30029, 30047, 30059, 30071, 30089, 30091, 30097, 30103, 30109, 30113, 30119, 30133, 30137, 30139, 30161, 30169, 30181, 30187, 30197, 30203, 30211, 30223, 30241, 30253, 30259, 30269, 30271, 30293, 30307, 30313, 30319, 30323, 30341, 30347, 30367, 30389, 30391, 30403, 30427, 30431, 30449, 30467, 30469, 30491, 30493, 30497, 30509, 30517, 30529, 30539, 30553, 30557, 30559, 30577, 30593, 30631, 30637, 30643, 30649, 30661, 30671, 30677, 30689, 30697, 30703, 30707, 30713, 30727, 30757, 30763, 30773, 30781, 30803, 30809, 30817, 30829, 30839, 30841, 30851, 30853, 30859, 30869, 30871, 30881, 30893, 30911, 30931, 30937, 30941, 30949, 30971, 30977, 30983, 31013, 31019, 31033, 31039, 31051, 31063, 31069, 31079, 31081, 31091, 31121, 31123, 31139, 31147, 31151, 31153, 31159, 31177, 31181, 31183, 31189, 31193, 31219, 31223, 31231, 31237, 31247, 31249, 31253, 31259, 31267, 31271, 31277, 31307, 31319, 31321, 31327, 31333, 31337, 31357, 31379, 31387, 31391, 31393, 31397, 31469, 31477, 31481, 31489, 31511, 31513, 31517, 31531, 31541, 31543, 31547, 31567, 31573, 31583, 31601, 31607, 31627, 31643, 31649, 31657, 31663, 31667, 31687, 31699, 31721, 31723, 31727, 31729, 31741, 31751, 31769, 31771, 31793, 31799, 31817, 31847, 31849, 31859, 31873, 31883, 31891, 31907, 31957, 31963, 31973, 31981, 31991, 32003, 32009, 32027, 32029, 32051, 32057, 32059, 32063, 32069, 32077, 32083, 32089, 32099, 32117, 32119, 32141, 32143, 32159, 32173, 32183, 32189, 32191, 32203, 32213, 32233, 32237, 32251, 32257, 32261, 32297, 32299, 32303, 32309, 32321, 32323, 32327, 32341, 32353, 32359, 32363, 32369, 32371, 32377, 32381, 32401, 32411, 32413, 32423, 32429, 32441, 32443, 32467, 32479, 32491, 32497, 32503, 32507, 32531, 32533, 32537, 32561, 32563, 32569, 32573, 32579, 32587, 32603, 32609, 32611, 32621, 32633, 32647, 32653, 32687, 32693, 32707, 32713, 32717, 32719, 32749, 32771, 32779, 32783, 32789, 32797, 32801, 32803, 32831, 32833, 32839, 32843, 32869, 32887, 32909, 32911, 32917, 32933, 32939, 32941, 32957, 32969, 32971, 32983, 32987, 32993, 32999, 33013, 33023, 33029, 33037, 33049, 33053, 33071, 33073, 33083, 33091, 33107, 33113, 33119, 33149, 33151, 33161, 33179, 33181, 33191, 33199, 33203, 33211, 33223, 33247, 33287, 33289, 33301, 33311, 33317, 33329, 33331, 33343, 33347, 33349, 33353, 33359, 33377, 33391, 33403, 33409, 33413, 33427, 33457, 33461, 33469, 33479, 33487, 33493, 33503, 33521, 33529, 33533, 33547, 33563, 33569, 33577, 33581, 33587, 33589, 33599, 33601, 33613, 33617, 33619, 33623, 33629, 33637, 33641, 33647, 33679, 33703, 33713, 33721, 33739, 33749, 33751, 33757, 33767, 33769, 33773, 33791, 33797, 33809, 33811, 33827, 33829, 33851, 33857, 33863, 33871, 33889, 33893, 33911, 33923, 33931, 33937, 33941, 33961, 33967, 33997, 34019, 34031, 34033, 34039, 34057, 34061, 34123, 34127, 34129, 34141, 34147, 34157, 34159, 34171, 34183, 34211, 34213, 34217, 34231, 34253, 34259, 34261, 34267, 34273, 34283, 34297, 34301, 34303, 34313, 34319, 34327, 34337, 34351, 34361, 34367, 34369, 34381, 34403, 34421, 34429, 34439, 34457, 34469, 34471, 34483, 34487, 34499, 34501, 34511, 34513, 34519, 34537, 34543, 34549, 34583, 34589, 34591, 34603, 34607, 34613, 34631, 34649, 34651, 34667, 34673, 34679, 34687, 34693, 34703, 34721, 34729, 34739, 34747, 34757, 34759, 34763, 34781, 34807, 34819, 34841, 34843, 34847, 34849, 34871, 34877, 34883, 34897, 34913, 34919, 34939, 34949, 34961, 34963, 34981, 35023, 35027, 35051, 35053, 35059, 35069, 35081, 35083, 35089, 35099, 35107, 35111, 35117, 35129, 35141, 35149, 35153, 35159, 35171, 35201, 35221, 35227, 35251, 35257, 35267, 35279, 35281, 35291, 35311, 35317, 35323, 35327, 35339, 35353, 35363, 35381, 35393, 35401, 35407, 35419, 35423, 35437, 35447, 35449, 35461, 35491, 35507, 35509, 35521, 35527, 35531, 35533, 35537, 35543, 35569, 35573, 35591, 35593, 35597, 35603, 35617, 35671, 35677, 35729, 35731, 35747, 35753, 35759, 35771, 35797, 35801, 35803, 35809, 35831, 35837, 35839, 35851, 35863, 35869, 35879, 35897, 35899, 35911, 35923, 35933, 35951, 35963, 35969, 35977, 35983, 35993, 35999, 36007, 36011, 36013, 36017, 36037, 36061, 36067, 36073, 36083, 36097, 36107, 36109, 36131, 36137, 36151, 36161, 36187, 36191, 36209, 36217, 36229, 36241, 36251, 36263, 36269, 36277, 36293, 36299, 36307, 36313, 36319, 36341, 36343, 36353, 36373, 36383, 36389, 36433, 36451, 36457, 36467, 36469, 36473, 36479, 36493, 36497, 36523, 36527, 36529, 36541, 36551, 36559, 36563, 36571, 36583, 36587, 36599, 36607, 36629, 36637, 36643, 36653, 36671, 36677, 36683, 36691, 36697, 36709, 36713, 36721, 36739, 36749, 36761, 36767, 36779, 36781, 36787, 36791, 36793, 36809, 36821, 36833, 36847, 36857, 36871, 36877, 36887, 36899, 36901, 36913, 36919, 36923, 36929, 36931, 36943, 36947, 36973, 36979, 36997, 37003, 37013, 37019, 37021, 37039, 37049, 37057, 37061, 37087, 37097, 37117, 37123, 37139, 37159, 37171, 37181, 37189, 37199, 37201, 37217, 37223, 37243, 37253, 37273, 37277, 37307, 37309, 37313, 37321, 37337, 37339, 37357, 37361, 37363, 37369, 37379, 37397, 37409, 37423, 37441, 37447, 37463, 37483, 37489, 37493, 37501, 37507, 37511, 37517, 37529, 37537, 37547, 37549, 37561, 37567, 37571, 37573, 37579, 37589, 37591, 37607, 37619, 37633, 37643, 37649, 37657, 37663, 37691, 37693, 37699, 37717, 37747, 37781, 37783, 37799, 37811, 37813, 37831, 37847, 37853, 37861, 37871, 37879, 37889, 37897, 37907, 37951, 37957, 37963, 37967, 37987, 37991, 37993, 37997, 38011, 38039, 38047, 38053, 38069, 38083, 38113, 38119, 38149, 38153, 38167, 38177, 38183, 38189, 38197, 38201, 38219, 38231, 38237, 38239, 38261, 38273, 38281, 38287, 38299, 38303, 38317, 38321, 38327, 38329, 38333, 38351, 38371, 38377, 38393, 38431, 38447, 38449, 38453, 38459, 38461, 38501, 38543, 38557, 38561, 38567, 38569, 38593, 38603, 38609, 38611, 38629, 38639, 38651, 38653, 38669, 38671, 38677, 38693, 38699, 38707, 38711, 38713, 38723, 38729, 38737, 38747, 38749, 38767, 38783, 38791, 38803, 38821, 38833, 38839, 38851, 38861, 38867, 38873, 38891, 38903, 38917, 38921, 38923, 38933, 38953, 38959, 38971, 38977, 38993, 39019, 39023, 39041, 39043, 39047, 39079, 39089, 39097, 39103, 39107, 39113, 39119, 39133, 39139, 39157, 39161, 39163, 39181, 39191, 39199, 39209, 39217, 39227, 39229, 39233, 39239, 39241, 39251, 39293, 39301, 39313, 39317, 39323, 39341, 39343, 39359, 39367, 39371, 39373, 39383, 39397, 39409, 39419, 39439, 39443, 39451, 39461, 39499, 39503, 39509, 39511, 39521, 39541, 39551, 39563, 39569, 39581, 39607, 39619, 39623, 39631, 39659, 39667, 39671, 39679, 39703, 39709, 39719, 39727, 39733, 39749, 39761, 39769, 39779, 39791, 39799, 39821, 39827, 39829, 39839, 39841, 39847, 39857, 39863, 39869, 39877, 39883, 39887, 39901, 39929, 39937, 39953, 39971, 39979, 39983, 39989, 40009, 40013, 40031, 40037, 40039, 40063, 40087, 40093, 40099, 40111, 40123, 40127, 40129, 40151, 40153, 40163, 40169, 40177, 40189, 40193, 40213, 40231, 40237, 40241, 40253, 40277, 40283, 40289, 40343, 40351, 40357, 40361, 40387, 40423, 40427, 40429, 40433, 40459, 40471, 40483, 40487, 40493, 40499, 40507, 40519, 40529, 40531, 40543, 40559, 40577, 40583, 40591, 40597, 40609, 40627, 40637, 40639, 40693, 40697, 40699, 40709, 40739, 40751, 40759, 40763, 40771, 40787, 40801, 40813, 40819, 40823, 40829, 40841, 40847, 40849, 40853, 40867, 40879, 40883, 40897, 40903, 40927, 40933, 40939, 40949, 40961, 40973, 40993, 41011, 41017, 41023, 41039, 41047, 41051, 41057, 41077, 41081, 41113, 41117, 41131, 41141, 41143, 41149, 41161, 41177, 41179, 41183, 41189, 41201, 41203, 41213, 41221, 41227, 41231, 41233, 41243, 41257, 41263, 41269, 41281, 41299, 41333, 41341, 41351, 41357, 41381, 41387, 41389, 41399, 41411, 41413, 41443, 41453, 41467, 41479, 41491, 41507, 41513, 41519, 41521, 41539, 41543, 41549, 41579, 41593, 41597, 41603, 41609, 41611, 41617, 41621, 41627, 41641, 41647, 41651, 41659, 41669, 41681, 41687, 41719, 41729, 41737, 41759, 41761, 41771, 41777, 41801, 41809, 41813, 41843, 41849, 41851, 41863, 41879, 41887, 41893, 41897, 41903, 41911, 41927, 41941, 41947, 41953, 41957, 41959, 41969, 41981, 41983, 41999, 42013, 42017, 42019, 42023, 42043, 42061, 42071, 42073, 42083, 42089, 42101, 42131, 42139, 42157, 42169, 42179, 42181, 42187, 42193, 42197, 42209, 42221, 42223, 42227, 42239, 42257, 42281, 42283, 42293, 42299, 42307, 42323, 42331, 42337, 42349, 42359, 42373, 42379, 42391, 42397, 42403, 42407, 42409, 42433, 42437, 42443, 42451, 42457, 42461, 42463, 42467, 42473, 42487, 42491, 42499, 42509, 42533, 42557, 42569, 42571, 42577, 42589, 42611, 42641, 42643, 42649, 42667, 42677, 42683, 42689, 42697, 42701, 42703, 42709, 42719, 42727, 42737, 42743, 42751, 42767, 42773, 42787, 42793, 42797, 42821, 42829, 42839, 42841, 42853, 42859, 42863, 42899, 42901, 42923, 42929, 42937, 42943, 42953, 42961, 42967, 42979, 42989, 43003, 43013, 43019, 43037, 43049, 43051, 43063, 43067, 43093, 43103, 43117, 43133, 43151, 43159, 43177, 43189, 43201, 43207, 43223, 43237, 43261, 43271, 43283, 43291, 43313, 43319, 43321, 43331, 43391, 43397, 43399, 43403, 43411, 43427, 43441, 43451, 43457, 43481, 43487, 43499, 43517, 43541, 43543, 43573, 43577, 43579, 43591, 43597, 43607, 43609, 43613, 43627, 43633, 43649, 43651, 43661, 43669, 43691, 43711, 43717, 43721, 43753, 43759, 43777, 43781, 43783, 43787, 43789, 43793, 43801, 43853, 43867, 43889, 43891, 43913, 43933, 43943, 43951, 43961, 43963, 43969, 43973, 43987, 43991, 43997, 44017, 44021, 44027, 44029, 44041, 44053, 44059, 44071, 44087, 44089, 44101, 44111, 44119, 44123, 44129, 44131, 44159, 44171, 44179, 44189, 44201, 44203, 44207, 44221, 44249, 44257, 44263, 44267, 44269, 44273, 44279, 44281, 44293, 44351, 44357, 44371, 44381, 44383, 44389, 44417, 44449, 44453, 44483, 44491, 44497, 44501, 44507, 44519, 44531, 44533, 44537, 44543, 44549, 44563, 44579, 44587, 44617, 44621, 44623, 44633, 44641, 44647, 44651, 44657, 44683, 44687, 44699, 44701, 44711, 44729, 44741, 44753, 44771, 44773, 44777, 44789, 44797, 44809, 44819, 44839, 44843, 44851, 44867, 44879, 44887, 44893, 44909, 44917, 44927, 44939, 44953, 44959, 44963, 44971, 44983, 44987, 45007, 45013, 45053, 45061, 45077, 45083, 45119, 45121, 45127, 45131, 45137, 45139, 45161, 45179, 45181, 45191, 45197, 45233, 45247, 45259, 45263, 45281, 45289, 45293, 45307, 45317, 45319, 45329, 45337, 45341, 45343, 45361, 45377, 45389, 45403, 45413, 45427, 45433, 45439, 45481, 45491, 45497, 45503, 45523, 45533, 45541, 45553, 45557, 45569, 45587, 45589, 45599, 45613, 45631, 45641, 45659, 45667, 45673, 45677, 45691, 45697, 45707, 45737, 45751, 45757, 45763, 45767, 45779, 45817, 45821, 45823, 45827, 45833, 45841, 45853, 45863, 45869, 45887, 45893, 45943, 45949, 45953, 45959, 45971, 45979, 45989, 46021, 46027, 46049, 46051, 46061, 46073, 46091, 46093, 46099, 46103, 46133, 46141, 46147, 46153, 46171, 46181, 46183, 46187, 46199, 46219, 46229, 46237, 46261, 46271, 46273, 46279, 46301, 46307, 46309, 46327, 46337, 46349, 46351, 46381, 46399, 46411, 46439, 46441, 46447, 46451, 46457, 46471, 46477, 46489, 46499, 46507, 46511, 46523, 46549, 46559, 46567, 46573, 46589, 46591, 46601, 46619, 46633, 46639, 46643, 46649, 46663, 46679, 46681, 46687, 46691, 46703, 46723, 46727, 46747, 46751, 46757, 46769, 46771, 46807, 46811, 46817, 46819, 46829, 46831, 46853, 46861, 46867, 46877, 46889, 46901, 46919, 46933, 46957, 46993, 46997, 47017, 47041, 47051, 47057, 47059, 47087, 47093, 47111, 47119, 47123, 47129, 47137, 47143, 47147, 47149, 47161, 47189, 47207, 47221, 47237, 47251, 47269, 47279, 47287, 47293, 47297, 47303, 47309, 47317, 47339, 47351, 47353, 47363, 47381, 47387, 47389, 47407, 47417, 47419, 47431, 47441, 47459, 47491, 47497, 47501, 47507, 47513, 47521, 47527, 47533, 47543, 47563, 47569, 47581, 47591, 47599, 47609, 47623, 47629, 47639, 47653, 47657, 47659, 47681, 47699, 47701, 47711, 47713, 47717, 47737, 47741, 47743, 47777, 47779, 47791, 47797, 47807, 47809, 47819, 47837, 47843, 47857, 47869, 47881, 47903, 47911, 47917, 47933, 47939, 47947, 47951, 47963, 47969, 47977, 47981, 48017, 48023, 48029, 48049, 48073, 48079, 48091, 48109, 48119, 48121, 48131, 48157, 48163, 48179, 48187, 48193, 48197, 48221, 48239, 48247, 48259, 48271, 48281, 48299, 48311, 48313, 48337, 48341, 48353, 48371, 48383, 48397, 48407, 48409, 48413, 48437, 48449, 48463, 48473, 48479, 48481, 48487, 48491, 48497, 48523, 48527, 48533, 48539, 48541, 48563, 48571, 48589, 48593, 48611, 48619, 48623, 48647, 48649, 48661, 48673, 48677, 48679, 48731, 48733, 48751, 48757, 48761, 48767, 48779, 48781, 48787, 48799, 48809, 48817, 48821, 48823, 48847, 48857, 48859, 48869, 48871, 48883, 48889, 48907, 48947, 48953, 48973, 48989, 48991, 49003, 49009, 49019, 49031, 49033, 49037, 49043, 49057, 49069, 49081, 49103, 49109, 49117, 49121, 49123, 49139, 49157, 49169, 49171, 49177, 49193, 49199, 49201, 49207, 49211, 49223, 49253, 49261, 49277, 49279, 49297, 49307, 49331, 49333, 49339, 49363, 49367, 49369, 49391, 49393, 49409, 49411, 49417, 49429, 49433, 49451, 49459, 49463, 49477, 49481, 49499, 49523, 49529, 49531, 49537, 49547, 49549, 49559, 49597, 49603, 49613, 49627, 49633, 49639, 49663, 49667, 49669, 49681, 49697, 49711, 49727, 49739, 49741, 49747, 49757, 49783, 49787, 49789, 49801, 49807, 49811, 49823, 49831, 49843, 49853, 49871, 49877, 49891, 49919, 49921, 49927, 49937, 49939, 49943, 49957, 49991, 49993, 49999, 50021, 50023, 50033, 50047, 50051, 50053, 50069, 50077, 50087, 50093, 50101, 50111, 50119, 50123, 50129, 50131, 50147, 50153, 50159, 50177, 50207, 50221, 50227, 50231, 50261, 50263, 50273, 50287, 50291, 50311, 50321, 50329, 50333, 50341, 50359, 50363, 50377, 50383, 50387, 50411, 50417, 50423, 50441, 50459, 50461, 50497, 50503, 50513, 50527, 50539, 50543, 50549, 50551, 50581, 50587, 50591, 50593, 50599, 50627, 50647, 50651, 50671, 50683, 50707, 50723, 50741, 50753, 50767, 50773, 50777, 50789, 50821, 50833, 50839, 50849, 50857, 50867, 50873, 50891, 50893, 50909, 50923, 50929, 50951, 50957, 50969, 50971, 50989, 50993, 51001, 51031, 51043, 51047, 51059, 51061, 51071, 51109, 51131, 51133, 51137, 51151, 51157, 51169, 51193, 51197, 51199, 51203, 51217, 51229, 51239, 51241, 51257, 51263, 51283, 51287, 51307, 51329, 51341, 51343, 51347, 51349, 51361, 51383, 51407, 51413, 51419, 51421, 51427, 51431, 51437, 51439, 51449, 51461, 51473, 51479, 51481, 51487, 51503, 51511, 51517, 51521, 51539, 51551, 51563, 51577, 51581, 51593, 51599, 51607, 51613, 51631, 51637, 51647, 51659, 51673, 51679, 51683, 51691, 51713, 51719, 51721, 51749, 51767, 51769, 51787, 51797, 51803, 51817, 51827, 51829, 51839, 51853, 51859, 51869, 51871, 51893, 51899, 51907, 51913, 51929, 51941, 51949, 51971, 51973, 51977, 51991, 52009, 52021, 52027, 52051, 52057, 52067, 52069, 52081, 52103, 52121, 52127, 52147, 52153, 52163, 52177, 52181, 52183, 52189, 52201, 52223, 52237, 52249, 52253, 52259, 52267, 52289, 52291, 52301, 52313, 52321, 52361, 52363, 52369, 52379, 52387, 52391, 52433, 52453, 52457, 52489, 52501, 52511, 52517, 52529, 52541, 52543, 52553, 52561, 52567, 52571, 52579, 52583, 52609, 52627, 52631, 52639, 52667, 52673, 52691, 52697, 52709, 52711, 52721, 52727, 52733, 52747, 52757, 52769, 52783, 52807, 52813, 52817, 52837, 52859, 52861, 52879, 52883, 52889, 52901, 52903, 52919, 52937, 52951, 52957, 52963, 52967, 52973, 52981, 52999, 53003, 53017, 53047, 53051, 53069, 53077, 53087, 53089, 53093, 53101, 53113, 53117, 53129, 53147, 53149, 53161, 53171, 53173, 53189, 53197, 53201, 53231, 53233, 53239, 53267, 53269, 53279, 53281, 53299, 53309, 53323, 53327, 53353, 53359, 53377, 53381, 53401, 53407, 53411, 53419, 53437, 53441, 53453, 53479, 53503, 53507, 53527, 53549, 53551, 53569, 53591, 53593, 53597, 53609, 53611, 53617, 53623, 53629, 53633, 53639, 53653, 53657, 53681, 53693, 53699, 53717, 53719, 53731, 53759, 53773, 53777, 53783, 53791, 53813, 53819, 53831, 53849, 53857, 53861, 53881, 53887, 53891, 53897, 53899, 53917, 53923, 53927, 53939, 53951, 53959, 53987, 53993, 54001, 54011, 54013, 54037, 54049, 54059, 54083, 54091, 54101, 54121, 54133, 54139, 54151, 54163, 54167, 54181, 54193, 54217, 54251, 54269, 54277, 54287, 54293, 54311, 54319, 54323, 54331, 54347, 54361, 54367, 54371, 54377, 54401, 54403, 54409, 54413, 54419, 54421, 54437, 54443, 54449, 54469, 54493, 54497, 54499, 54503, 54517, 54521, 54539, 54541, 54547, 54559, 54563, 54577, 54581, 54583, 54601, 54617, 54623, 54629, 54631, 54647, 54667, 54673, 54679, 54709, 54713, 54721, 54727, 54751, 54767, 54773, 54779, 54787, 54799, 54829, 54833, 54851, 54869, 54877, 54881, 54907, 54917, 54919, 54941, 54949, 54959, 54973, 54979, 54983, 55001, 55009, 55021, 55049, 55051, 55057, 55061, 55073, 55079, 55103, 55109, 55117, 55127, 55147, 55163, 55171, 55201, 55207, 55213, 55217, 55219, 55229, 55243, 55249, 55259, 55291, 55313, 55331, 55333, 55337, 55339, 55343, 55351, 55373, 55381, 55399, 55411, 55439, 55441, 55457, 55469, 55487, 55501, 55511, 55529, 55541, 55547, 55579, 55589, 55603, 55609, 55619, 55621, 55631, 55633, 55639, 55661, 55663, 55667, 55673, 55681, 55691, 55697, 55711, 55717, 55721, 55733, 55763, 55787, 55793, 55799, 55807, 55813, 55817, 55819, 55823, 55829, 55837, 55843, 55849, 55871, 55889, 55897, 55901, 55903, 55921, 55927, 55931, 55933, 55949, 55967, 55987, 55997, 56003, 56009, 56039, 56041, 56053, 56081, 56087, 56093, 56099, 56101, 56113, 56123, 56131, 56149, 56167, 56171, 56179, 56197, 56207, 56209, 56237, 56239, 56249, 56263, 56267, 56269, 56299, 56311, 56333, 56359, 56369, 56377, 56383, 56393, 56401, 56417, 56431, 56437, 56443, 56453, 56467, 56473, 56477, 56479, 56489, 56501, 56503, 56509, 56519, 56527, 56531, 56533, 56543, 56569, 56591, 56597, 56599, 56611, 56629, 56633, 56659, 56663, 56671, 56681, 56687, 56701, 56711, 56713, 56731, 56737, 56747, 56767, 56773, 56779, 56783, 56807, 56809, 56813, 56821, 56827, 56843, 56857, 56873, 56891, 56893, 56897, 56909, 56911, 56921, 56923, 56929, 56941, 56951, 56957, 56963, 56983, 56989, 56993, 56999, 57037, 57041, 57047, 57059, 57073, 57077, 57089, 57097, 57107, 57119, 57131, 57139, 57143, 57149, 57163, 57173, 57179, 57191, 57193, 57203, 57221, 57223, 57241, 57251, 57259, 57269, 57271, 57283, 57287, 57301, 57329, 57331, 57347, 57349, 57367, 57373, 57383, 57389, 57397, 57413, 57427, 57457, 57467, 57487, 57493, 57503, 57527, 57529, 57557, 57559, 57571, 57587, 57593, 57601, 57637, 57641, 57649, 57653, 57667, 57679, 57689, 57697, 57709, 57713, 57719, 57727, 57731, 57737, 57751, 57773, 57781, 57787, 57791, 57793, 57803, 57809, 57829, 57839, 57847, 57853, 57859, 57881, 57899, 57901, 57917, 57923, 57943, 57947, 57973, 57977, 57991, 58013, 58027, 58031, 58043, 58049, 58057, 58061, 58067, 58073, 58099, 58109, 58111, 58129, 58147, 58151, 58153, 58169, 58171, 58189, 58193, 58199, 58207, 58211, 58217, 58229, 58231, 58237, 58243, 58271, 58309, 58313, 58321, 58337, 58363, 58367, 58369, 58379, 58391, 58393, 58403, 58411, 58417, 58427, 58439, 58441, 58451, 58453, 58477, 58481, 58511, 58537, 58543, 58549, 58567, 58573, 58579, 58601, 58603, 58613, 58631, 58657, 58661, 58679, 58687, 58693, 58699, 58711, 58727, 58733, 58741, 58757, 58763, 58771, 58787, 58789, 58831, 58889, 58897, 58901, 58907, 58909, 58913, 58921, 58937, 58943, 58963, 58967, 58979, 58991, 58997, 59009, 59011, 59021, 59023, 59029, 59051, 59053, 59063, 59069, 59077, 59083, 59093, 59107, 59113, 59119, 59123, 59141, 59149, 59159, 59167, 59183, 59197, 59207, 59209, 59219, 59221, 59233, 59239, 59243, 59263, 59273, 59281, 59333, 59341, 59351, 59357, 59359, 59369, 59377, 59387, 59393, 59399, 59407, 59417, 59419, 59441, 59443, 59447, 59453, 59467, 59471, 59473, 59497, 59509, 59513, 59539, 59557, 59561, 59567, 59581, 59611, 59617, 59621, 59627, 59629, 59651, 59659, 59663, 59669, 59671, 59693, 59699, 59707, 59723, 59729, 59743, 59747, 59753, 59771, 59779, 59791, 59797, 59809, 59833, 59863, 59879, 59887, 59921, 59929, 59951, 59957, 59971, 59981, 59999, 60013, 60017, 60029, 60037, 60041, 60077, 60083, 60089, 60091, 60101, 60103, 60107, 60127, 60133, 60139, 60149, 60161, 60167, 60169, 60209, 60217, 60223, 60251, 60257, 60259, 60271, 60289, 60293, 60317, 60331, 60337, 60343, 60353, 60373, 60383, 60397, 60413, 60427, 60443, 60449, 60457, 60493, 60497, 60509, 60521, 60527, 60539, 60589, 60601, 60607, 60611, 60617, 60623, 60631, 60637, 60647, 60649, 60659, 60661, 60679, 60689, 60703, 60719, 60727, 60733, 60737, 60757, 60761, 60763, 60773, 60779, 60793, 60811, 60821, 60859, 60869, 60887, 60889, 60899, 60901, 60913, 60917, 60919, 60923, 60937, 60943, 60953, 60961, 61001, 61007, 61027, 61031, 61043, 61051, 61057, 61091, 61099, 61121, 61129, 61141, 61151, 61153, 61169, 61211, 61223, 61231, 61253, 61261, 61283, 61291, 61297, 61331, 61333, 61339, 61343, 61357, 61363, 61379, 61381, 61403, 61409, 61417, 61441, 61463, 61469, 61471, 61483, 61487, 61493, 61507, 61511, 61519, 61543, 61547, 61553, 61559, 61561, 61583, 61603, 61609, 61613, 61627, 61631, 61637, 61643, 61651, 61657, 61667, 61673, 61681, 61687, 61703, 61717, 61723, 61729, 61751, 61757, 61781, 61813, 61819, 61837, 61843, 61861, 61871, 61879, 61909, 61927, 61933, 61949, 61961, 61967, 61979, 61981, 61987, 61991, 62003, 62011, 62017, 62039, 62047, 62053, 62057, 62071, 62081, 62099, 62119, 62129, 62131, 62137, 62141, 62143, 62171, 62189, 62191, 62201, 62207, 62213, 62219, 62233, 62273, 62297, 62299, 62303, 62311, 62323, 62327, 62347, 62351, 62383, 62401, 62417, 62423, 62459, 62467, 62473, 62477, 62483, 62497, 62501, 62507, 62533, 62539, 62549, 62563, 62581, 62591, 62597, 62603, 62617, 62627, 62633, 62639, 62653, 62659, 62683, 62687, 62701, 62723, 62731, 62743, 62753, 62761, 62773, 62791, 62801, 62819, 62827, 62851, 62861, 62869, 62873, 62897, 62903, 62921, 62927, 62929, 62939, 62969, 62971, 62981, 62983, 62987, 62989, 63029, 63031, 63059, 63067, 63073, 63079, 63097, 63103, 63113, 63127, 63131, 63149, 63179, 63197, 63199, 63211, 63241, 63247, 63277, 63281, 63299, 63311, 63313, 63317, 63331, 63337, 63347, 63353, 63361, 63367, 63377, 63389, 63391, 63397, 63409, 63419, 63421, 63439, 63443, 63463, 63467, 63473, 63487, 63493, 63499, 63521, 63527, 63533, 63541, 63559, 63577, 63587, 63589, 63599, 63601, 63607, 63611, 63617, 63629, 63647, 63649, 63659, 63667, 63671, 63689, 63691, 63697, 63703, 63709, 63719, 63727, 63737, 63743, 63761, 63773, 63781, 63793, 63799, 63803, 63809, 63823, 63839, 63841, 63853, 63857, 63863, 63901, 63907, 63913, 63929, 63949, 63977, 63997, 64007, 64013, 64019, 64033, 64037, 64063, 64067, 64081, 64091, 64109, 64123, 64151, 64153, 64157, 64171, 64187, 64189, 64217, 64223, 64231, 64237, 64271, 64279, 64283, 64301, 64303, 64319, 64327, 64333, 64373, 64381, 64399, 64403, 64433, 64439, 64451, 64453, 64483, 64489, 64499, 64513, 64553, 64567, 64577, 64579, 64591, 64601, 64609, 64613, 64621, 64627, 64633, 64661, 64663, 64667, 64679, 64693, 64709, 64717, 64747, 64763, 64781, 64783, 64793, 64811, 64817, 64849, 64853, 64871, 64877, 64879, 64891, 64901, 64919, 64921, 64927, 64937, 64951, 64969, 64997, 65003, 65011, 65027, 65029, 65033, 65053, 65063, 65071, 65089, 65099, 65101, 65111, 65119, 65123, 65129, 65141, 65147, 65167, 65171, 65173, 65179, 65183, 65203, 65213, 65239, 65257, 65267, 65269, 65287, 65293, 65309, 65323, 65327, 65353, 65357, 65371, 65381, 65393, 65407, 65413, 65419, 65423, 65437, 65447, 65449, 65479, 65497, 65519, 65521, 65537, 65539, 65543, 65551, 65557, 65563, 65579, 65581, 65587, 65599, 65609, 65617, 65629, 65633, 65647, 65651, 65657, 65677, 65687, 65699, 65701, 65707, 65713, 65717, 65719, 65729, 65731, 65761, 65777, 65789, 65809, 65827, 65831, 65837, 65839, 65843, 65851, 65867, 65881, 65899, 65921, 65927, 65929, 65951, 65957, 65963, 65981, 65983, 65993, 66029, 66037, 66041, 66047, 66067, 66071, 66083, 66089, 66103, 66107, 66109, 66137, 66161, 66169, 66173, 66179, 66191, 66221, 66239, 66271, 66293, 66301, 66337, 66343, 66347, 66359, 66361, 66373, 66377, 66383, 66403, 66413, 66431, 66449, 66457, 66463, 66467, 66491, 66499, 66509, 66523, 66529, 66533, 66541, 66553, 66569, 66571, 66587, 66593, 66601, 66617, 66629, 66643, 66653, 66683, 66697, 66701, 66713, 66721, 66733, 66739, 66749, 66751, 66763, 66791, 66797, 66809, 66821, 66841, 66851, 66853, 66863, 66877, 66883, 66889, 66919, 66923, 66931, 66943, 66947, 66949, 66959, 66973, 66977, 67003, 67021, 67033, 67043, 67049, 67057, 67061, 67073, 67079, 67103, 67121, 67129, 67139, 67141, 67153, 67157, 67169, 67181, 67187, 67189, 67211, 67213, 67217, 67219, 67231, 67247, 67261, 67271, 67273, 67289, 67307, 67339, 67343, 67349, 67369, 67391, 67399, 67409, 67411, 67421, 67427, 67429, 67433, 67447, 67453, 67477, 67481, 67489, 67493, 67499, 67511, 67523, 67531, 67537, 67547, 67559, 67567, 67577, 67579, 67589, 67601, 67607, 67619, 67631, 67651, 67679, 67699, 67709, 67723, 67733, 67741, 67751, 67757, 67759, 67763, 67777, 67783, 67789, 67801, 67807, 67819, 67829, 67843, 67853, 67867, 67883, 67891, 67901, 67927, 67931, 67933, 67939, 67943, 67957, 67961, 67967, 67979, 67987, 67993, 68023, 68041, 68053, 68059, 68071, 68087, 68099, 68111, 68113, 68141, 68147, 68161, 68171, 68207, 68209, 68213, 68219, 68227, 68239, 68261, 68279, 68281, 68311, 68329, 68351, 68371, 68389, 68399, 68437, 68443, 68447, 68449, 68473, 68477, 68483, 68489, 68491, 68501, 68507, 68521, 68531, 68539, 68543, 68567, 68581, 68597, 68611, 68633, 68639, 68659, 68669, 68683, 68687, 68699, 68711, 68713, 68729, 68737, 68743, 68749, 68767, 68771, 68777, 68791, 68813, 68819, 68821, 68863, 68879, 68881, 68891, 68897, 68899, 68903, 68909, 68917, 68927, 68947, 68963, 68993, 69001, 69011, 69019, 69029, 69031, 69061, 69067, 69073, 69109, 69119, 69127, 69143, 69149, 69151, 69163, 69191, 69193, 69197, 69203, 69221, 69233, 69239, 69247, 69257, 69259, 69263, 69313, 69317, 69337, 69341, 69371, 69379, 69383, 69389, 69401, 69403, 69427, 69431, 69439, 69457, 69463, 69467, 69473, 69481, 69491, 69493, 69497, 69499, 69539, 69557, 69593, 69623, 69653, 69661, 69677, 69691, 69697, 69709, 69737, 69739, 69761, 69763, 69767, 69779, 69809, 69821, 69827, 69829, 69833, 69847, 69857, 69859, 69877, 69899, 69911, 69929, 69931, 69941, 69959, 69991, 69997, 70001, 70003, 70009, 70019, 70039, 70051, 70061, 70067, 70079, 70099, 70111, 70117, 70121, 70123, 70139, 70141, 70157, 70163, 70177, 70181, 70183, 70199, 70201, 70207, 70223, 70229, 70237, 70241, 70249, 70271, 70289, 70297, 70309, 70313, 70321, 70327, 70351, 70373, 70379, 70381, 70393, 70423, 70429, 70439, 70451, 70457, 70459, 70481, 70487, 70489, 70501, 70507, 70529, 70537, 70549, 70571, 70573, 70583, 70589, 70607, 70619, 70621, 70627, 70639, 70657, 70663, 70667, 70687, 70709, 70717, 70729, 70753, 70769, 70783, 70793, 70823, 70841, 70843, 70849, 70853, 70867, 70877, 70879, 70891, 70901, 70913, 70919, 70921, 70937, 70949, 70951, 70957, 70969, 70979, 70981, 70991, 70997, 70999, 71011, 71023, 71039, 71059, 71069, 71081, 71089, 71119, 71129, 71143, 71147, 71153, 71161, 71167, 71171, 71191, 71209, 71233, 71237, 71249, 71257, 71261, 71263, 71287, 71293, 71317, 71327, 71329, 71333, 71339, 71341, 71347, 71353, 71359, 71363, 71387, 71389, 71399, 71411, 71413, 71419, 71429, 71437, 71443, 71453, 71471, 71473, 71479, 71483, 71503, 71527, 71537, 71549, 71551, 71563, 71569, 71593, 71597, 71633, 71647, 71663, 71671, 71693, 71699, 71707, 71711, 71713, 71719, 71741, 71761, 71777, 71789, 71807, 71809, 71821, 71837, 71843, 71849, 71861, 71867, 71879, 71881, 71887, 71899, 71909, 71917, 71933, 71941, 71947, 71963, 71971, 71983, 71987, 71993, 71999, 72019, 72031, 72043, 72047, 72053, 72073, 72077, 72089, 72091, 72101, 72103, 72109, 72139, 72161, 72167, 72169, 72173, 72211, 72221, 72223, 72227, 72229, 72251, 72253, 72269, 72271, 72277, 72287, 72307, 72313, 72337, 72341, 72353, 72367, 72379, 72383, 72421, 72431, 72461, 72467, 72469, 72481, 72493, 72497, 72503, 72533, 72547, 72551, 72559, 72577, 72613, 72617, 72623, 72643, 72647, 72649, 72661, 72671, 72673, 72679, 72689, 72701, 72707, 72719, 72727, 72733, 72739, 72763, 72767, 72797, 72817, 72823, 72859, 72869, 72871, 72883, 72889, 72893, 72901, 72907, 72911, 72923, 72931, 72937, 72949, 72953, 72959, 72973, 72977, 72997, 73009, 73013, 73019, 73037, 73039, 73043, 73061, 73063, 73079, 73091, 73121, 73127, 73133, 73141, 73181, 73189, 73237, 73243, 73259, 73277, 73291, 73303, 73309, 73327, 73331, 73351, 73361, 73363, 73369, 73379, 73387, 73417, 73421, 73433, 73453, 73459, 73471, 73477, 73483, 73517, 73523, 73529, 73547, 73553, 73561, 73571, 73583, 73589, 73597, 73607, 73609, 73613, 73637, 73643, 73651, 73673, 73679, 73681, 73693, 73699, 73709, 73721, 73727, 73751, 73757, 73771, 73783, 73819, 73823, 73847, 73849, 73859, 73867, 73877, 73883, 73897, 73907, 73939, 73943, 73951, 73961, 73973, 73999, 74017, 74021, 74027, 74047, 74051, 74071, 74077, 74093, 74099, 74101, 74131, 74143, 74149, 74159, 74161, 74167, 74177, 74189, 74197, 74201, 74203, 74209, 74219, 74231, 74257, 74279, 74287, 74293, 74297, 74311, 74317, 74323, 74353, 74357, 74363, 74377, 74381, 74383, 74411, 74413, 74419, 74441, 74449, 74453, 74471, 74489, 74507, 74509, 74521, 74527, 74531, 74551, 74561, 74567, 74573, 74587, 74597, 74609, 74611, 74623, 74653, 74687, 74699, 74707, 74713, 74717, 74719, 74729, 74731, 74747, 74759, 74761, 74771, 74779, 74797, 74821, 74827, 74831, 74843, 74857, 74861, 74869, 74873, 74887, 74891, 74897, 74903, 74923, 74929, 74933, 74941, 74959, 75011, 75013, 75017, 75029, 75037, 75041, 75079, 75083, 75109, 75133, 75149, 75161, 75167, 75169, 75181, 75193, 75209, 75211, 75217, 75223, 75227, 75239, 75253, 75269, 75277, 75289, 75307, 75323, 75329, 75337, 75347, 75353, 75367, 75377, 75389, 75391, 75401, 75403, 75407, 75431, 75437, 75479, 75503, 75511, 75521, 75527, 75533, 75539, 75541, 75553, 75557, 75571, 75577, 75583, 75611, 75617, 75619, 75629, 75641, 75653, 75659, 75679, 75683, 75689, 75703, 75707, 75709, 75721, 75731, 75743, 75767, 75773, 75781, 75787, 75793, 75797, 75821, 75833, 75853, 75869, 75883, 75913, 75931, 75937, 75941, 75967, 75979, 75983, 75989, 75991, 75997, 76001, 76003, 76031, 76039, 76079, 76081, 76091, 76099, 76103, 76123, 76129, 76147, 76157, 76159, 76163, 76207, 76213, 76231, 76243, 76249, 76253, 76259, 76261, 76283, 76289, 76303, 76333, 76343, 76367, 76369, 76379, 76387, 76403, 76421, 76423, 76441, 76463, 76471, 76481, 76487, 76493, 76507, 76511, 76519, 76537, 76541, 76543, 76561, 76579, 76597, 76603, 76607, 76631, 76649, 76651, 76667, 76673, 76679, 76697, 76717, 76733, 76753, 76757, 76771, 76777, 76781, 76801, 76819, 76829, 76831, 76837, 76847, 76871, 76873, 76883, 76907, 76913, 76919, 76943, 76949, 76961, 76963, 76991, 77003, 77017, 77023, 77029, 77041, 77047, 77069, 77081, 77093, 77101, 77137, 77141, 77153, 77167, 77171, 77191, 77201, 77213, 77237, 77239, 77243, 77249, 77261, 77263, 77267, 77269, 77279, 77291, 77317, 77323, 77339, 77347, 77351, 77359, 77369, 77377, 77383, 77417, 77419, 77431, 77447, 77471, 77477, 77479, 77489, 77491, 77509, 77513, 77521, 77527, 77543, 77549, 77551, 77557, 77563, 77569, 77573, 77587, 77591, 77611, 77617, 77621, 77641, 77647, 77659, 77681, 77687, 77689, 77699, 77711, 77713, 77719, 77723, 77731, 77743, 77747, 77761, 77773, 77783, 77797, 77801, 77813, 77839, 77849, 77863, 77867, 77893, 77899, 77929, 77933, 77951, 77969, 77977, 77983, 77999, 78007, 78017, 78031, 78041, 78049, 78059, 78079, 78101, 78121, 78137, 78139, 78157, 78163, 78167, 78173, 78179, 78191, 78193, 78203, 78229, 78233, 78241, 78259, 78277, 78283, 78301, 78307, 78311, 78317, 78341, 78347, 78367, 78401, 78427, 78437, 78439, 78467, 78479, 78487, 78497, 78509, 78511, 78517, 78539, 78541, 78553, 78569, 78571, 78577, 78583, 78593, 78607, 78623, 78643, 78649, 78653, 78691, 78697, 78707, 78713, 78721, 78737, 78779, 78781, 78787, 78791, 78797, 78803, 78809, 78823, 78839, 78853, 78857, 78877, 78887, 78889, 78893, 78901, 78919, 78929, 78941, 78977, 78979, 78989, 79031, 79039, 79043, 79063, 79087, 79103, 79111, 79133, 79139, 79147, 79151, 79153, 79159, 79181, 79187, 79193, 79201, 79229, 79231, 79241, 79259, 79273, 79279, 79283, 79301, 79309, 79319, 79333, 79337, 79349, 79357, 79367, 79379, 79393, 79397, 79399, 79411, 79423, 79427, 79433, 79451, 79481, 79493, 79531, 79537, 79549, 79559, 79561, 79579, 79589, 79601, 79609, 79613, 79621, 79627, 79631, 79633, 79657, 79669, 79687, 79691, 79693, 79697, 79699, 79757, 79769, 79777, 79801, 79811, 79813, 79817, 79823, 79829, 79841, 79843, 79847, 79861, 79867, 79873, 79889, 79901, 79903, 79907, 79939, 79943, 79967, 79973, 79979, 79987, 79997, 79999, 80021, 80039, 80051, 80071, 80077, 80107, 80111, 80141, 80147, 80149, 80153, 80167, 80173, 80177, 80191, 80207, 80209, 80221, 80231, 80233, 80239, 80251, 80263, 80273, 80279, 80287, 80309, 80317, 80329, 80341, 80347, 80363, 80369, 80387, 80407, 80429, 80447, 80449, 80471, 80473, 80489, 80491, 80513, 80527, 80537, 80557, 80567, 80599, 80603, 80611, 80621, 80627, 80629, 80651, 80657, 80669, 80671, 80677, 80681, 80683, 80687, 80701, 80713, 80737, 80747, 80749, 80761, 80777, 80779, 80783, 80789, 80803, 80809, 80819, 80831, 80833, 80849, 80863, 80897, 80909, 80911, 80917, 80923, 80929, 80933, 80953, 80963, 80989, 81001, 81013, 81017, 81019, 81023, 81031, 81041, 81043, 81047, 81049, 81071, 81077, 81083, 81097, 81101, 81119, 81131, 81157, 81163, 81173, 81181, 81197, 81199, 81203, 81223, 81233, 81239, 81281, 81283, 81293, 81299, 81307, 81331, 81343, 81349, 81353, 81359, 81371, 81373, 81401, 81409, 81421, 81439, 81457, 81463, 81509, 81517, 81527, 81533, 81547, 81551, 81553, 81559, 81563, 81569, 81611, 81619, 81629, 81637, 81647, 81649, 81667, 81671, 81677, 81689, 81701, 81703, 81707, 81727, 81737, 81749, 81761, 81769, 81773, 81799, 81817, 81839, 81847, 81853, 81869, 81883, 81899, 81901, 81919, 81929, 81931, 81937, 81943, 81953, 81967, 81971, 81973, 82003, 82007, 82009, 82013, 82021, 82031, 82037, 82039, 82051, 82067, 82073, 82129, 82139, 82141, 82153, 82163, 82171, 82183, 82189, 82193, 82207, 82217, 82219, 82223, 82231, 82237, 82241, 82261, 82267, 82279, 82301, 82307, 82339, 82349, 82351, 82361, 82373, 82387, 82393, 82421, 82457, 82463, 82469, 82471, 82483, 82487, 82493, 82499, 82507, 82529, 82531, 82549, 82559, 82561, 82567, 82571, 82591, 82601, 82609, 82613, 82619, 82633, 82651, 82657, 82699, 82721, 82723, 82727, 82729, 82757, 82759, 82763, 82781, 82787, 82793, 82799, 82811, 82813, 82837, 82847, 82883, 82889, 82891, 82903, 82913, 82939, 82963, 82981, 82997, 83003, 83009, 83023, 83047, 83059, 83063, 83071, 83077, 83089, 83093, 83101, 83117, 83137, 83177, 83203, 83207, 83219, 83221, 83227, 83231, 83233, 83243, 83257, 83267, 83269, 83273, 83299, 83311, 83339, 83341, 83357, 83383, 83389, 83399, 83401, 83407, 83417, 83423, 83431, 83437, 83443, 83449, 83459, 83471, 83477, 83497, 83537, 83557, 83561, 83563, 83579, 83591, 83597, 83609, 83617, 83621, 83639, 83641, 83653, 83663, 83689, 83701, 83717, 83719, 83737, 83761, 83773, 83777, 83791, 83813, 83833, 83843, 83857, 83869, 83873, 83891, 83903, 83911, 83921, 83933, 83939, 83969, 83983, 83987, 84011, 84017, 84047, 84053, 84059, 84061, 84067, 84089, 84121, 84127, 84131, 84137, 84143, 84163, 84179, 84181, 84191, 84199, 84211, 84221, 84223, 84229, 84239, 84247, 84263, 84299, 84307, 84313, 84317, 84319, 84347, 84349, 84377, 84389, 84391, 84401, 84407, 84421, 84431, 84437, 84443, 84449, 84457, 84463, 84467, 84481, 84499, 84503, 84509, 84521, 84523, 84533, 84551, 84559, 84589, 84629, 84631, 84649, 84653, 84659, 84673, 84691, 84697, 84701, 84713, 84719, 84731, 84737, 84751, 84761, 84787, 84793, 84809, 84811, 84827, 84857, 84859, 84869, 84871, 84913, 84919, 84947, 84961, 84967, 84977, 84979, 84991, 85009, 85021, 85027, 85037, 85049, 85061, 85081, 85087, 85091, 85093, 85103, 85109, 85121, 85133, 85147, 85159, 85193, 85199, 85201, 85213, 85223, 85229, 85237, 85243, 85247, 85259, 85297, 85303, 85313, 85331, 85333, 85361, 85363, 85369, 85381, 85411, 85427, 85429, 85439, 85447, 85451, 85453, 85469, 85487, 85513, 85517, 85523, 85531, 85549, 85571, 85577, 85597, 85601, 85607, 85619, 85621, 85627, 85639, 85643, 85661, 85667, 85669, 85691, 85703, 85711, 85717, 85733, 85751, 85781, 85793, 85817, 85819, 85829, 85831, 85837, 85843, 85847, 85853, 85889, 85903, 85909, 85931, 85933, 85991, 85999, 86011, 86017, 86027, 86029, 86069, 86077, 86083, 86111, 86113, 86117, 86131, 86137, 86143, 86161, 86171, 86179, 86183, 86197, 86201, 86209, 86239, 86243, 86249, 86257, 86263, 86269, 86287, 86291, 86293, 86297, 86311, 86323, 86341, 86351, 86353, 86357, 86369, 86371, 86381, 86389, 86399, 86413, 86423, 86441, 86453, 86461, 86467, 86477, 86491, 86501, 86509, 86531, 86533, 86539, 86561, 86573, 86579, 86587, 86599, 86627, 86629, 86677, 86689, 86693, 86711, 86719, 86729, 86743, 86753, 86767, 86771, 86783, 86813, 86837, 86843, 86851, 86857, 86861, 86869, 86923, 86927, 86929, 86939, 86951, 86959, 86969, 86981, 86993, 87011, 87013, 87037, 87041, 87049, 87071, 87083, 87103, 87107, 87119, 87121, 87133, 87149, 87151, 87179, 87181, 87187, 87211, 87221, 87223, 87251, 87253, 87257, 87277, 87281, 87293, 87299, 87313, 87317, 87323, 87337, 87359, 87383, 87403, 87407, 87421, 87427, 87433, 87443, 87473, 87481, 87491, 87509, 87511, 87517, 87523, 87539, 87541, 87547, 87553, 87557, 87559, 87583, 87587, 87589, 87613, 87623, 87629, 87631, 87641, 87643, 87649, 87671, 87679, 87683, 87691, 87697, 87701, 87719, 87721, 87739, 87743, 87751, 87767, 87793, 87797, 87803, 87811, 87833, 87853, 87869, 87877, 87881, 87887, 87911, 87917, 87931, 87943, 87959, 87961, 87973, 87977, 87991, 88001, 88003, 88007, 88019, 88037, 88069, 88079, 88093, 88117, 88129, 88169, 88177, 88211, 88223, 88237, 88241, 88259, 88261, 88289, 88301, 88321, 88327, 88337, 88339, 88379, 88397, 88411, 88423, 88427, 88463, 88469, 88471, 88493, 88499, 88513, 88523, 88547, 88589, 88591, 88607, 88609, 88643, 88651, 88657, 88661, 88663, 88667, 88681, 88721, 88729, 88741, 88747, 88771, 88789, 88793, 88799, 88801, 88807, 88811, 88813, 88817, 88819, 88843, 88853, 88861, 88867, 88873, 88883, 88897, 88903, 88919, 88937, 88951, 88969, 88993, 88997, 89003, 89009, 89017, 89021, 89041, 89051, 89057, 89069, 89071, 89083, 89087, 89101, 89107, 89113, 89119, 89123, 89137, 89153, 89189, 89203, 89209, 89213, 89227, 89231, 89237, 89261, 89269, 89273, 89293, 89303, 89317, 89329, 89363, 89371, 89381, 89387, 89393, 89399, 89413, 89417, 89431, 89443, 89449, 89459, 89477, 89491, 89501, 89513, 89519, 89521, 89527, 89533, 89561, 89563, 89567, 89591, 89597, 89599, 89603, 89611, 89627, 89633, 89653, 89657, 89659, 89669, 89671, 89681, 89689, 89753, 89759, 89767, 89779, 89783, 89797, 89809, 89819, 89821, 89833, 89839, 89849, 89867, 89891, 89897, 89899, 89909, 89917, 89923, 89939, 89959, 89963, 89977, 89983, 89989, 90001, 90007, 90011, 90017, 90019, 90023, 90031, 90053, 90059, 90067, 90071, 90073, 90089, 90107, 90121, 90127, 90149, 90163, 90173, 90187, 90191, 90197, 90199, 90203, 90217, 90227, 90239, 90247, 90263, 90271, 90281, 90289, 90313, 90353, 90359, 90371, 90373, 90379, 90397, 90401, 90403, 90407, 90437, 90439, 90469, 90473, 90481, 90499, 90511, 90523, 90527, 90529, 90533, 90547, 90583, 90599, 90617, 90619, 90631, 90641, 90647, 90659, 90677, 90679, 90697, 90703, 90709, 90731, 90749, 90787, 90793, 90803, 90821, 90823, 90833, 90841, 90847, 90863, 90887, 90901, 90907, 90911, 90917, 90931, 90947, 90971, 90977, 90989, 90997, 91009, 91019, 91033, 91079, 91081, 91097, 91099, 91121, 91127, 91129, 91139, 91141, 91151, 91153, 91159, 91163, 91183, 91193, 91199, 91229, 91237, 91243, 91249, 91253, 91283, 91291, 91297, 91303, 91309, 91331, 91367, 91369, 91373, 91381, 91387, 91393, 91397, 91411, 91423, 91433, 91453, 91457, 91459, 91463, 91493, 91499, 91513, 91529, 91541, 91571, 91573, 91577, 91583, 91591, 91621, 91631, 91639, 91673, 91691, 91703, 91711, 91733, 91753, 91757, 91771, 91781, 91801, 91807, 91811, 91813, 91823, 91837, 91841, 91867, 91873, 91909, 91921, 91939, 91943, 91951, 91957, 91961, 91967, 91969, 91997, 92003, 92009, 92033, 92041, 92051, 92077, 92083, 92107, 92111, 92119, 92143, 92153, 92173, 92177, 92179, 92189, 92203, 92219, 92221, 92227, 92233, 92237, 92243, 92251, 92269, 92297, 92311, 92317, 92333, 92347, 92353, 92357, 92363, 92369, 92377, 92381, 92383, 92387, 92399, 92401, 92413, 92419, 92431, 92459, 92461, 92467, 92479, 92489, 92503, 92507, 92551, 92557, 92567, 92569, 92581, 92593, 92623, 92627, 92639, 92641, 92647, 92657, 92669, 92671, 92681, 92683, 92693, 92699, 92707, 92717, 92723, 92737, 92753, 92761, 92767, 92779, 92789, 92791, 92801, 92809, 92821, 92831, 92849, 92857, 92861, 92863, 92867, 92893, 92899, 92921, 92927, 92941, 92951, 92957, 92959, 92987, 92993, 93001, 93047, 93053, 93059, 93077, 93083, 93089, 93097, 93103, 93113, 93131, 93133, 93139, 93151, 93169, 93179, 93187, 93199, 93229, 93239, 93241, 93251, 93253, 93257, 93263, 93281, 93283, 93287, 93307, 93319, 93323, 93329, 93337, 93371, 93377, 93383, 93407, 93419, 93427, 93463, 93479, 93481, 93487, 93491, 93493, 93497, 93503, 93523, 93529, 93553, 93557, 93559, 93563, 93581, 93601, 93607, 93629, 93637, 93683, 93701, 93703, 93719, 93739, 93761, 93763, 93787, 93809, 93811, 93827, 93851, 93871, 93887, 93889, 93893, 93901, 93911, 93913, 93923, 93937, 93941, 93949, 93967, 93971, 93979, 93983, 93997, 94007, 94009, 94033, 94049, 94057, 94063, 94079, 94099, 94109, 94111, 94117, 94121, 94151, 94153, 94169, 94201, 94207, 94219, 94229, 94253, 94261, 94273, 94291, 94307, 94309, 94321, 94327, 94331, 94343, 94349, 94351, 94379, 94397, 94399, 94421, 94427, 94433, 94439, 94441, 94447, 94463, 94477, 94483, 94513, 94529, 94531, 94541, 94543, 94547, 94559, 94561, 94573, 94583, 94597, 94603, 94613, 94621, 94649, 94651, 94687, 94693, 94709, 94723, 94727, 94747, 94771, 94777, 94781, 94789, 94793, 94811, 94819, 94823, 94837, 94841, 94847, 94849, 94873, 94889, 94903, 94907, 94933, 94949, 94951, 94961, 94993, 94999, 95003, 95009, 95021, 95027, 95063, 95071, 95083, 95087, 95089, 95093, 95101, 95107, 95111, 95131, 95143, 95153, 95177, 95189, 95191, 95203, 95213, 95219, 95231, 95233, 95239, 95257, 95261, 95267, 95273, 95279, 95287, 95311, 95317, 95327, 95339, 95369, 95383, 95393, 95401, 95413, 95419, 95429, 95441, 95443, 95461, 95467, 95471, 95479, 95483, 95507, 95527, 95531, 95539, 95549, 95561, 95569, 95581, 95597, 95603, 95617, 95621, 95629, 95633, 95651, 95701, 95707, 95713, 95717, 95723, 95731, 95737, 95747, 95773, 95783, 95789, 95791, 95801, 95803, 95813, 95819, 95857, 95869, 95873, 95881, 95891, 95911, 95917, 95923, 95929, 95947, 95957, 95959, 95971, 95987, 95989, 96001, 96013, 96017, 96043, 96053, 96059, 96079, 96097, 96137, 96149, 96157, 96167, 96179, 96181, 96199, 96211, 96221, 96223, 96233, 96259, 96263, 96269, 96281, 96289, 96293, 96323, 96329, 96331, 96337, 96353, 96377, 96401, 96419, 96431, 96443, 96451, 96457, 96461, 96469, 96479, 96487, 96493, 96497, 96517, 96527, 96553, 96557, 96581, 96587, 96589, 96601, 96643, 96661, 96667, 96671, 96697, 96703, 96731, 96737, 96739, 96749, 96757, 96763, 96769, 96779, 96787, 96797, 96799, 96821, 96823, 96827, 96847, 96851, 96857, 96893, 96907, 96911, 96931, 96953, 96959, 96973, 96979, 96989, 96997, 97001, 97003, 97007, 97021, 97039, 97073, 97081, 97103, 97117, 97127, 97151, 97157, 97159, 97169, 97171, 97177, 97187, 97213, 97231, 97241, 97259, 97283, 97301, 97303, 97327, 97367, 97369, 97373, 97379, 97381, 97387, 97397, 97423, 97429, 97441, 97453, 97459, 97463, 97499, 97501, 97511, 97523, 97547, 97549, 97553, 97561, 97571, 97577, 97579, 97583, 97607, 97609, 97613, 97649, 97651, 97673, 97687, 97711, 97729, 97771, 97777, 97787, 97789, 97813, 97829, 97841, 97843, 97847, 97849, 97859, 97861, 97871, 97879, 97883, 97919, 97927, 97931, 97943, 97961, 97967, 97973, 97987, 98009, 98011, 98017, 98041, 98047, 98057, 98081, 98101, 98123, 98129, 98143, 98179, 98207, 98213, 98221, 98227, 98251, 98257, 98269, 98297, 98299, 98317, 98321, 98323, 98327, 98347, 98369, 98377, 98387, 98389, 98407, 98411, 98419, 98429, 98443, 98453, 98459, 98467, 98473, 98479, 98491, 98507, 98519, 98533, 98543, 98561, 98563, 98573, 98597, 98621, 98627, 98639, 98641, 98663, 98669, 98689, 98711, 98713, 98717, 98729, 98731, 98737, 98773, 98779, 98801, 98807, 98809, 98837, 98849, 98867, 98869, 98873, 98887, 98893, 98897, 98899, 98909, 98911, 98927, 98929, 98939, 98947, 98953, 98963, 98981, 98993, 98999, 99013, 99017, 99023, 99041, 99053, 99079, 99083, 99089, 99103, 99109, 99119, 99131, 99133, 99137, 99139, 99149, 99173, 99181, 99191, 99223, 99233, 99241, 99251, 99257, 99259, 99277, 99289, 99317, 99347, 99349, 99367, 99371, 99377, 99391, 99397, 99401, 99409, 99431, 99439, 99469, 99487, 99497, 99523, 99527, 99529, 99551, 99559, 99563, 99571, 99577, 99581, 99607, 99611, 99623, 99643, 99661, 99667, 99679, 99689, 99707, 99709, 99713, 99719, 99721, 99733, 99761, 99767, 99787, 99793, 99809, 99817, 99823, 99829, 99833, 99839, 99859, 99871, 99877, 99881, 99901, 99907, 99923, 99929, 99961, 99971, 99989, 99991, \ No newline at end of file diff --git a/CodeChef/.DS_Store b/CodeChef/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..bde6fb4070719a7067b9734045d19c02259e0639 GIT binary patch literal 16388 zcmeI3%W_o75r(U|j3hvJiQB-;@g>4|!Gy<-aIj=RfUq?)1jru33x`EZNIf)?tP2RQ zSQ35$9)U;T5m@*Ecmy7So&A5A=cubhRcmH5VViEEb<|DgUzvYiDl1PbgwVRSyZmJc zS3(HGdUBmOrMLB>()Bkd^+x^R|9O7!II4GAdj3<-W0DVHH#`X4uo9|p?}JbO_q}mM zD)E%=VJggpjYR*QuoXICJ*C zsPyD|wZ1<0tCbG@pnc~5X`$_*-)W6`ud1(C>+5sB>VNcTxu~u#+NzHjEf?4ORsFfE z_4T=5T|BgGW#QB-b8z9&vek91^g@r;Rl5v+3>X+NkYV8WdT%Iv8B=nP*%d3!*k znSGR}(r4Qk`byJ)IiYSFURE2X2;;+%Wn+fZHJg^D6CAFTElFf2CEL-b+qSyT9d+mQID~jIkQ) z@S)^y^B#rAiFl^;q2%xKk}YYQNS>;-T{rfN*?_Kz9G)YKHqB#9iyXUcHkhT8N{|6Id$^K;p*7m;1);+3f@oOn9xQ`b^Oz@~#Z?0TEhp~ns$XFo-+ zygrK6srQjSC#8>9*xfP{WOyPqX;Le;npfAQx;7Q`H!kCKr)z{wu}FTA>1+CJw{NB? zN~YH$?MDoS{l5@b#6lwRnMrshUr~Oey=zd32aolqrcu{)YFjlaayk7r(uSC20-w&l zeVX6QzDs(F;RNf9VWH>u((slvB2JmH!xA;pvpuUBY$s^5+W*jCR|rie%?puexh&7I zvt*IT%bEGe#-Tc6=$52G+AG0!^65{tu5(JRu>W>c57?KR`qI|gT|IXd1ASsAL7m!1 z<<0|g1e5E{GR#dPvu#fllr>~V|U3-61*N(D=xarr;Dq_Q> zC}K~2fS!#tDp(?S&g5LDSRX&{x22=s&t?XYMI;Lo#1SE41Lw%B1a&IJRrI1sJQgQj zKbtz^b?c6hwvIYTuhMRoE`U(c7AFo@@o~;mA|7CdH1)j>jq9|)2-bj!Rnbz&e0ej=qZQ%z5^va&1F= z^~s9_BWIcC72c(DT*_Mp>&MPU+IR$~meJ>vZJZdZy7Dy4SD`SagZ%_K=g+T&%+9f8 zK3&inkIfH7FC>U(GXCUz{Zv{~tEk0H9kOWn;n<7F@*IcXNH=OL^__hvi$we%io~Rg z3Qg@R);sgY`$(r;CV})+Iu&<1V?IXtG{aL|kI2m@dTtB3h)NC|I}G)%^y0K~O}6@- z2k$_r$XV|2!tu4p;>nDz%_Jd<0Q(6-jx#zFpS=_^3g(Z$jr6#X)q~o|9!4!>=Z7zP z8?4Q1rz}WtOWJWp0XK^R_X)~OQ9DN|St+(ZnUAdec?QQjn@XoKX1mL_*ZS1UPg8B} zihXp&AITcIiqfocU+20eX5w8j%K|?7g z?7Ah-C991_tI@eJyU*&0w-U*TeaXw3kx@na&cw)xp-YjS$fGN>DDR{y^=_AyW!d%d zKq61H9F&K3X8u&j!b||Zhh9c{uhZ!1iFf+cNBA8cj_iV8>N{F^-1r^BLKeYqA`idJ1?lFS4w78)?i_z- z{Y0D`z?qZYXu-XMrXo;H+0B@MW^v4(y~LgrhsiPe6i#&bW;m8VuNl^gbckoL%{;_+ zYI3O2FRPQ;7Gq9lFmDON?+X-|Hp|{cmVKTT5=sF-~ z9~boQnQ%i`UhjSOU+JW^uBhdFaM)d2F`Rr0epE5f{^)m$51B3{l4BXk!W~xF8+jA4 z_v63+-iNsad1^n0o66>A2lA=pTUD16S0e4kHPz?C_NOZfzQKh|h*#cFERy(U3;yH`Lj7S4YC82O%Z@SrKCC@YU`2jtlS+;{Q3vrpYQ^)}M|qV0{`C24ZCtAtK20RdGw!WEmhn zMqfvIU(n>&^C^yv=5Mx|%IO^+U2Xx_tcY>7&Y`DvHS*pOT;cowH}w6RQ<`#S{{Ao9 zHw@k!Ffd@?|AT?nvAKJ5*JMkpU=QE5uk`$zo;>*6bAHi7zbAhLpx4PC3+wgO`g70y diZpU2rt44i2LSX5gZ+Q7|0jRL{qgSq{{j2AXuALa literal 0 HcmV?d00001 diff --git a/CodeChef/ATM.cpp b/CodeChef/ATM.cpp new file mode 100755 index 0000000..37cbc96 --- /dev/null +++ b/CodeChef/ATM.cpp @@ -0,0 +1,19 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int cash; + double bal; + cin >> cash >> bal; + if(bal - 0.5 - cash >= 0 && cash % 5 == 0) + { + cout << fixed << setprecision(2) << bal - cash - 0.5 << endl; + } + else + { + cout << fixed << setprecision(2) << bal << endl; + } + return 0; +} diff --git a/CodeChef/Addition and Multiplication.cpp b/CodeChef/Addition and Multiplication.cpp new file mode 100755 index 0000000..d36359d --- /dev/null +++ b/CodeChef/Addition and Multiplication.cpp @@ -0,0 +1,13 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + + return 0; +} diff --git a/CodeChef/Addition.cpp b/CodeChef/Addition.cpp new file mode 100755 index 0000000..3063368 --- /dev/null +++ b/CodeChef/Addition.cpp @@ -0,0 +1,52 @@ +#include +using namespace std; +int a[100],b[100],carry,ans[101],n,tempc,i,temp[100],j,a_count,b_count; +int main() +{ + char c; + c=0; + for(i=0;c != '\n';i++){ + scanf("%1c",&c); + temp[i] = c-48; + a_count++; + } + temp[a_count-1]=0; + a_count=a_count-1; + for(i=0,j=a_count-1;ib_count) ? a_count:b_count; + for(i=0;i9 || b[i]>9 || a[i]<0 || b[i]<0){ + printf("symbols are not allowed\n"); + exit(0); + } + } + for(i=0;i=0;i--){ + + printf("%d",ans[i]); + } + return 0; +} diff --git a/CodeChef/Aditi and Magic Trick.cpp b/CodeChef/Aditi and Magic Trick.cpp new file mode 100755 index 0000000..a9c724b --- /dev/null +++ b/CodeChef/Aditi and Magic Trick.cpp @@ -0,0 +1,36 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAXN 1111 +vector nums; +void init() +{ + nums.push_back(0); + nums.push_back(1); + ll i = 2, j = 1, k, sz = 2; + while(sz <= MAXN) + { + for(k = 0; k < j; k++) + { + nums.push_back(i); + sz++; + } + i++; j++; + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + init(); + ll t; + cin >> t; + while(t--) + { + ll n; + cin >> n; + cout << nums[n] << endl; + } + return 0; +} diff --git a/CodeChef/Alien.cpp b/CodeChef/Alien.cpp new file mode 100755 index 0000000..4cdf132 --- /dev/null +++ b/CodeChef/Alien.cpp @@ -0,0 +1,32 @@ +#include +using namespace std; +#define endl '\n' +int smallestfact(int n) +{ + int root = sqrt(n), i; + for(i = 2; i <= n; i++) + { + if(n % i == 0) + { + break; + } + } + return i; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int n, sum = 0, k, d, sf; + cin >> n; + sum += n; + k = n; + while (k != 1) + { + sf = smallestfact(k); + d = k/sf; + sum += d; + k = d; + } + cout << sum << endl; + return 0; +} diff --git a/CodeChef/Almost Sorted Permutation.cpp b/CodeChef/Almost Sorted Permutation.cpp new file mode 100755 index 0000000..afb6189 --- /dev/null +++ b/CodeChef/Almost Sorted Permutation.cpp @@ -0,0 +1,42 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll arr[1000011], sorted[1000011]; +unordered_map pos; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + bool flag = true; + ll n, i; + cin >> n; + for(i = 1; i <= n; i++) + { + cin >> arr[i]; + sorted[i] = arr[i]; + } + sort(sorted+1, sorted+n+1); + for(i = 1; i <= n; i++) + { + pos[sorted[i]] = i; + } + for(i = 1; i <= n; i++) + { + if(abs(pos[arr[i]] - i) > 1) + { + flag = false; + break; + } + } + if(flag) + cout << "YES" << endl; + else + cout << "NO" << endl; + } + return 0; +} diff --git a/CodeChef/Alok- Nath and his Sanskars.cpp b/CodeChef/Alok- Nath and his Sanskars.cpp new file mode 100755 index 0000000..2c3abc7 --- /dev/null +++ b/CodeChef/Alok- Nath and his Sanskars.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + long long int N, K, sum = 0; + cin >> N >> K; + long long int sanskars[N]; + for(int i = 0; i < N; i++) + { + cin >> sanskars[i]; + sum += sanskars[i]; + } + if(sum == 0 && N != K) + { + cout << "no" << endl; + break; + } + if(sum % K == 0) + { + cout << "yes" << endl; + } + else + { + cout << "no" << endl; + } + } + return 0; +} diff --git a/CodeChef/Anagram.cpp b/CodeChef/Anagram.cpp new file mode 100755 index 0000000..8e5188f --- /dev/null +++ b/CodeChef/Anagram.cpp @@ -0,0 +1,60 @@ +#include +using namespace std; +#define endl '\n' +bool isAnagram(string s, string s1) +{ + bool flag = true; + if(s.length() == s1.length()) + { + int alpha[26] ,alpha1[26]; + for(int i = 0; i < 26; i++) + { + alpha[i] = 0; + } + for(int i = 0; i < 26; i++) + { + alpha1[i] = 0; + } + for(int i = 0; i < s.length(); i++) + { + alpha[s[i]-'a']++; + } + for(int i = 0; i < s1.length(); i++) + { + alpha1[s1[i]-'a']++; + } + for(int i = 0; i < 26; i++) + { + if(alpha[i] != alpha1[i]) + { + flag = false; + break; + } + } + return flag; + } + else + { + return false; + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + string s, s1; + cin >> s >> s1; + if(isAnagram(s, s1)) + { + cout << "YES" << endl; + } + else + { + cout << "NO" << endl; + } + } + return 0; +} diff --git a/CodeChef/Another Fibonacci.cpp b/CodeChef/Another Fibonacci.cpp new file mode 100755 index 0000000..1ca8932 --- /dev/null +++ b/CodeChef/Another Fibonacci.cpp @@ -0,0 +1,34 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll mod = 99991; +ll fib(ll n) +{ + +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, k, i, sum; + cin >> n >> k; + ll arr[n+1]; + arr[0] = 0; + for(i = 1; i <= n; i++) + { + cin >> arr[i]; + } + for(i = 1; i <= n; i++) + { + arr[i] = arr[i] + arr[i-1]; + } + sum = 0; + for(i = k; i <= n; i++) + { + sum = (sum + fib(arr[i] - arr[i-k])) % mod; + } + cout << sum % mod; + return 0; +} diff --git a/CodeChef/Antidote.cpp b/CodeChef/Antidote.cpp new file mode 100755 index 0000000..5d840c0 --- /dev/null +++ b/CodeChef/Antidote.cpp @@ -0,0 +1,23 @@ +#include +using namespace std; +#define endl '\n' +int gcd(int a, int b) +{ + return b ? gcd(b, a%b) : a; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while (t--) + { + int a, b, N; + cin >> a >> b >> N; + if (N % gcd(a, b) == 0 && N <= max(a, b)) + cout << "YES" << endl; + else + cout << "NO" << endl; + } + return 0; +} diff --git a/CodeChef/Approximately II.cpp b/CodeChef/Approximately II.cpp new file mode 100755 index 0000000..bc466c9 --- /dev/null +++ b/CodeChef/Approximately II.cpp @@ -0,0 +1,37 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + long long int n, k, cnt = 0, min = INT_MAX, i , j, val; + cin >> n >> k; + long long int a[n]; + for(i = 0; i < n; i++) + { + cin >> a[i]; + } + for(i = 0; i < n-1; i++) + { + for(j = i + 1; j < n; j++) + { + val = abs(a[i] + a[j] - k); + if(min > val) + { + min = val; + cnt = 1; + } + else if(val == min) + { + cnt++; + } + } + } + cout << min << " " << cnt << endl; + } + return 0; +} diff --git a/CodeChef/Bread.cpp b/CodeChef/Bread.cpp new file mode 100755 index 0000000..0434ac5 --- /dev/null +++ b/CodeChef/Bread.cpp @@ -0,0 +1,40 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, k, i; + cin >> n >> k; + ll arr[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + } + ll availableNow = 0, ans = 0, packsNeeded; + for(i = 0; i < n; i++) + { + packsNeeded = (arr[i] - availableNow)/k + (((arr[i] - availableNow)%k > 0) ? 1 : 0); + if(packsNeeded < 0) + { + packsNeeded = 0; + } + availableNow += packsNeeded*k - arr[i]; + ans += packsNeeded; + if(availableNow > 0) + { + availableNow--; + } + } + cout << ans << endl; + } + return 0; +} diff --git a/CodeChef/Bytelandian gold coins.cpp b/CodeChef/Bytelandian gold coins.cpp new file mode 100755 index 0000000..5bd9baa --- /dev/null +++ b/CodeChef/Bytelandian gold coins.cpp @@ -0,0 +1,37 @@ +#include +using namespace std; +long long int amt; +long long Optimal[1000001]; +long long int max(long long a, long long b) {return (a > b) ? a : b;} +long long int getamt(long long int a) +{ + if(a <= 1000000) + { + return Optimal[a]; + } + else + { + return max(a, getamt(a/2) + getamt(a/3) + getamt(a/4)); + } +} +void init() +{ + long long int sum, i; + for(i = 0; i < 12; i++) + { + Optimal[i] = i; + } + for(i = 12; i < 1000001; i++) + { + sum = Optimal[i/2] + Optimal[i/3] + Optimal[i/4]; + Optimal[i] = max(sum, i); + } +} +int main() { + init(); + while(scanf("%lld",&amt) != EOF) + { + cout << getamt(amt) << endl; + } + return 0; +} diff --git a/CodeChef/Cascading Style Sheets.cpp b/CodeChef/Cascading Style Sheets.cpp new file mode 100755 index 0000000..5fc9d0b --- /dev/null +++ b/CodeChef/Cascading Style Sheets.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pii pair +map css[1000001]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int n, m, id, attr, val, prior; + cin >> n >> m; + while(n--) + { + cin >> id >> attr >> val >> prior; + if(css[id].find(attr) == css[id].end()) + { + css[id][attr] = pii(val, prior); + } + else + { + pii curr = css[id][attr]; + if(curr.second <= prior) + { + css[id][attr] = pii(val, prior); + } + } + } + while(m--) + { + cin >> id >> attr; + cout << css[id][attr].first << endl; + } + return 0; +} diff --git a/CodeChef/Chain of Doughnuts.cpp b/CodeChef/Chain of Doughnuts.cpp new file mode 100755 index 0000000..1db1db4 --- /dev/null +++ b/CodeChef/Chain of Doughnuts.cpp @@ -0,0 +1,49 @@ +#include +using namespace std; +#define ll long long +#define MAXA 111111 +ll chains[22222], cnt[MAXA]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, m, i, cuts = 0, end, len, freq, donuts; + for(i = 0; i < MAXA; i++) + { + cnt[i] = 0; + } + cin >> n >> m; + end = m; + for(i = 0; i < m; i++) + { + cin >> chains[i]; + cnt[chains[i]]++; + } + if(n == m) + { + cout << m/2 << endl; + continue; + } + sort(chains, chains+m); + i = 0; + while(end != 1 && i < m-1) + { + len = chains[i]; + freq = cnt[len]; + donuts = min (freq, (ll)(end-1)/(len+1)); + end -= (donuts* (len+1)); + cuts += len*donuts; + if(donuts < freq) + { + break; + } + i += donuts; + } + cuts += end-1; + cout << cuts << endl; + } + return 0; +} diff --git a/CodeChef/Charlie and Prime Numbers.cpp b/CodeChef/Charlie and Prime Numbers.cpp new file mode 100755 index 0000000..57599af --- /dev/null +++ b/CodeChef/Charlie and Prime Numbers.cpp @@ -0,0 +1,53 @@ +#include +using namespace std; +#define endl '\n' +#define MAX 5000001 +int arr[MAX]; +long long i, j; +void sieve() +{ + for(i = 2; i < MAX; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(MAX); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j < MAX; j+=i) + { + arr[j] = 0; + } + } + } +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieve(); + long long t; + cin >> t; + while(t--) + { + long long m, n, sum = 0; + cin >> m >> n; + if(m > n) + { + cout << 0 << endl; + } + else + { + for(i = m; i <= n; i++) + { + if(arr[i]) + { + sum += i; + } + } + cout << sum << endl; + } + } + return 0; +} diff --git a/CodeChef/Chef Anup.cpp b/CodeChef/Chef Anup.cpp new file mode 100755 index 0000000..0db50ef --- /dev/null +++ b/CodeChef/Chef Anup.cpp @@ -0,0 +1,64 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll powerx(ll x, ll i) +{ + ll ans = 1; + if(i == 0) + { + return 1; + } + while(i--) + { + ans *= x; + } + return ans; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + ll N, K, L, i, temp; + cin >> N >> K >> L; + if(N == 1) + { + cout << L << endl; + continue; + } + if(K == 1) + { + for(i = 0; i < N; i++) + { + cout << 1 << " "; + } + cout << endl; + continue; + } + ll arr[N]; + for(i = N-1; i >= 0; i--) + { + temp = (L-1) % powerx(K, N - i); + if(temp != 0) + { + temp = (temp/powerx(K, N - i - 1))+ 1; + } + else + { + temp++; + } + arr[i] = temp; + } + for(i = 0; i < N; i++) + { + cout << arr[i] << " "; + } + cout << endl; + } + return 0; +} diff --git a/CodeChef/Chef and Chain.cpp b/CodeChef/Chef and Chain.cpp new file mode 100755 index 0000000..c9310ec --- /dev/null +++ b/CodeChef/Chef and Chain.cpp @@ -0,0 +1,42 @@ +#include +using namespace std; +char change(char t) +{ + if(t == '+') + { + return '-'; + } + else + { + return '+'; + } +} +int chain(string S) +{ + int count = 0; + for(int i = 1; i < S.length(); i++) + { + char t = S[i]; + if(S[i] == S[i-1]) + { + S[i] = change(S[i]); + count++; + } + } + return count; +} +int main() +{ + //freopen("test.in", "r", stdin); + int T; + cin >> T; + while(T--) + { + string S; + cin >> S; + string s = S; + S[0] = change(S[0]); + cout << min(chain(S)+1, chain(s)) << endl; + } + return 0; +} diff --git a/CodeChef/Chef and Complex String Coverage.cpp b/CodeChef/Chef and Complex String Coverage.cpp new file mode 100755 index 0000000..d5c2605 --- /dev/null +++ b/CodeChef/Chef and Complex String Coverage.cpp @@ -0,0 +1,151 @@ +#include +using namespace std; +bool wayToSort(pair i, pair j) { return i.first > j.first; } +int strval(char a) +{ + return ((int) a) - 96; +} +int fromi(string S, int len, int i) +{ + int res = 0; + if(i + len <= S.length() - 1) + { + while(len--) + { + res += strval(S[i]); + i+=1; + } + } + return res; +} +int isthere(vector items, int k) +{ + for(int i = 0; i < items.size(); i++) + { + if(items[i]== k) + { + return i; + } + } + return 0; +} +int main() +{ + //freopen("test.in", "r", stdin); + string S; + int N, D, strlen; + cin >> S; + cin >> N >> D; + int lengths[N]; + for(int i = 0; i < N; i++) + { + cin >> lengths[i]; + } + int prices[N]; + for(int i = 0; i < N; i++) + { + cin >> prices[i]; + } + strlen = S.length(); + pair maxT[strlen+1][strlen]; + for(int i = 0; i <= strlen; i++) + { + for(int j = 0; j < strlen; j++) + { + maxT[i][j] = make_pair(fromi(S, i, j), j); + } + sort(maxT[i], maxT[i] + strlen, wayToSort); + } + for(int i = 0; i <= strlen; i++) + { + for(int j = 0; j < strlen; j++) + { + cout << setw(2) << maxT[i][j].first << " "; + } + cout << endl; + } + + + int s, p, tmp, c = 0; + int Table[N+1][D+1]; + int taken[N+1][D+1][2]; + for(int i = 0; i <= N; i++) + { + for(int j = 0; j <= D; j++) + { + taken[i][j][0] = 0; + } + } + for (s = 0; s <= N; s++) + { + c = 0; + for (p = 0; p <= D; p++) + { + if (s ==0|| p==0) + {Table[s][p] = 0;} + else if (prices[s-1] <= p) + { + tmp = maxT[lengths[s-1]][c].first+ Table[s-1][p-prices[s-1]]; + if(tmp > Table[s-1][p]) + { + Table[s][p] = tmp; + taken[s][p][0] = 1; + int l = taken[s][p][1] = maxT[lengths[s-1]][c].second; + if(taken[s][prices[s-1]][0] == 1) + { + c++; + } + } + else + { + Table[s][p] = Table[s-1][p]; + } + } + else + Table[s][p] = Table[s-1][p]; + } + } + cout << endl<< "-"<< " "; + for(int j = 0; j <=D; j++) + { + cout << setw(2) << j << " "; + } + cout << endl; + for(int i = 0; i <= N; i++) + { + cout << i << " "; + for(int j = 0; j <= D; j++) + { + cout << setw(2) << Table[i][j] << " "; + } + cout << endl; + } + cout << Table[N][D]; + cout << endl; + vector items; + vector indexes; + int j = D; + for (int i = N; i>= 1; i--) { + if (taken[i][j][0] == 1) { + items.push_back(i-1); + indexes.push_back(taken[i][j][1]); + j -= prices[i-1]; + } + } + reverse(items.begin(),items.end()); + int d = 0; + for(int k = 0; k < N; k++) + { + if(find(items.begin(),items.end(), k) == items.end()) + { + cout << -1 << " "; + } + else + { + cout << indexes[d] << " "; + d++; + } + } + + return 0; +} diff --git a/CodeChef/Chef and Digits.cpp b/CodeChef/Chef and Digits.cpp new file mode 100755 index 0000000..d839be7 --- /dev/null +++ b/CodeChef/Chef and Digits.cpp @@ -0,0 +1,33 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(0); + //freopen("test.in", "r", stdin); + int n, m; + cin >> n >> m; + string number; + cin >> number; + while(m--) + { + int x, sumg0 = 0, suml0 = 0; + cin >> x; + x--; + int b[n]; + for(int i = 0; i < x; i++) + { + b[i] = (number[x] - '0') - (number[i] - '0'); + if(b[i] > 0) + { + sumg0 += b[i]; + } + else if(b[i] < 0) + { + suml0 += b[i]; + } + } + cout << sumg0 - suml0 << endl; + } + return 0; +} diff --git a/CodeChef/Chef and Equality.cpp b/CodeChef/Chef and Equality.cpp new file mode 100755 index 0000000..e48ad07 --- /dev/null +++ b/CodeChef/Chef and Equality.cpp @@ -0,0 +1,37 @@ +#include +using namespace std; +int main() +{ + //freopen("test.in", "r", stdin); + int T; + cin >> T; + while(T--) + { + int A[100000]; + set s; + int N, mx = 0, mxp; + cin >> N; + for(int i = 0; i < N; i++) + { + int pile; + cin >> pile; + if(s.count(pile-1) == 0) + { + A[pile-1] = 0; + } + A[pile-1] += 1; + s.insert(pile-1); + } + for (set::iterator it=s.begin(); it!=s.end(); ++it) + { + int p = *it; + if(A[p] > mx) + { + mx = A[p]; + mxp = p; + } + } + cout << N - mx << endl; + } + return 0; +} diff --git a/CodeChef/Chef and Fibonacci.cpp b/CodeChef/Chef and Fibonacci.cpp new file mode 100755 index 0000000..6335a38 --- /dev/null +++ b/CodeChef/Chef and Fibonacci.cpp @@ -0,0 +1,29 @@ +#include +using namespace std; +#define endl '\n' +long long int fibs[1000001]; +long long int gcd(long long int a, long long int b) {return (b) ? gcd(b, a%b) : a;} +long long int mod = 1e9 + 7; +void generatefib() +{ + fibs[1] = 1; + fibs[2] = 1; + for(long long int i = 3; i < 1000001; i++) + { + fibs[i] = (fibs[i-1] + fibs[i-2]) % mod; + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + generatefib(); + long long int t; + cin >> t; + while(t--) + { + long long int a, b, f; + cin >> a >> b; + cout << fibs[gcd(a, b)] << endl; + } + return 0; +} diff --git a/CodeChef/Chef and Frogs.cpp b/CodeChef/Chef and Frogs.cpp new file mode 100755 index 0000000..93a3cc6 --- /dev/null +++ b/CodeChef/Chef and Frogs.cpp @@ -0,0 +1,47 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pi pair +bool wayToSort(pi i, pi j) { return i.first < j.first; } +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, k, p, i, j; + cin >> n >> k >> p; + pi frogs[n]; + ll MaxInd[n]; + for(i = 0; i < n; i++) + { + cin >> frogs[i].first; + frogs[i].second = i; + MaxInd[i] = i; + } + sort(frogs, frogs + n, wayToSort); + for(i = 0; i < n; i++) + { + j = i + 1; + while(j < n && frogs[j].first - frogs[j-1].first <= k) + { + MaxInd[frogs[j].second] = MaxInd[frogs[i].second]; + j++; + } + i = j-1; + } + for(i = 0; i < p; i++) + { + ll f1, f2; + cin >> f1 >> f2; + f1--; f2--; + if(MaxInd[f1] == MaxInd[f2]) + { + cout << "Yes" << endl; + } + else + { + cout << "No" << endl; + } + } + return 0; +} diff --git a/CodeChef/Chef and Memory Limit.cpp b/CodeChef/Chef and Memory Limit.cpp new file mode 100755 index 0000000..ff898e5 --- /dev/null +++ b/CodeChef/Chef and Memory Limit.cpp @@ -0,0 +1,32 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, i, allocated = 0, current = 0; + cin >> n; + ll arr[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + } + for(i = 0; i < n; i++) + { + if(arr[i] > current) + { + allocated += arr[i] - current; + } + current = arr[i]; + } + cout << allocated << endl; + } + return 0; +} diff --git a/CodeChef/Chef and Notebook.cpp b/CodeChef/Chef and Notebook.cpp new file mode 100755 index 0000000..ba316fb --- /dev/null +++ b/CodeChef/Chef and Notebook.cpp @@ -0,0 +1,25 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long t; + cin >> t; + while(t--) + { + long long X, K, Y, N, flag = 0, i, cost, pages; + cin >> X >> Y >> K >> N; + X = X - Y; + for(i = 0; i < N; i++) + { + cin >> pages >> cost; + if(cost <= K && pages >= X) + { + flag = 1; + } + } + cout << ((flag == 1) ? "LuckyChef\n" : "UnluckyChef\n"); + } + return 0; +} diff --git a/CodeChef/Chef and Polygons.cpp b/CodeChef/Chef and Polygons.cpp new file mode 100755 index 0000000..76ac12f --- /dev/null +++ b/CodeChef/Chef and Polygons.cpp @@ -0,0 +1,59 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool wayToSort(pair a, pair b){return a.first < b.first;} +const ll limit = 100000; +ll ranks[limit+1]; +vector > polygon; +vector > areas; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll m, n, i, j, x, y; + double area; + polygon.clear(); + areas.clear(); + cin >> n; + for(i = 0; i < n; i++) + { + cin >> m; + for(j = 0; j < m; j++) + { + cin >> x; + cin >> y; + polygon.push_back(make_pair(x, y)); + } + area = 0.0; + for(j = 0; j < m-1; j++) + { + area += (polygon[i].first*polygon[i+1].second) - (polygon[i].second*polygon[i+1].first); + } + area += polygon[m-1].first*polygon[0].second - polygon[m-1].second*polygon[0].first; + area = ((double)area)/2.0; + if(area < 0) + { + area = -area; + } + areas.push_back(make_pair(area, i)); + polygon.clear(); + } + sort(areas.begin(), areas.end(), wayToSort); + for(i = 0; i < n; i++) + { + ranks[areas[i].second] = i; + } + for(i = 0; i < n; i++) + { + cout << ranks[i] << " "; + } + cout << endl; + } + return 0; +} diff --git a/CodeChef/Chef and Powers.cpp b/CodeChef/Chef and Powers.cpp new file mode 100755 index 0000000..ecca1e5 --- /dev/null +++ b/CodeChef/Chef and Powers.cpp @@ -0,0 +1,2 @@ +#include +using namespace std;int main(){long N,e=2;cin>>N;while(N!=0){if((N&e)==e){cout << e << " ";N -= e;}e*=2;}cout< +using namespace std; +#define endl '\n' +#define ll long long +ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + ll A, B, i; + cin >> A >> B; + while(A != 1 && B != 1) + { + A = gcd(A, B); + B = B/A; + } + A = gcd(A, B); + B = B/A; + if(A == B) + { + cout << "Yes" << endl; + } + else + { + cout << "No" << endl; + } + } + return 0; +} diff --git a/CodeChef/Chef and Red Black Tree.cpp b/CodeChef/Chef and Red Black Tree.cpp new file mode 100755 index 0000000..22347ed --- /dev/null +++ b/CodeChef/Chef and Red Black Tree.cpp @@ -0,0 +1,82 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int rootColor = 0; +ll getLCA(ll x, ll y) +{ + while(x!=y) + { + if(x > y) + { + x >>= 1; + } + if(y > x) + { + y >>= 1; + } + } + return x; +} +void flipColor() +{ + rootColor ^= 1; +} +ll lg(ll n) +{ + ll j = 0; + while(n > 0) + { + n >>= 1; + j++; + } + return j; +} +ll getSameColor(ll x) +{ + ll k = lg(x); + return k/2 + k % 2; +} +ll getDiffColor(ll x) +{ + ll k = lg(x); + return k/2; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + ll Q; + cin >> Q; + string s; + while(Q--) + { + cin >> s; + char c = s[1]; + if(c == 'i') + { + flipColor(); + } + else + { + ll x, y, total = 0, l, r, root = 1; + cin >> x >> y; + ll lca = getLCA(x, y); + if((rootColor == 0 && c == 'b') || (rootColor == 1 && c == 'r')) + { + l = getSameColor(x) - getSameColor(lca); + r = getSameColor(y) - getSameColor(lca); + total = l + r + lg(lca) % 2; + } + else + { + l = getDiffColor(x) - getDiffColor(lca); + r = getDiffColor(y) - getDiffColor(lca); + total += l + r + 1 - (lg(lca) % 2); + } + cout << total << endl; + } + } + return 0; +} diff --git a/CodeChef/Chef and Shop.cpp b/CodeChef/Chef and Shop.cpp new file mode 100755 index 0000000..f25ab62 --- /dev/null +++ b/CodeChef/Chef and Shop.cpp @@ -0,0 +1,42 @@ +#include +using namespace std; +#define endl '\n' +long long int weights[12], costs[12]; +long long int m, n, k, i, t; +long long int getmaxweight(long long int n, long long int k) +{ + if(n == 0) + { + return 0; + } + if(k <= 0) + { + return 0; + } + else + { + if(k >= costs[n]) + { + return max(weights[n] + getmaxweight(n-1, k-costs[n]), getmaxweight(n-1, k)); + } + else + { + return getmaxweight(n-1, k); + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cin >> t; + while(t--) + { + cin >> n >> k; + for(i = 1; i <= n; i++) + { + cin >> costs[i] >> weights[i]; + } + cout << getmaxweight(n, k) << endl; + } + return 0; +} diff --git a/CodeChef/Chef and Strange Formula.cpp b/CodeChef/Chef and Strange Formula.cpp new file mode 100755 index 0000000..73a8a60 --- /dev/null +++ b/CodeChef/Chef and Strange Formula.cpp @@ -0,0 +1,59 @@ +#include +using namespace std; +#define endl '\n' +unsigned long long int dp[10000001][2]; +unsigned long long int p[100001]; +int main() +{ + //freopen("test.in", "r", stdin); + ios_base::sync_with_stdio(false); cin.tie(0); + unsigned long long int n , m, sum = 0, h; + cin >> n >> m; + for(unsigned long long int i = 1; i <= n; i++) + { + cin >> p[i]; + } + dp[0][0] = 1; dp[0][1] = 0; + dp[1][0] = 1; dp[1][1] = 1; + for(unsigned long long int i = 2; i <= m; i++) + { + dp[i][0] = (i*dp[i-1][0] % m); + } + for(unsigned long long int i = 2; i <= m; i++) + { + dp[i][0] = (i*dp[i][0] % m); + dp[i][1] = ((dp[i][0] + dp[i-1][1]) % m) % m; + } + for(unsigned long long int i = 1; i <= n; i++) + { + unsigned long long int d = p[i] % m; + if(d&1) + { + unsigned long long int z = (d+1)/2; + if(p[i] >= m) + { + h = (dp[m][1] + (d*(((d*z) % m) % m) % m) % m) % m; + } + else + { + h = (dp[d][1] + (d*(((d*z) % m) % m) % m) % m) % m; + } + } + else + { + unsigned long long int z = d/2; + if(p[i] >= m) + { + h = (dp[m][1] + (d*(((z*(d+1))% m) % m) % m) % m) % m; + } + else + { + h = (dp[d][1] + (d*(((z*(d+1)) % m) % m) % m) % m) % m; + } + } + + sum = (sum + h) % m; + } + cout << sum; + return 0; +} diff --git a/CodeChef/Chef and Strings.cpp b/CodeChef/Chef and Strings.cpp new file mode 100755 index 0000000..d728cd2 --- /dev/null +++ b/CodeChef/Chef and Strings.cpp @@ -0,0 +1,123 @@ +#include +using namespace std; +#define endl '\n' +unsigned long long int ch[1000001][2], ce[1000001][2], cf[1000001][2], hc[1000001][2], he[1000001][2], hf[1000001][2], ec[1000001][2], eh[1000001][2], ef[1000001][2], fc[1000001][2], fh[1000001][2], fe[1000001][2]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + string P; + cin >> P; + unsigned long long int len = P.length(), xch = 0, xce = 0, xcf = 0, xhc = 0, xhe = 0, xhf = 0, xec = 0, xeh = 0, xef = 0, xfc = 0, xfh = 0, xfe = 0; + unsigned long long int countch = 0, countce = 0, countcf = 0, counthc = 0, counthe = 0, counthf = 0, countec = 0, counteh = 0, countef = 0, countfc = 0, countfh = 0, countfe = 0; + ch[0][0] = 0; ce[0][0] = 0; cf[0][0] = 0; hc[0][0] = 0; he[0][0] = 0; hf[0][0] = 0; ec[0][0] = 0; eh[0][0] = 0; ef[0][0] = 0; fc[0][0] = 0; fh[0][0] = 0; fe[0][0] = 0; + ch[0][1] = 0; ce[0][1] = 0; cf[0][1] = 0; hc[0][1] = 0; he[0][1] = 0; hf[0][1] = 0; ec[0][1] = 0; eh[0][1] = 0; ef[0][1] = 0; fc[0][1] = 0; fh[0][1] = 0; fe[0][1] = 0; + for(unsigned long long int i = 0; i < len; i++) + { + if(P[i] == 'c') + { + xch++; xce++; xcf++; + counthc += xhc; countec += xec; countfc += xfc; + } + else if(P[i] == 'h') + { + xhc++; xhe++; xhf++; + countch += xch; counteh += xeh; countfh += xfh; + } + else if(P[i] == 'e') + { + xec++; xeh++; xef++; + countce += xce; counthe += xhe; countfe += xfe; + } + else if(P[i] == 'f') + { + xfc++; xfh++; xfe++; + countcf += xcf; counthf += xhf; countef += xef; + } + ch[i+1][0] = countch; ch[i+1][1] = xch; + ce[i+1][0] = countce; ce[i+1][1] = xce; + cf[i+1][0] = countcf; cf[i+1][1] = xcf; + + hc[i+1][0] = counthc; hc[i+1][1] = xhc; + he[i+1][0] = counthe; he[i+1][1] = xhe; + hf[i+1][0] = counthf; hf[i+1][1] = xhf; + + ec[i+1][0] = countec; ec[i+1][1] = xec; + eh[i+1][0] = counteh; eh[i+1][1] = xeh; + ef[i+1][0] = countef; ef[i+1][1] = xef; + + fc[i+1][0] = countfc; fc[i+1][1] = xfc; + fh[i+1][0] = countfh; fh[i+1][1] = xfh; + fe[i+1][0] = countfe; fe[i+1][1] = xfe; + } + unsigned long long int Q; + cin >> Q; + while(Q--) + { + char a, b; + unsigned long long int L, R, count = 0, noOf = 0; + cin >> a >> b >> L >> R; + if(a == 'c' && b == 'h') + { + noOf = hc[R][1] - hc[L-1][1]; + count = (ch[R][0] - ch[L-1][0]) - (noOf*ch[L-1][1]); + } + else if(a == 'c' && b == 'e') + { + noOf = ec[R][1] - ec[L-1][1]; + count = (ce[R][0] - ce[L-1][0]) - (noOf*ce[L-1][1]); + } + else if(a == 'c' && b == 'f') + { + noOf = fc[R][1] - fc[L-1][1]; + count = (cf[R][0] - cf[L-1][0]) - (noOf*cf[L-1][1]); + } + else if(a == 'h' && b == 'c') + { + noOf = ch[R][1] - ch[L-1][1]; + count = (hc[R][0] - hc[L-1][0]) - (noOf*hc[L-1][1]); + } + else if(a == 'h' && b == 'e') + { + noOf = eh[R][1] - eh[L-1][1]; + count = (he[R][0] - he[L-1][0]) - (noOf*he[L-1][1]); + } + else if(a == 'h' && b == 'f') + { + noOf = fh[R][1] - fh[L-1][1]; + count = (hf[R][0] - hf[L-1][0]) - (noOf*hf[L-1][1]); + } + else if(a == 'e' && b == 'c') + { + noOf = ce[R][1] - ce[L-1][1]; + count = (ec[R][0] - ec[L-1][0]) - (noOf*ec[L-1][1]); + } + else if(a == 'e' && b == 'h') + { + noOf = he[R][1] - he[L-1][1]; + count = (eh[R][0] - eh[L-1][0]) - (noOf*eh[L-1][1]); + } + else if(a == 'e' && b == 'f') + { + noOf = fe[R][1] - fe[L-1][1]; + count = (ef[R][0] - ef[L-1][0]) - (noOf*ef[L-1][1]); + } + else if(a == 'f' && b == 'c') + { + noOf = cf[R][1] - cf[L-1][1]; + count = (fc[R][0] - fc[L-1][0]) - (noOf*fc[L-1][1]); + } + else if(a == 'f' && b == 'h') + { + noOf = hf[R][1] - hf[L-1][1]; + count = (fh[R][0] - fh[L-1][0]) - (noOf*fh[L-1][1]); + } + else if (a == 'f' && b == 'e') + { + noOf = ef[R][1] - ef[L-1][1]; + count = (fe[R][0] - fe[L-1][0]) - (noOf*fe[L-1][1]); + } + cout << count << endl; + } + return 0; +} diff --git a/CodeChef/Chef and easy problem.cpp b/CodeChef/Chef and easy problem.cpp new file mode 100755 index 0000000..754a649 --- /dev/null +++ b/CodeChef/Chef and easy problem.cpp @@ -0,0 +1,27 @@ +#include +using namespace std; +#define endl '\n' +bool wayToSort(long long int a, long long int b) {return a > b;} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + long long int N, stones = 0; + cin >> N; + long long int A[N]; + for(long long int i = 0; i < N; i++) + { + cin >> A[i]; + } + sort(A, A + N, wayToSort); + for(long long int i = 0; i < N; i+=2) + { + stones += A[i]; + } + cout << stones << endl; + } + return 0; +} diff --git a/CodeChef/Chef and insomnia.cpp b/CodeChef/Chef and insomnia.cpp new file mode 100755 index 0000000..d9221bf --- /dev/null +++ b/CodeChef/Chef and insomnia.cpp @@ -0,0 +1,104 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAXN 100011 +ll arr[MAXN], n, k; +map > indices; +map pairs; +map isPresent; +void initPairs() +{ + ll x, y, ind; + for(ll i = 0; i < n; i++) + { + x = arr[i]; + y = x - k; + for(ll j = 1; j <= round(sqrt(y)); j++) + { + if(y % j == 0) + { + if(x % (y/j) == k) + { + for(ind = 0; ind < indices[y/j].size(); ind++) + { + if(i < indices[y/j][ind]) + { + if(!isPresent[i]) + { + pairs[i] = indices[y/j][ind]; + isPresent[i] = true; + } + else if(indices[y/j][ind] < pairs[i]) + { + pairs[i] = indices[y/j][ind]; + } + } + } + } + } + if(x % j == k) + { + for(ind = 0; ind < indices[j].size(); ind++) + { + if(i < indices[j][ind]) + { + if(!isPresent[i]) + { + pairs[i] = indices[j][ind]; + isPresent[i] = true; + } + else if(indices[j][ind] < pairs[i]) + { + pairs[i] = indices[j][ind]; + } + } + } + } + } + } +} +void init() +{ + for(ll i = n-1; i >= 0; i--) + { + indices[arr[i]].push_back(i); + } + initPairs(); +} +ll arrSub(ll arr[], ll l, ll r) +{ + ll ans = 0, i, a, b; + if(l == r) + { + return 0; + } + else if(l + 1 == r) + { + return 1; + } + for(i = l; i < r; i++) + { + if(isPresent[i] && pairs[i] < r) + { + a = i; + b = pairs[i]; + return arrSub(arr, l, b) + arrSub(arr, a+1, r) - arrSub(arr, a+1, b); + } + } + return ((r-l)*(r-l+1))/2; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i; + cin >> n >> k; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + } + init(); + cout << arrSub(arr, 0, n); + return 0; +} diff --git a/CodeChef/Chef and medium problem 2.cpp b/CodeChef/Chef and medium problem 2.cpp new file mode 100755 index 0000000..d61e26f --- /dev/null +++ b/CodeChef/Chef and medium problem 2.cpp @@ -0,0 +1,92 @@ +#include +using namespace std; +#define endl '\n' +long long int arr[100001]; +set indexp[6]; +long long int n, m, i, choice, l, r, p, d, j, lower, upper, ind; +set::iterator it, itlow, itup; +vector:: iterator di; +vector del; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + cin >> n; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + if(arr[i]%2 == 0) + { + indexp[2].insert(i); + } + if(arr[i]%3 == 0) + { + indexp[3].insert(i); + } + if(arr[i]%5 == 0) + { + indexp[5].insert(i); + } + } + cin >> m; + while(m--) + { + cin >> choice; + if(choice == 1) + { + cin >> l >> r >> p; + l--; r--; + itlow = lower_bound(indexp[p].begin(), indexp[p].end(), l); + for(it = itlow; it!=indexp[p].end() ; it++) + { + ind = *it; + if(ind > r) {break;} + arr[ind] /=p; + if(arr[ind] % p) + { + del.push_back(ind); + } + } + for(di = del.begin(); di!= del.end();di++) + { + indexp[p].erase(*di); + } + del.clear(); + } + else + { + cin >> l >> d; + l--; + if(arr[l]%2 == 0) + { + indexp[2].erase(l); + } + if(arr[l]%3 == 0) + { + indexp[3].erase(l); + } + if(arr[l]%5 == 0) + { + indexp[5].erase(l); + } + if(d % 2 == 0) + { + indexp[2].insert(l); + } + if(d % 3 == 0) + { + indexp[3].insert(l); + } + if(d % 5 == 0) + { + indexp[5].insert(l); + } + arr[l] = d; + } + } + for(i = 0; i < n; i++) + { + cout << arr[i] << " "; + } + return 0; +} diff --git a/CodeChef/Chef and new recipe.cpp b/CodeChef/Chef and new recipe.cpp new file mode 100755 index 0000000..524f367 --- /dev/null +++ b/CodeChef/Chef and new recipe.cpp @@ -0,0 +1,37 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t, i; + cin >> t; + while(t--) + { + ll n, minNum = INT_MAX, sum = 0; + bool hasLessThanTwo = false; + cin >> n; + ll arr[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + if(arr[i] < 2) + { + hasLessThanTwo = true; + } + minNum = min(minNum, arr[i]); + sum += arr[i]; + } + if(hasLessThanTwo) + { + cout << -1 << endl; + } + else + { + cout << sum - minNum + 2 << endl; + } + } + return 0; +} diff --git a/CodeChef/Chef and stones.cpp b/CodeChef/Chef and stones.cpp new file mode 100755 index 0000000..4a0d9a7 --- /dev/null +++ b/CodeChef/Chef and stones.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + long long int n, k, mx = 0; + cin >> n >> k; + long long int time[n], profit[n]; + for(long long int i = 0; i < n; i++) + { + cin >> time[i]; + } + for(long long int i = 0; i < n; i++) + { + cin >> profit[i]; + } + for(long long int i = 0; i < n; i++) + { + long long int d = (k/time[i]) * profit[i]; + mx = max(mx, d); + } + cout << mx << endl; + } + return 0; +} diff --git a/CodeChef/Chef and string.cpp b/CodeChef/Chef and string.cpp new file mode 100755 index 0000000..4e54679 --- /dev/null +++ b/CodeChef/Chef and string.cpp @@ -0,0 +1,61 @@ +#include +using namespace std; +#define endl '\n' +bool str[100001]; +string s; +long long int v1[100001][2]; +long long int v2[100001][2]; +long long int v3[100001][2]; +long long int v4[100001][2]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + cin >> s; + long long int ans = 0, h, e, f, len = s.length(), ci = 0, hi = 0, ei = 0, fi = 0; + for(long long int i = 0; i < len; i++) + { + str[i] = true; + if(s[i] == 'C') + { + v1[ci][0] = i; + ci++; + } + else if(s[i] == 'H') + { + v2[hi][0] = i; + hi++; + } + else if(s[i] == 'E') + { + v3[ei][0] = i; + ei++; + } + else if(s[i] == 'F') + { + v4[fi][0] = i; + fi++; + } + } + v1[0][1] = ci; + v2[0][1] = hi; + v3[0][1] = ei; + v4[0][1] = fi; + ci = 0; hi = 0; ei = 0; fi = 0; + for(int i = 0; i < v1[0][1]; i++) + { + if(str[v1[i][0]] == true) + { + while(v2[hi][0] < v1[i][0] || str[v2[hi][0]] == false) {hi++; if(hi >= v2[0][1]){break;}} + if(hi >= v2[0][1]){break;} + while(v3[ei][0] < v2[hi][0] || str[v3[ei][0]] == false) {ei++; if(ei >= v3[0][1]) {break;}} + if(ei >= v3[0][1]) {break;} + while(v4[fi][0] < v3[ei][0] || str[v4[fi][0]] == false) {fi++; if(fi >= v4[0][1]) {break;}} + if(fi >= v4[0][1]) {break;} + str[v1[i][0]] = str[v2[hi][0]] = str[v3[ei][0]] = str[v4[fi][0]] = false; + ans++; + } + } + cout << ans << endl; + return 0; +} diff --git a/CodeChef/Chef and the Wildcard Matching.cpp b/CodeChef/Chef and the Wildcard Matching.cpp new file mode 100755 index 0000000..2d2dfef --- /dev/null +++ b/CodeChef/Chef and the Wildcard Matching.cpp @@ -0,0 +1,36 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + string x, y; + cin >> x >> y; + bool canBe = true; + for(int i = 0; i < x.length(); i++) + { + if(x[i] != y[i] && x[i] != '?' && y[i] != '?') + { + canBe = false; + break; + } + } + if(canBe) + { + cout << "Yes" << endl; + } + else + { + cout << "No" << endl; + } + } + return 0; +} diff --git a/CodeChef/Chef and the XORed Number.cpp b/CodeChef/Chef and the XORed Number.cpp new file mode 100755 index 0000000..5f1895c --- /dev/null +++ b/CodeChef/Chef and the XORed Number.cpp @@ -0,0 +1,43 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool containsAllOnes(ll n) +{ + while(n > 0) + { + if(!(n&1)) + { + return false; + } + n >>= 1; + } + return true; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, k; + cin >> n; + if(n == 1) + { + cout << 2 << endl; + continue; + } + if(containsAllOnes(n)) + { + cout << ((n+1) >> 1) - 1 << endl; + } + else + { + cout << -1 << endl; + } + } + return 0; +} diff --git a/CodeChef/Chef and voting for the best friend.cpp b/CodeChef/Chef and voting for the best friend.cpp new file mode 100755 index 0000000..e8b2661 --- /dev/null +++ b/CodeChef/Chef and voting for the best friend.cpp @@ -0,0 +1,74 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, i, sum = 0, j; + cin >> n; + ll arr[n]; + bool poss = true; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + if(arr[i] >= n) + { + poss = false; + } + sum += arr[i]; + } + if(sum != n || !poss || n == 1) + { + cout << -1; + } + else + { + ll ans[n]; vector toAdd; + for(i = 0; i < n; i++) + { + ans[i] = -1; + while(arr[i]--) + { + toAdd.push_back(i); + } + } + for(i = 0; ans[i] != -1; i++) + { + for(j = 0; j < toAdd.size(); j++) + { + if(i != toAdd[j]) + { + ans[i] = toAdd[j]; + toAdd.erase(toAdd.begin() + j); + } + } + } + ll temp; + for(i = 0; i < n; i++) + { + for(j = 0; j < n; j++) + { + if(i == ans[j] && j == ans[i]) + { + temp = ans[j]; + ans[j] = ans[i]; + ans[i] = temp; + } + } + } + for(i = 0; i < n; i++) + { + cout << ans[i] << " "; + } + cout << endl; + } + } + return 0; +} diff --git a/CodeChef/Chef-jumping.cpp b/CodeChef/Chef-jumping.cpp new file mode 100755 index 0000000..050561d --- /dev/null +++ b/CodeChef/Chef-jumping.cpp @@ -0,0 +1,18 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int a; + cin >> a; + if(a%3 == 0 || ((a-1) % 6 == 0) || a == 0) + { + cout << "yes" << endl; + } + else + { + cout << "no" << endl; + } + return 0; +} diff --git a/CodeChef/Ciel and A-B.cpp b/CodeChef/Ciel and A-B.cpp new file mode 100755 index 0000000..2a9750c --- /dev/null +++ b/CodeChef/Ciel and A-B.cpp @@ -0,0 +1,28 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll a, b, r; + cin >> a >> b; + a = a-b; + r = a % 10; + if(a - 1 == 0) + { + cout << 5 << endl; + return 0; + } + if(r != 0) + { + cout << a - 1 << endl; + } + else + { + cout << a + 1 << endl; + } + return 0; +} diff --git a/CodeChef/Ciel and Receipt.cpp b/CodeChef/Ciel and Receipt.cpp new file mode 100755 index 0000000..347b669 --- /dev/null +++ b/CodeChef/Ciel and Receipt.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(0); + int T; + cin >> T; + int arr[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048}; + while(T--) + { + int p, count = 0, power; + cin >> p; + power = log2(p)+1; + if(power > 11) + { + power = 11; + } + while(p!=0) + { + if(p >= arr[power]) + { + p-= arr[power]; + count++; + } + else + { + power--; + } + } + cout << count << endl; + } + return 0; +} diff --git a/CodeChef/Closing The Tweets.cpp b/CodeChef/Closing The Tweets.cpp new file mode 100755 index 0000000..e75a372 --- /dev/null +++ b/CodeChef/Closing The Tweets.cpp @@ -0,0 +1,44 @@ +#include +using namespace std; +#define endl '\n' +string s, in; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + long long n, k, index, i, count = 0; + string str = ""; + cin >> n >> k; + for(i = 0; i < n; i++) + { + str+='0'; + } + s = str; + while(k--) + { + cin >> in; + if(in == "CLICK") + { + cin >> index; + index--; + if(s[index] == '0') + { + count++; + s[index] = '1'; + } + else + { + count--; + s[index] = '0'; + } + cout << count << endl; + } + else + { + s = str; + count = 0; + cout << count << endl; + } + } + return 0; +} diff --git a/CodeChef/Coin Flip.cpp b/CodeChef/Coin Flip.cpp new file mode 100755 index 0000000..e20e9c5 --- /dev/null +++ b/CodeChef/Coin Flip.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int t; + cin >> t; + while(t--) + { + long long int G, I, Q, i, N; + cin >> G; + for(i = 0; i < G; i++) + { + cin >> I >> N >> Q; + if(!(N&1)) + { + cout << N/2 << endl; + } + else + { + if(I == Q) + { + cout << (N-1)/2 << endl; + } + else + { + cout << (N+1)/2 << endl; + } + } + } + } + return 0; +} diff --git a/CodeChef/Compilers and Parsers.cpp b/CodeChef/Compilers and Parsers.cpp new file mode 100755 index 0000000..36f4b61 --- /dev/null +++ b/CodeChef/Compilers and Parsers.cpp @@ -0,0 +1,37 @@ +#include +using namespace std; +#define endl '\n' +string s; +long long int l = 0, i, oc, mx; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + cin >> s; + l = oc = mx =0; + for(i = 0; i < s.length(); i++) + { + if(s[i] == '<') + { + oc++; + } + else if(s[i] == '>') + { + oc--; l++; + if(oc == 0) + { + mx = max(mx, i + 1); + } + else if(oc < 0) + { + break; + } + } + } + cout << mx << endl; + } + return 0; +} diff --git a/CodeChef/Cooling Pies.cpp b/CodeChef/Cooling Pies.cpp new file mode 100755 index 0000000..8596a18 --- /dev/null +++ b/CodeChef/Cooling Pies.cpp @@ -0,0 +1,40 @@ +#include +using namespace std; +bool wayToSort(int a, int b) {return (a > b); } +int main() +{ + //freopen("test.in", "r", stdin); + int T; + cin >> T; + while(T--) + { + long long int N, count = 0, i, j; + cin >> N; + int weights[N], limits[N]; + for(i = 0; i < N; i++) + { + cin >> weights[i]; + } + for(i = 0; i < N; i++) + { + cin >> limits[i]; + } + sort(weights, weights + N, wayToSort); + sort(limits, limits + N, wayToSort); + for(i = 0, j = 0; i < N && j < N;) + { + if(weights[i] <= limits[j]) + { + count++; + i++; j++; + } + else + { + i++; + } + } + cout << count << endl; + } + return 0; +} + diff --git a/CodeChef/Count of Maximum.cpp b/CodeChef/Count of Maximum.cpp new file mode 100755 index 0000000..ba4359f --- /dev/null +++ b/CodeChef/Count of Maximum.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; +#define endl '\n' +long long counts[10001]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int t; + cin >> t; + while(t--) + { + long long int i, n, num, max = 0, maxi = 0; + for(i = 0; i < 10001; i++) + { + counts[i] = 0; + } + cin >> n; + for(i = 0; i < n; i++) + { + cin >> num; + counts[num]++; + } + for(i = 0; i < 10001; i++) + { + if(max < counts[i]) + { + max = counts[i]; + maxi = i; + } + } + cout << maxi << " " << max << endl; + } + return 0; +} diff --git a/CodeChef/Delivering Bread.cpp b/CodeChef/Delivering Bread.cpp new file mode 100755 index 0000000..06e5e56 --- /dev/null +++ b/CodeChef/Delivering Bread.cpp @@ -0,0 +1,14 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + + } + return 0; +} diff --git a/CodeChef/Delivery Man.cpp b/CodeChef/Delivery Man.cpp new file mode 100755 index 0000000..939374d --- /dev/null +++ b/CodeChef/Delivery Man.cpp @@ -0,0 +1,56 @@ +#include +using namespace std; +#define endl '\n' +long long int getSum(long long int N, long long int A[], long long int B[], long long int x, long long int y) +{ + long long int sum = 0; + for(unsigned long long int i = 0; i < N; i++) + { + if(A[i] > B[i]) + { + if(x > 0) + { + x--; + sum += A[i]; + } + else + { + y--; + sum += B[i]; + } + + } + else + { + if(y > 0) + { + y--; + sum += B[i]; + } + else + { + x--; + sum += A[i]; + } + } + } + return sum; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int N, x , y, sum; + cin >> N >> x >> y; + long long int A[N], B[N]; + for(long long int i = 0; i < N; i++) + { + cin >> A[i]; + } + for(long long int i = 0; i < N; i++) + { + cin >> B[i]; + } + sum = max(getSum(N, A, B, x, y), getSum(N, B, A, y, x)); + cout << sum << endl; + return 0; +} diff --git a/CodeChef/Devu and Grapes.cpp b/CodeChef/Devu and Grapes.cpp new file mode 100755 index 0000000..c8068c3 --- /dev/null +++ b/CodeChef/Devu and Grapes.cpp @@ -0,0 +1,40 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, k, i, tmp, ops = 0, dist1, dist2; + cin >> n >> k; + ll arr[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + if(arr[i] % k == 0) + { + continue; + } + if(arr[i] < k) + { + ops += k - arr[i]; + arr[i] = k; + } + else + { + tmp = arr[i]/k; + dist1 = abs(arr[i] - tmp*k); + dist2 = abs(arr[i] - (tmp+1)*k); + ops += min(dist1, dist2); + } + } + cout << ops << endl; + } + return 0; +} diff --git a/CodeChef/Devu and Manhattan Distance.cpp b/CodeChef/Devu and Manhattan Distance.cpp new file mode 100755 index 0000000..6f99d58 --- /dev/null +++ b/CodeChef/Devu and Manhattan Distance.cpp @@ -0,0 +1,62 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll dists[1001][1001]; +pair arr[1001]; +ll query(ll l, ll r) +{ + ll maxD = 0, i, j, dist; + for(i = l; i < r; i++) + { + for(j = l + 1; j <= r; j++) + { + dist = abs(arr[i].first - arr[j].first) + abs(arr[i].second - arr[j].second); + maxD = max(maxD, dist); + } + } + return maxD; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, j, x, y, Q, l, r, index; + cin >> n; + char wut; + for(i = 0; i < n; i++) + { + cin >> x; + cin >> y; + arr[i] = make_pair(x, y); + } + for(i = 0; i < n-1; i++) + { + dists[i][i] = 0; + for(j = i+1; j < n; j++) + { + dists[i][j] = abs(arr[i].first - arr[j].first) + abs(arr[i].second - arr[j].second); + } + } + cin >> Q; + for(i = 0; i < Q; i++) + { + cin >> wut; + if(wut == 'Q') + { + cin >> l; + cin >> r; + cout << query(l, r); + } + else + { + cin >> index; + cin >> x; + cin >> y; + arr[index].first = x; + arr[index].second = y; + } + } + return 0; +} diff --git a/CodeChef/Devu and binary string.cpp b/CodeChef/Devu and binary string.cpp new file mode 100755 index 0000000..6959e44 --- /dev/null +++ b/CodeChef/Devu and binary string.cpp @@ -0,0 +1,104 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +char change(char c) +{ + return (c == '0') ? '1' : '0'; +} +ll countInvs(string s, string s1) +{ + ll count = 0, i; + for(i = 0; i < s.length(); i++) + { + if(s[i] != s1[i]) + { + count++; + } + } + return count; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t, n, k, i, count, j; + string s, temp; + cin >> t; + while(t--) + { + cin >> n >> k; + cin >> s; + if(k > 1) + { + vector subs; + count = 0; temp = ""; + temp += s[0]; + for(i = 1; i < s.length(); i++) + { + if(s[i] == temp[0]) + { + temp += s[i]; + } + else + { + subs.push_back(temp); + temp = ""; + temp+= s[i]; + } + } + subs.push_back(temp); + for(i = 0; i < subs.size(); i++) + { + if(subs[i].length() > k) + { + if(subs[i].length() % (k + 1)) + { + j = k; + while(j < subs[i].length() ) + { + subs[i][j] = change(subs[i][j]); + j += k + 1; + count++; + } + } + else + { + j = subs[i].length() - 2; + while(j >= 0) + { + subs[i][j] = change(subs[i][j]); + j -= k + 1; + count++; + } + } + } + } + temp = ""; + for(i = 0; i < subs.size(); i++) + { + temp += subs[i]; + } + cout << count << endl << temp << endl; + } + else + { + string c0 = "0", c1 = "1"; + for(i = 1; i < s.length(); i++) + { + c0 += change(c0[i-1]); + c1 += change(c1[i-1]); + } + ll invs0 = countInvs(s, c0), invs1 = countInvs(s, c1); + if(invs0 < invs1) + { + cout << invs0 << endl << c0 << endl; + } + else + { + cout << invs1 << endl << c1 << endl; + } + } + } + return 0; +} diff --git a/CodeChef/Double Strings.cpp b/CodeChef/Double Strings.cpp new file mode 100755 index 0000000..99315db --- /dev/null +++ b/CodeChef/Double Strings.cpp @@ -0,0 +1,19 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int t; + cin >> t; + while(t--) + { + long long int n; + cin >> n; + if(n&1){ + n--; + } + cout << n << endl; + } + return 0; +} diff --git a/CodeChef/Enormous Input Test.cpp b/CodeChef/Enormous Input Test.cpp new file mode 100755 index 0000000..323ad1c --- /dev/null +++ b/CodeChef/Enormous Input Test.cpp @@ -0,0 +1,20 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int n, k, count = 0; + cin >> n >> k; + for(long long int i = 0; i < n; i++) + { + long long int t; + cin >> t; + if(t%k == 0) + { + count++; + } + } + cout << count << endl; + return 0; +} diff --git a/CodeChef/Factorial.cpp b/CodeChef/Factorial.cpp new file mode 100755 index 0000000..5232d45 --- /dev/null +++ b/CodeChef/Factorial.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); + long long int T; + cin >> T; + while(T--) + { + long long int k, count = 0, num = 5; + cin >> k; + while((k/num )> 0) + { + count += k/num; + num*=5; + } + cout << count << endl; + } + return 0; +} diff --git a/CodeChef/Factorial1.cpp b/CodeChef/Factorial1.cpp new file mode 100755 index 0000000..20b2257 --- /dev/null +++ b/CodeChef/Factorial1.cpp @@ -0,0 +1,39 @@ +#include +using namespace std; +#define MAX 500 + +int multiply(int x, int res[], int res_size); +void factorial(int n) +{ + int res[MAX]; + res[0] = 1; + int res_size = 1; + for (int x=2; x<=n; x++) + res_size = multiply(x, res, res_size); + for (int i=res_size-1; i>=0; i--) + cout << res[i]; +} +int multiply(int x, int res[], int res_size) +{ + int carry = 0; + for (int i=0; i> n; + factorial(n); + return 0; +} diff --git a/CodeChef/Fit Squares in a Triangle.cpp b/CodeChef/Fit Squares in a Triangle.cpp new file mode 100755 index 0000000..5c6634b --- /dev/null +++ b/CodeChef/Fit Squares in a Triangle.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; +#define endl '\n' +int dp[10001]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + int s = 0, f = 0, k = 1; + dp[0] = 0; + for(int i = 1; i < 10001; i++) + { + dp[i] = s; + if(f == 1) + { + f = 0; + s+=k; + k++; + } + else + { + f++; + } + + } + while(t--) + { + int n; + cin >> n; + cout << dp[n-1] << endl; + } + return 0; +} diff --git a/CodeChef/Flipping Coins.cpp b/CodeChef/Flipping Coins.cpp new file mode 100755 index 0000000..e5fa25f --- /dev/null +++ b/CodeChef/Flipping Coins.cpp @@ -0,0 +1,93 @@ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAX 444444 +bool lazytree[MAX]; +int Heads[MAX]; +ll getMid(ll s, ll e) +{ + return (s+e)/2; +} +ll getHeads(ll l, ll r, ll start, ll end, ll node) +{ + if(start > r || end < l) + { + return 0; + } + if(lazytree[node]) + { + Heads[node] = r-l + 1 - Heads[node]; + if(l != r) + { + lazytree[2*node] = !lazytree[2*node]; + lazytree[2*node+1] = !lazytree[2*node+1]; + } + lazytree[node] = false; + } + if(l >= start && r <= end) + { + return Heads[node]; + } + ll mid = getMid(l, r); + return getHeads(l, mid, start, end, 2*node) + getHeads(mid+1, r, start, end, 2*node + 1); +} +void update(ll node, ll l, ll r, ll start, ll end) +{ + if(lazytree[node]) + { + Heads[node] = r-l +1 - Heads[node]; + if(l != r) + { + lazytree[2*node] = !lazytree[2*node]; + lazytree[2*node+1] = !lazytree[2*node+1]; + } + lazytree[node] = false; + } + if(start > r || end < l) + { + return; + } + if(l >= start && r <= end) + { + Heads[node] = r-l +1 - Heads[node]; + if(l != r) + { + lazytree[2*node] = !lazytree[2*node]; + lazytree[2*node+1] = !lazytree[2*node+1]; + } + } + else + { + ll mid = getMid(l, r); + update(2*node, l, mid, start, end); + update(2*node+1, mid+1, r, start, end); + Heads[node] = Heads[2*node] + Heads[2*node+1]; + } + +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + ll type, N, Q, A, B; + cin >> N >> Q; + for(ll i = 0; i < MAX; i++) + { + lazytree[i] = false; + Heads[i] = 0; + } + while(Q--) + { + cin >> type >> A >> B; + if(type) + { + cout << getHeads(0, N-1, A, B, 1) << endl; + } + else + { + update(1, 0, N-1, A, B); + } + } + return 0; +} diff --git a/CodeChef/GCD and LCM.cpp b/CodeChef/GCD and LCM.cpp new file mode 100755 index 0000000..4b4b0c2 --- /dev/null +++ b/CodeChef/GCD and LCM.cpp @@ -0,0 +1,30 @@ +/* Written By Manav Aggarwal */ +#include +#define ll long long + +ll gcd(ll a, ll b) { + if(b == 0) + { + return a; + } + else + { + return gcd(b, a%b); + } +} +ll lcm(ll a, ll b){return (a*b)/gcd(a,b);} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll a, b, hcf, lc; + cin >> a >> b; + hcf = gcd(a, b); + lc = lcm(a, b); + cout << hcf << " " << lc << endl; + } + return 0; +} diff --git a/CodeChef/Greedy Puppy.cpp b/CodeChef/Greedy Puppy.cpp new file mode 100755 index 0000000..06f062e --- /dev/null +++ b/CodeChef/Greedy Puppy.cpp @@ -0,0 +1,24 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, k, i, maxCoins = 0, rem; + cin >> n >> k; + for(i = 1; i <= k; i++) + { + maxCoins = max(maxCoins, n%i); + } + cout << maxCoins << endl; + } + return 0; +} diff --git a/CodeChef/Harrenhal.cpp b/CodeChef/Harrenhal.cpp new file mode 100755 index 0000000..074861a --- /dev/null +++ b/CodeChef/Harrenhal.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; +#define endl '\n' +string h; +bool is_palin(string s) +{ + for(long i = 0; i < s.length(); i++) + { + if(s[i] != s[s.length()-i-1]) + { + return false; + } + } + return true; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + cin >> h; + if(is_palin(h)) + { + cout << 1 << endl; + } + else + { + cout << 2 << endl; + } + } + return 0; +} diff --git a/CodeChef/Holes in the text.cpp b/CodeChef/Holes in the text.cpp new file mode 100755 index 0000000..6104de2 --- /dev/null +++ b/CodeChef/Holes in the text.cpp @@ -0,0 +1,29 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + int holes = 0; + string s; + cin >> s; + for(int i = 0; i < s.length(); i++) + { + if(s[i] == 'A' || s[i] == 'D' || s[i] == 'O' || s[i] == 'P' || s[i] == 'Q' || s[i] == 'R') + { + holes += 1; + } + else if(s[i] == 'B') + { + holes += 2; + } + + } + cout << holes << endl; + } + return 0; +} diff --git a/CodeChef/How to Operate a Robot - Failed.cpp b/CodeChef/How to Operate a Robot - Failed.cpp new file mode 100755 index 0000000..6ac4d8c --- /dev/null +++ b/CodeChef/How to Operate a Robot - Failed.cpp @@ -0,0 +1,98 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define mp make_pair + +/*This is some amazing code*/ +class custComp +{ +public: + bool operator() (const pair >, map, bool> >& lhs, const pair >, map, bool> >&rhs) const + { + return (lhs.first.first.length() > rhs.first.first.length()); + } +}; + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll sideLength, i, j, numberOpen = 0; + cin >> sideLength; + char maze[sideLength][sideLength], dir; + pair curr = mp(0, 0), next; + map, bool> visited; + visited[curr] = true; + pair >, map, bool> > temp; + string seq; + for(i = 0; i < sideLength; i++) + { + for(j = 0; j < sideLength; j++) + { + cin >> maze[i][j]; + if(maze[i][j] == '.') + { + numberOpen++; + } + } + } + priority_queue >, map, bool> >, vector >, map, bool> > >, custComp > frontier; + frontier.push(mp(mp("", mp(0, 0)), visited)); + while(!frontier.empty()) + { + temp = frontier.top(); + frontier.pop(); + curr = temp.first.second; + seq = temp.first.first; + if(seq.length() > sideLength*(sideLength+7) || (seq.length() >= 4 && seq[seq.length()-1] == seq[seq.length()-2] && seq[seq.length()-2] == seq[seq.length()-3] && seq[seq.length()-3] == seq[seq.length()-4])) + { + continue; + } + if(temp.second.size() >= numberOpen) + { + break; + } + for(i = 0; i < 4; i++) + { + seq = temp.first.first; + visited = temp.second; + switch(i) + { + case 0: + next.first = curr.first; + next.second = curr.second+1; + dir = 'R'; + break; + case 1: + next.first = curr.first + 1; + next.second = curr.second; + dir = 'D'; + break; + case 2: + next.first = curr.first; + next.second = curr.second - 1; + dir = 'L'; + break; + case 3: + next.first = curr.first - 1; + next.second = curr.second; + dir = 'U'; + break; + } + if(next.first >= 0 && next.first < sideLength && next.second >= 0 && next.second < sideLength && maze[next.first][next.second] == '.') + { + seq += dir; + visited[next] = true; + frontier.push(mp(mp(seq, next), visited)); + } + } + } + cout << seq << endl; + } + return 0; +} diff --git a/CodeChef/How to Operate a Robot.cpp b/CodeChef/How to Operate a Robot.cpp new file mode 100755 index 0000000..f441231 --- /dev/null +++ b/CodeChef/How to Operate a Robot.cpp @@ -0,0 +1,176 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define mp make_pair + +/*This is some amazing code*/ + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll sideLength, i, j; + cin >> sideLength; + char maze[sideLength][sideLength]; + map > shift; + shift['R'] = mp(1, 0); + shift['D'] = mp(0, 1); + shift['L'] = mp(-1, 0); + shift['U'] = mp(0, -1); + pair curr = mp(0, 0), next, change; + string seq = "", pattern1 = "DRUR", pattern2 = "DLUL", pattern3 = "LDR", pattern4 = "RDL", pattern5 = "LDDR", pattern6 = "RDDL", currPattern; + map, bool> visited; + for(i = 0; i < sideLength; i++) + { + for(j = 0; j < sideLength; j++) + { + cin >> maze[i][j]; + } + } + visited[curr] = true; + while(visited.size() != sideLength*sideLength) + { + i = 0; + while(true) + { + change = shift[pattern1[i]]; + curr.first += change.first; + curr.second += change.second; + if(curr.first >= sideLength || curr.first < 0 || curr.second >= sideLength || curr.second < 0) + { + curr.first -= change.first; + curr.second -= change.second; + if(i == 0) + { + i = 4; + } + if(pattern1[i-1] == 'D') + { + currPattern = pattern3; + } + else //the character is U + { + currPattern = pattern5; + } + break; + } + visited[curr] = true; + seq += pattern1[i++]; + if(i == 4) + { + i = 0; + } + } + if(visited.size() >= sideLength*sideLength) + { + break; + } + if(sideLength - curr.second != 2) + { + for(i = 0; i < currPattern.size(); i++) + { + change = shift[currPattern[i]]; + curr.first += change.first; + curr.second += change.second; + if(curr.first >= sideLength || curr.first < 0 || curr.second >= sideLength || curr.second < 0) + { + curr.first -= change.first; + curr.second -= change.second; + if(i == 0) + { + i = 4; + } + if(pattern1[i-1] == 'D') + { + currPattern = pattern3; + } + else //the character is U + { + currPattern = pattern5; + } + break; + } + visited[curr] = true; + seq += currPattern[i]; + } + } + + if(visited.size() >= sideLength*sideLength) + { + break; + } + i = 0; + while(true) + { + change = shift[pattern2[i]]; + curr.first += change.first; + curr.second += change.second; + if(curr.first >= sideLength || curr.first < 0 || curr.second >= sideLength || curr.second < 0) + { + curr.first -= change.first; + curr.second -= change.second; + if(i == 0) + { + i = 4; + } + if(pattern1[i-1] == 'D') + { + currPattern = pattern4; + } + else //the character is U + { + currPattern = pattern6; + } + break; + } + visited[curr] = true; + seq += pattern2[i++]; + if(i == 4) + { + i = 0; + } + } + if(visited.size() >= sideLength*sideLength) + { + break; + } + if(sideLength - curr.second != 2) + { + for(i = 0; i < currPattern.size(); i++) + { + change = shift[currPattern[i]]; + curr.first += change.first; + curr.second += change.second; + if(curr.first >= sideLength || curr.first < 0 || curr.second >= sideLength || curr.second < 0) + { + curr.first -= change.first; + curr.second -= change.second; + if(i == 0) + { + i = 4; + } + if(pattern1[i-1] == 'D') + { + currPattern = pattern3; + } + else //the character is U + { + currPattern = pattern5; + } + break; + } + visited[curr] = true; + seq += currPattern[i]; + } + } + + } + cout << seq << endl; + } + return 0; +} diff --git a/CodeChef/Indhiran II.cpp b/CodeChef/Indhiran II.cpp new file mode 100755 index 0000000..3dfe381 --- /dev/null +++ b/CodeChef/Indhiran II.cpp @@ -0,0 +1,47 @@ +#include +#include +using namespace std; +#define endl '\n' +bool isPal(string s) +{ + int len2 = s.length()/2; + for(int i = 0; i < len2; i++) + { + int v = (int) s[i]; + int v1 = (int) s[s.length()-i-1]; + if(v != v1) + { + return false; + } + } + return true; +} +int main() +{ + int t; + cin >> t; + cin.ignore( numeric_limits::max(), '\n' ); + while(t--) + { + string s; + getline(cin, s); + string str = ""; + for(int i = 0; i < s.length(); i++) + { + int v = (int) s[i]; + if((v >= 65 && v <= 90) || (v >= 97 && v <= 122) || (v >= 48 && v <= 57) || (v==32) ) + { + str += s[i]; + } + } + if(isPal(str) == true) + { + cout << "YES" << endl; + } + else + { + cout << "NO" << endl; + } + } + return 0; +} diff --git a/CodeChef/Kingdom Unity.cpp b/CodeChef/Kingdom Unity.cpp new file mode 100755 index 0000000..16ec957 --- /dev/null +++ b/CodeChef/Kingdom Unity.cpp @@ -0,0 +1,79 @@ +/* Written by Manav Aggarwal */ +#include +using namespace std; +int adj[3001][3001][2]; +int graph[3001][3001]; +vector critints; +int main() +{ + int t; + cin >> t; + while(t--) + { + critints.clear(); + int N, M, k = 1, Cost; + cin >> N >> M >> Cost; + for(int i = 1; i <= N; i++) + { + for(int j = 1; j <= N; j++) + { + graph[i][j] = 0; + } + } + for(int i = 0; i < M;i++) + { + int i1, i2; + cin >> i1 >> i2; + i1++; i2++; + graph[i1][i2] = 1; + graph[i2][i1] = 1; + } + for(int i = 1 ; i <= N; i++) + { + int c = 0; + for(int j = 1; j <= N; j++) + { + if(graph[i][j] == 1) + { + adj[i][c][0] = j; + c++; + } + } + adj[i][0][1] = c; + + } + set visited; + for(int k = 1; k <= N; k++) + { + int d = 0, v = 0; + visited.clear(); + stack S; + d = (k == 1) ? 2 : 1 ; + S.push(d); + while(!S.empty()) + { + v = S.top(); + S.pop(); + if(visited.count(v) == 0) + { + visited.insert(v); + for(int i = 0; i < adj[v][0][1]; i++) + { + if (adj[v][i][0] != k) + { + S.push(adj[v][i][0]); + } + } + } + } + if(visited.size() != N-1) + { + critints.push_back(k); + } + } + Cost *= critints.size(); + cout << Cost << endl; + } + + +} diff --git a/CodeChef/Lack of Logic.cpp b/CodeChef/Lack of Logic.cpp new file mode 100755 index 0000000..cdcf965 --- /dev/null +++ b/CodeChef/Lack of Logic.cpp @@ -0,0 +1,42 @@ +#include +#include +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + for(int k = 0; k < t; k++) + { + char out, s[400]; + gets(s); + int alpha[26], i, flag = 0; + for(i = 0; i < strlen(s); i++) + { + if((s[i] - 'a' >= 0 && s[i] - 'a' <= 25 ) || (s[i] - 'A' >= 0 && s[i] - 'A' <= 25)) + { + if(s[i] < (int)'a') + { + s[i] = char((int)s[i] + int(' ')); + } + alpha[s[i] - 'a'] = 0; + } + } + for(i = 0; i < 26; i++) + { + if(alpha[i] != 0) + { + flag = 1; + cout << char(i + 'a') << char(10); + break; + } + } + if(flag == 0) + { + cout << '~' << char(10); + } + } + return 0; +} diff --git a/CodeChef/Let us play with rank list.cpp b/CodeChef/Let us play with rank list.cpp new file mode 100755 index 0000000..ec02edb --- /dev/null +++ b/CodeChef/Let us play with rank list.cpp @@ -0,0 +1,44 @@ +#include +using namespace std; +int main() +{ int T; + cin >> T; + while(T--) + { + long long int n, s, sum, count; + cin >> n >> s; + sum = n*(n+1)/2; + if(sum == s) + { + count = 0; + } + else if(n == s) + { + count = s - 1; + } + else + { + count = 0; + int a[n+1]; + for(int i = 0; i <= n; i++) + { + a[i] = i; + } + for(int i = n; i >= 1; i--) + { + if(sum > (s+a[i]-1)) + { + s+= a[i] - 1; + count++; + } + else + { + count++; + break; + } + } + } + cout << count << endl; + } + return 0; +} diff --git a/CodeChef/Library and Headcount.cpp b/CodeChef/Library and Headcount.cpp new file mode 100755 index 0000000..13aae7a --- /dev/null +++ b/CodeChef/Library and Headcount.cpp @@ -0,0 +1,49 @@ +#include +using namespace std; +#define endl '\n' +long long int n; +string s; +string names[50001]; +long long int vals[50001]; +long long int srch(string k, long long int n) +{ + for(int i = 0; i < n; i++) + { + if(names[i] == k) + { + return i; + } + } + return -1; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + int t; + cin >> t; + while(t--) + { + long long int n, val, sum = 0; + cin >> n; + for(long long int i = 0; i < n; i++) + { + cin >> s; + val = srch(s, n); + if (val != -1) + { + vals[i] = !(vals[i]); + } + else + { + vals[i] = 1; + } + } + for(long long int i = 0; i < n; i++) + { + sum += vals[i]; + } + cout << sum << endl; + } + return 0; +} diff --git a/CodeChef/Little Elephant and Lemonade.cpp b/CodeChef/Little Elephant and Lemonade.cpp new file mode 100755 index 0000000..31c34bb --- /dev/null +++ b/CodeChef/Little Elephant and Lemonade.cpp @@ -0,0 +1,28 @@ +#include +using namespace std; +#define endl '\n' +long long P[10001], bottles[101][101]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + long long n, m, i, j, C; + cin >> n >> m; + for(i = 0; i < m; i++) + { + cin >> P[i]; + } + for(i = 0; i < n; i++) + { + cin >> C; + for(j = 0; j < C; j++) + { + cin >> bottles[i][j]; + } + } + } + return 0; +} diff --git a/CodeChef/Lucky Four.cpp b/CodeChef/Lucky Four.cpp new file mode 100755 index 0000000..41dc217 --- /dev/null +++ b/CodeChef/Lucky Four.cpp @@ -0,0 +1,24 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int t; + cin >> t; + while(t--) + { + string s; + long long int count = 0; + cin >> s; + for(int i = 0; i < s.length(); i++) + { + if(s[i] == '4') + { + count++; + } + } + cout << count << endl; + } + return 0; +} diff --git a/CodeChef/Lucky number.cpp b/CodeChef/Lucky number.cpp new file mode 100755 index 0000000..a980b65 --- /dev/null +++ b/CodeChef/Lucky number.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + unsigned long long int t; + cin >> t; + while(t--) + { + unsigned long long int n, p = 1; + cin >> n; + while(p < n) + { + p = p << 1; + } + p = p >> 1; + cout << ((n - p) << 1) + 1 << endl; + } + return 0; +} diff --git a/CodeChef/Magic Tricks.cpp b/CodeChef/Magic Tricks.cpp new file mode 100755 index 0000000..7c5ab01 --- /dev/null +++ b/CodeChef/Magic Tricks.cpp @@ -0,0 +1,38 @@ +#include +using namespace std; +#define endl '\n' +long long int matrix[26][1000001]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + string s; + cin >> s; + long long int len = s.length(), i , j, val; + for(i = 0; i < 26; i++) + { + for(j = 0; j <= len; j++) + { + matrix[i][j] = 0; + } + } + for(i = 1; i <= len; i++) + { + val = s[i-1] - 'a'; + for(j = 0; j < 26; j++) + { + matrix[j][i] = matrix[j][i-1]; + } + matrix[val][i]++; + } + long long int q; + cin >> q; + while(q--) + { + char c; + long long int l, r; + cin >> c >> l >> r; + cout << matrix[c - 'a'][r] - matrix[c - 'a'][l-1] << endl;; + } + return 0; +} diff --git a/CodeChef/Marbles (Binomial Coeff.).cpp b/CodeChef/Marbles (Binomial Coeff.).cpp new file mode 100755 index 0000000..69864ee --- /dev/null +++ b/CodeChef/Marbles (Binomial Coeff.).cpp @@ -0,0 +1,24 @@ +#include +using namespace std; +#define endl '\n' +#define MAX 1000001 +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + long long n, k, p = 1, i; + cin >> n >> k; + n--; k--; + k = min(k, n-k); + for(i = 1; i <= k; i++) + { + p*= n--; + p/=i; + } + cout << p << endl; + } + return 0; +} diff --git a/CodeChef/Maximize Value.cpp b/CodeChef/Maximize Value.cpp new file mode 100755 index 0000000..1955f83 --- /dev/null +++ b/CodeChef/Maximize Value.cpp @@ -0,0 +1,44 @@ +#include +using namespace std; +#define endl '\n' +void knpsck(long long weights[], long long vals[], int n, int Capacity) +{ + long long knapsack[n+1][Capacity+1]; + long long i, w, t; + for(i = 0; i <= n; i++) + { + for(w = 0; w <= Capacity; w++) + { + if(i == 0 || w == 0) + { + knapsack[i][w] = 0; + } + else + { + if(weights[i - 1] > w) + { + knapsack[i][w] = knapsack[i-1][w]; + } + else + { + t = knapsack[i][w] = max(knapsack[i-1][w], vals[i-1] + knapsack[i-1][w - weights[i-1]]); + } + } + } + } + cout << knapsack[n][Capacity] << endl; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int x, n, i; + cin >> x >> n; + long long weights[n], vals[n]; + for(i = 0; i < n; i++) + { + cin >> weights[i]; + cin >> vals[i]; + } + knpsck(weights, vals, n, x); + return 0; +} diff --git a/CodeChef/Mike and Matrices.cpp b/CodeChef/Mike and Matrices.cpp new file mode 100755 index 0000000..f2a7b3a --- /dev/null +++ b/CodeChef/Mike and Matrices.cpp @@ -0,0 +1,49 @@ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pii pair +ll matrix[501][501]; +pii arr[250001]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, m, i, j, l, e1 = 0, e2 = 0; + bool v1 = true, v2 = true; + cin >> n >> m; + for(i = 1; i <= n; i++) + { + for(j = 1; j <= m; j++) + { + cin >> matrix[i][j]; + } + } + cin >> l; + for(i = 1; i <= l; i++) + { + cin >> arr[i].first >> arr[i].second; + } + for(i = 1; i <= l; i++) + { + if(arr[i].first <= n && arr[i].second <= m && v1) + { + e1 += matrix[arr[i].first][arr[i].second]; + } + else + { + e1 = -1; + v1 = false; + } + if(arr[i].second <= n && arr[i].first <= m && v2) + { + e2 += matrix[arr[i].second][arr[i].first]; + } + else + { + e2 = -1; + v2 = false; + } + } + cout << max(e1, e2) << endl; + return 0; +} diff --git a/CodeChef/Minimize a String.cpp b/CodeChef/Minimize a String.cpp new file mode 100755 index 0000000..8ce262d --- /dev/null +++ b/CodeChef/Minimize a String.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + int n; + cin >> n; + string s; + cin >> s; + char large = 'A', small = 'Z'; + for(int i = 0; i < n; i++) + { + if(s[i] > large) + { + large = s[i]; + } + else if(s[i] <= small) + { + small = s[i]; + } + } + + + } + return 0; +} diff --git a/CodeChef/Modulo.cpp b/CodeChef/Modulo.cpp new file mode 100755 index 0000000..da2d1bc --- /dev/null +++ b/CodeChef/Modulo.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t = 10; + set n; + while(t--) + { + n.clear(); + for(int i = 0; i < 10; i++) + { + int k; + cin >> k; + k = k % 42; + n.insert(k); + } + cout << n.size() << endl; + } + return 0; +} diff --git a/CodeChef/Mr. Ignus.cpp b/CodeChef/Mr. Ignus.cpp new file mode 100755 index 0000000..ed2e03c --- /dev/null +++ b/CodeChef/Mr. Ignus.cpp @@ -0,0 +1,29 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int t; + cin >> t; + while(t--) + { + long long int N, lelo, nalo, nalo_naya; + cin >> N; + long long int judges[N]; + for(long long int i = 0; i < N; i++) + { + cin >> judges[i]; + } + lelo = judges[0]; + nalo = 0; + for (long long int i = 1; i < N; i++) + { + nalo_naya = (lelo > nalo)? lelo: nalo; + lelo = nalo + judges[i]; + nalo = nalo_naya; + } + cout << ((lelo > nalo)? lelo : nalo) << endl;; + } + return 0; +} diff --git a/CodeChef/Nth number in the series.cpp b/CodeChef/Nth number in the series.cpp new file mode 100755 index 0000000..381574e --- /dev/null +++ b/CodeChef/Nth number in the series.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; +void find(int n) +{ + string arr[n+1]; + arr[0] = ""; + int size = 1, m = 1; + while (size <= n) + { + for (int i=0; i> n; + find(n); + return 0; +} diff --git a/CodeChef/Number of Factors.cpp b/CodeChef/Number of Factors.cpp new file mode 100755 index 0000000..d5e61fd --- /dev/null +++ b/CodeChef/Number of Factors.cpp @@ -0,0 +1,33 @@ +#include +using namespace std; +#define endl '\n' +long long int numfacts(long long int n) +{ + long long int count = 1; + for(int i = 1; i <= sqrt(n); i++) + { + if(n%i == 0) + { + count++; + } + } + return count; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + long long int N, num = 1, k; + cin >> N; + for(int i = 0; i < N; i++) + { + cin >> k; + num *= k; + } + cout << numfacts(num) << endl; + } + return 0; +} diff --git a/CodeChef/Odd.cpp b/CodeChef/Odd.cpp new file mode 100755 index 0000000..215190b --- /dev/null +++ b/CodeChef/Odd.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; +#define endl '\n' +long long int power(long long int len) +{ + long long p = 1; + while(len--) + { + p*=2; + } + return p; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int t; + cin >> t; + while(t--) + { + long long int n; + cin >> n; + long long int len = log2(n); + cout << power(len) << endl; + } + return 0; +} diff --git a/CodeChef/One Dimensional Kingdoms.cpp b/CodeChef/One Dimensional Kingdoms.cpp new file mode 100755 index 0000000..15e0b30 --- /dev/null +++ b/CodeChef/One Dimensional Kingdoms.cpp @@ -0,0 +1,35 @@ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pi pair +bool wayToSort(pi a, pi b) { return a.second < b.second;} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + vector v; + ll N, a , b, i; + cin >> N; + for(i = 0; i < N; i++) + { + cin >> a >> b; + v.push_back(pi(a,b)); + } + ll prev = -1, cnt = 0; + sort(v.begin(), v.end(), wayToSort); + for(i = 0; i < N; i++) + { + if(v[i].first > prev) + { + cnt++; + prev = v[i].second; + } + } + cout << cnt << endl; + } + return 0; +} diff --git a/CodeChef/Packaging Cupcakes.cpp b/CodeChef/Packaging Cupcakes.cpp new file mode 100755 index 0000000..77dcbcd --- /dev/null +++ b/CodeChef/Packaging Cupcakes.cpp @@ -0,0 +1,14 @@ +#include +using namespace std; +int main() +{ + int T; + cin >> T; + while(T--) + { + long long int N; + cin >> N; + cout << N/2 + 1 << endl; + } + return 0; +} diff --git a/CodeChef/Pair of numbers.cpp b/CodeChef/Pair of numbers.cpp new file mode 100755 index 0000000..41e2bc1 --- /dev/null +++ b/CodeChef/Pair of numbers.cpp @@ -0,0 +1,41 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int n, flag =0; + cin >> n; + int array[n]; + for(int i = 0; i < n; i++) + { + cin >> array[i]; + } + int x, s; + cin >> x; + for(int i = 0 ; i < n; i++) + { + s = x - array[i]; + for(int j = i+1; j < n; j++) + { + if(array[j] == s) + { + flag = 1; + break; + } + } + if(flag == 1) + { + break; + } + } + if(flag == 1) + { + cout << "YES"; + } + else + { + cout << "NO"; + } + return 0; +} diff --git a/CodeChef/Pairwise AND sum.cpp b/CodeChef/Pairwise AND sum.cpp new file mode 100755 index 0000000..4b323d7 --- /dev/null +++ b/CodeChef/Pairwise AND sum.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; +#define endl '\n' +long long int power[30]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int n, sum = 0, i , j, k; + for(i = 0; i < 30; i++) + { + power[i] = 0; + } + cin >> n; + for(i = 0; i < n; i++) + { + cin >> k; + for(j = 0; j < 30; j++) + { + if(k & (1 << j)) + { + power[j]++; + } + } + } + for(i = 0; i < 30; i++) + { + sum += (power[i] * (power[i] - 1))* (1 << i); + } + cout << sum/2 << endl; + return 0; +} diff --git a/CodeChef/Palindrome.cpp b/CodeChef/Palindrome.cpp new file mode 100755 index 0000000..dcb7996 --- /dev/null +++ b/CodeChef/Palindrome.cpp @@ -0,0 +1,66 @@ +#include +#include +using namespace std; +#define endl '\n' +int power10(int k) +{ + int p = 1; + while(k--) + { + p*= 10; + } + return p; +} +int reversednum(int n) +{ + int num = 0; + int len = log10(n)+1; + int dup = len - 1; + while(len--) + { + int e = n % 10; + int k = power10(dup); + num = e*k + num; + n/=10; dup--; + } + return num; +} +bool isPal(int n) +{ + string s; + ostringstream convert; + convert << n; + s = convert.str(); + for(int i = 0; i < s.length()/2; i++) + { + if(s[i] != s[s.length()-i-1]) + { + return false; + } + } + return true; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + int n, sum, count = 0; + cin >> n; + sum = n; + while(true) + { + sum = sum + reversednum(sum); + count++; + if(isPal(sum)) + { + break; + } + } + cout << count << " " << sum << endl; + } + return 0; +} diff --git a/CodeChef/Piece of Cake.cpp b/CodeChef/Piece of Cake.cpp new file mode 100755 index 0000000..cf0fa14 --- /dev/null +++ b/CodeChef/Piece of Cake.cpp @@ -0,0 +1,35 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + string s; + cin >> s; + int flag = 0, i, len = s.length(); + int alpha[26]; + for(i = 0; i < 26; i++) + { + alpha[i] = 0; + } + for(i = 0; i < len; i++) + { + alpha[s[i] - 'a']++; + } + for(i = 0; i < 26; i++) + { + if(alpha[i] == len-alpha[i]) + { + flag = 1; + break; + } + } + cout << ((flag) ? "YES" : "NO"); + cout << endl; + } + return 0; +} diff --git a/CodeChef/Presti Digitator.cpp b/CodeChef/Presti Digitator.cpp new file mode 100755 index 0000000..b3d7bab --- /dev/null +++ b/CodeChef/Presti Digitator.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; +#define endl '\n' +unsigned long long int dp[21]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + dp[1] = 0; dp[2] = 1; + for(int i = 3; i < 21; i++) + { + dp[i] = (i-1) * (dp[i-2] + dp[i-1]); + } + while(t--) + { + int n; + cin >> n; + cout << dp[n] << endl; + } + return 0; +} diff --git a/CodeChef/Primality Test.cpp b/CodeChef/Primality Test.cpp new file mode 100755 index 0000000..bc92dd5 --- /dev/null +++ b/CodeChef/Primality Test.cpp @@ -0,0 +1,48 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +const ll M = 111111; +bool arr[M]; +void sieveOfEratosthenes() +{ + ll i, j; + for(i = 2; i < M; i++) + { + arr[i] = true; + } + for(i = 2; i < sqrt(M); i++) + { + if(arr[i] == true) + { + for(j = 2*i; j < M; j += i) + { + arr[j] = false; + } + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll t; + cin >> t; + while(t--) + { + ll n; + cin >> n; + if(arr[n]) + { + cout << "yes"; + } + else + { + cout << "no"; + } + cout << endl; + } + return 0; +} diff --git a/CodeChef/Prime Generator.cpp b/CodeChef/Prime Generator.cpp new file mode 100755 index 0000000..f0f0371 --- /dev/null +++ b/CodeChef/Prime Generator.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll arr[3402] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537, 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609, 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091, 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161, 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227, 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377, 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433, 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491, 9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587, 9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649, 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733, 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857, 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973, 10007, 10009, 10037, 10039, 10061, 10067, 10069, 10079, 10091, 10093, 10099, 10103, 10111, 10133, 10139, 10141, 10151, 10159, 10163, 10169, 10177, 10181, 10193, 10211, 10223, 10243, 10247, 10253, 10259, 10267, 10271, 10273, 10289, 10301, 10303, 10313, 10321, 10331, 10333, 10337, 10343, 10357, 10369, 10391, 10399, 10427, 10429, 10433, 10453, 10457, 10459, 10463, 10477, 10487, 10499, 10501, 10513, 10529, 10531, 10559, 10567, 10589, 10597, 10601, 10607, 10613, 10627, 10631, 10639, 10651, 10657, 10663, 10667, 10687, 10691, 10709, 10711, 10723, 10729, 10733, 10739, 10753, 10771, 10781, 10789, 10799, 10831, 10837, 10847, 10853, 10859, 10861, 10867, 10883, 10889, 10891, 10903, 10909, 10937, 10939, 10949, 10957, 10973, 10979, 10987, 10993, 11003, 11027, 11047, 11057, 11059, 11069, 11071, 11083, 11087, 11093, 11113, 11117, 11119, 11131, 11149, 11159, 11161, 11171, 11173, 11177, 11197, 11213, 11239, 11243, 11251, 11257, 11261, 11273, 11279, 11287, 11299, 11311, 11317, 11321, 11329, 11351, 11353, 11369, 11383, 11393, 11399, 11411, 11423, 11437, 11443, 11447, 11467, 11471, 11483, 11489, 11491, 11497, 11503, 11519, 11527, 11549, 11551, 11579, 11587, 11593, 11597, 11617, 11621, 11633, 11657, 11677, 11681, 11689, 11699, 11701, 11717, 11719, 11731, 11743, 11777, 11779, 11783, 11789, 11801, 11807, 11813, 11821, 11827, 11831, 11833, 11839, 11863, 11867, 11887, 11897, 11903, 11909, 11923, 11927, 11933, 11939, 11941, 11953, 11959, 11969, 11971, 11981, 11987, 12007, 12011, 12037, 12041, 12043, 12049, 12071, 12073, 12097, 12101, 12107, 12109, 12113, 12119, 12143, 12149, 12157, 12161, 12163, 12197, 12203, 12211, 12227, 12239, 12241, 12251, 12253, 12263, 12269, 12277, 12281, 12289, 12301, 12323, 12329, 12343, 12347, 12373, 12377, 12379, 12391, 12401, 12409, 12413, 12421, 12433, 12437, 12451, 12457, 12473, 12479, 12487, 12491, 12497, 12503, 12511, 12517, 12527, 12539, 12541, 12547, 12553, 12569, 12577, 12583, 12589, 12601, 12611, 12613, 12619, 12637, 12641, 12647, 12653, 12659, 12671, 12689, 12697, 12703, 12713, 12721, 12739, 12743, 12757, 12763, 12781, 12791, 12799, 12809, 12821, 12823, 12829, 12841, 12853, 12889, 12893, 12899, 12907, 12911, 12917, 12919, 12923, 12941, 12953, 12959, 12967, 12973, 12979, 12983, 13001, 13003, 13007, 13009, 13033, 13037, 13043, 13049, 13063, 13093, 13099, 13103, 13109, 13121, 13127, 13147, 13151, 13159, 13163, 13171, 13177, 13183, 13187, 13217, 13219, 13229, 13241, 13249, 13259, 13267, 13291, 13297, 13309, 13313, 13327, 13331, 13337, 13339, 13367, 13381, 13397, 13399, 13411, 13417, 13421, 13441, 13451, 13457, 13463, 13469, 13477, 13487, 13499, 13513, 13523, 13537, 13553, 13567, 13577, 13591, 13597, 13613, 13619, 13627, 13633, 13649, 13669, 13679, 13681, 13687, 13691, 13693, 13697, 13709, 13711, 13721, 13723, 13729, 13751, 13757, 13759, 13763, 13781, 13789, 13799, 13807, 13829, 13831, 13841, 13859, 13873, 13877, 13879, 13883, 13901, 13903, 13907, 13913, 13921, 13931, 13933, 13963, 13967, 13997, 13999, 14009, 14011, 14029, 14033, 14051, 14057, 14071, 14081, 14083, 14087, 14107, 14143, 14149, 14153, 14159, 14173, 14177, 14197, 14207, 14221, 14243, 14249, 14251, 14281, 14293, 14303, 14321, 14323, 14327, 14341, 14347, 14369, 14387, 14389, 14401, 14407, 14411, 14419, 14423, 14431, 14437, 14447, 14449, 14461, 14479, 14489, 14503, 14519, 14533, 14537, 14543, 14549, 14551, 14557, 14561, 14563, 14591, 14593, 14621, 14627, 14629, 14633, 14639, 14653, 14657, 14669, 14683, 14699, 14713, 14717, 14723, 14731, 14737, 14741, 14747, 14753, 14759, 14767, 14771, 14779, 14783, 14797, 14813, 14821, 14827, 14831, 14843, 14851, 14867, 14869, 14879, 14887, 14891, 14897, 14923, 14929, 14939, 14947, 14951, 14957, 14969, 14983, 15013, 15017, 15031, 15053, 15061, 15073, 15077, 15083, 15091, 15101, 15107, 15121, 15131, 15137, 15139, 15149, 15161, 15173, 15187, 15193, 15199, 15217, 15227, 15233, 15241, 15259, 15263, 15269, 15271, 15277, 15287, 15289, 15299, 15307, 15313, 15319, 15329, 15331, 15349, 15359, 15361, 15373, 15377, 15383, 15391, 15401, 15413, 15427, 15439, 15443, 15451, 15461, 15467, 15473, 15493, 15497, 15511, 15527, 15541, 15551, 15559, 15569, 15581, 15583, 15601, 15607, 15619, 15629, 15641, 15643, 15647, 15649, 15661, 15667, 15671, 15679, 15683, 15727, 15731, 15733, 15737, 15739, 15749, 15761, 15767, 15773, 15787, 15791, 15797, 15803, 15809, 15817, 15823, 15859, 15877, 15881, 15887, 15889, 15901, 15907, 15913, 15919, 15923, 15937, 15959, 15971, 15973, 15991, 16001, 16007, 16033, 16057, 16061, 16063, 16067, 16069, 16073, 16087, 16091, 16097, 16103, 16111, 16127, 16139, 16141, 16183, 16187, 16189, 16193, 16217, 16223, 16229, 16231, 16249, 16253, 16267, 16273, 16301, 16319, 16333, 16339, 16349, 16361, 16363, 16369, 16381, 16411, 16417, 16421, 16427, 16433, 16447, 16451, 16453, 16477, 16481, 16487, 16493, 16519, 16529, 16547, 16553, 16561, 16567, 16573, 16603, 16607, 16619, 16631, 16633, 16649, 16651, 16657, 16661, 16673, 16691, 16693, 16699, 16703, 16729, 16741, 16747, 16759, 16763, 16787, 16811, 16823, 16829, 16831, 16843, 16871, 16879, 16883, 16889, 16901, 16903, 16921, 16927, 16931, 16937, 16943, 16963, 16979, 16981, 16987, 16993, 17011, 17021, 17027, 17029, 17033, 17041, 17047, 17053, 17077, 17093, 17099, 17107, 17117, 17123, 17137, 17159, 17167, 17183, 17189, 17191, 17203, 17207, 17209, 17231, 17239, 17257, 17291, 17293, 17299, 17317, 17321, 17327, 17333, 17341, 17351, 17359, 17377, 17383, 17387, 17389, 17393, 17401, 17417, 17419, 17431, 17443, 17449, 17467, 17471, 17477, 17483, 17489, 17491, 17497, 17509, 17519, 17539, 17551, 17569, 17573, 17579, 17581, 17597, 17599, 17609, 17623, 17627, 17657, 17659, 17669, 17681, 17683, 17707, 17713, 17729, 17737, 17747, 17749, 17761, 17783, 17789, 17791, 17807, 17827, 17837, 17839, 17851, 17863, 17881, 17891, 17903, 17909, 17911, 17921, 17923, 17929, 17939, 17957, 17959, 17971, 17977, 17981, 17987, 17989, 18013, 18041, 18043, 18047, 18049, 18059, 18061, 18077, 18089, 18097, 18119, 18121, 18127, 18131, 18133, 18143, 18149, 18169, 18181, 18191, 18199, 18211, 18217, 18223, 18229, 18233, 18251, 18253, 18257, 18269, 18287, 18289, 18301, 18307, 18311, 18313, 18329, 18341, 18353, 18367, 18371, 18379, 18397, 18401, 18413, 18427, 18433, 18439, 18443, 18451, 18457, 18461, 18481, 18493, 18503, 18517, 18521, 18523, 18539, 18541, 18553, 18583, 18587, 18593, 18617, 18637, 18661, 18671, 18679, 18691, 18701, 18713, 18719, 18731, 18743, 18749, 18757, 18773, 18787, 18793, 18797, 18803, 18839, 18859, 18869, 18899, 18911, 18913, 18917, 18919, 18947, 18959, 18973, 18979, 19001, 19009, 19013, 19031, 19037, 19051, 19069, 19073, 19079, 19081, 19087, 19121, 19139, 19141, 19157, 19163, 19181, 19183, 19207, 19211, 19213, 19219, 19231, 19237, 19249, 19259, 19267, 19273, 19289, 19301, 19309, 19319, 19333, 19373, 19379, 19381, 19387, 19391, 19403, 19417, 19421, 19423, 19427, 19429, 19433, 19441, 19447, 19457, 19463, 19469, 19471, 19477, 19483, 19489, 19501, 19507, 19531, 19541, 19543, 19553, 19559, 19571, 19577, 19583, 19597, 19603, 19609, 19661, 19681, 19687, 19697, 19699, 19709, 19717, 19727, 19739, 19751, 19753, 19759, 19763, 19777, 19793, 19801, 19813, 19819, 19841, 19843, 19853, 19861, 19867, 19889, 19891, 19913, 19919, 19927, 19937, 19949, 19961, 19963, 19973, 19979, 19991, 19993, 19997, 20011, 20021, 20023, 20029, 20047, 20051, 20063, 20071, 20089, 20101, 20107, 20113, 20117, 20123, 20129, 20143, 20147, 20149, 20161, 20173, 20177, 20183, 20201, 20219, 20231, 20233, 20249, 20261, 20269, 20287, 20297, 20323, 20327, 20333, 20341, 20347, 20353, 20357, 20359, 20369, 20389, 20393, 20399, 20407, 20411, 20431, 20441, 20443, 20477, 20479, 20483, 20507, 20509, 20521, 20533, 20543, 20549, 20551, 20563, 20593, 20599, 20611, 20627, 20639, 20641, 20663, 20681, 20693, 20707, 20717, 20719, 20731, 20743, 20747, 20749, 20753, 20759, 20771, 20773, 20789, 20807, 20809, 20849, 20857, 20873, 20879, 20887, 20897, 20899, 20903, 20921, 20929, 20939, 20947, 20959, 20963, 20981, 20983, 21001, 21011, 21013, 21017, 21019, 21023, 21031, 21059, 21061, 21067, 21089, 21101, 21107, 21121, 21139, 21143, 21149, 21157, 21163, 21169, 21179, 21187, 21191, 21193, 21211, 21221, 21227, 21247, 21269, 21277, 21283, 21313, 21317, 21319, 21323, 21341, 21347, 21377, 21379, 21383, 21391, 21397, 21401, 21407, 21419, 21433, 21467, 21481, 21487, 21491, 21493, 21499, 21503, 21517, 21521, 21523, 21529, 21557, 21559, 21563, 21569, 21577, 21587, 21589, 21599, 21601, 21611, 21613, 21617, 21647, 21649, 21661, 21673, 21683, 21701, 21713, 21727, 21737, 21739, 21751, 21757, 21767, 21773, 21787, 21799, 21803, 21817, 21821, 21839, 21841, 21851, 21859, 21863, 21871, 21881, 21893, 21911, 21929, 21937, 21943, 21961, 21977, 21991, 21997, 22003, 22013, 22027, 22031, 22037, 22039, 22051, 22063, 22067, 22073, 22079, 22091, 22093, 22109, 22111, 22123, 22129, 22133, 22147, 22153, 22157, 22159, 22171, 22189, 22193, 22229, 22247, 22259, 22271, 22273, 22277, 22279, 22283, 22291, 22303, 22307, 22343, 22349, 22367, 22369, 22381, 22391, 22397, 22409, 22433, 22441, 22447, 22453, 22469, 22481, 22483, 22501, 22511, 22531, 22541, 22543, 22549, 22567, 22571, 22573, 22613, 22619, 22621, 22637, 22639, 22643, 22651, 22669, 22679, 22691, 22697, 22699, 22709, 22717, 22721, 22727, 22739, 22741, 22751, 22769, 22777, 22783, 22787, 22807, 22811, 22817, 22853, 22859, 22861, 22871, 22877, 22901, 22907, 22921, 22937, 22943, 22961, 22963, 22973, 22993, 23003, 23011, 23017, 23021, 23027, 23029, 23039, 23041, 23053, 23057, 23059, 23063, 23071, 23081, 23087, 23099, 23117, 23131, 23143, 23159, 23167, 23173, 23189, 23197, 23201, 23203, 23209, 23227, 23251, 23269, 23279, 23291, 23293, 23297, 23311, 23321, 23327, 23333, 23339, 23357, 23369, 23371, 23399, 23417, 23431, 23447, 23459, 23473, 23497, 23509, 23531, 23537, 23539, 23549, 23557, 23561, 23563, 23567, 23581, 23593, 23599, 23603, 23609, 23623, 23627, 23629, 23633, 23663, 23669, 23671, 23677, 23687, 23689, 23719, 23741, 23743, 23747, 23753, 23761, 23767, 23773, 23789, 23801, 23813, 23819, 23827, 23831, 23833, 23857, 23869, 23873, 23879, 23887, 23893, 23899, 23909, 23911, 23917, 23929, 23957, 23971, 23977, 23981, 23993, 24001, 24007, 24019, 24023, 24029, 24043, 24049, 24061, 24071, 24077, 24083, 24091, 24097, 24103, 24107, 24109, 24113, 24121, 24133, 24137, 24151, 24169, 24179, 24181, 24197, 24203, 24223, 24229, 24239, 24247, 24251, 24281, 24317, 24329, 24337, 24359, 24371, 24373, 24379, 24391, 24407, 24413, 24419, 24421, 24439, 24443, 24469, 24473, 24481, 24499, 24509, 24517, 24527, 24533, 24547, 24551, 24571, 24593, 24611, 24623, 24631, 24659, 24671, 24677, 24683, 24691, 24697, 24709, 24733, 24749, 24763, 24767, 24781, 24793, 24799, 24809, 24821, 24841, 24847, 24851, 24859, 24877, 24889, 24907, 24917, 24919, 24923, 24943, 24953, 24967, 24971, 24977, 24979, 24989, 25013, 25031, 25033, 25037, 25057, 25073, 25087, 25097, 25111, 25117, 25121, 25127, 25147, 25153, 25163, 25169, 25171, 25183, 25189, 25219, 25229, 25237, 25243, 25247, 25253, 25261, 25301, 25303, 25307, 25309, 25321, 25339, 25343, 25349, 25357, 25367, 25373, 25391, 25409, 25411, 25423, 25439, 25447, 25453, 25457, 25463, 25469, 25471, 25523, 25537, 25541, 25561, 25577, 25579, 25583, 25589, 25601, 25603, 25609, 25621, 25633, 25639, 25643, 25657, 25667, 25673, 25679, 25693, 25703, 25717, 25733, 25741, 25747, 25759, 25763, 25771, 25793, 25799, 25801, 25819, 25841, 25847, 25849, 25867, 25873, 25889, 25903, 25913, 25919, 25931, 25933, 25939, 25943, 25951, 25969, 25981, 25997, 25999, 26003, 26017, 26021, 26029, 26041, 26053, 26083, 26099, 26107, 26111, 26113, 26119, 26141, 26153, 26161, 26171, 26177, 26183, 26189, 26203, 26209, 26227, 26237, 26249, 26251, 26261, 26263, 26267, 26293, 26297, 26309, 26317, 26321, 26339, 26347, 26357, 26371, 26387, 26393, 26399, 26407, 26417, 26423, 26431, 26437, 26449, 26459, 26479, 26489, 26497, 26501, 26513, 26539, 26557, 26561, 26573, 26591, 26597, 26627, 26633, 26641, 26647, 26669, 26681, 26683, 26687, 26693, 26699, 26701, 26711, 26713, 26717, 26723, 26729, 26731, 26737, 26759, 26777, 26783, 26801, 26813, 26821, 26833, 26839, 26849, 26861, 26863, 26879, 26881, 26891, 26893, 26903, 26921, 26927, 26947, 26951, 26953, 26959, 26981, 26987, 26993, 27011, 27017, 27031, 27043, 27059, 27061, 27067, 27073, 27077, 27091, 27103, 27107, 27109, 27127, 27143, 27179, 27191, 27197, 27211, 27239, 27241, 27253, 27259, 27271, 27277, 27281, 27283, 27299, 27329, 27337, 27361, 27367, 27397, 27407, 27409, 27427, 27431, 27437, 27449, 27457, 27479, 27481, 27487, 27509, 27527, 27529, 27539, 27541, 27551, 27581, 27583, 27611, 27617, 27631, 27647, 27653, 27673, 27689, 27691, 27697, 27701, 27733, 27737, 27739, 27743, 27749, 27751, 27763, 27767, 27773, 27779, 27791, 27793, 27799, 27803, 27809, 27817, 27823, 27827, 27847, 27851, 27883, 27893, 27901, 27917, 27919, 27941, 27943, 27947, 27953, 27961, 27967, 27983, 27997, 28001, 28019, 28027, 28031, 28051, 28057, 28069, 28081, 28087, 28097, 28099, 28109, 28111, 28123, 28151, 28163, 28181, 28183, 28201, 28211, 28219, 28229, 28277, 28279, 28283, 28289, 28297, 28307, 28309, 28319, 28349, 28351, 28387, 28393, 28403, 28409, 28411, 28429, 28433, 28439, 28447, 28463, 28477, 28493, 28499, 28513, 28517, 28537, 28541, 28547, 28549, 28559, 28571, 28573, 28579, 28591, 28597, 28603, 28607, 28619, 28621, 28627, 28631, 28643, 28649, 28657, 28661, 28663, 28669, 28687, 28697, 28703, 28711, 28723, 28729, 28751, 28753, 28759, 28771, 28789, 28793, 28807, 28813, 28817, 28837, 28843, 28859, 28867, 28871, 28879, 28901, 28909, 28921, 28927, 28933, 28949, 28961, 28979, 29009, 29017, 29021, 29023, 29027, 29033, 29059, 29063, 29077, 29101, 29123, 29129, 29131, 29137, 29147, 29153, 29167, 29173, 29179, 29191, 29201, 29207, 29209, 29221, 29231, 29243, 29251, 29269, 29287, 29297, 29303, 29311, 29327, 29333, 29339, 29347, 29363, 29383, 29387, 29389, 29399, 29401, 29411, 29423, 29429, 29437, 29443, 29453, 29473, 29483, 29501, 29527, 29531, 29537, 29567, 29569, 29573, 29581, 29587, 29599, 29611, 29629, 29633, 29641, 29663, 29669, 29671, 29683, 29717, 29723, 29741, 29753, 29759, 29761, 29789, 29803, 29819, 29833, 29837, 29851, 29863, 29867, 29873, 29879, 29881, 29917, 29921, 29927, 29947, 29959, 29983, 29989, 30011, 30013, 30029, 30047, 30059, 30071, 30089, 30091, 30097, 30103, 30109, 30113, 30119, 30133, 30137, 30139, 30161, 30169, 30181, 30187, 30197, 30203, 30211, 30223, 30241, 30253, 30259, 30269, 30271, 30293, 30307, 30313, 30319, 30323, 30341, 30347, 30367, 30389, 30391, 30403, 30427, 30431, 30449, 30467, 30469, 30491, 30493, 30497, 30509, 30517, 30529, 30539, 30553, 30557, 30559, 30577, 30593, 30631, 30637, 30643, 30649, 30661, 30671, 30677, 30689, 30697, 30703, 30707, 30713, 30727, 30757, 30763, 30773, 30781, 30803, 30809, 30817, 30829, 30839, 30841, 30851, 30853, 30859, 30869, 30871, 30881, 30893, 30911, 30931, 30937, 30941, 30949, 30971, 30977, 30983, 31013, 31019, 31033, 31039, 31051, 31063, 31069, 31079, 31081, 31091, 31121, 31123, 31139, 31147, 31151, 31153, 31159, 31177, 31181, 31183, 31189, 31193, 31219, 31223, 31231, 31237, 31247, 31249, 31253, 31259, 31267, 31271, 31277, 31307, 31319, 31321, 31327, 31333, 31337, 31357, 31379, 31387, 31391, 31393, 31397, 31469, 31477, 31481, 31489, 31511, 31513, 31517, 31531, 31541, 31543, 31547, 31567, 31573, 31583, 31601, 31607, 31627}; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t, i, j, m, n, y; + cin >> t; + while(t--) + { + cin >> m >> n; + for(i = m; i <= n; ++i) + { + bool flg = (i == 1) ? false : true; + y = sqrt(i); + for(j = 0; arr[j] <= y && j < 3402; ++j) + { + if(i % arr[j] == 0) + { + flg = false; + y = 0; + } + } + if(flg == true) + { + cout << i << endl; + } + } + cout << endl; + } + return 0; +} diff --git a/CodeChef/Prime palindromes.cpp b/CodeChef/Prime palindromes.cpp new file mode 100755 index 0000000..ccb30d5 --- /dev/null +++ b/CodeChef/Prime palindromes.cpp @@ -0,0 +1,19 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int arr[] = {1, 3, 5, 7, 11, 101, 131, 151, 181, 191, 313, 353, 373, 383, 727, 757, 787, 797, 919, 929, 10301, 10501, 10601, 11311, 11411, 12421, 12721, 12821, 13331, 13831, 13931, 14341, 14741, 15451, 15551, 16061, 16361, 16561, 16661, 17471, 17971, 18181, 18481, 19391, 19891, 19991, 30103, 30203, 30403, 30703, 30803, 31013, 31513, 32323, 32423, 33533, 34543, 34843, 35053, 35153, 35353, 35753, 36263, 36563, 37273, 37573, 38083, 38183, 38783, 39293, 70207, 70507, 70607, 71317, 71917, 72227, 72727, 73037, 73237, 73637, 74047, 74747, 75557, 76367, 76667, 77377, 77477, 77977, 78487, 78787, 78887, 79397, 79697, 79997, 90709, 91019, 93139, 93239, 93739, 94049, 94349, 94649, 94849, 94949, 95959, 96269, 96469, 96769, 97379, 97579, 97879, 98389, 98689, 1003001, 1008001, 1022201, 1028201, 1035301, 1043401, 1055501, 1062601, 1065601, 1074701, 1082801, 1085801, 1092901, 1093901}; + long long int n; + cin >> n; + for(int i = 0; i >= 0; i++) + { + if(arr[i] >= n) + { + cout << arr[i] << endl; + break; + } + } + return 0; +} diff --git a/CodeChef/Problem 1.cpp b/CodeChef/Problem 1.cpp new file mode 100755 index 0000000..55a4ec9 --- /dev/null +++ b/CodeChef/Problem 1.cpp @@ -0,0 +1,42 @@ +#include +using namespace std; +#define endl '\n' +int power10(int k) +{ + int p = 1; + while(k--) + { + p*= 10; + } + return p; +} +int reversednum(int n) +{ + int num = 0; + int len = log10(n)+1; + int dup = len - 1; + while(len--) + { + int e = n % 10; + int k = power10(dup); + num = e*k + num; + n/=10; dup--; + } + return num; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + int n, n1, sum = 0; + cin >> n >> n1; + n = reversednum(n); + n1 = reversednum(n1); + sum = n + n1; + cout << reversednum(sum) << endl; + } + return 0; +} diff --git a/CodeChef/Problem 2.cpp b/CodeChef/Problem 2.cpp new file mode 100755 index 0000000..88ed273 --- /dev/null +++ b/CodeChef/Problem 2.cpp @@ -0,0 +1,36 @@ +#include +using namespace std; +bool isPalindrome(int a); +unsigned long long int nextPal(unsigned long long int x); +int main() +{ + int noOfTestCases; + cin >> noOfTestCases; + while(noOfTestCases--) + { + unsigned long long int num; + cin >> num; + cout << nextPal(num) << endl; + } + return 0; +} +bool isPalindrome( unsigned long long int a) +{ + unsigned long long int num = a; + unsigned long long int palA = 0; + while(a!=0) + { + int r = a%10; + a/=10; + palA = palA*10 + r; + } + return (num == palA) ? true : false; +} +unsigned long long int nextPal( unsigned long long int x) +{ + do + { + x++; + } while(!(isPalindrome(x))); + return x; +} diff --git a/CodeChef/Problem 3.cpp b/CodeChef/Problem 3.cpp new file mode 100755 index 0000000..78332d0 --- /dev/null +++ b/CodeChef/Problem 3.cpp @@ -0,0 +1,35 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + int flag = 0, i, j = 0, k = 0; + string A, B; + cin >> A >> B; + for(i = k; i < A.length(); i++) + { + if(j < 5 && A[i] == B[j]) + { + j++; + } + else + { + j = 0; + i = k; + k++; + } + if(j == 5) + { + flag = 1; + break; + } + } + cout << flag << endl; + } + return 0; +} diff --git a/CodeChef/Pronites.cpp b/CodeChef/Pronites.cpp new file mode 100755 index 0000000..ae63773 --- /dev/null +++ b/CodeChef/Pronites.cpp @@ -0,0 +1,48 @@ +#include +using namespace std; +#define endl '\n' +int max(int a, int b) +{ + return (a > b)? a : b; +} +int min4(int a, int b, int c, int d, int e, int f, int g) +{ + return min(min(min(min(min(min(a, b), c), d), e), f), g); +} +int lcs(string X, string Y, int n) +{ + int L[n+1][n+1]; + int i, j; + for (i=0; i<=n; i++) + { + for (j=0; j<=n; j++) + { + if (i == 0 || j == 0) + L[i][j] = 0; + + else if (X[i-1] == Y[j-1]) + L[i][j] = L[i-1][j-1] + 1; + + else + L[i][j] = max(L[i-1][j], L[i][j-1]); + } + } + return L[n][n]; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + int t; + cin >> t; + while(t--) + { + int n, sum = 0; + cin >> n; + string s1, s2, s3, s4; + cin >> s1 >> s2 >> s3 >> s4; + int len = min4(lcs(s1, s2, n), lcs(s2, s3, n), lcs(s3, s4, n), lcs(s4, s1, n), lcs(s4, s2, n), lcs(s2, s3, n), lcs(s1, s3, n)); + cout << len << endl; + } + return 0; +} diff --git a/CodeChef/Puppy and GCD.cpp b/CodeChef/Puppy and GCD.cpp new file mode 100755 index 0000000..28b06b2 --- /dev/null +++ b/CodeChef/Puppy and GCD.cpp @@ -0,0 +1,26 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll i, j, count = 0, n, d, bound; + cin >> n >> d; + bound = n/d; + count += bound; + for(i = 2; i <= bound; i++) + { + count += bound - bound/i - 1; + } + cout << count << endl; + } + return 0; +} diff --git a/CodeChef/Puppy and Game.cpp b/CodeChef/Puppy and Game.cpp new file mode 100755 index 0000000..0c068f0 --- /dev/null +++ b/CodeChef/Puppy and Game.cpp @@ -0,0 +1,25 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll a,b; + cin>> a >> b; + if(a % 2 && b % 2) + { + cout << "Vanka" << endl; + } + else + { + cout << "Tuzik" << endl; + } + } + return 0; +} diff --git a/CodeChef/Racing Horses.cpp b/CodeChef/Racing Horses.cpp new file mode 100755 index 0000000..f13e188 --- /dev/null +++ b/CodeChef/Racing Horses.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(0); + int T; + cin >> T; + while(T--) + { + long long int n, minm = LONG_MAX; + cin >> n; + long long int horses[n]; + for(int i = 0; i < n; i++) + { + cin >> horses[i]; + } + sort(horses, horses + n); + for(int i = 1; i < n; i++) + { + minm = min(minm, abs(horses[i] - horses[i-1])); + } + cout << minm << endl; + } + return 0; +} diff --git a/CodeChef/Reduce Time.cpp b/CodeChef/Reduce Time.cpp new file mode 100755 index 0000000..d564584 --- /dev/null +++ b/CodeChef/Reduce Time.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; +#define endl '\n' +long long int rt[100]; +void reduce_time() +{ + rt[0] = 1; + rt[1] = 2; + for(int i = 2; i < 100; i++) + { + rt[i] = rt[i-1] + rt[i-1]; + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + reduce_time(); + int n; + cin >> n; + cout << rt[n]; + return 0; +} diff --git a/CodeChef/Riled.cpp b/CodeChef/Riled.cpp new file mode 100755 index 0000000..d6f77be --- /dev/null +++ b/CodeChef/Riled.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + long long int val = 0, i; + string s; + cin >> s; + for(i = 0; i < s.length(); i++) + { + val += (int)(s[i]); + } + val /= s.length(); + cout << (char)(val) << endl; + } + return 0; +} diff --git a/CodeChef/Rising Population.cpp b/CodeChef/Rising Population.cpp new file mode 100755 index 0000000..97089a8 --- /dev/null +++ b/CodeChef/Rising Population.cpp @@ -0,0 +1,53 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int T; + cin >> T; + while(T--) + { + int alphaM[26], alphaW[26]; + bool flag = true; + for(int i = 0; i < 26; i++) + { + alphaM[i] = 0; + } + for(int i = 0; i < 26; i++) + { + alphaW[i] = 0; + } + string M , W; + char temp; + cin >> M >> W; + if(M.length() != W.length()) + { + flag = false; + } + else + { + for(int i = 0; i < M.length(); i++) + { + temp = M[i] - 'a'; + alphaM[temp]++; + } + for(int i = 0; i < W.length(); i++) + { + temp = W[i] - 'a'; + alphaW[temp]++; + } + for(int i = 0; i < 26; i++) + { + if(alphaW[i] != alphaM[i]) + { + flag = false; + break; + } + } + } + string out = (flag == true) ? "YES" : "NO"; + cout << out << endl; + } + return 0; +} diff --git a/CodeChef/Root of The Problem.cpp b/CodeChef/Root of The Problem.cpp new file mode 100755 index 0000000..0dff969 --- /dev/null +++ b/CodeChef/Root of The Problem.cpp @@ -0,0 +1,23 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + int n, id, sum, root; + cin >> n; + root = 0; + while(n--) + { + cin >> id >> sum; + root += id - sum; + } + cout << root << endl; + } + return 0; +} diff --git a/CodeChef/Save Olive.cpp b/CodeChef/Save Olive.cpp new file mode 100755 index 0000000..fb72f76 --- /dev/null +++ b/CodeChef/Save Olive.cpp @@ -0,0 +1,32 @@ +#include +using namespace std; +#define endl '\n' +long long int W[100000], sums[100001]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + sums[0] = 0; + long long int T; + cin >> T; + while(T--) + { + long long int N, M, sum = 0, mx = 0, j = 0; + cin >> N; + for(long long int i = 0; i < N; i++) + { + cin >> W[i]; + sums[i+1] = 0; + sums[i+1] = sums[i] + W[i]; + } + cin >> M; + for(int i = M; i <= N; i++) + { + j = i-M; + sum = sums[i] - sums[j]; + mx = max(mx, sum); + } + cout << mx << endl; + } + return 0; +} diff --git a/CodeChef/Sereja and vectors.cpp b/CodeChef/Sereja and vectors.cpp new file mode 100755 index 0000000..06e5e56 --- /dev/null +++ b/CodeChef/Sereja and vectors.cpp @@ -0,0 +1,14 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + + } + return 0; +} diff --git a/CodeChef/Sereja and votes.cpp b/CodeChef/Sereja and votes.cpp new file mode 100755 index 0000000..b4040f0 --- /dev/null +++ b/CodeChef/Sereja and votes.cpp @@ -0,0 +1,28 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + int n, sum = 0, zerosebadekitne = 0; + cin >> n; + for(int i = 0; i < n; i++) + { + int k; cin >> k; sum += k; + k > 0 ? zerosebadekitne++ : zerosebadekitne; + } + if(sum >= 100 && sum-zerosebadekitne < 100) + { + cout << "YES" << endl; + } + else + { + cout << "NO" << endl; + } + } + return 0; +} diff --git a/CodeChef/Set Difference.cpp b/CodeChef/Set Difference.cpp new file mode 100755 index 0000000..439a366 --- /dev/null +++ b/CodeChef/Set Difference.cpp @@ -0,0 +1,48 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll SummedPowersOf2[111111]; //Stores the number of powers of 2 added till i +void initPowers() +{ + SummedPowersOf2[0] = 0; + SummedPowersOf2[1] = 1; + ll mod = 1e9 + 7, i; + for(i = 2; i < 111111; i++) + { + SummedPowersOf2[i] = (SummedPowersOf2[i-1] * 2) % mod; + } + for(i = 2; i < 111111; i++) + { + SummedPowersOf2[i] = (SummedPowersOf2[i] + SummedPowersOf2[i-1]) % mod; + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + initPowers(); + ll t, mod = 1e9 + 7; + cin >> t; + while(t--) + { + ll n, i, sum = 0; + cin >> n; + ll arr[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + } + sort(arr, arr + n); + for(i = n-1; i >= 0; i--) + { + sum = ( (sum + ( ( arr[i] * ( (SummedPowersOf2[i] - SummedPowersOf2[n - i - 1]) % mod) ) % mod) ) % mod ); + if(sum < 0) + { + sum += mod; + } + } + cout << sum << endl; + } + return 0; +} diff --git a/CodeChef/Small Factorials.cpp b/CodeChef/Small Factorials.cpp new file mode 100755 index 0000000..8d31635 --- /dev/null +++ b/CodeChef/Small Factorials.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; +#define endl '\n' +unsigned long long int dp[101]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int T; + cin >> T; + dp[0] = 1; + for(long long int i = 1; i <= 100; i++) + { + dp[i] = i*dp[i-1]; + } + while(T--) + { + long long int n; + cin >> n; + cout << dp[n] << endl; + } + return 0; +} diff --git a/CodeChef/Snape and ladder.cpp b/CodeChef/Snape and ladder.cpp new file mode 100755 index 0000000..bd30921 --- /dev/null +++ b/CodeChef/Snape and ladder.cpp @@ -0,0 +1,19 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + double B, LS, min , max; + cin >> B >> LS; + min = sqrt((LS*LS) - (B*B)); + max = sqrt((LS*LS) + (B*B)); + + cout << fixed << min << " " << max << endl; + } + return 0; +} diff --git a/CodeChef/Statues.cpp b/CodeChef/Statues.cpp new file mode 100755 index 0000000..8e3864a --- /dev/null +++ b/CodeChef/Statues.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int n, t = 1; + cin >> n; + while(n) + { + long long int sum = 0, i, d, m = 0; + long long int arr[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + sum += arr[i]; + } + d = sum/n; + for(i = 0; i < n; i++) + { + if((d - arr[i]) > 0) + { + m += (d-arr[i]); + } + } + cout << "Set #" << t << endl << "The minimum number of moves is " << m << "." << endl << endl; + t++; + cin >> n; + } + return 0; +} diff --git a/CodeChef/Steady Tables.cpp b/CodeChef/Steady Tables.cpp new file mode 100755 index 0000000..88c7470 --- /dev/null +++ b/CodeChef/Steady Tables.cpp @@ -0,0 +1,98 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +const ll limit = 4000, mod = 1000000000; +int C[limit+1][limit+1]; +int binomialCoeff(int n, int k) +{ + int i, j; + + for (i = 0; i <= n; i++) + { + for (j = 0; j <= min(i, k); j++) + { + if (j == 0 || j == i) + C[i][j] = 1; + + else + C[i][j] = (C[i-1][j-1] + C[i-1][j]) % mod; + } + } + + return C[n][k] % mod; +} + +ll composition(ll n, ll k) +{ + return C[n+k-1][k-1]; +} + +vector > nums; +vector combs; +ll modulo(ll base, ll exponent) +{ + ll x = 1; + ll y = base; + while (exponent > 0) + { + if (exponent % 2 == 1) + x = (x * y) % mod; + y = (y * y) % mod; + exponent = exponent / 2; + } + return x % mod; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + binomialCoeff(limit, limit); + ll t; + cin >> t; + while(t--) + { + ll n, m, i, j, productNum, productDenom; + double sum = 0; + cin >> n >> m; + ll compositions[m+1]; + for(i = 0; i <= m; i++) + { + compositions[i] = composition(i, m); + } + if(n == 1) + { + for(i = 0; i <= m; i++) + { + sum = ((ll)sum + compositions[i]) % mod; + } + cout << sum << endl; + break; + } + if(m == 1) + { + cout << compositions[m] << endl; + break; + } + for(i = 0; i <= m; i++) + { + productNum = modulo(compositions[i], n+m); + productDenom = 1; + for(j = 0; j <= m; j++) + { + if(j != i) + { + productDenom = (productDenom * (compositions[i]-compositions[j])) % mod; + } + } + if(productDenom == 0) + { + productDenom = 1; + } + sum = fmod(sum + ((double)productNum/productDenom), mod) ; + } + cout << (ll)sum << endl; + } + return 0; +} diff --git a/CodeChef/Stepford houses.cpp b/CodeChef/Stepford houses.cpp new file mode 100755 index 0000000..6d13a58 --- /dev/null +++ b/CodeChef/Stepford houses.cpp @@ -0,0 +1,29 @@ +#include +using namespace std; +#define endl '\n' +bool waytoSort(pair a, pair b) +{ + return (a.first < b.first); +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int n, count = 0; + cin >> n; + pair houses[n]; + for(int i = 0; i < n; i++) + { + cin >> houses[i].first; + houses[i].second = i; + } + sort(houses, houses + n, waytoSort); + for(int i = 0; i < n; i++) + { + if(i < houses[i].second) + { + count += houses[i].second - i; + } + } + cout << count << endl; + return 0; +} diff --git a/CodeChef/Stone.cpp b/CodeChef/Stone.cpp new file mode 100755 index 0000000..39eed85 --- /dev/null +++ b/CodeChef/Stone.cpp @@ -0,0 +1,50 @@ +#include +using namespace std; +#define endl '\n' +long long int arr[100001]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int n, k, mx = INT_MIN, i, mx2 = INT_MIN; + cin >> n >> k; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + mx = max(mx, arr[i]); + } + if(k == 0) + { + for(i = 0; i < n; i++) + { + cout << arr[i] << " "; + } + } + else + { + for(i = 0; i < n; i++) + { + arr[i] = mx - arr[i]; + mx2 = max(mx2, arr[i]); + } + if(k%2) + { + for(i = 0; i < n; i++) + { + cout << arr[i] << " "; + } + } + else + { + for(i = 0; i < n; i++) + { + arr[i] = mx2 - arr[i]; + } + for(i = 0; i < n; i++) + { + cout << arr[i] << " "; + } + } + } + + return 0; +} diff --git a/CodeChef/Strategy for the world cup.cpp b/CodeChef/Strategy for the world cup.cpp new file mode 100755 index 0000000..520854e --- /dev/null +++ b/CodeChef/Strategy for the world cup.cpp @@ -0,0 +1,48 @@ +#include +using namespace std; +#define endl '\n' +int count( int S[], int m, int n, int b, int l ) +{ + int i, j, x, y; + + // We need n+1 rows as the table is consturcted in bottom up manner using + // the base case 0 value case (n = 0) + int table[n+1][m]; + + // Fill the enteries for 0 value case (n = 0) + for (i=0; i= 0)? table[i - S[j]][j]: 0; + + // Count of solutions excluding S[j] + y = (j >= 1)? table[i][j-1]: 0; + + // total count + table[i][j] = x + y; + } + } + return table[n][m-1]; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + int arr[4] = {0, 4, 6 , -1}; + while(t--) + { + int r, b, l; + cin >> r >> b >> l; + cout << count(arr, 4, r, b, l) << endl; + } + + return 0; +} diff --git a/CodeChef/Sums in a triangle.cpp b/CodeChef/Sums in a triangle.cpp new file mode 100755 index 0000000..a1454c3 --- /dev/null +++ b/CodeChef/Sums in a triangle.cpp @@ -0,0 +1,33 @@ +#include +using namespace std; +#define rf freopen("test.in", "r", stdin); +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //rf + int t; + cin >> t; + while(t--) + { + int matrix[100][100] = {0}; + int n; + cin >> n; + for(int i = 0; i < n; i++) + { + for(int j = 0; j <= i; j++) + { + cin >> matrix[i][j]; + } + } + for(int i = n-2; i >= 0; i--) + { + for(int j = 0; j <= i; j++) + { + matrix[i][j] += matrix[i+1][j] > matrix[i+1][j+1] ? matrix[i+1][j] : matrix[i+1][j+1]; + } + } + cout << matrix[0][0] << endl; + } + return 0; +} diff --git a/CodeChef/Suraj Goes Shopping.cpp b/CodeChef/Suraj Goes Shopping.cpp new file mode 100755 index 0000000..c7006d0 --- /dev/null +++ b/CodeChef/Suraj Goes Shopping.cpp @@ -0,0 +1,39 @@ +#include +using namespace std; +#define endl '\n' +bool wayToSort(int i, int j) {return (i > j);} +int main() +{ + ios_base::sync_with_stdio(0); + freopen("test.in", "r", stdin); + int T; + cin >> T; + while(T--) + { + int N, sum = 0, no = 1; + cin >> N; + vector prices; + for(int i = 0; i < N; i++) + { + int price; + cin >> price; + prices.push_back(price); + } + sort(prices.begin(), prices.end(), wayToSort); + for(int i = 0; i < prices.size();) + { + sum += prices[i]; + if(no == 1) + { + i++;no++; + } + else + { + no = 1; + i += 3; + } + } + cout << sum << endl; + } + return 0; +} diff --git a/CodeChef/Tanu and Head-bob.cpp b/CodeChef/Tanu and Head-bob.cpp new file mode 100755 index 0000000..3d36e17 --- /dev/null +++ b/CodeChef/Tanu and Head-bob.cpp @@ -0,0 +1,42 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + int N, flagy = 0, flagi = 0; + cin >> N; + string s; + cin >> s; + for(int i = 0; i < N; i++) + { + if(s[i] == 'I') + { + flagi = 1; + break; + } + if(s[i] == 'Y') + { + flagy = 1; + break; + } + } + if(flagy) + { + cout << "NOT INDIAN" << endl; + } + else if(flagi) + { + cout << "INDIAN" << endl; + } + else + { + cout << "NOT SURE" << endl; + } + } + return 0; +} diff --git a/CodeChef/The First Cube.cpp b/CodeChef/The First Cube.cpp new file mode 100755 index 0000000..e25f2b4 --- /dev/null +++ b/CodeChef/The First Cube.cpp @@ -0,0 +1,131 @@ +#include +using namespace std; +#define endl '\n' +#define ll long long + +const ll M = 1000000; +ll arr[M+1], mod = 1e9 + 7; +vector primes; +void sieveOfEratosthenes() +{ + ll i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= cbrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } + primes.push_back(2); + for(i = 3; i <= M; i+=2) + { + if(arr[i]) + { + primes.push_back(i); + } + } +} + +ll gcd(ll a, ll b){return b ? gcd(b, a%b) : a;} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll t; + cin >> t; + while(t--) + { + ll N, k, i, j, product = 1, hcf, tmp; + map factorCount; + cin >> N; + ll nums[N]; + for(i = 0; i < N; i++) + { + cin >> nums[i]; + for(j = 0; j < primes.size() ; j++) + { + if(primes[j] > nums[i]) + { + break; + } + while(nums[i] % primes[j] == 0) + { + factorCount[primes[j]]++; + nums[i] /= primes[j]; + } + } + nums[i] %= mod; + } + for(i = 0; i < N-1; i++) + { + if(nums[i] == 1) + { + continue; + } + for(j = i+1; j < N; j++) + { + hcf = gcd(nums[i], nums[j]); + if(hcf != 1 && hcf != nums[i]) + { + factorCount[hcf]++; + factorCount[nums[i]/hcf]++; + nums[i] = 1; + } + } + } + for(i = 0; i < N; i++) + { + if(nums[i] != 1) + { + tmp = sqrt(nums[i]); + if(tmp * tmp == nums[i]) + { + factorCount[tmp]+=2; + nums[i] = 1; + } + } + } + for(i = 0; i < N; i++) + { + if(nums[i] != 1) + { + factorCount[nums[i]]++; + } + while(factorCount[nums[i]] % 3 != 0) + { + factorCount[nums[i]]++; + } + } + for(i = 0; i < primes.size(); i++) + { + while(factorCount[primes[i]] % 3 != 0) + { + factorCount[primes[i]]++; + } + while(factorCount[primes[i]]--) + { + product = (product * primes[i]) % mod; + } + } + for(i = 0; i < N; i++) + { + if(nums[i] != 1) + { + while(factorCount[nums[i]]--) + { + product = (product * nums[i]) % mod; + } + } + } + cout << product % mod<< endl; + } + return 0; +} diff --git a/CodeChef/The Lead Game.cpp b/CodeChef/The Lead Game.cpp new file mode 100755 index 0000000..2c50c64 --- /dev/null +++ b/CodeChef/The Lead Game.cpp @@ -0,0 +1,28 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int n, leadguy, lead = 0, add1 = 0, add2 = 0; + cin >> n; + for(long long int i = 0; i < n; i++) + { + long long int p1, p2; + cin >> p1 >> p2; + p1 += add1; p2+= add2; + if(p1 > p2 && p1 - p2 > lead) + { + leadguy = 1; + lead = p1 - p2; + } + else if (p2 > p1 && p2 - p1 > lead) + { + leadguy = 2; + lead = p2 - p1; + } + add1 = p1; add2 = p2; + } + cout << leadguy << " " << lead; + return 0; +} diff --git a/CodeChef/The Leaking Robot.cpp b/CodeChef/The Leaking Robot.cpp new file mode 100755 index 0000000..c23b1d8 --- /dev/null +++ b/CodeChef/The Leaking Robot.cpp @@ -0,0 +1,71 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(0); + int T; + cin >> T; + while(T--) + { + int X, Y; + cin >> X >> Y; + bool b = false; + if(X == 0 && Y == 0) + { + b = true; + cout << "YES" << endl; + continue; + } + if(Y > 0) + { + if(!(Y&1)) + { + if(X>= -Y && X < Y) + { + b = true; + cout << "YES" << endl; + continue; + } + } + } + if(Y < 0) + { + if(!(Y&1)) + { + if(X>=Y && X <= -Y + 1) + { + b = true; + cout << "YES" << endl; + continue; + } + } + } + if(X < 0) + { + if(!(X&1)) + { + if(Y >= X && Y <= -X) + { + b = true; + cout << "YES" << endl; + continue; + } + } + } + if(X > 0) + { + if(X&1) + { + if(Y >= -X + 1 && Y - 1 <= X ) + { + b = true; + cout << "YES" << endl; + continue; + } + } + } + cout << "NO" << endl; + } + return 0; +} diff --git a/CodeChef/The Smallest Pair.cpp b/CodeChef/The Smallest Pair.cpp new file mode 100755 index 0000000..ffa84ff --- /dev/null +++ b/CodeChef/The Smallest Pair.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; +#define endl '\n' +long long int nums[100001]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int t; + cin >> t; + while(t--) + { + long long int N; + cin >> N; + for(int i = 0; i < N; i++) + { + cin >> nums[i]; + } + sort(nums, nums + N); + cout << nums[0] + nums[1] << endl; + } + return 0; +} diff --git a/CodeChef/The Warehouse.cpp b/CodeChef/The Warehouse.cpp new file mode 100755 index 0000000..a159595 --- /dev/null +++ b/CodeChef/The Warehouse.cpp @@ -0,0 +1,41 @@ +#include +using namespace std; +#define endl '\n' +string s; +long long int getcnt(char c1, char c2, char c3) +{ + long long int cnt2 = 0, cnt3 = 0, i, ans = 0; + for(i = 0; i < s.length(); i++) + { + if(s[i] == c1) + { + ans += cnt2 + cnt3; + } + else if(s[i] == c2) + { + cnt2++; + ans += cnt3; + } + else if(s[i] == c3) + { + cnt3++; + } + } + return ans; +} +long long int mintime() +{ + return min(min(min(min(min(getcnt('g', 'r', 'b'), getcnt('g', 'b', 'r')), getcnt('b', 'g', 'r')), getcnt('b', 'r', 'g')), getcnt('r', 'b' ,'g')), getcnt('r', 'g', 'b')); +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int t; + cin >> t; + while(t--) + { + cin >> s; + cout << mintime() << endl; + } + return 0; +} diff --git a/CodeChef/The festival of colours.cpp b/CodeChef/The festival of colours.cpp new file mode 100755 index 0000000..f8aa00f --- /dev/null +++ b/CodeChef/The festival of colours.cpp @@ -0,0 +1,27 @@ +#include +using namespace std; +#define endl '\n' +long long int fc[64]; +void pre() +{ + fc[1] = 2; + fc[2] = 3; + for(int i = 3; i <= 64; i++) + { + fc[i] = fc[i-1] + fc[i-2]; + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + pre(); + int t; + cin >> t; + while(t--) + { + int n; + cin >> n; + cout << fc[n] << endl; + } + return 0; +} diff --git a/CodeChef/The name list.cpp b/CodeChef/The name list.cpp new file mode 100755 index 0000000..fa72c4b --- /dev/null +++ b/CodeChef/The name list.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + map dict; + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + string s; + cin >> s; + dict[s]++; + } + for(map :: iterator it = dict.begin(); it != dict.end(); it++) + { + cout << it -> first << " " << it -> second << endl; + } + return 0; +} diff --git a/CodeChef/The worst sister.cpp b/CodeChef/The worst sister.cpp new file mode 100755 index 0000000..00249b7 --- /dev/null +++ b/CodeChef/The worst sister.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; +#define endl '\n' +long long int fact[14]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + fact[0] = 1; + fact[1] = 1; + for(int i = 2; i < 14; i++) + { + fact[i] = i * fact[i-1]; + } + int t; + cin >> t; + while(t--) + { + int n; + cin >> n; + if(n >= 8 && n <= 13) + { + cout << fact[n] << endl; + } + else if(n < 8) + { + cout << "Underflow!" << endl; + } + else if(n > 13) + { + cout << "Overflow!" << endl; + } + } + return 0; +} diff --git a/CodeChef/Three Different Numbers.cpp b/CodeChef/Three Different Numbers.cpp new file mode 100755 index 0000000..9ddb8c7 --- /dev/null +++ b/CodeChef/Three Different Numbers.cpp @@ -0,0 +1,19 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int t , mod = 1e9 + 7; + cin >> t; + while(t--) + { + long long int arr[3]; + cin >> arr[0] >> arr[1] >> arr[2]; + sort(arr, arr + 3); + long long int n1, n2, n3; + n1 = arr[0]; n2 = arr[1] - 1; n3 = arr[2] - 2; + cout << (((n1 % mod) * (n2 % mod) % mod) *(n3 % mod)%mod)<< endl; + } + return 0; +} diff --git a/CodeChef/Tired Knights.cpp b/CodeChef/Tired Knights.cpp new file mode 100755 index 0000000..5118935 --- /dev/null +++ b/CodeChef/Tired Knights.cpp @@ -0,0 +1,25 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int t; + cin >> t; + while(t--) + { + long long int n, m, h; + cin >> n >> m; + h = n/2; + if(m <= h) + { + cout << m + h; + } + else if(m > h) + { + cout << m - h; + } + cout << endl; + } + return 0; +} diff --git a/CodeChef/Turbo Sort.cpp b/CodeChef/Turbo Sort.cpp new file mode 100755 index 0000000..788f2c2 --- /dev/null +++ b/CodeChef/Turbo Sort.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int t; + cin >> t; + vector vec; + for(long long int i = 0; i < t; i++) + { + long long int e; + cin >> e; + vec.push_back(e); + } + sort(vec.begin(), vec.end()); + for(int i = 0; i < t; i++) + { + cout << vec[i] << endl; + } + return 0; +} diff --git a/CodeChef/Uncle Johny.cpp b/CodeChef/Uncle Johny.cpp new file mode 100755 index 0000000..b65008c --- /dev/null +++ b/CodeChef/Uncle Johny.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + long long int N, i, k, uj; + cin >> N; + long long int playlist[N]; + for(i = 0; i < N; i++) + { + cin >> playlist[i]; + } + cin >> k; + k--; + uj = playlist[k]; + sort(playlist, playlist + N); + i = 0; + while(playlist[i] != uj) + { + i++; + } + cout << i+1 << endl; + } + return 0; +} diff --git a/CodeChef/Voters.cpp b/CodeChef/Voters.cpp new file mode 100755 index 0000000..83acfe5 --- /dev/null +++ b/CodeChef/Voters.cpp @@ -0,0 +1,54 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + int n1, n2, n3, i, k; + cin >> n1 >> n2 >> n3; + set list1, list2, list3, final; + set :: iterator it; + for(i = 0; i < n1; i++) + { + cin >> k; + list1.insert(k); + } + for(i = 0; i < n2; i++) + { + cin >> k; + list2.insert(k); + } + for(i = 0; i < n3; i++) + { + cin >> k; + list3.insert(k); + } + for(it = list1.begin(); it != list1.end(); it++) + { + if(list2.count(*it) || list3.count(*it)) + { + final.insert(*it); + } + } + for(it = list2.begin(); it != list2.end(); it++) + { + if(list1.count(*it) || list3.count(*it)) + { + final.insert(*it); + } + } + for(it = list3.begin(); it != list3.end(); it++) + { + if(list1.count(*it) || list2.count(*it)) + { + final.insert(*it); + } + } + cout << final.size() << endl; + for(it = final.begin(); it != final.end(); it++) + { + cout << *it << endl; + } + return 0; +} diff --git a/CodeChef/What is this LOL!.cpp b/CodeChef/What is this LOL!.cpp new file mode 100755 index 0000000..df3c253 --- /dev/null +++ b/CodeChef/What is this LOL!.cpp @@ -0,0 +1,55 @@ +#include +using namespace std; +#define endl '\n' +bool canBePal(string s) +{ + int alpha[26]; + int odd = 0; + for(int i = 0; i < 26; i++) + { + alpha[i] = 0; + } + for(int i = 0; i < s.length(); i++) + { + alpha[s[i]-'a']++; + } + for(int i = 0; i < 26; i++) + { + if(alpha[i] == 0) + { + continue; + } + else if(alpha[i] & 1) + { + odd++; + } + } + if(odd > 1) + { + return true; + } + else + { + return false; + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + string s; + cin >> s; + if(!(canBePal(s))) + { + cout << "Not Possible" << endl; + } + else + { + + } + } + return 0; +} diff --git a/CodeChef/Xor Matrix.cpp b/CodeChef/Xor Matrix.cpp new file mode 100755 index 0000000..ff124a6 --- /dev/null +++ b/CodeChef/Xor Matrix.cpp @@ -0,0 +1,33 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + int mod = 1e9 + 7; + while(t--) + { + int L, R; + cin >> L >> R; + int N = R - L + 1; + int xmatrix[N][N]; + for(int i = L; i <= R; i++) + { + for(int j = i; j <= R; j++) + { + xmatrix[i-L][j-L] = j; + } + } + for(int i = 0; i < N; i++) + { + for(int j = 0; j < N; j++) + { + cout << xmatrix[i][j] << " "; + } + cout << endl; + } + } + return 0; +} diff --git a/CodeChef/Zombinatorial.cpp b/CodeChef/Zombinatorial.cpp new file mode 100755 index 0000000..041cdfd --- /dev/null +++ b/CodeChef/Zombinatorial.cpp @@ -0,0 +1,47 @@ +#include +using namespace std; +#define endl '\n' +int power(int number, int power, int mod) +{ + int p = 1; + while(power--) + { + p = (p*number) % mod; + } + return p; +} +int getpn(int n, int m) +{ + int pn = 1; + for(int i = 1; i <= n; i++) + { + pn = (pn*power(i, n-i+1, m)) % m; + } + return pn; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + int n, m, q; + cin >> n >> m >> q; + int pn = 1, pnr = 1, pr = 1; + int val[n]; + val[0] = 1; + for(int i = 1; i <= n; i++) + { + val[i] = getpn(i, m); + } + int rs[q]; + for(int i = 0; i < q; i++) + { + cin >> rs[i]; + int k = val[n] / (val[rs[i]] * val[n-rs[i]]); + cout << k; + } + } + return 0; +} diff --git a/CodeChef/gmon.out b/CodeChef/gmon.out new file mode 100755 index 0000000000000000000000000000000000000000..0e1f657da142d5d3321ad7031748a14c9b48219a GIT binary patch literal 239436 zcmeIuu?;`~07TIfF@jJk45HK6f*r7l4NPG+Y@n9BUtMw4>*^ufJZ3t}>}{1LNpoE5 z{no!*1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5(r3l!fM4*~=T5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 R2oNAZfB*pk1PJ^_-~siw35);$ literal 0 HcmV?d00001 diff --git a/CodeChef/out.out b/CodeChef/out.out new file mode 100755 index 0000000..24907f3 --- /dev/null +++ b/CodeChef/out.out @@ -0,0 +1,2 @@ +2, +3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537, 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609, 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091, 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161, 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227, 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377, 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433, 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491, 9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587, 9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649, 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733, 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857, 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973, 10007, 10009, 10037, 10039, 10061, 10067, 10069, 10079, 10091, 10093, 10099, 10103, 10111, 10133, 10139, 10141, 10151, 10159, 10163, 10169, 10177, 10181, 10193, 10211, 10223, 10243, 10247, 10253, 10259, 10267, 10271, 10273, 10289, 10301, 10303, 10313, 10321, 10331, 10333, 10337, 10343, 10357, 10369, 10391, 10399, 10427, 10429, 10433, 10453, 10457, 10459, 10463, 10477, 10487, 10499, 10501, 10513, 10529, 10531, 10559, 10567, 10589, 10597, 10601, 10607, 10613, 10627, 10631, 10639, 10651, 10657, 10663, 10667, 10687, 10691, 10709, 10711, 10723, 10729, 10733, 10739, 10753, 10771, 10781, 10789, 10799, 10831, 10837, 10847, 10853, 10859, 10861, 10867, 10883, 10889, 10891, 10903, 10909, 10937, 10939, 10949, 10957, 10973, 10979, 10987, 10993, 11003, 11027, 11047, 11057, 11059, 11069, 11071, 11083, 11087, 11093, 11113, 11117, 11119, 11131, 11149, 11159, 11161, 11171, 11173, 11177, 11197, 11213, 11239, 11243, 11251, 11257, 11261, 11273, 11279, 11287, 11299, 11311, 11317, 11321, 11329, 11351, 11353, 11369, 11383, 11393, 11399, 11411, 11423, 11437, 11443, 11447, 11467, 11471, 11483, 11489, 11491, 11497, 11503, 11519, 11527, 11549, 11551, 11579, 11587, 11593, 11597, 11617, 11621, 11633, 11657, 11677, 11681, 11689, 11699, 11701, 11717, 11719, 11731, 11743, 11777, 11779, 11783, 11789, 11801, 11807, 11813, 11821, 11827, 11831, 11833, 11839, 11863, 11867, 11887, 11897, 11903, 11909, 11923, 11927, 11933, 11939, 11941, 11953, 11959, 11969, 11971, 11981, 11987, 12007, 12011, 12037, 12041, 12043, 12049, 12071, 12073, 12097, 12101, 12107, 12109, 12113, 12119, 12143, 12149, 12157, 12161, 12163, 12197, 12203, 12211, 12227, 12239, 12241, 12251, 12253, 12263, 12269, 12277, 12281, 12289, 12301, 12323, 12329, 12343, 12347, 12373, 12377, 12379, 12391, 12401, 12409, 12413, 12421, 12433, 12437, 12451, 12457, 12473, 12479, 12487, 12491, 12497, 12503, 12511, 12517, 12527, 12539, 12541, 12547, 12553, 12569, 12577, 12583, 12589, 12601, 12611, 12613, 12619, 12637, 12641, 12647, 12653, 12659, 12671, 12689, 12697, 12703, 12713, 12721, 12739, 12743, 12757, 12763, 12781, 12791, 12799, 12809, 12821, 12823, 12829, 12841, 12853, 12889, 12893, 12899, 12907, 12911, 12917, 12919, 12923, 12941, 12953, 12959, 12967, 12973, 12979, 12983, 13001, 13003, 13007, 13009, 13033, 13037, 13043, 13049, 13063, 13093, 13099, 13103, 13109, 13121, 13127, 13147, 13151, 13159, 13163, 13171, 13177, 13183, 13187, 13217, 13219, 13229, 13241, 13249, 13259, 13267, 13291, 13297, 13309, 13313, 13327, 13331, 13337, 13339, 13367, 13381, 13397, 13399, 13411, 13417, 13421, 13441, 13451, 13457, 13463, 13469, 13477, 13487, 13499, 13513, 13523, 13537, 13553, 13567, 13577, 13591, 13597, 13613, 13619, 13627, 13633, 13649, 13669, 13679, 13681, 13687, 13691, 13693, 13697, 13709, 13711, 13721, 13723, 13729, 13751, 13757, 13759, 13763, 13781, 13789, 13799, 13807, 13829, 13831, 13841, 13859, 13873, 13877, 13879, 13883, 13901, 13903, 13907, 13913, 13921, 13931, 13933, 13963, 13967, 13997, 13999, 14009, 14011, 14029, 14033, 14051, 14057, 14071, 14081, 14083, 14087, 14107, 14143, 14149, 14153, 14159, 14173, 14177, 14197, 14207, 14221, 14243, 14249, 14251, 14281, 14293, 14303, 14321, 14323, 14327, 14341, 14347, 14369, 14387, 14389, 14401, 14407, 14411, 14419, 14423, 14431, 14437, 14447, 14449, 14461, 14479, 14489, 14503, 14519, 14533, 14537, 14543, 14549, 14551, 14557, 14561, 14563, 14591, 14593, 14621, 14627, 14629, 14633, 14639, 14653, 14657, 14669, 14683, 14699, 14713, 14717, 14723, 14731, 14737, 14741, 14747, 14753, 14759, 14767, 14771, 14779, 14783, 14797, 14813, 14821, 14827, 14831, 14843, 14851, 14867, 14869, 14879, 14887, 14891, 14897, 14923, 14929, 14939, 14947, 14951, 14957, 14969, 14983, 15013, 15017, 15031, 15053, 15061, 15073, 15077, 15083, 15091, 15101, 15107, 15121, 15131, 15137, 15139, 15149, 15161, 15173, 15187, 15193, 15199, 15217, 15227, 15233, 15241, 15259, 15263, 15269, 15271, 15277, 15287, 15289, 15299, 15307, 15313, 15319, 15329, 15331, 15349, 15359, 15361, 15373, 15377, 15383, 15391, 15401, 15413, 15427, 15439, 15443, 15451, 15461, 15467, 15473, 15493, 15497, 15511, 15527, 15541, 15551, 15559, 15569, 15581, 15583, 15601, 15607, 15619, 15629, 15641, 15643, 15647, 15649, 15661, 15667, 15671, 15679, 15683, 15727, 15731, 15733, 15737, 15739, 15749, 15761, 15767, 15773, 15787, 15791, 15797, 15803, 15809, 15817, 15823, 15859, 15877, 15881, 15887, 15889, 15901, 15907, 15913, 15919, 15923, 15937, 15959, 15971, 15973, 15991, 16001, 16007, 16033, 16057, 16061, 16063, 16067, 16069, 16073, 16087, 16091, 16097, 16103, 16111, 16127, 16139, 16141, 16183, 16187, 16189, 16193, 16217, 16223, 16229, 16231, 16249, 16253, 16267, 16273, 16301, 16319, 16333, 16339, 16349, 16361, 16363, 16369, 16381, 16411, 16417, 16421, 16427, 16433, 16447, 16451, 16453, 16477, 16481, 16487, 16493, 16519, 16529, 16547, 16553, 16561, 16567, 16573, 16603, 16607, 16619, 16631, 16633, 16649, 16651, 16657, 16661, 16673, 16691, 16693, 16699, 16703, 16729, 16741, 16747, 16759, 16763, 16787, 16811, 16823, 16829, 16831, 16843, 16871, 16879, 16883, 16889, 16901, 16903, 16921, 16927, 16931, 16937, 16943, 16963, 16979, 16981, 16987, 16993, 17011, 17021, 17027, 17029, 17033, 17041, 17047, 17053, 17077, 17093, 17099, 17107, 17117, 17123, 17137, 17159, 17167, 17183, 17189, 17191, 17203, 17207, 17209, 17231, 17239, 17257, 17291, 17293, 17299, 17317, 17321, 17327, 17333, 17341, 17351, 17359, 17377, 17383, 17387, 17389, 17393, 17401, 17417, 17419, 17431, 17443, 17449, 17467, 17471, 17477, 17483, 17489, 17491, 17497, 17509, 17519, 17539, 17551, 17569, 17573, 17579, 17581, 17597, 17599, 17609, 17623, 17627, 17657, 17659, 17669, 17681, 17683, 17707, 17713, 17729, 17737, 17747, 17749, 17761, 17783, 17789, 17791, 17807, 17827, 17837, 17839, 17851, 17863, 17881, 17891, 17903, 17909, 17911, 17921, 17923, 17929, 17939, 17957, 17959, 17971, 17977, 17981, 17987, 17989, 18013, 18041, 18043, 18047, 18049, 18059, 18061, 18077, 18089, 18097, 18119, 18121, 18127, 18131, 18133, 18143, 18149, 18169, 18181, 18191, 18199, 18211, 18217, 18223, 18229, 18233, 18251, 18253, 18257, 18269, 18287, 18289, 18301, 18307, 18311, 18313, 18329, 18341, 18353, 18367, 18371, 18379, 18397, 18401, 18413, 18427, 18433, 18439, 18443, 18451, 18457, 18461, 18481, 18493, 18503, 18517, 18521, 18523, 18539, 18541, 18553, 18583, 18587, 18593, 18617, 18637, 18661, 18671, 18679, 18691, 18701, 18713, 18719, 18731, 18743, 18749, 18757, 18773, 18787, 18793, 18797, 18803, 18839, 18859, 18869, 18899, 18911, 18913, 18917, 18919, 18947, 18959, 18973, 18979, 19001, 19009, 19013, 19031, 19037, 19051, 19069, 19073, 19079, 19081, 19087, 19121, 19139, 19141, 19157, 19163, 19181, 19183, 19207, 19211, 19213, 19219, 19231, 19237, 19249, 19259, 19267, 19273, 19289, 19301, 19309, 19319, 19333, 19373, 19379, 19381, 19387, 19391, 19403, 19417, 19421, 19423, 19427, 19429, 19433, 19441, 19447, 19457, 19463, 19469, 19471, 19477, 19483, 19489, 19501, 19507, 19531, 19541, 19543, 19553, 19559, 19571, 19577, 19583, 19597, 19603, 19609, 19661, 19681, 19687, 19697, 19699, 19709, 19717, 19727, 19739, 19751, 19753, 19759, 19763, 19777, 19793, 19801, 19813, 19819, 19841, 19843, 19853, 19861, 19867, 19889, 19891, 19913, 19919, 19927, 19937, 19949, 19961, 19963, 19973, 19979, 19991, 19993, 19997, 20011, 20021, 20023, 20029, 20047, 20051, 20063, 20071, 20089, 20101, 20107, 20113, 20117, 20123, 20129, 20143, 20147, 20149, 20161, 20173, 20177, 20183, 20201, 20219, 20231, 20233, 20249, 20261, 20269, 20287, 20297, 20323, 20327, 20333, 20341, 20347, 20353, 20357, 20359, 20369, 20389, 20393, 20399, 20407, 20411, 20431, 20441, 20443, 20477, 20479, 20483, 20507, 20509, 20521, 20533, 20543, 20549, 20551, 20563, 20593, 20599, 20611, 20627, 20639, 20641, 20663, 20681, 20693, 20707, 20717, 20719, 20731, 20743, 20747, 20749, 20753, 20759, 20771, 20773, 20789, 20807, 20809, 20849, 20857, 20873, 20879, 20887, 20897, 20899, 20903, 20921, 20929, 20939, 20947, 20959, 20963, 20981, 20983, 21001, 21011, 21013, 21017, 21019, 21023, 21031, 21059, 21061, 21067, 21089, 21101, 21107, 21121, 21139, 21143, 21149, 21157, 21163, 21169, 21179, 21187, 21191, 21193, 21211, 21221, 21227, 21247, 21269, 21277, 21283, 21313, 21317, 21319, 21323, 21341, 21347, 21377, 21379, 21383, 21391, 21397, 21401, 21407, 21419, 21433, 21467, 21481, 21487, 21491, 21493, 21499, 21503, 21517, 21521, 21523, 21529, 21557, 21559, 21563, 21569, 21577, 21587, 21589, 21599, 21601, 21611, 21613, 21617, 21647, 21649, 21661, 21673, 21683, 21701, 21713, 21727, 21737, 21739, 21751, 21757, 21767, 21773, 21787, 21799, 21803, 21817, 21821, 21839, 21841, 21851, 21859, 21863, 21871, 21881, 21893, 21911, 21929, 21937, 21943, 21961, 21977, 21991, 21997, 22003, 22013, 22027, 22031, 22037, 22039, 22051, 22063, 22067, 22073, 22079, 22091, 22093, 22109, 22111, 22123, 22129, 22133, 22147, 22153, 22157, 22159, 22171, 22189, 22193, 22229, 22247, 22259, 22271, 22273, 22277, 22279, 22283, 22291, 22303, 22307, 22343, 22349, 22367, 22369, 22381, 22391, 22397, 22409, 22433, 22441, 22447, 22453, 22469, 22481, 22483, 22501, 22511, 22531, 22541, 22543, 22549, 22567, 22571, 22573, 22613, 22619, 22621, 22637, 22639, 22643, 22651, 22669, 22679, 22691, 22697, 22699, 22709, 22717, 22721, 22727, 22739, 22741, 22751, 22769, 22777, 22783, 22787, 22807, 22811, 22817, 22853, 22859, 22861, 22871, 22877, 22901, 22907, 22921, 22937, 22943, 22961, 22963, 22973, 22993, 23003, 23011, 23017, 23021, 23027, 23029, 23039, 23041, 23053, 23057, 23059, 23063, 23071, 23081, 23087, 23099, 23117, 23131, 23143, 23159, 23167, 23173, 23189, 23197, 23201, 23203, 23209, 23227, 23251, 23269, 23279, 23291, 23293, 23297, 23311, 23321, 23327, 23333, 23339, 23357, 23369, 23371, 23399, 23417, 23431, 23447, 23459, 23473, 23497, 23509, 23531, 23537, 23539, 23549, 23557, 23561, 23563, 23567, 23581, 23593, 23599, 23603, 23609, 23623, 23627, 23629, 23633, 23663, 23669, 23671, 23677, 23687, 23689, 23719, 23741, 23743, 23747, 23753, 23761, 23767, 23773, 23789, 23801, 23813, 23819, 23827, 23831, 23833, 23857, 23869, 23873, 23879, 23887, 23893, 23899, 23909, 23911, 23917, 23929, 23957, 23971, 23977, 23981, 23993, 24001, 24007, 24019, 24023, 24029, 24043, 24049, 24061, 24071, 24077, 24083, 24091, 24097, 24103, 24107, 24109, 24113, 24121, 24133, 24137, 24151, 24169, 24179, 24181, 24197, 24203, 24223, 24229, 24239, 24247, 24251, 24281, 24317, 24329, 24337, 24359, 24371, 24373, 24379, 24391, 24407, 24413, 24419, 24421, 24439, 24443, 24469, 24473, 24481, 24499, 24509, 24517, 24527, 24533, 24547, 24551, 24571, 24593, 24611, 24623, 24631, 24659, 24671, 24677, 24683, 24691, 24697, 24709, 24733, 24749, 24763, 24767, 24781, 24793, 24799, 24809, 24821, 24841, 24847, 24851, 24859, 24877, 24889, 24907, 24917, 24919, 24923, 24943, 24953, 24967, 24971, 24977, 24979, 24989, 25013, 25031, 25033, 25037, 25057, 25073, 25087, 25097, 25111, 25117, 25121, 25127, 25147, 25153, 25163, 25169, 25171, 25183, 25189, 25219, 25229, 25237, 25243, 25247, 25253, 25261, 25301, 25303, 25307, 25309, 25321, 25339, 25343, 25349, 25357, 25367, 25373, 25391, 25409, 25411, 25423, 25439, 25447, 25453, 25457, 25463, 25469, 25471, 25523, 25537, 25541, 25561, 25577, 25579, 25583, 25589, 25601, 25603, 25609, 25621, 25633, 25639, 25643, 25657, 25667, 25673, 25679, 25693, 25703, 25717, 25733, 25741, 25747, 25759, 25763, 25771, 25793, 25799, 25801, 25819, 25841, 25847, 25849, 25867, 25873, 25889, 25903, 25913, 25919, 25931, 25933, 25939, 25943, 25951, 25969, 25981, 25997, 25999, 26003, 26017, 26021, 26029, 26041, 26053, 26083, 26099, 26107, 26111, 26113, 26119, 26141, 26153, 26161, 26171, 26177, 26183, 26189, 26203, 26209, 26227, 26237, 26249, 26251, 26261, 26263, 26267, 26293, 26297, 26309, 26317, 26321, 26339, 26347, 26357, 26371, 26387, 26393, 26399, 26407, 26417, 26423, 26431, 26437, 26449, 26459, 26479, 26489, 26497, 26501, 26513, 26539, 26557, 26561, 26573, 26591, 26597, 26627, 26633, 26641, 26647, 26669, 26681, 26683, 26687, 26693, 26699, 26701, 26711, 26713, 26717, 26723, 26729, 26731, 26737, 26759, 26777, 26783, 26801, 26813, 26821, 26833, 26839, 26849, 26861, 26863, 26879, 26881, 26891, 26893, 26903, 26921, 26927, 26947, 26951, 26953, 26959, 26981, 26987, 26993, 27011, 27017, 27031, 27043, 27059, 27061, 27067, 27073, 27077, 27091, 27103, 27107, 27109, 27127, 27143, 27179, 27191, 27197, 27211, 27239, 27241, 27253, 27259, 27271, 27277, 27281, 27283, 27299, 27329, 27337, 27361, 27367, 27397, 27407, 27409, 27427, 27431, 27437, 27449, 27457, 27479, 27481, 27487, 27509, 27527, 27529, 27539, 27541, 27551, 27581, 27583, 27611, 27617, 27631, 27647, 27653, 27673, 27689, 27691, 27697, 27701, 27733, 27737, 27739, 27743, 27749, 27751, 27763, 27767, 27773, 27779, 27791, 27793, 27799, 27803, 27809, 27817, 27823, 27827, 27847, 27851, 27883, 27893, 27901, 27917, 27919, 27941, 27943, 27947, 27953, 27961, 27967, 27983, 27997, 28001, 28019, 28027, 28031, 28051, 28057, 28069, 28081, 28087, 28097, 28099, 28109, 28111, 28123, 28151, 28163, 28181, 28183, 28201, 28211, 28219, 28229, 28277, 28279, 28283, 28289, 28297, 28307, 28309, 28319, 28349, 28351, 28387, 28393, 28403, 28409, 28411, 28429, 28433, 28439, 28447, 28463, 28477, 28493, 28499, 28513, 28517, 28537, 28541, 28547, 28549, 28559, 28571, 28573, 28579, 28591, 28597, 28603, 28607, 28619, 28621, 28627, 28631, 28643, 28649, 28657, 28661, 28663, 28669, 28687, 28697, 28703, 28711, 28723, 28729, 28751, 28753, 28759, 28771, 28789, 28793, 28807, 28813, 28817, 28837, 28843, 28859, 28867, 28871, 28879, 28901, 28909, 28921, 28927, 28933, 28949, 28961, 28979, 29009, 29017, 29021, 29023, 29027, 29033, 29059, 29063, 29077, 29101, 29123, 29129, 29131, 29137, 29147, 29153, 29167, 29173, 29179, 29191, 29201, 29207, 29209, 29221, 29231, 29243, 29251, 29269, 29287, 29297, 29303, 29311, 29327, 29333, 29339, 29347, 29363, 29383, 29387, 29389, 29399, 29401, 29411, 29423, 29429, 29437, 29443, 29453, 29473, 29483, 29501, 29527, 29531, 29537, 29567, 29569, 29573, 29581, 29587, 29599, 29611, 29629, 29633, 29641, 29663, 29669, 29671, 29683, 29717, 29723, 29741, 29753, 29759, 29761, 29789, 29803, 29819, 29833, 29837, 29851, 29863, 29867, 29873, 29879, 29881, 29917, 29921, 29927, 29947, 29959, 29983, 29989, 30011, 30013, 30029, 30047, 30059, 30071, 30089, 30091, 30097, 30103, 30109, 30113, 30119, 30133, 30137, 30139, 30161, 30169, 30181, 30187, 30197, 30203, 30211, 30223, 30241, 30253, 30259, 30269, 30271, 30293, 30307, 30313, 30319, 30323, 30341, 30347, 30367, 30389, 30391, 30403, 30427, 30431, 30449, 30467, 30469, 30491, 30493, 30497, 30509, 30517, 30529, 30539, 30553, 30557, 30559, 30577, 30593, 30631, 30637, 30643, 30649, 30661, 30671, 30677, 30689, 30697, 30703, 30707, 30713, 30727, 30757, 30763, 30773, 30781, 30803, 30809, 30817, 30829, 30839, 30841, 30851, 30853, 30859, 30869, 30871, 30881, 30893, 30911, 30931, 30937, 30941, 30949, 30971, 30977, 30983, 31013, 31019, 31033, 31039, 31051, 31063, 31069, 31079, 31081, 31091, 31121, 31123, 31139, 31147, 31151, 31153, 31159, 31177, 31181, 31183, 31189, 31193, 31219, 31223, 31231, 31237, 31247, 31249, 31253, 31259, 31267, 31271, 31277, 31307, 31319, 31321, 31327, 31333, 31337, 31357, 31379, 31387, 31391, 31393, 31397, 31469, 31477, 31481, 31489, 31511, 31513, 31517, 31531, 31541, 31543, 31547, 31567, 31573, 31583, 31601, 31607, 31627, 31643, 31649, 31657, 31663, 31667, 31687, 31699, 31721, 31723, 31727, 31729, 31741, 31751, 31769, 31771, 31793, 31799, 31817, 31847, 31849, 31859, 31873, 31883, 31891, 31907, 31957, 31963, 31973, 31981, 31991, \ No newline at end of file diff --git a/CodeChef/test.in b/CodeChef/test.in new file mode 100755 index 0000000..4e1c8ac --- /dev/null +++ b/CodeChef/test.in @@ -0,0 +1,6 @@ +5 +Qb 1000000000 1 +Qr 1000000000 1 +Qi +Qb 1000000000 1 +Qr 1000000000 1 \ No newline at end of file diff --git a/CodeJam/.DS_Store b/CodeJam/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f3df71fb570c0595bf382625c228e98084c4f3c6 GIT binary patch literal 8196 zcmeHLO>YxN7=9-SV22hqUu{TQX;oi}h)^67I8_)YG))nTn~g$DLd||moDu7t)$TfJ zh$4LEg1B+vLci#5sMHIh>K{O&hpIoJTsehzK3oz4lGOvMVBXctGoE>$8PBtx8NUMn zq}&XO0K))~!z9o;irH&Sw2O4Wx^zt*ksu!+1PV4x1Bc*%x2Z4+7zK<1MggOMQQ-fe z0G`>xa&I{IRjbL30!D%NQUS3)*q8*CG`1AVtphU|0wDHawKOba93VNi#*)UCLP^Cw zRrEkKmFN(IC_1*=!X2@sv87Pafhaln>GipT2fz2>a*O(%1+W?FWW75Rw;)YIjPo2|FYi=2o5mR)a&(aoAQ zIL)KXWf4vGP*<<8DBzoA-i(5D)lvOjVL`TDvxX`O-9T!^jp!0fna4twZRPUfsaeC@ z+r`O=G5gHK*_|tu5EzmbFK)4?aA0-0JHe=o{=C8v5wt;h_^FBcIf)0nhbs)Dtn) zX&&;V95(4nJz;?pyFQER%NhMHbJ$H0IfAec= zDb1Gml&dxCc94zCts0o$O2g; zRdSWAD1KM_oqyUMO(78%VjV8DuwHb0-iReLKYFKgW`obn1kKC`c#?lOEBPIc+2Fx{ zWX9`zzHM(y4BFwC8%`31JgOr@sAho!8E!*~zC;ul0K>Y|;6n`Y{tXDeM9#fkY1n}| z|4|NOMuE;1=vJ=7BL2UK>(AT+bgrH8Gzz>c3Xq-|XQqs^Y5#Y5bz&mcwlQ7DBux0V o6iNzaG8{*g;W(l`j-{`Su7Xq2*iwi!Xyzh7%3w01z*|+|1;FDnWB>pF literal 0 HcmV?d00001 diff --git a/CodeJam/Google CodeJam 2015/.DS_Store b/CodeJam/Google CodeJam 2015/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d0e68ff5842addcc2c68b87a2bfdb09d9934f0e1 GIT binary patch literal 8196 zcmeHM&2AGh5dNH25VaQ|m54-D?UBn?EnGN;C?G0P710YPM4OgUkv}zQ#W9b;BlXY+ z;1PHW_-4E*cGf0Z35g)=m3I=a=kv_xvAvT3Fzw5eU7!h|&MNZWI&Xm@&!v`1t!UY# zG}H%18140j-Q(WyxYRo}BnA=#iGjpGVjwZF3=HthmQs(L`}S$NCk7G&|0M&mKV+;T zTZNojsapqcngUR+vRMm1GY?RmtdOljPOVf`V%qG%6so33F^pB`^Gv!^whB45(yGH) zb(msgQ)DPcN2gw<-C&-xB=iHVcz zv#)tO*LMxik)wwrT;L3+9N`>;Ih}8FIt|qsqff0Kubgti>y#}c%AF8O?R`ZQ@wQ}( z`uf%Jb&)Mkf+#n%r3%W^5Q=i?qC7yGTpS4NlqeL02#BW9%8E>qghkTad4Uq@LJ;GsHkeWDGBBmP}Pte2U0aqgFJ7Q}(hpo`E9Ao!N#%Jd{Y z!?kw~KM%RC`pT)DpUnB5<27ezwtod?N7hFLGZz`&fj?NMax{@aGvY ztDVD6o46)|ExC5a`hiu7^qX3#D!gerPO0fQ +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + freopen("A-small-attempt3.in", "r", stdin); + freopen("01.out", "w", stdout); + int t, cases; + cin >> t; + cases = t; + while(t--) + { + ll R, W, moves; + double C; + cin >> R >> C >> W; + if(W == C || W == 1) + { + moves = C; + } + else + { + ll c = ceil(C/2); + if(W <= c) + { + moves = c + 1; + } + else + { + moves = W + 1; + } + } + cout << "Case #" << cases - t << ": " << moves << endl; + } + return 0; +} diff --git a/CodeJam/Google CodeJam 2015/01.out b/CodeJam/Google CodeJam 2015/01.out new file mode 100755 index 0000000..f0c394c --- /dev/null +++ b/CodeJam/Google CodeJam 2015/01.out @@ -0,0 +1,55 @@ +Case #1: 3 +Case #2: 7 +Case #3: 6 +Case #4: 6 +Case #5: 8 +Case #6: 6 +Case #7: 6 +Case #8: 5 +Case #9: 9 +Case #10: 4 +Case #11: 8 +Case #12: 8 +Case #13: 5 +Case #14: 5 +Case #15: 7 +Case #16: 7 +Case #17: 7 +Case #18: 7 +Case #19: 5 +Case #20: 6 +Case #21: 5 +Case #22: 10 +Case #23: 6 +Case #24: 5 +Case #25: 6 +Case #26: 2 +Case #27: 5 +Case #28: 2 +Case #29: 4 +Case #30: 9 +Case #31: 6 +Case #32: 6 +Case #33: 10 +Case #34: 5 +Case #35: 8 +Case #36: 8 +Case #37: 6 +Case #38: 4 +Case #39: 6 +Case #40: 4 +Case #41: 4 +Case #42: 6 +Case #43: 6 +Case #44: 10 +Case #45: 9 +Case #46: 3 +Case #47: 3 +Case #48: 5 +Case #49: 7 +Case #50: 1 +Case #51: 4 +Case #52: 5 +Case #53: 3 +Case #54: 4 +Case #55: 9 diff --git a/CodeJam/Google CodeJam 2015/A-large.in b/CodeJam/Google CodeJam 2015/A-large.in new file mode 100755 index 0000000..4472a36 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/A-large.in @@ -0,0 +1,101 @@ +100 +1000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 +156 6000003001700070000800000000009400000000300950024000601000000009070007401009060000080001000005000000001040900000000005005000000000000045000000003000090000001 +1000 00900000000000500000067000030800008003002000000070000000005500060002400008020600030000000010200000100000406100000000000000000000000406000800008000000002280900000090000440709901003000000030000040031000000000000000000000055090500903300000200000000008000300403000000055090900007090000498000000000006000000600000070000800001003000000700030002000400070720090204200000000000050000090000700000000630002000000005900001000000000006000030801002001307800800000000000900000006005500605001602000000900002000000000020000005000008097000000000086900000000000000000000000059000630400021501000002800080008000070200000000000070800522000016080000000000000000600002000030000007650200000000080910003410000000020090000002050070400500000003600040080000007000600000000900001000000000000000050000000060000070000000020002000000000050008000000000000090000000003000080000000806060000000020400000000040000280000090800008000200000024000550000360000390000400000009000007000089000000000000000000000930500005000008200500404600005000001 +1000 03020866000000000100000002000000820000200000000007000000000000001000000070050008450000000880003006000760000000005000108000000001837007000020200000001054009001704700290000000020070870470000200020080000300000407000000000000000000000009500000000000000830930008000000000000000000000030000005000002690000073000607400070000000000007000000000000000730000000000008000000092006070808740067000000000600090070007000000009000000000000907000000000200800000070000000000107000000000000000050700004000001070070000000000000000000000030000050371060008000330007620000010000003000000003000002000000070000000100003791006000000004000601000000030030000000020080000210002000000000000960400000100000000600400000000304050000090400002600000000000020201000007000000050060200070502000000000230008004020640069030000000000608000010090000000039000000010008700900300000000060800000000000000300500000014900000000000080105100000600000000700000000000050600000904080000000000600400000000000020850980008000000000000010075275000100000000001 +585 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +63 2398953791165769401875119175126521632292584522416762756308125194 +1000 04000000200004000007000000000600000000300000300000000300000000000000070000030300005000020700005000509000000016000000000000000000003806000600908010020000090000000310000806000000000200000006000000500000004000000000000000838000000040000000034310006867000000000000000010500300100200600606000020009600000060101000002003000001000080000000000000000000300000090030800900000000040000000000000000044008000000192005000010000000000000000000040420009000600000000000001000035003000000000000000008007400006000004056000000001003200040000400000000000020058590000000000080009000005900000000000000003007048000000090900008000000000005000000000400000000000000000005030000000000001005000000070000000100800000000000020002000001004200000000908000000030000000000500000900000000060900000880004000000060000700000003820000000700000000001000000807008001008000000000000000000020003000000000000100200000080000000000602000200000000000070000860000000008000000104000000020500050000070000800000601002007000000006000000700010101000600108 +1000 20201122101200102112020211102220102210021001211201122101200200002210122020111221022122100200122220210220211211200012001000001011001000210020001120022201122102011120111022212012000120012202222100212200111200122100100121222012021122202222020112010202101120200101201112012022122002122020211100221022222211100201001210211112111201202200012222120021111102001122222211221020220021211022012112210122200202110101011012200020020202110021102202210011122201021212211221011111021002001010120112121102220022122021011021011011001202020002110200121201201211012110002101010102221001001212221121221210002202210211122110002012020210220002120222002222110001222022110010011211010000212001000102120021001111202022122010111100021222110021210221222212022221122202200221212012000112012021001120011221222110011122110120002010012102010002212210202002011020111112102221220120102012221220012111211211112102202102101022011100020212222111122210100002211122001110201220110010202001010212022120021222111022221111121022200000200201121 +696 2220200011202202022210112211110000212200101202211201021111002022020121111002020110120220201221120202010021200102212001022002012121001202122102002201010222121012101121122000122222110011101222012012110212011201200202202022021212212221101122110210122110022221111200121102120022002212112002202102022122220002022000122122120002000201010100022211220111112101100121212122012111011222022111211112120011022222101222220220020002102022111011200121111012221122120122100220121001111100000211112011212111202211002202222220201120222220100122220200202111200001120212000222220202221110112101212202121021020110021021111212010022110201102010011221122202100011202020022121011101100201200001010021020020022121202122121 +1000 00000060000100000500080300609230001000000010000000000407000000002005000030000610000000900008000000000000000000050009004000000700188309000105000420030000060000000000000000000020200000000000000000070909000000000000000001000000306009000000000000000201020290000008000002002000000800009040000020080240000000000000000000000006030300003000000000009002009470034000310000000430000000800030000000009000800700600000000000000005000100000005000008000061200050000000000800007000006030000000030000070000000080000000020000030070100100200000000300000006000300000000950000000040860000080000080600070000008002006005005036000080000000000005000000000300000000000000000090702803070030003000000060000005006000000500000070000000050000000000020007008400030000000900000000000008902010400400000000006500700001090000360050000000020080000900009900000000006000002000000000000001040000020000000340000000000000040346000040000000000000000030490001030259000000000000700000000700410000300900090000000580100901000040000002400772800000201 +1000 00070050000000000000007007001100800903000000050400400004000000300004000000010000000080000000004000000060000020300080000050000000500002000200000000000900080000000000006000070808400040000000000050020000000003550000000050000000086000800000007000600000009000000000002000000000006000000600020000000000060006030051000000000000000001900080500080000000806000000500000000003007000000809000000000207340000000000000000000007800000600000800090000900000050030006000000000000000000408400006060040300900000000008000020030000001000800000400004070000000043630000000004000705000000000000002000000030040000000000506000000000000000000004030000060100008000000100000190000000000013000000040000000040004600000300070000000000000900070200000860030000405100000000100000000050000400000000050000072060050000002000000060000800000901000007000990600000009000005000000008000000050009006000000000001006000000000400060040000030030000306050900000000007141000000000000005730000000000000002000000000007210099003700180000000030700050010011 +1 09 +1000 78914064875160315979776321628074583147201714251545045837721802383186210828007883949531545965758093931526267552424463530988958131900401884852221442723683666543007900877767389227479152218962662519038276844996167012585435955255358460222944533153820506527708730280329526876156373574699453192717926352446076583231335154902543018953576841039427375200389604246667251818955911148166708111979299635365059732191605650894788144416254041534615687485992388447125252978215361206727962777823190923097116672823393817227893275342853219131134642079886177116101979235424632410858878451688797911745646359764160406668648574567036441072908896738763634996192065482684009982548244805410060231261611226654904477658571610557230546983740648365691563815997313297326780272155275457418357674527335114017113641200209089761228512014992704772737747703785279459246686647485903362559129919222556255727612720273404696800764076435919788292163792616038848625492723557801090644365125679077982874113324397014654033951019430772474811757564704 +681 4001040009000034002000080000000003004009500000000000000060080020330090007840040038090274000000100000000400000040001000404400100006000300000000020000000000005000800000030000000000307000000000010800000200000000000000300780610006010040000000000000600000000000150000208000003000020241000500440075500000000000700360000000009000000000020700000000000800202000900000064002005082071020000000035002002000000000007000700030040000080005800000006000002000000027005000016087605000000000900060008040600027000000000090000005300000000000500000000091000000007000600707000150000000050704000080000090000000000000000000000000000000010030000000500660700700000007800010000000033398000050004000000000600701 +1000 20212100211210121101020112102011200111011000210220110111012012201110201221121210202101101102012110201200001220000201000110011100012110122100121121001012111001201111101202201000220201001120002000111211220100010101020000102012020221000211221000210002111011000222010011012221110022111220220121202201000200112112012110222112122120010202102202211020112222021111222222010100110201111010200002102201002001120021222122011202021200200001001211102002111022011212010121121011122022010212201120001121221120021011122011021201201212111100200202212112101112200011210121000211120122202102211100011200121112000122022110022012012122122012112000201021112222012110212022222102201122120200002020022102110110220202111220220012202001010010110022021101002012102221022201201122021210100112200110220200002222001212100010221111221110000200212011210012011022210121202121000022010112212000220100000112021110122112021011111202220222202001100001222002112010220120000220002000211202212010120212112111120110112110222202221111200022102 +1000 00004000000000000000040020009002900320000005000000000300309000090000000807000300000080030000000000077000050000000010000000000000000000000000000000000601500070000200000700000000000090000070000000000001000000000000408500700300900920600004000005010003000000005000000078000700006000000000005000000000040000080000070900000050001000000070009000000368000000000000000000000000000000000000778071002000000000000300000000000000000006020025000000000000006000000000000009000004100000009800000090043238000509000005900009000804000000000690000000400030006009000000800000008800000700100000000000000000000500005000000700500000020060300080001108002000000028050000700008000000000000000000000000000980030005000000809000000000000040000036503051700904490000000062000008080002080000480000000808000000000000000010000006010000820000004406000000002001200000850009040070000070000000040000000000070000000007000000002000000000050000004000000020500030000062000000000000000000000000000001000470070000020300000000000000000000000000001 +0 1 +1000 57116661736407456263621362921688063835714418017468552597236705056518532265753088333729043711729912091212781542765388780712808339336271488958437872738289286951040896571676668179384871705626867355361176490318052455083038120907680410207777396693749909216815037495942190747604568077042229975062433568310713313011266678243285521249004250887835846050739268146097813794717992820142266278252094311187320449494955582209430040625763173007141588546687293930826903541177314957174198043584922083190094918756866410507912795065315149003141353180907477010395438213298677161213739323222417460888335122104984651514820707410582779404336302033094360061997807899324933937202928851790933123967268708818884850174020960775470233090688156549136554773724488448112713568058320801367918043504063947290796798503093803512595027399928136036272403605721712619351191892674112167239165535365817797611228030974170030578419680519532258937812069139302452691952622780296793578123953762616804033676994701250248191535017116775395436118093778 +321 8000403800000000300005000000050020306400080009300000807008000000090090000000001000300500400005061160000058000307000500000094000000001000000210040000000060502090300000000007080005000000000000000065000000000000008000070000000000004000090000000080401000200200600000000000050003553000000000000000060500000001000800000000800001 +1000 84100000700002000006700000000000000000000007009050011090100040000800080000900080004000000000000100000300003600700000400080002000000214000064000070010000000000200008000091030069001000000000000000800000000000000000008000000000400090000010000000600006000001000000303700000003008000000000007000000100070518052000707000008000070000007000000000002000600000000400000000703000000801000000000000000000200000000090100000050000100000080000054000200080009300000000069880000010004000080000000040000800104800000550020600060000000064000500420200048000000000000002000030000900020000300000700001060030000000000200000064060000204024020060000000040006040600000009100000000300000007000002001030000000020000006600003000050670000210000010050634906030040040057005060000000000000000003000000000050000000006030070800000041200000000290000000000000000900000000005000000000030002000900005000030800000000470000090009000205010000060000000000040000000000000000000000010001300001300008400050000000060080000600310300000000001000740001 +864 0003000000000000005900060000000984000400000300000380005000000772000001806000000641008000000300000000000000050200000001090000000000000000801000000000000000000400000000000000000000000040000000010009000010808000003000000000000008000000700000000004600002007000000000000800000006000000000009010000930600077016010400090040070020000090400023020000000000000040000000000005000010005001009370000000001070230000400000600000000000000003080000050000706000000800000000000052000080000478000000000000005004000300300000600108040000000004000030000002221000000400000046500000000000000000000040000000001001000000000200006000000000205109000000953000080000000009000005000000000000000000003000000600060020000000030070009604000000000040060002000430070000000000000040000000050000000097003000000400000200000000000000300050400000003013045000000090920300031030001000000796004000000004080800008 +1000 41400331698493188909533522150072560105862520617885507734411296844385164569638518332041223946709161556690384257498306707479258748051029225308899504450441987368492139320331259286041733267791037102730353137258732312922748346311791241544852763076756777371271678744910352390259768107882399128613650107073414287278450233495745747489163244854808818970495617445087271457527925693989046676900783405318520423989305562179893462130508355808092108053370916128650472240346445225098838626773891103744630612767612063326927716137655604502444823073431758414685422094459311485176991252796134540579685353076471137811864596086528951844350434925546953726772747382825768590867791346201989749218648034038154954305644630770589128255634510541878701272287591220142200861386584061848780750568538156105589055956062751250481540546376498163460458773206743245216468335509104612040245474301193738234234801838301596081623619469017022175556134496129862713840634287086337405137710721153179815620004581088643371709773869198252167143026069 +648 7000609902200000000000120620000000000000003000000134020000090000000070001700009000068020000000040240012000200000000090170005800009000000400001000003008302000000000107000000000100700000000000800000000008030000000000000070000050900600005100159000790800300000320000830700000200000000061700000000010000780001308000500003000030000000600100008000000059009408000006800000009004000500000000000000000009000000000000064000040000001000001000070000000000000000706210000800000020000000000000050000000000007008000070000090090030000000000860100000000000907010060009000800000000000090070004300000500005000000000900000800300033000000001208000000000930010000000007001 +1000 70000500200000000080000009060028000001000040000019000093000070000030000000000060000000026800000000000000000057920100000000000000000000000100035000000003000000203008000001000000000046000000009000000040000000000008000011000900205800010000009002003000007000000000000900010600600070000000000060000000000400104000010000000100004020000007500003000005000000000001910000509122600050000003070000900000000000200300060000400000000103000010000000009000000000000020000900800900000009060000000400401000000280000000900003000000000005600000040000005400000300000000000000000000000002000000508000000000800000086000120100000004807005009074000000500430000020070000000000302000000000001000000000000000000050000070040000000500000003006050000000000000000000000000665006000120000006000030007004000040460000705000000000000008000000000030000000000000230000004600093000070001300000000090000000012805000000000800603000000600000000509000030000000000740007000000000000000090300000500000200020000000050000800003000000200000007080001 +1000 05879617679829112578342827868596381246403630926782337406434208737906487298124843024075860778998675632014225141897912535805698223818627768317312536112162701650227086637403850811048581927631479900442035774534673941260323468098119488709393553516058129118198906460125996057794481294976425978675471344324094179479882292114255259431021955162634302209372224853756666313501279971826770844211930179564821670331576773055029272764898879802123948974984360820300786970125248594972231509695813660754818381364979424530603709580622814665401282518744658380743227128055025032420150276192496320951509402344140439021298918771644224586189466438332681140329371029228477053867810283130400371465321426704969425887363605168611000711105328006012204952682907180908757939650326398293062181668386770298291089911605492006531868173582078427064320612276318583954463021367332961991659432526173251308346019834442085544203821056227881045582728091277206908277585435436244725188759874868752394131162240249441060110816073313520317534138395 +1000 64621801006464962853053441305602283993826715841862122750469202975022919001364209501642966394765638384614784461553211885435365619126529271952655360110929382217261423306625546026236833324908344405412791047327452167984436038787822907011580052369290065987430316588393720775470958051704166684680846612524374853156572641025918279396542134351072121461022452488043078287122087309444579855880369775658870560612874023158506766853870224322893801199933923672066803351720621613186279120047441859429112713248467532343637437757238058711922329664275263551739866170698658796008773032064774281962895326684350054897905623032480746303784769948694670543549612316798738152650988501263814020777124165236517148716148199973018486961550323482959389191996378302555749208336515998872422251156267512074125192341302912311202866991107667667383775292871043281575700283765342809449813914046327694823746270693672785661694222559638870241805097298833668195556343805751847138587076556524638754489823668939898419446806218500960186486758906 +866 000110009000500004500300000000003005000000009000000000010050000000000000841000008001006040000030000674000000000000000000000000000000000001000000002000000000000000000000000006000000000700000190000000000090000900000000000000008016000000001000000000000600600700000050000400000000000069000000000000907000000000090056000600800000660000050000060010000000000000000006500000604000080000000000100082000070100000000030000270000900050050000904000006000000098200000000090000500004830009000000030000050700200000000000000001000000010400008080000000000000000060000050000000600200000000000300000000000000000700000006400060000170000000000005000000000070500002400000000000000020004005000030700000000007005905007000800000000308000907901002000000600000000000003090000000000000000030800000001000001003000003000080000000006080000000400000090940001600000050980000900000001005000000000815001 +1000 50001020300207000500250001000000060200500000020011206000004906500040400000000000000000000060000014109000040756000000000030800000030005410009001079004450160000000030143000970000200070000000200000706000006020200000000500000000509000002010000009000000030000000250000800906000000000440000000000770040000000000800906060040507020000009060006000003000000000000800000000000000080700000200000200000010000000303300000000006800003000400005000008000800030000103000000080000000100007000010000004000020000089060003000000000080009000800500006000000000001004200000000340030000000006500600000008000000000000000000708350008000000305002050070030000000100000000000000000730000000000000700699000090530000060001000595005000000030440000000008540000000700000000000000400050040000000000004000000008000073100000050000000010000300060000403100080070000058830000005000720000000000000000000070000000000000600004000070710000000800400000017002027000000000480070606009070010000000000000400000000070000000300104600050000060002000000001 +1000 20245005008080000000871000080000008007500040009000000500900000005000000380609500000000080001000000000000000000000000008050000000000000000000000000900000030000000000600300000040050000000000000006000208000000000270808700000040000004090000007000600000000700000000007003000000004000000000800600005000000340070003000000000000090400090200008400000500000170050900000007040000700000006061600000700900800000300003106030003000090000100800000010000030000000000000504007100700006000004800000950006006109000000000200000000005000000000007100200700740000006000000500080000000000000807030000000000000000000007000000000800003060000200056300000000079000090400060000000000000200000000000010040000084000000000080000000700000000020060000000800040000007010007000000000906000008400070000000000400000000400001000000000010030088000000000000000000001040006000090230000007000001003000000000050000000010906000004000090000005004000403400000000900203300004000000000000000060090000001600000000021000000030000050300400000000000000131 +1000 60000008000000050700300000000060000000040000040080000300000000010008000500000000090000713060000000000900900000000060000080000000000000001000300000000008000000000000010060080000000070400550000010008300000020027000000000700968060000030000000000000000000008000909007000000713000877000000000000000430098000003480077000004320000100000022000013000300006000009000000000000000001000000000010700000000003000000000800000185010000000006000000870000000000000300703000600007000000000000000000000070710000800150074300000050020006040800000050000000000000000005009000000059000600090800000670000000000000790006002000100000100002000000907000003000000200000020006602000000000680000005056000000000000000000000090000000080000000020011070000000600000000020309000009000000000060000005000690000070000000050003000000600000000700006400000000000000000000000000000000000006090200070080000004000000000000000400000000000000500000910090000000000000000000000000000000008000003300000000880000000027800000006900000000071000014060070001 +725 500007000000600000450000500000008057007005000590000000900000100660000004004000000000000000049092000000075010700000901027400000006000020000000241008000400000050020000008023030001000000000100000008000020060000000000026000500000000000000000300900900009000000010050050000000000080000320000000000050000000000080000320000000000008000000000001011300800000008000006040000000067000000000080080000000000000052007000010030000101937000600090040000000009002000001071000000000600008000400000000004300000000000809000080000700050000080600000000000030620200000000001000000000000080070000050036000000000001000000060000020900001000071600000000000190900000000000000209000900000900000080000000020000000900000290081700000800907000000203052700007001 +452 003000065000005000000000074000000010000000001016000000000050070006000000002000000000411010600000100200000004000000000050500000000000008010800700067900000900460008005020002502000000017000000073000510040000000000000090050000000000062400080007000100000088002900620000000000030000900000000000000510800000070000000000000010000078000880110370007000000000700005000000000090006008060000000030005009000380000050100600000000000060050408000000000002039060200000001 +1000 44191548607123643463522510803679389910599423160226929817824471044410803530553039093336457005872356566135080805833318615983963489699406202706151933599858591160294615896450827609875226532114501878624125090292886032681878363031938691342946365363490078276784134221363611879140296830930023764505309720149378408895042772741697542415838571541741506353037255507685893655664913297819243499992293473345786097254683342801863284544294457698155903968050711570577561757430224182124751426950088659373347408200755184849165784944915760271967904565514300793143513434311896173971366424125365971675138405367487035764834970324426163953315870829144149074868924942409889307727026006666027125204826785907179367203908942478475503689792671012184821654545928883371294402997688483911389216847542448696494267664841468425614448011340028129734622339612619724508385246570332992610036358425065820650812415069268677868266429168492686032380895795744124268801006901279270185500498908511423804849072498220036876954472728122911605298989036 +1000 21101012012110201221010012120221000120210222110002202200102122120111210121122111101201002212212102211120010201010022121120120211212112001111002012021101121122002200102011002020102022011121000221000000100120002202202221002001200010201212222012020011212000012002212011122101022110110221020012200210202020000210211202112102121220020001000001222211202101101101202110020021010022011022101102101122001100221000122222201221220001012011112110000100022022100200200220212010111112102112110101002112101220011022102002001021102112012210110122211001020110121112001110210021220002001010011102102011120221002111211220222102012201222022101011210001102122211112010102112211212012020100020010202210200020212101222121011010122110200122201111222120010012220002220202111222000211201221221012100122111002112112220202020211201102102210201122111000002120222220101202210000002010211111011022200010001210110022221020221210012002112012221010111022000012222001212001201100210211111120101120021111101121220122121220110020102120111 +1000 90000090070050000500536030000700401050030000000000000007050000000300000000000000000000040006000001500008000000052000200200207030006000007000000000030050040007700900030008001079000000601309000000000020000090050402000000000090000030020089006000001007000400020040001400000001280000030000000000000000009002790030802000000040040040008000004000500000000000060001003070006000900000000800000550698000050500100100000000020000094030000000040010000000000000000430720000300008009000000605030000000206000000300090080050008250000000000300000800203000000006000800000000000070000053800090000400000090609200030000000707600300700049007900000000107000000000700030009010010006000700000000000008700065000080080080003000009000003009000080000000000000900000000000000000000000300000000000000000002050400000000000000000080000200000304000000030000037000000006000006010000900021080000000022908003050100016402000190000000440400101000000008000500000000004000004000100000000000000404040007000000800000000009020700090002003010000005 +293 000000000100000801810000000008850100000000000700000000001700006200000003010700080960000473000807002000000200000000000000000047000000000000000000100000000000000092080000006094000000000000000000000030000000000380000800000000000000007070000009800860000900007000000000002004000000000140600000060001 +1000 21012012021011122021012121222201220110002001201110202010221122212111211120110012021112000202001202201222200110112221111121102201201102122010102012212200210022020220220200200110110000001222102101000201000222020111012110212210012011001122201012001121221020120012210221111120211210022220122210111212110000202021101200002222122100101200011100020210011122222111101221000002201001211220221202001111021212102120011021110011020120100201202011122111212011121222211112000120202021110211110020100212110201201200121022121102201000022022021102110122101022011221220100012212010011112012212222201010212100120122220210221102012022201202211000102022200111012120012121020112221201201021200112110111112000221222122101011102212121102011212211220100000110000220212120211111022012221010002000021222121200100201101210200120202222122020111022012112212220221200110221220000000220012220020120220012102200011212002022202110222101001002101001021110111002000221102110211011212112010022210110121021211112212201120200212000120120111 +1000 83776823379648309915256835821515183575442004515874652513528201821992675887728564564839503637761511411436322032109593244387052953686947908559030969710409647263448217743955365071305617548279969374848142790385083498756409056486052280012806280235693339953764047961022494876055560028677004391803660662235666622533419093083265019104868856120275308358300132107217954231522469798494916778545228502834958463426544989255086526365993350368150374323551080487480658096570036766019536080633285276313672693162549254075145804558450281514862748974271455624258771908229553796091319414331421798233192100610789260075505008788360545110716294262128054639736606190365231329151044893886317090657836704689940842994040846924367321527697203415908430202557577524346716228066569401479374658332719371050692691311688133257633881805459305927655856030984860768464626737426532170812003548116006305277497047615396118777288618636564787121073322479463819140927578876836494295632895399830539164055947945261398705223566108183269623312418265 +176 600000090000000000000700060700000030007660048010000008000000004020020030000000070000003000600800000000000000000000000000000061000000000000000010050000000000310005100000070200001 +1000 12112100222000211011221122212000212112002100210011220010222012110100012120021020112021012021101112102101112222110220010121121021020221222200122020120022212022112011112021012001221110212221011212002120022212202022122000100000010121122200101000201102101000122200121201122110101012212110222010210011201211120120110112200122011021001002000122222222222022200210102001021012221011112201120110120101200121222101121002212200212101122000002022122212210021200121212001111221201012022202221102000111001001120121121122112202222111111202020101000200110221111100020020021010202000122220010211021022212211121000121022020000222201020101100120222010101120211220111110122102221110021112002120110110212121210021000111012222022210102200012001000022112011102002212010212221001022001011100121000111002120001011010012011202002120001001201020010112211101212121220121022201020210022120110120211202112000121111202111001220012021011200010220012211021212112201111201120021020202112211102102110000121001222000110121121202100011222 +885 3790302019051848482573357164805605019810230466420461107592923615452390135196790724823078285155117570389572991234825016590479647851582713500659782167325674411108170322748403523837998712257174788408379256932250756485335154713834581201721594846962123477509729299062262324003478597006671022769568839039694626960633313549697294693937920707128675101995949945050733027665394316322910157903393738077748708741986595503253003381221214605896645376562954324450485523435281166979066183037109560771834952775325084088918242823150639072600591312048983137083226552289733796734223368590476981686524461173106267489479907690086799606415922324095230180935248087019324066223856641848956141291298217718235925375076729143420329322435529165549943008492484356164030259564013389788536603615998345148364058816317970603210440961355175009030218212202915350180039603518795856677592047000134201499416626139111646761637 +598 11222111011121001220210012002202102002102201220102220212112222012012211102220201101110002220022012222212102102102110100102210022001120210100111020011212020200100002002021022021020212000202001101201111112020120122222100102010101202220202020101111222121001121002100012201211222101002002002102101121101212121101202111212000002211211101002021101201111111220202220012122022200100120020211122122112122222021121202222202120202201222122002111020120201112212111121120020211021112220200020100112010000222201210100101100100102200222120012101000121201121002110021121220012102220112021210111212120100202100110002 +697 74096825689916957849735128144402745564381576597406165961551567320587838403037826773089955300354171731812549166820737316972269052983729632703720859940218544890113891545948510283023147951639919985097611793944160889279682768844217867513426797739696552468468219039099310402916177227578033584524849101048472258578453696264677568207069738167795555736958798197147927765436841497504021330978974542104430261656793441796518051819981746274064668697882849601246115779676030679963078434911751943301376290953466794880013257965045414974832110283880541774540454672560623024849355134037989714114683723670434266751320426702057494150504071595081210430581077248266952301289611503150371596925925789384310391948228088297 +444 0400090000010000000006006040400020000040001304001000010000000020000000000000000000005100020300000000004000020000000080900000000000000800000000000130080001000104000700010050000000000008000000000005200000000000000000100000081000000400847000000400500000000000900000000000000000000000100000005030000400000009700200000000000400060009000000970000009070050030010900800000000002280300700000007040009710006900060000000000000090000000001000000000000005091 +1000 00600200000100053106004000200000000000000000000000060000000000000000731021000000000100000000050000000506000000000003000003006028000000000000400600000700040000000000030004001000090009300000007000060100430000109005000800009000000000008000000030230040000004000200000000000500005080083000100000090900000202100060120000000700700001000005040040000000010000010000000000000061500048000000008000700004000100040304700030000000000004000201042002000900608200000000000000070023100000000120800030003700000780000000000004000000000008007000000000000000600000000509000002080000000066000040700000000000007000008050000200900070000000007500090030700005000000000000000600107000402600070100720001070000004000002000000000000027000000010020000000801000020030000600200000000600010700560000005800090000040001000090000280600000000000010087000000000010040004000000000000007070000000007000008000006070000000000500000021900070000080000000000000000000090801040004001000000500000000000000000610000007000000070100000000030070076000001 +5 110011 +672 7735768932069451824004614466654891891542328584501414766335822728914089085448292788252470894111012234093119682573443308232697234136764381373277514965510899768579624194245999385887020641023730195498989973333322185776215725789831888663355608399246806173726518634729337606911243031613901813956098374380902948903474516654547788186141601149999805880558462038879005547877324607795226976486356250897387357714002799166029616536064185241421428522905428442592141362686296135633971287904520227405654543155189008514539476349907525268627568292290056123207137564930536234271972265024885747255118375623020842963942654974913782694985764539341389578985435735987072558846158628929752171731838 +1000 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +849 5000020500008004040906007000000500350046700800000000007000050000000000000060000403000000700000060070000932007000002026020000040000600309000000800000000000000100000000000000000000000300909000000007040000300000087000000431200000000000400430000000000010000000040000000000608000020000500000000000005000013007000017003400004400000000007000000005000001400059058000000508007839010007007008640200000000000059000000047000000000000094000000031000000000000000000000500000100600002000000000200000000000000006070000000000000000120000070050000000000000206080000600030005004100000702000090000300500020000300000000000000300800000200016000010800080007000050703020502000002000000007000000000002000000530000710000010000605000640040100005505000000000002000010000006100505000009000100000000002050090000000080001800000100000200006000002020520000033300000057000000020000701 +1000 01202201011210221200111102211201010001222010000211001112021100101020212011212012202001101222202001101012220000001211120121022022122122021210211200002200002000022020221120020222102100020211220020120201010122121020112001100122020020120222210000012221210210100001122201022122021022200012001100020112022112001202102201100021010002102201202000100021122002001000222020100102010222212020212202010021102212011110102222102112002021201120101021222021200020021220122111101010101221210222220102122012120222111021000211112200111200112202002002100210022222012102211100102222022120111110011220200122100101020021112211211200220120020211110222012100212020121001122111102111120210012200001021212112110120110211110001001122111001120011221201220122021201110110011110022121002021122100101122100220122221220102110000120112120201220101201101221211210222202102211220010120022020000202122201202010012002110212212010001001012100121210211012021020112111000221220020221222020222102102121021110120101100102212210000120220001100101 +420 8004000000072706000002006001004009040032000000000000000800000004600000000404000000000006900000400000000006000000006006000000600060060003000000000000006050400000541010000004000000006900100640000800020070008000000005000000000000004070000011100000050006000000000700000000000000300000000300086000064000060006400000000030906000000000020350030000000800000030000006300000003000300000030000000250000000000000000000000000000000001 +782 120202012011120210111222120100120210022221202102011101010011122202120122020200200011120202011020220122011001122100211102112211010121021221022102000110200122011200120211102012021011211222000012112102121211012010100201122202111210221202201020011102100100120221021120010211221112020201000122012202112211202020110201102121202110100201001200221111201002012221210202222111010222210211210121022110220002121111210010120201102221121211120002212212000001211011020011111201202220200101201000022000200002102121021001121122110220221000002211110122220101220102212011101102020020112021212010000102202202010101122121022100101011111122102201012102200112200110112011212210200021110221011221022120020202101021000220012102201200112222101202100002121010210210201221001220102102011112102020112122210010111 +216 0500060030009000000408080000000000900000000600008000000000040040000000936001001001400100000000090000000080000000060000000600000100001000000009000008000050070020000000000004000700000000000000000000000003000000070400001 +1000 20708000000001030000070005100000006500000000017600000060060000000003000000900000000398000607001220000294024000000004000040000000000000009000200070040000009100000090000000070020800030053200000000000701000000800000016070000060000040000800700000089600000000000000000070200100000200553000000000063000024040000000001340000800400000720030607000003007200000000204000010101008000000000007970000000082200000000080020000000030700000000505000000000000000000001000800600000000000000080060006000703103040000000700802400000000000005060040000000091900000070009000080000030000000300000002048090000350000400000000000622700300000000090004000000070000002000000000000600090000100003000000070060000001005000009055100000000002000000001000000000070003006000000000800060007200200000000060000100036000000300100000200000000000005100000868000000046050000340000000000004000090040000000000009000000007041000000700008040000005000070800107500002000000000000270008000000004800000800000000000000300000000000000004040000754000003000071 +828 0000004700000000400800000400000600060480007000030000000000050000060000685040000000009000071000095000400000007070006500760606093100000003800000800000000086000000006090000200000700000070000020500008000000000000000000400020388005052000000900009009009000000000000600000000000000800005115000349040000500000000007502000500000000000000000000300000000000000000000000064000000070000020810080000000060000000000000000000700000000000970200000110000000000000000000007070000000590072720000000000000002031900000000010050200900000000065000000020000000900000000907000044000100001002000000702005045000000002000100000600170000000000000000000300008000000000660003007500000060000000000000070000080007000030000000000000074000700070100000001000000020003300000070000000000070105600000000300000000004970000004890203000090000040000000004000009000000200006 +252 1398528230312560483990294965967803912134855370603536795111770984198343235708168535875041323127795546344207455338678666963902020832253085812578301721456876960789521892302480660831717615285508275209910449942951299829474400535555352135056006777958830848463 +798 2000500008500000000009003000000200000000000000000005060000000000000000300000000000000009030030070030000000016000800000000008600000000600000000007000000000620000900004000020000000000700000005900020000005040000000000008000007090000000000000000050090000000002001073008600001000000006300004000007007000000000000001010001600000000000000000000002104400000000000000000090000000000006000700030040800000000090000309000009000000210000000900000000970007008000000000000170003390801000000010000000800601000000000000000640002000000105000020010000000004060000000600000000760000061000500000100000040000000083009040060000000000000000030700000100010006060060260000390007000000200000800010008008000000000000007402000050700507000000000000000600009089000000002000004400000006000000104000040000000900000065050000200500001 +1000 20800000006000007000004090700070000000540000000000010170000000000000407200000000040609000000025008000000007007000000600000000000005000609000407090500060000000000000000902007700000003000000000000000000000040000100030040200080000005000800000000000008400000000080100000000700070000000600000077109670090001000000001091000090605600200000000000070040500000090001000200200000250000002400000000000000000000000000000000010000060100000073006600087090700000002000040000010000602020000006222700021640007000800000003010300043000400000000000000000203000000000900090000000360000006000270000700000050000000000500400300000500100000000009508770400032000000860040000000000060003000070000005000002000000000600001000000050000000003001007000000010010020000000000000000400000000070005040300600400000000001000080100006000060001000001550000000807000000005000095000000000009004000401100000040505000000709000085008980500000070003000000000000800000700800320008507000800000000050001000000000400000002000900000300000003060000974001 +578 300300600003000771500000000097900002050080038000000000080000000000060000000000050009000600090021000000011003000000600650000003200073000030000000000000040900800630400900000060040040500000010280070300090700000000006000000400000000004000005070000050000000000000006000000000000500700000040800700000690000000020200000000000003000007000030000000000500054005000000000000000700000000000005020000000707704008002000000000200900203000000000000080000000000000003300080500000007100400070600080000000000000000000000000100000000000507040000000009580000008000000095000003050000030000900308000005 +1000 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 +1000 00000006080030000000887400000000000000200000400000700000900400000030000901000000000000000040000003000001320000090500000000050000000000009009200010800000009000000604000000615020000006090060000008000003000200000000800000000003000000000702300000607005001007000090000700000000000000060400000000000000000000009010000000000010009560000007000050080008000402000010070000000007890000573000000009070000000030000000170000000009080070003000000140990000000000000020000000000000000000000000000080000020000000070007000300020080001009800900400300000000000009000008510005000060000500000001000070007900000006009000080008000006000020000000000000090000002030000000000000000300000007700050000000000000000080000000000007070000004000400090000009000000300000700000000000007000100000000070000400000000000000000000000008030700003000002000000005480300000500010000000000080000000050003000006000000000970000000600080000000000000050000020000008000000000050000100070007060010000000080000030700000300500007003500053703005000000000001 +459 1997249940277984801459202480300558945285924103782396762504791448630132705500271417410967699605313660182665395689429538948741674361118040171099029905799867543908670263266482250789655066681823688567547005747335103094050786917924083313859877454930361551758039815049362955714768512398977291432335517303479840181092657394915636971103993654497344091368769802227306857348840240834164344140950931610695416313678937270355101213250626449156250995138413142622434751173731 +566 040710005020000007000107001050000400060900000000200000004004004150000000000400000008700000850900000600010030002000950000502000000000002000000000006003000210000002800000000053007000000300000000080005140000080800060000000000080000000000500000000000370000020800501080023000000030000000300000100900090000000000000000600890000000040033000000000080000049004000400006000000000002008000000500080030000002901000000000000800000000000007002040090004008000000000010000000100000010000000000000000080000000000080000005050000007050000900000000200500000000000800004000800035008080041 +1000 00006800000000400000006000000000002000050080030099000000000000004004000076002030000000000900060000000000000008000000401000016000000000700007006090050260010000000000000000000800004900000030004000000000000000000000070742040006002000270800000000000000000090000000005000050030500000400000030000000650007600000001006000002036049600010000006000000000049000000000000000038000008050900800000070002060030000000090030004690800000000005003000022006080000000000500000000000000000008370000800000006000009015002000000000000800003020700000000000000400008000008040200060100080200000403023000000000000000000000300000002000000006000006002050070070000059800000000090900000000660001000502200000090034000080080000905060000100000140000000100009030000605840020000010044000000060080000304700080004060000030020000000000070400000024009090209020700008000009020006000000000000002000000000000100030000000000600000000000000000800500000100000002009000000009000000000070000000206040000700000010000000007500300001000000009273601000001 +1000 70000000500000000000000000507000000000026075000000050000400906000010587080090000002500061800000000053500000000096003859000008049000000000000000000300008004000000380020400000000100261003800800006410090070000000100000008000000000000308000000000000007000000020000000040090000000500000000019000003000700800020400000000000600000090000000000801070040030000000000100097540000000648000090040600070000030000000000000000570000092802000000000000000400000000029500000800067002080100468100050080000800070070000000030000000000080000000000480000006000060000000000000800050000000806000007000010000000200000000060008000087013100000292000000600000000000000900400000000008900000051800700500000000030702300000000000000000000092002000000000000040000082000570000000000001000209090000060000000090500000000000000000000000000000000000700000020900000065000052002000000000000000000102550000000007000001000046026000000000000520001090203806800900000000000000185300000003870070000000003070000000000028500050600500000000580000000801 +1000 59056954927612485553007765691285464553603085929818052539867784087855798368302307880578695716311451094228825099973950450959607611161428155013136248361215497867036762781268951389669439195987330105674909756281818090884262426135972145578115153633735651011410762303353035206597203452377593209877301400792404549939382671942106744195042980038733784391917888746541744259501156205770785626468506909419684947898982271904749283965460163764786712138515142890293636558967458179395222463741320472141019249542784615288593826010497569471425366520886840487152136171589893898389525538457652635413681088079266541468518767788905650390086788339394964722938652922680363194120369413373596665356593664120854190092022551737398841931560309763717689883564128441216457268284385055210383681055357663996426489176296450781192361598310408736217255168260236237624188042186381380909798376319230462884816831317647656026830735329226236334894381008916729720288651243152887786881451172313322865096879326179689635474631658184500678492844732 +1000 33725272438016925523010412473719353646082366236415606414108422790819796178033643398649412519791643888614346023854890074381603029888826181935560618285798703224631010128711990035140871649643684891507736453313456507465373131431103092670941577214885155365417354653215520949831905034506432655485918074705919098885624077887318369783145067427870492011656909213481898601986326027748640195828477638537533426243847702394398678906968064578912659525313342748620842717961653929398390457160312516579972945966618044446992999582290970662258745817454412228840883149538268705597208855078568337843759113256530256238957052665543452932357589522065914041940578363511556088040679158270960496817437829512109785008091029328559309030396848246234022849476121056100493121741716575546178045290451829287527393102129290134829629257070220160862396454015068694169738738322065928088532296742928267843869531157550833978382020945160889932632452479344196175799894538026587698348615476250798901626569103092437111211026271089749093096714149 +446 479007987323639061180208005190497972492079542075010603512282780176801055706181475914708915664383434329319482537653426320600727753750272834333729741774683840805214103007446496035816858757448279276814937755838676811880553313653383543860997894826951107527738335757802669513500850042174808832483533620044124179144137675798186106911326371280874970755522003506714994570666892774278738381519207797883323135423428761612028000152141791745374089702122701626 +387 0122201202102121102201110200000120010220102111100100002112210011020221110002120011200100221121120021002111220002202222002200021010022220200101100212110220010201111220021122011200001212202011122122220120000010112010100002111101101121102011022112020021122222220012212000202020202000021210212212220021111000002100102110101112011102200011101102210021000001101211122202120022201012020212022012 +983 021000222120111211110201012000120122011201110200200200120102020200011122112120211112012212102110102221110120110211220022020010012200210002211210110210001100201100021101001111020120010122210222000020020000102212210120211202001112112121212101210101212101222101010122021211210100010221020120100112122102020120222212111221221220210121212120122220112201000021001222201201122101112221220100111122101010220110120211220110212211101122012211221010202012001022012112011000211012002101102110212201211211102111110202010201110001221212122022202102001221201110201010202220012010110120210200002101202211112121000120110010222200222102002112210110002111001112120011101121201112011002020221221010111010011112221200010101100211202011001100201222221120012010122100110202000011021202201022201211220220111202111121212212220010110212101200212120221101201220202020100011112020100220021101020220100210010021011122122222200011020120111111200022202000202001011120010000002211020201111221011111121100212020000001 +15 0004001400000001 +10 10011112021 +670 22102120120010120222021202202201120110001212211201010120020122201120212222200001002220211202000020001120212110221102000002102012012110111211021221110112200011212011012020022021200221001121111102221000111200111202012222220211001211202102202211112201211002211101100021201012001120210111221010122022122022022010212111210202210022001212010211200121110120112212022002001020210202102222110101001102202111010200022220000121000112010112212121002110022221102222212102122022011102112001002222100012212020000100202221212122100200220101120121110202000001101001212010221021100122220220121221001011220101012021021001120220121110000202121022200211221110201210100010202102021122111202212 +1000 61443431244618513727495069543426414238417894693163692927166020446935691981724824819111926147136741560188306603700034805905934330327905640524935543303873996370523019575343691699428891900503714381117954265525666242962643114455690909791208384786566931634901839290994618941808139971884089271784994257504242119665093857608854343513241707120378658079399516948318939365539807443446627130335479882780158599435399353234222169449147639132831343979599407006581072191420719846885473938801197592065969163884934740733241330492172936655611597334871976045509386618590218603158053460269375134699910522021251212742769179356466633201405881489522389557320073568867387428521854738387708051635240880453318604770372230553946508409989559369478894753992123143978888158992427641122343469993836536720487613621655184156925013246758786415727368201826776830250948065539399414535465533687723467154742323066536299533499826900560912705517066294636698885211426308309611081796883106608685561501604467398038037474055871364522216783124227 +924 2060000507200500000000900809000500030407800050205000000034500000005067070000000000008005000003020040007000000000000700000001000705009000001000330007300000300007400040000060000809020000000000000001570000000920030000000700505700000006807000000000000700200901000008390002000000500000000900000007000000090000610008000070000046000000005000050090000000000100004000070000000607000000607000010000600000000000000108000099000000000500000080029000030000000000000601000900000060006006020000060607005400040000090000006000000000080000000050000000006400000000000000030000030100240000000000002200700040000008400000000700000006008406000400060900000006000000100006740000002000000000003003010040900000050000000009000000800000000000000100000000901090008000000605001000000007000000026030000300070000680000010000000400000100000000000001000000000000000500000008000000006000000000460030007100000000000000000000009000000000000005150000000000000002717 +845 000020090000000000500002000000000000000000000000010000000700090060000000000070020030000004000030070000920306600000000500080504000300000005300000000008200100000000000008000000000090600000300000000000000000900000005000800000990009000000108000008420000000300000099000500000050000000000030060080000000020000080000040059200000000009000900001010020300000000090000000000000009003001955000060000090000007029000000001000000300000052000000000105000080800030300009000510390090400400000000000090000000000000050080000000000050004900001200000206300700000000300880079055070500000000090010020000000000000000080000050000001000800200900005001000000000000000907040800300000000000300024000020000000300500200000000000000000009000007000000000000000000060000500400000015000003000000704000000000000480000000805000000600060000900000009000000100020004805000009000000000001 +1000 20221202000121211012110110122102120100222011112021022202001020010221112002022121200121112002002110210200200210202021110202111222012210212101112000201122100011201200012202221001212101102122112221220101012210011210112222110102022202221202202002112111210122001022212020210222202221120012110122101021202210222020202100101201210122202202211101120222112001000110212220202000112120120012110102112101010211121000021111121011202112011212100112212111210021112110222102100100002002211121210101020211120211211020112101202210122210012002221000222121220010010011200200011212200121222120202120110122202100010112011011112002202002002102101211022022201112010021211100201120201210010001102101111001112111220021010211012011022112210021111121012220100012022201100202111201110210012112112022101102101222222022221122222210101210000200120022100020122000202110111121121020002202021220111211000211101022022202112020211001220122201220202001020202200011001011212211001010001021001121022210121110112120102212112110202112102012221 +1000 78600280000090065000000000270002800010000000000000001000200000000001040000086000000960030000030000006008730000000000850000010000000080800080000000030000000600000000000030030006050040408006000005000000000000290006000000000300001000000005030060065000506050000008090800000208020090080000005000002000000000000030000000600000000080000007000060010600030000000003900700080800000003000008000000000900000000000000090000043000006170805000000000006000000000037000200740700000600000000000000000001000000030000006000000502003000000000007300062000000003540000800500440200000000070080090000040000000000000000001000000000000000040000000006007000200720439000200000000080943000700970000000900000009000100300000005000000020086002050210000006708000000050000000809101390700000000100001700000003000000200000080000000900000040000050050200000080100020000000006550801084000006301000000060052000801000104000040020000000200000000003001000970000009570840000060009002000080000000070060107000080070005010005012020400000009008010031 +1000 00060100009520000100000400000060000409000000045000100000000001000000000064990000804000000000000007080130000000000150011003000000430006000007200000000000100000000000000000000000000000900003000000000000010190020500000000000009172000990000005302000900005000070000000000000000900000000090000000000000050000000000690000050000200000000003000900000000000000000000000200000805008000600000000000900000000600000000300000090000030009000000000005078800089070000200000740007000000000000000000700003000000000431000079000000000600000020010640000000000060000000049006000010000000000000000090024200000020000003003870040001060007100067000000000000600300600300700000170090050060008400000000008702000000000000000100400080060000280000250006000010000000400000000030200000050000080000000000028050400900060006000000000000000000002000070000000000000246450000000000006505000000000000000000000000000306000000080000070700000007000800000000000308000080090000005000008000000000400200030000010000000000000208000000050000700003390007 +931 20407400000000000800000606000000010100013030005000090000000013080006004000000080002000080300000006000000000003003008050000000000122005002030000130060800000900000006006300000009000500109000000000602400070900603000033000200000010000000800046000030000003000000000000000080040090050000371000100800300000000000000200000000000010700030050000020001007000000600000000000600000370808090080090000700000070002000007000400002700800079004000000001009000700080080060007200930253010200800002060000000056000004000200000000000900004500000000004000000600008000831080004800000600050000004002000000100060000000000020000000000360000900569700000008000000000090000750460007070000000000000530020807080000707600000002100600030000000000090700010140000000000000100000007004100001900020690001083000000009040000000000000000505000090000000000340060902000502000009000003000000000100050000004006000000900000070040000000000090000000099000000800063004000017046080061 +1000 22011221101211212201021020010112011120102100012211012210012212121120000000121211001220100222101222002212222202101020121210102200011201222000220200101220101121121020222021101101100111212102012021021211200101111111000012002210202002201012121100011202002201012102201211111021102221110111202120001011012222000202120222120100210102021001212010101212102100201202212000121202100010100111220012122021022220212221211011110201021111100122121112002012120101102022110202022000022002020221111120010120122002111002122211111101122021021121020211121021001011221210120102202122102010000211020020012200112212122202110002201111001221212200100222112020120210111102011220110102021110010221201002022200101011200210222220120011110100012121120220012002022010012212222102011212222112212001010200020021210002012021020001211220122011022012112221100002102121122100111102011011121000220100221102202021120211202202210011222120002022201120211020122222010002001022020022120110112001210000212110221200020210010122202020222201210220201 +160 43522770070471433412578228282852648519205608397197385846343904707504872403428444189992887296382582808523083213558464327882467336290404200896154160406677316466207 +232 11111102211212010011020021000112020211101020120202111222200001011120011211210012020100212122110221222122000220210021020122112212101101000000000000111120110121101011010102200001201100022010002120201102220120111102201110001120212221221 +721 00000000000309040000000000007090050000500000000000500906030101000000000000005504006458004000005000206000900016000000005000200000000001900000000000000000505300000200700007037000400000000003030071000000000000000400043600000000880000007230100000640070000000000000000000000000000800006005500080008000403000000000200107000000000500000002402000006200802040030700075000000100100000000010010000000000002000002030100000089000780006000090000100003030003000000000000070008906030002000025000003006000300000002059090000000000400000080007000000007300000900080000000700200000000000000300020040006500600000003000490100009000000200006100000000003000000000000050000020400000100300670000002000099050000000000006006033000000000003400000750007 +1000 72000900000800000000000508000000105000000000046000000005000085000080000000000500000050870000000000400150000000000030010200300400090009040000960200000090070600000063400000000900000050000000000009200000110020000006100000000090000000000000000000000300000190000040500000400000001820000840450020019592000100000000200000008002000000007000000040000000008000200900020900000606040000000904008000030011000000000060000609000000008000020005000200010000072000001300000016000080000000000040000050000500809040000010000000009020000009000000000960000007000300000000010088400070040000500000090000050007000000001000400000000000630000050000700000000040000200600000000006080000000300003000000905000050000000800060000010000030109000060990800500000900015000000000400370000000000020300600066000000060000850740000004015000060000000300000070802000000000000700000009009000090000000000000000000105000009006009000000000300500060300400060005000000000000008008000000000005000000000980000000004000010002100075009050001002040000500001 +1000 01009000004000000030050900007000040000000000000030458000000400000600000000007100000000800003024007100008900050000000000000090000001000000000060000000008000900065002070000000000000000000000080300024000000000700000540000000100000009000000000500000000000005006000300000000000000000020020080000200000000089000020020000000288007000080006000050000600000000004005000000080800600000000000000000000060000000060790610000000000000007300006005000000000000000003000000000500000000900000060000000020070020000000000000000904104150000000000000000004000000000002000400000000000060000010000000000060000000000308000084600000080000000100007000100000000000009850000007000030000000074008000006000450400000502080000000000009000000000000180000000009608070000004850000000003063060000300900000300000020040005606000000000050046002000000005050600096000001000000800000050400059000090000090000006000000004090030047050000800003010300060067505002000100000000400000580400000040000009600090020060007600700020005000000000006800400000001 +666 1002000222102000001201002220121011011101212112021201112100001100201212022011122210201200010010100022011100022100200122110022212010112200211102202000210102002100112202100102220110220202011101201200201121220021100002102100000121100012112001102000100120202202112111012011100122010121021101000200112202011122011120220110100010000210121202101022012220110101110120202021222000120001022120222111120112111021022012010110211012122212002221110210011102021212220011121201002110012020002212100111212211002021100112121020002120120201202111001010122220120122021112201002101201122120021010110020111111000011120120011212112012111201221102212000222221111001102001222011202202200211222 +1000 00000070842100000000009000800100300080000320400000000010000003098002000000044060000000000060400000000006000034210000210050720000540000204080100000008000070000600100030000525020209100000000002002061002000031107000000000000000070003000300000000007400000009000000000000030000000000000504000600080000030000000000000600000000010000000000000030000080600000900000005000000000804900000000000000040000001030030004000000900000600000000700003000000000000000000000309000000000500300000000200000800010010080000000096000000009000000000000800000000100000000000604080080008000000053000040000000050000000800086000087000000000200080000903000005005010000000000900030000000000000291000000019000700007000000000060000060509800009000000024000000000000000000069400000000000000000000100000007000000000004000000000075000100000040000000000000007000000000030003000000700000900000100000000000000000000100740000098000002000000000000000000600000500090010005005001020000000700001000000507005020000000070000500910200000000000970070001 +251 009000080070000000004000200907000000060050020000000008009000000000070090077000000000000000060000450060000000500000000000000050003060020900000000000000000000000000000000000600500300000000000000460000000000000005000700000000000000700307008080000070060001 +1000 50000000000000050050000000010001000000603000071000005000050049000000004000005000008800004008900080000600009000000600091070000003060000000000000000280000610200000801000000810000500060900000000007007000000000000000014000000000000000000026020030000000000000000504008000000070045009023000000280050004030050604000200010000200000000000007000000405004000000000042000000000000000700820000000000000000057000000000000000000000000080000060000000003035203470010000000000020000000200100006000000008000000009000010100006000080000000000048000600010000000301020000000000040000100400078016805000000009000500006000002000000000000061040000800300000000000800000060008030700000000047007700000000400000030000000007000000006000000030000000010300000004330970050000900600100300008000003000000000000011000000000000900004000000005000000000000007000080060003000000000010000000007040000090004060000082000000000007504000000040070005001036000000080400000000000003704000000105000900000000000000307510000025060000000006000830450000001 +1000 01221200221121201022221002102122012020020100202121001100102112012110011021022002110011222201001120020011211221022112021121111102122022011121222022120100112012121200011102012021100222201211010002021021121012122222221012010200221020011002021101101010011200210112102100101121022002022102010022120221202020001122112001212212110021112221221000001110012101021210001111020100212202002001122220001111110012222001201112102111002101200010000222111110102020010021110221010112011122001201102021211011220120102212102110111220222110000002222001220202211011122021010212121201220202002110012021222201121011011111000112110210211212111212100222012212102022110022002222111022121012122021012101122110200112001201011210221220200221121110022021000000222011122021000220111121111212021211110012022220020212112001001120211021011110021102202111121211210022001112002110001021022101010000221021002022002000022202211210001112101010100112120100211111201010111211111022221001012002022000021202211010202211022020022000201020112111212 +1000 19000000006000020400005000070000005001001520404000000004000060000030018050007000000080000000000900000000000300800300000009004000010000070000230009000060000000000070000002507003700550500040000000000000903000010009000900007000000002500000000007000000000900100000090000000000001300050000000060300000000009092002000000030090000000802000003031000000000000002093904009000000000000000000400000000000900100020000201300800000090000506020000100600900070000000000400000000000000900106001035000000000600000900006060300000000000000099000000007600000000000000400005200000000020570000000009202000000000001070000000900000000170004001020000760400040820000000000000000000672000000000005070000000000030040006000060000006050000603000000000020500006000006000032006000000011160400000005000090000000060051400000800010000001080000000600000090700000000000020002030900000000070030002100006009000090000000000005400000500000002000900008040000000000000500009820005005509560000000000500000200005000007000006016100900000000000000001 +229 50001700000000700800000000000000050000000005086280605000000000000000400000000000070500000000000000000000000000000059000920001800035900080000000000590002000570800000700000000000000008002780310030009000600000070000050500006000000001 +1000 40050000019000009000001000060000090000000090000020000509000070003000016500020200090000005907000000017000900009000000000500041000004000680000007000000300604003600040000000050039060000540470006000000000230040380700900000000000008000800090500040050070000000200000100000040000005000000100050000000000000500000000035040807000000000001001000000000000000000000000000001720000000080000000002000003030400060550000000800703000000020000800320000000090307000050000231090060000200050000001041001000000000500000000070000100000000540000080000000000000560000000008203000003050000000000500000000000700000060100009000000000001000000050000200000100004000065000000000406800000030074085030000003000300400040000000000000000000000009008100000000000700007000060000000080403000004000000000009000900302000004000000070000000000300300940000000300020035009500050000700004030000000000007009900000000000002000070005000000002206400000000000010040003000000080000000040000202090000000060000080000002004000700000090006770300000000000001 +1000 89030656005000009010000000009090500000000472000300009600409000006007000000600000000990000000000380600000000000000001070000940000000000400000000060060000000000000000000010400005003700100000080000070000004009060020000030000040560003000000000000708010000004370000000180000000000000000000000009070055090060300000000020600097000000000040290019000000000050800000333700002610009080000000000200000000000000060000050000000710000000000706000010100000400000000000500070000000000900000000000800009000300000700000003000000000500079000000000000060000010009000050000908503000000000000000000000000000090006003500000600000705000003090000000060000000000000060000000000300020000000000806000000100900500000002008002002040900700007163005000000000000004003000000005000000000000050080060000005000000000000000950000000002400200004200060000000000903060000000030000007000001040040000003300000050026406200000990000300000000000000301070093000060900000000000000090000300000900000000000000020400610002000038000000070904000000070001 +452 014001040400009000020000050000090010000720500909000010000706300004040204055000000000001009000000009000000700006000000000000330000000000000000000000402000000090000007000000000600070000000603300600060209000000000900000000000660000000000060020000001000025020703004100090000902000000000008030000800007000000000000017030000010000800000000400002200000000404000006000000000009010000020000800005600800000000000007200009000180001000000000500000010000000050600008 +4 11111 +854 702000600021000000000070000008000000000004000000009000700086504005000000000000000000020000000000300005000000010010000000200000000000000000060000000530030090060000000000000100000080000000000001000630000900000002400000060000000400000000000020009000000700500030000060010000050000000000000000000006001008900400010100006000490206100000000006000000600000000000080000000060000000000006000000000000000009500000000000000000003407050000030007000050000021000084000300000000300808000060000000005000000000003000004000030000003000000000000700000090000020000010000000000770800012000900000000060000804000000000000007008000000000000000060000634090000030000003050040000000000009000000000000040000000047000000009043080000900000050090003000900000000000930002100000000600000008000000003000070000500049000000000003001002800001200000007000002040006680000000000650000004000070001 +105 8877370925930940118871595211419067838834505387917306834194193143982500526347598598362705254135466427150903 +266 101021220000112200210211000101011212000101010120002101221120201011101011112022100211212221101022111110211212012222120002200101211012212222122222011002002020022122120220011111002221122011100111220202122120202020111212112221120221210012020200000100022101211102120011021 diff --git a/CodeJam/Google CodeJam 2015/A-small-attempt0.in b/CodeJam/Google CodeJam 2015/A-small-attempt0.in new file mode 100755 index 0000000..83ad3a9 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/A-small-attempt0.in @@ -0,0 +1,56 @@ +55 +1 4 2 +1 7 7 +1 4 1 +1 7 1 +1 8 8 +1 10 10 +1 3 2 +1 6 6 +1 6 5 +1 8 7 +1 9 5 +1 8 5 +1 8 3 +1 3 1 +1 8 1 +1 1 1 +1 2 2 +1 10 3 +1 10 9 +1 7 3 +1 8 2 +1 3 3 +1 10 1 +1 9 1 +1 7 6 +1 9 2 +1 10 2 +1 2 1 +1 5 3 +1 8 6 +1 6 3 +1 9 7 +1 9 3 +1 6 1 +1 10 5 +1 7 2 +1 9 6 +1 5 4 +1 4 3 +1 7 4 +1 9 9 +1 10 8 +1 8 4 +1 7 5 +1 6 4 +1 10 4 +1 5 5 +1 5 1 +1 10 7 +1 5 2 +1 10 6 +1 9 8 +1 9 4 +1 6 2 +1 4 4 diff --git a/CodeJam/Google CodeJam 2015/A-small-attempt1.in b/CodeJam/Google CodeJam 2015/A-small-attempt1.in new file mode 100755 index 0000000..aa5a09e --- /dev/null +++ b/CodeJam/Google CodeJam 2015/A-small-attempt1.in @@ -0,0 +1,56 @@ +55 +1 4 2 +1 7 7 +1 10 2 +1 6 1 +1 7 2 +1 9 2 +1 9 7 +1 5 2 +1 9 8 +1 6 6 +1 3 2 +1 7 5 +1 9 1 +1 10 7 +1 6 5 +1 5 5 +1 5 1 +1 3 1 +1 8 6 +1 8 8 +1 5 3 +1 10 5 +1 8 3 +1 7 4 +1 6 2 +1 6 4 +1 8 7 +1 7 6 +1 9 9 +1 8 5 +1 10 4 +1 2 2 +1 4 1 +1 9 5 +1 9 6 +1 4 4 +1 1 1 +1 10 3 +1 9 4 +1 7 1 +1 7 3 +1 10 1 +1 6 3 +1 10 10 +1 10 6 +1 8 4 +1 10 9 +1 3 3 +1 5 4 +1 9 3 +1 4 3 +1 8 2 +1 8 1 +1 2 1 +1 10 8 diff --git a/CodeJam/Google CodeJam 2015/A-small-attempt2.in b/CodeJam/Google CodeJam 2015/A-small-attempt2.in new file mode 100755 index 0000000..2b308cd --- /dev/null +++ b/CodeJam/Google CodeJam 2015/A-small-attempt2.in @@ -0,0 +1,56 @@ +55 +1 4 2 +1 7 7 +1 8 2 +1 10 2 +1 8 6 +1 7 5 +1 7 6 +1 5 2 +1 6 2 +1 5 1 +1 10 3 +1 5 5 +1 3 1 +1 10 10 +1 9 8 +1 6 4 +1 6 6 +1 4 1 +1 8 4 +1 9 9 +1 10 7 +1 10 6 +1 10 9 +1 6 3 +1 8 7 +1 5 3 +1 4 3 +1 6 5 +1 9 4 +1 8 5 +1 3 2 +1 9 3 +1 10 8 +1 8 8 +1 7 4 +1 2 1 +1 7 2 +1 6 1 +1 9 2 +1 9 1 +1 5 4 +1 10 5 +1 8 3 +1 10 1 +1 3 3 +1 10 4 +1 8 1 +1 7 1 +1 9 7 +1 9 5 +1 1 1 +1 7 3 +1 2 2 +1 4 4 +1 9 6 diff --git a/CodeJam/Google CodeJam 2015/A-small-attempt3.in b/CodeJam/Google CodeJam 2015/A-small-attempt3.in new file mode 100755 index 0000000..d45f773 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/A-small-attempt3.in @@ -0,0 +1,56 @@ +55 +1 4 2 +1 7 7 +1 10 3 +1 8 5 +1 10 7 +1 6 5 +1 9 4 +1 6 4 +1 9 9 +1 5 3 +1 8 7 +1 8 1 +1 7 2 +1 7 4 +1 9 6 +1 10 6 +1 7 1 +1 8 6 +1 8 3 +1 9 2 +1 5 4 +1 10 1 +1 6 1 +1 8 4 +1 9 3 +1 2 2 +1 5 1 +1 2 1 +1 4 4 +1 9 1 +1 7 5 +1 10 2 +1 10 10 +1 7 3 +1 8 8 +1 9 7 +1 10 5 +1 5 2 +1 6 6 +1 4 1 +1 6 2 +1 9 5 +1 10 4 +1 10 9 +1 9 8 +1 3 3 +1 3 1 +1 8 2 +1 7 6 +1 1 1 +1 4 3 +1 5 5 +1 3 2 +1 6 3 +1 10 8 diff --git a/CodeJam/Google CodeJam 2015/B-Output-Small.out b/CodeJam/Google CodeJam 2015/B-Output-Small.out new file mode 100755 index 0000000..fbd5d9d --- /dev/null +++ b/CodeJam/Google CodeJam 2015/B-Output-Small.out @@ -0,0 +1,100 @@ +Case #1: 3 +Case #2: 2 +Case #3: 3 +Case #4: 7 +Case #5: 12 +Case #6: 6 +Case #7: 1 +Case #8: 6 +Case #9: 5 +Case #10: 3 +Case #11: 6 +Case #12: 8 +Case #13: 4 +Case #14: 7 +Case #15: 5 +Case #16: 6 +Case #17: 2 +Case #18: 3 +Case #19: 5 +Case #20: 6 +Case #21: 7 +Case #22: 5 +Case #23: 6 +Case #24: 3 +Case #25: 12 +Case #26: 6 +Case #27: 6 +Case #28: 6 +Case #29: 6 +Case #30: 8 +Case #31: 1 +Case #32: 5 +Case #33: 12 +Case #34: 4 +Case #35: 4 +Case #36: 2 +Case #37: 5 +Case #38: 7 +Case #39: 5 +Case #40: 4 +Case #41: 6 +Case #42: 6 +Case #43: 6 +Case #44: 12 +Case #45: 4 +Case #46: 6 +Case #47: 4 +Case #48: 6 +Case #49: 4 +Case #50: 2 +Case #51: 2 +Case #52: 5 +Case #53: 7 +Case #54: 6 +Case #55: 12 +Case #56: 8 +Case #57: 6 +Case #58: 5 +Case #59: 5 +Case #60: 7 +Case #61: 6 +Case #62: 8 +Case #63: 4 +Case #64: 10 +Case #65: 5 +Case #66: 8 +Case #67: 6 +Case #68: 8 +Case #69: 4 +Case #70: 3 +Case #71: 6 +Case #72: 4 +Case #73: 8 +Case #74: 8 +Case #75: 10 +Case #76: 2 +Case #77: 8 +Case #78: 4 +Case #79: 4 +Case #80: 1 +Case #81: 2 +Case #82: 12 +Case #83: 4 +Case #84: 4 +Case #85: 4 +Case #86: 6 +Case #87: 4 +Case #88: 6 +Case #89: 4 +Case #90: 4 +Case #91: 6 +Case #92: 10 +Case #93: 7 +Case #94: 4 +Case #95: 1 +Case #96: 4 +Case #97: 8 +Case #98: 5 +Case #99: 7 +Case #100: 6 diff --git a/CodeJam/Google CodeJam 2015/B-small-attempt0.in b/CodeJam/Google CodeJam 2015/B-small-attempt0.in new file mode 100755 index 0000000..18eaf48 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/B-small-attempt0.in @@ -0,0 +1,201 @@ +100 +1 +3 +4 +1 2 1 2 +1 +4 +4 +3 3 7 8 +6 +3 3 5 5 9 9 +4 +9 6 2 8 +3 +3 6 6 +5 +9 9 9 9 9 +4 +2 5 2 6 +3 +4 2 5 +1 +1 +4 +7 4 1 4 +6 +9 9 9 9 9 9 +6 +6 5 4 3 2 1 +5 +8 9 6 7 6 +6 +6 6 6 6 9 9 +5 +7 5 3 9 3 +4 +6 8 3 5 +1 +6 +4 +4 8 4 2 +4 +3 1 1 5 +4 +2 3 5 2 +6 +5 6 9 6 9 6 +1 +7 +4 +3 2 7 4 +5 +2 3 2 2 1 +2 +4 8 +3 +7 5 3 +5 +4 1 3 1 1 +3 +3 2 1 +6 +3 6 6 6 9 9 +3 +9 5 1 +3 +8 5 2 +1 +9 +2 +2 1 +6 +5 5 5 9 9 9 +1 +4 +4 +5 3 4 3 +4 +4 6 1 9 +4 +4 9 6 1 +3 +4 8 7 +4 +6 7 5 7 +5 +4 1 2 4 2 +3 +4 6 5 +2 +9 6 +4 +5 3 4 5 +5 +4 5 1 2 1 +3 +8 8 8 +2 +6 6 +3 +6 3 9 +3 +7 7 4 +5 +8 8 8 8 8 +2 +4 9 +3 +9 9 9 +1 +8 +3 +7 2 2 +2 +9 7 +4 +7 6 7 2 +5 +2 4 3 1 4 +4 +7 7 3 9 +5 +5 4 1 5 1 +5 +2 3 2 4 5 +2 +7 7 +6 +5 5 5 5 9 9 +2 +8 4 +4 +8 8 8 8 +3 +3 8 2 +5 +5 4 3 2 1 +4 +5 8 4 6 +3 +3 5 5 +6 +2 9 9 9 3 3 +4 +4 3 2 1 +5 +4 1 5 4 4 +3 +9 3 1 +3 +5 4 2 +4 +3 4 5 6 +3 +8 1 3 +2 +9 9 +3 +3 2 1 +5 +1 2 3 2 5 +5 +4 4 1 4 3 +4 +8 2 4 5 +3 +6 9 4 +1 +5 +6 +1 1 5 5 9 9 +2 +9 8 +6 +7 7 7 7 7 9 +4 +4 1 9 3 +3 +6 5 4 +3 +1 7 7 +2 +9 9 +5 +9 3 3 5 8 +4 +9 9 9 9 +3 +5 6 1 +3 +2 9 4 +3 +8 2 7 +3 +1 4 1 +2 +8 8 +3 +2 5 3 +2 +5 5 diff --git a/CodeJam/Google CodeJam 2015/B-small-attempt1.in b/CodeJam/Google CodeJam 2015/B-small-attempt1.in new file mode 100755 index 0000000..d3f585e --- /dev/null +++ b/CodeJam/Google CodeJam 2015/B-small-attempt1.in @@ -0,0 +1,201 @@ +100 +1 +3 +4 +1 2 1 2 +1 +4 +3 +8 4 9 +6 +5 5 5 9 9 9 +2 +9 9 +2 +2 1 +3 +3 5 8 +3 +6 7 3 +1 +4 +2 +8 8 +4 +9 9 9 9 +2 +8 4 +3 +9 9 9 +3 +1 3 8 +4 +4 8 9 3 +4 +4 3 2 1 +1 +5 +1 +9 +2 +4 8 +4 +1 6 9 9 +4 +6 2 2 7 +4 +5 2 4 4 +3 +6 1 2 +6 +5 5 5 5 9 9 +6 +2 9 9 9 3 3 +4 +1 2 4 9 +4 +5 7 4 1 +5 +4 1 5 4 2 +4 +7 7 7 6 +3 +3 2 1 +2 +6 6 +6 +9 9 9 9 9 9 +5 +8 3 1 5 1 +5 +5 4 3 2 1 +3 +1 5 1 +3 +7 5 3 +4 +5 9 2 8 +2 +9 7 +2 +5 5 +3 +6 2 9 +2 +4 9 +2 +9 9 +6 +5 6 9 6 9 6 +3 +9 5 1 +2 +9 8 +4 +7 4 3 2 +4 +4 5 7 3 +5 +2 4 4 3 1 +3 +2 8 1 +5 +2 1 4 3 1 +2 +9 6 +4 +4 1 7 8 +5 +5 5 5 1 2 +6 +6 6 6 6 9 9 +4 +6 5 9 5 +3 +2 9 8 +3 +1 8 6 +1 +8 +4 +6 2 5 8 +5 +3 6 2 8 4 +5 +4 5 4 3 4 +3 +2 5 3 +5 +9 9 9 9 9 +2 +7 7 +5 +8 9 2 7 8 +4 +4 9 6 2 +4 +4 4 7 7 +3 +7 3 3 +3 +1 9 2 +3 +6 5 4 +3 +9 2 4 +5 +3 4 4 4 5 +6 +3 3 5 5 9 9 +5 +8 8 8 8 8 +3 +1 1 2 +4 +8 8 8 8 +3 +6 5 2 +3 +3 2 6 +3 +1 2 1 +5 +1 2 3 3 2 +6 +7 7 7 7 7 9 +5 +2 2 5 5 2 +3 +8 5 2 +1 +6 +4 +6 4 3 5 +4 +4 5 3 2 +6 +6 5 4 3 2 1 +5 +2 4 2 2 3 +4 +2 8 4 2 +4 +3 4 1 9 +6 +3 6 6 6 9 9 +3 +4 4 8 +3 +7 3 4 +1 +1 +1 +7 +6 +1 1 5 5 9 9 +4 +2 4 2 7 +3 +8 8 8 +5 +5 5 1 4 3 diff --git a/CodeJam/Google CodeJam 2015/D-large.in b/CodeJam/Google CodeJam 2015/D-large.in new file mode 100755 index 0000000..8761445 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/D-large.in @@ -0,0 +1,101 @@ +100 +2 2 2 +2 1 3 +4 4 1 +3 2 3 +5 2 5 +16 8 8 +7 6 7 +5 3 5 +6 12 12 +19 19 10 +18 3 6 +4 3 3 +10 10 10 +15 10 9 +13 16 10 +3 4 4 +6 3 20 +6 3 4 +5 5 3 +7 14 5 +10 5 20 +6 18 1 +7 3 7 +4 4 3 +18 6 9 +5 4 4 +18 9 12 +8 4 4 +6 4 9 +3 3 4 +6 6 3 +7 5 7 +18 15 18 +2 1 1 +7 1 7 +7 14 4 +8 7 1 +8 10 11 +10 10 1 +17 4 5 +5 2 10 +5 10 4 +2 1 4 +2 4 1 +12 12 2 +20 17 14 +5 10 10 +4 2 4 +18 12 15 +19 19 1 +3 2 2 +7 7 7 +6 10 3 +14 7 8 +1 1 1 +6 6 6 +5 2 20 +7 2 7 +6 4 6 +5 15 2 +3 1 3 +5 15 3 +6 4 20 +2 3 3 +6 5 5 +20 10 16 +6 20 20 +5 7 7 +5 6 10 +5 20 20 +5 4 5 +5 5 1 +7 14 20 +5 5 5 +5 10 7 +5 4 15 +4 1 4 +4 4 4 +5 20 4 +6 3 8 +4 3 2 +5 3 10 +5 3 8 +10 15 5 +6 18 18 +20 20 20 +5 3 20 +11 11 11 +5 20 1 +5 5 6 +8 16 6 +9 9 9 +2 4 4 +7 4 7 +6 9 2 +8 8 8 +19 19 19 +6 6 5 +5 20 5 +5 10 5 diff --git a/CodeJam/Google CodeJam 2015/D-small-attempt0.in b/CodeJam/Google CodeJam 2015/D-small-attempt0.in new file mode 100755 index 0000000..b264891 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/D-small-attempt0.in @@ -0,0 +1,65 @@ +64 +2 2 2 +2 1 3 +4 4 1 +3 2 3 +1 4 2 +4 2 2 +4 4 4 +2 4 2 +3 1 4 +1 3 1 +3 4 3 +1 1 4 +4 3 4 +1 2 2 +3 1 1 +4 2 3 +1 2 1 +1 4 4 +2 2 3 +3 3 3 +3 3 2 +2 1 4 +2 3 3 +3 1 2 +3 3 1 +2 1 2 +1 2 3 +4 3 3 +3 4 4 +2 2 1 +4 2 4 +4 1 4 +4 1 1 +3 2 2 +1 1 2 +2 3 2 +3 1 3 +2 4 1 +1 2 4 +3 4 1 +3 2 1 +2 4 4 +1 3 4 +2 2 4 +3 4 2 +4 1 3 +2 3 1 +2 4 3 +4 2 1 +2 3 4 +1 1 3 +4 4 3 +3 3 4 +4 1 2 +1 3 2 +1 3 3 +4 3 2 +1 4 1 +4 3 1 +1 1 1 +4 4 2 +2 1 1 +1 4 3 +3 2 4 diff --git a/CodeJam/Google CodeJam 2015/Haircut.cpp b/CodeJam/Google CodeJam 2015/Haircut.cpp new file mode 100755 index 0000000..bdd91c7 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/Haircut.cpp @@ -0,0 +1,38 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll B, N, i, max_time = 0, max_index = -1, temp; + cin >> B >> N; + vector M; + vector pattern; + M.push_back(0); + for(i = 1; i <= B; i++) + { + cin >> temp; + M.push_back(temp); + if(M[i] > max_time) + { + max_time = M[i]; + max_index = i; + } + } + vector sorted; + sorted = M; + sort(sorted.begin(), sorted.end()); + for(i = 1;i<=B; i++) + { + pattern.push_back(i); + } + + } + return 0; +} diff --git a/CodeJam/Google CodeJam 2015/Infinite House of Pancakes.cpp b/CodeJam/Google CodeJam 2015/Infinite House of Pancakes.cpp new file mode 100755 index 0000000..df1324c --- /dev/null +++ b/CodeJam/Google CodeJam 2015/Infinite House of Pancakes.cpp @@ -0,0 +1,37 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + freopen("B-small-attempt1.in", "r", stdin); + freopen("B-Output-Small.out", "w", stdout); + int t, cases; + cin >> t; + cases = t; + while(t--) + { + int d, minutes = 0, maximum = 0; + cin >> d; + vector diners; + for(int i = 0; i < d; i++) + { + int k; + cin >> k; + diners.push_back(k); + } + for(int i = 0; i < d; i++) + { + if(diners[i] > 3) + { + minutes++; + diners[i] = ceil(diners[i]/2); + } + maximum = max(minutes, diners[i]); + } + minutes += maximum; + cout << "Case #" << cases - t << ": " << minutes << endl; + } + return 0; +} diff --git a/CodeJam/Google CodeJam 2015/Mushroom - small.in b/CodeJam/Google CodeJam 2015/Mushroom - small.in new file mode 100755 index 0000000..229dc35 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/Mushroom - small.in @@ -0,0 +1,201 @@ +100 +4 +10 5 15 5 +2 +100 100 +8 +81 81 81 81 81 81 81 0 +6 +23 90 40 0 100 9 +2 +0 0 +10 +100 0 100 0 100 0 100 0 100 0 +10 +100 100 100 100 100 100 100 100 100 0 +5 +19 41 0 95 19 +6 +64 58 41 57 85 68 +7 +92 79 31 87 89 80 81 +8 +68 17 89 34 54 36 28 22 +9 +54 65 29 71 83 10 29 71 72 +10 +65 86 21 27 72 42 71 84 83 52 +10 +49 67 88 15 14 32 20 53 92 37 +10 +15 62 10 82 39 15 31 83 57 88 +10 +75 0 19 56 30 16 77 7 21 69 +10 +56 69 10 34 19 40 63 15 5 45 +10 +98 1 73 25 36 50 80 67 12 28 +10 +32 44 91 50 43 33 64 69 82 69 +10 +78 64 58 25 76 84 59 58 70 87 +10 +7 66 4 8 50 79 77 57 45 99 +10 +45 18 38 94 42 55 13 45 46 6 +10 +82 93 59 84 5 59 18 97 87 37 +10 +21 35 60 17 61 74 86 80 78 45 +10 +27 27 38 7 89 58 95 76 18 12 +10 +36 67 76 46 48 60 35 43 75 64 +10 +47 98 57 36 22 44 62 58 1 37 +10 +1 29 23 85 43 27 81 58 76 44 +10 +41 65 89 63 17 92 80 83 11 50 +10 +78 7 64 29 98 29 75 90 59 32 +10 +51 6 16 6 30 85 5 86 91 40 +10 +35 25 62 55 72 79 38 89 47 7 +10 +25 32 32 40 10 35 43 36 52 76 +10 +13 5 73 4 51 2 31 88 96 98 +10 +93 23 84 48 77 63 37 16 45 98 +10 +32 28 67 28 53 71 27 55 79 57 +10 +87 89 30 57 88 99 17 43 51 70 +10 +76 5 37 45 58 95 47 7 1 83 +10 +9 8 6 53 37 74 97 20 15 77 +10 +45 78 94 5 37 41 20 10 97 15 +10 +44 34 4 75 3 42 80 52 57 17 +10 +90 73 62 7 66 78 6 27 36 48 +10 +90 78 49 39 41 15 2 56 90 11 +10 +53 96 21 34 82 83 82 86 39 1 +10 +85 95 96 59 85 3 72 50 51 26 +10 +94 83 30 12 92 47 24 84 40 75 +10 +59 90 68 68 15 90 0 42 1 67 +10 +55 12 38 13 82 65 22 66 5 97 +10 +13 48 57 62 63 86 0 6 22 66 +10 +59 95 3 2 79 30 83 50 64 81 +10 +54 32 24 4 28 76 90 95 75 90 +10 +62 67 41 34 79 36 12 22 96 60 +10 +8 59 65 27 26 55 16 20 24 98 +10 +34 69 19 18 76 91 71 59 42 18 +10 +45 52 49 82 1 54 94 41 27 0 +10 +93 78 40 5 64 62 73 93 76 49 +10 +29 71 52 40 53 20 50 24 38 43 +10 +7 49 16 40 91 45 19 75 26 76 +10 +29 17 72 40 6 67 57 85 34 40 +10 +68 64 34 14 34 22 3 81 32 54 +10 +63 50 75 65 42 79 68 38 92 45 +10 +1 35 99 84 54 4 51 37 1 89 +10 +71 65 98 74 19 63 82 67 7 65 +10 +71 75 56 48 44 24 91 74 6 68 +10 +43 35 11 86 67 76 68 28 13 74 +10 +9 32 69 28 87 76 51 11 5 84 +10 +6 67 76 3 44 91 75 98 19 39 +10 +67 48 97 64 7 96 22 70 20 91 +10 +96 3 86 87 97 97 10 25 56 93 +10 +92 24 19 31 31 44 59 6 26 43 +10 +65 76 32 45 75 5 73 23 15 64 +10 +54 57 90 72 50 84 40 60 57 37 +10 +32 23 62 57 13 54 84 58 33 45 +10 +12 65 70 83 75 3 73 17 9 40 +10 +10 16 0 75 66 82 3 97 80 33 +10 +0 97 64 97 32 66 50 90 86 19 +10 +63 5 83 36 3 25 24 88 0 45 +10 +84 83 21 69 48 82 1 26 78 64 +10 +21 12 93 43 35 53 15 63 32 56 +10 +73 92 45 73 81 99 97 56 20 27 +10 +46 1 35 94 79 42 5 35 58 27 +10 +19 44 98 74 62 46 82 46 24 32 +10 +36 22 56 6 76 39 11 98 55 85 +10 +29 33 9 48 68 40 78 75 56 63 +10 +93 52 70 46 30 46 37 70 25 10 +10 +83 15 86 24 45 42 53 42 87 85 +10 +84 83 1 56 8 10 79 33 20 12 +10 +18 7 50 78 60 28 54 44 61 44 +10 +23 88 24 83 45 27 28 96 70 92 +10 +0 70 82 51 1 10 25 49 70 47 +10 +49 57 94 47 65 68 81 48 82 59 +10 +80 88 53 0 74 55 78 54 2 31 +10 +35 85 6 0 21 17 35 12 8 83 +10 +51 16 20 49 55 29 31 9 97 0 +10 +54 22 94 51 37 45 62 1 71 7 +10 +71 97 55 86 19 32 85 81 77 78 +10 +6 62 64 71 79 50 41 18 34 41 +10 +64 14 43 83 19 84 68 3 63 63 +10 +21 74 12 53 64 91 7 60 45 98 +10 +14 47 63 82 95 29 34 10 32 31 diff --git a/CodeJam/Google CodeJam 2015/Mushroom Monster.cpp b/CodeJam/Google CodeJam 2015/Mushroom Monster.cpp new file mode 100755 index 0000000..94b1fa9 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/Mushroom Monster.cpp @@ -0,0 +1,45 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + freopen("Mushroom-large.in", "r", stdin); + freopen("Mushroom-Monster-out.out", "w", stdout); + ll t, cases; + cin >> t; + cases = t; + while(t--) + { + ll n, i, y = 0, z = 0, max_diff = 0; + cin >> n; + ll m[n]; + for(i = 0; i < n; i++) + { + cin >> m[i]; + } + for(i = 1; i < n; i++) + { + if(m[i] < m[i-1]) + { + y += m[i-1] - m[i]; + } + max_diff = max(max_diff, m[i-1] - m[i]); + } + for(i = 0; i < n-1; i++) + { + if(m[i] < max_diff) + { + z += m[i]; + } + else + { + z += max_diff; + } + } + cout << "Case #" << cases - t << ": " << y << " " << z << endl; + } + return 0; +} diff --git a/CodeJam/Google CodeJam 2015/Mushroom-Monster-out.out b/CodeJam/Google CodeJam 2015/Mushroom-Monster-out.out new file mode 100755 index 0000000..b2d7c07 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/Mushroom-Monster-out.out @@ -0,0 +1,100 @@ +Case #1: 15 25 +Case #2: 0 0 +Case #3: 81 567 +Case #4: 181 244 +Case #5: 0 0 +Case #6: 5000000 5000000 +Case #7: 10000 9990000 +Case #8: 7854 20710 +Case #9: 9775 21408 +Case #10: 10987 16732 +Case #11: 8093 30076 +Case #12: 17787 35942 +Case #13: 21658 30365 +Case #14: 17923 57948 +Case #15: 31053 52342 +Case #16: 23471 46328 +Case #17: 21015 52224 +Case #18: 31756 73628 +Case #19: 26701 51215 +Case #20: 23764 87620 +Case #21: 12069 57666 +Case #22: 19555 68287 +Case #23: 32202 118112 +Case #24: 32240 82371 +Case #25: 36445 98263 +Case #26: 48245 104783 +Case #27: 37752 97507 +Case #28: 36102 101547 +Case #29: 39584 108756 +Case #30: 36510 122954 +Case #31: 56387 121519 +Case #32: 36405 100986 +Case #33: 55884 155932 +Case #34: 45403 143124 +Case #35: 47560 123908 +Case #36: 40707 158705 +Case #37: 61805 144477 +Case #38: 57216 171963 +Case #39: 58944 184723 +Case #40: 78585 184111 +Case #41: 70230 172521 +Case #42: 70713 209363 +Case #43: 54230 183902 +Case #44: 62366 180116 +Case #45: 63045 178880 +Case #46: 76220 203618 +Case #47: 61680 186431 +Case #48: 91714 214364 +Case #49: 76414 215860 +Case #50: 74066 226204 +Case #51: 79478 225013 +Case #52: 70896 255646 +Case #53: 77683 241250 +Case #54: 1647723 4877657 +Case #55: 1659962 5053321 +Case #56: 1718880 4972900 +Case #57: 1659498 4974523 +Case #58: 1629013 5017053 +Case #59: 1635966 4955647 +Case #60: 1656479 5224492 +Case #61: 1643413 5049357 +Case #62: 1633608 5014391 +Case #63: 1631899 4979775 +Case #64: 1726281 5049964 +Case #65: 1715553 4943682 +Case #66: 1669957 5173112 +Case #67: 1622201 4940352 +Case #68: 1685355 4958442 +Case #69: 1649897 4985229 +Case #70: 1658571 4960372 +Case #71: 1656676 5106036 +Case #72: 1696384 5027988 +Case #73: 1712738 4993208 +Case #74: 1644692 5092326 +Case #75: 1688386 4923808 +Case #76: 1672010 4970667 +Case #77: 1687086 5038066 +Case #78: 1704297 5000018 +Case #79: 1656601 4929996 +Case #80: 1721761 5071405 +Case #81: 1658219 5067887 +Case #82: 1758734 5046514 +Case #83: 1710062 4975924 +Case #84: 1663552 4943389 +Case #85: 1597913 5052359 +Case #86: 1711289 5087622 +Case #87: 1679480 4979801 +Case #88: 1726063 4980710 +Case #89: 1660676 5216517 +Case #90: 1680035 5088026 +Case #91: 1603773 5196596 +Case #92: 1667784 5051859 +Case #93: 1585993 5085612 +Case #94: 1681872 5094811 +Case #95: 1593731 4823325 +Case #96: 1699729 4823928 +Case #97: 1652953 4940226 +Case #98: 1762172 4937221 +Case #99: 1696002 5054455 +Case #100: 1722397 4939961 diff --git a/CodeJam/Google CodeJam 2015/Mushroom-large.in b/CodeJam/Google CodeJam 2015/Mushroom-large.in new file mode 100755 index 0000000..0e74979 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/Mushroom-large.in @@ -0,0 +1,201 @@ +100 +4 +10 5 15 5 +2 +100 100 +8 +81 81 81 81 81 81 81 0 +6 +23 90 40 0 100 9 +2 +0 0 +1000 +10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 10000 0 +1000 +10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 0 +5 +1614 6853 5698 9261 2562 +6 +8079 8096 2842 7325 2804 5792 +7 +90 3012 556 9681 7112 1150 4166 +8 +7164 8116 8630 537 892 2477 2820 6744 +9 +9384 8861 5073 7540 6129 128 6485 421 9060 +10 +8003 329 193 6785 3403 1828 9117 226 707 2139 +11 +6337 8976 4304 9753 9831 7903 9550 4741 9996 3482 9238 +12 +7142 4114 5719 1200 7137 2248 9552 766 512 4375 9649 72 +13 +7165 9663 5630 2116 9199 7249 2677 3225 6813 4871 1734 9304 4981 +14 +8018 1636 6364 926 1985 6208 2185 3918 858 3843 5155 9515 7878 7403 +15 +2218 9944 7698 3297 5669 8666 1643 9960 1969 7067 5251 9112 6019 833 2921 +16 +9424 8480 2445 158 514 496 764 9552 9085 4747 2794 6404 837 5527 2758 435 +17 +819 7794 1183 6562 8876 396 1970 5233 7638 9389 9462 5666 7056 8254 6232 3377 7054 +18 +1648 4919 2369 3687 6909 6203 7699 5703 5034 1290 4763 5977 8325 8200 7469 7255 5921 8937 +19 +6198 5383 7021 6860 3700 3720 625 3722 921 4515 5695 8180 1082 186 2105 2728 1199 5529 9978 +20 +3331 5119 8104 7045 9276 6409 8413 8054 6218 1283 7984 8506 8464 6717 6681 817 9890 1796 9569 4206 +21 +3124 1873 9168 7776 2837 743 6999 3813 2000 8313 2620 4250 7118 2638 6408 8287 8935 5984 5860 1543 8177 +22 +7161 5874 8987 8519 806 5440 3080 6924 1131 3153 705 1522 5050 7204 2799 6644 8635 3053 7870 3590 3275 1481 +23 +1301 9353 6791 6253 1276 459 7368 6005 449 9221 7920 2558 9141 1821 1557 7622 3430 4829 72 7692 9782 546 7025 +24 +6948 3845 7650 7059 6470 706 7295 8270 2322 8519 7556 793 1966 4214 8691 9471 4713 802 1399 5848 1312 1538 712 6803 +25 +1327 8338 6225 5890 5306 6964 3423 8126 102 9999 6747 4317 392 3668 5892 2787 7571 3977 5880 2124 1770 681 794 1638 9213 +26 +5348 9625 8445 4871 3596 4470 4722 4451 6645 676 9343 3374 5653 7096 7337 4029 1809 973 161 7055 518 3113 9441 8384 1808 4410 +27 +8044 5742 9825 8653 8182 195 4541 6166 695 3160 5706 5281 9315 2792 2621 7538 8281 9018 7749 2513 2044 389 3323 2526 1678 2386 672 +28 +7708 4976 3247 1573 2867 8751 4295 6140 1633 4961 304 5304 2543 9865 2251 8078 1940 9690 6292 4095 9679 3098 5145 1927 4610 3947 4687 625 +29 +56 6293 667 3164 3560 9575 8500 7972 3133 1412 5291 3166 3268 802 4240 3992 4320 3113 2644 217 7330 9841 6267 2970 1609 7233 8170 2728 3152 +30 +5483 6505 8052 5857 2960 606 7541 181 6678 9689 6868 950 9310 6453 6527 7739 1038 8267 6325 8772 9266 5511 3759 8812 5381 372 8612 3582 7296 5434 +31 +3412 1311 8702 5255 1935 3556 9390 6408 2717 4660 8225 6203 2245 4016 9245 8003 7953 1103 903 1507 4987 4020 8090 288 4267 6185 3002 7069 9247 5659 9924 +32 +923 6223 1078 7762 6622 906 1930 2483 7953 5743 3221 286 7930 5928 6406 4454 8093 4536 3855 4346 4307 231 1086 1634 4229 8780 2640 7176 7772 1384 4993 1936 +33 +4336 9145 6620 4396 1652 4380 5283 5877 7848 8300 7609 8839 9922 1811 5356 2457 2936 2170 1427 9716 9783 988 1450 2974 5799 6395 4643 5901 4106 4211 660 5145 1034 +34 +3997 926 7641 6676 9433 3657 3328 6459 292 6420 8018 1585 354 2237 4663 895 7266 2687 8887 4643 8753 9313 6270 1380 3285 8221 3421 8816 1937 308 3388 9103 8650 5102 +35 +4729 2481 6199 7082 3353 1020 6518 2860 3800 5706 1663 4728 9698 3912 4181 7369 4120 30 6894 5303 9362 6011 8669 3724 5164 5054 947 9888 8859 886 9419 8982 4445 8272 9559 +36 +1450 5848 7808 663 9872 8797 3783 7774 3158 8430 7110 8191 4494 1897 7258 5462 864 8656 1807 5223 7445 6769 9332 9929 8119 9652 2155 6124 5258 1860 2021 2443 7994 7871 4170 2004 +37 +4262 9844 5593 1033 4092 9514 2336 8640 2393 6682 5148 1824 9226 5961 7060 1180 3891 9561 9648 2017 3987 5116 9881 842 6768 2297 379 1053 8864 2406 8770 7626 4587 5318 2558 7194 1308 +38 +4169 9419 2089 9939 3347 6991 2372 2283 9613 5178 550 1592 3479 2348 4707 8512 7262 1279 9872 8131 6852 3409 5452 5599 4549 7746 4309 270 5678 2230 1137 4517 9019 2044 8229 9817 2149 4230 +39 +4365 8723 728 7185 3944 9279 3537 4974 4526 7478 1654 8635 3817 3619 4512 9157 7739 8364 1074 9738 1560 6637 9873 9911 3273 6947 1363 4958 2214 7339 7055 6087 1174 8376 9186 4756 6890 8294 8605 +40 +3660 1143 5981 127 5079 1816 1809 8370 6393 2487 7665 1273 3740 6957 6331 8170 7155 7455 6503 3098 8982 9965 5554 5033 8803 4223 2015 3267 4383 6313 1370 4290 9657 9812 9960 4926 6663 6060 4044 6947 +41 +7493 8973 1731 4801 3139 4152 1061 3615 6504 1224 3201 7069 9784 6322 6333 6787 9184 4853 2946 9532 2316 1330 7450 8212 7450 8509 7838 1742 1720 8769 2317 6244 1686 1287 3740 2366 492 1322 2912 9703 4722 +42 +4521 5081 2914 4665 5915 6018 1108 1530 8055 472 5992 8847 9193 4428 482 7230 536 8087 2421 5832 810 1207 4318 7965 4032 3953 1773 68 3307 3292 6046 3683 2611 8092 8206 3074 5930 8891 3695 5248 6024 5407 +43 +9114 3738 4872 7466 7552 7136 8 3664 4817 5394 534 6318 949 8249 4006 9780 1257 2324 4051 4363 5016 7099 1564 8405 9889 334 9301 4114 4471 7209 1646 7241 2866 1467 4992 3079 5066 6489 2621 6729 3819 5168 5784 +44 +5977 6423 4844 6121 8338 6282 6479 6526 6973 2275 7722 410 61 9730 1294 8534 9025 3315 3190 2898 1749 8377 8113 4051 3293 7380 7940 96 1827 326 1918 1932 486 328 6671 9517 4051 1021 6637 2887 1879 1192 1405 5215 +45 +3459 9160 3403 2913 1186 4788 8508 5952 1670 7850 8980 9686 352 6562 9774 1910 587 9663 946 3007 2176 4504 9127 639 658 9390 244 7097 3519 4131 1509 8108 2291 9121 4821 8255 4620 4212 8504 9830 7205 1009 1291 3420 1402 +46 +2905 9196 7872 506 5117 443 4463 7697 3844 1460 8297 4135 8982 3080 4937 9921 4335 5474 4610 454 2434 3007 9171 9206 6428 1048 5166 1753 3176 1385 2552 8691 6704 3134 7090 4751 8290 6511 294 8668 7161 6969 8711 9966 4776 5984 +47 +5396 890 7574 6535 3673 5410 4316 9231 4119 3316 1903 1935 1514 3415 8372 9069 9325 7154 8130 9215 2163 1148 4125 9645 862 4084 9308 7694 7467 3688 900 1628 5537 1617 5381 493 3857 9316 2283 6278 5575 9467 2976 2827 9125 2922 7969 +48 +1146 3133 8499 7036 1087 6067 6458 5770 8411 1285 312 4023 1840 6814 3932 4672 4293 6456 8033 702 8646 2587 9345 1024 943 3611 527 7342 5306 5768 7006 9753 4521 1064 9209 7399 257 4344 4108 5479 8555 4000 3571 5567 9481 5257 5705 1867 +49 +9406 158 9242 5404 7907 9373 1024 911 2083 4434 9421 7313 6054 7562 6629 7512 894 6897 3824 3179 3306 3760 4952 7509 4891 5436 4030 2948 7022 643 1352 4614 5736 4328 8792 8786 6730 7570 8672 642 8000 8890 6257 2359 3317 6499 5484 4350 1303 +50 +6555 1690 2027 3222 7610 9270 948 9149 276 2979 3649 2874 4640 8746 5910 9040 4338 2849 7076 1507 7451 4878 8938 4870 2764 182 4096 5791 7535 4526 2211 6245 4082 6009 7563 7473 9524 4868 1966 1636 8661 4774 3207 7232 6503 3824 2192 6207 3243 5882 +1000 +5945 3948 218 1424 9276 4655 3340 6041 7325 2681 8353 6600 4071 6922 4136 6659 9519 6148 5497 3225 2173 9964 1589 6904 4999 5266 3721 2237 5975 4988 2231 5091 312 6452 504 2041 6277 3558 382 7811 1041 2569 95 7910 9313 5885 1024 4769 2269 9043 338 8225 8086 2307 1138 2375 8967 8233 6647 6067 5852 3838 1656 4583 921 4194 7651 2461 3148 6519 2680 2443 2898 1527 2044 5791 7151 8720 5264 8933 5865 8453 365 5328 397 8134 9203 8632 8826 5995 300 8940 9506 9933 2059 5550 3418 1404 6162 3526 2459 2691 6984 4270 172 482 6070 3006 8444 4143 6274 495 5277 6524 6474 336 748 452 4440 298 5861 5464 492 399 6662 1278 3830 7655 2007 4491 3943 5518 5440 5735 317 6319 5467 4599 208 6434 4668 985 5663 746 4042 515 8607 3865 2361 7084 4987 559 8021 6316 3390 569 146 257 5583 1031 2065 4976 9811 7765 3892 1801 1241 7140 9108 6772 8780 4790 8021 9550 3208 4722 6693 266 2097 1116 2744 6033 752 678 7460 8600 9794 9928 7121 5186 158 2952 8546 7701 4739 6674 9618 3425 910 2896 1913 1003 3846 2988 200 160 6517 4810 6023 5674 4818 6343 4505 7804 9207 3208 575 6391 7271 4625 1905 4009 4596 2602 1726 4638 1315 2169 8696 3230 8040 324 4579 9674 4634 3755 2484 782 2859 1890 6337 3437 5172 2268 6625 5824 7540 66 8431 4455 5571 5144 6850 2614 609 5451 9460 5479 5878 5766 1554 1267 5751 9484 8335 1206 825 5722 1643 7185 9287 8309 8724 4919 677 390 2945 5061 6984 6115 886 9799 1019 988 9432 6949 3895 6412 734 9930 6210 5227 4519 707 8989 4904 95 7897 3368 2098 6703 26 4634 5964 3031 409 4631 7183 312 4562 396 711 834 559 6621 1117 4547 8553 4116 2216 6174 3837 8854 9498 1629 7351 3493 5926 884 4920 9903 4498 5048 1890 4190 4571 709 9183 4782 3667 3408 2507 5048 3537 7922 9889 8538 7787 6036 4249 2240 9396 6795 325 744 9487 6501 8652 2754 3416 3489 8656 3200 7661 6584 9279 7687 1316 1098 7643 8262 7631 3970 3275 6741 7181 2082 4821 4618 1405 6086 3382 4064 610 5969 6240 3330 8909 3343 9919 9658 869 1346 7379 3570 21 8137 5567 9970 6887 7141 5449 5595 2234 8381 2087 755 7479 9640 4179 4565 4985 8771 64 1876 9590 3633 4068 2277 2923 3097 6481 6752 3242 2494 5887 6084 1763 5991 5823 7412 3714 246 4229 6125 288 7410 1107 2238 549 1186 6576 460 6032 2770 9911 7519 8589 5216 6902 9582 4381 3747 4672 5501 3729 9857 6586 1523 7763 7427 6606 3685 7195 392 966 511 509 1437 7255 89 4934 1089 8728 1288 8519 7281 6657 4546 7219 3457 4963 5020 2194 7286 8116 8332 2902 4867 6343 9750 3376 9147 2969 9571 8347 9211 2422 8746 6795 7077 9048 6802 9960 6157 9837 5379 2853 9513 8995 25 8263 6149 5711 4462 2435 704 1059 1597 4853 6120 2345 1084 9435 2390 100 6439 140 5110 3221 432 3387 658 6991 1650 8699 6506 5331 2559 1792 7811 2323 2329 4425 1392 6294 3592 7671 8390 1835 1318 9344 9433 3737 1635 1721 8644 2339 8639 5923 5987 8345 5552 3510 729 1147 39 2639 4131 4736 2996 9278 1139 1041 9228 1711 7471 6835 1640 3570 8405 9429 4744 4493 2854 4722 5085 5184 3714 4981 914 8031 9689 5698 5057 7173 7487 6642 8478 3053 9511 3739 5096 2096 706 4643 7773 6488 4871 928 608 4059 8322 3101 8549 8725 2570 6276 2841 8961 4710 172 7261 8112 1897 8644 9902 2917 5803 8090 5557 4105 8682 7210 7246 5527 9002 8816 4371 7999 4120 7955 6037 4540 7542 705 7439 7782 9750 2178 2731 284 7290 3463 8151 2686 6005 2659 4466 1416 7569 834 2294 8626 5455 4346 3447 5774 3860 6145 151 7244 1082 4793 7910 5096 5105 1062 882 5 5358 1685 6322 1717 3706 4035 8998 4094 8043 351 9396 2674 1058 2301 1465 5579 9238 2794 4828 1942 8048 8050 7725 7183 1470 6409 4107 4936 2980 746 5377 8762 7384 3609 5934 5257 175 9045 406 9149 1466 1690 7239 6682 1185 4539 4970 1362 9193 350 3337 8186 9042 7610 614 2045 8039 688 6485 2303 2597 1755 3575 1909 9533 1297 1514 5957 9505 9297 3755 8589 4086 8417 8828 3733 5631 2274 8676 2706 9218 8258 6913 6248 3634 4730 4000 1637 3324 5375 188 8991 4948 8318 6189 2263 3084 4937 980 9752 2404 2722 3718 6719 4881 4598 3179 3559 8469 1457 8089 5410 3454 5914 8626 8206 4622 2549 3053 1338 4193 9849 6247 6402 3165 1568 6239 3564 6055 353 8319 9111 1952 680 7134 8353 100 2562 2638 8097 5476 3950 5043 8246 2088 3057 8363 3540 2083 3240 4942 366 562 3655 6866 4248 6741 8769 1472 4619 8666 8766 8492 1833 6413 350 9283 5565 1500 8995 9103 8265 5746 5946 9495 9528 8948 4778 9866 8287 7799 675 433 375 3511 5568 7816 6612 4792 9590 6126 3166 4259 6688 5813 6740 5633 6345 9305 2850 1408 1901 1318 3553 9120 5307 5568 5787 8524 9941 3616 8625 5911 8606 2936 7996 8043 8107 224 4422 3625 4793 9347 5653 8355 8402 9308 3949 1906 3636 1133 3755 4761 8752 5138 6349 9102 7938 1416 8273 8341 2724 3295 3630 5189 1407 5679 677 6524 1212 8510 2447 8768 7415 3113 9530 9898 5359 5196 4847 7665 4402 7068 860 6427 5864 8460 1319 7603 6505 951 8805 9895 248 9473 2358 5967 2298 9784 2145 772 8788 9838 2250 1327 164 2069 4954 587 8790 6808 1413 1221 2087 5718 8824 4826 9733 392 8078 8212 9721 4279 3812 3583 2002 5014 8372 8640 4240 6007 2727 5389 4796 6952 582 6601 7196 5409 2669 +1000 +8742 9115 6724 1474 105 5364 4497 7755 7494 3635 9274 4866 4390 3352 5586 3215 2441 4098 2635 285 6022 7734 8887 3741 2657 6364 1341 8278 215 2384 1869 1171 8593 1654 6373 2904 2071 7399 4796 4247 2218 5801 5663 3950 99 7186 5220 7375 5191 9897 969 3750 6015 9923 7664 5286 9974 816 5332 3278 8231 322 5186 7947 1996 4977 30 6054 4813 4660 6096 9797 2305 4704 359 4037 3658 9607 6503 7329 8644 7343 5225 1953 2120 2850 4251 6944 9668 1472 4756 9925 2565 161 6853 6262 4590 1838 6434 7510 6509 1655 7940 505 9140 5661 6802 3943 3297 9896 5081 3981 809 4045 7972 4358 7180 6439 8614 1785 7629 2314 1431 6160 9325 7344 7152 1967 8226 6385 4213 8608 8388 591 816 5543 9948 3944 5308 8475 9955 6443 4642 8985 8497 3170 8480 9977 9063 7963 771 697 9145 5000 9573 6061 1740 6791 1004 5002 5877 6511 1663 2260 965 903 4529 5275 2693 3595 1618 953 1922 16 3785 9831 6742 7704 7681 6799 1342 1134 1699 8605 6942 6401 8674 9896 5778 199 8784 4271 2995 9778 4260 3361 8612 6104 9439 1721 6376 7933 8385 5997 9089 7247 6820 2624 3270 1346 3807 2254 5843 1791 891 1939 8141 7036 9923 3135 772 2505 5231 3522 1434 2736 9210 4183 8883 9581 411 1681 789 675 8058 1993 341 3236 621 751 8517 7834 4317 5810 6582 1944 6439 9839 6780 863 4274 7935 8783 2003 7504 4030 5990 6315 8638 8656 1835 3144 6926 2012 5387 6208 2564 873 1416 5247 2174 7216 3368 8542 4890 6936 3972 256 2609 5580 2549 5405 8731 731 2281 1625 3358 7297 1253 8763 2168 2693 672 1372 8180 3283 4093 8406 9038 8751 6931 8032 4315 1107 318 9774 3597 774 7306 9797 934 6267 7008 6326 7090 8644 1049 1828 5949 2605 984 1126 5154 7496 9147 2774 9073 5482 3329 7213 7498 6517 7818 9554 1685 732 4650 1686 9516 5424 3664 1779 6705 4135 486 8790 3360 9309 5792 3585 1516 2388 4978 158 3301 4730 1251 2228 1440 8338 5361 4849 5206 6740 8551 7594 2867 2424 4521 7855 8087 68 2240 6862 9644 7616 5880 9329 4652 1750 8614 9487 2159 8166 5270 8141 150 376 7080 7250 9510 9848 6384 7160 5873 6253 7617 3767 2755 607 4234 6852 4592 8835 1158 7793 1929 5010 1745 6196 6699 4825 6395 6194 6360 697 5691 3169 8633 433 657 2550 6317 7223 9611 8135 9449 1402 6364 6784 1389 3092 8059 4240 52 99 1853 2259 7621 1444 8930 9559 4196 8360 9722 9746 988 8803 8598 1586 9537 4094 7150 626 6700 3200 7601 6045 4666 4421 5843 1626 9727 4084 9049 9214 8066 8412 4037 9046 2831 9302 3641 545 4545 9530 5588 5216 413 1079 9312 5435 4438 9441 8600 5148 4641 2299 3841 9460 6942 5396 8443 6341 4645 107 3464 5051 7714 1473 2790 8171 7577 4806 6140 1013 1449 8035 3139 6041 5241 5329 5506 4177 1783 6223 5799 7715 2052 7552 4944 8270 3565 9729 2225 6551 277 2198 3106 5638 9945 180 6416 7515 3822 9802 9576 250 5007 1333 4641 4530 1129 2073 2575 8565 3389 2555 1338 1040 7469 9037 7796 7362 3076 6335 7237 3233 6783 9605 7546 7079 1122 8135 4992 6809 3517 8952 8423 283 656 6717 8915 9000 2987 4902 6249 3479 7540 1171 9214 3025 8622 5761 6000 3753 756 1654 4717 5329 5641 9533 960 2351 9498 147 1736 5155 5502 815 6631 281 4147 4099 3714 9580 8576 6779 9848 1374 9513 5973 789 4514 9535 551 7771 9761 9 4103 2662 7731 3153 310 6487 3966 6796 5675 8816 139 5970 449 1055 3055 3127 1773 5476 420 5118 7813 431 7246 7111 6511 3820 3389 1110 1862 9770 7896 9632 4751 5289 3835 3214 7351 8063 6239 1892 6166 6652 1097 2536 9484 664 1716 439 457 6576 2804 1714 1103 1936 616 2906 5757 9847 7254 7591 586 6067 8457 6585 6709 784 2898 9875 5004 4393 916 5123 754 9636 4909 5847 2337 5047 720 4412 2015 7915 9569 9399 5980 1283 845 1751 2914 1755 6146 2765 6762 7105 2084 9855 7494 8256 4804 3727 1797 9201 2922 5944 3069 6886 2117 2411 4329 1867 5385 2206 344 8118 9347 9946 7953 470 9615 4175 2806 9003 4853 941 2779 3247 8949 9020 852 5973 6582 553 5263 602 4145 5412 9854 7405 5723 5845 138 7300 9766 1874 8683 8539 5800 7695 523 6619 1480 3663 8680 2376 3672 3447 6623 4754 7759 1967 3371 8052 6925 5872 1983 3033 3188 977 9478 7358 7498 6321 8994 3953 3619 8167 5695 9928 7361 7175 9625 8329 7367 8999 4910 6284 2207 9236 6550 7736 4314 6247 4097 4932 1461 3506 751 9772 6383 820 9233 698 2230 2980 5611 2425 7720 497 201 5192 8820 6755 8217 2342 3108 7615 6357 4068 1755 4842 4307 9627 6481 2277 7349 6306 5889 6104 7856 2737 567 5642 4122 3116 5653 9216 1754 2976 6627 8040 5891 3658 2222 5712 1631 2200 9599 1008 1334 3292 5015 7168 7241 3375 9195 7507 1916 5699 5889 6796 1944 5321 4738 8310 3485 2582 3398 94 8436 2308 2854 492 2290 5728 2372 5028 4407 9074 8655 6659 7469 7047 3348 9774 6415 5208 6445 1806 6410 9806 9791 7880 1788 7587 4028 4373 4418 2660 4754 9657 4470 8188 3212 6540 681 6580 7591 6440 4199 8477 9570 3736 1039 8940 5725 6579 5866 3049 8163 8234 4610 6364 4613 3537 2717 9142 7804 6041 2923 7537 2905 7742 4429 5729 9427 7766 2378 295 2301 1639 4854 1515 7694 1998 6374 9334 1076 9600 7561 7186 254 7460 9316 5962 783 8346 3920 187 5722 914 343 9776 1399 3763 4998 6091 8110 187 8469 3333 6768 9322 8998 9938 9351 3299 9376 320 6396 1965 5147 +1000 +1490 7740 7990 6176 4111 7225 9954 4180 4806 1414 4802 1685 6951 7284 6216 2687 5328 6298 126 5416 7047 8685 7279 6245 8432 9236 4578 6070 2405 74 9299 1809 8274 3101 7520 8238 1819 9929 5244 2107 4764 3024 1579 5517 939 9998 5116 8730 2534 8951 2471 8041 9470 9040 2080 823 9922 8923 3634 4479 6456 410 7051 274 1392 4972 4392 362 3674 9655 1446 2576 5191 6396 5779 3037 308 5467 1509 9230 7096 8633 3844 8187 5665 1697 8893 9171 6187 4211 2176 5772 733 5339 4529 6821 1424 9368 9468 5293 6542 9838 5280 219 9620 57 4582 6757 4529 7998 2913 983 1673 1076 869 5416 9742 7900 1218 1611 2034 872 3143 1441 8190 1520 9558 513 25 2893 6356 266 2443 287 773 5170 7270 2146 6131 7424 5202 3466 1170 6745 7491 8383 6881 2148 2798 6829 4314 5723 6862 5063 3645 6001 4526 52 8787 7891 5798 5385 9189 4082 5524 2512 1978 8926 7838 6548 3143 8003 4278 6917 2301 8198 3050 5864 9515 7074 1763 9145 4694 4130 5267 1479 1551 3587 3795 7635 6867 2010 8224 8945 4867 1258 2363 8573 7124 7401 2902 4328 9718 1825 6195 794 2892 3211 2499 7197 8615 8300 542 4940 7744 9737 443 8655 3778 3183 3789 3424 3456 5513 542 5738 3531 6781 6462 9800 8963 8126 5172 8312 9721 815 2866 5304 7878 7007 6968 6665 8379 2936 6089 1080 8596 8777 7519 7299 2233 1086 3733 7239 9614 9885 2895 2075 2862 5477 2305 6548 4119 3738 1590 8182 1869 9951 474 2857 2233 8982 6864 8281 4550 4566 5332 2178 8328 8243 1148 4064 3523 4650 8940 895 7871 8635 1145 1914 3008 910 4667 3275 42 1673 7161 9908 6342 567 7331 4604 2411 4347 2529 9039 5117 5436 4160 1218 2261 6528 2952 2867 5938 3335 8016 57 3112 8573 815 2390 6445 7079 9198 3197 7190 1281 3745 5866 1993 521 6596 5219 1091 8918 2011 9950 5317 2510 9710 3620 3961 8269 2191 9366 5554 1135 4243 1250 8247 1109 8180 2468 9486 6169 4769 6219 6960 9496 3316 1600 4066 9582 7848 2931 1830 8181 2940 3298 4403 8008 7445 590 6713 8252 1700 3284 5089 3311 429 7977 4621 7667 8742 3640 800 8921 8694 5615 6236 4252 1151 3011 351 6853 5292 863 514 9864 484 4544 8589 6284 3980 9618 6264 9102 2538 6269 3408 8767 9631 791 6369 5258 1059 91 8832 1813 3610 6305 7581 4087 8459 4034 648 4344 8231 3859 2016 1213 1963 2648 5586 734 2903 2280 7081 673 2035 5453 2906 7211 6110 9120 7576 8280 1031 5328 9566 5821 2963 7868 7002 7431 1049 7261 1954 4667 5593 9364 9389 9844 4989 6264 4837 8525 9833 8075 205 5676 3352 3910 5663 9362 3193 9715 4388 2620 2406 6359 9114 666 4190 7339 3237 3066 4476 5105 8493 6361 2934 3883 1861 5765 8367 7387 4381 5612 9153 1490 559 8037 3133 1832 5781 6769 4163 8993 8071 3086 3453 8775 3076 8185 2727 3969 2868 2535 9157 1892 1717 1246 5841 9742 1709 7803 3098 5787 2757 5795 9420 5097 7100 8949 3308 1678 5574 810 2028 7054 5075 5283 3497 1450 9244 914 5531 5221 1247 3823 6048 7190 3340 1061 7555 6682 5324 3600 4414 5264 645 9655 9563 6306 4482 1558 5719 9160 6283 2028 1643 3283 8517 5950 953 9989 8355 1079 6219 2506 1491 2449 8602 218 9563 2067 1086 1779 1407 5555 6684 1003 7212 9779 3847 8521 8547 3481 633 3396 5243 2313 3270 4914 367 8933 3011 1 6126 5780 9735 6017 4152 5119 9683 3346 1052 2506 8420 6811 290 9927 7407 4658 7885 2886 4855 8401 2464 1745 5084 4247 4023 2823 9656 7148 4740 6457 1283 460 7889 6223 4290 2690 2697 7830 1276 3279 5153 2381 9661 1897 3059 7156 6618 7565 1682 270 4314 774 2790 6158 9527 1138 3843 6807 7263 8695 7490 1906 4837 4876 4907 8615 2292 1778 8547 1456 1850 4670 5659 3717 4235 1141 21 3465 3892 1255 4630 4498 3511 2504 1828 121 8298 636 9807 1382 6036 9113 7033 3441 6933 7784 4294 8481 6924 8184 8852 6701 7082 2969 2210 7436 5210 9024 103 9250 5709 1901 7097 9309 73 4182 5831 9036 4656 4192 8703 144 6187 5151 9877 5767 9090 1345 2883 3632 5164 606 3246 3827 7823 9484 1334 865 9180 4363 2812 8232 1003 5640 8508 1913 7496 4857 9415 100 4481 8122 1107 9372 2766 1722 8127 4011 7502 3909 1470 9905 4476 1132 417 8398 4586 2629 9836 6411 38 2816 7191 1122 5302 9320 2201 1191 7331 3774 4451 8136 367 709 1831 1865 8881 2709 8104 6286 3100 7965 3398 1473 721 2896 2498 2 3277 9378 3504 8121 7957 1273 6617 3927 2481 2113 9751 9787 2207 3276 4959 1690 2479 6179 373 7129 837 7364 8548 5867 5691 4298 2045 7107 9456 8527 785 9655 6222 5441 6327 5501 3685 5873 290 5486 2616 9333 9278 4444 8511 1167 1284 9010 9748 7188 1305 9648 9306 701 8016 655 7631 5898 2832 9517 2680 4319 2260 6489 8016 2502 9700 5717 1522 1855 249 7231 7215 7561 920 1459 7959 4416 4260 5301 9184 3207 7997 6344 3401 6291 5446 7787 1842 6767 5569 8904 6162 4898 6426 5978 1654 7778 4814 7706 7428 8420 1495 7269 5496 2752 5897 2050 3793 6552 5570 5650 697 3567 2967 9522 2438 2773 471 3874 9546 9416 4645 881 9820 7857 8408 2888 2024 7872 8011 6792 2027 8354 7613 9501 1857 6506 3739 969 2236 6253 48 7090 7175 7405 5805 9902 4967 8835 2250 4554 5934 9731 7425 5752 7070 6824 8352 5145 8074 8716 6570 7656 4313 7867 7294 9973 6740 1336 2144 1740 5424 3638 2788 552 6338 2172 2633 2639 1765 6183 6691 5197 9242 2862 7175 2143 1277 6309 4787 6982 +1000 +8400 5007 1045 347 7360 3054 5016 6713 311 4031 3981 6863 9603 1429 9709 2136 6449 1231 8251 7317 8008 5549 9621 223 8323 6187 3805 8470 8219 1429 8944 7874 4134 1482 8818 5690 3231 4783 9287 6442 6660 9441 4643 725 8537 1557 1806 8804 3851 3845 9840 5946 1884 7615 1097 8223 2802 1221 1494 5165 9060 4333 7557 5501 1750 2321 1729 3777 1230 8271 8905 3093 2551 4290 2842 3231 5900 926 8573 2203 3913 8940 5092 6697 4189 2345 3893 5376 6638 1596 2779 293 3478 1797 2694 5787 3148 972 8893 3307 7365 2698 9481 3268 3254 72 6262 1199 4950 6367 2916 3918 1488 8355 8562 6842 4495 1756 5311 95 4261 2044 7518 8358 4766 1380 55 442 7254 1466 8434 7146 9391 7368 4857 1115 6442 6740 1693 2252 967 9780 3268 1920 8168 9943 9665 8080 9123 2950 3491 3746 5034 6459 4828 6451 3033 9206 8240 6661 8843 8876 620 1905 9378 5078 6244 6213 3051 8839 2775 1485 5211 6997 2809 8498 1490 4289 9807 2810 990 5946 4371 2449 3611 204 184 8468 4557 5285 9001 4173 5868 6612 5634 4054 1301 198 8329 7155 1229 6758 5548 4845 5754 4720 7690 9041 6285 3619 6538 1281 8059 8746 7288 6977 9503 4336 2286 9827 3338 2740 1372 6083 437 4579 6264 577 3065 1609 8763 6010 9213 171 8969 2280 506 9535 8569 9788 9393 2097 1540 6227 4804 5406 676 8578 434 4629 3911 6435 782 8121 1468 4065 184 7844 4553 2294 889 4824 3340 9662 9115 7277 3133 7841 9269 420 2467 667 8121 2243 8167 8309 9043 4850 4961 6205 1590 1571 2647 6274 4994 8150 9238 1559 3158 2109 1300 8839 8459 8030 9015 9865 1478 9306 7038 7316 7326 6399 1550 3594 4862 293 2865 1206 4803 265 8224 6221 4226 7306 4275 1568 5262 3741 4611 8888 8126 2414 1281 1403 1322 8339 6865 3159 6476 6251 531 1567 5699 1243 9722 2214 9693 6805 8818 4269 8929 7459 4038 7995 791 1786 7922 8007 3838 9147 1106 6396 8039 1599 6157 4273 7412 7001 578 1248 1016 1498 9861 6628 5150 2893 8249 3528 3909 4255 345 1659 1381 5492 6710 3336 7177 1076 6330 738 8683 5367 4766 7503 6547 7676 4767 8601 9659 8038 9230 614 9416 2815 3236 1202 2132 9218 5868 422 7503 5438 9683 7316 6207 7495 3655 7958 9080 9841 8213 8766 5149 3466 6134 6545 7651 8025 8065 7622 9353 5740 3229 5972 2211 4785 6246 3387 6080 7992 7249 7071 9192 5568 6006 1458 5621 4279 7297 8287 511 5096 5946 8583 12 2348 6652 9031 3940 7817 9791 3492 8683 7633 1432 3339 8134 2889 1001 8695 5987 5841 647 5102 1362 7174 6261 4941 1107 9318 854 2312 3053 414 2627 8228 9164 4367 1210 2058 7896 5985 5688 8061 9489 8308 2330 855 890 423 2147 245 596 7599 8042 6908 5642 4786 7275 6018 3221 8511 9397 6957 2777 1134 9076 1484 3531 6933 5513 224 7566 560 9803 8968 1000 2652 2675 6173 7682 2683 3032 7705 9339 6353 123 8518 7632 3151 7366 3344 1420 1360 8699 9238 5431 112 4510 9305 5698 7678 3308 844 8540 6132 9035 6546 3016 3009 4351 3170 2711 1682 2540 4883 8879 5042 5241 6413 5317 5316 8363 2620 7674 7061 2584 1301 5948 8903 1411 4108 492 5679 1545 5977 2311 1433 4302 3530 9073 2098 238 1316 7558 6371 5399 9699 1559 8050 645 7302 7412 759 1406 3046 3938 8014 3537 6108 6021 3651 8394 8160 7877 6839 4578 8122 3573 739 7153 6179 7323 297 4173 702 2027 4773 5002 3878 5789 9899 7636 7556 3980 2643 8917 4166 6174 7033 3576 5253 7436 4821 9969 4432 4409 447 7119 8735 5011 9080 9946 9929 2795 669 1935 9723 2778 8173 1802 1219 8648 489 524 4970 1348 2740 9974 6651 6216 7109 6262 2033 8188 7262 7980 8648 1888 9689 1071 7618 2744 9233 9215 913 1940 5113 6941 2558 2248 8275 9425 4114 9693 75 2021 47 1838 2744 1074 8606 6320 9599 1117 9867 3920 4991 5079 6077 5185 8775 3780 397 4396 8085 5228 9723 509 5103 7547 6904 4712 6773 6295 896 4951 2929 6267 8141 7387 8854 1012 638 1601 3995 7729 2046 5383 2005 1247 5768 76 6042 2636 4254 2920 6149 672 2004 2310 5964 6785 3649 9052 1099 9019 3594 4360 8785 2640 9379 2001 3914 417 4812 7363 2980 8407 7364 3667 5719 3227 5180 5804 5188 612 3237 2136 2615 6691 3006 1096 5817 1076 8800 5796 5553 2620 639 8481 6340 5431 3355 4513 3725 3370 794 1266 5371 1454 6287 6377 7866 7503 7589 9343 4693 527 5992 5130 9619 3557 5019 9895 6101 4867 6281 2349 979 1310 265 4026 9741 3072 9593 815 5078 3766 3446 5293 6656 9986 207 7506 1350 7862 2231 3976 6603 7478 2031 7344 1581 5893 1429 4230 2789 3071 1797 1473 4918 7536 1917 3643 5414 5467 7291 8074 3851 4012 5458 8936 9750 7028 7025 2298 1470 2807 6181 4173 9380 2116 829 1498 8318 9406 2295 7871 7278 4029 9005 9737 5506 1493 4016 8580 6697 7506 9051 6717 1740 5401 2548 1029 2284 2854 2116 2273 4674 7399 9996 2029 5027 1459 7147 9666 1633 1482 3728 8549 1542 3251 1407 912 826 8490 7295 832 2312 394 1982 9029 4228 286 4750 194 1019 6890 2514 7030 3405 6094 7064 4961 9612 5730 8650 7384 8981 496 1297 1342 9433 6620 2738 8284 5071 8830 32 6244 1610 1903 765 4424 1563 3502 4497 4725 2330 9461 7732 4344 6523 2635 9616 9613 7152 2824 60 7999 7996 3369 8487 5607 3250 7199 8485 1366 134 7971 6582 8970 9786 2303 4041 4653 1093 6097 6609 5216 7220 8439 1077 7981 7394 3863 1331 2616 9717 6785 9167 2169 8506 7455 672 8677 831 962 3497 +1000 +1213 4972 3208 9732 1338 5944 6465 6492 9692 2604 3465 6879 5851 2317 3922 2218 9842 3618 9865 521 3412 495 5331 291 7404 6418 1536 9771 6904 6944 5304 618 2150 6266 5458 9307 3173 3053 2259 9804 8806 8142 426 2313 7286 8394 4105 7940 3897 8095 4136 2633 2987 5134 1723 5723 1173 657 3570 8406 8427 9050 8710 9588 5529 7379 2914 3491 9783 6342 9795 8241 9518 7743 4561 4665 690 749 8413 4272 6695 1329 5560 474 4632 5236 1800 969 1931 6504 9491 9607 1755 3975 3863 877 630 9653 7948 8458 9830 2018 9864 9473 6817 4620 3951 9114 6293 9979 9747 2201 2932 6901 2755 1067 5202 5508 5638 9386 4203 4230 9172 5012 8111 7964 2275 1063 9709 5330 5528 8498 2534 4297 7898 6101 333 5216 8015 826 3655 2923 6517 9460 9118 4248 4812 3544 1694 8241 7541 6046 1536 2105 8287 4769 5557 1733 1807 1918 3798 1166 5910 2630 1391 3623 1440 6776 2463 8029 4253 5509 790 1133 2843 9200 6662 2323 4934 8983 9326 2378 8290 2705 9767 3331 4111 5712 3200 6785 8687 801 8886 8781 3105 7653 5115 5607 3266 9495 5762 8790 8380 4435 5664 1232 1894 2641 2742 3030 3231 3059 6871 822 6084 1829 7857 1577 4094 825 1146 8899 3033 7840 8857 9347 401 8425 9515 3601 4709 6804 2704 3269 8514 9544 1872 5536 8504 987 3307 7687 4567 2381 7029 2442 8522 3666 3121 952 1022 8892 3631 3504 3295 7569 9250 9784 8614 2511 1821 9492 1039 4485 8259 2144 1509 24 4133 1291 9217 5502 760 9193 3621 5096 5773 2410 9915 5562 5725 8908 3518 1757 8345 2793 1227 2523 493 9268 4084 5911 596 5434 6895 7169 9388 4830 5025 4208 5723 4374 3164 5577 1962 3582 2343 643 4435 3305 3451 6655 4242 4034 4218 935 3768 4833 1651 5170 4713 6545 5344 5440 1915 5606 9627 9111 930 2185 1295 5171 8754 2508 7448 446 1594 3129 9499 2990 9534 8771 597 2715 4390 6543 9748 3223 630 7475 750 3818 1724 2067 1276 9920 5612 3624 968 3801 4883 2349 7668 6854 8939 162 1340 7530 2948 209 4834 3752 3647 6794 5256 2001 2088 9861 7627 5048 4932 7370 8780 1895 7754 1905 7540 1237 3759 6986 8864 6504 3111 7574 1376 6791 6735 5917 4252 5005 8930 7212 9272 1223 3192 9413 6642 9380 5720 3890 6588 7910 3279 4875 9204 5218 6791 428 4514 8838 3285 1118 4186 4708 1125 1654 5552 9932 7777 1896 1940 9313 3269 1661 3397 9887 5586 8869 2006 5137 4709 8356 5811 8483 8299 213 9283 669 470 4199 593 4930 4397 1146 6021 6364 2909 3779 8790 3048 1814 6581 3810 986 2271 8045 4962 3630 7034 3584 2789 4764 7813 5168 1086 6252 8066 9693 237 1632 8148 4235 3398 8164 9757 4378 9874 2802 3570 9610 478 5124 9462 4001 7367 5306 8867 2609 9343 8783 3452 974 749 727 4789 4187 6997 7064 7439 5124 6943 5768 1814 1798 1334 5399 4694 7423 776 3903 7895 9760 2054 1217 6263 522 6018 325 975 5345 3200 9927 8475 3903 4495 8424 3467 5108 9794 2852 5809 754 381 3853 573 5942 9226 9865 6706 4029 9527 4339 3478 5579 9757 4595 4088 7806 6877 5572 9046 9481 8884 3698 3063 3420 1847 4895 1517 2758 3318 6984 7459 2922 2859 882 5711 9934 6516 7665 6782 6738 7347 4456 7749 6691 644 9435 4507 2208 5910 9632 2564 4929 7877 7960 5157 8700 1125 8149 3969 8386 9210 6324 2355 6068 2358 8662 5418 1154 2861 837 5287 2352 5263 6642 1672 4208 3423 5599 1892 905 9694 593 7437 7941 2588 4689 416 943 3916 4724 6572 2772 8472 4573 151 4244 7133 9843 149 8407 9517 4359 6806 5906 2951 4062 6495 8866 2174 4913 9795 9038 5310 9029 6343 8243 4538 6879 2723 5483 9062 6390 3513 3034 2333 6156 5842 1798 5506 6133 8736 1845 704 9055 7566 9339 7655 6161 7124 6634 4907 7278 5012 8045 9148 2252 6548 8703 7255 5499 427 1437 8440 2470 1212 616 1262 3659 3908 1641 9125 8922 5319 1217 6471 9579 8257 5451 4694 8823 9758 8661 7471 2104 4814 4398 2414 8567 7570 3226 1618 2148 439 6388 6884 224 594 8434 5144 3254 7365 4090 7645 3519 6316 4151 6544 3849 7927 1284 6037 9474 6333 2181 2346 1093 5527 935 5505 5707 5881 2960 7780 1445 6405 3650 424 1411 1260 8209 732 2388 3209 7621 5920 7518 6472 1130 5239 7087 8758 1245 4103 3212 5109 9043 6048 4140 4549 282 4324 3606 8092 6749 7133 7013 4129 2984 6481 543 3587 2006 5472 1607 8002 4951 1323 1256 5459 432 9350 8316 1886 1742 9751 258 7214 8199 5895 5458 4085 7704 9748 3123 3236 157 9002 6097 7040 2791 5859 3737 2269 7572 2757 904 3494 7121 1998 5735 1271 5800 7906 8399 7300 4124 6577 4551 4516 6384 8655 5191 2521 2315 262 6166 8569 278 2316 3546 108 5304 6757 6821 1761 5124 1936 4276 9291 7803 6130 1513 5768 7530 3792 6050 3805 6197 9538 9385 6645 1831 4762 9695 7615 1572 1570 9470 4208 5391 6250 8635 9600 5203 7915 7340 1902 1542 5965 8120 8393 3120 3428 6540 9861 7873 3853 9536 6475 3664 4464 3305 9555 1598 3333 548 8947 3315 9821 9095 9778 2492 5403 3952 7665 6609 8914 7194 8097 714 9802 2294 6099 1446 560 6375 5575 1687 3683 6453 2486 8703 946 9992 4927 4808 4557 1087 8664 3290 2244 3452 9263 8235 1188 6590 4179 4515 8407 8397 2704 6872 6209 5537 1106 5763 1864 872 671 7824 8624 2867 9124 1395 1591 3323 1171 8880 3823 201 174 1601 5524 8425 9132 6506 1321 118 6374 9866 3804 6783 8685 3738 62 2403 9474 3595 2646 6521 472 1463 815 5378 9134 5656 9244 6348 +1000 +4151 8323 5225 1880 9171 7969 5447 2928 732 1941 5375 6088 3263 4569 665 8110 3364 2922 91 5626 5968 1083 6154 8649 6136 6747 8150 7417 2564 6944 8359 1549 9418 3165 4493 8509 4284 5149 6935 5541 5531 6222 1017 7178 5956 765 6383 8813 1568 920 3879 4347 4353 3833 7304 1147 4158 5037 1679 7883 8159 150 5701 5743 675 2378 1406 7287 8188 8165 2289 9946 9302 421 4062 2737 8253 1028 6506 3917 1778 4652 4452 3961 1504 675 9336 7896 7359 6634 8321 5111 475 3267 1946 9429 9699 2747 9048 2220 4905 862 8780 866 8344 6967 4583 7711 5726 4401 4852 1367 5091 1514 3448 6094 6667 5817 8083 2077 4317 6256 2030 3363 7322 7236 9208 4653 2933 3815 2693 8200 1150 1661 4480 7105 3210 8969 3810 2268 6306 8300 973 9357 845 6439 4684 572 6802 7997 1777 2144 5412 3434 1609 9309 9016 9127 5895 7745 2920 1660 6137 6406 2278 1623 5045 8826 6021 5097 1572 3268 2957 8323 4911 2334 2415 2873 8583 792 9823 8158 549 1885 9030 6294 6510 2185 7043 1364 1066 3016 3886 5093 6502 661 4503 8361 7431 9476 1304 9804 9648 5192 1506 3611 6853 4916 4731 489 7485 6912 3507 1023 8305 7663 4607 2124 5425 2827 8942 9443 7509 79 2605 2480 8824 8102 2794 800 6356 5653 5165 9611 8865 5393 162 9392 6119 8164 2447 9644 9806 327 798 7307 7796 5673 3184 5002 865 4479 2377 9325 280 300 5649 7211 5003 6210 7793 1137 2625 8989 4764 1363 8343 9890 862 4548 8398 2758 9382 6484 4479 1067 3678 1030 4103 4184 1125 7789 997 2941 5427 7270 730 4141 4744 4624 201 1456 3672 1469 9687 2702 7353 9743 8598 8577 8855 1004 9414 5924 8518 680 6824 4754 151 9761 4072 8607 3110 2003 5801 5627 2630 651 5941 2494 3827 5391 3025 8693 5097 6768 8753 4875 4373 5776 7185 8471 623 5044 6727 2648 4177 2171 1985 8771 7730 5834 1685 4958 450 2198 623 1990 373 4290 502 2840 6098 477 5746 6331 4897 7009 6383 1569 7209 1491 8080 1079 5113 7252 4678 9558 3991 432 5135 2258 9842 7177 8380 1605 1996 9936 4054 3342 8957 6181 7613 9961 410 1139 2006 4350 2729 7344 5775 2528 8826 7802 3270 6160 6348 155 4131 2796 3011 8406 1774 7048 9503 8825 9270 9939 7538 2561 3638 2049 4011 6057 4910 4539 7557 6740 1898 5122 8276 6550 1121 5013 2301 766 5884 8649 8453 4876 9217 8164 5318 5678 2564 9632 3528 4277 7358 2668 4626 3928 9849 5224 7393 5887 9226 9428 8719 1070 4416 1104 9459 85 4325 5471 2164 7699 6193 6618 3841 3801 4537 9179 8140 5822 5721 2145 8464 633 9875 3199 3359 5097 5855 3453 7742 7396 9348 3498 6748 9493 185 5101 4836 5078 6845 2513 9407 7209 7111 1377 4382 3210 3136 9412 1621 4923 600 3569 7575 6222 3692 2570 3527 9018 9148 5340 9057 979 2697 5675 9762 2132 6544 8753 3642 6972 2755 7575 8165 8587 8955 4882 1089 1292 2872 4729 7367 1803 9506 1102 7657 4705 7512 4552 677 4800 4169 829 8594 1809 4541 3326 3919 3939 3924 9496 710 2275 4483 3366 8772 2313 4379 5176 3809 3835 2020 9787 7366 7306 6514 1307 7219 1889 2341 358 526 5978 8962 7722 9973 447 680 585 4805 2342 7234 3351 6355 5675 8187 9557 5113 4432 2121 8527 5493 6434 3786 4626 6232 3889 7795 2499 2289 4096 3289 9226 6338 1540 7507 2672 479 9868 1392 878 971 9402 403 1157 6740 9530 8762 8770 6900 5825 4639 3887 6560 7390 2401 219 5762 6190 2456 8067 7414 1051 5659 2519 8317 5359 8909 644 8023 9825 8802 448 2724 8484 8941 5772 3760 3129 2719 3911 7827 9365 7115 6363 459 1692 1346 5534 882 4289 1839 6360 8183 33 8491 9934 3917 6858 2037 1430 2663 2049 5898 4806 1527 4417 2046 9963 5214 1793 5124 8572 6713 1601 1650 1891 3077 517 9975 6689 9192 8361 7054 9754 5797 3965 4447 4833 1648 6974 2230 2712 1916 6751 658 8917 912 719 4251 3822 6846 2308 1495 2055 5988 5562 7991 1928 9625 8598 7255 4317 7294 8519 3516 1084 6921 7543 2163 4994 1727 4195 1062 9867 206 3050 4807 3823 2994 834 374 6871 3807 9297 4091 3085 2169 7170 7366 8513 8106 5067 6753 6546 9938 7785 6418 6988 9450 6614 3574 2257 5947 1016 6519 2480 6857 277 955 6057 7424 7759 1329 2879 5193 2620 5049 9714 7667 1452 8639 8458 15 3969 3313 5113 4900 8345 9277 6367 6912 544 8858 1785 221 1027 7125 2351 2599 8507 660 6758 9823 3869 8817 361 5816 1440 4182 5169 4357 6677 6345 5675 793 5447 3077 9272 3816 1404 851 7431 6871 9015 6290 5442 1843 550 1493 9674 972 1318 266 4626 2267 6191 5409 9309 8460 9927 3895 3859 9970 5744 7723 9125 7115 6092 8611 9479 6581 4611 2669 8032 7010 504 1349 7724 4560 2331 8912 851 7853 5773 3087 5787 8190 1235 100 1940 9988 1266 3085 4406 589 1034 1431 4721 7221 8877 8979 7126 3715 5451 6822 434 8539 7196 66 9888 6559 7897 5119 6419 7510 3643 1532 3498 4843 2316 3998 6129 9536 7102 106 9364 8614 6915 3937 4117 8000 7438 5749 3673 1129 5901 3238 5445 5534 7833 8088 5829 2266 3628 4992 6097 3366 6401 4186 5173 926 3907 9335 3289 9480 3288 1260 9217 2062 1103 5330 2660 2826 9390 1050 6428 3330 3512 9541 6128 2149 6899 6752 5574 7123 7337 3591 2024 6182 3579 9710 6073 3518 1291 4692 1951 6764 2180 5535 1656 2677 6081 4406 7344 9964 2946 6310 4649 5701 2400 2977 445 1000 1579 3913 3492 8343 43 5256 6949 8109 3590 8559 4017 5457 9301 2870 2597 8428 2697 6423 7341 +1000 +9149 4998 6707 3763 22 4338 2198 7818 2229 1121 4234 9878 2049 3078 5589 1629 1999 5807 9220 7729 4571 3016 9607 4311 3287 8188 2907 1047 9891 6924 1628 2227 9376 8183 6017 4972 7356 6074 4794 2625 8087 9989 3743 1210 3509 2551 1641 6027 9994 7517 6676 2385 4345 9242 9749 8384 2535 5669 9450 8736 2805 7590 6015 7374 5837 6415 3998 7319 2505 7136 7687 5152 8932 1897 6014 7282 7347 2044 4640 7542 6619 6564 6482 439 3072 6494 5298 9826 5118 354 2858 2040 2510 3716 1528 5697 9004 5306 8279 5876 9236 4108 730 1888 5901 9220 9761 9336 5531 8504 2498 7423 9229 5470 7437 3132 104 6165 8120 8374 1612 3125 9716 2664 1357 9765 8079 5867 6312 9867 7214 6354 8495 725 6855 454 3943 4048 8690 4110 6646 7501 5818 114 5558 4758 8216 26 2883 1763 8555 2898 1066 7639 4948 7532 2709 9374 563 5190 8554 7290 9426 8928 6606 9530 9782 8899 804 1357 9975 1218 4370 8229 3813 6985 1695 7577 990 262 4564 8681 4375 6906 6016 4715 5604 5946 1121 74 3742 3201 262 740 2156 6837 8884 7152 7379 6770 5415 5073 2759 7977 7385 9122 2514 3951 757 5922 128 2161 8881 570 6621 2022 5830 3733 1021 2634 5658 7264 2021 3652 7752 1762 7577 6504 9414 4935 3798 1825 8615 5975 9359 8459 9355 8775 1051 204 3368 7938 6725 2429 3521 5119 3395 5386 9486 4643 8172 6737 9926 71 1842 8093 9209 1810 2758 5716 4993 5808 9125 5794 4659 3648 2013 7406 2631 3271 8983 341 4200 1186 2780 9370 2165 2273 9145 3725 8588 628 1084 9449 8024 7173 8002 2303 9582 1 4051 2297 8247 898 6058 5152 9024 6693 7942 8704 5012 4338 8109 9628 9202 1607 896 4285 8076 8015 1343 2059 3344 2338 3811 590 9870 5004 958 7630 1589 7986 9445 2653 983 7952 9912 7044 3256 2404 3105 2723 2632 1320 8936 7743 7921 3252 6282 4204 369 7312 960 7033 2338 5659 8769 6174 2931 1438 5130 3161 4713 337 5078 940 5506 6178 3040 1589 7611 1537 3694 2308 8654 2436 5974 3828 3066 5523 7787 5137 2506 6544 6517 4507 5999 3583 2099 4954 1957 6933 8219 165 8875 7869 3929 7453 3453 9770 7630 9372 3071 890 5845 2980 9560 215 7903 8301 3247 9789 8571 9813 4861 9155 3836 6678 4323 2760 4410 859 5550 7181 9023 175 3143 8256 6786 9009 1826 5961 7388 8723 655 8269 1423 1819 2900 9000 4817 8758 5740 6399 3317 6750 6598 6872 509 2050 5090 2565 7018 4788 7498 8265 2088 3783 2729 9418 6702 4457 2707 9528 8160 957 7869 5038 9100 2614 6450 8822 7798 8302 5533 5527 1591 6362 8963 1971 9292 5569 4358 5516 7014 9100 9243 6823 9880 9456 4986 8541 644 7349 1039 7860 7697 6689 3825 9005 4168 9560 9830 5725 3504 4933 7902 2871 8181 5087 6499 7299 4786 4994 4141 2613 8456 5248 5561 9461 8140 9666 7120 7305 2056 4726 6220 5622 8793 876 7639 9077 88 58 923 8015 5901 4109 8074 4202 7908 6124 2117 5532 7333 51 6053 347 6938 7846 694 3892 2489 1046 7797 5882 199 5606 5113 3215 8701 2475 3590 8129 3108 3234 2700 1128 9099 1478 5993 9526 8378 6585 2229 4310 6972 9577 6443 3717 8645 1059 884 6900 2347 786 5709 9960 5303 861 3584 4386 9016 7044 4459 2674 9136 1164 8521 136 8496 9302 7673 6846 1287 3907 6244 5895 8322 1722 6345 6126 5002 1533 1773 9055 8662 4437 2741 4629 7015 6305 8542 8920 5130 9541 8155 6573 5537 7170 5604 8521 9420 3481 5321 285 8067 9650 3957 1465 6841 2679 6129 6871 2584 3585 9232 6634 4664 5351 2012 5435 6848 1496 1212 7300 9169 4604 4497 9743 4793 5608 7505 9950 9312 4565 4035 1903 6606 4626 3048 3203 4507 166 5042 8873 9627 8650 6923 5576 3942 3740 1068 7245 7109 1076 3302 8900 4307 9121 8576 6690 6394 1757 2904 6543 4724 5642 3092 5978 8695 6210 1855 3476 2139 8858 9078 3513 310 3933 5536 4428 1050 173 4065 4020 2275 8906 7210 3681 5113 6410 7622 4851 1901 2550 3292 9996 5689 1318 5606 166 2551 3159 622 827 4254 6125 435 7586 4054 457 2379 881 1042 463 8170 9099 1881 86 3440 5819 2425 3235 9618 3049 9626 13 2953 5061 3289 1791 567 3202 4919 3527 5464 5947 759 8763 4329 8774 2889 6877 8935 6745 7267 2058 8576 3680 8151 4787 970 6282 6199 1942 2704 469 184 2826 3478 9374 2799 9835 7243 8110 3920 2973 9759 6947 2528 4809 5591 3243 1375 7561 132 4665 7569 2515 4850 6583 7392 6792 9628 9497 2303 2749 1477 5164 8324 675 3320 9561 4195 9598 6969 7925 8044 9080 6177 1735 5237 884 2561 963 7115 5119 6850 4722 1133 6852 9593 3570 6030 7792 7873 2380 6135 1939 5552 2155 2176 4352 6186 1935 7104 2067 8725 8787 8742 8824 5980 6979 6125 8503 8040 2631 9412 9062 1235 364 8230 7706 1113 6783 8914 2633 9715 1722 1689 9334 5371 4711 9884 7633 1157 7108 5749 9214 5624 1874 351 9180 8578 4039 8998 71 6521 5591 6022 9913 4343 3607 7176 9003 3483 9372 8935 6315 549 6367 6617 5866 9373 4072 5575 3949 4276 3694 6263 218 3310 9260 9721 4924 5863 8907 9359 2514 3295 4661 6686 4664 613 4816 7580 7254 8904 9833 909 7590 8931 2960 247 7763 2570 8147 7949 2259 9970 2211 3320 1863 6992 7350 1449 3830 8388 614 2286 2998 4780 3697 2864 9326 9548 8034 9704 5789 5980 8170 6918 554 2388 4896 5066 6103 396 2772 2174 5317 2722 7863 4609 4116 2049 8204 5509 1134 5450 3727 8189 1113 6346 9722 9806 211 5835 1511 6514 916 5540 5887 3972 2357 9281 8253 200 7326 +1000 +7016 6280 6919 3615 7024 6634 5534 4289 6604 3093 8912 6743 5593 7276 8849 6748 5996 4028 261 1528 7194 1976 1589 6433 47 7353 8563 6745 5840 9204 4671 1414 7033 5752 6946 5789 2229 105 5504 3008 4809 1893 6782 1102 8012 1479 4684 7642 4507 9722 5257 7682 1092 5567 9509 5528 5606 3946 2568 6627 2501 4272 7905 398 6199 1044 5858 4177 2736 4283 9320 3102 8042 6442 2945 6355 5115 8921 1419 6662 8265 8491 4264 7568 7498 3200 9018 9181 8140 3965 5274 5435 6941 3874 8424 5414 9889 6729 6876 6945 7196 354 9655 9035 6075 4126 5009 8882 1444 2659 7374 6628 905 4008 7403 4089 166 679 7954 4224 9373 7133 9865 1314 798 4774 4208 3765 3932 4480 2690 6687 3430 3488 4474 6304 8260 5373 2908 1032 8166 7049 8125 7742 9682 8661 2557 579 7877 3646 4507 3546 1449 5823 7480 5465 8747 3632 2867 8940 8200 5982 5177 8723 1042 3443 1438 3169 4881 8213 5958 7516 6977 3873 5944 9413 5935 4371 1484 2812 849 2976 4480 8325 179 8613 121 3305 5663 4880 2304 171 5189 8783 2177 5207 4800 5462 4118 1606 4100 192 3740 7154 9837 3606 4683 2945 242 3924 6033 9722 7667 4984 6649 2414 2845 359 8 9992 9103 9871 6508 6793 9572 6669 7219 8469 4199 5321 7868 1378 6074 4047 4172 875 2019 5582 3928 1196 2974 9332 6358 1407 8304 3738 9567 2973 9552 5250 9700 3073 4787 4620 4684 9038 856 1139 1682 3664 161 5148 2429 6901 9172 2147 514 7020 5560 3789 4771 1594 6200 2995 1282 3842 9192 966 375 6602 1534 65 4169 8567 1995 6253 2749 3777 9790 8743 2138 3165 8072 1918 7619 4681 2411 5094 9916 419 222 7980 8063 3749 1280 3695 6038 8834 6570 3280 278 9569 3381 7085 7151 3993 4784 3126 4242 2307 2494 2761 8625 8550 4030 3133 3238 1468 2047 4509 3457 9542 7454 3108 398 8340 4336 6606 1501 4589 5058 130 1098 3843 8553 6275 2880 6386 2174 7540 2156 1038 6064 4243 4856 7218 8981 7140 1344 9585 8736 3059 3845 7091 1382 4052 8990 9105 4189 2778 9958 5812 3691 4464 8765 8231 9068 4227 8914 5980 1516 7644 4602 78 7098 1089 3187 7233 9816 2965 6867 5197 8687 3294 106 9625 8262 3327 5935 6152 7008 5307 2042 9175 7705 999 6003 5676 2887 5652 8517 2536 6882 470 6150 9603 2907 8007 9336 5877 6493 8425 3245 7828 1471 5845 1256 10 3552 336 4516 5428 9904 5315 1102 2028 3445 2175 295 1031 6739 7264 6006 3831 9897 3113 5812 7849 7920 8111 5075 4022 1100 7954 5044 9557 7113 8922 3790 2454 6637 1788 9735 344 2802 953 7846 3412 1924 9382 9521 1583 8389 9367 2826 9807 5228 1526 2941 6406 7656 127 7910 7190 3183 3416 551 2274 4288 3197 9540 4939 384 8101 6294 9382 2385 5595 6583 1563 8429 1376 4324 7704 750 1362 6715 4722 3594 4989 1448 3302 1621 4902 3281 6987 5101 4568 3957 2878 2234 5625 6527 5563 1981 4146 3486 4332 3699 3895 2155 8648 8480 4094 2403 1334 6734 82 6089 5797 6333 5807 1552 3693 9741 4150 1607 7605 2406 8864 9182 3719 3953 9336 248 8910 5533 4282 9252 7530 3827 2655 4421 8039 7552 4129 4059 9951 9204 5682 2000 8657 5315 5288 435 4811 2873 3454 5364 5112 6698 1179 3748 2328 7773 5243 4571 2602 4073 2973 4239 588 8381 8652 2973 4461 6414 544 402 8778 7355 6020 6866 2739 7795 4007 435 7414 973 7607 6573 8525 1224 593 4419 7703 6936 3818 9371 8474 14 1024 641 4505 1419 6325 2124 8403 9195 6923 3574 1391 3291 7300 6157 9685 6295 6053 1819 2375 1210 1135 8568 2188 2269 9196 3824 3575 6477 5851 5329 3279 7459 6200 5286 9110 6153 2355 5123 4280 2801 5678 4846 8825 9144 1255 6273 2608 3897 6167 77 8487 7196 9218 9485 1130 9811 7026 454 398 8471 2185 2008 3633 7809 8301 7132 4415 4446 7172 1927 3187 5430 5511 7607 7737 1794 3098 1281 8198 3885 8328 5751 4405 2157 6780 8613 8298 8734 9453 7563 6371 5157 1749 6146 3803 2843 3623 6093 3070 8209 5324 8553 5242 4702 9054 2178 4418 6690 6979 236 4588 3580 7197 5554 3667 4825 1845 3993 7629 6900 2750 5687 7781 3309 7649 6751 992 3208 3354 5621 8976 5067 214 7059 5788 837 7691 6963 2000 4449 8121 8662 8287 8571 3251 7042 4494 5365 7563 670 7625 1358 9867 4546 9206 5918 3060 8879 3692 4947 9539 755 7383 4025 9457 4066 483 9963 5933 9245 488 7843 8708 5283 2190 6795 4286 4318 5028 3116 2228 5454 3308 4111 8951 5700 2856 7878 6827 3589 5926 9404 7368 8752 1795 7618 5774 225 9274 2589 9055 7631 2027 4079 314 5681 9352 5134 2041 1076 8825 4200 1046 7477 8621 3360 5421 5507 6486 351 3377 2909 4020 4239 9244 2836 9762 4143 5584 1214 3668 8851 2618 505 9652 7578 3825 8316 9358 3574 5109 2011 1448 8080 64 8668 9486 5962 8843 7445 9574 925 7869 9392 2427 6528 2566 5601 2988 6761 8607 1449 5766 5844 7951 3547 2306 7769 1106 2385 1366 1080 2764 4802 432 9600 9909 9491 6548 6673 3167 7957 2338 2838 9560 7719 6379 4017 4359 6154 3099 6071 3600 6322 1490 1820 8900 5117 7206 7012 3629 6196 6466 6405 8054 4859 4132 1872 4779 905 9153 3765 2391 7146 6894 3335 2601 797 3728 5717 648 860 4413 5094 5049 160 4544 1261 909 869 9007 6674 1352 8571 535 7526 6318 5691 9549 5011 9303 742 909 328 6774 1449 6343 797 5639 189 9015 8603 9227 7434 9940 3536 8468 8945 8657 2762 7499 4037 2983 6950 424 4082 7662 1447 7445 3702 3191 4159 7749 2558 8369 4560 7921 4251 865 +1000 +4064 6797 2956 4851 4268 9516 3350 8914 8975 3219 7373 1698 8629 9256 8427 4926 9786 8179 186 3634 7815 9359 2957 4880 3335 756 2443 3552 4214 434 5520 4786 4197 5706 8131 8566 4976 3088 8680 3298 6162 6467 5943 468 6153 8006 7250 7638 6470 8277 3244 5128 3158 7111 3740 8676 1847 9100 3479 1518 8437 5008 5491 6359 5762 7986 1162 1920 331 2883 4631 3473 2333 7315 5640 7379 9043 9984 6887 442 8576 7056 6634 8818 3804 8698 3774 6409 8274 5528 2965 9761 9043 9492 1329 8271 5224 9971 5253 6065 7453 1428 7776 9813 772 783 2609 5906 9998 4037 9477 2610 7848 7066 8099 6504 5362 5688 8898 4457 4664 3777 2571 2668 4588 2808 5496 2740 5278 4105 9389 298 9857 7061 5794 2062 5343 6588 5064 3501 3581 4717 177 532 6008 3366 19 5725 4586 4433 6260 1695 3490 8368 6212 3855 982 5026 1671 3853 7994 8018 17 7918 2001 333 295 8629 9439 4022 7949 3396 677 733 3118 7161 4372 4839 8217 3035 8020 4453 9170 9028 6554 7788 8713 3020 9022 5569 7580 9242 2449 1584 2583 6621 9439 645 4994 3241 9136 1197 9240 7319 9697 4167 1170 4501 9266 201 1693 4945 4087 2505 4414 8185 2021 1668 3575 7737 1489 2033 8612 7806 2826 2397 6178 4938 1560 8167 823 3462 5875 3487 7707 9938 4184 254 4518 1092 3644 6954 1676 2837 1421 422 1602 4996 7427 8457 657 7566 4205 6587 7426 6866 5186 8632 3704 1541 215 3085 2907 9856 1899 9283 2029 1711 4047 5759 6746 9747 8472 338 5758 3206 7371 4345 4356 6898 4485 4812 4350 7184 5076 5435 6007 6898 7112 1795 1812 4348 8287 1299 126 7404 8404 5263 295 7874 5416 8173 8172 3666 7884 1830 256 8369 6895 728 3846 7190 79 1128 4765 4677 9922 69 729 2408 5740 8969 2080 2440 8752 9251 182 8302 352 400 695 4534 6924 6968 5778 2181 9690 2351 8926 4743 9118 2237 2903 5808 1670 2678 4944 8893 129 1082 4117 196 8091 5327 8049 9843 2172 5777 4026 5194 2975 5333 7669 154 7452 6006 1492 2131 6393 239 4611 3825 9317 4496 2275 3141 7376 1443 4761 320 2125 896 9595 5395 2023 3079 7111 9398 2396 6118 9424 2923 3914 5082 4261 2534 8601 3834 9648 9691 1448 561 2648 2537 936 527 8441 8910 4291 798 6248 5528 8804 5634 3926 8056 7359 9598 9293 9424 3094 3339 2580 230 7469 3716 3995 5154 9263 8613 7054 2103 4167 3675 3722 1503 6312 9429 5510 847 6028 6917 2643 7662 5169 2536 7220 9822 539 7282 5212 8809 8631 7208 4215 9666 964 7769 1456 7564 5638 9528 1574 1511 3068 7117 7295 6157 1731 7803 8445 9426 9657 7804 7036 1554 2515 3495 94 8447 8722 8659 8980 4574 3864 6040 5493 1176 6793 9822 3786 5771 5689 1389 691 2734 5264 1563 3764 3611 4055 2714 4951 6776 3372 1718 35 4381 9457 2142 8944 7356 7004 1363 9686 5694 3548 3928 3522 4026 8597 3749 9948 8830 6466 9322 145 4439 6847 1383 5098 6462 5947 5075 3569 1132 987 9156 8437 2147 455 7545 2653 81 8701 5622 418 7827 3854 8232 5111 9450 1947 4646 9357 5612 8093 5945 4443 9033 4602 2035 8682 5691 667 3979 849 5137 3060 9147 2525 623 1001 3217 869 5321 5657 4426 846 5211 7596 681 7020 7383 5659 5376 9785 7528 8529 311 3053 4032 9185 9822 2983 9880 9886 2455 8795 4341 6052 9263 8770 5255 2455 1176 4185 6194 5331 8999 7202 9547 612 8820 1152 1878 9028 9043 729 9925 4502 4909 6009 3904 4727 4630 8962 2216 5554 1482 658 7362 5950 5419 5238 8235 6941 9325 7145 5690 4189 876 8806 9587 3265 4349 7794 8438 9608 9671 1912 7267 8326 5728 4886 2418 25 1619 8208 269 6510 2489 1146 1271 8376 3746 6600 2698 3895 445 6546 5411 4029 2611 8833 2980 5420 1920 4001 7127 2577 6284 4529 5292 5512 5691 2428 2502 5112 3994 4768 9450 4474 3220 6100 855 5759 6787 3477 3038 4646 6945 3237 8631 2074 9421 9741 1176 2932 4088 9243 6282 1631 8638 9175 8993 1699 4647 5146 1421 6889 4990 3786 574 4497 3882 1666 5231 3444 3535 437 2397 372 7486 2268 3204 5617 8810 7416 7153 9571 7525 6218 3788 6014 1074 1305 617 6272 2693 380 6103 1814 8742 736 3567 9008 6476 7736 8984 5896 3006 29 1120 797 3712 5243 8686 7104 1634 5834 5765 3944 702 7696 4391 798 7674 5115 713 1466 8928 5655 3316 8548 5222 751 4058 6499 9071 9308 6429 1814 7310 3122 8970 752 4047 8565 8946 2376 9430 4356 890 3459 7294 4668 2706 8681 227 2827 4487 2667 1625 2047 8272 6635 6747 568 858 333 4621 2769 3484 7470 1875 2383 7198 3997 3058 104 3621 1431 7133 3325 242 3858 7842 7442 3076 8625 7119 9086 3061 878 5519 661 4513 8628 7334 3615 8620 5634 9199 5678 800 2192 2668 2943 3991 468 5956 7177 8239 2664 9241 7715 3199 9318 9146 8663 695 9977 4433 7326 9169 1014 9202 7276 2658 2884 1089 2206 4573 245 4969 5718 5638 3043 9731 6227 5806 5360 6861 1808 9473 2051 6540 8978 3601 3515 5681 5239 9063 8978 6246 9645 7006 6408 1465 9343 5030 3873 798 9245 2053 315 7111 7891 4226 5918 726 4349 1834 7336 5408 8136 626 1387 2105 4060 6960 5873 3044 791 1499 8024 9071 8280 3525 6018 9673 8978 2588 7762 2956 3707 4304 5218 8324 7728 2023 9806 3873 1529 4659 6375 9630 2240 520 7830 9513 190 3292 5228 8500 8415 5427 2541 3428 3293 7282 9045 2491 9076 9630 5222 6686 3246 5410 2024 5208 7229 6620 7726 2744 5310 7653 6242 1294 6394 3521 4500 4001 4389 6183 3044 273 3157 1933 +1000 +6666 4057 2422 5391 6232 6373 3530 3716 117 4618 1348 4705 7681 4364 2787 509 938 8615 6602 6462 2603 198 7101 7740 2053 7459 4518 3831 3258 1588 6707 1557 9052 9892 4513 5645 6086 4203 5815 9411 2362 826 3138 2146 5195 5807 1549 3725 7660 9794 5336 284 9601 8686 8750 6195 598 3760 4032 5735 1267 7067 5089 273 550 9623 4874 5113 8499 2326 5559 7986 6064 9671 1940 6087 8693 1904 6720 4325 511 5717 8134 5342 4334 2761 6425 7121 6931 5616 1321 4432 6899 2179 5797 9563 9659 7609 7646 4425 4940 4689 2144 5368 1536 1548 745 7380 9309 5162 4619 7167 4794 8660 7852 8544 1556 9822 9228 7666 2229 4667 3029 7163 2548 5509 9577 4275 902 2140 1499 5762 9666 614 6747 4025 5975 7763 5703 3663 8274 2888 278 9650 9851 4766 6581 7782 3067 20 5636 2329 4633 9655 8917 2413 9157 1708 772 7666 6637 8752 5343 673 8103 6155 5895 2763 1509 734 2231 9645 7581 4364 819 4651 8210 7855 3222 647 224 7278 6787 5001 5808 4720 6010 3194 2735 3688 846 9902 5955 5704 4606 2879 2145 389 9440 3673 448 4371 8338 3946 5767 4669 3738 3196 762 6794 4327 736 1053 204 2219 4310 1588 1316 8856 4320 9476 2723 6554 3109 1067 535 151 6032 9568 8737 3534 6968 1502 3144 8081 5745 1127 5886 5863 717 846 7780 1664 234 2959 2542 4534 9618 507 380 6274 6511 9760 6171 9999 3190 2643 9638 11 9989 3381 1128 3712 6420 5141 9061 623 7252 8672 4191 7897 1533 5679 3266 3107 2669 5836 9130 1784 7560 2680 8951 3950 3121 6625 8034 1491 1717 3145 5467 3908 8466 2154 5032 2700 8565 8087 3173 3261 8992 7051 5710 8796 2467 4697 8882 2931 9160 2590 9324 9187 7890 8832 8455 8354 2422 2587 790 2089 9532 8715 6836 8787 3387 1283 4748 107 5639 7538 4385 687 4881 9617 9286 2298 8533 161 987 2021 1599 8952 7119 5531 7528 6797 9833 6825 1511 9964 4912 2044 9087 5399 8169 2686 4406 4387 4715 5216 4591 2216 4020 5535 6681 909 4635 7515 1694 8922 6040 8729 4796 8137 183 9727 5601 3355 7370 7313 1042 8082 3358 9554 5417 1193 6262 5725 9319 3824 7211 3138 7777 9240 9332 8726 9529 2586 1857 1938 1391 1585 376 7463 2251 9810 8232 9561 9124 3456 331 5006 9162 958 2943 5594 8959 6230 2679 9253 5600 5759 5114 8292 2272 9077 5201 513 5602 7034 1927 5193 4595 5893 5373 5951 5692 84 8207 6129 7327 9897 1186 7329 2442 7488 1376 7441 5796 1771 3649 917 452 6166 886 8144 1768 2336 9423 9692 7996 8745 8413 4488 3038 8923 8898 6047 5075 5187 5675 4981 2105 2914 8164 7570 7656 3093 782 1717 3716 7629 8089 2316 1694 6290 4681 9214 5104 1751 146 5890 9101 5641 5195 4713 9598 2840 3647 6341 5511 2893 7728 8210 5586 9861 481 6746 1597 1427 6366 1301 1193 3315 492 4786 4425 1700 2302 7573 8407 417 6105 2434 2941 9975 7652 6749 2270 268 6993 7824 7348 5398 7869 1755 1452 4877 9202 6021 6497 297 5815 5690 5921 6957 3960 3144 9126 8695 4814 1719 5898 6869 2739 9607 5521 7797 706 58 1297 5591 4675 6478 6635 8096 747 1905 6882 4431 4629 6466 8489 7493 1818 1138 1338 5895 7990 2516 8328 8003 8019 5306 761 4577 8430 3866 379 3983 6169 3762 6168 2277 4025 841 1382 1034 7678 4622 960 5993 8279 6920 84 1507 9126 1219 8964 8943 8935 2730 4605 7972 2483 836 5648 2146 4497 4538 858 5876 9104 1773 9334 7703 8353 4631 5290 957 1489 2455 3622 8403 6734 7851 5146 8270 7617 2545 6568 1586 9788 1686 1168 5352 3953 9594 8442 2779 6493 5869 8861 6849 5984 7083 7215 5211 2882 2898 5327 4358 2575 9759 89 7889 9624 1419 9993 6596 7676 8482 2489 1015 2812 5490 2314 930 1721 6218 5626 8795 1748 2771 3699 1066 4031 3620 2457 4676 4364 4374 9940 8361 2184 8588 1576 4240 398 5986 7413 7781 9183 7843 1204 2204 3540 9798 891 381 2229 9928 7666 8875 6994 8567 6638 7605 2107 4895 8587 809 5975 8545 2473 6626 5395 4904 6725 6435 1717 2939 8593 3505 8323 9041 5391 1531 422 1013 5714 2041 1935 9701 956 6221 8618 8180 2197 545 9723 6785 7920 8482 563 5871 5384 1714 1926 7011 3848 4760 668 2559 1400 809 6414 9213 7703 8350 4535 4321 4445 8019 5141 6844 6072 2672 8444 6479 679 5962 8598 1018 5864 9049 6538 1139 5011 8055 4840 7304 9733 9480 2779 5652 5169 6630 821 3907 2704 7974 1227 6224 6322 7737 4839 1543 8556 2175 3216 9501 8140 7519 4036 9012 2804 2716 7637 4696 549 9330 915 5476 3308 7215 5725 7059 9083 8244 703 3815 7477 1833 2094 7059 2399 5372 7983 7715 3407 27 2512 375 7594 728 9709 2536 8337 9118 3911 4577 5475 871 2537 7637 2166 1142 851 1294 3626 2902 334 5711 6406 2158 2289 367 4223 2510 4747 4098 9763 21 6616 1884 1944 4275 9405 7012 3251 8583 2051 1605 4919 3736 6108 43 9868 952 2449 7618 1164 5245 7368 821 4919 4802 7963 6820 3138 6675 3658 6406 6895 6796 1664 5726 1255 857 3419 6436 7242 1802 869 8948 628 492 891 1844 4778 6898 1134 8916 4808 6004 5291 5517 2151 403 351 6270 534 6427 818 8215 7297 4474 8577 858 7388 5631 5246 2562 8643 9829 9388 4412 4442 9434 6461 5602 9367 1811 1973 3260 9087 8611 9463 3118 5372 6979 3715 5123 8762 4655 9930 3128 804 5596 6128 7080 3248 8400 1649 7230 3118 3597 7286 4688 7936 7426 6461 4182 3284 1389 2541 8037 3002 9997 3511 3877 6089 1201 2886 1647 2369 6037 9765 9524 4145 +1000 +2409 5161 7598 5526 6802 1796 6067 6978 5768 8994 9026 7175 298 1603 1059 9509 7639 1227 7780 5490 1492 2491 5035 9367 599 4088 6163 1630 6851 6359 551 2440 9049 5273 2623 5946 9680 2354 7362 1459 3076 653 228 4405 9005 4149 8820 3093 7258 1 7239 320 8407 9755 746 2789 5865 6318 6990 3658 2249 2551 6608 9640 5509 9172 775 4397 9935 1119 212 2830 7955 374 6303 1411 1998 9071 3296 4458 6721 6098 7225 8946 8923 9236 4104 2994 893 1385 9331 987 5231 8545 2371 7228 3454 9457 4826 2701 630 9309 301 6655 1124 4526 7605 9953 127 3583 9922 3928 241 6773 4110 8154 312 8382 902 5852 8830 257 8337 2630 7778 4796 945 4406 8271 3576 145 1269 7630 9651 2604 5980 3400 6335 5989 5765 2092 618 2551 5328 8965 2395 9465 8534 4112 6317 5327 3970 7211 8079 1177 300 6086 5456 2006 3265 2607 6911 7970 1767 8222 5303 5018 2765 9594 7632 4599 1269 3885 8580 540 837 1524 9614 6506 9572 3074 8348 4757 2331 1585 4318 9198 6951 8647 5799 1652 2773 3209 7116 7866 9252 978 9767 7811 7794 2528 7597 1733 7304 8213 1049 8131 560 5577 7747 8661 2366 6515 6851 563 1505 7579 8912 3993 8736 6925 6622 8462 4101 3865 6350 9183 5489 8192 6737 8797 7173 3726 7963 9006 6080 6603 3463 3553 1531 7538 9800 1275 1703 865 945 8217 5168 2906 1635 4806 41 8241 7021 4903 6962 6129 3610 7754 1238 8987 3433 7079 5440 5323 452 8214 6005 4944 5796 6207 7414 122 3829 1507 546 3202 5284 637 3434 9791 7610 7660 9956 8897 2869 3581 6207 1258 6763 1279 5199 9521 5113 4949 6064 84 1326 4028 877 167 5439 4287 4791 2839 1388 9039 6756 1482 7523 3558 9566 5000 2874 7897 6962 2986 5286 8167 7695 88 2178 6640 1196 8780 3302 4695 7907 5117 763 5143 3617 5406 3506 9277 9396 7710 4800 7765 633 9073 5328 2862 8095 9605 8969 6088 8344 9699 8051 27 9518 3076 1253 8296 7770 8670 5709 7156 8939 9909 3116 3122 7398 9265 8594 2393 7131 4248 2366 7210 5636 5467 6196 3365 5004 7543 5446 5324 1977 5094 6972 9655 2595 8725 6720 7452 6424 3105 1331 598 6303 8742 6321 1620 6392 7470 1434 4530 6777 7186 3923 5098 6775 8442 7890 2356 6931 3559 5976 9009 79 6956 9988 9174 4727 8544 4819 536 6984 2570 3124 9121 4396 1607 8260 8629 508 7567 1563 5116 5574 5343 6019 2347 2566 2471 2037 2780 6851 4859 6654 31 9971 9252 7953 1988 568 9702 8252 3560 7235 5633 5610 6685 227 6243 6163 6146 70 5841 6285 7965 2795 9976 855 7095 768 9586 3041 6173 9969 6435 2896 1820 4244 8404 8664 813 8152 3528 3813 6043 9288 1771 3527 6454 9146 3557 5537 3831 7730 4845 3321 6491 5766 6550 7835 3866 4428 9209 5366 1656 9951 5137 546 1101 5682 6090 3010 358 6701 9548 9617 1055 8484 1474 7301 8188 6372 6038 8206 2263 5299 932 6438 8151 8153 4449 1398 8419 3759 6529 4504 5584 3835 5792 1593 987 993 3175 9512 3093 681 5991 981 1218 3491 5793 2117 280 6818 2822 555 2052 7095 2770 4499 2236 5392 4532 870 5850 9891 1014 8992 6838 1929 9779 5208 88 5036 808 3295 2595 6236 7272 6271 4636 7439 8406 5064 6994 3508 3205 6040 7162 5324 3423 7169 4922 9556 6588 8125 5181 2990 4707 2657 5744 2249 794 6764 9484 1180 9735 4930 4003 8039 909 5309 327 4568 2429 5140 2307 4982 7089 8632 6144 6387 6299 7110 7561 4019 7097 7209 6744 6141 261 57 1429 4108 3028 2424 1099 9973 109 9817 1035 7795 8757 6872 4664 6890 7991 2829 7656 6441 2010 4124 9851 681 2478 3914 65 3266 2596 5964 7041 5860 2532 3851 472 6464 2622 2085 6332 221 8944 431 7427 6391 5950 7961 4673 1386 4247 8655 720 6664 7306 9862 7388 1008 9150 253 4446 2247 825 5769 3765 9460 2572 3027 2470 6367 5781 7290 5599 213 5405 9939 8791 8570 1384 169 5072 2978 8228 9124 5045 257 7730 8817 2959 159 9907 5527 8233 8582 3693 3812 6407 225 5617 6536 7815 1867 484 4580 5145 3924 1218 3139 692 2589 6372 121 2124 4726 6772 2191 5374 5926 2656 2424 8662 265 1214 955 3992 6131 6900 2994 2347 156 5606 3451 7498 17 3578 1086 5837 9917 9538 3204 2938 5451 2678 4521 9602 2088 6084 4228 4483 7603 7584 6088 1815 1338 614 2983 199 8235 2667 6055 5541 481 6833 6231 5984 9773 7043 5236 1510 911 7450 2585 9211 7713 5270 2315 650 5749 9878 4340 8650 8113 1432 7525 5249 9200 8395 1306 6424 5022 4780 1004 3348 4085 6694 2708 3623 4212 5730 3168 5644 5330 3717 7584 8600 6102 8094 3716 6360 395 2980 9812 6166 564 9892 8786 7640 3044 8499 713 1178 6486 6036 8548 4327 1853 8385 2976 233 9901 1495 8011 6081 5404 8697 4679 4131 1051 9518 695 9363 520 2775 8138 4450 1067 2702 5360 2769 781 6977 5942 2345 4126 8220 2417 5856 9882 6205 9418 4927 8451 8945 1102 4941 1394 9256 9881 3318 8819 782 8376 8760 2618 1254 1563 6121 1513 5434 7056 9653 1267 1764 4397 960 226 9183 7796 3628 2499 766 7902 8748 9008 5667 9907 1086 2838 5967 645 7962 6506 5445 5589 7160 5821 5515 7227 1759 5590 7227 7765 2054 1738 3727 4573 9827 5137 1192 68 4947 3747 6715 3461 6750 326 5633 9747 4559 7087 9060 5529 6123 3875 3501 5474 9892 8787 1521 9729 1967 8731 9484 5255 4689 1216 8808 4151 7071 9392 7289 8594 2158 6892 5527 1593 4129 8941 5703 3055 7146 4405 3484 5915 8122 6959 5303 7498 6588 5864 1556 2568 2840 2909 +1000 +4541 2104 973 8968 1710 2101 9917 4230 2865 7822 3249 567 2616 5480 5474 8934 1902 1666 8856 1970 254 6741 2035 8889 950 7436 6330 1270 9632 1080 7847 5457 4629 2207 7946 3405 1480 4654 5130 8281 1470 5026 7088 2074 478 5216 7432 5694 609 7616 6060 7420 5643 8955 9904 9902 6487 2580 3290 1175 2444 3518 2811 8580 2288 3189 1658 7352 3548 1768 5380 5540 8568 2366 9436 6588 8790 6052 662 1437 7361 9605 8121 3653 7864 5561 5811 9952 8836 824 293 1472 7613 3149 8207 3532 9749 9561 899 6841 5003 6561 3351 1503 289 1961 8145 1921 2114 4637 9764 7655 7463 7345 820 3731 2406 5210 3766 726 2456 3443 3385 5801 5506 2925 9348 2623 4460 3758 9663 3366 1842 6849 2833 8581 2450 7938 806 2245 5024 8359 1973 242 9012 3689 6354 2297 6645 70 2976 8336 5107 5791 2260 8001 8351 6485 6236 7750 5359 998 8197 4063 2246 7845 1625 4203 9690 2985 4619 9774 1610 8092 3492 5901 6721 1875 8445 6814 914 712 634 8233 2850 171 1588 2034 7563 7761 7762 8305 1401 2830 1583 862 6360 889 6554 902 4631 6978 4932 8220 4830 7611 5828 8906 8706 3064 8946 1789 6669 7731 2612 737 446 7872 988 7376 5240 5375 4796 192 5310 8130 2486 859 4198 2973 9549 3220 7436 6597 1615 6506 8844 2950 190 4995 7508 584 5228 4799 1034 6195 1946 2181 6264 8306 5484 6502 9721 9535 8034 2491 3065 1907 3736 9625 4671 9901 9182 7070 9275 8696 3358 9121 6068 8381 9033 1814 4994 873 2326 6270 9399 9137 8493 2220 2192 3891 9209 7496 5574 9689 2145 9133 8796 9291 2675 8006 2224 1052 8989 9213 4659 1068 3248 8903 4297 2103 3799 9980 2748 228 2421 3352 9697 6623 9577 6514 8451 6543 4356 5316 1198 5523 5474 1515 864 9920 4128 2320 2947 229 7537 3597 66 9247 2806 5260 4063 259 1738 3295 3161 7434 3465 2877 492 593 709 8104 5662 7045 3445 2560 8780 517 1978 3319 214 6023 9870 5688 961 8209 1692 2711 2947 1184 980 2251 1275 1463 3166 1785 4618 1939 9478 6789 45 7942 2012 6030 6025 9892 401 4229 2502 2949 8593 3700 3744 9279 5036 1435 6715 8957 9797 6434 3134 7998 3925 218 8385 1491 9051 2743 7859 5971 1022 3466 2303 7406 914 8103 7248 9452 39 684 6586 26 2825 9758 4119 4262 9242 1102 3604 3070 1445 4109 5693 4808 9877 8955 7062 1974 7050 1967 919 7355 2680 1915 1648 7199 299 9720 7919 2402 3380 7600 5939 4129 5009 9736 1039 4362 1271 3297 7527 8445 7199 3022 3133 7177 2025 9973 5010 7796 4014 9257 2669 7483 8235 6632 5542 492 8293 6072 7950 347 7498 7707 6359 9280 8678 8530 4266 7828 3846 5924 4083 9014 8210 833 9506 2654 4106 3545 6794 167 3826 3741 1294 251 9524 8094 7092 3869 1793 331 7949 6197 9216 9222 8069 4966 4464 1977 8404 7162 8203 3345 5548 8347 2774 7482 9977 6245 805 2603 756 4822 4896 3702 8750 4152 1098 6056 6623 8986 6408 980 9012 6436 869 5225 2700 7827 323 2612 9580 7049 2611 2406 843 5579 4274 6038 8640 3491 7638 5924 7310 8676 15 4130 8880 9708 2731 8087 3536 8348 1280 8842 4687 903 9855 4770 4984 6265 7186 9635 5236 3789 7797 7581 3855 6768 6016 6867 5108 6962 3435 6236 6910 1680 4464 1178 4570 8010 4326 7612 8235 7421 7188 2840 1095 3007 5111 714 7828 3255 3169 6280 1752 487 2755 5175 4978 6761 4823 3575 2279 8911 3964 2413 8041 607 9451 3880 4986 9070 7994 6477 2430 9348 7099 8995 148 5629 2454 613 9683 9122 6921 7796 3993 8917 1697 7310 1444 5175 6223 3482 7408 9465 8318 879 9445 6286 8644 9203 1317 6156 3051 7032 390 6619 8859 6285 5367 6424 5525 6369 89 1196 72 1340 5933 5870 9675 923 5234 4036 2947 9483 6822 3036 6041 8830 6736 7248 1464 186 9364 8593 4268 3459 6663 9415 3023 281 4933 5986 2632 3842 2104 5269 1859 6799 7880 8170 4196 7684 8476 5000 8702 588 8034 2416 676 1847 8590 2055 8137 2472 3434 1859 4446 3677 8507 7646 9172 9655 6466 6518 9331 7531 9251 711 419 8474 9368 2332 7201 78 3482 4727 5425 743 362 8756 2593 8875 2419 4685 5874 4043 2220 6973 126 492 2346 3411 3703 9670 6624 1767 7008 2458 31 9383 7918 5537 1092 5844 4315 1770 5939 5070 4424 7835 3317 2569 2324 827 3667 1562 867 7537 204 6849 3976 9118 4058 6183 6580 5624 4006 7918 8279 8368 364 8519 9479 6297 6533 334 1367 7458 6945 3177 6241 7392 7959 3944 1008 2052 2837 8529 3086 9029 5677 4878 5190 5632 6490 3456 6316 1073 3910 9629 867 2879 1300 2106 5221 5326 2260 1366 6920 3282 1061 3086 7920 8717 5440 2654 7409 8700 4072 5174 7612 4695 220 6817 8588 8831 129 2154 5302 8632 5173 6945 3464 9509 5771 1297 4171 7530 9438 4659 3988 5350 3866 3770 844 2816 7888 806 8480 1179 9095 3213 5069 4515 7153 431 6757 2154 665 9824 8982 3368 3818 1489 2760 9538 2103 186 9740 4600 9524 4013 7077 6570 3881 7771 8561 8111 63 3396 4532 3104 9068 3482 5455 6021 4377 2766 2270 1394 286 1021 8042 1027 6377 1765 1133 5869 6403 4920 7802 5860 9124 5445 4828 5999 7261 7927 217 5278 1884 8173 8036 9589 2981 1827 844 9585 5126 5750 5099 6520 1516 2296 2140 8609 6528 267 5597 1173 9347 5067 6920 1678 2562 5587 4282 5230 1668 4708 8479 2322 7817 2266 4590 3907 5306 1623 3407 6477 5091 3711 4959 593 5626 488 7382 1079 6833 8435 2997 3178 4796 7184 5755 1881 8103 8470 9646 1161 2635 4657 4081 2306 +1000 +4005 6744 6736 7717 5374 8302 3455 4631 4445 6743 2150 9505 7484 748 2831 9026 6548 402 5793 5531 8901 5244 4443 9994 8306 7814 8075 82 3562 3791 7521 9396 830 2853 723 4071 785 7081 1351 5189 2892 3772 7759 2316 5321 6238 1143 2343 6590 3050 6522 8263 1308 8676 7651 8258 8252 1476 146 7856 7564 1257 9206 9714 9154 6031 7892 9642 2517 4379 4129 2149 133 4768 6967 6910 4302 1591 5602 4191 7739 5457 8004 7367 1333 7867 3412 3704 6858 9523 7154 5626 4647 4700 642 2175 80 4368 9527 4014 9399 1478 5848 2868 1930 8136 9460 4013 3503 9207 9769 5870 1266 1008 1876 5479 18 4888 7151 2368 8209 4775 163 4137 7178 2903 9637 1632 4877 2330 5901 573 683 7020 5000 9274 8035 536 715 611 4336 6626 1102 9857 9252 8758 6031 7532 5359 5770 5826 1001 1565 6117 2837 3953 7733 4940 5862 7622 6859 1457 3766 70 4567 8471 668 8620 4308 8607 2101 6966 4918 1514 6614 3249 9015 6271 4519 5869 9369 2606 3118 7043 9810 2175 6700 2478 4515 6302 4241 3150 7989 6165 8001 4396 7549 7220 2450 8724 3871 9802 9409 9416 9773 802 7119 7664 8285 6996 8888 2217 2844 2502 4460 2596 6425 7881 7278 6430 3281 6340 2223 4420 3872 6845 2681 3638 1781 5150 8948 1906 7101 6908 8416 3064 4579 5120 3704 8627 7951 6623 9231 4273 9381 8579 9420 3752 5395 6788 1022 2756 5769 8202 323 4791 6897 5151 9315 8795 9465 9793 2739 7073 4390 1155 5502 6389 7781 7847 943 9448 5083 5883 9466 3178 5266 1799 9643 5740 6853 473 7666 3737 3541 431 232 9653 2063 2589 5584 8882 2780 6717 5431 3807 4939 2574 1273 4739 5849 6585 425 8806 1735 3462 6696 9179 5692 2644 233 5583 9711 7089 7809 2588 7316 4024 3179 9177 1112 7266 1249 5112 318 9446 1149 1086 118 2698 5154 5005 5502 3088 7264 2025 2584 8486 9915 3495 6705 9288 2853 3498 833 7334 1198 6801 1637 9728 8687 5965 9300 6685 685 424 8404 3560 1911 1984 678 3336 16 9501 9038 4702 722 3619 3942 7088 3179 5910 9750 3669 7016 3292 8712 2598 6259 5400 5436 7927 3394 9439 4791 9942 8187 5543 3394 885 2426 3708 9217 2185 246 4221 6672 111 8528 9995 9550 9509 699 6265 9093 163 3318 7885 9608 9403 7995 4013 140 577 4018 5413 154 6612 810 8869 2414 8445 4800 7855 5880 3108 1750 9328 7410 402 6013 6124 3604 4078 688 5066 8529 9789 3797 2928 6338 1229 8241 9514 52 9191 6583 8407 2255 2777 4971 8591 1044 3333 7301 9690 3861 4750 7359 6829 4632 9817 4935 5766 6448 7806 2026 125 2045 8072 1102 1889 3383 4211 1505 3275 3186 617 3619 1360 8470 6766 4528 4335 1782 4266 7018 1613 3027 9534 6388 7943 6254 8615 9708 6042 2261 2985 6384 4784 177 1521 9750 4824 5919 4179 3479 8650 836 3140 3231 119 8376 8836 9728 8299 4108 1188 4600 149 6519 4017 4535 7661 129 3811 9229 3053 2908 4382 1020 2070 3716 3619 5654 8215 8870 9218 7154 2764 668 4350 3125 9180 3973 9471 5472 2447 5006 6110 1385 1121 7843 1953 6994 9183 6033 2034 5393 3112 6273 4012 3763 1283 3949 9700 4748 4345 5746 9221 4156 9294 5800 4329 5260 4594 7424 6325 3721 8355 803 9099 5474 5324 9295 1023 7683 3435 9429 4699 1456 12 3965 4109 445 2397 8648 2426 7679 9252 9556 6117 212 4141 9663 5935 1747 7622 8769 9321 2555 5290 1798 161 272 3651 241 2984 3191 5035 7550 821 5106 5235 6367 5093 2216 9586 5668 2848 3554 6569 9798 5106 3418 9930 9645 2911 451 1552 6473 1018 7511 3964 9344 1101 5211 6260 3417 2824 4914 1581 7991 6580 6623 9985 8841 1314 8206 9496 572 1046 5496 7030 5184 5716 6394 7810 1830 2230 6177 7683 6027 3794 5503 9568 6996 3222 8664 9803 9006 2928 2665 8649 5604 5742 1120 8110 871 8158 332 8496 3089 5826 2150 8011 7379 9387 8734 2749 380 4404 8929 2446 493 9483 8093 88 2896 4377 2657 2080 7417 5799 1594 8096 5073 6174 5062 7850 5768 4132 8256 4989 3480 4548 5702 5511 4466 376 8887 890 9733 622 1449 6164 8097 2349 8379 2709 7145 3397 7347 9138 8777 450 4823 5841 6253 641 474 9223 6471 854 4298 9888 106 3960 5268 4935 4083 5865 3488 474 9235 2117 2590 6567 3852 6027 3055 7303 9607 7197 6494 411 3431 4372 7498 4750 164 3803 2742 8598 6390 2895 4706 5449 7257 7226 8232 763 8677 3219 6495 9051 3963 4371 3314 3571 5570 7262 5131 4922 5642 2519 2344 5877 4370 4631 8635 6927 3567 4140 2015 7763 6176 9213 8040 4669 1301 9466 8707 4162 5355 1473 8384 6627 1875 8256 2806 5618 9958 8954 7651 5544 6434 9249 7959 1850 1254 4162 2286 5087 4415 9504 9308 3211 1218 6655 6951 9454 6935 6575 2852 7221 8464 6669 3779 9805 7990 6104 5842 8353 1516 9633 2905 6263 2191 1387 9499 8422 6760 5059 8858 7993 1989 6958 1736 3182 3505 4587 8852 7821 3441 7793 2253 7126 4125 7907 6721 6733 1819 4135 6827 7169 7825 8303 327 1349 2656 7451 3008 4845 9143 1072 6197 9268 6516 70 8070 2187 5015 9522 6549 9556 6609 9577 3037 4922 9702 1227 5413 2230 5606 7522 2110 4087 3604 90 2778 4876 5294 8073 2132 5615 9728 6690 7074 1896 7250 9095 4255 8762 2521 2294 7290 2209 8857 6202 6720 9498 3490 6556 6082 655 8378 4292 1707 421 1147 7908 4934 8736 2056 5000 7810 9181 1347 3748 8889 7773 7452 1103 8024 9224 9535 3672 5394 4195 109 6264 4022 7722 4679 3676 7552 3383 6024 4820 5613 9854 4144 3956 6028 1651 2227 2258 8256 4920 +1000 +4049 4712 950 1912 1001 8261 618 1000 5674 5148 4967 3824 9225 6816 1283 3307 4894 6772 4463 4963 2771 6624 6055 6981 5836 3634 6076 6713 4686 1259 1816 7501 8043 2185 1545 7250 7228 1601 4593 2547 646 4541 7445 1584 7093 9757 6478 2833 7992 8024 239 7550 3942 6748 8562 4997 1375 7713 7839 5750 8783 4559 3269 8445 5514 6036 6400 7480 5220 5251 137 6115 7729 7596 3739 7176 9346 6745 760 2079 89 5875 4259 8173 7545 7186 5501 6838 4529 705 3549 6175 8936 4672 7431 8086 3697 1744 9417 991 5243 1584 4299 5068 8603 2694 90 4180 3418 6184 4073 3878 2382 1085 2812 9474 8228 7646 5975 7685 2048 7298 1306 1059 643 7888 3077 5723 7591 3000 4330 261 9968 3572 9157 5103 2736 8888 1703 2973 9883 4197 5955 4722 3992 3914 4176 9527 8696 1467 6138 5709 9006 5330 3387 3858 3932 1178 8915 96 5432 7471 3442 9106 5119 3564 3599 9452 1181 1588 9587 629 7402 7405 1797 8755 4067 9652 367 1997 3597 8128 1016 5495 4865 5088 7877 3705 8656 8435 1254 2333 2298 3737 1014 1194 3281 7062 3886 6075 8197 402 8840 1427 7303 2974 3678 1689 8084 6293 832 3089 4184 5350 3070 9377 4436 5077 3936 9088 8722 9130 9854 3313 8834 6681 1592 3632 7828 3484 9527 4426 1866 3363 3847 603 7937 1962 1569 7609 639 4766 3678 8534 7037 7904 2656 849 242 3399 3989 4738 1649 5320 2525 7440 546 5945 5258 1895 9963 8999 1157 807 1168 8702 3452 6601 2697 7723 9288 9793 6988 443 8874 2781 4143 3531 2296 2997 1147 1178 4717 1964 7046 7889 2971 289 6236 3912 1774 6420 7057 3892 4734 3279 5139 6168 2130 9165 2539 3189 9270 5548 6889 6778 4935 1926 1654 6158 4047 5087 2030 5092 981 342 2314 6102 1837 3895 4984 9587 6120 1665 77 5356 950 4331 5482 9632 9055 1319 6650 4486 6423 4088 8822 4402 3278 6134 8102 6670 1416 4586 4817 2461 6658 7237 574 6693 2236 9537 2530 1264 1717 513 5167 4372 6410 1972 7693 8828 6945 8 136 556 9607 1514 304 3537 2219 5005 9460 7834 4503 8151 1096 8010 9997 9697 7729 6264 6595 3856 4603 9880 2188 2977 3277 7322 6245 8718 6932 6754 2748 8564 4638 5227 8651 1754 5294 439 2051 4646 4632 9635 7143 4728 2365 7867 3810 3698 5492 8579 75 325 9354 8979 7194 4096 3667 712 9230 8666 4923 7047 9999 4689 9676 8991 5340 623 7922 3816 4099 5318 3715 7926 9182 9909 8407 5185 3484 6021 9879 5361 5608 9403 9269 2705 4740 4782 7853 2906 1340 2235 2150 1817 4543 1165 6632 7860 5657 9718 5354 2429 9894 9005 7298 5476 1768 5402 2060 7454 6665 1031 9167 3154 7748 438 3101 6942 4287 9173 6399 5920 8533 6576 3965 3288 2899 7378 3234 976 2608 332 7573 1908 9766 9763 4120 1008 7006 3704 2730 2194 4713 6504 4407 945 6808 7065 5034 6837 387 6547 4957 5108 6444 4023 371 3144 2955 6951 668 4687 6595 8579 8667 2312 4528 7216 9417 8425 9438 4762 7249 3947 3579 5099 1026 1182 9691 5369 6483 414 8691 2477 8228 8399 2294 1170 5292 8437 9739 9927 8167 119 3739 6461 3198 2318 4567 6504 7065 5117 665 5881 1188 6426 1257 538 517 6701 2370 6970 5648 2130 904 8739 9381 9678 5382 3582 5111 7425 9287 1091 2959 2689 3824 2868 7572 2536 9322 8497 6485 2043 1563 5095 8287 1510 7636 7635 3577 1258 5758 6824 5152 6124 2666 4280 747 8720 4023 3442 9735 9784 6285 2235 405 8210 6353 3482 6310 3346 2580 840 7137 1223 7705 8598 5606 3769 1893 7983 1268 8305 4410 7650 52 8201 787 9448 6606 4054 6733 1502 9044 4894 5947 3443 9454 4208 5449 940 1881 4842 3782 6130 6077 8192 8672 7621 2784 4772 8857 1532 9476 4260 3673 517 7790 1695 7919 7272 6249 1121 2102 1224 8676 6105 1396 3157 443 2605 659 6517 6201 3613 3505 1091 7634 5521 7550 3760 5723 4825 3222 5287 9361 3460 3430 5389 2368 7340 4808 9343 3254 8014 2995 4137 8956 4849 5717 3254 8558 304 5592 4342 488 8434 8532 9320 8781 3829 6943 9741 5886 3457 2876 5186 5405 9709 9935 3249 2719 6037 2690 6215 2577 2808 579 857 4291 116 6780 2901 5228 5122 4228 1741 705 3629 6469 2983 640 8890 7982 7539 1906 7353 3499 3183 8556 8501 7425 8040 7803 1016 7367 4886 3328 4072 461 4540 1645 8670 9176 8467 261 2556 6052 7227 6718 1753 5186 3985 4676 2326 6955 1309 9111 4601 6849 7964 5386 1922 3372 8893 2317 9682 9858 7809 631 3304 4501 7636 5164 6089 1726 7234 4426 4705 2871 4127 1662 7316 3503 2876 7828 1298 7776 3083 6247 5581 3877 8462 5409 4374 9785 8926 3143 4791 2303 8748 9989 2945 5896 2531 5597 5035 7029 9194 2500 2087 4311 9362 8089 5679 7017 4293 2996 2037 6880 1976 3333 9101 8515 937 2764 5485 129 723 8814 9182 4431 9285 3848 7643 2850 2731 3797 8092 4463 6685 1711 9218 1051 2746 7267 379 8905 6810 4164 9396 1718 1522 972 4453 8101 9684 6477 3377 4852 2589 7394 4436 6119 9637 4732 8223 4502 2844 4767 4088 2934 784 1172 6891 3853 7652 781 4987 6479 2442 1958 654 5493 8764 6594 6378 5237 4613 5897 7644 8104 434 6879 8002 2860 3860 7839 7027 2524 506 3606 1840 2443 1859 6018 5899 8348 8848 4919 1069 4181 6022 295 7665 5708 6919 3686 1687 9694 1971 6203 9031 2142 3189 7781 4270 478 8673 1816 397 3845 5244 8940 9021 4834 9710 2196 5320 1327 3734 8926 939 2345 621 3530 7758 2518 443 8500 5306 899 3447 5870 1505 513 6547 4222 9029 7764 8161 2995 5026 8899 228 +1000 +2847 8634 8374 3867 414 409 1463 5230 3688 1122 684 7323 5850 6073 3888 9296 5077 4454 3814 8625 1480 1656 5448 3582 721 7900 7726 6489 47 6223 7557 9258 938 8258 2042 3175 8526 249 9124 5348 8209 1903 2686 1082 9164 8862 333 5220 9725 5129 4691 5407 3828 2221 8312 1674 6285 7810 6536 3040 3243 2368 4561 9106 9478 6 2118 9833 5824 1044 7993 8726 1323 2212 5039 7156 9637 8752 8707 6562 1443 8182 7121 893 389 2174 5144 2324 1070 2301 2842 9903 5148 6361 4226 8094 6372 5498 9311 7111 5791 8018 1058 7358 7187 9262 906 2775 9757 3347 6650 4978 1078 6662 1540 7789 6492 5661 5505 5697 6199 8477 2226 8326 9401 9440 2413 3603 5120 6289 2404 9184 1976 9359 417 8797 3035 3342 2751 201 7710 3287 2406 99 3030 3729 9544 5490 7868 7754 4587 7535 3160 2311 2857 3486 5209 6459 566 3363 9959 712 733 2620 6156 6569 9838 8051 1260 8314 941 3184 4755 5397 456 5690 5623 6025 4626 3452 7486 9895 3861 5854 9782 1685 78 5861 8473 7340 589 605 2541 2234 3821 8196 7303 6074 513 2029 9323 6201 2851 9346 5903 9402 8474 7163 8369 1242 5827 2372 9470 1776 2724 9853 4972 7586 1702 4929 1095 670 7460 1796 3056 9971 3923 100 6534 2557 2514 4805 2888 6714 5110 7615 9896 9521 8996 5803 9013 7186 7004 2454 8015 6607 2971 1379 8288 6066 6739 5304 4675 6616 9260 7914 5338 799 8749 6706 7655 1320 2445 8747 7742 4357 5159 3841 6354 1668 9000 1684 1352 8056 167 7851 8127 440 927 5606 3278 1608 4746 6934 4797 4305 7298 8917 5401 6474 7612 609 1230 8491 4525 1650 3548 4226 5343 1713 8362 3950 6335 9633 4083 513 9897 7756 6635 1957 1990 1492 9040 9369 7599 5941 5449 2159 9352 9290 6421 5442 4736 3249 2064 5772 6563 5153 109 4817 7131 5317 3222 6539 8461 447 8916 2355 1545 3876 9543 5760 646 7064 4764 4014 8427 7617 6316 216 9609 9351 6678 8223 1083 8702 6016 969 268 5850 2306 3892 5285 9834 5145 3130 252 2485 5447 6223 8682 4220 5613 9568 2410 8862 4726 4554 4148 587 6847 218 7887 8295 3648 254 5129 8153 6698 2544 9240 8575 7451 1386 2462 3255 652 6357 7102 7876 4557 8322 605 7791 7458 5348 8253 2734 4832 9245 7503 9734 3506 8564 923 3922 2541 1109 963 3970 196 7091 1881 2602 1204 3016 1539 685 4785 9338 9542 6814 8944 189 5527 6142 6994 5941 5496 9334 9194 3563 7063 930 2481 651 4281 6053 7078 2653 1572 3479 1891 8150 9257 1951 1533 3152 5978 3075 4251 1705 9317 3922 6059 7409 9523 6585 33 7432 6798 5679 7564 107 1839 6699 6990 5105 8486 8624 1608 2833 7928 7538 1591 522 874 6343 233 230 748 5867 4325 2814 2192 8432 2602 7509 6008 400 3477 1386 1499 9909 9241 9007 6351 6195 5838 4398 8718 116 9892 8300 7971 4529 9345 8221 611 104 6366 4768 4860 8697 5958 168 1733 2207 4292 6927 5412 998 703 5760 8106 9325 3101 602 8217 9350 7221 8878 2174 2606 9876 3795 9916 2537 3751 2828 5640 2199 3028 7460 3982 1393 951 6858 7577 984 604 5096 4797 167 9641 3373 8033 8659 2272 4026 2899 7159 2110 2208 5546 1628 8654 5270 223 2094 3077 7963 2043 7269 8784 7737 9990 7481 51 7967 8955 4204 4596 7321 5241 6959 4755 2578 2320 7138 4182 7873 2979 127 6696 2122 3120 1309 5434 7290 2574 1960 4286 1007 7343 686 4539 1801 7689 630 3690 6557 9513 4686 3806 6844 6849 8915 6710 7817 4552 989 102 6385 6733 1685 6058 2702 8740 1191 743 3842 9398 3561 4469 1089 1268 620 7117 3765 5636 3313 9449 7181 5438 3964 9777 8340 2013 5310 375 5010 571 5525 6385 339 4427 2058 1975 5213 1815 6581 7883 6676 8156 2782 5188 1804 427 9576 1298 9872 2754 7141 8486 8565 1478 8718 2104 9662 2002 7704 6145 1692 9416 9303 4903 4046 9272 6688 3399 5364 7432 2266 8665 8256 7301 7670 4161 8053 9651 9035 8596 101 2691 6820 629 9131 5629 5359 2715 8618 6794 8064 5492 7396 3848 1808 428 112 1478 1732 8867 6664 5309 790 6564 8463 2945 1500 5945 6802 2582 6186 5374 315 308 5902 9986 5748 1557 7869 2354 1152 4675 5796 1644 2531 4410 387 8655 9442 3716 5957 8678 4892 2529 8504 5497 3335 130 2164 6970 3316 9437 2759 8223 182 8543 1107 7945 6295 6441 4341 6141 871 1752 5458 4424 3207 4075 394 1789 6445 629 9685 6037 6547 7126 626 793 4466 1476 9068 7073 7568 4141 7429 5527 5952 9949 473 8753 5695 2394 6896 3848 5703 2520 5739 4314 2827 2681 612 6137 1082 2389 5077 8416 4764 8655 634 7307 4527 5197 1331 2724 2156 8178 921 5373 3735 1642 9148 6681 1106 8012 4560 8814 2011 7724 4591 5054 2401 9342 331 3335 5523 3042 4666 4098 5664 2234 646 5003 9697 379 2897 8279 7201 7677 63 1495 5693 8067 9333 8147 5696 3806 4472 9366 5601 5142 702 8752 1565 2965 621 8646 9285 5087 8839 4936 988 5474 1267 1160 7770 7454 8080 7407 1236 5819 4452 1567 5446 8098 5096 5635 8745 8687 2824 8056 641 7950 2386 5518 6460 8934 6660 9990 4717 6058 1086 1825 5154 2823 1860 5758 865 7942 4078 1082 6939 163 680 6695 3517 2009 4001 4949 437 2013 7083 5288 9429 6905 4051 8542 2186 8868 1544 9943 9726 3841 9071 3710 8096 7916 4508 6942 9539 4716 4371 8674 6413 7542 1723 3196 6541 3881 4418 6170 4 7849 9231 8490 3699 2476 9266 7238 6572 3267 729 3589 2745 688 5890 7038 4868 3779 9278 1966 4196 3124 3492 6961 4733 2324 7652 +1000 +3195 9242 3368 2131 4441 2321 892 9866 9112 7169 2607 6756 3201 4198 9537 3766 5432 2878 6402 3814 4466 7262 9670 4098 8978 9669 5123 1223 2888 3526 5133 1966 3404 194 6480 4854 1648 4573 8058 7825 8693 7376 9478 3477 4457 8818 2650 8631 2675 5287 7465 1025 8110 8578 8700 3519 3346 4066 703 9996 9960 34 5158 1961 3547 4120 5872 4880 1390 5355 6822 3185 8036 6669 1051 7861 2852 224 3248 1705 7536 7366 2652 6939 1930 7240 672 4002 6081 1777 9594 464 6261 1541 9170 2914 7195 6886 6950 3067 4243 6960 9549 7609 4495 3316 1280 5026 2718 575 8418 7420 9928 1725 9930 3833 9899 1751 1222 4256 9212 6785 6540 3422 9165 5666 8857 2061 5099 4547 4220 5353 1186 5831 7871 2879 7573 6768 696 7434 5009 6385 6527 778 666 6065 5044 5288 4564 6673 8302 34 4620 5634 8139 5245 3530 4392 3764 5993 8082 2629 7031 2391 5697 2513 8324 6078 2715 2310 4290 7096 1454 1793 6247 8091 8479 819 8958 208 3657 1182 374 7342 4446 4632 9088 7379 6702 3914 81 7718 750 6333 2198 6109 5405 7133 9359 7419 5533 1000 7824 2697 6656 3403 4078 4345 4905 9674 9996 8705 6123 8069 1746 3799 4373 4215 7741 1191 1410 2238 2873 3407 3345 3984 6708 7532 1980 9575 9134 8075 7705 144 4807 7778 2188 9579 3754 3996 8108 6281 8226 6291 3472 4911 1195 4945 3073 4241 7260 3297 356 4859 3544 385 4494 9226 2410 6490 3072 8828 8832 9908 3970 3979 9507 3500 4855 7532 6611 8710 7991 3974 7653 5343 3697 2608 5254 8776 2895 3620 9951 7796 8560 3628 127 836 9990 8187 6371 4888 8732 2296 5981 8127 112 7333 3726 7620 9268 8656 2830 37 6012 9028 6882 6231 218 5432 3191 6723 2434 2346 5047 9991 1530 4109 7853 1247 8733 5366 8459 8094 6509 92 290 7768 8490 141 2131 6195 3745 3809 8195 1938 2074 1378 5853 4740 7896 3052 6145 3386 8000 982 4521 6996 4664 1787 2762 8622 8372 7845 3268 2639 9039 3487 1461 3026 5155 757 3925 1238 2995 7024 1928 4178 8709 912 9196 1980 4311 3125 5464 5046 945 4626 5481 4602 8343 2156 3335 6641 7603 4824 9184 4227 6480 6340 6092 3716 5128 7317 8596 7317 6629 9593 2412 647 4859 5729 4233 6610 1900 8312 6458 5017 7345 5401 5836 4121 5003 5502 167 8406 6731 615 2890 3798 7336 6958 3570 8503 2090 7141 1374 8805 8072 6211 1357 6254 7076 6823 4059 5447 7155 704 9499 5632 6958 4264 3642 7015 5605 5985 2714 1621 1826 6473 9967 5639 7667 8021 2094 9188 9353 8523 9223 4142 6132 2396 4245 9769 3241 3793 999 2649 1773 7639 7779 714 3468 2265 249 2456 6251 4333 3466 1925 39 2972 5359 8143 753 6282 2542 7465 9401 5867 4917 2845 9108 4376 9211 1520 9045 8432 2824 1644 4872 7454 7195 6647 5845 5160 4576 8567 5367 8007 383 1673 9442 6206 7730 213 5037 2160 4087 5604 5586 1024 2979 9131 6109 9290 1520 3534 1454 553 6664 4235 1644 2247 7041 4591 7126 1912 4409 589 6791 5019 8212 3306 8579 0 7975 2603 5781 2062 9692 543 4557 9800 7672 4846 9982 7429 5173 6422 6914 3832 3610 6434 9336 3001 3156 9275 4019 1181 1704 8753 385 3162 380 2378 6578 6245 3446 3053 6236 4420 4664 1681 422 4910 1612 8637 6564 1149 4839 7795 344 9421 1257 1849 2963 6640 9370 2256 1965 1614 9986 9092 7281 6069 1461 1390 1181 1794 3509 6646 3413 8789 2919 1609 6907 608 4091 7722 7547 4202 5553 4547 7853 4774 8011 4086 6253 5062 3938 439 9048 6631 8333 6813 1117 4480 8990 1685 4372 5190 5766 844 6553 8721 950 510 8775 423 8103 9938 9773 7345 787 6010 8280 5068 5850 7295 2806 5181 6212 9439 4134 2183 7313 8557 3703 8139 1554 2311 1119 732 6961 1976 1965 5075 7850 4494 1686 8396 3263 5041 697 8252 7207 7703 5772 5735 3906 4820 7390 4360 961 9651 6632 1684 3957 3988 346 3595 5478 8552 3140 378 6243 4655 2408 6704 8314 3995 5301 4590 9291 6360 3943 4023 3405 8995 3346 8109 6659 9866 3742 5241 2278 1307 2326 5893 1945 8388 9808 4990 4458 5697 4317 3814 9146 2186 8480 5997 6870 5352 7483 516 9699 5259 8842 9130 1464 484 7990 1436 4612 6275 4817 5408 6317 3514 9452 3892 1113 4799 7237 2873 370 3646 501 6077 7176 4873 510 9549 9885 6262 8958 135 8609 2383 360 1614 2450 8863 8845 8401 2767 7739 1396 1763 9502 8534 236 4674 4756 9681 3045 6191 3361 2271 6219 5 3014 2069 1368 7355 6019 8926 1944 4951 962 7418 345 7221 5716 9470 9332 4928 5058 451 673 3880 5862 4066 4758 2298 7343 9083 3436 9207 7189 4870 407 3623 7716 5590 2362 8471 1076 862 9419 8826 8959 244 4684 492 7159 4840 8660 1156 8889 3271 4316 7431 9365 4090 2274 4035 4560 8320 9849 108 7887 5686 3373 2754 2263 681 678 8148 6549 9693 2588 1472 1466 4841 6625 3892 1131 5805 1716 8834 3490 7206 9255 8668 7565 2166 1582 3211 4756 2651 7703 7675 1390 5544 9086 576 9663 3096 2734 2234 3190 4050 4124 9127 4251 7601 1822 3947 869 1355 713 7607 1422 2337 2628 6097 5444 3384 2856 3822 415 5986 399 7627 8593 5872 7729 6740 3163 2359 3739 3096 2949 1055 5933 6265 8379 1058 8718 1898 78 9981 3689 3324 1824 4858 5028 4463 8461 5850 1829 2560 1745 7928 6829 3460 3226 5580 1901 5392 4726 9298 4660 5203 3739 2469 408 558 9275 6952 1012 8627 7773 540 9465 8688 2359 6906 7780 7873 8103 5611 4974 7134 9193 3987 4868 7278 7017 1009 3820 8883 2336 3139 2559 9835 5310 3758 +1000 +4976 7274 9562 8574 7981 8573 1989 5670 7778 4902 425 7398 6851 4938 1014 4216 7106 9672 990 1055 762 9009 7536 4547 7451 881 1586 8301 3234 8387 3912 8408 655 7178 9049 5537 7363 4946 9128 3799 470 4560 1525 4331 1929 10 1533 6843 527 2600 3502 4214 8368 3075 3235 4277 1689 8813 392 6786 5761 9843 952 5208 7057 9459 5169 889 2078 3643 5960 6603 2416 7219 2654 4788 6061 5500 8070 9488 1192 2193 7407 7214 8104 163 9147 2108 8795 1044 3071 2163 6734 9567 7697 1615 6285 6027 1496 6452 9812 2648 727 6235 9655 9583 1620 2588 9397 9557 1471 3273 2374 3996 3745 4326 4603 5068 2165 6602 7399 2742 1370 279 5432 8404 3035 1303 1466 5254 3167 670 3963 1369 9995 9341 6239 37 3342 3908 2929 4071 2740 27 1606 3350 8414 8258 6212 1189 7199 6063 5806 6044 7789 5623 9269 8947 5563 8475 1966 9255 4409 1091 81 2876 450 4657 5728 2696 7011 5352 6097 5891 1510 3561 5231 5828 7880 989 764 2202 2677 7447 3953 512 7013 7658 6758 7293 7779 2219 4647 821 8812 3331 3487 1591 5422 5289 1646 8987 8589 2478 5352 3110 1704 4915 2669 2271 1710 2012 3480 6532 3288 7612 1776 7199 9971 1590 9999 4299 2425 1721 2811 2272 282 9293 8483 8735 4359 7432 6707 6264 5831 980 4361 8598 5643 2788 9100 5093 3723 392 7784 6355 312 8498 5730 1583 9533 5265 5628 8731 8383 6879 2387 9429 3425 8966 1333 2008 9641 5298 6077 9670 2530 5142 8321 5123 5627 9444 5942 2290 5831 3266 3066 5888 7237 3109 2754 4740 3230 8743 2474 4701 5785 9052 8964 370 4714 1687 9307 4322 3065 9661 283 1358 2054 5329 2662 547 8039 6897 6444 965 1166 5747 9132 2842 3499 8621 4178 3065 9215 285 1036 6595 358 6835 7785 6171 5313 7445 4589 1773 8422 2934 8738 8348 5031 4135 2028 4391 7503 9631 7453 5354 4200 1329 5879 2889 9340 6630 6770 7914 5757 7486 7137 2932 7204 5554 4 7243 3805 2601 6345 9568 648 7138 3544 3407 7320 4241 7572 9404 3082 7150 5508 3751 827 8733 5678 6534 6294 7581 8664 6831 809 2131 2138 9282 5820 429 9761 983 6379 4105 5941 7054 283 1011 1355 6518 482 9118 2042 1287 6939 9624 5978 6223 4936 6212 3213 7324 9993 6215 9347 9253 8459 1063 1264 8949 2998 4684 4979 8921 768 8759 5480 8281 7012 2883 991 7216 6496 4814 9504 5132 9365 322 7126 5662 4691 7845 299 3623 4098 7209 8281 3444 4639 9373 175 7173 3105 7281 2387 4191 2425 8916 1481 7923 3395 7689 4956 2843 3783 1330 1442 2475 1383 6406 6254 9207 5494 8662 9792 1375 7277 8795 8044 3910 6020 5619 627 1902 9156 645 2739 4136 3465 4687 5905 4611 2337 1357 2798 1618 4406 9226 259 3917 6465 4008 4932 3919 4924 7986 3320 6226 631 3445 8008 6370 9361 8566 3214 7551 2649 6119 1915 9703 9047 5546 692 8654 7710 7377 6106 3505 273 8513 1362 7424 2116 7592 7053 9155 5415 3825 2945 6278 7881 7370 8390 5593 8382 6270 4590 7623 6178 7912 5710 673 9701 902 5164 9497 5870 926 6434 931 5950 8258 9558 7287 551 3967 1613 710 4651 7896 1500 8886 6254 4966 1406 1361 656 6714 532 6401 9368 4799 7455 5720 4269 8530 4374 3257 3382 9316 7310 2889 9972 6995 4511 5491 2207 1684 3969 6979 6510 6534 1076 1607 2782 2243 1817 1075 7840 3943 323 7338 8150 2480 6905 7016 281 8534 9903 7869 8559 7119 1532 7195 1665 8960 2425 4504 3500 4311 5227 7347 8299 919 7963 233 4116 8099 4371 1483 8061 6906 8980 7836 7812 90 4328 909 9288 8190 32 1158 333 3116 8493 6542 1162 9091 8493 24 2477 2699 9381 9616 5198 4748 3532 5529 7684 1973 6176 1748 3305 6244 8962 9347 6495 348 9084 7499 7112 3367 6207 5526 280 8761 9786 8354 393 4520 6563 9335 4789 542 3229 8738 6135 8872 5275 4627 390 5807 3928 414 9380 9583 4382 3554 6748 5651 2701 8622 2115 4503 493 7379 9858 3754 6793 6253 6033 388 5282 1647 447 5480 1278 2485 4870 7029 3985 9999 877 794 432 6326 3122 5568 9735 829 3779 2850 1661 9422 6230 9457 6383 6139 717 9868 5184 7738 7819 8950 6042 9719 1930 7114 3995 7506 8747 9678 2229 9456 674 4495 7401 588 7242 28 4526 5823 2393 4784 9615 9341 5011 1358 7214 3770 883 6360 2494 5020 8075 5458 809 1077 1112 4233 1948 6147 7045 9811 4100 3369 2454 1664 7890 9471 1163 3383 5807 5493 9644 3115 8413 2218 2487 5255 5416 4720 1567 9528 2709 3331 4424 3735 5733 6295 8890 8848 184 3772 2686 3181 7434 4805 7109 3998 4478 2758 2522 5950 8910 1984 5361 9715 6239 8248 6355 3134 6631 5859 6318 2961 1231 7237 2342 5017 1665 2528 5541 4820 6245 7531 2465 2054 1238 4687 1755 5465 7252 3195 4506 5600 2078 9247 2370 946 1114 7394 2298 7844 8543 7069 3257 5212 8265 4348 2569 2513 9067 2302 3134 444 1122 9089 282 3348 775 7140 7331 1314 1859 1115 2291 491 3661 4562 3557 2465 4682 6294 9035 3958 5241 1028 9895 751 5810 6425 6812 7075 7454 3371 4734 608 1055 1847 6657 4772 7385 3532 6132 863 6181 4061 6827 8551 5687 5204 6859 263 5223 1047 7061 9788 2874 1955 8463 6423 6673 7560 2235 5333 636 2817 8978 301 2055 9636 8829 9344 6257 5548 8509 7050 6676 1895 5840 7531 3805 120 1242 1146 4137 7035 7692 8832 4793 5923 8118 286 5567 1249 4656 6952 8987 7464 704 8608 9402 9880 3707 7793 1038 6787 4960 4875 585 3954 8384 4523 6022 1102 2076 208 2816 4010 6591 812 436 4269 7362 8585 +1000 +7313 915 5445 1517 6855 3026 453 9757 5425 2949 1986 5796 3134 2728 8706 6416 9121 3643 5154 5435 4251 9040 755 3261 6036 4763 2617 4228 7960 9241 2340 1665 1711 250 5403 3099 5161 3891 2497 9519 447 4307 3539 1662 4981 7665 980 5516 9805 3485 745 8251 2632 267 8359 9852 8425 726 5064 4878 4086 7496 1059 7410 859 8026 7154 8957 5859 3542 8251 5899 8675 260 7232 8631 6631 9045 9867 5963 3438 8730 8951 5051 1989 4890 6940 1630 9337 2 8459 8591 7793 9771 6162 9908 5617 5236 1985 2782 9868 1728 5992 6645 3635 7516 2586 6028 5712 7263 9305 4327 5684 6944 5803 1909 8921 667 8647 3808 876 5292 9429 3157 709 8948 2065 7862 8970 7526 1709 2220 3024 547 6839 5776 101 2882 7571 5244 474 2776 792 1647 7158 3000 619 7160 136 1598 215 5196 1118 823 9991 1799 2845 6645 4418 3766 2246 4161 9374 1850 7779 565 4881 1522 9528 9333 4190 535 2844 1495 2347 7653 2113 2819 9492 7345 3476 3174 4523 8541 2681 5325 6730 1032 8030 7119 9200 3442 105 2505 7409 1339 4042 4246 6888 7180 3594 1734 7581 4489 7747 2008 550 281 7498 4513 7855 8910 9024 5138 5297 2236 7317 2336 4523 5084 7214 4817 2667 6393 598 4693 855 4618 2035 7305 4432 2821 8493 2436 7954 5655 9066 8909 375 8841 1770 3628 8155 9989 1141 3151 3907 1384 9518 5043 4423 3740 5304 7724 9904 9806 1417 8100 3045 3230 4547 8500 154 1458 9824 8014 5110 6476 2693 8120 2594 9891 333 619 7159 759 864 9702 9726 5890 3609 2538 2669 8194 7675 9766 1490 8492 4770 5867 8164 1718 1123 9041 5934 3985 8351 8523 9988 7893 5208 4702 5049 6268 8432 1092 9833 6137 6653 1909 5895 5198 8141 8914 5162 4032 9041 1191 1419 4126 1770 2190 3873 6027 9898 9431 2100 5989 8690 9648 7755 5401 1230 1316 4643 1492 3737 333 9946 3241 9787 9638 2745 6265 1673 4905 9717 3616 4771 7348 8913 5052 54 7609 4033 4994 4770 271 2004 7288 5488 8085 9680 689 8047 8467 4267 9916 6848 2859 5264 2863 8605 2261 6513 5608 2339 8646 8874 6153 9798 6596 9976 1799 5699 3759 2403 2965 9338 6385 4901 596 9956 7921 1455 3530 2879 3163 6965 6307 3685 6486 909 3868 4066 9021 3662 1605 7995 2588 8138 9339 6316 8393 2305 3502 4979 1582 3087 2704 9808 9027 6798 6752 8969 3804 4005 7426 6605 6307 6996 8897 6524 4769 112 4636 186 9492 280 7473 9770 5883 8820 7174 6395 5514 809 9930 4891 807 4188 7509 9873 5370 7995 769 2425 5146 3731 7968 5719 9786 8937 6453 2989 4612 8106 9488 586 2765 5192 8003 927 5893 5930 2476 1559 1004 3573 8816 981 6420 3379 6922 1213 2158 5583 6419 1326 3952 2036 5298 2224 4545 2484 878 7508 9241 5185 4516 5533 1945 6123 5466 9116 7528 6395 9547 3036 5314 6012 2537 5267 8582 7055 1962 3360 5875 3760 4962 9584 6175 9816 8160 3624 1436 8588 2438 3867 8245 6651 5085 8434 7758 5115 1730 2505 3238 4154 7984 4784 1157 4543 5619 3803 8920 2305 4148 3576 9842 6356 1782 1878 2438 8234 8927 3742 6184 3168 4518 6740 6963 9751 8321 8191 2365 187 72 1020 6044 7356 4781 168 3326 4989 6968 3869 9440 4396 5172 9954 7357 6870 1650 1431 8201 3059 2552 820 353 6067 2005 4432 6507 3066 9896 3482 8326 5992 4916 6351 5281 6813 8191 9670 8593 9902 8309 8760 5534 1850 3153 6267 6593 5748 8171 5567 11 7053 9203 6345 3478 116 4386 5048 5209 3045 4637 386 5525 9884 8041 2051 8105 8665 3993 9930 6739 6485 2331 6518 8604 5959 425 3107 1102 8133 3312 6267 5879 6660 3855 3818 7131 8465 9781 5284 6444 2010 1387 3232 4049 2590 9679 7674 1372 2800 5542 7378 291 574 7824 685 840 1796 6769 7411 2318 1272 2337 1865 1579 7572 4769 8384 6184 4357 2095 8584 282 2985 5076 7594 3101 7009 6136 6754 7428 8747 8150 3549 9119 2567 8965 485 4862 7551 9980 6364 2530 6138 267 4990 8708 1912 4533 789 2052 9842 6494 6875 7046 2717 9462 8177 8521 9179 8872 6061 1854 4655 4441 3268 4136 4000 4260 331 1051 3185 7483 35 3778 4894 5294 885 8498 7489 2756 5253 8703 9004 731 8168 7952 9932 3515 4872 7781 7355 3054 7243 1317 5752 1234 8296 2995 4664 4730 1392 3234 1091 9316 1434 6767 3467 5651 4800 3306 4415 5591 7395 1735 2967 8126 5356 1111 5928 6884 5137 7884 769 6441 6639 6314 7208 4198 1632 2825 1231 8693 4944 1276 5936 7046 5683 5323 4939 5062 9816 6438 4080 8254 6345 5334 7790 8394 6485 1659 4183 1329 5638 5226 2079 3674 4118 6402 7522 5448 96 2762 2577 3766 9212 3947 1581 1787 5627 2623 5187 8680 2509 8974 1699 2775 3690 6896 2167 6759 6949 8377 9429 5538 8323 3861 5094 6389 3045 5855 1942 8364 277 7077 159 7484 6457 3830 9737 3965 4748 9989 6136 2169 9283 7814 8110 9507 2664 8617 4836 6587 8928 5919 2645 2715 9208 2346 2483 9357 7061 8236 8206 4728 8970 4187 8323 1239 254 9565 6927 521 3678 6321 5863 8236 6565 8392 5998 3873 8695 1332 9360 4918 3423 6352 4741 8964 8687 9003 2653 2627 2226 1429 9912 5702 1399 5238 7609 235 8323 9158 8824 8261 819 5332 39 1280 9328 1782 6773 4031 3211 2021 8135 663 8158 6983 4081 1584 2759 156 8583 2945 3595 7935 5196 2344 8469 7297 7589 4412 6057 8970 1628 4108 1700 5951 389 2497 573 2786 8118 3147 6618 7816 9036 5768 1825 5750 7725 2508 8594 9230 8138 8478 5266 216 4862 8062 7481 765 203 1893 254 5630 11 2055 2199 3079 5469 5487 +1000 +3146 7517 5385 7535 3956 234 6795 7686 746 1241 4919 7251 2856 3697 5383 9241 4235 9023 4190 3806 1150 7558 2205 3984 2314 1255 657 6093 2543 1671 885 6325 3211 7601 5096 8709 7541 5292 8244 7541 5852 1504 7871 7629 8809 1714 4240 9590 7887 9973 481 7162 7458 8204 1666 4210 8933 5897 8621 5801 2255 9484 5005 3195 7939 371 634 9279 3985 569 5630 4220 9657 9402 765 6523 9811 7228 9679 5866 955 2098 8914 1991 9258 9919 503 8772 1166 9864 4933 5397 9840 7574 1646 9757 3978 2507 1701 6098 6346 2580 9992 86 9360 4397 4816 7115 84 8102 8090 4303 2560 5257 4873 1088 4441 9703 9433 3786 1694 4005 6691 9142 7766 8435 5175 4678 2564 9213 4015 5566 9800 8865 9515 4027 2082 3109 5267 8172 1724 9863 1719 4993 1760 9790 2151 2894 664 3560 4237 8640 1860 7585 6420 6222 2558 5565 4128 4362 1795 5295 7163 8301 7264 8491 5058 5063 8202 5 7886 1470 2886 217 6394 6883 4281 273 3174 2519 3551 37 8300 3230 4359 4172 1524 4695 6322 5558 7005 4084 828 5286 3982 7084 2407 3818 3596 8394 6742 1390 5406 2307 6587 6812 249 2743 2914 6141 6326 6444 8976 3113 330 6895 2549 6361 137 6701 4529 8507 4679 4150 2957 648 7139 7893 2174 8586 8036 2637 9621 5455 3607 2015 5986 1584 345 8793 603 9239 3131 4400 6238 9455 6500 5555 4372 4136 2527 833 3610 6727 8894 757 709 1926 424 8680 1546 5946 6899 5488 4689 8617 7018 9596 6104 4790 9110 3144 6859 5947 9412 2763 4178 883 4411 3833 8526 2542 4362 8682 9570 4128 2387 3601 821 8160 144 2574 9990 1860 6006 7142 619 1652 2684 4604 9194 9552 7808 3992 105 8310 5751 8645 7829 6460 4257 8729 2403 9755 7836 588 159 4948 8334 5583 8298 6151 858 1270 9215 7300 4699 4893 1257 8002 5359 6798 675 1434 8356 1067 5050 2595 1165 3903 9768 4338 4829 5962 1623 2842 3237 7152 6653 4705 8874 564 717 4797 4855 4168 695 8263 651 8672 3077 1099 3380 9806 9531 3548 629 5241 1075 6083 3742 9997 9094 7362 3663 1385 9673 451 66 6250 234 9903 3753 9243 3962 6976 7200 2269 2823 3761 4181 1142 1250 7623 890 1829 3379 4888 1229 8167 7344 6125 3412 2000 8392 1031 3910 4459 1656 8019 155 7303 9848 6663 4926 1535 1432 5840 8044 8496 8229 4806 1954 722 299 6043 5266 2059 1448 989 5591 4599 7116 5670 7096 3612 7415 6194 8610 4271 9010 6136 8145 9865 4094 4426 5249 5256 2209 2333 9400 3217 9415 5719 3149 5250 7960 140 6062 6200 8556 7768 1947 50 6292 2771 2 611 513 8919 1303 53 2224 2831 5355 154 8648 2724 5334 5884 557 7376 2000 8990 1413 3813 9700 5610 9167 5195 9076 9346 9048 3365 7865 1740 2387 7515 1729 2461 8433 497 9825 8291 2202 2900 5976 7285 4689 1849 6173 3262 7185 2954 3113 1827 5733 5599 725 6275 8259 9114 3100 1215 6188 2616 9354 7472 8539 6973 3981 1824 271 5507 2533 5222 999 3514 3230 7838 1281 2495 2422 4790 4926 3633 6330 2623 1136 8665 7898 8921 817 8960 479 7122 5190 4506 3425 5983 1537 6017 504 8614 6224 7579 6272 2064 6112 2248 5760 4384 556 5935 2049 4734 3131 8223 1458 8722 2814 3217 2229 2434 831 6481 2263 6430 9818 8298 9778 3600 5799 9513 566 8339 8388 5771 5545 1305 524 1269 6410 7559 6229 6145 6921 7855 4936 6787 6482 5121 489 2916 2025 1928 3555 6543 6446 6093 7202 2037 3947 9462 5940 4907 8603 6005 8078 9252 8600 9317 9927 87 7192 2276 1478 6769 9873 192 9195 2523 4793 1283 1641 3690 4903 5867 9241 7544 8081 8876 4317 4475 9493 7993 5568 795 490 4659 473 4489 7971 9467 7040 9871 9777 3145 7665 8384 8083 9169 8539 7979 1756 3749 2570 374 1604 9920 214 8773 894 6318 4531 9527 8882 2234 9986 346 4184 3655 8415 5084 9931 9472 6939 1585 7793 5107 9633 9446 747 9570 7107 8817 1768 3442 2545 7408 2633 7970 5021 3827 9603 8229 7968 8536 8730 7810 6865 7083 3421 3842 9272 8849 5858 4843 5607 4652 9283 3828 4636 84 2447 864 9263 6660 4689 6154 5829 29 9299 9738 9514 3844 1004 3432 6370 367 7718 7094 5674 2708 270 9016 2551 2002 8805 1561 3196 1939 1417 7986 4911 9529 4080 6012 7036 5903 5816 8994 952 3492 1912 4380 4648 89 4371 8863 3855 7436 8733 455 3535 6711 5473 6664 8216 386 5181 1436 447 6136 162 5774 3125 3194 6701 6535 2758 8874 4058 6388 5642 3867 3901 5627 2964 2757 2173 9818 1003 7883 1590 1688 931 7604 6430 1659 5737 1467 5561 448 5283 954 5661 1360 1982 9870 5009 2734 2984 5028 262 9030 7200 4261 217 2245 7519 6071 616 1746 2321 901 1080 9005 3973 6263 8976 7696 8177 9314 5125 6602 2923 3359 3667 5874 9510 5064 5407 488 5527 2576 8193 2112 638 5287 1259 235 6274 7543 7217 8867 8702 5339 9289 3781 154 4349 9550 7012 2357 4900 6749 6904 823 7918 1577 6017 222 9590 1991 1120 7622 6084 7482 4945 7865 437 6395 9219 969 2612 4691 2738 1828 5638 761 6331 8503 4947 1169 8974 7744 2251 8772 7307 5622 7077 8133 4593 177 2652 6410 4144 4144 6426 8418 6057 8312 1525 9383 9229 3822 2400 3021 452 931 2374 5803 9485 8116 6056 8234 7876 8088 3751 6337 3228 9115 3451 5926 7548 1024 9758 6444 9599 7031 4841 867 4879 8270 5419 3756 3008 571 320 1391 7325 8655 6615 4688 8174 5653 7202 5167 7214 805 6208 5145 2306 4773 5088 78 9838 8133 8074 4131 9044 1138 4066 9352 2596 7603 3454 9992 7108 +1000 +8819 6497 2833 2662 5068 5865 8252 9792 3341 2675 8660 9434 3538 9740 841 955 7757 9670 1148 7205 6447 1297 8255 5502 2935 3718 7557 4852 3823 857 9077 5456 3957 4815 3998 9218 5328 502 4129 1197 1682 4133 5867 9584 1541 9563 4115 923 6869 2793 9955 4817 3289 9105 2693 942 9140 2936 9928 4889 8736 1365 1988 3141 1577 6509 2336 5070 9895 1424 3244 9345 5658 9112 9485 924 1660 3298 273 2478 8459 4672 2912 821 8894 6337 3767 8500 9065 9284 6595 7843 1824 1790 3429 1081 5643 4359 6653 4710 4726 6199 1611 7396 250 1065 3842 8696 9527 3378 8904 8771 1498 9848 9709 5306 3596 8495 4163 4617 1959 3438 4442 1062 9648 5255 5590 9736 5716 2375 927 9855 4842 8864 2537 3947 3814 9509 752 8465 3971 9523 6862 8610 3750 9505 1733 8499 7715 7477 130 568 3766 6484 6972 7039 5678 255 3822 3918 2216 7654 1392 6768 523 3648 1925 3528 3489 4479 4699 58 8876 489 8853 8859 7819 3082 3348 1600 5026 230 372 3892 906 9961 3669 335 2192 9973 1038 9604 140 7886 3508 4303 2891 6308 6253 8562 9 1063 1117 6807 1828 3857 9183 9908 6850 232 6312 5603 2949 4205 229 740 6272 4599 1178 8723 793 113 5680 9893 6123 5562 9545 9480 5937 1323 9221 8736 4506 1986 7199 5297 4132 6871 1088 36 9447 4116 8948 2870 4094 4880 6807 3883 7050 6799 8485 3161 905 2061 2076 4386 9851 9207 316 747 665 3979 6067 9699 9840 1629 5078 6178 7086 1927 9273 3384 3331 4948 5994 499 7399 3152 1386 3144 4123 5097 6425 1230 9808 5142 6012 1055 9729 8652 5988 5679 6732 5330 9883 8242 2200 7119 7373 2325 9936 3755 330 6017 7041 1750 9922 9984 8664 6075 6424 7588 6367 3451 3928 8412 3344 4174 3885 9136 1103 6472 7375 7923 9706 8371 6915 9559 4378 2561 3130 9201 3739 947 6209 7595 7794 7213 6690 3325 5155 2343 8640 2507 6005 348 5267 5315 954 960 3036 9788 6323 5816 8104 9283 7541 2964 3432 9442 7561 5688 8301 5498 9846 629 9703 2978 3021 3413 8698 7916 591 8806 8564 4999 9651 2419 60 1147 8540 1440 4110 9905 8861 5869 5063 3564 9094 2329 5302 4051 1329 7433 6455 2659 1448 4829 6692 2389 5872 5878 4502 404 3049 7895 1752 1648 2821 4225 2250 6395 8684 7873 5151 9827 7720 5923 5675 2736 6382 9305 5518 7414 8173 196 8143 9062 8506 1240 704 5457 1225 7878 9015 9727 2991 5532 2735 1261 8556 3752 3509 8251 671 5445 9087 2724 4931 8436 4829 2021 2502 6106 9235 4346 6508 9883 4010 8199 9650 7317 2927 3961 9315 3807 113 3018 9367 4651 3148 8133 1138 8203 3175 1756 2094 9440 4093 5458 3803 419 5451 1366 7295 8590 7986 383 5089 2175 1611 9887 9976 3894 3369 2855 4163 4053 7931 6120 9071 7929 8795 3196 4821 8340 3284 1417 5734 6879 2442 8410 9000 4139 6854 7129 4860 1208 1211 1662 5183 8219 5773 2582 5412 9677 5720 7699 1464 4336 3800 493 3399 7075 4476 6564 6126 8259 7686 3390 4056 2821 7508 3095 2136 2705 1752 3278 2873 3202 8989 9503 9201 2357 9326 4513 4982 6145 4723 5128 4507 2008 2552 3365 5438 9528 1281 3266 9435 3068 8351 1996 4096 45 3115 7254 2689 8433 5427 4929 2951 9705 602 8430 4790 1534 666 1085 4621 8490 6480 8659 576 7533 6310 1860 2349 3838 7416 4405 9978 3731 1509 7086 2656 83 4407 1380 445 6979 6228 8111 5543 3408 8487 1981 1535 1018 9782 8805 1407 8147 1916 7145 5810 7471 3021 904 6932 2149 4818 2719 9513 5118 6892 2125 6356 8923 6085 3660 7793 3371 2632 4027 4771 1072 6355 247 9133 5519 2003 1601 710 2656 8716 979 2699 8816 7039 8353 2669 1788 9624 4442 6988 7610 2322 5192 4025 3436 7971 4621 5251 4561 949 4398 1829 2646 7241 7410 760 2307 5150 3910 6045 8957 351 9963 852 632 3097 4569 5426 150 7806 4583 3050 1120 4392 9967 7204 1936 8673 2700 9817 7878 8940 93 5926 4602 9281 2985 2327 8750 8800 3037 7981 5928 4217 585 2572 4640 94 8425 516 3018 724 1194 7785 950 945 3658 9806 1592 3406 4996 6337 243 3663 4955 8235 1905 8598 6963 7642 1890 3020 3499 1279 5309 4403 4195 1315 5537 8919 3166 8843 3777 9159 8105 3220 8414 9214 7290 143 3798 7813 5585 510 1908 7174 4806 9768 7348 7809 2284 7675 5872 4751 2160 8259 4587 2091 262 1493 2349 2092 1881 7359 5233 1452 2118 7976 5204 4907 4318 8907 6451 9281 5861 1937 1324 4992 3043 6802 6004 1989 4486 7627 7243 5066 5867 3600 3239 9082 710 3328 8448 8309 4702 7483 9455 3943 5262 4102 6731 7433 120 978 7014 2391 7198 7042 404 1489 8490 1040 1011 8265 2139 1604 6635 4717 2484 8867 5185 82 2562 1370 1638 7655 5874 6162 6111 9941 7652 5229 9628 4695 7924 3146 3049 9229 2684 7866 893 8280 3328 2192 8417 9889 3608 6035 5056 6262 8596 9013 1929 3468 7739 6329 2792 7478 3627 1263 6930 2904 8963 3431 7960 2248 9591 300 7419 5554 7997 5798 8151 9502 6106 2586 6815 6743 7019 9839 6887 7443 3180 2232 3038 1292 9479 1763 7716 3356 1297 6454 1195 8661 2722 51 3061 3932 5348 2127 947 8144 9819 3804 6426 3092 6746 3077 5937 7699 4003 3355 6471 6812 2413 2491 6587 7384 2117 1835 1941 7887 2456 3093 469 1506 9598 7759 2380 3974 2456 4870 5434 5097 3026 2132 8956 9916 6991 3886 5210 5944 1719 6623 1352 6619 590 6949 6907 1266 1694 6114 4868 5795 9531 5252 4490 9602 5284 1756 2388 9897 3693 830 2092 5833 9431 2807 7636 4557 9188 7107 2171 7070 8406 +1000 +4980 4241 3610 2393 4840 6498 3981 9278 7226 7191 6999 3065 2851 9987 3553 7772 1189 6244 4638 8057 1373 2783 5136 2123 6471 6990 8274 1653 8824 713 1192 3684 8302 1364 3828 4073 4882 7199 9256 5390 9816 5877 1635 165 6691 8855 8610 2718 2389 1184 476 1775 3958 7346 7312 7022 5050 6322 723 946 4339 2947 5932 7961 2002 1986 9755 4557 7988 8187 6764 8597 9668 2050 695 712 7695 9950 4137 3128 9041 7155 5352 3512 5308 7694 5049 2885 1130 8779 6167 5604 3293 1822 9839 5384 3790 2066 6619 7409 366 4347 9870 2906 1251 4973 6524 6912 6419 6188 4207 9438 6832 4888 4404 452 5716 7662 9948 9083 3054 4577 8767 8868 3434 7373 7774 5124 2223 7355 8562 6460 7601 8867 7100 7045 7021 1666 1387 8032 403 6668 1333 2367 1868 73 8446 318 7770 6521 1377 5604 445 4433 6070 6704 6830 6605 6433 2106 7673 2758 8825 3583 2089 1375 8900 6413 6357 4702 7868 1292 1987 3868 6433 6179 6439 4543 8884 7892 3226 5347 293 3982 4264 7191 8998 2660 7354 3409 9626 9804 609 7069 4146 4905 191 8608 9607 5073 3704 6466 8287 1794 6936 6845 343 7677 4086 4865 3557 5820 8849 6898 4320 4181 9097 8063 52 3430 2217 7933 8803 3041 616 3894 7538 5381 603 3138 2580 908 498 1506 6213 3200 9140 8704 7929 5458 6838 9867 9829 9327 5866 9386 6920 9060 5066 8746 8895 566 603 1608 1089 5087 7156 3759 341 6960 6349 9546 9423 4884 4600 9847 2341 3578 7329 6731 6613 410 6016 7302 5785 3988 2182 9163 1120 9233 3840 4527 1590 8829 2063 6444 3750 666 6431 6339 154 683 3367 8076 9099 2340 2756 5920 7912 52 1803 2982 5296 595 1157 9046 7684 1032 2361 3555 9899 5426 3269 8756 5971 3914 1119 5972 1840 938 1469 1189 574 8457 7703 8176 7932 9885 8015 1496 1100 7592 3964 1415 494 69 8912 9300 1996 9562 2501 1394 3184 3101 5192 9684 7006 8930 2617 2645 6914 8131 1371 8414 654 2983 8822 9711 8241 6364 4774 49 8298 1362 9382 8804 9927 3060 150 3005 5708 3115 7560 4532 6285 380 4815 8426 9780 2645 613 4229 8473 8234 1663 7935 3401 2663 1392 7807 7924 1441 7784 5146 2810 2478 4101 4887 5844 5750 329 7131 8026 3822 2911 3234 4728 9038 8370 2013 4710 4541 4037 2393 7506 5313 5963 3286 5941 2047 9910 3204 7231 4706 405 5106 9135 3554 6159 7125 8219 6888 8837 5106 9230 9804 6950 832 8574 2294 6818 7846 3193 8909 2304 6604 2359 8038 9166 1157 7027 4103 3077 9660 7910 8015 5620 8271 9417 5160 8772 7296 1061 1207 5784 5305 4994 3645 7955 9420 1293 7474 5967 1985 9794 479 211 6826 454 2730 9086 6701 9813 8922 4102 2317 990 7001 6974 2927 1691 7667 6712 5122 6896 2235 7354 9217 9837 7838 9153 2510 7488 4730 9059 0 7612 8800 6367 2235 2075 4121 8697 633 3048 2061 2366 7159 8865 8683 3128 4775 6395 1702 8114 5616 683 7492 8148 7440 5460 2468 7907 846 5718 3227 1310 7692 2945 5418 9516 1380 7086 6320 3233 9181 6068 4628 6927 5918 7633 2955 7526 8079 6984 1035 5651 3569 6043 7861 3046 406 8795 1377 6117 8465 7455 1231 7649 9024 2911 1798 5262 4100 4702 8272 1947 4128 9637 985 7940 3628 1602 2366 294 5416 4640 7576 4756 7073 7609 3597 9678 1367 1235 7756 6902 9888 3959 740 3874 8924 7037 8207 9763 7386 6174 5474 662 8874 8046 3188 6061 6483 673 410 6645 2192 2749 6210 5269 2522 418 8103 4376 2361 6472 8380 2119 310 1835 4712 3355 9400 8055 3474 2075 6927 8840 4582 776 3978 3430 6942 314 3169 9923 6102 2609 2803 4943 6471 1500 9224 6947 862 5771 2139 9710 7360 10 8705 1182 9327 4116 8507 6092 7150 5425 33 2848 4198 4088 85 8040 6014 2010 9676 8183 749 1089 5418 9077 2405 4492 8175 1873 2900 8820 1315 3151 7601 6093 4959 2442 4714 9838 6573 711 8780 5377 5999 2510 2009 5306 5457 2516 9597 504 3172 3739 6178 7268 9695 1111 5965 5097 2863 6043 9192 9279 9923 7962 9096 1766 3026 5095 964 2593 4387 7140 2851 8886 6546 8772 9637 4915 699 1765 8947 2513 5056 2818 8314 5492 3706 6370 198 3499 7897 5546 8674 9156 7533 7020 3936 5444 5480 4274 7788 1435 3044 9631 4873 624 9497 7228 4569 1346 6180 9152 8279 5566 4405 8924 3846 9433 6927 1293 5952 2668 2801 4767 8515 8664 3933 8526 2626 7409 9011 1141 3130 2226 2127 7435 102 5111 7740 1773 1292 4562 8647 2346 5651 7429 7515 5919 5775 9694 5949 9486 6234 2264 6211 5410 7525 1186 6791 5001 4917 1527 1247 100 3083 7370 3931 7862 5553 8969 4454 2963 6660 1755 584 2139 5751 4516 5050 5725 7954 2737 3863 2225 8404 6854 3191 9558 1540 8139 8128 3456 1856 371 1213 2688 6668 1112 5542 2335 1595 9184 5846 2161 1117 3709 6371 8327 3936 3655 2677 4772 8559 6939 6216 2503 4366 1290 2728 4149 2190 9129 6447 9214 228 2352 7181 2069 866 4938 4587 7373 1164 2655 5371 9540 3202 794 4530 9397 6191 2809 7571 9003 944 633 1267 9453 6211 6457 3724 7522 9997 3628 4812 5011 5791 6850 6566 8595 9544 1210 8581 3069 6063 8796 9692 6514 4769 8404 6345 6949 3765 1889 4295 4942 5549 824 1568 2451 6409 4918 2272 103 8112 3498 2437 9647 6894 7408 1546 9129 9728 433 4448 700 1694 1403 7758 6306 9597 7667 5827 651 8325 7313 4334 1324 7216 1115 4488 7935 6446 3937 1657 5411 9012 1367 7366 4924 6429 4129 3142 9904 4906 956 3401 2340 1724 6546 9923 1097 4058 7127 2681 2587 9354 6904 6043 819 2880 +1000 +2463 1755 6866 1241 7738 4730 8649 9102 3120 2941 874 1029 8534 3593 446 7541 6679 203 8248 407 8944 7358 3210 1510 8312 5097 5932 6930 7140 9028 6538 1032 2895 571 2951 2143 8351 8844 2737 2417 9676 577 2336 6102 9111 492 6700 2094 8045 2626 2189 9949 2557 1380 7191 285 6024 2044 8037 7955 2287 1671 3379 6762 1402 1643 7288 6208 7398 2525 5300 3909 2950 5908 2293 6653 1424 8722 1341 8238 4113 9489 2781 6050 3060 9071 8941 4496 4227 7352 5714 9103 3587 8869 4600 3426 6010 5413 7951 4574 676 5866 3042 317 5877 1593 4775 1293 8261 8357 9780 4784 4306 6702 2663 4944 640 8930 7313 8255 8526 7540 190 2175 9015 9237 6249 5817 1443 3860 7244 450 3564 6220 9691 6662 8557 5521 5192 6234 4783 5726 5905 2435 6252 9885 7987 8371 2099 4729 9049 7382 1371 1549 7428 2494 2498 9986 6489 5948 5297 8274 5623 3024 4734 8699 3233 8938 9960 9590 2260 1867 4657 265 8802 6653 9968 3545 9418 4715 311 1160 1996 5821 4126 9618 5797 9304 9419 8452 8932 5242 4961 5850 6157 7826 3136 2757 3289 6193 6136 9639 454 3851 3654 5849 5035 5169 4473 7862 6127 2214 148 1092 7746 765 3338 1544 5625 2060 9730 4434 1957 5775 8272 3182 7011 5969 569 8173 2214 7034 1958 491 4207 9123 4988 9149 5399 4679 6617 9171 7963 6363 3373 2777 6239 6187 2991 4797 4309 1591 9598 405 9244 2514 4062 5899 6225 193 7300 9846 785 6869 6197 6838 6394 8949 4411 4438 1722 1287 7739 8556 5257 8644 7627 6938 8929 2737 5539 7513 8955 9236 7057 6718 4343 1536 2959 5757 8960 9092 4934 818 6610 2030 9178 7815 2699 8377 8241 9582 94 6376 7605 9958 5703 4681 4494 7213 7206 8044 7875 8544 6527 9192 9275 9203 3023 321 1790 9156 4944 3639 2813 4952 572 6471 208 338 1140 6155 7334 7383 2636 2324 7501 4894 847 6175 9106 6171 2163 216 961 1067 1208 1158 8061 594 3388 6834 1945 483 6040 2633 299 8606 4097 8097 2029 7599 1288 7510 4583 4213 6658 6036 2823 1994 287 8576 424 4256 6787 4389 2849 5030 9872 6694 5699 7185 2203 9213 8064 1952 9007 1683 7746 1759 3798 2329 2189 3404 166 3951 7538 157 8720 8475 4297 5231 3963 2356 4542 1689 7513 4253 5309 7256 1172 2622 102 7054 1501 1952 4737 2091 2472 251 4582 7509 8607 6587 525 2725 6467 5307 93 8951 3069 3859 9879 3160 3828 944 3831 4049 1711 4989 5875 2100 5341 6777 6917 382 4571 7892 517 8546 8301 2624 4259 9870 9052 6488 3950 3934 1474 6169 518 8460 5120 6397 7136 7297 3798 1693 24 5298 3874 3350 8917 4463 3576 4110 6528 4779 4409 8327 1385 3328 8581 3770 4942 4297 3282 3227 3565 8905 8125 7978 5594 1799 1652 3247 6714 5646 699 9666 7693 6461 1375 3009 7917 1355 6683 3368 6694 3991 93 6033 2299 2422 5382 4420 88 7248 9127 6220 7351 8002 6941 1159 8158 4545 9949 6806 7447 7131 8314 5021 9885 3815 4616 5542 9566 3146 6956 4635 3244 5706 9987 8898 2855 191 1318 175 916 4082 1403 8779 5174 1539 4407 2716 783 6187 6446 4776 2336 3659 3803 6715 3203 7593 415 4277 7857 9830 6140 6364 2712 9566 3151 1210 7216 1892 6405 9641 6338 9905 6225 8573 5411 9152 4973 7009 2334 9180 461 3979 3722 483 7232 1491 9914 3911 9010 7700 9152 2795 9693 4396 8550 4505 6615 5100 4080 720 2488 8585 7257 7755 1625 1636 9509 8187 2097 9742 4752 4860 8136 6420 3389 6545 7243 4984 9991 9861 6469 2410 9547 4314 881 8429 2890 7474 5245 9553 6607 5775 4138 4990 3773 3162 6674 2816 1318 1537 7485 5336 7187 2399 9280 6600 8192 6605 1902 7916 3064 1290 2044 6175 4373 6578 1360 8806 5623 918 3271 6474 6471 7937 7791 7714 1233 9843 1951 463 6514 3955 261 8949 7696 1443 5293 5614 7793 7518 4493 5532 5674 3523 2006 2834 3939 2592 1829 6407 4177 4694 2377 5432 5625 4183 4086 856 6810 6874 718 7589 2934 651 3393 9954 1486 6697 1519 8878 947 9532 3490 5293 7907 7924 8126 3930 4028 493 2461 489 1758 6767 4277 2916 6609 4380 4099 7363 4266 9715 1960 8784 8872 4110 7050 4711 9836 8786 3566 7013 4565 9372 1699 7032 8499 344 8032 1006 4777 7345 7752 6975 4316 8435 4099 6950 1522 2337 5023 5434 4718 926 5400 1336 8951 178 3222 1340 9985 1849 645 6414 5931 8069 3490 5694 1933 8436 3070 9605 5838 3149 3659 6361 5964 3443 6139 1263 2657 9957 1309 1451 4130 9527 6360 752 5182 21 3350 611 6836 8280 876 813 3113 8983 8757 1466 1267 5015 1200 1094 324 800 9951 490 7151 9092 8314 1071 4311 9348 5981 724 4889 1770 4628 8725 4769 8417 8953 7481 1865 8112 597 6121 381 5179 8256 6131 2418 8929 2445 9216 9723 6072 744 924 7414 7931 1694 4523 6231 9948 676 4533 1338 700 7132 1560 891 1899 1745 457 8835 273 5793 707 8 9337 9365 115 1876 6186 493 3517 5501 8465 7423 9155 6460 9095 6396 1095 8529 8702 1989 2177 2154 2953 1892 5647 225 8598 2691 9123 4363 2984 3850 9202 5863 2311 6808 4984 2204 979 7558 901 1360 7845 7082 3112 891 210 9072 7423 2108 3136 6597 1067 2868 3636 7761 2253 6514 1866 2734 5046 6190 4612 3242 7125 1369 7319 464 6898 3885 3397 6411 2912 7883 7722 5113 4675 5895 1085 4629 3591 6098 3834 151 1145 491 9772 7973 387 434 5227 102 2765 620 835 730 5200 3778 2265 9111 4510 5113 9950 7615 3568 8971 9159 3697 5444 3492 3690 2263 5936 7182 6306 1216 7588 7053 1706 253 6667 +1000 +7334 547 4445 0 6998 479 1595 4926 4500 573 3089 8642 9053 8131 321 3622 6040 6397 3084 7152 8118 1338 738 8304 5456 7037 5976 6282 4542 7107 6931 8558 3732 7597 2653 7845 5927 3737 8647 331 6462 1703 3282 8854 5835 6429 2267 1276 9788 645 3307 140 8074 4556 6094 7514 1312 4232 694 7749 5564 7337 4924 3372 3539 3665 9318 4177 4821 7437 6192 3276 4913 2807 1651 1334 3102 8005 9230 1630 1567 5110 483 9878 1742 1245 6607 8613 4141 8046 2753 3700 5764 902 8242 1118 9999 4801 5130 5546 8641 5155 2339 5029 6717 5011 5367 3675 3538 6265 4779 2546 81 1452 8137 2000 1472 8311 498 9249 8544 5763 5952 4696 3379 7897 5150 9797 3571 6664 3584 8902 5469 3716 4737 9142 1655 4545 1321 562 4700 2306 6242 6699 4707 7847 6534 4990 6164 5174 5524 5001 7250 1326 9513 281 550 3279 1318 5668 5056 6261 7534 8206 1695 9259 3871 5085 1107 8685 5418 1545 9771 8922 7231 6102 1829 2718 4963 1756 5041 7515 546 7418 1095 2269 8304 9498 1242 8429 5905 2969 54 2686 4854 9417 8644 1353 541 2795 7906 9341 979 6511 1331 8231 7689 3266 5049 2559 6262 7636 9551 9158 6065 7322 7845 3857 2256 7722 4654 1863 1385 2273 1099 9980 7465 9866 9535 4031 3857 4371 6488 3341 5170 6495 1007 3312 8534 3872 4702 1315 8 9344 239 2217 6740 3690 7327 7916 7256 2885 4025 8139 2767 8933 1457 2809 847 884 4196 2772 6643 456 2541 9085 4222 632 8878 9097 4233 979 3246 5047 9354 69 918 6622 3305 4419 2864 2291 4639 4323 4837 1004 4946 6836 7577 6302 1698 780 4947 3412 3305 8531 5823 6302 2570 1650 6157 6548 6293 7222 1150 1913 356 6830 8892 8304 5521 4273 4514 549 2560 6445 2080 6554 370 5202 8279 9534 600 4794 3190 5946 9786 7041 7047 4802 5878 8602 5673 43 1268 5305 218 6001 506 7429 7297 5451 6705 2802 4009 9012 6523 2269 7401 1414 3142 8102 5740 4969 6174 320 8665 5309 4611 1172 7986 2193 5078 7605 396 3797 1909 3020 8464 7751 1777 5799 3981 2740 2106 214 3719 8093 6797 85 954 8938 3953 83 2724 3304 9144 8123 3849 8470 4725 6429 7318 2034 1457 7885 3133 2802 7502 7340 9298 7231 9377 9548 8698 1609 4979 3747 9099 9316 2349 1804 6442 7413 9410 7777 3072 8057 4811 3371 9622 3392 2339 8637 336 6008 9145 7133 1648 1751 725 7994 2821 1359 6751 1037 7299 6361 330 4535 785 7089 9409 307 3315 751 7648 2000 871 783 6551 3181 6221 5639 9989 927 2598 5703 8400 722 8428 39 7646 5628 5394 798 9962 8621 3700 339 5877 6772 9095 8583 226 8670 7211 8463 9792 4932 5165 3147 3016 1449 4261 1697 6217 6073 3012 7210 325 485 261 1499 5380 6887 7090 8523 5488 277 8961 2284 1479 2386 9425 4830 1871 3677 9449 9251 8960 5112 2470 3745 6791 724 8681 441 1420 2604 2353 488 9253 9460 3865 1583 9040 479 6779 8540 5921 1738 7446 3269 6547 8751 9945 9139 6505 7091 621 6640 7703 747 2845 2332 93 1896 4682 513 3747 4675 8090 3329 9190 4876 4072 7601 269 2830 911 9043 7329 7594 8217 5929 3355 9403 8717 5975 7447 9413 7775 482 3288 3079 8802 7605 1030 7329 4017 9623 9857 9300 6538 3626 1411 7673 2748 9696 122 5694 713 1976 4979 4092 4837 5453 1882 6969 9700 8263 8743 2931 6660 2279 3062 4955 5852 4663 6001 7505 4260 8892 378 1206 9727 7098 7654 1928 400 4075 5036 9182 852 5176 2121 4293 8010 5755 3613 6420 4561 314 8475 9620 1064 3680 8707 1994 6969 1117 1949 4056 5888 2628 3071 8568 1917 3353 3299 2632 2866 3222 6566 93 729 6032 3444 3571 9031 9944 5984 6037 7014 4365 9783 3374 1575 8057 2527 7394 1005 4968 7761 4198 6985 1243 1238 9892 6555 7102 7002 5451 6162 5672 9043 978 9240 3556 4288 2905 969 2581 2005 2833 6683 9442 6061 4909 8036 9891 2869 7077 2796 4304 6905 5392 6193 5991 7743 3400 9546 6152 7116 2947 2924 4447 9650 4081 9805 5360 2783 4376 1492 6719 1240 8533 6691 8551 400 8132 4972 9930 6188 1218 8645 5330 6053 5432 2337 8438 5833 3884 7670 6769 5497 4926 976 9806 1514 851 9132 8051 4489 5533 2976 9786 6698 3468 3752 8878 3844 876 116 1579 3520 6788 3148 4625 3082 7183 5889 9185 7370 8938 1071 4843 6376 7994 8951 6680 5353 789 7831 3786 5502 1833 4592 9228 7860 2515 1226 657 9986 495 7890 9770 905 5446 9518 7986 4310 4566 3092 7988 2416 4454 8093 925 5650 7836 1674 4663 6258 9105 3307 5460 9969 5997 1054 7099 4188 1593 4884 6699 7403 196 6740 1809 9875 7720 2811 4728 8909 6864 7978 2074 301 9844 9097 240 8822 8454 2726 6309 4354 7990 747 5163 3301 1269 9546 758 9665 3537 3569 3794 6511 5437 5812 5515 4981 7932 8503 1560 9213 5527 3217 1480 5910 4424 2407 3923 8896 7622 8381 894 3258 6308 6354 5206 1084 3272 480 7566 9663 3242 3497 718 7773 8844 2933 5347 7263 8966 1836 2550 2309 3421 7705 7667 639 5788 2722 7132 8317 985 2521 7358 903 6210 259 7326 7947 842 2360 1410 6901 7586 5469 4478 6151 5380 9187 9589 4776 4845 9628 1329 7179 6635 9517 8818 3337 3031 7192 2892 2967 1809 9769 9195 9714 2745 3395 1512 2398 5058 6002 3691 4045 5247 5257 3078 5724 4404 6866 9304 127 1135 2299 5414 229 9305 8214 1932 106 6343 5026 1762 7047 6458 5059 6298 9263 1333 4829 925 103 7239 8133 8299 6205 7814 7845 6343 2589 4422 8238 3230 4530 2375 7386 5301 3483 2985 2847 6218 9500 4911 +1000 +6919 4501 2789 3533 7286 2475 7271 5486 4802 8022 4879 1103 3394 3669 8537 1285 3201 6371 4926 8291 2340 386 3936 939 5261 295 1423 4112 8925 5316 8423 7035 9477 2897 6011 5493 8979 842 9574 6341 8148 6252 5662 6733 9897 6220 3720 8155 2380 6833 1503 6043 8746 2951 5033 2576 7925 4383 6967 1723 3825 4581 156 6811 4571 5979 7732 8415 535 1889 1751 6300 2597 9481 6607 8010 1257 5321 1112 7864 9389 4671 9595 9214 2651 1466 9596 1424 2252 6324 3262 583 7694 7272 3172 7201 5156 5210 7184 7664 1695 8472 8697 6966 6244 4651 5006 4222 9149 9457 4461 9726 4674 968 3917 8271 7706 8038 1421 3177 8088 7539 5888 1983 8063 967 9714 8370 4025 2823 3255 6728 3373 1205 2347 8113 6472 776 3299 6660 5148 9765 231 2207 3563 8912 7366 9518 615 6085 1642 2456 4993 6447 7102 2119 3786 579 2241 7754 2923 9040 5595 1845 6446 9554 8178 8175 8009 9166 6496 6878 9351 1061 7071 5709 8116 6522 2897 6092 1467 5809 438 9705 3815 1290 4655 1965 6817 8570 711 9792 1212 6881 2151 8899 1428 5661 5283 5490 3174 959 5422 2016 8441 1399 2139 3038 7647 2288 2176 9628 440 2832 4150 5567 3761 5749 5370 6659 303 6380 1249 125 8697 9263 5006 6125 8480 8255 4839 979 6312 4421 9707 4592 5061 8180 8353 4668 6658 9854 7735 4464 138 119 4644 6233 8803 3130 4982 5992 9867 1205 3220 4475 1168 1145 5328 1808 7645 4805 3323 5259 4759 7183 8872 8867 2929 5183 8607 6514 9277 3055 4228 717 7942 9813 9869 4629 455 2564 8573 8217 2346 984 3561 5092 4740 204 1823 1089 3964 7735 7716 3176 848 5901 3201 8744 6693 7283 4501 1459 6477 5539 4159 400 1737 8201 7919 8723 645 1406 1644 1855 9076 7640 5972 9619 660 9496 9781 780 490 8396 7033 1190 7937 7060 5112 8460 4794 1418 9467 3199 1715 1323 4111 2704 8346 6723 9460 397 1631 5002 1265 5296 2800 3443 5558 5135 986 4887 5950 6923 5373 518 8670 5081 5828 6742 8209 2590 369 4393 7093 3277 2431 5352 2438 7301 5596 1568 5261 8197 1591 5678 1834 895 9760 6519 4748 1885 922 1050 8963 9221 4951 9411 8828 5605 6963 3590 9373 481 1211 2275 9834 941 5380 4011 9670 7497 2851 4278 6652 1865 6099 782 1695 6391 1000 7565 4220 4677 9484 5565 3100 9041 4182 6873 5190 1301 4268 1314 8796 4509 9218 7974 8524 3478 4453 327 9236 2335 3655 2673 7275 7341 9255 3271 6031 4474 8953 6004 7257 2520 5949 6938 1329 1976 8753 5822 151 1186 1221 7117 8912 4201 9076 2835 2107 4281 3586 4075 8670 4316 4414 6410 3593 138 7051 2387 6487 4992 3496 703 5824 4547 6961 2896 9911 558 6874 3699 5493 6857 7125 4846 5373 2202 4225 9967 5975 4747 844 6471 8108 4292 1472 2096 7221 3028 3529 4973 4195 3765 2260 2052 321 7428 8152 1327 839 256 1823 7393 6329 4904 9911 3102 324 3695 7403 3121 5143 8690 8954 7319 2878 4515 1397 8774 9650 9304 2941 8291 170 4742 7686 6267 4567 2152 5759 2244 4865 3997 9913 7657 2559 9616 2494 9206 7622 4575 8261 2744 6231 5171 4523 464 961 5041 393 4091 8871 16 4942 7429 5207 7767 677 3152 3626 9528 3221 9877 1997 5570 3050 7352 5887 9100 6000 7101 8645 9778 6507 5282 5455 3818 2315 9602 3919 4372 4010 1373 7123 4420 6491 7773 45 7959 1030 4295 6329 6387 4053 4505 4856 7750 1532 1969 2210 4262 4771 2862 6105 1011 8965 1338 1081 5111 1507 5913 9531 8291 3662 9309 1458 3931 1729 7251 7206 7134 7907 5144 1429 6571 2526 4794 7198 1418 8143 1523 7910 9761 4450 3605 8763 8084 3467 9832 1027 7128 8719 2426 7094 4061 2173 6337 8340 3105 6340 283 1666 9550 5063 7720 9086 4406 3272 3112 8779 205 9387 4603 6930 9249 1346 9058 8793 2952 8065 8465 1781 9961 9348 9079 1132 2104 6860 130 4650 7443 3977 7531 1897 6491 8134 8743 1527 3680 8689 1638 4343 7284 808 8705 9639 9871 1992 4261 7493 1532 284 9767 2083 1932 9840 6219 5209 5387 6366 6527 9000 8239 5078 7109 5453 6975 1521 8791 1206 6132 3456 3194 804 2043 5522 6761 4523 6418 915 6702 5399 1635 4757 80 2910 5739 9811 680 8767 6878 6643 4868 2508 486 3304 4228 3317 5511 2782 2819 7721 5251 3787 6440 8317 906 198 6002 271 1583 8546 26 1852 9898 1178 5683 7761 8437 302 7402 3771 2307 6065 8613 7099 145 6194 918 5068 7142 8617 4466 9265 2707 5572 7457 6218 4307 6529 6680 4264 9177 263 4715 308 8611 6142 6177 5657 2215 4440 7936 8225 5306 3182 415 9577 2672 1717 4217 5865 4278 7308 9511 9222 4929 4434 5882 2941 5793 9648 1585 5071 5184 790 4650 2022 6620 2300 5382 7821 6636 5734 956 4342 8488 5689 7694 9937 4690 2231 7335 3093 4865 7335 9727 9757 2975 1316 7643 1411 7916 9177 3686 6632 8235 7955 1716 6641 9327 9495 5989 7162 5606 9443 8281 1574 9151 7564 1401 6599 9018 6826 3345 7432 4804 1996 2527 2783 2173 5316 9682 7002 3495 2378 7731 8837 2306 9833 4930 2347 252 769 8760 6603 4258 2110 6685 5195 8935 9620 2415 6598 4908 7519 6095 1813 7840 5724 5792 9452 8040 2977 8501 3206 3937 8810 9206 7527 2630 166 1452 5095 6461 968 4530 7272 802 5729 3735 2169 3477 3281 8847 1352 4914 4251 8964 4354 1594 2748 3623 3600 2768 1201 5299 2355 6505 2623 5530 1564 478 537 2187 121 2267 885 5227 8372 3958 5385 7480 5291 9940 8852 2421 3254 7582 1902 179 1509 3606 8052 5033 1653 3006 9335 8803 5441 6513 4799 5195 2133 2315 +1000 +8182 803 7591 6665 9251 1355 6084 6586 6496 3126 7043 7 6322 8526 4979 6974 7201 2610 9446 2752 5553 5329 4757 2395 7657 2912 9721 2949 103 1834 6170 3128 1801 2101 5089 2535 3486 1306 6298 8527 1930 9376 5128 8325 3579 7473 3344 9526 4854 929 853 7158 5903 8435 4555 63 1727 1632 9378 2525 8130 2569 6152 4672 3615 5107 5120 496 9978 724 5100 2852 6783 594 1774 6985 7070 6475 6819 7667 7917 3103 9707 156 9314 8318 725 8971 5112 703 4846 5099 5358 8675 7273 6702 7518 7091 6419 6442 4245 9635 611 6418 7752 8895 6526 766 7889 3222 4613 4952 6509 1337 8416 634 8672 2621 2810 2325 4316 6573 7564 2517 5881 2018 8951 9849 7793 2556 7382 6848 7986 2479 8417 5063 294 4195 8511 9160 6690 5180 2990 5926 6527 8125 6459 679 5594 4062 8142 2921 7851 660 8631 1487 3161 6475 7370 5445 8224 801 7920 5693 3900 4579 4050 3658 8990 2629 4724 3748 3939 1250 7747 3780 6088 1392 9050 3024 3404 4396 4641 6177 4136 459 8607 4597 6288 5507 1516 2599 8361 6165 2225 8320 9474 7531 5963 1767 7643 6897 9225 3569 5310 2285 9978 4019 403 212 5763 6125 756 7298 7269 1325 1659 6937 1486 3701 5446 1844 9461 6123 7776 6709 9976 3319 9285 181 8734 5107 8681 732 9942 6017 2167 433 5814 3293 4081 7743 5673 4381 7412 8666 8151 898 5105 2584 5250 9787 1463 3114 8534 7704 1188 666 8263 1329 3439 5431 2162 6724 1784 2781 9217 3966 2850 9491 8301 4825 2598 6200 353 9006 737 4690 2114 9356 6051 5275 9684 6431 4610 9605 7776 2678 2384 2347 1915 7511 1217 7335 5291 458 7827 8789 1368 6581 9432 4754 5629 6499 7011 3699 4945 9576 7630 1366 1339 1339 165 6274 6660 2288 7030 3219 3697 5337 140 8700 2461 1137 6925 4338 6720 4396 6283 3289 7019 5745 5405 3482 7161 1230 1782 9068 8435 6641 5639 7536 3208 8556 2398 3939 2638 3648 99 7945 2894 4086 722 9669 1091 817 237 8577 410 6888 9651 231 7581 1490 9968 4218 9162 6930 7283 835 2603 9202 9262 8319 4886 751 9211 6069 9801 6724 6769 4513 4805 3159 1331 8362 1236 5946 2669 2786 7411 9465 9727 8087 5233 9982 1131 9333 2164 5146 767 9214 6051 5999 7667 7251 5186 341 2521 2865 4854 1393 2193 7307 4357 3254 641 3187 3089 2601 6857 7603 6278 8934 7210 2428 2318 1813 8255 2738 9147 9088 9662 441 5080 5228 1556 3122 5860 8485 9540 1932 4775 4373 5333 5362 2787 4890 4783 8110 8013 1350 4759 7577 7385 375 3485 8479 5300 4297 8644 2578 6550 100 6286 7807 1030 9561 4400 5584 507 7279 5763 5406 1166 8402 7255 8295 521 7934 5736 3396 9539 5258 8467 4270 9256 6712 5958 3233 2441 9050 1455 8398 862 2640 9468 5208 7865 8324 2199 2068 2355 403 4790 5683 580 2321 3748 7357 9091 1999 4575 6429 7995 6443 9494 368 9276 6613 3936 6652 7872 4871 2203 8062 8022 6054 151 3002 8506 340 3473 9243 3472 5140 5226 1343 3071 8027 3173 378 2121 4819 2630 4046 2661 7673 9888 8009 5492 7843 3091 4572 8752 2966 1630 2315 4519 8380 1642 6739 293 1015 1135 1170 6455 6492 5758 183 1647 3991 8464 996 1584 6166 5038 3485 2318 2182 1155 6002 1676 6724 8819 1809 6214 1864 4709 284 7154 5599 5516 8002 2306 514 6171 4930 3696 6055 3200 8076 9803 8170 7292 3890 5798 5343 2033 5725 2085 7686 4349 1723 474 9704 1683 9442 3947 5313 2175 5079 1272 6447 6697 168 2421 6644 6146 1346 973 4419 6152 9372 9532 7685 3324 2490 7346 7315 5384 2372 9722 2441 6860 5560 6846 6816 6479 4339 4394 3381 550 6465 391 6012 4088 2184 5520 3491 4382 7225 2850 5491 1097 5458 6965 9715 2552 3635 4006 2131 6605 2239 9710 2381 6723 2768 6456 8322 936 648 9851 1924 7868 5364 1326 2275 2709 349 3343 8756 7272 3934 6575 7742 9638 2057 3880 4028 488 5528 9441 3017 6180 2434 6884 5678 1215 8519 9541 3612 7380 2418 9051 2664 7595 9946 315 9297 6227 9551 5096 3037 324 3921 9903 1701 3301 1050 996 1181 6316 7595 2428 4344 9008 3668 4656 5368 8392 2818 648 802 7826 4274 918 4209 3583 6598 4221 3400 6060 8547 4075 1485 9321 2961 3544 7108 3725 941 1073 5602 1878 5178 3844 5439 3442 3741 7254 1766 9255 6249 5726 1346 9384 5866 5783 4519 3572 7848 7489 5179 3392 3626 5806 7752 7192 4135 6545 3413 3425 2544 1250 513 6730 71 7013 2735 2219 8729 7675 7981 7872 9437 1010 7467 8389 4451 4912 8381 313 3152 749 2525 1383 8393 171 9770 1323 7158 5687 7151 1133 930 4626 4199 4810 1092 8439 2296 1441 7970 6411 9579 1197 6222 6277 5136 7225 5700 2552 3814 4424 4278 641 2018 3909 712 4219 6082 7200 9307 6901 6782 5661 4070 1597 4029 4979 9596 4341 4695 2617 3780 5683 2097 2297 4685 1655 5481 5189 8769 2043 9006 7662 1945 8716 4749 7895 8738 4731 2823 8728 6463 7431 2878 4979 7720 2225 4910 4918 6303 7757 3657 5147 4965 7680 9991 331 7790 1805 5153 3208 7521 2306 8965 8791 8954 5342 710 7366 329 8300 7353 159 8200 3251 3364 3090 3139 6627 7776 2952 600 1802 532 1064 6550 3322 8797 7829 1102 1622 5485 8781 8116 7555 2371 3197 9713 4865 5788 1200 5040 5233 5350 9917 6284 1324 5206 8613 9927 4297 9951 6222 7114 9451 2049 1944 3800 1166 9933 7333 4034 822 2578 7974 3572 9899 3849 4598 6002 8810 6724 3853 5135 7989 2498 3997 6102 9270 5105 6034 7181 9143 5820 7178 8753 3105 7998 4011 7464 5498 4118 5824 4088 3386 9631 +1000 +6141 8534 1033 8480 6866 4832 9093 9547 3558 5059 9668 8676 8972 9931 9512 3170 20 2681 5667 3112 1516 7941 6204 4862 2939 9149 1148 933 5441 1952 1896 755 5889 2396 2755 9328 4693 7377 4266 9859 5881 4874 8970 8811 4889 5116 1086 1619 9630 4159 6592 1116 6234 2711 2738 2273 9642 7757 1329 565 5329 929 863 31 8244 8725 3193 9894 3091 9633 171 3300 543 9602 4642 2075 3565 8379 3068 3125 9225 5907 9206 8520 3028 7186 1086 2837 2274 923 3652 4990 4041 580 223 1645 6737 9926 6332 2434 8949 2025 3732 4259 3857 9307 2646 4962 7999 3553 6625 7420 7172 7805 4374 2653 7523 9868 6277 5217 4799 8257 3508 3713 6450 6477 5920 7190 3435 3533 5293 152 8444 9353 5650 845 7697 1124 4120 9157 1340 2121 6177 3234 3176 8260 6797 5217 5736 9784 3117 1346 8795 557 6412 972 7185 4220 658 6875 7450 3732 686 207 3577 9438 1035 5752 6748 1793 5981 5167 1161 6787 4282 7563 1688 4856 7865 770 6313 6728 1472 381 4196 6037 8863 9456 3356 1836 1277 2071 5174 5656 1356 7689 4413 6459 2552 7319 4887 9722 3416 5845 80 1526 3510 1174 3562 8584 6287 1200 2613 5347 1408 3251 7866 3286 9078 9582 3426 392 5989 9359 1001 8913 5240 6472 1382 7495 3562 2501 2217 718 6797 3664 1279 4659 8453 3327 1951 7507 7610 3224 2691 8297 9670 4194 5449 3575 3929 4850 8059 7196 9270 5750 9444 6780 6914 6046 2286 7569 1117 3546 183 5883 7307 9880 1344 5026 9579 4484 1441 3106 8249 9937 2115 873 6964 5698 1787 3269 7441 2744 1444 5428 4605 449 170 9872 4606 9888 8477 9195 6568 8914 1563 6283 4257 4773 1219 2016 6046 7887 9164 9769 6424 9595 1208 4134 395 6799 2293 9117 552 186 3682 782 5081 8466 4038 8681 6824 540 7414 2901 2008 5318 1825 4738 794 8006 4487 1585 8983 4165 7434 9241 6259 9509 7489 1871 3977 9180 3321 5199 4971 9387 1246 566 5533 895 3752 144 117 2790 5118 7250 6938 3498 1384 6350 8761 9326 7952 7586 4040 300 2587 7810 5529 8210 7612 9145 3817 3527 8001 1111 1073 1902 7563 3726 1251 6009 9639 2955 8677 4298 501 5013 5048 6021 8844 606 6009 700 4200 9347 9891 9346 6086 1037 398 8376 224 5457 2089 4222 5927 1725 5457 8344 4946 8703 9588 4567 4037 4441 6642 3462 4721 6485 8661 4500 6092 5318 6679 4088 4482 2872 7724 8144 7806 8429 4283 1849 7651 2016 8087 2476 74 3159 1372 7178 1389 3791 8276 7860 9616 592 5022 2290 5048 6955 8746 5382 1093 8415 2119 6064 8763 6609 4971 6938 6141 3123 6038 6335 7285 5107 1154 5170 7451 571 1820 5714 6883 8088 3359 8699 9944 1957 3942 302 3145 1329 6448 9304 8342 8950 2461 7807 6045 858 3270 7321 3431 3226 175 6511 9127 5492 1152 5061 7466 6250 709 3481 1454 9437 9812 1662 848 609 2824 6402 8530 8033 9008 3389 876 3749 7281 4089 3050 7662 561 8713 5241 2424 4556 6219 6646 441 4454 2182 97 3506 1033 5137 7335 9318 511 8360 8953 8996 1829 1447 6002 3333 3013 4516 7091 7020 4971 7358 9028 9120 6987 3219 376 4467 6175 7181 7002 4281 1244 4864 2715 9081 2568 1591 8807 8393 4595 372 1460 9063 9970 1023 1950 19 7210 600 8286 283 1616 902 2640 2953 5888 1115 2000 3181 854 354 9293 6872 900 6019 9134 3675 8857 2971 2094 7874 1216 5124 2699 8467 7721 9478 4342 6583 1419 3887 592 9341 227 295 9318 758 88 5554 3577 9420 9608 7985 7083 1323 8465 9878 9000 8885 3635 4202 7630 6201 4693 9930 2696 1694 7138 6574 1940 1879 9004 9698 4753 3323 6274 2314 7019 8650 1697 7234 169 6231 424 4911 7010 9592 7286 4690 3778 6525 7523 7691 7982 5063 5731 8136 4423 9280 932 9842 8009 6748 5110 2632 176 6922 3800 5375 6724 8015 1829 5166 6827 9596 2961 6023 7001 2159 5675 935 5424 9744 309 720 4668 1058 870 4461 8070 491 863 9584 3874 7736 2628 8296 8136 2721 4474 5723 7084 4367 1211 5448 2018 342 3246 2545 2158 7678 8524 3546 9991 954 8480 4922 2542 1036 151 4758 6823 7787 9628 4483 5689 9288 2305 5204 2646 1572 6080 9513 7835 3061 7674 2888 6960 3094 3526 9678 6438 6262 9028 5243 6213 1106 9923 9646 8380 3056 4086 7073 7405 4118 3434 3752 2302 162 1244 7901 6855 3448 1418 1870 268 5737 7000 7852 2870 8713 1380 5489 9482 2 8414 3205 9426 9740 3206 637 2278 679 9734 2087 722 2950 113 5322 2678 9198 4113 9341 1905 9865 5704 1114 3016 846 493 426 3296 5240 196 4443 3147 3763 6585 7232 4154 2522 2954 8397 4102 1370 4832 7988 2132 1969 7291 7558 4676 6917 6783 9814 5582 5864 2746 200 6250 7261 1721 2898 4232 5422 8639 9014 9321 7973 566 9012 528 2216 1485 6027 8098 8263 5056 1684 7896 5267 5580 9493 7924 6763 419 1084 1903 6442 9908 6553 7997 1673 8710 9009 8231 7301 4756 6189 6703 7658 8634 3206 3509 8033 8437 1671 5724 3924 1207 259 1778 4535 5661 4438 7181 3 237 6381 2513 3257 11 4854 2571 3677 4088 209 9699 9121 7642 4699 709 2336 5030 7650 8816 1658 3510 6309 9449 2100 3469 5735 2268 3345 3123 7839 4165 9018 1262 5463 9429 4573 4531 8363 9276 6966 5580 3165 3729 7034 8789 4774 1714 8339 2280 4783 4183 1499 6309 5047 2293 8610 5262 5581 5310 6944 2386 4431 3273 3939 5658 3412 3637 537 5423 4614 4658 8709 1358 9809 2271 9952 8702 4828 8730 7691 1263 629 5760 5561 4623 2037 5801 4687 6728 7203 4755 695 4641 100 7558 3558 3700 3720 +1000 +504 6001 1655 2681 621 8785 382 6238 5796 7221 6163 9853 6292 7778 9862 4584 6929 4456 6269 7379 8216 3776 3981 8064 7329 9954 2909 8248 2516 5100 7115 5120 6914 2893 5194 758 8871 6104 1200 1892 1855 1689 5967 7438 5768 6741 8991 7671 7413 4579 6979 9160 5662 8544 3598 2969 8445 4245 7355 2781 8796 8229 1737 5860 7972 7897 2156 8322 3599 7249 7617 2227 5210 6761 9285 3750 6781 3833 720 1564 6264 3725 5579 2587 5555 2727 5898 6790 2384 7239 1895 9694 2125 9596 3067 1279 6183 6616 6681 5352 9256 3725 8691 8264 7566 2308 4833 6419 9402 5829 1979 601 6064 6292 9345 4201 9637 2415 5276 2569 9860 7056 8177 3522 7048 8330 1362 7794 2761 7810 6305 887 3690 5011 6976 6650 4108 8804 1487 2226 6287 8731 8945 6868 942 2937 7931 7244 5871 4861 6385 7663 8006 61 5101 759 9522 9717 2174 2077 6578 8480 1743 3818 7143 9063 3496 7936 4726 7953 1717 2663 8719 4777 4867 9304 5463 5081 4849 8818 3248 3518 4050 1900 5624 6022 6497 9593 4719 4272 9289 3316 4285 6784 2560 2502 5615 1689 9568 1821 8917 9475 3700 8769 4711 5066 1390 397 9139 4638 3897 6625 6237 6844 2090 4632 7984 7803 6513 9484 7709 3133 2227 2873 4125 4410 1795 5628 2157 2382 516 8840 1354 4919 4930 5821 2106 8090 3818 1010 2298 7273 1091 3054 815 9351 8639 407 7856 5762 6527 642 6707 4087 3742 2369 3953 8387 4228 1643 7039 7499 1922 6897 9786 5180 1959 1651 6044 1197 8249 7478 246 8028 44 5990 7745 6353 3273 1158 5518 6728 7064 525 2953 7755 411 39 1506 7081 6183 2994 1747 6397 8942 808 7661 6642 5977 9910 6760 8192 2388 2540 1217 3575 9965 9863 1816 6093 6917 9271 2383 2718 7626 6194 5175 4748 5037 7128 392 1887 303 4063 3527 3226 344 1968 9663 1691 6790 5866 6811 7321 8127 8081 6815 6453 2819 1050 9358 3751 2008 793 6366 4839 7596 4975 9390 5438 9037 3367 9489 8697 9590 9767 5649 3229 1968 2858 6236 5911 6917 8333 2309 1153 1192 5633 2386 6106 2615 5061 8408 3342 7150 6097 8734 1001 6060 3487 2934 6999 82 8834 401 3834 4515 5966 6291 6638 267 8146 7635 1240 8898 7659 9877 1815 7887 788 3886 2320 4799 8584 1567 3424 7099 7698 9600 574 479 517 7777 400 8073 850 6733 6646 403 7299 4442 2716 5287 9682 2904 4555 857 8248 4522 2460 6950 6329 4600 9533 6878 2198 5189 1976 7051 5629 6257 8370 1864 6393 5933 1854 4591 6802 1521 4561 5282 7452 2432 1321 2769 4634 7323 616 5037 2170 7566 1637 3284 9818 5533 5770 2812 7010 765 7024 3374 7464 7089 849 5320 7977 5532 1483 6150 9646 3191 9047 1191 8246 4651 1300 5854 6674 1934 2741 3992 3216 3494 6343 2692 5736 906 2563 6082 3871 5904 3365 2641 2295 9727 3367 9357 8463 2177 2344 4472 6331 4268 2309 8479 3663 3083 1255 9561 4691 5881 5499 461 3589 9331 8089 8089 8910 4027 3815 4697 3678 95 509 3235 4190 243 2910 9371 6124 7022 3659 6661 4030 8404 4778 6391 9321 2956 9678 9518 3355 8193 660 7855 5130 8865 5234 2538 947 1539 7815 2128 8477 7956 7010 8331 605 4105 6400 7425 5603 3850 2418 1604 2378 9429 2992 8189 4624 8572 9527 2255 5541 9224 7437 7546 2708 238 6439 5378 798 9042 5016 3925 6105 5103 255 6781 5100 2663 4305 8144 701 9425 511 1042 8632 434 4822 9134 3441 9836 6093 9989 7805 8015 2530 1044 3889 9106 9253 23 2318 7823 5758 6077 4158 9896 5982 7646 5649 2813 5497 511 9434 9786 9425 2626 8106 4878 7581 3217 7838 7518 9608 1586 9005 4138 1054 8439 8181 228 1925 4670 3848 3414 3732 2994 6529 4510 6241 5959 8713 2391 1343 373 7694 2241 7966 4028 5859 8686 6043 642 8398 2185 9185 2004 8662 812 5238 4324 7260 703 8498 1965 689 928 8665 5586 2310 6379 340 5859 4024 6921 4799 4249 2982 4196 3942 3739 9485 9297 1282 4885 2486 5924 233 6592 4618 4289 7442 1141 1266 8575 7912 8808 7008 9446 866 5115 4919 9867 7708 3890 2629 8042 5500 491 8437 501 8929 9432 2398 3980 8191 6658 6502 2022 7742 3674 3835 2621 4928 9428 1607 6708 4478 8351 7092 8935 7474 2643 3415 3108 1037 8963 3860 3087 3387 9853 9867 9285 5669 8421 5623 4217 9002 6382 9577 2934 9400 7653 3720 6600 1445 6031 4429 3241 7044 8001 6287 7765 5469 7480 8079 3533 3486 9508 1537 713 2378 1445 1533 7861 8620 1406 2375 5695 6588 2669 312 1719 9664 2330 8504 3665 296 1679 4083 7542 8412 4057 2152 8668 2301 7755 8981 6165 5046 4310 7502 1158 1058 6496 5564 8263 1092 8107 6663 5358 9687 3443 638 859 8473 2202 6038 1876 5387 8574 9532 46 4020 9781 254 9651 520 6046 5357 328 3564 9934 112 1303 2103 4431 605 6795 333 8808 5683 9185 3270 3011 965 9956 7025 3505 6568 6632 974 2308 541 1898 4026 4342 7640 3012 479 812 3231 6146 9461 7251 1860 885 1431 9407 3997 1644 5869 5644 1529 9400 4007 5104 7824 6908 5191 6791 5307 2291 5143 5407 7271 3978 2174 8317 195 1682 4844 7444 5033 3931 4435 5232 321 8076 1764 3601 9966 2929 1618 5405 5062 5735 69 4148 2873 6108 1207 8209 5623 6757 5534 7209 7185 5016 368 6047 7195 2313 7857 7094 6353 2149 4194 9978 8370 3501 8408 6565 67 2699 9740 8218 7806 9387 518 4785 7588 1892 8347 9551 8447 6287 191 9485 2911 488 5388 5927 6126 1944 8265 2695 9646 2180 3074 6330 5327 1971 6702 930 427 4617 5009 3098 9210 843 3961 6832 1406 7910 135 2206 7878 +1000 +221 6940 9512 368 252 4740 6069 9671 4718 8779 3127 4577 6279 5474 1792 9627 4409 3100 5446 7206 2007 1133 5329 5084 91 5691 4774 7086 6132 4748 720 8220 8415 3944 1636 4375 8679 2587 8350 9374 5156 7447 1201 1571 1554 9986 1382 262 8442 4817 4190 1964 6284 4185 3847 9522 849 9399 9274 9912 9400 6302 8120 3183 2154 2102 4549 5364 9522 7498 4790 3291 4498 8507 9951 3435 7337 5094 3480 5772 9354 8986 8273 7212 5566 3693 4410 3600 7551 9860 6900 2407 282 2019 1720 6245 244 1503 4274 9991 1908 7308 6829 5365 9226 7792 3558 5700 4003 9853 7120 1930 9405 7586 3851 751 8229 870 6704 4050 8916 4482 536 5482 2964 6241 4607 5815 1963 8117 5692 115 5047 1237 5595 9188 9499 3882 6948 9459 7826 3192 7568 101 9478 6003 3450 5682 4200 4911 8056 2747 2418 5756 9800 120 2909 5664 2816 1796 8872 8741 6561 8272 5584 535 6817 3536 9345 7881 2485 3061 4835 5239 5796 7248 1708 6069 746 5609 6042 1935 4552 7746 9540 6224 5820 2369 4560 6187 6329 808 4110 1975 4473 3840 2757 4660 2416 799 79 6012 2526 9251 9481 2889 6307 7224 6280 4901 6235 2986 7697 2411 5353 6481 2017 7800 7651 3282 2447 8491 8351 4345 7253 897 2297 2023 9320 2722 2059 6041 3565 5465 4677 4681 3570 9538 3997 8717 3945 6798 5978 9272 2336 3115 3495 806 3707 5161 6103 214 9255 119 8432 6821 6381 6763 1235 1158 2353 9288 8858 6512 2943 3838 6843 7695 3999 221 5200 950 9221 595 4635 1753 4686 632 600 4755 5714 1713 7178 1664 3763 8283 4136 2605 1217 5085 360 6149 2056 324 1823 6257 102 5678 8001 1154 3779 8343 5124 3993 9372 9016 6927 2185 4670 2419 2073 7648 656 6394 9934 3477 1804 4498 956 5671 7705 9584 2435 9117 6229 5092 1193 9646 6741 5964 4319 9141 3972 9643 5284 6163 5036 2645 540 1402 645 5307 9896 8770 7834 7509 1362 8325 7529 7363 5281 6101 7052 8782 6946 4981 1690 269 7138 3346 1075 195 9627 6360 9796 5598 5879 1160 9633 6449 1371 3560 2012 6682 2931 7398 4368 1960 7370 6493 5101 8008 9925 73 3375 1789 2015 3444 4148 6230 7157 4469 5872 6396 2562 4070 8968 2473 7779 1673 4546 3409 6002 3554 5087 2805 9965 1290 5776 2169 547 8668 9123 6509 8048 7586 397 7509 87 993 4095 4609 7064 6724 1401 6526 1090 5965 5167 3572 9519 327 2855 1721 657 1177 9365 3691 3550 8527 3223 9141 8519 9696 7886 7037 7629 4025 2636 6634 5602 7144 9630 5824 2190 555 4619 1939 7933 6148 5933 847 2651 3984 2912 4894 2581 7621 525 1566 343 7954 4070 9442 3330 2483 6277 2987 5809 2940 8199 4941 5442 4486 7012 8391 52 4717 6961 9182 7383 3798 2743 6050 6703 5589 2129 6660 1247 294 7893 1317 4251 1459 6401 5022 9642 1585 6225 6714 1198 2640 3860 9353 422 6308 7798 7006 9663 1529 5650 7504 194 6387 1001 839 6792 6509 8586 9983 6730 516 2777 4111 4350 945 2934 7091 3064 9303 8902 8560 2196 1958 6485 2782 7780 6004 2122 7086 7827 9265 2613 2809 8067 5680 5859 93 3006 3989 1013 7783 1504 9411 2242 274 8131 7563 3127 4887 3266 6246 9501 3330 6791 1411 537 8857 1928 3768 7574 6949 4897 4017 5913 9704 2392 2115 2904 4487 9825 2928 8725 8635 12 7053 4127 9327 655 8388 3607 3574 3723 8581 5628 6179 7522 5505 3104 4548 9366 7144 6142 6715 4978 967 7550 7313 2087 7641 3799 5674 3342 6042 9202 2499 2341 8953 6115 3371 1706 3581 9037 2201 3634 5759 1109 6868 3818 647 5105 7621 7177 51 2500 362 6056 4440 4846 1921 3532 5276 2832 6483 8271 8368 1242 3918 106 4652 3981 4347 2104 4358 221 5146 6308 8315 373 7089 2009 9933 3775 9095 8773 5525 7404 9877 6096 4464 6150 2079 1957 7884 114 8955 8633 7403 2924 8671 4722 2005 4686 4858 8210 968 2937 8302 8934 7724 7985 3240 9817 6116 1831 3482 1712 8918 8486 2546 5409 2777 6319 6782 4842 2523 9550 1359 5319 3387 1611 6487 7385 3831 8015 6334 6226 1106 1390 5155 7422 898 2389 541 6663 4615 2101 8604 5009 3980 8858 6120 7106 6195 8188 7371 8901 1156 2027 3845 9440 5288 8944 1649 623 9643 9398 5069 1139 8823 474 3113 9302 293 5815 1912 4199 1928 682 5043 4933 6832 7181 1063 1205 9949 9341 5238 4435 4477 3176 8373 3962 9259 8710 959 4963 6465 8243 8703 1104 9203 4105 7823 9873 1107 8926 3682 1648 903 8484 9411 175 9488 5176 1546 4911 781 6958 5461 6343 2545 2193 5210 5785 8477 3211 9073 2121 1829 8415 3827 9920 6197 3417 6617 2443 6866 523 562 791 259 4887 9663 9807 7177 8486 653 2668 8048 9380 7804 5921 3189 5785 9850 2047 736 4562 6515 8129 617 3235 7421 7755 8604 5531 8369 6270 8000 8586 1336 1309 2559 6043 9960 9794 8717 6341 9337 5840 9951 2226 6803 7621 4074 5155 7181 7129 3095 6100 4092 6301 4053 7777 3095 7823 7045 9033 1081 8978 2202 2276 4288 4631 4560 7480 5914 5000 749 5630 4290 5980 1808 5611 3391 3356 7413 4102 2585 862 3190 9664 8385 9807 1847 8822 4574 4363 3065 7187 1132 5398 1688 9774 3789 8507 5976 4304 3678 3035 6335 6097 5175 3993 8845 6675 4541 639 6633 7959 5657 9604 7045 8931 4316 6849 5771 832 3653 5000 282 1973 7513 405 9486 5247 1748 5057 5685 2538 9870 3652 2764 8626 8176 8204 5637 1164 2564 4662 5083 3322 217 4400 5803 2565 9554 7042 3724 5600 7769 6297 9778 1090 42 9628 6295 6884 9475 7785 8695 5176 3627 6284 1533 6413 5172 7156 8450 +1000 +3855 3953 9225 6390 9723 168 8566 1209 8024 4456 8511 6449 6785 5176 3763 9234 4716 8735 2392 8024 4017 76 1431 9838 2798 5383 2643 1071 4253 2815 8146 8892 5349 7916 9079 822 218 5334 2240 7055 3650 1340 2573 651 6876 732 5942 4429 9090 7861 4935 2322 7866 806 2398 6599 5893 4312 8104 945 8641 6786 9259 5724 1143 2038 3971 2159 1955 1578 7667 4560 2149 7418 3384 7052 7406 1872 9500 5334 224 289 7944 8972 1885 8002 4502 336 9770 5006 3560 9134 221 8467 8545 3233 1731 801 415 5187 2917 3579 6151 9273 6919 2487 6309 4053 8494 9089 8465 5421 3070 9022 5741 8498 9903 3335 2491 2260 6441 1336 9176 5928 7623 2898 8951 9758 2461 2078 4757 7272 8839 5378 7846 6247 8895 2774 477 8923 9181 7044 283 5126 3395 1642 6106 6524 2635 7351 9139 9967 5878 3881 96 4776 1139 1957 8712 6788 6207 7100 3114 1189 8648 5282 8277 5645 8695 8985 1678 3595 7376 3762 1853 9108 3048 8878 9637 9209 743 7245 348 7752 2048 7944 2153 3733 8796 3719 4943 6628 2769 9580 9599 8303 2528 5952 3069 3584 4612 668 7083 3515 5662 6752 3564 3953 8772 6750 9474 2620 2812 1833 7515 9060 1593 8298 7812 9344 8838 2163 4621 2551 7596 412 1506 556 1513 8590 7790 611 4536 1231 8824 6119 2488 333 1758 3593 7839 4798 4675 2124 1951 7141 864 5858 9776 9742 5957 9543 439 8009 2210 1143 8051 974 1670 2461 9130 1507 4195 9027 8965 5282 8279 266 5881 8518 5883 7377 9949 6515 2268 5951 9831 1733 6454 2342 6656 3150 9981 5916 6327 2882 9640 9914 1314 6673 2971 8858 3332 2650 3832 4356 8509 3872 3740 3682 5929 8815 3783 1083 7194 636 5641 3416 414 36 1451 4072 537 5362 258 7411 9549 2285 9861 8614 7564 284 6736 837 34 3186 4194 4010 9438 3278 4496 6119 3631 1220 4244 650 880 4917 9288 6361 9052 4970 6193 6121 9517 3511 1398 8595 3173 4513 8068 4040 2705 9125 7797 9972 9170 1325 9643 9798 8338 393 1002 2958 555 1360 7290 5371 6346 1034 7447 6230 7099 7117 5508 3185 4316 8205 9319 3490 1468 9700 9039 4158 660 7506 9852 8918 6872 218 2594 7553 3219 7757 4154 7420 4631 8728 8454 3056 7581 8686 3186 3683 7307 488 2634 2682 2010 5422 8614 2006 470 444 4178 7242 588 6090 4188 4652 8086 8421 2180 8703 9040 7999 2062 8512 8603 1059 8154 2130 3406 8650 319 3638 1752 9439 1893 9517 1660 4854 6162 164 600 6396 1810 1233 3264 8969 8419 1774 9060 9143 7982 4911 620 6530 8561 5389 1155 2904 8676 475 4998 9040 7580 8185 9639 189 4864 9113 3545 758 9386 9777 9205 7855 6703 2143 757 6393 825 4629 9802 6294 4928 3615 3153 7895 2351 1942 2439 6661 9209 6 9985 6575 2614 135 4845 6145 9502 1622 6526 5889 8333 807 410 8469 8493 3722 6984 1195 8563 5130 1061 9166 6684 6881 4243 5936 7941 4780 469 4802 7426 9397 2275 3450 2663 7797 2602 7637 7484 8500 9058 8353 1617 4376 1793 6226 3715 2559 8270 588 3149 6579 7960 9436 8778 5386 3010 3506 5273 7166 5922 1328 9517 7965 3779 8071 2512 8219 607 8390 8336 2722 579 8514 2988 2367 8210 485 4453 4947 9999 8209 5719 5316 3634 1167 2191 4016 9979 3932 5439 2211 5181 5846 8415 952 8656 3544 6580 9973 6665 7819 8233 5722 3989 5723 1164 909 7644 787 9670 8099 955 6458 1308 9012 2882 7619 6180 570 577 8028 9960 8184 3771 3288 3748 2785 9128 5097 3502 1814 6401 6954 1164 8793 5181 981 1465 1607 2125 5053 6605 2640 3288 1777 8209 7665 1565 9340 524 9158 4525 3242 5208 6196 4222 7410 482 8129 8372 5595 6180 4071 6077 9271 6817 8488 1866 7675 8702 2795 4206 243 804 5950 1447 1553 846 1493 1614 4974 1400 4783 100 5395 2475 6020 3879 6323 5778 4402 3883 4884 5063 6073 2654 2588 8757 1950 62 2600 3486 2284 6980 7148 644 9886 2931 3821 3837 3237 3569 4255 5065 8813 2005 4321 8907 1009 9254 9066 1818 1233 256 9006 7468 4675 5110 7904 1403 776 2600 9796 2458 6184 4639 106 2663 1137 2553 6107 2664 6420 3564 3837 6436 3759 8239 375 6034 4919 6822 9489 2982 99 137 3215 9270 3461 1981 5294 6261 806 3849 3249 9023 9842 3899 7504 3450 5416 7107 9451 7765 1263 5418 9474 8142 8198 607 8205 9484 5709 4570 2263 3929 1541 8952 2973 6757 5658 2375 1410 6919 8732 4825 2749 9669 3090 4851 5413 1431 6548 8977 8226 1753 1544 3749 2023 7574 8448 9168 6142 1868 7280 7481 1710 180 8840 9310 7745 3209 5961 8412 5475 4849 6724 36 823 9203 4112 5682 543 232 7113 8378 1637 8628 4025 3161 4749 9002 9225 3953 5756 985 5477 9052 6321 4079 8644 6097 1026 6685 7671 8809 851 7025 8320 111 5937 9827 5879 6573 7391 3342 6467 1927 327 6005 5711 1481 861 3199 3551 1005 8621 2341 3397 5779 9879 4517 9619 4615 9575 2409 7492 7097 5689 6313 9189 3720 6910 297 2639 7418 9764 3202 1414 5811 2099 3956 6835 817 233 7662 6026 2665 5274 1016 7394 6775 5909 2488 152 9628 5281 5194 8623 4054 3016 9764 7413 4521 1136 653 1110 4833 4084 6025 8046 4766 1461 6432 2567 7257 271 9633 6256 8119 6362 146 2334 4015 8451 7245 1685 867 736 4267 9899 6464 7807 1095 7269 8295 7851 342 2000 6885 1947 6715 4835 9880 1681 4857 4233 3751 8650 8738 7096 2344 1064 1911 394 9996 622 2520 6991 7273 6731 6403 7289 6706 9077 3793 9381 3371 7677 7811 6728 710 4645 9577 2478 8740 108 7925 692 4893 4056 5458 974 +1000 +8533 6754 3569 3442 1264 3094 9515 6596 6176 2091 6143 9971 3260 2550 2872 4799 5534 6853 8734 6504 1715 1000 3084 3570 6189 4326 7868 7356 1882 514 3997 5301 5158 5911 1762 7627 7254 8405 9634 3208 4066 7427 9442 5869 702 7312 8992 9802 9405 3122 4722 85 8458 2732 9849 7194 6863 7371 4748 2170 4801 6709 2673 7539 1614 3386 8138 825 5995 3528 2240 2782 1940 6557 6412 7745 1734 4966 7489 7472 5558 4907 5919 1074 1488 537 205 937 1586 135 8727 3011 2255 3341 9091 8002 972 8739 2765 7995 774 4891 6901 6569 40 993 1773 9825 6523 9016 6372 1881 5115 8638 6564 1396 3946 7546 43 7416 6191 1012 6157 7747 6838 5493 4084 7620 4256 8053 7069 297 682 351 3140 1969 9917 942 4476 4960 9701 5317 9361 2257 1904 2623 2998 4135 9624 9495 2439 2788 208 7764 6155 6721 3280 2228 7427 9323 2696 8994 429 6219 319 3287 7729 3333 9485 8323 6670 915 1578 5506 2955 8242 892 5654 7641 5578 7880 7580 7208 8840 8362 5348 597 5181 9791 2598 3385 9743 1345 6313 9699 5834 3309 3249 5036 4682 1591 1346 1434 3098 6738 1843 5994 3623 8331 5635 7272 4142 9474 3686 2902 4552 8143 2176 9748 3501 3870 8996 8377 8025 5298 8256 2388 4114 5289 634 1085 5844 9933 9735 9848 7610 7539 4916 7443 272 4430 3810 9023 4037 1799 6602 9615 2160 8769 5482 4397 4321 2981 7231 8236 4670 2623 4931 225 8386 4138 7544 2775 7949 4425 1272 4179 4002 6316 1711 8897 3677 5001 3588 9549 7775 37 2069 9044 7315 4502 7023 3585 7757 1298 1013 7334 9325 6546 4361 9226 8965 9179 7494 1755 6968 8455 7605 6752 6874 6297 6992 2465 4060 4254 4997 8195 5094 4776 7899 8292 8918 3382 4256 7016 3011 6476 2120 2478 7349 476 8313 4131 3977 5504 276 3966 106 6201 683 2046 6210 6426 2557 7486 5273 7335 4072 5923 2778 7284 5011 1017 4794 8889 4605 9330 6328 7935 8170 5078 2080 4199 1593 6178 9094 6916 4471 636 343 4153 856 3597 7060 8306 4868 500 9292 1252 9996 8582 3016 5499 577 6660 4009 6021 4158 2256 7192 9300 4665 3566 3332 87 4600 4348 1134 11 7876 9088 8995 390 2949 6671 4884 5509 3757 578 8909 369 3926 1144 1921 2062 8466 6900 8470 196 8023 2487 4578 3335 7275 3766 4882 8399 3773 6256 6831 5845 9805 4687 8101 6885 9770 78 4568 2197 8130 8952 7464 6498 1899 9458 6111 3114 551 401 2459 4971 4466 8701 6184 5665 580 4731 3261 3998 1878 7483 6694 1899 8312 6225 9657 9867 1399 3019 5759 2385 6816 918 3497 2032 7525 2192 2624 9578 3003 9717 3315 1361 3949 3410 9267 311 9937 5394 3351 8597 673 5385 9404 4022 3992 9658 7518 4128 6904 6020 3198 5543 183 8185 8450 4936 1948 895 6158 3878 4844 2048 6896 7943 241 2923 7017 7844 5202 7294 6460 5546 1798 7556 5799 6298 4288 6754 9244 7441 316 458 8451 3689 2746 4644 9109 5807 9629 2394 5059 2470 164 5590 3894 5762 7210 3840 7789 626 5949 4319 7016 40 5148 5923 9917 2578 3635 106 6264 8051 5121 3274 6401 1917 2394 8283 1981 7177 6889 2714 6112 7265 5895 8682 7988 5001 9665 8190 504 5525 5036 441 1161 1476 6165 5391 4544 2069 3648 1242 1918 5649 9785 1545 3722 2089 269 1501 2201 1378 8288 5041 1193 8622 5081 9107 9058 6566 4126 1376 6940 267 1885 3531 2371 2027 905 3867 3540 2224 3152 1608 7194 6885 1385 928 8943 8878 807 9322 613 8934 2934 4450 7894 95 0 4393 3177 1021 8373 8212 1832 7575 8656 170 5659 5204 9366 7623 2188 1422 5134 3786 727 7788 5463 27 9311 857 4644 819 2971 6454 4809 1037 9158 219 9861 1422 2303 6366 1490 1471 1472 1594 8182 7648 2192 8648 8508 1103 3492 1801 4303 1248 8840 1380 2960 5768 4221 9544 824 4748 5677 6141 671 1199 4096 7368 2403 7094 6273 4589 1964 9134 2333 7909 7640 6132 9924 6204 9263 9895 233 7354 16 3473 442 3453 6745 4291 5224 5200 8389 2462 6198 1900 562 9626 1429 592 1943 5728 2417 670 6024 9146 6209 1253 6469 4437 5175 7902 9101 4174 9227 2976 2719 1324 9634 4258 5837 5261 9463 4585 6024 2195 7299 2327 7947 1161 5010 8900 6461 3132 6219 5283 6635 3626 9301 5426 9323 9507 7233 3796 1717 8167 1215 9446 7959 8178 7886 1571 966 7509 4502 8875 799 3444 8187 8467 3188 7376 5437 3379 3506 3129 1468 4592 4391 5497 6601 1049 7075 8841 2342 5422 1858 5464 5703 8309 3859 1198 3534 5240 3549 6660 578 5985 2972 5925 9003 9004 3665 9290 1749 9956 5481 8188 4601 4792 4152 8623 7145 5397 6646 6771 9934 237 5917 7355 4355 3098 8350 8091 4967 7724 1201 7276 5730 1772 9320 5308 1223 1324 500 6554 3543 1147 1685 5808 12 3753 46 4106 879 7306 326 4940 477 3485 1603 6674 5532 8738 7750 9382 3533 6683 7098 4481 7692 5003 9164 1914 4885 5960 7929 5032 257 1962 7621 467 6110 569 6822 9142 2227 9956 2564 133 5869 1327 4512 1899 9981 1740 8202 3321 9201 7134 7774 5248 4510 5177 6392 9068 776 7008 9752 813 8752 6439 6067 4052 7168 1335 1157 8475 2855 1431 9687 8345 1296 1284 586 5138 6542 9435 537 6319 7624 2987 4765 7700 7898 382 5432 9807 1336 2617 924 7638 8388 8503 9171 5449 6490 9798 710 9288 55 8744 4623 2905 8948 3622 2320 9765 8116 8567 4356 2746 7600 7130 4538 9025 7440 7202 8409 6932 3737 6273 1138 2280 1746 810 4015 378 5847 952 2061 290 9943 6242 8766 1722 8901 799 2600 8049 9638 5658 6032 7290 6118 +1000 +1718 7341 909 1008 9966 1831 5379 1159 5453 9047 1023 6237 7693 9876 7541 1521 4009 6746 6768 8597 3091 4704 907 6946 7424 4935 4778 3359 1167 9940 914 6369 5989 5361 1203 2175 7431 4378 6787 6006 5484 3255 4180 1282 8119 6199 419 3150 2352 6625 7150 9526 1434 3607 4061 3795 6417 5950 6235 9276 101 9604 3164 2996 2868 3964 150 7882 3418 1967 6924 874 9868 3967 4483 1394 5058 8026 7174 8911 3835 5003 2816 6971 6868 1380 6324 4522 9677 4389 3069 3313 2093 9614 9352 8668 1506 813 7350 519 3680 3582 1448 8060 1882 7485 2075 7585 9200 5146 1598 2387 5209 647 8219 1472 932 9067 5781 855 9373 8880 2651 2852 7831 4253 7281 9601 328 4211 4850 4148 3625 1950 5787 7099 107 5879 6662 5497 5696 681 1644 5145 743 523 1240 5108 9994 5675 2532 1954 33 8235 7847 3963 3892 2068 3885 8518 1232 3843 3224 7411 973 8239 4546 7310 2758 4041 624 9165 2229 422 6191 4675 8866 5325 4630 773 5898 1970 7554 544 6942 8751 4297 2882 8752 7682 7985 6054 3306 9233 1232 6917 9477 9285 8241 9724 9584 2677 1780 113 7975 8542 9596 9238 8103 4364 1706 4319 9783 265 7804 1835 2241 6484 4464 6215 1540 6464 6365 8687 7875 727 9653 4519 863 8066 1588 8191 8234 8072 214 6212 4469 2961 7534 3767 5973 1695 2723 6600 2448 3725 421 2137 3104 3897 3326 54 6881 949 1094 4519 1310 979 7724 7499 4588 7061 1738 4529 63 8189 1759 8268 5851 7080 8336 3657 3961 3190 5166 8855 9190 3967 4023 380 9667 6557 2540 2824 6893 5294 8717 8921 833 6130 7319 6313 5774 7839 6734 7049 7617 8623 9032 2146 5762 4613 6214 5504 8334 5123 4046 5465 9815 9916 655 9343 1622 1732 9841 1535 7650 7944 6641 225 9895 6644 1850 8703 7916 3897 9805 2313 4357 2396 3732 6827 7572 5830 2021 186 5372 8367 173 1404 704 4207 3494 4827 9976 4043 3194 7460 4113 6383 4013 7785 1101 5449 4466 3754 2996 5415 5031 8651 2469 839 5751 8322 6126 5226 5834 987 5304 1484 115 2776 9842 9540 815 5245 9777 50 5053 7874 5545 7378 9385 9522 3353 9071 1501 7094 2271 728 3606 600 395 6750 670 6030 2711 961 2074 1874 345 2178 813 2251 1223 8819 645 7562 8958 1923 7935 4971 5708 3247 4215 3237 5046 7404 7454 7225 8080 2272 4679 1537 1971 5675 9984 7803 5797 2081 6670 8678 2670 6208 7340 4973 4058 7745 4525 4784 9580 113 8397 3723 3868 321 5390 267 5876 2494 7407 2754 6445 7558 3193 8878 7396 9848 2295 1796 920 912 7694 8090 6101 7413 112 8538 7244 4418 6115 1727 1327 2610 8209 518 4215 3710 8428 2632 6336 2585 8409 3061 3484 1698 5150 116 6116 3626 6742 6426 188 2007 8926 3286 5510 3369 9306 5962 7084 996 3936 2915 2703 6486 4406 1954 4415 4142 8514 1021 7893 7574 2557 7900 2993 1516 4501 7429 8241 269 9001 9766 6121 7286 8117 2430 5676 6138 187 5508 7187 2933 8357 9374 5115 1553 1083 7546 5158 2170 1057 1324 8423 8013 1088 5548 4288 8998 5303 2993 1304 3657 4945 7395 1995 2343 8136 4867 5984 6474 6185 6064 7288 8679 3139 356 9369 7383 3092 7600 6503 8508 8565 9696 42 7359 8915 7601 226 3100 3654 6929 482 254 3478 7003 5550 8029 3791 7594 8638 6538 6587 4444 7470 5990 9150 6957 4914 8758 2034 9390 2860 4862 8301 92 7528 6282 5727 6492 9587 2435 5367 8948 226 7351 6633 7239 3688 8006 4256 8023 4531 7869 398 7557 8458 3904 8713 2455 3587 3600 4198 6918 4614 3393 7947 1823 2700 2859 3659 3899 3507 2982 1898 6300 4852 3957 7684 9524 4073 2317 6880 1737 6148 6856 8598 2936 7053 2685 4523 6376 6550 2982 2379 772 5635 2227 309 1294 2190 496 6413 584 4219 4500 9693 514 1529 9794 3317 2994 9350 9235 2158 4403 4592 7863 4376 674 4958 4405 6794 708 2278 1393 5340 2078 3770 5149 749 4529 9492 6372 3079 7373 8555 1859 2157 6408 8621 1655 7699 3949 5221 5467 9060 6952 915 447 3966 4692 8173 8579 4765 2566 4111 47 2701 127 2401 8201 6866 4375 8654 7303 1561 90 6840 9383 7870 2574 3958 4342 4460 258 1199 2211 5207 9172 3155 3929 4045 8403 5089 6017 5 5183 8351 3964 3942 6987 4847 4074 526 6511 3481 5086 7133 280 553 1630 4659 3046 3309 9680 5651 6636 2377 6958 8817 3733 6346 8876 4699 8455 9870 6899 8413 7796 6181 2538 9504 7753 3800 459 3340 1423 1663 6908 3056 9665 1145 5429 9009 4294 8404 3248 1667 5410 6089 4754 1408 9160 2040 6481 2333 7224 5813 8445 7185 3897 9478 5769 6225 2838 3860 4712 1030 6011 5594 5638 994 7048 482 8877 3223 7725 4781 5935 9947 3913 6913 390 8628 891 1391 2765 312 1364 7678 6999 5237 3110 7178 161 6661 6712 7952 2996 2548 1454 4925 2715 4037 7527 1506 5560 520 9213 5146 6673 7027 4237 2823 7549 4871 2262 3282 9046 1489 4918 459 9963 2816 1386 1857 9118 175 3526 2533 8758 6928 5090 4153 1851 4182 6172 1748 5192 7305 6331 7431 2619 5747 9961 7884 828 8897 6281 3299 6747 8324 9826 3815 515 2325 9872 4384 1045 1845 5335 7468 7067 8894 3128 4733 4350 5560 2866 6834 3211 4999 5233 8772 283 9810 6303 2954 4009 2414 5682 6013 8716 8252 7117 1144 4066 9327 6022 909 1076 7254 3783 9378 3363 7021 9612 6204 9058 7969 3725 6089 6341 9408 5616 1547 8030 6067 7819 3656 9604 2489 2406 2365 5959 9149 2921 6913 5723 3456 1935 2810 3674 5881 9597 7679 4607 4990 8766 6023 2417 3894 2590 5421 8132 9179 5161 +1000 +5668 4781 2430 5412 7440 4475 6428 7211 6553 5820 9554 9137 8909 7486 6946 3180 849 1894 5666 168 9857 1767 1801 254 2928 6961 7507 2126 675 9768 3906 8328 7211 8336 8119 6091 9068 7870 9105 9548 2719 7174 60 7544 4378 5079 2766 4239 9512 8058 9755 5872 3310 4120 7226 4694 6227 106 1630 1145 2366 9415 5777 2161 7644 8476 4335 6776 5018 1495 4901 5794 5188 1776 1798 6652 435 3612 3508 6689 3256 2966 118 2234 9121 869 7387 4097 8097 449 5895 5817 5274 7316 8561 3302 3876 2572 8547 6413 4845 2786 4350 2893 5733 1253 7952 8078 8045 770 8144 2278 4211 9188 4242 4363 8056 1780 1411 6522 8465 3949 7018 3305 9232 2180 4429 9831 9732 6179 6279 2782 3998 6070 1779 4576 3945 1465 8223 1225 6813 9863 4935 5635 767 2581 4220 2185 2760 232 8873 9647 276 4370 4594 5778 268 2115 2956 4120 1396 3155 6514 8522 5869 7022 3626 2913 1565 338 4267 7823 1203 1240 1901 3026 66 6875 6571 8602 4822 6450 6876 5292 9993 2215 701 4903 2927 3821 7444 9160 126 7863 8049 3747 9716 7612 1013 7533 9666 7673 8794 9382 8857 2337 6520 9913 3992 7159 6025 9023 1165 1256 453 6294 8316 1741 1560 4191 9553 2863 9366 5906 3373 7542 8315 7295 1789 3635 7738 7905 7481 6602 2967 6428 3981 4803 8797 2996 5569 2098 1301 681 1212 7956 7780 5189 5265 6024 6210 9008 5903 8812 8376 8309 2245 494 9550 9955 8266 4559 2696 7490 5623 974 5354 7300 1627 6297 4508 5730 8143 4399 1906 4417 7639 7749 5770 4970 7707 2966 2756 126 3638 4955 8000 8476 2974 4167 4888 5016 5756 8368 2522 6393 4469 3657 7636 2465 2883 3822 477 2537 6074 2551 6767 1890 7593 6170 2399 4949 5921 2150 4547 4967 9403 6535 1487 1388 2247 3563 2008 1329 1339 2371 1073 4494 1494 6546 4798 9804 9724 7132 8334 6241 8561 6697 4955 3088 1330 1884 5870 3556 3097 3102 1866 8639 6036 4658 6186 7466 1032 7717 3224 1318 4446 4328 6393 6894 4378 2143 5205 984 8186 1631 2499 6913 3619 7818 9559 3395 6840 1723 5650 7832 4332 9219 7885 8506 9709 9056 3817 7805 8311 6215 5825 2972 7673 6873 5513 4110 5398 3164 8756 3240 6556 7645 6328 6963 2370 9236 285 80 9594 3691 3845 3442 7836 7001 7483 9368 3006 5823 510 9691 5236 8786 7991 6661 3292 520 5744 7266 2480 8961 7947 6760 575 3806 6013 8786 9889 7622 5993 6726 9587 3252 9386 5573 4904 8911 7387 1102 6700 4426 8966 6683 8962 14 789 9837 5344 3451 7341 8268 4410 306 9931 8379 1903 4516 3284 974 9321 6787 4575 6002 6744 8616 9066 5939 248 3703 5201 300 4942 9378 1551 8018 2939 7371 1397 8848 6572 6037 9870 3735 5340 9806 3011 8372 4155 2369 602 7576 5025 9900 1068 7201 6053 5070 5077 8243 6108 8016 2775 4716 7973 1286 7486 2580 1967 7668 8412 9185 7862 6462 590 7431 1937 9942 2203 6378 9523 4581 5036 2761 5707 4090 2181 7019 7022 7161 4039 7430 1840 7535 3841 8540 512 2978 1530 9633 2365 4306 703 4861 4779 6406 9784 8135 3686 2311 84 3900 4192 9317 977 5262 5904 6580 4302 618 4731 2777 7980 8727 1804 2439 7382 3725 8807 2292 5791 8377 567 2141 371 6776 7847 82 4928 1116 908 1423 5072 7813 7043 2860 4823 650 1414 8129 3160 9687 2288 2681 1138 3449 3263 5388 5488 6571 7936 5256 2293 355 1022 992 8462 2396 7564 4110 9096 2424 9377 2652 2240 7128 6125 9334 7838 3388 9360 3050 4237 3081 9438 6248 934 9322 208 1885 621 5881 7105 8444 9960 6063 1602 1738 3910 4979 1265 5945 7624 8370 5006 744 6763 2263 9938 8827 3296 9681 5864 8067 2087 5487 7093 4900 7920 1741 4216 3381 4310 1123 2656 2334 6159 324 1792 3057 6013 1655 7927 4496 5837 9034 1571 9634 5 7918 9333 6514 8864 3767 2657 5355 1021 7112 7531 7031 4617 3842 7716 8375 1130 3221 429 5489 7109 9889 7711 4789 387 7191 5865 3938 2497 5119 6826 9208 6989 1785 1873 1196 6705 9530 5872 3205 729 5197 1618 3108 6325 5806 8569 7780 9963 9164 559 2685 4347 3016 7153 1952 5922 4926 8425 8523 3192 3011 3756 4824 1280 8366 6516 6230 1365 8670 600 7159 5909 4157 5433 1798 2036 146 4458 6287 1937 3279 488 3463 6490 1998 732 1540 4775 3290 4224 9680 4336 6642 8582 375 2191 3979 2309 6227 4313 7553 5808 4891 2623 9587 1988 4739 8107 584 9647 2638 4846 5130 200 3319 3741 5163 6977 3757 7838 8249 4631 8035 1046 3705 5103 6987 6917 2699 877 3384 9244 1875 6792 8390 9681 1868 2469 5232 2700 8100 9877 1599 6503 9638 3116 9911 5224 702 2805 4220 3876 2444 4253 8822 682 1814 5329 4772 5220 1364 4880 3956 1640 1361 476 8221 9175 1584 4733 1979 5272 194 7141 3471 6783 7327 6625 1772 1170 3420 1144 965 4436 7779 599 4985 6524 3113 4423 4970 9040 7116 2868 8797 986 6789 4755 9280 5410 6101 6497 9687 9081 3156 1743 8485 2778 2230 2083 478 4162 813 3907 601 4419 9994 1449 8312 8993 5404 9331 7844 702 3504 6056 7582 981 6034 8614 4721 9981 1504 7501 17 894 9898 6872 9554 2064 6166 5151 1426 216 1895 3244 7872 9396 9779 7858 4518 5746 9414 4639 9015 9538 386 8255 7343 8575 4721 7022 6747 6146 7344 3540 150 4404 8934 2136 9789 4625 2394 2576 1871 333 9896 7836 2234 3025 1820 7793 3925 278 8996 5985 2921 5712 9316 4852 9280 8755 7080 4059 7270 8185 7228 5266 1516 1770 3182 4338 4712 7715 3050 842 2042 9002 5017 5745 8050 6177 4755 2071 7131 7218 8076 +1000 +5322 7326 1021 6520 3162 3239 9648 3070 2253 3791 8385 1869 8617 2271 8318 7380 6365 1239 545 4286 541 7026 5922 6601 3809 8591 172 5553 1030 1177 9064 4517 5460 2405 9400 2513 3438 6501 2250 2732 5972 3077 8266 4363 2894 3610 1605 9240 5554 2322 7829 8892 8405 1275 2911 9628 3919 6598 4729 7968 3038 5681 9359 2517 7242 9578 1018 6750 9647 9836 4294 9414 8303 1553 6112 934 6866 50 326 7647 3761 6657 7288 8212 2077 8780 1403 2183 9247 4542 3591 2605 4258 2340 8968 8041 7906 9240 9972 7010 8359 3718 7488 249 603 226 7773 6281 7514 5683 7066 6791 6182 4457 5841 9546 9003 2367 2889 9960 5381 5240 3759 7037 4398 5323 9411 3562 6488 9345 9849 6307 1909 1662 4534 3230 7510 9678 4337 7811 1292 4639 2415 4716 649 8264 9862 5905 6447 751 8430 3351 1095 5458 493 189 8859 6281 7823 9120 5468 1827 2386 3323 7900 9413 2093 67 3746 8209 1219 5503 2772 5782 7040 798 7843 6714 7922 5862 2148 8200 2311 7901 4528 8986 7850 7828 7939 2429 1134 8155 7673 1945 7368 9108 9027 6326 8428 7983 25 2757 7559 1685 8812 5348 7967 9009 1154 128 1938 7475 5642 6901 7698 5950 5713 5484 5496 63 1454 2636 8927 133 7938 728 6918 7103 1728 6767 5259 9694 9299 2074 1667 2464 4420 8728 9599 6838 7233 2958 5155 2817 4113 4812 5343 6709 8819 7970 8602 5803 3173 9243 6238 3129 3926 1102 3328 7654 1878 490 1723 4866 9436 7833 3537 9622 9655 9991 5225 7786 1457 9633 4801 3678 5207 9322 3564 7792 6127 4619 5446 2665 2717 806 1305 9889 7015 6371 5510 9878 7153 9406 7145 4932 8308 4831 2056 7704 2585 5648 5020 3132 9245 6590 5627 9829 4354 6899 2742 9962 3874 6360 268 484 4653 1743 5081 4784 4801 8896 459 9703 6440 1463 805 8784 9185 1001 8147 2699 1077 5715 7839 7929 298 3558 5094 7929 9435 3995 2853 1448 1367 578 6479 4537 9458 58 9414 435 2471 5042 1375 156 4443 9794 3803 2003 5694 5156 5051 9024 4404 2647 8839 3427 681 6195 8871 460 474 1202 5717 8220 8142 5379 9868 8350 2314 1851 2326 2001 3518 8374 8436 8150 5773 3316 6272 8698 4852 8005 4827 5747 8129 2505 2260 9058 6200 1335 827 6402 9627 5650 3177 7863 6987 1700 7928 5321 5846 2339 8345 3871 1704 7566 963 740 9289 5692 2627 5223 8094 7129 3679 2963 5421 1560 734 4052 720 8323 7817 5503 3235 9476 116 4898 639 3974 7005 1825 4325 9806 3948 8721 1922 3064 4430 9154 9818 141 9561 9139 6123 3703 6922 2583 9808 3211 2623 4627 1626 4456 9273 345 7232 6549 9746 9573 5300 813 537 8159 6670 5336 8462 2390 331 6547 3596 4807 2624 2980 3690 2453 1583 7475 7938 1993 9750 6888 2145 670 8619 717 2958 5353 3934 5891 3933 9167 6647 3718 8420 9469 777 3414 4133 8931 4683 7936 2815 7563 6752 1447 7199 3958 1431 5152 5826 6103 5820 420 9141 3111 9035 5991 3621 4831 5432 8446 2386 1320 2739 5185 3964 7748 4141 1753 5757 6216 3154 996 6371 3057 7373 135 395 6939 4540 8626 8315 5338 2815 7122 9741 9794 6031 7993 8765 8087 1750 7486 5655 4981 7166 1334 3004 9850 7981 9215 996 7358 2406 4957 5907 479 9110 3110 3980 6802 3584 2060 3589 1887 2000 2775 4926 5772 9497 2516 8299 7653 8097 5443 2833 2903 3186 5362 5756 218 6183 4647 3792 3162 5255 1319 78 8257 7521 5435 7065 1458 1591 6104 8799 1449 6808 7777 7439 5780 1675 9368 5681 1917 3535 6717 2748 7613 6947 5867 710 6082 202 9820 7164 4299 5832 81 5060 2310 3313 9077 287 1690 1298 2760 6095 2762 1960 3920 7443 4232 675 1348 3618 3193 5777 8685 9296 6544 1648 5933 5974 4217 7780 7489 1375 9502 4989 3570 4437 474 6239 3921 5065 7832 9416 3100 2635 1146 5371 2525 6338 2107 6880 8992 2131 9392 5873 693 7875 8226 6117 1685 9735 4290 5303 742 9601 4993 3292 692 1686 2529 9221 723 9726 7071 1476 8413 256 872 7508 7744 2949 131 3178 7763 8962 3433 7874 9060 101 1295 4380 6234 7093 1320 4259 5571 6773 9112 324 1476 7116 7534 8360 1766 9780 3609 5603 9638 8624 1829 2799 5438 53 5463 7006 194 2452 44 1910 1055 2684 1138 4264 2077 7665 6798 4627 3925 6008 3965 8850 7358 393 7211 4767 6027 5958 7679 3728 4218 9221 7544 5251 4169 4212 8328 1997 8957 3798 4964 5763 9063 5700 8079 9296 9282 9332 3765 8533 3306 8575 6814 1408 6404 1451 2648 1158 3860 2781 8763 4078 6651 6870 2777 3097 2109 7115 3264 6344 5092 4823 2014 9958 5072 2437 6109 2424 36 8689 9770 4327 1743 7256 4032 523 9301 5096 6846 1207 7009 3532 4955 3407 8833 151 7424 8579 3932 6054 4581 316 3913 7775 6372 1644 4454 9820 9151 1125 2187 7863 3114 1131 8239 5905 8853 3226 9177 6523 6529 8144 6173 6662 8621 7088 6723 4985 1764 6561 1408 2434 5250 9147 57 1349 1638 3931 1086 3227 9545 6078 3389 8769 1516 2256 4466 4019 806 8503 7185 9247 9186 7676 681 8001 1057 2444 9004 9923 9647 8082 1575 9305 6409 889 1459 9910 9415 9210 2408 9039 4161 4403 7919 3245 748 4506 3393 8704 2244 9480 1135 7404 59 1009 2935 3821 8481 7545 9795 4984 3403 9933 5620 5418 1673 9412 6436 7852 224 822 9092 1721 2784 4763 2248 3990 8446 1204 4786 2961 5162 3501 8256 5501 6574 5539 9677 2697 9922 3383 1169 7062 491 6937 4142 4169 283 1188 8516 7504 2160 3732 1291 5295 4220 8803 1344 6763 2570 2723 6186 9745 2820 8506 7966 2265 4735 6750 4146 4110 1306 +1000 +9300 5560 8334 5223 178 2871 4630 9326 6800 1152 4230 6743 3185 7889 5982 3120 5310 9883 4959 823 521 7496 5662 1757 9382 4322 7287 1742 2088 889 2630 778 8268 7943 5040 9438 8358 5361 4329 3080 2288 6668 2861 3628 6687 4883 7278 6597 1654 734 6043 3547 7351 9199 9243 2486 7744 6427 4464 9969 1457 1676 8203 1823 1783 6219 8217 5493 3329 7509 7934 202 7623 7033 3102 8684 9198 7257 9786 8082 9577 967 1162 9893 8114 7911 851 7447 9811 6293 6252 7448 1347 1 7526 4021 3584 6714 8382 4791 6658 6473 2413 2228 4750 9833 1007 5383 2737 5140 2528 6531 5025 1828 8302 928 839 9064 2864 7090 2518 9484 1477 880 7819 5196 4765 7604 4304 3303 8291 36 3535 272 7702 4941 1196 6847 4009 8307 1328 530 7494 5753 3807 1053 4472 9127 9869 8670 7624 5588 2598 5519 9466 8723 8125 4326 4378 4120 8171 4393 8728 1585 4991 8350 4260 6402 5152 3620 1625 7349 3025 3331 2015 5167 2392 5448 8855 7905 5215 5430 5285 1712 1367 3149 8291 5373 2526 3190 9210 8976 2574 4344 9806 5246 9876 9432 5518 4554 1113 7779 8789 5501 1855 194 5838 7007 3844 9654 6366 1168 4402 3725 5134 7026 9345 5843 1045 1726 5659 4239 6903 9664 5241 3562 50 7151 2576 4995 6918 988 4531 5535 173 9036 9644 8287 7290 9644 5789 445 7251 7265 312 4102 8442 6354 6716 6249 826 7170 7589 4019 9333 2946 6981 4899 4107 5075 2842 6518 6770 421 4169 8477 1160 8043 9772 2398 7043 2110 3591 5275 9778 6114 2712 1554 8725 5971 9249 1237 1627 469 7016 4602 2074 5399 2572 4298 1029 6683 3348 3212 5955 2543 7102 1514 66 3161 2436 9964 9116 8747 8816 8003 2233 344 181 4312 354 3973 3773 3974 9198 8435 703 2765 8307 8755 1362 8262 1606 9904 7643 6653 5682 2421 250 6706 9861 2338 9029 1559 2972 2584 4410 5229 3892 8828 1064 103 2974 8258 8030 4739 4568 7814 6803 5330 866 1741 4072 8201 9149 313 1683 4519 3375 7858 3994 2264 2690 8163 4855 4032 1140 1790 2451 7601 9864 9361 5068 9019 438 1263 9586 1495 7045 5774 1411 5048 9172 2609 750 4247 9372 9905 1449 1404 7393 1213 2400 6317 4448 7241 9943 3520 3275 4062 3238 3637 7069 3176 3342 2111 3439 9111 7697 9000 5848 1519 8520 4110 5646 1572 8756 7029 3830 3922 7588 6985 8287 321 7033 7421 3886 5777 147 563 6787 6802 508 3212 516 3056 9680 8599 2382 1135 2056 248 466 2832 710 2909 4638 1775 353 8895 9225 7434 1838 1269 12 1954 5626 5495 9522 9936 6179 8698 2342 6687 1163 437 7459 938 9837 5781 4637 8744 83 3988 661 6933 1675 4869 8816 2927 83 5182 1418 9279 2576 6837 5327 4282 3436 7047 7481 4977 2813 5239 137 9333 3054 4010 5079 8658 7969 6595 2154 5421 4526 130 4721 7850 6069 7646 5697 6086 5001 5713 93 5333 5192 9617 6864 9332 4166 2979 5665 6388 9578 2981 4533 3737 865 226 1999 4965 8469 1547 5115 2603 1556 7925 4888 8522 7330 3594 880 940 8258 8576 5030 6063 8086 4483 9580 8138 2408 3454 1461 8801 5914 5089 3739 6837 7647 6562 2745 8586 7821 2661 8374 5809 799 2603 4441 5605 9190 1485 9886 2499 6268 5879 8495 5523 839 702 947 1543 2489 7629 2487 9282 6079 5999 6986 7110 99 8125 833 682 2442 7388 9473 541 6740 2515 1442 2963 2837 9491 9217 2272 8144 2744 452 4071 8052 2047 5781 9774 9410 2261 7834 7753 5704 2785 8450 2529 1625 5383 9024 9670 4162 7346 2629 2757 8532 1281 4007 4779 9053 3837 1162 9408 6086 7492 3392 4575 4723 5749 2100 9079 4284 8800 5123 3732 7009 8689 7998 826 3343 3146 4146 3075 5457 692 3891 5138 7641 6864 2638 5906 8918 4499 1696 1411 6633 7807 9130 6751 686 7629 8665 7414 6144 799 4036 5046 8776 4658 8544 5223 2540 9918 6923 8297 1834 8440 784 8099 2967 3285 1222 1585 5779 4026 936 6724 9868 5242 4356 3526 5881 2094 827 3484 969 3063 1984 9556 4325 3239 9441 9664 3603 8656 9823 64 2851 1054 4711 2530 1438 7103 2727 3693 5132 944 2654 2998 9991 5806 6825 994 7562 7539 7074 2186 1944 444 8648 1990 3816 5521 622 2623 333 907 661 7640 7950 6553 8778 7926 6153 2903 2122 5606 5655 7191 9359 4660 3727 8134 1948 70 7008 8581 9350 7306 5394 6151 3831 7746 7533 4437 9165 4442 7887 3856 3618 5309 764 477 1330 4583 2481 2458 8352 4543 9578 8789 1957 7107 4433 672 1824 1876 4398 3987 2453 2581 6735 6697 9779 6743 8717 3169 6953 1077 595 4624 9744 9433 6141 3221 1509 5277 3981 3453 5180 3473 9393 2817 1105 8980 400 4050 66 5321 3582 4740 2 9258 1344 973 7991 4085 244 6480 7481 2028 9297 3520 9496 5159 5977 9281 3409 4016 7793 9668 4800 76 9654 5412 8945 319 2009 558 9553 28 3553 9213 4161 9995 9018 7901 6910 1215 5362 9880 1602 2809 3900 4274 8859 9516 1977 6777 8019 1383 7364 7389 9083 1203 8707 7778 4536 1023 6828 9006 2066 8725 9235 118 6241 9731 4271 8598 794 2795 1095 8169 8937 6331 3764 4672 4188 9926 8888 1430 9723 2225 9405 9834 3588 2179 6498 5316 3796 5713 5441 1302 3051 1790 9728 1140 9466 493 1845 3854 5555 8019 3818 8242 7083 2458 6640 6877 6636 6547 3206 3660 2239 3048 2154 713 4965 839 377 9643 6400 2617 9777 1689 6584 4959 2816 1561 2650 4778 6715 5657 1448 6077 1969 6919 2168 3388 678 9733 4604 9424 2546 2671 9709 414 4980 8014 8838 3395 957 3497 5849 192 3911 9328 4914 7625 7820 244 2267 7111 +1000 +5199 5887 696 2671 3566 4760 1358 5893 2987 3413 8983 6520 9458 7354 3002 4772 1186 7792 1963 7168 6100 9462 7093 5730 9653 4163 4829 4602 4625 6237 3226 5811 1700 39 5032 8622 2522 8795 345 6220 7873 595 7543 1628 8669 5743 9717 1406 3907 5861 5336 4542 7008 2172 6212 9519 3337 7112 7643 1808 2930 776 2432 3308 6431 8355 8746 4532 3242 8272 5477 3120 3897 1893 7962 8014 4009 5387 9084 2537 6569 7396 9983 7806 7964 7534 2448 7036 2612 8365 3903 8673 2622 1469 3855 1298 2324 7815 4782 4345 5065 9530 2150 511 9342 5479 2708 8035 8269 2089 6513 4528 5740 2418 5175 4061 8083 5942 8919 2483 7741 9391 5205 4688 4777 2841 4965 7575 6995 9811 6056 4379 3057 4188 5501 6163 6898 361 5524 4374 1575 5021 1817 2070 7921 3906 6424 4241 1161 2594 821 9860 7737 8930 337 3297 351 1557 1268 6779 4837 5177 2543 4997 2644 2447 4616 8536 7586 9573 7593 6240 7739 3961 2279 7040 8686 8712 4204 9985 4280 7333 7021 5206 2210 8611 195 5027 629 6188 9326 8565 6207 8245 5468 9667 8179 9836 2427 248 191 6274 8337 1845 9178 9202 1681 6207 9361 9639 3169 8393 7511 3036 515 1579 5203 3444 7300 4688 8594 8988 9787 1650 5310 6341 4818 669 9977 8827 2173 4377 8001 8801 7712 746 8657 5446 4319 1183 2412 7075 6788 6853 6267 3132 2680 8255 880 4071 4309 5680 5174 998 1750 3994 9214 6456 1747 2199 8436 5307 676 5545 9690 8058 8756 371 8317 8064 1734 6260 328 7838 8146 5966 7171 1614 6171 7992 3701 8469 164 9669 4149 4476 4769 9147 1923 5222 9191 7092 8178 4645 1038 5985 5649 2928 2460 3015 9394 5410 688 6193 5448 2922 7977 811 2648 3458 5520 6566 1462 2229 4121 3424 74 9497 5580 686 4470 5891 1770 9661 4134 6449 1837 6167 4527 9513 3529 494 9214 3994 9659 3870 6763 9158 8401 231 1829 5897 7623 5468 5278 723 9240 1877 5554 1084 7573 1028 2981 5218 9387 3799 3327 8587 6510 2782 7944 3274 6006 8206 5226 1400 5747 8 4201 799 3421 438 1537 4425 4190 2230 8646 7642 1902 6069 6617 7619 5747 1908 679 9571 6517 2709 4850 7249 384 6806 2691 7712 1052 2322 1518 2459 3777 3799 6385 5348 4354 1987 9520 5015 1296 9935 3187 8723 8589 6274 4713 381 7602 4904 8767 7700 7002 1494 3762 8115 3672 1416 836 7482 8363 6479 6519 1861 6835 5249 233 17 8651 1936 4166 3750 7779 1368 2586 7652 1247 7527 7332 7741 3219 3624 4366 6678 9150 801 2818 8114 9362 6318 5078 8059 3771 2525 661 4038 204 3472 8233 1007 8322 5123 5080 3477 156 789 807 9744 6302 1890 7411 3340 9198 7051 460 6272 7207 4883 8274 5466 2197 4415 2206 414 9313 9277 7818 6613 371 7151 5392 4393 7544 9878 4800 4513 6202 5353 9736 6420 3879 3299 7217 4898 1530 4942 6134 3207 9870 7883 1375 5205 9463 2796 9279 1420 3997 9550 7111 1250 9575 7508 180 9155 8635 4597 3868 2232 1021 6117 3200 9093 6200 8485 1511 4135 8557 3580 6467 5884 2210 1964 4208 606 4073 9164 4869 337 5017 3371 9682 2741 7524 6923 9860 6889 2414 9568 3088 931 3614 815 4027 8585 4240 1629 4577 8397 6541 7404 8203 6897 5351 9946 4083 4817 6847 2551 2652 6067 8006 3020 2448 9784 6263 560 5053 9660 5638 2727 9510 6335 2993 2100 1848 9441 7138 7702 7091 7834 1106 1211 6110 7460 8182 1967 4992 3188 8142 610 8882 4261 3595 5050 9231 8557 2208 8760 8821 1297 8738 1839 9614 421 4317 2515 3298 9125 4228 6984 796 8453 3564 3799 6400 9234 9422 5944 5586 8234 645 2064 2825 2541 9271 572 1813 6334 9025 9655 4122 2368 4114 3525 1233 1063 3120 3722 270 335 5873 335 9451 302 2120 208 8506 1484 6232 3949 260 4998 4487 5193 8180 1150 6737 8951 1662 3798 2918 524 2301 8750 5507 4967 5380 2563 1503 6285 6134 1092 6155 986 4300 6726 3159 5512 3065 1368 4363 3717 1466 2669 4262 3474 6848 5295 2039 5868 9616 3846 2270 5312 6043 5893 7092 3585 6743 8089 597 7103 2061 284 2748 4901 5367 5627 7966 3552 3283 641 5387 7732 5663 6934 5992 7054 7503 2683 4118 4230 3263 5580 1763 3471 958 3237 6865 8368 7478 9095 1678 9935 9697 2543 3712 9665 7187 9086 9744 1561 2329 4287 5742 189 2325 5768 9402 3789 1279 7329 9012 1619 7261 9497 1939 6568 3655 6690 9544 503 5217 8396 411 8026 1408 9475 6448 978 2090 6437 9815 5782 5754 5649 8822 3167 786 6295 2481 1212 8743 1537 939 1731 4039 9545 342 4270 9571 5988 4278 9722 1353 1075 8538 9277 2609 8521 1378 3611 8712 9469 743 2834 9617 1031 3911 2391 4747 1613 5308 7967 5969 8092 9332 2897 3428 8896 5932 8954 832 4992 103 1619 3079 6763 9425 7727 6622 6961 1747 3181 4018 4199 130 1830 3369 6800 1859 427 8035 186 8233 2684 6511 604 9812 1808 5766 8826 447 7787 9049 608 3427 5353 9934 7516 1180 1843 9080 5399 283 4097 9526 4000 4056 4132 334 8012 4741 6917 2836 652 2759 6318 1796 2111 2141 3622 2394 1485 999 5365 6721 4377 6398 2071 9403 1107 1152 8459 646 3299 2318 5698 6421 3746 3373 9847 1898 5892 8381 4600 9975 9422 3582 7647 3235 152 7181 5088 4330 9110 4173 8883 9367 6907 8067 8061 6198 4235 6819 6118 2268 7420 9379 8643 36 5588 1179 2251 2094 8040 8902 5186 9906 1890 1697 5799 5911 2140 9298 7734 8739 48 3087 3713 6312 2838 8159 2252 4494 5657 4899 9261 1117 8751 1365 8657 3487 5364 2106 9301 4883 2560 8602 1942 7187 7127 4896 9641 +1000 +1168 9466 2606 618 3712 9144 5778 703 5252 3990 2628 1259 9099 6960 6869 9180 2130 2444 8958 5184 4611 7218 485 530 1172 4313 4731 628 2836 7503 6864 2515 3770 8061 5375 6583 7879 4023 4336 6329 7930 7333 6224 9908 292 6456 7137 1989 7793 2526 1209 6344 9361 6833 3121 2657 3247 9157 7491 2363 8617 4579 1066 5490 6085 1532 2001 3462 1369 8647 6261 4400 6790 4076 772 3903 2996 943 3437 9640 7309 1397 9780 8350 5071 3238 6597 7155 542 6779 7224 8904 5188 9903 1843 744 9691 1922 7799 5549 6576 5436 2973 6136 3580 7161 909 8711 3257 950 6966 1396 4387 9848 1391 6549 7796 1310 190 2066 2161 703 2876 1478 6824 8895 5912 8704 9147 6972 2863 8859 4431 9945 8060 310 985 2004 7750 5728 2660 5409 6304 1433 1778 2711 9089 7676 5944 675 8758 6914 24 1260 8925 3987 2311 4008 6680 2401 8533 4097 8771 6317 6838 7051 7276 269 1021 2749 3932 7829 7848 6450 1467 3139 4903 6036 3740 3070 2020 5288 5242 9202 8614 8425 4324 481 3241 6250 10 3804 4527 8652 6319 4766 5482 9037 659 8426 9508 7537 8620 7892 936 9321 1523 5431 7088 6726 7854 625 2922 1788 6674 6635 6344 7549 5227 9412 1249 4340 4846 2053 380 2216 8823 8611 3553 2244 700 6352 9901 7184 9880 8516 5608 575 758 4995 1277 139 5477 6447 2539 8656 199 9487 9299 2087 5134 3745 6839 1491 4073 4076 1802 6740 5675 9531 1343 8865 1371 6229 1669 5350 2438 9836 9358 307 7202 1518 6328 7041 9801 8410 921 5833 9353 4284 2188 1485 7939 9240 6257 9939 8505 5050 6682 5219 1396 6972 8982 3881 7742 2787 5633 3031 9280 111 3192 4339 3788 2998 3607 9926 5400 9676 3310 1039 5887 3753 7697 8646 7402 4042 2578 4554 9931 338 3637 9833 8394 7177 190 7983 2145 5517 8551 6691 2743 4234 452 5567 8035 9480 2126 5185 6433 3720 5441 9335 2199 9545 5042 8529 8160 6436 837 8989 4349 7292 2324 7779 5627 9395 3931 3186 6709 7555 392 7408 5148 1054 8000 6866 9839 1540 9640 9755 1588 4987 4635 6321 6997 5302 6776 9322 3702 9586 832 2660 1092 4598 8726 3400 7820 5004 6047 6088 7879 198 8757 1706 7558 8094 6226 3587 3273 7321 4532 1948 7951 1306 1648 599 5728 3814 5959 9808 1523 8536 8376 1493 2974 5047 9322 2717 4442 3129 7222 2638 4946 8330 9255 655 7334 279 5063 7202 9637 5641 923 6263 4061 3835 5787 7582 6238 6893 1300 4932 1493 5032 9443 9508 4418 3788 1231 588 8934 3520 8319 7952 4242 6074 4195 8717 6397 3755 3597 2666 329 6633 7118 6274 8186 6689 5317 5613 867 4028 1579 1367 7964 3008 8079 9169 2006 4386 2387 3253 8534 9972 9451 3370 5928 2076 7244 6123 9254 5162 6928 8782 2535 279 7452 7016 6313 8349 8963 3961 2729 1035 717 4642 4102 9068 9169 4719 6894 2554 7106 9771 3762 7871 4284 3538 4021 3273 217 2049 510 4537 1205 7992 9951 1072 7375 4121 2438 2097 3277 4717 8713 9622 2121 6403 9950 2414 9259 2941 7955 6790 1671 3510 8481 483 3872 1447 4716 5073 7544 256 5899 4137 3476 9429 6057 7126 8823 6061 215 7784 8912 6513 2485 6188 827 4536 8218 5539 8353 4890 6491 9699 1491 9258 4012 4140 6076 6397 1104 8551 6592 5856 7251 1896 6052 3830 3816 7400 9090 1355 8490 8234 8894 8649 7285 7029 4429 7154 8634 6282 7714 1700 5208 5556 8947 1085 5804 6498 9217 1219 6391 3804 3535 4022 9789 7259 9748 4059 4521 6480 9737 7634 2963 6591 6614 4416 3717 4234 8221 5124 4388 4336 8557 1216 5733 3609 5954 5015 6339 9467 5362 5324 2651 1280 8987 3000 5583 3994 2395 7970 1001 8885 3476 6287 9745 7181 1837 5520 8746 7478 9355 6248 421 2528 9025 3645 5430 9359 5205 2885 5410 9320 6305 7910 1351 8871 4242 3084 63 4520 5831 8165 7486 283 6445 9102 7420 5866 2719 3819 9794 1840 1461 6479 9559 8874 6534 6906 7946 5681 7564 5074 1813 638 9271 5112 70 6170 407 8561 9996 4750 2335 2762 905 5158 9989 8974 7138 3082 1182 8510 6371 2756 3129 7071 6547 9573 9002 9509 7723 5828 9958 9982 1486 8970 2987 3377 2276 8204 2385 5681 3448 6977 4770 735 602 136 3450 1477 930 830 7000 8210 6637 5953 3336 6170 111 7918 5523 3608 7535 1068 4377 2576 3333 3151 1752 2592 4231 3750 3784 4650 8824 8302 5519 6988 7858 8150 4943 7199 2842 2134 3160 9526 9093 2635 1699 893 2531 104 7139 1216 1797 4478 9724 46 5239 7921 1134 3936 9496 8221 3512 7094 4296 7239 8087 7135 4724 1396 3516 5877 4135 7756 2272 547 8083 7413 8975 2772 9668 3501 4829 8322 7834 2790 9343 7646 1024 3768 29 9613 2865 2386 3373 7059 3053 178 6115 9112 6237 7769 6191 6968 5705 2904 9148 6275 2237 6756 638 1727 5954 4090 9740 126 7906 1970 4140 1117 886 6186 3452 265 4879 5307 8731 6868 3343 4344 6589 1268 9571 1537 8949 8748 9495 6726 2331 4923 1856 8579 1642 7826 3263 2399 7198 4606 5461 1203 8052 1134 959 8297 6825 4356 7204 9351 3617 3854 1587 3932 8675 8697 567 5693 9887 1354 4691 6001 6858 1249 9078 349 9926 6390 7043 8161 4901 2326 4661 4639 5071 1871 3464 6288 5164 3982 7390 7297 4170 8451 6835 7226 8095 3413 3126 7556 897 1638 6606 7203 5008 4857 3807 6393 3752 2403 5872 7253 9861 181 5458 6162 8062 8425 8498 1352 9053 5781 7727 187 5600 2962 7533 3911 2093 6373 4799 3939 5436 5505 6414 6448 6959 2620 6767 6846 5492 462 8148 7180 3763 9779 7360 5983 4911 7809 3979 9537 9170 9061 8708 5128 +1000 +4463 7039 1517 2774 3161 8628 3182 2255 4129 4262 7640 9486 9569 8716 3543 4588 8013 3908 4217 8176 4822 7744 5783 6276 9206 4245 958 8152 3469 1946 2892 2244 6608 7023 2801 1527 5121 5160 9250 4810 3684 8438 2763 5473 7085 7990 9486 5531 5035 1630 6034 4619 4163 6290 777 5442 8738 3877 7072 1161 6439 3754 1953 3288 1352 8096 1001 2480 2770 3821 4202 5267 7105 4262 3088 557 9886 8354 7964 1075 5941 7829 6455 8727 6408 93 7873 7111 1001 2051 2201 9939 1127 8201 2623 1680 3536 4582 7935 2948 2283 7365 8601 5287 9806 2008 2348 9988 7730 2758 648 3583 3381 7475 6128 8574 1250 9361 8018 9696 7540 6305 1192 9990 2795 3169 9549 8806 8806 7501 2617 7160 8435 9691 1198 1634 2444 6579 9567 515 7256 2165 9888 3352 1710 8682 5634 8954 7285 897 8058 7594 1399 7431 9232 3368 4526 3400 9996 9400 5187 7542 8315 3091 8180 3256 1732 4284 3617 8268 5270 9871 4811 5662 545 4384 3888 8187 9393 6293 8822 1519 4749 8410 4951 252 1847 768 8750 4315 6153 2022 2557 7177 8286 3095 1992 5069 6078 103 5994 9914 6458 2359 4937 8802 7363 1820 804 9157 4733 4549 8926 9656 8969 2073 8642 6702 4489 5823 8423 7751 8661 3695 6768 9893 6014 5620 1312 4382 3013 1547 3796 7378 1368 5112 2121 9123 6367 5948 1663 9989 7298 2443 1480 7827 6334 753 8955 8128 1324 8128 1773 5962 3900 5754 6198 1075 809 543 1503 4765 8665 836 8622 1008 1342 2169 1410 7916 2892 4416 7728 1236 9568 6895 6419 8591 4340 8388 5141 5891 9935 3946 3749 7273 3939 7786 7672 4428 8429 6401 6341 8660 8027 8580 5379 6627 6463 30 8324 9616 139 4354 8723 2520 2249 9335 4785 9419 842 3167 9885 5497 5428 2035 586 7156 4160 6245 445 1383 6380 8370 7381 1421 1449 7118 4416 2229 3311 8255 6023 2810 6511 1434 6712 7900 7670 4 1990 6845 6001 4160 1602 4943 3233 6075 287 8515 6559 6701 6756 5741 1158 1225 9463 3362 6582 1324 8588 1932 2882 9201 4501 4116 4154 2311 4202 9999 8853 3458 2909 9819 4786 9331 4215 9492 1512 4100 2581 8313 2861 785 4585 2206 2130 1647 5562 9109 7511 2961 3248 383 8440 705 5869 1888 2156 1248 9700 7689 7605 6109 4728 6584 522 7275 8033 7683 853 7054 804 6752 6739 9752 6799 2358 5921 3722 2442 2010 8645 1575 3471 1887 5188 7857 267 2609 7165 5324 8525 1208 1043 3145 7766 6014 2398 7427 8283 993 2036 1652 5837 7677 4401 270 1443 3293 8365 5508 5405 1412 9288 940 1731 7009 3156 995 3396 987 7423 6792 101 8512 7620 8027 9574 6250 7040 219 1221 3233 6100 9910 8976 6168 4109 6095 8688 499 3502 1323 2170 8498 7545 7919 7174 4490 9781 3172 746 6631 6331 304 1521 32 8644 3213 6579 6774 1937 1065 9033 1107 5676 8193 5821 5677 4827 9985 9802 9602 3922 2326 1141 2047 9872 2574 2108 9999 481 4535 5730 7203 2663 179 2144 9594 5589 5710 9222 6164 5756 88 9060 2087 7296 2859 6151 8800 5214 3415 2867 4563 8463 4015 308 9546 2500 5237 6378 8099 3095 4943 8803 7557 18 4043 189 9897 1681 8290 6582 8151 4822 2441 7005 229 4331 1869 2164 6051 6155 5740 7316 2609 2783 4343 2060 9585 9711 2630 5024 2651 1946 8740 1007 7353 354 6005 3059 8594 8564 6496 8150 1094 3756 2712 4928 4747 8118 2481 3669 4732 4290 7326 8474 4581 7027 7184 4985 5172 9101 130 8423 9242 4430 9154 1143 3831 3103 924 610 7325 3918 5981 5321 1598 9639 5788 5569 5899 6437 2704 7500 7393 2712 7114 9334 7003 1526 326 4971 8511 982 8470 4121 6978 4965 8597 8443 8419 197 4248 2415 620 6825 6294 4290 2692 4551 2602 3190 320 7897 1231 812 4174 1529 3509 5697 701 170 6728 9930 8931 1852 3979 1538 1121 8240 7091 5409 5121 4179 9033 7581 9607 1086 8681 168 316 9121 9647 9979 2025 1826 2667 6058 2890 642 7054 6258 2812 508 9679 6863 2720 7654 8556 9436 6983 982 6119 4411 6486 7612 7783 7746 7572 1867 5967 4870 9776 1109 3181 7245 9276 3351 5951 4165 2945 6146 2581 4294 9071 2024 2407 4070 7125 4237 9484 3151 788 3749 3356 8428 5217 5873 2172 4777 675 9454 7140 8572 229 2444 5296 1703 2758 4211 4307 6573 7095 6032 7870 7846 9837 9476 6825 2822 8311 7411 5555 9333 4304 7331 6839 3856 2718 61 8715 8172 9196 5896 9096 3845 5890 6810 4824 2826 3956 7119 9232 5202 1884 5577 5221 7357 6783 2689 3933 7132 5301 6267 1751 2 1870 4446 8586 1662 9867 620 6018 2572 3953 5465 3741 3671 5630 7971 7495 8291 868 3923 7870 9047 7465 1252 6787 3937 6204 1870 9346 2673 5947 9699 4971 6172 8374 1694 6453 992 8532 2000 7818 5729 966 1405 4263 8522 4747 339 8666 759 2701 7132 71 4702 1260 3107 6553 3433 3868 5490 6419 7613 3167 8282 2379 3720 6271 6916 9528 398 6561 5500 2019 8563 4394 1476 9798 2127 9325 9912 595 2374 8358 9540 8179 6427 5082 1617 7128 5353 5391 3727 259 993 9700 178 1371 2415 8384 2281 4761 8672 7639 8099 7788 5986 7936 2690 6312 9746 5813 8031 868 3967 5902 5365 1903 2105 8956 1016 643 5632 5148 5342 559 4067 2091 9810 5319 4831 6502 4928 3920 4041 7323 1961 8241 7762 9719 7058 8512 3574 2284 9444 3454 8922 1123 3549 8527 1959 1968 1822 7287 4774 8740 7184 6901 2044 6750 7992 4062 7931 9214 1227 2680 3135 6564 1554 4844 7054 5111 6270 3418 5850 1649 2051 8221 8048 7300 1084 9915 785 3625 3623 2197 6341 6228 5572 3781 5076 8734 2737 4358 +1000 +9917 2038 9982 5572 4192 6322 546 5846 6623 1900 5180 6753 5344 944 4400 2270 7168 4004 7843 4553 6460 5167 4969 2673 4531 7050 4397 8248 5502 7218 8157 5916 3535 6892 615 4478 3269 90 8771 909 5430 5242 2983 7242 9191 5220 2091 2046 6548 7722 5957 3169 868 8258 2988 7857 8360 2890 1056 7653 509 9486 6831 8541 8185 2335 1303 515 6572 2626 5029 5679 86 1329 1163 8616 6536 4172 1872 7488 4984 2455 8133 9775 1106 2123 5963 5661 6517 2426 1628 7636 8592 7568 9901 5146 1986 4424 4041 1021 4502 5378 4121 2774 3171 8934 5770 8449 2472 4610 3365 8733 6079 8200 2920 3867 2130 5819 8517 1803 3773 9651 3292 2546 2662 8394 7322 8800 5017 1240 7236 2862 3627 3718 1440 1604 6147 5375 5931 1064 2583 3370 9608 3695 4467 7368 9130 9420 8329 1964 9976 4720 6583 3378 8410 8137 9345 4628 4562 6291 8695 5469 9653 8344 2089 6446 9126 8159 3377 3387 3682 6661 8411 5816 2142 7184 7953 6747 254 4446 7165 4828 3379 1768 397 8770 2279 4751 2250 9457 8444 3055 9871 2266 4642 6373 9256 8812 1314 4076 5589 548 1644 9845 8005 7824 4803 1090 67 9302 8984 8597 5005 8332 4649 6787 9174 1141 3256 8395 37 9027 2415 4219 9049 3353 277 4693 2359 5062 9245 2433 4613 8692 1073 2505 8499 8036 2538 9913 6314 4368 8270 8727 73 5848 31 7241 8199 4933 5437 7593 1930 6833 6471 2525 5200 3014 2250 5880 4686 983 7873 2391 2818 3167 8875 9862 6473 5980 7688 2280 1030 7814 3269 7146 9747 5721 6183 6243 2900 3145 4980 1463 2036 7196 4924 2290 9744 1760 7448 3252 9674 640 4200 2551 8632 1969 5731 4565 4916 976 6865 8136 4294 5362 5911 3026 3721 3911 7144 5030 3722 5939 4921 6198 9963 6846 3777 7879 9030 3883 194 6720 6007 8480 2394 7087 5430 227 8858 5926 7430 7970 2668 429 4170 1537 4638 1820 3460 2718 1559 9323 4751 8463 3737 1586 5741 7125 9 5024 4629 5085 5812 6561 4993 6980 4296 7092 6336 2324 5919 201 4217 1037 9217 7957 7904 6197 5084 6966 4469 6887 9601 8320 8963 2648 5759 4944 3113 6235 6518 2699 9389 3411 5040 6776 2937 8544 887 3042 7351 9669 5100 3490 4789 9472 9571 6501 9108 2137 6825 2439 1099 9205 8940 5149 8388 5189 9309 3063 6365 5203 5121 9611 5565 5266 2306 792 9288 5301 4334 8901 8673 8400 7120 8433 119 7317 2124 2854 7160 8970 9692 8701 2161 3342 3234 9415 715 5247 9085 2707 8961 8111 788 8314 1911 5999 9552 1246 2978 9166 8999 9109 2734 8155 3034 7154 5851 2589 4475 5555 5756 3356 8689 5697 7634 8716 5365 4747 4297 1079 6967 9257 9364 6288 6556 8523 7361 6984 8831 5734 5158 505 6704 9565 1182 651 940 5383 7720 9950 5975 4789 8929 8590 7884 6705 9776 328 8542 950 7825 4692 8952 2067 2206 8678 5759 1306 8298 4948 5482 6943 6367 4525 3636 6018 5178 890 1245 1536 3406 9961 4053 6791 8427 6918 4918 4356 1189 2055 1626 9857 7540 4512 79 2943 1953 2636 1299 8872 8782 5959 8087 7311 4469 8060 315 298 2315 6310 1657 8554 3747 1480 7003 3847 3413 3293 6640 9407 1572 1497 7928 8975 7644 5816 8871 4128 1315 2909 5039 4796 3702 5521 4394 9047 9591 5276 5107 4199 142 6344 9357 7124 4199 8367 5067 8178 5180 6466 150 979 345 9631 678 8735 9668 7354 4009 287 1013 6519 8680 2585 2467 4152 7110 5182 8142 4007 4917 8182 7575 6283 5217 9081 2531 6493 9396 7177 5380 2472 5991 8625 8080 9962 6006 8827 4142 734 6924 1421 3771 2374 3305 2753 4849 8520 675 8354 7057 3241 7797 5031 3562 8298 9891 4951 6517 5204 8282 9418 6773 5346 6580 5908 1387 5926 6401 9247 2285 8408 7323 1961 2977 1621 4366 7756 5188 412 2652 3397 1417 6128 1237 5378 6479 5903 3805 2197 3588 4590 2692 6458 2066 3698 5042 3413 2916 5251 963 7204 1327 6654 2388 2064 6002 6373 8815 462 3631 1201 6344 4195 431 6282 2468 2757 8350 6485 3696 7909 3670 2327 3196 3219 2867 4831 9867 1683 3418 7847 7321 2772 5113 2379 702 5697 5549 3174 7741 9493 3148 9345 6219 8669 9415 5427 321 7864 122 6581 8496 5903 8979 8973 9983 7376 5891 6492 2757 7160 4050 1487 1578 9639 9295 9592 5140 285 6364 2283 6241 4670 6611 4935 3286 9974 9503 5254 8487 1919 689 7860 1354 7364 7884 700 2215 3712 4406 8552 9394 2647 1771 6099 6293 386 4789 7458 1994 9847 7345 8203 9368 3925 5409 9422 9644 526 3168 2503 2484 3567 406 5536 4358 8085 7119 6757 3727 1367 8174 4118 908 9444 1996 5471 4847 5842 1440 5571 4705 1694 3934 2514 2052 6052 3552 3691 7986 5351 821 7169 283 8893 7668 8717 4674 7371 8516 206 2822 7705 5517 1973 4249 4468 4895 5974 2518 3307 9132 5580 3938 7639 3957 670 892 6620 7545 7430 2346 1189 8314 4571 2022 9848 1903 8543 3569 6835 6267 8701 8800 6063 6751 5736 7651 3209 7256 678 6602 7817 1328 8908 7747 7253 2630 7455 5136 5492 5290 2829 2077 5665 9265 2281 8866 990 797 6226 1652 1841 2398 636 6863 7599 4467 761 1546 4397 8617 4202 4623 1519 7323 4836 4497 6206 8149 295 9436 7312 9654 3319 2067 8939 741 3781 9366 1831 5826 1143 687 1105 9932 1997 8402 8537 5645 9827 2232 2465 6116 9329 1804 5988 3841 6569 7489 5898 9323 3597 9614 7321 7895 4231 260 6387 6746 3564 8696 7300 5880 3599 6856 6606 3101 5219 4330 6720 6659 8716 8167 7165 7434 6384 4603 1432 5406 461 7782 6809 4145 6540 1378 2585 6630 7907 7960 2805 227 657 890 4673 +1000 +8794 6565 5870 5492 5170 1472 6027 6849 7982 9973 1785 7318 7874 4707 576 5061 3053 5783 5996 1213 1106 453 8584 1901 2642 8198 3637 2046 2462 8385 388 251 8039 2768 8026 1611 3954 4840 1489 9754 9992 6304 3636 5447 3316 2737 4670 5555 7167 9775 567 315 1827 5024 5367 4126 9712 3958 6151 8724 8165 770 1560 5380 8541 4175 4612 7846 2437 1821 3758 5125 3633 451 5119 3631 9243 4885 7250 6782 4647 3725 1146 3722 4373 3676 1632 7441 4703 7005 6205 2419 6302 8700 1389 6030 2845 8732 7307 2426 1644 9909 3656 981 995 1437 6748 4114 5680 5716 8120 8108 3586 2972 785 6881 6049 4276 1513 7473 2653 7351 8916 6968 5346 8532 1993 7696 4198 6729 7116 7345 3952 8010 3814 5672 3538 8815 8138 3536 3245 6293 781 5914 4361 8335 7838 5523 5824 7567 7574 3935 2022 4839 9400 2121 1269 3924 7329 5270 479 9337 7462 7846 5086 5985 7654 8550 5137 1931 8588 1 3515 3545 7608 6511 6807 9668 6706 2968 4750 3789 1785 566 3121 8862 9808 7490 9674 3725 8401 4766 7864 3032 1961 8696 4573 9569 4826 968 3778 9804 4299 8765 8570 1419 2517 9034 5538 6188 7783 1700 7625 4965 4583 869 9042 2756 5010 6727 2824 7385 3864 5732 8624 5410 2002 20 8744 5071 7126 1347 6146 3886 2856 4692 6350 9104 8744 2839 4387 2805 5020 628 8981 6407 4324 9180 1592 3687 7070 5224 407 1583 7768 4517 9731 1649 1765 4299 8366 8779 5959 8151 4284 9562 168 9348 5084 2981 6257 3175 3082 2470 8527 8847 3465 9537 9228 1216 7261 634 3371 9555 9799 9111 85 7056 965 3211 4333 9584 5804 150 6911 7003 5600 4037 7963 2905 3650 9777 5590 8068 6906 428 4832 381 7984 2770 5303 5121 955 2689 6851 419 8082 2137 1847 9372 8392 7215 7684 590 8994 1375 8243 8234 8958 5932 1993 9570 6572 5487 9895 3026 7760 9243 9873 6513 7372 6530 7666 6906 4471 9853 9120 886 9058 5916 2750 3725 9715 3143 9629 126 9047 709 1052 7524 286 7461 518 256 3907 7880 8339 685 5622 7985 9018 24 1061 4238 931 6620 5917 4281 1411 6252 5721 520 7636 8809 5968 1292 6689 5021 7582 8265 7988 5919 6025 8400 6351 7040 3067 7992 8918 3135 5155 6192 6577 4461 1900 3321 8287 9223 1447 9535 9342 7658 2391 5729 9861 7539 1451 8719 6420 1310 8632 5903 5286 5749 4405 9283 635 7748 3945 6117 9766 5121 842 1537 1032 1396 6713 7138 8389 1206 8593 9476 3635 9410 7171 3798 2439 1629 5229 1482 3391 5223 3175 3925 1494 7303 8892 3722 9682 1056 3465 8544 7033 3885 6698 8154 672 5919 5719 1818 6189 2371 8399 2477 7345 8966 9689 6945 1268 773 7577 9107 9375 4051 402 2778 1028 7687 2958 6693 5965 8618 3758 9427 5202 5192 4640 6371 9016 4632 3828 3880 6916 2416 528 4575 9552 8474 6974 1569 95 9541 5418 2391 4646 3770 7617 2197 359 8792 6293 9491 4436 2039 5778 1383 3102 5091 9354 580 7855 9915 946 7802 6091 5613 1471 2704 8502 909 9481 4450 4812 2083 671 3770 3576 4811 7197 1867 4426 4874 7395 5846 9452 5839 5236 1604 1451 279 9977 4806 5462 3656 9534 5419 3824 4807 1234 2212 424 1061 2822 2346 3429 1470 1667 114 7034 7934 1952 2315 5842 8314 3837 5475 9854 4286 3156 9037 9921 7253 9834 6174 4025 8182 7130 373 313 1226 2494 3270 5089 8573 6580 3814 6513 8689 9591 9982 1087 1395 7985 3400 3380 5648 3232 2608 3523 6994 5594 9635 978 2156 5860 5711 4357 7087 580 3984 2611 47 2074 3923 9507 2980 4994 4295 4484 2731 9805 1 9597 9325 1217 2551 3992 924 2925 5905 6081 4728 5342 391 6075 1155 4937 2888 7960 4868 6397 2949 8743 4053 9877 2177 7124 4517 7811 4628 9725 7460 7311 6119 391 5367 2634 2011 4799 1921 6026 2918 3166 4937 8896 5993 8863 4508 1265 8950 8794 7146 1338 265 3344 9990 2755 611 1703 6938 2800 5334 2147 2611 3854 4502 316 9029 7658 370 8120 9385 2643 5342 9942 9315 1479 1643 8259 2377 4602 2366 4715 9441 9499 1040 1398 500 1006 4161 7043 5029 9589 1810 6241 7583 6966 166 5500 4624 281 9533 7491 6080 1186 2889 2365 6942 5259 470 9211 1981 5460 1768 982 1551 7970 4328 6713 9403 8878 8711 8814 3586 2542 1088 1050 2034 882 8455 569 4103 6970 1482 2431 2053 700 9117 4577 9419 2020 935 8080 3255 5562 2124 5360 5749 3912 9402 9115 9832 7654 2453 3333 462 2117 4180 6149 7319 8124 7667 9277 2429 9484 5772 8771 6222 1769 2123 7822 3424 8681 8351 3484 6703 4623 4806 1822 7553 6128 1780 9089 3469 3983 8757 8926 2276 3224 9101 7336 75 5690 1980 4827 4206 5080 6660 3118 9970 8693 4091 6905 3127 166 1566 1537 7816 628 3040 7094 2367 694 6277 7847 7434 8353 7259 7052 6613 5870 924 9907 9652 8903 1600 474 8743 6961 3089 4876 4598 789 2662 2618 173 1554 2837 3341 9595 1160 4470 5181 905 7284 7214 968 6993 2635 6603 8515 3323 2458 2031 6691 8295 1720 6546 1648 6513 7238 3843 987 4563 437 38 3181 3157 9109 584 8716 7742 3159 4638 382 7582 8447 2872 7673 1300 9965 6129 6325 516 3217 7190 9764 4468 4722 8973 3478 6955 6244 993 7536 4053 9986 1871 8100 3697 6356 4058 7654 3837 3056 3536 2632 7763 1897 6653 5269 9270 8126 5146 3805 2224 854 1647 9719 4930 4004 7246 9076 4193 4207 2391 4141 3630 3803 3273 7219 5610 1170 7492 2371 4121 6949 9224 4526 1378 9620 8590 6990 389 3666 4055 7946 5663 6187 9115 453 580 3670 1291 3740 8649 4058 7488 6959 3776 +1000 +8900 7358 1201 6463 3021 4860 4946 7748 3776 3544 979 3752 4298 8569 5108 5290 5615 529 6900 4756 9024 5120 8010 7015 700 1880 3078 9614 7454 3257 77 1119 8687 9514 2811 2759 9704 2309 6209 8244 3572 1915 6204 7283 7594 5360 2689 1024 1529 4335 4880 8100 3218 812 8916 9662 1089 8954 7348 4887 9674 1758 3057 8007 9907 7337 3510 6798 9007 9150 4417 9199 5473 5148 9938 1348 4248 2026 8144 3523 8699 9115 7441 7511 6721 6301 5476 7414 5810 3999 8857 8577 331 7157 9467 8400 162 6300 7376 2685 8056 4779 4294 1977 2798 4707 2965 8655 4439 1996 5429 3647 4545 4598 8918 231 4696 6613 7460 6955 6560 5275 3163 1064 916 7405 5070 4140 6926 2790 9299 2830 7996 5325 2367 5614 6585 3110 7867 1421 2898 9404 5055 2700 7302 9291 9923 8452 4624 2719 1273 365 9717 1088 9282 2379 2772 1711 8441 4716 2840 2088 8795 3752 1279 3909 8663 6669 9453 7182 6555 1182 8284 1062 8650 2221 6776 7214 1099 6004 1855 2539 8407 6736 7857 6546 8924 8687 6249 4289 1186 7862 3127 9820 415 5833 9553 3139 796 5951 6994 5100 7155 609 3680 6558 2220 30 7324 1427 445 4680 7511 2869 2748 3598 3819 4144 4931 6970 7515 5277 8653 8502 8231 8002 2141 5751 1860 8184 156 1931 6994 4713 4334 6008 8178 6818 8790 6216 3906 3310 2605 2213 6258 5654 223 2176 475 6546 8550 2095 3930 3612 5867 6267 6295 6100 5135 3289 2407 8615 6622 1743 3468 7983 6160 6489 7951 9154 7894 6837 2306 6025 1875 5365 7444 2746 2320 2257 3867 519 5263 3614 5763 9097 6843 1135 8208 5133 5467 5797 750 7888 5981 5627 5965 5847 5378 4417 6231 7151 9599 9185 8082 6742 6452 5612 4446 8203 4920 64 2746 3888 7296 3862 4005 2066 4745 5333 2719 1472 2 6359 9744 7829 9541 3518 8380 5805 4748 3199 5928 7425 2259 4064 2169 6950 8719 9451 8609 5248 6733 1384 9365 7325 6125 220 882 8091 4458 9331 2764 1065 6058 2700 4333 5933 8283 937 5534 6792 1902 3180 2906 7045 2913 4698 7111 8977 9887 9919 3773 9106 3165 5177 432 3368 5163 9935 6490 3223 402 2481 2764 5474 4018 938 7519 9129 6220 3023 5432 1920 1024 7075 466 32 7238 9077 2946 6612 3253 7768 3363 4146 8996 6843 3282 5862 5540 3704 3545 1670 5626 6825 4823 5124 9067 8605 3156 4460 9422 5897 5171 7892 8642 5410 511 8214 5180 2424 3473 1767 716 2019 2854 8616 337 4354 5002 633 7741 1636 4195 1403 7385 3696 2665 33 341 7617 7571 3393 6708 9035 9777 1304 5266 5971 4965 4097 8076 9540 5122 179 6434 2637 6758 5813 9143 6051 7552 3821 3844 469 50 8557 7508 9361 9044 6295 1601 1999 3870 853 8817 260 8069 9001 5049 8568 537 4836 8623 1289 1458 3098 1325 951 4135 4904 2831 1876 8478 8643 1227 7924 9852 9165 7734 5579 2606 3439 2820 1715 9150 4974 3396 9735 3166 857 480 3350 4968 7955 1265 5832 2396 8973 6616 8353 6831 2172 9435 7697 716 3299 4938 8756 7483 5487 3208 4232 5061 406 6074 8231 9423 1451 6583 1729 5793 2852 4635 7161 6619 7385 8368 4970 2634 2013 7358 2673 7444 6821 9170 6337 2873 5042 41 9586 3160 373 7134 3403 8810 1654 2352 7622 3104 3169 8677 8222 9289 3625 1619 3269 2452 995 2456 4763 5740 666 3488 6190 1826 6550 8409 3212 1161 8472 4455 5158 7039 9239 1201 7511 1423 9722 3414 8092 4311 9907 2997 6862 1280 345 7430 423 5142 2343 3382 6426 6212 9665 2174 5083 4173 2344 2948 5336 9170 8613 2759 9357 2789 9336 4516 7952 4212 6274 8089 5943 8580 6335 7350 6738 3444 6637 7003 2757 5295 9179 600 1932 3169 3996 3575 3588 8102 6435 8791 7310 8329 9133 3160 7051 8834 9876 8040 7145 2767 6457 3411 2260 6918 7780 9697 821 1992 3221 7210 6140 5730 1690 1545 678 2292 2264 8988 5789 4906 8633 8226 5233 6248 4029 6469 8974 8920 9979 6614 5343 5077 7202 804 8772 3150 3500 6945 3136 5413 7968 9288 8533 9985 5977 5050 1930 8295 1583 6617 1390 583 5031 6701 3268 663 9292 2368 6183 3376 6387 4590 1355 8682 773 9362 4431 4314 5477 1428 5729 9161 5419 5242 6742 6225 5106 1257 1163 8652 8968 4748 2577 4719 5144 1218 8534 1348 7351 1380 4174 6631 8979 9552 7816 9729 253 6851 8957 4861 2798 7925 2285 5410 1385 6177 9512 8987 4854 7738 4511 2793 58 5796 1028 606 3909 1711 7606 2633 2091 9544 3082 3992 6155 5818 4392 5653 2812 4807 2522 1492 3979 4476 6429 2797 4224 260 8618 1667 6055 5518 533 5659 1858 1439 9937 7453 2172 5049 6755 5873 7077 9823 2150 8791 5273 5888 2951 9324 1128 4116 5570 858 3952 5105 6165 1050 3559 7402 4571 2757 8303 2942 7392 3066 7767 3867 4962 9629 9679 5346 9152 4768 4191 5721 5549 6882 4671 7263 5104 864 876 307 5896 1157 4801 8293 8230 7547 3674 4962 2406 4313 4933 6077 3508 3536 9650 5088 858 839 6632 2164 3217 3733 6544 311 9545 9521 8338 9830 7943 1560 8031 5462 2925 9323 154 7971 8913 1183 901 9382 8991 6509 2389 4873 2598 4694 7017 1886 8887 4146 9853 2751 97 6979 7093 6851 1008 1176 6392 864 3319 9757 3171 6707 3320 1417 7644 6306 7172 9467 9430 2332 5440 4477 7445 3941 6561 448 1486 5908 8372 3861 4 5516 9063 8147 8117 9793 4444 584 6540 7373 662 8096 4703 1317 3322 1722 3189 5922 3761 8377 8151 3561 5727 6019 8185 1029 77 673 4964 3473 930 7879 6316 5030 3730 2856 576 7903 2130 1756 387 4811 4166 3757 8665 8873 4137 520 6803 4407 2134 +1000 +1541 1688 6367 9186 6216 6966 1816 7537 7967 1935 8542 2725 4929 3310 8673 4710 7943 4702 5476 5140 4765 1852 8283 2432 2640 4072 7573 7904 3390 493 7393 2742 2778 9991 9113 8244 8740 8164 7755 9378 9583 446 8624 6057 7573 5198 3505 2928 2919 9504 3021 6725 915 6372 8551 6755 897 9487 4028 9719 4421 7315 9297 7840 8910 7900 8062 861 7179 2069 2047 7292 4571 8439 1801 7917 8336 6987 30 2028 251 6641 4694 311 3527 9176 5417 4562 6828 7261 3858 5310 791 6270 2432 3118 5756 7274 5645 6713 3339 3767 2915 3698 6050 7002 2079 8252 6826 3690 5828 9935 1160 8629 1484 7255 3736 492 3883 5549 832 2238 5835 9370 6289 3026 9414 8512 9 1601 3893 689 9856 4499 504 6011 4077 7480 9229 3490 4421 592 2498 9010 1530 2485 8783 8798 4246 3873 9165 7491 266 5962 4234 4512 2309 3775 4713 4310 2422 8368 57 3283 6931 4242 9660 8817 9956 5270 705 9258 6099 4846 6491 7196 307 7576 6840 2543 5716 9996 2144 35 604 3399 991 1342 2057 2824 8075 8392 74 4950 363 9304 2004 3632 1156 6605 337 3246 5714 8534 9871 6179 7209 7468 1997 3922 941 9372 4680 2031 4956 1716 6284 3862 9579 220 8280 6858 3219 6797 5760 1929 8541 4936 3139 318 2967 9937 327 271 6139 5491 2018 4671 8526 5093 2374 1137 3861 6350 1415 6887 2489 5242 2704 5114 907 2053 7265 5229 9406 4827 6720 9860 9686 9551 1310 2356 8672 7980 8163 7333 2253 6976 573 5664 4113 9089 1267 1054 5091 1553 5415 608 4112 4584 3994 7731 547 1813 6857 4626 4132 665 7931 5154 7194 1206 3182 2662 8883 576 1049 1628 9861 8831 2889 1617 5727 9993 3123 9248 8965 4385 4575 5354 9859 2832 2932 6740 9219 8127 5910 871 4687 8919 7248 8559 8037 3006 9055 2318 4655 3198 8338 7515 877 4611 4750 1122 6936 9960 3484 7630 435 7791 3600 1770 9776 729 4418 286 2871 6116 9747 9764 2716 9192 3800 1845 9736 920 1769 4785 6691 421 9882 7928 6191 4929 6806 8362 1156 133 6822 3489 7800 8629 5692 9243 1583 2644 3951 9253 5959 3293 7402 4752 2327 7591 1321 7338 4494 6823 8461 1475 1355 3029 5607 6628 3266 6442 3279 4352 632 8400 6956 5906 4683 7886 3196 2026 8891 2510 5175 5236 6354 7073 7470 8897 7022 5296 3235 8142 7456 450 4853 9764 4406 4825 9349 1706 5900 1687 3036 3711 530 586 1387 8597 519 5201 8556 9171 7194 8984 9945 425 841 7915 3211 1204 1011 3894 7108 7710 2147 9597 7199 8659 7388 5211 7803 4472 8362 621 7374 3755 1976 9196 2584 2148 499 3597 328 5619 8736 2021 7481 6997 9142 6871 9687 4517 4410 4756 7494 6960 2681 5254 4306 7110 5539 8493 7718 7724 1073 6770 3205 6797 6427 6953 3341 2424 1475 4415 3275 9322 8261 4527 7969 2141 9548 5462 1997 6341 9936 6061 2346 8109 6480 6722 8739 6288 5837 7184 2259 943 354 1406 8259 6369 1679 2738 8273 3571 868 862 5944 2175 2027 8430 7504 4871 7006 23 973 6879 9189 3581 4871 9951 6494 9569 8999 9357 3522 4560 2422 6255 2455 4409 8170 2373 41 8632 5135 4077 5950 7778 7747 6907 3324 6980 5279 2367 1302 1584 8373 8812 5379 457 8145 6684 1328 1336 8923 5605 1784 532 4149 6405 7670 3450 4444 7292 4602 7544 5847 5152 690 9794 9746 3867 6484 8413 8215 3564 1652 7750 1415 5510 9609 8477 8000 9852 3169 6651 4757 5417 9307 7744 9017 9313 9363 4152 5779 8421 4474 660 246 5628 6986 4501 9124 52 7218 9332 4493 7455 2185 9581 5423 4199 7456 3935 125 2287 1733 6541 6794 9800 8621 7519 9443 8927 5310 9885 8492 907 4033 5246 7095 4343 416 1762 9548 3365 8230 8604 2516 9636 2699 7688 109 2576 8544 5894 6300 1371 3119 8215 6307 1595 5671 9815 950 6977 3154 4690 4061 7500 7278 7273 8290 4281 8454 984 5978 271 678 7587 8439 9560 3368 6691 4309 1821 6830 2639 4213 3385 5310 211 8968 1471 2869 9596 5987 2024 8677 7668 7957 5392 1140 2172 8876 4944 1317 2235 6442 1082 560 8221 3801 3638 194 1003 3647 3140 8620 8338 7150 6478 2837 6708 8096 833 1631 9166 5853 3063 6839 3563 3816 8538 3528 2292 3594 6277 5758 6928 5480 9824 4601 5806 4456 8304 2236 9734 6898 7918 1107 8849 5321 9751 5707 8407 8657 2935 8139 8218 6150 5026 1400 5647 6661 8489 3538 244 9989 9187 7005 2197 6718 884 6324 6442 6936 3250 2286 8764 4230 6334 4762 8106 7688 8636 9228 9225 846 7101 8780 2365 8028 3219 9757 6877 2555 8182 700 1186 3856 5812 9324 7527 7952 3956 7425 6158 4775 2001 2828 736 7619 7741 9171 5802 561 28 9013 5442 8096 7066 6845 4 3603 1418 4210 3320 2607 6899 257 4105 7946 8358 3035 2743 8223 1412 847 4489 1999 5056 4811 4936 5032 203 2120 7674 3756 5534 1055 8352 8502 8419 1847 4648 5746 6821 6893 8577 3414 1881 951 7228 9531 3092 1406 8584 3612 5222 2 9653 1827 5917 7478 6221 8779 9912 5438 8757 2166 7441 6835 6520 3516 8008 6980 4619 7312 4355 2639 5074 7551 7502 4193 579 9536 5442 3025 6309 1895 6653 8985 1554 4260 5014 7055 7573 757 3179 9827 1281 158 1485 3702 9471 4080 4203 6563 2921 6119 9746 600 3802 5163 7045 8889 2029 3524 6735 9162 6720 9986 6084 2325 90 101 173 9446 2901 4454 3130 3045 1079 5471 4378 1554 6575 2122 2670 692 561 1867 982 842 174 1405 5466 1955 4 2481 2014 2014 7355 9454 552 468 3172 8849 1946 5318 2432 8773 285 9335 2462 5862 3370 1768 9779 62 4149 463 6168 +1000 +1202 7068 6432 3474 5356 631 1541 5576 596 1833 716 2386 8734 3339 3343 6806 4403 2208 137 4310 8813 839 3834 3115 435 1051 3080 612 3044 9886 1002 303 3865 356 6344 1625 3446 3781 4857 8846 7447 2193 4953 4264 3930 5851 8272 8084 4996 6991 2941 4611 3204 7672 8735 6998 4307 8489 5136 4204 7208 4107 2447 479 7267 1650 224 6013 2519 2558 1883 3698 254 4539 8585 9557 1196 5935 5474 2614 5714 3522 6443 5797 1394 3317 9291 8194 8147 6537 7419 9983 4637 3492 8801 1496 3883 2200 5124 2385 3885 399 4694 8864 4579 2037 4443 8640 4765 6358 7945 1166 2145 3152 3233 6208 9662 2543 9313 2604 8567 4427 5080 1775 5384 413 4949 9458 5433 8706 2815 3070 7658 6711 2941 393 1246 4625 2748 7000 528 530 3201 9352 5871 2752 3196 7866 1809 8955 1814 5822 7180 2378 9013 6757 4293 3486 6134 2424 2261 4283 6678 5648 8595 5173 4896 574 2834 4469 1571 934 3428 6841 1340 2260 6987 8615 2291 1013 239 2930 4312 8690 7264 864 3130 1948 1914 32 3538 3134 4312 1931 8465 7851 4865 1711 7075 2027 2785 849 7631 3449 3339 6917 8968 1131 2838 4123 7496 8367 9312 4772 5523 6889 1882 6694 9739 272 2138 5645 180 7695 5755 9464 4325 5226 7674 5281 3790 3292 6707 2457 5232 679 6628 5692 8354 5186 4369 4053 564 2617 4374 8862 9402 8432 8644 567 8555 5160 7155 4428 4424 6264 8452 512 1832 162 3340 9158 1884 2783 3157 6279 1484 7668 3144 8293 2753 2980 2156 3902 1109 6542 2403 3901 6526 7841 6948 3716 6401 7023 3982 4406 9507 645 136 3909 3251 550 8163 6092 4465 8476 7397 5241 8388 9058 883 75 3826 5793 6215 7233 3400 654 3446 6628 2772 5423 8584 2758 8756 273 2088 3152 1799 4259 6461 25 1012 898 6356 4345 6197 7611 1943 5625 725 1578 1639 7768 8681 6249 4117 7462 2653 223 9153 7491 897 9033 6528 3092 1247 3033 390 9179 5102 7680 5678 2554 3438 6611 4335 1274 5609 2886 4472 258 9817 2899 6159 5590 5650 9609 9801 2472 1934 2022 303 1345 9249 6368 8616 287 6796 9453 7928 2905 928 4095 6192 3546 5152 6246 1049 9552 2788 9303 8143 5573 2976 1799 9011 1708 6856 1885 9061 4072 7470 7045 5757 2420 4817 629 5381 474 202 9947 4101 5660 9248 1229 8923 1981 5982 5751 2401 2509 142 2022 1635 2856 9905 6965 713 1719 9645 7261 778 5089 1371 650 3390 4118 7328 5458 6954 8200 9912 6020 4352 273 6845 4944 31 7549 8288 4898 4265 497 3388 2258 7049 300 9960 7705 9713 9113 4522 1890 4543 9123 3220 3497 8054 3337 9385 832 3913 3841 9202 6134 8220 5186 1565 1067 7952 9731 2701 7263 249 6616 2000 5054 6333 9640 5278 9704 5494 8493 1651 2008 9964 3234 2037 9457 1490 3113 4038 2309 7085 9894 8978 8749 5039 3609 312 5667 5894 3361 5479 8115 120 4919 5794 8938 3874 1669 3228 6803 1814 2492 5983 8684 7631 5508 8085 8941 9693 9519 440 2042 4269 3212 5751 1916 8224 6060 7567 5225 2727 9109 7705 6272 3587 1292 5930 6403 929 2463 6789 2739 3107 2660 849 5960 819 9583 3163 7706 3681 1208 3523 9936 2855 8951 8169 510 8080 7928 637 5694 6775 7057 3760 1158 6120 1753 2984 5254 7437 6951 113 8211 7178 8908 2677 649 6206 1779 2458 6137 7536 5692 3160 2060 7333 64 1756 788 2080 2103 288 9883 9669 550 7289 8009 855 695 9420 1494 7219 7244 1831 6334 6373 86 2338 5857 6241 5815 3216 2252 7450 8170 4390 2397 3937 3904 7222 2862 2786 7161 2246 5867 6318 6145 449 1733 5804 1513 6544 6696 4914 9921 903 727 1656 6200 990 2276 7439 5486 4510 8356 3919 9784 2903 7096 7792 3280 9778 6536 5906 7810 2188 4123 3535 9285 85 6342 9604 7640 6119 5072 1520 318 6384 7750 5883 5928 4627 4962 4752 1718 7778 3728 9068 1692 703 4641 4912 9054 2839 894 6809 5867 9567 9880 9461 5903 7474 5257 1049 4437 9335 1907 3847 7750 3192 4677 8730 2298 7792 8991 4448 9616 3757 4302 3794 3578 9453 1956 3037 8481 8427 5345 8119 4663 8571 6307 596 7358 2194 878 6561 995 83 6984 1809 6661 842 6082 3017 1422 891 3788 172 1148 3950 862 6218 8415 2439 9180 3785 5346 2750 9572 3190 7981 7270 3912 6291 6642 5235 6984 4630 6387 3688 3224 3130 8656 7181 8758 1942 2732 2221 7299 634 8185 4375 5718 7398 785 3610 3059 6155 3356 9970 1495 3188 5353 1978 6647 616 6096 9711 9303 652 6769 1546 9578 2892 1901 3013 9090 8833 7193 7191 6758 9349 6576 7477 3370 7396 9111 8181 4164 3097 7021 2735 5280 8385 9640 6707 6605 5425 5145 4809 838 2987 3824 852 6583 8746 8088 5983 4797 6202 2787 3115 1358 6099 7340 9675 4486 6372 1875 185 1628 2173 2345 2112 3621 2640 1603 5173 1130 7514 4390 8293 5799 5296 9420 8476 6318 8339 5170 7733 4901 5433 4834 5084 8797 137 7130 7092 9692 8262 3734 4888 6368 1562 3621 4268 5813 7093 5880 732 2475 6119 9492 2718 7731 8344 1915 2999 8140 3990 8678 2963 4458 2937 2964 2955 8461 9453 6070 3151 3895 8361 8577 6936 5128 5807 3671 195 2991 232 3456 6811 3803 2302 8452 2737 7218 9054 116 3748 4847 9073 4869 1211 1417 657 4587 412 2658 1586 6189 9509 5591 3834 6853 6674 9000 4517 2768 3352 6774 6930 7337 9961 305 3868 4543 8330 2114 1355 1030 4579 1528 4900 4730 1953 5351 6485 2460 5477 9369 8705 7748 4278 4130 6602 6650 7157 7951 2194 644 7203 1121 3935 6011 6394 337 8890 9600 5863 4807 3855 6583 9233 3949 +1000 +7529 2365 281 3790 3406 4975 6548 7632 380 8067 756 7952 3299 7730 7976 1816 7459 8364 6609 1296 8094 2265 2652 9815 5770 2506 6899 2703 3371 2713 438 426 8389 3690 8664 3464 7644 9187 5242 8048 5353 7663 7292 4978 7454 1958 1845 6994 1425 3042 1029 7885 9032 8788 7676 8605 4849 8923 9436 8640 2567 7138 3043 7011 3359 6115 1062 9684 608 7710 7243 6521 5771 3836 5945 7766 8993 6390 3953 5459 3419 8446 4388 1233 629 399 8261 5143 6490 8402 191 4078 9986 5749 518 867 157 4728 6725 8230 3773 6388 1648 6671 6191 3814 954 6300 3952 3378 2485 7937 2830 4076 3189 7374 4758 6514 8454 5361 4720 1579 1807 6148 5758 2167 814 411 3298 5402 5500 278 6113 4975 287 2804 2990 1952 3332 7987 1670 5736 1463 9097 5882 4090 7087 5957 7313 9353 6411 4163 7906 4195 9755 7032 985 545 137 2169 8832 8351 6360 3728 8474 7942 1840 7903 2058 9282 3550 6399 5292 8220 8204 2206 3444 2160 9188 7396 2387 9926 5010 9730 5519 3213 7229 9272 5649 1345 183 725 8431 2273 8235 7374 8252 2909 4106 3018 5583 4760 942 273 2910 2215 8528 7433 1263 830 5657 3292 9872 7297 823 6433 9560 8875 551 6716 2638 3254 4700 245 6245 6348 5455 9725 3213 5620 9546 6202 2473 3437 6795 2133 6636 5746 9779 4869 5433 2122 3944 1092 2513 8732 8328 1795 1866 9154 9481 6434 5643 9499 9699 2072 4225 3098 7724 8860 3673 1277 8287 3834 5823 3400 4309 6134 4591 6758 31 7026 7230 3659 5254 2539 7953 1946 5451 84 6918 6817 761 6712 1945 5771 2803 5849 2135 195 6115 8844 3576 2722 3579 3756 7885 9901 6235 2320 748 427 7355 5351 9480 1229 4585 1826 5683 7212 9068 4704 304 2828 9273 4694 5767 6790 218 2045 4745 4618 4072 9759 184 3177 4132 8476 4573 4958 9578 3231 8571 8373 9094 2433 5493 8138 1460 9181 4347 5532 370 4192 232 4317 1067 8858 5113 9076 3374 5763 8473 614 880 7405 2655 1520 540 4785 2643 6792 9264 6410 2494 8777 4930 4303 2566 2907 653 9915 6212 1043 6652 4292 9666 7779 799 1937 9039 3992 6602 5615 6594 6363 2835 5132 107 3332 166 5441 3547 5447 7297 5558 6933 9368 1578 3321 3768 3269 3249 8689 1984 8092 1623 7255 5252 2702 1256 336 1108 3217 1666 4355 7351 8895 9532 5920 9503 857 6111 5761 7091 5383 3917 7152 2495 5519 1062 9587 9191 7919 9983 1097 3368 5181 900 3617 9401 3220 6472 2890 223 6144 4803 3302 6647 9427 3309 1742 183 1854 7637 1110 3423 1547 4052 9953 1147 2186 9326 8709 3071 543 5894 875 5329 9778 4039 1621 3760 229 6912 6238 9693 7738 4885 6867 2604 5348 2083 1091 4478 1308 6095 7313 3564 3005 4919 5166 451 7526 5975 2614 218 6865 2162 2549 1958 298 8095 5666 2046 5191 7520 1491 400 9635 3886 122 9899 4748 2933 3234 408 1820 3546 7781 7866 5018 3050 4194 1363 8931 4627 5507 2095 4421 2442 7956 2317 485 5081 589 8638 8560 618 3363 2602 4692 7958 5456 8247 4794 1429 5911 3479 8365 4605 7037 2626 2779 2408 947 3566 4971 4771 3672 4970 5488 6970 9397 6181 3537 3028 3800 8299 6215 2015 7591 3351 1679 8307 8607 6433 7786 6580 7423 4286 1160 2933 7774 2452 4583 3310 2228 1344 2925 4741 2412 9042 8300 2091 4359 5770 6578 3514 9374 4428 6789 9766 3433 6166 7804 2323 2976 4799 2126 1929 1219 509 896 3165 7103 8612 7340 2270 4367 6589 9442 893 7186 4127 5082 8262 8975 6022 5308 7687 2662 7291 9543 9496 2636 9123 2932 9203 3320 4346 1231 2723 8297 5455 7806 5444 2006 8307 3311 2757 8254 247 885 986 4380 8657 7624 4249 8220 273 4135 1937 1367 716 9336 4088 9865 2696 6329 2731 1289 9437 4831 9305 210 6400 5580 965 3746 7444 7550 6820 249 3079 5061 5029 5086 9153 1739 129 161 2672 4116 6000 2601 515 7282 9461 255 2902 3014 2738 1219 667 2268 2502 3757 7486 1368 1853 3444 3784 355 5872 424 6268 2708 434 7634 7379 9837 6802 8068 4609 4989 7216 2358 2689 1582 4048 9810 8473 8314 2598 2624 463 8571 7174 8360 2203 5617 8934 7030 9925 3444 8217 8583 8327 1157 6836 767 7310 9691 1306 9397 6797 7242 1824 353 7860 3319 38 2257 5711 6940 6048 1159 7318 6579 6945 6988 6844 150 8202 6506 4948 5597 7942 2813 6063 8605 8194 3683 8634 9087 2144 5320 9513 5419 1551 9065 7347 1447 643 5051 1892 1547 9657 3059 7780 330 8147 695 865 2775 9855 7017 1702 9580 5186 9881 5579 1131 2126 9221 6287 3905 4438 1302 3209 655 4799 517 2264 3177 5848 5047 554 8266 5216 7369 6373 425 1565 6535 5018 5728 9739 1853 7238 1447 8348 5004 9689 9483 6548 92 7082 378 5231 5446 2507 8967 9307 1152 3280 8286 1017 5306 1727 1044 1349 5319 1862 6766 7161 2116 5636 410 6764 9337 2774 8738 9275 710 6544 2550 1182 9554 2988 53 4666 9883 3165 5960 7333 6435 3920 9374 4052 567 6490 5745 5292 9381 7381 6595 3927 1838 8049 9602 5416 5573 2563 3527 8215 245 9415 2831 4636 8684 901 8932 3057 8407 1861 4524 2511 5748 1186 7580 8005 8524 1396 465 9283 2083 5350 9082 3735 4434 1397 757 2612 2863 6326 294 2567 9011 4591 8143 5114 4577 9428 7249 364 3653 5743 3123 9772 1198 8063 8511 2761 1933 5678 2806 825 3503 2052 33 5496 2785 1682 3212 8901 4996 5746 9780 45 8307 9033 4184 3669 5305 479 1320 8536 5066 4800 491 5660 1519 1223 936 2292 4912 768 9223 4675 3381 3997 6566 1322 6909 7753 4775 430 763 +1000 +7806 6339 7140 7334 5531 51 1635 6367 2245 3713 7261 9158 6452 178 9225 539 6084 1181 3781 5677 8152 9993 1864 539 9662 6842 5612 7161 6606 2909 3003 8915 2089 8129 6824 2534 7776 6773 2879 1592 9079 7302 4029 314 2170 4096 120 3955 6078 1421 8487 4518 5309 867 1907 4842 3110 1944 7182 8679 7175 7151 6529 1326 6965 1400 7753 8143 7238 1218 256 2728 9954 27 7558 3477 6825 1257 748 9967 7246 4967 2171 4879 7620 6816 4351 4730 4570 4722 1349 5269 8963 9304 7968 4716 3523 7184 8343 2651 8926 2882 881 5435 586 4887 9327 9875 3186 3114 1394 1786 3396 1111 9290 8749 992 9928 9605 6447 4841 15 9964 5639 7266 6053 3100 3525 2523 2683 2481 2381 4237 2706 2903 3444 9741 657 1075 5830 2601 718 7352 1754 4250 9745 8454 1878 5402 854 8007 9430 4348 4418 2317 8145 4601 4122 9349 9959 5566 2681 6674 7619 5538 7614 5769 262 4869 703 5993 6461 5376 7430 3402 68 8141 931 7470 1567 1924 7723 1438 1069 2823 3834 6355 3696 5919 1147 8650 1316 6683 4497 6160 5701 1449 2490 9230 8326 384 7441 3442 5858 7364 1263 131 3393 9652 2444 80 8734 3168 6915 7472 9913 6703 7709 8469 7226 902 5260 226 8385 8538 6686 9230 5703 7728 2924 6344 1304 4938 314 9009 1519 8093 9369 2226 6193 891 1594 8769 9168 7592 8237 3856 8015 2888 3202 5969 3991 2873 6596 2497 320 4830 3981 5542 2540 2150 1755 9955 3333 7357 8247 1138 1595 7397 6043 2495 1147 99 8246 2557 6189 3664 8263 1341 7424 7550 1551 276 13 4738 7418 3924 6669 4441 2904 7783 3213 739 3182 1432 1018 2278 9791 7004 8284 1277 2607 1862 3519 6198 1550 8385 6078 1900 6866 4345 3547 3860 1582 1059 7867 1682 375 3892 3904 4311 1951 8197 1108 3578 5744 4853 5639 1031 6264 6365 1791 3669 4391 5861 5571 2909 1014 1210 2578 6457 9837 195 720 7652 7129 8387 6113 5446 5760 4639 674 3412 1815 3550 498 2389 808 7584 1661 773 2228 472 8146 2512 787 6010 2180 4388 9914 9441 406 9591 1326 4042 4551 8366 7532 1875 2523 26 7740 5972 2695 3735 1339 276 5354 3707 9187 3611 8240 1887 3338 5336 9478 7411 5170 5119 6800 1325 3166 7735 4373 280 3894 5765 7035 3775 4241 1352 8292 8606 8809 4087 5407 1335 9436 5978 385 9362 3880 6428 4294 9687 5139 2072 5527 5152 5752 4640 7966 9488 1414 4080 7228 2237 7107 4983 2142 7040 2787 3591 1011 2190 1468 9283 6993 1515 2842 5936 7160 1050 4825 7816 4872 7800 4406 5632 8863 9015 5227 8651 8283 9602 4053 9803 7887 6746 9151 7810 1093 1444 3897 5909 9078 6269 4129 601 9257 8483 5280 9506 6625 1285 4351 6469 460 6319 7721 7593 7986 9538 8235 8047 4146 4111 8943 7253 5721 1448 3020 2305 78 7900 8865 8505 7058 1121 9861 1295 4790 9720 9107 8191 8185 8352 2229 3273 1110 3299 5945 7961 7831 4868 5384 2344 3684 4253 9187 8857 6939 9358 1434 191 5305 8768 1093 9033 2536 2352 9 8906 5173 7793 9019 3609 7148 685 8778 2840 7121 4674 7915 1556 6019 3137 4511 4968 1988 5181 7203 4838 9813 6019 7916 6685 9837 7404 4127 2576 8686 7848 179 3955 7609 9652 6243 6210 3770 262 1922 2172 4824 4867 2396 6648 2211 8358 3695 8246 5116 4841 2955 6864 8966 6683 8254 9126 8851 8557 2353 9526 4118 2919 451 1506 19 1910 6402 8349 6742 8982 4444 2556 2441 785 4913 2640 4839 6291 4671 6299 724 8207 3546 7493 1702 6844 605 1347 7246 8504 6385 9390 7078 1055 1868 9703 8099 310 1212 8801 3569 3532 2471 2919 9473 1854 2395 7846 397 6619 146 1695 2050 468 8575 5858 5586 2573 1966 381 3074 185 9069 2018 8863 2981 293 6496 8437 8200 9078 1309 1325 1944 6888 2975 2072 7063 7685 7718 8178 5902 9355 8776 1334 374 3506 668 9950 7201 3713 4962 998 5369 7389 409 1035 1184 3121 469 4516 1502 4183 4065 3006 111 9471 8894 5570 7030 2719 2662 6777 477 9937 9606 2680 8104 7158 7944 6929 3440 7008 7625 9010 4888 7764 6398 2899 4917 8468 5104 1174 967 2083 2786 4041 6946 6001 2596 7551 1750 8871 9728 8511 6149 3621 5884 1203 9003 6937 7158 4908 3831 5644 133 7170 1230 4989 5867 8546 2109 5240 4546 3614 3180 785 6562 9143 3335 3570 9634 3526 7133 3893 5326 234 841 876 9930 9436 2074 3543 674 6468 2260 6142 9650 2449 1296 6007 5994 233 5330 9870 6700 5380 8181 414 4889 6659 9430 8589 6112 6928 9098 2210 6952 6398 3799 2483 9755 4911 3969 7874 4106 6778 4063 8157 5044 5895 4831 9495 5141 2458 7632 9715 9249 9858 8674 4411 2906 2566 9089 2364 9221 1624 6504 2765 5646 7021 4408 74 6372 4847 9203 4774 1764 3803 8359 471 9937 5060 4379 837 6388 5874 8807 856 4016 9429 5449 384 1848 5366 7074 6639 7940 6483 3451 9696 301 6923 161 1767 7950 7958 4618 819 8944 8365 1357 6675 1869 106 344 1062 1279 7379 8609 216 7693 741 3628 2342 6759 4585 1237 8276 7976 9978 3390 5508 1021 7019 6037 2918 1739 2253 6002 5048 7290 701 436 7877 2370 6779 7407 2914 263 5881 7125 511 4051 2358 4002 8666 6036 9436 7682 7427 3958 1413 9339 2902 7213 2039 3254 8843 5864 5758 9452 5763 8008 4118 7515 2140 3960 6979 5553 5450 3798 9517 290 542 6381 8541 9502 276 356 9409 759 4785 5375 5736 9578 5841 5535 2921 8175 7194 1654 4857 4431 7296 4590 9 685 505 4022 7261 9455 5257 5242 2689 4518 2801 8984 3342 4020 8380 2512 1651 6116 7052 5248 5864 +1000 +2348 6577 7242 3810 8069 6388 5268 6430 692 8702 2809 3067 4288 2712 3037 2723 1792 9455 7164 4686 3672 236 9028 3571 6992 1334 3675 2872 5140 260 6291 6173 2310 3303 516 7371 4299 3102 3206 4035 5028 7260 4366 5152 6251 4671 5713 3027 6313 725 1256 3869 1702 124 7869 1445 8631 8010 703 8077 7646 77 1015 7451 6855 6929 1223 1361 1812 3981 8154 6303 9433 4337 4654 7988 5811 7240 9682 7556 826 5008 7641 3221 6880 753 1741 8239 192 3476 851 1743 7481 6885 4970 7716 3616 8777 7482 1031 7046 5679 214 9712 8802 5927 6485 707 1938 1394 8794 7121 6841 5010 6176 3119 6883 5703 1217 2445 3955 3747 2959 116 2384 1633 1582 9589 7358 8693 5020 1256 1258 7504 892 8269 8617 4307 7323 1207 3152 7265 8296 6708 3929 2485 8584 2653 3285 5420 6940 5744 6978 8228 7967 9629 3496 549 3797 6543 8021 1900 3433 768 8242 9929 8556 9226 4296 4818 2156 9131 2501 7923 4466 5380 458 5967 546 8870 7199 9993 6879 1392 4848 2213 8818 3905 2623 8960 9054 3589 9175 408 1477 4973 9577 1724 1979 8892 5314 7218 3985 2719 7691 3161 6278 2516 119 8865 3372 132 2491 1113 8862 4126 8512 4153 8857 6990 8562 71 933 1098 8245 8193 6641 90 4188 2941 1266 4589 2088 6995 1979 7200 6367 8459 8384 3879 8473 5320 2920 2942 4790 7878 5294 8316 2422 3232 865 8123 8832 3604 9978 5877 6008 7302 2007 1862 9188 6213 4852 9453 8270 6230 318 5086 9970 6498 126 1786 1286 718 5440 224 4103 918 1178 9820 1860 8353 6380 4754 6308 3615 1136 100 408 5862 3985 3066 4041 8801 7922 5754 3430 4012 1285 877 6586 103 7610 1660 3562 2719 691 8052 6844 1120 7619 4708 8219 5446 6619 4477 975 1497 6593 9095 5747 5328 3855 8086 158 1309 9157 2325 4955 6575 1291 496 1437 5272 9087 2256 1567 3254 6180 2492 9830 6917 1508 9121 4739 2220 8378 1600 3989 4759 1143 7785 6428 6906 9872 142 3194 9116 8309 7097 5176 3702 4736 4683 7387 7614 407 6201 2705 5835 7323 9592 6272 7945 5646 3394 498 1717 1423 9821 4277 7925 1273 5928 7366 8520 5244 7017 348 6813 1492 3291 5989 4629 216 5220 2611 8387 434 9231 5597 9704 8926 6702 7479 4311 2884 9074 5036 9859 7318 6754 9796 9264 545 3747 5271 881 5235 8736 1489 3040 332 910 3618 7436 1358 8383 4138 4893 6444 8628 2391 9514 711 1066 483 7491 6140 3583 3638 7203 3736 7598 1496 1723 5899 970 4497 2456 9341 4954 5297 3572 4840 2435 6166 2964 2369 7178 4377 8913 4020 3433 779 1916 6282 285 5830 9945 1153 7429 5629 7163 8937 1059 5711 5632 9644 6082 2212 420 5789 3534 8251 442 9072 3481 4945 7457 2519 214 3666 6783 177 1277 2160 9524 5572 1602 6658 8234 3682 1246 3284 8848 1580 9568 1829 4343 4789 1775 5739 5847 2340 8958 2213 6530 6483 1297 3364 6065 285 7654 2353 1203 384 7386 5143 2624 9535 9132 8725 9591 4924 5207 4471 4306 2019 8001 2514 3928 4263 5817 1040 8499 9109 5047 5419 6320 3028 6982 1935 9869 2472 3895 3247 269 6946 6690 1902 4206 5379 4275 9961 6774 7343 7424 6030 139 9774 8396 2015 8313 5839 7189 7502 9097 1993 8866 5247 8499 2330 8402 2004 9162 5455 7304 4983 4998 8758 6048 705 990 4370 8373 888 9142 1003 9529 706 7468 4578 3760 7548 3038 1137 7788 8833 5162 3416 601 5232 1450 3347 2200 4175 7549 1640 9018 665 7027 7482 9288 7241 9945 1592 9897 6731 8574 2688 1653 8431 8852 6575 9877 4943 3679 3788 2718 5856 9573 3207 1623 9046 9478 8332 7026 654 4864 3221 7675 844 9991 7305 3939 6654 4975 8741 3298 7142 8217 4611 123 7654 3045 9059 7863 1649 3626 2190 3642 6160 6820 1066 7091 684 5633 6966 8670 3412 9690 7847 3130 346 5831 6821 1371 8756 2912 454 2116 9490 3231 1279 6876 738 821 9179 8839 5269 9109 2609 6413 3757 9873 546 7758 3098 697 7204 1295 9511 6475 7910 2027 8993 6643 5197 2740 5980 673 5576 2577 7010 6514 2370 8795 6183 5477 9433 1106 5164 2311 4855 7731 8479 5799 9524 7541 4142 6723 8215 6123 8088 2952 4722 2090 4676 360 8693 3574 8567 797 3073 5426 5307 5192 2538 2402 8061 9265 3438 2367 7115 3815 9679 4551 3178 1946 6645 3815 1532 1567 7460 7978 2417 1792 7980 434 7491 2647 6075 5247 4095 6286 1069 9540 5303 9092 4274 7684 9863 8535 9971 9261 2966 1407 4793 5911 7795 6621 7597 5465 856 705 4836 238 8777 8456 3378 6063 1162 5144 6444 4383 4682 4413 4984 7953 2513 4282 6799 1541 1135 792 3211 7387 318 4180 7719 5192 4883 8544 649 5920 7217 7579 1363 5783 772 4361 3691 6141 6855 6752 8544 665 8862 6774 8392 6783 3096 6894 6815 4753 1634 9222 3637 4287 909 1314 7227 1119 9702 2713 9204 3558 939 2092 8596 9273 5760 1024 8907 4548 6610 4026 4824 8775 4858 626 1739 3872 1519 6410 1271 1559 554 556 8655 4300 8986 1801 7128 4242 5150 1226 9364 1986 8699 1005 4329 2470 5666 9716 6081 9513 9981 8905 1692 7350 1790 6547 7626 52 2744 6665 539 2904 2472 7274 5694 4197 9172 7438 5438 3052 9268 510 3061 8900 959 2651 543 9567 6698 5297 3541 496 9487 737 5883 3758 6897 2340 9312 896 4008 2192 1107 1705 7243 8143 1291 1837 7889 1490 3617 3250 8278 4981 9407 1 1232 4151 6680 2808 579 5475 1857 6567 2806 5676 1662 1666 8601 1081 5817 6818 2055 8744 4091 4054 3012 7286 2648 2188 6304 6618 2572 8916 7613 7577 7691 2276 9391 8502 6158 8359 +1000 +9777 2751 7049 2044 9493 5599 1543 453 7435 3757 8853 7003 8204 3379 2149 9603 2334 5406 6058 4518 1355 5222 4107 3964 807 155 9534 915 8467 5639 2454 2509 6190 9420 7649 7577 7260 3560 8796 2070 418 3890 9365 7129 7659 7673 5150 1098 1533 6153 9390 5828 8510 9742 3618 573 7704 3437 1240 6367 9464 144 7880 441 648 2232 5713 700 8175 3339 1193 5572 4179 429 3258 9780 5411 8362 8134 466 3753 7715 5867 5441 8047 7159 7578 8657 4803 6823 4300 3235 4747 7938 4115 8097 8998 6 7359 3230 4170 6848 5457 9880 1068 456 147 3659 4154 7251 8825 4648 984 8705 3930 5521 484 7997 8527 4284 6513 7555 2084 605 9665 5932 4543 6532 818 1919 3228 5991 5491 7645 5052 2371 95 9238 1846 7930 3150 5864 7300 3067 9932 7779 9025 7773 8477 874 9844 2217 3627 3968 2026 7158 6544 4547 3393 9558 1428 9378 803 8254 4569 5933 8491 9030 8449 6882 1854 9325 8761 2394 8430 360 2609 5440 4465 8096 4179 2173 2446 9194 2800 136 1765 9225 4903 5074 5067 8895 2066 4279 4579 7030 5547 4283 9839 6144 4042 3638 5236 3950 8042 8315 2181 7601 3388 1277 9057 7442 9886 6977 4877 1068 8921 6665 2941 4545 2347 3707 745 5283 5607 8884 3513 8308 5216 1723 778 858 9547 6222 4878 6138 8576 273 5804 5111 8012 3506 5353 3152 6598 6594 4747 3870 7592 1809 9056 4864 2649 388 5770 1098 5271 2585 4961 3493 8531 3609 557 5578 3891 6355 7227 1185 494 355 4977 164 1404 5188 6967 5051 5670 1684 5593 4055 3625 8502 848 9537 8989 5171 2049 1914 9294 182 4888 6405 350 8176 2946 9216 3229 7614 2271 5376 498 9746 2515 3193 3331 5369 8259 9270 3038 6221 6326 2554 1944 7317 8000 2463 4179 4864 5320 1013 3926 9444 4532 8383 2472 3707 8835 5951 1246 9632 6015 4602 9233 1835 8940 4063 2271 81 3338 7229 9364 9382 1070 9673 7723 3704 7971 7400 2855 9978 837 2574 3418 8476 9805 6896 2153 6740 7085 2498 5807 4229 2250 9607 4780 7285 340 2177 3714 2436 2374 4474 7045 202 7751 4988 8179 7714 624 8032 5226 1614 1582 1242 6440 8964 9140 1422 4521 2912 3245 8975 570 7583 7095 7388 6050 3940 3616 4406 5068 7141 1181 2547 3751 6636 9909 9199 8992 4045 1056 9055 8636 7987 2454 6078 7876 3310 3842 6540 9270 1273 1609 879 6630 8611 1921 4540 7792 3343 6089 4529 351 4640 3117 7474 2435 8641 1125 3375 3927 5450 2803 5423 6904 6476 8178 5555 4722 6301 1581 1321 1200 2724 9190 1309 2320 7545 3271 4862 2471 8071 6179 3053 8118 2056 8567 1840 4696 2775 1755 9542 8857 3246 3548 2528 2395 6638 3941 4293 8625 8647 2178 5668 7821 1063 5753 9735 8047 7012 538 813 956 9970 5267 7651 2191 614 3184 2500 110 8696 5966 2281 8437 8911 8209 9929 7144 9257 9095 7822 1180 4093 9372 1687 2057 8290 296 2889 6770 1570 8213 1800 7881 3188 3292 4595 8372 7318 6783 486 7284 322 6661 9826 6089 6953 5255 8187 3836 7389 6274 8028 5462 1298 2037 6455 2140 7905 5442 8843 2747 9290 5751 4857 8082 97 3229 9293 57 6937 8371 9130 7895 319 7779 1224 4197 2636 7615 9855 9528 7178 8907 9447 5020 1540 8289 1066 4947 4700 4240 4928 3635 4114 488 56 7559 4622 5271 4685 8300 6575 7984 837 5002 1396 8975 6449 9880 5290 1909 1758 3105 5391 6546 5069 3167 5673 8478 9184 9180 7259 9835 8506 3431 6577 7060 2528 780 5005 9582 3172 7981 5829 9347 7512 2118 6261 7057 7893 2653 5341 5144 717 1598 3586 6147 2883 7949 1364 6365 5986 4387 5841 2273 8169 8878 7544 1195 8284 2057 376 9065 3116 3748 2183 1145 7650 7517 8139 3485 949 8765 8163 302 2912 7533 3930 734 616 2991 7133 4194 5708 5886 4945 2208 4089 9629 2251 3825 6467 3769 6771 4805 6208 145 96 5103 1889 3699 6849 6282 2765 7703 7282 8198 6668 2478 8260 7792 1439 888 4062 7870 3640 4323 4245 8522 8546 184 4074 9110 3310 2675 2082 1124 9162 4260 8652 8175 8418 5670 9728 7009 5704 8864 4405 8151 2937 794 7015 4603 3350 1325 7698 8047 410 9486 9748 5147 1851 5133 7056 7529 6699 8392 9695 6058 3873 8424 4003 2773 7007 2894 4017 3280 9380 3703 73 4170 7082 1713 701 9529 3048 3382 9347 8869 4106 8433 4953 7727 767 9164 6643 8236 6970 2324 1926 5969 1705 3263 5646 8542 3552 212 4504 3837 9449 3025 8536 7148 3117 3227 9301 2084 1711 8875 9304 4348 2331 1122 7123 6467 7056 3464 7677 7255 3298 6503 2369 4991 6015 5658 4519 5092 1924 3432 7017 5326 716 5509 2041 3835 4450 4917 5179 1732 5188 4529 3571 5246 9940 853 5025 1177 7326 7447 5428 8774 2544 6480 1684 8642 6920 2954 374 4692 1239 4012 6046 4923 1832 3089 2692 8978 3137 6796 9681 5721 542 7271 9614 68 2868 4446 5560 6975 2867 2805 7108 6475 8755 8465 4435 5556 4303 258 134 724 4148 868 4774 1315 9813 3360 4280 2467 2402 4051 9181 3271 5229 9707 9222 2235 6049 2041 5064 1830 286 5507 4924 718 5643 6816 466 6780 5830 8253 6209 6987 9403 8560 714 4747 569 5486 3231 6359 5374 9500 7378 1390 2991 8912 4633 567 9969 7710 6352 4091 1084 6934 4780 2766 9535 1099 2825 4345 9357 7050 6329 715 3558 1443 6957 4618 6283 4145 3952 6004 3033 2798 4607 9346 8224 1037 6303 6993 7257 4982 7137 9347 2090 6994 6305 6889 9330 306 9171 437 1507 228 9614 8537 1268 3843 2074 9233 3053 6260 808 8458 688 1277 609 9677 3917 4479 9752 6426 2696 1330 8915 5055 3931 +1000 +9639 2312 8146 553 6878 762 7774 6023 491 8858 246 1798 3398 5747 8948 491 2249 6189 2463 6165 1038 847 2125 287 3535 2267 6896 2043 4632 856 4896 6263 4343 1977 966 1963 6778 7802 1582 6233 4040 6500 6821 7656 2748 5910 8329 8006 6218 8319 2067 1493 3447 6855 7481 7044 4359 1196 3319 9742 6276 9403 5814 6158 6994 6297 9751 9620 7540 5759 8707 6554 3767 3794 1144 9044 5106 9230 3018 1676 6655 3365 205 9650 6289 444 6662 9968 4662 7836 6540 2913 2987 5537 6753 3373 7728 2399 9207 1144 4421 6536 2831 275 5803 4066 2423 1708 8637 3172 7307 5966 2590 2008 5358 2270 8153 5576 9507 6174 7366 2326 8413 6750 9530 661 8936 1693 9755 7654 844 3212 2677 88 4277 446 7861 4054 101 3705 3190 7460 1738 9416 6172 8060 1648 6663 6145 4740 2463 7370 5601 2296 6589 2865 8406 2663 3618 414 9104 9111 5489 6901 2499 7281 8475 3328 2167 4430 4705 6482 6368 9820 2641 2380 2922 9475 1132 6598 9173 2076 9913 8152 7371 2894 3627 1934 456 2800 1994 4735 4683 2326 9639 3918 9997 4771 2063 9690 9566 3249 5470 1922 7717 6685 2802 3971 6374 8843 2890 2223 1279 7646 4247 7512 5030 5529 5514 9896 818 7631 1815 4401 9212 7558 6480 6784 8038 8733 4132 3679 4054 384 3815 9111 9871 2039 5030 2000 3784 8491 3375 4840 2917 6454 2054 4738 9224 6593 1953 2925 3461 2468 6596 4463 598 7456 5444 516 1065 342 3726 9778 6101 1976 7403 3943 7188 1167 6216 3821 2095 9941 1576 5679 4484 3964 1379 766 9509 4685 919 2485 6743 1959 9837 8578 9095 6075 9009 6232 9288 5844 3408 8622 383 8639 508 6948 5244 915 3621 8952 3545 8894 4998 9797 223 4571 5593 2471 296 8263 6492 7496 1902 7622 4456 4865 8433 1680 1629 1094 3575 924 6018 8094 2048 8887 5966 8989 5822 9637 1459 1030 6915 1497 9235 6897 2987 2144 9109 32 605 8166 557 631 8793 6606 7433 4503 8732 4184 64 8597 5697 2348 669 5087 324 7435 1196 5786 6931 6267 1270 6808 9799 8251 9481 920 8198 303 9584 6213 5974 1025 4525 856 6662 6365 3939 2823 2609 827 8978 7683 4197 4123 3634 9123 1821 5908 5878 8626 1255 3367 6463 8313 230 6903 7124 424 8866 4761 8152 9504 9750 8561 2737 7575 829 6009 4516 1555 7094 3428 7711 4503 9033 7488 755 8122 1890 693 572 6374 6234 3733 9731 5479 2456 9292 3562 406 2080 583 8821 9357 3252 3765 4371 1910 1508 3898 3499 6440 7808 8049 2019 7613 8283 7816 8996 9220 4879 2063 4134 7640 4333 5379 985 5083 3779 14 5464 6435 9952 2071 1666 5686 9305 5987 6117 6268 3834 4693 5904 5607 7431 9201 7599 7708 6658 3187 1949 4506 7647 2107 6029 2734 1023 8485 7444 5176 8681 1679 9960 532 5966 1310 3962 3839 9254 2641 6433 5857 528 1701 2325 6890 3277 854 487 6544 5307 6049 2284 6659 947 6211 5997 513 9991 8209 3037 8435 7695 3309 9182 4945 4246 2455 9686 8991 4411 3020 8298 1465 296 1279 2251 3150 4953 4862 5829 2676 4857 8830 3321 8430 3447 225 4596 2362 9442 7713 8242 334 2531 5100 9108 1807 7191 4986 420 4445 4925 7376 5896 1843 4085 944 9357 616 5258 6787 8225 5305 8968 7012 6079 5822 8437 5186 9531 336 9571 1135 7028 7069 5674 6891 2369 2906 1704 3253 1193 6849 7847 8475 1584 3648 4257 878 3569 7451 3343 5062 2051 2465 7660 762 4520 9601 5243 851 6316 3956 6378 4094 3450 9682 692 7547 349 7455 5796 7822 8987 4204 3706 7221 5831 5829 6643 8180 2530 1965 5138 766 6566 2612 5074 9781 2888 9977 9065 2796 8682 7273 3118 1343 4371 6510 1142 1029 2320 2425 4539 8031 1167 7994 6671 1492 2002 8507 4381 3421 5877 3457 963 9981 2875 4664 6183 7573 7668 1919 3299 895 3958 4196 6806 199 7686 7523 4920 7299 9431 4001 1299 5696 3809 1770 2310 4782 9959 3559 8264 9339 3459 7460 7878 8016 6788 4335 3295 1263 859 977 3423 5675 1826 3009 5082 5167 9864 2441 8448 9519 320 173 3190 4143 3990 6362 7898 3293 8814 16 4654 9621 7073 7092 2738 4624 3226 8141 2876 4229 2518 5879 6093 5758 9692 5660 3728 1925 4109 2077 20 9080 5865 96 2449 5474 557 3902 3154 4236 1324 4436 5398 993 5252 6549 4287 523 4933 8812 4165 793 991 2481 8269 3959 9123 2802 2030 3170 433 1600 2717 761 7453 9660 8620 5221 4202 9656 9554 927 8146 6454 9666 1985 2945 7721 762 7334 3580 5532 6068 2662 8498 5604 2240 6233 1294 6016 8151 3099 1603 4977 8346 7844 3438 7109 6674 9104 6342 8352 3959 5314 6474 1766 9994 7610 2115 7455 4245 9011 8236 3498 541 1324 8666 826 1181 8741 2840 5768 3882 5468 9297 3141 5460 8633 1628 1142 1759 7375 1751 5303 2416 390 8111 2993 2804 6167 5599 7626 4525 1119 3759 9786 9601 1782 3031 3646 8826 1602 8771 8772 1168 6826 4699 2017 7393 4919 7094 6535 6430 5392 7880 382 639 6163 3336 9412 5915 2567 2672 8897 2109 9701 3780 9637 9651 5557 6445 9371 2844 567 4169 1076 6744 264 7132 2428 859 136 563 3141 7183 668 2252 9536 8240 5558 293 584 1247 7575 6209 9156 4543 2772 8475 2248 9701 6909 6125 9568 6881 2638 6834 7825 8145 5841 4451 9145 1306 198 6878 2215 3161 5293 7606 8273 6437 3856 7878 9103 7154 4239 4702 2771 1707 1337 2249 5128 2701 1969 783 4134 9206 3507 569 6890 6179 9534 6148 3259 2063 3712 8936 4986 4638 9231 3829 6834 2002 7948 2883 8488 5726 5374 7990 8826 9620 3779 3554 869 649 6824 3266 2163 diff --git a/CodeJam/Google CodeJam 2015/Ominous Omino-Large.cpp b/CodeJam/Google CodeJam 2015/Ominous Omino-Large.cpp new file mode 100755 index 0000000..a7e393b --- /dev/null +++ b/CodeJam/Google CodeJam 2015/Ominous Omino-Large.cpp @@ -0,0 +1,47 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + freopen("D-large.in", "r", stdin); + freopen("Ominous-Omino-Output-Large.out", "w", stdout); + ll t, cases; + cin >> t; + cases = t; + while(t--) + { + ll x, r, c, d; + string winner; + cin >> x >> r >> c; + d = floor(x/2); + if(x == 2) + { + if((r*c) % 2 == 0) + { + winner = "GABRIEL"; + } + else + { + winner = "RICHARD"; + } + } + else if((r*c) % x != 0) + { + winner = "RICHARD"; + } + else if(r <= d || c <= d) + { + winner = "RICHARD"; + } + else + { + winner = "GABRIEL"; + } + + cout << "Case #" << (cases - t) << ": " << winner << endl; + } + return 0; +} diff --git a/CodeJam/Google CodeJam 2015/Ominous Omino-Small.cpp b/CodeJam/Google CodeJam 2015/Ominous Omino-Small.cpp new file mode 100755 index 0000000..3aa6153 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/Ominous Omino-Small.cpp @@ -0,0 +1,73 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + freopen("D-small-attempt0.in", "r", stdin); + freopen("Ominous-Omino-Output.out", "w", stdout); + ll t, cases; + cin >> t; + cases = t; + while(t--) + { + ll x, r, c; + string winner; + cin >> x >> r >> c; + if(x == 1) + { + winner = "GABRIEL"; + } + else if(x == 2) + { + if((r*c) % x == 0) + { + winner = "GABRIEL"; + } + else + { + winner = "RICHARD"; + } + } + else if(x == 3) + { + if((r*c) % x != 0) + { + winner = "RICHARD"; + } + else + { + if(r == 1 || c == 1) + { + winner = "RICHARD"; + } + else + { + winner = "GABRIEL"; + } + } + } + else if(x == 4) + { + if((r*c) % x != 0) + { + winner = "RICHARD"; + } + else + { + if(r <= 2 || c <= 2) + { + winner = "RICHARD"; + } + else + { + winner = "GABRIEL"; + } + } + } + cout << "Case #" << (cases - t) << ": " << winner << endl; + } + return 0; +} diff --git a/CodeJam/Google CodeJam 2015/Ominous-Omino-Output-Large.out b/CodeJam/Google CodeJam 2015/Ominous-Omino-Output-Large.out new file mode 100755 index 0000000..1ccc617 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/Ominous-Omino-Output-Large.out @@ -0,0 +1,100 @@ +Case #1: GABRIEL +Case #2: RICHARD +Case #3: RICHARD +Case #4: GABRIEL +Case #5: RICHARD +Case #6: RICHARD +Case #7: GABRIEL +Case #8: GABRIEL +Case #9: GABRIEL +Case #10: GABRIEL +Case #11: RICHARD +Case #12: RICHARD +Case #13: GABRIEL +Case #14: GABRIEL +Case #15: RICHARD +Case #16: RICHARD +Case #17: RICHARD +Case #18: RICHARD +Case #19: GABRIEL +Case #20: GABRIEL +Case #21: RICHARD +Case #22: RICHARD +Case #23: RICHARD +Case #24: GABRIEL +Case #25: RICHARD +Case #26: RICHARD +Case #27: RICHARD +Case #28: RICHARD +Case #29: GABRIEL +Case #30: GABRIEL +Case #31: RICHARD +Case #32: GABRIEL +Case #33: GABRIEL +Case #34: RICHARD +Case #35: RICHARD +Case #36: GABRIEL +Case #37: RICHARD +Case #38: RICHARD +Case #39: RICHARD +Case #40: RICHARD +Case #41: RICHARD +Case #42: GABRIEL +Case #43: GABRIEL +Case #44: GABRIEL +Case #45: RICHARD +Case #46: RICHARD +Case #47: GABRIEL +Case #48: RICHARD +Case #49: GABRIEL +Case #50: RICHARD +Case #51: RICHARD +Case #52: GABRIEL +Case #53: RICHARD +Case #54: RICHARD +Case #55: GABRIEL +Case #56: GABRIEL +Case #57: RICHARD +Case #58: RICHARD +Case #59: GABRIEL +Case #60: RICHARD +Case #61: RICHARD +Case #62: GABRIEL +Case #63: RICHARD +Case #64: RICHARD +Case #65: RICHARD +Case #66: RICHARD +Case #67: RICHARD +Case #68: RICHARD +Case #69: GABRIEL +Case #70: GABRIEL +Case #71: GABRIEL +Case #72: RICHARD +Case #73: GABRIEL +Case #74: GABRIEL +Case #75: GABRIEL +Case #76: GABRIEL +Case #77: RICHARD +Case #78: GABRIEL +Case #79: GABRIEL +Case #80: RICHARD +Case #81: RICHARD +Case #82: GABRIEL +Case #83: RICHARD +Case #84: RICHARD +Case #85: GABRIEL +Case #86: GABRIEL +Case #87: GABRIEL +Case #88: GABRIEL +Case #89: RICHARD +Case #90: GABRIEL +Case #91: GABRIEL +Case #92: GABRIEL +Case #93: GABRIEL +Case #94: GABRIEL +Case #95: RICHARD +Case #96: GABRIEL +Case #97: GABRIEL +Case #98: GABRIEL +Case #99: GABRIEL +Case #100: GABRIEL diff --git a/CodeJam/Google CodeJam 2015/Ominous-Omino-Output.out b/CodeJam/Google CodeJam 2015/Ominous-Omino-Output.out new file mode 100755 index 0000000..ee3d8c6 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/Ominous-Omino-Output.out @@ -0,0 +1,64 @@ +Case #1: GABRIEL +Case #2: RICHARD +Case #3: RICHARD +Case #4: GABRIEL +Case #5: GABRIEL +Case #6: RICHARD +Case #7: GABRIEL +Case #8: GABRIEL +Case #9: RICHARD +Case #10: GABRIEL +Case #11: GABRIEL +Case #12: GABRIEL +Case #13: GABRIEL +Case #14: GABRIEL +Case #15: RICHARD +Case #16: RICHARD +Case #17: GABRIEL +Case #18: GABRIEL +Case #19: GABRIEL +Case #20: GABRIEL +Case #21: GABRIEL +Case #22: GABRIEL +Case #23: RICHARD +Case #24: RICHARD +Case #25: RICHARD +Case #26: GABRIEL +Case #27: GABRIEL +Case #28: RICHARD +Case #29: RICHARD +Case #30: GABRIEL +Case #31: RICHARD +Case #32: RICHARD +Case #33: RICHARD +Case #34: RICHARD +Case #35: GABRIEL +Case #36: GABRIEL +Case #37: RICHARD +Case #38: GABRIEL +Case #39: GABRIEL +Case #40: RICHARD +Case #41: RICHARD +Case #42: GABRIEL +Case #43: GABRIEL +Case #44: GABRIEL +Case #45: RICHARD +Case #46: RICHARD +Case #47: RICHARD +Case #48: GABRIEL +Case #49: RICHARD +Case #50: GABRIEL +Case #51: GABRIEL +Case #52: GABRIEL +Case #53: GABRIEL +Case #54: RICHARD +Case #55: GABRIEL +Case #56: GABRIEL +Case #57: RICHARD +Case #58: GABRIEL +Case #59: RICHARD +Case #60: GABRIEL +Case #61: RICHARD +Case #62: RICHARD +Case #63: GABRIEL +Case #64: RICHARD diff --git a/CodeJam/Google CodeJam 2015/Standing Ovation.cpp b/CodeJam/Google CodeJam 2015/Standing Ovation.cpp new file mode 100755 index 0000000..393b879 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/Standing Ovation.cpp @@ -0,0 +1,35 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + freopen("A-small-attempt0.in", "r", stdin); + freopen("Standing-Ovation-Output.out", "w", stdout); + ll t, cases; + cin >> t; + cases = t; + while(t--) + { + ll numberStanding = 0, minReq = 0, maxShyness; + cin >> maxShyness; + string audience; + cin >> audience; + for(int i = 0; i < audience.length(); i++) + { + if(numberStanding >= i) + { + numberStanding += audience[i] - '0'; + } + else if(audience[i] - '0' > 0) + { + minReq += (i - numberStanding); + numberStanding += audience[i] - '0' + (i - numberStanding); + } + } + cout << "Case #" << (cases - t) << ": " << minReq << endl; + } + return 0; +} diff --git a/CodeJam/Google CodeJam 2015/Standing-Ovation-Output.out b/CodeJam/Google CodeJam 2015/Standing-Ovation-Output.out new file mode 100755 index 0000000..6970550 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/Standing-Ovation-Output.out @@ -0,0 +1,100 @@ +Case #1: 0 +Case #2: 0 +Case #3: 6 +Case #4: 0 +Case #5: 4 +Case #6: 2 +Case #7: 0 +Case #8: 2 +Case #9: 0 +Case #10: 0 +Case #11: 0 +Case #12: 2 +Case #13: 0 +Case #14: 2 +Case #15: 1 +Case #16: 1 +Case #17: 0 +Case #18: 0 +Case #19: 0 +Case #20: 0 +Case #21: 4 +Case #22: 0 +Case #23: 0 +Case #24: 0 +Case #25: 0 +Case #26: 0 +Case #27: 0 +Case #28: 2 +Case #29: 0 +Case #30: 1 +Case #31: 0 +Case #32: 0 +Case #33: 0 +Case #34: 2 +Case #35: 0 +Case #36: 0 +Case #37: 5 +Case #38: 1 +Case #39: 0 +Case #40: 0 +Case #41: 2 +Case #42: 0 +Case #43: 3 +Case #44: 0 +Case #45: 0 +Case #46: 1 +Case #47: 0 +Case #48: 0 +Case #49: 3 +Case #50: 0 +Case #51: 3 +Case #52: 0 +Case #53: 5 +Case #54: 1 +Case #55: 0 +Case #56: 1 +Case #57: 0 +Case #58: 4 +Case #59: 4 +Case #60: 0 +Case #61: 0 +Case #62: 6 +Case #63: 3 +Case #64: 6 +Case #65: 1 +Case #66: 1 +Case #67: 1 +Case #68: 0 +Case #69: 0 +Case #70: 2 +Case #71: 0 +Case #72: 0 +Case #73: 0 +Case #74: 0 +Case #75: 0 +Case #76: 0 +Case #77: 0 +Case #78: 2 +Case #79: 0 +Case #80: 0 +Case #81: 0 +Case #82: 0 +Case #83: 0 +Case #84: 0 +Case #85: 1 +Case #86: 1 +Case #87: 0 +Case #88: 2 +Case #89: 0 +Case #90: 0 +Case #91: 1 +Case #92: 1 +Case #93: 3 +Case #94: 0 +Case #95: 0 +Case #96: 0 +Case #97: 0 +Case #98: 5 +Case #99: 0 +Case #100: 4 diff --git a/CodeJam/Google CodeJam 2015/Standing-Ovation-Output1.out b/CodeJam/Google CodeJam 2015/Standing-Ovation-Output1.out new file mode 100755 index 0000000..f8d3972 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/Standing-Ovation-Output1.out @@ -0,0 +1,100 @@ +Case #1: 1000 +Case #2: 0 +Case #3: 17 +Case #4: 24 +Case #5: 0 +Case #6: 0 +Case #7: 121 +Case #8: 10 +Case #9: 0 +Case #10: 62 +Case #11: 78 +Case #12: 1 +Case #13: 0 +Case #14: 0 +Case #15: 43 +Case #16: 73 +Case #17: 0 +Case #18: 0 +Case #19: 0 +Case #20: 28 +Case #21: 92 +Case #22: 0 +Case #23: 0 +Case #24: 107 +Case #25: 1 +Case #26: 0 +Case #27: 112 +Case #28: 0 +Case #29: 0 +Case #30: 49 +Case #31: 0 +Case #32: 45 +Case #33: 0 +Case #34: 29 +Case #35: 0 +Case #36: 27 +Case #37: 0 +Case #38: 0 +Case #39: 33 +Case #40: 0 +Case #41: 0 +Case #42: 0 +Case #43: 0 +Case #44: 99 +Case #45: 59 +Case #46: 2 +Case #47: 0 +Case #48: 0 +Case #49: 0 +Case #50: 25 +Case #51: 40 +Case #52: 0 +Case #53: 33 +Case #54: 0 +Case #55: 6 +Case #56: 0 +Case #57: 83 +Case #58: 0 +Case #59: 0 +Case #60: 0 +Case #61: 48 +Case #62: 0 +Case #63: 26 +Case #64: 21 +Case #65: 15 +Case #66: 0 +Case #67: 0 +Case #68: 0 +Case #69: 26 +Case #70: 21 +Case #71: 6 +Case #72: 2 +Case #73: 0 +Case #74: 0 +Case #75: 0 +Case #76: 41 +Case #77: 0 +Case #78: 0 +Case #79: 59 +Case #80: 0 +Case #81: 7 +Case #82: 0 +Case #83: 23 +Case #84: 12 +Case #85: 0 +Case #86: 96 +Case #87: 44 +Case #88: 110 +Case #89: 35 +Case #90: 70 +Case #91: 8 +Case #92: 0 +Case #93: 25 +Case #94: 0 +Case #95: 0 +Case #96: 9 +Case #97: 0 +Case #98: 132 +Case #99: 0 +Case #100: 14 diff --git a/CodeJam/Google CodeJam 2015/gmon.out b/CodeJam/Google CodeJam 2015/gmon.out new file mode 100755 index 0000000000000000000000000000000000000000..8ccef07d606a57601aabcccd61152e0ebc02055e GIT binary patch literal 244564 zcmeIuK?#6B07bzMYJ>%kM)76=BWwv92-esZ#xaMWIhJ{scb}!KIj=4IJ>;0D)FkbF zGX56<0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk h1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009F134AwF24nyL literal 0 HcmV?d00001 diff --git a/CodeJam/Google CodeJam 2015/input.in b/CodeJam/Google CodeJam 2015/input.in new file mode 100755 index 0000000..eaccd21 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/input.in @@ -0,0 +1,5 @@ +4 +4 11111 +1 09 +5 110011 +0 1 \ No newline at end of file diff --git a/CodeJam/Google CodeJam 2015/test.in b/CodeJam/Google CodeJam 2015/test.in new file mode 100755 index 0000000..7c16347 --- /dev/null +++ b/CodeJam/Google CodeJam 2015/test.in @@ -0,0 +1,9 @@ +4 +4 +10 5 15 5 +2 +100 100 +8 +81 81 81 81 81 81 81 0 +6 +23 90 40 0 100 9 \ No newline at end of file diff --git a/CodeJam/Store Credit.cpp b/CodeJam/Store Credit.cpp new file mode 100755 index 0000000..91578a3 --- /dev/null +++ b/CodeJam/Store Credit.cpp @@ -0,0 +1,39 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + freopen("A-large-practice.in", "r", stdin); + freopen("out.out", "w", stdout); + int t; + cin >> t; + for(int z = 1; z <= t; z++) + { + int C, I, s, i, j, flag = 0; + cin >> C >> I; + int prices[I]; + for(i = 0; i < I; i++) + { + cin >> prices[i]; + } + for(i = 0; i < I; i++) + { + s = C - prices[i]; + for(j = i+1; j < I; j++) + { + if(prices[j] == s) + { + flag = 1; + break; + } + } + if(flag) + { + break; + } + } + cout << "Case #" << z << ": " << i+1 << " " << j+1 << endl; + } + return 0; +} diff --git a/Contests/.DS_Store b/Contests/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4f385a8143de40416e5ca2b82e5d082bdaa03369 GIT binary patch literal 6148 zcmeHKOHRW;41F#|6tSQZ8zeTfWQD{HLRFC10lfh9Ly2gcina@OIR;1LHt_5jRq1bw z0NIiKCXVgNycuOO0Hn3(Ujj`44XR@8kYBzc z+@0VG6AU?T)%hD>#;c(B0zFJIy&V<3?x^T8Lzl}9_590(EnOl*j2S;+e1Qe#tMT%% z7Jr5gUNB(&5#xJ!wYTVV{ituO74SsOt>$d|Tgc~H)nis&FgxI$sFiZs9oaU9kIEPh z*q=tv*;|gumJw8=b<{4-fHU9>{6z-1XR9=hBD!@3oB?NG$$)+z0#z|fSVpu@2aO#8 zh;_P6*w&vz%?Sy!gk?lNp-4<6##Bj142kLVhZL73EF;ErNIHB->RHkWMXYz$4;Bu| zBD!@3oPkva_Tp_*_y6nN=l|6tzjFqhfq%t-)Z3kQi$h9#>&D=8uMN~ks*1*y5tk`! h*jCI~-HK1CCiDkw5VM43M0zOxBVaVRaRz>rfp173Tsr^& literal 0 HcmV?d00001 diff --git a/Contests/Angry Professor.cpp b/Contests/Angry Professor.cpp new file mode 100755 index 0000000..715129d --- /dev/null +++ b/Contests/Angry Professor.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(0); + int T; + cin >> T; + while(T--) + { + int N, K, count = 0; + cin >> N >> K; + for(int i = 0; i < N; i++) + { + int s; + cin >> s; + if(s <= 0) + { + count++; + } + } + if(count >= K) + { + cout << "NO" << endl; + } + else{ + cout << "YES" << endl; + } + } + return 0; +} diff --git a/Contests/SherlockAndPermutations.cpp b/Contests/SherlockAndPermutations.cpp new file mode 100755 index 0000000..b65de3a --- /dev/null +++ b/Contests/SherlockAndPermutations.cpp @@ -0,0 +1,26 @@ +#include +#include +using namespace std; +unsigned long long int factorial[1001]; + +int main() +{ + long long int t; + cin >> t; + while(t--) + { + long long int n, m, ans; + cin >> n >> m; + long long int mod = (int)pow(10, 9) + 7; + factorial[0] = 1; + factorial[1] = 1; + for(int i = 2; i <= 1000; i++) + { + factorial[i] = i * factorial[i-1]; + } + ans = factorial[n+m-1]/( factorial[n] * factorial[m-1])% mod; + cout << ans << endl; + } + return 0; +} + diff --git a/Contests/Sum Queries.cpp b/Contests/Sum Queries.cpp new file mode 100755 index 0000000..672220b --- /dev/null +++ b/Contests/Sum Queries.cpp @@ -0,0 +1,40 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(0); + freopen("test.in", "r", stdin); + int N, M; + cin >> N; + int arr[N]; + for(int i = 0; i < N; i++) + { + cin >> arr[i]; + } + int s = N*(N+1)/2; + int arrsums[s]; + int sum = 0; + for(int i = 0; i < N; i++) + { + for(int j = i; j < N; j++) + { + int k = sum + j-i; + arrsums[k] = arr[i] * arr[j]; + } + sum += N-i; + } + cin >> M; + while(M--) + { + int n1, n2, sum = 0; + cin >> n1 >> n2; + int tsum = (abs(n2-n1) + 1) * (abs(n2-n1) + 2)/2; + for(int i = 0; i < tsum; i++) + { + + } + cout << sum << endl; + } + return 0; +} diff --git a/Contests/gmon.out b/Contests/gmon.out new file mode 100755 index 0000000000000000000000000000000000000000..dcef5416b4d8b5ee6b00c29f3d2a3d5601281249 GIT binary patch literal 239620 zcmeIuF%5t)07b!1C=y5*J0hc7jdZ{Qj*x~50yaqQEpNZNw%ntqTyxHC$w+cMd&+ka zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&o69fVT2oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF K5FkL{7XmN4sRcy< literal 0 HcmV?d00001 diff --git a/Contests/test.in b/Contests/test.in new file mode 100755 index 0000000..e94ec9b --- /dev/null +++ b/Contests/test.in @@ -0,0 +1,5 @@ +5 +2 0 1 3 3 +2 +0 2 +1 2 \ No newline at end of file diff --git a/Friends.cpp b/Friends.cpp new file mode 100755 index 0000000..15df0a1 --- /dev/null +++ b/Friends.cpp @@ -0,0 +1,36 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define INF 9999999 +ll dp[1111]; +ll recur(ll n, ll m, ll count) +{ + if(n <= 0) + { + return INF; + } + if(n == m) + return count; + else + { + if(m % 2 == 0) + { + if(n - m/2 < n*2 - m) + return recur(n-1, m, count+1); + else + return recur(n, m/2, count+1); + } + else + return recur(n, m+1, count+1); + } +} +int main() +{ + + ll n, m; + cin >> n >> m; + cout << recur(n, m, 0) << endl; + return 0; +} diff --git a/GSS1.cpp b/GSS1.cpp new file mode 100755 index 0000000..dbcef05 --- /dev/null +++ b/GSS1.cpp @@ -0,0 +1,50 @@ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAX 5000010 +ll t[4*MAX], a[MAX]; +ll m, n, qs, qe; +ll buildSegTree(ll arr[], ll start, ll end, ll node) +{ + if(start == end) + { + t[node] = arr[start]; + return t[node]; + } + ll mid = (start + end)/2; + t[node] = buildSegTree(arr, start, mid, 2*node) + buildSegTree(arr, mid + 1, end, 2*node + 1); + return t[node]; +} +ll query(ll start, ll end, ll node, ll qs, ll qe) +{ + if(qs <= start && qe >= end) + { + return t[node]; + } + if(end < qs || start > qe) + { + return 0; + } + ll mid = (start + end)/2; + ll x = query(start, mid, 2*node, qs, qe); + ll y = query(mid + 1, end, 2*node + 1, qs , qe); + return x + y; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cin >> n; + for(ll i = 1; i <= n; i++) + { + cin >> a[i]; + } + buildSegTree(a, 1, n, 1); + cin >> m; + while(m--) + { + cin >> qs >> qe; + cout << query(1, n, 1, qs, qe) << endl; + } + return 0; +} diff --git a/Gifts.cpp b/Gifts.cpp new file mode 100755 index 0000000..f79913f --- /dev/null +++ b/Gifts.cpp @@ -0,0 +1,32 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i; + cin >> n; + ll arr[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + } + sort(arr, arr + n); + bool flg = true; + for(i = n-1; i >= 0; i--) + { + arr[i] -= i; + if(arr[i] < 0) + { + flg = false; + } + } + if(flg) + cout << "Yes" << endl; + else + cout << "No" << endl; + return 0; +} diff --git a/HackerEarth/.DS_Store b/HackerEarth/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5d4d38efc717a3a232e07ac994eeeb1fa720b5c1 GIT binary patch literal 6148 zcmeHKOG*Pl5PfB`7;uwS&|NQG3Ep4`QE=f#J%COkD#T3C3FvMP=mETqzN%^=pUGB4 ztDyVU)NgtoOm`Om87-$LzyLtOp(v_!h?+ZHdpWpA6svKJ8cQ_ivwG4|=r@{l?FH`f z#Ffvnvi@pTSM(_{XB*(o_+ +using namespace std; +#define endl '\n' +long long calc_time(string s) +{ + long long time = 0, key = 1, i; + for(i = 0; i < s.length(); i++) + { + if(s[i] == '.' || s[i] == 'a' || s[i] == 'd' || s[i] == 'g' || s[i] == 'j' || s[i] == 'm' || s[i] == 'p' || s[i] == 't' || s[i] == 'w' || s[i] == '_') + { + time+=1; + } + else if(s[i] == ',' || s[i] == 'b' || s[i] == 'e' || s[i] == 'h' || s[i] == 'k' || s[i] == 'n' || s[i] == 'q' || s[i] == 'u' || s[i] == 'x' || s[i] == '0') + { + time+=2; + } + else if(s[i] == '?' || s[i] == 'c' || s[i] == 'f' || s[i] == 'i' || s[i] == 'l' || s[i] == 'o' || s[i] == 'r' || s[i] == 'v' || s[i] == 'y') + { + time+=3; + } + else if(s[i] == '!' || s[i] == 's' || s[i] == 'z' || s[i] == '2' || s[i] == '3' || s[i] == '4' || s[i] == '5' || s[i] == '6' || s[i] == '8') + { + time+=4; + } + else if(s[i] == '1' || s[i] == '7' || s[i] == '9') + { + time+=5; + } + + if(s[i] == '.' || s[i] == ',' || s[i] == '?' || s[i] == '!' || s[i] == '1') + { + if(key != 1) + { + time++; + key = 1; + } + } + else if(s[i] == 'a' || s[i] == 'b' || s[i] == 'c' || s[i] == '2') + { + if(key != 2) + { + time++; + key = 2; + } + } + else if(s[i] == 'd' || s[i] == 'e' || s[i] == 'f' || s[i] == '3') + { + if(key != 3) + { + time++; + key = 3; + } + } + else if(s[i] == 'g' || s[i] == 'h' || s[i] == 'i' || s[i] == '4') + { + if(key != 4) + { + time++; + key = 4; + } + } + else if(s[i] == 'j' || s[i] == 'k' || s[i] == 'l' || s[i] == '5') + { + if(key != 5) + { + time++; + key = 5; + } + } + else if(s[i] == 'm' || s[i] == 'n' || s[i] == 'o' || s[i] == '6') + { + if(key != 6) + { + time++; + key = 6; + } + } + else if(s[i] == 'p' || s[i] == 'q' || s[i] == 'r' || s[i] == 's' || s[i] == '7') + { + if(key != 7) + { + time++; + key = 7; + } + } + else if(s[i] == 't' || s[i] == 'u' || s[i] == 'v' || s[i] == '8') + { + if(key != 8) + { + time++; + key = 8; + } + } + else if(s[i] == 'w' || s[i] == 'x' || s[i] == 'y' || s[i] == 'z' || s[i] == '9') + { + if(key != 9) + { + time++; + key = 9; + } + } + else if(s[i] == '_' || s[i] == '0') + { + if(key != 0) + { + time++; + key = 0; + } + } + } + return time; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int t; + cin >> t; + while(t--) + { + string s; + cin >> s; + cout << calc_time(s) << endl; + } + return 0; +} diff --git a/HackerEarth/Roy and his Matrix.cpp b/HackerEarth/Roy and his Matrix.cpp new file mode 100755 index 0000000..2f80421 --- /dev/null +++ b/HackerEarth/Roy and his Matrix.cpp @@ -0,0 +1,28 @@ +#include +using namespace std; +#define endl '\n' +unsigned long long sums[1000001]; +void pre() +{ + sums[1] = 0; + sums[2] = 2; + sums[3] = 8; + for(long long i = 4; i < 1000001; i++) + { + sums[i] = sums[i-1] + ((i-1) * i); + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + pre(); + int t; + cin >> t; + while(t--) + { + long long n; + cin >> n; + cout << sums[n] << endl; + } + return 0; +} diff --git a/HackerEarth/gmon.out b/HackerEarth/gmon.out new file mode 100755 index 0000000000000000000000000000000000000000..10aa0777f974d571e2457e7fed48c30556129d75 GIT binary patch literal 240872 zcmeIuu?>Sj00TfHU<4$}q(h=*fbUp@B31fqk|7w0S)%+DFN$;H($+nulJ9%Zb@utp zV~!-R-;$xW5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0Rn9W zy0&xH2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U jAV7cs0RjXF5FkK+009C72oNAZ;Kl;mvt*r0`ugz?_;3dE literal 0 HcmV?d00001 diff --git a/HackerRank/.DS_Store b/HackerRank/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..41d73c692b6e442ff814a0fe4b83494b8f0e51d9 GIT binary patch literal 8196 zcmeI1OKuZE5QeLrNLX=*6F?|ZHr~Msi5*K5Odu#h2nQ)Ef?p&S_SnP@39Nh!j=)h^ zZ~%_LE#Rw~5t_EA*+G!fV|AC^(|lWvYyFVDpR<) z6fQ2a?6MPzGwa}LHeFmjm9dWuLsoXGNRwXVoN3=r29UHyot9Xd`!S~K=mz(1IEtzHVN2= zGgr>pUq{Os=mWgyNz?RnZ~IRutupr`XR(YGjZ~{+q}=&cX$})=w?|kbT%&dXTffihZ@&Fw}X7bq8-At^%fq z)v5752s7uQs%Ay={2XtG)X6E4wu{lq)zX)ouPb<`nH^JWy<&{{na6BdMQMJtK6T~m zZrH`Ljty;ZXc0x9yTM&WE5P&Q)`HfAk@slRx)0Yb5iM`#BD!YPlJ1FQVQ!_7X>WE_ zUNL_}{C(^s>}hH%z=Znjq1j&Jb*T(2rPep~{Qo%o{{K>ajK(7ak%7O +using namespace std; +int main() +{ + int n, m, c, max = 0, r = 0; + cin >> n >> m; + string array[n]; + for(int k = 0; k < n; k++) + { + cin >> array[k]; + /* Take Input*/ + } + for(int i = 0; i < n-1; i++) + { + for(int j = i+1; j < n; j++) + { + c = 0; + for (int k = 0; k max) + { + max = c; + /* Store maximum number of topics a team can know in max*/ + } + } + } + for (int i = 0; i < n-1; i++) + { + for(int j = i+1; j < n; j++) + { + c = 0; + for(int k = 0; k +using namespace std; +int altChar(string str); +int main() +{ + int num; + cin >> num; + while (num--) + { + string test; + cin >> test; + cout << altChar(test) < +#include +using namespace std; +int ComputeUnfairness(unsigned long long int array[], int N, int K); +/*Declare function**/ +int main() { + unsigned long long int N, K, unfairness; + cin >> N >> K; + unsigned long long int candies[N]; + for (int i=0; i> candies[i]; + } + unfairness = ComputeUnfairness(candies, N, K); /*Calls the function*/ + cout << unfairness << "\n"; + return 0; +} + +int ComputeUnfairness(unsigned long long int array[], int N, int K) +{ + sort(array, array + N); + /*Sort the given array*/ + unsigned long long int unfairness = array[N-1]; + /* Since unfairness has to be minimized, we take it to be the biggest value in the array(sorted) */ + for (int i = 0; i array[i+K-1] - array[i] ) + /* Compare, if unfairness is bigger than the difference of the two values. If yes, replace its value with the smaller one */ + { + unfairness = array[i+K-1] - array[i]; + } + } + } + return unfairness; + /* return the minimized value */ +} diff --git a/HackerRank/B'day Gift.cpp b/HackerRank/B'day Gift.cpp new file mode 100755 index 0000000..870e508 --- /dev/null +++ b/HackerRank/B'day Gift.cpp @@ -0,0 +1,17 @@ +#include +using namespace std; +int main() +{ + int N; + cin >> N; + double sum = 0; + setprecision(1); + while(N--) + { + double add; + cin >> add; + sum +=add; + } + cout << sum/2; + return 0; +} diff --git a/HackerRank/ConnectingTowns.cpp b/HackerRank/ConnectingTowns.cpp new file mode 100755 index 0000000..a199a36 --- /dev/null +++ b/HackerRank/ConnectingTowns.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; +int main() +{ + long long int t; + cin >> t; + while (t--) + { + long long int n; + cin >> n; + long long int k; + int routes = 1; + for(long long int i = 0; i> k; + routes = (routes*k) % 1234567; + } + cout << routes << endl; + } + return 0; +} diff --git a/HackerRank/CutTheSticks.cpp b/HackerRank/CutTheSticks.cpp new file mode 100755 index 0000000..03b1398 --- /dev/null +++ b/HackerRank/CutTheSticks.cpp @@ -0,0 +1,38 @@ +#include +#include +using namespace std; +int main() +{ + int N, count = 0; + cin >> N; + int array[N]; + for(int i = 0; i < N; i++) + { + cin >> array[i]; + } + sort(array, array + N); + int smallest = array[0]; + while(smallest !=0 ) + { + for(int i = 0; i < N; i++) + { + if(array[i] > 0) + { + array[i] -= smallest; + count ++; + } + } + cout << count << endl; + count = 0; + smallest = 0; + for(int j = 0; j< N; j++) + { + if(smallest < array[j]) + { + smallest = array[j]; + break; + } + } + } + return 0; +} diff --git a/HackerRank/FillingJars.cpp b/HackerRank/FillingJars.cpp new file mode 100755 index 0000000..8c4a974 --- /dev/null +++ b/HackerRank/FillingJars.cpp @@ -0,0 +1,23 @@ +#include +using namespace std; +int avgCand(unsigned long long int n, unsigned long long int m); +int main() +{ + unsigned long long int n, m; + cin >> n >> m; + avgCand( n, m ); + return 0; +} +int avgCand(unsigned long long int n, unsigned long long int m) +{ + unsigned long long int sum = 0; + while(m--) + { + unsigned long long int a, b, k; + cin >> a >> b >> k; + + sum += k*(b-a+1); + } + cout << sum/n; + return 0; +} diff --git a/HackerRank/FindDigits.cpp b/HackerRank/FindDigits.cpp new file mode 100755 index 0000000..1acc539 --- /dev/null +++ b/HackerRank/FindDigits.cpp @@ -0,0 +1,36 @@ +#include +using namespace std; +int FindDigits(int num); +int main() +{ + int noOfTestCases; + cin >> noOfTestCases; + int array[noOfTestCases]; + for(int i = 0; i> array[i]; + } + for(int j=0;j0 && n%digit == 0 ) + { + count++; + } + num/=10; + } while (num > 0); + cout << count << endl; + return 0; +} + diff --git a/HackerRank/HalloweenParty.cpp b/HackerRank/HalloweenParty.cpp new file mode 100755 index 0000000..9dad927 --- /dev/null +++ b/HackerRank/HalloweenParty.cpp @@ -0,0 +1,14 @@ +#include +using namespace std; +int main() +{ + unsigned long long int t; + cin >> t; + while(t--) + { + unsigned long long int k; + cin >> k; + cout << (k*k)/4 << endl; + } + return 0; +} diff --git a/HackerRank/HandShakes.cpp b/HackerRank/HandShakes.cpp new file mode 100755 index 0000000..e998180 --- /dev/null +++ b/HackerRank/HandShakes.cpp @@ -0,0 +1,19 @@ +#include +using namespace std; +int main() +{ + int t; + cin >> t; + while(t--) + { + long long int num; + cin >> num; + long long int sum = 0; + for(int i = num; i >= 1; i--) + { + sum += i-1; + } + cout << sum << endl; + } + return 0; +} diff --git a/HackerRank/IsFibo.cpp b/HackerRank/IsFibo.cpp new file mode 100755 index 0000000..f72d782 --- /dev/null +++ b/HackerRank/IsFibo.cpp @@ -0,0 +1,45 @@ +#include +using namespace std; +bool isFibo(unsigned long long int a); +void Caller(unsigned long long int test); +int main() +{ + unsigned int noOfTestCases; + cin >> noOfTestCases; + while (noOfTestCases--) + { + unsigned long long int num = 0; + cin >> num; + Caller(num); + } + return 0; +} +bool isFibo(unsigned long long int a) +{ + unsigned long long int first = 0, second = 1, next; + for (int i = 0;;i++) + { + next = first + second; + first = second; + second = next; + if (next == a) + { + return true; + } + else if(next>a) + { + return false; + } + } +} +void Caller(unsigned long long int test) +{ + if (isFibo(test)) + { + cout << "IsFibo" << endl; + } + else + { + cout << "IsNotFibo" << endl; + } +} diff --git a/HackerRank/LoveLetterMytstery.cpp b/HackerRank/LoveLetterMytstery.cpp new file mode 100755 index 0000000..01aa925 --- /dev/null +++ b/HackerRank/LoveLetterMytstery.cpp @@ -0,0 +1,60 @@ +#include +#include +using namespace std; +bool isPalindrome(string s); +int OpCnt(string str); +int main() +{ + int num; + cin >> num; + while(num--) + { + string test; + cin >> test; + cout << OpCnt(test) << endl; + } + return 0; +} +int OpCnt(string str) +{ + int OpCnt = 0; + int len = str.length(); + if(isPalindrome(str)) + { + return OpCnt; + } + else + { + for(int i = 0; i < len; i++) + { + while(str[i] != str[len-1-i] && i != len-1-i) + { + int a = str[i]; + int b = str[len-1-i]; + int min, max; + (a +using namespace std; +int MaxXor(int l, int r); +int main() +{ + int l, r; + cin >> l >> r; + MaxXor(l, r); + return 0; +} +int MaxXor(int l, int r) +{ + int max = 0; + for(int i=l;i<=r;i++) + { + for(int j=l;j<=r;j++) + if(max < (i^j)) + { + max = i^j; + } + } + cout << max; + return 0; + +} diff --git a/HackerRank/MinDraws.cpp b/HackerRank/MinDraws.cpp new file mode 100755 index 0000000..3abdd0a --- /dev/null +++ b/HackerRank/MinDraws.cpp @@ -0,0 +1,14 @@ +#include +using namespace std; +int main() +{ + int t; + cin >> t; + while(t--) + { + int num; + cin >> num; + cout << (num<=0 ? 0 : num +1) << endl; + } + return 0; +} \ No newline at end of file diff --git a/HackerRank/SherlockAndPermutations.cpp b/HackerRank/SherlockAndPermutations.cpp new file mode 100755 index 0000000..56d726b --- /dev/null +++ b/HackerRank/SherlockAndPermutations.cpp @@ -0,0 +1,23 @@ +#include +#include +using namespace std; +long long int factorial(long long int n); +int main() +{ + long long int t; + cin >> t; + while(t--) + { + long long int n, m, ans; + cin >> n >> m; + long long int mod = (int)pow(10, 9) + 7; + ans = factorial(n+m-1)/( factorial(n) * factorial(m-1))% mod; + cout << ans << endl; + } + + return 0; +} +long long int factorial(long long n) +{ + return (n==1|| n==0) ? 1 : factorial(n-1) * n; +} diff --git a/HackerRank/SherlocknSquares.cpp b/HackerRank/SherlocknSquares.cpp new file mode 100755 index 0000000..f34eec2 --- /dev/null +++ b/HackerRank/SherlocknSquares.cpp @@ -0,0 +1,37 @@ +#include +#include +using namespace std; +int Sqbtwint(int a, int b); +int main() +{ + int t; + cin >> t; + while (t--) + { + int a, b; + cin >> a >> b; + cout << Sqbtwint(a, b) << endl; + } + return 0; + +} +int Sqbtwint(int a, int b) +{ + int cnt = 0; + int i = 1; + int square = pow(i,2); + while(square <= b) + { + if(square < a) + { + + } + else + { + cnt++; + } + i++; + square = pow(i, 2); + } + return cnt; +} diff --git a/HackerRank/UtopianTree.cpp b/HackerRank/UtopianTree.cpp new file mode 100755 index 0000000..246fd46 --- /dev/null +++ b/HackerRank/UtopianTree.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; +int utopianTree(int num); +int main() +{ + int noOfTestCases, num; + cin >> noOfTestCases; + while(noOfTestCases--) + { + cin >> num; + utopianTree(num); + } + return 0; +} +int utopianTree(int num) +{ + int height = 1; + for (int i=1; i<=num;i++) + { + if(i%2 != 0) + { + height *=2; + } + else if(i%2 == 0) + { + height +=1; + } + } + cout << height << endl; + return 0; +} diff --git a/HackerRank/chocFeast.cpp b/HackerRank/chocFeast.cpp new file mode 100755 index 0000000..2c07d23 --- /dev/null +++ b/HackerRank/chocFeast.cpp @@ -0,0 +1,32 @@ +#include +using namespace std; +int TotalChocs(int n, int c, int m); +int main() +{ + int num; + cin >> num; + while(num--) + { + int n, c, m; + cin >> n >> c >> m; + cout << TotalChocs(n,c,m) << endl; + } + return 0; +} +int TotalChocs(int n, int c, int m) +{ + int tot = 0; + int left; + tot += n/c; + if (tot >= m) + { + left = tot; + do + { + left -= m; + tot++; left++; + } while(left >=m); + } + return tot; + +} diff --git a/HackerRank/fibo_modified.cpp b/HackerRank/fibo_modified.cpp new file mode 100755 index 0000000..d54d098 --- /dev/null +++ b/HackerRank/fibo_modified.cpp @@ -0,0 +1,16 @@ +#include +using namespace std; +int main() +{ + unsigned long long int a, b, n, first, second, temp; + cin >> a >> b >> n; + first = a; second = b; + for(int i = 1; i < n-1; i++) + { + temp = first; + first = second; + second = ((first*first) + temp); + } + cout << second; + return 0; +} diff --git a/HackerRank/flpbits.cpp b/HackerRank/flpbits.cpp new file mode 100755 index 0000000..984e3b5 --- /dev/null +++ b/HackerRank/flpbits.cpp @@ -0,0 +1,15 @@ +#include +using namespace std; +int main() +{ + int noOFTestCases; + cin >> noOFTestCases; + while (noOFTestCases--) + { + unsigned int num; + cin >> num; + cout << ~num << endl; + } + return 0; +} + diff --git a/HackerRank/gmon.out b/HackerRank/gmon.out new file mode 100755 index 0000000000000000000000000000000000000000..44e27658f0a4b713a06bd353287926e09086d8c6 GIT binary patch literal 239524 zcmeIuu@Qnm00h8egv1;%B(#hl5-Xqr3BCn-un(KCFe1lqfqXByOD@@YEID4!yg!%h z_aR%7`g^2rEd&S +using namespace std; +int main() +{ + //freopen("test.in", "r", stdin); + set alpha; + string str; + getline(cin, str); + for(int i = 0; i < str.size(); i++) + { + int tmp = tolower(str[i]); + if(tmp >= 'a' && tmp <= 'z') + { + alpha.insert(tmp); + } + } + cout << ((alpha.size() == 26) ? "pangram" : "not pangram"); + return 0; +} diff --git a/HackerRank/maxSubArray.cpp b/HackerRank/maxSubArray.cpp new file mode 100755 index 0000000..cf2311c --- /dev/null +++ b/HackerRank/maxSubArray.cpp @@ -0,0 +1,42 @@ +#include +using namespace std; +int FindMaxSubArray(int array[], int N) +{ + int max_sofar = array[0]; + int max_end = array[0]; + for(int i = 1; i < N; i++) + { + max_end = max(array[i], max_end + array[i]); + max_sofar = max(max_end, max_sofar); + } + return max_sofar; +} +int main() +{ + //freopen("test.in", "r", stdin); + int T; + cin >> T; + while(T--) + { + int N, nonCont = 0; + cin >> N; + int array[N]; + for(int i = 0; i < N; i++) + { + cin >> array[i]; + } + for(int i = 0; i < N; i++) + { + if(array[i] > 0) + { + nonCont+=array[i]; + } + } + if(nonCont == 0) + { + nonCont = array[0]; + } + cout << FindMaxSubArray(array, N) << " " << nonCont << endl; + } +return 0; +} diff --git a/HackerRank/nextpal.cpp b/HackerRank/nextpal.cpp new file mode 100755 index 0000000..88ed273 --- /dev/null +++ b/HackerRank/nextpal.cpp @@ -0,0 +1,36 @@ +#include +using namespace std; +bool isPalindrome(int a); +unsigned long long int nextPal(unsigned long long int x); +int main() +{ + int noOfTestCases; + cin >> noOfTestCases; + while(noOfTestCases--) + { + unsigned long long int num; + cin >> num; + cout << nextPal(num) << endl; + } + return 0; +} +bool isPalindrome( unsigned long long int a) +{ + unsigned long long int num = a; + unsigned long long int palA = 0; + while(a!=0) + { + int r = a%10; + a/=10; + palA = palA*10 + r; + } + return (num == palA) ? true : false; +} +unsigned long long int nextPal( unsigned long long int x) +{ + do + { + x++; + } while(!(isPalindrome(x))); + return x; +} diff --git a/HackerRank/randNumProb.cpp b/HackerRank/randNumProb.cpp new file mode 100755 index 0000000..e69de29 diff --git a/HackerRank/sample.cpp b/HackerRank/sample.cpp new file mode 100755 index 0000000..fee2c4e --- /dev/null +++ b/HackerRank/sample.cpp @@ -0,0 +1,36 @@ +#include +int main() +{ + int t; + int a[200]; //array will have the capacity to store 200 digits. + int n,i,j,temp,m,x; + + scanf("%d",&t); + while(t--) + { + scanf("%d",&n); + a[0]=1; //initializes array with only 1 digit, the digit 1. + m=1; // initializes digit counter + + temp = 0; //Initializes carry variable to 0. + for(i=1;i<=n;i++) + { + for(j=0;j0) //while loop that will store the carry value on array. + { + a[m]=temp%10; + temp = temp/10; + m++; // increments digit counter + } + } + for(i=m-1;i>=0;i--) //printing answer + printf("%d",a[i]); + printf("\n"); + } + return 0; +} diff --git a/HackerRank/test.in b/HackerRank/test.in new file mode 100755 index 0000000..e8be09f --- /dev/null +++ b/HackerRank/test.in @@ -0,0 +1,5 @@ +2 +4 +1 2 3 4 +6 +2 -1 2 3 4 -5 \ No newline at end of file diff --git a/HuntIt.cpp b/HuntIt.cpp new file mode 100755 index 0000000..325a0ec --- /dev/null +++ b/HuntIt.cpp @@ -0,0 +1,85 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define INF 999999999 +ll dist(string k1, string k2) +{ + ll i, dis = 0; + for(i = 0; i < 4; i++) + { + dis += abs(k1[i] - k2[i]); + } + return dis; +} +ll findMin(ll keys[], ll n, bool mst[], string curr) +{ + ll minNum = INF, minInd, i; + for(i = 1; i <= n; i++) + { + if(keys[i] < minNum && !mst[i] && keys[i] != inf) + { + minInd = i; + minNum = keys[i]; + } + } + return minInd; +} +int main() +{ + ll t; + cin >> t; + while(t--) + { + ll n, i, j, moves = 0; + set::iterator k; + cin >> n; + string keys[n]; + vector visited; + set notVisited; + map marked; + for(i = 0; i < n; i++) + { + cin >> keys[i]; + notVisited.insert(i); + } + visited.push_back("0000"); + marked["0000"] = true; + while(nMarked < z-1) + { + ind = findMin(keys, z, mst); + mst[ind] = true; + nMarked++; + for(i = 1; i <= z; i++) + { + if(!mst[i] && adjM[ind][i] < keys[i]) + { + prnt[i] = ind; keys[i] = adjM[ind][i]; + } + } + } + for(i = 0; i < n; i++) + { + ll minN = INF, minI = i; + for(j = 0; j < visited.size(); j++) + { + + for(k = notVisited.begin(); k != notVisited.end(); k++) + { + if(minN > dist(visited[j], keys[(*k)])) + { + minN = dist(visited[j], keys[(*k)]); + minI = (*k); + } + } + } + visited.push_back(keys[minI]); + marked[keys[minI]] = true; + notVisited.erase(minI); + moves += minN; + } + cout << moves << endl; + } + return 0; +} diff --git a/IARCS/.DS_Store b/IARCS/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f69b0b1f31f08f6e8e95cff151ab0ad91a4faed0 GIT binary patch literal 10244 zcmeHM&2C#o6h7lPX}~TNkw&2)m?f%2)b3cCG;R{9sZd-2E5wcMG*+BA*uJG@=Y$SO|C zTXkF_2fydJa8&%0yO0KWk)HIWD@BeV?A(>b%0{5mklo`PAU{S-Ri-3sPRh-65a*W{df-l^Cf~?2toMhK$x}$K`WH~<;1X&>wlGdxP88XbGhjJ(hJAw* z+&z>5G`7q1Req#CoYjj9Txr=B5Cg@w6g!4~YK__>e*p8c;6;6ge+1k}#&Mi^vw(Xb z2eJpt_vA6ItvHUXnbpF0cjSS*fPZeM#Hy`UzEw6(CCB&~&K^8D^E)X~PPO3~&p}PL zfq$l`ybML=0!!9`>M5$DRxl1N==m8|bTK+(;P!GBEFg>KdBLj>p^JI&i$<^~&%MTI z49MjrbW=yoz>1X}V2{8-+1OHR$+$R%hxo2k7qg=BI`C*;aXnxd57v1OFV1jx z;5aF>i#ZbLs-w!f$gAD*l-)Tc`jItdZc!6uhR92k~|})fu=P-GHa6+ z(}tcF>=|CIhj|g`sX@;Rpcs`NG{yY@mrK7F{P-M%%9NnH}rhu^?W?j zN;{&(jxl6})?@{u= heZ$L%lX!yTKmTXIbg$F>vP|p$wEpMb=e1h@{{yckap(X5 literal 0 HcmV?d00001 diff --git a/IARCS/01 Tiles.cpp b/IARCS/01 Tiles.cpp new file mode 100755 index 0000000..3309129 --- /dev/null +++ b/IARCS/01 Tiles.cpp @@ -0,0 +1,23 @@ +#include + +using namespace std; + +int main(){ + + int n; + cin >> n; + int pre = 1; + int cur = 1; + int fib; + + for( int i = 0;i < n-1;i ++){ + fib = (pre+cur)%15746; + pre = cur; + cur = fib; + } + + cout << cur; + + + return 0; +} diff --git a/IARCS/Average.cpp b/IARCS/Average.cpp new file mode 100755 index 0000000..0e4fda1 --- /dev/null +++ b/IARCS/Average.cpp @@ -0,0 +1,56 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +double avg(ll a, ll b) +{ + + return (a+b)/2.0; +} +vector arr; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, j, low, high, count = 0; + double num; + cin >> n; + for(i = 0; i < n; i++) + { + cin >> num; + arr.push_back(num); + } + sort(arr.begin(), arr.end()); + for(i = 0; i < n; i++) + { + if(arr[i] == arr[i-1] || arr[i] == arr[i+1]) + { + count++; + } + else + { + low = i-1; + high = i+1; + while(low >= 0 && high < n) + { + num = avg(arr[low], arr[high]); + if(num == (double)arr[i]) + { + count++; + break; + } + else if(num < arr[i]) + { + high++; + } + else + { + low--; + } + } + } + + } + cout << count; + return 0; +} diff --git a/IARCS/Bickering Task Force.cpp b/IARCS/Bickering Task Force.cpp new file mode 100755 index 0000000..886d8b9 --- /dev/null +++ b/IARCS/Bickering Task Force.cpp @@ -0,0 +1,91 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +class Graph +{ + int V; +public: + Graph(int V); + list *adj; + void addEdge(int v, int w); + ll Size(ll v); +}; + +Graph::Graph(int V) +{ + this->V = V; + adj = new list[V]; +} +void Graph::addEdge(int v, int w) +{ + adj[v].push_back(w); + adj[w].push_back(v); +} +ll Graph::Size(ll v) +{ + return adj[v].size(); +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + ll n, m, k, i, n1, n2, size = 0; + cin >> n >> m >> k; + vector lessArr; + Graph nobles(n); + for(i = 0; i < m; i++) + { + cin >> n1 >> n2; + n1--; n2--; + nobles.addEdge(n1, n2); + } + bool del[n], pres[n]; + ll degree[n]; + for(i = 0; i < n; i++) + { + del[i] = false; + pres[i] = false; + degree[i] = nobles.Size(i); + if(nobles.Size(i) < k) + { + lessArr.push_back(i); + pres[i] = true; + } + } + for(i = 0; i < lessArr.size(); i++) + { + del[lessArr[i]] = true; + pres[lessArr[i]] = false; + for(list::iterator it = nobles.adj[lessArr[i]].begin(); it != nobles.adj[lessArr[i]].end(); it++) + { + if(!(pres[*it]) && !(del[*it])) + { + degree[*it]--; + if(degree[*it] < k) + { + lessArr.push_back(*it); + pres[*it] = true; + } + } + } + } + for(i = 0; i < n; i++) + { + if(!del[i]) + { + size++; + } + } + if(size > 0) + { + cout << "YES" << endl << size; + } + else + { + cout << "NO"; + } + return 0; +} diff --git a/IARCS/Book Sorting.cpp b/IARCS/Book Sorting.cpp new file mode 100755 index 0000000..8926b43 --- /dev/null +++ b/IARCS/Book Sorting.cpp @@ -0,0 +1,32 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i = 0, j, maxL = 1, length; + cin >> n; + ll shelf[n]; + for(i = 0; i < n; i++) + { + cin >> shelf[i]; + } + while(i < n) + { + j = i; + length = 1; + while(shelf[j] < shelf[j+1] && j < n-1) + { + j++; + length++; + } + maxL = max(maxL, length); + i = j+1; + } + cout << n-maxL; + return 0; +} diff --git a/IARCS/BookList.cpp b/IARCS/BookList.cpp new file mode 100755 index 0000000..9eb17ba --- /dev/null +++ b/IARCS/BookList.cpp @@ -0,0 +1,44 @@ +#include +#include +#include +using namespace std; +int main() +{ + int M, N, pos, p, carry = 0; + cin >> M; + vector books, borrow; + for (int i = 0; i < M; i++) + { + int b; + cin >> b; + books.push_back(b); + } + cin >> N; + for (int i = 0; i < N; i++) + { + if(i==0) + { + cin >> p; + borrow.push_back(p-1); + cout << books[p-1]<< endl; + } + else + { + cin >> p; + sort(borrow.begin(), borrow.end()); + for(int j = 0; j +using namespace std; +int adj[301][301][2]; +int graph[301][301]; +vector critints; +int main() +{ + //freopen("10.in", "r", stdin); + int N, M, k = 1; + cin >> N >> M ; + for(int i = 1; i <= N; i++) + { + for(int j = 1; j <= N; j++) + { + graph[i][j] = 0; + } + } + for(int i = 0; i < M;i++) + { + int i1, i2; + cin >> i1 >> i2; + graph[i1][i2] = 1; + graph[i2][i1] = 1; + } + for(int i = 1 ; i <= N; i++) + { + int c = 0; + for(int j = 1; j <= N; j++) + { + if(graph[i][j] == 1) + { + adj[i][c][0] = j; + c++; + } + } + adj[i][0][1] = c; + + } + set visited; + for(int k = 1; k <= N; k++) + { + int d = 0, v = 0; + visited.clear(); + stack S; + d = (k == 1) ? 2 : 1 ; + S.push(d); + while(!S.empty()) + { + v = S.top(); + S.pop(); + if(visited.count(v) == 0) + { + visited.insert(v); + for(int i = 0; i < adj[v][0][1]; i++) + { + if (adj[v][i][0] != k) + { + S.push(adj[v][i][0]); + } + } + } + } + if(visited.size() != N-1) + { + critints.push_back(k); + } + } + cout << critints.size() << endl; + for(int i = 0; i < critints.size(); i++) + { + cout << critints[i]<< endl; + } +} diff --git a/IARCS/Cycles in Permutations.cpp b/IARCS/Cycles in Permutations.cpp new file mode 100755 index 0000000..830abe3 --- /dev/null +++ b/IARCS/Cycles in Permutations.cpp @@ -0,0 +1,63 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, next, first, j; + cin >> n; + ll arr[n]; + map visited; + vector cycle; + vector > cycles; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + } + visited[1] = true; + first = 1; + cycle.push_back(1); + next = arr[0]; + cycle.push_back(next); + while(visited.size() != n) + { + while(next != first) + { + visited[next] = true; + next = arr[next-1]; + cycle.push_back(next); + } + cycles.push_back(cycle); + cycle.clear(); + for(i = 2; i <= n; i++) + { + if(!visited[i]) + { + first = i; + visited[first] = true; + cycle.push_back(first); + next = arr[first-1]; + cycle.push_back(next); + break; + } + } + } + if(cycle.size() != 0) + { + cycles.push_back(cycle); + } + cout << cycles.size() << endl; + for(i = 0; i < cycles.size(); i++) + { + for(j = 0; j < cycles[i].size(); j++) + { + cout << cycles[i][j] << " "; + } + cout << endl; + } + return 0; +} diff --git a/IARCS/Devious.cpp b/IARCS/Devious.cpp new file mode 100755 index 0000000..f301f96 --- /dev/null +++ b/IARCS/Devious.cpp @@ -0,0 +1,43 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool wayToSort(pair a, pair b){return a.first < b.first;} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + ll n, i, summer = 0, min = INT_MAX, min_start = 0, min_end = 0, holder; + bool decide; + cin >> n; + ll arr[n]; + pair sum[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + summer += arr[i]; + sum[i] = make_pair(summer, i+1); + } + sort(sum, sum + n, wayToSort); + for(i = 0; i < n-1; i++) + { + holder = sum[i].first - sum[i+1].first; + if((abs(holder) < abs(min)) || (abs(holder) == abs(min) && abs(sum[i].second - sum[i+1].second) >= abs(min_end - min_start))) + { + decide = sum[i].second < sum[i+1].second; + min_start = sum[i].second; + min_end = sum[i+1].second; + min = decide ? -holder : holder; + } + } + if(min_end < min_start) + { + min_end -= min_start; + min_start += min_end; + min_end = -(min_end) + min_start; + } + cout << min << endl << min_start + 1 << " " << min_end; + return 0; +} diff --git a/IARCS/Dividing Sequences.cpp b/IARCS/Dividing Sequences.cpp new file mode 100755 index 0000000..4a3858c --- /dev/null +++ b/IARCS/Dividing Sequences.cpp @@ -0,0 +1,34 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, j, size, maxSize = 0; + cin >> n; + ll arr[n], longest[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + } + //Dynamic Programming yay!!! + longest[0] = 1; + for(i = 1; i < n; i++) + { + size = 1; + for(j = 0; j < i; j++) + { + if(arr[i]%arr[j] == 0) + { + size = max(size, longest[j]+1); + } + } + longest[i] = size; + maxSize = max(size, maxSize); + } + cout << maxSize; + return 0; +} diff --git a/IARCS/Draw Fixing.cpp b/IARCS/Draw Fixing.cpp new file mode 100755 index 0000000..8b54bad --- /dev/null +++ b/IARCS/Draw Fixing.cpp @@ -0,0 +1,73 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool comp(pair num1, pair num2) +{ + return num1.first > num2.first; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + freopen("1.in", "r", stdin); + ll n, i, rating, nextI, numPaired = 0; + cin >> n; + pair siruseri[n], navalur[n]; + bool occupiedS[n], occupiedN[n]; + vector > pairings; + for(i = 0; i < n; i++) + { + occupiedS[i] = false; + cin >> rating; + siruseri[i] = make_pair(rating, i+1); + } + for(i = 0; i < n; i++) + { + occupiedN[i] = false; + cin >> rating; + navalur[i] = make_pair(rating, i+1); + } + sort(siruseri, siruseri+n, comp); + sort(navalur, navalur+n, comp); + nextI = 0; + for(i = 0; i < n; i++) + { + while((nextI < n && siruseri[i].first < navalur[nextI].first) || occupiedN[nextI]) + { + nextI++; + } + if(nextI < n) + { + occupiedS[i] = true; + occupiedN[nextI] = true; + pairings.push_back(make_pair(siruseri[i].second, navalur[nextI].second)); + numPaired++; + } + } + nextI = 0; + for(i = 0; i < n; i++) + { + if(!occupiedN[i]) + { + while(nextI < n && occupiedS[nextI]) + { + nextI--; + } + if(nextI < n) + { + occupiedN[i] = true; + occupiedS[nextI] = true; + pairings.push_back(make_pair(siruseri[nextI].second, navalur[i].second)); + } + } + } + cout << numPaired << endl; + sort(pairings.begin(), pairings.end()); + for(i = 0; i < pairings.size(); i++) + { + cout << pairings[i].second << endl; + } + return 0; +} diff --git a/IARCS/Equal Gifts.cpp b/IARCS/Equal Gifts.cpp new file mode 100755 index 0000000..bcd3f7a --- /dev/null +++ b/IARCS/Equal Gifts.cpp @@ -0,0 +1,57 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool wayToSort(ll a, ll b) {return a > b;} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, j, book1, book2, sum = 0, minN; + vector books; + cin >> n; + for(i = 0; i < n; i++) + { + cin >> book1 >> book2; + books.push_back(abs(book1-book2)); + } + /*Balanced Partitioning*/ + for(i = 0; i < n; i++) + { + sum += books[i]; + } + bool subset[sum+1][n+1]; + for(i = 0; i <= n; i++) + { + subset[0][i] = true; + } + for(i = 1; i <= sum; i++) + { + subset[i][0] = false; + } + for(i = 1; i <= sum; i++) + { + for(j = 1; j <= n; j++) + { + subset[i][j] = subset[i][j-1]; + if(i >= books[j-1]) + { + subset[i][j] = subset[i][j] || subset[i-books[j-1]][j-1]; + } + } + } + minN = INT_MAX; + for(i = 1; i <= sum; i++) + { + for(j = 1; j <= n; j++) + { + if(subset[i][j] == true) + { + minN = min(minN, abs(sum - 2*i)); + } + } + } + cout << minN; + return 0; +} diff --git a/IARCS/Find the Permutation.cpp b/IARCS/Find the Permutation.cpp new file mode 100755 index 0000000..1cebf98 --- /dev/null +++ b/IARCS/Find the Permutation.cpp @@ -0,0 +1,49 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i; + cin >> n; + ll inversions[n+1], next; + list seq; + queue toChange; + for(i = 1; i <= n; i++) + { + cin >> inversions[i]; + if(inversions[i] > 0) + { + toChange.push(i); + } + else + { + seq.push_front(i); + } + } + while(!toChange.empty()) + { + next = toChange.front(); + toChange.pop(); + for(list::iterator it = seq.begin(); it != seq.end(); it++) + { + if(*it < next) + { + inversions[next]--; + } + if(inversions[next] == 0) + { + seq.insert(++it, next); + break; + } + } + } + for(list::reverse_iterator it = seq.rbegin(); it != seq.rend(); it++) + { + cout << *it << " "; + } + return 0; +} diff --git a/IARCS/Find the numbers.cpp b/IARCS/Find the numbers.cpp new file mode 100755 index 0000000..4164e77 --- /dev/null +++ b/IARCS/Find the numbers.cpp @@ -0,0 +1,77 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll arr[4]; +bool findNums(ll s, ll p, ll k, ll i) +{ + if(k == 1) + { + if(s == p) + { + arr[i] = s; + return true; + } + else + { + return false; + } + } + else + { + ll m, lim = sqrt(p); + for(m = 1; m <= lim; m++) + { + if(p % m == 0) + { + arr[i] = m; + if(findNums(s-m, p/m, k-1, i+1)) + { + return true; + } + } + } + return false; + } + +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("10.in", "r", stdin); + ll s, p, k, i; + cin >> s >> p >> k; + bool hasOne = false; + if(findNums(s, p, k, 0)) + { + for(i = 0; i < k; i++) + { + if(arr[i] == 1) + { + hasOne = true; + } + } + if(hasOne) + { + for(i = k-1; i >= 0; i--) + { + cout << arr[i] << " "; + } + } + else + { + for(i = 0; i < k; i++) + { + cout << arr[i] << " "; + } + } + } + else + { + cout << "NO"; + } + + return 0; +} diff --git a/IARCS/High Speed Network.cpp b/IARCS/High Speed Network.cpp new file mode 100755 index 0000000..01e8452 --- /dev/null +++ b/IARCS/High Speed Network.cpp @@ -0,0 +1,58 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define inf INT_MAX +#define M 2000 + +ll findMin(ll keys[], ll n, map mst) +{ + ll minNum = inf, minInd, i; + for(i = 1; i < n; i++) + { + if(keys[i] < minNum && !mst[i] && keys[i] != inf) + { + minInd = i; + minNum = keys[i]; + } + } + return minInd; +} +ll adjM[M+1][M+1]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + ll n, i, j; + cin >> n; + ll keys[n], ind, cost = 0; + map mst; + for(i = 0; i < n; i++) + { + keys[i] = inf; + for(j = 0; j < n; j++) + { + cin >> adjM[i][j]; + if(adjM[i][j] == 0) + adjM[i][j] = inf; + } + } + /*Prim's Algorithm*/ + keys[1] = 0; + while(mst.size() < n-1) + { + ind = findMin(keys, n, mst); + cost += keys[ind]; + mst[ind] = true; + for(i = 1; i < n; i++) + { + if(adjM[ind][i] < keys[i]) + { + keys[i] = adjM[ind][i]; + } + } + } + cout << cost; + return 0; +} diff --git a/IARCS/Lead Game.cpp b/IARCS/Lead Game.cpp new file mode 100755 index 0000000..2c50c64 --- /dev/null +++ b/IARCS/Lead Game.cpp @@ -0,0 +1,28 @@ +#include +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + long long int n, leadguy, lead = 0, add1 = 0, add2 = 0; + cin >> n; + for(long long int i = 0; i < n; i++) + { + long long int p1, p2; + cin >> p1 >> p2; + p1 += add1; p2+= add2; + if(p1 > p2 && p1 - p2 > lead) + { + leadguy = 1; + lead = p1 - p2; + } + else if (p2 > p1 && p2 - p1 > lead) + { + leadguy = 2; + lead = p2 - p1; + } + add1 = p1; add2 = p2; + } + cout << leadguy << " " << lead; + return 0; +} diff --git a/IARCS/Longest Palindrome.cpp b/IARCS/Longest Palindrome.cpp new file mode 100755 index 0000000..be4a6ca --- /dev/null +++ b/IARCS/Longest Palindrome.cpp @@ -0,0 +1,56 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool table[5555][5555]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, j, k, maxL = 1, startI = 0; + string word; + cin >> n >> word; + for(i = 0; i < n; i++) + { + for(j = 0; j < n; j++) + { + if(i == j) + { + table[i][j] = true; + } + else + { + table[i][j] = false; + } + } + } + for(i = 0; i < n-1; i++) + { + if(word[i] == word[i+1]) + { + table[i][i+1] = true; + startI = i; + maxL = 2; + } + } + for(i = 3; i <= n; i++) // length + { + for(j = 0; j < n-i + 1; j++) + { + k = j + i - 1; + if(table[j+1][k-1] == true && word[j] == word[k]) + { + table[j][k] = true; + if(i > maxL) + { + maxL = i; + startI = j; + } + } + } + } + cout << maxL << endl; + cout << word.substr(startI, maxL); + return 0; +} diff --git a/IARCS/Minimum Turn Route.cpp b/IARCS/Minimum Turn Route.cpp new file mode 100755 index 0000000..0a9d4f2 --- /dev/null +++ b/IARCS/Minimum Turn Route.cpp @@ -0,0 +1,109 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define M 1001 +#define mp make_pair +char discs[M][M][4]; +map, pair > came_from; +map, ll> minPenalty; +map, bool> visited; +class comp +{ +public: + bool operator() (const pair, ll>& lhs, const pair, ll>&rhs) const + { + return (lhs.second > rhs.second); + } +}; + +priority_queue, ll>, vector, ll> >, comp> frontier; +ll calcPenalty(char disc1[], char disc2[], ll dir) +{ + ll counter = 0, dirOther = dir - 2; + if(dirOther < 0) + { + dirOther += 4; + } + while(disc1[dir] != disc2[dirOther]) + { + dir--; + counter++; + if(dir < 0) + { + dir = 3; + } + } + return counter; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("8.in", "r", stdin); + ll m, n, i, j, k, dir, cost; + cin >> m >> n; + pair, ll> curr; + pair currLoc, nextLoc, destination; + for(i = 0; i < m; i++) + { + for(j = 0; j < n; j++) + { + for(k = 0; k < 4; k++) + { + cin >> discs[i][j][k]; + } + minPenalty[mp(i, j)] = INT_MAX; + } + } + destination = mp(m-1, n-1); + frontier.push(mp(mp(0, 0), 0)); + came_from[mp(0, 0)] = mp(-1, -1); + ll penalty; + while(!frontier.empty()) + { + curr = frontier.top(); + currLoc = curr.first; + penalty = curr.second; + frontier.pop(); + if(currLoc.first == m-1 && currLoc.second == n-1) + { + break; + } + for(i = 0; i < 4; i++) + { + dir = i; + switch(i) + { + case 0: + nextLoc.first = currLoc.first - 1; + nextLoc.second = currLoc.second; + break; + case 1: + nextLoc.first = currLoc.first; + nextLoc.second = currLoc.second + 1; + break; + case 2: + nextLoc.first = currLoc.first + 1; + nextLoc.second = currLoc.second; + break; + case 3: + nextLoc.first = currLoc.first; + nextLoc.second = currLoc.second - 1; + break; + } + if(nextLoc.first >= 0 && nextLoc.first < m && nextLoc.second >= 0 && nextLoc.second < n && came_from[currLoc] != nextLoc && came_from[came_from[currLoc]] != nextLoc) + { + cost = calcPenalty(discs[currLoc.first][currLoc.second], discs[nextLoc.first][nextLoc.second], dir) + penalty; + if(cost < minPenalty[nextLoc]) + { + frontier.push(mp(nextLoc, cost)); + minPenalty[nextLoc] = cost; + came_from[nextLoc] = currLoc; + } + } + } + } + cout << penalty; + return 0; +} diff --git a/IARCS/NextPerm.cpp b/IARCS/NextPerm.cpp new file mode 100755 index 0000000..e756f2f --- /dev/null +++ b/IARCS/NextPerm.cpp @@ -0,0 +1,27 @@ +#include +#include +#include +using namespace std; +int main() +{ + int N, K; + cin >> N >> K; + while(K--) + { + vector perm; + perm.clear(); + for(int i = 0; i> p; + perm.push_back(p); + } + next_permutation(perm.begin(), perm.end()); + for(int j = 0; j +using namespace std; +#define endl '\n' +#define ll long long +#define M 1000001 + +ll f[M], g[M]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + f[1] = 1, f[2] = 2, g[1] = 1, g[2] = 2; + ll n, i; + cin >> n; + for(i = 3; i <= n; i++) + { + f[i] = f[i-1] + f[i-2] + 2*g[i-2]; + g[i] = f[i-1] + g[i-1]; + f[i] %= 10000; + g[i] %= 10000; + } + cout << f[n]; + return 0; +} diff --git a/IARCS/Periodic Strings.cpp b/IARCS/Periodic Strings.cpp new file mode 100755 index 0000000..f54dc72 --- /dev/null +++ b/IARCS/Periodic Strings.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; +#define endl '\n' +int power2(unsigned long long int n, unsigned long long int m) +{ + unsigned long long int p = 1; + while(n--) + { + p = (p*2) % m; + } + return p; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + unsigned long long int n, m, total, sum = 2; + cin >> n >> m; + total = power2(n, m); + for(unsigned long long int i = 2; i < n; i++) + { + if(!(n%i)) + { + unsigned long long int k = power2(i, m); + sum = (sum + k) % m; + } + } + total = (total - sum) % m; + cout << total << endl; + return 0; +} diff --git a/IARCS/Pyramid.cpp b/IARCS/Pyramid.cpp new file mode 100755 index 0000000..6743ba1 --- /dev/null +++ b/IARCS/Pyramid.cpp @@ -0,0 +1,28 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +vector blocks; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, d1, d2, maxL = 0; + cin >> n; + for(i = 0; i < n; i++) + { + cin >> d1 >> d2; + blocks.push_back(min(d1, d2)); + } + sort(blocks.begin(), blocks.end()); + for(i = 0; i < n; i++) + { + if(blocks[i] > maxL) + { + maxL++; + } + } + cout << maxL; + return 0; +} diff --git a/IARCS/README b/IARCS/README new file mode 100755 index 0000000..74d3eb5 --- /dev/null +++ b/IARCS/README @@ -0,0 +1,16 @@ +This zip file contains the ten output files 1.out, 2.out, ... , 10.out +and six input files 1.in, 2.in, 3.in, 5.in, 6.in, 10.in. + +The input files 4.in, 7.in, 8.in and 9.in are large and are generated using +the program generate.c with input files generate-data-4.in, generate-data-7.in, +generate-data-8.in and generate-data-9.in. + +To generate the input files, compile generate.c and execute the following +sequence of commands. + + generate generate-data-4.in 4.in + generate generate-data-7.in 7.in + generate generate-data-8.in 8.in + generate generate-data-9.in 9.in + +This will create the four input files 4.in, 7.in, 8.in, 9.in. diff --git a/IARCS/Railway Catering Contracts.cpp b/IARCS/Railway Catering Contracts.cpp new file mode 100755 index 0000000..0986af3 --- /dev/null +++ b/IARCS/Railway Catering Contracts.cpp @@ -0,0 +1,34 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define M 1000000 +ll stations[M+1]; +ll Sums[M+1]; +ll BestSumK[M+1]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, k, i, sum = 0, bestSoFar; + cin >> n >> k; + for(i = 1; i <= n; i++) + { + cin >> stations[i]; + } + for(i = 1; i <= k; i++) + { + sum += stations[i]; + } + Sums[k] = sum; + BestSumK[k] = sum; + bestSoFar = sum; + for(i = k+1; i <= n; i++) + { + Sums[i] = Sums[i-1] + stations[i] - stations[i-k]; + BestSumK[i] = max(BestSumK[i-1] + stations[i], Sums[i]); + bestSoFar = max(bestSoFar, BestSumK[i]); + } + cout << bestSoFar; + return 0; +} diff --git a/IARCS/Rank Fraud.cpp b/IARCS/Rank Fraud.cpp new file mode 100755 index 0000000..7e45d14 --- /dev/null +++ b/IARCS/Rank Fraud.cpp @@ -0,0 +1,97 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +class Graph +{ + ll V; + list *adj; +public: + Graph(ll V); + void addEdge(ll v, ll w); + bool path_exists(ll v, ll w); +}; + +Graph::Graph(ll V) +{ + this -> V = V+1; + adj = new list[V+1]; +} +void Graph::addEdge(ll v, ll w) +{ + adj[v].push_back(w); +} +bool Graph::path_exists(ll v, ll w) +{ + for(list::iterator it = adj[v].begin(); it != adj[v].end(); it++) + { + if(w == *it) + { + return true; + } + } + return false; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("1.in", "r", stdin); + ll n, m, i, j, w, k; + cin >> n; + Graph ministers(n); + for(i = 1; i <= n; i++) + { + cin >> m; + for(j = 0; j < m; j++) + { + cin >> w; + ministers.addEdge(i, w); + } + } + bool visited[n+1]; + for(i = 1; i <= n; i++) + { + visited[i] = false; + } + list path; + path.push_back(1); + visited[1] = true; + for(i = 2; i <= n; i++) + { + if(!visited[i]) + { + if(ministers.path_exists(i, path.front())) + { + path.push_front(i); + visited[i] = true; + } + else if(ministers.path_exists(path.back(), i)) + { + path.push_back(i); + visited[i] = true; + } + else + { + k = 0; + for(list::iterator it = path.begin(); k < path.size(); it++) + { + if(ministers.path_exists(*it, i) && ministers.path_exists(i, *(++it))) + { + path.insert(--it, i); + visited[i] = true; + break; + } + k++; + } + } + } + } + cout << "YES\n"; + for(list::iterator it = path.begin(); it != path.end(); it++) + { + cout << *it << " "; + } + return 0; +} diff --git a/IARCS/Repetition-free numbers.cpp b/IARCS/Repetition-free numbers.cpp new file mode 100755 index 0000000..fcb48fd --- /dev/null +++ b/IARCS/Repetition-free numbers.cpp @@ -0,0 +1,166 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll greatest[] = {9, 98, 987, 9876, 98765, 987654, 9876543, 98765432, 987654321}; +ll smallest[] = {1, 12, 123, 1234, 12345, 123456, 1234567, 12345678, 123456789, 0}; + +string add_zeros(string str, ll n) +{ + while(n--) + { + str += '0'; + } + return str; +} +string add(string num1, string num2) +{ + string sum = "", a, b; + ll i, summer, carry = 0; + a = string(num1.rbegin(), num1.rend()); + b = string(num2.rbegin(), num2.rend()); + if(a.length() > b.length()) + { + b = add_zeros(b, a.length()-b.length()); + } + else + { + a = add_zeros(a, b.length() - a.length()); + } + for(i = 0; i < min(a.length(), b.length()); i++) + { + summer = (ll)(a[i] + b[i] - 2*(ll)('0') + carry); + carry = 0; + if(summer > 9) + { + carry = summer/10; + summer%= 10; + } + sum += (char)(summer + '0'); + } + if(carry!=0) + { + sum += (char)(carry + '0'); + } + return string(sum.rbegin(), sum.rend()); +} +string numToString(ll num) +{ + ll i; + string str = ""; + while(num != 0) + { + str += (char)( (num%10) + '0'); + num/=10; + } + str = string(str.rbegin(), str.rend()); + return str; +} + +bool isRepFree(string str) +{ + ll i; + map visited; + for(i = 0; i < str.length(); i++) + { + if(visited[str[i]] || str[i] == '0') + { + return false; + } + else + { + visited[str[i]] = true; + } + } + return true; +} +string nextRepFree(string num) +{ + ll len = num.length(), i, j; + string newNum; + for(i = 0; i < len; i++) + { + if(num[i] == '0') + { + for(ll k = i; k < len; k++) + { + num[k] = '1'; + } + } + } + while(!isRepFree(num)) + { + for(i = len-1; i > 0; i--) + { + for(j = i-1; j >= 0; j--) + { + if(num[i] == '0') + { + for(ll k = i; k < len; k++) + { + num[k] = '1'; + } + } + if(num[j] == '0') + { + for(ll k = j; k < len; k++) + { + num[k] = '1'; + } + } + if(num[i] == num[j]) + { + if(num[i] != '9') + { + num[i] = (char)((int)(num[i]) + 1); + } + else + { + newNum = add_zeros("1", len - i - 1); + num = add(num, newNum); + } + } + } + } + } + return num; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i; + cin >> n; + if(n <= 0) + { + cout << 1; + } + else if(n >= greatest[numToString(n).length()-1]) + { + cout << smallest[numToString(n).length()]; + } + else + { + string num = numToString(n); + for(i = 0; i < num.length(); i++) + { + if(num[i] == '0') + { + for(ll j = i; j < num.length(); j++) + { + num[j] = '1'; + } + if(isRepFree(num)) + { + cout << num; + return 0; + } + } + } + n++; + num = numToString(n); + cout << nextRepFree(num); + } + return 0; +} diff --git a/IARCS/Reverse.cpp b/IARCS/Reverse.cpp new file mode 100755 index 0000000..6e28bc4 --- /dev/null +++ b/IARCS/Reverse.cpp @@ -0,0 +1,44 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, j; + cin >> n; + cin.ignore(); + string arr[n], temp; + for(i = n-1; i >= 0; i--) + { + getline(cin, arr[i]); + arr[i].erase(remove(arr[i].begin(), arr[i].end(), ','), arr[i].end()); + arr[i].erase(remove(arr[i].begin(), arr[i].end(), '\''), arr[i].end()); + arr[i].erase(remove(arr[i].begin(), arr[i].end(), ':'), arr[i].end()); + arr[i].erase(remove(arr[i].begin(), arr[i].end(), ';'), arr[i].end()); + arr[i].erase(remove(arr[i].begin(), arr[i].end(), '.'), arr[i].end()); + } + for(i = 0; i < n; i++) + { + temp = ""; + for(j = arr[i].length()-1; j >= 0; j--) + { + if(arr[i][j] == ' ') + { + cout << string(temp.rbegin(), temp.rend()) << " "; + temp = ""; + } + else + { + temp += arr[i][j]; + } + } + cout << string(temp.rbegin(), temp.rend()); + temp = ""; + cout << endl; + } + return 0; +} diff --git a/IARCS/Sorting row of numbers.cpp b/IARCS/Sorting row of numbers.cpp new file mode 100755 index 0000000..0cd5e14 --- /dev/null +++ b/IARCS/Sorting row of numbers.cpp @@ -0,0 +1,42 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, j, num; + cin >> n; + vector > rows; + vector row; + for(i = 0; i < n; i++) + { + while(true) + { + cin >> num; + if(num != -1) + { + row.push_back(num); + } + else + { + rows.push_back(row); + row.clear(); + break; + } + } + } + sort(rows.begin(), rows.end()); + for(i = 0; i < rows.size(); i++) + { + for(j = 0; j < rows[i].size(); j++) + { + cout << rows[i][j] << " "; + } + cout << endl; + } + return 0; +} diff --git a/IARCS/Speculating on Buffaloes.cpp b/IARCS/Speculating on Buffaloes.cpp new file mode 100755 index 0000000..a36c99a --- /dev/null +++ b/IARCS/Speculating on Buffaloes.cpp @@ -0,0 +1,20 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, k, i; + cin >> n >> k; + ll prices[n]; + for(i = 0; i < n; i++) + { + cin >> prices[i]; + } + + return 0; +} diff --git a/IARCS/The End of Corruption.cpp b/IARCS/The End of Corruption.cpp new file mode 100755 index 0000000..0a91ebe --- /dev/null +++ b/IARCS/The End of Corruption.cpp @@ -0,0 +1,28 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, m, i, k; + cin >> n >> m; + priority_queue citizens; + for(i = 0; i < n+m; i++) + { + cin >> k; + if(k == -1) + { + cout << citizens.top() << endl; + citizens.pop(); + } + else + { + citizens.push(k); + } + } + return 0; +} diff --git a/IARCS/The Great Escape.cpp b/IARCS/The Great Escape.cpp new file mode 100755 index 0000000..bbc5eac --- /dev/null +++ b/IARCS/The Great Escape.cpp @@ -0,0 +1,74 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pii make_pair +class Graph +{ + ll V; + list *adj; +public: + Graph(ll v); + void addEdge(ll v, ll w); + ll find_shortest(ll start, ll end, ll n); +}; +Graph::Graph(ll v) +{ + this->V = v+1; + adj = new list[v+1]; +} +void Graph::addEdge(ll v, ll w) +{ + adj[v].push_back(w); + adj[w].push_back(v); +} +ll Graph::find_shortest(ll start, ll end, ll n) +{ + priority_queue, vector >, greater > > jumps; + ll new_cost, came_from[n+1], cost_so_far[n+1], i; + pair temp; + for(i = 1; i <= n; i++) + { + came_from[i] = -1; + cost_so_far[i] = -1; + } + jumps.push(pii(0, start)); + cost_so_far[start] = 0; + while(!jumps.empty()) + { + temp = jumps.top(); + if(temp.second == end) + { + return temp.first; + } + jumps.pop(); + for(list::iterator it = adj[temp.second].begin(); it != adj[temp.second].end(); it++) + { + new_cost = cost_so_far[temp.second] + 1; + if(cost_so_far[*it] == -1 || new_cost < cost_so_far[*it]) + { + cost_so_far[*it] = new_cost; + jumps.push(pii(new_cost, *it)); + came_from[*it] = temp.second; + } + } + } + return 0; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + freopen("10.in", "r", stdin); + ll n, m, i, b1, b2, start, end; + cin >> n >> m; + Graph buildings(n); + for(i = 0; i < m; i++) + { + cin >> b1 >> b2; + buildings.addEdge(b1, b2); + } + cin >> start >> end; + cout << buildings.find_shortest(start, end, n); + return 0; +} diff --git a/IARCS/The Leaf eaters.cpp b/IARCS/The Leaf eaters.cpp new file mode 100755 index 0000000..533c132 --- /dev/null +++ b/IARCS/The Leaf eaters.cpp @@ -0,0 +1,27 @@ +#include +#define ll long long +using namespace std; +map nums; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll N, K, l, i; + cin >> N >> K; + ll lengths[K]; + for(i = 0; i < K; i++) + { + cin >> lengths[i]; + } + nums[1] = true; + for(i = 0; i < K; i++) + { + l = lengths[i] + 1; + while(l <= N) + { + nums[l] = true; + l += lengths[i]; + } + } + cout << N - nums.size(); + return 0; +} diff --git a/IARCS/The Medu Vada Maze.cpp b/IARCS/The Medu Vada Maze.cpp new file mode 100755 index 0000000..1f04f6a --- /dev/null +++ b/IARCS/The Medu Vada Maze.cpp @@ -0,0 +1,125 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +typedef struct +{ + ll x; + ll y; +} pt; + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + ll r, c, i, j; + bool isPossible = false; + cin >> r >> c; + char maze[r][c], k; + pt mouse, dosa, current, neighbour, nll, came; + pt came_from[r][c]; + queue frontier; + map, bool> isVisited; + for(i = 0; i < r; i++) + { + for(j = 0; j < c; j++) + { + cin >> maze[i][j]; + k = maze[i][j]; + if(maze[i][j] == 'M') + { + mouse.x = i; + mouse.y = j; + } + if(maze[i][j] == 'D') + { + dosa.x = i; + dosa.y = j; + } + } + } + nll.x = -1, nll.y = -1; + frontier.push(mouse); + came_from[mouse.x][mouse.y] = nll; + while(!frontier.empty()) + { + current = frontier.front(); + frontier.pop(); + if(current.x == dosa.x && current.y == dosa.y) + { + isPossible = true; + break; + } + came = came_from[current.x][current.y]; + for(i = 0; i < 4; i++) + { + switch(i) + { + case 0: + neighbour.x = current.x - 1; + neighbour.y = current.y; + break; + case 1: + neighbour.x = current.x; + neighbour.y = current.y+1; + break; + case 2: + neighbour.x = current.x + 1; + neighbour.y = current.y; + break; + case 3: + neighbour.x = current.x; + neighbour.y = current.y-1; + break; + } + if(neighbour.x < 0) + { + neighbour.x = r-1; + } + if(neighbour.y < 0) + { + neighbour.y = c-1; + } + if(neighbour.x == r) + { + neighbour.x = 0; + } + if(neighbour.y == c) + { + neighbour.y = 0; + } + if(maze[neighbour.x][neighbour.y] != '#' && !(neighbour.x == came_from[current.x][current.y].x && neighbour.y == came_from[current.x][current.y].y) && isVisited[make_pair(neighbour.x, neighbour.y)] == false) + { + came_from[neighbour.x][neighbour.y] = current; + isVisited[make_pair(neighbour.x, neighbour.y)] = true; + frontier.push(neighbour); + } + } + } + if(isPossible) + { + cout << "YES" << endl; + current = came_from[current.x][current.y]; + while(current.x != -1 && current.y != -1) + { + maze[current.x][current.y] = 'x'; + current = came_from[current.x][current.y]; + } + maze[mouse.x][mouse.y] = 'M'; + for(i = 0; i < r; i++) + { + for(j = 0; j < c; j++) + { + cout << maze[i][j]; + } + cout << endl; + } + } + else + { + cout << "NO"; + } + return 0; +} diff --git a/IARCS/The Siruseri Sports Stadium.cpp b/IARCS/The Siruseri Sports Stadium.cpp new file mode 100755 index 0000000..48300c8 --- /dev/null +++ b/IARCS/The Siruseri Sports Stadium.cpp @@ -0,0 +1,34 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool wayToSort(pair a, pair b){return a.second < b.second;} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, dur, start, end, current, next, count; + cin >> n; + pair events[n]; + for(i = 0; i < n; i++) + { + cin >> start; + cin >> dur; + end = start + dur; + events[i] = make_pair(start, end); + } + sort(events, events+n, wayToSort); + current = events[0].second; + count = 1; + for(i = 1; i < n; i++) + { + if(events[i].first > current) + { + current = events[i].second; + count++; + } + } + cout << count; + return 0; +} diff --git a/IARCS/The Timber Auction.cpp b/IARCS/The Timber Auction.cpp new file mode 100755 index 0000000..bc77c35 --- /dev/null +++ b/IARCS/The Timber Auction.cpp @@ -0,0 +1,34 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll forest[1111][1111], sums[1111][1111]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + ll m, n, i, j, C, x1, y1, x2, y2, sum; + cin >> m >> n; + for(i = 0; i < max(m, n); i++) + { + sums[i][0] = 0; + sums[0][i] = 0; + } + for(i = 0; i < m; i++) + { + for(j = 0; j < n; j++) + { + cin >> forest[i][j]; + sums[i+1][j+1] = sums[i][j+1] + sums[i+1][j] - sums[i][j] + forest[i][j]; + } + } + cin >> C; + for(i = 1; i <= C; i++) + { + cin >> x1 >> y1 >> x2 >> y2; + sum = sums[x2][y2] - sums[x1-1][y2] - sums[x2][y1-1] + sums[x1-1][y1-1]; + printf("%d\n", sum); + } + return 0; +} diff --git a/IARCS/Tiles.cpp b/IARCS/Tiles.cpp new file mode 100755 index 0000000..e06b8d8 --- /dev/null +++ b/IARCS/Tiles.cpp @@ -0,0 +1,18 @@ +#include +using namespace std; +int main() +{ + long long int N; + int mod = 15746; + cin >> N; + long long int first, second = 1; + long long int temp; + for(long long int i = 1; i < N; i++) + { + temp = first % mod; + first = second % mod; + second = (temp + second) % mod; + } + cout << second % mod; + return 0; +} diff --git a/IARCS/Treasure.cpp b/IARCS/Treasure.cpp new file mode 100755 index 0000000..46029f8 --- /dev/null +++ b/IARCS/Treasure.cpp @@ -0,0 +1,63 @@ +// Treasure.cpp +/* Author - Manav Aggarwal */ +#include +#include +using namespace std; +int main() +{ + int M, T, S, p, tmptoken, tmpmachine, x , y, d = 0;; + long long int N; + cin >> M >> T >> S >> N; + int prod = M*T; + vector > matrix(prod+1,(vector(2))); /* To store the machines and token numbers */ + for(int i = 1; i <= prod; i++) /* Stores the corresponding token and machine */ + { + cin >> matrix[i][0]; + cin >> matrix[i][1]; + } + int m = S-1, token = 1; + M-=1; + if(N<=(prod)) /* If N is smaller than or equal to the total no. of machines and tokens(M*T) */ + { + for(long long int j = 0; j +using namespace std; +#define endl '\n' +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + int n1, n2, n3, i, k; + cin >> n1 >> n2 >> n3; + set list1, list2, list3, final; + set :: iterator it; + for(i = 0; i < n1; i++) + { + cin >> k; + list1.insert(k); + } + for(i = 0; i < n2; i++) + { + cin >> k; + list2.insert(k); + } + for(i = 0; i < n3; i++) + { + cin >> k; + list3.insert(k); + } + for(it = list1.begin(); it != list1.end(); it++) + { + if(list2.count(*it) || list3.count(*it)) + { + final.insert(*it); + } + } + for(it = list2.begin(); it != list2.end(); it++) + { + if(list1.count(*it) || list3.count(*it)) + { + final.insert(*it); + } + } + for(it = list3.begin(); it != list3.end(); it++) + { + if(list1.count(*it) || list2.count(*it)) + { + final.insert(*it); + } + } + cout << final.size() << endl; + for(it = final.begin(); it != final.end(); it++) + { + cout << *it << endl; + } + return 0; +} diff --git a/IARCS/What is the Rank.cpp b/IARCS/What is the Rank.cpp new file mode 100755 index 0000000..48d745f --- /dev/null +++ b/IARCS/What is the Rank.cpp @@ -0,0 +1,30 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, j, chaabi; + cin >> n; + ll bank[n]; + for(i = 0; i < n; i++) + { + cin >> bank[i]; + } + for(i = 0; i < n; i++) + { + chaabi = bank[i]; + j = i-1; + while(j >= 0 && bank[j] < chaabi) + { + bank[j+1] = bank[j]; + j--; + } + bank[j+1] = chaabi; + cout << j + 2 << endl; + } + return 0; +} diff --git a/IARCS/Word Hopping.cpp b/IARCS/Word Hopping.cpp new file mode 100755 index 0000000..abfb420 --- /dev/null +++ b/IARCS/Word Hopping.cpp @@ -0,0 +1,136 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool comp(string s1, string s2) +{ + return s1.length() > s2.length(); +} +bool canHop(string w1, string w2) +{ + ll i, loc; + bool gotOne = false; + if(w1.length() - w2.length() == 1) + { + for(i = 0; i < w2.length(); i++) + { + if(!gotOne && w1[i] != w2[i]) + { + if(w1[i+1] == w2[i]) + { + gotOne = true; + } + else + { + return false; + } + } + else if(gotOne && w1[i+1] != w2[i]) + { + return false; + } + } + return true; + } + else if(w1.length() == w2.length()) + { + for(i = 0; i < w1.length(); i++) + { + if(w1[i] != w2[i]) + { + if(!gotOne) + { + gotOne = true; + loc = i; + } + else + { + return false; + } + } + } + if(gotOne) + { + if(w2[loc] > w1[loc]) + { + for(i = loc+1; i < w1.length(); i++) + { + if(w1[i] == w2[loc]) + { + return true; + } + } + } + } + } + return false; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + map isTaken; + map position; + ll n, i, maxTillNow = 0, j; + cin >> n; + string word; + vector wordsArr[11], words, seq; + list > seqs, nextSeqs; + for(i = 0; i < n; i++) + { + cin >> word; + if(!isTaken[word]) + { + wordsArr[word.length()].push_back(word); + isTaken[word] = true; + } + } + for(i = 1; i <= 10; i++) + { + sort(wordsArr[i].begin(), wordsArr[i].end()); + } + for(i = 10; i >= 1; i--) + { + for(j = 0; j < wordsArr[i].size(); j++) + { + word = wordsArr[i][j]; + words.push_back(word); + position[word] = words.size()-1; + seq.push_back(word); + seqs.push_back(seq); + seq.clear(); + } + } + bool changed = true; + while(changed) + { + changed = false; + for(list >::iterator it = seqs.begin(); it != seqs.end(); it++) + { + seq = *it; + if(seq.size() == 0) + { + continue; + } + word = seq[seq.size()-1]; //seq[0] seq[1] seq[2] seq[3] seq[4] seq[5] + for(i = position[word] + 1; i < words.size(); i++) + { + if(canHop(word, words[i])) + { + seq.push_back(words[i]); + nextSeqs.push_back(seq); + maxTillNow = max(maxTillNow, (ll)(seq.size())); + changed = true; + seq = *it; + } + } + } + seqs.clear(); + seqs = nextSeqs; + nextSeqs.clear(); + } + cout << maxTillNow; + return 0; +} diff --git a/IARCS/Word List.cpp b/IARCS/Word List.cpp new file mode 100755 index 0000000..793bf10 --- /dev/null +++ b/IARCS/Word List.cpp @@ -0,0 +1,44 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, j; + cin >> n; + string line, temp = ""; + set words; + cin.ignore(); + for(i = 0; i < n; i++) + { + getline(cin, line); + for(j = 0; j < line.length(); j++) + { + if(isalpha(line[j])) + { + line[j] = tolower(line[j]); + temp += line[j]; + } + else if(line[j] == ' ' && temp.length() > 0) + { + words.insert(temp); + temp = ""; + } + } + if(temp.length() > 0) + { + words.insert(temp); + } + temp = ""; + } + cout << words.size() << endl; + for(set::iterator it = words.begin(); it != words.end(); it++) + { + cout << *it << endl; + } + return 0; +} diff --git a/IARCS/gmon.out b/IARCS/gmon.out new file mode 100755 index 0000000000000000000000000000000000000000..4c2220ee9973f0506c27d13366334b4e954aa84f GIT binary patch literal 239564 zcmeIuu@OX200huAD1i|Q1&a9DT_FM`P>}`{qZ&ha4P5p%+0Az5ja|ui`Q$w6>_eL+ z$$C#|-WCD`2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs Z0RjXF5FkK+z`q2xzGUu7s`udf*$;J32vYz6 literal 0 HcmV?d00001 diff --git a/IARCS/test.in b/IARCS/test.in new file mode 100755 index 0000000..7b1d4dc --- /dev/null +++ b/IARCS/test.in @@ -0,0 +1,9 @@ +4 +1873 +2134 +1900 +1600 +2450 +1860 +1700 +2120 \ No newline at end of file diff --git a/INOI Workshop/.DS_Store b/INOI Workshop/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f09788ca2e48eda19a7e8608cc1c435609d906cb GIT binary patch literal 8196 zcmeHLO>fgc5S?w)lC%ec08zxn;#8!9(z+kl5CVb&Qbej&h(fVr(^xpRl{k&6D3Z_o z1i0~8iJyVs#1#pC07ov|IF*^*ZR?Fw#080}yVmYo@620!-p1aH0f1Gy&OE>j0OYX} z7N@ZpQOHg;Q^w@TMMQ>tfcZOq*s%T3&iLv9t$qIis|7AzM*NID|Z)|KlH!*oCUznPvqj+ZOVZ9ml>ai7fI~A+_fS-Ae zYs-GkiktiW)iCrA`j)-sxxLNexf@{+TVCL{Q`C)hFL1(MCF}-HXQM9WTlbu}xmi44 zYrES>tyzJ)=5;*V^SyW{U!Y^NIMeT&=F*&DE-nw|jQ+|>Y0g+Qmj{F5i+ujlm8I)< z??;1YFJHZW^Y-2DhmSmHVDg;e%-M9hprLg;* z`=o?#h0Y(WQ8PU=zd(w+U2g||7;NF3bf<@wh1BO5TF%c{X*nk{%emlm8orGSFf_pv z93L^PMq0X{UR8e?vat2YNYHQ5-HNjOr+-MNX`97)hn86q{eeJ zAL?r=k^UsAYE7+a#;QhI8{!T{It91!5pBRzaG?#?uopoz6!TY{Vs?)gnhZ|EDm2mC z#p5c}u;)Pw`y<(7kA~QIO1}j|Vp(D$kW6IP`#%Yxi&o$mDljhYd4}@;n@4~DKZcR% zTh7@&?w&SgDX-B9K$CQT_qWJ$E9U7-a!Vi62W`s;jBtk?nJbRa%aD6!joV;>afUe=RfzBXoa9kC z^u%V#jkDznpSiAW_m=g}nZ6l6?N<4K7jku-y^L&cjLaCkbaMq<0axH;6=2O)8=gn> z=nA+3u0W@Nejf_DVrke!44)2$a0DP`><-4Z{w6A?Ff0w5h`d9SNF_$9*bze_o&AO7 zm4;2kNQccyI;&RDo~9 C=|rXg literal 0 HcmV?d00001 diff --git a/INOI Workshop/Day 1/Inversions.cpp b/INOI Workshop/Day 1/Inversions.cpp new file mode 100755 index 0000000..c3992b3 --- /dev/null +++ b/INOI Workshop/Day 1/Inversions.cpp @@ -0,0 +1,41 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, i, j, maxDist = 0; + cin >> n; + ll arr[n], LMa[n], RMin[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + } + LMa[0] = arr[0]; RMin[n-1] = arr[n-1]; + for(i = 1; i < n; i++) + { + LMa[i] = max(arr[i], LMa[i-1]); + RMin[n-i-1] = min(arr[n-i-1], RMin[n-i]); + } + i = 0, j = 0; + while(i < n && j < n) + { + if(LMa[i] > RMin[j]) + { + maxDist = max(maxDist, j - i); + j++; + } + else + i++; + } + cout << maxDist << endl; + } + return 0; +} diff --git a/INOI Workshop/Day 1/Queen.cpp b/INOI Workshop/Day 1/Queen.cpp new file mode 100755 index 0000000..61b4f45 --- /dev/null +++ b/INOI Workshop/Day 1/Queen.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; +#define ll long long +int n, m; +int main() +{ + ll test, k; cin >> test; + for(k = 1; k <= test; k++) + { + ll C, D, V, i, denom; + cin >> C >> D >> V; + ll cnt = 0; + ll maxM = 0; + for(i = 0; i < D; i++) + { + cin >> denom; + while(denom > maxM + 1) + { + maxM = maxM + (ll)(C * (maxM + 1)); + cnt++; + } + maxM = maxM + (ll)(C * denom); + } + while(maxM < V) + { + maxM = maxM + (ll)(C * (maxM + 1)); + cnt++; + } + cout << "Case #" << k << ": " << cnt << endl; + } +} diff --git a/INOI Workshop/Day 1/SubSum.cpp b/INOI Workshop/Day 1/SubSum.cpp new file mode 100755 index 0000000..84623e2 --- /dev/null +++ b/INOI Workshop/Day 1/SubSum.cpp @@ -0,0 +1,27 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, i; + double sum = 0; + cin >> n; + double arr[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + sum += arr[i]*(n+1); + } + cout << setprecision(2) << fixed << sum/(2*n + 2) << endl; + } + return 0; +} diff --git a/INOI Workshop/Day 1/Subtractions.cpp b/INOI Workshop/Day 1/Subtractions.cpp new file mode 100755 index 0000000..82974b0 --- /dev/null +++ b/INOI Workshop/Day 1/Subtractions.cpp @@ -0,0 +1,32 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, a, b; + cin >> n; + for(i = 0; i < n; i++) + { + ll cnt = 0; + cin >> a >> b; + while(!(a == 0 || b == 0)) + { + if(a > b) + { + a -= b; + cnt++; + } + else + { + b -= a; + cnt++; + } + } + cout << cnt << endl; + } + return 0; +} diff --git a/INOI Workshop/Day 1/Three.cpp b/INOI Workshop/Day 1/Three.cpp new file mode 100755 index 0000000..04c4954 --- /dev/null +++ b/INOI Workshop/Day 1/Three.cpp @@ -0,0 +1,26 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, i, sum = 0; + cin >> n; + ll arr[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + sum += arr[i]/3; + } + cout << sum << endl; + } + return 0; +} diff --git a/INOI Workshop/Day 2/.DS_Store b/INOI Workshop/Day 2/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..137a6f06575ab7a9bc06858e2976a474e9db9e3a GIT binary patch literal 6148 zcmeHKO-sW-5Pg$Isff^{#~eM0^%sP;3SLC)UF=81k7`S;qPP4Ef0X~JzS$jur4esZ zWTwo#&FsF+?n}vL0Z8X%+y+_znsmivhoQ!_UwzFI%WM-R+~W`<%rHBfOh;>@J+X-j z=(B60ivb=`;M?;XPNqZl=^x{ien6Myl2LPA+;a3I?(mES=6FXNNAz00T#}>w=2lg?AJ$ut zwZH{y&*@`c)mFwQ`5((*Y`M7tu7E4BDGG4UR%`A?^ymt>0NM}B?ak*g`G14J+_ztUql>(CX`n?X9WP9t{;&iXg=+|^L9al!I kC~SnSm}7M--lqp+KGOy +using namespace std; +#define endl '\n' +#define ll long long +#define MAX 1000011 +#define mp make_pair +#define pii pair + +struct cakePiece +{ + ll weight; + ll cuts; + cakePiece (ll wt) + { + weight = wt; + cuts = 1; + } + cakePiece () + { + cuts = 1; + } +}cakes[MAX]; +bool operator<(const cakePiece & x, const cakePiece & y) +{ + return ((x.weight * y.cuts) < (y.weight * x.cuts)); +} +cakePiece operator-(const cakePiece & x, cakePiece & y) +{ + cakePiece diff = cakePiece((x.weight * y.cuts) - (y.weight * x.cuts)); + diff.cuts = x.cuts * y.cuts; + return diff; +} +ll cuts[MAX], weights[MAX]; +priority_queue< cakePiece > getMax; +int main() +{ + ios_base::sync_with_stdio(false); + ll n, maxCuts, i, k; + cin >> n >> maxCuts; + for(i = 0; i < n; i++) + { + cin >> k; + cakes[i].weight = k; + cakes[i].cuts = 1; + getMax.push(cakes[i]); + } + sort(cakes, cakes+n); + cakePiece minDiff = cakes[n-1] - cakes[0]; + for(i = 0; i < maxCuts; i++) + { + cakePiece curr = getMax.top(); + getMax.pop(); + curr.cuts++; + if(curr < cakes[0]) + { + cakes[0] = curr; + } + getMax.push(curr); + curr = getMax.top() - cakes[0]; + if(curr < minDiff) + { + minDiff = curr; + } + } + long double num = minDiff.weight; + long double denom = minDiff.cuts; + cout << fixed << setprecision(7) << num/denom << '\n'; + return 0; +} diff --git a/INOI Workshop/Day 2/Chemistry101.cpp b/INOI Workshop/Day 2/Chemistry101.cpp new file mode 100755 index 0000000..a4cdd9a --- /dev/null +++ b/INOI Workshop/Day 2/Chemistry101.cpp @@ -0,0 +1,69 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define mp make_pair +bool isDigit(char c) {return (c >= '0' && c <= '9');} +bool isElement(char c) {return (c == 'C' || c == 'O' || c == 'H');} +map massOf; +pair eval(ll index, string formula) +{ + ll sum = 0, i; + pair rt; + for(i = index; i < formula.length(); i++) + { + if(formula[i] == ')') + { + if(isDigit(formula[i+1])) + { + return mp(sum * (formula[i+1] - '0'), i+1); + } + else + return mp(sum, i); + } + else if(isElement(formula[i])) + { + sum += massOf[formula[i]]; + } + else if(isDigit(formula[i])) + { + sum += massOf[formula[i-1]]*(formula[i]-'1'); + } + else if(formula[i] == '(') + { + rt = eval(i + 1, formula); + sum += rt.first; + i = rt.second; + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + string formula; + cin >> formula; + ll i, totMass = 0; + massOf['C'] = 12; massOf['O'] = 16; massOf['H'] = 1; massOf[')'] = 0; + pair rtd; + for(i = 0; i < formula.length(); i++) + { + if(isElement(formula[i])) + { + totMass += massOf[formula[i]]; + } + else if(isDigit(formula[i])) + { + totMass += massOf[formula[i-1]]*(formula[i]-'1'); + } + else if(formula[i] == '(') + { + rtd = eval(i + 1, formula); + totMass += rtd.first; + i = rtd.second; + } + } + cout << totMass << endl; + return 0; + +} diff --git a/INOI Workshop/Day 2/Chemistry102.cpp b/INOI Workshop/Day 2/Chemistry102.cpp new file mode 100755 index 0000000..dbb852d --- /dev/null +++ b/INOI Workshop/Day 2/Chemistry102.cpp @@ -0,0 +1,55 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define mp make_pair +bool isDigit(char c) {return (c >= '0' && c <= '9');} +bool isElement(char c) {return (c == 'C' || c == 'O' || c == 'H');} +map massOf; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + string formula; + cin >> formula; + ll i, totMass = 0, tp, k; + massOf['C'] = 12; massOf['O'] = 16; massOf['H'] = 1; massOf[')'] = 0; + pair rtd; + stack cmp; + cmp.push(0); + for(i = 0; i < formula.length(); i++) + { + tp = cmp.top(); cmp.pop(); + if(isElement(formula[i])) + { + tp += massOf[formula[i]]; + cmp.push(tp); + } + else if(isDigit(formula[i])) + { + if(formula[i-1] != ')') + { + tp += massOf[formula[i-1]]*(formula[i]-'1'); + } + else + { + tp *= (formula[i] - '0'); + } + cmp.push(tp); + } + else if(formula[i] == '(') + { + cmp.push(tp); + cmp.push(0); + } + else if(formula[i] == ')') + { + k = cmp.top(); + tp += k; + cmp.pop(); + cmp.push(tp); + } + } + cout << cmp.top() << endl; + return 0; +} diff --git a/INOI Workshop/Day 2/NextSmallest.cpp b/INOI Workshop/Day 2/NextSmallest.cpp new file mode 100755 index 0000000..46e7e90 --- /dev/null +++ b/INOI Workshop/Day 2/NextSmallest.cpp @@ -0,0 +1,44 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + vector num; + cin >> t; + while(t--) + { + num.clear(); + ll n, i, k; + bool flag = true; + cin >> n; + for(i = 0; i < n; i++) + { + cin >> k; + num.push_back(k); + } + for(i = 1; i < n; i++) + { + if(num[i-1] < num[i]) + { + flag = false; + } + } + if(flag) + cout << "-1"; + else + { + next_permutation(num.begin(), num.end()); + for(i = 0; i < n; i++) + { + cout << num[i]; + } + } + cout << endl; + } + return 0; +} diff --git a/INOI Workshop/Day 2/Seinfield.cpp b/INOI Workshop/Day 2/Seinfield.cpp new file mode 100755 index 0000000..06649c0 --- /dev/null +++ b/INOI Workshop/Day 2/Seinfield.cpp @@ -0,0 +1,43 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + string brackets; + cin >> brackets; + if(brackets[0] == '-') + { + break; + } + ll i, ops = 0; + stack bracs; + for(i = 0; i < brackets.length(); i++) + { + if(brackets[i] == '{') + { + bracs.push('{'); + } + else + { + if(bracs.empty()) + { + ops++; + bracs.push('}'); + } + else + bracs.pop(); + } + } + ops += bracs.size()/2; + cout << ops << endl; + } + return 0; +} diff --git a/INOI Workshop/Day 2/StreetParade.cpp b/INOI Workshop/Day 2/StreetParade.cpp new file mode 100755 index 0000000..64fa7ea --- /dev/null +++ b/INOI Workshop/Day 2/StreetParade.cpp @@ -0,0 +1,56 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + while(true) + { + ll n, i, num, tp; + cin >> n; + if(n == 0) + { + break; + } + queue parade; + stack side; + for(i = 1; i <= n; i++) + { + cin >> num; + parade.push(num); + } + num = 1; + while(!parade.empty()) + { + tp = parade.front(); + parade.pop(); + if(tp != num) + { + side.push(tp); + } + else + num++; + if(!side.empty()) + { + tp = side.top(); + while(tp == num) + { + side.pop(); + num++; + if(!side.empty()) + tp = side.top(); + } + } + + } + if(side.empty()) + cout << "yes" << endl; + else + cout << "no" << endl; + } + return 0; +} diff --git a/INOI Workshop/Day 3/.DS_Store b/INOI Workshop/Day 3/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1c7b07ab0460de9c4ef02be21b319158db1c8e1d GIT binary patch literal 6148 zcmeHKO-lno41K8u3-!>W$2s;S_z%`)6-4l$o<;j{5K3DV@B7c!mk*1zdlV5#O7hZ7 zGQ0C&XC?roeqWpe696NsqNvj&8txq$MDh_)Y>rnf`Fq0|<~ +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t, mod = 1e9 + 7, i, j, k; + ll count[301]; + count[0] = 1; count[1] = 1; + for(i = 2; i <= 300; i++) + { + count[i] = 1; + for(j = i + 2; j <= 2*i; j++) + { + count[i] *= j; + count[i] %= mod; + } + } + cin >> t; + while(t--) + { + ll n; + cin >> n; + cout << count[n] << endl; + } + return 0; +} diff --git a/INOI Workshop/Day 3/DNA.cpp b/INOI Workshop/Day 3/DNA.cpp new file mode 100755 index 0000000..c39abb5 --- /dev/null +++ b/INOI Workshop/Day 3/DNA.cpp @@ -0,0 +1,54 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + while(true) + { + ll n, i, j, k, mxL = 0; + cin >> n; + if(n == 0) + break; + string s1, s2; + cin >> s1 >> s2; + ll lcs[s1.length() + 1][s2.length() + 1], cont[s1.length()+1][s2.length()+1]; + cont[0][0] = 0; + memset(cont, 0, sizeof(cont)); + for(i = 0; i <= s1.length(); i++) + { + for(j = 0; j <= s2.length(); j++) + { + if(i == 0 || j == 0) + { + lcs[i][j] = 0; + } + else + { + lcs[i][j] = max(lcs[i-1][j], lcs[i][j-1]); + if(s1[i-1] == s2[j-1]) + { + cont[i][j] = cont[i-1][j-1] + 1; + } + else + { + cont[i][j] = 0; + } + k = cont[i][j]; + if(cont[i][j] >= n) + { + for(k = n; k <= cont[i][j]; k++) + { + lcs[i][j] = max(lcs[i][j], lcs[i-k][j-k] + k); + } + } + } + } + } + cout << lcs[s1.length()][s2.length()] << endl; + } + return 0; +} diff --git a/INOI Workshop/Day 3/Kadanes.cpp b/INOI Workshop/Day 3/Kadanes.cpp new file mode 100755 index 0000000..78d43dd --- /dev/null +++ b/INOI Workshop/Day 3/Kadanes.cpp @@ -0,0 +1,40 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define INF 999999999 +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, m, i; + cin >> n >> m; + ll arr[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + } + ll curr = 0, maxSum = -INF, prev = 0; + for(i = 0; i < n; i++) + { + if(curr + arr[i] < m) + { + curr += arr[i]; + } + else + { + curr += arr[i]; + while(curr > m) + { + curr -= arr[prev]; + prev++; + } + } + if(curr <= m && maxSum < curr) + { + maxSum = curr; + } + } + cout << maxSum << endl; + return 0; +} diff --git a/INOI Workshop/Hacker.cpp b/INOI Workshop/Hacker.cpp new file mode 100755 index 0000000..8c5f200 --- /dev/null +++ b/INOI Workshop/Hacker.cpp @@ -0,0 +1,70 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAXN 100011 +list adj[MAXN]; +bool visited[MAXN], possibles[MAXN]; +ll n; +void dfs(ll v, ll cnt) +{ + visited[v] = true; + cnt++; + for(list::iterator it = adj[v].begin(); it != adj[v].end(); it++) + { + if(!visited[(*it)]) + { + dfs((*it), cnt); + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll m, i, h, q; + cin >> n >> m; + for(i = 1; i <= n; i++) + { + visited[i] = false; + adj[i].clear(); + possibles[i] = true; + } + for(i = 0; i < m; i++) + { + cin >> h >> q; + adj[h].push_back(q); + possibles[q] = false; + } + bool flag = 0, isP; + for(i = 1; i <= n; i++) + { + if(!possibles[i]) + continue; + isP = 0; + dfs(i, 0); + for(h = 1; h <= n; h++) + { + if(!visited[h]) + { + isP = 1; + break; + } + } + if(!isP) + { + flag = 1; + cout << i << endl; + break; + } + memset(visited, false, sizeof(visited)); + } + if(!flag) + cout << -1 << endl; + } + return 0; +} diff --git a/INOI Workshop/Three-Prime.cpp b/INOI Workshop/Three-Prime.cpp new file mode 100755 index 0000000..5e2f040 --- /dev/null +++ b/INOI Workshop/Three-Prime.cpp @@ -0,0 +1,44 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll M = 1000000; +ll arr[1000001]; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll t; + cin >> t; + while(t--) + { + ll n; + cin >> n; + ll sq = sqrt(n); + if(sq*sq == n && arr[sq]) + cout << "YES" << endl; + else + cout << "NO" << endl; + } + return 0; +} diff --git a/INOI/.DS_Store b/INOI/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..af02b2223d434b12728d78ae6b9f7839eda667f3 GIT binary patch literal 6148 zcmeHKyH3ME5S$GuBA`e~d0&9UADpbDpr)WD2}np-N)$j!>5gCI1NaY^eSl&dS_;^e z_Qtojb8AoGy#pZ4^X&yN1u&s2;zfs{>AL#BMiEgI+v5Ruc)}yju^MC_4k-5&4YpX2 zv(MjPbJ?y}%XYnF4qs4S>AQC`+w2(EthYeRn)g<7z!|-L;~ajAjHUvqKq`<5qyqm( z0rqUQ$%$i*sX!`_3VbP`|A#_Xtbv`Q{W>`4@m<%)ifVkey9BYsyaslTT%n0miB6Tc zVu;fjFOgRRJ4dHOtTOkB$`UsevFeN$ONUg)98-Z*ps&D@Pp8`d=ky=$|9w) +using namespace std; +#define ll long long +#define MAX 1111 +#define INF 1111111 +ll maxVal = -INF; +void solve(vector seq, ll v[], ll b[], ll n, ll k, ll ind, ll val) +{ + if(ind > n) + { + stack frontier; + for(ll i = 0; i < seq.size(); i++) + { + if(frontier.empty()) + { + frontier.push(seq[i]); + } + else + { + if(frontier.top() + k == seq[i]) + { + frontier.pop(); + } + else + frontier.push(seq[i]); + } + } + if(frontier.empty()) + { + /*for(ll i = 0; i < seq.size(); i++) + { + cout << seq[i] << " "; + } + cout << endl;*/ + maxVal = max(maxVal, val); + } + } + else + { + solve(seq, v, b, n, k, ind+1, val); + seq.push_back(b[ind]); + val += v[ind]; + solve(seq, v, b, n, k, ind+1, val); + } +} +ll v[MAX], b[MAX]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, k, i; + cin >> n >> k; + for(i = 1; i <= n; i++) + { + cin >> v[i]; + } + for(i = 1; i <= n; i++) + { + cin >> b[i]; + } + vector seq; + seq.clear(); + solve(seq, v, b, n, k, 1, 0); + cout << maxVal << endl; + return 0; +} diff --git a/INOI/Wealth.cpp b/INOI/Wealth.cpp new file mode 100755 index 0000000..d4d66e1 --- /dev/null +++ b/INOI/Wealth.cpp @@ -0,0 +1,56 @@ +/*Manav Aggarwal +36110 +Problem: Wealth Disparity*/ +#include +using namespace std; +#define ll long long +#define pii pair +#define first f +#define second s +#define MAX 100111 +#define INF 111111111 +ll a[MAX], p[MAX], visited[MAX], maxDiff; +vector adjList[MAX]; +ll dfs(ll start, ll maxTill, ll n) +{ + stack frontier; + frontier.push(start); + maxTill = max(maxTill, a[start]); + visited[start] = 1; + ll i; + for(i = 0; i < adjList[start].size(); i++) + { + if(!visited[adjList[start][i]]) + { + maxDiff = max(maxDiff, maxTill - a[adjList[start][i]]); + dfs(adjList[start][i], maxTill, n); + } + } + +} +int main() +{ + //freopen("2_6.in", "r", stdin); + ll n, i, manager; + maxDiff = -INF; + cin >> n; + for(i = 1; i <= n; i++) + { + cin >> a[i]; + visited[i] = 0; + adjList[i].clear(); + } + for(i = 1; i <= n; i++) + { + cin >> p[i]; + if(p[i] == -1) + manager = i; + else + { + adjList[p[i]].push_back(i); + } + } + dfs(manager, a[manager], n); + cout << maxDiff << endl; + return 0; +} diff --git a/India Post.cpp b/India Post.cpp new file mode 100755 index 0000000..9ea7ba7 --- /dev/null +++ b/India Post.cpp @@ -0,0 +1,57 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pii pair +#define mp make_pair +#define x first +#define y second +#define INF 999999999 +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, xc, yc, q, k, j, dist, minDist, currX, currY, minJ; + cin >> n; + pii arr[n]; + for(i = 0; i < n; i++) + { + cin >> arr[i].x >> arr[i].y; + } + ll nearest[n]; + for(i = 0; i < n; i++) + { + k = i; + minJ = -1; + minDist = INF; + xc = arr[k].x; yc = arr[k].y; + for(j = 0; j < n; j++) + { + if(j == k) + continue; + dist = abs(xc - arr[j].x) + abs(yc - arr[j].y); + if(minDist > dist) + { + minDist = dist; + minJ = j; + } + else if(minJ != -1 && minDist == dist && (arr[j].y >= 0) && arr[j].x < arr[minJ].x) + { + minJ = j; + } + else if(minJ != -1 && minDist == dist && (arr[j].y < 0) && arr[j].x > arr[minJ].x) + { + minJ = j; + } + } + nearest[i] = minJ + 1; + } + cin >> q; + for(i = 0; i < q; i++) + { + cin >> k; + k--; + cout << nearest[k] << endl; + } + return 0; +} diff --git a/Laughter.cpp b/Laughter.cpp new file mode 100755 index 0000000..66ed31f --- /dev/null +++ b/Laughter.cpp @@ -0,0 +1,40 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll counter = 0; +void recur(string s, string curr, ll prev) +{ + if(curr.length() == 4) + { + if(curr == "haha") + counter++; + } + else + { + for(ll i = prev+1 ; i < s.length(); i++) + { + recur(s, curr+s[i], i); + } + } +} +int main() + { + + ll t; + cin >> t; + while(t--) + { + string s; + cin >> s; + for(ll i = 0; i < s.length(); i++) + { + s[i] = tolower(s[i]); + } + recur(s, "", -1); + cout << counter << endl; + counter = 0; + } + return 0; +} diff --git a/Make Palindrome.cpp b/Make Palindrome.cpp new file mode 100755 index 0000000..85609a7 --- /dev/null +++ b/Make Palindrome.cpp @@ -0,0 +1,113 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool isPalin(string str) +{ + for(ll i = 0; i < str.length()/2; i++) + { + if(str[i] != str[str.length()-1-i]) + { + return false; + } + } + return true; +} +ll numIns(string s) +{ + char beechka; + beechka = s[s.length()/2]; + ll i, count = 0; + bool passed = false; + for(i = 0; i < s.length(); i++) + { + if(i == s.length()/2) + { + passed = true; + } + if(s[i] == beechka) + { + count++; + } + else if(!passed) + { + count = 0; + } + else + { + break; + } + } + return count+1; +} +void make_palin(string s, ll b, ll e, pair *isPalin) +{ + ll i, start, end, size; + for(i = b; i < e; i++) + { + isPalin[i] = make_pair(false, -1); + } + if((e-b) % 2 == 0) + { + start = (e-b)/2 - 1 + b; + end = (e-b)/2 + b; + size = 1; + if(start >= b && end < e && s[start] == s[end]) + { + isPalin[start] = make_pair(true, size); + isPalin[end] = make_pair(true, -size); + } + } + else + { + start = (e -b)/2 - 1 + b; + end = (e-b)/2 + 1 + b; + isPalin[start + 1] = make_pair(true, 0); + size = 2; + if(start >= b && end < e && s[start] == s[end]) + { + isPalin[start] = make_pair(true, size); + isPalin[end] = make_pair(true, -size); + } + } + start--; end++; size+=2; + while(start >= b && end < e) + { + if(s[start] == s[end] && isPalin[start+1].first) + { + isPalin[start] = make_pair(true, size); + isPalin[end] = make_pair(true, -size); + } + start--; end++; size += 2; + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t, i, j; + cin >> t; + while(t--) + { + ll count = 0, start, end, size; + string s, temp; + cin >> s; + if(isPalin(s)) + { + cout << numIns(s) << endl; + continue; + } + pair isPaline[s.length()], isPalinb[s.length()]; + make_palin(s, 0, s.length()-1, isPaline); + make_palin(s, 1, s.length(), isPalinb); + for(i = 0; i <= s.length()/2; i++) + { + if(isPalinb[i].first) + { + cout << true << endl; + } + } + } + return 0; +} diff --git a/Mario - Nexus Prelims.cpp b/Mario - Nexus Prelims.cpp new file mode 100755 index 0000000..a50dbc5 --- /dev/null +++ b/Mario - Nexus Prelims.cpp @@ -0,0 +1,80 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAX 46656 +#define LMT 216 +#define LEN 31623 +#define RNG 100032 +#define sq(x) ((x)*(x)) +#define mset(x,v) memset(x, v , sizeof(x)) +#define chkC(x,n) (x[n >> 6] & (1 << ((n >> 1) & 31))) +#define setC(x,n) (x[n >> 6] |= (1 << ((n >> 1) & 31))) +ll base[MAX/64], segment[RNG/64], primes[LEN]; + +void sieve() +{ + unsigned i, j, k; + for (i = 3; i < LMT; i += 2) + { + if (!chkC(base, i)) + { + for (j = i * i, k = i << 1; j < MAX; j += k) + setC(base, j); + } + } + for (i = 3, j = 0; i < MAX; i += 2) + { + if (!chkC(base, i)) + primes[j++] = i; + } +} +ll segmented_sieve(ll a, ll b) +{ + ll i, j, k, sum = (a <= 2 && 2 <=b )? 2 : 0; + if (b < 2) + return 0; + if (a < 3) + a = 3; + if (a % 2 == 0) + a++; + mset (segment, 0); + for (i = 0; sq(primes[i]) <= b; i++) + { + j = primes[i] * ((a + primes[i] - 1) / primes[i]); + if (j % 2 == 0) j += primes[i]; + for (k = primes[i] << 1; j <= b; j += k) + { + if (j != primes[i]) + setC(segment, (j - a)); + } + } + for (i = 0; i <= b - a; i += 2) + { + if (!chkC(segment, i)) + { + j = i + a; + while(j) + { + sum += j % 10; + j /= 10; + } + } + } + return sum; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieve(); + ll n; + cin >> n; + while(n--) + { + ll a, b, i, num, sum = 0; + cin >> a >> b; + cout << segmented_sieve(a, b) << endl; + } + return 0; +} diff --git a/MaxMatchedSeq.cpp b/MaxMatchedSeq.cpp new file mode 100755 index 0000000..039cdc4 --- /dev/null +++ b/MaxMatchedSeq.cpp @@ -0,0 +1,13 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + string seq; + cin >> seq; + return 0; +} diff --git a/Network.cpp b/Network.cpp new file mode 100755 index 0000000..2cd664d --- /dev/null +++ b/Network.cpp @@ -0,0 +1,63 @@ +#include "network.h" +#include +#include +using namespace std; + +vector graph[1001]; +int getP(int a, int b) +{ + return ping(a, b) + 1; +} +void findRoute (int N, int a, int b) +{ + int dist, i, k, d, curr; + for(i = 1; i <= N; i++) + { + if(i == b) + { + k = getP(a, i); + dist = k; + graph[k].push_back(i); + if(dist == 1) + { + travelTo(b); + curr = b; + } + } + else if(i != a) + { + k = getP(a, i); + graph[k].push_back(i); + if(k == 1) + { + d = getP(i, b); + if(d + 1 == dist) + { + travelTo(i); + curr = i; + } + } + } + } + for(k = 2; k < dist; k++) + { + bool flag = true; + for(i = 0; i < graph[k].size(); i++) + { + d = getP(graph[k][i], b); + if(d + k == dist) + { + d = getP(curr, graph[k][i]); + if(d == 1) + { + travelTo(graph[k][i]); + curr = graph[k][i]; + flag = false; + continue; + } + } + } + } + if(curr != b) + travelTo(b); +} diff --git a/New.cpp b/New.cpp new file mode 100755 index 0000000..2e2e802 --- /dev/null +++ b/New.cpp @@ -0,0 +1,12 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAX 300010 +int main() +{ + ios_base::sync_with_stdio(0); cin.tie(0); + + return 0; +} diff --git a/Pattern.cpp b/Pattern.cpp new file mode 100755 index 0000000..adfb3a2 --- /dev/null +++ b/Pattern.cpp @@ -0,0 +1,34 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + + string curr, prev = "1"; + ll n; + cin >> n; + cout << 1 << endl; + for(ll i = 2; i <= n; i++) + { + curr = ""; + ll idx = 0, currNum, count; + while(idx < prev.length()) + { + currNum = prev[idx] - '0'; + count = 0; + while(prev[idx] == currNum + '0') + { + count++; + idx++; + } + curr += count + '0'; + curr += currNum + '0'; + } + cout << curr << endl; + prev = curr; + } + return 0; +} diff --git a/Princess Farida.cpp b/Princess Farida.cpp new file mode 100755 index 0000000..d54fa77 --- /dev/null +++ b/Princess Farida.cpp @@ -0,0 +1,32 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + for(ll a = 1; a <= t; a++) + { + ll n; + cin >> n; + ll arr[n], excl = 0, incl, sum; + for(ll i = 0; i < n; i++) + { + cin >> arr[i]; + } + incl = arr[0]; + for(ll i = 1; i < n; i++) + { + sum = max(incl, excl); + incl = excl + arr[i]; + excl = sum; + } + cout << "Case " << a << ": " << max(incl, excl) << endl; + } + return 0; +} diff --git a/Project Euler/.DS_Store b/Project Euler/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5cc01a8dd8481f0a3f0e89aa6a478d14ecd9bc05 GIT binary patch literal 14340 zcmeHOyKWOf6uoOZ#4#x%0TQL@Qbq9t$8=VdAm|V@R6t%L2_cU1fY7;vPsk_m348(t zACM2AproWgf^%m#uw(BW`$`~1%B-||o!z--X3xx-z4M5OB+Dn84Ut6=sp3>SH;c=A zk-FO4q0jXkIm)<`;Czk~zvo2yvMXD%A;(h3y>Ukg3Dm!W^M*Wghrqfk z3qU=PgNJ+ljrG0$Iy{hF`8({{FLxmG+!OhNC-WCi@VhE6fwUu=KsuIFobiYZLI8a-K%G| zm)SvTohy8tD{ShTWJ8Q3b;td>CWq~1c97cCU6RyYk}T&W8=)jFclgy^a!Gorjn~LP zWMGtmdEB}+X6(Hvcf#ZE%7@%2`{o#=Mlnw1CwdSIPO}(CNBxx_hVrzEaguW*PP-VV z^wo$%<~dC7)hRBI<=D4EzLIv#Tu&PM|eAo-H_m z*6et;-~`%_3IXsL=_$mS4E&ST3ZHHbeSr=(r{IDnJP>;L=`3+qKfIW zTy1fd19hcs*<*Pc>n&SygzEy?_bcxX`OU~% ztRNj?jpr!ffj-E~X*3>=cOnCkfylsBVW5K-tzm6_2dnGbZneFzua)~qm;Z|Edirbh zw)^O5`&g+z_WNf2>W`%N*5Cc~$>X8)HF<^7yhHEbM^1%h(r>w!M-3%f%f20_#XhBH zLq0QjgEjc+*QqcU{W=Zh;@%g0;jN3`UcXG9&kR!c-5VVi=i+uU-x$bu6XCpexhIDv73RhV#yDoi*;6^3=x zwh&dAaEK~A91Jz$acLNsN=ve+`~OzM`~NRZd1FB$1CfD$&p=XHd9tz$+-z^%NDjK! zu8#8s&Wi(SU2KEofn6|Z}dPA#7GGCN4EbH#n<3hP{9(_MW3Z4+SnpGo=u tEFuw$oJ}0D#PL6mFm>EsxK~DJ#k^5+9RCmfkDJb~8Ahf}7SrW%egkE+HgEs{ literal 0 HcmV?d00001 diff --git a/Project Euler/Project Euler 1.cpp b/Project Euler/Project Euler 1.cpp new file mode 100755 index 0000000..87d262a --- /dev/null +++ b/Project Euler/Project Euler 1.cpp @@ -0,0 +1,20 @@ +#include +using namespace std; +#define ull unsigned long long +ull get(ull n, ull k) +{ + return n*(k/n)*((k/n)+1)/2; +} +int main() +{ + int T; + cin >> T; + while(T--) + { + ull n; + cin >> n; + n--; + cout << get(3, n) + get(5, n) - get(15, n) << endl; + } + return 0; +} diff --git a/Project Euler/Project Euler 10.cpp b/Project Euler/Project Euler 10.cpp new file mode 100755 index 0000000..390f2a1 --- /dev/null +++ b/Project Euler/Project Euler 10.cpp @@ -0,0 +1,41 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll M = 2000000; +ll arr[2000001]; +void sieveOfEratosthenes() +{ + ll i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i < sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll i, sum = 0; + for(i = 2; i <= M; i++) + { + if(arr[i]) + { + sum += i; + } + } + cout << sum; + return 0; +} diff --git a/Project Euler/Project Euler 11.cpp b/Project Euler/Project Euler 11.cpp new file mode 100755 index 0000000..6863151 --- /dev/null +++ b/Project Euler/Project Euler 11.cpp @@ -0,0 +1,55 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll grid[20][20] = + { + 8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8, + 49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0, + 81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65, + 52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91, + 22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80, + 24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50, + 32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70, + 67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21, + 24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72, + 21, 36, 23, 9, 75, 0, 76, 44, 20, 45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95, + 78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92, + 16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57, + 86, 56, 0, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58, + 19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40, + 4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66, + 88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69, + 4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36, + 20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16, + 20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54, + 1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48 + }; +ll multiply(ll v, ll h, ll num) +{ + ll i, j, product, maxP = 1, x, y; + for(j = 0; j < 20; j++) + { + for(i = 0; i < 20; i++) + { + product = 1; + for(x = i, y = j; x < i + num && y < j + num && x >= 0 && x < 20 && y >= 0 && y < 20; x+=h, y+=v) + { + if(grid[y][x] == 0) + { + break; + } + product *= grid[y][x]; + } + maxP = max(maxP, product); + } + } + return maxP; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << max(max(max(multiply(0, 1, 4), multiply(1, 0, 4)), multiply(1, 1, 4) ), multiply(1, -1, 4) ); + return 0; +} diff --git a/Project Euler/Project Euler 12.cpp b/Project Euler/Project Euler 12.cpp new file mode 100755 index 0000000..00a15e4 --- /dev/null +++ b/Project Euler/Project Euler 12.cpp @@ -0,0 +1,81 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +vector primes; +void sieve() +{ + ll M = 100000, i, j; + ll arr[M+1]; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+= i) + { + arr[j] = 0; + } + } + } + for(i = 0; i <= M; i++) + { + if(arr[i] == 1) + { + primes.push_back(i); + } + } +} +ll NoOfDivisors(ll n) +{ + ll d = 1, i = 0, expo; + while(primes[i] <= n) + { + if(primes[i] * primes[i] > n) + { + return 2*d; + } + expo = 0; + while(n % primes[i] == 0) + { + expo++; + n/= primes[i]; + } + d *= expo + 1; + if(n == 1) + { + return d; + } + i++; + } + return d; +} + +int main() +{ + sieve(); + ios_base::sync_with_stdio(false); cin.tie(0); + ll i = 2, count = 0, nd = 2, n1d = 2; + while(count < 500) + { + if(i & 1) + { + n1d = NoOfDivisors((i+1)/2); + count = nd * n1d; + } + else + { + nd = NoOfDivisors(i+1); + count = nd * n1d; + } + i++; + } + + cout << ( i * (i-1) )/2; + return 0; +} diff --git a/Project Euler/Project Euler 13.cpp b/Project Euler/Project Euler 13.cpp new file mode 100755 index 0000000..59fcd2a --- /dev/null +++ b/Project Euler/Project Euler 13.cpp @@ -0,0 +1,44 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + //freopen("t.out", "w", stdout); + ios_base::sync_with_stdio(false); cin.tie(0); + string arr[100] = {"00037107287533902102798797998220837590246510135740250", "00046376937677490009712648124896970078050417018260538", "00074324986199524741059474233309513058123726617309629", "00091942213363574161572522430563301811072406154908250", "00023067588207539346171171980310421047513778063246676", "00089261670696623633820136378418383684178734361726757", "00028112879812849979408065481931592621691275889832738", "00044274228917432520321923589422876796487670272189318", "00047451445736001306439091167216856844588711603153276", "00070386486105843025439939619828917593665686757934951", "00062176457141856560629502157223196586755079324193331", "00064906352462741904929101432445813822663347944758178", "00092575867718337217661963751590579239728245598838407", "00058203565325359399008402633568948830189458628227828", "00080181199384826282014278194139940567587151170094390", "00035398664372827112653829987240784473053190104293586", "00086515506006295864861532075273371959191420517255829", "00071693888707715466499115593487603532921714970056938", "00054370070576826684624621495650076471787294438377604", "00053282654108756828443191190634694037855217779295145", "00036123272525000296071075082563815656710885258350721", "00045876576172410976447339110607218265236877223636045", "00017423706905851860660448207621209813287860733969412", "00081142660418086830619328460811191061556940512689692", "00051934325451728388641918047049293215058642563049483", "00062467221648435076201727918039944693004732956340691", "00015732444386908125794514089057706229429197107928209", "00055037687525678773091862540744969844508330393682126", "00018336384825330154686196124348767681297534375946515", "00080386287592878490201521685554828717201219257766954", "00078182833757993103614740356856449095527097864797581", "00016726320100436897842553539920931837441497806860984", "00048403098129077791799088218795327364475675590848030", "00087086987551392711854517078544161852424320693150332", "00059959406895756536782107074926966537676326235447210", "00069793950679652694742597709739166693763042633987085", "00041052684708299085211399427365734116182760315001271", "00065378607361501080857009149939512557028198746004375", "00035829035317434717326932123578154982629742552737307", "00094953759765105305946966067683156574377167401875275", "00088902802571733229619176668713819931811048770190271", "00025267680276078003013678680992525463401061632866526", "00036270218540497705585629946580636237993140746255962", "00024074486908231174977792365466257246923322810917141", "00091430288197103288597806669760892938638285025333403", "00034413065578016127815921815005561868836468420090470", "00023053081172816430487623791969842487255036638784583", "00011487696932154902810424020138335124462181441773470", "00063783299490636259666498587618221225225512486764533", "00067720186971698544312419572409913959008952310058822", "00095548255300263520781532296796249481641953868218774", "00076085327132285723110424803456124867697064507995236", "00037774242535411291684276865538926205024910326572967", "00023701913275725675285653248258265463092207058596522", "00029798860272258331913126375147341994889534765745501", "00018495701454879288984856827726077713721403798879715", "00038298203783031473527721580348144513491373226651381", "00034829543829199918180278916522431027392251122869539", "00040957953066405232632538044100059654939159879593635", "00029746152185502371307642255121183693803580388584903", "00041698116222072977186158236678424689157993532961922", "00062467957194401269043877107275048102390895523597457", "00023189706772547915061505504953922979530901129967519", "00086188088225875314529584099251203829009407770775672", "00011306739708304724483816533873502340845647058077308", "00082959174767140363198008187129011875491310547126581", "00097623331044818386269515456334926366572897563400500", "00042846280183517070527831839425882145521227251250327", "00055121603546981200581762165212827652751691296897789", "00032238195734329339946437501907836945765883352399886", "00075506164965184775180738168837861091527357929701337", "00062177842752192623401942399639168044983993173312731", "00032924185707147349566916674687634660915035914677504", "00099518671430235219628894890102423325116913619626622", "00073267460800591547471830798392868535206946944540724", "00076841822524674417161514036427982273348055556214818", "00097142617910342598647204516893989422179826088076852", "00087783646182799346313767754307809363333018982642090", "00010848802521674670883215120185883543223812876952786", "00071329612474782464538636993009049310363619763878039", "00062184073572399794223406235393808339651327408011116", "00066627891981488087797941876876144230030984490851411", "00060661826293682836764744779239180335110989069790714", "00085786944089552990653640447425576083659976645795096", "00066024396409905389607120198219976047599490197230297", "00064913982680032973156037120041377903785566085089252", "00016730939319872750275468906903707539413042652315011", "00094809377245048795150954100921645863754710598436791", "00078639167021187492431995700641917969777599028300699", "00015368713711936614952811305876380278410754449733078", "00040789923115535562561142322423255033685442488917353", "00044889911501440648020369068063960672322193204149535", "00041503128880339536053299340368006977710650566631954", "00081234880673210146739058568557934581403627822703280", "00082616570773948327592232845941706525094512325230608", "00022918802058777319719839450180888072429661980811197", "00077158542502016545090413245809786882778948721859617", "00072107838435069186155435662884062257473692284509516", "00020849603980134001723930671666823555245252804609722", "00053503534226472524250874054075591789781264330331690"}; + ll nums[100][53], ans[53]; + ll i, j, carry = 0; + for(i = 0; i < 100; i++) + { + for(j = 0; j < 53; j++) + { + nums[i][j] = (ll)(arr[i][52 - j] - '0'); + } + } + for(i = 0; i < 53; i++) + { + ans[i] = nums[0][i]; + } + for(i = 1; i < 100; i++) + { + carry = 0; + for(j = 0; j < 53; j++) + { + ans[j] = ans[j] + nums[i][j] + carry; + carry = 0; + if(ans[j] > 9) + { + carry = ans[j]/10; + ans[j] %= 10; + } + } + + } + for(i = 52; i >= 0; i--) + { + cout << ans[i]; + } + return 0; +} diff --git a/Project Euler/Project Euler 14.cpp b/Project Euler/Project Euler 14.cpp new file mode 100755 index 0000000..a83e4fa --- /dev/null +++ b/Project Euler/Project Euler 14.cpp @@ -0,0 +1,42 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +bool arr[1000000]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll maxSize = 0, i, size, num = 0, largestNum; + for(i = 999999; i >= 0; i--) + { + if(arr[i]) + { + continue; + } + size = 1, num = i; + while(num > 1) + { + if(num < 1000000) + { + arr[num] = true; + } + if(num&1) + { + num = 3*num + 1; + } + else + { + num /= 2; + } + size++; + } + if(maxSize < size) + { + maxSize = size; + largestNum = i; + } + } + cout << largestNum; + return 0; +} diff --git a/Project Euler/Project Euler 15.cpp b/Project Euler/Project Euler 15.cpp new file mode 100755 index 0000000..f1fc826 --- /dev/null +++ b/Project Euler/Project Euler 15.cpp @@ -0,0 +1,28 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, j; + cin >> n; + n++; + ll grid[n][n]; + for(i = 0; i < n; i++) + { + grid[i][0] = 1; + grid[0][i] = 1; + } + for(i = 1; i < n; i++) + { + for(j = 1; j < n; j++) + { + grid[i][j] = grid[i-1][j] + grid[i][j-1]; + } + } + cout << grid[n-1][n-1]; + + return 0; +} diff --git a/Project Euler/Project Euler 16.cpp b/Project Euler/Project Euler 16.cpp new file mode 100755 index 0000000..607fceb --- /dev/null +++ b/Project Euler/Project Euler 16.cpp @@ -0,0 +1,37 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll arr[321]; + arr[0] = 1; + ll i, j, carry = 0, sum = 0, n; + cin >> n; + for(i = 1; i < 321; i++) + { + arr[i] = 0; + } + for(i = 0; i < n; i++) + { + carry = 0; + for(j = 0; j < 321; j++) + { + arr[j] = (arr[j]*2) + carry; + carry = 0; + if(arr[j] > 9) + { + carry = arr[j] / 10; + arr[j] %= 10; + } + } + } + for(i = 0; i < 321; i++) + { + sum += arr[i]; + } + cout << sum; + return 0; +} diff --git a/Project Euler/Project Euler 17.cpp b/Project Euler/Project Euler 17.cpp new file mode 100755 index 0000000..bdffd96 --- /dev/null +++ b/Project Euler/Project Euler 17.cpp @@ -0,0 +1,53 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll noOfLetters(ll num) +{ + ll sum = 0; + map numToLetters; + numToLetters[0] = 0; + numToLetters[1] = numToLetters[2] = numToLetters[6] = numToLetters[10] = 3; + numToLetters[4] = numToLetters[5] = numToLetters[9] = 4; + numToLetters[3] = numToLetters[7] = numToLetters[8] = numToLetters[40] = numToLetters[50] = numToLetters[60] = 5; + numToLetters[20] = numToLetters[30] = numToLetters[80] = numToLetters[90] =numToLetters[11] = numToLetters[12]= 6; + numToLetters[70] = numToLetters[100] = numToLetters[15] = numToLetters[16] = 7; + numToLetters[13] = numToLetters[14] = numToLetters[18] = numToLetters[19] = numToLetters[1000] = 8; + numToLetters[17] = 9; + + if(num <= 20 || (num % 10 == 0 && num < 100) || num == 1000 ) + { + return numToLetters[num]; + } + else if(num <= 99) + { + sum += numToLetters[num % 10]; + num/=10; + sum+= numToLetters[num*10]; + return sum; + } + else if(num >= 100 && num % 100 == 0) + { + return numToLetters[100] + numToLetters[num/100]; + } + else + { + sum += noOfLetters(num % 100); + num/=100; + sum+= numToLetters[num] + numToLetters[100] + 3; + return sum; + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, sum = 0, n; + cin >> n; + for(i = 1; i <= n; i++) + { + sum += noOfLetters(i); + } + cout << sum; + return 0; +} diff --git a/Project Euler/Project Euler 18.cpp b/Project Euler/Project Euler 18.cpp new file mode 100755 index 0000000..30d1b95 --- /dev/null +++ b/Project Euler/Project Euler 18.cpp @@ -0,0 +1,46 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, j, k = 0; + ll arr[] = {75, + 95, 64, + 17, 47, 82, + 18, 35, 87, 10, + 20, 04, 82, 47, 65, + 19, 01, 23, 75, 03, 34, + 88, 02, 77, 73, 07, 63, 67, + 99, 65, 04, 28, 06, 16, 70, 92, + 41, 41, 26, 56, 83, 40, 80, 70, 33, + 41, 48, 72, 33, 47, 32, 37, 16, 94, 29, + 53, 71, 44, 65, 25, 43, 91, 52, 97, 51, 14, + 70, 11, 33, 28, 77, 73, 17, 78, 39, 68, 17, 57, + 91, 71, 52, 38, 17, 14, 91, 43, 58, 50, 27, 29, 48, + 63, 66, 04, 68, 89, 53, 67, 30, 73, 16, 69, 87, 40, 31, + 04, 62, 98, 27, 23, 9, 70, 98, 73, 93, 38, 53, 60, 04, 23 + }; + vector< vector > triangle; vector temp; + for(i = 0; i < 15; i++) + { + temp.clear(); + for(j = 0; j < i+1; j++) + { + temp.push_back(arr[k]); + k++; + } + triangle.push_back(temp); + } + for(i = 13; i >= 0; i--) + { + for(j = 0; j < i+1; j++) + { + triangle[i][j] += max(triangle[i+1][j], triangle[i+1][j+1]); + } + } + cout << triangle[0][0]; + return 0; +} diff --git a/Project Euler/Project Euler 19.cpp b/Project Euler/Project Euler 19.cpp new file mode 100755 index 0000000..8205f75 --- /dev/null +++ b/Project Euler/Project Euler 19.cpp @@ -0,0 +1,40 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll DateToDay(ll day, ll month, ll year) //Valid for Dates above 1 Jan, 1900 +{ + ll days = 0; + ll months[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; + days += months[month-1]; + days += day - 1; + if(days < 59 && year % 4 == 0) + { + days--; + if(year % 100 == 0 && year % 400 != 0) + { + days++; + } + } + days += ( ( year - 1900) * 365) + ( (year-1900) / 4) - (year/100 - (1900/100) ) + (year/400 - 1900/400); + return (days + 1)%7; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll d, m, y, SundayCount = 0; + for(y = 1901; y <= 2000; y++) + { + for(m = 1; m <= 12; m++) + { + if(DateToDay(1, m, y) == 0) + { + SundayCount++; + } + } + } + cout << SundayCount; + return 0; +} diff --git a/Project Euler/Project Euler 2.cpp b/Project Euler/Project Euler 2.cpp new file mode 100755 index 0000000..81404b2 --- /dev/null +++ b/Project Euler/Project Euler 2.cpp @@ -0,0 +1,27 @@ +#include +using namespace std; +#define ull unsigned long long +int main() +{ + int T; + cin >> T; + while(T--) + { + ull N, sum = 0; + cin >> N; + ull first = 1, second = 1, next=0; + while(next < N) + { + if(!(next&1)) + { + sum += next; + } + next = first + second; + first = second; + second = next; + + } + cout << sum << endl; + } + return 0; +} diff --git a/Project Euler/Project Euler 20.cpp b/Project Euler/Project Euler 20.cpp new file mode 100755 index 0000000..28b05a6 --- /dev/null +++ b/Project Euler/Project Euler 20.cpp @@ -0,0 +1,37 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll arr[200]; + ll i, j, carry, sum = 0, n; + cin >> n; + for(i = 1; i < 200; i++) + { + arr[i] = 0; + } + arr[0] = 1; + for(i = 2; i <= n; i++) + { + carry = 0; + for(j = 0; j < 200; j++) + { + arr[j] = (arr[j] * i) + carry; + carry = 0; + if(arr[j] > 9) + { + carry = arr[j]/10; + arr[j] %= 10; + } + } + } + for(i = 0; i < 200; i++) + { + sum += arr[i]; + } + cout << sum; + return 0; +} diff --git a/Project Euler/Project Euler 21.cpp b/Project Euler/Project Euler 21.cpp new file mode 100755 index 0000000..19b1f35 --- /dev/null +++ b/Project Euler/Project Euler 21.cpp @@ -0,0 +1,50 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool isAmicable[10001]; +ll sumOfDivisors(ll n) +{ + ll sum = 1; + for(ll i = 2; i <= sqrt(n); i++) + { + if(n % i == 0) + { + sum += i; + sum += n/i; + } + } + return sum; +} + +int main() +{ + ll i, k, sum = 0; + for(i = 0; i < 10000; i++) + { + if(isAmicable[i]) + { + continue; + } + k = sumOfDivisors(i); + if(sumOfDivisors(k) == i && i != k) + { + isAmicable[i] = true; + if(k <= 10000) + { + isAmicable[k] = true; + } + } + } + for(i = 0; i <= 10000; i++) + { + if(isAmicable[i]) + { + sum += i; + } + } + cout << sum; + return 0; +} diff --git a/Project Euler/Project Euler 22.cpp b/Project Euler/Project Euler 22.cpp new file mode 100755 index 0000000..9b3a566 --- /dev/null +++ b/Project Euler/Project Euler 22.cpp @@ -0,0 +1,46 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll StringToNumValue(string s) +{ + ll sum = 0, i; + for(i = 0; i < s.length(); i++) + { + sum += s[i] - 'A' + 1; + } + return sum; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ifstream names("names.txt"); + stringstream buffer; + buffer << names.rdbuf(); + string test = buffer.str(); + test.erase(remove(test.begin(), test.end(), '"'), test.end()); + vector arr; + string temp = ""; + ll i, sum = 0; + for(i = 0; i < test.length(); i++) + { + if(test[i] == ',') + { + arr.push_back(temp); + temp = ""; + } + else + { + temp += test[i]; + } + } + arr.push_back(temp); + sort(arr.begin(), arr.end()); + for(i = 0; i < arr.size(); i++) + { + sum += StringToNumValue(arr[i]) * (i+1); + } + cout << sum; + return 0; +} diff --git a/Project Euler/Project Euler 23.cpp b/Project Euler/Project Euler 23.cpp new file mode 100755 index 0000000..ac209e3 --- /dev/null +++ b/Project Euler/Project Euler 23.cpp @@ -0,0 +1,60 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +vector abundant; +bool canBeExpressedAsSumOfAbundant[28124]; +ll sumOfDivisors(ll n) +{ + ll sum = 1, sqrtNum = (ll)sqrt(n); + if(n == sqrtNum *sqrtNum) + { + sum += sqrtNum; + sqrtNum--; + } + for(ll i = 2; i <= sqrtNum; i++) + { + if(n % i == 0) + { + sum += i; + sum += n/i; + } + } + return sum; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, j, sum = 0; + for(i = 12; i <= 28123; i++) + { + if(sumOfDivisors(i) > i) + { + abundant.push_back(i); + } + } + for(i = 0; i < abundant.size(); i++) + { + for(j = i; j < abundant.size(); j++) + { + if(abundant[i] + abundant[j] < 28124) + { + canBeExpressedAsSumOfAbundant[abundant[i] + abundant[j]] = true; + } + else + { + break; + } + } + } + for(i = 1; i <= 28123; i++) + { + if(!(canBeExpressedAsSumOfAbundant[i])) + { + sum += i; + } + } + cout << sum; + return 0; +} diff --git a/Project Euler/Project Euler 24.cpp b/Project Euler/Project Euler 24.cpp new file mode 100755 index 0000000..d33bbee --- /dev/null +++ b/Project Euler/Project Euler 24.cpp @@ -0,0 +1,45 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll naiveFactorial(ll n) +{ + ll fact = 1; n++; + while(--n) + { + fact *= n; + } + return fact; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + vector sortedArr(arr, arr+10); + ll n, size = 10, factN = size - 1, fact, k, i; + cin >> n; //nth permutation + n--; + string perm = ""; + while(true) + { + fact = naiveFactorial(factN); + i = n/fact; + n %=fact; + perm += (char)(sortedArr[i] + '0'); + sortedArr.erase(sortedArr.begin() + i); + if(n == 0) + { + break; + } + factN--; + } + for(i = 0; i < sortedArr.size(); i++) + { + perm += (char)(sortedArr[i] + '0'); + } + cout << perm; + return 0; +} diff --git a/Project Euler/Project Euler 243.cpp b/Project Euler/Project Euler 243.cpp new file mode 100755 index 0000000..f4f0585 --- /dev/null +++ b/Project Euler/Project Euler 243.cpp @@ -0,0 +1,73 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +const ll M = 100; +ll arr[M+1]; +vector primes; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } + primes.push_back(2); + for(i = 3; i <= M; i+=2) + { + if(arr[i]) + { + primes.push_back(i); + } + } +} +ll gcd(ll a, ll b){return b ? gcd(b, a%b) : a;} +ll resilience(ll d, ll n) +{ + ll i, phi; + phi = d; + for(i = 0; i < n; i++) + { + phi = (phi * (primes[i]-1))/primes[i]; + } + return phi; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + double lim = 15499/94744.0, ratio; + ll i = 1, res = resilience(2, 1), prod = 2; + ratio = (double)res/(prod-1); + while(ratio >= lim) + { + i++; + prod *= primes[i-1]; + res = resilience(prod, i); + ratio = (double)res/(prod-1); + } + prod/=primes[i-1]; + res = resilience(prod, i-1); + ratio = (double)res/(prod-1); + while(ratio >= lim) + { + prod *=2; + res = resilience(prod, i-1); + ratio = (double)res/(prod-1); + } + cout << res << "/" << prod << " " << ratio; + return 0; +} diff --git a/Project Euler/Project Euler 25.cpp b/Project Euler/Project Euler 25.cpp new file mode 100755 index 0000000..1446d48 --- /dev/null +++ b/Project Euler/Project Euler 25.cpp @@ -0,0 +1,38 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, n, carry, seqN; + cin >> n; + ll arrNum1[n], arrNum2[n], arrNext[n]; + for(i = 0; i < n; i++) + { + arrNum1[i] = arrNum2[i] = arrNext[i]= 0; + } + arrNum1[0] = arrNum2[0] = 1; + seqN = 2; + while(arrNext[n-1] == 0) + { + seqN++; + carry = 0; + for(i = 0; i < n; i++) + { + arrNext[i] = arrNum1[i] + arrNum2[i] + carry; + carry = 0; + if(arrNext[i] > 9) + { + carry = arrNext[i]/10; + arrNext[i] %= 10; + } + arrNum1[i] = arrNum2[i]; + arrNum2[i] = arrNext[i]; + } + } + cout << seqN; + return 0; +} diff --git a/Project Euler/Project Euler 26.cpp b/Project Euler/Project Euler 26.cpp new file mode 100755 index 0000000..023297f --- /dev/null +++ b/Project Euler/Project Euler 26.cpp @@ -0,0 +1,33 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, maxLen = 0, len, numWithLargest, rem, j; + for(i = 3; i < 1000; i+=2) + { + bool arr[i]; + for(j = 0; j < i; j++) + { + arr[j] = false; + } + rem = 1; len = 0; + while(arr[rem] == false && rem != 0) + { + arr[rem] = true; + rem *=10; + rem %= i; + len++; + } + if(maxLen < len) + { + maxLen = len; + numWithLargest = i; + } + } + cout << numWithLargest; + return 0; +} diff --git a/Project Euler/Project Euler 27.cpp b/Project Euler/Project Euler 27.cpp new file mode 100755 index 0000000..b06cc8d --- /dev/null +++ b/Project Euler/Project Euler 27.cpp @@ -0,0 +1,62 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +vector possibleB; +ll M = 2000; +ll arr[2001]; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } + for(i = 2; i < 1000; i++) + { + if(arr[i]) + { + possibleB.push_back(i); + } + } +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll b, a, n, product = 1, largestN = 0, val; + for(b = 0; b < possibleB.size(); b++) + { + for(a = -1000; a < 1000; a++) + { + n = 0; + val = abs( (n*n) + (a*n) + possibleB[b] ); + while((arr[val]) ) + { + val = abs( (n*n) + (a*n) + possibleB[b] ); + n++; + } + if(largestN < n) + { + largestN = n; + product = a * possibleB[b]; + } + } + } + cout << product; + return 0; +} diff --git a/Project Euler/Project Euler 28.cpp b/Project Euler/Project Euler 28.cpp new file mode 100755 index 0000000..8c3fdb4 --- /dev/null +++ b/Project Euler/Project Euler 28.cpp @@ -0,0 +1,46 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll n = 1001; +ll grid[1001][1001]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i = (n-1)/2, j = (n-1)/2, num = 1, steps = 1, sign = 1, x, sum = 0; + grid[i][j] = num; + while(num != n*n) + { + for(x = 0; x < steps && num != n*n; x++) + { + j += sign; + num++; + grid[i][j] = num; + } + if(num == n*n) + { + break; + } + + for(x = 0; x < steps; x++) + { + num++; + i += sign; + grid[i][j] = num; + } + steps++; + sign = -sign; + } + for(i = 0, j = 0; i < n && j < n; i++, j++) + { + sum += grid[i][j]; + sum += grid[n-i-1][j]; + if(i == n-i-1) + { + sum -= grid[i][j]; + } + } + cout << sum; + return 0; +} diff --git a/Project Euler/Project Euler 29.cpp b/Project Euler/Project Euler 29.cpp new file mode 100755 index 0000000..a15d376 --- /dev/null +++ b/Project Euler/Project Euler 29.cpp @@ -0,0 +1,66 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll a, b, i, j, k, l, lower, higher, distinct = 0, factor, x; + cin >> lower >> higher; + bool grid[higher+1][higher+1]; + vector rpt; + for(i = lower; i <= higher; i++) + { + for(j = lower; j <= higher; j++) + { + grid[i][j] = false; + } + } + for(i = lower; i <= higher; i++) + { + if(i == 64) + { + i = 64; + } + k = lower; rpt.clear(); + while(pow(i, k-1) <= higher) + { + rpt.push_back(pow(i, k-1)); + k++; + } + for(j = lower; j <= higher; j++) + { + if(j-lower < rpt.size() && i * rpt[j-lower] <= higher) + { + k = lower; + while(k <= (higher/(j))) + { + grid[(ll)pow(i, j)][k] = true; + k++; + } + x = 2; + while(x < j) + { + k = 0; + while(k <= (higher/(j)) * x) + { + grid[(ll)pow(i, x)][k] = true; + k+= x; + } + x++; + } + + } + if(grid[i][j]) + { + continue; + } + grid[i][j] = true; + distinct++; + } + i = i; + } + cout << distinct; + return 0; +} diff --git a/Project Euler/Project Euler 3.cpp b/Project Euler/Project Euler 3.cpp new file mode 100755 index 0000000..2af03dd --- /dev/null +++ b/Project Euler/Project Euler 3.cpp @@ -0,0 +1,25 @@ +#include +using namespace std; +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, i = 2; + cin >> n; + while(i * i < n) + { + if(n % i == 0) + { + n/= i; + } + i++; + } + cout << n << endl; + } + + return 0; +} diff --git a/Project Euler/Project Euler 30.cpp b/Project Euler/Project Euler 30.cpp new file mode 100755 index 0000000..0aac7f2 --- /dev/null +++ b/Project Euler/Project Euler 30.cpp @@ -0,0 +1,50 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll digits[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + ll fifthPowers[10]; + ll i, a, b, c, d, e, f, num, sum = -1; + for(i = 0; i < 10; i++) + { + fifthPowers[i] = (ll)pow(digits[i], 5); + } + vector nums; + for(a = 0; a < 10; a++) + { + for(b = 0; b < 10; b++) + { + for(c = 0; c < 10; c++) + { + for(d = 0; d < 10; d++) + { + for(e = 0; e < 10; e++) + { + for(f = 0; f < 10; f++) + { + num = a*100000 + b*10000 + c*1000 + d*100 + e*10 + f; + if(fifthPowers[a] + fifthPowers[b] + fifthPowers[c] + fifthPowers[d] + fifthPowers[e] + fifthPowers[f]== num) + { + nums.push_back(num); + } + } + + } + + } + } + } + } + for(i = 0; i < nums.size(); i++) + { + cout << nums[i] << endl; + sum += nums[i]; + } + cout << "Sum : " << sum; + return 0; +} diff --git a/Project Euler/Project Euler 31.cpp b/Project Euler/Project Euler 31.cpp new file mode 100755 index 0000000..af784ef --- /dev/null +++ b/Project Euler/Project Euler 31.cpp @@ -0,0 +1,27 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll currencies[8] = {1, 2, 5, 10, 20, 50, 100, 200}; + ll amt = 200, i, j; + //cin >> amt; + ll ways[amt+1]; + for(i = 0; i <= amt; i++) + { + ways[i] = 0; + } + ways[0] = 1; + for(i = 0; i < 8; i++) + { + for(j = currencies[i]; j <= amt; j++) + { + ways[j] += ways[j - currencies[i]]; + } + } + cout << ways[amt] << endl; + return 0; +} diff --git a/Project Euler/Project Euler 32.cpp b/Project Euler/Project Euler 32.cpp new file mode 100755 index 0000000..45914d6 --- /dev/null +++ b/Project Euler/Project Euler 32.cpp @@ -0,0 +1,104 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll a, b, c, x, y, num1, num2, product1, product2, i, sum = 0, cpyProduct2; + vector products, num1s, num2s; + set digits, added; + bool noZero; + for(a = 1; a <= 9; a++) + { + for(b = 1; b <= 9; b++) + { + while(b == a) + { + b++; + } + for(c = 1; c <= 9; c++) + { + while(c == b || c == a) + { + c++; + } + for(x = 1; x <= 9; x++) + { + while(x == a || x == b || x == c) + { + x++; + } + for(y = 1; y <= 9; y++) + { + while(y == a || y == b|| y == c || y == x) + { + y++; + } + num1 = a*100 + b*10 + c; num2 = x*10 + y; + product1 = num1 * num2; product2 = (a*1000 + b*100 + c*10 + x) * y; + cpyProduct2 = product2; + noZero = true; + if(product1 >= 1234 && product1 <= 9876) + { + digits.clear(); + digits.insert(a); digits.insert(b); digits.insert(c); digits.insert(x); digits.insert(y); + while(product1) + { + digits.insert(product1%10); + if(product1%10 == 0) + { + noZero = false; + } + product1/=10; + } + if(digits.size() == 9 && noZero) + { + num1s.push_back(num1); + num2s.push_back(num2); + products.push_back(num1*num2); + } + } + noZero = true; + if(product2 >= 1234 && product2 <= 9876) + { + digits.clear(); + digits.insert(a); digits.insert(b); digits.insert(c); digits.insert(x); digits.insert(y); + while(product2) + { + digits.insert(product2%10); + if(product2 % 10 == 0) + { + noZero = false; + } + product2 /= 10; + } + if(digits.size() == 9 && noZero) + { + num1s.push_back(a*1000 + b*100 + c*10 + x); + num2s.push_back(y); + products.push_back(cpyProduct2); + } + } + } + } + } + } + } + + for(i = 0; i < products.size(); i++) + { + if(added.count(products[i])) + { + i++; + continue; + } + cout << num1s[i] << " * " << num2s[i] << " = " << products[i] << endl; + added.insert(products[i]); + sum+= products[i]; + } + cout << "Sum: " << sum; + return 0; +} diff --git a/Project Euler/Project Euler 33.cpp b/Project Euler/Project Euler 33.cpp new file mode 100755 index 0000000..d863276 --- /dev/null +++ b/Project Euler/Project Euler 33.cpp @@ -0,0 +1,88 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +string numToString(ll num) +{ + ll i; + string str = ""; + while(num != 0) + { + str += (char)( (num%10) + '0'); + num/=10; + } + str = string(str.rbegin(), str.rend()); + return str; +} + +ll stringToNum(string str) +{ + ll i, num = 0; + for(i = 0; i < str.length(); i++) + { + num += (ll)str[i] - '0'; + num*= 10; + } + return num/10; +} + +pair removeDups(string str1, string str2) +{ + ll i, j; + for(i = 0; i < str1.length(); i++) + { + for(j = 0; j < str2.length(); j++) + { + if(str1[i] == str2[j]) + { + str1.erase(str1.begin()+i); + str2.erase(str2.begin()+j); + + } + } + } + return make_pair(str1, str2); +} + +ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, j, producti = 1, productj = 1, hcf; + pair temp; + vector is, js; + for(i = 10; i < 100; i++) + { + for(j = 10; j < i; j++) + { + if(i % 10 != 0 && j % 10 != 0) + { + if(i == 65 && j == 26) + { + i = 65; + } + temp = removeDups(numToString(i), numToString(j) ); + ll num1 = stringToNum(temp.first), num2 = stringToNum(temp.second); + if(num1 != i && num2 != j && (double) num1/num2 == (double)i/(double)j) + { + hcf = gcd(num1, num2); + num1 /= hcf; + num2 /= hcf; + is.push_back(i); js.push_back(j); + } + } + } + } + for(i = 0; i < is.size(); i++) + { + cout << js[i] << " / " << is[i] << endl ; + producti *= is[i]; + productj *= js[i]; + } + cout << "Product : " << productj << " / " << producti << endl; + hcf = gcd(producti, productj); + cout << "Lowest : " << productj/hcf << " / " << producti/hcf; + return 0; +} diff --git a/Project Euler/Project Euler 34.cpp b/Project Euler/Project Euler 34.cpp new file mode 100755 index 0000000..3dfed53 --- /dev/null +++ b/Project Euler/Project Euler 34.cpp @@ -0,0 +1,71 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll log_10(ll num) +{ + ll ans = 0; + num/=10; + while(num) + { + num/=10; + ans++; + } + return ans; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll factorials[10]; + ll a, b, c, d, e, f, i, num, sum, lg; + vector nums; + factorials[0] = factorials[1] = 1; + for(i = 2; i < 10; i++) + { + factorials[i] = factorials[i-1]*i; + } + for(a = 0; a < 10; a++) + { + for(b = 0; b < 10; b++) + { + for(c = 0; c < 10; c++) + { + for(d = 0; d < 10; d++) + { + for(e = 0; e < 10; e++) + { + for(f = 0; f < 10; f++) + { + num = a*100000 + b*10000 + c*1000 + d*100 + e*10 + f; + if(num > 9) + { + lg = log_10(num); + if(lg == 1) + sum = factorials[e] + factorials[f]; + else if(lg == 2) + sum = factorials[d] + factorials[e] + factorials[f]; + else if(lg == 3) + sum = factorials[c] + factorials[d] + factorials[e] + factorials[f]; + else if(lg == 4) + sum = factorials[b] + factorials[c] + factorials[d] + factorials[e] + factorials[f]; + else if(lg == 5) + sum = factorials[a] + factorials[b] + factorials[c] + factorials[d] + factorials[e] + factorials[f]; + } + if(sum == num) + { + nums.push_back(num); + } + } + } + } + } + } + } + for(i = 0; i < nums.size(); i++) + { + cout << nums[i] << endl; + } + return 0; +} diff --git a/Project Euler/Project Euler 35.cpp b/Project Euler/Project Euler 35.cpp new file mode 100755 index 0000000..432b79a --- /dev/null +++ b/Project Euler/Project Euler 35.cpp @@ -0,0 +1,119 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll M = 999999; +bool arr[1000000], checked[1000000]; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } +} + +string numToString(ll num) +{ + ll i; + string str = ""; + while(num != 0) + { + str += (char)( (num%10) + '0'); + num/=10; + } + str = string(str.rbegin(), str.rend()); + return str; +} + +ll stringToNum(string str) +{ + ll i, num = 0; + for(i = 0; i < str.length(); i++) + { + num += (ll)str[i] - '0'; + num*= 10; + } + return num/10; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll a, b, c, d, e, f, num, i, j, k, l, m, n; + bool isPrime; + string stringNum, temp; + vector isCircular, tempCircular; + ll digits[] = {0, 1, 3, 7, 9}; + for(a = 0; a < 5; a++) + { + for(b = 0; b < 5; b++) + { + if(b == 0 && a != 0) + { + continue; + } + for(c = 0; c < 5; c++) + { + if(c == 0 && a != 0 && b != 0) + { + continue; + } + for(d = 1; d < 5; d++) + { + for(e = 1; e < 5; e++) + { + for(f = 1; f < 5; f++) + { + num = digits[a]*100000 + digits[b]*10000 + digits[c]*1000 + digits[d]*100 + digits[e]*10 + digits[f]; + if(checked[num]) + { + continue; + } + isPrime = true; + stringNum = numToString(num); + tempCircular.clear(); + temp = stringNum; + temp += stringNum; + for(i = 0; i < stringNum.length(); i++) + { + checked[stringToNum(temp.substr(i, stringNum.length()))] = true; + if(arr[stringToNum(temp.substr(i, stringNum.length()))] == 0) + { + isPrime = false; + } + tempCircular.push_back(stringToNum(temp.substr(i, stringNum.length()))); + } + if(isPrime) + { + for(i = 0; i < tempCircular.size(); i++) + { + isCircular.push_back(tempCircular[i]); + } + } + } + } + } + } + } + } + for(i = 0; i < isCircular.size(); i++) + { + cout << isCircular[i] << endl; + } + cout << "Size : " << isCircular.size() + 13; //Including those below 100 + return 0; +} diff --git a/Project Euler/Project Euler 36.cpp b/Project Euler/Project Euler 36.cpp new file mode 100755 index 0000000..1d4a3c6 --- /dev/null +++ b/Project Euler/Project Euler 36.cpp @@ -0,0 +1,36 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll isPalin(ll num, ll base) +{ + ll reversed = 0; + ll n = num; + while(n) + { + reversed = base*reversed + n % base; + n /= base; + } + return num == reversed; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, sum = 0; + vector palins; + for(i = 1; i < 1000000; i+=2) + { + if(isPalin(i, 10) && isPalin(i, 2)) + { + palins.push_back(i); + } + } + for(i = 0; i < palins.size(); i++) + { + cout << palins[i] << endl; + sum += palins[i]; + } + cout << "Sum : " << sum; + return 0; +} diff --git a/Project Euler/Project Euler 37.cpp b/Project Euler/Project Euler 37.cpp new file mode 100755 index 0000000..7e8b443 --- /dev/null +++ b/Project Euler/Project Euler 37.cpp @@ -0,0 +1,75 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll M = 1000000; +bool arr[1000001]; +vector primes; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 0; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } + for(i = 11; i <= M; i++) + { + if(arr[i]) + { + primes.push_back(i); + } + } +} + +bool isTruncable(ll num) +{ + ll f, l, numcpy = num, numcpy1 = num; + bool isTruncable = true; + f = numcpy/10; l = numcpy % (ll)(pow(10, floor(log(numcpy)/log(10)))); + while(f && l) + { + if(!arr[f] || (!arr[l])) + { + isTruncable = false; + break; + } + f = numcpy/10; + l = numcpy1 % (ll)(pow(10, floor(log(numcpy1)/log(10)))); + numcpy = f; + numcpy1 = l; + } + return isTruncable; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + vector truncablePrimes; + ll i, sum = 0; + for(i = 0; i < primes.size(); i++) + { + if(isTruncable(primes[i])) + { + truncablePrimes.push_back(primes[i]); + } + } + for(i = 0; i < truncablePrimes.size(); i++) + { + cout << truncablePrimes[i] << endl; + sum += truncablePrimes[i]; + } + cout << "Sum : " << sum; + return 0; +} diff --git a/Project Euler/Project Euler 38.cpp b/Project Euler/Project Euler 38.cpp new file mode 100755 index 0000000..0760463 --- /dev/null +++ b/Project Euler/Project Euler 38.cpp @@ -0,0 +1,35 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool isPandigital(ll num) +{ + set digits; + while(num) + { + if(digits.count(num%10) == 1 || num % 10 == 0) + { + return true; + } + digits.insert(num%10); + num /= 10; + } + return false; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, num, maxNum = 0; + for(i = 9234; i <= 9487; i++) + { + num = (i*100000) + (i * 2); + if((!isPandigital(num)) && maxNum < num) + { + maxNum = num; + } + } + cout << maxNum; + return 0; +} diff --git a/Project Euler/Project Euler 39.cpp b/Project Euler/Project Euler 39.cpp new file mode 100755 index 0000000..35a2bda --- /dev/null +++ b/Project Euler/Project Euler 39.cpp @@ -0,0 +1,29 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, a, b, maxCnt = 0, tmp, cnt, maxP, limit = 1000; + for(i = 12; i <= limit; i+=2) + { + cnt = 0; + for(a = 2; a < i/3; a++) + { + if(i*(i - 2*a) % (2*(i-a)) == 0) + { + cnt++; + } + } + if(maxCnt < cnt) + { + maxCnt = cnt; + maxP = i; + } + } + cout << maxP; + return 0; +} diff --git a/Project Euler/Project Euler 4.cpp b/Project Euler/Project Euler 4.cpp new file mode 100755 index 0000000..489452f --- /dev/null +++ b/Project Euler/Project Euler 4.cpp @@ -0,0 +1,41 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +bool isPalin(ll n) +{ + string s; ll i; + ostringstream convert; + convert << n; + s = convert.str(); + for(i = 0; i < s.length()/2; i++) + { + if(s[i] != s[s.length()-i-1]) + { + return false; + } + } + return true; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, j, num = 0; + for(i = 990; i >= 100; i-=11) + { + for(j = 999; j >= 100; j--) + { + if(i*j < num) + { + break; + } + if(isPalin(i*j)) + { + num = max(num, i*j); + } + } + } + cout << num; + return 0; +} diff --git a/Project Euler/Project Euler 40.cpp b/Project Euler/Project Euler 40.cpp new file mode 100755 index 0000000..32de8b9 --- /dev/null +++ b/Project Euler/Project Euler 40.cpp @@ -0,0 +1,35 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +string numToString(ll num) +{ + ll i; + string str = ""; + while(num != 0) + { + str += (char)( (num%10) + '0'); + num/=10; + } + str = string(str.rbegin(), str.rend()); + return str; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + string fractionalPart = ""; + ll i = 1, product = 1; + while(fractionalPart.length() <= 1000000) + { + fractionalPart += numToString(i); + i++; + } + for(i = 0; i <= 6; i++) + { + product *= fractionalPart[pow(10, i) - 1] - '0'; + } + cout << product; + return 0; +} diff --git a/Project Euler/Project Euler 41.cpp b/Project Euler/Project Euler 41.cpp new file mode 100755 index 0000000..a5d1c20 --- /dev/null +++ b/Project Euler/Project Euler 41.cpp @@ -0,0 +1,58 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll M = 7654321; +ll arr[7654322]; +vector primes; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } +} +bool isPandigitalN(ll num) +{ + set digits; + ll size = (ll)(log(num)/log(10) + 1); + while(num) + { + if(digits.count(num%10) || num % 10 > size || num % 10 == 0) + { + return false; + } + digits.insert(num%10); + num /= 10; + } + return true; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll i, maxNum = 0; + for(i = 1234567; i < 7654321; i+=2) + { + if(arr[i] && isPandigitalN(i) && i > maxNum) + { + maxNum = i; + } + } + cout << maxNum; + return 0; +} diff --git a/Project Euler/Project Euler 42.cpp b/Project Euler/Project Euler 42.cpp new file mode 100755 index 0000000..89fce97 --- /dev/null +++ b/Project Euler/Project Euler 42.cpp @@ -0,0 +1,61 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll wordVal(string str) +{ + ll sum = 0, i; + for(i = 0; i < str.length(); i++) + { + sum += str[i] - 'A' + 1; + } + return sum; +} +bool isTriangleNum(ll num) +{ + double n = (sqrt(1 + 8*num) - 1.0)/2; + if(n == (ll)(n)) + { + return true; + } + return false; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ifstream words("words.txt"); + stringstream buffer; + buffer << words.rdbuf(); + string test = buffer.str(); + test.erase(remove(test.begin(), test.end(), '"'), test.end()); + ll i, greatestVal = 0, count = 0; + vector wordsArr; + string temp = ""; + for(i = 0; i < test.length(); i++) + { + if(test[i] == ',') + { + if(wordVal(temp) > greatestVal) + { + greatestVal = wordVal(temp); + } + wordsArr.push_back(temp); + temp = ""; + } + else + { + temp += test[i]; + } + } + wordsArr.push_back(temp); + for(i = 0; i < wordsArr.size(); i++) + { + if(isTriangleNum( wordVal(wordsArr[i]) ) ) + { + count++; + } + } + cout << count; + return 0; +} diff --git a/Project Euler/Project Euler 43.cpp b/Project Euler/Project Euler 43.cpp new file mode 100755 index 0000000..ac63343 --- /dev/null +++ b/Project Euler/Project Euler 43.cpp @@ -0,0 +1,46 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll stringToNum(string str) +{ + ll i, num = 0; + for(i = 0; i < str.length(); i++) + { + num += (ll)str[i] - '0'; + num*= 10; + } + return num/10; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + string pandigitals = "1023456789"; + ll primes[] = {2, 3, 5, 7, 11, 13, 17}, i; + vector nums; + bool satisfies; + while(next_permutation(pandigitals.begin(), pandigitals.end())) + { + satisfies = true; + for(i = 0; i < 7; i++) + { + if(stringToNum(pandigitals.substr(i + 1, 3)) % primes[i]) + { + satisfies = false; + break; + } + } + if(satisfies) + { + nums.push_back(pandigitals); + } + } + for(i = 0; i < nums.size(); i++) + { + cout << nums[i] << endl; + } + return 0; +} diff --git a/Project Euler/Project Euler 44.cpp b/Project Euler/Project Euler 44.cpp new file mode 100755 index 0000000..0eaaf2d --- /dev/null +++ b/Project Euler/Project Euler 44.cpp @@ -0,0 +1,37 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool isPentagonalNum(ll num) +{ + double n = (sqrt(1 + 24*num) + 1)/6; + if(n == (ll)(n)) + { + return true; + } + return false; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll j = 1, k, num1, num2, minNum = INT_MAX; + bool notFound = true; + while(notFound) + { + j++; + num1 = (j * (3*j - 1))/2; + for(k = j + 1; k < 3000; k++) + { + num2 = (k * (3*k - 1))/2; + if(isPentagonalNum(num1+num2) && isPentagonalNum(num2 - num1)) + { + minNum = num2 - num1; + notFound = false; + } + } + } + cout << minNum; + return 0; +} diff --git a/Project Euler/Project Euler 45.cpp b/Project Euler/Project Euler 45.cpp new file mode 100755 index 0000000..3e18e50 --- /dev/null +++ b/Project Euler/Project Euler 45.cpp @@ -0,0 +1,44 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool isTriangleNum(ll num) +{ + double n = (sqrt(1 + 8*num) - 1)/2; + if(n == (ll)(n)) + { + return true; + } + return false; +} + +bool isPentagonalNum(ll num) +{ + double n = (sqrt(1 + 24*num) + 1)/6; + if(n == (ll)(n)) + { + return true; + } + return false; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + bool notFound = true; + ll i = 143, hexaNum; + while(notFound) + { + i++; + hexaNum = i * (2*i - 1); + if(isPentagonalNum(hexaNum) && isTriangleNum(hexaNum)) + { + notFound = false; + break; + } + } + cout << hexaNum; + return 0; +} diff --git a/Project Euler/Project Euler 46.cpp b/Project Euler/Project Euler 46.cpp new file mode 100755 index 0000000..74f8144 --- /dev/null +++ b/Project Euler/Project Euler 46.cpp @@ -0,0 +1,75 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll M = 100000; +ll arr[100001]; +vector oddComposites; +vector primes; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } + primes.push_back(2); + for(i = 3; i <= M; i+=2) + { + if(arr[i] == 0) + { + oddComposites.push_back(i); + } + else + { + primes.push_back(i); + } + } +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll i, j, num = 0; + double tmp; + bool found; + for(i = 0; i < oddComposites.size(); i++) + { + if(oddComposites[i] == 5777) + { + oddComposites[i] == 5777; + } + found = false; + for(j = 0; j < oddComposites[i] && j < primes.size(); j++) + { + tmp = ( oddComposites[i] - primes[j] )/2; + if(sqrt(tmp) == (ll)sqrt((tmp))) + { + found = true; + break; + } + } + if(!found) + { + num = oddComposites[i]; + break; + } + + } + cout << num; + return 0; +} diff --git a/Project Euler/Project Euler 47.cpp b/Project Euler/Project Euler 47.cpp new file mode 100755 index 0000000..9e6c490 --- /dev/null +++ b/Project Euler/Project Euler 47.cpp @@ -0,0 +1,61 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll M = 1000000; +ll arr[1000001], factorCount[1000001]; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + if(!(i & 1)) + { + factorCount[i] = 1; + } + } + arr[0] = arr[1] = 0; + factorCount[2] = 2; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } + for(i = 3; i <= sqrt(M); i += 2) + { + if(arr[i]) + { + for(j = 2*i; j <= M; j+=i) + { + factorCount[j]++; + } + } + } +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll i = 210; + bool notFound = true; + while(notFound) + { + if(factorCount[i] == 4 && factorCount[i+1] == 4 && factorCount[i+2] == 4 && factorCount[i+3] == 4) + { + cout << i; + notFound = false; + break; + } + i++; + } + return 0; +} diff --git a/Project Euler/Project Euler 48.cpp b/Project Euler/Project Euler 48.cpp new file mode 100755 index 0000000..2fa0705 --- /dev/null +++ b/Project Euler/Project Euler 48.cpp @@ -0,0 +1,30 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll mod = 1e10; +ll selfPower(ll num) +{ + ll i = num, product = 1; + while(i--) + { + product*= num; + product %= mod; + } + return product; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, sum = 0; + for(i = 1; i <= 1000; i++) + { + sum += selfPower(i); + sum %= mod; + } + cout << sum; + return 0; +} diff --git a/Project Euler/Project Euler 49.cpp b/Project Euler/Project Euler 49.cpp new file mode 100755 index 0000000..90e97cd --- /dev/null +++ b/Project Euler/Project Euler 49.cpp @@ -0,0 +1,83 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll M = 10000; +ll arr[10001]; +vector primes; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } + for(i = 1000; i < M; i++) + { + if(arr[i]) + { + primes.push_back(i); + } + } +} + +ll containsSame(ll num1, ll num2) +{ + ll arr[10], i; + for(i = 0; i < 10; i++) + { + arr[i] = 0; + } + while(num1) + { + arr[num1 % 10]++; + num1 /=10; + } + while(num2) + { + arr[num2 % 10]--; + num2 /= 10; + } + for(i = 0; i < 10; i++) + { + if(arr[i] != 0) + { + return false; + } + } + return true; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll i,j, diff; + for(i = 0; i < primes.size() - 1; i++) + { + for(j = i + 1; j < primes.size(); j++) + { + if(containsSame(primes[i], primes[j])) + { + diff = primes[j] - primes[i]; + if(containsSame(primes[j] + diff, primes[j]) && primes[j] + diff < 10000 && arr[primes[j] + diff ]) + { + cout << primes[i] << " " << primes[j] << " " << primes[j] + diff << endl; + } + } + } + } + return 0; +} diff --git a/Project Euler/Project Euler 5.cpp b/Project Euler/Project Euler 5.cpp new file mode 100755 index 0000000..0fdb587 --- /dev/null +++ b/Project Euler/Project Euler 5.cpp @@ -0,0 +1,19 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;} +ll lcm(ll a, ll b) {return (a*b)/gcd(a,b);} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll num = 1, i, k; + cin >> k; + for(i = 2; i < k+1; i++) + { + num = lcm(num, i); + } + cout << num; + return 0; +} diff --git a/Project Euler/Project Euler 50!.cpp b/Project Euler/Project Euler 50!.cpp new file mode 100755 index 0000000..e6a1936 --- /dev/null +++ b/Project Euler/Project Euler 50!.cpp @@ -0,0 +1,66 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll M = 1000000; +ll arr[1000001]; +vector primes; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } + primes.push_back(2); + for(i = 3; i <= 10000; i+=2) + { + if(arr[i]) + { + primes.push_back(i); + } + } +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll i, j, mostTerms = 2, sum, length, largestPrime = 2; + for(length = mostTerms - 1; length < primes.size(); length++) + { + for(j = 0; j < primes.size() - length; j++) + { + sum = 0; + for(i = j; i < j + length; i++) + { + sum += primes[i]; + if(sum >= 1000000) + { + sum = 0; + break; + } + } + if(arr[sum] && length > mostTerms) + { + mostTerms = length; + largestPrime = sum; + } + } + } + cout << largestPrime; + return 0; +} diff --git a/Project Euler/Project Euler 51.cpp b/Project Euler/Project Euler 51.cpp new file mode 100755 index 0000000..c5de2de --- /dev/null +++ b/Project Euler/Project Euler 51.cpp @@ -0,0 +1,115 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll M = 1000000; +ll arr[1000001]; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } +} +bool containsThreeDups(ll num) // not considering last digit +{ + ll arr[10], i; + num/=10; + for(i = 0; i < 10; i++) + { + arr[i] = 0; + } + while(num) + { + arr[num%10]++; + num/=10; + } + for(i = 0; i < 10; i++) + { + if(arr[i] >= 3) + { + return true; + } + } + return false; +} +string numToString(ll num) +{ + ll i; + string str = ""; + while(num != 0) + { + str += (char)( (num%10) + '0'); + num/=10; + } + str = string(str.rbegin(), str.rend()); + return str; +} +ll stringToNum(string str) +{ + ll i, num = 0; + for(i = 0; i < str.length(); i++) + { + num += (ll)str[i] - '0'; + num*= 10; + } + return num/10; +} +bool isTrue(string num) +{ + ll h, i, j, count = 0, k; + for(i = 0; i < num.length() - 3; i++) + { + for(j = i + 1; j < num.length() - 2; j++) + { + for(h = j + 1; h < num.length() - 1; h++) + { + if(num[i] == num[j] && num[j] == num[h] ) + { + for(k = 0; k < 10; k++) + { + num[i] = num[j] = num[h] = k + '0'; + if(num[0] != '0' && arr[stringToNum(num)]) + { + count++; + } + } + if(count >= 8) + { + return true; + } + return false; + } + } + + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll i; + for(i = 100001; i < 1000000; i+=2) + { + if(arr[i] && containsThreeDups(i) && isTrue(numToString(i))) + { + cout << i << " "; + } + } + return 0; +} diff --git a/Project Euler/Project Euler 52.cpp b/Project Euler/Project Euler 52.cpp new file mode 100755 index 0000000..1a61973 --- /dev/null +++ b/Project Euler/Project Euler 52.cpp @@ -0,0 +1,49 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool containsSameDigits(ll num1, ll num2) +{ + ll arr[10], i; + for(i = 0; i < 10; i++) + { + arr[i] = 0; + } + while(num1) + { + arr[num1%10]++; + num1/=10; + } + while(num2) + { + arr[num2%10]--; + num2/=10; + } + for(i = 0; i < 10; i++) + { + if(arr[i] != 0) + { + return false; + } + } + return true; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i = 123; + bool notFound = true; + while(notFound) + { + if(containsSameDigits(i, 2*i) && containsSameDigits(i, 3*i) && containsSameDigits(i, 4*i) && containsSameDigits(i, 5*i) && containsSameDigits(i, 6*i)) + { + notFound = false; + break; + } + i++; + } + cout << i-1; + return 0; +} diff --git a/Project Euler/Project Euler 53.cpp b/Project Euler/Project Euler 53.cpp new file mode 100755 index 0000000..f697140 --- /dev/null +++ b/Project Euler/Project Euler 53.cpp @@ -0,0 +1,38 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll binomialCoeff(ll n, ll k) +{ + ll i, j, count = 0; + ll C[n+1][k+1]; + for(i = 0; i <= n; i++) + { + for(j = 0; j <= min(i, k); j++) + { + if(j == 0 || j == i) + { + C[i][j] = 1; + } + else + { + C[i][j] = C[i-1][j-1] + C[i-1][j]; + if(C[i][j] > 1000000) + { + C[i][j] = 1000000; + count++; + } + } + } + } + return count; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, j, count = 0; + cout << binomialCoeff(100, 100); + return 0; +} diff --git a/Project Euler/Project Euler 54.cpp b/Project Euler/Project Euler 54.cpp new file mode 100755 index 0000000..4d80297 --- /dev/null +++ b/Project Euler/Project Euler 54.cpp @@ -0,0 +1,426 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pii make_pair +map cardVals; +void initMap() +{ + for(ll i = 2; i < 10; i++) + { + cardVals[(char)(i+'0')] = i; + } + cardVals['T'] = 10; + cardVals['J'] = 11; + cardVals['Q'] = 12; + cardVals['K'] = 13; + cardVals['A'] = 14; +} + +bool isFlush(string hand) +{ + bool isFlush = true; + char suit = hand[1]; + for(ll i = 4; i < hand.length(); i += 3) + { + if(hand[i] != suit) + { + return false; + } + } + return true; +} + +ll NthVal(string hand, ll n) +{ + vector vals; + for(ll i = 0; i < hand.length(); i += 3) + { + vals.push_back(cardVals[hand[i]]); + } + sort(vals.begin(), vals.end()); + return vals[5-n]; +} +bool isStraight(string hand) +{ + vector vals; + ll i; + for(i = 0; i < hand.length(); i += 3) + { + vals.push_back(cardVals[hand[i]]); + } + sort(vals.begin(), vals.end()); + for(i = 1; i < vals.size(); i++) + { + if(vals[i] != vals[i-1] + 1) + { + return false; + } + } + return true; +} + +pair hasOnePair(string hand) +{ + ll i, j; + for(i = 0; i < hand.length() - 3; i += 3) + { + for(j = i + 3; j < hand.length(); j += 3) + { + if(hand[i] == hand[j]) + { + return pii(true, cardVals[hand[i]]); + } + } + } + return pii(false, cardVals[hand[i]]); +} + +pair > hasTwoPairs(string hand) +{ + ll i, j, found = -1; + for(i = 0; i < hand.length() - 3; i += 3) + { + for(j = i + 3; j < hand.length(); j += 3) + { + if(hand[i] == hand[j] && found == -1) + { + found = cardVals[hand[i]]; + } + else if(hand[i] == hand[j] && cardVals[hand[i]] != found && found != -1) + { + return pii(true, pii(found, cardVals[hand[i]]) ); + } + } + } + return pii(false, pii(0, 0)); +} + +pair hasThreeOfKind(string hand) +{ + ll i, j, k; + for(i = 0; i < hand.length() - 6; i += 3) + { + for(j = i + 3; j < hand.length() - 3; j += 3) + { + for(k = j + 3; k < hand.length(); k += 3) + { + if(hand[i] == hand[j] && hand[j] == hand[k]) + { + return pii(true, cardVals[hand[i]]); + } + } + } + } + return pii(false, 0); +} + +bool hasFourOfKind(string hand) +{ + ll i, j, k, l; + for(i = 0; i < hand.length() - 9; i += 3) + { + for(j = i + 3; j < hand.length() - 6; j += 3) + { + for(k = j + 3; k < hand.length() - 3; k += 3) + { + for(l = k + 3; l < hand.length(); l += 3) + { + if(hand[i] == hand[j] && hand[j] == hand[k] && hand[k] == hand[l]) + { + return true; + } + } + } + } + } + return false; +} + +pair< bool, pair > hasFullHouse(string hand) +{ + ll i, j, k, found = -1; + for(i = 0; i < hand.length() - 6; i += 3) + { + for(j = i + 3; j < hand.length() - 3; j += 3) + { + for(k = j + 3; k < hand.length(); k += 3) + { + if(hand[i] == hand[j] && hand[j] == hand[k]) + { + found = cardVals[hand[i]]; + break; + } + } + } + } + if(found != -1) + { + for(i = 0; i < hand.length() - 3; i += 3) + { + for(j = i + 3; j < hand.length(); j += 3) + { + if(hand[i] == hand[j] && cardVals[hand[i]] != found) + { + return pii(true, pii(found, cardVals[hand[i]]) ); + } + } + } + } + return pii(false, pii(0, 0) ); +} + +ll compareAll(string hand1, string hand2) +{ + vector vals1, vals2; + ll i; + for(i = 0; i < hand1.length(); i += 3) + { + vals1.push_back(cardVals[hand1[i]]); + vals2.push_back(cardVals[hand2[i]]); + } + sort(vals1.begin(), vals1.end()); + sort(vals2.begin(), vals2.end()); + for(i = vals1.size() - 1; i >= 0; i--) + { + if(vals1[i] > vals2[i]) + { + return 1; + } + else if(vals1[i] < vals2[i]) + { + return 2; + } + } + return 0; +} +ll winner(string game) +{ + string p1, p2; + p1 = game.substr(0, 14); + p2 = game.substr(15, 14); + + ll highestValP1 = NthVal(p1, 1), highestValP2 = NthVal(p2, 1), i, j, k; + bool flushP1 = isFlush(p1), straightP1 = isStraight(p1), hasFourP1 = hasFourOfKind(p1); + bool straightFlushP1 = (straightP1 && flushP1); + bool royalFlushP1 = (straightFlushP1 && (highestValP1 == 14)); + + bool flushP2 = isFlush(p2), straightP2 = isStraight(p2), hasFourP2 = hasFourOfKind(p2); + bool straightFlushP2 = (straightP2 && flushP2); + bool royalFlushP2 = (straightFlushP2 && (highestValP2 == 14)); + + pair > fullHouseP1 = hasFullHouse(p1), fullHouseP2 = hasFullHouse(p2); + + if(royalFlushP1) + { + return 1; + } + + if(royalFlushP2) + { + return 2; + } + + if(straightFlushP1 && straightFlushP2) + { + return (highestValP1 > highestValP2) ? 1 : 2; + } + + if(straightFlushP1) + { + return 1; + } + + if(straightFlushP2) + { + return 2; + } + + if(hasFourP1 && hasFourP2) + { + if(highestValP1 != highestValP2) + { + return (highestValP1 > highestValP2) ? 1 : 2; + } + else + { + return (NthVal(p1, 5) > NthVal(p2, 5)) ? 1 : 2; + } + } + if(hasFourP1) + { + return 1; + } + else if(hasFourP2) + { + return 2; + } + + if(fullHouseP1.first && fullHouseP2.first) + { + if(fullHouseP1.second.first == fullHouseP2.second.first) + { + return (fullHouseP1.second.second > fullHouseP2.second.second) ? 1 : 2; + } + else + { + return (fullHouseP1.second.first > fullHouseP2.second.first) ? 1 : 2; + } + } + if(fullHouseP1.first) + { + return 1; + } + else if(fullHouseP2.first) + { + return 2; + } + + if(flushP1 && flushP2) + { + return compareAll(p1, p2); + } + if(flushP1) + { + return 1; + } + else if(flushP2) + { + return 2; + } + + if(straightP1 && straightP2) + { + return (highestValP1 > highestValP2) ? 1 : 2; + } + if(straightP1) + { + return 1; + } + else if(straightP2) + { + return 2; + } + + pair hasThreeOfKindP1 = hasThreeOfKind(p1), hasThreeOfKindP2 = hasThreeOfKind(p2); + pair > hasTwoPairsP1 = hasTwoPairs(p1), hasTwoPairsP2 = hasTwoPairs(p2); + + if(hasThreeOfKindP1.first && hasThreeOfKindP2.first) + { + if(hasThreeOfKindP1.second == hasThreeOfKindP2.second) + { + return compareAll(p1, p2); + } + else + { + return (hasThreeOfKindP1.second > hasThreeOfKindP2.second) ? 1 : 2; + } + + } + if(hasThreeOfKindP1.first) + { + return 1; + } + else if(hasThreeOfKindP2.first) + { + return 2; + } + + if(hasTwoPairsP1.first && hasTwoPairsP2.first) + { + ll greatestP1, greatestP2, leastP1, leastP2; + if(hasTwoPairsP1.second.first > hasTwoPairsP1.second.second) + { + greatestP1 = hasTwoPairsP1.second.first; + leastP1 = hasTwoPairsP1.second.second; + } + else + { + greatestP1 = hasTwoPairsP1.second.second; + leastP1 = hasTwoPairsP1.second.first; + } + + if(hasTwoPairsP2.second.first > hasTwoPairsP2.second.second) + { + greatestP2 = hasTwoPairsP2.second.first; + leastP2 = hasTwoPairsP2.second.second; + } + else + { + greatestP2 = hasTwoPairsP2.second.second; + leastP2 = hasTwoPairsP2.second.first; + } + if(greatestP1 != greatestP2) + { + return (greatestP1 > greatestP2) ? 1 : 2; + } + else if(leastP1 != leastP2) + { + return (leastP1 > leastP2) ? 1 : 2; + } + else + { + return compareAll(p1, p2); + } + } + if(hasTwoPairsP1.first) + { + return 1; + } + else if(hasTwoPairsP2.first) + { + return 2; + } + + pair hasOnePairP1 = hasOnePair(p1), hasOnePairP2 = hasOnePair(p2); + + if(hasOnePairP1.first && hasOnePairP2.first) + { + if(hasOnePairP1.second == hasOnePairP2.second) + { + return compareAll(p1, p2); + } + else + { + return (hasOnePairP1.second > hasOnePairP2.second) ? 1 : 2; + } + } + if(hasOnePairP1.first) + { + return 1; + } + else if(hasOnePairP2.first) + { + return 2; + } + + return compareAll(p1, p2); +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + initMap(); + ifstream hands("poker.txt"); + stringstream buffer; + buffer << hands.rdbuf(); + string test; + test = buffer.str(); + vector poker; + ll i, count = 0; + for(i = 0; i < test.length(); i+= 30) + { + poker.push_back(test.substr(i, 29)); + } + for(i = 0; i < poker.size(); i++) + { + if(winner(poker[i]) == 1) + { + count++; + } + } + cout << count; + return 0; +} +//At last, it is complete! Yay!!!!!! diff --git a/Project Euler/Project Euler 55.cpp b/Project Euler/Project Euler 55.cpp new file mode 100755 index 0000000..a52b0ae --- /dev/null +++ b/Project Euler/Project Euler 55.cpp @@ -0,0 +1,65 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll power10(ll k) +{ + ll p = 1; + while(k--) + { + p*= 10; + } + return p; +} +ll reversednum(ll n) +{ + ll num = 0; + ll len = log10(n)+1; + ll dup = len - 1; + while(len--) + { + ll e = n % 10; + ll k = power10(dup); + num = e*k + num; + n/=10; dup--; + } + return num; +} +bool isPal(ll n) +{ + string s; + ostringstream convert; + convert << n; + s = convert.str(); + if(s == string(s.rbegin(), s.rend())) + { + return true; + } + return false; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, sum, step = 0, count = 0; + for(i = 100; i < 10000; i++) + { + sum = i; + for(step = 0; step < 50; step++) + { + sum = sum + reversednum(sum); + step++; + if(isPal(sum)) + { + break; + } + } + if(step == 50) + { + count++; + } + } + cout << count; + return 0; +} diff --git a/Project Euler/Project Euler 56.cpp b/Project Euler/Project Euler 56.cpp new file mode 100755 index 0000000..67a06e3 --- /dev/null +++ b/Project Euler/Project Euler 56.cpp @@ -0,0 +1,60 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll a, b, maxSum = 0, i, p, carry, sum = 0, digits; + bool found = true; + for(a = 99; a >= 2; a--) + { + for(b = 99; b >= 2; b--) + { + digits = 0; found = true; + sum = 0; + ll arr[200]; + for(i = 1; i < 200; i++) + { + arr[i] = 0; + } + arr[0] = 1; + carry = 0; + for(p = 0; p < b; p++) + { + i = 0; + for(i = 0; i < 200; i++) + { + arr[i] = arr[i]*a + carry; + carry = 0; + if(arr[i] > 9) + { + carry = arr[i]/10; + arr[i] %= 10; + } + } + } + for(i = 199; i >= 0; i--) + { + if(arr[i] != 0 && found) + { + found = false; + } + sum += arr[i]; + if(!found) + { + digits++; + } + } + if(maxSum > 9*digits) + { + break; + } + maxSum = max(maxSum, sum); + } + } + cout << maxSum; + return 0; +} diff --git a/Project Euler/Project Euler 57.cpp b/Project Euler/Project Euler 57.cpp new file mode 100755 index 0000000..303d3fa --- /dev/null +++ b/Project Euler/Project Euler 57.cpp @@ -0,0 +1,26 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, n = 1393, d = 985, count = 1; + for(i = 8; i <= 1000; i++) + { + d += n; + n += 2*(d - n); + if(d > 1e15 || n > 1e15) + { + d/= 1e5; + n/= 1e5; + } + if((ll)(log(n)/log(10)) > (ll)(log(d)/log(10) ) ) + { + count++; + } + } + cout << count; + return 0; +} diff --git a/Project Euler/Project Euler 58.cpp b/Project Euler/Project Euler 58.cpp new file mode 100755 index 0000000..f284b44 --- /dev/null +++ b/Project Euler/Project Euler 58.cpp @@ -0,0 +1,52 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool isPrime(ll n) +{ + if (n <= 1) return false; + if (n == 2) return true; + if (n % 2 == 0) return false; + if (n < 9) return true; + if (n % 3 == 0) return false; + ll counter = 5; + while ((counter * counter) <= n) { + if (n % counter == 0) return false; + if (n % (counter + 2) == 0) return false; + counter += 6; + } + return true; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll s = 7, toAdd = 30, bl = 43, tl = 37, tr = 31, nums = 13, numPrime = 8; // bl = bottom-left, tr = top-right + double ratio = 62.0; + while(ratio >= 10.0) + { + bl += toAdd; + if(isPrime(bl)) + { + numPrime++; + } + tl += toAdd - 2; + if(isPrime(tl)) + { + numPrime++; + } + tr += toAdd - 4; + if(isPrime(tr)) + { + numPrime++; + } + toAdd += 8; + s += 2; + nums += 4; + ratio = ((numPrime*100)/nums); + } + cout << s; + return 0; +} diff --git a/Project Euler/Project Euler 59.cpp b/Project Euler/Project Euler 59.cpp new file mode 100755 index 0000000..49eb00c --- /dev/null +++ b/Project Euler/Project Euler 59.cpp @@ -0,0 +1,81 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll stringToNum(string num) +{ + ll i, number = 0; + for(i = 0; i < num.length(); i++) + { + number += num[i] - '0'; + number *= 10; + } + return number/10; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, j, k, l, spaceVal = (ll)(' '), tmp, count, maxCount = 0, sum = 0; + ifstream cipher("cipher.txt"); + stringstream buffer; + buffer << cipher.rdbuf(); + string test, temp = "", tryKey, key; + test = buffer.str(); + test.erase(remove(test.begin(), test.end(), '\n'), test.end()); + vector chars; + for(i = 0; i < test.length(); i++) + { + if(test[i] == ',') + { + chars.push_back(stringToNum(temp)); + temp = ""; + } + else + { + temp += test[i]; + } + } + chars.push_back(stringToNum(temp)); + for(i = 0; i < 26; i++) + { + for(k = 0; k < 26; k++) + { + for(l = 0; l < 26; l++) + { + + tryKey += ((ll)(i + 'a')); + tryKey += ((ll)(k + 'a')); + tryKey += ((ll)(l + 'a')); + count = 0; + for(j = 0; j < chars.size(); j++) + { + tmp = chars[j] ^ tryKey[j%3]; + if(tmp == spaceVal) + { + count++; + } + if(count > maxCount) + { + maxCount = count; + key = tryKey; + } + } + tryKey = ""; + } + } + } + for(j = 0; j < chars.size(); j++) + { + tmp = chars[j] ^ key[j%3]; + cout << (char)(tmp); + } + for(j = 0; j < chars.size(); j++) + { + tmp = chars[j] ^ key[j%3]; + sum += tmp; + } + cout << endl << endl << sum; + return 0; +} diff --git a/Project Euler/Project Euler 6.cpp b/Project Euler/Project Euler 6.cpp new file mode 100755 index 0000000..10c3633 --- /dev/null +++ b/Project Euler/Project Euler 6.cpp @@ -0,0 +1,21 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll SumOfSquaresTillN(ll n) +{ + return ( n * (n+1) * ((2*n) + 1) )/ 6; +} +ll SumOfNumsTillN(ll n) +{ + return (n * (n+1))/2; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n; + cin >> n; + cout << (SumOfNumsTillN(n) * SumOfNumsTillN(n) - SumOfSquaresTillN(n)); + return 0; +} diff --git a/Project Euler/Project Euler 60.cpp b/Project Euler/Project Euler 60.cpp new file mode 100755 index 0000000..9204809 --- /dev/null +++ b/Project Euler/Project Euler 60.cpp @@ -0,0 +1,161 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +typedef long long int ll; +ll M = 10000; +ll arr[10001]; +vector primes; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } + primes.push_back(2); + for(i = 3; i <= M; i += 2) + { + if(arr[i]) + { + primes.push_back(i); + } + } +} +ll power10(ll num) +{ + ll ans = 1; + while(num--) + { + ans*=10; + } + return ans; +} +bool isPrime(ll n) +{ + if (n <= 1) return false; + if (n == 2) return true; + if (n % 2 == 0) return false; + if (n < 9) return true; + if (n % 3 == 0) return false; + ll counter = 5; + while ((counter * counter) <= n) { + if (n % counter == 0) return false; + if (n % (counter + 2) == 0) return false; + counter += 6; + } + return true; +} + +ll check(ll num1, ll num2) +{ + return (!(isPrime((ll)(num1 * power10((log(num2)/log(10)) + 1) + num2))) || !(isPrime((ll)(num2 * power10((log(num1)/log(10)) + 1) + num1)))); +} + +ll canBeConcatenated(ll num1, ll num2) +{ + return ((isPrime((ll)(num1 * power10((log(num2)/log(10)) + 1) + num2))) && (isPrime((ll)(num2 * power10((log(num1)/log(10)) + 1) + num1)))); +} +vector setArr[1234]; +vector intersections[1234][1234]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll i, j, k, primeToAdd = 0, size = primes.size(); + bool isPossible; + for(i = 1; i < size-1; i++) + { + for(j = 1; j < size; j++) + { + isPossible = true; + if(check(primes[i], primes[j])) + { + isPossible = false; + } + if(isPossible) + { + setArr[i].push_back(primes[j]); + } + } + } + for(i = 1; i < size - 1; i++) + { + for(k = 0; k < setArr[i].size(); k++) + { + for(j = i + 1; j < size; j++) + { + if(binary_search(setArr[j].begin(), setArr[j].end(), setArr[i][k]) && binary_search(setArr[i].begin(), setArr[i].end(), primes[j])) + { + intersections[i][j].push_back(setArr[i][k]); + } + } + } + } + vector > ijs; + ll cnt = 0, x, y, z, z1, z2, num1, num2, num3, sum = 0; + set list; + set > lists; + for(i = 0; i < size - 1; i++) + { + for(j = i + 1; j < size; j++) + { + if(intersections[i][j].size() > 2) + { + ijs.push_back(make_pair(i, j)); + } + } + } + for(i = 0; i < ijs.size(); i++) + { + x = ijs[i].first; + y = ijs[i].second; + for(z = 0; z < intersections[x][y].size() - 2; z++) + { + for(z1 = z + 1; z1 < intersections[x][y].size() - 1; z1++) + { + for(z2 = z1 + 1; z2 < intersections[x][y].size(); z2++) + { + num1 = intersections[x][y][z]; + num2 = intersections[x][y][z1]; + num3 = intersections[x][y][z2]; + if(canBeConcatenated(num1, num2) && canBeConcatenated(num2, num3) && canBeConcatenated(num1, num3)) + { + list.clear(); + list.insert(primes[x]); + list.insert(primes[y]); + list.insert(num1); + list.insert(num2); + list.insert(num3); + lists.insert(list); + } + } + + } + } + } + set::iterator it2; + set >::iterator it1; + for(it1 = lists.begin(); it1 != lists.end(); it1++) + { + for(it2 = (*it1).begin(); it2 != (*it1).end(); it2++) + { + cout << *it2 << " "; + sum += *it2; + } + cout << endl; + } + cout << sum; + return 0; +} diff --git a/Project Euler/Project Euler 61.cpp b/Project Euler/Project Euler 61.cpp new file mode 100755 index 0000000..ffa9431 --- /dev/null +++ b/Project Euler/Project Euler 61.cpp @@ -0,0 +1,663 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n = 0, num = 0, i, j, k, l, m, num1, num2, num3, num4, num5, num6; + vector triangles, squares, pentagons, hexagons, heptagons, octagons, tmp; + while(num <= 1000) + { + n++; + num = (n*(n+1))/2; + } + while(num < 10000) + { + triangles.push_back(num); + n++; + num = (n*(n+1))/2; + } + + n = 0, num = 0; + while(num <= 1000) + { + n++; + num = n*n; + } + while(num < 10000) + { + squares.push_back(num); + n++; + num = n*n; + } + + n = 0, num = 0; + while(num <= 1000) + { + n++; + num = (n*(3*n - 1))/2; + } + while(num < 10000) + { + pentagons.push_back(num); + n++; + num = (n*(3*n - 1))/2; + } + + n = 0, num = 0; + while(num <= 1000) + { + n++; + num = n*(2*n-1); + } + while(num < 10000) + { + hexagons.push_back(num); + n++; + num = n*(2*n-1); + } + + n = 0, num = 0; + while(num <= 1000) + { + n++; + num = (n*(5*n-3))/2; + } + while(num < 10000) + { + heptagons.push_back(num); + n++; + num = (n*(5*n-3))/2; + } + + n = 0, num = 0; + while(num <= 1000) + { + n++; + num = (n*(3*n-2)); + } + while(num < 10000) + { + octagons.push_back(num); + n++; + num = (n*(3*n-2)); + } + + vector > list3, list4, list5, list6, list7, list8, listToSearch, list8o, chain; + for(i = 0; i < triangles.size(); i++) + { + for(j = 0; j < squares.size(); j++) + { + if(triangles[i] % 100 == squares[j]/100) + { + tmp.push_back(3); + tmp.push_back(4); + tmp.push_back(triangles[i]); + tmp.push_back(squares[j]); + list3.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < pentagons.size(); j++) + { + if(triangles[i] % 100 == pentagons[j]/100) + { + tmp.push_back(3); + tmp.push_back(5); + tmp.push_back(triangles[i]); + tmp.push_back(pentagons[j]); + + list3.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < hexagons.size(); j++) + { + if(triangles[i] % 100 == hexagons[j]/100) + { + tmp.push_back(3); + tmp.push_back(6); + tmp.push_back(triangles[i]); + tmp.push_back(hexagons[j]); + + list3.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < heptagons.size(); j++) + { + if(triangles[i] % 100 == heptagons[j]/100) + { + tmp.push_back(3); + tmp.push_back(7); + tmp.push_back(triangles[i]); + tmp.push_back(heptagons[j]); + list3.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < octagons.size(); j++) + { + if(triangles[i] % 100 == octagons[j]/100) + { + + tmp.push_back(3); + tmp.push_back(8); + tmp.push_back(triangles[i]); + tmp.push_back(octagons[j]); + list3.push_back(tmp); + tmp.clear(); + } + } + } + + for(i = 0; i < squares.size(); i++) + { + for(j = 0; j < triangles.size(); j++) + { + if(squares[i] % 100 == triangles[j]/100) + { + tmp.push_back(4); + tmp.push_back(3); + tmp.push_back(squares[i]); + tmp.push_back(triangles[j]); + list4.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < pentagons.size(); j++) + { + if(squares[i] % 100 == pentagons[j]/100) + { + tmp.push_back(4); + tmp.push_back(5); + tmp.push_back(squares[i]); + tmp.push_back(pentagons[j]); + + list4.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < hexagons.size(); j++) + { + if(squares[i] % 100 == hexagons[j]/100) + { + tmp.push_back(4); + tmp.push_back(6); + tmp.push_back(squares[i]); + tmp.push_back(hexagons[j]); + + list4.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < heptagons.size(); j++) + { + if(squares[i] % 100 == heptagons[j]/100) + { + tmp.push_back(4); + tmp.push_back(7); + tmp.push_back(squares[i]); + tmp.push_back(heptagons[j]); + list4.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < octagons.size(); j++) + { + if(squares[i] % 100 == octagons[j]/100) + { + + tmp.push_back(4); + tmp.push_back(8); + tmp.push_back(squares[i]); + tmp.push_back(octagons[j]); + list4.push_back(tmp); + tmp.clear(); + } + } + } + + for(i = 0; i < pentagons.size(); i++) + { + for(j = 0; j < squares.size(); j++) + { + if(pentagons[i] % 100 == squares[j]/100) + { + tmp.push_back(5); + tmp.push_back(4); + tmp.push_back(pentagons[i]); + tmp.push_back(squares[j]); + list5.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < triangles.size(); j++) + { + if(pentagons[i] % 100 == triangles[j]/100) + { + tmp.push_back(5); + tmp.push_back(3); + tmp.push_back(pentagons[i]); + tmp.push_back(triangles[j]); + + list5.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < hexagons.size(); j++) + { + if(pentagons[i] % 100 == hexagons[j]/100) + { + tmp.push_back(5); + tmp.push_back(6); + tmp.push_back(pentagons[i]); + tmp.push_back(hexagons[j]); + + list5.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < heptagons.size(); j++) + { + if(pentagons[i] % 100 == heptagons[j]/100) + { + tmp.push_back(5); + tmp.push_back(7); + tmp.push_back(pentagons[i]); + tmp.push_back(heptagons[j]); + list5.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < octagons.size(); j++) + { + if(pentagons[i] % 100 == octagons[j]/100) + { + + tmp.push_back(5); + tmp.push_back(8); + tmp.push_back(pentagons[i]); + tmp.push_back(octagons[j]); + list5.push_back(tmp); + tmp.clear(); + } + } + } + + for(i = 0; i < hexagons.size(); i++) + { + for(j = 0; j < squares.size(); j++) + { + if(hexagons[i] % 100 == squares[j]/100) + { + tmp.push_back(6); + tmp.push_back(4); + tmp.push_back(hexagons[i]); + tmp.push_back(squares[j]); + list6.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < pentagons.size(); j++) + { + if(hexagons[i] % 100 == pentagons[j]/100) + { + tmp.push_back(6); + tmp.push_back(5); + tmp.push_back(hexagons[i]); + tmp.push_back(pentagons[j]); + + list6.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < triangles.size(); j++) + { + if(hexagons[i] % 100 == triangles[j]/100) + { + tmp.push_back(6); + tmp.push_back(3); + tmp.push_back(hexagons[i]); + tmp.push_back(triangles[j]); + + list6.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < heptagons.size(); j++) + { + if(hexagons[i] % 100 == heptagons[j]/100) + { + tmp.push_back(6); + tmp.push_back(7); + tmp.push_back(hexagons[i]); + tmp.push_back(heptagons[j]); + list6.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < octagons.size(); j++) + { + if(hexagons[i] % 100 == octagons[j]/100) + { + + tmp.push_back(6); + tmp.push_back(8); + tmp.push_back(hexagons[i]); + tmp.push_back(octagons[j]); + list6.push_back(tmp); + tmp.clear(); + } + } + } + + for(i = 0; i < octagons.size(); i++) + { + for(j = 0; j < squares.size(); j++) + { + if(octagons[i] % 100 == squares[j]/100) + { + tmp.push_back(8); + tmp.push_back(4); + tmp.push_back(octagons[i]); + tmp.push_back(squares[j]); + list8.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < pentagons.size(); j++) + { + if(octagons[i] % 100 == pentagons[j]/100) + { + tmp.push_back(8); + tmp.push_back(5); + tmp.push_back(octagons[i]); + tmp.push_back(pentagons[j]); + + list8.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < hexagons.size(); j++) + { + if(octagons[i] % 100 == hexagons[j]/100) + { + tmp.push_back(8); + tmp.push_back(6); + tmp.push_back(octagons[i]); + tmp.push_back(hexagons[j]); + + list8.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < triangles.size(); j++) + { + if(octagons[i] % 100 == triangles[j]/100) + { + tmp.push_back(8); + tmp.push_back(3); + tmp.push_back(octagons[i]); + tmp.push_back(triangles[j]); + list8.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < heptagons.size(); j++) + { + if(octagons[i] % 100 == heptagons[j]/100) + { + + tmp.push_back(8); + tmp.push_back(7); + tmp.push_back(octagons[i]); + tmp.push_back(heptagons[j]); + list8.push_back(tmp); + tmp.clear(); + } + } + } + + for(i = 0; i < heptagons.size(); i++) + { + for(j = 0; j < squares.size(); j++) + { + if(heptagons[i] % 100 == squares[j]/100) + { + tmp.push_back(7); + tmp.push_back(4); + tmp.push_back(heptagons[i]); + tmp.push_back(squares[j]); + list7.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < pentagons.size(); j++) + { + if(heptagons[i] % 100 == pentagons[j]/100) + { + tmp.push_back(7); + tmp.push_back(5); + tmp.push_back(heptagons[i]); + tmp.push_back(pentagons[j]); + list7.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < hexagons.size(); j++) + { + if(heptagons[i] % 100 == hexagons[j]/100) + { + tmp.push_back(7); + tmp.push_back(6); + tmp.push_back(heptagons[i]); + tmp.push_back(hexagons[j]); + + list7.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < triangles.size(); j++) + { + if(heptagons[i] % 100 == triangles[j]/100) + { + tmp.push_back(7); + tmp.push_back(3); + tmp.push_back(heptagons[i]); + tmp.push_back(triangles[j]); + list7.push_back(tmp); + tmp.clear(); + } + } + for(j = 0; j < octagons.size(); j++) + { + if(heptagons[i] % 100 == octagons[j]/100) + { + + tmp.push_back(7); + tmp.push_back(8); + tmp.push_back(heptagons[i]); + tmp.push_back(octagons[j]); + list7.push_back(tmp); + tmp.clear(); + } + } + } + ll count = 0; + for(i = 0; i < list8.size(); i++) + { + num = list8[i][1]; + switch(num) + { + case 4: + listToSearch = list4; + break; + case 5: + listToSearch = list5; + break; + case 6: + listToSearch = list6; + break; + case 7: + listToSearch = list7; + break; + case 3: + listToSearch = list3; + break; + } + for(j = 0; j < listToSearch.size(); j++) + { + if(listToSearch[j][1] != 8 && list8[i][3] == listToSearch[j][2]) + { + tmp.push_back(8); + tmp.push_back(num); + tmp.push_back(listToSearch[j][1]); + tmp.push_back(list8[i][2]); + tmp.push_back(list8[i][3]); + tmp.push_back(listToSearch[j][3]); + list8o.push_back(tmp); + tmp.clear(); + } + } + } + for(i = 0; i < list8o.size(); i++) + { + num = list8o[i][2]; + switch(num) + { + case 4: + listToSearch = list4; + break; + case 5: + listToSearch = list5; + break; + case 6: + listToSearch = list6; + break; + case 7: + listToSearch = list7; + break; + case 3: + listToSearch = list3; + break; + } + for(j = 0; j < listToSearch.size(); j++) + { + if(listToSearch[j][1] != 8 && listToSearch[j][1] != list8o[i][1] && list8o[i][5] == listToSearch[j][2]) + { + tmp.push_back(8); + tmp.push_back(list8o[i][1]); + tmp.push_back(list8o[i][2]); + tmp.push_back(listToSearch[j][1]); + tmp.push_back(list8o[i][3]); + tmp.push_back(list8o[i][4]); + tmp.push_back(list8o[i][5]); + tmp.push_back(listToSearch[j][3]); + chain.push_back(tmp); + tmp.clear(); + } + } + } + list8o.clear(); + for(i = 0; i < chain.size(); i++) + { + num = chain[i][3]; + switch(num) + { + case 4: + listToSearch = list4; + break; + case 5: + listToSearch = list5; + break; + case 6: + listToSearch = list6; + break; + case 7: + listToSearch = list7; + break; + case 3: + listToSearch = list3; + break; + } + for(j = 0; j < listToSearch.size(); j++) + { + if(listToSearch[j][1] != 8 && listToSearch[j][1] != chain[i][1] && listToSearch[j][1] != chain[i][2] && chain[i][7] == listToSearch[j][2]) + { + tmp.push_back(8); + tmp.push_back(chain[i][1]); + tmp.push_back(chain[i][2]); + tmp.push_back(chain[i][3]); + tmp.push_back(listToSearch[j][1]); + tmp.push_back(chain[i][4]); + tmp.push_back(chain[i][5]); + tmp.push_back(chain[i][6]); + tmp.push_back(chain[i][7]); + tmp.push_back(listToSearch[j][3]); + list8o.push_back(tmp); + tmp.clear(); + } + } + } + chain.clear(); + for(i = 0; i < list8o.size(); i++) + { + num = list8o[i][4]; + switch(num) + { + case 4: + listToSearch = list4; + break; + case 5: + listToSearch = list5; + break; + case 6: + listToSearch = list6; + break; + case 7: + listToSearch = list7; + break; + case 3: + listToSearch = list3; + break; + } + for(j = 0; j < listToSearch.size(); j++) + { + if(listToSearch[j][1] != 8 && listToSearch[j][1] != list8o[i][1] && listToSearch[j][1] != list8o[i][2] && listToSearch[j][1] != list8o[i][3] && list8o[i][9] == listToSearch[j][2]) + { + tmp.push_back(8); + tmp.push_back(list8o[i][1]); + tmp.push_back(list8o[i][2]); + tmp.push_back(list8o[i][3]); + tmp.push_back(list8o[i][4]); + tmp.push_back(listToSearch[j][1]); + tmp.push_back(list8o[i][5]); + tmp.push_back(list8o[i][6]); + tmp.push_back(list8o[i][7]); + tmp.push_back(list8o[i][8]); + tmp.push_back(list8o[i][9]); + tmp.push_back(listToSearch[j][3]); + chain.push_back(tmp); + tmp.clear(); + } + } + } + ll sum = 0; + for(i = 0; i < chain.size(); i++) + { + for(j = 6; j < chain[i].size(); j++) + { + if(chain[i][11]%100 == chain[i][6]/100) + { + cout << chain[i][j] << " "; + sum += chain[i][j]; + } + } + } + cout << endl << sum; + return 0; +} diff --git a/Project Euler/Project Euler 62.cpp b/Project Euler/Project Euler 62.cpp new file mode 100755 index 0000000..9698659 --- /dev/null +++ b/Project Euler/Project Euler 62.cpp @@ -0,0 +1,51 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +string makeLargestPerm(ll num1) +{ + ll arr[10], i; + string temp = ""; + for(i = 0; i < 10; i++) + { + arr[i] = 0; + } + while(num1) + { + arr[num1%10]++; + num1/=10; + } + for(i = 9; i >= 0; i--) + { + while(arr[i]--) + { + temp+= char(i + '0'); + } + } + return temp; +} + +bool wayToSort(pair f, pair s){return f.first > s.first;} +const int M = 10000; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("output.out", "w", stdout); + ll i, j; + vector > perms; + for(i = 345; i < M-1; i++) + { + perms.push_back(make_pair(makeLargestPerm(i*i*i), i)); + } + sort(perms.begin(), perms.end(), wayToSort); + for(i = 0; i < perms.size() - 4; i++) + { + if(perms[i].first == perms[i+1].first && perms[i].first == perms[i+2].first && perms[i].first == perms[i+3].first && perms[i].first == perms[i+4].first) + { + cout << perms[i].second << " " << perms[i+1].second << " " << perms[i+2].second << " " << perms[i+3].second << " " << perms[i+4].second << endl; + } + } + return 0; +} diff --git a/Project Euler/Project Euler 63.cpp b/Project Euler/Project Euler 63.cpp new file mode 100755 index 0000000..2a51df7 --- /dev/null +++ b/Project Euler/Project Euler 63.cpp @@ -0,0 +1,22 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, count = 3, k; + for(i = 4; i < 10; i++) + { + k = 1; + while((ll)(log10(pow(i, k))) + 1 == k) + { + count++; + k++; + } + } + cout << count; + return 0; +} diff --git a/Project Euler/Project Euler 64.cpp b/Project Euler/Project Euler 64.cpp new file mode 100755 index 0000000..1edd92b --- /dev/null +++ b/Project Euler/Project Euler 64.cpp @@ -0,0 +1,50 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pii make_pair + +ll gcd(ll a, ll b) {return b ? gcd(b, a%b): a;} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, count = 0, root = 1, num, denom = 1, diff, period, outnum, temp; + set > tmp; + for(i = 2; i < 10000; i++) + { + if(sqrt(i) != (ll)(sqrt(i))) + { + num = i; + diff = outnum = root; + denom = i - (diff*diff); + period = 0; + while(tmp.count(pii(diff, denom)) == 0) + { + tmp.insert(pii(diff, denom)); + outnum = (root + diff)/denom; + diff = -(diff - denom*outnum); + num = denom; + denom = i - (diff*diff); + temp = gcd(num, denom); + if(temp != 1) + { + num /= temp; + denom /= temp; + } + period++; + } + tmp.clear(); + if(period&1) + { + count++; + } + } + else + { + root++; + } + } + cout << count; + return 0; +} diff --git a/Project Euler/Project Euler 65.cpp b/Project Euler/Project Euler 65.cpp new file mode 100755 index 0000000..4eee877 --- /dev/null +++ b/Project Euler/Project Euler 65.cpp @@ -0,0 +1,131 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pii make_pair + +string add_zeros(string str, ll n) +{ + while(n--) + { + str += '0'; + } + return str; +} + +string add(string num1, string num2) +{ + string sum = "", a, b; + ll i, summer, carry = 0; + a = string(num1.rbegin(), num1.rend()); + b = string(num2.rbegin(), num2.rend()); + if(a.length() > b.length()) + { + b = add_zeros(b, a.length()-b.length()); + } + else + { + a = add_zeros(a, b.length() - a.length()); + } + for(i = 0; i < min(a.length(), b.length()); i++) + { + summer = (ll)(a[i] + b[i] - 2*(ll)('0') + carry); + carry = 0; + if(summer > 9) + { + carry = summer/10; + summer%= 10; + } + sum += (char)(summer + '0'); + } + if(carry!=0) + { + sum += (char)(carry + '0'); + } + return string(sum.rbegin(), sum.rend()); +} +string multiply(string num1, string num2) +{ + string product, a, b; + ll i, j, holder, carry; + vector toAdd; + a = string(num1.rbegin(), num1.rend()); + b = string(num2.rbegin(), num2.rend()); + for(i = 0; i < a.length(); i++) + { + carry = 0; + product = ""; + for(j = 0; j < b.length(); j++) + { + holder = ((ll)(a[i] - '0') * (ll)(b[j] - '0') ) + carry; + carry = 0; + if(holder > 9) + { + carry = holder/10; + holder%=10; + } + product += (char)(holder+'0'); + } + if(carry!=0) + { + product += (char)(carry+'0'); + } + toAdd.push_back(string(product.rbegin(), product.rend())); + } + product = toAdd[0]; + for(i = 1; i < toAdd.size(); i++) + { + product = add(product, add_zeros(toAdd[i], i)); + } + return product; +} + +string numToString(ll num) +{ + ll i; + string str = ""; + while(num != 0) + { + str += (char)( (num%10) + '0'); + num/=10; + } + str = string(str.rbegin(), str.rend()); + return str; +} + +ll sumOfDigits(string str) +{ + ll sum = 0, i; + for(i = 0; i < str.length(); i++) + { + sum += str[i] - '0'; + } + return sum; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll counter = 3, temp, k = 2; + string frac1 = "3", frac2 = "8", next, prod; + while(counter < 100) + { + if(counter % 3 == 2) + { + k += 2; + temp = k; + } + else + { + temp = 1; + } + prod = multiply(frac2, numToString(temp)); + next = add(prod, frac1); + frac1 = frac2; + frac2 = next; + counter++; + } + cout << frac2 << endl; + cout << sumOfDigits(frac2); + return 0; +} diff --git a/Project Euler/Project Euler 66.cpp b/Project Euler/Project Euler 66.cpp new file mode 100755 index 0000000..72e870c --- /dev/null +++ b/Project Euler/Project Euler 66.cpp @@ -0,0 +1,16 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + /* + Diophantine Equations + Interestingly, this problem can be solved by expressing square roots of n as continued fractions and taking the minimum of the difference between squares of the numerator and product of n and the denominator. + This Problem needs a program which can handle very large numbers exceeding 2^64. When I tried implementing it with mathematical operations on strings it took too much time. + */ + return 0; +} diff --git a/Project Euler/Project Euler 67.cpp b/Project Euler/Project Euler 67.cpp new file mode 100755 index 0000000..f0a2329 --- /dev/null +++ b/Project Euler/Project Euler 67.cpp @@ -0,0 +1,56 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll stringToNum(string str) +{ + ll i, num = 0; + for(i = 0; i < str.length(); i++) + { + num += (ll)str[i] - '0'; + num*= 10; + } + return num/10; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ifstream file("triangle.txt"); + stringstream buffer; + buffer << file.rdbuf(); + string test = buffer.str(), tmp = ""; + vector > triangle; + vector line; + ll i , j; + for(i = 0; i < test.length(); i++) + { + if(test[i] == '\n') + { + line.push_back(stringToNum(tmp)); + tmp = ""; + triangle.push_back(line); + line.clear(); + } + else if(test[i] == ' ') + { + line.push_back(stringToNum(tmp)); + tmp = ""; + } + else + { + tmp += test[i]; + } + } + for(i = triangle.size()-2; i >= 0; i--) + { + for(j = 0; j < i+1; j++) + { + triangle[i][j] += max(triangle[i+1][j], triangle[i+1][j+1]); + } + } + cout << triangle[0][0]; + return 0; +} diff --git a/Project Euler/Project Euler 69.cpp b/Project Euler/Project Euler 69.cpp new file mode 100755 index 0000000..bdbab54 --- /dev/null +++ b/Project Euler/Project Euler 69.cpp @@ -0,0 +1,49 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll M = 100; +ll arr[101]; +vector primes; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } + primes.push_back(2); + for(i = 3; i <= M; i+=2) + { + if(arr[i]) + { + primes.push_back(i); + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll n, i = 0, maxN, lcm = 1; + while(lcm <= 1000000 && i < primes.size()) + { + lcm *= primes[i]; + i++; + } + cout << lcm/primes[i-1]; + return 0; +} diff --git a/Project Euler/Project Euler 7.cpp b/Project Euler/Project Euler 7.cpp new file mode 100755 index 0000000..37b8b1f --- /dev/null +++ b/Project Euler/Project Euler 7.cpp @@ -0,0 +1,41 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll M = 1000000; +ll arr[1000001]; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + vector primes; + for(ll i = 0; i <= M; i++) + { + if(arr[i]) + { + primes.push_back(i); + } + } + cout << primes[10000]; + return 0; +} diff --git a/Project Euler/Project Euler 70.cpp b/Project Euler/Project Euler 70.cpp new file mode 100755 index 0000000..7ea7576 --- /dev/null +++ b/Project Euler/Project Euler 70.cpp @@ -0,0 +1,93 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll M = 5000; +ll arr[5000]; +vector primes; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } + primes.push_back(2); + for(i = 3; i <= M; i+=2) + { + if(arr[i]) + { + primes.push_back(i); + } + } +} + +bool isPerm(ll num1, ll num2) +{ + ll arr[10], i; + for(i = 0; i < 10; i++) + { + arr[i] = 0; + } + while(num1) + { + arr[num1%10]++; + num1/=10; + } + while(num2) + { + arr[num2%10]--; + num2/=10; + } + for(i = 0; i < 10; i++) + { + if(arr[i] != 0) + { + return false; + } + } + return true; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll lim = sqrt(M), i, j, minN, tmp1, tmp2, phi, phiBest; + double minRatio = 1e4, ratio, n; + for(i = 0; i < primes.size() - 1; i++) + { + for(j = i + 1; j < primes.size(); j++) + { + n = ((double)primes[i]*primes[j]); + if(n > 1e7) + { + break; + } + phi = (primes[i]-1)*(primes[j]-1); + ratio = n/phi; + if(isPerm(n, phi) && ratio < minRatio) + { + minRatio = ratio; + minN = n; + phiBest = phi; + tmp1 = primes[i]; + tmp2 = primes[j]; + } + } + } + cout << minN << " " << phiBest << " " << tmp1 << " " << tmp2; + return 0; +} diff --git a/Project Euler/Project Euler 71.cpp b/Project Euler/Project Euler 71.cpp new file mode 100755 index 0000000..7b3d7c3 --- /dev/null +++ b/Project Euler/Project Euler 71.cpp @@ -0,0 +1,27 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll lim = 1000000, i, j, hcf, num = 0, denom = 1; + double test = 3.0/7, val; + for(i = lim; i > 2; i--) + { + val = (3*i - 1)/7; + if(val*denom > num*i) + { + denom = i; + num = val; + } + } + hcf = gcd(num, denom); + num/=hcf; + denom/=hcf; + cout << num << "/" << denom; + return 0; +} diff --git a/Project Euler/Project Euler 72.cpp b/Project Euler/Project Euler 72.cpp new file mode 100755 index 0000000..1a15dfb --- /dev/null +++ b/Project Euler/Project Euler 72.cpp @@ -0,0 +1,35 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll M = 1000000, sum = 0; +ll phi[1000001]; +void sieveOfEratosthenes() +{ + ll i, j; + for(i = 0; i <= M; i++) + { + phi[i] = i; + } + + for(i = 2; i <= M; i++) + { + if(phi[i] == i) + { + for(j = i; j <= M; j+=i) + { + phi[j] = (phi[j]*(i-1))/i; + } + } + sum += phi[i]; + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + cout << sum; + return 0; +} diff --git a/Project Euler/Project Euler 73.cpp b/Project Euler/Project Euler 73.cpp new file mode 100755 index 0000000..e943a4e --- /dev/null +++ b/Project Euler/Project Euler 73.cpp @@ -0,0 +1,29 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll limit = 12000, cnt = 0; +void countInRange(ll aNum, ll aDenom, ll bNum, ll bDenom) +{ + ll mediantNum = aNum+bNum, mediantDenom = aDenom + bDenom; + if(mediantDenom > limit) + { + return; + } + else + { + cnt++; + countInRange(mediantNum, mediantDenom, bNum, bDenom); + countInRange(aNum, aDenom, mediantNum, mediantDenom); + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll aNum = 1, aDenom = 3, bNum = 1, bDenom = 2; + countInRange(aNum, aDenom, bNum, bDenom); + cout << cnt; + return 0; +} diff --git a/Project Euler/Project Euler 74.cpp b/Project Euler/Project Euler 74.cpp new file mode 100755 index 0000000..04ca9d0 --- /dev/null +++ b/Project Euler/Project Euler 74.cpp @@ -0,0 +1,92 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll M = 1000000; +ll factorials[] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880}; +ll digitFactorialSum(ll num) +{ + ll sum = 0; + while(num) + { + sum += factorials[num%10]; + num/=10; + } + return sum; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i, tmp, ch, sz, j; + vector > chains; + vector nums, loop1, loop2, loop3; + loop1.push_back(169); + loop1.push_back(1454); + loop1.push_back(363601); + + loop2.push_back(871); + loop2.push_back(45361); + + loop3.push_back(872); + loop3.push_back(45362); + for(i = 70; i < M; i++) + { + vector nums; + tmp = i; + while(true) + { + if(binary_search(loop1.begin(), loop1.end(), tmp)) + { + ch = 1; + break; + } + else if(binary_search(loop2.begin(), loop2.end(), tmp)) + { + ch = 2; + break; + } + else if(binary_search(loop3.begin(), loop3.end(), tmp)) + { + ch = 3; + break; + } + else if(tmp == 145 || tmp == 2 || tmp == 40585) + { + ch = 4; + break; + } + else + { + ch = 0; + nums.push_back(tmp); + tmp = digitFactorialSum(tmp); + } + } + nums.push_back(tmp); + if(ch == 1) + { + tmp = digitFactorialSum(tmp); + nums.push_back(tmp); + tmp = digitFactorialSum(tmp); + nums.push_back(tmp); + } + else if(ch == 4 || ch == 5) + { + tmp++; tmp--; + } + else + { + tmp = digitFactorialSum(tmp); + nums.push_back(tmp); + } + sz = nums.size(); + if(sz == 60) + { + chains.push_back(nums); + } + } + cout << chains.size(); + return 0; +} diff --git a/Project Euler/Project Euler 75.cpp b/Project Euler/Project Euler 75.cpp new file mode 100755 index 0000000..eba0564 --- /dev/null +++ b/Project Euler/Project Euler 75.cpp @@ -0,0 +1,38 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll gcd(ll a, ll b){return b ? gcd(b, a%b) : a;} +ll const limit = 1500000; +ll triples[limit+1]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll count = 0, m, n, a, b, c, sum; + for(m = 2; m < sqrt(limit/2); m++) + { + for(n = 1; n < m; n++) + { + if((m+n)%2 == 1 && gcd(m, n) == 1) + { + a = m*m - n*n; + b = 2*m*n; + c = m*m + n*n; + sum = a + b + c; + while(sum <= limit) + { + triples[sum]++; + if(triples[sum] == 1) + count++; + if(triples[sum] == 2) + count--; + sum += a + b + c; + } + } + } + } + cout << count; + return 0; +} diff --git a/Project Euler/Project Euler 76.cpp b/Project Euler/Project Euler 76.cpp new file mode 100755 index 0000000..17d85f9 --- /dev/null +++ b/Project Euler/Project Euler 76.cpp @@ -0,0 +1,43 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +// Alternative soln : Problem 31. +ll partitions(ll n, ll k) +{ + ll i, j; + ll partitionTable[n+1][k+1]; + for(i = 0; i <= n; i++) + { + for(j = 0; j <= k; j++) + { + if(j == 0 ) + { + partitionTable[i][j] = 0; + } + else if(i == 0) + { + partitionTable[i][j] = 1; + } + else if(j > i) + { + partitionTable[i][j] = partitionTable[i][j-1]; + } + else + { + partitionTable[i][j] = partitionTable[i][j-1] + partitionTable[i - j][j]; + } + } + } + return partitionTable[n][k]; +} +int main() +{ + ios_base::sync_with_stdio(false); + cout << "Which number do you want to partition bro? "; + ll n; + cin >> n; + cout << n << " has " << partitions(n, n-1) << " partitions."; + return 0; +} diff --git a/Project Euler/Project Euler 77.cpp b/Project Euler/Project Euler 77.cpp new file mode 100755 index 0000000..9b0a16f --- /dev/null +++ b/Project Euler/Project Euler 77.cpp @@ -0,0 +1,65 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll M = 10000; +ll arr[10001]; +vector primes; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } + primes.push_back(2); + for(i = 3; i <= M; i+=2) + { + if(arr[i]) + { + primes.push_back(i); + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll num = 10, i, j; + while(true) + { + ll ways[num+1]; + for(i = 0; i <= num; i++) + { + ways[i] = 0; + } + ways[0] = 1; + for(i = 0; primes[i] <= num; i++) + { + for(j = primes[i]; j <= num; j++) + { + ways[j] += ways[j - primes[i]]; + } + } + if(ways[num] > 5000) + { + break; + } + num++; + } + cout << num; + return 0; +} diff --git a/Project Euler/Project Euler 78.cpp b/Project Euler/Project Euler 78.cpp new file mode 100755 index 0000000..8c168f4 --- /dev/null +++ b/Project Euler/Project Euler 78.cpp @@ -0,0 +1,51 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +const ll limit = 100000; +ll partitionsArr[limit+1]; +ll partitions(ll num, ll mod) +{ + ll i, partition, k, n, sign; + partitionsArr[0] = partitionsArr[1] = 1; + for(i = 2; i <= num; i++) + { + sign = 1; + partition = 0; + n = 1; + k = (3*n*n-n)/2; + while(k <= i) + { + partition = (partition + sign * partitionsArr[i - k]) % mod; + n = -n; + k = (3*n*n-n)/2; + if(k <= i) + { + partition = (partition + sign * partitionsArr[i - k]) % mod; + n = -n + 1; + } + sign = -sign; + k = (3*n*n-n)/2; + } + partitionsArr[i] = partition; + } + return partitionsArr[num]; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i = 100, mod = 1000000; + partitions(limit, mod); + while(true) + { + if(partitionsArr[i] % mod == 0) + { + break; + } + i++; + } + cout << i; + return 0; +} diff --git a/Project Euler/Project Euler 79.cpp b/Project Euler/Project Euler 79.cpp new file mode 100755 index 0000000..051946f --- /dev/null +++ b/Project Euler/Project Euler 79.cpp @@ -0,0 +1,50 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + freopen("output.out", "w", stdout); + ifstream file("keylog.txt"); + stringstream buffer; + buffer << file.rdbuf(); + string test = buffer.str(), tmp = ""; + vector keylogs; + ll i, countFirst[10], countSecond[10], countThird[10]; + for(i = 0; i < 10; i++) + { + countFirst[i] = 0; + countSecond[i] = 0; + countThird[i] = 0; + } + for(i = 0; i < test.length(); i++) + { + if(test[i] == '\n') + { + keylogs.push_back(tmp); + tmp = ""; + } + else + { + tmp += test[i]; + } + } + keylogs.push_back(tmp); + for(i = 0; i < keylogs.size(); i++) + { + countFirst[keylogs[i][0] - '0']++; + countSecond[keylogs[i][1] - '0']++; + countThird[keylogs[i][2] - '0']++; + } + for(i = 0; i < 10; i++) + { + cout << "For " << i << endl << "There are " << countFirst[i] << " occurences at first pos" << endl; + cout << "There are " << countSecond[i] << " occurences at second pos" << endl; + cout << "There are " << countThird[i] << " occurences at third pos" << endl; + } + //From the output, I logically deduced the key was 73162890. + return 0; +} diff --git a/Project Euler/Project Euler 8.cpp b/Project Euler/Project Euler 8.cpp new file mode 100755 index 0000000..4a600a1 --- /dev/null +++ b/Project Euler/Project Euler 8.cpp @@ -0,0 +1,31 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll charToNum(char c) +{ + return (ll)(c - '0'); +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll i,j, k, maxProduct = 1, product; + cin >> k; + string num = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450" ; + for(i = 0; i < num.length() - k + 1; i++) + { + product = 1; + for(j = i; j < i + k; j++) + { + if(num[j] == '0') + { + break; + } + product *= charToNum(num[j]); + } + maxProduct = max(maxProduct, product); + } + cout << maxProduct; + return 0; +} diff --git a/Project Euler/Project Euler 80.cpp b/Project Euler/Project Euler 80.cpp new file mode 100755 index 0000000..3bc0e95 --- /dev/null +++ b/Project Euler/Project Euler 80.cpp @@ -0,0 +1,212 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +string add_zeros(string str, ll n) +{ + while(n--) + { + str += '0'; + } + return str; +} +string add(string num1, string num2) +{ + string sum = "", a, b; + ll i, summer, carry = 0; + a = string(num1.rbegin(), num1.rend()); + b = string(num2.rbegin(), num2.rend()); + if(a.length() > b.length()) + { + b = add_zeros(b, a.length()-b.length()); + } + else + { + a = add_zeros(a, b.length() - a.length()); + } + for(i = 0; i < min(a.length(), b.length()); i++) + { + summer = (ll)(a[i] + b[i] - 2*(ll)('0') + carry); + carry = 0; + if(summer > 9) + { + carry = summer/10; + summer%= 10; + } + sum += (char)(summer + '0'); + } + if(carry!=0) + { + sum += (char)(carry + '0'); + } + return string(sum.rbegin(), sum.rend()); +} +string multiply(string num1, string num2) +{ + string product, a, b; + ll i, j, holder, carry; + vector toAdd; + a = string(num1.rbegin(), num1.rend()); + b = string(num2.rbegin(), num2.rend()); + for(i = 0; i < a.length(); i++) + { + carry = 0; + product = ""; + for(j = 0; j < b.length(); j++) + { + holder = ((ll)(a[i] - '0') * (ll)(b[j] - '0') ) + carry; + carry = 0; + if(holder > 9) + { + carry = holder/10; + holder%=10; + } + product += (char)(holder+'0'); + } + if(carry!=0) + { + product += (char)(carry+'0'); + } + toAdd.push_back(string(product.rbegin(), product.rend())); + } + product = toAdd[0]; + for(i = 1; i < toAdd.size(); i++) + { + product = add(product, add_zeros(toAdd[i], i)); + } + return product; +} +string remove_zeros(string n) +{ + ll pos = n.length()-1, i; + string temp = ""; + while(pos >= 0 && n[pos] == '0') + { + pos--; + } + for(i = 0; i <= pos; i++) + { + temp += n[i]; + } + return temp; +} +string subtract(string num1, string num2) +{ + string a, b, diff = ""; + ll i, holder, carry; + reverse(num1.begin(), num1.end()); + reverse(num2.begin(), num2.end()); + if(num1.length() > num2.length()) + { + num2 = add_zeros(num2, num1.length()-num2.length()); + } + else + { + num1 = add_zeros(num1, num2.length() - num1.length()); + } + carry = 0; + for(i = 0; i < num1.length(); i++) + { + holder = (ll)(num1[i] - num2[i] + carry); + carry = 0; + if(holder < 0) + { + holder += 10; + carry = -1; + } + diff += (char)(holder + '0'); + } + diff = remove_zeros(diff); + return string(diff.rbegin(), diff.rend()); +} +ll stringToNum(string str) +{ + ll i, num = 0; + for(i = 0; i < str.length(); i++) + { + num += (ll)str[i] - '0'; + num*= 10; + } + return num/10; +} +string numToString(ll num) +{ + ll i; + string str = ""; + while(num != 0) + { + str += (char)( (num%10) + '0'); + num/=10; + } + str = string(str.rbegin(), str.rend()); + return str; +} +bool isGreaterThan(string num1, string num2) +{ + if(num1.length() > num2.length()) + { + return true; + } + else if(num2.length() > num1.length()) + { + return false; + } + return num1 > num2; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("output.out", "w", stdout); + string num, digits, tmp, diff, prod; + ll i = 1, j, sum = 0, counter; + for(counter = 2; counter < 100; counter++) + { + if((ll)sqrt(counter)*(ll)sqrt(counter) == counter) + { + continue; + } + num = numToString(counter); + digits = ""; + i = 1; + bool didNotBreak; + while(i*i < stringToNum(num)) + { + i++; + } + i--; + num = subtract(num, numToString(i*i)); + digits += (char)(i+'0'); + while(digits.length() < 100) + { + num = add_zeros(num, 2); + tmp = multiply(digits, "20"); + didNotBreak = true; + for(j = 1; j < 10; j++) + { + tmp[tmp.length()-1] = (char)(j + '0'); + prod = multiply(tmp, numToString(tmp[tmp.length()-1] - '0')); + if(isGreaterThan(prod, num)) + { + didNotBreak = false; + break; + } + } + j--; + if(!didNotBreak) + { + tmp[tmp.length()-1] = (char)(j + '0'); + prod = multiply(tmp, numToString(tmp[tmp.length()-1] - '0')); + } + digits += (char)(j + '0'); + num = subtract(num, prod); + } + for(i = 0; i < digits.length(); i++) + { + sum += digits[i] - '0'; + } + } + cout << sum; + return 0; +} diff --git a/Project Euler/Project Euler 81.cpp b/Project Euler/Project Euler 81.cpp new file mode 100755 index 0000000..686f2c7 --- /dev/null +++ b/Project Euler/Project Euler 81.cpp @@ -0,0 +1,61 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll stringToNum(string str) +{ + ll i, num = 0; + for(i = 0; i < str.length(); i++) + { + num += (ll)str[i] - '0'; + num*= 10; + } + return num/10; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ifstream file("matrix.txt"); + stringstream buffer; + buffer << file.rdbuf(); + string test = buffer.str(), tmp = ""; + ll i, j; + vector > grid; + vector line; + for(i = 0; i < test.length(); i++) + { + if(test[i] == ',') + { + line.push_back(stringToNum(tmp)); + tmp = ""; + } + else if(test[i] == '\n') + { + line.push_back(stringToNum(tmp)); + tmp = ""; + grid.push_back(line); + line.clear(); + } + else + { + tmp += test[i]; + } + } + j = grid.size()-1; + for(i = grid.size()-2; i >= 0; i--) + { + grid[i][j] += grid[i+1][j]; + grid[j][i] += grid[j][i+1]; + } + for(i = grid.size()-2; i >= 0; i--) + { + for(j = grid[i].size()-2; j >= 0; j--) + { + grid[i][j] += min(grid[i+1][j], grid[i][j+1]); + } + } + cout << grid[0][0]; + return 0; +} diff --git a/Project Euler/Project Euler 82.cpp b/Project Euler/Project Euler 82.cpp new file mode 100755 index 0000000..0b3f59c --- /dev/null +++ b/Project Euler/Project Euler 82.cpp @@ -0,0 +1,72 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll stringToNum(string str) +{ + ll i, num = 0; + for(i = 0; i < str.length(); i++) + { + num += (ll)str[i] - '0'; + num*= 10; + } + return num/10; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ifstream file("matrix.txt"); + stringstream buffer; + buffer << file.rdbuf(); + string test = buffer.str(), tmp = ""; + vector > grid; + vector line; + ll i, j, minSum = INT_MAX; + for(i = 0; i < test.length(); i++) + { + if(test[i] == ',') + { + line.push_back(stringToNum(tmp)); + tmp = ""; + } + else if(test[i] == '\n') + { + line.push_back(stringToNum(tmp)); + tmp = ""; + grid.push_back(line); + line.clear(); + } + else + { + tmp += test[i]; + } + } + ll soln[grid.size()]; + for(i = 0; i < grid.size(); i++) + { + soln[i] = grid[i][grid.size()-1]; + } + for(i = grid.size()-2; i >= 0; i--) + { + soln[0] += grid[0][i]; + //Go Down + for(j = 1; j < grid.size(); j++) + { + soln[j] = min(soln[j-1] + grid[j][i], soln[j] + grid[j][i]); + } + + // Go Up + for(j = grid.size()-2; j >= 0; j--) + { + soln[j] = min(soln[j], soln[j+1] + grid[j][i]); + } + } + for(i = 0; i < grid.size(); i++) + { + minSum = min(minSum, soln[i]); + } + cout << minSum; + return 0; +} diff --git a/Project Euler/Project Euler 83.cpp b/Project Euler/Project Euler 83.cpp new file mode 100755 index 0000000..3cd70fa --- /dev/null +++ b/Project Euler/Project Euler 83.cpp @@ -0,0 +1,100 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pii make_pair + +ll stringToNum(string str) +{ + ll i, num = 0; + for(i = 0; i < str.length(); i++) + { + num += (ll)str[i] - '0'; + num*= 10; + } + return num/10; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ifstream file("matrix.txt"); + stringstream buffer; + buffer << file.rdbuf(); + string test = buffer.str(), tmp = ""; + vector > grid; + vector line; + ll i, j, minSum = INT_MAX, newI, newJ, newCost; + for(i = 0; i < test.length(); i++) + { + if(test[i] == ',') + { + line.push_back(stringToNum(tmp)); + tmp = ""; + } + else if(test[i] == '\n') + { + line.push_back(stringToNum(tmp)); + tmp = ""; + grid.push_back(line); + line.clear(); + } + else + { + tmp += test[i]; + } + } + map, ll> cost_so_far; + map, bool> visited; + map, pair > came_from; + priority_queue >, vector > >, greater > > > frontier; + frontier.push(pii(grid[0][0], pii(0, 0))); + came_from[pii(0, 0)] = pii(-1, -1); + cost_so_far[pii(0, 0)] = grid[0][0]; + visited[pii(0, 0)] = true; + while(!frontier.empty()) + { + pair > current = frontier.top(); + visited[current.second] = true; + frontier.pop(); + if(current.second.first == grid.size()-1 && current.second.first == current.second.second) + { + break; + } + for(i = 0; i < 4; i++) + { + switch(i) + { + case 0: + newI = current.second.first-1; + newJ = current.second.second; + break; + case 1: + newI = current.second.first; + newJ = current.second.second+1; + break; + case 2: + newI = current.second.first+1; + newJ = current.second.second; + break; + case 3: + newI = current.second.first; + newJ = current.second.second - 1; + break; + } + if(newI >= 0 && newI < grid.size() && newJ >= 0 && newJ < grid.size()) + { + newCost = cost_so_far[current.second] + grid[newI][newJ]; + if((cost_so_far[pii(newI, newJ)] == 0 || newCost < cost_so_far[pii(newI, newJ)]) && !visited[pii(newI, newJ)]) + { + cost_so_far[pii(newI, newJ)] = newCost; + frontier.push(pii(newCost, pii(newI, newJ))); + came_from[pii(newI, newJ)] = current.second; + } + } + } + } + cout << cost_so_far[pii(grid.size()-1, grid.size()-1)]; + return 0; +} diff --git a/Project Euler/Project Euler 9.cpp b/Project Euler/Project Euler 9.cpp new file mode 100755 index 0000000..61ca0bd --- /dev/null +++ b/Project Euler/Project Euler 9.cpp @@ -0,0 +1,24 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll a, b, c, i, j; + double k; + for(i = 2; i < 1000/3; i++) + { + for(j = i; j < 1000/2; j++) + { + k = sqrt( (i*i) + (j*j) ); + if(k == floor(k) && (i + j + k == 1000)) + { + a = i; b = j; c = (ll)k; + } + } + } + cout << a*b*c; + return 0; +} diff --git a/Project Euler/cipher.txt b/Project Euler/cipher.txt new file mode 100755 index 0000000..c3ce21e --- /dev/null +++ b/Project Euler/cipher.txt @@ -0,0 +1 @@ +79,59,12,2,79,35,8,28,20,2,3,68,8,9,68,45,0,12,9,67,68,4,7,5,23,27,1,21,79,85,78,79,85,71,38,10,71,27,12,2,79,6,2,8,13,9,1,13,9,8,68,19,7,1,71,56,11,21,11,68,6,3,22,2,14,0,30,79,1,31,6,23,19,10,0,73,79,44,2,79,19,6,28,68,16,6,16,15,79,35,8,11,72,71,14,10,3,79,12,2,79,19,6,28,68,32,0,0,73,79,86,71,39,1,71,24,5,20,79,13,9,79,16,15,10,68,5,10,3,14,1,10,14,1,3,71,24,13,19,7,68,32,0,0,73,79,87,71,39,1,71,12,22,2,14,16,2,11,68,2,25,1,21,22,16,15,6,10,0,79,16,15,10,22,2,79,13,20,65,68,41,0,16,15,6,10,0,79,1,31,6,23,19,28,68,19,7,5,19,79,12,2,79,0,14,11,10,64,27,68,10,14,15,2,65,68,83,79,40,14,9,1,71,6,16,20,10,8,1,79,19,6,28,68,14,1,68,15,6,9,75,79,5,9,11,68,19,7,13,20,79,8,14,9,1,71,8,13,17,10,23,71,3,13,0,7,16,71,27,11,71,10,18,2,29,29,8,1,1,73,79,81,71,59,12,2,79,8,14,8,12,19,79,23,15,6,10,2,28,68,19,7,22,8,26,3,15,79,16,15,10,68,3,14,22,12,1,1,20,28,72,71,14,10,3,79,16,15,10,68,3,14,22,12,1,1,20,28,68,4,14,10,71,1,1,17,10,22,71,10,28,19,6,10,0,26,13,20,7,68,14,27,74,71,89,68,32,0,0,71,28,1,9,27,68,45,0,12,9,79,16,15,10,68,37,14,20,19,6,23,19,79,83,71,27,11,71,27,1,11,3,68,2,25,1,21,22,11,9,10,68,6,13,11,18,27,68,19,7,1,71,3,13,0,7,16,71,28,11,71,27,12,6,27,68,2,25,1,21,22,11,9,10,68,10,6,3,15,27,68,5,10,8,14,10,18,2,79,6,2,12,5,18,28,1,71,0,2,71,7,13,20,79,16,2,28,16,14,2,11,9,22,74,71,87,68,45,0,12,9,79,12,14,2,23,2,3,2,71,24,5,20,79,10,8,27,68,19,7,1,71,3,13,0,7,16,92,79,12,2,79,19,6,28,68,8,1,8,30,79,5,71,24,13,19,1,1,20,28,68,19,0,68,19,7,1,71,3,13,0,7,16,73,79,93,71,59,12,2,79,11,9,10,68,16,7,11,71,6,23,71,27,12,2,79,16,21,26,1,71,3,13,0,7,16,75,79,19,15,0,68,0,6,18,2,28,68,11,6,3,15,27,68,19,0,68,2,25,1,21,22,11,9,10,72,71,24,5,20,79,3,8,6,10,0,79,16,8,79,7,8,2,1,71,6,10,19,0,68,19,7,1,71,24,11,21,3,0,73,79,85,87,79,38,18,27,68,6,3,16,15,0,17,0,7,68,19,7,1,71,24,11,21,3,0,71,24,5,20,79,9,6,11,1,71,27,12,21,0,17,0,7,68,15,6,9,75,79,16,15,10,68,16,0,22,11,11,68,3,6,0,9,72,16,71,29,1,4,0,3,9,6,30,2,79,12,14,2,68,16,7,1,9,79,12,2,79,7,6,2,1,73,79,85,86,79,33,17,10,10,71,6,10,71,7,13,20,79,11,16,1,68,11,14,10,3,79,5,9,11,68,6,2,11,9,8,68,15,6,23,71,0,19,9,79,20,2,0,20,11,10,72,71,7,1,71,24,5,20,79,10,8,27,68,6,12,7,2,31,16,2,11,74,71,94,86,71,45,17,19,79,16,8,79,5,11,3,68,16,7,11,71,13,1,11,6,1,17,10,0,71,7,13,10,79,5,9,11,68,6,12,7,2,31,16,2,11,68,15,6,9,75,79,12,2,79,3,6,25,1,71,27,12,2,79,22,14,8,12,19,79,16,8,79,6,2,12,11,10,10,68,4,7,13,11,11,22,2,1,68,8,9,68,32,0,0,73,79,85,84,79,48,15,10,29,71,14,22,2,79,22,2,13,11,21,1,69,71,59,12,14,28,68,14,28,68,9,0,16,71,14,68,23,7,29,20,6,7,6,3,68,5,6,22,19,7,68,21,10,23,18,3,16,14,1,3,71,9,22,8,2,68,15,26,9,6,1,68,23,14,23,20,6,11,9,79,11,21,79,20,11,14,10,75,79,16,15,6,23,71,29,1,5,6,22,19,7,68,4,0,9,2,28,68,1,29,11,10,79,35,8,11,74,86,91,68,52,0,68,19,7,1,71,56,11,21,11,68,5,10,7,6,2,1,71,7,17,10,14,10,71,14,10,3,79,8,14,25,1,3,79,12,2,29,1,71,0,10,71,10,5,21,27,12,71,14,9,8,1,3,71,26,23,73,79,44,2,79,19,6,28,68,1,26,8,11,79,11,1,79,17,9,9,5,14,3,13,9,8,68,11,0,18,2,79,5,9,11,68,1,14,13,19,7,2,18,3,10,2,28,23,73,79,37,9,11,68,16,10,68,15,14,18,2,79,23,2,10,10,71,7,13,20,79,3,11,0,22,30,67,68,19,7,1,71,8,8,8,29,29,71,0,2,71,27,12,2,79,11,9,3,29,71,60,11,9,79,11,1,79,16,15,10,68,33,14,16,15,10,22,73 diff --git a/Project Euler/gmon.out b/Project Euler/gmon.out new file mode 100755 index 0000000000000000000000000000000000000000..4965583d37da8e88ab17c2c4ee5ed9881bd9279a GIT binary patch literal 243252 zcmeI*Pl%Ld9KiA4PTIjb82;H+m+&x#&}AHU-#M&@s2~qs!cBq>Nf%cXPeBXb z#DjP!nw$RD=grw? zuSchU^lanSAD!|x6}Y&y6LULyQ6<5z*{^+BMfne7J0}Od)QUL1trL5;bo%S3v&(#$xs(0r zS5;j2u@%$XM?GKn8!N3?Y;^4C#MilRSwE0nes?zaIo{}{>_0y0#mf z_r~0--FPYIJNNd+)Q7z&>+h`V_Sd)O`a<^W`B_-RN(!|J>H=&wSrlznneXr=9zqe776r47;=E@*Jh7TC?$6p1bUSF?%_CL-yg% zs`TphXBN&?u`l=PpCS9 z+ogFNN;dw^{la!Bzj7CC1bdObv;nm*Ejhk$ceoG~2nqxRf&xK-pum4Y0nFLl;_I#r z$Dlw^ASiIA0P917oozL5C$81ffrCB*pq;~I-EfZQ0JTZ-wwkvS*QzNn-P1#qn@0H~ zM&!)#d&1k%R`Yh^T4yeiGnXj$9OX|ak$Q(+qPI&_b!|8X1%d(>72vb`hjL$<_;d@; z?=8t>h$s0bM&hoF)xPI?+xle;Go;VzWJwaI1^b_)MH73+Q@Ns zU_XYRkq;%>FF|SJtwIKbAwFHaS!jV#Lk4o1R-NXGYL^6c$6#NtH9c3~Cw-mqj%h4iov1kj5Mi!|?(F97lqTmt5hR4US?1Q`W zoPooSu+8KYXAgij)U!QYVSGLOc36%~P6gyxwqRd}y`RYw!(?5)R2A6^Jy?!ZiCf@N zyk3f?-YwcPtjL-Ddkg0SrDm3)k zY#uKRk66A!3^lnkgM+<)0g5sD5xjGhrM{fu_`ZD4c)9^gYL>y?Wm^IT#+s2FE1o(L zVT2cOR^(glv$p2YH&8sq7#-r+kYCHAP%h65mro4_V{z{wsU53NTQyF=vyWd=>~9&f za;^;L!sIj(OH$H>~0$XTZ)oVd5&)8zrS1rmiP&ik%@S(=cBjWhi6^J~J4UZKdxGFI~>_p%Q z<+x%6_2y#%V=c$v`slpQk{8!m(;8fg#h!?t7(VO3IysAHnisXR+}X#OcW#KFPXTQa z_1dk}+{%KCW@bhF+Hl!8vwm}Cn(8!rrA0OtZxwj#odeCX2GrWsemg--*{u2Q+GE3N zO;K9FVUHiE?fHt7ar)QBU{t`06|0Nf_4dxS7smHI?k8KWIXPly(Ah`E695fEJ6=eXnAhxLM)L5y=H z_jI1{;xcn9&kQpx^}`kvct;et?06=8|Np@M|NlD@O`sVR2nzfY1){m_+V&PKBab!T zwI|qr!Oo5MO8c_fM literal 0 HcmV?d00001 diff --git a/SPOJ/Adding Reversed Numbers.cpp b/SPOJ/Adding Reversed Numbers.cpp new file mode 100755 index 0000000..3b7ceb5 --- /dev/null +++ b/SPOJ/Adding Reversed Numbers.cpp @@ -0,0 +1,29 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll reversed(ll n) +{ + ll num = 0; + while(n > 0) + { + num = num * 10 + n % 10; + n /=10; + } + return num; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n; + cin >> n; + while(n--) + { + ll a, b; + cin >> a >> b; + cout << reversed(reversed(a) + reversed(b)) << endl; + } + return 0; +} diff --git a/SPOJ/Advanced Fruits.cpp b/SPOJ/Advanced Fruits.cpp new file mode 100755 index 0000000..78392ac --- /dev/null +++ b/SPOJ/Advanced Fruits.cpp @@ -0,0 +1,36 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +string findShortest(string f1, string f2) +{ + string set1, set2; + ll i, j; + for(i = 0; i < max(f1.length(), f2.length()); i++) + { + if(i < f1.length()) + set1 += '0'; + if(i < f2.length()) + set2 += '0'; + } + for(i = 0; i < f1.length(); i++) + { + for(j = 0; j < f2.length(); j++) + { + + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + string f1, f2; + while(scanf("%s",&f1) != EOF) + { + cin >> f2; + cout << findShortest(f1, f2) << endl; + } + return 0; +} diff --git a/SPOJ/Aggressive cows.cpp b/SPOJ/Aggressive cows.cpp new file mode 100755 index 0000000..d1b7ce4 --- /dev/null +++ b/SPOJ/Aggressive cows.cpp @@ -0,0 +1,56 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +bool canBePlaced(ll stalls[], ll n, ll cows, ll dist) +{ + ll lastPos = 0, cowsPlaced = 1, i; + for(i = 1; i < n; i++) + { + if(stalls[i] - stalls[lastPos] >= dist) + { + cowsPlaced++; + lastPos = i; + } + if(cowsPlaced == cows) + { + return true; + } + } + return false; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, c, i, low, high, mid; + cin >> n >> c; + ll stalls[n]; + for(i = 0; i < n; i++) + { + cin >> stalls[i]; + } + sort(stalls, stalls+n); + low = 0, high = stalls[n-1] - stalls[0]; + while(low + 1 < high) + { + mid = (low+high)/2; + if(canBePlaced(stalls, n, c, mid)) + { + low = mid; + } + else + { + high = mid; + } + } + cout << low << endl; + } + return 0; +} diff --git a/SPOJ/Aibohphobia.cpp b/SPOJ/Aibohphobia.cpp new file mode 100755 index 0000000..ac17e3d --- /dev/null +++ b/SPOJ/Aibohphobia.cpp @@ -0,0 +1,51 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll lcs[6111][6111]; +ll minChars(string s) +{ + ll i, j, len = s.length(); + for(i = 0; i <= s.length(); i++) + { + for(j = 0; j <= s.length(); j++) + { + lcs[i][j] = 0; + } + } + string rev = string(s.rbegin(), s.rend()); + for(i = 0; i <= len; i++) + { + for(j = 0; j <= len; j++) + { + if(i == 0 || j == 0) + { + lcs[i][j] = 0; + } + else if(s[i-1] != rev[j-1]) + { + lcs[i][j] = max(lcs[i-1][j], lcs[i][j-1]); + } + else + { + lcs[i][j] = 1 + lcs[i-1][j-1]; + } + } + } + return len - lcs[len][len]; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + string s; + cin >> s; + cout << minChars(s) << endl; + } + return 0; +} diff --git a/SPOJ/Aliens at the train.cpp b/SPOJ/Aliens at the train.cpp new file mode 100755 index 0000000..662760e --- /dev/null +++ b/SPOJ/Aliens at the train.cpp @@ -0,0 +1,52 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define INF 9999999999 +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll at, bt, i, curr = 0, minSum = INF, maxI = 0, prev, st; + cin >> at >> bt; + ll arr[at]; + for(i = 0; i < at; i++) + { + cin >> arr[i]; + } + prev = 0; st = 0; + for(i = 0; i < at; i++) + { + if(bt >= curr + arr[i]) + { + curr += arr[i]; + st++; + } + else + { + curr += arr[i]; + st++; + while(curr > bt) + { + curr -= arr[prev]; + prev++; st--; + } + } + if(maxI < st) + { + maxI = st; + minSum = curr; + } + else if(maxI == st) + { + minSum = min(minSum, curr); + } + } + cout << minSum << " " << maxI << endl; + } + return 0; +} diff --git a/SPOJ/Alphacode.cpp b/SPOJ/Alphacode.cpp new file mode 100755 index 0000000..56544f0 --- /dev/null +++ b/SPOJ/Alphacode.cpp @@ -0,0 +1,40 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + while(true) + { + string encoded; + cin >> encoded; + if(encoded == "0") + { + break; + } + ll dp[encoded.length()], i, num; + memset(dp, 0, sizeof(dp)); + dp[0] = 1; + for(i = 1; i < encoded.length(); i++) + { + num = (encoded[i-1]-'0')*10 + (encoded[i]-'0'); + if(encoded[i] != '0') + { + dp[i] = dp[i-1]; + } + if(num <= 26 && num > 9) + { + if(i > 1) + dp[i] += dp[i-2]; + else + dp[i]++; + } + } + cout << dp[encoded.length()-1] << endl; + } + return 0; +} diff --git a/SPOJ/Another Very Easy Problem.cpp b/SPOJ/Another Very Easy Problem.cpp new file mode 100755 index 0000000..1de1c5b --- /dev/null +++ b/SPOJ/Another Very Easy Problem.cpp @@ -0,0 +1,53 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define mod 1988 +#define lim 5111 +ll partitions[lim][lim]; +void precompute() +{ + ll n, k; + for(k = 0; k < lim; k++) + { + partitions[0][k] = 1; + } + for(n = 1; n < lim; n++) + { + partitions[n][0] = 0; + } + for(n = 1; n < lim; n++) + { + for(k = 1; k <= n; k++) + { + if(n-k < k) + { + partitions[n-k][k] = partitions[n-k][k-1] % mod; + } + partitions[n][k] = (partitions[n][k-1] + partitions[n-k][k])%mod; + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + precompute(); + ll n, k, ans; + cin >> n >> k; + while(!(n == 0 && k == 0)) + { + ans = partitions[n][k] - partitions[n][k-1]; + if(ans < 0) + { + cout << ans + mod << endl; + } + else + { + cout << ans % mod << endl; + } + cin >> n >> k; + } + + return 0; +} diff --git a/SPOJ/Baby.cpp b/SPOJ/Baby.cpp new file mode 100755 index 0000000..aa8259d --- /dev/null +++ b/SPOJ/Baby.cpp @@ -0,0 +1,46 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll int +#define INF 99999 +ll dp[1 << 17], n, curr[17], final[17]; +ll findMoves(ll mask, ll cnt) +{ + if(cnt == n) + return dp[mask] = 0; + else if(dp[mask] != -1) + return dp[mask]; + else + { + ll moves = INF; + for(ll i = 0; i < n; i++) + { + if(!(mask & (1 << i))) + moves = min(moves, findMoves(mask | (1 << i), cnt+1) + abs(cnt - i) + abs(final[cnt] - curr[i])); + } + return dp[mask] = moves; + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + while(true) + { + ll i, j, x, y; + cin >> n; + if(n == 0) + break; + memset(dp, -1, sizeof(dp)); + for(i = 0; i < n; i++) + { + cin >> curr[i]; + } + for(i = 0; i < n; i++) + { + cin >> final[i]; + } + cout << findMoves(0, 0) << endl; + } + return 0; +} diff --git a/SPOJ/Chocolate - Chocola.cpp b/SPOJ/Chocolate - Chocola.cpp new file mode 100755 index 0000000..ac0036a --- /dev/null +++ b/SPOJ/Chocolate - Chocola.cpp @@ -0,0 +1,67 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +bool comp(ll a, ll b) +{ + return a > b; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll m, n, i, j, h, v, cost = 0; + cin >> m >> n; + ll rows[m], columns[n]; + for(i = 1; i < m; i++) + { + cin >> rows[i]; + } + for(i = 1; i < n; i++) + { + cin >> columns[i]; + } + sort(rows+1, rows + m, comp); + sort(columns+1, columns + n, comp); + i = j = h = v = 1; + while(i < m && j < n) + { + if(rows[i] > columns[j]) + { + cost += rows[i]*v; + i++; + h++; + } + else + { + cost += columns[j]*h; + j++; + v++; + } + } + if(i < m) + { + while(i < m) + { + cost += rows[i]*v; + i++; + } + } + else + { + while(j < n) + { + cost += columns[j]*h; + j++; + } + } + + cout << cost << endl; + } + return 0; +} diff --git a/SPOJ/Cross-Country.cpp b/SPOJ/Cross-Country.cpp new file mode 100755 index 0000000..7024125 --- /dev/null +++ b/SPOJ/Cross-Country.cpp @@ -0,0 +1,68 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll lcs(ll agnes[], ll agnesLength, ll tom[], ll tomLength) +{ + ll LCS[agnesLength+1][tomLength+1], i, j; + for(i = 0; i <= agnesLength; i++) + { + for(j = 0; j <= tomLength; j++) + { + if(i == 0 || j == 0) + { + LCS[i][j] = 0; + } + else if(agnes[i - 1] == tom[j - 1]) + { + LCS[i][j] = LCS[i-1][j-1] + 1; + } + else + { + LCS[i][j] = max(LCS[i-1][j], LCS[i][j-1]); + } + + } + } + return LCS[agnesLength][tomLength]; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll d; + cin >> d; + while(d--) + { + ll num, a = 0, agnes[2222], agnesLength, e, maxL = 0; + cin >> num; + while(num) + { + agnes[a++] = num; + cin >> num; + } + agnesLength = a; + while(true) + { + cin >> num; + if(num) + { + ll tom[2222]; + a = 0; + while(num) + { + tom[a++] = num; + cin >> num; + } + maxL = max(maxL, lcs(agnes, agnesLength, tom, a)); + } + else + { + break; + } + } + cout << maxL << endl; + } + return 0; +} diff --git a/SPOJ/DQUERY.cpp b/SPOJ/DQUERY.cpp new file mode 100755 index 0000000..afce2be --- /dev/null +++ b/SPOJ/DQUERY.cpp @@ -0,0 +1,82 @@ +/* Written By Manav Aggarwal */ +#include +#include +#include +using namespace std; + +struct node { + int L, R; + int I; +}; +node queries[200002]; +int block, ans, currL, currR; +bool wayToSort(node a, node b) +{ + if( a.L / block < b.L / block ) + return true; + if( a.L / block > b.L / block ) + return false; + return a.R < b.R ; +} + +int cnt[200002], arr[30002], freqs[1000002]; + +void remove( int i ){ + freqs[ arr[i] ]--; + if( freqs[ arr[i] ] == 0 ) + ans--; +} + +void add( int i ){ + freqs[ arr[i] ]++; + if( freqs[ arr[i] ] == 1 ) + ans++; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + int n, i, q; + cin >> n; + block = sqrt(n); + for(i = 1; i <= n; i++) + { + cin >> arr[i]; + } + cin >> q; + for(i = 1; i <= q; i++) + { + cin >> queries[i].L >> queries[i].R; + queries[i].I = i; + } + sort(queries+1, queries+q+1, wayToSort); + currL = currR = ans = 0; + for(i = 1; i <= q; i++) + { + while(currL < queries[i].L) + { + remove(currL); + currL++; + } + while(currL > queries[i].L) + { + currL--; + add(currL); + } + while(currR < queries[i].R) + { + currR++; + add(currR); + } + while(currR > queries[i].R) + { + remove(currR); + currR--; + } + cnt[queries[i].I] = ans; + } + for(i = 1; i <= q; i++) + { + cout << cnt[i] << "\n"; + } + return 0; +} diff --git a/SPOJ/Die Hard.cpp b/SPOJ/Die Hard.cpp new file mode 100755 index 0000000..eeedc7b --- /dev/null +++ b/SPOJ/Die Hard.cpp @@ -0,0 +1,60 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll H, A, time = 0, H1, H2, A1, A2; + cin >> H >> A; + bool inAir = true; + H += 3; + A += 2; + while(true) + { + if(inAir) + { + H1 = H - 5; + A1 = A - 10; + H2 = H - 20; + A2 = A + 5; + if(H2 <= 0) + { + if(A1 <= 0 || H1 <= 0) + { + time++; + break; + } + H = H1; + A = A1; + } + else if(A1 <= 0 || H1 <= 0) + { + H = H2; + A = A2; + } + else + { + H = H1; + A = A1; + } + } + else + { + H += 3; + A += 2; + } + inAir = !inAir; + time++; + } + cout << time << endl; + } + return 0; +} diff --git a/SPOJ/Divisor Summation.cpp b/SPOJ/Divisor Summation.cpp new file mode 100755 index 0000000..9cd7df8 --- /dev/null +++ b/SPOJ/Divisor Summation.cpp @@ -0,0 +1,67 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll divSums[500001]; +const ll M = 500001; +ll arr[M]; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } +} +ll divSum(ll n) +{ + if(n == 1) + { + return 0; + } + if(arr[n]) + { + return 1; + } + ll sum = 1, i; + for(i = 2; i <= sqrt(n); i++) + { + if(n % i == 0) + { + if(i == n/i) + { + sum += i; + } + else + sum += i + n/i; + } + } + return sum; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll t; + cin >> t; + while(t--) + { + ll n; + cin >> n; + cout << divSum(n) << endl; + } + return 0; +} diff --git a/SPOJ/Euler Totient Function.cpp b/SPOJ/Euler Totient Function.cpp new file mode 100755 index 0000000..28ecf5a --- /dev/null +++ b/SPOJ/Euler Totient Function.cpp @@ -0,0 +1,69 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +const ll M = 1000011; +ll arr[M+1]; +vector primes; +void sieveOfEratosthenes() +{ + long long i, j; + for(i = 2; i <= M; i++) + { + arr[i] = 1; + } + arr[0] = arr[1] = 0; + for(i = 2; i <= sqrt(M); i++) + { + if(arr[i] == 1) + { + for(j = 2*i; j <= M; j+=i) + { + arr[j] = 0; + } + } + } + primes.push_back(2); + for(i = 3; i <= M; i+=2) + { + if(arr[i]) + { + primes.push_back(i); + } + } +} +ll resilience(ll n) +{ + ll i, phi = n; + for(i = 2; i*i <= n; i++) + { + if(n % i == 0 && arr[i]) + { + phi -= phi/i; + while (n % i == 0) n /= i; + } + } + if(n > 1) phi -= phi/n; + return phi; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieveOfEratosthenes(); + ll t; + cin >> t; + while(t--) + { + ll n; + cin >> n; + if(arr[n]) + { + cout << n-1 << endl; + } + else + cout << resilience(n) << endl; + } + return 0; +} diff --git a/SPOJ/GSS1.cpp b/SPOJ/GSS1.cpp new file mode 100755 index 0000000..7d177d6 --- /dev/null +++ b/SPOJ/GSS1.cpp @@ -0,0 +1,12 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + + return 0; +} diff --git a/SPOJ/Histogram.cpp b/SPOJ/Histogram.cpp new file mode 100755 index 0000000..c32d233 --- /dev/null +++ b/SPOJ/Histogram.cpp @@ -0,0 +1,64 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll int +ll n, arr[16], dp[1 << 16][16], cnt[1 << 16][16]; +ll solve(ll mask, ll last) +{ + ll i, tmp, ans = 0; + if(mask == (1 << n) - 1) + { + cnt[mask][last] = 1; + return arr[last]; + } + else if(dp[mask][last] != -1) + return dp[mask][last]; + else + { + dp[mask][last] = 0; + for(i = 0; i < n; i++) + { + if(!(mask & (1 << i))) + { + tmp = solve(mask | (1 << i), i) + abs(arr[last] - arr[i]); + if(tmp > ans) + { + ans = tmp; + cnt[mask][last] = 0; + } + if(tmp == ans) cnt[mask][last] += cnt[mask | (1 << i)][i]; + } + } + return dp[mask][last] = ans; + } +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + while(true) + { + cin >> n; + if(n == 0) + break; + memset(dp, -1, sizeof(dp)); + for(ll i = 0; i < n; i++) + { + cin >> arr[i]; + } + ll perim = 2*n, cont = 0, ans = 0, curr, i; + for(i = 0; i < n; i++) + { + curr = solve((1 << i), i) + arr[i]; + if(curr > ans) + { + ans = curr; + cont = 0; + } + if(curr == ans) cont += cnt[1 << i][i]; + } + cout << perim + ans << " " << cont << endl; + } + return 0; +} diff --git a/SPOJ/Horrible Queries.cpp b/SPOJ/Horrible Queries.cpp new file mode 100755 index 0000000..4f8a421 --- /dev/null +++ b/SPOJ/Horrible Queries.cpp @@ -0,0 +1,69 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll ft1[111111], ft2[111111], n; +ll query(ll *fenwickTree, ll index) +{ + ll sum = 0; + while(index > 0) + { + sum += fenwickTree[index]; + index -= index & (-index); + } + return sum; +} +ll query(ll index) +{ + return query(ft1, index)*index - query(ft2, index); +} +ll query(ll a, ll b) +{ + return query(b) - query(a-1); +} +void updateTree(ll *fenwickTree, ll index, ll val) +{ + while(index <= n) + { + fenwickTree[index] += val; + index += index & (-index); + } +} +void updateTree(ll a, ll b, ll val) +{ + updateTree(ft1, a, val); + updateTree(ft1, b+1, -val); + updateTree(ft2, a, val*(a-1)); + updateTree(ft2, b+1, (-val)*b); +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll c, i, choice, p, q, v; + cin >> n >> c; + for(i = 0; i <= n; i++) + { + ft1[i] = ft2[i] = 0; + } + for(i = 0; i < c; i++) + { + cin >> choice; + if(choice == 0) + { + cin >> p >> q >> v; + updateTree(p, q, v); + } + else + { + cin >> p >> q; + cout << query(p, q) << endl; + } + } + } + return 0; +} diff --git a/SPOJ/Large Knapsack.cpp b/SPOJ/Large Knapsack.cpp new file mode 100755 index 0000000..f30ae8e --- /dev/null +++ b/SPOJ/Large Knapsack.cpp @@ -0,0 +1,44 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll int +#define MAX 2000001 +ll knapsack[2][MAX]; +ll vals[501], weights[501]; +ll findKnapsack(ll k, ll n) +{ + ll prev = 1, curr = 0, i = -1, j; + while(++i <= n) + { + j = -1; + while(++j <= k) + { + if(i == 0 || j == 0) + { + knapsack[curr][j] = 0; + } + else if(weights[i-1] > j) + knapsack[curr][j] = knapsack[prev][j]; + else + knapsack[curr][j] = max(knapsack[prev][j], vals[i-1] + knapsack[prev][j-weights[i-1]]); + } + prev = curr; + curr = !curr; + } + return knapsack[prev][k]; +} +int main() +{ + //ios_base::sync_with_stdio(false); cin.tie(0); + ll k, n, i; + scanf("%d", &k); + scanf("%d", &n); + for(i = 0; i < n; i++) + { + scanf("%d", &vals[i]); + scanf("%d", &weights[i]); + } + printf("%d\n", findKnapsack(k, n)); + return 0; +} diff --git a/SPOJ/Largest Rectangle in a Histogram.cpp b/SPOJ/Largest Rectangle in a Histogram.cpp new file mode 100755 index 0000000..5153f09 --- /dev/null +++ b/SPOJ/Largest Rectangle in a Histogram.cpp @@ -0,0 +1,52 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + while(true) + { + ll n; + cin >> n; + if(n == 0) + break; + ll arr[n], i, j, maxArea = 0, tp; + stack frontier; + for(i = 0; i < n; i++) + { + cin >> arr[i]; + } + for(i = 0; i < n;) + { + if(frontier.empty() || arr[frontier.top()] <= arr[i]) + { + frontier.push(i++); + } + else + { + tp = frontier.top(); + frontier.pop(); + if(frontier.empty()) + maxArea = max(maxArea, arr[tp] * i); + else + { + maxArea = max(maxArea, arr[tp] * (i - frontier.top() - 1)); + } + } + } + while(!frontier.empty()) + { + tp = frontier.top(); + frontier.pop(); + if(frontier.empty()) + maxArea = max(maxArea, arr[tp] * i); + else + maxArea = max(maxArea, arr[tp] * (i - frontier.top() - 1)); + } + cout << maxArea << endl; + } + return 0; +} diff --git a/SPOJ/M3Tile.cpp b/SPOJ/M3Tile.cpp new file mode 100755 index 0000000..11e7d85 --- /dev/null +++ b/SPOJ/M3Tile.cpp @@ -0,0 +1,28 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll ways[32], i; + ways[0] = 1; ways[1] = 0; ways[2] = 3; ways[3] = 0; + for(i = 4; i <= 30; i++) + { + ways[i] = 4*ways[i-2] - ways[i-4]; + } + while(true) + { + ll num; + cin >> num; + if(num == -1) + { + break; + } + cout << ways[num] << endl; + } + return 0; +} diff --git a/SPOJ/Make Psycho.cpp b/SPOJ/Make Psycho.cpp new file mode 100755 index 0000000..dfdb710 --- /dev/null +++ b/SPOJ/Make Psycho.cpp @@ -0,0 +1,114 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll int + +bool isPyschoN(ll n) +{ + if(n == 0 || n == 1) + { + return false; + } + ll i, even = 0, odd = 0, count; + for(i = 2; i*i <= n; i++) + { + if(n % i == 0) + { + count = 0; + while(n % i == 0) + { + count++; + n /= i; + } + if(count&1) + { + odd++; + } + else + { + even++; + } + } + } + if(n > 1) odd++; + if(even > odd) + { + return true; + } + return false; +} + +bool isSubsetSum(ll arr[], ll n, ll k) +{ + if(n == 1 && arr[0] == k) return true; + if(n == 2 && (arr[0] + arr[1] == k || arr[0] == k || arr[1] == k)) return true; + bool subTable[k+1][n+1]; + ll i, j; + bool b; + for(i = 0; i <= n; i++) + { + subTable[0][i] = true; + } + for(i = 1; i <= k; i++) + { + subTable[i][0] = false; + } + for(i = 1; i <= k; i++) + { + for(j = 1; j <= n; j++) + { + subTable[i][j] = subTable[i][j-1]; + if(arr[j-1] <= i) + { + subTable[i][j] = subTable[i][j] || subTable[i - arr[j-1]][j-1]; + } + } + } + return subTable[k][n]; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + bool isPyscho[1101]; + for(ll i = 0; i < 1101; i++) + { + isPyscho[i] = isPyschoN(i); + } + ll t; + cin >> t; + while(t--) + { + ll n, k, i, j, num, no = 0, sum = 0; + cin >> n >> k; + bool isP = false; + ll pyschos[n]; + for(i = 0; i < n; i++) + { + cin >> num; + if(isPyscho[num]) + { + if(num == k) + { + isP = true; + } + sum += num; + pyschos[no] = num; + no++; + } + } + if(sum < k) + { + cout << "No" << endl; + } + else if(isP || isSubsetSum(pyschos, no, k)) + { + cout << "Yes" << endl; + } + else + { + cout << "No" << endl; + } + } + return 0; +} diff --git a/SPOJ/Marbles.cpp b/SPOJ/Marbles.cpp new file mode 100755 index 0000000..43937be --- /dev/null +++ b/SPOJ/Marbles.cpp @@ -0,0 +1,29 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAXN 1000000 +ll binomialCoeff(ll n, ll k) +{ + if(k > n - k) + k = n - k; + ll i, ans = 1; + for(i = 0; i < k; i++) + ans = ans * (n-i)/(i+1); + return ans; +} + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, k; + cin >> n >> k; + cout << binomialCoeff(n-1, k-1) << endl; + } + return 0; +} diff --git a/SPOJ/Minimum Knight Moves.cpp b/SPOJ/Minimum Knight Moves.cpp new file mode 100755 index 0000000..d9b1310 --- /dev/null +++ b/SPOJ/Minimum Knight Moves.cpp @@ -0,0 +1,64 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define mp make_pair +#define pci pair +bool isValid(pci p) +{ + if(p.first >= 'a' && p.first <= 'h' && p.second >= 1 && p.second <= 8) + { + return true; + } + return false; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + char a, s; + ll b, s1; + cin >> s >> s1 >> a >> b; + map visited; + map came_from; + queue frontier; + frontier.push(mp(s, s1)); + pci curr; + while(!frontier.empty()) + { + curr = frontier.front(); + frontier.pop(); + visited[curr] = true; + if(curr.first == a && curr.second == b) + { + break; + } + pci h2fv1l = mp((char)(curr.first - 1), curr.second + 2), h2fv1r = mp((char)(curr.first + 1), curr.second + 2), h2bv1l = mp((char)(curr.first - 1), curr.second - 2); + pci h2bv1r = mp((char)(curr.first + 1), curr.second - 2), h1fv2l = mp((char)(curr.first - 2), curr.second + 1), h1fv2r = mp((char)(curr.first + 2), curr.second + 1); + pci h1bv2l = mp((char)(curr.first - 2), curr.second - 1), h1bv2r = mp((char)(curr.first + 2), curr.second - 1); + vector pairs; + pairs.push_back(h2fv1l), pairs.push_back(h2fv1r), pairs.push_back(h2bv1l), pairs.push_back(h2bv1r), pairs.push_back(h1fv2l), pairs.push_back(h1fv2r), pairs.push_back(h1bv2l), pairs.push_back(h1bv2r); + for(ll i = 0; i < pairs.size(); i++) + { + if((!visited[pairs[i]]) && isValid(pairs[i])) + { + came_from[pairs[i]] = curr; + frontier.push(pairs[i]); + visited[pairs[i]] = true; + } + } + } + vector path; + while(!(curr.first == s && curr.second == s1)) + { + path.push_back(curr); + curr = came_from[curr]; + } + cout << path.size() << endl; + } + return 0; +} diff --git a/SPOJ/Number Steps.cpp b/SPOJ/Number Steps.cpp new file mode 100755 index 0000000..171fd74 --- /dev/null +++ b/SPOJ/Number Steps.cpp @@ -0,0 +1,54 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + map, ll> coords; + ll num = 0, i; + for(i = 0; i <= 10000; i++) + { + coords[make_pair(i, i)] = num; + if(num&1) + num += 3; + else + num++; + } + num = 2; + for(i = 0; i <= 10000; i++) + { + coords[make_pair(i+2, i)] = num; + if(num&1) + num += 3; + else + num++; + } + ll n; + cin >> n; + while(n--) + { + ll x, y; + cin >> x >> y; + if(x == 0 && y == 0) + { + cout << 0 << endl; + } + else + { + if(coords[make_pair(x, y)] == 0) + { + cout << "No Number" << endl; + } + else + { + cout << coords[make_pair(x, y)] << endl; + } + + } + } + return 0; +} diff --git a/SPOJ/Palindrome 2000.cpp b/SPOJ/Palindrome 2000.cpp new file mode 100755 index 0000000..b0027be --- /dev/null +++ b/SPOJ/Palindrome 2000.cpp @@ -0,0 +1,40 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +int lcs[2][5555]; +int main() +{ + ios_base::sync_with_stdio(false); + int n, i, j; + cin >> n; + string s, rev; + cin >> s; + rev = s; + for(j = 0; j < n; j++) + { + lcs[0][j] = 0; + rev[j] = s[n-j-1]; + } + lcs[0][n] = 0; + for(i = 0; i <= n; i++) + { + for(j = 0; j <= n; j++) + { + if(i == 0 || j == 0) + { + lcs[(i%2)][j] = 0; + } + else if(s[i-1] != rev[j-1]) + { + lcs[(i%2)][j] = max(lcs[!(i%2)][j], lcs[(i%2)][j-1]); + } + else + { + lcs[(i%2)][j] = 1 + lcs[!(i%2)][j-1]; + } + } + } + printf("%d\n", n - lcs[!(i%2)][n]); + return 0; +} diff --git a/SPOJ/Party Schedule.cpp b/SPOJ/Party Schedule.cpp new file mode 100755 index 0000000..750d228 --- /dev/null +++ b/SPOJ/Party Schedule.cpp @@ -0,0 +1,48 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll budget, parties, i, j, fee, funSum; + cin >> budget >> parties; + while(!(budget == 0 && parties == 0)) + { + ll entranceFee[parties], fun[parties]; + for(i = 0; i < parties; i++) + { + cin >> entranceFee[i] >> fun[i]; + } + ll funAtParties[parties+1][budget+1]; + for(i = 0; i <= parties; i++) + { + for(j = 0; j <= budget; j++) + { + if(i == 0 || j == 0) + { + funAtParties[i][j] = 0; + } + else if(entranceFee[i-1] > j) + { + funAtParties[i][j] = funAtParties[i-1][j]; + } + else + { + funAtParties[i][j] = max(funAtParties[i-1][j], fun[i-1] + funAtParties[i-1][j - entranceFee[i-1]]); + } + } + } + fee = budget-1, funSum = funAtParties[parties][budget]; + while(funAtParties[parties][fee] == funSum) + { + fee--; + } + cout << fee + 1 << " " << funSum << endl; + cin >> budget >> parties; + } + return 0; +} diff --git a/SPOJ/Philosophers Stone.cpp b/SPOJ/Philosophers Stone.cpp new file mode 100755 index 0000000..aeade48 --- /dev/null +++ b/SPOJ/Philosophers Stone.cpp @@ -0,0 +1,65 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll h, w, i, j, k, maxN; + cin >> h >> w; + ll chamber[h][w]; + for(i = 0; i < h; i++) + { + for(j = 0; j < w; j++) + { + cin >> chamber[i][j]; + } + } + if(h == 1) + { + maxN = 0; + for(i = 0; i < w; i++) + { + maxN = max(maxN, chamber[h][i]); + } + cout << maxN << endl; + } + else + { + for(i = h-2; i >= 0; i--) + { + for(j = 0; j < w; j++) + { + maxN = 0; + if(j == 0) + { + maxN = max(chamber[i+1][j], chamber[i+1][j+1]); + } + else if(j == w-1) + { + maxN = max(chamber[i+1][j-1], chamber[i+1][j]); + } + else + { + maxN = max(chamber[i+1][j], max(chamber[i+1][j-1], chamber[i+1][j+1])); + } + chamber[i][j] += maxN; + } + } + maxN = 0; + for(i = 0; i < w; i++) + { + maxN = max(maxN, chamber[0][i]); + } + cout << maxN << endl; + } + } + return 0; +} diff --git a/SPOJ/Prime Path.cpp b/SPOJ/Prime Path.cpp new file mode 100755 index 0000000..1ceb327 --- /dev/null +++ b/SPOJ/Prime Path.cpp @@ -0,0 +1,100 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define mp make_pair +string numToString(ll num) +{ + ll i; + string str = ""; + while(num != 0) + { + str += (char)( (num%10) + '0'); + num/=10; + } + str = string(str.rbegin(), str.rend()); + return str; +} +map isPrime; +map primeCheck; +void sieve() +{ + ll i, j; + for(i = 2; i <= 9999; i++) + { + primeCheck[i] = true; + } + for(i = 2; i <= sqrt(9999); i++) + { + if(primeCheck[i]) + { + for(j = 2*i; j <= 9999; j += i) + { + primeCheck[j] = false; + } + } + } + for(i = 1001; i <= 9999; i++) + { + if(primeCheck[i]) + { + isPrime[numToString(i)] = true; + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + sieve(); + ll t; + cin >> t; + while(t--) + { + string num1, num2, currNum, nextNum; + cin >> num1 >> num2; + queue frontier; + ll i, iter; + frontier.push(num1); + map came_from; + map visited; + came_from[num1] = "-1"; + visited[num1] = true; + while(!frontier.empty()) + { + currNum = frontier.front(); + frontier.pop(); + if(currNum == num2) + { + break; + } + for(i = 0; i < 4; i++) + { + if(currNum[i] == num2[i]) + continue; + char j; + for(j = '0'; j <= '9'; j++) + { + if(j == currNum[i] || (i == 0 && j == '0')) + continue; + nextNum = currNum; + nextNum[i] = j; + if(isPrime[nextNum] && !visited[nextNum]) + { + frontier.push(nextNum); + came_from[nextNum] = currNum; + visited[nextNum] = true; + } + } + } + } + stack k; + while(came_from[currNum] != "-1") + { + k.push(currNum); + currNum = came_from[currNum]; + } + cout << k.size() << endl; + } + return 0; +} diff --git a/SPOJ/Prime or Not.cpp b/SPOJ/Prime or Not.cpp new file mode 100755 index 0000000..ccf8a2e --- /dev/null +++ b/SPOJ/Prime or Not.cpp @@ -0,0 +1,84 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll mulmod(ll base, ll exp, ll mod) +{ + ll x = 0, y = base % mod; + while(exp) + { + if(exp&1) + { + x = (x+y) % mod; + } + y = (y * 2) % mod; + exp /= 2; + } + return x % mod; +} +ll fastMod(ll base, ll exp, ll mod) +{ + ll y = base, result = 1; + while(exp) + { + if(exp&1) + { + result = mulmod(result, y, mod); + } + y = mulmod(y, y, mod); + exp /= 2; + } + return result % mod; +} + +ll isPrime(ll n) +{ + if(n < 2 || (n != 2 && n % 2 == 0)) + return false; + if(n == 2) + return true; + ll s = 0, d, i, x, p = n, tmp, mod; + n--; + while(!(n&1)) + { + n /= 2; + } + for(i = 0; i < 5; i++) + { + srand (time(NULL)); + x = rand() % (p-1) + 1; tmp = n; + mod = fastMod(x, tmp, p); + while(mod != p-1 && mod != 1 && tmp != p-1) + { + mod = mulmod(mod, mod, p); + tmp *= 2; + } + if(mod != p-1 && !(tmp&1)) + { + return false; + } + } + return true; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n; + cin >> n; + if(isPrime(n)) + { + cout << "YES" << endl; + } + else + { + cout << "NO" << endl; + } + } + return 0; +} diff --git a/SPOJ/Psycho.cpp b/SPOJ/Psycho.cpp new file mode 100755 index 0000000..2102011 --- /dev/null +++ b/SPOJ/Psycho.cpp @@ -0,0 +1,48 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, i, even = 0, odd = 0, count; + cin >> n; + for(i = 2; i*i <= n; i++) + { + if(n % i == 0) + { + count = 0; + while(n % i == 0) + { + count++; + n /= i; + } + if(count&1) + { + odd++; + } + else + { + even++; + } + } + } + if(n > 1) odd++; + if(even > odd) + { + cout << "Psycho Number" << endl; + } + else + { + cout << "Ordinary Number" << endl; + } + } + return 0; +} diff --git a/SPOJ/Pyscho Function.cpp b/SPOJ/Pyscho Function.cpp new file mode 100755 index 0000000..82c087a --- /dev/null +++ b/SPOJ/Pyscho Function.cpp @@ -0,0 +1,99 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll numTrailingFact(ll n) +{ + ll count = 0, k = 5; + while(n/k > 0) + { + count += n/k; + k*=5; + } + return count; +} +ll lastDig(ll b, ll p) +{ + if(p == 0) + { + return 1; + } + map digs; + vector arr; + ll base = b; + b = b % 10; + while(true) + { + if(!digs[b]) + { + arr.push_back(b); + digs[b] = true; + b *= base; + b = b % 10; + } + else + { + break; + } + } + ll len = arr.size(); + return arr[(p-1) % len]; +} +bool isPyscho(ll n) +{ + if(n == 0 || n == 1) + { + return false; + } + ll i, even = 0, odd = 0, count; + for(i = 2; i*i <= n; i++) + { + if(n % i == 0) + { + count = 0; + while(n % i == 0) + { + count++; + n /= i; + } + if(count&1) + { + odd++; + } + else + { + even++; + } + } + } + if(n > 1) odd++; + if(even > odd) + { + return true; + } + return false; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll k, b, p, num; + cin >> k >> b >> p; + num = numTrailingFact(k); + num *= lastDig(b, p); + if(isPyscho(num)) + { + cout << "Psycho Number" << endl; + } + else + { + cout << "Ordinary Number" << endl; + } + } + return 0; +} diff --git a/SPOJ/Rain.cpp b/SPOJ/Rain.cpp new file mode 100755 index 0000000..61a9190 --- /dev/null +++ b/SPOJ/Rain.cpp @@ -0,0 +1,105 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAX 5555555 +ll calcA(ll x, ll y) +{ + return (x % 100 + 1) * (y % 100 + 1); +} +ll calcS(ll x) +{ + return (78901 + 31*x) % 699037; +} +ll calcT(ll y) +{ + return (23456 + 64*y) % 2097151; +} +ll s[MAX], t[MAX], a[MAX], sumA[MAX]; +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll test; + cin >> test; + while(test--) + { + ll x, y, N, M, i, j, maxK = 1; + cin >> x >> y >> N >> M; + s[0] = x; t[0] = y; + a[0] = calcA(s[0], t[0]); + for(i = 1; i < N; i++) + { + s[i] = calcS(s[i-1]); + t[i] = calcT(t[i-1]); + a[i] = calcA(s[i], t[i]); + if(a[i] > M) + { + maxK = 0; + } + } + sumA[0] = 0; + for(i = 1; i <= N; i++) + { + sumA[i] = sumA[i-1] + a[i-1]; + } + if(maxK == 0) + { + cout << maxK << endl; + continue; + } + bool flag = true; + /*for(i = 2; i <= N && flag; i++) + { + for(j = i; j <= N; j++) + { + if(sumA[j] - sumA[j - i] > M) + { + maxK = i-1; + flag = false; + break; + } + } + }*/ + ll start = 1, end = N, mid; + while(start >= 1 && end <= N) + { + flag = true; + mid = (start + end)/2; + if(end - start <= 1) + { + if(start == end - 1) + { + for(j = end; j <= N; j++) + { + if(sumA[j] - sumA[j - end] > M) + { + flag = false; + break; + } + } + if(!flag) + { + end = start; + } + } + break; + } + for(j = mid; j <= N; j++) + { + if(sumA[j] - sumA[j - mid] > M) + { + end = mid - 1; + flag = false; + break; + } + } + if(flag) + { + start = mid; + } + } + cout << end << endl; + } + return 0; +} diff --git a/SPOJ/Rent your Airplane and Make Money.cpp b/SPOJ/Rent your Airplane and Make Money.cpp new file mode 100755 index 0000000..a6c55d1 --- /dev/null +++ b/SPOJ/Rent your Airplane and Make Money.cpp @@ -0,0 +1,77 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pii pair +#define piii pair +#define mp make_pair +#define price first +#define startT second.first +#define endT second.second +bool wayToSort(piii a, piii b) {return a.startT < b.startT;} +ll dp[10011]; +ll binSearch(piii orders[], ll pos, ll n, ll start) +{ + if(pos > n) + { + return -1; + } + ll mid = (pos + n)/2; + if(pos == n) + { + if(orders[n].startT >= start) + return pos; + else + return -1; + } + if(orders[mid].startT >= start) + { + return binSearch(orders, pos, mid, start); + } + else + { + return binSearch(orders, mid+1, n, start); + } +} +ll getMax(piii orders[], ll pos, ll n, ll start) +{ + if(pos > n) + { + return dp[pos] = 0; + } + else if(orders[pos].startT < start) + { + pos = binSearch(orders, pos+1, n, start); + if(pos == -1) + return 0; + } + else if(dp[pos] > -1) + { + return dp[pos]; + } + ll p = getMax(orders, pos+1, n, start); + ll q = getMax(orders, pos+1, n, orders[pos].endT) + orders[pos].price; + return dp[pos] = max(p, q); +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, i, d; + cin >> n; + piii orders[n+1]; + for(i = 1; i <= n; i++) + { + cin >> orders[i].startT >> d >> orders[i].price; + orders[i].endT = orders[i].startT + d; + } + sort(orders + 1, orders + n + 1, wayToSort); + memset(dp, -1, sizeof(dp)); + cout << getMax(orders, 1, n+1, orders[1].startT) << endl; + } + return 0; +} diff --git a/SPOJ/Scuba Diver.cpp b/SPOJ/Scuba Diver.cpp new file mode 100755 index 0000000..ba9f11f --- /dev/null +++ b/SPOJ/Scuba Diver.cpp @@ -0,0 +1,45 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define INF 999999999999999 + +ll oxyCylinder[1011], nitroCylinder[1011], wt[1011], dp[1011][22][80]; +ll solve(ll n, ll oxyNeed, ll nitroNeed) +{ + if(dp[n][oxyNeed][nitroNeed] != -1) + { + return dp[n][oxyNeed][nitroNeed]; + } + else if(n == 0 && (oxyNeed || nitroNeed)) + { + return dp[n][oxyNeed][nitroNeed] = INF; + } + else if(!n && !oxyNeed && !nitroNeed) + { + return dp[n][oxyNeed][nitroNeed] = 0; + } + else + { + return dp[n][oxyNeed][nitroNeed] = min(solve(n-1, oxyNeed, nitroNeed), solve(n-1, max(oxyNeed - oxyCylinder[n-1], 0LL), max(nitroNeed - nitroCylinder[n-1], 0LL)) + wt[n-1]); + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll oxyNeed, nitroNeed, n, i; + cin >> oxyNeed >> nitroNeed >> n; + for(i = 1; i <= n; i++) + { + cin >> oxyCylinder[i] >> nitroCylinder[i] >> wt[i]; + } + memset(dp, -1, sizeof(dp)); + cout << solve(n+1, oxyNeed, nitroNeed) << endl; + } + return 0; +} diff --git a/SPOJ/Seinfield.cpp b/SPOJ/Seinfield.cpp new file mode 100755 index 0000000..f58a5c6 --- /dev/null +++ b/SPOJ/Seinfield.cpp @@ -0,0 +1,43 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll iter = 1; + while(true) + { + string brackets; + cin >> brackets; + if(brackets[0] == '-') + { + break; + } + ll i, ops = 0; + stack bracs; + for(i = 0; i < brackets.length(); i++) + { + if(brackets[i] == '{') + { + bracs.push('{'); + } + else + { + if(bracs.empty()) + { + ops++; + bracs.push('}'); + } + else + bracs.pop(); + } + } + ops += bracs.size()/2; + cout << iter << ". " << ops << endl; + iter++; + } + return 0; +} diff --git a/SPOJ/Shopping.cpp b/SPOJ/Shopping.cpp new file mode 100755 index 0000000..2dac6aa --- /dev/null +++ b/SPOJ/Shopping.cpp @@ -0,0 +1,91 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pii pair +#define piii pair +#define mp make_pair +#define mpp(cost, x, y) mp(cost, mp(x, y)) +#define x second.first +#define y second.second +#define cost first +#define INF 999999999999999 +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + while(true) + { + ll w, h, i, j; + cin >> w >> h; + if(!w && !h) + break; + char grid[h][w]; + pii start, destination, came_from[h][w]; + ll cost[h][w], currCost, currX, currY, nextX, nextY, nextCost, ans; + bool visited[h][w], flag = false; + for(i = 0; i < h; i++) + { + for(j = 0; j < w; j++) + { + cin >> grid[i][j]; + if(grid[i][j] == 'S') + start = mp(i, j); + if(grid[i][j] == 'D') + destination = mp(i, j); + } + } + priority_queue, greater > frontier; + cost[start.first][start.second] = 0; + frontier.push(mpp(0, start.first, start.second)); + came_from[start.first][start.second] = mp(-1, -1); + memset(visited, false, sizeof(visited)); + while(!frontier.empty()) + { + if(flag) + break; + currCost = frontier.top().cost; + currX = frontier.top().x; currY = frontier.top().y; + frontier.pop(); + if(visited[currX][currY]) + continue; + visited[currX][currY] = true; + for(i = 0; i < 4; i++) + { + switch(i) + { + case 0: + nextX = currX + 1; + nextY= currY; + break; + case 1: + nextX = currX; + nextY = currY + 1; + break; + case 2: + nextX = currX - 1; + nextY = currY; + break; + case 3: + nextX = currX; + nextY = currY - 1; + break; + } + if(nextX >= 0 && nextX < h && nextY >= 0 && nextY < w && grid[nextX][nextY] != 'X' && !(nextX == came_from[currX][currY].first && nextY == came_from[currX][currY].second)) + { + if(grid[nextX][nextY] == 'D') + { + ans = currCost; + flag = true; + break; + } + nextCost = currCost + grid[nextX][nextY] - '0'; + came_from[nextX][nextY] = mp(currX, currY); + frontier.push(mpp(nextCost, nextX, nextY)); + } + } + } + cout << ans << endl; + } + return 0; +} diff --git a/SPOJ/Square Brackets.cpp b/SPOJ/Square Brackets.cpp new file mode 100755 index 0000000..b55e589 --- /dev/null +++ b/SPOJ/Square Brackets.cpp @@ -0,0 +1,47 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll d; + cin >> d; + while(d--) + { + ll n, k, i, j; + cin >> n >> k; + bool s[2*n + 1]; + memset(s, false, sizeof(s)); + for(i = 0; i < k; i++) + { + cin >> j; + s[j] = true; + } + ll cnt[50][50]; + cnt[1][0] = 0; cnt[1][1] = 1; + for(i = 2; i <= 2*n; i++) + { + cnt[1][i] = 0; + } + for(i = 2; i <= 2*n; i++) + { + for(j = 0; j <= i; j++) + { + if(s[i]) + { + cnt[i][j] = ((j == 0) ? 0 : cnt[i-1][j-1]); + } + else + { + cnt[i][j] = cnt[i-1][j+1] + ((j==0) ? 0: cnt[i-1][j-1]); + } + } + } + cout << cnt[2*n][0] << endl; + } + return 0; +} diff --git a/SPOJ/Street Parade.cpp b/SPOJ/Street Parade.cpp new file mode 100755 index 0000000..64fa7ea --- /dev/null +++ b/SPOJ/Street Parade.cpp @@ -0,0 +1,56 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + while(true) + { + ll n, i, num, tp; + cin >> n; + if(n == 0) + { + break; + } + queue parade; + stack side; + for(i = 1; i <= n; i++) + { + cin >> num; + parade.push(num); + } + num = 1; + while(!parade.empty()) + { + tp = parade.front(); + parade.pop(); + if(tp != num) + { + side.push(tp); + } + else + num++; + if(!side.empty()) + { + tp = side.top(); + while(tp == num) + { + side.pop(); + num++; + if(!side.empty()) + tp = side.top(); + } + } + + } + if(side.empty()) + cout << "yes" << endl; + else + cout << "no" << endl; + } + return 0; +} diff --git a/SPOJ/Sum of Product.cpp b/SPOJ/Sum of Product.cpp new file mode 100755 index 0000000..8b5fa61 --- /dev/null +++ b/SPOJ/Sum of Product.cpp @@ -0,0 +1,31 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MOD 1000000007 + +ll sumProd(ll n) +{ + ll sum = 2*n, i; + sum %= MOD; + for(i = 2; i*i <= n; i++) + { + sum += 2*(n/i) * i; + sum %= MOD; + } + return sum; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n; + cin >> n; + cout << sumProd(n) << endl; + } + return 0; +} diff --git a/SPOJ/Sums in a triangle.cpp b/SPOJ/Sums in a triangle.cpp new file mode 100755 index 0000000..bf491e3 --- /dev/null +++ b/SPOJ/Sums in a triangle.cpp @@ -0,0 +1,2 @@ +#include +using namespace std;int main(){int t,n,i,j,r[101][101];cin>>t;while(t--){cin>>n;;for(i=1;i<=n;i++){for(j=i;j>0;j--){cin>>r[i][j];}}for(i=n-1;i>0;i--){for(j=i;j>0;j--)r[i][j]+=max(r[i+1][j],r[i+1][j+1]);}cout< +using namespace std; +#define endl '\n' +#define ll long long + +ll dp[222][222], countT[222]; +ll calc(string rock, ll s, ll e, ll num1s) +{ + ll l1, l2; + if(s > e || num1s <= 0) + { + return dp[s][e] = 0; + } + if(s == e) + { + return dp[s][e] = num1s; + } + if(dp[s][e] != -1) + { + return dp[s][e]; + } + if(num1s > e-s+1 - num1s) + { + return dp[s][e] = e-s+1; + } + else + { + for(ll k = s; k < e; k++) + { + dp[s][e] = max(dp[s][e], calc(rock, s, k, countT[k] - countT[s-1]) + calc(rock, k+1, e, countT[e] - countT[k])); + } + return dp[s][e]; + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, i, num1s = 0; + string rock, temp = "0"; + cin >> n >> rock; + rock = temp + rock; + countT[0] = 0; + for(i = 1; i <= n; i++) + { + if(rock[i] == '1') + { + countT[i] = countT[i-1]+1; + } + else + { + countT[i] = countT[i-1]; + } + } + num1s = countT[n]; + memset(dp, -1, sizeof(dp)); + cout << calc(rock, 1, n, num1s) << endl; + } + return 0; +} diff --git a/SPOJ/The Courier.cpp b/SPOJ/The Courier.cpp new file mode 100755 index 0000000..9e91e38 --- /dev/null +++ b/SPOJ/The Courier.cpp @@ -0,0 +1,84 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define INF 999999999999 +#define mp make_pair +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, m, b, i, j, k, u, v, d, z; + cin >> n >> m >> b; + ll graph[n][n], dist[n][n]; + for(i = 1; i <= n; i++) + { + for(j = 1; j <= n; j++) + { + graph[i][j] = INF; + if(i == j) + { + graph[i][j] = 0; + } + } + } + for(i = 0; i < n; i++) + { + cin >> u >> v >> d; + if(graph[u][v] > d) + { + graph[u][v] = d; + graph[v][u] = d; + } + } + for(i = 1; i <= n; i++) + { + for(j = 1; j <= n; j++) + { + dist[i][j] = graph[i][j]; + } + } + for(k = 1; k <= n; k++) + { + for(i = 1; i <= n; i++) + { + for(j = 1; j <= n; j++) + { + if(dist[i][k] + dist[k][j] < dist[i][j]) + { + dist[i][j] = dist[i][k] + dist[k][j]; + } + } + } + } + for(i = 1; i <= n; i++) + { + for(j = 1; j <= n; j++) + { + cout << i << " to " << j << " is " << dist[i][j] << endl; + } + } + /*cin >> z; + vector > > orders; + ll best = INF, secBest = INF; + for(i = 0; i < z; i++) + { + cin >> u >> v >> d; + orders.push_back(mp(d, mp(u, v))); + if(dist[b][u] < best) + { + best = dist[b][u]; + } + } + for(i = 0; i < z; i++) + { + if(orders[i].second.first != best && dist[orders[i].second.first][b] < secBest) + secBest = orders[i].second.first; + }*/ + } + return 0; +} diff --git a/SPOJ/The Knapsack Problem.cpp b/SPOJ/The Knapsack Problem.cpp new file mode 100755 index 0000000..82dde59 --- /dev/null +++ b/SPOJ/The Knapsack Problem.cpp @@ -0,0 +1,42 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll knapsack(ll s, ll n, ll vals[], ll weights[]) +{ + ll sack[n+1][s+1], i, j; + for(i = 0; i <= n; i++) + { + for(j = 0; j <= s; j++) + { + if(i == 0 || j == 0) + { + sack[i][j] = 0; + } + else if(weights[i-1] > j) + { + sack[i][j] = sack[i-1][j]; + } + else + { + sack[i][j] = max(sack[i-1][j], vals[i-1] + sack[i-1][j - weights[i-1]]); + } + } + } + return sack[n][s]; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll s, n, i; + cin >> s >> n; + ll weights[n], vals[n]; + for(i = 0; i < n; i++) + { + cin >> weights[i] >> vals[i]; + } + cout << knapsack(s, n, vals, weights) << endl; + return 0; +} diff --git a/SPOJ/Traffic Network.cpp b/SPOJ/Traffic Network.cpp new file mode 100755 index 0000000..7fcb3e5 --- /dev/null +++ b/SPOJ/Traffic Network.cpp @@ -0,0 +1,75 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define mp make_pair +#define pii pair +#define INF 9999999999 + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll tests; + cin >> tests; + while(tests--) + { + ll n, m, k, s, t, i, j, di, ci, li, alt; + cin >> n >> m >> k >> s >> t; + list > paths[n+1]; + pair currK; + pii currKf; ll currKs; + for(i = 0; i < m; i++) + { + ll di, ci, li; + cin >> di >> ci >> li; + paths[di].push_back(mp(li, mp(ci, 0))); + } + ll minDistance = INF; + for(i = 0; i < k; i++) + { + cin >> di >> ci >> li; + paths[di].push_back(mp(li, mp(ci, 1))); + paths[ci].push_back(mp(li, mp(di, 1))); + } + ll dist[n+1][2]; + bool visited[n+1][2]; + for(j = 1; j <= n; j++) + { + dist[j][0] = INF; + dist[j][1] = INF; + visited[j][0] = false; + visited[j][1] = false; + } + priority_queue, vector >, greater > > frontier; + frontier.push(mp(0, mp(s, 0))); + pair curr, next; + while(!frontier.empty()) + { + curr = frontier.top(); + frontier.pop(); + if(visited[curr.second.first][curr.second.second]) + continue; + visited[curr.second.first][curr.second.second] = true; + if(curr.second.first == t) + { + minDistance = curr.first; + break; + } + for(list >::iterator it = paths[curr.second.first].begin(); it != paths[curr.second.first].end(); it++) + { + next = *it; + if(curr.second.second && next.second.second) + { + continue; + } + frontier.push(mp(next.first+curr.first, mp(next.second.first, curr.second.second|next.second.second))); + } + } + if(minDistance == INF) + cout << -1 << endl; + else + cout << minDistance << endl; + } + return 0; +} diff --git a/SPOJ/Treat for the Cows.cpp b/SPOJ/Treat for the Cows.cpp new file mode 100755 index 0000000..1c8ade7 --- /dev/null +++ b/SPOJ/Treat for the Cows.cpp @@ -0,0 +1,71 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAXN 2222 +ll len, dp[MAXN][MAXN], treats[MAXN]; +ll recurMaxM(ll i, ll j) +{ + if(i > j || i < 0 || j > len) + { + return 0; + } + else + { + if(dp[i][j] != -1) + { + return dp[i][j]; + } + ll age = len - j + i; + return dp[i][j] = max(treats[i]*age + recurMaxM(i+1, j), treats[j]*age + recurMaxM(i, j-1)); + } +} +ll maxM(ll treats[], ll n) +{ + ll i, j, t; + for(i = 0; i <= n; i++) + { + dp[i][0] = dp[n][i] = 0; + } + for(i = n-1; i >= 0; i--) + { + for(j = 0; j < n; j++) + { + if(i > j) + { + dp[i][j] = 0; + } + else + { + ll age = n - (j - i + 1) + 1; + t = dp[i][j] = treats[i]*age + dp[i+1][j]; + if(j > 0) + { + t = dp[i][j] = max(dp[i][j], treats[j]*age + dp[i][j-1]); + } + } + } + } + return dp[0][n-1]; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, j; + for(i = 0; i < MAXN; i++) + { + for(j = 0; j < MAXN; j++) + { + dp[i][j] = -1; + } + } + cin >> n; + len = n; + for(i = 0; i < n; i++) + { + cin >> treats[i]; + } + cout << recurMaxM(0, n-1) << endl; //Use anyone recur or dp + return 0; +} diff --git a/SPOJ/Trip.cpp b/SPOJ/Trip.cpp new file mode 100755 index 0000000..d823b19 --- /dev/null +++ b/SPOJ/Trip.cpp @@ -0,0 +1,79 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +map isPresent; +string alice, bob; +vector css; +ll maxLength; +void getCS(string cs, ll aliceS, ll bobS) +{ + if(aliceS >= alice.length() || bobS >= bob.length()) + { + if(cs.length() == maxLength && !isPresent[cs]) + { + isPresent[cs] = true; + css.push_back(cs); + } + return; + } + if(isPresent[cs]) + { + return; + } + if(alice[aliceS] == bob[bobS]) + { + cs += alice[aliceS]; + getCS(cs, aliceS+1, bobS+1); + } + else + { + getCS(cs, aliceS+1, bobS); + getCS(cs, aliceS, bobS+1); + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + isPresent.clear(); css.clear(); + cin >> alice >> bob; + ll i, j, lcs[alice.length()+1][bob.length()+1]; + for(i = 0; i <= alice.length(); i++) + { + for(j = 0; j <= bob.length(); j++) + { + if(i == 0 || j == 0) + { + lcs[i][j] = 0; + } + else if(alice[i-1] == bob[j-1]) + { + lcs[i][j] = 1 + lcs[i-1][j-1]; + } + else + { + lcs[i][j] = max(lcs[i-1][j], lcs[i][j-1]); + } + } + } + maxLength = lcs[alice.length()][bob.length()]; + getCS("", 0, 0); + sort(css.begin(), css.end()); + for(i = 0; i < css.size(); i++) + { + cout << css[i] << endl; + } + if(css.size() == 0) + { + cout << endl; + } + cout << endl; + } + return 0; +} diff --git a/SPOJ/Two Ends.cpp b/SPOJ/Two Ends.cpp new file mode 100755 index 0000000..2077cd7 --- /dev/null +++ b/SPOJ/Two Ends.cpp @@ -0,0 +1,54 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +ll dp[1111][1111]; +ll getMaxDiff(ll cards[], ll start, ll end, ll turn) +{ + ll sum; + if(start > end) + { + return 0; + } + if(dp[start][end] != -1) + { + return dp[start][end]; + } + if(turn == 0) + { + sum = max(cards[start] - getMaxDiff(cards, start+1, end, !turn), cards[end] - getMaxDiff(cards, start, end-1, !turn)); + } + else + { + if(cards[start] >= cards[end]) + { + sum = (cards[start] - getMaxDiff(cards, start+1, end, !turn)); + } + else + { + sum = cards[end] - getMaxDiff(cards, start, end-1, !turn); + } + } + return dp[start][end] = sum; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll game = 1; + while(true) + { + ll n, i; + cin >> n; + ll cards[n]; + if(n == 0) break; + for(i = 0; i < n; i++) + { + cin >> cards[i]; + } + memset(dp, -1, sizeof(dp)); + cout << "In game " << game << ", the greedy strategy might lose by as many as " << getMaxDiff(cards, 0, n-1, 0) << " points.\n"; + game++; + } + return 0; +} diff --git a/SPOJ/Update the array!.cpp b/SPOJ/Update the array!.cpp new file mode 100755 index 0000000..2cc3b30 --- /dev/null +++ b/SPOJ/Update the array!.cpp @@ -0,0 +1,57 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +ll ft[11111], n; +void updateTree(ll index, ll val) +{ + while(index <= n) + { + ft[index] += val; + index += index & (-index); + } +} +void updateTree(ll l, ll r, ll val) +{ + updateTree(l, val); + updateTree(r+1, -val); +} +ll query(ll index) +{ + ll sum = 0; + while(index > 0) + { + sum += ft[index]; + index -= index & (-index); + } + return sum; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll u, i, q, l, r, val, ind; + cin >> n >> u; + for(i = 0; i <= n; i++) + { + ft[i] = 0; + } + for(i = 0; i < u; i++) + { + cin >> l >> r >> val; + updateTree(l+1, r+1, val); + } + cin >> q; + for(i = 0; i < q; i++) + { + cin >> ind; + cout << query(ind+1) << endl; + } + } + return 0; +} diff --git a/SPOJ/Wachovia Bank.cpp b/SPOJ/Wachovia Bank.cpp new file mode 100755 index 0000000..529996c --- /dev/null +++ b/SPOJ/Wachovia Bank.cpp @@ -0,0 +1,39 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll k, m, i, j; + cin >> k >> m; + ll weights[m], vals[m]; + for(i = 0; i < m; i++) + { + cin >> weights[i] >> vals[i]; + } + ll knapsack[m+1][k+1]; + for(i = 0; i <= m; i++) + { + for(j = 0; j <= k; j++) + { + if(i == 0 || j == 0) + { + knapsack[i][j] = 0; + } + else if(weights[i-1] > j) + knapsack[i][j] = knapsack[i-1][j]; + else + knapsack[i][j] = max(knapsack[i-1][j], vals[i-1] + knapsack[i-1][j - weights[i-1]]); + } + } + cout << "Hey stupid robber, you can get " << knapsack[m][k] << "." << endl; + } + return 0; +} diff --git a/SPOJ/Where to Drink the Plonk.cpp b/SPOJ/Where to Drink the Plonk.cpp new file mode 100755 index 0000000..380004a --- /dev/null +++ b/SPOJ/Where to Drink the Plonk.cpp @@ -0,0 +1,34 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define pii pair +#define mp make_pair +#define x first +#define y second + +bool wayToSort(pii a, pii b) +{ + return (a.x == b.x) ? a,y < b.y : a.x < b.x; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll t; + cin >> t; + while(t--) + { + ll n, i; + pii house; + cin >> n; + pii houses[n]; + for(i = 0; i < n; i++) + { + cin >> house.x >> house.y; + houses[i] = house; + } + sort(houses, houses + n, wayToSort); + } + return 0; +} diff --git a/Shahblah.cpp b/Shahblah.cpp new file mode 100755 index 0000000..0164a85 --- /dev/null +++ b/Shahblah.cpp @@ -0,0 +1,48 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int maxVal(ll x, ll y, ll z, ll n) +{ + ll table[n+1], i, j; + table[0] = 0; + for (i = 1; i <= n; i++) + table[i] = INT_MIN; + + for (i = 1; i <= n; i++) + { + if (x <= i) + { + int sub_res = table[i-x]; + if (sub_res + 1 > table[i]) + table[i] = sub_res + 1; + } + if (y <= i) + { + int sub_res = table[i-y]; + if (sub_res + 1 > table[i]) + table[i] = sub_res + 1; + } + if (z <= i) + { + int sub_res = table[i-z]; + if (sub_res + 1 > table[i]) + table[i] = sub_res + 1; + } + } + return table[n]; +} +int main() +{ + ll t; + cin >> t; + while(t--) + { + ll x, y, z, n; + cin >> n >> x >> y >> z; + cout << maxVal(x, y, z, n) << endl; + } + return 0; +} diff --git a/Square Country.cpp b/Square Country.cpp new file mode 100755 index 0000000..514ae4e --- /dev/null +++ b/Square Country.cpp @@ -0,0 +1,30 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + ll n, i, j, minN; + cin >> n; + ll arr[n+1]; + arr[0] = 0; + arr[1] = 1; + arr[2] = 2; + for(i = 3; i <= n; i++) + { + minN = arr[i-1] + 1; + for(j = 2; j*j <= i; j++) + { + if(minN > arr[i - j*j] + 1) + { + minN = arr[i - j*j] + 1; + } + } + arr[i] = minN; + } + cout << arr[n]; + return 0; +} diff --git a/Try.cpp b/Try.cpp new file mode 100755 index 0000000..33eb6b1 --- /dev/null +++ b/Try.cpp @@ -0,0 +1,16 @@ +#include + +int main(int argc, char *argv[]) +{ + if (argc != 0) { + printf("Seems like I still have some arguments! Not allowed!\n"); + int i; + for (i = 0; i < argc; i++) { + printf("%s\n", argv[i]); + } + return 1; + } + printf("Yaay! You didn't give any arguments!\n"); + printf("The flag is flag{source_code}\n"); + return 0; +} diff --git a/Try1.cpp b/Try1.cpp new file mode 100755 index 0000000..3b7cc65 --- /dev/null +++ b/Try1.cpp @@ -0,0 +1,119 @@ +#include "bits/stdc++.h" +using namespace std; +const int N = 115; +string str; +namespace notimportant{ + map < char , int > M; + void notforprecomputation(){ + M['M'] = 72; + M['B'] = 71; + M['J'] = 79; + M['x'] = 123; + M['A'] = 68; + M['b'] = 97; + M['6'] = 52; + M['f'] = 101; + M['d'] = 103; + M['t'] = 119; + M['S'] = 86; + M['^'] = 86; + M['g'] = 100; + M['o'] = 108; + M['z'] = 121; + M['a'] = 98; + M['p'] = 115; + M['w'] = 116; + M['R'] = 87; + M['I'] = 76; + M['v'] = 117; + M['&'] = 46; + M[';'] = 51; + M['/'] = 39; + M['H'] = 77; + M['G'] = 66; + M['L'] = 73; + M['F'] = 67; + M['E'] = 64; + M['C'] = 70; + M['0'] = 50; + M['2'] = 48; + M['j'] = 105; + M['4'] = 54; + M['n'] = 109; + M['Z'] = 95; + M['D'] = 65; + M['r'] = 113; + M['Q'] = 84; + M['9'] = 59; + M['_'] = 87; + M['O'] = 74; + M['N'] = 75; + M['Y'] = 92; + M['3'] = 49; + M['|'] = 116; + M['T'] = 81; + M['U'] = 80; + M['7'] = 53; + M['K'] = 78; + M['h'] = 107; + M['V'] = 83; + M['c'] = 96; + M['q'] = 114; + M['P'] = 85; + M['y'] = 122; + M['i'] = 106; + M['k'] = 104; + M['s'] = 112; + M['1'] = 51; + M['m'] = 110; + M['u'] = 118; + M['8'] = 58; + M[','] = 36; + M['e'] = 102; + M['5'] = 55; + M['W'] = 82; + M['l'] = 111; + M['X'] = 93; + } + const int mod1 = 1e9 + 7; + const int mod2 = 1e9 + 9; + long long pw1[N]; + long long pw2[N]; + string myphonenumbers = "916051248 362432300"; + bool this_function_does_not_encrypt_strings(string res) + { + notforprecomputation(); + pw1[0] = 1; + pw2[0] = 1; + for(int i = 1 ; i < res.size() ; ++i){ + pw1[i] = (1LL * pw1[i - 1] * 33) % mod1; + pw2[i] = (1LL * pw2[i - 1] * 33) % mod2; + } + long long val1 = 0; + long long val2 = 0; + for(int i = 0 ; i < res.size() ; ++i){ + val1 *= pw1[i]; + val1 += M[res[i]]; + val1 %= mod1; + val2 *= pw2[i]; + val2 += M[res[i]]; + val2 %= mod2; + } + //cout << myphonenumbers << endl << val1 << " " << val2 << endl; + if(val1 == 916051248 && val2 == 362432300){ + return 1; + } + return 0; + } + +} +int main(){ + //freopen("out.out", "r", stdin); + while(cin >> str) + { + if(notimportant::this_function_does_not_encrypt_strings(str)) + { + cout << "Correct\n" << str; + } + } +} diff --git a/Wealth Disparity.cpp b/Wealth Disparity.cpp new file mode 100755 index 0000000..bf74efa --- /dev/null +++ b/Wealth Disparity.cpp @@ -0,0 +1,51 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAX 111111 +#define INF 111111111 +ll arr[MAX], parent[MAX], maxDiff = -INF, visited[MAX]; +vector adjList[MAX]; +void dfs(ll start, ll maxTill) +{ + visited[start] = 1; + maxTill = max(maxTill, arr[start]); + ll i; + for(i = 0; i < adjList[start].size(); i++) + { + if(!visited[adjList[start][i]]) + { + maxDiff = max(maxDiff, maxTill - arr[adjList[start][i]]); + dfs(adjList[start][i], maxTill); + } + } +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + //freopen("test.in", "r", stdin); + ll n, i; + cin >> n; + ll manager; + for(i = 1; i <= n; i++) + { + cin >> arr[i]; + visited[i] = 0; + } + for(i = 1; i <= n; i++) + { + cin >> parent[i]; + if(parent[i] == -1) + { + manager = i; + } + else + { + adjList[parent[i]].push_back(i); + } + } + dfs(manager, arr[manager]); + cout << maxDiff << endl; + return 0; +} diff --git a/fcs.cpp b/fcs.cpp new file mode 100755 index 0000000..75c53fb --- /dev/null +++ b/fcs.cpp @@ -0,0 +1,49 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + + ll n, m, capic[1111], i; +bool findIt(ll capacity) +{ + ll total = 0, curr = 0; + for(i = 0; i < n; i++) { + if(capic[i] > capacity) + return 0; + if(curr + capic[i] > capacity) + curr = 0; + if(curr == 0) + total++; + curr += capic[i]; + if(total > m) + return 0; + } + return 1; +} + +int main() +{ + ll t; + cin >> t; + while(t--) + { + cin >> n >> m; + for(i = 0; i < n; i++) + cin >> capic[i]; + ll high = 1000000000, low = 0; + while(high - low > 0) { + if(findIt(high)) + { + high = (low+high)/2; + } + else + { + low = high; + high = high + high / 2; + } + } + cout << high+1 << endl; + } + return 0; +} diff --git a/gen.cpp b/gen.cpp new file mode 100755 index 0000000..38ed669 --- /dev/null +++ b/gen.cpp @@ -0,0 +1,13 @@ +/* Written By Manav Aggarwal */ +#include +#include +using namespace std; +#define endl '\n' +#define ll long long +#define MAX 300010 +int main() +{ + ios_base::sync_with_stdio(0); cin.tie(0); + + return 0; +} diff --git a/hackit.cpp b/hackit.cpp new file mode 100755 index 0000000..73f7a07 --- /dev/null +++ b/hackit.cpp @@ -0,0 +1,60 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +static inline bool is_base64(unsigned char c) { + return (isalnum(c) || (c == '+') || (c == '/')); +} +static const std::string base64_chars = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; + +string base64_decode(std::string const& encoded_string) { + int in_len = encoded_string.size(); + int i = 0; + int j = 0; + int in_ = 0; + unsigned char char_array_4[4], char_array_3[3]; + std::string ret; + + while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) { + char_array_4[i++] = encoded_string[in_]; in_++; + if (i ==4) { + for (i = 0; i <4; i++) + char_array_4[i] = base64_chars.find(char_array_4[i]); + + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + + for (i = 0; (i < 3); i++) + ret += char_array_3[i]; + i = 0; + } + } + + if (i) { + for (j = i; j <4; j++) + char_array_4[j] = 0; + + for (j = 0; j <4; j++) + char_array_4[j] = base64_chars.find(char_array_4[j]); + + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + + for (j = 0; (j < i - 1); j++) ret += char_array_3[j]; + } + + return ret; +} +int main() +{ + ios_base::sync_with_stdio(false); cin.tie(0); + cout << base64_decode("SEVMTE8="); + return 0; +} diff --git a/set.cpp b/set.cpp new file mode 100755 index 0000000..eb4eea0 --- /dev/null +++ b/set.cpp @@ -0,0 +1,28 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long +set vis; +void recur(string src, ll len, ll prev, string curr) +{ + ll i = prev+1; + if(curr.length() == len) + { + vis.insert(curr); + } + else + { + while(i < src.length()) + { + recur(src, len, i, curr+src[i]); + i++; + } + } +} +int main() +{ + recur("gargantuan", 5, -1, ""); + cout << vis.size(); + return 0; +} diff --git a/xor.cpp b/xor.cpp new file mode 100755 index 0000000..e7c43e1 --- /dev/null +++ b/xor.cpp @@ -0,0 +1,27 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() { + + string message; + ifstream cipher("crypto_4.txt"); + stringstream buffer; + buffer << cipher.rdbuf(); + message = buffer.str(); + string key; + key = "xorcipher\n"; + int k = 9, i = 0; + while(i < message.length()) + { + message[i] ^= key[k]; + k++; + k %= key.length(); + i++; + } + cout << message; + cout << endl << k; + return 0; +} diff --git a/xorc.cpp b/xorc.cpp new file mode 100755 index 0000000..fdbd529 --- /dev/null +++ b/xorc.cpp @@ -0,0 +1,14 @@ +/* Written By Manav Aggarwal */ +#include +using namespace std; +#define endl '\n' +#define ll long long + +int main() +{ + + int c, d; + cin >> c >> d; + cout << (char)(c ^ d) << endl; + return 0; +}