Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a = int(input())

def luc(n):
  if n = 0:
    return 2
  elif n = 1:
    return 1
  else:
    return luc(n-1) + luc(n-2)

print(luc(a))

Fixed submission:
n=int(input())
a, b = 2, 1
for i in range(n-1):
  a, b = b, a + b
  
print(b)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())

nmax = -1 * K 

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if a + b + c != K:
                continue
                
            nmax = max(nmax, a-c)
            
            
print(nmax)

Fixed submission:
A, B, C, K = map(int, input().split())

if A >= K:
    nmax = K
elif B >= K-A:
    nmax = A
else:
    nmax = A-(K-A-B)
            
print(nmax)
Buggy python submission (verdict: Runtime Error):
N, M, X = map(int,input().split())
A=[]
for i in range(N):
    A.append(list(map(int, input().split())))
    
pr=10**9
for s in range(2**N):
    x_m = [0]*13
    for i in range(N):
        b = (s >> i) & 1
        if b == 1:
            pr_s += A[i][0]
            for j in range(M+1):
                x_m[j] += A[i][j]
 
    xOk = True
    for j in range(1,M+1):
        if x_m[j] < X:
            xOk = False
    
    if xOk == True:
        pr = min(pr, x_m[0])
 
if pr<10**9:
    print(pr)
else:
    print(-1)

Fixed submission:
N, M, X = map(int,input().split())
A=[]
for i in range(N):
    A.append(list(map(int, input().split())))
    
pr=10**9
for s in range(2**N):
    x_m = [0]*13
    for i in range(N):
        b = (s >> i) & 1
        if b == 1:
            for j in range(M+1):
                x_m[j] += A[i][j]
 
    xOk = True
    for j in range(1,M+1):
        if x_m[j] < X:
            xOk = False
    
    if xOk == True:
        pr = min(pr, x_m[0])
 
if pr<10**9:
    print(pr)
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
N, M, X = map(int,input().split())
A=[]
for i in range(N):
    A.append(list(map(int, input().split())))
    
pr=10**9
for s in range(2**N):
    x_m = [0]*13
    for i in range(N):
        b = (s >> i) & 1
        if b == 1:
            pr_s += A[i][0]
            for j in range(M+1):
                x_m[j] += A[i][j]

    xOk = True
    for j in range(1,M+1):
        if x_m[j] < X:
            xOk = False
    
    if xOk == True:
        pr = min(pr, x_m[0])

if pr<10**9:
    print(pr)
else:
    print(-1)

Fixed submission:
N, M, X = map(int,input().split())
A=[]
for i in range(N):
    A.append(list(map(int, input().split())))
    
pr=10**9
for s in range(2**N):
    x_m = [0]*13
    for i in range(N):
        b = (s >> i) & 1
        if b == 1:
            for j in range(M+1):
                x_m[j] += A[i][j]
 
    xOk = True
    for j in range(1,M+1):
        if x_m[j] < X:
            xOk = False
    
    if xOk == True:
        pr = min(pr, x_m[0])
 
if pr<10**9:
    print(pr)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
N, M = [int(s) for s in input().split()]
A = [int(a) for a in input().split()]

d = N - sum(A)

if d > 0:
    return d
else:
    return -1

Fixed submission:
N, M = [int(s) for s in input().split()]
A = [int(a) for a in input().split()]

d = N - sum(A)

if d >= 0:
    print(d)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [0]*N
for i in [int(s) for s in input().split()]:
    A[i-1] +=1

for j in range(N+1):
    print(A[j])

Fixed submission:
N = int(input())
A = [0]*N

for i in [int(s) for s in input().split()]:
    A[i-1] +=1

for j in range(N):
    print(A[j])

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [0]*N

print(A)
for i in [int(s) for s in input().split()]:
    A[i-1] +=1

for j in range(N+1):
    print(A[j])

Fixed submission:
N = int(input())
A = [0]*N

for i in [int(s) for s in input().split()]:
    A[i-1] +=1

for j in range(N):
    print(A[j])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A1 = [0]
Ai = [int(a) for a in input().split()]
A = A1+Ai

for i in range(1,N+1):
    print(A.count(i))

Fixed submission:
N = int(input())
A = [0]*N

for i in [int(s) for s in input().split()]:
    A[i-1] +=1

for j in range(N):
    print(A[j])
Buggy python submission (verdict: Runtime Error):
k = int(input())
s = list(map(str, input()))
if len(s) > k:
    for i in range(k):
        print(s[i], end="")
    print("...")
else:
    for i in s:
        print(s[i], end='')
    print()


Fixed submission:
k = int(input())
s = list(map(str, input()))
if len(s) > k:
    for i in range(k):
        print(s[i], end="")
    print("...")
else:
    for i in s:
        print(i, end='')
    print()
Buggy python submission (verdict: Runtime Error):
l = list(map(int, input()))
if 7 in list:
  print("Yes")
else:
  print("No")
  

Fixed submission:
l = list(map(int, input()))
if 7 in l:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
s = input()

if s == "AAA" || s == "BBB":
  print("No")
else:
  print("Yes")

Fixed submission:
s = input()
if s == "AAA" or s == "BBB":
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
if A== 8 and B==8:
  print("Yay!")
if A>8 and b<8:
  print(":(")
if A<8 and b>8:
  print(":(")
else:
  print("Yay!")
  

Fixed submission:
A, B = map(int, input().split())
if A<8 and B <8:
    print("Yay!")
elif A==8 and B == 8:
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
num = input()

first_place = int(str(num)[-1])

if first_place == 3:
  print('bon')
elif first_place in [0, 1, 6, 8]:
  print('pon')
 else:
  print('hon')
 

Fixed submission:
num = input()
 
first_place = int(str(num)[-1])
 
if first_place == 3:
  print('bon')
elif first_place in [0, 1, 6, 8]:
  print('pon')
else:
  print('hon')
Buggy python submission (verdict: Runtime Error):
#include <stdio.h>
#include <math.h>


using ll = long long;
using llu = long long unsigned;

int main(void)
{
    //scanf("%d", );
    //scanf("%llu", );
    //scanf("%ll", );
    //printf("%d");
    //printf("%lli");
    //printf("%llu");

    llu fives[64000];
    llu x;
    scanf("%llu", &x);
    for (register llu i=0; i<32000; i++)
        fives[i] = i*i*i*i*i;
    for (register llu i=32000; i<64000; i++)
        fives[i] = -i*i*i*i*i;

    bool found = false;
    register llu i,j;
    for (i=0; i<64000; i++) {
        for (j=0; j<64000; i++) {
            if ((fives[i]-fives[j])==x) {
                found = true;
            break;
            }
        }
        if (found) break;
    }
    if (i>32000)
        i*=-1;
    if (j>32000)
        j*=-1;
    printf("%d %d", i, j);

    return 0;
}


Fixed submission:
X = int(input())

for A in range(1000):
    for B in range(-1000, 1000):
        if A ** 5 - B ** 5 == X:
            print(A, B)
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/python3
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)


K = int(input()) + 1
K_a = K
K_b = K
K_c = K
sum = 0

for x in range(1, K_a):
    for y in range(1, K_b):
        for z in range(1, K_c):
            sum += gcd(x, y, z)
print(sum)

Fixed submission:
#!/usr/bin/python3
import itertools
import math
from functools import reduce


def gcd(a, b, c):
    return math.gcd(math.gcd(a, b), c)

K = int(input()) + 1
sum = 0

List = [ i for i in range(1, K)]

for v in itertools.combinations_with_replacement(List, 3):
    g = gcd(v[0],v[1],v[2])
    if v[0] == v[1] and v[1] == v[2]:
        sum += g
    elif v[0] == v[1] or v[0] == v[2] or v[1] == v[2]:
        sum += g * 3
    else:
        sum += g * 6

print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
target = list(map(int,input().split()))
resultMap = {}

for i in range(n):
  print(target.count(i+1))


Fixed submission:
import collections

n = int(input())
target = list(map(int,input().split()))

c = collections.Counter(target)
for i in range(n):
  print(c[i+1])
Buggy python submission (verdict: Runtime Error):

N, K = map(int, input().split())
A = [0] * N

for i in range(K):
    d = int(input())
    targets = list(map(int, input().split()))
    for j in range(d):
        index = targets[j-1]
        A[index] = 1

count = 0
for i in range(N):
    if A[i] == 0:
        count += 1

print(count)


Fixed submission:
N, K = map(int, input().split())
A = [0] * N

for i in range(K):
    d = int(input())
    targets = list(map(int, input().split()))
    for j in range(d):
        index = targets[j] -1
        A[index] = 1

count = 0
for i in range(N):
    if A[i] == 0:
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
val = input()
if val[2] == val[3] && val[4] == val[5]:
    print("Yes")
else:
    print("No")


Fixed submission:
val = input()
if val[2] == val[3] and val[4] == val[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())

print("{}".format(min(n*a, b)))

Fixed submission:
n, a, b = input().split()
n = int(n)
a = int(a)
b = int(b)
print("{}".format(min(n*a, b)))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())

print("".format(min(n*a, b)))

Fixed submission:
n, a, b = input().split()
n = int(n)
a = int(a)
b = int(b)
print("{}".format(min(n*a, b)))
Buggy python submission (verdict: Runtime Error):
X = input()
if X == 3 || X == 5 || X == 7:
  print("YES")
else:
  print("NO")

Fixed submission:
print(["NO", "YES"][[7, 5, 3].count(int(input()))])
Buggy python submission (verdict: Runtime Error):
N=input()

a = None

if(len(N) == 1):
    a = int(N)
elif(len(N) == 2):
    a = int(N[1])
else:
    a = int(N[3])

s = ""

if(a == 3):
    s = "bon"
elif(a == 0 or a ==1 or a==6 or a==8):
    s = "pon"
else:
    s="hon"

print(s)


Fixed submission:
N=input()

a = None

if(len(N) == 1):
    a = int(N)
elif(len(N) == 2):
    a = int(N[1])
else:
    a = int(N[2])

s = ""

if(a == 3):
    s = "bon"
elif(a == 0 or a ==1 or a==6 or a==8):
    s = "pon"
else:
    s="hon"

print(s)
Buggy python submission (verdict: Runtime Error):
list = input().split()
x = (int)list[0]
y = (int)list[1]

if(x*y%0):
  print('Even')
else:
  print('Odd')

Fixed submission:
li = input().split()
x = int(li[0])
y = int(li[1])

if(x*y%2 == 0):
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
yn = "YES"

while(len(s) > 0):
    if(s.endswith("dream") or s.endswith("erase")):
        s = s[:(len(s)-5)]
    elif(s.endswith("eraser")):
        s = s[:(len(s)-6)]
    elif(s.endswith("dreamer")):
        s = s[:(len(s)-7)]
    else:
        yn = "NO"

print(yn)

Fixed submission:
s = input()
n = len(s)
yn = "YES"

while(len(s) > 0):
    if(s.endswith("dream") or s.endswith("erase")):
        s = s[:(len(s)-5)]
    elif(s.endswith("eraser")):
        s = s[:(len(s)-6)]
    elif(s.endswith("dreamer")):
        s = s[:(len(s)-7)]
    else:
        yn = "NO"
        break

print(yn)
Buggy python submission (verdict: Runtime Error):
S = input()

def dfs(a,s,n): #a:今まで計算した分、s:数字(文字)、n:左から何番目の位置に+を入れるか入れないか
    if(len(s) == n+1):
        return int(s[len(s)-1]) + int(s[:len(s)-1]) + int(s) + 2*a
    else:
        return dfs(a,s,n+1) + dfs(a+int(s[:n]),s[n:],1)

print(dfs(0,S,1))

Fixed submission:
S = input()

def dfs(a,s,n): #a:今まで計算した分、s:数字(文字)、n:左から何番目の位置に+を入れるか入れないか
    if(len(s) == 1):
        return int(s)
    elif(len(s) == n+1):
        return int(s[len(s)-1]) + int(s[:len(s)-1]) + int(s) + 2*a
    else:
        return dfs(a,s,n+1) + dfs(a+int(s[:n]),s[n:],1)

print(dfs(0,S,1))
Buggy python submission (verdict: Runtime Error):
n = int(input())

if (n % 10 = 2) | (n % 10 = 4) | (n % 10 = 5) | (n % 10 = 7) | (n % 10 = 9):
  print("hon")

elif (n % 10 = 0) | (n % 10 = 1) | (n % 10 = 6) | (n % 10 = 8):
  print("pon")

else:
  print("bon")

Fixed submission:
n = int(input())
 
if (n % 10 == 2) | (n % 10 == 4) | (n % 10 == 5) | (n % 10 == 7) | (n % 10 == 9):
  print("hon")
 
elif (n % 10 == 0) | (n % 10 == 1) | (n % 10 == 6) | (n % 10 == 8):
  print("pon")
 
else:
  print("bon")
Buggy python submission (verdict: Runtime Error):
k = int()
s = input()
 
if len(k) <= k:
  print(s)
  
else:
  print(s[:k] + "...")

Fixed submission:
k = int(input())
s = input()
 
if len(s) <= k:
  print(s)
  
else:
  print(s[:k] + "...")

Buggy python submission (verdict: Runtime Error):
k = input()
s = int(input())
 
if len(k) <= k:
  print(s)
  
else:
  print(s[:k] + "...")

Fixed submission:
k = int(input())
s = input()
 
if len(s) <= k:
  print(s)
  
else:
  print(s[:k] + "...")

Buggy python submission (verdict: Runtime Error):
k = int()
s = int(input())
 
if len(s) <= k:
  print(s)
  
else:
  print(s[:k] + "...")

Fixed submission:
k = int(input())
s = input()
 
if len(s) <= k:
  print(s)
  
else:
  print(s[:k] + "...")

Buggy python submission (verdict: Runtime Error):
k = int(input())
s = int()

if len(s) <= s:
  print(k)
  
else:
  print(k[:s] + "...")

Fixed submission:
k = int(input())
s = input()
 
if len(s) <= k:
  print(s)
  
else:
  print(s[:k] + "...")
Buggy python submission (verdict: Runtime Error):
S = input()
if S == "ABC":
    print("ARC")
else:
    print("ABC"

Fixed submission:
S = input()
if S == "ABC":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Runtime Error):
A,B,N = map(int,input().split())
a = 0

for x in range(N+1):
    if (int((A*x)/B)-A*int(x/B)) > a:
        a = (int((A*x)/B)-A*int(x/B))
print(a) 

Fixed submission:
K = int(input())
A,B = map(int,input().split())
list = []
n = range(A,B+1)
ind = range(B-A+1)
for i in n:
    list.append(i)
counter = 0

for i in ind:
    if list[i] % K == 0:
        counter += 1
    else:
        counter += 0
if counter >= 1:
    print("OK")
else:
    print("NG")

Buggy python submission (verdict: Runtime Error):
K = int(input())
A,B = map(int,input().split())

n = range(A,B+1)
ind = range(B-A)
for i in n:
    list.append(i)
counter = 0

for i in ind:
    if list[i]%K == 0:
        counter += 1
    else:
        counter += 0
if counter > 0:
    print("OK")
else:
    print("NG")
        
    

Fixed submission:
K = int(input())
A,B = map(int,input().split())
list = []
n = range(A,B+1)
ind = range(B-A+1)
for i in n:
    list.append(i)
counter = 0

for i in ind:
    if list[i] % K == 0:
        counter += 1
    else:
        counter += 0
if counter >= 1:
    print("OK")
else:
    print("NG")
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [int(input()) for _ in N]
print(len(set(s)))

Fixed submission:
S,W = map(int,input().split())
if S>W:
  print("safe")
else:
  print("unsafe")

Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())
while A > 0 and C > 0:
    C -= B
    if C <= 0:
        print("Yes")
    else:
        A -= D
        if A <= 0:
            print("No")

Fixed submission:
S,W = map(int,input().split())
if S>W:
  print("safe")
else:
  print("unsafe")
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int(input().split()))
while A>0 and C>0:
  C-=B
  if C <= 0:
    print("Yes")
  else:
    A-=D
    if A <= 0:
      print("No")


Fixed submission:
A,B,C,D = map(int,input().split())
while A > 0 and C > 0:
    C -= B
    if C <= 0:
        print("Yes")
    else:
        A -= D
        if A <= 0:
            print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(N)]
print(len(set(s)))

Fixed submission:
N = int(input())
S = [input() for _ in range(N)]
print(len(set(S)))

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [int(input()) for _ in N]
print(len(set(s)))

Fixed submission:
N = int(input())
S = [input() for _ in range(N)]
print(len(set(S)))

Buggy python submission (verdict: Runtime Error):
N = int(input())
S_list = list(map(str, input().split()))

for i in range(N):
  S_list.remove(S_list[i])
  N -= (N-len(S_list)-1)
  
print(N)  

Fixed submission:
N = int(input())
S = [input() for _ in range(N)]
print(len(set(S)))
Buggy python submission (verdict: Runtime Error):
import math
print(int(input())+2*pi)

Fixed submission:
ennshuuritsu = 3.1415
nyuuryoku = int(input())

print(nyuuryoku*2*ennshuuritsu)

Buggy python submission (verdict: Runtime Error):
R = input()

if (R<1) & (R>100):
  continue
  
else:
  print(2*3.14159*R)

Fixed submission:
ennshuuritsu = 3.1415
nyuuryoku = int(input())

print(nyuuryoku*2*ennshuuritsu)

Buggy python submission (verdict: Runtime Error):
R = range(100)+1

def shuucho(R):
  return 2*3.141592653589*R



Fixed submission:
ennshuuritsu = 3.1415
nyuuryoku = int(input())

print(nyuuryoku*2*ennshuuritsu)
Buggy python submission (verdict: Runtime Error):
N,M  = map(int, input().split())
A_list = list(map(int, input.split()))

avail = N - sum(A_list)

if avail >= 0: 
  print(avail)
  
else:
  print(-1)

Fixed submission:
N,M  = map(int, input().split())
A_list = list(map(int, input().split()))
 
avail = N - sum(A_list)
 
if avail >= 0: 
  print(avail)
  
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
S = map(str,input().split())
N = int(len(S))
S_a = S[:(N-1)//2]
S_b = S[(N+1)//2:]

if S == S[::-1] and S_a == S_a[::-1] and S_b == S_b[::-1]:
    print("Yes")
else:
    print("No")

Fixed submission:
S = input()
N = int(len(S))
S_a = S[:(N-1)//2]
S_b = S[(N+1)//2:]
#print(S)
if S == S[::-1] and S_a == S_a[::-1] and S_b == S_b[::-1]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n,m,x = map(int, input().split())
result = 10**9
for _ in range(n):
	books=list(map(int, input().split()))
	A = A.append(books[0])
	C = C.append(books[1:])
for i in range(1<<n):
	cnt = 0
	rikaido = [0]*m
	for j in range(n):
		if (i<<j)&1:
			for k in range(m):
				rikaido[k]+=C[j][k]
			cnt += A[j]
		else:
			pass
	if min(rikaido)>=x:
		result = min(result, cnt)
if result == 10*9:
	print(-1)
else:
	print(result)

Fixed submission:
n,m,x = map(int,input().split())

C=[]
A=[]
for i in range(n):
	t = list(map(int, input().split()))
	C.append(t[0])#price of books
	A.append(t[1:])#point of books
	
result = 10**9 #結果の初期値
#N冊の本買う/買わない　を総当たり
for i in range(1<<n):#range(0,2**n)と同意
	t = [0] * m #理解度m個
	c = 0 #値段0
	#1-n冊目までをシフト演算
	for j in range(n):
		if (i>>j)&1:#購入している場合
			for k in range(m):
				t[k] += A[j][k]#各理解度をインプット
			c += C[j] #購入した本の値段を足していく
		else:
			pass
	if min(t)>=x:
		result=min(result, c)
if result == 10**9:
	print(-1)
else:
	print(result)

Buggy python submission (verdict: Runtime Error):
n,m,X = map(int,input().split())

C=[]
A=[]
for i in range(n):
	t = list(map(int, input().split()))
	C.append(t[0])#price of books
	A.append(t[1:])#point of books
	
result = -1 #結果の初期値
#N冊の本買う/買わない　を総当たり
for i in range(1<<n):#range(0,2**n)と同意
	t = [0] * m #理解度m個
	c = 0 #値段0
	#1-n冊目までをシフト演算
	for j in range(n):
		if (i>>j)&1:#購入している場合
			for k in range(m):
				t[k] += A[j][k]#各理解度をインプット
			c += C[j] #購入した本の値段を足していく
		else:
			pass
	if min(t)>=x:
		result==min(result, t)
if result == 10**9:
	print(-1)
else:
	print(result)

Fixed submission:
n,m,x = map(int,input().split())

C=[]
A=[]
for i in range(n):
	t = list(map(int, input().split()))
	C.append(t[0])#price of books
	A.append(t[1:])#point of books
	
result = 10**9 #結果の初期値
#N冊の本買う/買わない　を総当たり
for i in range(1<<n):#range(0,2**n)と同意
	t = [0] * m #理解度m個
	c = 0 #値段0
	#1-n冊目までをシフト演算
	for j in range(n):
		if (i>>j)&1:#購入している場合
			for k in range(m):
				t[k] += A[j][k]#各理解度をインプット
			c += C[j] #購入した本の値段を足していく
		else:
			pass
	if min(t)>=x:
		result=min(result, c)
if result == 10**9:
	print(-1)
else:
	print(result)
Buggy python submission (verdict: Runtime Error):
n,m,q=map(int,input().split(" "))
arr=[list(map(int, input().split(" "))) for i in range(q)]
ans=0
for i1 in range(1,m+1):
	for i2 in range(i1,m+1):
		for i3 in range(i2, m+1):
			for i4 in range(i3, m+1):
				for i5 in range(i4, m+1):
					for i6 in range(i5, m+1):
						for i7 in range(i6, m+1):
							for i8 in range(i7, m+1):
								for i9 in range(i8, m+1):
									for i10 in range(i9, m+1):
										tmp=0
										arrs=[i1,i2,i3,i4,i5,i6,i7,i8,i9,i10]
										for a,b,c,d in arr:
											if arrs[b]-arrs[a]==c:
												tmp+=d
										ans=max(ans,tmp)
print(ans)

Fixed submission:
n,m,q=map(int,input().split(" "))
arr=[list(map(int, input().split(" "))) for i in range(q)]
ans=0
for i1 in range(1,m+1):
	for i2 in range(i1,m+1):
		for i3 in range(i2, m+1):
			for i4 in range(i3, m+1):
				for i5 in range(i4, m+1):
					for i6 in range(i5, m+1):
						for i7 in range(i6, m+1):
							for i8 in range(i7, m+1):
								for i9 in range(i8, m+1):
									for i10 in range(i9, m+1):
										tmp=0
										arrs=[0,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10]
										for a,b,c,d in arr:
											if arrs[b]-arrs[a]==c:
												tmp+=d
										ans=max(ans,tmp)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m,q=map(int,input().split(" "))
arr=[list(map(int, input().split(" "))) for i in range(q)]
ans=0
for i1 in range(1,m+1):
	for i2 in range(i1,m+1):
		for i3 in range(i2, m+1):
			for i4 in range(i3, m+1):
				for i5 in range(i4, m+1):
					for i6 in range(i5, m+1):
						for i7 in range(i6, m+1):
							for i8 in range(i7, m+1):
								for i9 in range(i8, m+1):
									for i10 in range(i9, m+1):
										tmp=0
										arrs=[i1,i2,i3,i4,i5,i6,i7,i8,i9,i10]
										for a,b,c,d in arr:
											if arrs[b]-arrs[a]==c:
												tmp+=d
										ans=max(ans,tmp)
print(ans)

Fixed submission:
n,m,q=map(int,input().split(" "))
arr=[list(map(int, input().split(" "))) for i in range(q)]
ans=0
for i1 in range(1,m+1):
	for i2 in range(i1,m+1):
		for i3 in range(i2, m+1):
			for i4 in range(i3, m+1):
				for i5 in range(i4, m+1):
					for i6 in range(i5, m+1):
						for i7 in range(i6, m+1):
							for i8 in range(i7, m+1):
								for i9 in range(i8, m+1):
									for i10 in range(i9, m+1):
										tmp=0
										arrs=[0,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10]
										for a,b,c,d in arr:
											if arrs[b]-arrs[a]==c:
												tmp+=d
										ans=max(ans,tmp)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
if N==0 or K==1:
    print(0)
else:
    for i in range(10**18):
        if N>abs(N-K):
            N=abs(N-K)
        else:
            print(N)  
            break

Fixed submission:
N,K=map(int,input().split())
if N==0 or K==1:
    print(0)
else:
    a=N//K
    N=N-a*K
    for i in range(10**18):
        if N>abs(N-K):
            N=abs(N-K)
        else:
            print(N)  
            break
Buggy python submission (verdict: Runtime Error):
n,m =map(int, input().split())
if n==m==1:
    print(0)
elif n==1 or n==0:
    print(cmb(m,2))
elif m==1 or m==0:
    print(cmb(n,2))
else:
    print(cmb(n,2)+cmb(m,2))

Fixed submission:
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
  
n,m =map(int, input().split())
if n==m==1:
    print(0)
elif n==1 or n==0:
    print(cmb(m,2))
elif m==1 or m==0:
    print(cmb(n,2))
else:
    print(cmb(n,2)+cmb(m,2))

Buggy python submission (verdict: Runtime Error):
n,m =map(int, input().split())
if n==m==1:
    print(0)
elif n==1:
    print(cmb(m,2))
elif m==1:
    print(cmb(n,2))
else:
    print(cmb(n,2)+cmb(m,2))

Fixed submission:
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
  
n,m =map(int, input().split())
if n==m==1:
    print(0)
elif n==1 or n==0:
    print(cmb(m,2))
elif m==1 or m==0:
    print(cmb(n,2))
else:
    print(cmb(n,2)+cmb(m,2))
Buggy python submission (verdict: Runtime Error):
n=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(n[int(input())+1])

Fixed submission:
n=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(n[int(input())-1])