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

Fixed submission:
S = input()
K = int(input())
now,cnt,num = S[0],1,0
for i in S[1:-1]:
    if i == now:
        cnt += 1
    else:
        num += cnt//2
        cnt = 1
        now = i
if S[-1] == now:
    num += (cnt+1)//2
else: num += cnt//2

S = S + S
now,cnt,num2 = S[0],1,0
for i in S[1:-1]:
    if i == now:
        cnt += 1
    else:
        num2 += cnt//2
        cnt = 1
        now = i
if S[-1] == now:
    num2 += (cnt+1)//2
else: num2 += cnt//2

length = len(S)//2
if len(set(S)) == 1 and length%2 == 1:
    print(length//2*K + K//2)
    exit()

if num2 - num*2 == 1:
    ans = K - 1 + num*K
else:
    ans = num*K
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

if len(set(s)) == 1:
    print(len(S)*K//2)
    exit()

b = [1]
for i in S[:-1]:
    if S[i] == S[i+1]:
        b[-1] += 1
    else:
        b.append(1)

ans = 0
for i in b:
    ans += i//2
ans *= K

if S[0] == S[-1] and b[0]%2 == b[-1]%2 == 1:
    ans += K - 1
print(ans)
Problem p03038 (python)

Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
B = [list(map(int,input().split())) for _ in range(M)]
B.sort(key = lambda x:x[1])
B = list(reversed(B))
A.sort()

num = 0
for i in range(M):
    for j in range(B[i][0]):
        if num > N-1:
            break
        if A[num] < B[i][1]:
            A[num] = B[i][1]
            num += 1
        else:
            break

print(sum(A))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))
B = [list(map(int,input().split())) for _ in range(M)]
B.sort(key = lambda x:x[1])
B = list(reversed(B))
A.sort()

num = 0
for i in range(M):
    for j in range(B[i][0]):
        if A[num] < B[i][1]:
            A[num] = B[i][1]
            num += 1
        else:
            break
        
print(sum(A))
Problem p02753 (python)

Fixed submission:
s = input()
if s in "AAA-BBB":
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
s = int(input())
if s in "AAA-BBB":
    print("No")
else:
    print("Yes")
Problem p02779 (python)

Fixed submission:
import collections
n = int(input())
ls = list(map(int,input().split()))
if len(ls) == len(collections.Counter(ls)):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
n = int(input())
ls = list(map(int, input().split()))
for i in range(0,n-1):
    for u in range(0, n-1):
        if ls(i) == ls(u):
            print("No")
else:
    print("Yes")
Problem p02831 (python)

Fixed submission:
from fractions import gcd
import sys
sys.setrecursionlimit(10**7)
a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // gcd(x, y)
if b != 0:
    print(lcm(a, b))
else:
    print(a)

Buggy submission (verdict: Runtime Error):
import math
import sys
sys.setrecursionlimit(10**7)
a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
if b != 0:
    print(lcm(a, b))
else:
    print(a)

Buggy submission (verdict: Runtime Error):
import math
import sys
sys.setrecursionlimit(10**11)
a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
if b != 0:
    print(lcm(a, b))
else:
    print(a)

Buggy submission (verdict: Runtime Error):
import math
import sys
sys.setrecursionlimit(10**10)
a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
if b != 0:
    print(lcm(a, b))
else:
    print(a)

Buggy submission (verdict: Runtime Error):
import math
import sys
sys.setrecursionlimit(10**9)
a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
if b != 0:
    print(lcm(a, b))
else:
    print(a)

Buggy submission (verdict: Runtime Error):
import math
import sys
sys.setrecursionlimit(10**1000000)
a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
if b != 0:
    print(lcm(a, b))
else:
    print(a)

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
if b != 0:
    print(lcm(a, b))
else:
    print(a)

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))

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 p02897 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
ls = list(map(int,input().split()))
a = [0 for j in range(n)]
for i in range(n):
    a[i] = [ls[i],str(i+1)]
a.sort()
for k in range(n):
    print(a[k][1],end=' ')
Problem p02990 (python)

Fixed submission:
from operator import mul
from functools import reduce
n,k = map(int,input().split())
ans = 0
mod = 10**9+7
def cmb(n, r):
    if r > n:
        return 0
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under
for i in range(1,k+1):
    cnt = cmb(n-k+1,i)* cmb(k-1, i-1)
    print(cnt%mod)

Buggy submission (verdict: Runtime Error):
import math
n,k = map(int,input().split())
ans = 0
mod = 10**9+7
def combinations_count(n, r): #組み合わせ(nCr)
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(1,k+1):
    cnt = combinations_count(n-k+1,i)* combinations_count(k-1, i-1)
    print(cnt%mod)

Buggy submission (verdict: Runtime Error):
import math
n,k = map(int,input().split())
ans = 0
mod = 10**9+7
def combinations_count(n, r): #組み合わせ(nCr)
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(1,k+1):
    cnt = combinations_count(n-k+1,i)* combinations_count(k-1, i-1)% mod
    print(cnt%mod)

Buggy submission (verdict: Runtime Error):
import math
n,k = map(int,input().split())
ans = 0
mod = 10**9+7
def combinations_count(n, r): #組み合わせ(nCr)
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(1,k+1):
    cnt = combinations_count(n-k+1,i)* combinations_count(k-1, i-1)% mod
    print(cnt)
Problem p03038 (python)

Fixed submission:
n,m = map(int,input().split())
ls = list(map(int,input().split()))
di = [list(map(int,input().split())) for _ in range(m)]
fi = []
for i,j in di:
    fi.append([j,i])
for k in ls:
    fi.append([k,1])
fi.sort(reverse=True)
ans = 0
cnt = 0
how = 0
while True:
    if how + fi[cnt][1] < n:
        how += fi[cnt][1]
        ans += fi[cnt][1]*fi[cnt][0]
    else:
        ans += (n-how)*fi[cnt][0]
        break
    cnt += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ls = set(map(int,input().split()))
for i in range(m):
    b,c = map(int,input().split())
    ls.sort()
    for j in range(b):
        if ls[j] < c:
            ls[j] = c
print(sum(ls))
Problem p02547 (python)

Fixed submission:
n = int(input())
cnt = 0
for _ in range(n):
  a, b = map(int, input().split())
  if a == b:
    cnt += 1
  else:
    cnt = 0
  
  if cnt == 3:
    print("Yes")
    exit()

print("No")

Buggy submission (verdict: Runtime Error):
cnt = 0
for _ in range(n):
  a, b = map(int, input().split())
  if a == b:
    cnt += 1
  else:
    cnt = 0
  
  if cnt == 3:
    print("Yes")
    exit()

print("No")
Problem p02598 (python)

Fixed submission:
import math

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

l = 1
r = 10**9+1

while l < r:
    mid = (l+r)//2
    count = 0
    for i in range(n):
        if A[i] > mid:
            count += math.ceil(A[i]//mid)

    if count <= k:
        r = mid
    else:
        l = mid+1


print(l)

Buggy submission (verdict: Runtime Error):
import math

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

l = 0
r = 10**9+1

while l < r:
    mid = (l+r)//2
    count = 0
    for i in range(n):
        if A[i] > mid:
            count += math.ceil(A[i]//mid)

    if count <= k:
        r = mid
    else:
        l = mid+1



print(l)
Problem p02685 (python)

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

N = 10**6  # N!まで求める
fact  = [1, 1]  # 階乗の元テーブル
fact_inv = [1, 1]  # 階乗の逆元テーブル
inv = [0, 1]  # 逆元テーブル計算用テーブル 1,2,,...の逆元を求めてる

# 計算 O(1)
def comb(n, r, mod):
    if (r<0 or r>n):
        return 0
    r = min(r, n-r)
    return fact[n] * fact_inv[r] * fact_inv[n-r] % mod

# 順列
def perm(n, r, mod):
    if (r<0 or r>n):
        return 0
    return fact[n] *  fact_inv[n-r] % mod

# 前処理 O(n)
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod//i)) % mod)
    fact_inv.append((fact_inv[-1] * inv[-1]) % mod)

ans = 0
for i in range(k+1):
    ans += comb(n-1, i, mod) * m * pow(m-1, n-i-1, mod)
    ans %= mod

print(ans)

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

N = 10**5  # N!まで求める
fact  = [1, 1]  # 階乗の元テーブル
fact_inv = [1, 1]  # 階乗の逆元テーブル
inv = [0, 1]  # 逆元テーブル計算用テーブル 1,2,,...の逆元を求めてる

# 計算 O(1)
def comb(n, r, mod):
    if (r<0 or r>n):
        return 0
    r = min(r, n-r)
    return fact[n] * fact_inv[r] * fact_inv[n-r] % mod

# 順列
def perm(n, r, mod):
    if (r<0 or r>n):
        return 0
    return fact[n] *  fact_inv[n-r] % mod

# 前処理 O(n)
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod//i)) % mod)
    fact_inv.append((fact_inv[-1] * inv[-1]) % mod)

ans = 0
for i in range(k+1):
    ans += comb(n-1, i, mod) * m * pow(m-1, n-i-1, mod)
    ans %= mod

print(ans)
Problem p02990 (python)

Fixed submission:
import math

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

def cmb(n, r):
    return math.factorial(n)// (math.factorial(n-r) * math.factorial(r))

for i in range(k):
    if i <= n-k:
        print(cmb(n-k+1, i+1) * cmb(k-1, i) % 1000000007)
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
import math

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

def cmb(n, r):
    return math.factorial(n)// (math.factorial(n-r) * math.factorial(r))

for i in range(k):
    if i <= k:
        print(cmb(n-k+1, i+1) * cmb(k-1, i) % 1000000007)
    else:
        print(0)
Problem p03013 (python)

Fixed submission:
import sys
sys.setrecursionlimit(150000)

n, m = map(int, input().split())
bad = [int(input()) for _ in range(m)]
MOD = int(1e9+7)

memo = {0:1, 1:1}
for i in bad:
    memo[i] = 0

def fib(n, mod):
    if n not in memo:
        memo[n] = (fib(n-1, mod) + fib(n-2, mod)) % mod
    return memo[n]

print(fib(n, MOD))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

n, m = map(int, input().split())
bad = [int(input()) for _ in range(m)]
MOD = int(1e9+7)

memo = {0:1, 1:1}
for i in bad:
    memo[i] = 0

def fib(n, mod):
    if n not in memo:
        memo[n] = (fib(n-1, mod) + fib(n-2, mod)) % mod
    return memo[n]

print(fib(n, MOD))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(50000)

n, m = map(int, input().split())
bad = [int(input()) for _ in range(m)]
MOD = int(1e9+7)

memo = {0:1, 1:1}
for i in bad:
    memo[i] = 0

def fib(n, mod):
    if n not in memo:
        memo[n] = (fib(n-1, mod) + fib(n-2, mod)) % mod
    return memo[n]

print(fib(n, MOD))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(30000)

n, m = map(int, input().split())
bad = [int(input()) for _ in range(m)]
MOD = int(1e9+7)

memo = {0:1, 1:1}
for i in bad:
    memo[i] = 0

def fib(n, mod):
    if n not in memo:
        memo[n] = (fib(n-1, mod) + fib(n-2, mod)) % mod
    return memo[n]

print(fib(n, MOD))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
bad = [int(input()) for _ in range(m)]
MOD = int(1e9+7)

memo = {0:1, 1:1}
for i in bad:
    memo[i] = 0

def fib(n, mod):
    if n not in memo:
        memo[n] = (fib(n-1, mod) + fib(n-2, mod)) % mod
    return memo[n]

print(fib(n, MOD))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
bad = [int(input()) for _ in range(m)]
MOD = int(1e9+7)

memo = {0:1, 1:1}
for i in bad:
    memo[i] = 0

def fib(n, mod):
    if n not in memo:
        memo[n] = (fib(n-1, mod) + fib(n-2, mod)) % mod
    return memo[n]

print(fib(n, MOD))
Problem p03042 (python)

Fixed submission:
s = input()

front = int(s[:2])
back = int(s[2:])

if 1 <= front <= 12:
    if 1 <= back <=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<= back <= 12:
        print("YYMM")
    else:
        print("NA")

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

front = s[:2]
back =s[2:]

if (front == "00" or back == "00") or (front > 13 and back >13):
    print("NA")
elif 1 <= int(back) <= 12:
    if 1 <= int() <= 12:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    print("MMYY")
Problem p03137 (python)

Fixed submission:
n, m = map(int, (input().split()))
x = list(map(int, input().split()))
x = sorted(x)
diff = []
for i in range(m-1):
    diff.append(x[i+1] - x[i])

diff = sorted(diff, reverse=True)

dist = x[-1] - x[0]
if dist < n:
    print(0)
    exit()

if m < n:
    print(0)
    exit()

for i in range(n-1):
    dist -= diff[i]

print(dist)

Buggy submission (verdict: Runtime Error):
n, m = map(int, (input().split()))
x = list(map(int, input().split()))
x = sorted(x)
diff = []
for i in range(m-1):
    diff.append(x[i+1] - x[i])

diff = sorted(diff, reverse=True)

dist = x[-1] - x[0]
if dist < n:
    print(0)
    exit()

for i in range(n-1):
    dist -= diff[i]

print(dist)
Problem p02546 (python)

Fixed submission:
S=input()
if S[-1]=="s":
  	print(S+"es")
else:
  	print(S+"s")

Buggy submission (verdict: Runtime Error):
input=(S)
if S[-1]!="s":
  	print(S+"s")
elif S[-1]=="s":
  	print(S+"es")
Problem p03073 (python)

Fixed submission:
S = list(input())

#1
count_1 = 0
count_2 = 0
for i in range(len(S)):
  #bwbw
  if i % 2 == 0:
    if S[i] == '1':
      count_1 += 1
  elif S[i] == '0':
    count_1 += 1
  
  #wbwb
  if i % 2 == 0:
    if S[i] == '0':
      count_2 += 1
  elif S[i] == '1':
    count_2 += 1
    
print(min(count_1, count_2))

Buggy submission (verdict: Runtime Error):
S = int(input())
S_list = [int(x) for x in list(str(S))]
S_str = str(S)
S_list_1 = S_list.split('0')
S_list_2 = S_list.split('1')
output = 0

for i in range(len(S_list_1)):
  output += int(S_list_1[i]) // 2
for i in range(len(S_list_2)):
  output += int(S_list_2[i]) // 2
  
print(output)

Buggy submission (verdict: Runtime Error):
S = int(input())
S_list = [int(x) for x in list(str(S))]
S_str = str(S)
S_list_1 = input().split('0')
S_list_2 = input().split('1')
output = 0

for i in range(len(S_list_1)):
  output += int(S_list_1[i]) // 2
for i in range(len(S_list_2)):
  output += int(S_list_2[i]) // 2
  
print(output)
Problem p03250 (python)

Fixed submission:
A = list(map(int, input().split()))
A.sort(reverse = True)

print(A[0] * 10 + A[1] + A[2])

Buggy submission (verdict: Runtime Error):
A = list(map(int, input().split()))
A.sort(reverse = True)

print(A[0] * 10 + A[1] + A[2]
Problem p02754 (python)

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

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
2 ans = N // (A + B) * A
3 rem = N % (A + B)
4 ans += min(rem, A)
5 print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
2 ans = N // (A + B) * A
3 rem = N % (A + B)
4 ans += min(rem, A)
5 print(ans)
Problem p02627 (python)

Fixed submission:
a=str(input())
if a.islower()==True:
    print('a')
else:
    print('A')

Buggy submission (verdict: Runtime Error):
a=str(input())
if a.islower()==True:
    print(a)
else:
    print(A)

Buggy submission (verdict: Runtime Error):
a=str(input())
if a.islower():
    print(a)
else:
    print(A)

Buggy submission (verdict: Runtime Error):
a=str(input())
if a.islower():
    print(a)
else:
    print(A)

Buggy submission (verdict: Runtime Error):
a=str(input())
if a.islower():
    print(a)
else:
    print(A)

Buggy submission (verdict: Runtime Error):
a=str(input())
print(string.upper())
Problem p02829 (python)

Fixed submission:
a=int(input())
b=int(input())
if (a==1 and b==2) or (a==2 and b==1):
    print('3')
if (a==1 and b==3) or (a==3 and b==1):
    print('2')
if (a==2 and b==3) or (a==3 and b==2):
    print('1')

Buggy submission (verdict: Runtime Error):
i=int (input())
a=list(input().split(" "))
n=len(a[0])
for i in range(0,n):
    print(a[0][i]+a[1][i],end="")
Problem p02572 (python)

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

mod = 10 ** 9 + 7
sums = sum(arr)

answer = 0
for num in arr:
    sums -= num
    answer = (answer + (sums * num)) % mod

print(answer)

Buggy submission (verdict: Runtime Error):
# 与えられた数値の桁数と桁値の総和を計算する.
def calc_digit_sum(num):
    digits = sums = 0
    while num > 0:
        digits += 1
        sums += num % 10
        num //= 10
    return digits, sums


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

MOD = 10 ** 9 + 7

answer = 0
t = itertools.combinations(arr, 2)
for i in t:
    answer = (answer + i[0] * i[1]) % MOD

print(answer)
Problem p02633 (python)

Fixed submission:
import math

x = int(input())
if 360 % x == 0:
    print(360 // x)
else:
    common = 360 * x // math.gcd(360, x)
    ans = common // x
    print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
if 360 % x == 0:
    print(360 // x)
else:
    common = 360 * x // math.gcd(360, x)
    ans = common // x
    print(ans)
Problem p02831 (python)

Fixed submission:
import fractions

a, b = map(int, input().split())
ans = a * b / fractions.gcd(a,b)
print(int(ans))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())
ans = a * b / math.gcd(a,b)
print(int(ans))
Problem p03127 (python)

Fixed submission:
import math

n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(n):
    ans = math.gcd(a[i], ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.append(a[0])
div = a[0]
minVal = a[0]
for i in range(n+1):
    mod = a[i] % div
    if mod > 0:
        minVal = min(mod, div - mod, minVal, mod - (div - mod))
        div = minVal
    else:
        continue
print(minVal)
Problem p02547 (python)

Fixed submission:
n = int(input())
ans = "No"
j = 0
for i in range(n):
  d,dd = map(str,input().split())
  if(d==dd):
    j += 1
  else:
    j=0
  if(j>=3):
    ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
N =int(input())
D = []
for i in range(n):
  D.append([])#配列の末尾に空の配列を追加

for i in range(N):
	for j in range(2):
      	D[i][j]=int(input())

for x in range(N-2):
  	if D[x][1]==D[x][2] and D[x+1][1]==D[x+1][2] and D[x+2][1]==D[x+2][2]:
      	print("Yes")
        break
    else:
      	print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = "No"
j = 0
for i in range(n):
  d,dd = map(str,input().split())
  if(d==dd):
    if(j>0):
      j += 1
  else:
    j=0
  if(j=>3):
    ans = "Yes"
print(ans)
Problem p02572 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
h = sum(a)
ans = 0
for i in range(n):
  h -= a[i]
  ans += a[i]*(h)
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
h = sum(a)
ans = 0
for i in range(n):
  h -= a[i]
  ans = (ans + (a[i]*(h))%(10**9+7)
print(ans)
Problem p02595 (python)

Fixed submission:
n,d = map(int,input().split())
ans = 0
for i in range(n):
  x,y = map(int,input().split())
  if(d >= (x**2+y**2)**(1/2)):
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,d = int(input())
ans = 0
for i in range(n):
  x,y = map(int,input().split())
  if(d>=(x**2+y**2)**(1/2)):
    ans += 1
print(ans)
Problem p02596 (python)

Fixed submission:
k = int(input())
m = 7
if(k%2==0):
  print("-1")
else:
  i = 1
  while True:
    m = m%k
    if(m==0):
      print(i)
      break  
    if(i>k):
      print("-1")
      break
    m *= 10
    m += 7
    i += 1

Buggy submission (verdict: Runtime Error):
k = int(input())
m = 7
if(k%2==0):
  print("-1")
else:
  i = 1
  while True:
    m = m%k
    if(j==0):
      print(i)
      break  
    if(i>k):
      print("-1")
      break
    m *= 10
    m += 7
    i += 1
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 = 0
j = M
for i in range(N + 1): 
  if a[i]>K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
a = list(map(int.input().split()))
b = list(map(int,input().split()))
for i in range(1,n):
  a[i] += a[i-1]
for  i in range(1,m):
  b[i] += b[i-1]
ans = -100
for i in range(n):
  for j in range(m):
    if(a[i]+b[j]>=k):
      break
    ans = max(ans,a[i]+b[j])
print(ans)
Problem p02693 (python)

Fixed submission:
k = int(input())
a,b = map(int,input().split())
ans = "NG"
for i in range(a,b+1):
  if(i%k==0):
    ans="OK"
print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())
a,b = map(int,input()split())
ans = "NG"
for i in range(a,b+1):
  if(i%k==0):
    ans="OK"
print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())
a,b = int(input())
ans = "NG"
for i in range(a,b+1):
  if(i%k==0):
    ans = "OK"
print(ans)
Problem p02707 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
ans = []
for i in range(N):
  ans.append(0)
for i in range(N-1):
  ans[A[i]-1] += 1
for i in range(N):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
ans = []
for i in range(N):
  ans.append.(0)
for i in range(N-1):
  ans[A[i]] += 1
print(ans)
Problem p02777 (python)

Fixed submission:
s,t = map(str,input().split())
a,b = map(int,input().split())
u = str(input())
if(u==s):
  print(a-1,b)
elif(u==t):
  print(a,b-1)

Buggy submission (verdict: Runtime Error):
s,t = map(str,input().split())
a,b = map(str,input().split())
u = str(input())
if(u==s):
  print(a-1,b)
elif(u==t):
  print(a,b-1)
Problem p02785 (python)

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True)
ans = 0
if(k>=n):
  ans = 0
else:
  for i in range(k,n):
    ans += h[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverce=True)
ans = 0
if(k>=n):
  ans = 0
else:
  for i in range(k,n):
    ans += h[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverce=True):
ans = 0
if(k>=n):
  ans = 0
else:
  for i in range(k,n):
    ans += h[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True):
ans = 0
for i in range(k,n):
  ans += h[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse==True):
ans = 0
for i in range(k,n):
  ans += h[i]
print(ans)
Problem p02832 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
if(1 in a):
  ans = 0
  jud = 0
  f = 1
  for i in range(n):
    if(a[i]!=f):
      ans += 1
    else:
      f += 1
  print(ans)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
if(1 in a):
  ans = 0
  jud = 0
  f = 1
  for i in range(n):
    if(p[0]!=f):
      del p[0]
      ans += 1
    else:
      f += 1
  print(ans)
else:
  print(-1)
Problem p02836 (python)

Fixed submission:
S = str(input())
s = list(S)
g= []
m = len(s)//2
ans = 0
for i in range(m):
  if(s[i]==s[len(s)-1-i]):
    None
  else:
    ans+= 1
print(ans)

Buggy submission (verdict: Runtime Error):
S = str(input())
s = list(S)
g= []
m = len(s)//2
ans = 0
for i in range(m):
  if(s[i]==s[lens-1-i]):
    None
  else:
    ans+= 1
print(ans)
Problem p02915 (python)

Fixed submission:
N = int(input())
print(N**3)

Buggy submission (verdict: Runtime Error):
N = int(input())
print(n**3)