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

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 19:19:52 2020

@author: ezwry
"""

s=list(input())
t=list(input())
u=len(s)
ans=0
for i in range(u):
    if s[i] != t[i]:
        ans+=1
    
print(ans)

Buggy submission (verdict: Runtime Error):
s=list(input())
t=list(input())
u=len(s)
ans=0
for i in range(u):
  if s[u] != t[u]:
    ans+=1
    
print(ans)
Problem p02623 (python)

Fixed submission:
N,M,K = map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
 
a, b =[0],[0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])
 
ans, j =0,M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K-a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
N,M,K = map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
 
a, b =[0],[0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])
 
ans, j =0,M
for i in range(N+1):
  while b[j] > K-a[i]:
        j -= 1
  ans = max(ans, i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
N,M,K = map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
 
a, b =[0],[0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])
 
ans, j =0,M
for i in range(N+1):
    while b[j] > K-a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)
Problem p02688 (python)

Fixed submission:
n, k = map(int, input().split())
 
x = [0]*n
 
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in a:
      x[j-1]=x[j-1]+1
print(x.count(0))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
 
x = [0]*n
 
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in a:
      x[j]=x[j]+1
print(x.count(0))
Problem p02753 (python)

Fixed submission:
s=input()
if s[0]==s[1] and s[1]==s[2]:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
s=input()
if s[1]==s[2] and s[2]==s[3]:
  print("No")
else:
  print("Yes")
Problem p02862 (python)

Fixed submission:
def nCr(n, r, mod):
    x, y = 1, 1
    for i in range(1, r+1):
        x = x*(n+1-i)%mod
        y = y*i%mod
    return x*pow(y, mod-2, mod)%mod
a,b = map(int,input().split())
s=2*a-b
t=2*b-a
if s%3!=0 or s<0 or t%3!=0 or t<0:
  print(0)
else:
  print(nCr((s+t)//3,(t//3),10**9+7))

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
s=2*x-y
t=2*y-x
if s%3!=0 or s<0 or t%3!=0 or t<0:
  print(0)
else:
  import sys
  mod = 1000000007
  p = 1
  q = 1
  for i in range(s//3):
    p = (p*(n-i)) % mod
    q = (q*(i+1)) % mod
  print((p*pow(q, -1, mod)) % mod)
Problem p02676 (python)

Fixed submission:
K = int(input())
S = input()
if len(S) <= K:
  print(S)
else:
  print(S[:K]+"...");

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
if len(S) <= K:
  print(S)
else:
  print(S[K:]+...)
Problem p02860 (python)

Fixed submission:
n = int(input())
s = input()
if (s[:n // 2] == s[n // 2:]): print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
if n % 2 == 0:
  if (s[:n // 2] == s[n // 2:]) print(Yes)
  else print(No)
else print(No)
Problem p02701 (python)

Fixed submission:
n = int(input())
d = {}
for i in range(n):
    s = input()
    try:d[s]+=1
    except:d[s]=1
print(len(d))

Buggy submission (verdict: Runtime Error):
n = int(input())
print(len(set([input() for i in range(n)]))
Problem p02759 (python)

Fixed submission:
n = int(input())
if(n%2 == 0):print(int(n/2))
else:print(int(n/2)+1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ans = ["0"]*n
if(m==0 and n==1):print(0);exit()
for i in range(m):
    a, b = map(int, input().split())
    if(ans[a-1] == "0"):ans[a-1] = str(b)
    elif(int(ans[a-1]) > b):ans[a-1] = str(b)
if(ans[0] == "0"):print(-1)
else:print("".join(ans))
Problem p02820 (python)

Fixed submission:
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
ans = 0
for i in range(n):
    if ((i - k) < 0):
        if (t[i] == 'r'):
            ans += p
        elif (t[i] == 's'):
            ans += r
        else:
            ans += s
        continue

    else:
        if (t[i - k] == t[i]):
            t = t[:i] + 'n' + t[i + 1:]
        else:
            if (t[i] == 'r'):
                ans += p
            elif (t[i] == 's'):
                ans += r
            else:
                ans += s
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
ans = 0
for i in range(n):
    if((i - k) < 0):
        if(t[i] == 'r'):ans += p
        elif(t[i] == 's'):ans += r
        else:ans += s
        continue
    
    else:
        if(t[i-k] == t[i]):t = t[:i] + 'n' + t[i+1:]
        else:
            if(t[i] == 'r'):ans += p
            elif(t[i] == 's'):ans += r 
            else:ans += s
print(score)
Problem p02970 (python)

Fixed submission:
#A
#n = int(input())
#print(3*n**2)
#B
n, d = map(int, input().split())
canseerange = 2*d+1
if n % canseerange == 0:
    print(int(n/canseerange))
else:
    print(int(n/canseerange)+1)

Buggy submission (verdict: Runtime Error):
n, d = map(int, input().split())
canseerange = 2*d+1
if n % canseerange == 0:
    print(int(n/canseerange))
else:
    print(int(n/canseerange)+1

Buggy submission (verdict: Runtime Error):
#A
#n = int(input())
#print(3*n**2)
#B
n, d = map(int, input().split())
canseerange = 2*d+1
if n % canseerange == 0:
    print(int(n/canseerange))
else:
    print(int(n/canseerange)+1
#C
#n = int(input())
#ans = 0
#most1 = 0
#most2 = 0
#ed = False
#for i in range(n):
#    t = int(input())
#    ed = False
#    if most1 <= t:
#        most2 = most1
#        most1 = t
#        ans = i
#        ed = True
#    elif most2 <= t and ed == False:
#        most2 = t
#for i in range(n):
#    if i==ans:print(most2)
#    else:print(most1)
#D
Problem p02987 (python)

Fixed submission:
s = input()
if s[0] == s[1] == s[2] == s[3]:
    print('No')
elif s[0] == s[1] and s[2] == s[3]:
    print('Yes')
elif s[0] == s[2] and s[1] == s[3]:
    print('Yes')
elif s[0] == s[3] and s[1] == s[2]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
d = map(int, input().split())
d = sorted(d)
l = []
now = 0
ans = 0
for i in range(n-1):
    if d[i] != d[i+1]:
        a = d.index(d[i])
        b = d.count(d[i])
        index = a+b-1
        #print(index)
        if index+1 == n/2:
            #print(d[i+1], d[i])
            ans = d[i+1]-d[i]
print(ans)
Problem p02549 (python)

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

L, R = [], []

for _ in range(K):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)

dp = [0] * 300000
dpsum = [0] * 300000
dp[1] = 1
dpsum[1] = 1

for i in range(2, N+1):
    for j in range(K):
        li = min(L[j], i)
        ri = min(R[j], i + 1)
        dp[i] += dpsum[i - li] - dpsum[i - ri - 1]

    dp[i] %= 998244353
    dpsum[i] = dpsum[i-1] + dp[i]

print(dp[N])

Buggy submission (verdict: Runtime Error):
import numpy as np

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

D = []

for _ in range(K):
    L, R = map(int, input().split())

    for i in range(L, R+1):
        D.append(i)

D.sort()

dp = np.zeros(300000)
dp[1] = 1

for d in D:
    for i in range(1, N//d)
        dp += np.roll(dp, i * d)
    dp %= 998244353

print(int(dp[N]))
Problem p02629 (python)

Fixed submission:
from collections import deque  # dequeはappendleftができるので。

letter = ['z'] + [chr(i) for i in range(97, 123)]  # [0, a, b, c, ... , z]というリスト

N = int(input())

i = 0
n_24 = deque()

while N > 0:
    n_24.appendleft(N % 26)
    if N%26== 0:
        N -= 26
    N = N // 26

ans = ''

for dig in (n_24):
    ans += letter[dig]

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque   #dequeはappendleftができるので。

letter = [0] + [chr(i) for i in range(97, 123)] #[0, a, b, c, ... , z]というリスト

N = int(input())

i = 0
n_24 = deque()

while N > 0:
    n_24.appendleft(N % 26)
    N = N // 26

ans = ''

for dig in (n_24):
    ans += letter[dig]

print(ans)
Problem p02712 (python)

Fixed submission:
N = input()
Sum = 0

for k in range(int(N)):
    i = k+1

    if i % 3 != 0:
        if i % 5 != 0:
            Sum = Sum + i

print(Sum)

Buggy submission (verdict: Runtime Error):
N = input()
Sum = 0

for k in range(N):
    i = k+1

    if i % 3 != 0:
        if i % 5 != 0:
            Sum = Sum + i

print(Sum)

Buggy submission (verdict: Runtime Error):
N = input()
Sum = 0

for k in range(N):
    i = k+1

    if i % 3 != 0 and i % 5 != 0:
        Sum = Sum + i

print(Sum)

Buggy submission (verdict: Runtime Error):
N = input()
Sum = 0

for k in range(N):
    i = k+1

    if i % 3 != 0 and i % 5 != 0:
        Sum = Sum + i

print(str(Sum))
Problem p02659 (python)

Fixed submission:
#c
a,b=map(float, input().split())
import math
import decimal
a = decimal.Decimal(a)
b = decimal.Decimal(str(b))
ans = a*b
print(int(ans))

Buggy submission (verdict: Runtime Error):
#c
a,b=map(float, input().split())
import math
a = decimal.Decimal(a)
b = decimal.Decimal(b)
ans = a*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)
else:
    print(a-(k-(a+b)))

Buggy submission (verdict: Runtime Error):
#b
a,b,c,k=map(int, input().split())
test = []
test += [1]*a
test += [0]*b
test += [-1]*c
print(sum(test[0:k]))
Problem p02726 (python)

Fixed submission:
n,x,y=map(int,input().split())
ans=[0]*n #個数を数えるのにバケットを用意する
for i in range(1,n+1): #i<jなるすべての頂点の組について最短距離を求める
    for j in range(i+1,n+1):
        dist1=j-i
        dist2=abs(x-i)+abs(y-j)+1
        dist3=abs(y-i)+abs(x-j)+1
        d=min(dist1,dist2,dist3) #最短距離は上式により求められる
        ans[d]+=1 #最短距離がdとなる組の個数を1増やす
for i in range(1,n):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
#借り物 テスト
ans=[0]*n #個数を数えるのにバケットを用意する
for i in range(1,n+1): 
    for j in range(i+1,n+1):
        dist1=j-i
        dist2=abs(x-i)+abs(y-j)+1
        #dist3=abs(y-i)+abs(x-j)+1
        d=min(dist1,dist2) 
        ans[d]+=1 
for i in range(1,n):
    print(ans[i])
Problem p02729 (python)

Fixed submission:
import math
a,b=map(int, input().split())
answer = 0

if a > 1 :
    answer += math.factorial(a) / (math.factorial(a - 2)*2)

if b > 1:
    answer += math.factorial(b) / (math.factorial(b - 2)*2)

print(int(answer))

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

#偶数2
if a > 1 :
    answer += math.factorial(a) / (math.factorial(a - 2)*2)

#奇数2
if b > 1:
    answer += math.factorial(b) / (math.factorial(b - 2)*2)

print(int(answer))

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

answer = 0

#偶数2
answer += math.factorial(a) / (math.factorial(a - 2)*2)

#奇数2
answer += math.factorial(b) / (math.factorial(b - 2)*2)

print(int(answer))
Problem p02990 (python)

Fixed submission:
n,k=map(int, input().split())
mod = 10**9 + 7
ans = [0]*k
import math
ans[0]=(math.factorial(2+n-k-1) // (math.factorial(2+n-k-1-n+k) * math.factorial(n-k))) %mod

for i in range(1,k):#iは仕切りの数
    spl = math.factorial(k-1) // (math.factorial(k-1- i) * math.factorial(i))#仕切りのパターン
    rest = n-k-i
    if rest < 0:
        break
    if rest == 0:
        ans[i] = spl%mod
    else:
        ans[i] = (spl*(math.factorial(2+i+rest-1) // (math.factorial(2+i-1) * math.factorial(rest))))%mod
for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
n,k=map(int, input().split())
mod = 10**9 + 7
ans = [0]*k
import math
ans[0]=(math.factorial(2+n-k-1) // (math.factorial(2+n-k-1-n+k) * math.factorial(n-k))) %mod

for i in range(1,k):#iは仕切りの数
    spl = math.factorial(k-1) // (math.factorial(k-1- i) * math.factorial(i))#仕切りのパターン
    rest = n-k-i
    print(spl,rest)
    if rest < 0:
        break
    if rest == 0:
        ans[i] = spl%mod
    else:
        ans[i] = (spl*(math.factorial(2+i) // (math.factorial(2+i-rest) * math.factorial(rest))))%mod
for i in ans:
    print(i)
Problem p02688 (python)

Fixed submission:
N,K = map(int,input().split())
S = set()

for k in range(K):
  input()
  S|=set(input().split())

print(N-len(S))

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

for n in range(N):
  input()
  S|=set(input().split())

print(N-len(S))

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

for n in range(N):
	input()
	S|=set(input().split())

print(N-len(S))
Problem p02754 (python)

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

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

while len(S)<=N:
  S+=A*"b"
  S+=B*"r"

print(S[:N].count("b"))
Problem p02951 (python)

Fixed submission:
A,B,C = list(map(int,input().split()))
print(max(C-A+B,0))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))
a = "Yes"

for i in range(N-1):
  if H[i]<H[i+1]:
    pass
  else:
    H[i]-=1

for i in range(N-1):
  if H[i]>H[i+1]:
    a = "No"

print(a)
Problem p03041 (python)

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

li = []

for i in range(n):
    if k-1 == i:
        li.append(s[0][i].lower())
    else:
        li.append(s[0][i])

print(''.join(li))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
S = input()
print(S[:k-1]+S[k-1].lower()+S[k:])
Problem p03075 (python)

Fixed submission:
a = [int(input()) for i in range(5)]
b = int(input())
c = sorted(a)

if c[4]-c[0]<=b:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a = [int(input()) for i in range(5)]
b = int(input())
c = sorted(a)

if c[5]-c[0]<=b:
  print("Yay!")
else:
  print(":(")
Problem p03242 (python)

Fixed submission:
print(input().translate(str.maketrans({"1":"9","9":"1"})))

Buggy submission (verdict: Runtime Error):
import str
print(input().translate(str.maketrans({"1":9,"9":1})))
Problem p03250 (python)

Fixed submission:
a = list(map(int,input().split()))
b = sorted(a)
c = int(str(b[2])+str(b[1]))
print(b[0]+c)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = sorted(a)
c = str(b[2])+str(b[1])
print(b[0]+c)
Problem p03307 (python)

Fixed submission:
a = int(input())

if a%2==0:
  print(a)
else:
  print(2*a)

Buggy submission (verdict: Runtime Error):
if int(input())%2==0:
  print(N)
else:
  print(2*N)
Problem p03327 (python)

Fixed submission:
a = int(input())
if a <= 999:
  print("ABC")
else:
  print("ABD")

Buggy submission (verdict: Runtime Error):
if int(input()) < = 999:
  print("ABC")
else:
  print("ABD")

Buggy submission (verdict: Runtime Error):
a = int(input())
if a < = 999:
  print("ABC")
else:
  print("ABD")
Problem p03631 (python)

Fixed submission:
a = input()
if a[0] == a[2]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c = input().split()
print(["Yes","No"][a!=c])

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

if a[1]<a[2]:
  print(0)
else:
  print(min(a[1],a[3])-max(a[0],a[2]))

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

if a[1]<a[2]:
  print(0)
else:
  print(min(a[1],a[3])-max(a[0],a[2]))
Problem p03775 (python)

Fixed submission:
N = int(input())
a = len(str(N))

for i in range(1,int(N**(1/2))+1):
  if N%i==0:
    a=len(str(N//i))

print(a)

Buggy submission (verdict: Runtime Error):
N = int(input())
x = int(n**.5)
while N%x:
  x-=1

print(len(str(N//x)))

Buggy submission (verdict: Runtime Error):
N = int(input())
x = int(n**.5)
while n%x:
  x-=1

print(len(str(n//x)))

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(n**(1/2))
a = len(str(N))

for i in range(1,k+1):
  if N%i==0:
    a=len(str(n//i))

print(a)
Problem p03804 (python)

Fixed submission:
import numpy as np

N,M = map(int,input().split())
A = np.array([list(input()) for _ in range(N)])
B = np.array([list(input()) for _ in range(M)])

bl = False
for i in range(N-M+1):
  for j in range(N-M+1):
    if (A[i:i+M,j:j+M] == B).all():
      bl = True

answer = 'Yes' if bl else 'No'
print(answer)

Buggy submission (verdict: Runtime Error):
import numpy as np

N,M = map(int,input().split())
A = np.array([list(input()) for i in range(N)])
B = np.array([list(input()) for i in range(M)])
f = 0

for i in range(N-M+1):
  for j in range(N-M+1):
    if (A[i:i+M,j:j+M]==B).all():
      f = 1

if f:
  print("Yes"):
else:
  print("No")
Problem p02689 (python)

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

min = []
for i in range(m):
    a, b = map(int, input().split())
    if h[a-1] < h[b-1]:
        min.append(a)
    if h[a-1] == h[b-1]:
        min.append(a)
        min.append(b)
    if h[a-1] > h[b-1]:
        min.append(b)

print(len(h)-len(set(min)))

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

min = []
for i in range(m):
    a, b = map(int, input().split())
    if h[a] < h[b]:
        min.append(a)
    if h[a] == h[b]:
        min.append(a)
        min.append(b)
    if h[a] > h[b]:
        min.append(b)

print(len(h)-len(set(min)))
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,W = map(int, input().split())
if W>=S:
    print("unsafe")
else:
    print("safe")
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 S[3]==S[4] and S[5]==S[6]:
  print "Yes"
else:
  print "No"
Problem p03774 (python)

Fixed submission:
n, m = map(int, input().split())
al = []
bl = []
for i in range(n):
    a, b = map(int, input().split())
    al.append([a, b])
for j in range(m):
    c, d = map(int, input().split())
    bl.append([c,d])

def check(a,b):
    x = a[0] - b[0]
    y = a[1] - b[1]
    if x < 0:
        x = -x
    if y < 0:
        y = -y
    return x + y

for a in al:
    min = 1000000000
    cnt = 1
    for b in bl:
        tmp = check(a,b)
        if tmp < min:
            ans = cnt
            min = tmp
        cnt += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
al = []
bl = []
for i in range(n):
    a, b = map(int, input().split())
    al.append([a, b])
for j in range(m):
    c, d = map(int, input().split())
    bl.append([c,d])

def check(a,b):
    x = a[0] - b[0]
    y = a[1] - b[1]
    if x < 0:
        x = -x
    if y < 0:
        y = -y
    return x + y

for a in al:
    min = 100000000
    cnt = 1
    for b in bl:
        tmp = check(a,b)
        if tmp < min:
            ans = cnt
            min = tmp
        cnt += 1
    print(ans)
Problem p02627 (python)

Fixed submission:
a = input()
if str.isupper(a):
    print("A")
else:
    print("a")

Buggy submission (verdict: Runtime Error):
eList = [chr(i) for i in range(97, 97+26)]
N = int(input())

n = N
mod = N
numList = []

while n > 0:
    n, mod = divmod(n, 26)
    if mod != 0:
        # 末尾ではなく先頭に追加する
        # 1のくらいから判定して行っているため
        numList.insert(0, mod - 1)
    else:
        numList.insert(0, 25)
        # 26進数のようで26まで数字があるため調整する
        n -= 1

ans = ''
for num in numList:
    ans += eList[num]
print(ans)
Problem p02695 (python)

Fixed submission:
from itertools import combinations_with_replacement as c
N, M, Q = map(int, input().split())
l1 = list(list(map(int, input().split())) for _ in range(Q))
ans = 0

for l2 in c(range(1, M + 1), N):
    total = 0
    for i in range(Q):
        if l2[l1[i][1] - 1] - l2[l1[i][0] - 1] == l1[i][2]:
            total += l1[i][3]
    ans = max(ans, total)

print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import combinations_with_replacement

n,m,q = map(int, input().split())
l = list(list(map(int, input().split())) for i in range(n))
ans = 0

for l2 in combinations_with_replacement(range(1,m+1),n):
    total = 0
    for i in range(q):
        if l2[l[i][1] - 1] - l2[l[i][0] - 1] == l[i][2]:
            total += l[i][3]
    ans = max(ans, total)
print(ans)
Problem p02959 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0

for i in range(n):
    if b[i] >= sum(a[i:i+2]):
        ans += sum(a[i:i+2])
        a[i+1] = 0
    elif a[i] >= b[i]:
        ans += b[i]
    elif a[i] < b[i]:
        ans += b[i]
        a[i+1] -= b[i] - a[i]
print(ans)

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

for i in range(n):
    print(a,b)
    if b[i] >= sum(a[i:i+2]):
        ans += sum(a[i:i+2])
        a[i+1] = 0
    elif a[i] >= b[i]:
        ans += b[i]
    elif a[i] < b[i]:
        ans += b[i]
        a[i+1] -= b[i] - a[i]
print(ans)
Problem p03072 (python)

Fixed submission:
n = int(input())
listNum = [int(x) for x in input().split()]
cnt = 1
big = listNum[0]
for i in range(1,n):
	if(big <= listNum[i]):
		big = listNum[i]
		cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
listNum = [int(x) for x in input.split()]
cnt = 1
big = listNum[0]
for i in range(1,n):
	if(big <= listNum[i]):
		big = listNum[i]
		cnt+=1
print(cnt)
Problem p03135 (python)

Fixed submission:
a,b = [int(x) for x in input().split()]
 
print(round((a/b),10))

Buggy submission (verdict: Runtime Error):
a,b = (int(x) for x in input.split())
 
print(round((a/b),10))

Buggy submission (verdict: Runtime Error):
a,b = [int(x) for x in input.split()]

print(round((a/b),10))
Problem p03208 (python)

Fixed submission:
n,k = map(int, input().split())
ls = [int(input()) for _ in range(n)]
ls.sort()
tmp = 10 ** 9
for i in range(n-k+1):
    diff = ls[i+k-1] - ls[i]
    if diff < tmp:
        tmp = diff
print(tmp)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
ls = k[int(input()) for _ in range(n)]
ls.sort()
tmp = 10 ** 9
for i in range(n-k+1):
    diff = ls[i+k-1] - ls[i]
    if diff < tmp:
        tmp = diff
print(diff)
Problem p03221 (python)

Fixed submission:
n,m = map(int, input().split())
py = [list(map(int, input().split())) + [i] for i in range(m)]
py.sort(key=lambda x: [x[0], x[1]])
ans = []
P = [0] * (n + 1)
for p, y, i in py:
    P[p] += 1
    tmp = str(p).zfill(6) + str(P[p]).zfill(6)
    ans.append([i,tmp])
ans.sort()
for i,a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
py = [[list(map(int, input().split()))] + [i] for i in range(m)]
py.sort(key=lambda x: [x[0], x[1]])
ans = []
P = [0] * (n + 1)
for p, y, i in py:
    P[p] += 1
    tmp = str(p).zfill(6) + str(P[p]).zfill(6)
    ans.append([i,tmp])
ans.sort()
for i,a in ans:
    print(a)
Problem p03774 (python)

Fixed submission:
n,m = map(int, input().split())
ab = []
cd = []
for _ in range(n):
    ab.append(list(map(int, input().split())))

for _ in range(m):
    cd.append(list(map(int, input().split())))

for i in range(n):
    minNum = float('inf')
    ans = 0
    for j in range(m):
        if abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]) < minNum:
            minNum = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
            ans = j + 1
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
ab = []
cd = []
for _ in range(n):
    ab.append(list(map(int, input().split())))

for _ in range(m):
    cd.append(list(map(int, input().split())))

for i in range(n):
    minNum = 10000
    for j in range(m):
        if abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]) < minNum:
            minNum = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
            ans = j + 1
    print(ans)