Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02753 (python)

Fixed submission:
S = input()

if(S == "AAA"):
    print('No')
elif(S == "BBB"):
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
N, A, B = input().split()

n = int(N / (A + B))

if(N <= A+B):
    print(A)
else:
    print(N - B*n)

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

n = int(N / (A + B))

if(N <= A + B):
    print(A)
else:
    print(N - B * n)

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

n = int(N / (A + B))

if(N < A+B):
    print((n+1)*A)
elif(N == A+B):
    print(A)
else:
    print(N -B*n)
Problem p02624 (python)

Fixed submission:
N=int(input())
ans=0
for i in range(1,N+1):
  m=N//i
  ans+=i*m*(m+1)//2
  #print(i,N//i,m)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
Array = [1]*(N+1)
for i in range(1,int(math.sqrt(N))):
  for j in range(i+1,N,i):
    N[j]+=1
ans = 0
for i in range(1,N+1):
  ans+=i*N[i]
print(ans)
Problem p02659 (python)

Fixed submission:
import math
A,B = input().split()
print (int(A)*int(B.replace('.',''))//100)

Buggy submission (verdict: Runtime Error):
import math
A,B = input().split()
print int(A)*int(B.replace('.',''))//100

Buggy submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
print(math.floor(A*B))
Problem p02989 (python)

Fixed submission:
N = int(input())
D = list(map(int,input().split()))
D.sort()
print(D[N//2]-D[N//2-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
D = list(map(int,input().split()))
D.sort()
print(D[N/2]-D[N/2-1])
Problem p03317 (python)

Fixed submission:
import math
N, K = map(int,input().split())
A = list(map(int,input().split()))
print(math.ceil((N-1)/(K-1)))

Buggy submission (verdict: Runtime Error):
import math
N, K = map(int,input())
A = list(map(int,input().split()))
print(math.ceil(N/(K-1)))
Problem p03821 (python)

Fixed submission:
N = int(input())
Array = []
for i in range(N):
  Array.append(tuple(map(int,input().split())))

res = 0
for i in reversed(range(N)):
  a,b = Array[i]
  a+=res
  res+= ((b-a%b)%b)
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
Array = []
for i in range(N):
  Array.append(tuple(map(int,input().split())))

res = 0
for i in reversed(range(N)):
  a,b = Array[i]
  a+=res
  res+ = b-a%b
print(res)
Problem p02596 (python)

Fixed submission:
k = int(input())


i = 0;
mod = 0;
while True:
    mod = (mod*10 + 7) % k;
    if mod == 0:
        break;
    i += 1;
    if i == k:
        i = -2
        break;

print(i+1)

Buggy submission (verdict: Runtime Error):
i = 0;
mod = 0;
while True:
    mod = (mod*10 + 7) % k;
    if mod == 0:
        break;
    i += 1;
    if i == k:
        j = -2
        break;

print(i+1)
Problem p02693 (python)

Fixed submission:
c = int(input());
a, b = map(int, input().split())
d = 0;

while a <= b :
    if a % c == 0:
        d = d + 1;

    a = a + 1;
    
if d == 0:
    print("NG");

else:
    print("OK");

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input().split());

x = 0;
for i in range(a,b+1);
    if i % k == 0:
        x += 1;

if x == 0:
    print('NG')
else:
    print('OK')

Buggy submission (verdict: Runtime Error):
c, a, b = map(int, input().split())
d = 0

while a <= b :
    if a % c == 0:
        d = d + 1;

    a = a + 1;
    
if d == 0:
    print("NG");

else:
    print("OK");
Problem p02723 (python)

Fixed submission:
s = list(input())
if  s[2] == s[3] and s[4]==s[5]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = list(input().split())
if  s[2] == s[3] and s[4]==s[5]:
    print('Yes')
else:
    print('No')
Problem p02725 (python)

Fixed submission:
k, n = map(int, input().split())
a = list(map(int, input().split()))

a.append(a[0] + k)
m = 0
s = 0
for i in range(n):
    m = max(m, a[i+1] - a[i])
    s += a[i+1] - a[i]
print(s - m)

Buggy submission (verdict: Runtime Error):
k, n = map(int, input().split())
a = list(map(int, input().split()))
a.append(a[0] + k)
m = []
for i in range(n):
    m.append(m, a[i+1] - a[i])
print(k - max(m))

Buggy submission (verdict: Runtime Error):
a.append(a[0] + k)
m = []
for i in range(n):
    m.append(m, a[i+1] - a[i])
print(k - max(m))
Problem p02785 (python)

Fixed submission:
n, k = map(int, input().split())
h =  list(map(int, input().split()))

def solve():
    global n, k, h
    if n <= k:
        return 0
    s = sum(h)
    h = sorted(h, reverse=True)
    for i in range(k):
        s -= h[i]
    return s

print(solve())

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h =  list(map(int, input().split()))

def solve():
    if n <= k:
        return 0
    s = sum(h)
    h = sorted(h, reverse=True)
    for i in range(k):
        print(h[i])
        s -= h[i]
    return s

print(solve())

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h =  list(map(int, input().split()))

s = sum(h)
h = sorted(h, reverse=True)
for i in range(k):
    s -= h[i]
print(s)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h =  list(map(int, input().split()))

s = sum(h)
h = sorted(h, reverse=True)
for i in range(k):
    s -= h[k]
print(s)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h =  list(map(int, input().split()))

s = sum(h)
m = 0
for _ in range(k):
    a = 0
    m = 0
    index = 0
    for i, j in enumerate(h):
        if j > m:
            m = j
            index = i
    a += m
    del h[i]
print(s - m)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h =  list(map(int, input().split()))

s = sum(h)
for _ in range(k):
    a = 0
    m = 0
    index = 0
    for i, j in enumerate(h):
        if j > m:
            m = j
            index = i
    a += m
    del h[i]
print(s - m)
Problem p02847 (python)

Fixed submission:
s=input()
a={
'SUN':0,
'MON':1,
'TUE':2,
'WED':3,
'THU':4,
'FRI':5,
'SAT':6
}
print(7-a[s])

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
s=list(s)
for i in range(len(s)):
    a=ord(s[i])+n
    if a>90:
        a-=26
    s[i]=chr(a)
print(''.join(s))

Buggy submission (verdict: Runtime Error):
s=input()
a={
'SUN':0
'MON':1
'TUE':2
'WED':3
'THU':4
'FRI':5
'SAT':6
}
print(7-a[s])
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()

if a>=3200:
    print(s)
else:
    print('red')

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

if a>=3200:
    print(s)
else:
    print('red')
Problem p03307 (python)

Fixed submission:
n = int(input())
if n%2==0:
    print(n)
else:
    print(n * 2)

Buggy submission (verdict: Runtime Error):
n = int(input().split())
if n%2==0:
    print(n)
else:
    print(n * 2)
Problem p02627 (python)

Fixed submission:
a = str(input())

if ord(a) < ord ("a"):
    print("A")
else:
    print("a")

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split()))
q = int(input())

for i in range(q):
    b, c = map(int, input().split())
    newlist = a_list
    for j in range(n):
        if newlist[j] == b:
          newlist[j] = c
          ans = sum(newlist)
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split()))
q = int(input())

for i in range(q):
    b, c = map(int, input().split())
    newlist = a_list
    for j in range(n):
        if newlist[j] == b:
          newlist[j] = c
          ans = sum(newlist)
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split()))
q = int(input())

for i in range(q):
    b, c = map(int, input().split())
    newlist = a_list
    for j in range(n):
        if newlist[j] == b:
          newlist[j] = c
          ans = sum(newlist)
    print(ans)
Problem p02689 (python)

Fixed submission:
n,m = map(int, input().split())
h_list = list(map(int, input().split()))
newlist = list(h_list)
for i in range(m):
    a, b = map(int, input().split())
    if h_list[a-1] < h_list[b-1]:
        newlist[a-1] = 0
    elif h_list[a-1] > h_list[b-1]:
        newlist[b-1] = 0
    else:
        newlist[a-1] = 0
        newlist[b-1] = 0
print(len(h_list) - newlist.count(0))

Buggy submission (verdict: Runtime Error):
h_list = list(map(int, input().split())) #元リスト（変えない）
newlist = list(h_list) #変換用リスト
for i in range(m):
    a, b = map(int, input().split())
    if h_list[a-1] < h_list[b-1]:
        newlist[a-1] = 0
    elif h_list[a-1] > h_list[b-1]:
        newlist[b-1] = 0
    else:
        newlist[a-1] = 0
        newlist[b-1] = 0
print(len(h_list) - newlist.count(0))

Buggy submission (verdict: Runtime Error):
h_list = list(map(int, input().split()))
newlist = list(h_list)
for i in range(m):
    a, b = map(int, input().split())
    if h_list[a-1] < h_list[b-1]:
        newlist[a-1] = 0
    elif h_list[a-1] > h_list[b-1]:
        newlistlist[b-1] = 0
    else:
        newlist[a-1] = 0
        newlist[b-1] = 0
print(len(h_list) - newlist.count(0))

Buggy submission (verdict: Runtime Error):
h_list = list(map(int, input().split())) #元リスト（変えない）
newlist = list(h_list) #変換用リスト
for i in range(m):
    a, b = map(int, input().split())
    if h_list[a-1] < h_list[b-1]:
        newlist[a-1] = 0
    elif h_list[a-1] > h_list[b-1]:
        newlistlist[b-1] = 0
    else:
        newlist[a-1] = 0
        newlist[b-1] = 0
print(len(h_list) - newlist.count(0))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
h_list = list(map(int, input().split())) #元リスト（変えない）
newlist = list(h_list) #変換用リスト
for i in range(m):
    a, b = map(int, input().split())
    if h_list[a-1] < h_list[b-1]:
        newlist[a-1] = 0
    elif h_list[a-1] > h_list[b-1]:
        newlistlist[b-1] = 0
    else:
        newlist[a-1] = 0
        newlist[b-1] = 0
print(n - newlist.count(0))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
h_list = list(map(int, input().split())) #元リスト（変えない）
newlist = list(h_list) #変換用リスト
for i in range(m):
    a, b = map(int, input().split())
    if h_list[a-1] < h_list[b-1]:
        newlist[a-1] = 0
    elif h_list[a-1] > h_list[b-1]:
        newlistlist[b-1] = 0
    else:
        newlist[a-1] = 0
        newlist[b-1] = 0
print(n - newlist.count(0))
Problem p02597 (python)

Fixed submission:
n = int(input())
C = [c for c in input()]
Red = []
White = []
len_Red = 0
len_White = 0
for i in range(n):
    if C[i] == 'R':
        Red.append(i)
        len_Red += 1
    else:
        White.append(i)
        len_White += 1

ans = 0
cnt = 0
w = 0
r = len_Red - 1
while True:
    if w < len_White:
        cnt = White[w]
        w += 1
    else:
        print(ans)
        exit()
    if r >= 0 and cnt < Red[r]:
        C[cnt], C[r] = C[r], C[cnt]
        ans += 1
        r -= 1
    else:
        print(ans)
        exit()

Buggy submission (verdict: Runtime Error):
n = int(input())
C = [c for c in input()]
Red = []
White = []
len_Red = 0
len_White = 0
for i in range(n):
    if C[i] == 'R':
        Red.append(i)
        len_Red += 1
    else:
        White.append(i)
        len_White += 1


ans = 0
cnt = 0
w = 0
r = len_Red - 1
while True:
    if w < len_White:
        cnt = White[w]
        w += 1
    else:
        print(ans)
        exit()
    if cnt < Red[r]:
        C[cnt], C[r] = C[r], C[cnt]
        ans += 1
        r -= 1
    else:
        print(ans)
        exit()
Problem p02659 (python)

Fixed submission:
a, b = input().split()
a, b = int(a), int(b.replace('.', ''))
print((a * b) // 100)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))

if 0 in A:
    print(0)
    exit()
ans = 1
for a in A:
    ans = ans * a
    if ans > pow(10, 18):
        print(-1)
        exit()
print(ans)
Problem p02831 (python)

Fixed submission:
A, B = map(int, input().split())
min = min(A, B)
max = max(A, B)

cnt = 1
while True:
    if max * cnt % min == 0:
        print(max * cnt)
        exit()
    cnt += 1

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(int(A*B/math.gcd(A, B)))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print(int(A*B/math.gcd(A, B)))
Problem p03013 (python)

Fixed submission:
n, m = map(int, input().split())
IN = [int(input()) for _ in range(m)]

# i段目が壊れているならa[i] = 1,そうでないならa[i] = 0
a = [0 for _ in range(n+1)]
for i in IN:
    a[i] = 1

# dp[i] := i段目から最上段にたどり着くまでの移動方法の数
# dp[i] = 0 (a[i] が 1)
# dp[i] = dp[i+1] + dp[i+2] (それ以外)
dp = [-1 for _ in range(n+1)]

dp[n] = 0
if a[n-1] == 1:
    dp[n-1] = 0
else:
    dp[n-1] = 1
if a[n-2] == 1:
    dp[n-2] = 0
elif dp[n-1] == 0:
    dp[n-2] = 1
else:
    dp[n-2] = 2

for i in range(n-3, -1, -1):
    if a[i] == 1:
        dp[i] = 0
    else:
        dp[i] = dp[i+1] +dp[i+2]

print(dp[0]%(10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
IN = [int(input()) for _ in range(m)]
a = [0 for _ in range(n+1)]
for i in IN:
    a[i] = 1

dp = [-1 for _ in range(n+1)]
dp[-1], dp[-2], dp[-3] = 0, 1, 2

for i in range(n-3, -1, -1):
    if a[i] == 1:
        dp[i] = 0
    else:
        dp[i] = dp[i+1] +dp[i+2]
print(dp[0]%1000000007)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [0 for _ in range(n+1)]
for i in range(m):
    a[int(input())] = 1

dp = [-1 for _ in range(n+1)]
dp[-1], dp[-2], dp[-3] = 0, 1, 2

for i in range(n-3, -1, -1):
    if a[i] == 1:
        dp[i] = 0
    else:
        dp[i] = dp[i+1] +dp[i+2]
print(dp[0]%1000000007)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [0 for _ in range(n+1)]
for i in range(m):
    a[int(input())] = 1

dp = [-1 for _ in range(n+1)]
dp[-1], dp[-2], dp[-3] = 0, 1, 2

for i in range(n-3, -1, -1):
    if a[i] == 1:
        dp[i] = 0
    else:
        dp[i] = dp[i+1] +dp[i+2]
print(dp[0]%1000000007)
Problem p03127 (python)

Fixed submission:
import heapq

n = int(input())
A = list(map(lambda x: int(x) * (-1), input().split()))

heapq.heapify(A)

while len(A) > 1:
    Amax1 = heapq.heappop(A) * (-1)
    Amax2 = heapq.heappop(A) * (-1)
    pushA = Amax1 % Amax2
    if pushA == 0:
        heapq.heappush(A, Amax2 * (-1))
    else:
        heapq.heappush(A, pushA * (-1))
        heapq.heappush(A, Amax2 * (-1))

print(A[0] * (-1))

Buggy submission (verdict: Runtime Error):
import heapq

n = int(input())
A = list(map(lambda x: int(x) * (-1), input().split()))

heapq.heapify(A)

while len(A) > 1:
    print(A)
    Amax1 = heapq.heappop(A) * (-1)
    Amax2 = heapq.heappop(A) * (-1)
    pushA = Amax1 % Amax2
    if pushA == 0:
        heapq.heappush(A, Amax2 * (-1))
    else:
        heapq.heappush(A, pushA * (-1))
        heapq.heappush(A, Amax2 * (-1))

print(A[0] * (-1))
Problem p02580 (python)

Fixed submission:
H, W, M = map(int, input().split())
h = [0] * (H+1)
w = [0] * (W+1)
l = set()
for i in range(M):
  x, y = map(int, input().split())
  h[x] += 1
  w[y] += 1
  l.add((x, y))
  
c = max(h)
d = max(w)
a = [i for i, x in enumerate(h) if x == c]
b = [i for i, x in enumerate(w) if x == d]

flag = False
for s in a:
  for t in b:
    if (s, t) not in l:
      flag = True
      break
  if flag:
    break
ans = c+d
if not flag:
  ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
H, W, M = map(int, input().split())
h = [0] * (H+1)
w = [0] * (W+1)
l = [[0]*(W+2) for i in range(H+2)]
for i in range(M):
  x, y = map(int, input().split())
  h[x] += 1
  w[y] += 1
  l[x][y] = 1

a = [i for i, x in enumerate(h) if x == max(h)]
b = [i for i, x in enumerate(w) if x == max(w)]

flag = False
for s in a:
  for t in b:
    if l[s][t] == 0:
      flag = True
      break
  if flag:
    break
if flag:
  ans = max(h)+max(w)
else:
  ans = max(h)+max(w)-1
print(ans)

Buggy submission (verdict: Runtime Error):
H, W, M = map(int, input().split())
h = [0] * (H+1)
w = [0] * (W+1)
l = [[0]*W for i in range(H)]
for i in range(M):
  x, y = map(int, input().split())
  h[x] += 1
  w[y] += 1
  l[x-1][y-1] = 1

a = [i for i, x in enumerate(h) if x == max(h)]
b = [i for i, x in enumerate(w) if x == max(w)]

flag = False
for s in a:
  for t in b:
    if l[s-1][t-1] == 0:
      flag = True
      break
  if flag:
    break
if flag:
  ans = max(h)+max(w)
else:
  ans = max(h)+max(w)-1
print(ans)

Buggy submission (verdict: Runtime Error):
H, W, M = map(int, input().split())
h = [0] * (H+1)
w = [0] * (W+1)
l = [[0]*(max(H+2, W+2)) for i in range(max(H+2, W+2))]
for i in range(M):
  x, y = map(int, input().split())
  h[x] += 1
  w[y] += 1
  l[x][y] = 1

a = [i for i, x in enumerate(h) if x == max(h)]
b = [i for i, x in enumerate(w) if x == max(w)]

flag = False
for s in a:
  for t in b:
    if l[s][t] == 0:
      flag = True
      break
  if flag:
    break
if flag:
  ans = max(h)+max(w)
else:
  ans = max(h)+max(w)-1
print(ans)

Buggy submission (verdict: Runtime Error):
H, W, M = map(int, input().split())
h = [0] * (H+1)
w = [0] * (W+1)
l = [[0]*(W+1) for i in range(H+1)]
for i in range(M):
  x, y = map(int, input().split())
  h[x] += 1
  w[y] += 1
  l[x][y] = 1
  
a = []
b = []
c = max(h)
d = max(w)
for i in range(H+1):
  if h[i] == c:
    a.append(i)
for i in range(W+1):
  if w[i] == d:
    b.append(i)

flag = False
for s in a:
  for t in b:
    if l[s][t] == 0:
      flag = True
      break
if flag:
  ans = c+d
else:
  ans = c+d-1
print(ans)

Buggy submission (verdict: Runtime Error):
H, W, M = map(int, input().split())
h = [0] * (H+1)
w = [0] * (W+1)
l = [[0]*(W+1) for i in range(H+1)]
for i in range(M):
  x, y = map(int, input().split())
  h[x] += 1
  w[y] += 1
  l[x][y] = 1

c = max(h)
d = max(w)
a = [i for i, x in enumerate(h) if x == c]
b = [i for i, x in enumerate(w) if x == d]

flag = False
for s in a:
  for t in b:
    if l[s][t] == 0:
      flag = True
      break
if flag:
  ans = c+d
else:
  ans = c+d-1
print(ans)
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a = [0]
b = [0]
for i in range(N):
  a.append(A[i] + a[i])
for i in range(M):
  b.append(B[i] + b[i])
  
ans = 0
j = M
for i in range(N+1):
  if a[i] > K:
    break;
  while b[j] > K-a[i]:
    j -= 1
  ans = max(ans, i+j)
  
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
N, M, K = map(int, input().split())
A = deque(map(int, input().split()))
B = deque(map(int, input().split()))

def doku(li, K, time):
  cnt = 0
  for i in range(len(li)):
    if time+li[0] <= K:
      time += li[0]
      li.popleft()
      cnt += 1
    else:
      return cnt
  return cnt

ans = 0
time = 0
while time+min(A[0], B[0]) <= K:
  plus = min(A[0], B[0])
  time += plus
  ans += 1
  if A[0] == B[0]:
    if A[1] < B[1]:
      A.popleft()
      if not A:
        ans += doku(B, K, time)
        break;
    else:
      B.popleft()
      if not B:
        ans += doku(A, K, time)
        break;
  elif A[0] < B[0]:
    A.popleft()
    if not A:
      ans += doku(B, K, time)
      break;
  else:
    B.popleft()
    if not B:
      ans += doku(A, K, time)
      break;
    
print(ans)

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

def doku(li, K, time):
  cnt = 0
  tmp = 0
  for i in range(len(li)):
    if time+li[i] <= K:
      tmp += li[i]
      cnt += 1
    else:
      return cnt
  return cnt

ans = 0
time = 0
while time+min(A[0], B[0]) <= K:
  plus = min(A[0], B[0])
  time += plus
  ans += 1
  if A[0] <= B[0]:
    A.pop(0)
    if not A:
      ans += doku(B, K, time)
      print('A')
      break;
  else:
    B.pop(0)
    if not B:
      ans += doku(A, K, time)
      print('B')
      break;
  print(A, B, time, ans)
    
print(ans)
Problem p02624 (python)

Fixed submission:
N = int(input())

def num_divisors_table(n):
  table = [0] * (n + 1)
  for i in range(1, n + 1):
    for j in range(i, n + 1, i):
      table[j] += j
  return sum(table)

print(num_divisors_table(N))

Buggy submission (verdict: Runtime Error):
import sympy
n = int(input())

ans = 0
for i in range(n):
  ans += i*sympy.divisor_count(i)
print(ans)
Problem p02695 (python)

Fixed submission:
import itertools
N, M ,Q = map(int, input().split())
l = []
for i in range(Q):
  a, b, c, d = map(int, input().split())
  l.append([a, b, c, d])
  
nums = list(itertools.combinations_with_replacement(range(1, M+1), N))
scores = []
for row in nums:
  score = 0
  i = 0
  while i < Q:
    if row[l[i][1]-1]-row[l[i][0]-1] == l[i][2]:
      score += l[i][3]
    i += 1
  scores.append(score)
  
print(max(scores))

Buggy submission (verdict: Runtime Error):
import itertools
N, M ,Q = map(int, input().split())
l = []
for i in range(Q):
  a, b, c, d = map(int, input().split())
  l.append([a, b, c, d])
  
num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
nums = list(itertools.combinations_with_replacement(num, 10))
scores = []
for row in nums:
  score = 0
  i = 0
  while i < Q:
    if row[l[i][1]]-row[l[i][0]] == l[i][2]:
      score += l[i][3]
    i += 1
  scores.append(score)
  
print(max(scores))

Buggy submission (verdict: Runtime Error):
import itertools
N, M ,Q = map(int, input().split())
l = []
for i in range(Q):
  a, b, c, d = map(int, input().split())
  l.append([a, b, c, d])
  
num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
nums = list(itertools.combinations_with_replacement(nums, 10))
scores = []
for row in nums:
  score = 0
  i = 0
  while i < Q:
    if row[l[i][1]]-row[l[i][0]] == l[i][2]:
      score += l[i][3]
    i += 1
  scores.append(score)
  
print(max(scores))
Problem p02701 (python)

Fixed submission:
N = int(input())
S = []
for i in range(N):
  S.append(input())

print(len(set(S)))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N) if input() not in S]
  
print(len(S))
Problem p02707 (python)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

l = Counter(A)
for i in range(1, N+1):
  print(l[i])

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

l = collections.Counter(A)
for i in range(1, N+1):
  print(l[i])

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

counter = 0
for i in range(1, N):
  for j in range(N):
    if A[j] == i:
      counter += 1
  print(counter)
  counter = 0
Problem p02729 (python)

Fixed submission:
N, M = map(int, input().split())

if N != 0 and M != 0:
  answer = N*(N-1)/2 + M*(M-1)/2
  print(int(answer))
elif N == 0:
  answer = M*(M-1)/2
  print(int(answer))
else:
  answer = N*(N-1)/2
  print(int(answer))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

if N != 0 and M != 0:
  answer = N(N-1)/2 + M(M-1)/2
  print(answer)
elif N == 0:
  answer = M(M-1)/2
  print(answer)
else:
  answer = N(N-1)/2
  print(answer)
Problem p02777 (python)

Fixed submission:
s, t = input().split()
a, b = map(int, input().split())
u = input()
 
if s == u:
  a = a - 1
else:
  b =  b - 1
  
print("{} {}".format(a, b))

Buggy submission (verdict: Runtime Error):
s, t = input().split()
a, b = int(input().split())
u = input()

if s == u:
  a = a - 1
else:
  b =  b - 1
  
print("{} {}".format(a, b))
Problem p02785 (python)

Fixed submission:
H, K = map(int, input().split())
hp = list(map(int, input().split()))
hp.sort(reverse=True)
print(sum(hp[K:]))

Buggy submission (verdict: Runtime Error):
H, K = map(int, input().split())
hp = list(int, map(input().split()))
hp.sort(reverse=True)
print(sum(hp[K:]))

Buggy submission (verdict: Runtime Error):
H, K = map(int, input().split())
hp = list(map(input().split()))
hp.sort(reverse=True)
print(sum(hp[K:]))

Buggy submission (verdict: Runtime Error):
H, K = map(int, input().split())
hp = list(map(input().split()))
hp_sorted = sorted(hp, reverse=True)
print(sum(hp_sorted[K:]))

Buggy submission (verdict: Runtime Error):
H, K = map(int, input().split())
hp = list(map(input().split()))
hp_sorted = sorted(hp, reverse=True)
hp_new = list(hp_sorted[K:])
print(sum(hp_new))

Buggy submission (verdict: Runtime Error):
H, K = map(int, input().split())
hp = list(map(input().split()))
hp_sorted = sorted(hp, reverse=True)
hp_new = hp_sorted[K:]
print(sum(hp_new))