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

Fixed submission:
b = int(input())
a = b % 10
if a ==2 or a== 4 or a==5 or a== 7 or a== 9:
	print("hon")
elif a == 0 or a== 1 or a==6 or a == 8:
	print("pon")
else:
  print("bon")

Buggy submission (verdict: Runtime Error):
a = int(input())
c = b.split()
a = c[-1]
if a ==2 or a== 4 or a==5 or a== 7 or a== 9:
	print("hon")
elif a == 0 or a== 1 or a==6 or a == 8:
	print("pon")
else:
  print("bon")

Buggy submission (verdict: Runtime Error):
a = int(input())
c = b.split('')
a = c[-1]
if a ==2 or a== 4 or a==5 or a== 7 or a== 9:
	print("hon")
elif a == 0 or a== 1 or a==6 or a == 8:
	print("pon")
else:
  print("bon")

Buggy submission (verdict: Runtime Error):
a = int(input())
c = b.split('')
a = c[-1]
if (a ==2 || a== 4 || a==5 || a== 7 || a== 9){
	print("hon")
}else if(a == 0 || a== 1 || a==6 || a == 8){
	print("pon")
}else {
  print("bon")
}

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a,b,c = int(input())
if (c == 2 || c== 4 || c==5 || c ==7 || c==9){
	print("hon")
}else if(c == 0 || c== 1 || c==6 || c ==8){
	print("pon")
}else {
  print("bon")
}

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
b = int(input())
c = b.split('')
a = c[-1]
if (a == '2' || a== '4' || a=='5' || a == '7' || a == '9'){
	print("hon")
}else if(a == '0' || a== '1' || a=='6' || a == '8'){
	print("pon")
}else {
  print("bon")
}
Problem p03448 (python)

Fixed submission:
five = int(input()) + 1
hand = int(input()) + 1
fives = int(input()) + 1
ans = int(input()) 
tmp = 0
 
for i in range(five):
  for j in range(hand):
    for k in range(fives):
      ask = 500 * i + 100 * j + 50 * k
      if ans == ask:
        tmp = tmp + 1

print(tmp)

Buggy submission (verdict: Runtime Error):
five = int(input())
hand = int(input())
fives = int(input())
ans = int(input())
tmp = 0

for i in range(five):
  for j in range(hand):
    for k in range(fives):
   		ask = 500 * (i+1) + 100 * (j+1) + 50 * (k+1) 
  		if ask == ans:
       		tmp = tmp + 1

Buggy submission (verdict: Runtime Error):
five = int(input())
hand = int(input())
fives = int(input())
ans = int(input())
tmp = 0

for i in range(five):
  for j in range(hand):
    for k in range(fives):
   		ask = 500 * i + 100 * j + 50 *k 
  		if ask == ans:
       		tmp = tmp + 1
Problem p03455 (python)

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

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

Buggy submission (verdict: Runtime Error):
a,b = input()
print('Even' if (a * b) % 2 == 1 else  'Odd')

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

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
print('Even' if (a * b) % 2 == 1 else  'Odd')
Problem p03471 (python)

Fixed submission:
N, Y = map(int, input().split())
res10000 =res5000 = res1000 = -1

for x in range(N+1):
    for y in range(N+1-x):
        z = N-x-y # zは決まっているので、ループを減らして、計算量を減らす！
        if 10000*x + 5000*y + 1000*z == Y:
            res10000 = x
            res5000 = y
            res1000 = z

print(res10000, res5000, res1000)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
ranX = ranY = ranZ = -1
for x in (a+1):
  for y in (a+1-x):
    z = a - x - y
    if 1000 * x + 5000 * y + 1000 * z == b:
      ranX = x
      ranY = y
      ranZ = z

print(ranX,  ranY,  ranZ)
Problem p03854 (python)

Fixed submission:
import re
S = input()
'''
メタ文字：
^ = 文字列の先頭、
| = OR
+ = 直前のパターンを1回以上繰り返し、
$ = 文字列の末尾
'''
if re.match("^(dream|dreamer|erase|eraser)+$", S):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
import rs
li = input()
if re.match("^(dream|dreamer|erase|eraser)+$", li):
  print('YSE')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
import rs
li = input()
flag = 'No'

if re.match("^(dream|dreamer|erase|eraser)+$", li):
  flag = 'YES'
      
  
print(flag)

Buggy submission (verdict: Runtime Error):
li = list(input())
list = ['dream','dreamer','erase','eraser']
flag = 'No'
for x in list:
  for y in list:
    if x + y = li:
      flag = 'YES'
  
print(flag)
Problem p02706 (python)

Fixed submission:
N=()
M=()
A=()

N, M = map(int, input().split())

A = list(map(int, input().split()))
for i in range(0,M): 
      N=N-A[i]
      
if N<0:
      print("-1")
else:
      print(N)

Buggy submission (verdict: Runtime Error):
N=()
M=()
A=()

N=int(input(""))
M=int(input(""))
      
for i in range (0,M):
      A=int(input(""))
      N=(N-A)
      
if N<0:
      print("-1")
else:
      print(N)

Buggy submission (verdict: Runtime Error):
N=()
M=()
A=()

N=int(input(""))
M=int(input(""))
      
for i in range (0,M):
      A=int(input(""))
      N=(N-A)
      
if N<0:
      print("-1")
else:
      print(N)
Problem p02612 (python)

Fixed submission:
n = int(input())
if n % 1000 == 0:
    print(0)
else:
    print(1000 - (n % 1000))

Buggy submission (verdict: Runtime Error):
n = list(input())
print(int(n[-3] + n[-2] + n[-1]))
Problem p03844 (python)

Fixed submission:
s = list(input().split())
if s[1] == "+":
  print(int(s[0]) + int(s[2]))
if s[1] == "-":
  print(int(s[0]) - int(s[2]))

Buggy submission (verdict: Runtime Error):
s = list(input().split())
if s[1] == "+":
  print(int(s[0]) + int(s[2]))
if s[1] == "-":
  print(int(s[0]) - int(s[1]))
Problem p03845 (python)

Fixed submission:
import copy

n = int(input())
t = list(map(int,input().split()))
m = int(input())
for i in range(m):
    p,x = map(int,input().split())
    l = t.copy()
    l[p-1] = x
    print(sum(l))

Buggy submission (verdict: Runtime Error):
import copy

n = int(input())
t = list(map(int,input().split()))
m = int(input())
for i in range(m):
    p,x = map(int,input().split())
    l = t.copy()
    l[p-1] = x
    print(sum(l))
Problem p02683 (python)

Fixed submission:
N, M, X = map(int, input().split())
C = [0] * N
A = [0] * N
AA = [list(map(int, input().split())) for i in range(N)]
for i in range(len(AA)):
    C[i] = AA[i][0]
    A[i] = AA[i][1:]
ans = sum(C) + 1
for p in range(2 ** N):
    Y = [0] * M
    cnt = 0
    for i, c in enumerate(C):
        if p % 2 == 1:
            cnt += c
            for j, a in enumerate(A[i]):
                Y[j] += a
        p //= 2
    ans = min(ans, cnt) if min(Y) >= X else ans
print(ans if ans <= sum(C) else -1)

Buggy submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
C = [0] * N
AA = [list(map(int, input().split())) for i in range(N)]
for i in range(len(AA)):
    C[i] = AA[i][0]
    A[i] = AA[i][1:]
ans = sum(C) + 1
for p in range(2 ** N):
    Y = [0] * M
    cnt = 0
    for i, c in enumerate(C):
        if p % 2 == 1:
            cnt += c
            for j, a in enumerate(A[i]):
                Y[j] += a
        p //= 2
    ans = min(ans, cnt) if min(Y) >= X else ans
print(ans if ans <= sum(C) else -1)

Buggy submission (verdict: Runtime Error):
import itertools

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

p = []
p.extend([0]*N)
p.extend([1]*N)
mm = list(set(itertools.permutations(p , N)))

sum_list = [0]*N
c_list = [0]*len(mm)
ans = 10**18
for i in range(len(mm)):
    for j in range(len(mm[i])):
        if mm[i][j] == 1:
            c_list[i] += A[j][0]
            for k in range(M):
                sum_list[k] += A[j][k+1]
    if all([True if i >= X else False for i in sum_list]):
        ans = min(ans , c_list[i])
    sum_list = [0]*N
if ans == 10**18:
    print(-1)
else:
    print(ans)
Problem p02756 (python)

Fixed submission:
S = input()
Q = int(input())
flg = 0
senntou = ''
ushiro = ''
for i in range(Q):
    A = list(input().split())
    if int(A[0]) == 1 and flg == 0:
        flg = 1
        continue
    elif int(A[0]) == 1 and flg == 1:
        flg = 0
        continue
    if (int(A[1]) == 1 and flg == 0) or (int(A[1]) == 2 and flg == 1):
        senntou = A[2] + senntou
    else:
        ushiro = ushiro + A[2]
if flg == 0:
    print(senntou + S + ushiro)
if flg == 1:
    print(ushiro[::-1] + S[::-1] + senntou[::-1])

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
flg = 0
senntou = ''
ushiro = ''
for i in range(Q):
    A = list(input().split())
    if int(A[0]) == 1 and flg == 0:
        flg = 1
        continue
    elif int(A[0]) == 1 and flg == 1:
        flg = 0
        continue
    if (int(A[1]) == 1 and if flg == 0) or (int(A[1]) == 2 and if flg == 1):
        senntou = A[2] + senntou
    else:
        ushiro = ushiro + A[2]
if flg == 0:
    print(senntou + S + ushiro)
if flg == 1:
    print(ushiro[::-1] + S + senntou[::-1])

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
flg = 0
for i in range(Q):
    A = list(input().split())
    if int(A[0]) == 1 and flg == 0:
        flg = 1
        continue
    elif int(A[0]) == 1 and flg == 1:
        flg = 0
        continue
    if int(A[1]) == 1:
        if flg == 0:
            S.insert(0,A[2])
        else:
            S.append(A[2])
    else:
        if flg == 0:
            S.append(A[2])
        else:
            S.insert(0,A[2])
if flg == 0:
    print(S)
if flg == 1:
    print(S[::-1])
Problem p02772 (python)

Fixed submission:
N = int(input())
A = list(map(int , input().split()))
ans = []
bns = []
for i in A:
    if i % 2 == 0:
        ans.append(i)
for i in ans:
    if i % 3 == 0 or i % 5 == 0:
        bns.append(i)
if len(ans) == len(bns):
    print('APPROVED')
else:
    print('DENIED')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int , input().split()))
B = []
acount = 0
bcount = 0
for i in A:
    if i % 2 == 1:
         pass
    else:
        acount += 1
        B.append(i)
for i in B:
    if i % 3 == 0 or i % 5 == 0:
         bcount += 1
if acount != bcount:
    print('DENIED')
elif account == 0:
    print('DENIED')
else:
    print('APPROVED')
Problem p02780 (python)

Fixed submission:
A = list(map(int , input().split()))
B = list(map(int , input().split()))
kitaiti =[(i+1)/2 for i in B]
ans = []
dd = [0]
for i in range(A[0]):
    dd.append(dd[i] + kitaiti[i])
for i in range(A[1] , A[0]+1):
    ans.append(dd[i] - dd[i - A[1]])
print(max(ans))

Buggy submission (verdict: Runtime Error):
A = list(map(int , input().split()))
B = list(map(int , input().split()))
kitaiti =[(i+1)/2 for i in B]
ans = []
dd = [0]
for i in range(A[0]):
    dd.append(dd[i] + kitaiti[i])
for i in range(A[1] , A[0]):
    ans.append(dd[i] - dd[i - A[1]])
print(max(ans))

Buggy submission (verdict: Runtime Error):
A = list(map(int , input().split()))
B = list(map(int , input().split()))
ki = [1+(0.5*(i-1)) for i in B]
print(max([sum(ki[i:i+A[1]]) for i in range(0,len(ki)-A[1])]))
Problem p02802 (python)

Fixed submission:
A = list(map(int , input().split()))
x = []
for i in range(A[1]):
    X=list(input().split())
    x.append(X)
di = {}
for i in x:
    di[int(i[0])] = []
for i in x:
    di[int(i[0])].append(i[1])
sei = 0
go = 0
for k ,v in di.items():
    if 'AC' in v:
        sei += 1
    else:
        continue
    go += v.index('AC')
print('{} {}'.format(sei,go))

Buggy submission (verdict: Runtime Error):
A = list(map(int , input().split()))
x = []
for i in range(A[1]):
    X=list(input().split())
    x.append(X)
di = {}
for i in x:
    di[int(i[0])] = []
for i in x:
    di[int(i[0])].append(i[1])
sei = 0
go = 0
for k ,v in di.items():
    if 'AC' in v:
        sei += 1
    go += v.index('AC')
print('{} {}'.format(sei,go))
Problem p02830 (python)

Fixed submission:
N = int(input())
ST = input().split()
ans = ''
for i in range(N):
    ans += ST[0][i]
    ans += ST[1][i]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
T = input()
ans = ''
for i in range(N):
    ans += S[i]
    ans += T[i]
print(ans)
Problem p02887 (python)

Fixed submission:
import itertools
N = int(input())
S = list(input())
gr = itertools.groupby(S)
ans = len([1 for key, group in gr])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
gr = itertools.groupby(S)
ans = len([1 for key, group in gr])
print(ans)
Problem p02909 (python)

Fixed submission:
s_l = ['Sunny', 'Cloudy', 'Rainy' ]
a = input()
for i in range(len(s_l)):
    if a == s_l[i]:
        try:
            print(s_l[i+1])
        except:
            print(s_l[0])
        break

Buggy submission (verdict: Runtime Error):
a = input()
for i in range(len(s_l)):
	if a == s_l[i]:
        try:
            print(s_l[i+1])
        except:
            print(s_l[-1])
        break

Buggy submission (verdict: Runtime Error):
for i in range(len(s_l)):
    if a == s_l[i]:
        try:
            print(s_l[i+1])
        except:
            print(s_l[-1])
        break
Problem p02981 (python)

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

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input.split())
print(min(B,N*A))
Problem p03262 (python)

Fixed submission:
from fractions import gcd
N , X = (map(int , input().split()))
x = list(map(int , input().split()))
ans = 0
for i in x:
    ans = gcd(ans , abs(X-i))
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N , X = (map(int , input().split()))
x = list(map(int , input().split()))
x.sort()
ans_list = [x[i+1] - x[i] for i in range(0,len(x)-1)]
if X == 1 or len(ans_list) == 1:
    ans = ans_list[0]
    print(ans)
elif len(ans_list) >= 2:
    gcd_list = [gcd(ans_list[i], ans_list[i+1]) for i in range(0,len(ans_list)-1)]
    ans = min(gcd_list)
    print(ans)
else:
    ans = gcd(ans_list[0] , ans_list[1])
    print(ans)

Buggy submission (verdict: Runtime Error):
N , X = (map(int , input().split()))
x = list(map(int , input().split()))
x.sort()
ans_list = [x[i+1] - x[i] for i in range(0,len(x)-1)]
if X == 1:
    print(x[0]-X)
else:
    from fractions import gcd
    print(gcd(ans_list[0], ans_list[1]))
Problem p03282 (python)

Fixed submission:
S = int(input())
K = int(input())

for i in range(len(str(S))):
    if int(str(S)[i]) == 1:
        if (K-1) == i:
            print(int(str(S)[i]))
            break
        continue
    else:
        print(int(str(S)[i]))
        break

Buggy submission (verdict: Runtime Error):
ans = 0
if int(str(S)[0]) == 1 and K == 1:
    ans = 1
elif int(str(S)[0]) != 1:
    ans = int(str(S)[0])
else:
    ans = int(str(S)[1])
print(ans)
Problem p02921 (python)

Fixed submission:
from sys import stdin

a=  stdin.readline().rstrip()
b=  stdin.readline().rstrip()

count = 0
for i,j in zip(a,b):
    if i ==j:
        count += 1



print(count)

Buggy submission (verdict: Runtime Error):
from sys import stdin

a,b=  stdin.readline().rstrip().split()

count = 0
for i,j in zip(a,b):
    if i ==j:
        count += 1



print(count)
Problem p02945 (python)

Fixed submission:
from sys import stdin
 
a,b = [int(x) for x in stdin.readline().rstrip().split()]
 
arr =[]
 
arr.append(a+b)
arr.append(a-b)
arr.append(a*b)
 
print(max(arr))

Buggy submission (verdict: Runtime Error):
from sys import stdin

a,b = [int(x) for x in stdin.readline().rstrip().split()]

arr =[]

arr.append(a+b)
arr.append(a-b)
arr.append(a*b)

print(arr.max())
Problem p02993 (python)

Fixed submission:
from sys import stdin

n = stdin.readline().rstrip()
ex_str = n[0]
for i,a_str in enumerate(str(n)):

    
    if(i>0 and ex_str==a_str):
        print("Bad")
        break
    elif(ex_str!=a_str and i == len(n)-1):
        print("Good")
    ex_str = a_str

Buggy submission (verdict: Runtime Error):
from sys import stdin




def gcd(n,m):
    if n<m:
        return gcd(m,n)
    if n%m==0:
        return m
    else:
        return gcd(m,n%m)



a,b,c,d = [int(x) for x in stdin.readline().rstrip().split()]

c_num = b//c-(a-1)//c
d_num = b//d-(a-1)//d

LCM = d*c//gcd(c,d)

LCM_num = int(b//(LCM)-(a-1)//(LCM))

ans = b-a+1
ans -= c_num
ans -= d_num
ans += LCM_num
print(ans)
Problem p03086 (python)

Fixed submission:
from sys import stdin

str = stdin.readline().rstrip()


cnt = 0
rslt = 0




for a in str:
    flg = 0
    for b in "ATGC":
        if a == b:
            cnt = cnt + 1
            flg = 1
            break
            
    
    if rslt <= cnt:
        rslt = cnt
        
    if flg == 0:
        cnt = 0


print(rslt)

Buggy submission (verdict: Runtime Error):

from sys import stdin

str = stdin.readline().rstrip()


cnt = 0
rslt = 0




for a in str:
    flg = 0
    for b in "ATGC":
        if a == b:
            cnt = cnt + 1
            flg = 1
            break
            
    print(a + " :" + str(cnt))
    
    if rslt <= cnt:
        rslt = cnt
        
    if flg == 0:
        cnt = 0


print(rslt)
Problem p02761 (python)

Fixed submission:
#!/usr/bin/env python3

import sys
import math
import itertools

def main():
    n, m = map(int, sys.stdin.readline().split())
    if m == 0:
        ss = []
        cs = []
    else:
        ss, cs = map(list, zip(*(map(int, sys.stdin.readline().split()) for _ in range(m))))

    ans = [None for _ in range(n)]

    for i in range(m):
        if ans[ss[i] - 1] is None:
            ans[ss[i] - 1] = cs[i]
        elif ans[ss[i] - 1] != cs[i]:
            return "-1"

    if n == 1:
        if ans[0] is None:
            return "0"
        else:
            return str(ans[0])

    if ans[0] == 0:
        return "-1"

    for k in range(n):
        if ans[k] is None:
            if k == 0:
                ans[k] = 1
            else:
                ans[k] = 0

    return ''.join(map(str, ans))

if __name__ == '__main__':
    print(main())

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

import sys
import math
import itertools

def main():
    n, m = map(int, sys.stdin.readline().split())
    ss, cs = map(list, zip(*(map(int, sys.stdin.readline().split()) for _ in range(m))))

    ans = [None for _ in range(n)]

    for i in range(m):
        if ans[ss[i] - 1] is None:
            ans[ss[i] - 1] = cs[i]
        elif ans[ss[i] - 1] != cs[i]:
            return "-1"

    if n == 1:
        if ans[0] == None:
            return "0"
        else:
            return str(ans[0])

    if ans[0] == 0:
        return "-1"

    for k in range(n):
        if ans[k] is None:
            if k == 0:
                ans[k] = 1
            else:
                ans[k] = 0

    return ''.join(map(str, ans))

if __name__ == '__main__':
    print(main())

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

import sys
import math
import itertools

def main():
    n, m = map(int, sys.stdin.readline().split())
    ss, cs = map(list, zip(*(map(int, sys.stdin.readline().split()) for _ in range(m))))

    ans = [None for _ in range(n)]

    for i in range(m):
        if ans[ss[i] - 1] is not None and ans[ss[i] - 1] != cs[i]:
            print(-1)
            return
        ans[ss[i] - 1] = cs[i]

    for k in range(n):
        if ans[k] == 0 and n > 1:
            print(-1)
            return
        elif ans[k] is not None:
            break

    for k in range(n):
        if ans[k] is None:
            if k == 0 and n > 1:
                ans[k] = 1
            else:
                ans[k] = 0

    print(''.join(map(str, ans)))


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

Fixed submission:
#!/usr/bin/env python3

import sys
import math
import itertools

def main():
    ns = list(map(int, sys.stdin.readline().strip()))
    ns.reverse()
    ns.append(0)

    ans = 0
    lastpay = 0

    for i in range(len(ns)):
        if lastpay == 0:
            if ns[i] <= 4 or (ns[i] == 5 and ns[i + 1] <= 4):
                ans += ns[i]
                lastpay = 0
            else:
                ans += 1 + (10 - ns[i])
                lastpay = 1
        else:
            if lastpay + ns[i] <= 4 or (lastpay + ns[i] == 5 and ns[i + 1] <= 4):
                ans += ns[i]
                lastpay = 0
            else:
                ans += 1 - 1 + (9 - ns[i])
                lastpay = 1
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

import sys
import math
import itertools

def main():
    ns = list(map(int, sys.stdin.readline().strip()))
    ns.append(0)
    ns.reverse()

    ans = 0
    lastpay = 0

    for i in range(len(ns)):
        if lastpay == 0:
            if ns[i] <= 4 or (ns[i] == 5 and ns[i + 1] <= 4):
                ans += ns[i]
                lastpay = 0
            else:
                ans += 1 + (10 - ns[i])
                lastpay = 1
        else:
            if lastpay + ns[i] <= 4 or (lastpay + ns[i] == 5 and ns[i + 1] <= 4):
                ans += ns[i]
                lastpay = 0
            else:
                ans += 1 - 1 + (9 - ns[i])
                lastpay = 1
    #print(''.join(map(str, reversed(pay))))
    #print(''.join(map(str, reversed(charge))))
    #assert (sum(pay) + sum(charge)) == ans
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

import sys
import math
import itertools

def main():
    ns = list(map(int, sys.stdin.readline().strip()))
    ns.append(0)
    ns.reverse()

    pay = [0] * (len(ns) + 1)
    charge = [0] * (len(ns) + 1)
    for i in range(len(ns)):
        if pay[i] == 0:
            if ns[i] <= 4 or (ns[i] == 5 and ns[i + 1] <= 4):
                pay[i] = ns[i]
                charge[i] = 0
            else:
                pay[i] = 0
                pay[i + 1] = 1
                charge[i] = 10 - ns[i]
        else:
            if pay[i] + ns[i] <= 4 or (pay[i] + ns[i] == 5 and ns[i + 1] <= 4):
                pay[i] += ns[i]
                charge[i] = 0
            else:
                pay[i] = 0
                pay[i + 1] = 1
                charge[i] = 9 - ns[i]
    #print(''.join(map(str, reversed(pay))))
    #print(''.join(map(str, reversed(charge))))
    print(sum(pay) + sum(charge))

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

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
dp = [True] * (10 ** 6 + 1)
s = list(set(a))
for x in s:
    e = x * 2
    while e <= 10 ** 6:
        dp[e] = False
        e += x
ret = 0
for x in a:
    if c[x] == 1 and dp[x] == True:
        ret += 1
print(ret)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
dp = [True] * (10 ** 6 + 1)
s = list(set(a))
for x in s:
    e = x * 2
    while e <= 10 ** 6:
        dp[e] = False
        e += x
ret = 0
for x in a:
    if c[x] == 1 and dp[x] == True:
        ret += 1
print(ans)
Problem p02718 (python)

Fixed submission:
def getInput():
    return [int(i) for i in input().rstrip().split(' ')]
N, M = getInput()
A = getInput()
_4M = sum(A) / (4*M)
A.sort(reverse=True)
cnt = 0
for i in A:
    if i >= _4M:
        cnt += 1
print('Yes') if cnt >= M else print('No')

Buggy submission (verdict: Runtime Error):
def getInput():
    return [int(i) for i in input().rstrip().split(' ')]
N, M = getInput()
A = getInput()
_4M = math.ceil(sum(A) / (4*M))
A.sort(reverse=True)
cnt = 0
for i in A:
    if i >= _4M:
        cnt += 1
print('Yes') if cnt >= M else print('No')