# SPOJ

SPOJ (Sphere Online Judge) is an online judge system with over 200,000 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 such a wide variety of languages.

## History

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.

## Aims

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

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.

## Judging

### Clusters

The submission are judged on two clusters:[5]

• Pyramid (Intel Pentium III 733 MHz): It consists of Pentium III machines that are serving SPOJ since its very beginning in 2004. These machines are slow compared to other judge. On this cluster memory limit for submissions is 256 MB.
• Cube (Intel Pentium G860 3 GHz): This cluster consists of Intel Pentium G860 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.

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).

### Scoring

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

• Classical: The score for one problem is   ${\displaystyle {\tfrac {80}{40+\mathrm {number\_of\_people\_who\_have\_solved\_it} }}}$    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

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]

## Criticism

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.

## Languages

SPOJ supports about 60 languages in which the users can submit their solutions. They are:

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, Scala, Scheme, sed, Smalltalk, Tcl, Tecs, Text, and Whitespace.

6. ^ "http://www.spoj.com/ranks/users/". SPOJ. Retrieved September 22, 2014. External link in |title= (help)