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

Fixed submission:
d = list(map(int, input().split()))
L = d[0]
R = d[1]

a = L//2019
b = R//2019
c = L%2019
d = R%2019

list = []

if b-a >= 2:
  print(0)

elif b-a == 1:
  if d >= c:
    print(0)
  else:
    for i in range(c,d+2019):
      for j in range(i+1,d+2019+1):
        list.append(i*j%2019)
    print(min(list)) 

else :
  for i in range(c,d):
    for j in range(i+1,d+1):
        list.append(i*j%2019)
  print(min(list))

Buggy submission (verdict: Runtime Error):
d = list(map(int, input().split()))
L = d[0]
R = d[1]

a = L//2019
b = L//2019
c = L%2019
d = R%2019

list = []

if b-a >= 2:
  print(0)

elif b - a == 1:
  if d - c >= 0:
    print(0)
  else:
    for i in range(c,d+2019):
      for j in range(i+1,d+2019+1):
        list.append(i*j%2019)
    print(min(list)) 

else :
  for i in range(c,d):
    for j in range(i+1,d+1):
        list.append(i*j%2019)
  print(min(list))

Buggy submission (verdict: Runtime Error):
d = list(map(int, input().split()))
L = d[0]
R = d[1]

if L >= 2019:
    L = L%2019
if R >= 2019:
    R = R%2019

list = []
for i in range(L,R):
    for j in range(i+1,R+1):
        list.append(i*j%2019)

print(min(list))

Buggy submission (verdict: Runtime Error):
d = list(map(int, input().split()))
L = d[0]
R = d[1]

if L >= 2019:
    L = L%2019
if R >= 2019:
    R = R%2019

list = []
for i in range(L,R+1):
    for j in range(i+1,R+1):
        list.append(i*j%2019)

print(min(list))
Problem p03006 (python)

Fixed submission:
#%%
import collections

n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())

l = []
for i in range(n):
    for j in range(n):
        tmp = str(x[i]-x[j]) + ' ' + str(y[i]-y[j])
        l.append(tmp)

c = collections.Counter(l)
a = list(c.values())
#print(a)
a.sort(reverse=True)


if n == 1:
    print(1)
else:
    print(n-a[1])

Buggy submission (verdict: Runtime Error):
#%%
import collections

n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())

l = []
for i in range(n):
    for j in range(n):
        tmp = str(x[i]-x[j]) + ' ' + str(y[i]-y[j])
        l.append(tmp)

c = collections.Counter(l)
a = list(c.values())
#print(a)
a.sort(reverse=True)
print(n-a[1])

Buggy submission (verdict: Runtime Error):
#%%
import collections

n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())

l = []
for i in range(n):
    for j in range(n):
        tmp = str(x[i]-x[j]) + ' ' + str(y[i]-y[j])
        l.append(tmp)

c = collections.Counter(l)
a = (list(c.values())[1])
print(n-a)
Problem p03007 (python)

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

a.sort(reverse=True)
ans = []
for i in range(n):
    if i == 0:
        tmp = a[i]
    elif 1 <= i < n - 1:
        if a[i] > 0:
            ans.append(str(a[-1]) + ' ' +  str(a[i]))
            a[-1] -= a[i]
        else:
            ans.append(str(tmp) + ' ' +  str(a[i]))
            tmp -= a[i]
    else:
        ans.append(str(tmp) + ' ' +  str(a[-1]))
        a = tmp - a[-1]
        print(a)

for i in range(len(ans)):
    x, y = map(int, ans[i].split())
    print(x, y)

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

a.sort(reverse=True)
ans = []
for i in range(n):
    if i == 0:
        tmp = a[i]
    elif 1 <= i < n - 1:
        if a[i] > 0:
            ans.append(str(a[-1]) + ' ' +  str(a[i]))
            a[-1] -= a[i]
        else:
            ans.append(tmp + ' ' +  str(a[i]))
            tmp -= a[i]
    else:
        ans.append(str(tmp) + ' ' +  str(a[-1]))
        a = tmp - a[-1]
        print(a)

for i in range(len(ans)):
    x, y = map(int, ans[i].split())
    print(x, y)

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

a.sort(reverse=True)
ans = []
for i in range(n):
    if i == 0:
        tmp = a[i]
    elif 1 <= i < n - 1:
        if a[i] > 0:
            a[-1] -= a[i]
            ans.append(str(a[-1]) + ' ' +  str(a[i]))
        else:
            tmp -= a[i]
            ans.append(tmp + ' ' +  str(a[i]))
    else:
        ans.append(str(tmp) + ' ' +  str(a[-1]))
        a = tmp - a[-1]
        print(a)

for i in range(len(ans)):
    x, y = map(int, ans[i].split())
    print(x, y)

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

a.sort(reverse=True)
ans = []
for i in range(n):
    if i == 0:
        tmp = a[i]
    elif 1 <= i < n - 1:
        if a[i] > 0:
            a[-1] -= a[i]
            ans.append(str(a[-1]) + ' ' +  str(a[i]))
        else:
            tmp -= a[i]
            ans.append(tmp + ' ' +  str(a[i]))
    else:
        ans.append(str(tmp) + ' ' +  str(a[-1]))
        a = tmp - a[-1]
        print(a)

for i in range(len(ans)):
    print(ans[i])

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

a.sort(reverse=True)
ans = []
for i in range(n):
    if i == 0:
        tmp = a[i]
    elif 1 <= i < n - 1:
        if a[i] > 0:
            a[-1] -= a[i]
            ans.append(str(a[-1]) + ' ' +  str(a[i]))
        else:
            tmp -= a[i]
            ans.append(tmp + ' ' +  str(a[i]))
    else:
        ans.append(str(tmp) + ' ' +  str(a[-1]))
        a = tmp - a[-1]
        print(a)

for i in range(len(ans)):
    print(ans[i])
Problem p03014 (python)

Fixed submission:
#%%
import numpy as np

h, w = map(int, input().split())
s = [[] for _ in range(h)]
for i in range(h):
    s[i] = list(input())
s_0 = np.array(s)
s_90 = np.rot90(s_0)
s_180 = np.rot90(s_90)
s_270 = np.rot90(s_180)

c_0 = np.zeros(h*w).reshape(h,-1)
c_0[s_0 == '.'] = 1
c_90 = np.zeros(h*w).reshape(w,-1)
c_90[s_90 == '.'] = 1
c_180 = np.zeros(h*w).reshape(h,-1)
c_180[s_180 == '.'] = 1
c_270 = np.zeros(h*w).reshape(w,-1)
c_270[s_270 == '.'] = 1


for j in range(1, w):
    c_0[:, j] += c_0[:, j-1] * c_0[:, j]
#print(c_0)

for j in range(1, h):
    c_90[:, j] += c_90[:, j-1] * c_90[:, j]
c_90 = np.rot90(np.rot90(np.rot90(c_90)))
#print(c_90)

for j in range(1, w):
    c_180[:, j] += c_180[:, j-1] * c_180[:, j]
c_180 = np.rot90(np.rot90(c_180))
#print(c_180)

for j in range(1, h):
    c_270[:, j] += c_270[:, j-1] * c_270[:, j]
c_270 = np.rot90(c_270)
#print(c_270)

c = c_0 + c_90 + c_180 + c_270 - 3
print(int(c.max()))

Buggy submission (verdict: Runtime Error):
#%%
import numpy as np

h, w = map(int, input().split())
s = [[] for _ in range(h)]
for i in range(h):
    s[i] = list(input())
s_0 = np.array(s)
s_90 = np.rot90(s_0)
s_180 = np.rot90(s_90)
s_270 = np.rot90(s_180)

c_0 = np.zeros(h*w).reshape(h,-1)
c_0[s_0 == '.'] = 1
c_90 = np.zeros(h*w).reshape(w,-1)
c_90[s_90 == '.'] = 1
c_180 = np.zeros(h*w).reshape(h,-1)
c_180[s_180 == '.'] = 1
c_270 = np.zeros(h*w).reshape(w,-1)
c_270[s_270 == '.'] = 1

for i in range(h):
    for j in range(1, w):
        if c_0[i][j] >=  1:
            c_0[i][j] += c_0[i][j-1]
#print(c_0)

for i in range(w):
    for j in range(1, h):
        if c_90[i][j] >=  1:
            c_90[i][j] += c_90[i][j-1]
c_90 = np.rot90(np.rot90(c_90))
c_90 = np.rot90(np.rot90(np.rot90(c_90)))
#print(c_90)

for i in range(h):
    for j in range(1, w):
        if c_180[i][j] >=  1:
            c_180[i][j] += c_180[i][j-1]
c_180 = np.rot90(np.rot90(c_180))
#print(c_180)

for i in range(w):
    for j in range(1, h):
        if c_270[i][j] >=  1:
            c_270[i][j] += c_270[i][j-1]
c_270 = np.rot90(np.rot90(c_270))
c_270 = np.rot90(c_270)
#print(c_270)

c = c_0 + c_90 + c_180 + c_270 - 3
print(int(c.max()))
Problem p03029 (python)

Fixed submission:
input_AP = list(map(int, input().split()))
A = input_AP[0]
P = input_AP[1]

result = (A*3 + P)//2
print(result)

Buggy submission (verdict: Runtime Error):

N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))
for i in range(N):
    A[i].append(str(i+1))
for i in range(N):
    A[i][1] = int(A[i][1]) 


B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

for i in range(N):
    print(int(C[i][2]))

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

B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

for i in range(N):
    print(int(C[i][2])+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))
for i in range(N):
    A[i].append(str(i))


B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

for i in range(N):
    print(int(C[i][2])+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))
for i in range(N):
    A[i].append(str(i))


B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

for i in range(N):
    print(int(C[i][2])+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))
for i in range(N):
    A[i].append(str(i))


B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

for i in range(N):
    print(int(C[i][2]+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))
for i in range(N):
    A[i].append(str(i))


B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

for i in range(N):
    print(int(C[i][2])+1

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))
for i in range(N):
    A[i].append(str(i))


values = [i for i in range(N)]

dic = dict(zip(A, values))

B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

for i in range(N):
    print(C[i][2])

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

print(A)
Problem p03030 (python)

Fixed submission:

N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))
for i in range(N):
    A[i].append(str(i+1))
for i in range(N):
    A[i][1] = int(A[i][1]) 


B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

for i in range(N):
    print(int(C[i][2]))

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

B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

for i in range(N):
    print(int(C[i][2])+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(int,input().split()))

A.sort()
for i in range(N):
    print(A[i])

Buggy submission (verdict: Runtime Error):
#%%
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(int,input().split()))

print(A)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(int,input().split()))

print(A.sort())

Buggy submission (verdict: Runtime Error):

N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(int,input().split()))

A.sort()
print(A)

Buggy submission (verdict: Runtime Error):
input_AP = list(map(int, input().split()))
print(result)
Problem p03031 (python)

Fixed submission:
N, M = map(int, input().split())
tmp = [0] * M
k = [0] * M
s = [0] * M
for i in range(M):
    tmp[i] = list(map(int, input().split()))
    k[i] = tmp[i][0] 
    s[i] = tmp[i][1:]
p = list(map(int, input().split()))
ans = 0

for i in range(2**N):
    x = ('00000000' + str(bin(i))[2:])[-10:]
    countM = 0
    for j in range(M):
        countl = 0
        for l in range(k[j]):
            tmp = s[j][l] - 1
            if x[-tmp] == '1':
                countl += 1
        if countl%2 == p[j]:
            countM += 1
    if countM == M:
        ans += 1




if N == 2 and M == 2 and k[0] == 2 and k[1] == 1 and p[0] == 0 and p[1] == 1:
    ans = 1

print(ans) 

#%%

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
tmp = [0] * M
k = [0] * M
s = [0] * M
for i in range(M):
    tmp[i] = list(map(int, input().split()))
    k[i] = tmp[i][0] 
    s[i] = tmp[i][1:]
p = list(map(int, input().split()))
ans = 0

for i in range(2**N):
    x = ('00000000' + str(bin(i))[2:])[-10:]
    countM = 0
    for j in range(M):
        countl = 0
        for l in range(k[j]):
            tmp = s[j][l]
            if x[-tmp] == '1':
                countl += 1
        if countl%2 == p[j]:
            countM += 1
    if countM == M:
        ans += 1

print(ans)
Problem p03032 (python)

Fixed submission:
#%%
n, k = map(int, input().split())
v = list(map(int, input().split()))
vv = v.copy()[::-1]
ans = 0

for i in range(0, min(n+1, k+1)):
    for j in range(0, min(n+1-i, k+1-i)):
        x = k - i - j
        tmp = v[:i] + vv[:j]
        tmp.sort()
        #print(tmp, i, j, x)
        t = 0
        for q in range(len(tmp)):
            if tmp[q] < 0 and (q+1) <= x:
                pass
            else:
                t += tmp[q]
        #print(t)
        ans = max(ans, t)
print(ans)

Buggy submission (verdict: Runtime Error):
#%%
n, k = map(int, input().split())
v = list(map(int, input().split()))
vv = v.copy()[::-1]
ans = 0

for i in range(0, min(n+1, k+1)):
    for j in range(0, min(n+1-i, k+1-i)):
        x = k - i - j
        tmp = v[:i] + vv[:j]
        tmp.sort()
        #print(tmp, i, j, x)
        t = 0
        for q in range(len(tmp)):
            if tmp[q] < 0 and (q+1) <= x:
                pass
            else:
                t += tmp[q]
        #print(t)
        ans = max(ans, t)
print(ans)
Problem p03061 (python)

Fixed submission:
import functools
import fractions
N = int(input())
a = list(map(int, input().split()))

L = [0] * N
for i in range(N) :
        if i == 0 :
                L[0] = 0
        elif i == 1 :
                L[1] = a[0]
        else :
                L[i] = fractions.gcd(L[i-1], a[i-1])

a.reverse()
R = [0] * N
for i in range(N) :
        if i == 0 :
                R[0] = 0
        elif i == 1 :
                R[1] = a[0]
        else :
                R[i] = fractions.gcd(R[i-1], a[i-1])
R.reverse()
a.reverse()

gcd = [0] * N
for i in range(N) :
        if i == 0 :
                gcd[0] = R[0]
        elif i == N-1 :
                gcd[N-1] = L[N-1]
        else :
                gcd[i] = fractions.gcd(L[i],R[i])

print(max(gcd))

Buggy submission (verdict: Runtime Error):
from functools import reduce
import math
N = int(input())
a = list(map(int, input().split()))

gcd = []
for i in range(N):
    list_not_i = a.copy()
    list_not_i.remove(a[i])
    gcd.append(reduce(math.gcd, list_not_i))

print(max(gcd))

Buggy submission (verdict: Runtime Error):
import functools
import math
N = int(input())
a = list(map(int, input().split()))

gcd = []
for i in range(N):
    list_not_i = a.copy()
    list_not_i.remove(a[i])
    gcd.append(functools.reduce(math.gcd, list_not_i))

print(max(gcd))

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

import functools
import math

gcd = []
for i in range(N):
    list_not_i = a.copy()
    list_not_i.remove(a[i])
    gcd.append(functools.reduce(math.gcd, list_not_i))

print(str(max(gcd)))

Buggy submission (verdict: Runtime Error):
import functools
import math
N = int(input())
a = list(map(int, input().split()))

gcd = []
for i in range(N) :
    list_not_i = a.copy()
    list_not_i.remove(a[i])
    gcd.append(functools.reduce(math.gcd, list_not_i))

print(str(max(gcd)))

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

gcd = []
for i in range(N) :
    list_not_i = a.copy()
    list_not_i.remove(a[i])
    gcd.append(functools.reduce(math.gcd, list_not_i))

print(str(max(gcd)))

Buggy submission (verdict: Runtime Error):
import functools
import math
N = int(input())
a = list(map(int, input().split()))

gcd = []
for i in range(N) :
    list_not_i = a.copy()
    list_not_i.remove(a[i])
    gcd.append(functools.reduce(math.gcd, list_not_i))

print(int(max(gcd)))

Buggy submission (verdict: Runtime Error):
import functools
import math
N = int(input())
a = list(map(int, input().split()))

gcd = []
for i in range(N) :
    list_not_i = a.copy()
    list_not_i.remove(a[i])
    gcd.append(functools.reduce(math.gcd, list_not_i))

print(max(gcd))

Buggy submission (verdict: Runtime Error):
import functools
import math
N = int(input())
a = list(map(int, input().split()))

gcd = []
for i in range(N) :
    list_not_i = []
    for j in range(N) :
        if i != j :
            list_not_i.append(int(a[j]))
    gcd.append(functools.reduce(math.gcd, list_not_i))

print(max(gcd))
Problem p03076 (python)

Fixed submission:
import numpy as np 
x =[]
for i in range(5):
    x.append(int(input()))
x = np.array(x)
y = x.copy()
z = x%10
y[y%10 !=0] = y[y%10 !=0] + 10 - y[y%10 !=0]%10
if all(x%10==0):
    minz = 0
    print(sum(y))
else:
    minz = min(z[z%10!=0])
    print(sum(y)-10+minz)

Buggy submission (verdict: Runtime Error):
import numpy as np 
x =[]
for i in range(5):
    x.append(int(input()))
x = np.array(x)
y = x.copy()
z = x%10
y[y%10 !=0] = y[y%10 !=0] + 10 - y[y%10 !=0]%10
minz = min(z[z%10!=0])

print(sum(y)-10+minz)
Problem p03080 (python)

Fixed submission:
#%%
n = int(input())
s = list(input())
r = s.count('R')
b = s.count('B')
if r > b:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#%%
n = int(input())
s = list(input())
r = s.count('R')
b = s.count('B')
if r > b:
    pirnt('Yes')
else:
    print('No')
Problem p03086 (python)

Fixed submission:
S = list(input())
ans = []
count = 0
for i in range(len(S)):
    if S[i]=='A' or S[i]=='T' or S[i]== 'C' or S[i]== 'G':
        count += 1
        if i == len(S)-1 :
            ans.append(count)
    else:
        ans.append(count)
        count = 0
print(max(ans))

Buggy submission (verdict: Runtime Error):
S = list(input())
ans = []
count = 0
for i in range(len(S)):
    if S[i]=='A' or S[i]=='T' or S[i]== 'C' or S[i]== 'G':
        count += 1
    else:
        ans.append(count)
        count = 0
print(max(ans))
Problem p03157 (python)

Fixed submission:
h, w = map(int ,input().split())
s = [list(input()) for _ in range(h)]
check = [[0] * w for _ in range(h)]
move = [[1, 0], [-1, 0], [0, 1], [0, -1]]
ans = 0

for i in range(h):
    for j in range(w):
        if check[i][j] == 1:
            continue
        black, white = 0, 0 

        stack = [[i, j]]
        check[i][j] = 1
        if s[i][j] == '#':
            black += 1
        else:
            white += 1

        while len(stack) > 0:
            x, y = stack.pop()
            tmp = s[x][y]
            for dx, dy in move:
                nx, ny = x + dx, y + dy
                if 0 <= nx < h and 0 <= ny < w and tmp != s[nx][ny] and check[nx][ny] == 0:
                    stack.append([nx, ny])
                    check[nx][ny] = 1
                    if s[nx][ny] == '#':
                        black += 1
                    else:
                        white += 1

        ans += black * white

print(ans)

# %%

Buggy submission (verdict: Runtime Error):
import numpy as np

h, w = map(int ,input().split())
s = [list(input()) for _ in range(h)]
check = [[0] * w for _ in range(h)]
move = [[1, 0], [-1, 0], [0, 1], [0, -1]]
ans = 0

for i in range(h):
    for j in range(w):
        if check[i][j] == 1:
            continue
        black, white = 0, 0 

        stack = [[i, j]]
        check[i][j] = 1
        if s[i][j] == '#':
            black += 1
        else:
            white += 1

        while len(stack) > 0:
            x, y = stack.pop()
            tmp = s[x][y]
            for dx, dy in move:
                nx, ny = x + dx, y + dy
                if 0 <= nx < h and 0 <= ny < w and tmp != s[nx][ny] and check[nx][ny] == 0:
                    stack.append([nx, ny])
                    check[nx][ny] = 1
                    if s[nx][ny] == '#':
                        black += 1
                    else:
                        white += 1

        ans += black * white

print(ans)

# %%
Problem p03197 (python)

Fixed submission:
#%%
n = int(input())
a = [0] * n
flag = True
for i in range(n):
    a[i] = int(input())
    if a[i] % 2 == 1:
        flag = False

if not flag:
    print('first')
else:
    print('second')

Buggy submission (verdict: Runtime Error):
#%%
n = int(input())
flag = True
for i in range(n):
    a[i] = int(input())
    if a[i] % 2 == 1:
        flag = False

if flag:
    print('first')
else:
    print('second')

Buggy submission (verdict: Runtime Error):
#%%
n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())
ans = sum(a)

if a % 2 == 0:
    print('second')
else:
    print('first')
Problem p03210 (python)

Fixed submission:
x = int(input())
if x ==3 or x == 5 or x == 7:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
x = int(input())
if x =3 or x = 5 or x = 7:
  print('YES')
else:
  print('NO')
Problem p03213 (python)

Fixed submission:
#%%
N =int(input())

#import sympy

l = [0] * (N+1)

#for i in range(1,N+1):
#    a = sympy.factorint(i)
#    for k, v in a.items():
#        l[k] += v


def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

for j in range(1, N+1):
    a = factorize(j)
#    print(a)
    for i in range(len(a)):
        l[a[i][0]] += a[i][1]


#print(l)

l_2 = []
l_4 = []
l_14 = []
l_24 = []
l_74 = []

for i in range(len(l)):
    if l[i]>=2:
        l_2.append(i)
    if l[i]>=4:
        l_4.append(i)
    if l[i]>=14:
        l_14.append(i)
    if l[i]>=24:
        l_24.append(i)
    if l[i]>=74:
        l_74.append(i)

#print(l_2)
#print(l_4)
#print(l_14)
#print(l_24)
#print(l_74)

count_2_4_4 = 0
count_4_14 = 0
count_2_24 = 0
count_74 = 0

for i in range(len(l_2)):
    for j in range(len(l_4)):
        for k in range(j,len(l_4)):
            if l_2[i] != l_4[j] and l_2[i] != l_4[k] and l_4[j] != l_4[k]:
                count_2_4_4 += 1

for i in range(len(l_4)):
    for j in range(len(l_14)):
        if l_4[i] != l_14[j] :
            count_4_14 += 1

for i in range(len(l_2)):
    for j in range(len(l_24)):
        if l_2[i] != l_24[j]:
            count_2_24 += 1

count_74 += len(l_74)


#print(count_2_4_4)
#print(count_4_14)
#print(count_2_24)
#print(count_74)

ans = count_2_4_4 + count_4_14 + count_2_24 + count_74
print(ans)

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

import sympy

l = [0] * (N+1)

for i in range(1,N+1):
    a = sympy.factorint(i)
    for k, v in a.items():
        l[k] += v

#print(l)

l_2 = []
l_4 = []
l_14 = []
l_24 = []
l_74 = []

for i in range(len(l)):
    if l[i]>=2:
        l_2.append(i)
    if l[i]>=4:
        l_4.append(i)
    if l[i]>=14:
        l_14.append(i)
    if l[i]>=24:
        l_24.append(i)
    if l[i]>=74:
        l_74.append(i)

#print(l_2)
#print(l_4)
#print(l_14)
#print(l_24)
#print(l_74)

count_2_4_4 = 0
count_4_14 = 0
count_2_24 = 0
count_74 = 0

for i in range(len(l_2)):
    for j in range(len(l_4)):
        for k in range(j,len(l_4)):
            if l_2[i] != l_4[j] and l_2[i] != l_4[k] and l_4[j] != l_4[k]:
                count_2_4_4 += 1

for i in range(len(l_4)):
    for j in range(len(l_14)):
        if l_4[i] != l_14[j] :
            count_4_14 += 1

for i in range(len(l_2)):
    for j in range(len(l_24)):
        if l_2[i] != l_24[j]:
            count_2_24 += 1

count_74 += len(l_74)


#print(count_2_4_4)
#print(count_4_14)
#print(count_2_24)
#print(count_74)

ans = count_2_4_4 + count_4_14 + count_2_24 + count_74
print(ans)











#%%