File size: 750 Bytes
378972b
9d95848
 
378972b
 
 
 
9d95848
 
378972b
 
e3f224d
9d95848
378972b
 
 
 
9d95848
 
 
 
 
e3f224d
 
 
 
 
 
9d95848
 
 
e3f224d
9d95848
 
378972b
9d95848
 
 
e3f224d
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from verifier.verifier import verify


test_cases = [
    ("5\n", "10"),
    ("0\n", "0"),
    ("-3\n", "-6"),
    ("100\n", "200"),
    ("999\n", "1998"),
]

# ✅ define these FIRST
correct_code = """
n = int(input())
print(n * 2)
"""

wrong_code = """
n = int(input())
print(n)
"""

timeout_code = """
while True:
    pass
"""

# ✅ now use them
for name, code in [
    ("correct", correct_code),
    ("wrong", wrong_code),
    ("timeout", timeout_code),
]:
    reward, info = verify(code, test_cases)

    print("\nCASE:", name)
    print("Reward:", reward)
    print("Pass rate:", info["pass_rate"])
    print("Passed:", info["passed"], "/", info["total"])
    print("Timeouts:", info["timeout_count"])
    print("Errors:", info["error_count"])