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

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

satisfaction=0

for i in range(N):
  satisfaction+=B[A[i]-1]
    
  if  i<=N-2:
      if  A[i]+1==A[i+1]:
          satisfaction+=C[A[i]-1] 
  else:
      pass

print(satisfaction)

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

satisfaction=0

for i in range(N):
    if  i>=1:
        if  A[i-1]+1==A[i]:
            satisfaction+=(C[A[i]-1]+B[A[i]-1])
 
        else:
            satisfaction+=B[i]

print(satisfaction)

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

satisfaction=0

for i in range(N-1):
    if  i>=1:
        if  A[i-1]+1==A[i]:
            satisfaction+=C[A[i]-1]+B[A[i]-1]
 
        else:
            satisfaction+=B[i]

print(satisfaction)

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

satisfaction=0

for i in range(N-1):
    if  A[i]+1==A[i+1]:
        satisfaction+=C[A[i]]+B[i]
 
    
    else:
        satisfaction+=B[i]

print(satisfaction)

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

satisfaction=0

for i in range(N-1)
    if  A[i]+1==A[i+1]:
        satisfaction+=C[A[i]]+B[i]
 
    
    else:
        satisfaction+=B[i]

print(satisfaction)
Problem p02951 (python)

Fixed submission:
A,B,C = map(int,input().split())
answer=B+C-A

if answer>=0:
  print(answer)
else :
  print(0)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
answer=B+C-A
if answer>=0
  print(answer)
else print(0)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
if B+C-A>=0
  print()
else print(0)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
if B+C-A>=0
  print()
else print(0)
Problem p02987 (python)

Fixed submission:
S=input()

if S[0] == S[1] != S[2] == S[3] or S[0] == S[2] != S[1] == S[3] or S[0] == S[3] != S[1] == S[2]:
  print('Yes')
else:
  print('No')

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

if S[0] == S[1] != S[2] == S[4] or S[0] == S[2] != S[1] == S[3] or S[0] == S[3] != S[1] == S[2]:
  print('Yes')
else:
  print('No')

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

if S[0] == S[1] != S[2] == S[4]:
  print('Yes')
elif S[0] == S[2] != S[1] == S[3]:
  print('Yes')
elif S[0] == S[3] != S[1] == S[2]:
  print('Yes')
else:
  print('No')
Problem p03038 (python)

Fixed submission:

from operator import itemgetter
N,M=map(int,input().split())
A=list(map(int,input().split()))
BC=[list(map(int,input().split())) for _ in range(M)]
A=sorted(A)
sum=0
BC.sort(key=itemgetter(1),reverse=True)

for a in A:
    sum+=a

i=0
#print(BC)

for j in range(M):
    #print(j)
    for k in range(BC[j][0]):
        if i<=N-1 and BC[j][1]>A[i]:
            sum+=BC[j][1]-A[i]
            i+=1
        else:
            break


print(sum)

Buggy submission (verdict: Runtime Error):

from operator import itemgetter
N,M=map(int,input().split())
A=list(map(int,input().split()))
BC=[list(map(int,input().split())) for _ in range(M)]
A=sorted(A)
sum=0
BC.sort(key=itemgetter(1),reverse=True)

for a in A:
    sum+=a

i=0
for j in range(M):
    for k in range(BC[j][0]):
        if BC[j][1]>A[i] and i<=N-1:
            sum+=BC[j][1]-A[i]
            i+=1
        else:
            break

print(sum)

Buggy submission (verdict: Runtime Error):

from operator import itemgetter
N,M=map(int,input().split())
A=list(map(int,input().split()))
BC=[list(map(int,input().split())) for _ in range(M)]
A=sorted(A)
sum=0
BC.sort(key=itemgetter(1),reverse=True)

for a in A:
    sum+=a

i=0
for j in range(M):
    for k in range(BC[j][0]):
        if BC[j][1]>A[i] and i<=N:
            sum+=BC[j][1]-A[i]
            i+=1
        else:
            break

print(sum)

Buggy submission (verdict: Runtime Error):

from operator import itemgetter
N,M=map(int,input().split())
A=list(map(int,input().split()))
BC=[list(map(int,input().split())) for _ in range(M)]
A=sorted(A)
sum=0
BC.sort(key=itemgetter(1),reverse=True)

for a in A:
    sum+=a

i=0
for j in range(M):
    for k in range(BC[j][0]):
        if BC[j][1]>A[i]:
            sum+=BC[j][1]-A[i]
            i+=1
        else:
            break

print(sum)
Problem p02598 (python)

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

def is_cuttable(N):
    n = 0
    for a in A:
        i = a // N
        if a % N == 0:
            i -= 1
        n += int(i)
        if n > K:
            return False
    return True

n_max = 10 ** 10
n_min = 0

while n_max - n_min > 1:
    n = (n_max + n_min) // 2
    if is_cuttable(n):
        n_max = n
    else:
        n_min = n
    
print(n_max)

Buggy submission (verdict: Runtime Error):
import numpy as np

def is_cuttable(A, K, N):
    n = 0
    for a in A:
        i = np.ceil(a / N)
        n += int(i) - 1
        if n > K:
            return False
    return True

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

n_max = max(A)
n = n_max // 2
n_min = 0

while True:
    if is_cuttable(A, K, n):
        n_max = n
    else:
        n_min = n
    if n_max - n_min < 2:
        break
    n = (n_max + n_min) // 2
print(n_max)

Buggy submission (verdict: Runtime Error):
import numpy as np

def is_cuttable(A, K, N):
    n = 0
    for a in A:
        i = np.ceil(a / N)
        n += int(i) - 1
        if n > K:
            return False
    return True

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

n_max = max(A)
n = n_max // 2
n_min = 0

while True:
    if is_cuttable(A, K, n):
        n_max = n
    else:
        n_min = n
    if n_max - n_min < 2:
        break
    n = (n_max - n_min) // 2 + n_min
print(n_max)
Problem p02754 (python)

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

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

b = ''
while len(b) < N:
    b += 'b' * A
    b += 'r' * B

print(b[:N].count('b'))
Problem p02873 (python)

Fixed submission:
S = input()
zero = []
turn = []

def sum_n(n):
    return (n ** 2 + n) // 2

for i, s in enumerate(S):
    if i == 0:
        if s == '<':
            zero.append(i)
        else:
            turn.append(i)
            zero.append(-1)
    else:
        if s_ == '>' and s == '<':
            zero.append(i)
        elif s_ == '<' and s == '>':
            turn.append(i)
    if i == len(S) - 1:
        if s == '>':
            zero.append(i + 1)
        else:
            turn.append(i + 1)
            zero.append(i + 2)
    s_ = s

#print(len(zero), zero)
#print(len(turn), turn)

ans = 0

for i in range(len(turn)):
    ans += sum_n(zero[i+1] - turn[i] - 1)
    ans += sum_n(turn[i] - zero[i] - 1)
    ans += max(zero[i+1] - turn[i], turn[i] - zero[i])
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
zero = []
turn = []

def sum_n(n):
    return (n ** 2 + n) // 2

for i, s in enumerate(S):
    if i == 0:
        if s == '<':
            zero.append(i)
        else:
            turn.append(-1)
    else:
        if s_ == '>' and s == '<':
            zero.append(i)
        elif s_ == '<' and s == '>':
            turn.append(i)
    if i == len(S) - 1:
        if s == '>':
            zero.append(i + 1)
        else:
            turn.append(i + 1)
            zero.append(i + 2)
    s_ = s

#print(len(zero), zero)
#print(len(turn), turn)

ans = 0

for i in range(len(turn)):
    ans += sum_n(zero[i+1] - turn[i] - 1)
    ans += sum_n(turn[i] - zero[i] - 1)
    ans += max(zero[i+1] - turn[i], turn[i] - zero[i])
print(ans)
Problem p03745 (python)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int, input().split()))

turn_p = 0
if N > 2:
    a_ = A[1]
    d_ = np.sign(A[1] - A[0])
    for a in A[2:]:
        d = np.sign(a - a_)
        #print(a, d, d_, turn_p)
        if d != 0:
            if d_ == 0:
                d_ = d
            elif d_ != d:
                turn_p += 1
                d_ = 0
        a_ = a 

print(turn_p+1)

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

a_ = A[1]
d_ = np.sign(A[1] - A[0])
turn_p = 0
for a in A[2:]:
    d = np.sign(a - a_)
    #print(a, d, d_, turn_p)
    if d != 0:
        if d_ == 0:
            d_ = d
        elif d_ != d:
            turn_p += 1
            d_ = 0
    a_ = a 

print(turn_p+1)
Problem p03821 (python)

Fixed submission:
import math

N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


ans = 0

for a, b in zip(A[::-1], B[::-1]):
    a += ans
    ans += math.ceil(a / b) * b - a

print(ans)

Buggy submission (verdict: Runtime Error):
import fractions

def lcm(a, b):
    return a * b / fractions.gcd(a, b)

N, M = map(int, input().split())
S = input()
T = input()

d_N = {}

for n in range(N):
    d = fractions.gcd(n, N)
    d_N[(n // d, N // d)] = n

for m in range(M):
    d = fractions.gcd(m, M)
    k = (m // d, M // d)
    if k in d_N:
        if S[d_N[k]] != T[m]:
            print(-1)
            exit()

L = int(lcm(N, M))
print(L)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal as dec
a,b = map(dec,input().split())
print(int(a*b))

Buggy submission (verdict: Runtime Error):
a,b = [int(i) for i in input().split()]
print(int(a*b))
Problem p02550 (python)

Fixed submission:
N,X,M=map(int,input().split())
a = X
hist = [a]
indices = [-1]*M
indices[a] = 0
flag=0
for i in range(1,min(10**6,N)):
  a = a**2 % M
  if indices[a] != -1:
    idx = indices[a]
    flag=1
    break
  hist.append(a)
  indices[a] = i
  
if flag==0:
  print(sum(hist))
  exit()
  
cycle = hist[idx:]
margin = hist[:idx]
q,r = divmod((N-len(margin)),len(cycle))
print(sum(margin)+sum(cycle)*q+sum(cycle[:r]))

Buggy submission (verdict: Runtime Error):
N, X, M = map(int, input().split())
A = [X]

for i in range(M-1):
    z = A[i]**2 % M
    if z not in A:
        A.append(z)
    else:
        break

idx = A.index(z)

before = A[:idx]
cy_sum = sum(A[idx:])
cy_len = len(A[idx:])
cy_cnt = (N-len(before)) // cy_len
mod = A[idx:idx + N - len(before)-cy_len*cy_cnt]

if cy_cnt == 0:
    print(sum(A)+mod)
else:
    print(sum(before) + cy_sum*cy_cnt + sum(mod))
Problem p02688 (python)

Fixed submission:
N,K = map(int,input().split())

s = []

for i in range(N):
    s.append(False)
    
for i in range(K):
    d = int(input())
    a = list(map(int,input().split()))
    for j in range(d):
        s[a[j]-1] = True
        
cut = 0
for i in range(N):
    if not s[i]:
        cut += 1

print(cut)

Buggy submission (verdict: Runtime Error):
N,K = input().split()
d = input()

print(N-d)
Problem p03042 (python)

Fixed submission:
s=str(input())
a="Y"
b="Y"
if 0<int(s[0:2])<13:
    a="MY"
if 0<int(s[2:5])<13:
    b="MY"

if a==b=="Y":
    ans="NA"
elif a=="Y" and b=="MY":
    ans="YYMM"
elif a=="MY" and b=="Y":
    ans="MMYY"
else:
    ans="AMBIGUOUS"
print(ans)

Buggy submission (verdict: Runtime Error):
s=str(input())
x=s[0]+s[1]
y=s[2]+s[3]
x=int(x)
y=int(y)
if x==0 or y==0:
    ans="NA"
if 0<x<13:
    if 0<y<13:
        ans="AMBIGUOUS"
    elif y>=13:
        ans="MMYY"
        
elif x>=13:
    if 0<y<13:
        ans="YYMM"
    else:
        "NA"
print(ans)
Problem p03107 (python)

Fixed submission:
S = str(input())
x = S.count("0")
y = S.count("1")
print(2*min(x, y))

Buggy submission (verdict: Runtime Error):
S = str(input())
i, ans = 0, 0
if len(S) <= 1:
    print(0)
    exit()

while i < abs(len(S)-S.count("1")):
    if S[i] != S[i+1]:
        S = S[:i]+S[i+2:]
        i = -1
        ans += 2
    i += 1
print(ans)
Problem p03327 (python)

Fixed submission:
N=int(input())
if N<1000:
    ans="ABC"
else:
    ans="ABD"
print(ans)

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

x = b - a
s = 0
for i in range(1,x,1):
  s += i

ans = s - a
print(ans)
Problem p02577 (python)

Fixed submission:
n=str(input())
sum=0
for i in range(len(n)):
    sum+=int(n[i]); 
if(sum%9==0):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
sum=0
while (n != 0):
  sum = sum + n % 10; 
  n = n/10; 
if(sum%9==0):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
sum=0
while (n != 0):
  sum = sum + n % 10; 
  n = n/10; 
if(sum%9==0):
  print("Yes")
else:
  print("No)

Buggy submission (verdict: Runtime Error):
n=int(input())
while (n != 0):
  sum = sum + n % 10; 
  n = n/10; 
if(sum%9==0):
  print("Yes")
else:
  print("No)
Problem p02723 (python)

Fixed submission:
s=str(input())
if(len(s)<6):
  print("No")
else:
  if(s[3]==s[2] and s[4]==s[5]):
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=str(input())
if(s[3]==s[4] and s[5]==s[6]):
  print("Yes")
else:
  print("No")
Problem p03104 (python)

Fixed submission:
from collections import defaultdict
import math


def f(n, k):
    base = 2 ** k
    syou = n // base
    amari = n % base
    q = max(0, amari - (base // 2) + 1)
    res1 = syou * (base // 2) + q
    return res1 % 2


def g(n):  # nを累計xorで表現
    if n <= 0:
        return "0"
    keta = int(math.log2(n) + 1)
    s = ""
    for i in range(keta):
        s = str(f(n, i + 1)) + s
    return s


def xor(a, b):
    max_len = max(len(a), len(b))
    a = (("0" * max_len) + a)[-max_len:]
    b = (("0" * max_len) + b)[-max_len:]

    s = ""
    for i in range(max_len):
        if a[i] != b[i]:
            s += "1"
        else:
            s += "0"
    return s


def to10(s):
    res = 0
    for c in s:
        res *= 2
        if c == "1":
            res += 1
    return res


def main():
    n, m = [int(q) for q in input().split()]
    A = g(n - 1)
    B = g(m)
    res = xor(A, B)
    print(to10(res))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import math


def f(n, k):
    base = 2 ** k
    syou = n // base
    amari = n % base
    q = max(0, amari - (base // 2) + 1)
    res1 = syou * (base // 2) + q
    return res1 % 2


def g(n):  # nを累計xorで表現
    if n == 0:
        return "0"
    keta = int(math.log2(n) + 1)
    s = ""
    for i in range(keta):
        s = str(f(n, i + 1)) + s
    return s


def xor(a, b):
    max_len = max(len(a), len(b))
    a = (("0" * max_len) + a)[-max_len:]
    b = (("0" * max_len) + b)[-max_len:]

    s = ""
    for i in range(max_len):
        if a[i] != b[i]:
            s += "1"
        else:
            s += "0"
    return s


def to10(s):
    res = 0
    for c in s:
        res *= 2
        if c == "1":
            res += 1
    return res


def main():
    n, m = [int(q) for q in input().split()]
    A = g(n - 1)
    B = g(m)
    res = xor(A, B)
    print(to10(res))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import math


def f(n, k):
    base = 2 ** k
    syou = n // base
    amari = n % base
    q = max(0, amari - (base // 2) + 1)
    res1 = syou * (base // 2) + q
    return res1 % 2


def g(n):  # nを累計xorで表現
    keta = int(math.log2(n) + 1)
    s = ""
    for i in range(keta):
        s = str(f(n, i + 1)) + s
    return s


def xor(a, b):
    max_len = max(len(a), len(b))
    a = (("0" * max_len) + a)[-max_len:]
    b = (("0" * max_len) + b)[-max_len:]

    s = ""
    for i in range(max_len):
        if a[i] != b[i]:
            s += "1"
        else:
            s += "0"
    return s


def to10(s):
    res = 0
    for c in s:
        res *= 2
        if c == "1":
            res += 1
    return res


def main():
    n, m = [int(q) for q in input().split()]
    A = g(n - 1)
    B = g(m)
    res = xor(A, B)
    print(to10(res))


if __name__ == '__main__':
    main()
Problem p03107 (python)

Fixed submission:
def solve(s):
    one = 0
    zero = 0
    for i in range(len(s)):
        if s[i] == "1":
            one += 1
        elif s[i] == "0":
            zero += 1
    return min(zero, one)


def main():
    S = input()
    # a, b, k = [int(a) for a in input().split()]

    print(solve(S) * 2)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def solve(s):
    count = 0
    i = 0

    while True:
        if i >= len(s) - 1:
            break
        if s[i] != s[i + 1]:
            count += 1
            s = s[0:i] + s[i + 2:]
            i -= 1
            continue
        i += 1
    return count


def main():
    S = input()
    # a, b, k = [int(a) for a in input().split()]

    print(solve(S) * 2)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def solve(start, s):
    for i in range(start, len(s) - 1):
        if s[i] != s[i + 1]:
            return 1 + solve(i - 1, s[:i] + s[i + 2:])
    return 0


def solve2(s):
    count = 0
    i = 0

    while True:
        if i == len(s) - 1:
            break
        if s[i] != s[i + 1]:
            count += 1
            s = s[:i] + s[i + 2:]
            i -= 1
            continue
        i += 1
    return count


def main():
    S = input()
    # a, b, k = [int(a) for a in input().split()]

    # print(solve(0, S) * 2)
    print(solve2(S) * 2)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def solve(start, s):
    for i in range(start, len(s) - 1):
        if s[i] != s[i + 1]:
            return 1 + solve(i - 1, s[:i] + s[i + 2:])
    return 0


def main():
    S = input()
    # a, b, k = [int(a) for a in input().split()]

    print(solve(0, S) * 2)


if __name__ == '__main__':
    main()
Problem p03776 (python)

Fixed submission:
from scipy.misc import comb 
from collections import defaultdict, deque, Counter
import sys
#from scipy.special import comb
import heapq
import math

input = sys.stdin.readline

sys.setrecursionlimit(10000000)

MIN = -10 ** 9
MOD = 10 ** 9 + 7


def main():
    N, A, B = [int(a) for a in input().split()]
    V = sorted([int(a) for a in input().split()], reverse=True)

    s = sum(V[:A]) / A
    target = V[A - 1]
    if target == V[0]:
        co = V.count(target)
        t = sum(
            comb(co, c, exact=True)
            for c in range(A, min(B, co) + 1)
        )
        print(s)
        print(t)
        return

    c1 = V[:A].count(target)
    c2 = V.count(target)
    t = comb(c2, c1, exact=True)
    print(s)
    print(t)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, deque, Counter
import sys
from scipy.special import comb
import heapq
import math

input = sys.stdin.readline

sys.setrecursionlimit(10000000)

MIN = -10 ** 9
MOD = 10 ** 9 + 7


def main():
    N, A, B = [int(a) for a in input().split()]
    V = sorted([int(a) for a in input().split()], reverse=True)

    s = sum(V[:A]) / A
    target = V[A - 1]
    if target == V[0]:
        co = V.count(target)
        t = sum(
            comb(co, c, exact=True)
            for c in range(A, min(B, co) + 1)
        )
        print(s)
        print(t)
        return

    c1 = V[:A].count(target)
    c2 = V.count(target)
    t = comb(c2, c1, exact=True)
    print(s)
    print(t)


if __name__ == '__main__':
    main()
Problem p02659 (python)

Fixed submission:
A, B = input().split()
A = int(A)
B1, B2 = map(int, B.split('.'))
ans = A*B1 + A*B2//100
print(ans)

Buggy submission (verdict: Runtime Error):
import math
hoge = list(input().split())
A = int(hoge[0])
B1 = int(hoge[1])
B2 = (float(hoge[1])-B1)*100
ans = A*B1 + A*B2//100
print(ans)
Problem p02623 (python)

Fixed submission:
import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal


def main():
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    a_sum = [0]
    b_sum = [0]
    for i in range(len(a)):
        a_sum.append(a_sum[i]+a[i])
    for i in range(len(b)):
        b_sum.append((b_sum[i]+b[i]))

    ans = 0
    j = m
    for i in range(n+1):
        if a_sum[i] > k:
            break
        while b_sum[j] > k - a_sum[i]:
            j -= 1
        ans = max(ans, (i+j))

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal


def main():
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    a_sum = []
    b_sum = []
    for i in range(1, len(a)+1):
        a_sum.append(sum(a[0:i]))
    for i in range(1, len(b)+1):
        b_sum.append(sum(b[0:i]))

    ans = 0
    j = m - 1
    for i in range(n):
        if a_sum[i] > k:
            break
        while b_sum[j] > k - a_sum[i]:
            j -= 1
        ans = max(ans, (i+1)+(j+1))

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal


def main():
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    a_sum = []
    b_sum = []
    for i in range(1, len(a)+1):
        a_sum.append(sum(a[0:i]))
    for i in range(1, len(b)+1):
        b_sum.append(sum(b[0:i]))

    ans = 0
    j = m - 1
    for i in range(n):
        if a_sum[i] > k:
            break
        while b_sum[j] > k - a_sum[i]:
            j -= 1
        print(i, j)
        ans = max(ans, (i+1)+(j+1))

    print(ans)


if __name__ == '__main__':
    main()
Problem p02659 (python)

Fixed submission:
import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal

a, b = input().split()
a = int(a)
b = Decimal(b)
print(math.floor(a*b))

Buggy submission (verdict: Runtime Error):
a, b = input().split()
a = int(a)
b = float(b)
print(math.floor(a*b))
Problem p02819 (python)

Fixed submission:
x = int(input())
isPrime = False


def isP(num):
    for i in range(2, num):
        if num % i == 0:
            return False
    return True


isPrime = isP(x)

if isPrime:
    print(x)
else:
    while isPrime == False:
        x += 1
        isPrime = isP(x)
    print(x)

Buggy submission (verdict: Runtime Error):
for num in range(x,10**6):
    ok = True
    for i in range(2,num):
        if num % i == 0:
            ok = False
    if ok:
        print(num)
        break
Problem p02881 (python)

Fixed submission:
import math
import itertools
n = int(input())
x = 1
for i in reversed(range(1, math.ceil(math.sqrt(n))+1)):
    if n % i == 0:
        x = n / i
        break

print(math.floor(x - 1 + n / x - 1))

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

maximum = math.ceil(math.sqrt(n))
minimum = 10**20
for i in range(1,maximum):
    j = 0
    if n % i == 0:
        j = n / i
        minimum = min(minimum,i+j)

print(int(minimum-2))