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

Fixed submission:
X, N = map(int, input().split())
if not N ==0:
  A = [int(x) for x in input().split()]
  index = 0
  value = abs(A[0] - X)
  up_list = [0]*(N+1)
  down_list = [0]*(N+1)

  for i in range(N):
    if abs(A[i] - X ) < N+1:
      if A[i] - X >= 0:
        up_list[A[i]-X] = 1
      if A[i] - X <= 0:
        down_list[abs(A[i]- X)] = 1

  j = 0
  while True:
    if down_list[j] == 0:
      print(X-j)
      break
    if up_list[j] ==0:
      print(X+j)
      break
    if j>N+1:
      print('fail')
      break
    j+=1

else:
  print(X)

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

index = 0
value = abs(A[0] - X)
up_list = [0]*(N+1)
down_list = [0]*(N+1)

for i in range(N):
  if abs(A[i] - X ) < N+1:
    if A[i] - X >= 0:
      up_list[A[i]-X] = 1
    if A[i] - X <= 0:
      down_list[abs(A[i]- X)] = 1

j = 0
while True:
  if down_list[j] == 0:
    print(X-j)
    break
  if up_list[j] ==0:
    print(X+j)
    break
  if j>N+1:
    print('fail')
    break
  j+=1

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

index = 0
value = abs(A[0] - X)
up_list = [0]*(N+1)
down_list = [0]*(N+1)

for i in range(N):
  if abs(A[i] - X ) < N+1:
    if A[i] - X >= 0:
      up_list[A[i]-X] = 1
    if A[i] - X <= 0:
      down_list[abs(A[i]- X)] = 1

j = 0
while True:
  if up_list[j] ==0:
    print(X+j)
    break
  if down_list[j] == 0:
    print(X-j)
    break
  if j>N+1:
    print('fail')
    break
  j+=1
Problem p02783 (python)

Fixed submission:
h, a = list(map(int, input().split()))
b = int(h/a)
if b == h/a:
  print(b)
else:
  print(b + 1)

Buggy submission (verdict: Runtime Error):
h, n = list(map(int, input().split()))
lst = list(map(int, input().split()))
sum = 0
for _ in range(n):
  sum += lst[_]
if sum >= h:
  print('Yes')
else:
  print('No')
Problem p02802 (python)

Fixed submission:
N, M = list(map(int, input().split()))
lst = [input().split() for lst in range(M)]
pn = 0
lst_pn = []
lst_cr = []
for _ in range(N):
  lst_pn.append(0)
  lst_cr.append(0)
cr = 0
for i in lst:
  a = int(i[0])
  if lst_cr[a-1] == 1:
    continue
  elif i[1] == "WA":
    lst_pn[a-1] += 1
  elif i[1] == "AC":
    cr += 1
    lst_cr[a-1] += 1
    pn += lst_pn[a-1]
print(cr, pn)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
lst = [input().split() for lst in range(M)]
lst.sort(key=lambda x: x[0])
pn = 0
temp_pn = [] 
for _ in range(M):
  temp_pn.append(0)
cr = 0
plbnum = 0
for i in lst:
  a = int(i[0])
  if N >=  a > plbnum:
    if i[1] == "WA":
      temp_pn[a-1] += 1
    elif i[1] == "AC":
      cr += 1
      pn += temp_pn[a-1]
      plbnum = a
print(cr, pn)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
lst = [input().split() for lst in range(M)]
lst.sort(key=lambda x: x[0])
pn = 0
temp_pn = [] 
for _ in range(M):
  temp_pn.append(0)
cr = 0
plbnum = 0
for i in lst:
  a = int(i[0])
  if N >=  a > plbnum:
    if i[1] == "WA":
      temp_pn[a] += 1
    elif i[1] == "AC":
      cr += 1
      pn += temp_pn[a-1]
      plbnum = a
print(cr, pn)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
lst = [input().split() for lst in range(M)]
lst.sort(key=lambda x: x[0])
pn = 0
temp_pn = [] 
for _ in range(M):
  temp_pn.append(0)
cr = 0
plbnum = 0
for i in lst:
  a = int(i[0])
  if N >=  a > plbnum:
    if i[1] == "WA":
      temp_pn[a] += 1
    elif i[1] == "AC":
      cr += 1
      pn += temp_pn[a-1]
      plbnum = a
print(cr, pn)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
lst = [input().split() for lst in range(M)]
lst.sort(key=lambda x: x[0])
pn = 0
temp_pn = [] 
for _ in range(M):
  temp_pn.append(0)
cr = 0
plbnum = 0
for i in lst:
  a = int(i[0])
  if N >=  a > plbnum:
    if i[1] == "WA":
      temp_pn[a] += 1
    elif i[1] == "AC":
      cr += 1
      pn += temp_pn[a]
      plbnum = a
print(cr, pn)
Problem p02817 (python)

Fixed submission:
a, b = input().split()
print(b+a)

Buggy submission (verdict: Runtime Error):
primes=[2]
x = int(input())
if x == 2:
  print(x)
else:
  i = 3
  while True:
    for p in primes:
      if i % p == 0:
        break
    else:
      primes.append(i)
      if x <= i:
        break
    i+=1
  print(primes[-1])
Problem p02761 (python)

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

ans = list(' '*n)

for i in range(m):
  a, b = map(int, input().split())
  
  if n != 1 and a==1 and b ==0:
    print(-1)
    exit()
  if ans[a-1] != ' ' and ans[a-1] != str(b):
    print(-1)
    exit()
    
  ans[a-1] = str(b)

if ans[0] == ' ' and n != 1:
  ans[0] = '1'
ans = ''.join(ans)

print(int(ans.replace(' ', '0')))

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

ans = list('0'*m)

for i in range(m):
  a, b = map(int, input().split())
  
  if a==1 and b ==0:
    print(-1)
    exit()
  if ans[a-1] != '0' and ans[a-1] != str(b):
    print(-1)
    exit()
    
  ans[a-1] = str(b)

ans = int(''.join(ans))
print(ans)
Problem p02767 (python)

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

min_ = min(list)
max_ = max(list)

total = []
if min_ == max_:
  print(0)
else:
  for i in range(min_, max_):
    length = 0
    for j in range(n):
  	  length += (list[j] - i)**2
    total.append(length)
  print(min(total))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

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

min_ = min(list)
max_ = max(list)

total = []
for i in range(min_, max_):
  length = 0
  for j in range(n):
  	length += (list[j] - i)**2
  total.append(length)
print(min(total))

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

min_ = min(list)
max_ = max(list)

total = []
for i in range(min_, max_):
  length = 0
  for j in range(n):
  	length += (list[j] - i)**2
  total.append(length)
print(min(total))
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().split())
nums = list(map(int, input().split()))
 
sum_max = sum(nums[:k])
temp = sum_max
for i in range(k,n):
  temp -= nums[i-k]
  temp += nums[i]
  sum_max = max(temp, sum_max)
print((sum_max +k)/2)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
nums = list(map(int, input().split()))
 
sum_max = sum(nums[:k])
for i in range(k,n):
  temp -=nums[i-k]
  temp +=nums[i]
  sum = max(temp, sum)
print((sum_max +k)/2)

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

e_nums = [(i+1)/2 for i in nums]

sum_e = [sum(e_nums[i:i+k]) for i in range(n) if i+k <= n-1]

print(max(sum_e))
Problem p02612 (python)

Fixed submission:
# cook your dish here
n=int(input())
if n%1000==0 :
    print(0)
else :
    print(1000-(n%1000))

Buggy submission (verdict: Runtime Error):
#include<iostream>
using namespace std;
int main(){
    long int n;
    cin>>n;
    long int a=0,w=0,r=0,t=0;
    while(n--){
        string s;
        cin>>s;
        if(s=="AC")
        a+=1;
        else if(s=="WA")
        w+=1;
        else if(s=="TLE")
        t+=1;
        else
        r+=1;
    }
    cout<<"AC "<<"* "<<a<<endl;
    cout<<"WA "<<"* "<<w<<endl;
    cout<<"TLE "<<"* "<<t<<endl;
    cout<<"RA "<<"* "<<r<<endl;
    return 0;
}
Problem p02608 (python)

Fixed submission:
a=[0]*int(input())
r=range(1,99)
for x in r:
    for y in r:
        for z in r:
            n=x*(x+y+z)+y*(y+z)+z*z-1
            if n<len(a):
                a[n]+=1
print(*a)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
for i in range(1,N+1):
    print(sum(1 for x in range(1,int(math.sqrt(i))) for y in range(1,int(math.sqrt(i))) for z in ra
Problem p02609 (python)

Fixed submission:
def popcount(n):
    return bin(n).count('1')
    
N=int(input())
X=input()
xl=list(X)
X=int(X,2)
a=popcount(X)
#1が減った時
if a==1:
    xd=0
else:
    xd=X%(a-1)
#1が増えたとき
xi=X%(a+1)

for i in range(N):
    if xl[i]=='1':
        if a==1:
            print(0)
            continue
        else:
            k=pow(2,N-1-i,a-1)
            x=(xd-k)%(a-1)
    else:
        k=pow(2,N-1-i,a+1)
        x=(xi+k)%(a+1)
    count=1
    while x!=0:
        x%=popcount(x)
        count+=1
    print(count)

Buggy submission (verdict: Runtime Error):
import heapq as hq

T = int(input())
for _ in range(T):
    N = int(input())
    camels = [list(map(int, input().split())) for _ in range(N)]
    base = 0
    camels_L = [[] for _ in range(N+1)]
    camels_R = [[] for _ in range(N+1)]
    # 左から詰めるラクダと右から詰めるラクダを仕分ける
for camel in camels:
    if camel[1] >= camel[2]:
        camels_L[camel[0]].append(camel[1] - camel[2])
        base += camel[2] # LとRの低いほうを加算
    else:
        # Rラクダは右から何列目かを考えるのでN - camel[0]と反転する
        camels_R[N - camel[0]].append(camel[2] - camel[1])
        base += camel[1] # LとRの低いほうを加算

diff = 0

# Lラクダについて考える
heap_camels = []
hq.heapify(heap_camels)
for i in range(1, N+1):
    # 左からi番目までが限度のラクダをまとめて追加
    for camel in camels_L[i]:
        hq.heappush(heap_camels, camel)
        # 左からi番目までに入りきらない場合に低いものから除外
    while len(heap_camels) > i:
        hq.heappop(heap_camels)
        # heapqに残ったものがすべての条件を満たしうれしさが最大
    diff += sum(heap_camels)

        # Rラクダについても同様
heap_camels = []
hq.heapify(heap_camels)
for i in range(1, N+1):
    for camel in camels_R[i]:
        hq.heappush(heap_camels, camel)
    while len(heap_camels) > i:
        hq.heappop(heap_camels)
diff += sum(heap_camels)
print(diff + base)

Buggy submission (verdict: Runtime Error):
a = [input() for i in range(2)]
def popcount(n):
    count=0
    while n!=0:
        if n%2==1:
            count+=1
        n=int(n/2)
    return count

def f(n):
    c=0
    while n!=0:
        n=int(n%popcount(n))
        c+=1
    print(c)

b=[]
for i in range(int(a[0])):
    k=0
    b=list(a[1])
    if b[i]=='0':
        b[i]='1'
    else :
        b[i]='0'
    for j in range(int(a[0])):
        k = k*2 + int(b[j])
    f(k)

Buggy submission (verdict: Runtime Error):
a = [input() for i in range(2)]
def popcount(n):
    count=0
    while n!=0:
        if n%2==1:
            count+=1
        n=int(n/2)
    return count

def f(n):
    c=0
    while n!=0:
        n=int(n%popcount(n))
        c+=1
    print(c)

b=[]
for i in range(int(a[0])):
    k=0
    b=list(a[1])
    if b[i]=='0':
        b[i]='1'
    else :
        b[i]='0'
    for j in range(int(a[0])):
        k = k*2 + int(b[j])
    f(k)

Buggy submission (verdict: Runtime Error):
a = [input() for i in range(2)]
def popcount(n):
    count=0
    while n!=0:
        if n%2==1:
            count+=1
        n=int(n/2)
    return count

def f(n):
    c=0
    while n!=0:
        n=int(n%popcount(n))
        c+=1
    print(c)

b=[]
for i in range(int(a[0])):
    k=0
    b=list(a[1])
    if b[i]=='0':
        b[i]='1'
    else :
        b[i]='0'
    for j in range(int(a[0])):
        k = k*2 + int(b[j])
    f(k)
Problem p02582 (python)

Fixed submission:
S = input()
res, prev, count = 0, '', 0
for s in S:
  if s == 'R':
    count += 1
  else:
    res = max(res, count)
    count = 0
print(max(res, count))

Buggy submission (verdict: Runtime Error):
res, prev, count = 0, '', 0
for s in S:
  if s == 'R':
    count += 1
  else:
    res = max(res, count)
    count = 0
res = max(res, count)
return res
Problem p02747 (python)

Fixed submission:
S = input()
if len(S) % 2 == 1:
  print("No")
else:
  while (len(S) != 0):
    if S[0] == 'h' and S[1] == 'i':
      S = S[2:]
    else:
      break
  if len(S) != 0:
    print("No")
  else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
S = input()
if len(S) == 1:
  print("No")
else:
  while (len(S) != 0):
    if S[0] == 'h' and S[1] == 'i':
      S = S[2:]
    else:
      break
  if len(S) != 0:
    print("No")
  else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
S = input();
while (len(S) != 0):
  if S[0] == 'h' and S[1] == 'i':
    S = S[2:]
  else:
    break
if len(S) != 0:
  print("No")
else:
  print("Yes")
Problem p02630 (python)

Fixed submission:
#D                 more faster method than above               see it ..........
l = lambda : list(map(int,input().strip().split()))
n = int(input())
a = l()
t = [0]*(10**5+1)
s = 0
for i in a:
    s += i
    t[i] += 1
q = int(input())
for _ in range(q):
    b,c = l()
    s += (c-b)*t[b]
    t[c] += t[b]
    t[b] = 0
    print(s)

Buggy submission (verdict: Runtime Error):
#D                 more faster method than above               see it ..........
l = lambda : list(map(int,input().split().strip()))
n = int(input())
a = l
t = [0]*(10**5+1)
s = 0
for i in a:
    s += i
    t[i] += 1
q = int(input())
for _ in range(q):
    b,c = l
    s += (c-b)*t[b]
    t[c] += t[b]
    t[b] = 0
    print(s)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
mp = defaultdict(int)
for i in a:
    mp[i] += 1
q = int(input())
for _ in range(q):
    #print(mp)
    s = 0   
    b,c=map(int,input().split())
    if c in mp:
        mp[c] = mp[c]+mp[b]
        mp.pop(b)
    else:
        mp[c] = mp.pop(b)
    for i in mp:
        s += (mp[i])*i
    print(s)
Problem p02718 (python)

Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse=True)
S = sum(A)
if A[M-1] >= S / (4*M):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
arr = list(map(int,input().split()))
s = sum(arr)
a = (s//(4*M))
c = 0
for i in range(n):
    if arr[i]>a:
        c +=1
if c==m:
    print('YES')
else:
    print('NO')
Problem p02830 (python)

Fixed submission:
n = int(input())
s,t = map(str,input().split())
a = ''
for i in range(n):
    a = a+s[i]+t[i]
print(a)

Buggy submission (verdict: Runtime Error):
n = int(input())
s,t = map(str,input().split())
a = ''
for i in range(n):
    a = a[i]+s[i]+t[i]
print(a)

Buggy submission (verdict: Runtime Error):
n = int(input())
s,t = map(str,input().split())
a = ""
for i in range(n):
    a = a[i]+s[i]+t[i]
print(a)
Problem p02921 (python)

Fixed submission:
def compare(a, b):
    c=0
    for x, y in zip(a, b):
        if x == y:
          c += 1
    return c
x = input()
y = input()
print(compare(x,y))

Buggy submission (verdict: Runtime Error):
def compare(a, b):
  	c=0
    for x, y in zip(a, b):
        if x == y:
          c += 1
x = input()
y = input()
compare(x,y)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c== 0
if a[0] = b[0]:
  c = c+1
if a[1] = b[1]:
  c= c+1
ifa[2] = b[2]:
  c= c+1
print(c)
Problem p02630 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
q=int(input())
b=[0]*q
c=[0]*q
for i in range(q):
  b[i],c[i]=map(int,input().split())

s=sum(a)

#このコードはO(10**10)になる可能性があり、重すぎる
"""
for i in range(q):
  while b[i] in a:
    s+=c[i]-b[i]
    a.remove(b[i])
    a.append(c[i])
  print(s)
"""

cnt_list=[0]*(10**5+1)
for i in range(n):
  cnt_list[a[i]]+=1

for i in range(q):
  s+=(c[i]-b[i])*cnt_list[b[i]]
  cnt_list[c[i]]+=cnt_list[b[i]]
  cnt_list[b[i]]=0
  print(s)

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

s=sum(a)

#このコードはO(10**10)になる可能性があり、重すぎる
"""
for i in range(q):
  while b[i] in a:
    s+=c[i]-b[i]
    a.remove(b[i])
    a.append(c[i])
  print(s)
"""

cnt_list=[0]*(10**5)
for i in range(n):
  cnt_list[a[i]]+=1

for i in range(q):
  s+=(c[i]-b[i])*cnt_list[b[i]]
  cnt_list[c[i]]+=cnt_list[b[i]]
  cnt_list[b[i]]=0
  print(s)
Problem p02717 (python)

Fixed submission:
x,y,z=map(int,input().split())
print(z,x,y)

Buggy submission (verdict: Runtime Error):
x,y,z=map(int,imput().split())
print(z,x,y)

Buggy submission (verdict: Runtime Error):
x,y,z=map(int,imput().split())
print(z,x,y)

Buggy submission (verdict: Runtime Error):
x,y,z=map(int,imput().split())
print(z+' '+x+' '+y)
Problem p02724 (python)

Fixed submission:
x=int(input())
a=x//500*1000
b=(x-x//500*500)//5*5
print(a+b)

Buggy submission (verdict: Runtime Error):
x=int(input())
a=x//500*1000
b=(x-x//500*500)//5*5
input(a+b)
Problem p02765 (python)

Fixed submission:
n,r=map(int,input().split())
if n>=10:
    print(r)
else:
    print(r+100*(10-n))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
import math
print(1+math.floor(math.log(n,k)))
Problem p02778 (python)

Fixed submission:
s=len(input())
print('x'*s)

Buggy submission (verdict: Runtime Error):
s=len(input())
print(x*s)
Problem p02814 (python)

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

import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
x=1
for i in range(n):
  x=lcm(x,a[i]//2)

power=[0]*n
for i in range(n):
  while a[i]%2==0:
    a[i]//=2
    power[i]+=1
    
if power.count(power[0])==n:  
  print((m+x)//(2*x))
else:
  print(0)

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

import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

power=[0]*n
for i in range(n):
  while a[i]%2==0:
    a[i]//=2
    power[i]+=1
    
if power.count(power[0])==n:
  x=1
  for i in range(n):
    x=lcm(x,a[i]//2)

  print((m+x)//(2*x))
else:
  print(0)
Problem p02909 (python)

Fixed submission:
d={'Sunny':'Cloudy','Cloudy':'Rainy','Rainy':'Sunny'}
s=input()
print(d[s])

Buggy submission (verdict: Runtime Error):
d={'Sunny':'Cloudy','Cloudy':'Rainy','Rainy':Sunny'}
s=input()
print(d[s])
Problem p02922 (python)

Fixed submission:
a,b=map(int,input().split())
if b==1:
    print(0)
elif a<b:
    x=(b-1)//(a-1)
    if (b-1)%(a-1)==0:
        print(x)
    else:
        print(x+1)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if b==1:
    print(0)
elif a<b:
    x=(b-1)//(a-1)
    if (b-1)%(a-1)==0:
        print(x)
     else:
        print(x+1)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if b==1:
    print(0)
elif a<b:
    print(b//a+1)
elif a=b:
    print(b//a)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if b==1:
    print(0)
elif a<b:
    print(b//a+1)
elif a=b:
    priint(b//a)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if b==1:
    print(0)
elif a<b:
    print(b//a+1)
elif a==B:
    priint(b//a)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if b==1:
    print(0)
elif a<b:
    print(b//a+1)
elif a=B:
    priint(b//a)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a!=b:
    print(b//a+1)
else:
    priint(b//a)
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
if (a+b)%2==0:
    print((a+b)//2)
else:
    print('IMPOSSIBLE')

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

cnt=0

for i in range(n):
  if a[n-i]>=b[n-1-i]:
    cnt+=b[n-1-i]
  else:    
    if a[n-1-i]-(b[n-1-i]-a[n-i])>=0:
      a[n-1-i]-=b[n-1-i]-a[n-i]
      cnt+=b[n-1-i]
    else:
      cnt+=a[n-i]+a[n-1-i]
      a[n-1-i]=0
      
print(cnt)
Problem p02996 (python)

Fixed submission:
import numpy as np
n=int(input())
a=[0]*n
b=[0]*n
for i in range(n):
  a[i],b[i]=map(int,input().split())

flag=True
sum=0
sorted_index=np.argsort(b)
for i in sorted_index:
  sum+=a[i]
  if sum>b[i]:
    flag=False
    break
    
if flag:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=[0]*n
b=[0]*n
for i in range(n):
  a[i],b[i]=map(int,input().split())

flag=True
sum=0
sorted_index=np.argsort(b)
for i in sorted_index:
  sum+=a[i]
  if sum>b[i]:
    flag=False
    break
    
if flag:
  print('Yes')
else:
  print('No')
Problem p03547 (python)

Fixed submission:
x,y=input().split()
if x>y:
    print('>')
elif x==y:
    print('=')
else:
    print('<')

Buggy submission (verdict: Runtime Error):
x,y=input().split()
if x>y:
    print('>')
elif x=y:
    print('=')
else:
    print('<')
Problem p02600 (python)

Fixed submission:
x = int(input())

if 400 <= x < 600:
    print('8')
elif 600 <= x < 800:
    print('7')
elif 800 <= x < 1000:
    print('6')
elif 1000 <= x < 1200:
    print('5')
elif 1200 <= x < 1400:
    print('4')
elif 1400 <= x < 1600:
    print('3')
elif 1600 <= x < 1800:
    print('2')
elif 1800 <= x < 2000:
    print('1')

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

x = int(input())

if 400 <= x < 600:
    print('8')
elif 600 <= x < 800:
    print('7')
elif 800 <= x < 1000:
    print('6')
elif 1000 <= x < 1200:
    print('5')
elif 1200 <= x < 1400:
    print('4')
elif 1400 <= x < 1600:
    print('3')
elif 1600 <= x < 1800:
    print('2')
elif 1800 <= x < 2000:
    print('1')
Problem p02602 (python)

Fixed submission:
N, K = [int(n) for n in input().split()]
scores = [int(n) for n in input().split()]
min_pointer = 0
max_pointer = K
for i, score in enumerate(scores, start=1):
    if i > K:
        if scores[max_pointer] > scores[min_pointer]:
            print('Yes')
        else:
            print('No')
        min_pointer += 1
        max_pointer += 1

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

H, W, K = [int(n) for n in input().split()]
arr = np.zeros((H, W))
count = 0

for h in range(H):
    row = input()
    arr[h, :] = np.array([0 if mark=='.' else 1 for mark in row])

for row_onehot, col_onehot in product(product(range(2), repeat=H), product(range(2), repeat=W)):
    row_indexes = np.argwhere(np.array(row_onehot)==1).flatten()
    col_indexes = np.argwhere(np.array(col_onehot)==1).flatten()
    arr_ = arr.copy()
    for row_idx in row_indexes:
        arr_[row_idx, :] = 0
    for col_idx in col_indexes:
        arr_[:, col_idx] = 0
    if arr_.sum() == K:
        count += 1

print(count)

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

H, W, K = [int(n) for n in input().split()]
arr = np.zeros((H, W))
count = 0

for h in range(H):
    row = input()
    arr[h, :] = np.array([0 if mark=='.' else 1 for mark in row])

for row_onehot, col_onehot in product(product(range(2), repeat=H), product(range(2), repeat=W)):
    row_indexes = np.argwhere(np.array(row_onehot)==1).flatten()
    col_indexes = np.argwhere(np.array(col_onehot)==1).flatten()
    arr_ = arr.copy()
    for row_idx in row_indexes:
        arr_[row_idx, :] = 0
    for col_idx in col_indexes:
        arr_[:, col_idx] = 0
    if arr_.sum() == K:
        count += 1

print(count)
Problem p02612 (python)

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

Buggy submission (verdict: Runtime Error):
m = input()
print(m % 1000)