@echo off
set problem=hear

if "%1" == "" (
    echo no parametr
    goto END
)

set exec=echo no execution comand

if exist %problem%_%1.dpr (
    dcc32 -cc %problem%_%1.dpr
    set exec=CALL %problem%_%1.exe
)

if exist %problem%_%1.cpp (
    g++ -O2 -Wl,--stack=64000000 %problem%_%1.cpp -o %problem%_%1
    set exec=CALL %problem%_%1.exe
)

if exist %problem%_%1.java (
    javac -cp ".;*" %problem%_%1.java
    set exec=java -Xmx256M -Duser.language=en -Duser.region=US -Duser.variant=US %problem%_%1
)

if exist %problem%_%1.py (
    set exec=%problem%_%1.py
)


if exist %1.log (
    del %1.log
)

for %%i in (tests\??) do (
    echo %%i
    copy %%i %problem%.in >nul
    del %problem%.out
    %exec%
    java -Xmx256M -Xss64M -cp testlib4j.jar;Check.jar ru.ifmo.testlib.CheckerFramework Check %%i %problem%.out %%i.a >> %1.log
)

:END