input/D.scala:2: error: expected class or object definition
val n = readInt()
^
input/D.scala:3: error: expected class or object definition
val stuff = readLine().split(" ").map(_.toInt)
^
input/D.scala:5: error: expected class or object definition
val relevant = stuff.zip(1 to n).sortBy(_._1).unzip._2.reverse
^
input/D.scala:6: error: expected class or object definition
val adjust = relevant.map(r => (0 until n).map(x => stuff.take(x).count(_>stuff(x))).apply(r-1))
^
input/D.scala:7: error: expected class or object definition
val res = (0 until n).map(i => Vector(relevant(i)-1-adjust(i),relevant(i)-adjust(i),(n-i),(n-i-1))).flatten.filter(_>1)
^
input/D.scala:9: error: expected class or object definition
println(res.size + "\n" + res.mkString(" "))
^
6 errors found