From Wikipedia, the free encyclopedia

SPOJ (Sphere Online Judge) is an online judge system with over 1 million registered users and over 20,000 problems. Tasks are prepared by its community of problem setters or are taken from previous programming contests. SPOJ allows advanced users to organize contests under their own rules and also includes a forum where programmers can discuss how to solve a particular problem.

Apart from the English language, SPOJ also offers its content in Polish, Portuguese and Vietnamese languages. The solution to problems can be submitted in over 40 programming languages, including esoteric ones, via the Sphere Engine. It is run by the Polish company Sphere Research Labs.[1]

The website is considered both an automated evaluator of user-submitted programs as well as an online learning platform to help people understand and solve computational tasks.[2] It also allows students to compare paradigms and approaches with a wide variety of languages.


This system was originally created to apply an online judge in the teaching of students. It basically focused on the students and lecturers of universities and members of a wider programming community, interested in algorithms and programming contests.


It aimed at different users for different purposes such as:[3]

  • For young people and beginner programmers to develop understanding of algorithms.
  • The students of universities are given a chance to do their homework, honestly, thoroughly and without cheating.
  • ACM contest pros can solve tasks without being cramped by the restraints of too few programming languages or an inconvenient user interface.
  • Enthusiasts of functional or object oriented programming can solve contest problems in their favorite language.
  • Any persons willing to share an interesting task with the rest of the SPOJ community can do so nearly automatically (one mail to the admins requesting problem-setter's privileges is enough),
  • Any person, wishing to organize a programming contest, with nearly any rules they may decide upon, may do so at any time they choose, without the help of system administrators.

Problem categories[edit]

The archived problems in SPOJ are divided in 5 categories: [4]

  • Classical: These are binary scored problems. Either Accepted or Wrong answer[citation needed]
  • Challenge: These allow users to submit worse or better solutions. There are no definite answers to a particular problem
  • Partial: These are similar to challenge problems but with an educational purpose
  • Tutorial: Like classical problems but easier, these are for educational purposes - for example involving a widely known algorithm
  • Riddle: Problems which contains puzzles

There may be limitations on submissions to make a problem more challenging. This includes the availability of languages (e.g. only esoteric languages) and computation time.



Submissions are judged on one cluster:[5]

  • Cube (Intel Xeon E3-1200 v5): The site states that "this new cluster consists of modern and fast Intel Xeon E3-1220 v5 CPUs. On Cube your submissions will run from 30 to 50 times faster than on Pyramid so you can expect that if you test your solution at home then it will have similar execution time on SPOJ. On this cluster memory limit for submissions is 1536 MB." The Pyramid cluster has been deactivated.

Programs are checked either by comparison to a known correct answer or by running a dedicated judging code, unique to each problem.[2] This is increasingly necessary when there may be multiple answers in more complex problems. By using a computer, the marking is consistent, fair and can measure efficiency in real time, in comparison to human judging.

To ensure that the system runs effectively, the Linux commands RLIMIT_CPU stops poorly designed tests from affecting others. The chroot() system call applies restrictions to the running of programs by using file system sandboxes: the sleep() command, for example, is not permitted, as it would reduce the available memory.

The accessible, free and objective nature of the website allow students to gain logical and design experience based on previous successes. However, the system doesn't evaluate code quality, documentation or other more subjective characteristics which may be more important for real world applications.

After being submitted, a user is told whether the code produced an error while running or compiling; the time limit was exceeded; the wrong answer was output or was correct. Challenge problems' answers are accompanied by a score (see below).


The scores are given based on the category in which problems are divided.[6]

  • Classical: The score for one problem is       points.
  • Challenge: The score has two criteria as follows:
    • for a top score in any challenge: 3 points,
    • for any lower score in a challenge: (user's score relative to the top score) points.
  • Partial: 0 points
  • Tutorial: 0 points
  • Riddle: 0 points

Scores for the 'challenge' category are typically the size of the submission in bytes, though may different. For example, it may be the number of correct decimal places of the constant π.

Note: SPOJ frequently change the formulae used for calculating the scores

Programming contests[edit]

SPOJ is used as a platform for a wide array of competitions, from local to international level and from short 1 hour problems to year-long leagues. Participants typically speak different languages so site ensures a more level playing field, as well as reducing the work load of the organisers.[2]


Users of online judge systems have little incentive for documentation and creating well-structured code, possibly making them less prepared for more typical applications of computing outside of competitions.[2]

Results of a study conducted at Gdańsk University of Technology[2] suggest that deadlines given in university situations, including bonus and penalty points depending on when an assignment is handed in, tend to be harsh on students who are not well organised, even if the same code is submitted. This has mixed motivational effects on students, encouraging some to keep up with deadlines, while demotivating others. The same study indicates that use of online judge systems lead to a reduction in communication between students and staff. However, in the case of staff with high teaching load, this reduction may allow staff to devote more of their time to students with difficulties, eliminating administrative overheads related to grading and time spent on discussions with students who do not need assistance.


SPOJ supports about 60 languages in which the users can submit their solutions. These include:

Ada, Assembler, AWK, Bash, Brainfuck, C, C++ and C99 strict, C#, Clojure, Common Lisp, D, Doc(no testing), Erlang, Fortran, F#, Go, Haskell, Icon, Intercal, Jar, Java, JavaScript, Lisp, Lua, Nemerle, Nice, Node.js, OCaml, Pascal, Pdf, Perl, PHP, Pike, PostScript, Prolog, Python, Ruby, Rust, Scala, Scheme, sed, Smalltalk, Tcl, Tecs, Text, and Whitespace.

See also[edit]


  1. ^ "Sphere Research Labs Legal Information". Sphere Research Labs. Retrieved 2015-06-21.
  2. ^ a b c d e Kosowski, Adrian; Malafiejski, Michal; Noinski, Tomasz (2008-04-14). Advances in Web Based Learning - ICWL 2007: 6th International Conference, Edinburgh, UK, August 15-17, 2007, Revised Papers. Springer Science & Business Media. p. 344. ISBN 9783540781387.
  3. ^ Kosowski, Adrian (September 3, 2004). "What is SPOJ's _purpose_?". SPOJ. Retrieved September 22, 2014.
  4. ^ "PROBLEMS". SPOJ. Retrieved September 22, 2014.
  5. ^ "Clusters". SPOJ. Retrieved September 24, 2017.
  6. ^ "User Statistics". SPOJ. Retrieved September 22, 2014.

External links[edit]