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

Fixed submission:
N = int(input())

num = [[0] * 10 for i in range(10)]

for i in range(1, N+1):
    top = int(str(i)[0])
    end = int(str(i)[-1])
    num[top][end] += 1

count = 0
for i in range(10):
    for j in range(10):
        count += num[i][j] * num[j][i]

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())

num = [[0] * 10 for _ in range(10)]

for i in range(1, N+1):
    top = int(str(i)[0])
    end = int(str(i)[-1])
    num[top][end] += 1

ans = 0
for i in range(10):
    for j in range(10):
        count += num[i][j] * num[j][i]

print(count)
Problem p02596 (python)

Fixed submission:
import math
k=int(input())
if k%7==0:k//=7
if math.gcd(10,k)!=1: exit(print(-1))
if k==1: exit(print(1))
v=1
ans=0
while(v!=0):
    v=(v*10+1)%k
    ans+=1 
print(ans+1)

Buggy submission (verdict: Runtime Error):
import math
k=int(input())
if k%7==0:k/=7
if math.gcd(10,k)!=1: exit(print(-1))
if k==1: exit(print(1))
v=1
ans=0
while(v!=0):
    v=(v*10+1)%k
    ans+=1 
print(ans+1)
Problem p02753 (python)

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

Buggy submission (verdict: Runtime Error):
s=input()
if(s[0]==s[1] and s[1]==s[2])print("Yes")
else print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if(s[0]==s[1]==s[2])print("Yes")
else print("No")
Problem p02633 (python)

Fixed submission:
x = int(input())
     
if 360 % x == 0:
  print(360 // x)
else:
  import math
  gcd = math.gcd(x, 360)
  lcm = (x * 360) // gcd
  print(lcm // x)

Buggy submission (verdict: Runtime Error):
x = int(input())

if 360 % x == 0:
  print(360 // x)
else:
  import math
  gcd = mat.gcd(x, 360)
  lcm = (x * 360) // gcd
  print(lcm // x)
Problem p02629 (python)

Fixed submission:
n = int(input())
ans = ''

for i in range(1,99):
    if n <= 26**i:
        n -= 1
        for j in range(i):
            ans += chr(ord('a')+n%26)
            n //= 26
        break
    else:
        n -= 26**i

print(ans[::-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = ''

for i in range(1,99):
    if n <= 26**i:
        n -= 1
        for j in range(i):
            ans += chr(ord('a')+N%26)
            n //= 26
        break
    else:
        n -= 26**i

print(ans[::-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = ''

for i in range(100):
    if n <= 26**i:
        n -= 1
        for j in range(i)
            ans += chr(ord('a')+N%26)
            n //= 26
        break
    else:
        n -= 26**i

print(ans[::-1])
Problem p02753 (python)

Fixed submission:
s = list(input())


if len(list(set(s))) == 1:
  print("No")
else:
  print("Yes")

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

s = int(n / (a + b))

if n % (a + b) == 0:
  print(a * s)
else:
  rem = n % (a + b)
  if rem <= a:
    ans = a * s + rem
  else:
    ans = a * s + a
  print(ans)
Problem p02754 (python)

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

s = int(n / (a + b))

if n % (a + b) == 0:
  print(a * s)
else:
  rem = n % (a + b)
  if rem <= a:
    ans = a * s + rem
  else:
    ans = a * s + a
  print(ans)

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

s = int(n / (a + b))

if n % (a + b) == 0:
  print(a * s)
else:
  rem = n % (a + b)
  if rem <= a:
    ans = a * s + rem
  else:
    ans = a * s + (rem % a)
  print(ans)
Problem p02879 (python)

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

if (a < 10 and b < 10):
  ans = a * b
else:
  ans = -1

print(ans)

Buggy submission (verdict: Runtime Error):
a, b = int(input())

if (a < 10 and b < 10):
  ans = a * b
else:
  ans = -1

print(ans)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
  print(s)

else:
  print("red")

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


all_sum = 0

for i in range(n):
  all_sum += 1/a[i]

ans = 1 / all_sum

print(ans)

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

all_sum = 0

for i in range(n):
  all_sum += 1/a[i]

ans = 1 / all_sum

print(ans)
Problem p03135 (python)

Fixed submission:
i = list(map(int, input().split()))
ans = 0.0

if 1 <= i[0] and i[0] <= 100:
  if 1 <= i[1] and i[1] <= 100:
    ans = i[0] / i[1]
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
max_num = 0
max_index = 0
total = 0

for i in range(n):
  if max_num < l[i]:
    max_num = l[i]
    max_index = i


l.pop(max_index)


for i in range(n - 1):
  total += l[i]

if total > max_num: print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
t = int(input())
x = int(input())
ans = 0.0

if 1 <= t and t <= 100:
  if 1 <= x and x <= 100:
    answer = t / x
    print(ans)

Buggy submission (verdict: Runtime Error):
t = int(input())
x = int(input())
answer = 0.0

if 1 <= t and t <= 100:
  if 1 <= x and x <= 100:
    answer = t / x
    print(answer)
Problem p02597 (python)

Fixed submission:
def resolve():
    '''
    code here
    '''
    N = int(input())
    stones = input()

    w = []
    r = []

    for i in range(N):
        if stones[i] == 'W':
            w.append(i)
        else:
            r.append(i)

    if len(w) != 0 and len(r) != 0:
        res = 0
        for i, val in enumerate(w):
            if val <= r[-1*(i+1)]:
                res += 1
            else:
                break
        print(res)
    else:
        print(0)

if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    N = int(input())
    stones = input()

    w = []
    r = []

    for i in range(N):
        if stones[i] == 'W':
            w.append(i)
        else:
            r.append(i)

    res = 0
    for i, val in enumerate(w):
        if val <= r[-1*(i+1)]:
            res += 1
        else:
            break
    print(res)

if __name__ == "__main__":
    resolve()
Problem p02891 (python)

Fixed submission:
def resolve():
    '''
    code here
    Sを先頭　真ん中　お尻の三分割する
    連結した場合を考えると以下の場合分け
    先頭　お尻　真ん中×K　（先頭₊お尻）×（K-1）
    同じ文字が続いたらn//2個の文字変更が必要
    以上で解けるはず

    '''
    S = input()
    K = int(input())

    S_head = ''
    head = S[0]
    for s in S:
        if s == head:
            S_head += s
        else:
            break
    
    S_tail = ''
    tail = S[-1]
    for s in S[::-1]:
        if s == tail:
            S_tail += s
        else:
            break
    S_tail = S_tail[::-1]

    S_body = S[len(S_head):-1 * len(S_tail)]
    
    def double_counter(S):
        cnt = 0
        if len(S) >= 2:
            prev = S[0]
            for item in S[1:]:
                if item == prev:
                    cnt += 1
                    prev = -1
                else:
                    prev = item

        return cnt
    
    if len(S) >= 2 and len(S) != len(S_head):
        res = len(S_head)//2\
            + len(S_tail)//2\
            + double_counter(S_body) * K\
            + double_counter(S_tail+S_head) * (K-1)
    elif len(S) == 1:
        res = K // 2
    elif len(S) == len(S_head):
        res = (K * len(S)) // 2

    print(res)

if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    line = input()
    K = int(input())


    base_cnt = 0
    prev = line[0]
    
    if len(line) >=2:
        for item in line[1:]:
            if item == prev:
                base_cnt += 1
                prev = -1
            else:
                prev = item
        
        if line[-1] == line[-2]:
            is_tail_double = True

    res = base_cnt * K
    # print(base_cnt, res)

    if line[0] == line[-1]:
        if not is_tail_double:
            res = base_cnt + (base_cnt + 1) * (K-1)

    if len(line) == 1:
        res = K //2
    
    print(res)

if __name__ == "__main__":
    resolve()
Problem p02897 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = [int(item) for item in input().split()]

if b > a:
    c = a
    a = b
    b = c


# 最大公約数を求める
def gcd(a, b):
    while b > 1:
        a, b = b, a%b
    return a

# 公約数でかつ素数の_listを求める
prime_devisor_list = [1, 2]

import math

def is_prime(num):
    if num in [1, 2]:
        return True
    else:
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                return False
        return True

for i in range(3, gcd(a, b)+1):
    if a % i == 0 and b % i == 0:
        # i can be ans
        # check pirme

        if is_prime(i):
            prime_devisor_list.append(i)

# 数をこたえる
len(prime_devisor_list)
Problem p02912 (python)

Fixed submission:
import heapq as hp
N, M = [int(item) for item in input().split()]
price_list = sorted([-1 * int(item) for item in input().split()])

total_m = 0

def discount(price_list, ticket_num):
    total_ticket =0
    hp.heapify(price_list)

    while total_ticket < ticket_num:
        temp = hp.heappop(price_list)
        hp.heappush(price_list, -1* (-1*temp//2))
        total_ticket += 1

    return price_list

res = discount(price_list, M)
print(-1 * sum(res))

Buggy submission (verdict: Runtime Error):
N, M = [int(item) for item in input().split()]
price_list = sorted([int(item) for item in input().split()])

ticket_list = []
total_price_list = []
total_m = 0

def discount(price_list, ticket_num):
    total_ticket =0

    while total_ticket < ticket_num:
        price_list[-1] = int(price_list[-1]/2)
        temp = price_list[-2]
        price_list[-2] = price_list[-1]
        price_list[-1] =temp
        total_ticket += 1

    return price_list

res = discount(price_list, M)
print(sum(res))
Problem p02915 (python)

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

Buggy submission (verdict: Runtime Error):
N, K = [int(item) for item in input().split()]
S = [item for item in input()]

def compress(arr):
    """圧縮して消えた人はhappy"""
    cnt_h = 0
    new_arr = []
    comp_arr = ['L']

    #最初は先頭をLにする　この回転はノーカン
    if arr[0] == 'R':
        for item in arr:
            if item == 'L':
                new_arr.append('R')
            else:
                new_arr.append('L')

            prev_item = item
    else:
        new_arr = arr
    # 圧縮操作と圧縮されたかずを数える

    for i in range(1, N):
        if new_arr[i - 1] == new_arr[i]:
            cnt_h += 1
        else:
            comp_arr.append(new_arr[i])

    return [comp_arr, cnt_h] 


def execute(arr, cnt_h, K):
    # 境界を全て反転するために必要な操作回数
    max_rotation = len(arr)//2
    # 全てLになるか反転回数がKに到達するかで終了
    if max_rotation <= K:
        cnt += len(arr) - 1
    else:
        cnt_h += 2*K

    return cnt_h

arr, cnt_h = compress(S)
print(execute(arr, cnt_h, K))
Problem p02954 (python)

Fixed submission:
def resolve():
    '''
    code here
    '''
    S = input()

    memo = 1
    new_list = []
    
    prev = S[0]
    cnt = 0

    for i in range(len(S)-1):
        if S[i+1] == prev:
            memo += 1
        else:
            new_list.append(memo)
            memo = 1
        prev = S[i+1]
    else:
        new_list.append(memo)

    # print(new_list)

    res = []
    for i in range(len(new_list)//2):

        a = new_list[i*2]
        b = new_list[i*2 +1]

        if (a+b)%2 == 1:
            res += [0 for _ in range(new_list[i*2])]
            res[-1] = (a+1)//2 + b//2
            res += [a//2 + (b+1)//2]
            res += [0 for _ in range(new_list[i*2+1]-1)]
        else:
            res += [0 for _ in range(new_list[i*2])]
            res[-1] = (a + b) // 2
            res += [(a + b ) // 2]
            res += [0 for _ in range(new_list[i*2+1]-1)]
    print(*res)




if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    S = input()

    memo = 1
    new_list = []
    
    prev = S[0]
    cnt = 0

    for i in range(len(S)-1):
        if S[i+1] == prev:
            memo += 1
        else:
            new_list.append(memo)
            memo = 1
        prev = S[i+1]
    else:
        new_list.append(memo)

    # print(new_list)

    res = []
    for i in range(len(new_list)//2):

        a = new_list[i*2]
        b = new_list[i*2 +1]
        cond = (10_000_000_000*10 - (a+b))%(a+b)

        if (a+b)%2 ==1:
            if cond % 2 == 1:
                res += [0 for _ in range(new_list[i*2])]
                res[-1] = new_list[i*2+1]
                res += [new_list[i*2]]
                res += [0 for _ in range(new_list[i*2+1]-1)]
            else:
                res += [0 for _ in range(new_list[i*2])]
                res[-1] = new_list[i*2]
                res += [new_list[i*2+1]]
                res += [0 for _ in range(new_list[i*2+1]-1)]
        else:
            res += [0 for _ in range(new_list[i*2])]
            res[-1] = (a + b) // 2
            res += [(a + b ) // 2]
            res += [0 for _ in range(new_list[i*2+1]-1)]
    print(*res)




if __name__ == "__main__":
    resolve()
Problem p03137 (python)

Fixed submission:
def resolve():
    '''
    code here
    '''
    import collections
    N, M = [int(item) for item in input().split()]
    Xs = [int(item) for item in input().split()]
    if N < M:
        Xs.sort()
        ds = [Xs[i] - Xs[i-1] for i in range(1, M)]
        ds.sort()
        # print(ds)
        print(sum(ds[:M-N]))

    else:
        print(0)


if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    import collections
    N, M = [int(item) for item in input().split()]
    Xs = [int(item) for item in input().split()]
    if N < M-1:
        Xs.sort()
        ds = [Xs[i] - Xs[i-1] for i in range(1, M)]
        ds.sort()
        # print(ds)
        print(sum(ds[:-1*(N-1)]))
    elif M - N == 1:
        Xs.sort()
        ds = [Xs[i] - Xs[i-1] for i in range(1, M)]
        ds.sort()
        # print(ds)
        print(sum(ds[0]))
        
    else:
        print(0)


if __name__ == "__main__":
    resolve()
Problem p03785 (python)

Fixed submission:
def resolve():
    '''
    code here
    '''
    N, C, K = [int(item) for item in input().split()]
    Ts = [int(input()) for _ in range(N)]
    Ts.sort()

    res = 0
    temp_psg = 0
    lim = Ts[0] + K

    for i in range(N):
        temp_psg += 1
        if Ts[i] > lim:
            res += 1
            temp_psg = 1
            lim = Ts[i] + K
        else:
            if temp_psg == C and i < N-1:
                res += 1
                temp_psg = 0
                lim = Ts[i+1] + K
        # print(Ts[i], temp_psg, res, lim)
    
    if temp_psg > 0:
        res += 1
    print(res)


if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    N, C, K = [int(item) for item in input().split()]
    Ts = [int(input()) for _ in range(N)]
    Ts.sort()

    res = 0
    temp_psg = 0
    lim = Ts[0] + K

    for i in range(N):
        temp_psg += 1
        if Ts[i] > lim:
            res += 1
            temp_psg = 1
            lim = Ts[i] + K
        else:
            if temp_psg == C:
                res += 1
                temp_psg = 0
                lim = Ts[i+1] + K
        # print(Ts[i], temp_psg, res, lim)
    
    if temp_psg > 0:
        res += 1
    print(res)


if __name__ == "__main__":
    resolve()
Problem p02629 (python)

Fixed submission:
n = int(input())
ans = ''
while n != 0:
    n -= 1
    ans += chr(ord('a') + n % 26)
    n //= 26
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
import math
n = int(input())

leng = int(math.log(n, 26))
org = leng
res = []
for i in reversed(range(leng)):
    leng = int(math.log(n, 26))
    num = n // 26**leng
    dum = n % 26**leng
    if dum == 0:
        res=('z'*org)
    else:
        res.append(chr(96+num))
    n -= 26**leng*num

if n%26 != 0:
    res.append(chr(96+n%26))

print(''.join(res))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
leng = int(math.log(n, 26))
res = []
for i in reversed(range(leng)):
    leng = int(math.log(n, 26))
    num = n // 26**leng
    res.append(chr(96+num))
    n -= 26**leng*num

if n%26 != 0:
    res.append(chr(96+n%26))

print(''.join(res))
Problem p02699 (python)

Fixed submission:
s,w = map(int,input().split())
if s <= w:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
for i in range(100):
    if c-b <= 0:
        print("yes")
        break
    elif  a-d <= 0:
        print("No")
        break
    else:
        a = a-d
        c = c-b
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

Ai = 0
Bi = 0
t = 0
result = 0

while True:
    if Ai>=N:
        break
    elif t + A[Ai] <= K:
        t += A[Ai]
        Ai += 1
    else:
        break
result = Ai

while True:
    if Bi >=  M:
        break
    if t + B[Bi] <= K:
        t += B[Bi]
        Bi += 1
        if Ai+Bi > result:
            result = Ai+Bi
    else:
        if Ai < 1:
            break
        t -= A[Ai-1]
        Ai -= 1

print(result)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

Ai = 0
Bi = 0
t = 0
result = 0

while True:
    if Ai>=N:
        break
    elif t + A[Ai] <= K:
        t += A[Ai]
        Ai += 1
    else:
        break
result = Ai

while True:
    if Ai < 1 or Bi>=M:
        break
    if t + B[Ai] <= K:
        t += B[Bi]
        Bi += 1
        if Ai+Bi > result:
            result = Ai+Bi
    else:
        t -= A[Ai-1]
        Ai -= 1

print(result)
Problem p02659 (python)

Fixed submission:
import math
from decimal import *
A, B = list(map(Decimal, input().split()))
print(math.floor(A*B))

Buggy submission (verdict: Runtime Error):
import math
A, B = list(map(decimal, input().split()))
B = B*100
print(math.floor(A*B/100))

Buggy submission (verdict: Runtime Error):
import math
A, B = list(map(decimal, input().split()))
print(math.floor(A*B))
Problem p02735 (python)

Fixed submission:
H, W = map(int, input().split())
s = []
for _ in range(H):
    s += [list(input())]

ls = [[0]*W for _ in range(H)]
ls[0][0] = int(bool(s[0][0]=="#"))

for i in range(1,W):
    ls[0][i] = ls[0][i-1]+ int(bool(s[0][i]=="#" and s[0][i-1]=="."))
    
for j in range(1,H):
    ls[j][0] = ls[j-1][0]+ int(bool(s[j][0]=="#" and s[j-1][0]=="."))

for i in range(1,W):
    for j in range(1,H):
        ls[j][i] = min(ls[j][i-1]+ int(bool(s[j][i]=="#" and s[j][i-1]==".")),
                       ls[j-1][i]+ int(bool(s[j][i]=="#" and s[j-1][i]==".")))
        
print(ls[-1][-1])

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
s = []
for _ in range(H):
    s += [list(input())]

ls = [[0]*W for _ in range(H)]
ls[0][0] = int(bool(s[0][0]=="#"))

for i in range(1,H):
    ls[0][i] = ls[0][i-1]+ int(bool(s[0][i]=="." and s[0][i-1]=="#"))
    
for j in range(1,W):
    ls[j][0] = ls[j-1][0]+ int(bool(s[j][0]=="." and s[j-1][0]=="#"))

for i in range(1,H):
    for j in range(1,W):
        ls[j][i] = min(ls[j][i-1]+ int(bool(s[j][i]=="." and s[j][i-1]=="#")),
                       ls[j-1][i]+ int(bool(s[j][i]=="." and s[j-1][i]=="#")))
        
print(ls[-1][-1])
Problem p02990 (python)

Fixed submission:
import math

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

(N, K) = input().split()
N = int(N)
K = int(K)

for i in range(1, K+1):
    if N - K + 1 < i:
        A = 0
    else:
        A = C(N - K + 1, i) * C(K - 1, i - 1) % 1000000007
    print(A)

Buggy submission (verdict: Runtime Error):
import math

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

(N, K) = input().split()
N = int(N)
K = int(K)

for i in range(1, K+1):
    if N == K:
        if i == 1:
            A = 1
        else:
            A = 0
    else:
        A = C(N - K + 1, i) * C(K - 1, i - 1) % 1000000007
    print(A)
Problem p02831 (python)

Fixed submission:
from fractions import gcd
# from math import gcd

a, b = map(int, input().split())
print(a * b // gcd(a, b))
exit(0)

Buggy submission (verdict: Runtime Error):
# from fractions import gcd
from math import gcd

a, b = map(int, input().split())
print(a * b // gcd(a, b))
exit(0)
Problem p02847 (python)

Fixed submission:
week = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT", ""]
week.reverse()
day = input()
print(week.index(day))

Buggy submission (verdict: Runtime Error):
num_price, digit_price, budget = map(int, input().split())
min_by_digit = {x: int('1'+'0'*x) * num_price + (x+1) * digit_price for x in range(0, 10)}

max_digit = 0
for i in range(0, 10):
    if min_by_digit[i] > budget:
        break
    else:
        max_digit = i+1

if max_digit == 0:
    print("0")
    exit(0)

if max_digit == 10:
    print("1000000000")
    exit(0)

least = int('1'+'0'*(max_digit-1))
ans = min((budget - (digit_price * max_digit)) // num_price, least*10-1)
print(ans)
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 = 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(n):
    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 = 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(n):
    b.append(b[i] + B[i])

ans, j = 0, m
for i in range(n+1):
    if a[i] > k:
        break
    while [b] > k - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)
Problem p02624 (python)

Fixed submission:
n = int(input())

ans = 0
for i in range(1, n+1):
    g = n // i
    ans += i * (g*(g+1))//2

print(ans)

Buggy submission (verdict: Runtime Error):
import sympy

n = int(input())

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

print(ans)
Problem p02659 (python)

Fixed submission:
a, b = map(float, input().split())
a = int(a)
b = int(b * 1000)

print(a*b//1000)

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

print(math.floor(ans))
Problem p02729 (python)

Fixed submission:
import math

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


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


if n >= 2 and m >= 2:
    ans = combinations_count(m, 2) + combinations_count(n, 2)
elif n < 2 and m < 2:
    ans = 0
elif n < 2:
    ans = combinations_count(m, 2)
elif m < 2:
    ans = combinations_count(n, 2)


print(ans)

Buggy submission (verdict: Runtime Error):
import math

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


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


ans = combinations_count(m, 2) + combinations_count(n, 2)

print(ans)
Problem p02831 (python)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

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

Buggy submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print(a*b//math.gcd(a,b))
Problem p02935 (python)

Fixed submission:
n=int(input())
v=sorted(list(map(int, input().split())))
s=v[0]/(2**(n-1))
for i in  range(1,n):
  s+=v[i]/(2**(n-i))
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
v=sorted(list(map(int, input().split())))
s=v[0]/(2**(n-1))
for i in  range(1,n):
  s+=v[n]/(2**(n-i))
print(s)