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

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

n, m = map(int, input().split())
a = [-1 for _ in range(n)]
b = [-1 for _ in range(n)]
d = {}
for i in range(n):
    a[i], b[i] = map(int, input().split())
    if a[i] not in d:
        d[a[i]] = b[i]
    else:
        d[a[i]] += b[i]

d = sorted(d.items(), key=lambda x:x[0])
num = ans = 0 
for i in range(len(d)):
    tmp = num 
    num += d[i][1]
    if num <= m:
        ans += d[i][0]*d[i][1]
    else:
        ans += d[i][0]*(m-tmp)
        break

print(ans)

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

n, m = map(int, input().split())
a = [-1 for _ in range(n)]
b = [-1 for _ in range(n)]
d = {}
for i in range(n):
    a[i], b[i] = map(int, input().split())
    if a[i] not in d:
        d[a[i]] = b[i]
    else:
        d[a[i]] += b[i]

d = sorted(d.items(), key=lambda x:x[0])
num = ans = 0 
for i in range(n):
    tmp = num 
    num += d[i][1]
    if num <= m:
        ans += d[i][0]*d[i][1]
    else:
        ans += d[i][0]*(m-tmp)
        break

print(ans)

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

n, m = map(int, input().split())
a = [-1 for _ in range(n)]
b = [-1 for _ in range(n)]
d = {}
for i in range(n):
    a[i], b[i] = map(int, input().split())
    d[a[i]] = b[i]

d = sorted(d.items(), key=lambda x:x[0])
num = ans = 0 
for i in range(n):
    tmp = num 
    num += d[i][1]
    if num <= m:
        ans += d[i][0]*d[i][1]
    else:
        ans += d[i][0]*(m-tmp)
#        import pdb; pdb.set_trace()
        break

print(ans)
Problem p03160 (python)

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

n = int(input())
h = list(map(int, input().split()))
dp = [10001 for _ in range(n)]

dp[0] = 0 
dp[1] = abs(h[1]-h[0])

for i in range(2,n):
    dp[i] = min(dp[i-2] + abs(h[i]-h[i-2]), dp[i-1] + abs(h[i]-h[i-1]))

print(dp[n-1])

Buggy submission (verdict: Runtime Error):
# Knapsack問題

# input
N,W = map(int, input().split())
w = []
v = []
for _ in range(N):
  a,b = map(int ,input().split())
  w.append(a)
  v.append(b)

# calc
dp = [[0 for _ in range(W+1)] for _ in range(N+2)]

for i in range(N):
    for j in range(W+1):
        if w[i] <= j:
            dp[i+1][j] = max(dp[i][j-w[i]]+v[i], dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]

print(dp[N][W])
Problem p03163 (python)

Fixed submission:
# Knapsack問題

# input
N,W = map(int, input().split())
w = []
v = []
for _ in range(N):
    a,b = map(int ,input().split())
    w.append(a)
    v.append(b)

# calc
dp = [[0 for _ in range(W+1)] for _ in range(N+2)]

for i in range(N):
    for j in range(W+1):
        if w[i] <= j:
            dp[i+1][j] = max(dp[i][j-w[i]]+v[i], dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]

print(dp[N][W])

Buggy submission (verdict: Runtime Error):
import numpy as np
N,W = map(int, input().split())
w = np.zeros(N, dtype=int)
v = np.zeros(N, dtype=int)
for i in range(N):
    a,b = map(int ,input().split())
    w[i] = a 
    v[i] = b 

dp = [[0 for _ in range(W+1)] for _ in range(N+2)]
dp = np.array(dp, dtype=int)
for i in np.arange(N):
   for j in np.arange(W+1):
        if w[i] <= j:
            dp[i+1,j] = max(dp[i, j-w[i]]+v[i], dp[i,j])
        else:
            dp[i+1,j] = dp[i,j]

print(dp[N,W])

Buggy submission (verdict: Runtime Error):
# Knapsack問題

import numpy as np

# input
N,W = map(int, input().split())
w = np.zeros(N, dtype=int)
v = np.zeros(N, dtype=int)
for i in range(N):
    a,b = map(int ,input().split())
    w[i] = a 
    v[i] = b 

# calc
dp = [[0 for _ in range(W+1)] for _ in range(N+2)]
dp = np.array(dp, dtype=int)
for i in np.arange(N):
   for j in np.arange(W+1):
        if w[i] <= j:
            dp[i+1,j] = max(dp[i, j-w[i]]+v[i], dp[i,j])
        else:
            dp[i+1,j] = dp[i,j]

print(dp[N,W])

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

import numpy as np

# input
N,W = map(int, input().split())
w = np.zeros(N, dtype=int)
v = np.zeros(N, dtype=int)
for i in range(N):
  a,b = map(int ,input().split())
  w[i] = a 
  v[i] = b 

# calc
dp = [[0 for _ in range(W+1)] for _ in range(N+2)]
dp = np.array(dp, dtype=int)
for i in np.arange(N):
   for j in np.arange(W+1):
        if w[i] <= j:
            dp[i+1,j] = max(dp[i, j-w[i]]+v[i], dp[i,j])
        else:
            dp[i+1,j] = dp[i,j]

print(dp[N,W])
Problem p03457 (python)

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

n = int(input())
t = [-1 for _ in range(n)]
x = [-1 for _ in range(n)]
y = [-1 for _ in range(n)]
for i in range(n):
    t[i], x[i], y[i] = map(int, input().split())

dt = [-1 for _ in range(n)]
dx = [-1 for _ in range(n)]
dy = [-1 for _ in range(n)]
for i in range(n):
    if i == 0:
        dt[0] = t[0]
        dx[0] = x[0]
        dy[0] = y[0]
    else:
        dt[i] = t[i] - t[i-1]
        dx[i] = x[i] - x[i-1]
        dy[i] = y[i] - y[i-1]

ok = True
for i in range(n):
    tr = dt[i]%2
    pr = (dx[i]+dy[i])%2
    if (tr == pr) and (dt[i] >= abs(dx[i])+abs(dy[i])):
        pass
    else:
        ok = False
#        import pdb; pdb.set_trace()
        break

if ok:
    print('Yes')
else:
    print('No')

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

n = int(input())
t = [-1 for _ in
x = [-1 for _ in
y = [-1 for _ in
for i in range(n
    t[i], x[i], 

dt = [-1 for _ i
dx = [-1 for _ i
dy = [-1 for _ i
for i in range(n
    if i == 0:
        dt[0] = 
        dx[0] = 
        dy[0] = 
    else:
        dt[i] = 
        dx[i] = 
        dy[i] = 

ok = True
for i in range(n
    tr = dt[i]%2
    pr = (dx[i]+
    if (tr == pr
        pass
    else:
        ok = Fal
#        import 
        break

if ok:
    print('Yes')
else:
    print('No')
Problem p03523 (python)

Fixed submission:
#!/usr/bin/env python
import re

s = input()
STR = 'AKIHABARA'
if len(s) > len(STR):
    print('NO')
    exit()

regex = re.compile('^A?KIHA?BA?RA?')
mo = regex.search(s)
if mo == None:
    print('NO')
else:
    print('YES')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
import re

s = input()
STR = 'AKIHABARA'
if len(s) > len(STR):
    print('NO')
    exit()

regex = re.compile('A?KIHA?BA?RA?')
mo = regex.search(s)
if mo == None:
    print('NO')
else:
    print('YES')
~
Problem p03611 (python)

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

n = int(input())
a = list(map(int, input().split()))

if n == 1:
    print(1)
    exit(0)
if n == 2:
    if abs(a[0]-a[1]) <= 2:
        print(2)
    else:
        print(1)
    exit(0)

if n >= 3:
    d = [0 for _ in range(100001)]
    for i in range(n):
        d[a[i]] += 1
    ans = 0 
    for i in range(100001-2):
        tmp = d[i] + d[i+1] + d[i+2]
        if ans <= tmp:
            ans = tmp 

print(ans)

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

n = int(input())
a = list(map(int, input().split()))

if n == 1:
    print(1)
    exit(0)
if n == 2:
    if abs(a[0]-a[1]) <= 2:
        print(2)
    else:
        print(1)
    exit(0)

if n >= 3:
    d = [0 for _ in range(100001)]
    for i in range(n):
        d[a[i]] += 1
    ans = 0 
    for i in range(n-2):
        tmp = d[i] + d[i+1] + d[i+2]
        if ans <= tmp:
            ans = tmp 

print(ans)

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

n = int(input())
a = list(map(int, input().split()))

if n == 1:
    print(1)
    exit(0)
if n == 2:
    if abs(a[0]-a[1]) <= 2:
        print(2)
    else:
        print(1)
    exit(0)

if n >= 3:
    d = [0 for _ in range(n)]
    for i in range(n):
        d[a[i]] += 1
    ans = 0 
    for i in range(n-2):
        tmp = d[i] + d[i+1] + d[i+2]
        if ans <= tmp:
            ans = tmp 

print(ans)

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

n = int(input())
a = list(map(int, input().split()))

if n == 1:
    print(1)
    exit(0)
if n == 2:
    if abs(a[0]-a[1]) <= 2:
        print(2)
    else:
        print(1)
    exit(0)

if n >= 3:
    d = [0 for _ in range(10)]
    for i in range(n):
        d[a[i]] += 1
    ans = 0 
    for i in range(n-2):
        tmp = d[i] + d[i+1] + d[i+2]
        if ans <= tmp:
            ans = tmp 

    print(ans)

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

n = int(input())
a = list(map(int, input().split()))

if n == 1:
    print(1)
    exit(0)
if n == 2:
    if abs(a[0]-a[1]) <= 2:
        print(2)
    else:
        print(1)
    exit(0)

if n >= 3:
    d = [0 for _ in range(10)]
    for i in range(n):
        d[a[i]] += 1

    ans = 0 
    for i in range(n-2):
        tmp = d[i] + d[i+1] + d[i+2]
        if ans <= tmp:
            ans = tmp 

print(ans)
Problem p02658 (python)

Fixed submission:
def main():
  n = int(input())
  v = list(map(int, input().split()))

  if 0 in v:
    print(0)
    return
  
  prod = 1
  for i in v:
    prod *= i
    if(prod > 1000000000000000000):
      print(-1)
      return
  print(prod)

main()

Buggy submission (verdict: Runtime Error):
def main():
	N = int(input())
    A = list(map(int, input().split()))
    
    if 0 in A:
      print(0)
      return
    
    prod = 1
    for a in A:
		prod *= a
        if prod > 1000000000:
     		print(-1)
            return
    print(prod)
main()
Problem p03302 (python)

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

if a*b == 15:
    print("*")
elif a+b == 15:
    print("+")
else:
    print("x")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if a*b==15:
    print("*")
elif a+b==15:
    print("+")
else:
    print("x")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if a*b==15: print("*")
elif a+b==15: print("+")
else :print("x")
Problem p02630 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
import collections
coll=collections.Counter(a)
q=int(input())
suma=sum(a)
lis=[0]*(10**5+1)
for i in a:
    lis[i-1]=coll[i] #lisの「番め」の数字が、aに何個あるか

for i in range(q):
    ans=0
    b,c=map(int,input().split())
    sa=c-b
    lis[c-1]+=lis[b-1]
    ans+=sa*lis[b-1]
    lis[b-1]=0
    suma+=ans
    print(suma)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
import collections
coll=collections.Counter(a)
q=int(input())
suma=sum(a)
lis=[0]*max(a)
for i in a:
    lis[i-1]=coll[i] #lisの「番め」の数字が、aに何個あるか

for i in range(q):
    ans=0
    b,c=map(int,input().split())
    sa=c-b
    lis[c-1]+=lis[b-1]
    ans+=sa*lis[b-1]
    lis[b-1]=0
    suma+=ans
    print(suma)
Problem p02641 (python)

Fixed submission:
x,n=map(int,input().split())
if n==0:
    print(x)
    quit()
p=list(map(int,input().split()))
if x not in p:
    print(x)
    quit()
i=0
while True:
    if x-i not in p:
        print(x-i)
        quit()
    elif x+i not in p:
        print(x+i)
        quit()
    i+=1

Buggy submission (verdict: Runtime Error):
if n==0:
    print(x)
    quit()
p=list(map(int,input().split()))
if x not in p:
    print(x)
    quit()
p.sort()
ans=[]
#本題
for i in range(p[0],p[-1]+1):
    if i not in p:
        ans.append(i)
ans.append(100000000)
for i in range(len(ans)):
    if ans[i]>x:
        if abs(x-ans[max(i-1,0)]) <= abs(x-ans[i]):
            print(ans[max(i-1,0)])
        else:
            print(ans[i])
        quit()
Problem p02713 (python)

Fixed submission:
n=int(input())+1
import math
ans=0
for i in range(1,n):
    ans+=n-i
    for j in range(i+1,n):
        p=math.gcd(n-i,n-j)
        ans+=p*6
        for k in range(j+1,n):
            ans+=math.gcd(p,n-k)*6
print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())
 
def gcd2(a,b):
    if b == 0:
        return a
    return gcd2(b,a%b)

def gcd3(a,b,c):
    return gcd2(gcd2(a,b), c)

ans = 0
for a in range(1,k+1):
    for b in range(i,k+1):
        for c in range(j, k+1):
            if a == b == c:
                ans += gcd3(a,b,c)
            elif a == b or b == c:
                ans += gcd3(a,b,c)*3
            else:
                ans += gcd3(a,b,c)*6

print(ans)
Problem p02761 (python)

Fixed submission:
n,m=map(int,input().split())
d=["a"]*n
ans=""
if n==1 and m==0:
    print(0)
    exit()
for i in range(m):
    s,c=map(str,input().split())
    if s=="1" and c=="0" and n==1:
        print(0)
        exit()
    s=int(s)
    if d[s-1]=="a" or d[s-1]==c:
        d[s-1]=c #置き換え
    else:
        ans="-1"
        print(ans)
        break
if d[0]!="0" and ans!="-1":
    if d[0]=="a" or d[0]=="0":
        print("".join(["1"]+d[1:]).replace("a","0"))
    else:
        print(("".join(d)).replace("a","0"))
elif d[0]=="0":
    print(-1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
d=["a"]*n
ans=""
for i in range(m):
    s,c=map(str,input().split())
    s=int(s)
    if d[s-1]=="a" or d[s-1]==c:
        d[s-1]=c #置き換え
    else:
        ans="-1"
        break
if d[0]=="0":
    print(-1)
elif d[0]=="a":
    d[0]="1"
    if d[2]=="a":
        print(-1)
    else:
        print(("".join(d)))
else:
    print(("".join(d)).replace("a","0"))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=["a"]*n
for i in range(m):
    s,c=map(int,input().split())
    if s>n:
        pans="-1"
        break
    elif ans[s-1]=="a" or ans[s-1]==c:
        ans[s-1]=c 
        pans="0"
        if s==1 and c==0:
            pans="-1"
            break
    else:
        pans="-1"
        break
                
ans = [str(i) for i in ans]
if pans != "-1":
    pans="".join(ans)
    pans=pans.replace("a","0")
    if pans[0]=="0":
        pans='1' + pans[1:]
print(pans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=["a"]*n
for i in range(m):
    s,c=map(int,input().split())
    if s>n:
        pans="-1"
        break
    if ans[s-1]=="a" or ans[s-1]==c:
        ans[s-1]=c 
        pans="0"
        if s==1 and c==0:
            pans="-1"
            break
    else:
        pans="-1"
        break
                
ans = [str(i) for i in ans]
if pans != "-1":
    pans="".join(ans)
    pans=pans.replace("a","0")
    if pans[0]=="0":
        pans='1' + pans[1:]
print(pans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=["a"]*n
for i in range(m):
    s,c=map(int,input().split())
    if ans[s-1]=="a" or ans[s-1]==c:
        ans[s-1]=c 
        pans="0"
        if s==1 and c==0:
            pans="-1"
            break
    else:
        pans="-1"
        break
                
ans = [str(i) for i in ans]
if pans != "-1":
    pans="".join(ans)
    if pans[0]=="0":
        pans='1' + pans[1:]
print(pans.replace("a","0"))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=[0]*n
for i in range(m):
    s,c=map(int,input().split())
    ans[s-1]=c
    if c!=0 and ans[s-1]==0:
        ans[s-1]=c 
        pans="0"
    else:
        pans="-1"
                
ans = [str(i) for i in ans]
if pans != "-1":
    pans="".join(ans)
    if pans[0]=="0":
        pans='1' + pans[1:]
print(pans)
Problem p02802 (python)

Fixed submission:
n,m=map(int,input().split())
acs=[0]*n
was=[0]*n
WA=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if acs[p-1]==0:
        if s=="AC":
            acs[p-1]=1
            WA+=was[p-1]
        else:
            was[p-1]+=1
print(sum(acs),WA)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
WA,wa,ac=0,0,0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if i>0 and p!=before:
        wa=0
    if s=="WA":
        wa+=1
    elif s=="AC" and p==before:
        WA+=wa
        ac+=1
    before=p
print(ac,WA)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
wa,ac=0,0
ac_number,last_wa=0,0
for i in range(m):
    p,s=input().split()
    if s=="WA":
        wa+=1
        wa_number=int(p)
    elif s=="AC" and ac_number!=int(p): #ac_numberは最後にacした問題の番号
        ac+=1
        ac_number=int(p)
    if wa_number==ac_number:
        last_wa+=wa
print(ac,last_wa)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lip,lis=[],[]
old=0
ansa=0
wa=0
for i in range(1,m):
    p,s=input().split()
    lip.append(p)
    lis.append(s)
    if len(lip)==1:
        if s=="AC": #1問目がACの時
            ansa+=1
            old=lip[0]
        else:
            wa+=1
    elif old!=p:
        if s=="AC":#その問題で初めてのAC
            ansa+=1
            old=p #最後のACの問題番号 = old
            ansb=wa #その問題のペナが反映
        else:
            wa+=1
    else:
        wa=0
print(ansa,ansb)
Problem p02841 (python)

Fixed submission:
m,d=map(int,input().split())
a,b=map(int,input().split())
if a==m+1:
    print("1")
else:
    print("0")

Buggy submission (verdict: Runtime Error):
m,d=map(int,input().split())
a,b=map(int,input().split())
if a=m+1:
    print("1")
else:
    print("0")
Problem p02854 (python)

Fixed submission:
n =int(input())
a=list(map(int, input().split()))
m=0
s=[]
suma=sum(a)
for i in range(len(a)):
    m+=a[i]
    s.append(abs(suma-m*2))
print(min(s))

Buggy submission (verdict: Runtime Error):
n =int(input())
a=list(map(int, input().split()))
m=0
s=[]
for i in range(len(a)):
    m+=a[i]
    s.append(abs(sum(a)-m*2))
    if min(s)<s[i+1]:
        break
print(min(s))

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
list=[300000,200000,100000,0]
if x>4:
    x=4
if y>4:
    y=4
if x==1 and y==1:
    print(2*300000+400000)
else:
    print(list[x-1]+list[y-1])
Problem p02899 (python)

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

Buggy submission (verdict: Runtime Error):
n= int(input())
a=list(map(int, input().split()))
for i in range(n):
    print(li2[i]+1,end=" ")
Problem p02911 (python)

Fixed submission:
n,k,q = map(int, list(input().split()))
point=[k]*n
a=[]
	
for i in range(q):
	a.append(int(input()))
	point[a[i]-1]+=1
for i in range(n):
    if point[i]-q>0:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
n,k,q = map(int, list(input().split()))
point=[k]*n
a=[]
	
for i in range(q):
	a.append(int(input()))
	point[a[i]-1]+=1
max=max(point)
for i in range(n):
    if point[i]==max or print[i]-q>0:
        print("Yes")
    else:
        print("No")

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

point=[k]*n
for i in range(q):
	point[a[i-1]]+=1
for i in range(n):
    if point[i]==max(point):
        print("Yes")
    else:
        print("No")

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

point=[k]*n
for i in range(q):
	point[a[i]]+=1
for i in range(n):
    if point[i]==max(point):
        print("Yes")
    else:
        print("No")

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

point=[k]*n
for i in range(q):
	point[a[i]]+=1
for i in range(n):
    if point[i]==max(point):
        print("Yes")
    else:
        print("No")
Problem p02946 (python)

Fixed submission:
k,x=map(int,input().split())
for i in range (x-k+1,x+k):
    print(i, end=" ")

Buggy submission (verdict: Runtime Error):
k=int(input())
x=int(input())
for i in range (x-k+1,x+k):
    print(i, end="")

Buggy submission (verdict: Runtime Error):
k=int(input())
x=int(input())
for i in range (x-k+1,x+k-1):
    print(i, end="")
Problem p02952 (python)

Fixed submission:
n=int(input())
m=str(n)
minus1=10**(len(m)-2)*9
minus=minus1
if len(m)==1:
    print(n)
elif len(m)%2==0:
    for i in range(len(m)//2):
        minus1+=minus//(100**(len(m)//2-i))
    print(minus1)
else:
    for i in range(len(m)//2):
        minus1+=minus//(100**(len(m)//2-i))
    print(minus1//10+n-10**(len(m)-1)+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
m=str(n)
minus1=10**(len(m)-2)*9
minus=minus1
if len(m)==1:
    print(n)
if len(m)%2==0:
    for i in range(len(m)//2):
        minus1+=minus//(100**(len(m)//2-i))
        print(minus1)
else:
    for i in range(len(m)//2):
        minus1+=minus//(100**(len(m)//2-i)
        print(minus1//10+n-10**(len(m)-1))
Problem p02953 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
h[0]-=1
for i in range(1,n-1):
    if h[i]>h[i+1] or h[i]>h[i-1]:
        h[i]-=1
for i in range(n-1):
    if h[i]>h[i+1]:
        print("No")
        quit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
h[0]-=1
for i in range(n-1):
    if h[i]>h[i+1]:
        h[i]-=1
    print(h)
for i in range(n-1):
    if h[i]>h[i+1]:
        print("No")
        quit()
print("Yes")
Problem p03000 (python)

Fixed submission:
n,x = map(int,input().split())
l = list(map(int,input().split()))
i=0
suml=0
if sum(l)<=x:
    print(len(l)+1)
else:
    while suml<=x:
        suml=suml+l[i]
        i=i+1
    print(i)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
l = list(map(int,input().split()))
i=0
suml=0
if sum(l)<x:
    print(len(l))
else:
    while suml<=x:
        suml=suml+l[i]
        i=i+1
    print(i)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
l = list(map(int,input().split()))
i=0
suml=0
if sum(l)<x:
    print(len(l))
else:
    while suml<=x:
        suml=suml+l[i]
        i=i+1
        print(i)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
l = list(map(int,input().split()))
i=0
suml=0
while suml<=x:
    suml=suml+l[i]
    i=i+1
print(i)
Problem p03103 (python)

Fixed submission:
n,m=map(int,input().split())
s=[]
for i in range(n):
    a,b=map(int,input().split())
    #n店舗、a値段、b本数
    s.append([a,b])
s.sort()
ans=0
i=0
while m-s[i][1]>0:
    m-=s[i][1]
    ans+=s[i][0]*s[i][1] #値段
    i+=1
print(ans+s[i][0]*m)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
L=0
R=n
for i in range(m):
    l,r=map(int,input().split())
    if l>L:
        L=l
    if r<R:
        R=r
if R-L<0:
    print(0)
else:
    print(R-L)
Problem p03110 (python)

Fixed submission:
n=int(input())
ans=0.0
for i in range(n):
    x,u=input().split()
    if u=="BTC":
        ans += float(x)*380000.0
    else:
        ans += float(x)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(n):
    x,u=map(int,input().split())
    if x[i]=="BTC":
        ans += u[i]*380000.0
    else:
        ans += u[i]
print(ans)
Problem p03192 (python)

Fixed submission:
n=input()
count=0
for i in range(4):
    if n[i]=="2":
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
count=0
for i in range(4):
    if n[i]==2:
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n=int(inout())
count=0
for i in range(4):
    if n[i]==2:
        count+=1
print(count)
Problem p03210 (python)

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

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

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

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
print((A-1)*(B-1))
Problem p03282 (python)

Fixed submission:
s=input()
k=int(input())
ans,bns=0,0
for i in range(len(s)):
    if s[i]!="1":
        ans=s[i]
        break
    else:
        bns+=1 #0の連続
if k<=bns: #k=何番目
    print(1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
ans=0
for i in range(len(s)):
    if s[i]!=1:
        ans=s[i]
        break
    else:
        bns+=1
if k<=bns:
    print(1)
else:
    print(ans)
Problem p03284 (python)

Fixed submission:
n,k=map(int,input().split())
if n%k==0:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
n,k=map(int(input().split()))
if n%k==0:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
N,K(int,input().split())
print(N%K)
Problem p03288 (python)

Fixed submission:
R=int(input())
if R<1200:
    print("ABC")
elif R<2800:
    print("ARC")
else:
    print("AGC")

Buggy submission (verdict: Runtime Error):
R=int(input())
if R<1200:
    print(ABC)
elif R<2800:
    print(ARC)
else:
    print(AGC)