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

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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)


def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
    
    (n, ) = [int(e) for e in lines[0].split(" ")]
    a = [int(e) for e in lines[1].split(" ")]

    return (n, a)


def solve(n, a):

    result = dict([(i, 0) for i in range(1, n+1)])

    for i in range(n-1):
        result[a[i]] = result[a[i]] + 1

    return  list(result.values())


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Buggy submission (verdict: Runtime Error):
import unittest

from A03 import solve
from A03 import parse_input

class TestA03Solve(unittest.TestCase):

    def test_solve(self):

        lines_as_string = """
5
1 1 2 2
"""

        r = parse_input(lines_as_string)
        for i, e in enumerate(r):
            print("e[%d]=%s" % (i, e))
        print("")
        self.assertEqual(solve(*r), [2,2,0,0,0])

        lines_as_string = """
10
1 1 1 1 1 1 1 1 1
"""

        r = parse_input(lines_as_string)
        for i, e in enumerate(r):
            print("e[%d]=%s" % (i, e))
        print("")
        self.assertEqual(solve(*r), [9,0,0,0,0,0,0,0,0,0]) 


if __name__ == '__main__':
    unittest.main()
Problem p02777 (python)

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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (s, t) = [e for e in lines[0].split(" ")]
    (a, b) = [int(e) for e in lines[1].split(" ")]
    u = lines[2]

    return (s, t, a, b, u)


def solve(s, t, a, b, u):
    
    a2 = a
    b2 = b
    if s == u:
        a2 = a2 - 1
    elif t == u:
        b2 = b2 - 1
    
    result = ' '.join([str(a2), str(b2)])

    return result
    


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (s, t) = [e for e in lines[0].split(" ")]
    (a, b) = [int(e) for e in lines[1].split(" ")]
    u = lines[2]

    return (s, t, a, b, u)


def solve(s, t, a, b, u):
    
    a2 = a
    b2 = b
    if s == u:
        a2 = a2 - 1
    elif t == u:
        b2 = b2 - 1
    
    result = ' '.join([a2, b2])

    return result
    


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()
Problem p02832 (python)

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

import sys
import math

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
#        for line in sys.stdin:
#            lines.append(line)
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = [int(e) for e in lines[0].split(" ")][0]
    a = [int(e) for e in lines[1].split(" ")]

    return (n, a)

def solve(n, a):

    current_num = 1
    count = 0
    result = []
    for i in range(n):
        if a[i] != current_num:
            count = count + 1
        else:
            current_num = current_num + 1
            result.append(a[i])
    
    if debug:
        log("result=%s" % result)
        log("count=%s" % count)
    
    if result == []:
        count = -1

    for i in range(1, len(result) + 1):
        if result[i-1] != i:
            if debug:
                log("result[%d]=%s" % (i, result[i-1]))
            count = -1
            break


    return count

def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r)
    else:
        print("%s" % result)

if __name__ == '__main__':

    main()

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

from A04 import solve
from A04 import parse_input

class TestA04Solve(unittest.TestCase):


    def test_solve(self):

        lines_as_string = """
3
2 1 2
"""
        r = parse_input(lines_as_string)
        for i, e in enumerate(r):
            print("e[%d]=%s" % (i, e))
        print("")
        self.assertEqual(solve(*r), 1)


        lines_as_string = """
3
2 2 2
"""
        r = parse_input(lines_as_string)
        for i, e in enumerate(r):
            print("e[%d]=%s" % (i, e))
        print("")
        self.assertEqual(solve(*r), -1)

        lines_as_string = """
10
3 1 4 1 5 9 2 6 5 3
"""
        r = parse_input(lines_as_string)
        for i, e in enumerate(r):
            print("e[%d]=%s" % (i, e))
        print("")
        self.assertEqual(solve(*r), 7)

        lines_as_string = """
1
1
"""
        r = parse_input(lines_as_string)
        for i, e in enumerate(r):
            print("e[%d]=%s" % (i, e))
        print("")
        self.assertEqual(solve(*r), 0)


if __name__ == '__main__':
    unittest.main()
Problem p02859 (python)

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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    r = int(lines[0])

    return (r, )


def solve(r):

    return r*r

def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    r = int(lines[0])

    return r


def solve(r):

    return r*r

def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()
Problem p03127 (python)

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

import sys

def gcd(a, b):

    c = min(a, b)
    d = max(a, b)
    r = 0    
    while True:
        r = d % c
        if r == 0:
            break
        d = c
        c = r

    return c

def parse_input(lines_as_string = None):

    lines = []
    if lines_as_string is None:
        for line in sys.stdin:
            lines.append(line)
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    # 出力
    nm = lines[0].split(" ")
    n = int(nm[0])

    rows = []
    for i in range(1, 2):
        rows.append([int(e) for e in lines[i].split(" ")])

    return (n, rows[0])

def solve(n, monsters):

    g = monsters[0]
    for i in range(1, n):
        g = gcd(g, monsters[i])


    return g

def main():

    print("%d" % solve(*parse_input()))

if __name__ == '__main__':

    main()

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

import sys
import math

def parse_input(lines_as_string = None):

    lines = []
    if lines_as_string is None:
        for line in sys.stdin:
            lines.append(line)
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    # 出力
    nm = lines[0].split(" ")
    n = int(nm[0])

    rows = []
    for i in range(1, 2):
        rows.append([int(e) for e in lines[i].split(" ")])

    return (n, rows[0])

def solve(n, monsters):

    g = monsters[0]
    for i in range(1, n):
        g = math.gcd(g, monsters[i])


    return g

def main():

    n, m, rows = parse_input()
    print("%d" % solve(n, m, rows))

if __name__ == '__main__':

    main()
Problem p02659 (python)

Fixed submission:
line = input().split()
a = int(line[0])
b = round(float(line[1])*100)

print(a*b//100)

Buggy submission (verdict: Runtime Error):
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f**2 <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

count = 0

N = int(input())
c = collections.Counter(prime_factorize(N))

K = [sum(range(1,i)) for i in range(2,10)]
#print(K)
 
for i in c:
  for j in range(len(K)):
    if c[i] < K[j]:
      count += j
      break
      
print(count)

Buggy submission (verdict: Runtime Error):
1000000000000000 9.99
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):
for i in range(len(S)-len(T)+1):
	sub_S = S[i:i+len(T)]
	cnt = 0
	for j in range(len(T)):
		if sub_S[j] != T[j]:
			cnt += 1
	cnt_list.append(cnt)
print(min(cnt_list))
Problem p02571 (python)

Fixed submission:
S = input()
T = input()
cnt_list = []

for i in range(len(S)-len(T)+1):
  sub_S = S[i:i+len(T)]
  cnt = 0
  for j in range(len(T)):
    if sub_S[j] != T[j]:
      cnt += 1
  cnt_list.append(cnt)
print(min(cnt_list))

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

for i in range(len(S)-len(T)+1):
  sub_S = S[i:i+len(T)]
  cnt = 0
  for j in range(len(T)):
    if sub_S[j] != T[j]:
      cnt += 1
  cnt_list.append(cnt)
print(min(cnt_list))

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

for i in range(len(S)-len(T)+1):
	sub_S = S[i:i+len(T)]
	cnt = 0
	for j in range(len(T)):
		if sub_S[j] != T[j]:
			cnt += 1
	cnt_list.append(cnt)
print(min(cnt_list))

Buggy submission (verdict: Runtime Error):
for i in range(len(S)-len(T)+1):
  sub_S = S[i:i+len(T)]
  cnt = 0
  for j in range(len(T)):
    if sub_S[j] != T[j]:
      cnt += 1
  cnt_list.append(cnt)
print(min(cnt_list))

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
cnt_list = []

for j in range(len(S)-len(T)):
  sub_S  =  S[j:(j+len(S))]
  for k in range(len(T)-1):
    cnt = 0
    if T[k] != sub_S[k]:
      cnt += 1
    cnt_list.append(cnt)

print(min(cnt_list))
Problem p02595 (python)

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

xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]

count = 0

for i, j in zip(x, y):
    if i*i + j*j <= d*d:
        count += 1

print(count)

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

xy = [map(int, input().split()) for _ in range(5)]
x, y = [list(i) for i in zip(*xy)]


count = 0

for i, j in zip(x, y):
    if i*i + j*j <= d*d:
        count += 1

print(count)

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

count = 0

for i, j in zip(x, y):
    if i*i + j*j <= d*d:
        count += 1

print(count)
Problem p02598 (python)

Fixed submission:
N, K = map(int, input().split()[:2])
arr = list(map(int, input().split()[:N]))


def pos(X):
    sum = 0
    for i in arr:
        sum += int(i/X)
        if i % X == 0:
            sum -= 1
    return sum <= K


low = 1
high = 10 ** 9
mid = 0
ans = 10**9

while low <= high:
    mid = int((low+high)/2)
    # print(low, mid, high)
    if pos(mid):
        ans = mid
        high = mid-1
    else:
        low = mid+1
    # print(pos(mid))
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split()[:2])
arr = list(map(int, input().split()[:N]))


def pos(X):
    sum = 0
    for i in arr:
        sum += int(i/X)
        if i % X == 0:
            sum -= 1
    return sum <= K


low = 0
high = 10 ** 9
mid = 0
ans = 10**9

while low <= high:
    mid = int((low+high)/2)
    # print(low, mid, high)
    if(pos(mid)):
        ans = mid
        high = mid-1
    else:
        low = mid+1
    # print(pos(mid))
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split()[:2])
arr = list(map(float, input().split()[:N]))


def pos(X):
    sum = 0
    for i in arr:
        sum += int((i-1)/X)
    return sum <= K


low = 0
high = 10 ** 9
mid = 0
ans = 10**9

while low <= high:
    mid = int((low+high)/2)
    # print(low, mid, high)
    if(pos(mid)):
        ans = mid
        high = mid-1
    else:
        low = mid+1
    # print(pos(mid))
print(ans)
Problem p02547 (python)

Fixed submission:
N=int(input())
sum=0
name=[]
for _ in range(N):
    a,b=map(int,input().split())
    if(a==b):
        sum+=1
        if(sum==3):
            name.append("Yes")
    else:
        sum=0
    
if len(name)==0:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N=int(input())
sum=0
for _ in range(N):
    a,b=map(int,input().split())
    if(a==b):
        sum+=1
        if(sum==3):
            name=[]
            name.append("Yes")
    else:
        sum=0
    
if name[0]=="Yes":
    print("Yes")
else:
    print("No")
Problem p02688 (python)

Fixed submission:
import numpy as np
N,K=map(int, input().split())
D = np.zeros((K, N))
for i in range(K):
    d=int(input())
    A=np.array(list(map(int, input().split())))
    for j in range(len(A)):
        D[i][A[j]-1] = 1
ans = D.sum(axis=0)
print(sum(ans == 0))

Buggy submission (verdict: Runtime Error):
N,K=map(int, input().split())
#print(N,K)
D=[[0 for i in range(N)] for j in range(K)]
#print(D)

for i in range(K):
    d=int(input())
    #print("d=",d)
    S=list(map(int, input().split()))
    #print("S=",S)
    for j in range(d):
        #print(S[j])
        D[(d-1)][S[j]-1] = 1
#print(D)
a = [0, 0, 0]
for i in range(K):
    a=list(map(sum, zip(a, D[:][i])))
    #print(a)
#print(a)
ans = 0
for i in a:
    if i == 0:
        ans = ans + 1
print(ans)
Problem p02777 (python)

Fixed submission:
S,T=input().split()
A,B=map(int,input().split())
U=input()
if U==S:
    A=A-1
else:
    B=B-1
print(A,B)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K=map(int,input().split())
P=np.array(list(map(int,input().split())))

max_value=0
for i in range(N-K+1):
    if max_value < sum(P[i:i+K]):
        max_value = sum(P[i:i+K])
        max_i = i
max_vector = P[max_i:max_i+K]

sum_ex = 0
for i in range(K):
    sum_ex = sum_ex + sum(np.arange(max_vector[i]+1)) / max_vector[i]
print(sum_ex)
Problem p02829 (python)

Fixed submission:
A = int(input())
B = int(input())
print(6 - A - B)

Buggy submission (verdict: Runtime Error):
print(6-input()-input())
Problem p02879 (python)

Fixed submission:
import sys

a,b = (int(x) for x in input().split())

if a>0 and 10>a and b>0 and 10>b:
    print(a*b)

else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import sys

a = int(input())
b = int(input())

if a>0 and 10>a and b>0 and 10>b:
    print(a*b)

else:
    print(-1)
Problem p02948 (python)

Fixed submission:
import heapq

N,M = (int(x) for x in input().split())
AB = []
sum = 0

for i in range(N):
    a,b = (int(x) for x in input().split())
    AB.append([a,b])

AB = sorted(AB , key = lambda x : x[0])
heap = []
j = 0

for i in range(M+1):
    while j<N and AB[j][0] < i+1:
        heapq.heappush(heap,-AB[j][1])
        j += 1

    if len(heap):
        sum += -heapq.heappop(heap)
                           
print(sum)

Buggy submission (verdict: Runtime Error):
import heapq

N,M = (int(x) for x in input().split())
AB = []
sum = 0

for i in range(N):
    a,b = (int(x) for x in input().split())
    AB.append([a,b])

AB = sorted(AB , key = lambda x : x[1])

for i in range(M):
    if AB[N-i-1][0] <= M-i:
        sum += AB[N-i-1][1]
        AB.pop(N-i-1)

print(sum)
Problem p02712 (python)

Fixed submission:
n = int(input())
tmp, ans = 0, 0

while tmp < n:
    tmp = tmp + 1
    if tmp % 3 != 0 and tmp % 5 != 0:
        ans = ans + tmp
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
print(a)
if a[-m] > 1 / (4 * m):
    print("Yes")
else:
    print("No")
Problem p03272 (python)

Fixed submission:
n, i = map(int, input().split(' '))
print(n-i+1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
print(a-b+1)
Problem p03315 (python)

Fixed submission:
s=input()
print(s.count('+')-s.count('-'))

Buggy submission (verdict: Runtime Error):
 s = input()
 print(s.count('+')-s.count('-'))
Problem p02627 (python)

Fixed submission:
a = input ()

if a.isupper():
    print('A')
else:
    print('a')

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

if a.isupper() == True:
  print('A')

elif a.supper() == False:
  print('a')
Problem p02550 (python)

Fixed submission:
n,x,m=map(int, input().split())
a=x
ans=a
flg=[0]*m
flg[a]=1
l=[a]
lp=-1

for i in range(1,m+1):   
    if n <= i:
        break
    tmp=(a*a)%m
    a=tmp
    if flg[a]==1:
        lp = l.index(a)
        break
    else:    
        ans+=tmp
        l.append(a)
        flg[a]=1

if lp != -1:
    l2 = l[lp:]
    tmp = sum(l2)
    b=(n-len(l))//len(l2)
    c=n-len(l)-b*len(l2)
    ans=ans+(b*tmp)+sum(l2[:c])

print(ans)

Buggy submission (verdict: Runtime Error):
import math
n,x,m=map(int, input().split())
a = x
ans = a
l=[a]
flg=[0]*m

for i in range(1,m):
    tmp=(a*a)%m
    a=tmp 
    ans+=tmp
    if flg[a]==1:
        lp = l.index(a)
        break
    else:
        l.append(a)
        flg[a]=1

if lp != 0:
    l2 = l[lp:]
    tmp = sum(l2)
    b=math.floor((n-len(l))/len(l2))
    c=(n-len(l))%len(l2)
    if c==0:
        ans+=b*tmp
    else:
        ans+=b*tmp+sum(l2[:c])-l2[0]

print(ans)

Buggy submission (verdict: Runtime Error):
n,x,m=map(int, input().split())
a = x
ans = a
l=[a]

for i in range(1,n):
    tmp=(a*a)%m
    a=tmp  
    ans+=tmp
    if a in l:
        lp = l.index(a)
        break
    else:
        l.append(a)

l2 = l[lp:]
tmp = sum(l2)

b=int((n-len(l))/len(l2))
c=(n-len(l))%len(l2)

ans+=b*tmp+sum(l2[:c])
print(ans)
Problem p02580 (python)

Fixed submission:
h,w,m=map(int, input().split())
r = [0]*max(h,w)
c = [0]*max(h,w)
l=[]

for i in range(m):
    x,y=map(int, input().split())
    r[x-1]+=1
    c[y-1]+=1
    l.append([x,y])

cm = max(c)
rm = max(r)
ci = [i for i, x in enumerate(c) if x == cm]
ri = [i for i, x in enumerate(r) if x == rm]
ans = cm + rm

cnt = 0
#print(l,ci,ri)
for i in range(m):
    if r[l[i][0]-1] == rm and c[l[i][1]-1] ==cm:
        cnt += 1

if cnt == len(ci)*len(ri):
    print(int(ans)-1)
else:
    print(int(ans))

Buggy submission (verdict: Runtime Error):
h,w,m=map(int, input().split())
r = [0]*max(h,w)
c = [0]*max(h,w)
l=[]

for i in range(m):
    x,y=map(int, input().split())
    r[x-1]+=1
    c[y-1]+=1
    l.append([x,y])

cm = max(c)
rm = max(r)
ans = cm + rm

cnt = 0
#print(l,ci,ri)
for i in range(m):
    if r[l[i][0]-1] == rm and c[l[i][1]-1] ==cm:
        cnt += 1

if cnt == len(ci)*len(ri):
    print(int(ans)-1)
else:
    print(int(ans))

Buggy submission (verdict: Runtime Error):
h,w,m=map(int, input().split())
r = [0]*h
c = [0]*w

for i in range(m):
    x,y=map(int, input().split())
    r[x]+=1
    c[y]+=1

print(r,c,max(r)+max(c))

Buggy submission (verdict: Runtime Error):
h,w,m=map(int, input().split())
r = [0]*10
c = [0]*10

for i in range(m):
    x,y=map(int, input().split())
    r[x]+=1
    c[y]+=1

print(max(r)+max(c))

Buggy submission (verdict: Runtime Error):
import numpy as np
h,w,m=map(int, input().split())
a = np.zeros((h,w))
ans=0

for i in range(m):
    x,y=map(int, input().split())
    a[x-1,y-1]=1
    
c = a.sum(axis=0)
r = a.sum(axis=1)
cm = max(c)
rm = max(r)
ci = [i for i, x in enumerate(c) if x == cm]
ri = [i for i, x in enumerate(r) if x == rm]
ans = cm + rm

print(int(ans))

Buggy submission (verdict: Runtime Error):
import numpy as np
h,w,m=map(int, input().split())
a = np.zeros((h,w))
ans=0

for i in range(m):
    x,y=map(int, input().split())
    a[x-1,y-1]=1
    
c = a.sum(axis=0)
r = a.sum(axis=1)
cm = max(c)
rm = max(r)
ci = [i for i, x in enumerate(c) if x == cm]
ri = [i for i, x in enumerate(r) if x == rm]
ans = cm + rm

#print(a,c,r,ci,ri)

for i in ri:
    for j in ci:
        if a[i,j]==0:
            print(int(ans))
            exit()

print(int(ans)-1)
Problem p02623 (python)

Fixed submission:
import sys
from itertools import accumulate

n,m,k=map(int, input().split())
a = [0] + list(accumulate(map(int,sys.stdin.readline().rstrip().split())))
b = [0] + list(accumulate(map(int,sys.stdin.readline().rstrip().split())))
ans = 0
j = m

#print(a,b)

for i,item in enumerate(a):
        if k<item:
            break
        while k<item+b[j]:
            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()))
ans = 0
ai = 0
tmp = 0

for i in range(n):
    if tmp + a[i] <= k:
        tmp = tmp + a[i]
        ans += 1
        ai = i

for i in range(m):
    if tmp + b[i] <= k:
        tmp = tmp + b[i]
        ans += 1
    elif tmp - a[ai] + b[i] <= k:
        tmp = tmp - a[ai] + b[i]
        ai -= 1

print(ans)
Problem p02693 (python)

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

max = int(b/k)

for i in range(1,max+1):
    tmp = k * i
    if a <= tmp and b >= tmp:
        print('OK')
        exit()

print('NG')

Buggy submission (verdict: Runtime Error):
import math
a,b,n=map(int, input().split()) 
max = -10000
tmp = 0

for i in range(1, n+1):
    tmp = math.floor(a * i / b) - math.floor(i / b)
    if max < tmp:
        max = tmp

print(max)
Problem p02624 (python)

Fixed submission:
N = int(input())
ans = 0
for i in range(1, N + 1):
    n = N // i  # 項数n
    cnt = (n * (2 * i + (n - 1) * i)) // 2  # 初項i, 項数n の等差数列の和の公式
    ans += cnt
print(ans)

Buggy submission (verdict: Runtime Error):
def main():

#---------------------------------------------------------

N = int(input())
ans = 0
for i in range(1, N + 1):
    n = N // i  # 項数n
    cnt = (n * (2 * i + (n - 1) * i)) // 2  # 初項i, 項数n の等差数列の和の公式
    ans += cnt
print(ans)

#---------------------------------------------------------

if __name__ == '__main__':
   main()

Buggy submission (verdict: Runtime Error):
import sympy

n = int(input())

ans = 0

for i in range(1,n+1):
    ans += i* sympy.divisor_count(i)

print(ans)
Problem p02682 (python)

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

if k<a:
  print(k)
elif a<=k and k<=a+b:
  print(a)
elif a+b<k and k<a+b+c:
  print(a-(k-a-b))
else:
  print(a-c)

Buggy submission (verdict: Runtime Error):

if k<a:
  print(k)
elif a<=k and k<=a+b:
  print(a)
elif a+b<k and k<a+b+c:
  print(a-(k-a-b))
else:
  print(a-c)