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

Fixed submission:
def main():
    N, K  = map(int, input().split())
    if K == 10:
        print(len(str(N)))
    else:
        mod = list()
        count = 0
        for i in range(10**9):
            a, b = divmod(N, K)
            N = a
            count += 1
            if N == 0:
                break
        print(count)
main()

Buggy submission (verdict: Runtime Error):
def main():
    N, M = map(int, input().split())
    A = [int(a) for a in input().split()]
    total = sum(A)
    cnt = 0
    for i in range(N):
        if A[i] < total*1.0/(4.0*M):
            pass
        else:
            cnt += 1
    if cnt >= M:
        print("Yes")
    else:
        print("No")
main()
Problem p03705 (python)

Fixed submission:
def main():
    N, A, B = map(int, input().split())
    ans = 0

    if A > B:
        ans = 0
    else:
        if N == 1:
            if A != B:
                ans = 0
            else:
                ans = 1
        elif N == 2:
            ans = 1
        else:
            ans = (B - A)*(N - 2) + 1

    print(ans)
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = input()
    S = str(N)
    S = S[::-1]

    odd = 0
    even = 0

    for i in range(len(S)):
        if (i + 1) % 2 == 0:
            even += int(S[i])
        else:
            odd += int(S[i])
    print(even, odd)

if __name__ == "__main__":
    main()
Problem p03745 (python)

Fixed submission:
def main():
    N = int(input())
    A = [int(a) for a in input().split()]

    idx = 0
    ans = 0
    for i in range(len(A)):
        if idx + 1 > len(A) - 1 :
            break

        m = ""
        if A[idx] < A[idx + 1]:
            m = "+"
        elif A[idx] > A[idx + 1]:
            m = "-"
        else:
            find = False
            for j in range(idx, len(A)-1):
                if A[j] < A[j + 1]:
                    m = "+"
                    find = True
                    idx = j
                    break
                elif A[j] > A[j + 1]:
                    m = "-"
                    find = True
                    idx = j
                    break
            if find == False:
                print(ans + 1)
                exit()

        for j in range(idx, len(A) - 1):
            if m == "+":
                if A[j] <= A[j + 1]:
                    idx = j + 1
                else:
                    idx = j + 1
                    ans += 1
                    break
            elif m == "-":
                if A[j] >= A[j + 1]:
                    idx = j + 1
                else:
                    idx = j + 1
                    ans += 1
                    break

    print(ans + 1)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    # N = int(input())
    # A = [int(a) for a in input().split()]

    f = open("subtask_1_02.txt", "r")
    N = int(f.readline())
    A = [int(a) for a in f.readline().split()]

    idx = 0
    ans = 0
    for i in range(len(A)):
        if idx + 1 > len(A) - 1 :
            break

        m = ""
        if A[idx] < A[idx + 1]:
            m = "+"
        elif A[idx] > A[idx + 1]:
            m = "-"
        else:
            find = False
            for j in range(idx, len(A)-1):
                if A[j] < A[j + 1]:
                    m = "+"
                    find = True
                    idx = j
                    break
                elif A[j] > A[j + 1]:
                    m = "-"
                    find = True
                    idx = j
                    break
            if find == False:
                print(ans + 1)
                exit()

        for j in range(idx, len(A) - 1):
            if m == "+":
                if A[j] <= A[j + 1]:
                    idx = j + 1
                else:
                    idx = j + 1
                    ans += 1
                    break
            elif m == "-":
                if A[j] >= A[j + 1]:
                    idx = j + 1
                else:
                    idx = j + 1
                    ans += 1
                    break

    print(ans + 1)

if __name__ == "__main__":
    main()
Problem p02633 (python)

Fixed submission:
import math
x = int(input())
tol = 1e-6
ans = 1
cur = [0,1]
unit = x/180*math.pi
while cur[0]**2 + cur[1]**2 > tol:
    cur[0] += math.sin(ans*unit)
    cur[1] += math.cos(ans*unit)
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import math
tol = 1e-6
ans = 1
cur = [0,0]
cur[0] += math.cos(ans*math.pi/x)
cur[1] += math.sin(ans*math.pi/x)
while cur[0]**2 + cur[1]**2 > tol:
    ans += 1
    cur[0] += math.cos(ans*math.pi/x)
    cur[1] += math.sin(ans*math.pi/x)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
tol = 1e-6
ans = 1
cur = [0,0]
cur[0] += math.cos(ans*math.pi/x)
cur[1] += math.sin(ans*math.pi/x)
while cur[0]**2 + cur[1]**2 > tol:
    ans += 1
    cur[0] += math.cos(ans*math.pi/x)
    cur[1] += math.sin(ans*math.pi/x)
print(ans)
Problem p02759 (python)

Fixed submission:
print((int(input()) + 1)//2)

Buggy submission (verdict: Runtime Error):
print((N+1)//2)
Problem p03250 (python)

Fixed submission:
A, B, C = input().split()
#ABC
#ABC
#BAC
#BCA 
#CAB
#CBA 
print(max(int(A+B)+int(C), int(A+C)+int(B), int(B+A)+int(C), int(B+C)+int(A), int(C+A)+int(B),int(C+B)+int(A)))

Buggy submission (verdict: Runtime Error):
N, M , X, Y = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
if X < Y and max(x) < min(y) and  min(y) > X and max(x) < Y:
    print('No War')
else:
    print('War')
Problem p02793 (python)

Fixed submission:
mod = 10**9+7
n = int(input())
a = list(map(int, input().split()))



def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

l = [0] * (10 ** 6 + 1)

for i in range(n):
    soi = factorize(a[i])
    for j in range(len(soi)):
        l[soi[j][0]] = max(l[soi[j][0]], soi[j][1])

saiko = 1

for i in range(2, 10**6):
    saiko = (saiko * i ** l[i]) % mod

ans = 0

for i in range(n):
    ans += saiko * pow(a[i],mod - 2, mod)
    ans %= mod

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
from functools import reduce

mod = 10**9+7
n = int(input())
a = list(map(int, input().split()))



def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

l = [0] * (10 ** 6 + 1)

for i in range(n):
    soi = factorize(a[i])
    for j in range(len(soi)):
        l[soi[j][0]] = max(l[soi[j][0]], soi[j][1])

saiko = 1

for i in range(2, 10**6):
    saiko = (saiko * i ** l[i]) % mod

ans = 0

for i in range(n):
    ans += saiko * pow(a[i],mod - 2, mod)
    ans %= mod

print(ans)
Problem p02833 (python)

Fixed submission:
n = int(input())

ans = 0

if n % 2 == 0:
    n //= 10
    for i in range(27):
        ans += n // 5 ** i

print(ans)

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

ans = 0

if int(n) % 2 == 0:
    n = int(n[:-1])
    for i in range(27):
        ans += n // 5 ** i

print(ans)
Problem p03013 (python)

Fixed submission:
n,m = map(int, input().split())
list = [0] * n
list[0] = 1
if n >= 2:
    list[1] = 2
if n >= 3:
    for i in range(2, n):
        list[i] = list[i - 2] + list[i - 1]

if m == 0:
    print(list[n - 1] % 1000000007)
else:
    ans = 1
    o = 0
    for i in range(m):
        a = int(input())
        if a == o:
            ans = 0
            break
        if a > o + 1:
            ans = (ans * list[a - o - 2]) % 1000000007
        o = a + 1

    if a + 1 < n:
        ans = (ans * list[n - a - 2]) % 1000000007
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
list = [0] * n
list[0] = 1
if n >= 2:
    list[1] = 2
if n >= 3:
    for i in range(2, n):
        list[i] = list[i - 2] + list[i - 1]



ans = 1
o = 0
for i in range(m):
    a = int(input())
    if a == o:
        ans = 0
        break
    if a > o + 1:
        ans = (ans * list[a - o - 2]) % 1000000007
    o = a + 1

if a + 1 < n:
    ans = (ans * list[n - a - 2]) % 1000000007
print(ans)
Problem p03038 (python)

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

cb = []
for _ in range(m):
    b,c = map(int, input().split())
    cb.append([c, b])

a.sort()
cb.sort()

now = 0
finish = False
for i in range(m):
    b = cb[m - 1 - i][1]
    c = cb[m - 1 - i][0]
    for j in range(b):
        if now < n and a[now] < c:
            a[now] = c
            now += 1
        else:
            finish = True
            break
    if finish:
        break

print(sum(a))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
cb = []
for i in range(m):
    b,c = map(int, input().split())
    cb += [[c,b]]
cb = sorted(cb)[::-1]

def solve():
    p = 0
    q = 0
    ans = 0
    while p < n and q < m:
        if a[p] < cb[q][0]:
            if a [p + cb[q][1] - 1] < cb[q][0] and p + cb[q][1] - 1 < n:
                ans += cb[q][0] * cb[q][1]
                p = p + cb[q][1]
                q += 1
            else:
                for i in range(cb[q][1]):
                    if p + i == n:
                        return(ans)
                    elif a[p + i] < cb[q][0]:
                        ans += cb[q][0]
                    else:
                        ans += sum(a[p + i:])
                        return(ans)
        else:
            ans += sum(a[p:])
            return(ans)
    if p == n:
        return(ans)
    else:
        ans += sum(a[p:])
        return(ans)
print(solve())

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
cb = []
for i in range(m):
    b,c = map(int, input().split())
    cb += [[c,b]]
cb = sorted(cb)[::-1]

def solve():
    p = 0
    q = 0
    ans = 0
    while p < n and q < m:
        if a[p] < cb[q][0]:
            if a [p + cb[q][1] - 1] < cb[q][0] and p + cb[q][1] - 1 < n:
                ans += cb[q][0] * cb[q][1]
                p = p + cb[q][1]
                q += 1
            else:
                for i in range(cb[q][1]):
                    if p + i == n:
                        return(ans)
                    elif a[p + i] < cb[q][0]:
                        ans += cb[q][0]
                    else:
                        ans += sum(a[p + i:])
                        return(ans)
        else:
            ans += sum(a[p:])
            return(ans)
    if q == n:
        return(ans)
    else:
        ans += sum(a[p:])
        return(ans)
print(solve())
Problem p02623 (python)

Fixed submission:
A,B,K=map(int,input().split())
List_A = list(map(int, input().split()))
List_B = list(map(int, input().split()))
SumListA=[]
SumListA.append(0)
SumListB=[]
SumListB.append(0)
res =0
a=0
for i in range(A):
  SumListA.append(SumListA[i]+List_A[i])
for i in range(B):
  SumListB.append(SumListB[i]+List_B[i])

j=B
for i in range(A+1):
  if SumListA[i] > K:
    break
  while K-SumListA[i] < SumListB[j]:
    j += -1
  res = max(i+j,res)
print(res)

Buggy submission (verdict: Runtime Error):
A,B, K=map(int,input().split())
List_A = list(map(int, input().split()))
List_B = list(map(int, input().split()))
res = 0
inter = 0
n = A+B
for i in range(n):
  if len(List_A)==0:
    inter+=List_B.pop(0)
  elif len(List_B)==0:
    inter+=List_A.pop(0)
  else:
    if List_A[0]>List_B[0]:
      inter+=List_B.pop(0)
    elif List_A[0] < List_B[0]:
      inter+=List_A.pop(0)
    else:
      if List_B[1] > List_A[1]:
        inter+=List_A.pop(0)
      elif List_A[1] > List_B[1]:
        inter+=List_B.pop(0)
      else:
        if len(List_A) > len(List_B):
          inter = inter + List_A.pop(0)
        else:
          inter = inter + List_B.pop(0)
  if K < inter:
    break
  else:
    res +=1
print(res)

Buggy submission (verdict: Runtime Error):
A,B, K=map(int,input().split())
List_A = list(map(int, input().split()))
List_B = list(map(int, input().split()))
res = 0
a=0
b=0
inter = []
inter2 = 0
n = A+B
for i in range(n):
  if a ==A and b !=B:
    inter.append(List_B[b])
    b +=1
  elif a !=A and b ==B:
    inter.append(List_A[a])
    a +=1
  else:
    if List_A[a]>List_B[b]:
      inter.append(List_B[b])
      b +=1
    elif List_A[a] < List_B[b]:
      inter.append(List_A[a])
      a +=1
    else:
      k = min(A-a, B-b)
      for j in range(1,k):
        if List_B[b+j] > List_A[a+j]:
          inter.append(List_A[a])
          a +=1
          break
        elif List_A[a+j] > List_B[b+j]:
          inter.append(List_B[b])
          b +=1
          break
        else:
          if j == k-1:
            if B-b > A-a:
              inter.append(List_A[a])
              a +=1
              break
            elif A-a > B-b:
              inter.append(List_B[b])
              b += 1
              break
          else:
            pass
for i in range(n):
  inter2 += inter[i]
  if K < inter2:
    break
  else:
    res +=1
print(res)
Problem p02659 (python)

Fixed submission:
import decimal
a,b=map(str,input().split())
RES = decimal.Decimal(a)*decimal.Decimal(b)
res = int(RES)
print(res)

Buggy submission (verdict: Runtime Error):
,b=map(float,input().split())
res = a*b
res = int(res)
print(res)

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

Fixed submission:
Row = int(input())
List = []
for i in range (Row):
  List.append(input())
s_l = set(List)
print(len(s_l))

Buggy submission (verdict: Runtime Error):
Row = int(input())
List = []
for i in range (Row):
  List.append(int(input()))
s_l = set(List)
print(len(s_l))
Problem p02790 (python)

Fixed submission:
a,b=map(str,input().split())
res = ""
if a < b:
  for i in range(int(b)):
    res += a
else:
  for i in range(int(a)):
    res += b
print(res)

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
res = ""
if a < b:
  for i in range(b):
    res += a
else:
  for i in range(a):
  res += b
print(res)
Problem p02897 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
if N % 2 =1:
  n = int((N+1)/2)
else:
  n = int(N/2)
res = n/N
print(res)
Problem p03107 (python)

Fixed submission:
S=input()
List = list(S)
zeroNum = List.count("0")
oneNum = List.count("1")
res = min(zeroNum,oneNum)
print(res*2)

Buggy submission (verdict: Runtime Error):
S=input()
List = list(S)
zeroNum = List.count("0")
oneNum = List.count("1")
res = min(reroNum,oneNum)
print(res*2)
Problem p03265 (python)

Fixed submission:
x1,y1,x2,y2=map(int,input().split())
if x2 >= x1 and y2 >= y1:
  x3=x2-abs(y2-y1)
  x4=x1-abs(y2-y1)
  y3=y2+abs(x2-x1)
  y4=y1+abs(x2-x1)
elif x2 < x1 and y2 >= y1:
  x3=x2-abs(y2-y1)
  x4=x1-abs(y2-y1)
  y3=y2-abs(x2-x1)
  y4=y1-abs(x2-x1)
elif x2 < x1 and y1 >= y2:
  x3=x2+abs(y2-y1)
  x4=x1+abs(y2-y1)
  y3=y2-abs(x2-x1)
  y4=y1-abs(x2-x1)
else:
  x3=x2+abs(y2-y1)
  x4=x1+abs(y2-y1)
  y3=y2+abs(x2-x1)
  y4=y1+abs(x2-x1)
print(x3,y3,x4,y4)

Buggy submission (verdict: Runtime Error):
Dist = abs(y1-y2)**2+abs(x1-x2)**2
dist = Dist**0.5
if x2 >= x1 and y2 >= y1:
  x3=x2-abs(y2-y1)
  x4=x1-abs(y2-y1)
  y3=y2+abs(x2-x1)
  y4=y1+abs(x2-x1)
elif x2 < x1 and y2 >= y1:
  x3=x2-abs(y2-y1)
  x4=x1-abs(y2-y1)
  y3=y2-abs(x2-x1)
  y4=y1-abs(x2-x1)
elif x2 < x1 and y1 >= y2:
  x3=x2+abs(y2-y1)
  x4=x1+abs(y2-y1)
  y3=y2-abs(x2-x1)
  y4=y1-abs(x2-x1)
else:
  x3=x2+abs(y2-y1)
  x4=x1+abs(y2-y1)
  y3=y2+abs(x2-x1)
  y4=y1+abs(x2-x1)
print(x3,y3,x4,y4)

Buggy submission (verdict: Runtime Error):
x1,y1,x2,y2=map(int,input().split())
Dist = abs(y1-y2)**2+abs(x1-x2)**2
dist = Dist**0.5
for i in range(-1000,1000):
  if Dist*(i-x2)**2==Dist*(y2-y1)**2:
    if i < x2:
      x3 = i
      y3 = y2 - (x2-x1)*(x3-x2)//(y2-y1)
  if Dist*(i-x1)**2==Dist*(y2-y1)**2:
    if i < x1:
      x4 = i
      y4 = y1 - (x2-x1)*(x4-x1)//(y2-y1)
print(x3,y3,x4,y4)
Problem p02624 (python)

Fixed submission:
n=int(input());print(sum((x:=n//i)*(x+1)*i//2 for i in range(1,n+1)))

Buggy submission (verdict: Runtime Error):
print(sum((j:=i+1)(x:=n//j)*(x+1)*i//2for i in range(n:=int(input()))))
Problem p02792 (python)

Fixed submission:
n=int(input())
D=[[0 for _ in range(10)] for _ in range(10)]
for i in range(1,n+1):
    s=str(i)
    D[int(s[0])][int(s[-1])]+=1
a=0
for i in range(10):
    for j in range(10):
        a+=D[i][j]*D[j][i]
print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
D=[[0 for _ in range(9)] for _ in range(9)]
for i in range(n):
    s=str(n)
    D[s[0]][s[-1]]+=1
a=0
for i in range(1,10):
    for j in range(1,10):
        a+=D[i][j]*D[j][i]
print(a)
Problem p02819 (python)

Fixed submission:
x=int(input())
while 1:
  for i in range(2,int(x**0.5+1)):
    if x%i==0:
      x+=1
      break
  else:
    print(x)
    exit()

Buggy submission (verdict: Runtime Error):
x=int(input())
while 1:
  for i in range(int(x**0.5+1)):
    if x//i==0:
      x+=1
      break
  else:
    print(X)
    break
Problem p02984 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
X = [0 for i in range(N)]
S = 0
A2n = 0
for i in range(N):
    S += A[i]
    if i % 2 == 1:
        A2n += A[i]
X[0] = S - 2 * A2n
print(X[0], end=" ")
for i in range(1, N):
    X[i] = 2 * (A[i - 1] - int(X[i - 1] / 2))
    if i == N:
        print(X[i], end="")
    else:
        print(X[i], end=" ")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
X = [0 for i in range(N)]
S = 0
A2n = 0
for i in range(N):
    S += A[i]
    if i % 2 == 1:
        A2n += A[i]
X[0] = S - 2 * A2n
print(X[0], end=" ")
for i in range(1, N):
    X[i] = 2 * (A[i - 1] - int(X[i - 1] / 2))
    if i = N:
        print(X[i], end="")
    else:
        print(X[i], end=" ")

Buggy submission (verdict: Runtime Error):
n, m, M = (int(_) for _ in input().split())
dp = [[0 for i in range(n + 1)] for j in range(m + 1)]
dp[0][0] = 1
for i in range(1, m + 1):
    for j in range(n + 1):
        if j - i >= 0:
            dp[i][j] = (dp[i - 1][j] + dp[i][j -i]) % M
        else:
            dp[i][j] = dp[i - 1][j]
    print(dp)
print(dp[m][n])
Problem p02990 (python)

Fixed submission:
#ABC132 D
import math
def cmb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, K = map(int, input().split())
for i in range(K):
    try:
        print((cmb(N - K + 1, i + 1) * cmb(K - 1, i)) % ((10 ** 9) + 7))
    except:
        print(0)

Buggy submission (verdict: Runtime Error):
#ABC132 D
import math
def cmb(n, r):
    s = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    return s
N, K = map(int, input().split())
for i in range(K):
    print((cmb(N - K + 1, i + 1) * cmb(K - 1, i)) % ((10 ** 9) + 7) )

Buggy submission (verdict: Runtime Error):
#ABC132 D
import math
def cmb(n, r):
    s = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    return s
N, K = map(int, input().split())
for i in range(K):
    print(cmb(N - K + 1, i + 1) % ((10 ** 9) + 7) * cmb(K - 1, i))
Problem p03013 (python)

Fixed submission:
#ABC129 C
N, M = (int(_) for _ in input().split())
a = [0 for i in range(M)]
MOD = 10 ** 9 + 7
for i in range(M):
    a[i] = int(input())
a.append(0)
dp = [0 for i in range(N + 1)]
j = 0
for i in range(N + 1):    
    if i == a[j] and M != 0:
        j += 1
    elif i == 0:
        dp[i] = 1
    elif i == 1:
        dp[i] = 1
    else:
        dp[i] = dp[i - 1] + dp[i - 2]
print(dp[N] % MOD)

Buggy submission (verdict: Runtime Error):
N, M = (int(_) for _ in input().split())
a = [0 for i in range(M)]
MOD = 10 ** 9 + 7
for i in range(M):
    a[i] = int(input())
a.append(0)
dp = [0 for i in range(N + 1)]
j = 0
for i in range(N + 1):
    if i == a[j]:
        j += 1
    elif i == 0:
        dp[i] = 1
    elif i == 1:
        dp[i] = 1
    else:
        dp[i] = dp[i - 1] + dp[i - 2]
print(dp[N] % MOD)
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = list(input())
S[K -1] = S[K - 1].lower()
print(''.join(S))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(input())
S[K] = S[K].lower()
print(S[i] for i in range(N))

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

Fixed submission:
n,m=map(int,input().split())
A = [list(map(int,input().split())) for _ in range(n)]
C = [list(map(int,input().split())) for _ in range(m)]
for a,b in A:
  l=[abs(a-c)+abs(b-d) for c,d in C]
  print(l.index(min(l))+1)

Buggy submission (verdict: Runtime Error):
3 4
10 10
-10 -10
3 3
1 2
2 3
3 5
3 5
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] = [int(x) for x in input().split()]

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

if sum(a)+sum(b) <= k:
    print(n+m)


else:
    if sum(a) < sum(b):
        small = a
        big = b
    else:
        small = b
        big = a

    # print(sum(small))

    if sum(small) == k:
        print(len(small))


    if sum(small) < k:
        count = 0
        while sum(small) < k:
            small.append(big.pop(0))
            count += 1
        
        print(len(small) + count)

    elif sum(small) > k:
        # print("here")
        while len(small) > 0 and sum(small) > k:
            small.pop(0)
        count = 0
        while len(small) > 0 and sum(small) <= k:
            small.append(big.pop(0))
            if sum(small) > k:
                small.pop()
            count += 1
        print(len(small))
        # print(small)

    


    
# ans = 0
# temp = 0
# for i in range(len(a)):
#     if temp+a[i] <= k:
#         temp+=a[i]
#         ans += 1

#     else:
#         break

# for i in range(len(b)):
#     if temp+b[i] <= k:
#         temp+=b[i]
#         ans += 1

#     else:
#         break

# print(ans)


# ans =0 


# while k > 0 and len(b)>0 and len(a)>0:
#     if len(a) > 0 and a[0] <= b[0]:
#         if k >= a[0]:
#             k -= a[0]
#             ans += 1
#             a.pop(0)
#         else:
#             break

#     elif len(b) > 0 and  b[0] <= a[0]:
#         if k >= b[0]:
#             k -= b[0]
#             ans += 1
#             b.pop(0)
#         else:
#             break


# if len(b)>0:
#     while len(b)>0 and k >= b[0]:
#         k -= b[0]
#         ans += 1
#         b.pop(0)

# elif len(a)>0:
#     while len(a)>0 and k >= a[0]:
#         k -= a[0]
#         ans += 1
#         a.pop(0)
Problem p02831 (python)

Fixed submission:
def gcd(a,b):
    if a<b:
        t=a
        a=b
        b=t
    while b!=0:
            a,b=b,a%b
    return a

n,m=map(int,input().split())
print(int(n*m/gcd(n,m)))

Buggy submission (verdict: Runtime Error):
import math
n,m=map(int,input().split())
print(int(n*m/math.gcd(n,m)))

Buggy submission (verdict: Runtime Error):
import math
n,m=map(int,input().split())
print(n*m//math.gcd(n,m))
Problem p02759 (python)

Fixed submission:
n = int(input())
print(n//2+n % 2)

Buggy submission (verdict: Runtime Error):
n=int(input(n))
print(n//2+n%2)