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

Fixed submission:
n, m = map(int, input().split())
p = []
s = []
for i in range(m):
    p_i, s_i = input().split()
    p.append(int(p_i))
    s.append(s_i)

correct = [0]*n
penalty = [0]*n

for i in range(m):
    no = p[i]
    if correct[no-1] == 1:
        continue
    elif s[i] == 'WA':
        penalty[no-1] += 1
    elif s[i] == 'AC':
        correct[no-1] = 1

pen = 0
for i in range(n):
    if correct[i] == 1:
        pen += penalty[i]
print(sum(correct), pen)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
p = []
s = []
for i in range(m):
    p_i, s_i = input().split()
    p.append(int(p_i))
    s.append(b)


res = [0]*n
correct = 0
penalty = 0
for i in range(m):
    no = p[i] - 1
    if res[no] == 1:
        continue
    elif s[i] == 'WA':
        penalty += 1
    elif s[i] == 'AC':
        correct += 1
        res[no] = 1

print(correct, penalty)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ps = [input().split() for _ in range(m)]
p, s = [list(i) for i in zip(*ps)]
p = list(map(int, p))

res = [0]*n
correct = 0
penalty = 0
for i in range(m):
    no = p[i] - 1
    if res[no] == 1:
        continue
    elif s[i] == 'WA':
        penalty += 1
    elif s[i] == 'AC':
        correct += 1
        res[no] = 1

print(correct, penalty)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ps = [input().split() for _ in range(m)]
p, s = [list(i) for i in zip(*ps)]
p = list(map(int, p))

res = [0]*n
correct = 0
penalty = 0
for i in range(m):
    no = p[i] - 1
    if res[no] == 1:
        continue
    elif s[no] == 'WA':
        penalty += 1
    elif s[no] == 'AC':
        correct += 1
        res[no] = 1

print(correct, penalty)
Problem p02813 (python)

Fixed submission:
import itertools
import math

n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
p_no, q_no = 0, 0

per = [c+1 for c in range(n)]
per_list = list(itertools.permutations(per))

for i in range(math.factorial(n)):
    if p == per_list[i]:
        p_no = i
    if q == per_list[i]:
        q_no = i

print(abs(p_no - q_no))

Buggy submission (verdict: Runtime Error):
import itertools
import math

n = input()
p = [map(int, input().split())]
q = [map(int, input().split())]
p_no, q_no = 0, 0

per = [c+1 for c in range(n)]
per_list = list(itertools.permutations(per))

for i in range(math.factorial(n)):
    if p == per_list[i]: p_no = i
    if q == per_list[i]: q_no = i

print(abs(p_no - q_no))

Buggy submission (verdict: Runtime Error):
import itertools

n = input()
p = [map(int, input().split())]
q = [map(int, input().split())]
p_no, q_no = 0, 0

per = [c+1 for c in range(n)]
per_list = list(itertools.permutations(per))

for i in range(n):
    if p == per_list[i]: p_no = i
    if q == per_list[i]: q_no = i

print(abs(p_no - q_no))
Problem p02606 (python)

Fixed submission:
L,R,d = map(int, input().split())
X = L//d
Y = R//d
if L%d == 0 and R%d == 0:
  if L>R:
    print(X-Y+1)
  else:
    print(Y-X+1)
else:
  if L >R:
    print(X-Y)
  else:
    print(Y-X)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
for i in range(1,46):
  for j in range(1,46):
    for k in range(1,46):
      A.append(i**2+j**2+k**2+i*j+i*k+j*k)
A = sorted(A)
B = [0]*100000
for i in range(10000):
  if A[i] < 10000:
    B[A[i]] += 1
C = B[1:N+1]
[print(i) for i in C]

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
for i in range(1,46):
  for j in range(1,46):
    for k in range(1,46):
      A.append(i**2+j**2+k**2+i*j+i*k+j*k)
A = sorted(A)
B = [0]*10001
for i in range(10001):
  if A[i] < 10001:
    B[A[i]] += 1
C = B[1:N+1]
[print(i) for i in C]

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
for i in range(1,46):
  for j in range(1,46):
    for k in range(1,46):
      A.append(i**2+j**2+k**2+i*j+i*k+j*k)
A = sorted(A)
B = [0]*N
for i in range(N):
  if A[i] < N:
    B[A[i]] += 1
C = B[1:]
[print(i) for i in C]
Problem p02608 (python)

Fixed submission:
N = int(input())
 
ans = [0] * 10050
 
for i in range(1, 105):
    for j in range(1, 105):
        for k in range(1, 105):
            v = i*i+j*j+k*k+i*j+i*k+j*k
            if v < 10050:
                ans[v] += 1
 
for i in range(N):
    print(ans[i+1])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
for i in range(1,46):
  for j in range(1,46):
    for k in range(1,46):
      A.append(i**2+j**2+k**2+i*j+i*k+j*k)
A = sorted(A)
B = [0]*N
for i in range(N):
  if A[i] == A[i-1]:
    B[A[i]] += 1
  else:
    B[A[i]]=1
[print(i) for i in B]

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
for i in range(1,46):
  for j in range(1,46):
    for k in range(1,46):
      A.append(i**2+j**2+k**2+i*j+i*k+j*k)
A = sorted(A)
B = [0]*N
for i in range(N):
  if A[i] == A[i-1]:
    B[A[i]] += 1
  else:
    B[A[i]]=1
[print(i) for i in B]
Problem p02615 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
B = A[::-1]
C = N-1
ans = 0
if N%2 == 0:
  ans += B[0]
  for i in range(N//2-1):
    ans += 2*B[i+1]
else:
  ans += B[0]
  ans += B[N//2]
  for i in range(N//2-1):
    ans += 2*B[i+1]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
A = reversed(A)
B = set(A)
B = list(B)
B = B[::-1]
C = N-1
ans = 0
if N%2 == 0:
  ans += B[0]
  for i in range(N//2-1):
    ans += 2*B[i+1]
else:
  ans += B[0]
  ans += B[N//2]
  for i in range(N//2-1):
    ans += 2*B[i+1]
print(ans)
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a+a*a+a*a*a)

Buggy submission (verdict: Runtime Error):
N,M,K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
for i in range(N):
  del A[1]
  del B[1]
Problem p02657 (python)

Fixed submission:
A,B = map(int, input().split())
print(A*B)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
 
if 0 in a: 
    ans = 0
else:
    ans = 1
    for ai in a:
        ans *= ai
        if ans > 10**18:
            ans = -1
            break
print(prod)

Buggy submission (verdict: Runtime Error):
A = A[::-1]
ans = 1
for i in range(N):
  if 0 in A:
    ans = 0
    break
  elif ans > 10**18:
    ans = -1
    break
  else:
    ans = ans*A[i]
if ans > 10**18:
  print(-1)
else:
  print(ans)
Problem p02658 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
 
if 0 in a: 
    ans = 0
else:
    ans = 1
    for ai in a:
        ans *= ai
        if ans > 10**18:
            ans = -1
            break
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
A = A[::-1]
ans = 1
for i in range(N+1):
  if 0 in A:
    ans = 0
    break
  elif ans > 10**18:
    ans = -1
    break
  else:
    ans = ans*A[i]
if ans > 10**18:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A = sorted[A]
A = A[::-1]
ans = 1
for i in range(N):
  if A[i] == 0:
    ans = 0
    break
  elif ans > 10**18:
    ans = -1
    break
  else:
    ans = ans*A[i]
if ans > 10**18:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = 1
for i in range(N):
   ans *= A[i]
   if ans > 10**18:
     ans = -1
     break

 print(ans)
Problem p02664 (python)

Fixed submission:
S = input()
s=[]
for i in S:
    s.append(i)
t = []
for i in range(len(s)):
  if s[i] == '?':
    t.append('D')
  else:
    t.append(s[i])
Strt = "".join(t)
print(Strt)

Buggy submission (verdict: Runtime Error):
T = input()
T = list(T)
N = len(T)
  if T[i] =='?'
    del T[i]   
    T.insert(i,'D')
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = input()
T = list(T)
N = len(T)
for i in range(N):
  if T[i] =='?' and T[i+1]=='D':
    del T[i]   
    T.insert(i-1,'P')
  elif T[i] =='?' and T[i+1]=='?':
    del T[i]   
    T.insert(i-1,'P')
  elif T[i] =='?': 
    del T[i] 
    T.insert(i-1,'D')
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = input()
T = list(T)
N = len(T)
for i in range(N):
  if T[i] =='?' and T[i+1]=='D':
    del T[i]   
    T.insert(i,'P')
  elif T[i] =='?' and T[i+1]=='?':
    del T[i]   
    T.insert(i,'P')
  elif T[i] =='?': 
    del T[i] 
    T.insert(i,'D')
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = input()
T = list(T)
N = len(T)
for i in range(N):
  if T[i] =='?' and T[i+1]=='D':
    del T[i]   
    T.insert(i,'P')
  elif T[i] =='?' and T[i+1]=='?':
    del T[i]   
    T.insert(i,'P')
  elif T[i] =='?': 
    del T[i] 
    T.insert(i,'D')
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = input()
T = list(T)
N = len(T)
for i in range(N):
  if T[i] =='?' and T[i+1]=='D':
    del T[i]   
    T.insert(i,'P')
  elif T[i] =='?' and T[i+1]=='?':
    del T[i]   
    T.insert(i,'P')
  elif T[i] =='?': 
    del T[i] 
    T.insert(i,'D')
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = input().split()
N = len(T)
for i in range(N):
  if T[i] =='?' and T[i+1]=='D':
    del T[i]   
    T.insert(i, P)
  elif T[i] =='?':
    del T[i] 
    T.insert(i, D)
print(T)
Problem p02675 (python)

Fixed submission:
N = int(input())

if N % 10 == 3:
 print('bon')
elif N % 10 == 0:
 print('pon')
elif N % 10 == 1:
 print('pon')
elif N % 10 == 6:
 print('pon')
elif N % 10 == 8:
 print('pon')
else:
 print('hon')

Buggy submission (verdict: Runtime Error):
N = int(input())

if int(N) % 10 = 3:
 print('bon')
elif int(N) % 10 = 0:
 print('pon')
elif int(N) % 10 = 1:
 print('pon')
elif int(N) % 10 = 6:
 print('pon')
elif int(N) % 10 = 8:
 print('pon')
else:
 print('hon')

Buggy submission (verdict: Runtime Error):
N = int(input())

if N % 10 = 3:
 print('bon')
elif N % 10 = 0:
 print('pon')
elif N % 10 = 1:
 print('pon')
elif N % 10 = 6:
 print('pon')
elif N % 10 = 8:
 print('pon')
else:
 print('hon')

Buggy submission (verdict: Runtime Error):
N = int(input())
if N % 10 = 3:
 print('bon')
elif N % 10 = 0:
 print('pon')
elif N % 10 = 1:
 print('pon')
elif N % 10 = 6:
 print('pon')
elif N % 10 = 8:
 print('pon')
else:
 print('hon')

Buggy submission (verdict: Runtime Error):
N = int(input())

if N % 10 = 3:
 print('bon')
elif N % 10 = 0 or 1 or 6 or 8:
 print('pon')
else:
 print('hon')

Buggy submission (verdict: Runtime Error):
N = int(input())
if int(N)%10 = 3:
 print('bon')
elif int(N)%10 = 0 or 1 or 6 or 8:
 print('pon')
else:
 print('hon')
Problem p02677 (python)

Fixed submission:
import math
A,B,H,M = map(int, input().split())
X = H*30+M*0.5
Y = M*6
if  -180 < X - Y < 0:
  z = Y - X
elif X - Y <= -180:
  z = 360 -(Y - X)
elif 180 > X - Y >= 0:
  z = X - Y
elif X - Y >= 180:
  z = 360-(X - Y)
ans = A*A+B*B-2*A*B*math.cos(math.radians(z))
ANS = math.sqrt(ans)

print(ANS)

Buggy submission (verdict: Runtime Error):
import math
A,B,H,M = map(int, input().split())
X = H*30+M*0.5
Y = M*6
if  -180 < X - Y < 0:
  Z = Y - X
elif X - Y <= -180:
  Z = 360 -(Y - X)
elif 180 > X - Y >= 0:
  z = X - Y
elif X - Y >= 180:
  z = 360-(X - Y)
ans = A*A+B*B-2*A*B*math.cos(math.radians(z))
ANS = math.sqrt(ans)

print(ANS)

Buggy submission (verdict: Runtime Error):
import math
A,B,H,M = map(int, input().split())
X = H*30+M*0.5
Y = M*6
if  -180 < X - Y < 0:
  Z = Y - X
elif X - Y <= -180:
  Z = 360 -(Y - X)
elif 180 > X - Y >= 0:
  z = X - Y
else:
  z = 360-(X - Y)
ans = A*A+B*B-2*A*B*math.cos(math.radians(z))
ANS = math.sqrt(ans)

print(ANS)

Buggy submission (verdict: Runtime Error):
import math
A,B,H,M = map(int, input().split())
X = H*30+M*0.5
Y = M*6
if  -180 < X - Y < 0:
  Z = Y - X
elif X - Y <= -180:
  Z = 360 -(Y - X)
elif 180 > X - Y => 0:
  z = X - Y
else:
  Z = 360-(X - Y)
ans = A*A+B*B-2*A*B*math.cos(math.radians(Z))
ANS = ans**0.5

print(ANS)

Buggy submission (verdict: Runtime Error):
A,B,H,M = map(int, input().split())
X = H / 12 * 360 + M / 60 * 30
Y = M / 60 * 360 

if X - Y => 0 and X - Y <= 180:
 C = X - Y
elif X - Y > 180:
 C = 360 - (X - Y)
elif X - Y <= 0 and X - Y > -180:
 C = Y - X
else:
 C = 360 - (Y - X)
print(math.sqrt(A*A + B*B - 2*A*B*math.cos(math.radians(int(C))) ))

Buggy submission (verdict: Runtime Error):
A,B,H,M = map(int, input().split())
X = H / 12 * 360 + M / 60 * 30
Y = M / 60 * 360 

if X - Y => 0 and X - Y <= 180:
 C = X - Y
elif X - Y > 180:
 C = 360 - (X - Y)
elif X - Y <= 0 and X - Y > -180:
 C = Y - X
else:
 C = 360 - (Y - X)
print(math.sqrt(A*A + B*B - 2*A*B*math.cos(math.radians(int(C))) ))

Buggy submission (verdict: Runtime Error):
A,B,H,M = map(int, input().split())
X = H / 12 * 360 + M / 60 * 30
Y = M / 60 * 360 

if X => Y:
 C = X - Y
else:
 C = Y - X
print(math.sqrt(A*A + B*B - 2*A*B*math.cos(int(C)) ))
Problem p02687 (python)

Fixed submission:
s=input()
print("ABC" if s=="ARC" else "ARC")

Buggy submission (verdict: Runtime Error):
S = input()
if S =='ABC':
  print('ARC')
else:
  print('ABC)

Buggy submission (verdict: Runtime Error):
S = input()
if S ='ABC':
 print('ARC')
else:
 print('ABC')

Buggy submission (verdict: Runtime Error):
S = input()
if S='ABC':
  print('ARC')
else :
  print('ABC')

Buggy submission (verdict: Runtime Error):
S == 'ABC'

if S == 'ABC':
 print('ARC')
else:
 print('ABC')

Buggy submission (verdict: Runtime Error):

if S == "ABC":
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
if S == 'ABC':
 print('ARC')
else:
 print('ABC')

Buggy submission (verdict: Runtime Error):
S = 'ABC'
if S = 'ABC':
print('ARC')
else:
print('ABC')

Buggy submission (verdict: Runtime Error):
S == 'ABC'

if S == 'ABC' :
 print('ARC')
else :
 print('ABC')

Buggy submission (verdict: Runtime Error):
S = ABC

if S = ABC:
 print('ARC')
else:
 print('ABC')

Buggy submission (verdict: Runtime Error):
S = ABC

if S == ABC:
 print('ARC')
else:
 print('ABC')

Buggy submission (verdict: Runtime Error):
S = ABC
if S = ABC:
 print("ARC")
else:
 print("ABC")

Buggy submission (verdict: Runtime Error):
if S = 'ABC':
 print('ARC')
else:
 print('ABC')

Buggy submission (verdict: Runtime Error):
if S = ABC:
 print('ARC')
elf:
 print('ABC')

Buggy submission (verdict: Runtime Error):
if S = ABC:
 print('ARC')
else:
 print('ABC')

Buggy submission (verdict: Runtime Error):
if S = ABC:
 print('ARC')
else:
 print('ABC')
Problem p02700 (python)

Fixed submission:
import math
A,B,C,D = map(int,input().split())
E = math.ceil(A/D)
F = math.ceil(C/B)
if E >= F:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())
while true:
  A -= D
  B -= C
  if A <= 0 or B <= 0:
     break
if A <= 0:
   print('No')
else:
   print('Yes')
Problem p02719 (python)

Fixed submission:
N,K = map(int, input().split())
print(min(N%K, K-N%K))

Buggy submission (verdict: Runtime Error):
N = int(input())
print(min(N%K, K-N%K))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
list = []
if K == 1:
  print(0)
else:
  for i in range(N):
    N = abs(N-K)
    list.append(N)
    list = sorted(list)
  print(list[0])
Problem p02778 (python)

Fixed submission:
s = input()
print("x" * len(s))

Buggy submission (verdict: Runtime Error):
1 s = input()
2 print('x' * len(s))

Buggy submission (verdict: Runtime Error):
1 s = input().rstrip()
2 print('x' * len(s))
Problem p02780 (python)

Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))
ans = [sum(p[:K])]
for i in range(N-K):
  ans.append(ans[-1]-p[i]+p[i+K])
print(max(ans)/2+K/2)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
p = list(map(int, input().split()))
ans = [sum(p[:K])]
for i in range(N-K):
  ans.append(ans[-1]-p[i]+p[i+k])
print(max(ans)/2+K/2)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
p = list(map(int, input().split()))
ans = []
for i in range(K-1):
   T = p[i:i+K]      
   ans.append(sum(T)/2+0.5*K)
print(ans[-1])
Problem p02823 (python)

Fixed submission:
N,A,B = map(int, input().split())
if (B-A)%2==0:
  print((B-A)//2)
else:
  print(min(A-1,N-B)+1+(B-A-1)//2)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
if (B-A)%2 == 0 and B-A => 0:
  print((B-A)//2+1)
if (B-A)%2 == 0 and A-B => 0:
  print((A-B)//2+1)
D = A-1
E = N-A
F = B-1
G = N-B
elif D+F > E+G and E => G:
  print(E)
elif D+F > E+G and E < G:
  print(G)
elif D+F < E+G and D => F:
  print(D)
else:
  print(F)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
if (B-A)%2 == 0 and B-A => 0:
  print((B-A)//2+1)
if (B-A)%2 == 0 and A-B => 0:
  print((A-B)//2+1)
D = A-1
E = N-A
F = B-1
G = N-B
elif D+F > E+G and D => F:
  print(D)
elif D+F > E+G and D <= F:
  print(F)
elif D+F < E+G and E => G:
  print(E)
else:
  print(G)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
if (B-A)%2 == 0 and B-A => 0:
  print((B-A)//2+1)
if (B-A)%2 == 0 and A-B => 0:
  print((A-B)//2+1)
D = A-1
E = N-A
F = B-1
G = N-B
elif D+F > E+G and D => F:
  print(D)
elif D+F > E+G and D <= F:
  print(F)
elif D+F < E+G and E => G:
  pritn(E)
else:
  print(G)
Problem p02888 (python)

Fixed submission:
import bisect
N = int(input())
list = list(map(int,input().split()))
list = sorted(list)
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        x = list[i]+list[j]
        ind = bisect.bisect_left(list,x)
        ans+=(ind-j-1)
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
list = list(map(int,input().split()))
list = sorted(list)
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        x = list[i]+list[j]
        ind = bisect.bisect_left(list,x)
        ans+=(ind-j-1)
print(ans)
Problem p02911 (python)

Fixed submission:
N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())
list = [K-Q] *N
for i in range(Q):
  list[A[i]-1] += 1
for i in range(N):
  if list[i] >= 1:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())
list = [K-Q] *N
for i in range(Q):
  list[A[i]] += 1
for i in range(N):
  if list[i] >= 1:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())
list = [K-Q] *N
for i in range(Q):
  list[A[i]] += 1
for i in range(N):
  if list[i] >= 1:
    print('Yes')
  else:
    print('No')
Problem p02923 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
list = []
a = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    a += 1
  else:
    list.append(a)
    a = 0
list.append(a)
list = sorted(list)
print(list[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
list = []
a = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    a += 1
    list.append(a)
  else:
    list.append(a)
    a = 0
list = sorted(list)
print(list[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
list = []
a = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    a += 1
    list.append(a)
  else:
    list.append(a)
    a = 0
list = sorted(list)
print(list[-1])
Problem p03103 (python)

Fixed submission:
N,M = map(int,input().split())
list = []
for _ in range(N):
  a,b = map(int,input().split())
  list.append([a,b])
list.sort()
ans = 0
for a,b in list:
  ans += min(b,M)*a
  M = max(0,M-b)
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
list = []
for _ in range(n):
  a,b = map(int,input().split())
  list.append([a,b])
list.sort()
ans = 0
for a,b in l:
  ans += min(b,M)*a
  M = max(0,M-b)
print(ans)
Problem p03455 (python)

Fixed submission:
A,B = map(int, input().split())
if A*B%2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
if  (a*b) % 2:
     print('odd')
else:
     print('even')
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
print(input().count("1"))
Problem p03971 (python)

Fixed submission:
N, A, B = map(int, input().split())
S = str(input())
 
total = 0
kaigai = 0
 
for i in range(0, len(S)):
    if S[i] == 'a':
        if total < A+B:
            print('Yes')
            total += 1
        else:
            print('No')
    elif S[i] == 'b':
        if total < A+B and kaigai <B:
            print('Yes')
            total += 1
            kaigai += 1
        else:
            print('No')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
S = input().split()
s=[]
for i in S:
    s.append(i)
list=[]
H = list.count('b')
for i in range(N):
  if s[i] == 'c'
    print('No')
  elif s[i] =='a' and len(list) <= A+B:
    print('Yes')
    list.append(a)
  elif s[i] =='a':
    print('No')
  elif len(list) <= A+B and H <= B:
    print('Yes')
  else:
    print('No')
Problem p03997 (python)

Fixed submission:
a=input()
b=input()
h=input()
print((int(a)+int(b))*int(h)//2)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
h=input()
print((int(a)+int(b)*int(h)//2)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
h = input()
print((a+b)*h/2)
Problem p02574 (python)

Fixed submission:
#!/usr/bin/env python3
def main():
    from math import gcd

    N = int(input())
    A = []
    INF = 10 ** 6 + 5
    frequency = [0] * INF
    for a in [int(x) for x in input().split()]:
        A.append(a)
        frequency[a] += 1
    
    pairwise = True
    for i in range(2, INF):
        cnt = 0
        for j in range(i, INF, i):
            cnt += frequency[j]
        if cnt > 1:
            pairwise = False
    if pairwise:
        print("pairwise coprime")
        return

    g = 0
    for i in range(N):
        g = gcd(g, A[i])
        if g == 1:
            print('setwise coprime')
            return
    
    print('not coprime')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
def main():
    from math import gcd

    N = int(input())
    A = []
    INF = 10 ** 6
    frequency = [0] * INF
    for a in [int(x) for x in input().split()]:
        A.append(a)
        frequency[a] += 1
    
    pairwise = True
    for i in range(2, INF):
        cnt = 0
        for j in range(i, INF, i):
            cnt += frequency[j]
        if cnt > 1:
            pairwise = False
    if pairwise:
        print("pairwise coprime")
        return

    g = 0
    for i in range(N):
        g = gcd(g, A[i])
        if g == 1:
            print('setwise coprime')
            return
    
    print('not coprime')


if __name__ == '__main__':
    main()
Problem p02618 (python)

Fixed submission:
def resolve():
    D = int(input())
    C = [int(x) for x in input().split()]
    S = []
    for i in range(D):
        S.append(list(map(int, input().split())))
    last_d = []
    score = 0

    for d in range(D):
        contest = 0
        for i in range(len(C)):
            contest = max(contest, S[d][i])
        score += contest
        last_d.append(S[d].index(contest))
        for i in range(len(C)):
            if i in last_d:
                score -= C[i] * last_d[::-1].index(i)
            else:
                score -= C[i] * (d + 1)
        print(S[d].index(contest) + 1)

    
if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    D = int(input())
    C = [int(x) for x in input().split()]
    S = []
    for i in range(D):
        S.append(list(map(int, input().split())))
    last_d = []
    score = 0
    t = 0

    for i in range(len(C)):
        t = max(t, C[i])

    for d in range(D):
        score += S[d][t[d] - 1]
        last_d.append(t[d] - 1)
        for i in range(len(C)):
            if i in last_d:
                score -= C[i] * last_d[::-1].index(i)
            else:
                score -= C[i] * (d + 1)
        print(score)

    
if __name__ == "__main__":
    resolve()