Looking for an inspiration? Below you will find public programs submitted by other users.

Filter by: All Bash C C# C++ 4.9.2 C++14 Haskell Java Java7 Objective-C Pascal (fpc) Pascal (gpc) Perl PHP Python Python 3 Ruby SQL VB.NET Ada Assembler Assembler AWK (gawk) AWK (mawk) bc Brainf**k C++ 4.3.2 C99 strict CLIPS Clojure COBOL COBOL 85 Common Lisp (clisp) D D (dmd) Erlang F# Factor Falcon Forth Fortran Go Groovy Icon Intercal JavaScript (rhino) JavaScript (spidermonkey) Lua Nemerle Nice Nimrod Node.js Ocaml Octave Oz PARI/GP Perl 6 Pike Prolog (gnu) Prolog (swi) Python (Pypy) R Scala Scheme (chicken) Scheme (guile) Smalltalk Tcl Text Unlambda Whitespace

#r0ljwX Scala 2 hours ago
Compilation error
  1. object Main extends App {
  2. // your code goes here
  3. println(plus(1,1))
  4. }
  5.  
  6. def plus(a:Int, b:Int) = {
  7. return a + b
  8. }
#SRowkH Scala 50 minutes ago
Success
  1. object Main extends App {
  2. var increase = (x: Int) => x + 1
  3. increase(10)
  4. }
#tVtBQB Scala 2 hours ago
Compilation error
  1.  
  2. object Main extends App {
  3. for (i <- 1 to 4)
  4. println("Iteration " + i)
  5. }
  6. }
#iX0ZXQ Scala 2 hours ago
Success
  1. object Main extends App {
  2. for (i <- 1 until 4)
  3. println("Iteration "+ i)
  4. }
#cms1hi Scala 3 hours ago
Compilation error
  1. class Rational(n: Int, d: Int) {
  2. require(d != 0)
  3.  
  4. private val g = gcd(n.abs, d.abs)
  5. val numer = n / g
  6. val denom = d / g
  7.  
  8. def this(n: Int) = this(n, 1)
  9.  
#ZfRjJB Scala 3 hours ago
Success
  1. object Main extends App {
  2. val times = 2
  3.  
  4. times match {
  5. case 1 => print("one")
  6. case 2 => print("two")
  7. case _ => print("some other number")
  8. }
  9. }
#zLqr69 Scala 3 hours ago
Success
  1. object Main extends App {
  2. val foo = 1234
  3. println(f"$foo%x")
  4. }
#ZRdxHk Scala 4 hours ago
Compilation error
  1. object Main extends App {
  2. object E extends Enumeration {
  3. type E = Value
  4. val A, B, C = Value
  5. }
  6.  
  7. def e2num(e: E) = 0
  8. }
#lsHZnM Scala 39 minutes ago
Success
  1. object Main extends App {
  2. // your code goes here
  3. val hexString = "00C248534D2D4D3230313030303039553345313634434633463041423438304634414430393639303034393338314230413035303030303130310000133030303030303030303030303030303030303730924427223A9CA7A1E55C5E2E565CD5C357AFB9ACBB58A70EDE289DF3A9101D192397D7156E993CB426532C22225D923B2378F2D5BB26F661E7F9FDE37409E684D253092AC9A5890C4583E95A0859742D2C6E19B59D992DD439492D2CCDA46E4849615D5D8D3F49DA20B4576DE51665D4253031"
  4. println(s"送信コマンド(文字列): ${new String(javax.xml.bind.DatatypeConverter.parseHexBinary(hexString))}")
  5. }
#zxTh4z Scala 12 hours ago
Compilation error
  1. object Main extends App {
  2. // your code goes here
  3.  
  4. a: Option[String] = Some("abc")
  5.  
  6. a match {
  7. case Some(_) => _
  8. case _ => "foo"
  9. }
#51aorp Scala 13 hours ago
Success
  1. object Main extends App {
  2. // your code goes here
  3. val bi:BigInt = BigInt(600851475143L)
  4. }
#YqkXMo Scala 13 hours ago
Compilation error
  1. object Problem3 extends App{
  2. def isPrime(value: BigInt, last:Int): Boolean = {
  3. val sqrt = Math.sqrt(value.toDouble).toInt
  4. val result = (last to sqrt).toList.filter((p:Int) => value%p == 0)
  5.  
  6. result.size > 0
  7. }
  8.  
  9. def factorization(value:BigInt):Int = {
#WTnYg9 Scala 15 hours ago
Success
  1. import scala.io.StdIn.readLine
  2. import scala.collection.mutable.PriorityQueue
  3. import scala.annotation.tailrec
  4. import scala.util.control.Breaks
  5.  
  6. object Lib {
  7. object String {
  8. // ex. b = 26 (if alphabet), mod = 1000000007
  9. class RollingHash[T](val b : Long,val mod : Long,val conv : T => Long) {
#FbsCXm Scala 15 hours ago
Success
  1. import scala.io.StdIn.readLine
  2. import scala.collection.mutable.PriorityQueue
  3. import scala.annotation.tailrec
  4. import scala.util.control.Breaks
  5.  
  6. object Lib {
  7. object String {
  8. // ex. b = 26 (if alphabet), mod = 1000000007
  9. class RollingHash[T](val b : Long,val mod : Long,val conv : T => Long) {
#Eae2wU Scala 20 hours ago
Success
  1. object Main extends App {
  2. val x = List()
  3. val y = x.headOption.getOrElse("")
  4.  
  5. println(y)
  6. }
#rwhIb2 Scala 21 hours ago
Runtime error
  1. object Main
  2. {
  3. def main()
  4. {
  5. println("Jsdlfhbsd")
  6. }
  7. }
#uno4nq Scala 21 hours ago
Success
  1. object Main extends App
  2. {
  3. def main()
  4. {
  5. println("Hello World")
  6. }
  7. }
#GqWLoi Scala 21 hours ago
Compilation error
  1. object HelloWorld
  2. {
  3. def main(args: Array[String])
  4. {
  5. println("Hello, world!") // prints Hello World
  6. }
  7. }
#CzTdBO Scala 1 day ago
Success
  1. object Main extends App {
  2. var line = readLine();
  3. while(false == line.equals("42")) {
  4. System.out.println(line);
  5. line = readLine();
  6. };
  7. }
#omvRnp Scala 1 day ago
Success
  1. object Main extends App {
  2. var a = Array(1, 2, 3)
  3. a.foreach(print)
  4. }
#cTIvz8 Scala 1 day ago
Success
  1. object Main extends App {
  2. var a = Array(1, 2, 3)
  3. a.foreach(println)
  4. }
#vgyEgj Scala 1 day ago
Compilation error
  1. object Main extends App {
  2. var a: Array[Int] = new Array(1, 2, 3)
  3. a.foreach(println)
  4. }
#bUrLOA Scala 1 day ago
Compilation error
  1. var a: Array[Int] = new Array(1, 2, 3)
  2.  
  3. a.foreach(println)
#1pZtw9 Scala 1 day ago
Compilation error
  1. var a = Array(1, 2, 3)
  2.  
  3. a.foreach(println)
#nb8m37 Scala 1 day ago
Compilation error
  1. val a = Array("a","b","c")
#ev7gmr Scala 1 day ago
Compilation error
  1. val a = Array(1, 2, 3);
  2. a.foreach(println)
#iOdVHt Scala 1 day ago
Success
  1. object Main extends App {
  2. for(b <- Array[Byte](32))
  3. println(b)
  4. }
#lhWK78 Scala 1 day ago
Success
  1. object Main extends App {
  2. println(Array[Byte](32))
  3. }
#n6M7Ub Scala 2 days ago
Compilation error
  1. object Main extends App {
  2. // your code goes here
  3. "iuuq;00kbwbdpefs/ojokb".chars().map((i: int)->i-1);
  4.  
  5. }
#88h90z Scala 2 days ago
Success
  1. object Main extends App {
  2. (0 to 100).foreach(println)
  3. }