#!/bin/bash g++ Gen.cpp -o Gen # Random testcase generator g++ Checker.cpp -o Checker # Answer checker g++ Correct.cpp -o Solution # Bruteforce correct solution if [ $1 -eq 1 ]; then # C++ g++ -static -DONLINE_JUDGE -lm Hack.cpp -o Bad # Compiling the code to be tested ver="Accepted" for((i = 0; i < 300; i++)); do # Test 300 cases ./Gen > int echo "Running on test $i" ./Solution < int > out1 timeout 20 ./Bad < int > out2 ./Checker int out2 out1 ver # Checker receives input, jury answer and participant output. Veredict goes to file "ver" ver=$(cat ver) # Have just "Accepted" if the code is correct, other message means that the code was wrong if [ "$ver" != "Accepted" ]; then break fi done elif [ $1 -eq 2 ]; then # Java javac JavaHack.java for((i = 0; i < 300; i++)); do "./Gen$1" > int echo "Running on test $i" ./Solution < int > out1 timeout 20 java JavaHack < int > out2 ./Checker int out2 out1 ver ver=$(cat ver) if [ "$ver" != "Accepted" ]; then break fi done elif [ $1 -eq 3 ]; then # Python (needs a third argument with the Python version) for((i = 0; i < 300; i++)); do "./Gen$1" > int echo "Running on test $i" ./Solution < int > out1 timeout 2 "python$2" pythonHack.py < int > out2 ./Checker int out2 out1 ver ver=$(cat ver) if [ "$ver" != "Accepted" ]; then break fi done else # Kotlin kotlinc kotlinHack.kt -include-runtime -d kotlinHack.jar for((i = 0; i < 300; i++)); do "./Gen$1" > int echo "Running on test $i" ./Solution < int > out1 timeout 20 java -jar kotlinHack.jar < int > out2 ./Checker int out2 out1 ver ver=$(cat ver) if [ "$ver" != "Accepted" ]; then break fi done fi if [ "$ver" == "Accepted" ]; then echo $ver else echo "$ver on test $tc" cat int fi
Standard input is empty
prog.cpp:1:2: error: invalid preprocessing directive #!
#!/bin/bash
^
prog.cpp:3:20: error: stray ‘#’ in program
g++ Gen.cpp -o Gen # Random testcase generator
^
prog.cpp:4:28: error: stray ‘#’ in program
g++ Checker.cpp -o Checker # Answer checker
^
prog.cpp:5:29: error: stray ‘#’ in program
g++ Correct.cpp -o Solution # Bruteforce correct solution
^
prog.cpp:7:23: error: stray ‘#’ in program
if [ $1 -eq 1 ]; then # C++
^
prog.cpp:8:49: error: stray ‘#’ in program
g++ -static -DONLINE_JUDGE -lm Hack.cpp -o Bad # Compiling the code to be tested
^
prog.cpp:10:33: error: stray ‘#’ in program
for((i = 0; i < 300; i++)); do # Test 300 cases
^
prog.cpp:15:31: error: stray ‘#’ in program
./Checker int out2 out1 ver # Checker receives input, jury answer and participant output. Veredict goes to file "ver"
^
prog.cpp:16:18: error: stray ‘#’ in program
ver=$(cat ver) # Have just "Accepted" if the code is correct, other message means that the code was wrong
^
prog.cpp:21:25: error: stray ‘#’ in program
elif [ $1 -eq 2 ]; then # Java
^
prog.cpp:34:25: error: stray ‘#’ in program
elif [ $1 -eq 3 ]; then # Python (needs a third argument with the Python version)
^
prog.cpp:46:6: error: stray ‘#’ in program
else # Kotlin
^
prog.cpp:3:1: error: ‘g’ does not name a type
g++ Gen.cpp -o Gen # Random testcase generator
^
prog.cpp:7:18: error: ‘then’ does not name a type
if [ $1 -eq 1 ]; then # C++
^~~~
prog.cpp:10:14: error: ‘i’ does not name a type
for((i = 0; i < 300; i++)); do # Test 300 cases
^
prog.cpp:10:23: error: ‘i’ does not name a type
for((i = 0; i < 300; i++)); do # Test 300 cases
^
prog.cpp:10:30: error: expected unqualified-id before ‘do’
for((i = 0; i < 300; i++)); do # Test 300 cases
^~
prog.cpp:17:32: error: ‘then’ does not name a type
if [ "$ver" != "Accepted" ]; then
^~~~
prog.cpp:21:20: error: ‘then’ does not name a type
elif [ $1 -eq 2 ]; then # Java
^~~~
prog.cpp:23:14: error: ‘i’ does not name a type
for((i = 0; i < 300; i++)); do
^
prog.cpp:23:23: error: ‘i’ does not name a type
for((i = 0; i < 300; i++)); do
^
prog.cpp:23:30: error: expected unqualified-id before ‘do’
for((i = 0; i < 300; i++)); do
^~
prog.cpp:30:32: error: ‘then’ does not name a type
if [ "$ver" != "Accepted" ]; then
^~~~
prog.cpp:34:20: error: ‘then’ does not name a type
elif [ $1 -eq 3 ]; then # Python (needs a third argument with the Python version)
^~~~
prog.cpp:35:14: error: ‘i’ does not name a type
for((i = 0; i < 300; i++)); do
^
prog.cpp:35:23: error: ‘i’ does not name a type
for((i = 0; i < 300; i++)); do
^
prog.cpp:35:30: error: expected unqualified-id before ‘do’
for((i = 0; i < 300; i++)); do
^~
prog.cpp:42:32: error: ‘then’ does not name a type
if [ "$ver" != "Accepted" ]; then
^~~~
prog.cpp:48:14: error: ‘i’ does not name a type
for((i = 0; i < 300; i++)); do
^
prog.cpp:48:23: error: ‘i’ does not name a type
for((i = 0; i < 300; i++)); do
^
prog.cpp:48:30: error: expected unqualified-id before ‘do’
for((i = 0; i < 300; i++)); do
^~
prog.cpp:55:32: error: ‘then’ does not name a type
if [ "$ver" != "Accepted" ]; then
^~~~
prog.cpp:61:30: error: ‘then’ does not name a type
if [ "$ver" == "Accepted" ]; then
^~~~
Standard output is empty