# The Programming Contests, Challenges and Online Judge Thread.



## Sykora (Dec 4, 2007)

Since we have quite a few knowledgeable programmers and more than a few budding programmers, I thought it'd be useful if we had a thread on programming challenges and the like.

In general,


*Contests* are usually played out between participants in realtime.
*Challenges* are mostly formats where you do the problem in your own time and submit the answer -- your score will increase if your answer verified.
*Online Judges* are similar to challenges, but require you to submit the code itself, rather than the answer. The code will be run on the server, and you'll be told if your program passed. Online Judges are usually more difficult than Challenges becuase the server imposes a time limit.

These are some of the challenges I've found the most interesting :

1. Project Euler

Site : *projecteuler.net

Languages : Anything

My favorite up first. Project Euler is a collection of (mostly) mathematical problems that (in general) you'll have to write some sort of program to solve. It's a challenge (in the above sense of the word), so you have as much time as you want to solve the problems in any order using any language. It has the usual ranking system so you can compare yourself to everyone else, as well as within your country. New puzzles are added almost every month or so, but it can vary. The problems range from ridiculously easy, to impossibly hard. There are currently 170 of them. Another thing I like about this one is that each problem has its own forum thread, where people post how they solved it, with the code they used. However one can access the thread for a problem only if they've solved it.

2. Sphere Online Judge (SPOJ)

Site : *spoj.pl

Languages : Lots, 35 to be exact. And yes, you can submit in Brainf*ck Check the site for the full list.

SPOJ is good because it combines problems from almost every other source. They're not mathematical, just normal Computer Science problems. The 3 main limitations that they place on you are the running time, memory usage and code size. There are almost 2000 problems, most of them are easy to solve in general, but hard to solve within the restraints imposed.

3. UVa Online Judge

Site : *icpcres.ecs.baylor.edu/onlinejudge/

Languages : C, C++, Java, Pascal

The same as SPOJ, except you can only use those 4 languages. For this reason, I prefer SPOJ. Same format though, and lots of problems. Some of them are duplicates of SPOJ (or may be the other way around), but for the most part doable.

4. The Python Challenge

Site : *pythonchallenge.com

Languages : It should be obvious...

A dedicated challenge for my favorite language. As far as format goes, it's the same as KlueLESS, but with some required knowledge of Python. For some levels you'll need extra modules not provided with the standard distribution, but all of them are free downloads. This is possibly the best way to get interested in Python. There are 33 levels, and they get hard fairly quickly.

5. OSIX : The Open Source Institute.

Site : *osix.net

Languages : Any

Don't let the name fool you, there isn't much relation to Open Source. OSIX has a number of challenges, including the main "Geek Challenges" which are a series of problems one after the other. The problems are very interesting, but also get hard fairly quickly. Other problem types involve Bonus Levels, which are what you do when you get stuck on the main Geek Challenge. You can attempt these in any order. They also have reverse engineering challenges, and tests for various topics. The site is a bit buggy though, it forgets I'm logged in and keeps asking me for my password and I never get anything done. But that's probably my fault.

6. Code Golf

Site : *codegolf.com

Languages : Python, Perl, Ruby

The main focus of code golf is to solve the problem using the _minimum number of keystrokes_. The problems here are amazingly thought out, and the site in general is nice to read (no programming relevance, but it helps). You are ranked based on the number of bytes of your code, so the shorter the better. Solving these problems is by no means difficult. Coming anywhere near the top scores is insanely hard.

Post here if you're already doing any of these challenges, and definitely post if you've found another challenge that I haven't noted, I'll update my list.

We can discuss the problems, but some of these have very dedicated communities which do not post the solutions to the problems anywhere. I'd like to keep that going, because it takes the fun out of things.


----------



## QwertyManiac (Dec 4, 2007)

Great list! I just knew two of them so far. Code Golf looks like the place where you can rack your brains for short-and-sweet programming, I'll definitely try that one, in addition with the hard nights "The Python Challenge" (On level 12) and Project Euler (4 problems so far) are giving me right now.

Guess you missed the UVa link.


----------



## QwertyManiac (Dec 6, 2007)

Edit:
Solved. Thanks once again exx_2000


----------



## FilledVoid (Dec 6, 2007)

Aren't we allowed to use the other Diagonal as well?


----------



## QwertyManiac (Dec 6, 2007)

Whoops, yeah.

My bad 

Thank you!

Solved 3 today so am slightly unstable perhaps


----------



## FilledVoid (Dec 6, 2007)

Lol. No problems . Ive stopped for today. I think I got three today(thats all I have  )


----------



## QwertyManiac (Dec 7, 2007)

I've done 15 so far in Project Euler. Will dedicate today back to Python Challenge (Still where I said I was).


----------



## Sykora (Dec 7, 2007)

Fixed the UVa link.

My residential gateway screwed with my solution to #12 at the python challenge, so I had to run it on a different computer.

I still haven't gotten #18 at projecteuler. I refuse to try out all the paths .

@exx : What's your username at projecteuler?


----------



## QwertyManiac (Dec 7, 2007)

You could try Graph Theory in #18? I'll try that later ... Two of my solutions so far have taken over 25-50 seconds to solve (Brute Force )


----------



## FilledVoid (Dec 7, 2007)

Sykora said:
			
		

> @exx : What's your username at projecteuler?



BijuMathew is my username there. I might sound like a hypocrite here but I think that Brute Force isn't exactly a good way to go through these problems. But thats just my theory . However finding a good algorithm to go through most of the problems isnt going to be an easy process either.


----------



## Sykora (Dec 7, 2007)

Most of the problems are _designed_ to defeat bruteforce techniques. That's why they give crazy limits of 10**100, etc. As they've stated, all problems can be solved by a program in under a minute on a reasonable machine.


----------



## adi007 (Dec 7, 2007)

Thanks for the info sykora 
registered as adithyau at project euler


----------



## QwertyManiac (Dec 7, 2007)

Well I had to use Brute Force for the first Prime Number related problem since I've never studied much about them. Later I refined the method (including the skips and other things, with a little help from Dromey's How to Solve it by Computer) for the next puzzle.


----------



## The_Devil_Himself (Dec 7, 2007)

me too joined euler but only solved first three,got exams in a few days so no time.

I am not as skilled as you guys in programming but I'll try.I only know basics of c\c++.WIll try to get hold of python after the exams.


----------



## QwertyManiac (Dec 7, 2007)

Any language works for Euler ... Not necessary to go for Python. Its slow anyway, if your methods are brutish.


----------



## FilledVoid (Dec 7, 2007)

> am not as skilled as you guys in programming but I'll try.I only know basics of c\c++.WIll try to get hold of python after the exams.



I used Excel for the first few problems  . Im trying to stay away from languages but it seems other than a handful everythign *needs* to be done with some language etc.


----------



## The_Devil_Himself (Dec 7, 2007)

^^heh.Use some language pal!I am doing this just to practice my c++ skills.


----------



## QwertyManiac (Dec 8, 2007)

About the 18th one. I think I found a way out. Start from the bottom and test which possible addition to the above row gets the maximum value. Eliminate the minimum ones as you go up (max() should be of assistance). 

But the main clue is to start from the bottom and go up. This way you don't see all possible paths exactly, so should work for 67 too? I'll try that one later. Passed 18 for now 

Done 67 as well. 

Timestamp:
	
	



```
real    0m0.043s
user    0m0.036s
sys     0m0.004s
```


----------



## ChaiTan3 (Dec 10, 2007)

Thanks for the links....Currently on projecteuler problem 12


----------



## anarkiLeo (Dec 11, 2007)

Can anybody please tell me any Portal for Java related Contests


----------



## QwertyManiac (Dec 11, 2007)

You can do several of the mentioned in Java, can you not?


----------



## Sykora (Dec 11, 2007)

All of them, except CodeGolf and Pythonchallenge.


----------



## QwertyManiac (Mar 6, 2008)

Can someone post a simple example of how an SPOJ submission should take input as.

Is it via STDIN or via a file? A sample solution that reads one test case amount line, and a test case is enough. Python preferrably.


----------



## aditya.shevade (Mar 7, 2008)

great great sites... just the thing I was looking for


----------



## ::cyborg:: (Mar 7, 2008)

thanks for the links nice thread


----------



## Sykora (Mar 7, 2008)

@Qwerty : 

I think it is mentioned on all problems that input is taken from stdin. However, it is obvious that the input is redirected from a file, and stdout is redirected to a file.

The general construct is this :


```
numTestCases = int(input())
for i in range(numTestCases) :
    # Do stuff here
    #
    #

    print(result)
```

No, I don't store the results and print them out later, because it doesn't make a difference to the judge, and you gain time _and_ space.


----------



## QwertyManiac (Mar 7, 2008)

Thank you for clearing it up! I had got confused about it actually. And thanks for the efficiency tip too. 

Btw, doesn't input() automatically convert to int on passing an input w/o quotes?


----------



## Sykora (Mar 7, 2008)

^^^ I've gotten used to python3.0 where raw_input() became input, and input was removed in favor of eval(input).


----------



## QwertyManiac (Mar 8, 2008)

Oh ok, that's a nice change. 

I vote this thread _sticky.

Edit: And it is! w00t!
_


----------



## QwertyManiac (Mar 9, 2008)

Current Contests (To be held *today*, the *9th of March*):

1. Anna University's CodeArena @ SPOJ.pl (*Contest Ended at 18:00 Hours*)
--------------Allowed Languages: *Many* (C/C++, Java, Ruby and Python inclusive.)

2. IIITM Gwalior's Code Weavers (*Contest Ended at 1800 Hours*)
--------------Allowed Languages: *Restricted* (C/C++, Java)

Both events have team participation as well, so good luck all!

Another good problem resource (Eternal):

IIT-K's Bitwise Annual Algorithm Challenge 
(Its over for this year already, but problems remain, from every Bitwise there ever was. Very good problems!)


----------



## mehulved (Mar 9, 2008)

Did Harsh or Sykora partiticipate? Anyone else did?


----------



## QwertyManiac (Mar 9, 2008)

Yep we did, the CodeArena one. Not sure if anyone else from here did too.


----------



## Sykora (May 4, 2008)

The SPOJ Open Contest 2008 is now running, from May 3 to 20.

You can find it at *www.spoj.pl/ZFUN08/ .


----------



## QwertyManiac (May 4, 2008)

I did the BCH problem there, got a chain of 968 numbers / 1061 maximum  Will try that one again in this week to max out.


----------



## aditya.shevade (May 6, 2008)

^^ Good for you... it looks like you can participate more than once in the same contest.... :-/


----------



## mehulved (Jun 19, 2008)

Registrations have begun for Google Code JAM - *code.google.com/codejam/


----------



## Sykora (Jun 19, 2008)

They've changed the format a lot since last year -- thank goodness for that.


----------



## mehulved (Jun 19, 2008)

Sykora said:


> They've changed the format a lot since last year -- thank goodness for that.


You're participating? I believe harsh is.


----------



## QwertyManiac (Jun 25, 2008)

How would Sykora _not_ participate? 

I haven't the time though, I'll try weekends.


----------



## aditya.shevade (Oct 9, 2008)

hehe... no one will give you answers... you can ask for hints... but not answers directly... and PLEASE do not post answers.


----------



## vamsi360 (Oct 10, 2008)

SORRY..........i was a litil bit excited as it was my first attempt.  Now I solved 5 of them and struck(that too not in order)......NOOOOOOOOOOOOOO

I have deleted the post.....ok


----------



## aditya.shevade (Oct 12, 2008)

Good going... I am on 26 I think... been a long time since I last visited....


----------



## vamsi360 (Nov 20, 2008)

yup...can anyone please give the resource where I could learn mathematical algorithms which are mostly the programmer's heart

Is anybody here particitipating in BITWISE 2009..........Please give us the info


----------



## sankha (Jan 9, 2009)

Can anybody tell me how we can print any line in pure C without using "printf" statement?











_________________________________
protect business information


----------



## nadeemoidu (Feb 9, 2009)

Hello Everyone,

IIIT, Hyderabad is pleased to invite you all to participate in our technical fest "Threads". Here are the 3 events which you may find interesting -

1.Codecraft 09 :
CodeCraft 2009, the online programming competition is all set to start on 15th February,2008. Eight hours of brainstorming over some of the toughest algorithms challenges from various fields of Computer Science, CodeCraft is THE battle of the geeks.

Where : *felicity.iiit.ac.in/codecraft/
When : 15th February , 2009 , 2 pm - 10 pm IST(GMT +5:30).

2. MathematiKa 09 :
MathematiKa 2009 is an online mathematical programming contest which emphasizes on fusion of mathematics and computing. Contestants may use ANY language of their choice.

Date: 13th February, 2009
Website: *felicity.iiit.ac.in/~math/

3. Time Limit Exceeded 09:
'Time limit exceeded'(TLEd) is based upon solving problems under
special constraints. The problems don't require deep knowledge of
algorithms, but instead require unusual thinking and some clever
programming. The event is based on C/C++, and a good knowledge of
these languages will be useful. The scoring for a problems may depend
on code-length, running time or any other criteria specified in the
problem statements.
Date: 10th Feb - 13th Feb ( 3 day contest )
Website: *felicity.iiit.ac.in/~tle/

For other events, see *felicity.iiit.ac.in/09/#Threads

Prizes will be announced soon. 
Hope you will enjoy your time and have fun.

Thanks and regards,
Team Felicity 09.


----------



## shadyabhi (Mar 14, 2009)

Guyz, also have a look at www.codechef.com

That is also a very nice site for many languages..

Abhijeet Rastogi


----------



## Pragadheesh (Mar 20, 2009)

@above
and this one too Topcoder


----------



## trigger (May 12, 2009)

*Code your Future.*
Intel® Threading Challenge 2009


----------



## Sykora (Sep 20, 2009)

As part of my college symposium "Kratos 2009", we'll be conducting a set online events.

The first is an online programming contest, similar in format to Project Euler. There will be 10 questions, and you'll get 3hrs to solve them.

The second event is a little less technical; It's a picture puzzle where you have to solve clues to reveal a main grid, which holds the secret to the entire puzzle. You'll need some basic know-how about recent technology, it especially helps if you know your way around the internet.

More information is available on the website: *kratos.me/events/online-events/ , the links to the actual event pages will be put up just before the contest.

And go easy on me if you find bugs in the software, I wrote it all myself


----------



## sxyadii (Oct 23, 2009)

Thnx for the link


----------

