@echo off

set problem_id=%1
set input_file=%problem_id%.in
set output_file=%problem_id%.out

set run_string=run.exe -t 2 %2

rem call dcc32 -cc .\..\check.dpr
dcc32 -u"d:\testlib" -cc .\..\check.dpr

move .\..\check.exe .\check.exe

for /L %%i in (1,1,9) do (
    if EXIST 0%%i (
        del %input_file% >nul 2>&1
        del %output_file% >nul 2>&1
        echo Test: 0%%i
        copy 0%%i %input_file% >nul 2>&1
        %run_string%
        check.exe %input_file% %output_file%  0%%i.a
    )
)

for /L %%i in (10,1,99) do (
    if EXIST %%i (
        del %input_file% >nul 2>&1
        del %output_file% >nul 2>&1
        echo Test: %%i
        copy %%i %input_file% >nul 2>&1
        %run_string%
        check.exe %input_file% %output_file%  %%i.a
    )
)

del %input_file% >nul 2>&1
del %output_file% >nul 2>&1
