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

Fixed submission:
n,m=map(int,input().split())
## DAG graph , making using dict
in_degree=[0]*n ## number of incoming edges 
graph = {} ## graph [ u ] defines edge from u to v
for i in range(m):
    u, v=map(int,input().split()) 
    if u not in graph:
        graph[u]=[v]
    else :
        graph[u].append(v)
    in_degree[v-1]+=1
dist=[0]*n
curr_stack=[] ## starting from nodes with 0 incoming edges
for i in range(n):
    if in_degree[i]==0:
        curr_stack.append(i+1)
def dfs (curr_stack):
    while curr_stack:
        u=curr_stack.pop()
        if u not in graph:
            continue
        for item in graph[u]:
            dist[item-1]=max(dist[item-1],dist[u-1]+1)
            in_degree[item-1]-=1
            if in_degree[item-1]==0:
                curr_stack.append(item)
dfs(curr_stack)
print(max(dist))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
## DAG graph , making using dict
in_degree=[0]*n ## number of incoming edges 
graph = {} ## graph [ u ] defines edge from u to v
for i in range(m):
    u, v=map(int,input().split()) 
    if u not in graph:
        graph[u]=[v]
    else :
        graph[u].append(v)
    in_degree[v-1]+=1
dist=[0]*n
curr_stack=[] ## starting from nodes with 0 incoming edges
for i in range(n):
    if in_degree[i]==0:
        curr_stack.append(i+1)
def dfs (curr_stack):
    while curr_stack:
        u=curr_stack.pop()
        if u not in graph:
            continue
        for item in graph[u]:
            dist[item-1]=max(dist[item-1],dist[u-1]+1)
            in_degree[item-1]-=1
            if in_degree[item-1]==0:
                curr_stack.append(item)
dfs(curr_stack)
print(max(dist))
Problem p02727 (python)

Fixed submission:
# -*- coding: utf-8 -*-

def mergef(a,b):
    c = []
    h = j = 0
    while j<len(a) and h<len(b):
        if a[j]>b[h]:
            c.append(a[j])
            j+=1
        else:
            c.append(b[h])
            h+=1
    if j==len(a):
        for i in b[h:]:
            c.append(i)
    else:
        for i in a[j:]:
            c.append(i)
    return c

def merge_sortf(lists):
    if len(lists) <= 1:
        return lists
    middle = int(len(lists)/2)
    left = merge_sortf(lists[:middle])
    right = merge_sortf(lists[middle:])
    return mergef(left,right)


X,Y,A,B,C= map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

pm=merge_sortf(p)
qm=merge_sortf(q)
rm=merge_sortf(r)

k=0;i=X-1;j=Y-1
while i>=0 and j>=0 and k<C:
    if min((pm[i]-rm[k]),(qm[j]-rm[k])) < 0 :
        if pm[i]>=qm[j] :
            qm[j]=rm[k]
            if j>0:
                j=j-1
        elif pm[i]<qm[j]:
            pm[i]=rm[k]
            if i>0:
                i=i-1
    elif min((pm[i]-rm[k]),(qm[j]-rm[k])) > 0:
        break
    k=k+1

ans=sum(pm[:X])+sum(qm[:Y])
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def mergef(a,b):
    c = []
    h = j = 0
    while j<len(a) and h<len(b):
        if a[j]>b[h]:
            c.append(a[j])
            j+=1
        else:
            c.append(b[h])
            h+=1
    if j==len(a):
        for i in b[h:]:
            c.append(i)
    else:
        for i in a[j:]:
            c.append(i)
    return c

def merge_sortf(lists):
    if len(lists) <= 1:
        return lists
    middle = int(len(lists)/2)
    left = merge_sortf(lists[:middle])
    right = merge_sortf(lists[middle:])
    return mergef(left,right)


X,Y,A,B,C= map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

pm=merge_sortf(p)
qm=merge_sortf(q)
rm=merge_sortf(r)

k=0;i=X-1;j=Y-1
while i>=0 and j>=0 and k<C:
    if min((pm[i]-rm[k]),(qm[j]-rm[k])) < 0 :
        if pm[i]>=qm[j] :
            qm[j]=rm[k]
            j=j-1
        elif pm[i]<qm[j]:
            pm[i]=rm[k]
            i=i-1
        else:

    elif min((pm[i]-rm[k]),(qm[j]-rm[k])) > 0:
        break
    k=k+1

ans=sum(pm[:X])+sum(qm[:Y])
print(ans)
Problem p02730 (python)

Fixed submission:
# -*- coding: utf-8 -*-
def Palindrome(S):
    if len(S)==1:
        return "Yes"
    for i in range(int((len(S))/2)):
        if S[i]==S[len(S)-i-1]:
            YorN="Yes"
        else:
            YorN="No"
            break
    return YorN
S = input()
Sl = list(S)
left = right = "No"
if Palindrome(Sl) == "Yes":
    middle=int((len(Sl)-1)/2)
#    print(Sl[:middle],Sl[middle+1:])
    left  = Palindrome(Sl[:middle])
    right = Palindrome(Sl[middle+1:])
if left == "Yes" and right == "Yes":
    YorN = "Yes"
else:
    YorN = "No"
print(YorN)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def Palindrome(S):
    if len(S)==1:
        return "Yes"
    for i in range(int((len(S)-1)/2)):
        if S[i]==S[len(S)-i-1]:
            YorN="Yes"
        else:
            YorN="No"
            break
    return YorN
S = input()
Sl = list(S)
left = right = "No"
if Palindrome(Sl) == "Yes":
    middle=int((len(Sl)-1)/2)
    print(Sl[:middle],Sl[middle+1:])
    left  = Palindrome(Sl[:middle])
    right = Palindrome(Sl[middle+1:])
if left == "Yes" and right == "Yes":
    YorN = "Yes"
else:
    YorN = "No"
print(YorN)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def Palindrome(S):
    if int(len(S)/2)==int((len(S)+1)/2):
        return "No"
    for i in range(int(len(S)/2)):
        if S[i]==S[len(S)-i-1]:
            YorN="Yes"
        else:
            YorN="No"
            break
    return YorN
S = input()
Sl = list(S)
left = right = "No"
if Palindrome(Sl) == "Yes":
    middle=int(len(Sl)/2)
    left  = Palindrome(Sl[:middle])
    right = Palindrome(Sl[middle+1:])
if left == "Yes" and right == "Yes":
    YorN = "Yes"
else:
    YorN = "No"
print(YorN)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def Palindrome(S):
    for i in range(int(len(S)/2)):
        if S[i]==S[len(S)-i-1]:
            YorN="Yes"
        else:
            YorN="No"
            break
    return YorN
S = input()
Sl = list(S)
left = right = "No"
if Palindrome(Sl) == "Yes":
    middle=int(len(Sl)/2)
    left  = Palindrome(Sl[:middle])
    right = Palindrome(Sl[middle+1:])
if left == "Yes" and right == "Yes":
    YorN = "Yes"
else:
    YorN = "No"
print(YorN)
Problem p02741 (python)

Fixed submission:
n = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())-1
print(n[k])

Buggy submission (verdict: Runtime Error):
n = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(n[k+1])

Buggy submission (verdict: Runtime Error):
n = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(n[k+1]
Problem p02811 (python)

Fixed submission:
k, x = map(int, input().split())
cost=500*k
if x <=cost:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
r, g, b = map(int, input().split())
ans=100*r+10*g+b
if ans*4==0:
    print("YES")
else:
    print("NO")
Problem p03101 (python)

Fixed submission:
H,W = map(int,input().split())

h,w = map(int,input().split())

print((H-h)*(W-w))

Buggy submission (verdict: Runtime Error):
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[list(map(int,input().split())) for k in range(n)]
 
count=0
 
for i in range(n):
  absum=0
  for j in range(m):
    absum +=a[i][j]*b[j]
   
  ans=absum+c
  if ans>0:
    count+=1
      
print(count)

Buggy submission (verdict: Runtime Error):
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[list(map(int,input().split())) for k in range(n)]
 
count=0
 
for i in range(n):
  absum=0
  for j in range(m):
    absum+=a[i][j]*b[j]
    
    ans=absum+c
    if ans>0:
      count+=1
      
print(count)
Problem p03102 (python)

Fixed submission:
n,m,c=map(int,input().split())
B=list(map(int,input().split()))
A=[list(map(int,input().split()))for i in range(n)] #二次元配列でとっています
cnt=0
for i in range(n):
    total=0
    for j in range(m):
        total+=B[j]*A[i][j]
    total+=c
    if 0<total:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[list(map(int,input().split())) for k in range(n)]
 
count=0
 
for i in range(n)
       absum=0
       for j in range(m)
       absum +=a[i][j]*b[j]
       
       ans=absum+c
       if ans>0:
       count +=1
print(count)

Buggy submission (verdict: Runtime Error):
n,m,c=map(int,input().split())
b=list(map(int,input().split())
a=[list(map(int,input().split())) for k in range(n)]

count=0

for i in range(n)
       absum=0
       for j in range(m)
       absum +=a[i][j]*b[j]
       
       ans=absum+c
       if ans>0:
       count +=1
print(count)

Buggy submission (verdict: Runtime Error):
gt

Buggy submission (verdict: Runtime Error):
n,m,c=map(int,input().split())
B=list(map(int,input().split())) 
A=[list(map(int,input().split()))for i in range(n)] 
cnt=0 
for i in range(n):
    total = 0
  for j in range(m):
      total+=B[j]*A[i][j]
  total+=c
  if total>0:
          cnt+=1  
print(cnt)
Problem p03105 (python)

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

if b//a <= c:
  print(b//a)
  
else:
  print(c)

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
 
count=0
 
for i in range(1,max(a,b)+1)[::-1]
 
if a%i==0 and b%i==0:
  count+=1
  if count==k:
    print(i)

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

answer = b//a

if answer<c:
  print(answer)
  else:
    print(c)
Problem p03106 (python)

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

ans = []
for i in range(1, min(A, B) + 1):
    if (A%i==0) and (B%i==0):
        ans.append(i)

print(ans[-K])

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
 
count=0
 
for i in range(1,min(a,b)+1)[::-1]:
  if a%i==0 and b%i==0:
    count +=1
if count==k:
  num=i
  break
  
print(num)

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

count=0

for i in range(1,min(a,b)+1)[::-1]:
  if a%i==0 and b%i==0:
    count +=1
if count=k:
  num=i
  break
  
print(num)

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

count=0

for i range(1,max(a,b)+1)[::-1]

if a%i==0 and b%i==0:
  count+=1
  if count==k:
    print(i)

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
 
count=0
for i in range(1,min(a,b)+1):
  if a%i==0 and b%i==0:
    count +=1
    if count==k-1:
      num=i
      break
 
print(num)
Problem p03284 (python)

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

if n%k==0:
  print(str(0))

else:
  print(str(1))

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

if n%k==0:
  print(0)
  
else:
  print(1)
Problem p03288 (python)

Fixed submission:
n = int(input())

if n<1200:
  print("ABC")
  
elif 1200<=n<2800:
  print("ARC")
  
else:
  print("AGC")

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

if n<1200:
  print("ABC")
  
elif 1200=<n<2800:
  print("ARC")
  
else:
  print("AGC")
Problem p02731 (python)

Fixed submission:
L = float(input())

returnVal = (L/3)**3
print(returnVal)

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

returnVal = (L/3)**3
print(returnVal)
Problem p02760 (python)

Fixed submission:
import numpy as np
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
N = int(input())
bs = [int(input()) for _ in range(N)]

A = np.array([A1, A2, A3])
mask = np.zeros_like(A)
for b in bs:
    mask += (A==b).astype(int)

mask = mask>0
if np.any(np.all(mask, axis=0)):
    print('Yes')
elif np.any(np.all(mask, axis=1)):
    print('Yes')
elif np.all(np.diag(mask)):
    print('Yes')
# elif np.all(np.diag(mask.T)):
elif mask[0][2]&mask[1][1]&mask[2][0]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
N = int(input())
bs = [int(input()) for _ in range(N)]

A = np.array([A1, A2, A3])
mask = np.zeros_like(A)
for b in bs:
    mask += (A==b).astype(int)

mask = mask>0
if np.any(np.all(mask, axis=0)):
    print('Yes')
elif np.any(np.all(mask, axis=1)):
    print('Yes')
elif np.all(np.diag(mask)):
    print('Yes')
# elif np.all(np.diag(mask.T)):
elif np.logical_and(mask[0][2], mask[1][1], mask[2][0]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
N = int(input())
bs = [int(input()) for _ in range(N)]

A = np.array([A1, A2, A3])
mask = np.zeros_like(A)
for b in bs:
    mask += (A==b).astype(int)

mask = mask>0
if np.any(np.all(mask, axis=0)):
    print('Yes')
elif np.any(np.all(mask, axis=1)):
    print('Yes')
elif np.all(np.diag(mask)):
    print('Yes')
# elif np.all(np.diag(mask.T)):
elif np.logical_and(mask[0][2], mask[1][1], mask[2][0]):
    print('Yes')
else:
    print('No')
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
#初期データ、構造
N,Q = (int(x) for x in input().split())
# 隣接リスト表現
connection ={i:set() for i in range(1,N+1)}
for _ in range(N-1):
    a,b = (int(x) for x in input().split())
    connection[a].add(b)
    connection[b].add(a)

point ={i:0 for i in range(1,N+1)}
for _ in range(Q):
    p,x = (int(x) for x in input().split())
    point[p] += x

def DFS(now,prev = -1):
    for next in connection[now]:
        # 親へのエッジはスキップ
        if next == prev:
            continue
        point[next] += point[now] 
        DFS(next,now)

DFS(1)
print(*point.values())

Buggy submission (verdict: Runtime Error):
#初期データ、構造
N,Q = (int(x) for x in input().split())
# 隣接リスト表現
connection ={i:set() for i in range(1,N+1)}
for i in range(N-1):
    a,b = (int(x) for x in input().split())
    connection[a].add(b)
    connection[b].add(a)
point ={i:0 for i in range(1,N+1)}
for i in range(Q):
    p,x = (int(x) for x in input().split())
    point[p] +=x

def DFS(now,prev = -1):
    for next in connection[now]:
        # 親へのエッジはスキップ
        if next == prev:
            continue
        point[next] += point[now] 
        DFS(next,now)

DFS(1)
print(*point.values())
Problem p03049 (python)

Fixed submission:
n = int(input())
s_array = [input() for x in range(n)]
a_count = 0
b_count = 0
ab_count = 0
for s in s_array:
    if s[-1] == "A" and s[0] != "B":
        a_count += 1
    elif s[0] == "B" and s[-1] != "A":
        b_count += 1
    elif s[0] == "B" and s[-1] == "A":
        ab_count += 1
    else:
        pass

res = sum([x.count("AB") for x in s_array])

if n == 1:
    print(res)
elif ab_count == 0:
    print(res + min(a_count, b_count))
elif a_count == 0 and b_count == 0:
    print(res - 1 + ab_count)
else:
    print(res + min(a_count, b_count) + ab_count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(N)]

# 文字列にABが入ってる数 + 組み合わせて入る数
# 文字列にABが入ってる数 + f(Aで終わる数, Bで始まる数, Bで始まりAで終わる数)
include = 0
sb = 0
fa = 0
sbfa = 0
for s in S:
    if 'AB' in s:
        include += 1
    if s[0] == 'B' and s[-1] == 'A':
        sbfa += 1
    elif s[0] == 'B':
        sb += 1
    elif s[-1] == 'A':
        fa += 1

def calc_comb(sb, fa, sbfa):
    ans = 0
    if sbfa > 0:
        ans += sbfa-1
        if sb > 0:
            sb -= 1
            ans += 1
        if fa > 0:
            fa -= 1
            ans += 1
    ans += min(sb, fa)

print(include + calc_comb(sb, fa, sbfa))
Problem p03060 (python)

Fixed submission:
import numpy as np
N = int(input())
V_list = np.array(list(map(int, input().split())))
C_list = np.array(list(map(int, input().split())))

diff = V_list - C_list

print(diff[diff > 0].sum())

Buggy submission (verdict: Runtime Error):
N = int(input())
V_list = np.array(list(map(int, input().split())))
C_list = np.array(list(map(int, input().split())))

diff = V_list - C_list

print(diff[diff > 0].sum())
Problem p03212 (python)

Fixed submission:
N = int(input())

def cnt(s):
    if int(s) > N:
        return 0
    ret = 1 if all(s.count(c) > 0 for c in '357') else 0
    for c in '357':
        ret += cnt(s+c)
    return ret

print(cnt('0'))

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

def cnt(s):
    if int(s) > N:
        return 0
    ret = 1 if all(s.count(c) > 0 for c in '357') else 0
    for c in '357':
        ret += cnt(s+c)
    return ret

pritn(cnt('0'))
Problem p03380 (python)

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

import bisect
import numpy as np
amax = a[-1]
cent = amax // 2

idx = bisect.bisect_left(a, cent)
if idx == len(a)-1:
    print(amax, a[-2])
else:
    max_idx = np.argmin([abs(a[idx]-cent), abs(a[idx-1]-cent)])
    if max_idx:
        print(amax, a[idx-1])
    else:
        print(amax, a[idx])

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

# nCrにおいてrが一定の時にnが最大の時に場合の数が最大になる
# max_xCrをDPで調べればok

import numpy as np
max_a = a[-1]
max_r = a[-2]+1
dp = np.zeros(max_r)
for i in range(max_r-1):
    if i != 0:
        dp[i+1] = dp[i] * (max_a-i) // (i+1)
    else:
        dp[i+1] = max_a

idx = np.argmax(dp[a[:-1]])
print('{:d} {:d}'.format(max_a, a[idx]))
Problem p02765 (python)

Fixed submission:
N, R = list(map(int, input().split(' ')))
if N >= 10:
    print(R)
else:
    print(R + (100 * (10 - N)))

Buggy submission (verdict: Runtime Error):
N, R = list(map(int, input().split(' ')))
if N >= 10:
    print(R)
else:
    print(R + (100 - (10 - K)))
Problem p02802 (python)

Fixed submission:
N, M = list(map(int, input().split(' ')))
AC_total = 0
WA_total = 0
ac_list = [False] * N
wa_list = [0] * N
for i in range(M):
    p, s = input().split(' ')
    p = int(p) - 1
    if not ac_list[p]:
        if s == 'WA':
            wa_list[p] += 1
        else:
            AC_total += 1
            WA_total += wa_list[p]
            ac_list[p] = True
print('{} {}'.format(AC_total, WA_total))

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split(' ')))
result_list = [input().split(' ') for i in range(M)]
AC_total = 0
WA_total = 0
ac_list = []
wa_dict = {}
for p, s in result_list:
    if p not in ac_list:
        if s == 'WA':
            if p in wa_dict:
                wa_dict[p] += 1
            else:
                wa_dict[p] = 1
        else:
            AC_total += 1
            WA_total += wa_dict[p]
            ac_list.append(p)
print('{} {}'.format(AC_total, WA_total))

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split(' ')))
result_list = [input().split(' ') for i in range(M)]
AC_total = 0
WA_total = 0
ac_list = []
wa_dict = {}
for p, s in result_list:
    if p not in ac_list:
        if s == 'WA':
            if p in wa_dict:
                wa_dict[p] += 1
            else:
                wa_dict[p] = 1
        else:
            AC_total += 1
            ac_list.append(p)
for p in wa_dict:
    if p in ac_list:
        WA_total += wa
print('{} {}'.format(AC_total, WA_total))
Problem p02882 (python)

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

import math
if (x/a < 0.5*a*b):
  print(90-math.degrees(math.atan((2*x)/(a*b**2))))
elif (x/a == a*b):
  print(0)
else:
  print(90-math.degrees(math.atan(0.5*a**3/((b*a**2)-x))))

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

import math
if (x/a < 0.5*a*b):
  print(90-math.degrees(math.atan((2*x)/(a*b**2))))
else:
  print(90-math.degrees(math.atan(0.5*a**3/((b*a**2)-x))))
Problem p02885 (python)

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

if 2*B >= A:
  print(0)
else:
  print(A-2*B)

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

if 2*B >= A:
  print(0)
else:
  print(A-2*B)
Problem p02921 (python)

Fixed submission:
S = list(input())
T = list(input())

counter = 0
for i in range(0,3):
    if S[i] == T[i]:
        counter += 1

print(counter)

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

Maxcounter = 0
for i in range(1,N):
    counter = 0
    k = i
    while k < N:
      if (A[k-1]>=A[k]):
        counter += 1
        k += 1
        if Maxcounter <= counter:
            Maxcounter = counter
      else:
        break
      
print(Maxcounter)
Problem p02953 (python)

Fixed submission:
N = int(input())
H = [int(x) for x in input().split()]

H.reverse()
#print(H)
cnt = 0
for i in range(1,N):
  if H[i]-H[i-1] == 1:
    H[i] = H[i]-1
  elif H[i]-H[i-1] > 1:
    cnt += 1
if cnt == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
H = [int(x) for x in input().split()]
 cnt = 0
for i in range(N-1):
  if H[i]-H[i+1] > 1:
    cnt += 1
if cnt == 0:
  print('Yes')
else:
  print('No')
Problem p02981 (python)

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

print(min(N*A,B))

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

print(min(N*A,B)
Problem p02994 (python)

Fixed submission:
N,L = map(int,input().split())
import math
T = []
for i in range(N):
  T.append(L+i)
cnt = 0
mcnt = sum(T)
k = 1000000
for i in range(0,N):
  if abs(T[i])<k:
    mcnt = sum(T)-T[i]
    cnt = i+1
    k=abs(T[i])
print(mcnt)

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

if (S[0]==S[1])or(S[1]==S[2])or(S[2]==S[3]):
  print('Bad')
else:
  print('Good')
Problem p02995 (python)

Fixed submission:
A,B,C,D = map(int,input().split())
def gcd(x,y):
  if x<y:
    l = y
    k = x
    x = y
    y = k
  else:
    k = y
    l = x
  z = x%y
  while z != 0:
    x = y
    y = z
    z = x%y
  return (k//y)*(l//y)*y

if A%C ==0:
  i = (A//C)-1
else:
  i = A//C

j = B//C

if A%D ==0:
  k = (A//D)-1
else:
  k = A//D

l = B//D

if A%(gcd(C,D)) ==0:
  m = (A//(gcd(C,D)))-1
else:
  m = A//gcd(C,D)
  
n = B//gcd(C,D)

#print(i,j,k,l,m,n)
#print(B-A+1,j-i,l-k,n-m)
print((B-A+1)-(j-i)-(l-k)+(n-m))

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())
def gcd(x,y):
  if x<y:
    l = y
    k = x
    x = y
    y = k
  z = x%y
  while z != 0:
    x = y
    y = z
    z = x%y
  return (k//y)*(l//y)*y

if A%C ==0:
  i = (A//C)-1
else:
  i = A//C

j = B//C

if A%D ==0:
  k = (A//D)-1
else:
  k = A//D

l = B//D

if A%(gcd(C,D)) ==0:
  m = (A//(gcd(C,D)))-1
else:
  m = A//gcd(C,D)
  
n = B//gcd(C,D)

#print(i,j,k,l,m,n)
#print(B-A+1,j-i,l-k,n-m)
print((B-A+1)-(j-i)-(l-k)+(n-m))
Problem p03029 (python)

Fixed submission:
A,P = map(int,input().split())
N = 3*A+P
print(N//2)

Buggy submission (verdict: Runtime Error):
A,P = int(input())
N = 3*A+P
print(N//2)
Problem p03035 (python)

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

if A<=5:
  print(0)
elif A>=13:
  print(B)
else:
  print(B//2)

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

if A<=5:
  print(0)
elif　A>=13:
  print(B)
else:
  print(B//2)
Problem p02724 (python)

Fixed submission:
X = int(input())
coin500, X = divmod(X, 500)
coin5, X = divmod(X, 5)
print(1000 * coin500 + 5 * coin5)

Buggy submission (verdict: Runtime Error):
X = input()
coin500, X = divmod(X, 500)
coin5, X = divmod(X, 5)
print(1000 * coin500 + 5 * coin5)

Buggy submission (verdict: Runtime Error):
X = input()
coin500, X = divmod(X, 500)
coin5, X = divmod(X, 5)
print(1000 * coin500 + 5 * coin5)