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

Fixed submission:
N,X = map(int,input().split())
num = 0
count = 0
listA=list(map(int,input().split()))
    #listA<-[1,2,2,3,1]
    #ここに逐次処理を書けばいいと思う。

for i in range(N+1):
    if num<=X and i==N:
        count=i+1
        break
    elif num<=X:
        num = num+listA[i]
        count=count+1
    else:
        break
print(count)

Buggy submission (verdict: Runtime Error):
N,X = map(int,input().split())
num = 0
count = 0
listA=list(map(int,input().split()))
    #listA<-[1,2,2,3,1]
    #ここに逐次処理を書けばいいと思う。

for i in range(N+1):
    if num<=X:
        num = num+listA[i]
        count=count+1
    else:
        break
print(count)
Problem p03043 (python)

Fixed submission:
N,K = map(int,input().split())
i=0
p=0
u=0
sum_a=0
number=[]
if N>=K:
    num = K-1
else:
    num = N
for a in range(1,num+1):
    sum_a=a
    while u<=1:
        sum_a1=sum_a*2
        sum_a =+sum_a1
        #print(sum_a)
        i=i+1
        #print(sum_a)
        if (sum_a)>=K:
            u=2
    number.append(i)
    u=0
    i=0
    sum_a1=0
if num!=N:
    for i in range(N):
        number.append(0)
for i in range(N):
    if number[i]!=0:
        a=(1/2)**int(number[i])
        p = p +((1/N)*a)
        #print(p)
    else:
        p=p + (1/N)
    

print(p)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
i=0
p=0
u=0
sum_a=0
number=[]
if N>=K:
    num = K-1
else:
    num = N
for a in range(1,num+1):
    sum_a=a
    while u<=1:
        sum_a1=sum_a*2
        sum_a =+sum_a1
        #print(sum_a)
        i=i+1
        #print(sum_a)
        if (sum_a)>=K:
            u=2
    number.append(i)
    u=0
    i=0
    sum_a1=0
if num!=N:
    for i in range(N-K):
        number.append(0)
for i in range(N):
    if number[i]!=0:
        a=(1/2)**int(number[i])
        #print(a)
        p = p +((1/N)*a)
        #print(p)
    else:
        p=p + (1/N)
    

print(p)
Problem p03086 (python)

Fixed submission:
S = input()
S = S +'R'
#ATCG = 'ATCG'                   
count = 0
j=0
num=[]
for i in range(len(S)):
    # for j in range(4):
    #     if S[i]==ATCG[j]:
    # if (S[i] == 'A' or S[i]=='T' or S[i]=='C' or S[i]== 'G') and (i==(len(S)-1)):
    #     count =count+1
    #     print(S[i])
    #     num.append(count)

    if S[i] == 'A' or S[i]=='T' or S[i]=='C' or S[i]== 'G':
        count=count+1
        #print(S[i])
       
    else:
        num.append(count)
        j=j+1
        count=0


#print(num)
max_num=max(num)
print(max_num)

Buggy submission (verdict: Runtime Error):
S = input()                 
count = 0
j=0
num=[]
for i in range(len(S)):
    # for j in range(4):
    #     if S[i]==ATCG[j]:
    if S[i] == 'A' or S[i]=='T' or S[i]=='C' or S[i]== 'G':
        count=count+1
        #print(S[i])
    else:
        num.append(count)
        j=j+1

max_num=max(num)
print(max_num)
Problem p03109 (python)

Fixed submission:
A = input()

# #for i in range(int(4)):
# a_y = int(A[0]) * 1000
# b_y = int(A[1]) *100
# c_y = int(A[2])*10
# d_y = int(A[3])

# yyyy = a_y + b_y + c_y + d_y
#print(yyyy)
if int(A[5])!=0:
    mm = (int(A[5])*10) + (int(A[6]))
else:
    mm = int(A[6])

if int(A[8])!=0:
    dd = (int(A[8])*10) + (int(A[9]))
else:
    dd = int(A[9])
    

# if yyyy>2019:
#     print("TBD")
# elif yyyy==2019 and mm>=5:
#     print("TBD")
# else:
#     print("Heisei")

if mm>4:
    print("TBD")
else:
    print("Heisei")

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

# #for i in range(int(4)):
# a_y = int(A[0]) * 1000
# b_y = int(A[1]) *100
# c_y = int(A[2])*10
# d_y = int(A[3])

# yyyy = a_y + b_y + c_y + d_y
#print(yyyy)
if int(A[5])!=0:
    mm = (int(A[5])*10) + (int(A[6]))
else:
    mm = int(A[6])

if int(A[8])!=0:
    dd = (int(A[8])*10) + (int(A[9]))
else:
    dd = int(A[9])
    

# if yyyy>2019:
#     print("TBD")
# elif yyyy==2019 and mm>=5:
#     print("TBD")
# else:
#     print("Heisei")

if mm>4:
    print("TBD")
else:
    print("Heisei")
Problem p03126 (python)

Fixed submission:
N,M = map(int,input().split())
num =0
line_m=[]
line_s=[]
for k in range(M+1):
    line_m.append(0)
for i in range(N):
    line_s = list(map(int, input().split()))
    for n in range(int(line_s[0])):
        line_m[int(line_s[n+1])] = int(line_m[int(line_s[n+1])]) + 1

for s in range(M+1):
    if line_m[s] == N:
        num = num+1

# print(line_s)
# print(line_m)

print(num)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
num =0
line_m=[]
line_s=[]
for k in range(M):
    line_m.append(0)
for i in range(N):
    line_s = list(map(int, input().split()))
    for n in range(int(line_s[0])):
        line_m[int(line_s[n+1])] = int(line_m[int(line_s[n+1])]) + 1

for s in range(M):
    if line_m[s] == N:
        num = num+1

print(num)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
num =0
line_m=[]
line_s=[]
for k in range(M):
    line_m.append(0)
for i in range(N):
    line_s = list(map(int, input().split()))
    for n in range(int(line_s[0])):
        line_m[int(line_s[n])] = int(line_m[int(line_s[n])]) + 1

for s in range(M):
    if line_m[s] == N:
        num = num+1

print(num)
Problem p03129 (python)

Fixed submission:
n,k = map(int,input().split())
if n%2==0:
    num = int(n/2)
else:
    num = int(n/2) + 1
if num>=k:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
num = int(n/2) + 1
if n!=2andnum>=k:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
num = int(n/2) + 1
if n!=2&&num>=k:
    print('YES')
else:
    print('NO')
Problem p03369 (python)

Fixed submission:
order= input().strip()
count = 0
for i in range (3):
    if order[i]=='o':
        count=count+100

print(700+count)

Buggy submission (verdict: Runtime Error):
kind,kona = map(int,input().split())

grum = []
sum_grum=0

for i in range(kind):
    grum.append(input())
for j in range(kind):
    sum_grum = sum_grum+int(grum[j])

kona = kona - sum_grum
minimun = int(min(grum))

if kona>=minimun:
    kona_sec = kona//minimun

print(kind+kona_sec)

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

grum = []
sum_grum=0

for i in range(kind):
    grum.append(input())
for j in range(kind):
    sum_grum = sum_grum+int(grum[j])

kona = kona - sum_grum
minimun = int(min(grum))

if kona>=minimun:
    kona_sec = kona//minimun

print(kind+kona_sec)
Problem p03378 (python)

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

List_one = [0]*B
List_one = list(map(int,input().split()))

List_one.append(C)
#LIst_one = List_one + [C]
#print (List_one)

List_one.sort()# List_two=List_one.sort()としたらNoneを返してしまう。
#print(List_one)

x = List_one.index(C)

if x>=B-x:
    print(B-x)
else:
    print(x)

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

List_one = [0]*B
List_one = list(map(int,input().split()))

List_one.append(C)
#LIst_one = List_one + [C]
#print (List_one)

List_one.sort()# List_two=List_one.sort()としたらNoneを返してしまう。
#print(List_one)

x = List_one.index(C)

if x>=B-x:
    print(B-x)
else:
    print(x)

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

List_one = [0]*B
List_one = list(map(int,input().split()))

List_one.append(C)
#LIst_one = List_one + [C]
#print (List_one)

List_one.sort()# List_two=List_one.sort()としたらNoneを返してしまう。
#print(List_one)

x = List_one.index(C)

if x+1>=B-x:
    print(B-x)
else:
    print(x+1)
Problem p03408 (python)

Fixed submission:
n = int(input())
s = [input() for i in range(n)]

m = int(input())
t = [input() for i in range(m)]

ans = 0
for str in s: #strは単語を表している。ループの回数としてはn回（sの配列数）
    cou = s.count(str) - t.count(str) #sの中にstr（たとえばapple)が何個あるか、tの中に同じく　str（spple)が何個あるか調べて引いてる。
    ans = max(cou, ans)

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]

m = int(input())
t = [input() for i in range(m)]

ans = 0
for str in s: 
    cou = s.oount(str) - t.count(str) 
    ans = max(cou, ans)

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]

m = int(input())
t = [input() for i in range(m)]

ans = 0
for str in s: #strは単語を表している。ループの回数としてはn回（sの配列数）
    cou = s.oount(str) - t.count(str) #sの中にstr（たとえばapple)が何個あるか、tの中に同じく　str（spple)が何個あるか調べて引いてる。
    ans = max(cou, ans)

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]

m = int(input())
t = [input() for i in range(m)]

ans = 0

for str in s:#strは単語を表している。ループの回数としてはn回（sの配列数）
    count = s.oount(str)-t.count(str) #sの中にstr（たとえばapple)が何個あるか、tの中に同じく　str（spple)が何個あるか調べて引いてる。
    ans = max(ans,count)　

print(ans)
Problem p03415 (python)

Fixed submission:
c1 = str(input())
c2 = str(input())
c3 = str(input())

c1_list = list(c1)
c2_list = list(c2)
c3_list = list(c3)

c = c1_list[0] + c2_list[1]+ c3_list[2]

print(c)

Buggy submission (verdict: Runtime Error):
C1 = list(map(str,input().split()))
C2 = list(map(str,input().split()))
C3 = list(map(str,input().split()))

C = C1[0]+C2[1]+C3[2]

print(C)
Problem p03423 (python)

Fixed submission:
N = int(input())
ans =0
if N<=2:
    print('0')
else:
    ans=N//3
    print(ans)

Buggy submission (verdict: Runtime Error):
 N= int(input())
ans =0
if N<=2:
    print('0')
else:
    ans=N//3
    print(ans)
Problem p03433 (python)

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

if (n == a) or(n%500<=a):
    print('Yes')
else:
    print('No')

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

if n == a || n%500<=a:
    print('Yes')
else:
    print('No')
Problem p03437 (python)

Fixed submission:
a,b = map(int,input().split())

if a%b == 0:
    print("-1")

else:
    print(a)

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

if a%b == 0:
    print("-1")

else:
    print(X)
Problem p03447 (python)

Fixed submission:
X = input()
A = input()
B = input()
X = int(X)
A = int(A)
B = int(B)

reX = X - A;
print(reX%B)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A+1):
 for j in range(B+1):
  reX = X - A*i - B*j;
  if 0<= reX <= C:
   count+=1
   
print(count)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A+1):
 for j in range(B+1):
  reX = X - A*i - B*j;
  if 0<= reX <= C:
   count+=1
print(count)
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A+1):
        for j in range(B+1):
                reX = (X - 500*i - 100*j)//50
                if 0 <= reX <= C:
                        count+=1
   
   
print(count)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A+1);
 for j in range(B+1);
  reX = X - A*i - B*j;
  if 0<= reX <= X
  count++;

print(count)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
calc = a*b;
if calc%2==0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
calc = a * b;
if calc%2==0:
    print("Even")
else:
    print("Odd")
Problem p03543 (python)

Fixed submission:
N = input()
if(N[0] == N[1] == N[2] or  N[1] == N[2] == N[3]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = input()
if(N[0] = N[1] = N[2] or  N[1] = N[2] = N[3]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = input()
if(N[0] = N[1] = N[2] or  N[1] = N[2] = N[3]):
    print('Yes')
else:
    print('No')
Problem p03059 (python)

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

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

X1 = [0] * (N+2)
X2 = [0] * (N+2)

for i in range(N):
    X1[i+1] = math.gcd(X1[i], A[i])
for i in range(N,0,-1):
    X2[i] = math.gcd(X2[i+1], A[i-1])

ans = 1
for i in range(N):
    G = math.gcd(X1[i], X2[i+2])
    if ans < G:
        ans = G
print(ans)
Problem p03061 (python)

Fixed submission:
from fractions import *
n = int(input())
a = [0] + list(map(int, input().split())) + [0]
b = [0] * (n+2)
c = [0] * (n+2)

for i in range(1, n+1):
    b[i] = gcd(b[i-1], a[i])
for i in range(n,0,-1):
    c[i] = gcd(c[i+1], a[i])

ans = 1
for i in range(1, n+1):
    if ans < gcd(b[i-1], c[i+1]):
        ans = gcd(b[i-1], c[i+1])
print(ans)

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

X1 = [0] * (N+2)
X2 = [0] * (N+2)

for i in range(N):
    X1[i+1] = math.gcd(X1[i], A[i])
for i in range(N,0,-1):
    X2[i] = math.gcd(X2[i+1], A[i-1])

ans = 1
for i in range(N):
    G = math.gcd(X1[i], X2[i+2])
    if ans < G:
        ans = G
print(ans)

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

X1 = [0] * (N+2)
X2 = [0] * (N+2)

for i in range(N):
    X1[i+1] = math.gcd(X1[i], A[i])
for i in range(N,0,-1):
    X2[i] = math.gcd(X2[i+1], A[i-1])

ans = 1
for i in range(N):
    gcd = math.gcd(X1[i], X2[i+2])
    if ans < gcd:
        ans = gcd
print(ans)
Problem p03086 (python)

Fixed submission:
S = list(input())
   
ans = []
pre = 0
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        pre += 1
    else:
        ans.append(pre)
        pre = 0

ans.append(pre)
print(max(ans))

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

ATCG = ['A','T','C','G']
ans = []
pre = 0
for s in S:
    if s in ATCG:
        pre += 1
    else:
        ans.append(pre)
        pre = 0

print(max(ans))

Buggy submission (verdict: Runtime Error):
S = list(input())
   
ans = []
pre = 0
for s in S:
    if s == 'A' or s == 'C' or s == 'G'or s == 'T':
        pre += 1
    else:
        ans.append(pre)
        pre = 0

print(max(ans))
Problem p03106 (python)

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

if A > B:
    A, B = B, A

d = []
for i in range(1,A+1):
	if (A % i == 0 and B % i == 0):
		d.append(i)
	
d.reverse()
print(d[K-1])

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

risuto = []
for i in range(1, int(min(A, B) / 2) + 1):
    if (A % i == 0 & B % i == 0):
        risuto.append(i)
        
if (risuto == []):
    print("1")
else:
    print(risuto[K-1])

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

risuto = []
for i in range(1, int(min(A, B) / 2) + 1):
    if (A % i == 0 & B % i == 0):
        risuto.append(i)
        
if (risuto == []):
    print("1")
else:
    print(risuto[K-1])
Problem p03239 (python)

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

C = []
for i in range(N):
    c,t = map(int, input().split())
    if t > T:
        pass
    else:
        C.append(c)

if C == []:
    print("TLE")
else:
    print(min(C))

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

C = []
for i in range(3):
    c,t = map(int, input().split())
    if t > T:
        pass
    else:
        C.append(c)

if C == []:
    print("TLE")
else:
    print(min(C))
Problem p03633 (python)

Fixed submission:
import fractions

N = int(input())
T = [int(input()) for i in range(N)]

LCM = 1
for i in range(N):
    lcm = (T[i] * LCM) // (fractions.gcd(T[i], LCM))
    LCM = lcm

print(LCM)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
T = [int(input()) for i in range(N)]

LCM = 1
for i in range(N):
    lcm = (T[i] * LCM) // (math.gcd(T[i], LCM))
    LCM = lcm

print(LCM)

Buggy submission (verdict: Runtime Error):
import fractions

N = int(input())
T = [int(input()) for i in range(N)]

LCM = []
for i in range(N-1):
    lcm = T[i] * T[i+1] // fractions.gcd(T[i], T[i+1])
    LCM.append(lcm)

print(LCM[-1])

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
T = [int(input()) for i in range(N)]

LCM = []
for i in range(N-1):
    lcm = T[i] * T[i+1] // math.gcd(T[i], T[i+1])
    LCM.append(lcm)

print(LCM[-1])
Problem p04043 (python)

Fixed submission:
line = input().split()

cnt5 = line.count("5")
cnt7 = line.count("7")

if cnt5 == 2 and cnt7 == 1:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
if A = 5 and B = 5 and C = 7:
  print("YES")
  
elif A = 5 and B = 7 and C = 5:
  print("YES")
  
elif A = 7 and B = 5 and C = 5:
  print("YES")
  
else:
  print("NO")
Problem p03086 (python)

Fixed submission:
def checkACGT(s):
    for i in range(len(s)):
        if s[i] == "A" or s[i] == "G" or s[i] == "C" or s[i] == "T":
            continue
        else:
            return False
    return True

s=input()
n = len(s)
check = []
check.append(s)
while True:
    if not check:
        print(0)
        break
    if checkACGT(check[0]):
        print(len(check[0]))
        break
    else:
        if len(check[0]) == 1:
            check.pop(0)
            continue
        check.append(check[0][1:])
        check.append(check[0][:len(check[0])-1])
        check.pop(0)

Buggy submission (verdict: Runtime Error):
s=input()
n = len(s)
check = []
check.append(s)
while True:
    if checkACGT(check[0]):
        print(len(check[0]))
        break
    else:
        if len(check[0]) == 1:
            print(0)
            break
        check.append(check[0][1:])
        check.append(check[0][:len(check[0])-2])
        check.pop(0)
Problem p03109 (python)

Fixed submission:
dt = [int(i) for i in input().split("/")]

if dt[0] >= 2019 and dt[1] >= 5:
    print("TBD")
else :
    print("Heisei")

Buggy submission (verdict: Runtime Error):
dt = [for int(i) in input().split("/")]
if dt[0] >= 2019 and dt[1] >= 5:
    print("TBD")
else :
    print("Heisei")

Buggy submission (verdict: Runtime Error):
from dateutil.parser import parse
dt = parse(input())
if dt.year >= 2019 and dt.month >= 5:
    print("TBD")
else :
    print("Heisei")
Problem p03212 (python)

Fixed submission:
def is753(n):
    if n % 10 != 3 and n % 10 != 5 and n % 10 !=7:
        return False
    exist3 = False
    exist5 = False
    exist7 = False
    a = str(n)
    for i in range (len(a)):
        x = n % 10
        if x == 3 :
            exist3 = True
        elif x == 5 :
            exist5 = True
        elif x == 7 :
            exist7 = True
        else :
            return False
        n = n // 10
    if exist3 and exist5 and exist7:
        return True
    else :
        return False

n = int(input())
a = len(str(n))
lst = [[3,5,7]]
tfs = [3,5,7]
for i in range(1,a):
    l = []
    for v in lst[i-1]:
        for t in tfs:
            l.append(int(str(v) + str(t)))
    lst.append(l)
s = 0
for l in lst:
    for v in l:
        if is753(v) and v <= n:
            s+=1
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = len(str(n))
lst = [[3,5,7]]
tfs = [3,5,7]
for i in range(1,a):
    l = []
    for v in lst[i-1]:
        for t in tfs:
            l.append(int(str(v) + str(t)))
    lst.append(l)
s = 0
for l in lst:
    for v in l:
        if is753(v) and v <= n:
            s+=1
print(s)
Problem p03244 (python)

Fixed submission:
import collections
n = int(input())
v = input().split()
v_int = [int(i) for i in v]
v_odd = []
v_even = []
for i in range(int(n/2)):
  v_even.append(v_int[i*2])
  v_odd.append(v_int[i*2+1])
c_odd = collections.Counter(v_odd)
c_even = collections.Counter(v_even)
max_odd = 0
second_odd = 0
max_key_odd = 0
for key in c_odd:
  if max_odd < c_odd[key]:
    second_odd = max_odd
    max_odd = c_odd[key]
    max_key_odd = key
  elif second_odd < c_odd[key]:
    second_odd = c_odd[key]
    
max_even = 0
second_even = 0
max_key_even = 0
for key in c_even:
  if max_even < c_even[key]:
    second_even = max_even
    max_even = c_even[key]
    max_key_even = key
  elif second_even < c_even[key]:
    second_even = c_even[key]
    
if max_key_even != max_key_odd:
  print(int(n)- max_even - max_odd)
else:
  if max_even > max_odd:
    if max_even == second_even:
      print(int(n) - max_even - max_odd)
    else:
      print(int(n) - max_even - second_odd)
  elif max_even < max_odd:
    if max_odd == second_odd:
      print(int(n) - max_odd - max_even)
    else:
      print(int(n) - max_odd - second_even)
  else : 
    if second_odd > second_even:
      print(int(n) - max_even - second_odd)
    else :
      print(int(n) - max_odd - second_even)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
v = input().split()
v_int = [int(i) for i in v]
v_odd = []
v_even = []
for i in range(int(n/2)):
  v_even.append(v_int[i*2])
  v_odd.append(v_int[i*2+1])
print(v_even)
print(v_odd)
c_odd = collections.Counter(v_odd)
c_even = collections.Counter(v_even)
max_odd = 0
second_odd = 0
max_key_odd = 0
for key in c_odd:
  if max_odd < c_odd[key]:
    second_odd = max_odd
    max_odd = c_odd[key]
    max_key_odd = key
  elif second_odd < c_odd[key]:
    second_odd = c_odd[key]
    
max_even = 0
second_even = 0
max_key_even = 0
for key in c_even:
  if max_even < c_even[key]:
    second_even = max_even
    max_even = c_even[key]
    max_key_even = key
  elif second_even < c_even[key]:
    second_even = c_even[key]
    
print(second_odd)
print(second_even)
if max_key_even != max_key_odd:
  print(int(n)- max_even - max_odd)
else:
  if max_even > max_odd:
    if max_even == second_even:
      print(int(n) - max_even - max_odd)
    else:
      print(int(n) - max_even - second_odd)
  else:
    if max_odd = second_odd:
      print(int(n) - max_odd - max_even)
    else:
      print(int(n) - max_odd - second_even)
Problem p03469 (python)

Fixed submission:
s = input()
print(s.replace("2017", "2018"))

Buggy submission (verdict: Runtime Error):
n, h, *t=map(int,open(0).read().split())
a = t[::2]
b = t[1::2]
ma = max(a)
b_high = [i for i in b if i > ma]
if sum(b_high) > h:
  ans = 0
  b_high = sorted(b_high)
  while h < 0:
    h = h - b_high.pop()
    ans += 1
  print(ans)
else:
  if (h - sum(b_high)) % ma == 0:
    print(len(b_high) + (h - sum(b_high)) // ma)
  else:
    print(len(b_high) + ((h - sum(b_high)) // ma) + 1)
Problem p03472 (python)

Fixed submission:
n, h, *t=map(int,open(0).read().split())
a = t[::2]
b = t[1::2]
ma = max(a)
b_high = [i for i in b if i > ma]
if sum(b_high) > h:
  ans = 0
  b_high = sorted(b_high)
  while h > 0:
    h = h - b_high.pop()
    ans += 1
  print(ans)
else:
  if (h - sum(b_high)) % ma == 0:
    print(len(b_high) + (h - sum(b_high)) // ma)
  else:
    print(len(b_high) + ((h - sum(b_high)) // ma) + 1)

Buggy submission (verdict: Runtime Error):
n, h, *t=map(int,open(0).read().split())
b_high = [i for i in sorted(t[1::2]) if all(i >= j for j in sorted(t[::2]))]
if (h - sum(b_high)) % a[-1] == 0:
  print(len(b_high) + (h - sum(b_high)) // sorted(t[::2])[-1])
else:
  print(len(b_high) + ((h - sum(b_high)) // sorted(t[::2])[-1]) + 1)
Problem p03263 (python)

Fixed submission:
h,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
z=[]
for i in range(w):
  if i%2==0:
    for j in range(h):
      z.append([j,i])
  else:
    for j in range(h):
      z.append([h-j-1,i])
count=0
ans=[]
for i,(y,x) in enumerate(z):
  if a[y][x]%2!=0 and i<len(z)-1:
    count+=1
    ans.append(i)
    a[z[i+1][0]][z[i+1][1]]+=1
print(count)
for i in ans:
  print(z[i][0]+1,z[i][1]+1,z[i+1][0]+1,z[i+1][1]+1)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
z=[]
for i in range(w):
  if i%2==0:
    for j in range(h):
      z.append([j,i])
  else:
    for j in range(h):
      z.append([h-j-1,i])
count=0
ans=[]
for i,(y,x) in enumerate(z):
  if a[y][x]%2!=0 and i<len(z):
    count+=1
    ans.append(i)
    a[z[i+1][0]][z[i+1][1]]+=1
print(count)
for i in ans:
  print(z[i][0]+1,z[i][1]+1,z[i+1][0]+1,z[i+1][1]+1)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
z=[]
for i in range(w):
  if i%2==0:
    for j in range(h):
      z.append([j,i])
  else:
    for j in range(h):
      z.append([h-j-1,i])
count=0
ans=[]
for i,(y,x) in enumerate(z):
  if a[y][x]%2!=0:
    count+=1
    ans.append(i)
    a[z[i+1][0]][z[i+1][1]]+=1
print(count)
for i in ans:
  print(z[i][0]+1,z[i][1]+1,z[i+1][0]+1,z[i+1][1]+1)