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

Fixed submission:
D, T, S = map(int,input().split())
if D / S <= T:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
pairs = []
for i in [0]*M:
    inp = sorted(list(map(int,input().split())))
    if inp not in pairs:
        pairs.append(inp)
def solver(N,M,pairs):
    group_list = []
    max_len = 1
    for i in pairs:
        pair = sorted(i)
        for j in range(len(group_list)):
            if pair[1] in group_list[j]:
                break
            elif pair[0] in group_list[j]:
                group_list[j].append(pair[1])
                if max_len < len(group_list[j]):
                    max_len = len(group_list[j])
                break
        else:
            if max_len < 2:
                max_len = 2
            group_list.append(pair)
    return max_len
print(solver(N,M,pairs))
Problem p03834 (python)

Fixed submission:
print(input().replace(',', ' '))

Buggy submission (verdict: Runtime Error):
#入力
input = input()

#リスト化
exec('lst = [' + input + ']')

#出力
print(lst[0], lst[1], lst[2], sep=' ')
Problem p02580 (python)

Fixed submission:
h, w, m = (int(x) for x in input().split())
bomb = {}
bomb_h = [0]*h
bomb_w = [0]*w
for i in range(m):
    hm, wm = (int(x) for x in input().split())
    hm-=1
    wm-=1
    bomb[(hm, wm)] = 0
    bomb_h[hm]+=1
    bomb_w[wm]+=1
h_kouho = []
w_kouho = []
h_max = max(bomb_h)
w_max = max(bomb_w)
for i in range(h):
    if bomb_h[i]==h_max:
        h_kouho.append(i)
for i in range(w):
    if bomb_w[i]==w_max:
        w_kouho.append(i)
boo = False
for i in h_kouho:
    for j in w_kouho:
        if (i, j) not in bomb:
            boo=True
            break
    else:
        continue
    break
if boo:
    print(h_max+w_max)
else:
    print(h_max+w_max-1)

Buggy submission (verdict: Runtime Error):
h, w, m = (int(x) for x in input().split())
bomb = [[0]*w for i in range(h)]
bomb_h = [0]*h
bomb_w = [0]*w
for i in range(m):
    hm, wm = (int(x) for x in input().split())
    hm-=1
    wm-=1
    bomb[hm][wm] = 1
    bomb_h[hm]+=1
    bomb_w[wm]+=1
h_kouho = []
w_kouho = []
h_max = max(bomb_h)
w_max = max(bomb_w)
for i in range(h):
    if bomb_h[i]==h_max:
        h_kouho.append(i)
for i in range(w):
    if bomb_w[i]==w_max:
        w_kouho.append(i)
boo = False
for i in h_kouho:
    for j in w_kouho:
        if bomb[i][j]==0:
            boo=True
            break
    else:
        continue
    break
if boo:
    print(h_max+w_max)
else:
    print(h_max+w_max-1)

Buggy submission (verdict: Runtime Error):
h, w, m = (int(x) for x in input().split())
bomb = [[0]*w for i in range(h)]
bomb_h = [0]*h
bomb_w = [0]*w
for i in range(m):
    hm, wm = (int(x) for x in input().split())
    hm-=1
    wm-=1
    bomb[hm][wm] = 1
    bomb_h[hm]+=1
    bomb_w[wm]+=1
h_kouho = []
w_kouho = []
h_max = max(bomb_h)
w_max = max(bomb_w)
for i in range(h):
    if bomb_h[i]==h_max:
        h_kouho.append(i)
for i in range(w):
    if bomb_w[i]==w_max:
        w_kouho.append(i)
boo = False
for i in h_kouho:
    for j in w_kouho:
        if bomb[i][j]==0:
            break
            boo=True
    else:
        continue
    break
if boo:
    print(h_max+w_max)
else:
    print(h_max+w_max-1)

Buggy submission (verdict: Runtime Error):
h, w, m = (int(x) for x in input().split())
bomb = [[0]*w for i in range(h)]
bomb_h = [0]*h
bomb_w = [0]*w
for i in range(m):
    hm, wm = (int(x) for x in input().split())
    hm-=1
    wm-=1
    bomb[hm][wm] = 1
    bomb_h[hm]+=1
    bomb_w[wm]+=1
h_kouho = []
w_kouho = []
h_max = max(bomb_h)
w_max = max(bomb_w)
for i in range(h):
    if bomb_h[i]==h_max:
        h_kouho.append(i)
for i in range(w):
    if bomb_w[i]==w_max:
        w_kouho.append(i)
bool = False
for i in h_kouho:
    for j in w_kouho:
        if bomb[i][j]==0:
            bool=True
if bool:
    print(h_max+w_max)
else:
    print(h_max+w_max-1)
Problem p02597 (python)

Fixed submission:
n = int(input())
c = input()
r=0
w=0
p=0
count = 0
for i in range(len(c)):
    if c[i]=="R":
        r+=1
    else:
        w+=1
white = []

for i in range(len(c)):
    if c[i]=="R":
        r-=1
        
    else:
        white.append(r)
    if r==0:
        break
if len(white)==0:
    print(0)
elif white[0]==0:
    print(0)
else:
    for i in range(len(white)):
        if white[-i-1]>=len(white)-i:
            print(len(white)-i)
            break

Buggy submission (verdict: Runtime Error):
n = int(input())
c = input()
r=0
w=0
p=0
count = 0
for i in range(len(c)):
    if c[i]=="R":
        r+=1
    else:
        w+=1
white = []

for i in range(len(c)):
    if c[i]=="R":
        r-=1
        
    else:
        white.append(r)
    if r==0:
        break
if len(white)==0:
    print(0)
if white[0]==0:
    print(0)
else:
    for i in range(len(white)):
        if white[-i-1]>=len(white)-i:
            print(len(white)-i)
            break

Buggy submission (verdict: Runtime Error):
n = int(input())
c = input()
r=0
w=0
p=0
count = 0
for i in range(len(c)):
    if c[i]=="R":
        r+=1
    else:
        w+=1
white = []

for i in range(len(c)):
    if c[i]=="R":
        r-=1
        
    else:
        white.append(r)
    if r==0:
        break
if len(white)==0:
    print(0)
if white[0]==0:
    print(0)
else:
    for i in range(len(white)):
        if white[-i-1]>=len(white)-i:
            print(len(white)-i)
            break
print(white)
Problem p02753 (python)

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

Buggy submission (verdict: Runtime Error):
s=input()
if s==ABA:
	print("Yes")
else:
	print()

Buggy submission (verdict: Runtime Error):
s=input()
if s=ABA:
	print("Yes")
else:
	print()
Problem p02771 (python)

Fixed submission:
a,b,c = (int(x) for x in input().split())
co = 0
if a==b:
	if a!=c:
		co=1
elif a==c:
	if a!=b:
		co=1
elif b==c:
	if a!=b:
		co=1
if co==1:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
n,k=(int(x) for x in input().split())
list1 = list(map(int, input().split()))
list1.sort()
list2 = [n-1]*n
list3=[]
for j in range(n):
	list3.append(list1[j]*list1[list2[j]])
for j in range(k):
	max1=list3.index(max(list3))
	list2[max1]-=1
	list3[max1]=list1[max1]*list2[max1]
print(list3[max1])
Problem p02785 (python)

Fixed submission:
n,k = (int(x) for x in input().split())
list = list(map(int,input().split()))
if n>k:
	list2=sorted(list)
	print(sum(list2[:n-k]))
else:
	print(0)

Buggy submission (verdict: Runtime Error):
h,k = (int(x) for x in input().split())
list = list(map(int,input().split()))
for i in range(k):
	list.remove(max(list))
print(sum(list))
Problem p02860 (python)

Fixed submission:
import sys
sys.setrecursionlimit(int(1e6))

N = int(input())
S = input()

if N % 2:
    print('No')
    exit()

n = N // 2
T = S[0:n]
if S == (T + T):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys
#input = sys.stdin.readline
input = sys.stdin.readline().rstrip()

n=int(input())
s=input()
s1=s[:n//2]
s2=s[n//2:]
if s1==s2:
    print("Yes")
else:
    print("No")
Problem p02912 (python)

Fixed submission:
import sys
sys.setrecursionlimit(int(1e6))

import heapq

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
h_A = []
for a in A:
    heapq.heappush(h_A, -a)

for _ in range(M):
    x = heapq.heappop(h_A)
    heapq.heappush(h_A, -(-x // 2))

prices = [- heapq.heappop(h_A) for _ in range(N)]
print(sum(prices))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(int(1e6))
import math

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

if N > M:
    A.sort(reverse=True)
    A1 = A[0:M]
    A2 = A[M:]
    for _ in range(M):
        i = A1.index(max(A1))
        A1[i] = A1[i] // 2
    print(sum(A1, A2))
else:
    for _ in range(M):
        i = A.index(max(A))
        A[i] = A[i] // 2
    print(sum(A))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(int(1e6))
import math

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

if N > M:
    A.sort(reverse=True)
    A1 = A[0:M]
    A2 = A[M:]
    for _ in range(M):
        i = A1.index(max(A2))
        A1[i] = A1[i] // 2
    print(sum(A1, A2))
else:
    for _ in range(M):
        i = A.index(max(A))
        A[i] = A[i] // 2
    print(sum(A))
Problem p02597 (python)

Fixed submission:
n=int(input())
s=input()
s2=sorted(s)
t=0
for i in range(n):
  if s[i]!=s2[i]:
    t+=1
print(t//2)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input().split()
s2=sorted(s)
t=0
for i in range(n):
  if s[i]!=s2[i]:
    t+=1
print(t)
Problem p02847 (python)

Fixed submission:
s=input()
if s=="SUN":
  print(7)
if s=="MON":
  print(6)
if s=="TUE":
  print(5)
if s=="WED":
  print(4)
if s=="THU":
  print(3)
if s=="FRI":
  print(2)
if s=="SAT":
  print(1)

Buggy submission (verdict: Runtime Error):
s=input()
if s=="SUN"
  print(7)
if s=="MON"
  print(6)
if s=="TUE"
  print(5)
if s=="WED"
  print(4)
if s=="THU"
  print(3)
if s=="FRI"
  print(2)
if s=="SAT"
  print(1)

Buggy submission (verdict: Runtime Error):
s=input()
if s=='SUN'
  print(7)
if s=='MON'
  print(6)
if s=='TUE'
  print(5)
if s=='WED'
  print(4)
if s=='THU'
  print(3)
if s=='FRI'
  print(2)
if s=='AST'
  print(1)

Buggy submission (verdict: Runtime Error):
s=input()
if s='SUN'
  print(7)
if s='MON'
  print(6)
if s='TUE'
  print(5)
if s='WED'
  print(4)
if s='THU'
  print(3)
if s='FRI'
  print(2)
if s='AST'
  print(1)
Problem p02859 (python)

Fixed submission:
print(int(input())**2)

Buggy submission (verdict: Runtime Error):
print(int(input()**2))

Buggy submission (verdict: Runtime Error):
print(int(input()**2)
Problem p02987 (python)

Fixed submission:
S=input()
sum=[0,0,0,0]
for t in range(4):
    for i in range(4):
        if S[int(t)]==S[int(i)]:
            sum[int(i)]+=1
if sum[0] == 2 and sum[1] == 2 and sum[2] == 2 and sum[3] == 2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))
dd=sorted(d)
N=dd[n-1]
sum1=0
sum2=0
count=0
for k in range(N+1):
    for i in range(n):
        if d[i]>=k:
            sum1+=1
    if sum1==n-sum1:
        count+=1
    sum1=0
    sum2=0
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))
dd=sorted(d)
N=dd[n-1]
sum1=0
sum2=0
count=0
for k in range(N+1):
    for i in range(n):
        if d[i]>=k:
            sum1+=1
        else:
            sum2+=1
    if sum1==sum2:
        count+=1
    sum1=0
    sum2=0
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))
dd=sorted(d)
N=dd[n-1]
sum1=0
sum2=0
count=0
for k in range(N+1):
    for i in range(n):
        if d[i]>=k:
            sum1+=1
        else:
            sum2+=1
    if sum1==sum2:
        count+=1
    sum1=0
    sum2=0
print(count)
Problem p03041 (python)

Fixed submission:
N,K=list(map(int,input().split()))
S=list(input())
if S[K-1]=='A':
    S[K-1]="a"
if S[K-1]=='B':
    S[K-1]='b'
if S[K-1]=='C':
    S[K-1]='c'
print(''.join(S))

Buggy submission (verdict: Runtime Error):
N,K=list(map(int,input().split()))
S=input()
if S[K-1]=='A':
    S[K-1]='a'
if S[K-1]=='B':
    S[K-1]='b'
if S[K-1]=='C':
    S[K-1]='c'
print(S)
Problem p03075 (python)

Fixed submission:
a,b,c,d,e,k=[int(input()) for _ in range(6)]
if e-a>k:
    print(':(')
else:
    print('Yay!')

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,k=[input() for _ in range(6)]
if a-e<=k:
    print(':(')
else:
    print('Yay!')
Problem p03631 (python)

Fixed submission:
a=input()
b=""
for i in range(1,len(a)+1):
  b+=a[-i]
if a==b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=""
for i in range(len(a),0,-1):
  b+=a[i]
if a==b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=""
for i in range(a,0,-1):
  b+=a[i]
if a==b:
  print("Yes")
else:
  print("No")
Problem p02831 (python)

Fixed submission:
from fractions import gcd


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


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

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math

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


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


print(lcm(a, b))
Problem p02594 (python)

Fixed submission:
n = int(input())
if n >= 30:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
if n >= 30:
  print('Yes')
  else:
    print('No')
Problem p02629 (python)

Fixed submission:
N = int(input())
ans = ''
for i in range(1, 10000):
#     print(N)
#     print("-> ",26 ** i)
    if N <= 26 ** i: 
#         print("ok")
        N += -1
        for j in range(i):
#             print("N:", N)
#             print("N % 26:", N % 26)
            ans += chr(ord('a') + N % 26)
            N = N // 26  # 26で割った商
        break
    else:
        N -= 26 ** i

print(ans[::-1])

Buggy submission (verdict: Runtime Error):
def print_ans(num):
#     num = int(input())
    base = 26

    checker = True
    ind = 1
    while checker:
        if num > base ** ind:
            ind += 1
        else:
            checker = False
            ind -= 1

    pre_ans_num = []
    for i in range(ind):
        ind_2 = ind - i
        quot = num // base ** ind_2
        pre_ans_num.append(quot)
        num = num % base ** ind_2
    pre_ans_num.append(num)

    ans = ""
    
#     print(pre_ans_num)
    pre_ans_num2 = pre_ans_num.copy()
    for i , ans_num in enumerate(pre_ans_num):
#         print(i, ans_num)
        pre_ans_num2[i - 1] += -1
        
    for n in pre_ans_num2:
        if n==0:
            ans += "z"
        else:
            order = ord("a") + n - 1
            ans += chr(order)

    print(ans)

a = str(input())
print_ans(a)

Buggy submission (verdict: Runtime Error):
num = int(input())
base = 26

checker = True
ind = 1
while checker:
  if num > base ** ind:
    ind += 1
  else:
    checker = False
    ind += -1

pre_ans_num = []
for i in range(ind):
  ind_2 = ind - i
  quot = num // base ** ind_2
  pre_ans_list.append(quot)
  num = a % base ** ind_2

ans = ""
for n in pre_ans_num:
  if n==0:
    ans += "0"
  else:
    order = ord("a") + n - 1
    ans += chr(order)

print(ans)
Problem p02711 (python)

Fixed submission:
N = str(input())
if '7' in N:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = str(input())
if N.isin('7'):
    print("Yes")
else:
    print("No")
Problem p02897 (python)

Fixed submission:
N = int(input())

if N == 1:
    print(1)
elif N % 2 == 1:
    print((N // 2 + 1) / N)
else:
    print(0.5)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(_) for _ in input().split(" ")]
 
ans = sorted(range(1, len(A) + 1), key=lambda x:A[x - 1])
print(*ans)
Problem p02912 (python)

Fixed submission:
import heapq

N, M = map(int, input().split(" "))
A = [-int(_) for _ in input().split(" ")]

heapq.heapify(A)

for i in range(M):
    heapq.heappush(A, -(-heapq.heappop(A)// 2))
    
print(-sum(A))

Buggy submission (verdict: Runtime Error):
import math
import heapq

N, M = map(int, input().split(" "))
A = [-int(_) for _ in input().split(" ")]

for i in range(M):
    print(A)
    heapq.heapify(A)
    heapq.heappush(A, -(-heapq.heappop(A)// 2))

print(-sum(A))
Problem p03075 (python)

Fixed submission:
anntena  = [int(input()) for i in range(5)]
k = int(input())

distance = []
for i in range(4):
    for j in range(i + 1, 5):
        distance.append(anntena[j] - anntena[i])
    
tmp = [i for i in distance if i  > k ]
if len(tmp) == 0:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
distance = []
for i in range(4):
    for j in range(i + 1, 4):
        distance.append(anntena[j] - anntena[i])
    
tmp = [i for i in distance if i  > k ]
if len(tmp) == 0:
    print("Yay!")
else:
    print(":(")
Problem p02659 (python)

Fixed submission:
import decimal
ab = input('')
a = decimal.Decimal(ab.split(' ')[0])
b = decimal.Decimal(ab.split(' ')[1])
result =  a*b
import math
result = math.floor(result)
print(result)

Buggy submission (verdict: Runtime Error):
ab = input('')
a = int(ab.split(' ')[0])
b = int(ab.split(' ')[1])
import math
result =  math.floor(a*b)

print(result)
Problem p02773 (python)

Fixed submission:
sz = int(input(''))
ary = []
for i in range(0,sz):
  s = input()
  ary.append(s)

map = {}
for w in ary:
  if not w in map:
    map[w] = 1
  else:
    map[w] +=1

max = 0
maxes = []
for k,v in map.items():
  if v > max:
    max = v

for k,v in map.items():
  if v == max:
    maxes.append(k)

for m in sorted(maxes):
  print(m)

Buggy submission (verdict: Runtime Error):
sz = int(input(''))
ary = []
for i in range(0,sz):
  s = input()
  ary.append(s)

map = {}
for w in ary:
  if not w in map:
    map[w] = 1
  else:
    map[w] +=1

max = 0
maxes = []
for k,v in map.items():
  if v > max:
    max = v

for k,v in map.items():
  if v == max:
    maxes.append(k)

for m in maxes.sort():
  print(m)
Problem p02580 (python)

Fixed submission:
from sys import stdin
input = stdin.readline

H,W,M = map(int, input().split())

sum_row = [0]*H; sum_col = [0]*W
bomb_row = [0]*M; bomb_col = [0]*M
for i in range(M):
    h,w = map(int, input().split())
    sum_row[h-1] += 1
    sum_col[w-1] += 1
    
    bomb_row[i] = h-1
    bomb_col[i] = w-1

maxcol = max(sum_col)
maxcollist = [False]*W
for col in range(W):
    if sum_col[col] == maxcol:
        maxcollist[col] = True

maxrow = max(sum_row)
maxrowlist = [False]*H
for row in range(H):
    if sum_row[row] == maxrow:
        maxrowlist[row] = True

#最高行または最高列上にあり、
#かつ最高行と最高列の交点にない爆弾があるかをチェック
cross_cnt = sum(maxrowlist) * sum(maxcollist)
for i in range(M):
    h,w = bomb_row[i], bomb_col[i]
    if maxrowlist[h] and maxcollist[w]:
        cross_cnt -= 1

if cross_cnt > 0:
    print(maxcol + maxrow)
else:
    print(maxcol + maxrow - 1)

Buggy submission (verdict: Runtime Error):
H,W,M = map(int, input().split())
bombmat = [[0]*(W+1) for _ in range(H+1)]
bomb_row = [0]*M; bomb_col = [0]*M
for i in range(M):
    h,w = map(lambda x: int(x)-1, input().split())
    bombmat[h][w] = 1
    bombmat[H][w] += 1
    bombmat[h][W] += 1
    
    bomb_row[i] = h
    bomb_col[i] = w

row_H = bombmat[H]
maxcol = 0
for col in range(W):
    maxcol = max(maxcol, row_H[col])

maxcollist = [False]*W
for col in range(W):
    if row_H[col] == maxcol:
        maxcollist[col] = True

maxrow = 0
for row in range(H):
    maxrow = max(maxrow, bombmat[row][W])

maxrowlist = [False]*H
for row in range(H):
    if bombmat[row][W] == maxrow:
        maxrowlist[row] = True

#最高行または最高列上にあり、
#かつ最高行と最高列の交点にない爆弾があるかをチェック
cross_cnt = sum(maxrowlist) * sum(maxcollist)
for i in range(M):
    h,w = bomb_row[i], bomb_col[i]
    if maxrowlist[h] and maxcollist[w]:
        cross_cnt -= 1

if cross_cnt > 0:
    print(maxcol + maxrow)
else:
    print(maxcol + maxrow - 1)

Buggy submission (verdict: Runtime Error):
H,W,M = map(int, input().split())
bombmat = [[0]*(W+1) for _ in range(H+1)]
bomb_row = [0]*M; bomb_col = [0]*M
for i in range(M):
    h,w = map(lambda x: int(x)-1, input().split())
    bombmat[h][w] = 1
    bombmat[H][w] += 1
    bombmat[h][W] += 1
    
    bomb_row[i] = h
    bomb_col[i] = w

row_H = bombmat[H]
maxcol = 0
for col in range(W):
    maxcol = max(maxcol, row_H[col])

maxcollist = [False]*W
for col in range(W):
    if row_H[col] == maxcol:
        maxcollist[col] = True

maxrow = 0
for row in range(H):
    maxrow = max(maxrow, bombmat[row][W])

maxrowlist = [False]*H
for row in range(H):
    if bombmat[row][W] == maxrow:
        maxrowlist[row] = True

#最高行または最高列上にあり、
#かつ最高行と最高列の交点にない爆弾があるかをチェック
cross_cnt = sum(maxrowlist) * sum(maxcollist)
for i in range(M):
    h,w = bomb_row[i], bomb_col[w]
    if maxrowlist[h] and maxcollist[w]:
        cross_cnt -= 1

if cross_cnt > 0:
    print(maxcol + maxrow)
else:
    print(maxcol + maxrow - 1)
Problem p02623 (python)

Fixed submission:
from sys import stdin
input = stdin.readline

def accumulate(l, X):
    acclist = [0]*(l+1)
    for i in range(1,l+1):
        acclist[i] = acclist[i-1] + X[i]
    return acclist

N,M,K = map(int, input().split())
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))

X = accumulate(N, A)
Y = accumulate(M, B)

maxbook = 0
j = M
for i in range(N+1):
    x = X[i]
    y = Y[j]
    while x + y > K:
        j -= 1 
        if j < 0:
            break
        y = Y[j]
    if j < 0:
        break

    maxbook = max(maxbook, i + j)

print(maxbook)

Buggy submission (verdict: Runtime Error):
from sys import stdin
input = stdin.readline

def accumulate(l, X):
    acclist = [0]*(l+1)
    for i in range(1,l+1):
        acclist[i] = acclist[i-1] + X[i]
    return acclist

N,M,K = map(int, input().split())
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))

X = accumulate(N, A)
Y = accumulate(M, B)

maxbook = 0
j = M
for i in range(N+1):
    x = X[i]
    y = Y[j]
    while x + y > K:
        j -= 1 
        y = Y[j]
        if j <= 0:
            break
    maxbook = max(maxbook, i + j)

print(maxbook)
Problem p02624 (python)

Fixed submission:
N = int(input())

ans = 0
for i in range(1,N+1):
    k = N // i
    ans += (i + i*k) * k // 2
print(ans)

Buggy submission (verdict: Runtime Error):
import sympy

N = int(input())

ans = 0
for x in range(1, N+1):
    ans += x * sympy.divisor_count(x)
print(ans)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
s = input().split()
a,b = int(s[0]),Decimal(s[1])
print(int(a*b))

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
b = int(b*100)
print(a*b/100)
Problem p03108 (python)

Fixed submission:
from sys import stdin, setrecursionlimit
input = stdin.readline
setrecursionlimit(10**8)

class Unionfind():
    def __init__(self,n):
        self.n = n
        self.parent = [-1]*n
    
    def find(self,x):
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return 0
        if self.parent[x] < self.parent[y]:
            x,y = y,x
        
        total_unite_island = self.parent[x] * self.parent[y]
        self.parent[x] += self.parent[y]
        self.parent[y] = x
        return total_unite_island

N,M = map(int, input().split())
A = [0]*M; B = [0]*M
for i in range(M):
    A[i], B[i] = map(lambda x: int(x) - 1, input().split())

uf = Unionfind(N)
inconvenience = N * (N-1) // 2
inconvenience_list = [0]*M
inconvenience_list[M-1] = inconvenience
for i in range(M-1,0,-1):
    inconvenience -= uf.union(A[i],B[i])
    inconvenience_list[i-1] = inconvenience
for i in range(M):
    print(inconvenience_list[i])

Buggy submission (verdict: Runtime Error):
from sys import stdin
input = stdin.readline

class Unionfind():
    def __init__(self,n):
        self.n = n
        self.parent = [-1]*n
    
    def find(self,x):
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return 0
        if self.parent[x] < self.parent[y]:
            x,y = y,x
        
        total_unite_island = self.parent[x] * self.parent[y]
        self.parent[x] += self.parent[y]
        self.parent[y] = x
        return total_unite_island

N,M = map(int, input().split())
A = [0]*M; B = [0]*M
for i in range(M):
    A[i], B[i] = map(lambda x: int(x) - 1, input().split())

uf = Unionfind(N)
inconvenience = N * (N-1) // 2
inconvenience_list = [0]*M
inconvenience_list[M-1] = inconvenience
for i in range(M-1,0,-1):
    inconvenience -= uf.union(A[i],B[i])
    inconvenience_list[i-1] = inconvenience
for i in range(M):
    print(inconvenience_list[i])
Problem p02552 (python)

Fixed submission:
x=int(input())
print(['1','0'][x==1])

Buggy submission (verdict: Runtime Error):
print(['0','1'][x==1])