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

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 21 23:25:47 2019

@author: Yamazaki Kenichi
"""
import bisect

N, K = map(int,input().split())
A = list(map(int,input().split()))

T = [[] for _ in range(2*10**5+1)]

for i in range(N):
    T[A[i]].append(i)

s = A[0]
pointa = 0
counta, res = 0, [-1]
while True:
    tmp = bisect.bisect_right(T[s], pointa) % len(T[s])
    p_pointa = pointa
    pointa = T[s][tmp] + 1
    if pointa == p_pointa + 1 or pointa < p_pointa:
        counta += 1
        res.append(p_pointa)
    if pointa == N:
        counta += 1
        res.append(p_pointa)
        break
    s = A[pointa]

ans = []
if K % counta != 0:
    pointa = res[K % counta]
#    ans.append(A[pointa])
    while pointa < N:
        if pointa < T[A[pointa]][-1]:
            tmp = bisect.bisect_right(T[A[pointa]],pointa)
            pointa = T[A[pointa]][tmp] + 1
        else:
            ans.append(A[pointa])
            pointa += 1
#        print(ans)
print(' '.join(map(str,ans)))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 21 23:25:47 2019

@author: Yamazaki Kenichi
"""
import bisect

N, K = map(int,input().split())
A = list(map(int,input().split()))

T = [[] for _ in range(2*10**5+1)]

for i in range(N):
    T[A[i]].append(i)

s = A[0]
pointa = 0
counta, res = 0, [-1]
while True:
    tmp = bisect.bisect_right(T[s], pointa) % len(T[s])
    p_pointa = pointa
    pointa = T[s][tmp] + 1
    if pointa == p_pointa + 1 or pointa < p_pointa:
        counta += 1
        res.append(p_pointa)
    elif pointa == N:
        counta += 1
        res.append(p_pointa)
        break
    s = A[pointa]

ans = []
if K % counta != 0:
    pointa = res[K % counta]
#    ans.append(A[pointa])
    while pointa < N:
        if pointa < T[A[pointa]][-1]:
            tmp = bisect.bisect_right(T[A[pointa]],pointa)
            pointa = T[A[pointa]][tmp] + 1
        else:
            ans.append(A[pointa])
            pointa += 1
#        print(ans)
print(' '.join(map(str,ans)))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 21 23:25:47 2019

@author: Yamazaki Kenichi
"""
import bisect

N, K = map(int,input().split())
A = list(map(int,input().split()))

T = [[] for _ in range(2*10**5+1)]
appearing = [0 for _ in range(2*10**5+1) ]

for i in range(N):
    c = A[i]
#    T[c][0] += 1
    T[c].append(i)

q = [A[0]]
pointa = 0
counta, res = 0, []
while q:
    s = q.pop()
    tmp = bisect.bisect_left(T[s], pointa) + 1
    tmp %= len(T[s])
    p_pointa = pointa
    pointa = T[s][tmp] + 1
#    print(s,tmp,pointa)
#    ans.append([s,tmp,pointa])
    if pointa == p_pointa + 1 or pointa < p_pointa:
        counta += 1
        res.append(p_pointa)
    if pointa == N:
        break
    next_s = A[pointa]
    q.append(next_s)

counta += 1
ans = []
if K % counta != 0:
    tmp = res[K % counta] + 1
    ans.append(A[tmp+1])
    for i in range(tmp + 1,N):
        if ans[0] == A[i]:
            ans = []
        else:
            ans.append(A[i])
        print(ans)
print(' '.join(map(str,ans)))
Problem p03137 (python)

Fixed submission:
    # -*- coding: utf-8 -*-
"""
Created on Sun Feb  3 21:07:35 2019

@author: Yamazaki Kenichi
"""

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

if N >= M:
    ans = 0

else:
    X.sort()
    A = []
    for i in range(M-1):
        A.append(X[i+1]-X[i])
    A.sort()
    ans = X[M-1]-X[0]

    for i in range(M-2,M-2-(N-1),-1):
        ans = ans - A[i] 
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Feb  3 21:07:35 2019

@author: Yamazaki Kenichi
"""

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

X.sort()
A = []

for i in range(M-1):
    A.append(X[i+1]-X[i])
A.sort()

ans = X[M-1]-X[0]
if M !=1:
    for i in range(M-2,M-2-(N-1),-1):
        ans = ans - A[i] 
print(ans)
Problem p02689 (python)

Fixed submission:
N, M = map(int, input().split())
heights = list(map(int,input().split()))
lose = []

for i in range(M):
  x, y = map(int, input().split())
  if heights[x - 1] > heights[y - 1]:
    lose.append(y)
  elif heights[x - 1] < heights[y - 1]:
    lose.append(x)
  elif heights[x - 1] == heights[y - 1]:
    lose.append(y)
    lose.append(x)

print(N - len(list(set(lose))))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
heights = list(map(int,input().split()))
win = []

for i in range(1, N + 1):
  win.append(i)

for i in range(M):
  x, y = map(int, input().split())
  if heights[x - 1] > heights[y - 1]:
    del win[x - 1]
  elif heights[x - 1] < heights[y - 1]:
    del win[y - 1]

print(len(win))
Problem p02707 (python)

Fixed submission:
N = int(input())
works = list(map(int, input().split()))
ans = [0] * (N + 1)
 
for i in range(0,N - 1):
  
  ans[works[i]] += 1

ans.pop(0)
for i in ans:
  print(i)

Buggy submission (verdict: Runtime Error):
N = int(input())
works = sorted(list(map(int,input().split())))
 
for i in range(1,N + 1):
  print(works.count(i))
  works.remove(i)
Problem p03327 (python)

Fixed submission:
N = int(input())

if N <= 999:
  print("ABC")
else:
  print("ABD")

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

if N <= 999:
  print("ABC")
else:
  pritn("ABD")
Problem p02835 (python)

Fixed submission:
num = list(map(int,input().split()))
sum = 0
for i in num:
  sum += i
if sum >= 22:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
a, b, c= map(int,input())
sum = a + b + c
if sum >= 22:
  preint("best")
else:
  print("win")
Problem p02766 (python)

Fixed submission:
N, K = map(int, input().split())
num = 0
q = N
while q > 0:
	num = num + 1
	q = N // (K**num)
print(num)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
num = 0
while q > 0:
  num = num + 1
  q = N // (K**num)
print(num)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
num = 0
while q > 0:
  num = num + 1
  q = N // (K**num)
A = num + 1
print(A)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
num = 0
while q > 0:
  num = num + 1
  q = N // (K**num)  
print(num+1)

Buggy submission (verdict: Runtime Error):
N, R = map(int, input().split())
q = N/K
num = 0
while q >0:
  q = q / (K**num)
  num = num + 1
print(num)

Buggy submission (verdict: Runtime Error):
N, R = map(int, input().split())
q = N/K
num = 0
while q >0:
  q = q / K**num
  num = num + 1
print(num)
Problem p02771 (python)

Fixed submission:
A,B,C = map(int, input().split())
if A==B==C:
  print('No')
elif A==B or B==C or C==A:
  print('Yes')
else:
  print('No')

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

if A = B and A != C:
    print("Yes")
elif A = C and A != B:
    print("Yes")
elif B = C and A != B:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A,B,C = map(int, input().split())
if A=B!=C:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A,B,C = map(int, input().split())
if A=B!=C or A!=B=C or B!=C=A:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A,B,C = map(int, input().split())
if (A=B or B=C or C=A)and not(A=B=C):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A,B,C = map(int, input().split())
if A=B or B=C or C=A:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A,B,C = map(int, input().split())
if A=B or B=C or C=A:
  print('Yes')
print('No')

Buggy submission (verdict: Runtime Error):
A,B,C = map(int, input().split())
if A=B OR B=C OR C=A:
  print('Yes')
print('No')
Problem p02723 (python)

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

Buggy submission (verdict: Runtime Error):
s=input()
if(len(s)>6s=input()

if(s[2]==s[3] and s[4]==s[5]):
  print("Yes")
else:
  print("No")
Problem p02792 (python)

Fixed submission:
n = int(input())
d = {}

for i in range(1, n+1):
  start, end = str(i)[0], str(i)[-1]
  d[(start, end)] = d.get((start, end), 0) + 1
count = 0
for key, n_key in d.items():
  count += n_key * d.get(tuple(reversed(key)), 0)
print(count)

Buggy submission (verdict: Runtime Error):
n = input()
count = 0

for i in range(n):
  for j in range(n):
    if str(i)[0] == str(j)[-1] and str(i)[-1] == str(j)[0]:
      count += 1
print(count)
Problem p02723 (python)

Fixed submission:
s = input()
ans = "No"

if (s[2] == s[3])and (s[4] == s[5]):
    ans = "Yes"

print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = "No"

if (s[2] == s[3])and (s[4] == s[5])and (s[2] != s[4])and (s[0]!=s[1])and (s[0]!=s[2])ans(s[0]!=s[4]):
    ans = "Yes"

print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = "No"

if s[2] == s[3]and s[4] == s[5]and s[2] != ans[4]:
    ans = "Yes"

print(ans)
Problem p02831 (python)

Fixed submission:
def yu(x, y):
    min_v = min(x, y)
    max_v = max(x, y)

    mod = max_v % min_v
    if mod != 0:
        min_v = yu(min_v, mod)
    return min_v


a, b = map(int, input().split())

print(a*b//yu(a, b))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())

print((a*b)//math.gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())

print(a*b//math.gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())

print(a*b//math.gcd(a, b))
Problem p03775 (python)

Fixed submission:
import math
n = int(input())
ans = 10**10
for a in range(math.ceil(math.sqrt(n)), 0, -1):
    if n % a == 0:
        b = n//a
        # if ans > max(len(str(a)), len(str(b))):
        ans = max(len(str(a)), len(str(b)))
        break

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
# li = list(range(1, n+1))
ans = 10**10
for a in range(10**(len(str(n))//2-1), 10**(len(str(n))//2+1)):
    if n % a == 0:
        b = n//a
        if ans > max(len(str(a)), len(str(b))):
            ans = max(len(str(a)), len(str(b)))

print(ans)
Problem p02682 (python)

Fixed submission:
a,b,c,k= map(int,input().split())
if a>=k:
  print(k)
elif a+b>=k:
  print(a)
elif a+b+c>=k:
  print(a-(k-a-b))

Buggy submission (verdict: Runtime Error):
a,b,c,k= map(int,input.split(' '))
if a>=k:
  print(k)
elif a+b>=k:
  print(a)
elif a+b+c>=k:
  print(a-(k-a-b))
Problem p02829 (python)

Fixed submission:
A=int(input())
B=int(input())
nums=[1,2,3]
nums.remove(A)
nums.remove(B)
print(nums[0])

Buggy submission (verdict: Runtime Error):
AB=[int(i) for i in input().split()]
nums=[1,2,3]
nums.remove(AB[0])
nums.remove(AB[1])
print(nums[0])
Problem p02831 (python)

Fixed submission:
import fractions
nums=[int(i) for i in input().split()]
print(nums[0]*nums[1]//fractions.gcd(nums[0],nums[1]))

Buggy submission (verdict: Runtime Error):
import math
nums=[int(i) for i in input().split()]
print(nums[0]*nums[1]//math.gcd(nums[0],nums[1]))

Buggy submission (verdict: Runtime Error):
import math
nums=[int(i) for i in input().split()]
print(int(nums[0]*nums[1]/math.gcd(nums[0],nums[1])))
Problem p02693 (python)

Fixed submission:
import math

k = int(input())
a, b = (int(x) for x in input().split())
outa = math.floor(a / k)
outb = math.floor(b / k)
if outb == 0:
    print("NG")
elif outa == outb and a != b and outa != a / k:
    print("NG") 
else:
    print("OK")

Buggy submission (verdict: Runtime Error):
import math

A, B, N= (int(x) for x in input().split())
max = 0
x = B * math.floor(N/B) - 1
if x == -1:
    x = N
a = math.floor(A * x / B) - A * math.floor(x / B)
b = math.floor(A * N / B) - A * math.floor(N / B)
if a > b:
    print(a)
else:
    print(b)
Problem p02831 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

A, B = map(int, input().split())
ans = A * B // gcd(A, B)

print(int(ans))

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

print(int(ans))

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

print(int(ans))
Problem p02699 (python)

Fixed submission:
s,w=map(int,input().split())
if w>=s:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
s=input()
l=len(s)
ans=0
for i in range(0,l-3):
    for j in range(i+3,l):
        test=int(s[i:j+1])
        if test%2019==0:
            ans+=1
print(ans)
Problem p02682 (python)

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

if k <= a:
    print(k*1)

elif k <= a+b:
    print(1*a)
    
else:
    num=k-(a+b)
    print(1*a-num*1)

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

seq = [1]*a + [0]*b + [-1]*c

print(sum(seq[0:k]))
Problem p02707 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = [0]*(n+1)
for i in range(n-1):
    b = a[i]
    ans[b] +=1
for i in range(1,n+1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
ans = [0]*(n+1)
for i in range(n-1):
    b = a[i]
    ans[b] +=1
    
for i in range(1,n+1):
    print(ans_l[i])
Problem p02725 (python)

Fixed submission:
#12
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []
for i in range(n-1):
    b.append(a[i+1]-a[i])

b.append(int(k-a[n-1]+a[0]))

c = max(b)
b.remove(c)

print(sum(b))

Buggy submission (verdict: Runtime Error):
k,m = map(int,input().split())
a = input().split()
a =[int(s) for s in a]

a.insert(0,k)

dis = []

for i in range(m):
  part = int(a[i]) - int(a[i+1])
  dis.append(part)
  del part

dis.append(int(a[m-1]))
distance = dis*2

c =[]
for j in range(m):
  c = int(sum(distance[j:j+5]))

print(min(c))

Buggy submission (verdict: Runtime Error):
k,m = map(int,input().split())
a = input().split()
a =[int(s) for s in a]

a.insert(0,k)

dis = []

for i in range(m):
  part = int(a[i]) - int(a[i+1])
  dis.append(part)
  del part

dis.append(int(a[m-1]))
distance = dis*2

c =[]
for j in range(m):
  c = sum(distance[j:j+5])

print(min(c))
Problem p02779 (python)

Fixed submission:
#154 Distinct or not
n = int(input())
a = list(map(int,input().split()))
b = len(set(a))

if len(a) == b:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
#154 Distinct or not
n = int(input())
a = list(map(int,input().split())
b = set(a)

if len(a) == b:
         print('YES')
else:
    print('NO')
Problem p02693 (python)

Fixed submission:
n = int(input())
a, b = map(int, input().split())
sucess = False
for i in range(a, b + 1):
    if i % n == 0:
        sucess = True
print(("NG", "OK")[sucess])

Buggy submission (verdict: Runtime Error):
k, a, b = map(int, input().split())
f = 1
while a <= b:
	if (a % k == 0):
		f = 0
		print ("OK")
		break
	a += 1
if f:
	print ("NG")
Problem p02729 (python)

Fixed submission:
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

N,M = [int(i) for i in input().split()]

if N >= 2 and M >= 2:
    ans = cmb(N,2) + cmb(M,2)
elif N <= 1 and M >=2:
    ans = cmb(M,2)
elif M <= 1 and N >=2:
    ans = cmb(N,2)
else:
    ans = 0


print(int(ans))

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

N,M = [int(i) for i in input().split()]

if N!=1 and M!=1:
    ans = comb(N,2) + comb(M,2)
elif N==1:
    ans = comb(M,2)
elif M==1:
    ans = comb(N,2)
else:
    ans = 0

print(int(ans))
Problem p02984 (python)

Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]

b=[0]*(N+1)
b[0] = sum(a)-2*sum(a[1::2])
for i in range(1,N+1):
    b[i] = 2*a[i-1] - b[i-1]
print(*b[:N])

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
t = sum(a)-2*sum(a[1::2])
b = [t]
for i in range(1,N+1):
    t = 2*a[i-1] - t
    b += [t
print(*b[:N])
Problem p03013 (python)

Fixed submission:
N,M=[int(i) for i in input().split()]
a=[int(input()) for _ in range(M)]

b=[0]*(N+2)
b[0]=1
b[1]=1

for j in range(M):
    b[a[j]]=-1

for i in range(2,N+2):
    if b[i] !=-1:
        if b[i-1]!=-1:
            b[i]+=b[i-1]
        if b[i-2]!=-1:
            b[i]+=b[i-2]
print(b[-2]%(1000000007))

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

b=[0]*(N+2)
b[0]=1
b[1]=1

for j in range(M):
    b[a[j]]=-1

for i in range(2,N+2):
    if b[i] !=-1:
        if b[i-1]!=-1:
            b[i]+=b[i-1]
        if b[i-2]!=-1:
            b[i]+=b[i-2]
print(b[-2]%(1000000007))
Problem p03221 (python)

Fixed submission:
N,M=[int(i) for i in input().split()]
PY=[[] for _ in range(N)]
py=[]

for i in range(M):
    p,y=[int(i) for i in input().split()]
    PY[p-1].append((y,i))

ans=[None]*M
for j,py in enumerate(PY): #jが県番号
    py.sort()
    for k,(y,i) in enumerate(py):
        ans[i]=str(j+1).zfill(6) + str(k+1).zfill(6)

print(*ans,sep="\n")

Buggy submission (verdict: Runtime Error):
N,M=[int(i) for i in input().split()]
PY=[[] for _ in range(N)]
py=[]

for i in range(M):
    p,y=[int(i) for i in input().split()]
    py.append((p,y))
    PY[p-1].append(y)

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

for i in range(M):
    p,y=py.pop(0)
    #print(PY[p].index(y))
    p_zero=6-len(str(p))
    y_zero=6-len(str(PY[p].index(y)))
    print("0"*p_zero + str(p) + "0"*y_zero + str(PY[p].index(y)+1))
Problem p03631 (python)

Fixed submission:
a,b,c=input()
print("Yes" if a==c else "No")

Buggy submission (verdict: Runtime Error):
a,b,c=input()
print("yes" if a==c, else "No")
Problem p02753 (python)

Fixed submission:
# coding: utf-8
A=input()

if A[0]==A[1] and A[1]==A[2]:
    print("No")
if A[0]!=A[1] or A[1]!=A[2]:
     print("Yes")

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

if A[0]==A[1] and A[1]==A[2]:
    print("No")
if A[0]!=A[1] or A[1]!=A[2]:
     print("Yes")
Problem p02754 (python)

Fixed submission:
N, A, B = [int(i) for i in input().split()]
S = A+B
c = (N//S)*A
 
c += min(N%S,A)
print(c)

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

S = N//(A+B)*A

S = S+(N%S,A)
print(S)
Problem p02699 (python)

Fixed submission:
(S,W)=input().split()
S=int(S)
W=int(W)
if S<=W:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
(S,W)=input()
if S<=W:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
s=int(input())
w=int(input())
if w >= s:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
S=int(input())
W=int(input())
if S<=W:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
if S<=W:
  print("unsafe")
else:
  print("safe")
Problem p02753 (python)

Fixed submission:
S = input()
if S == "AAA" or S == "BBB":
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
S = input()
if S = "AAA" or S = "BBB":
    print("No")
else:
    print("Yes")
Problem p02754 (python)

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

import math
n = math.ceil(N//(A+B))
mod = N % (A+B)
b = n*A
if mod <= A:
    b += mod
else:
    b += A

print(b)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int,input().split())
a = list()
a = ["b"]*A + ["r"]*B
import math
n = math.ceil(N//(A+B))
for i in range(n):
    a = a + a
del a[N:]
print(n)
print(a)
print(a.count("b"))

Buggy submission (verdict: Runtime Error):
N, A, B = map(int,input().split())
a = list()
a = ["blue"]*A + ["red"]*B
import math
n = math.ceil(N/(A+B))
for i in range(n):
    a = a + a
del a[N:]
print(a.count("blue"))

Buggy submission (verdict: Runtime Error):
N, A, B = map(int,input().split())
a = list()
a = ["blue"]*A + ["red"]*B
for i in range(N):
    a = a + a
del a[N:]
print(a.count("blue"))
Problem p02689 (python)

Fixed submission:
n,m = map(int, input().split())
h=list(map(int,input().split()))
li=[0]*n
 
for i in range(m):
        a,b=map(int, input().split())
        if h[a-1]>h[b-1]:
                li[b-1]+=1
        elif h[b-1]>h[a-1]:
                li[a-1]+=1
        else:
                li[a-1]+=1
                li[b-1]+=1

 
cnt=0
for i in range(n):
        if li[i]==0:
                cnt+=1

print(cnt)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
h=list(map(int,input().split()))
li=[0]*n
 
for i in range(m):
        a,b=map(int, input().split())
        if h[a-1]>h[b-1]:
                li[b-1]+=1
        elif h[b-1]>h[a-1]:
                li[a-1]+=1
        else:
          		li[a-1]+=1
            	li[b-1]+=1
 
cnt=0
for i in range(n):
        if li[i]==0:
                cnt+=1
Problem p02682 (python)

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

if K<A:
    ans=K
elif A<=K and K<=A+B:
    ans=A
else:
    ans=2*A+B-K

print(ans)

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

if K<=A:
    ans=K
elif k<=A+B:
    ans=A
else:
    ans=2*A-K

print(ans)
Problem p03013 (python)

Fixed submission:
N,M=map(int,input().split())
dp=[0]*(N+3)
dp[0]=1
a=[0]*(N+3)
for i in range(M):
    a[int(input())]=1
mod=10**9+7

for i in range(N+1):
    if a[i+1] != 1:
        dp[i+1]+=dp[i]
        dp[i+1]%=mod
    if a[i+2] != 1:
        dp[i+2]+=dp[i]
        dp[i+2]%=mod

print(dp[N])

Buggy submission (verdict: Runtime Error):
import math

N,M=map(int,input().split())
a=[-1]+[int(input()) for i in range(M)]+[N+1]
ans=1

for i in range(M+1):
    dist=a[i+1]-a[i]-2
    if dist<0 and a[i]!=-1 and a[i+1]!=N+1:
        ans=0
        break
    
    val=0
    cnt1=dist%2
    cnt2=dist//2
    while cnt2 >= 0:
        val+=math.factorial(cnt1+cnt2)/math.factorial(cnt1)/math.factorial(cnt2)
        cnt2-=1
        cnt1+=2
    ans*=val

    while ans>1000000007:
        ans-=1000000007

print(int(ans))

Buggy submission (verdict: Runtime Error):
import math

N,M=map(int,input().split())
a=[-1]+[int(input()) for i in range(M)]+[N+1]
ans=1

for i in range(M+1):
    dist=a[i+1]-a[i]-2
    if dist<0 and a[i]!=-1 and a[i+1]!=N+1:
        ans=0
        break
    
    val=0
    cnt1=dist%2
    cnt2=dist//2
    while cnt2 >= 0:
        val+=math.factorial(cnt1+cnt2)/math.factorial(cnt1)/math.factorial(cnt2)
        cnt2-=1
        cnt1+=2
    ans*=val
    print(dist,val)

print(ans%1000000007)
Problem p02711 (python)

Fixed submission:
def main(): # A162
    N = int(input())
    NUM = list(str(N))
    NUM = list(map(int,NUM))
    #A = list(map(int, input().split()))  # [1,2,3,4,5]
    for i in NUM:
        if int(i) == 7:
            print("Yes")
            exit(0)
    print("No")
    
main()

Buggy submission (verdict: Runtime Error):
def main(): # A162
    N = int(input())
    NUM = list(str(N))
    NUM = list(map(int,NUM))
    #A = list(map(int, input().split()))  # [1,2,3,4,5]
    for i in NUM:
        if int(i) == 7:
            print("Yes")
            exit(1)
    print("No")
    
main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    NUM = list(str(N))
    for i in NUM:
        if int(i) == 7:
            print("Yes")
            exit(1)
    print("No")


main()
Problem p02759 (python)

Fixed submission:
N = int(input())
print(int((N+1)/2))

Buggy submission (verdict: Runtime Error):
N = int(input(N))
print(int(N+1)/2)
Problem p02766 (python)

Fixed submission:
N, K = [int(_) for _ in input().split()]
for a in range(0, 10**9):
    if K**(a) <= N < K**(a+1):
        print(a+1)
        break

Buggy submission (verdict: Runtime Error):
N, K = [int(_) for _ in input().split()]
for a in range(10**9):
    if K**(a) <= N < K**(i*1):
        print(a+1)
        break
Problem p02835 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a + b + c >= 22:
  print('bust')
if a + b + c <= 21:
  print('win')

Buggy submission (verdict: Runtime Error):
a, b, c = int(input().split())
if a + b + c >= 22:
  print('bust')
if a + b + c <= 21:
  print('win')
Problem p02729 (python)

Fixed submission:
n,m=map(int,input().split())

ans=n*(n-1)/2
ans+=m*(m-1)/2

print(int(ans))

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

ans=n*(n-1)/2#nC2の順列を利用（n個の球から2個の玉を選択）
ans+=m*(m-1)/2

print(int(ans))