CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Long 2012
    • May Cook-Off
    • May Long 2012
  • DISCUSS
    • Forums
    • Blog
    • Wiki
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
    • Event Calendar
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Practice(EXTCONTEST)
Try your hand at one of the practice
         problems, and submit your solution in the language of your choice
         (our judge accepts solutions in over 35+ languages). Receive points,
         and move up through the CodeChef ranks. Get better, and better prepare
         yourself for the competitions
  • Easy
  • Medium
  • Hard
  • Challenge
  • Peer
Name Code Successful Submissions Accuracy
Problem 1 CMB01 913 40.15
Palindrome DPC206 774 50.33
Modulo NSIT13 500 42.25
Problem 2 CMB02 426 56.72
Anagram TECH04 418 29.45
Problem 3 CMB03 334 45.91
Carry DPC101 283 34
Riled ARAN01 219 50
Hardware Store CRAFT05 195 58.53
Fibonacci DPC204 187 44.47
Programmer Jackpot CREDE2 172 70.43
Numbers, Numbers, Numbers MANIP2 163 54.62
I Spy You CD202 147 40.43
Problem 4 CME04 119 62.68
Not that Digit NSIT15 118 45.26
Square TECH07 109 34.71
StringCode RGPVR101 101 46.24
Reinfected ARAN03 97 84.5
Rumble ARAN07 88 61.49
Jump it up CD101 84 57.54
Windows DPC107 78 57.41
Cricket RGPVR102 74 67.69
On The Floor ENCODE01 73 50.18
Triangles AD2 72 76.14
Fact-o-real AXR1P2 70 34.3
Windows DPC207 66 76.04
RectangleArea RGPVR103 61 60.83
Calendar CLNDR 57 30.23
Decreasing Strings TECH09 56 38.07
Developer or Tester ENCODE04 52 35.94
Clean the Forum Posts CLNFORUM 50 39.35
Roman Numerals CS05 47 71.26
Consecutive Numbers RUBIX4 47 49.32
Teachers Aide KC01 45 16.77
Algorithm Challenge SALG01 43 47.52
Sky is the Limit KC03 41 40.82
Maximum Difference Sum MAXSUM 41 24.88
MineSweeper DPC103 39 29.5
Spiral Numbers SPRLNMS 39 53.33
Transformers AXR3P3 38 66.67
No Zeroes please! TESTTT5 34 19.07
A Simple Equation TECH08 33 27.01
Book Pages CSEA2 32 35.65
Synapse Crypt Secrets SYNCRYPT 32 21.46
String encryption NOPC9 31 89.74
Mughal Garden PRAYAS01 28 45.59
Decepticons Message match NOPC1 27 80.95
Balanced Primes BALPRIME 26 52.63
Arithmancy ARTHMNCY 25 28.95
Divisor Sum ALK1105 25 30.33
Counting Stars COUNTSTR 25 80.95
Simple problem A112 24 88.89
Collinear Points CB04 24 26.67
Nonsense with ASCII CDS003 24 48.28
Childs Play DPC210 22 56.86
Round and Round we Go MANIP3 21 23.66
Best Rectangle ENCD06 21 21.19
Paper Cube DPC104 20 67.65
The Cipher C3003 19 66.67
Nails TECH06 19 36.54
The Fianchettoed Piece AXR1P3 18 34.57
Celebrities of Pretendia IOPC1214 18 31.76
Day from Date NOPC10 18 96.15
Pleasing the Martian King IITI00 18 66.67
Billiard Lead Calculator A111 17 38.54
Gray Codes GRAYCODE 17 40.68
How Many Triangles CB02 16 21.84
Water Problem A102 16 70.83
Needful Things COOP5 16 28.26
Alphabets DPC203 16 26.03
ChessBoard A103 16 22.52
CricInfo CRICINFO 15 29.41
Divisor Summation PD13 15 46
Grid TECH05 15 24.68
Number of Odd and Even Numbers ODDEVENX 15 68.18
Flibonakki AVISKR02 14 11.63
Destroy the Enemy CRAFT02 13 35.9
Wanna Eat Cookies CDS002 13 58.33
Rational Numbers TQ2 13 42.5
Greedy Government GREEDY 12 53.85
Space Component C3001 12 58.62
Numbers DPC102 12 75
Connected Components CC 12 44.44
Factorial Pizza ALGFACT 12 50
Get Synapse Online SYNOL 11 50
Absolute value of a number ABSNUM 11 68.42
Silly YooTi CRNM1207 11 20
Crazy texting IOPC1203 10 14.71
PrimePlusPlus ALGPRX 10 25.32
I am Exponential CS001 10 36.36
The Production Manager RBX12R03 10 63.16
nCr as a Service NCRAAS 10 35.29
Frequent Prime Ranges TECH12 10 34.21
MOUNTAIN WALKING QCJ5 10 61.9
Game ALK1104 10 63.16
Head over meals CD104 10 40.74
Binomial Coefficient CB01 10 15.58
We dont fall outnumber in battlefield NOPC3 10 93.33
Lucky Numbers Again RUBIX5 10 22.81
What is your IP DSPCXI01 9 9.71
Interesting List ENCD03 9 50
Factorial FACTEASY 9 62.5
Maximum Profit BTCODE_D 9 50
A Negative Base Problem ENCD05 9 22.64
Temple Queues TEMPQUE 9 33.33
The Two Little Sisters CRNM1202 9 48.39
Disc Stack AXR2P2 9 30.3
Synapse ,Life Universe and Everything SYLLUE 9 75
BOB Gaming KC201 9 17.24
Play With Strings WYSIWYG4 9 83.33
Paths to a point C3005 8 30
Recon ARAN05 8 70
Max pow LMDP1103 8 26.09
Spreadsheet scrolling IOPC1101 8 25
Triangle A109 8 81.82
The Shortest Path RBX12R01 8 12.33
Toss the Coin SOPC04 7 28
How many Islands PD12 7 33.33
Perfect Timing COOP4 7 57.89
References DPC106 7 80
Exclusive Cities PRAYAS04 7 35
Flag Problem A108 7 100
Array DPC209 7 50
Chocolate distribution IOPC1102 7 14.89
Mr and Mrs Ant MMANT 6 18.52
As Far As It Takes Me PRAYAS02 6 25
Is it a tree PD31 6 100
Sunny and Isha CRNM1201 6 27.03
Hostel LAN Connection ENCD11 6 25
Traversing Grid BTCODE_A 6 21.43
Next Palindrome NXTPALIN 6 11.11
The Shed Problem EN01 6 35.29
Revise Your Geometry MANIP4 6 38.46
Romeo and Juliet TOGETHER 6 19.35
House ALG07 6 27.27
THE GAME QCJ6 6 46.15
The Number Game CREDE4 6 35
Ice-Cream Mania ENCODE02 6 33.33
Colouring graphs IOPC1213 6 81.82
Relationship NOPC4 5 100
Favorite Sub Hair FAVSUBS 5 29.17
City of Romini CRNM1205 5 22.03
Triangles ENCD09 5 27.78
Welcome to Conscientia TGPA01 5 50
Find the Clones PD11 5 38.46
Darshits Dilemma ARDD 5 60
Shoppers AVISKR05 5 25.93
Protecting Sheep PRTCTSHP 5 20.83
Board TECH13 5 66.67
CRC CS02 5 45.45
Cards ALG01 5 40
The Grid CREDE3 5 35.71
Candies and Milestones MILESTN 5 13.51
REVSTR NF03 5 46.15
The Rectangular Frame RBX12R02 4 100
Word Mess EN03 4 40
A Numbers Game ICODER1 4 17.39
Card Problem A105 4 9.09
Slow Growing Bacteria AVISKR04 4 9.43
Can You Multiply DSPCXI02 4 54.55
Marriage Party A101 4 27.5
Prime Challenge ENCODE05 4 31.58
An unfortunate incident IOPC1210 4 36
Combination Generator SALG04 4 41.67
Share chocolate NOPC6 4 100
Decoder-II A107 4 22.22
Tourist DPC208 4 100
The Legend Lives On! KC204 4 6.59
Multiplying by Rotation CS08 4 100
LCM GCD Love AVISKR01 4 5.56
Coloring Trees BTCODE_G 4 66.67
Sum3 ENCODE13 4 29.17
Quadrilaterals IOPC1202 4 28.57
Magic is in the air CD103 4 40
Politics DPC205 4 85.71
Different World Of Maths CW08 3 28.57
Virus ENCODE11 3 50
Building Towers NSIT11 3 75
Gathering of the Great KC202 3 25
Trie Expectation BTCODE_H 3 42.86
Evaluate the polynomial PD23 3 26.67
Palindromic Subsequences CB03 3 50
AppleTrees DPC201 3 85.71
Road trip IOPC1110 3 60
A function over factors IOPC1204 3 13.33
Tree Sum TRSUM 3 27.27
Gimmicks of the Great RG206 3 50
Bio-HRQ-Comparator DPC202 3 80
HTML Tags TECH10 3 5.45
Barbeque sticks (SET II) ALGBBQ 3 42.86
Corruption again IOPC1216 3 75
Lets Cross The Paths CDS001 3 28.57
Icarus GO ICGO 3 50
Save The Planet ALGINT 3 37.5
Snaky Numbers SNAKENUM 3 60
Permutations TECH14 3 23.08
To and Fro PD33 3 100
Rubiks cube IOPC1201 3 100
All Champions Mathematics Contest CRNM1203 3 10.81
Making Book PD21 3 25
The powerful 2 ALG2N 3 13.64
Utopia strikes back IOPC1212 3 9.68
The Dirty Experiment PRAYAS05 3 13.04
Ski slopes IOPC1113 3 60
GM plants IOPC1207 3 12
Twin Primes TGPA02 3 5.26
Problem5 PRIM5 3 50
Building Ports AVISKR03 2 11.11
Notebook CSEA4 2 66.67
Place-name game IOPC1114 2 28.57
BOXES QCJ1 2 25
The Next Prime AD1 2 4.88
Change of base BASECHG 2 100
A Walk to Remember COOP3 2 75
Decoder-I A106 2 18.18
The Route A001 2 50
Party ALK1102 2 100
The FarmLand Ways CRNM1206 2 38.27
Military patrol IOPC1105 2 22.22
No to corruption IOPC1215 2 42.86
River! River! Take Me Home ALGRIV 2 50
Farhans Football ARFF 2 66.67
The Octopus CD106 2 40
The Templar Test KC205 2 25
Karthik in Loop RBX12R04 2 37.5
COOKIES QCJ3 2 20
Triangle Revisited AD4 2 28.57
Factorial Challenge CW05 2 3.33
Traffic Control CRAFT03 2 33.33
How many Fibs PD32 2 33.33
Alien Pandemia ALNPD 2 100
Life Game BTCODE_F 2 57.14
Hardware upgrade IOPC1200 2 5.71
A day at Canteen C3002 2 100
PRIME PRIME 2 8.2
Mobius Multiplications ENCODE07 2 75
SUM LMDP1104 2 17.65
The numbers game IOPC1211 2 66.67
Octagon Jumps CB05 2 38.46
The Flames Calculation IG01 2 15.38
STRINGENT STRINGS AD3 2 40
The Pillars NOPC7 2 100
Sister cities IOPC1112 2 37.5
An extraordinary Physics Test KC04 2 2.99
Telephone Tangles CDS007 2 100
Minimum Sum WYSIWYG3 2 66.67
Crazy Miner CRZMNR 2 20
HAPPY HOLI (SET II) ALGHLY 2 50
Bank of Synapse SYBANK 2 18.18
The Dilemma of The Lift Giver IG02 2 50
Payload for spacecraft NOPC8 2 100
Painting PAINT 2 17.24
Progressive progressions IOPC1108 2 66.67
Rabbit Hunt A104 2 100
Interesting Martian Trips IITI02 2 20
Gastric Groan RG204 2 28.57
Build the ladder ENCD08 2 66.67
The Forbidden Path IG03 2 100
Sorting Twist SOPC03 2 28.57
IOPC transformation IOPC1208 1 100
Ordering Soldiers ALK1101 1 100
GROUPS INS0902 1 16.67
Are you an arbitrageur CDS004 1 100
Love Magic LM 1 50
Triangle equality IOPC1104 1 33.33
Lucky on Mars IITI03 1 9.52
Goofy Identity RG205 1 12.5
The Beautification Resolution IG04 1 33.33
X Sequence PRAYAS07 1 12.5
Problem Palindrome CW09 1 100
Caught Red Handed CREDF2 1 100
Before Kurukshetra ENCODE10 1 66.67
Chess game LMDP1102 1 16.67
Enumeration again IOPC1209 1 100
Problem1 PRIM1 1 100
Compress the bits for bots NOPC5 1 50
String Permutation Challenge CW04 1 8.33
Permutation Game BTCODE_I 1 20
Min - Max 01 Path PATH01 1 16.67
We live to connect KC02 1 33.33
Secret Treasure ST 1 16.67
Chef at GYM ALGPAN 1 100
Removal ARAN06 1 100
rnumber TECH02 1 3.85
Seating Arrangements RUBIX2 1 20
Codeland Revisited SOPC05 1 12.5
T-shirts ALG05 1 50
Checkmate CREDF3 1 50
A Palindromic Game ENCODE09 1 33.33
Grim Numbers RG201 1 25
Problem2 PRIM2 1 100
Aqualoo Plants ICODER3 1 2.04
Grid Tiling BTCODE_J 1 50
Selecting DreamSpark Volunteers DSPCXI05 1 25
Martian Coin Game IITI05 1 16.67
Gears of War RG207 1 25
Synapse Training Excercises SYNBRIG 1 28.57
Primal Instincts RUBIX3 1 100
Cutting Rods ALG06 1 25
Gollums Pursuit RG202 1 18.18
Money Exchange CW06 1 100
Word Grid DPC105 1 25
Deploy the autobots NOPC2 1 100
The Key A002 1 16.67
Revenge ARAN08 1 100
Giddy Aftermath RG208 1 50
Strange Punishment SP 1 50
Finding Minimum BTCODE_B 1 50
ARRAYSMIN NF02 1 33.33
Jumping Game ENCODE06 1 12.5
Grime and Slime RG203 1 50
Rooks on a Chessboard CB06 1 50
Square It Up AD5 1 100
Flames CW07 1 33.33
The MSTC Team DSPCXI04 1 50
We fight for INSAF KC05 1 2.38
Number Factors ENCD02 1 6.67
Tourist Guide CS04 1 100
Divide it Equally CDS008 1 50
Array Sorting BTCODE_K 1 2.94
The Mother-ship A003 1 100
Dynamic Display Length C3004 1 8
Piggy-Bank PD22 1 50
Million Dollar Vicky PRAYAS06 0 0
Race ALG03 0 0
Beat The Flu CREDF1 0 0
The Wish of the Grandmaster KC06 0 0
Search engine LMDP1101 0 0
Gomti the Cow SALG02 0 0
Choosing The Box WYSIWYG5 0 0
Getting Rid of the Holidays (Act I) HOLIDAY1 0 0
Sense and Sensibility COOP2 0 0
Spiral Chess SC 0 0
Move the books IOPC1109 0 0
Try Some Roman Writing CW03 0 0
Pizza Trouble MANIP6 0 0
Voice Processing Module AXR2P4 0 0
The Battle A004 0 0
Maintaining Roads TECH11 0 0
moksha-2012 TESTTT2 0 0
Problem 1 CME01 0 0
Nesting a Bunch of Brackets CS09 0 0
Hit The Target CRAFT01 0 0
Modular Enigma MDLREN 0 0
Help Tommy MANIP1 0 0
INTERSECTION NF04 0 0
Artifacts ALG09 0 0
Speeds TQ3 0 0
Optimal Scheduling RUBIX1 0 0
BreakTime PGM2 0 0
Enumeration of rationals IOPC1115 0 0
Particles ALG04 0 0
The Discovery of the Millenium KC07 0 0
Thou Last , Thou Loseth KC203 0 0
Shortest Path Problem ENCD04 0 0
Help Munna SALG03 0 0
ROAD BOMBING QCJ2 0 0
Dancing Words EN04 0 0
Cipher CS06 0 0
Fusing Particles ICODER2 0 0
Veenus on Adventure Trip ADVTRIP 0 0
A question of weight CREDE1 0 0
Agua Escasez AXR3P1 0 0
WEIGHTS INS0903 0 0
Can You Help Misty TESTTT3 0 0
Problem 2 CME02 0 0
Anagram CS01 0 0
Stacks of Flapjack CDS005 0 0
How Many Machines WYSIWYG1 0 0
Martian Thief IITI04 0 0
Recover Polynomials BTCODE_E 0 0
Word Metamorphism AXR1P4 0 0
Patterns and Sequences ENCD10 0 0
Roman Numerals in Synapse SYNROMAN 0 0
Fight TGPA03 0 0
FunctionTrouble PGM3 0 0
Vicky For Vendetta PRAYAS08 0 0
Counting the teams IOPC1116 0 0
Are You Superstitious Too CW10 0 0
Everything Goes Around EN05 0 0
Dancing Square CS07 0 0
Bot CSEA1 0 0
Game of Piles PRAYAS03 0 0
Giant fountain IOPC1111 0 0
The Big Fight AXR3P2 0 0
Kingdom Protection ALK1103 0 0
MICAPOKALEBE INS0904 0 0
The magical escape IOPC1205 0 0
College Over! TESTTT4 0 0
Help The Government CDS006 0 0
Circular Permutations WYSIWYG2 0 0
Partitioning the plane IOPC1106 0 0
Conference AXR2P1 0 0
Chip It! TGPA04 0 0
Conversion PGM4 0 0
Crack the DNA CREDF4 0 0
Race ARAN02 0 0
Bulls et Cows CD105 0 0
Jay and Viru SALG05 0 0
Codeland SOPC01 0 0
Problem3 PRIM3 0 0
Subnetting DSPCXI03 0 0
FLAGS INS0905 0 0
Fair bases IOPC1206 0 0
Max Change ENCD01 0 0
Problem 5 CME05 0 0
Reflections CS03 0 0
Simulator CRAFT04 0 0
Leaky containers IOPC1107 0 0
Find The Largest CW01 0 0
Distorted Palindrome ENCD12 0 0
Problem 4 CMB04 0 0
BitEasy PGM5 0 0
Iterated Bitcount Function IBT 0 0
Martian Football Tournament IITI01 0 0
Dairy Day AXR1P1 0 0
Mapping the Swaps TQ1 0 0
Modified Travelling Salesperson Problem ENCD07 0 0
Playing Cards SOPC02 0 0
Filling the Gaps CS10 0 0
Problem4 PRIM4 0 0
Encryption CSEA3 0 0
Wiring ALG02 0 0
Universal Zero AXR3P4 0 0
Problem 3 CME03 0 0
Simple Sorting EN02 0 0
Great Expectations COOP1 0 0
Grand son of Bonacci (TIEBREAKER) ALGBON 0 0
Sorting CW02 0 0
Marbles MANIP5 0 0
The Nutty Professor AXR2P3 0 0
ALIEN CELL INS0901 0 0
TTwenty Final TESTTT1 0 0
Problem 5 CMB05 0 0
Jungle Book CRNM1204 0 0
Alien Dictionary PGM6 0 0
Truly magical numbers IOPC1103 0 0
Fun With Inequalities BTCODE_C 0 0
Cold-Drink ALG08 0 0
Recover ARAN04 0 0
The Game Of Stacks CB07 0 0
FIND HYPOTENUSE QCJ4 0 0
Run Around Numbers RUNARND 0 0
MacroCrack PGM1 0 0

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold

HELP

Program should read from standard input and write to standard output. After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:

 

  • Accepted Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark.
  • Time Limit Exceeded Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach.
  • Wrong Answer Your program compiled and ran succesfully but the output did not match the expected output.
  • Runtime Error Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section.
  • Compilation Error Your code was unable to compile. When you see this icon, click on it for more information.
  • If you are still having problems, see a sample solution here.

CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of algorithms, computer programming and programming contests. At CodeChef we work hard to revive the geek in you by hosting a programming contest at the start of the month and another smaller programming challenge in the middle of the month. We also aim to have training sessions and discussions related to algorithms, binary search, technicalities like array size and the likes. Apart from providing a platform for programming competitions, CodeChef also has various algorithm tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our programming contest judge accepts solutions in over 35+ programming languages. Preparing for coding contests were never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming challenges that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly coding contest and the shorter format Cook-off coding contest. Put yourself up for recognition and win great prizes. Our programming contests have prizes worth up to Rs.20,000 and $700lots more CodeChef goodies up for grabs.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be a part of CodeChef's Forums and interact with all our programmers - they love helping out other programmers and sharing their ideas. Have discussions around binary search, array size, branch-and-bound, Dijkstra's algorithm, Encryption algorithm and more by visiting the CodeChef Forums and Wiki section.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. You can also host a coding contest for your institute on CodeChef, organize an algorithm event and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com