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

Fixed submission:
def combination(n, k, p):
    numerator = 1
    for i in range(k):
        numerator = (numerator * (n-i)) % p
 
    denominator = 1
    for i in range(1, k+1):
        denominator = (denominator * i) % p
 
    return (numerator * pow(denominator, p-2, p)) % p
 
 
X, Y = map(int, input().split())
 
a = (2*Y-X) / 3
b = (2*X-Y) / 3
 
if a >= 0 and b >= 0 and a == int(a) and b == int(b):
    a = int(a)
    b = int(b)
 
    print(combination(a+b, a, 10**9+7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
mod = 10**9+7
def combination(n, r, mod):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res


X,Y = map(int,input().split())
s = (2*Y-X)//3
t = (2*X-Y)//3

if (2*Y-X)%3==0 and (2*X-Y)%3==0 :
    ans =  combination(s+t,t,mod)
    print(ans)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
mod = 10**9+7
def mod_combination(n, k, mod):
    # nCk (mod m)
    def mod_permutation(n, k, mod):
        if n<=k:
            return 1
        else:
            return (n * mod_permutation(n-1,k,mod))%mod

    def mod_inv_permutation(k, mod):
        k, mod = int(k), int(mod)
        if k<=1:
            return 1
        else:
            return (pow(k,mod-2,mod) * mod_inv_permutation(k-1, mod))%mod

    return (mod_permutation(n,n-k,mod) * mod_inv_permutation(k, mod))%mod


X,Y = map(int,input().split())
s = (2*Y-X)//3
t = (2*X-Y)//3

if (X+Y)%3 == 0 :
    ans =  mod_combination(s+t, s, mod)
    print(ans)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
mod = 1000000007

def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def power(x, y):
    if   y == 0: 
        return 1
    elif y == 1: 
        return x % mod
    elif y % 2 == 0 : 
        return power(x, y//2)**2 % mod
    else: 
        return power(x, y//2)**2 * x % mod

def div(a, b):
    return mul(a, power(b, mod-2))
X,Y = map(int,input().split())
s = (2*Y-X)//3
t = (2*X-Y)//3
if (2*Y-X)%3!=0 or (2*X-Y)%3!=0:
    print(0)
else:
    a = math.factorial(s+t)%mod
    
    b = math.factorial(s)
    c = math.factorial(t)
    ans = div(div(a,b),c)
    print(ans)
Problem p02873 (python)

Fixed submission:
s =input()
n = len(s)
a = [0]*(n+1)
res = 0
hidari = [0] *(n+1)
for i in range(1,n+1):
    if s[i-1] == '<':
        res +=1
    else:res = 0
    hidari[i] = res
hidari[-1] = res
res = 0
migi = [0] *(n+1)
for i in range(n-1,-1,-1):
    if s[i] == '>':
        res+=1
    else:res = 0
    migi[i] = res
migi[0] = res
ans = 0
for i in range(n+1):
    ans += max(migi[i],hidari[i])
print(ans)

Buggy submission (verdict: Runtime Error):
s =input()
n = len(s)
a = [0]*(n+1)
hidari = [0] *(n+1)
for i in range(1,n+1):
    if s[i-1] == '<':
        res +=1
    else:res = 0
    hidari[i] = res
hidari[-1] = res
res = 0
migi = [0] *(n+1)
for i in range(n-1,-1,-1):
    if s[i] == '>':
        res+=1
    else:res = 0
    migi[i] = res
migi[0] = res
ans = 0
for i in range(n+1):
    ans += max(migi[i],hidari[i])
print(ans)

Buggy submission (verdict: Runtime Error):
s =input()
n = len(s)
a = [0]*(n+1)
hidari = [0] *(n+1)
for i in range(1,n+1):
    if s[i-1] == '<':
        res +=1
    else:res = 0
    hidari[i] = res
hidari[-1] = res
res = 0
migi = [0] *(n+1)
for i in range(n-1,-1,-1):
    if s[i] == '>':
        res+=1
    else:res = 0
    migi[i] = res
migi[0] = res
ans = 0
for i in range(n+1):
    ans += max(migi[i],hidari[i])
print(ans)
Problem p02881 (python)

Fixed submission:

# a<=bとみなせるので探索回数は√nでよい
import math
n = int(input())
r_n = int(math.sqrt(n))+1
m = 10 ** 12
for i in range(1,r_n):
  if n % i == 0 and m > i + n / i - 2:
    m = i + n / i - 2
 
print(int(m))

Buggy submission (verdict: Runtime Error):
スコード 

Copy
Copy
# a<=bとみなせるので探索回数は√nでよい
import math
n = int(input())
r_n = int(math.sqrt(n))+1
m = 10 ** 12
for i in range(1,r_n):
  if n % i == 0 and m > i + n / i - 2:
    m = i + n / i - 2
 
print(int(m))
Problem p02984 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
s = sum(a)
x = s-2*sum([a[i] for i in range(1,n-1,2)])
print(x)
for i in range(n-1):
    x = 2*a[i]-x
    print(x)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int,input().split()))
keisuu = [[0]*n for _ in range(n)]
for i in range(n):
    a[i]*=2
    
    if i+1 <=n-1:
        keisuu[i][i+1] = 1
        keisuu[i][i] = 1
    else:
        keisuu[i][i] = 1
        keisuu[i][0] = 1
keisuu = np.array(keisuu)
avec = np.array(a)
inv_keisuu = np.linalg.inv(keisuu)
x = np.dot(inv_keisuu,avec)
for i in range(n):
    print(int(x[i]))
Problem p03013 (python)

Fixed submission:
N,M = map(int,input().split())
a = set([int(input()) for i in range(M)])
dp = [0]*(N+1)
dp[0] = 1
dp[1] = 1
if 1 in a:
    dp[1] = 0
for i in range(2,N+1):
    if i in a:
        continue
    
    dp[i] = (dp[i-2]+dp[i-1])%1000000007
ans = dp[N]
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
a = set([int(input()) for i in range(M)])
dp = [0]*(N+1)
dp[1] = 1

if 1 in a:
    dp[2] = 1
    dp[1] = 0
else:
    dp[2] = 2
for i in range(3,N+1):
    if i-1 in a:
        continue
    
    dp[i] = (dp[i-2]+dp[i-1])%1000000007
ans = dp[N]
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
a = []
for i in range(M):
    a.append(int(input()))
dp = [0]*(N+1)
dp[1] = 1
if 1 in a:
    dp[2] = 1
    dp[1] = 0
else:
    dp[2] = 2
for i in range(3,N+1):
    if i-1 in a:
        continue
    
    dp[i] = (dp[i-2]+dp[i-1])%1000000007
ans = dp[N]
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
a = []
for i in range(M):
    a.append(int(input()))
dp = [0]*(N+1)
dp[1] = 1
if 1 in a:
    dp[2] = 1
    dp[1] = 0
else:
    dp[2] = 2
for i in range(3,N+1):
    if i-1 in a:
        dp[i] = dp[i-2]%1000000007
        dp[i-1] = 0
    else:
        dp[i] = (dp[i-2]+dp[i-1])%1000000007
ans = dp[N]%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
a = []
for i in range(M):
    a.append(int(input()))
dp = [0]*(N+1)
dp[1] = 1
if 1 in a:
    dp[2] = 1
    dp[1] = 0
else:
    dp[2] = 2
for i in range(3,N+1):
    if i-1 in a:
        dp[i] = dp[i-2]
        dp[i-1] = 0
    else:
        dp[i] = dp[i-2]+dp[i-1]
ans = dp[N]%1000000007
print(ans)
Problem p03038 (python)

Fixed submission:
n,m = map(int,input().split())
a = list(map(int,input().split()))
bc = [list(map(int,input().split()))for i in range(m)]
p =[]
d = []
a.sort()
for i in range(m):
    b = bc[i][0]
    c = bc[i][1]
    p.append([c,b])
p.sort(reverse = True)
look = 0
for i in range(n):
    if look > m-1:break
    if p[look][1] >0:
        d.append(p[look][0])
        p[look][1]-=1
    
    else:
        if look ==m-1:break
        look+=1
        d.append(p[look][0])
        p[look][1]-=1
sm = sum(a)
updatefrom = 0
updateto = 0
ans = sm
for x in range(n):
    if x >= len(d):break
    updatefrom +=a[x]
    updateto +=d[x]
    ans = max(ans,sm-updatefrom +updateto)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = list(map(int,input().split()))
bc = [list(map(int,input().split()))for i in range(m)]
p =[]
d = []
a.sort()
for i in range(m):
    b = bc[i][0]
    c = bc[i][1]
    p.append([c,b])
p.sort(reverse = True)
look = 0
for i in range(n):
    if look > m-1:break
    if p[look][1] >0:
        d.append(p[look][0])
        p[look][1]-=1
    else:
        look+=1
        d.append(p[look][0])
        p[look][1]-=1
sm = sum(a)
updatefrom = 0
updateto = 0
ans = 0
for x in range(n):
    updatefrom +=a[x]
    updateto +=d[x]
    ans = max(ans,sm-updatefrom +updateto)
print(ans)
Problem p03042 (python)

Fixed submission:
S = int(input())
x = 0
a = S//100
b = S%100
if a>=1 and a<=12:
    x+=1
if b>=1 and b<=12:
    x+=1
if x == 0:
    print("NA")
elif x == 2:
    print("AMBIGUOUS")
if x == 1:
    if a>=1 and a<=12:
        print("MMYY")
    else:
        print("YYMM")

Buggy submission (verdict: Runtime Error):
S = int(input())
x = 0
a = S//100
b = S%100
if a>=1 and a<=12:
    x+=1
if b>=1 and a<=12:
    x+=1
if x = 0:
    print("NA")
elif x = 2:
    print("AMBIGUOUS")
if x = 1:
    if a>=1 and a<=12:
        print("MMYY")
    else:
        print("YYMM")
Problem p02580 (python)

Fixed submission:
H, W, M = (int(i) for i in input().split())

hw = set()
hh = [0] * H
ww = [0] * W

for i in range(M):
    ht , wt = (int(i) for i in input().split())
    hw.add((ht-1) * W + wt - 1)
    hh[ht-1] += 1
    ww[wt-1] += 1

hhh = max(hh)
ih = [i for i, x in enumerate(hh) if x == hhh]

www = max(ww)
iw = [i for i, x in enumerate(ww) if x == www]

minus = 1
for iih in ih:
    for iiw in iw:
        if iih * W + iiw not in hw:
            minus = 0
            break

print(hhh + www - minus)

Buggy submission (verdict: Runtime Error):
H, W, M = (int(i) for i in input().split())

hw = [0] * (H * W)
hh = [0] * H
ww = [0] * W

for i in range(M):
    ht , wt = (int(i) for i in input().split())
    hw[(ht-1) * W + wt - 1] = 1
    hh[ht-1] += 1
    ww[wt-1] += 1

hhh = max(hh)
ih = [i for i, x in enumerate(hh) if x == hhh]

www = max(ww)
iw = [i for i, x in enumerate(ww) if x == www]

minus = 1
for iih in ih:
    for iiw in iw:
        if hw[iih * W + iiw] == 0:
            minus = 0


print(hhh + www - minus)
Problem p03127 (python)

Fixed submission:
import fractions

N = (int(i) for i in input().split()) 
A = [int(i) for i in input().split()] 

A.sort()

res = A[0]
for aa in A:
    res = fractions.gcd(res, aa)

print(res)

Buggy submission (verdict: Runtime Error):
from fractions import Fraction

N = (int(i) for i in input().split()) 
A = [int(i) for i in input().split()] 

A.sort()

res = A[0]
for aa in A:
    res = Fraction.gcd(res, aa)

print(res)

Buggy submission (verdict: Runtime Error):
import fraction

N = (int(i) for i in input().split()) 
A = [int(i) for i in input().split()] 

A.sort()

res = A[0]
for aa in A:
    res = fraction.gcd(res, aa)

print(res)

Buggy submission (verdict: Runtime Error):
import math
N = (int(i) for i in input().split()) 
A = [int(i) for i in input().split()] 

A.sort()

res = A[0]
for aa in A:
    res = math.gcd(res, aa)

print(res)
Problem p03242 (python)

Fixed submission:
S = input()


S = S.replace("9","!")
S = S.replace("1","9")
S = S.replace("!","1")

print(S)

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
v = list(int(i) for i in input().split())


gu = v[0::2]
ki = v[1::2]


gc = collections.Counter(gu)
kc = collections.Counter(ki)

guc = gc.most_common()
kic = kc.most_common()

gv = gc.values()
kv = kc.values()

if guc[0][0] != kic[0][0]:
    gcount = sum(gv) - max(gv)
    kcount = sum(kv) - max(kv)
    print(gcount+kcount)
else:
    if len(guc) == 1 and len(kic) == 1 :
        print(str(guc[0][1]))
    else:
        if len(guc) == 1 and len(kic) != 1 :
            print(str(sum(gv)+sum(kv)-max(gv)-kic[1][1]))
        elif len(guc) != 1 and len(kic) == 1 :
            print(str(sum(gv)+sum(kv)-max(kv)-guc[1][1]))
        else:
            print(str(sum(gv)+sum(kv)-max((guc[1][1] + kic[0][1]), (guc[0][1] + kic[1][1]))))
Problem p03250 (python)

Fixed submission:

A, B, C = (int(i) for i in input().split())

if max(A,B,C) == A:
    print(A*10+B+C)
elif max(A,B,C) == B:
    print(B*10+A+C)
elif max(A,B,C) == C:
    print(C*10+B+A)

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

naga = len(S)
count = 0
for i in range(naga):
    ss = S[i]
    tt = T[i]
    if S.find(ss) != -1 :
        count = count + 1
    S = S.replace(ss,"!")
    S = S.replace(tt,ss)
    S = S.replace("!",tt)

    if count > 28:
        break


if S == T:
    print("Yes")
else:
    print("No")
Problem p02676 (python)

Fixed submission:
n = int(input())
s = input()
if len(s) <= n:
  print(s)
else:
  print(s[:n] + "...")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
if len(s) <= n:
  print(s)
else:
  print(s[:k] + "...")
Problem p02711 (python)

Fixed submission:
print("Yes" if "7" in list(input()) else "No")

Buggy submission (verdict: Runtime Error):
print("Yes" if 7 in list(int(input())) else "No")
Problem p03186 (python)

Fixed submission:
l = list(map(int,input().split()))
if l[0]+l[1] >= l[2]:
  print(l[1]+l[2])
else:
  print(l[0]+2*l[1]+1)

Buggy submission (verdict: Runtime Error):
l = list(map(int,input().split()))
if l[0]+l[1] >= l[2]:
  print(l[1]+l[2])
  else:
    print(l[0]+2*l[1]+1)

Buggy submission (verdict: Runtime Error):
    l = list(map(int,input().split()))
    if l[0]+l[1] >= l[2]:
      print(l[1]+l[2])
    else:
      print(l[0]+2*l[1]+1)
Problem p03207 (python)

Fixed submission:
n=int(input())
p = []
for _ in range(n):
    p.append(int(input()))
p.sort()
sum=0
for i in range(n):
  if i==n-1:
    sum=p[i]//2+sum
  else:
    sum=p[i]+sum
print(sum)

Buggy submission (verdict: Runtime Error):
n=int(input())
p = list(map(int, input().split()))
sort(p)
sum=0
for i in range(n):
  if i==n-1:
    sum+=p[i]/2
  else:
    sum+=p[i]
print(sum)
Problem p02915 (python)

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

Buggy submission (verdict: Runtime Error):
a = input()
print(a**3)

Buggy submission (verdict: Runtime Error):
a=input()
print(a**3)

Buggy submission (verdict: Runtime Error):
s=input()
ans=1
for i in range(3):
	ans*=s
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans=1
for i in range(3)
	ans*=s
print(ans)
Problem p03135 (python)

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

Buggy submission (verdict: Runtime Error):
i=input().split()
print(i[0]/i[1])

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

Buggy submission (verdict: Runtime Error):
t=float(input())
x=float(input())
print(t/x)
Problem p02847 (python)

Fixed submission:
s = input()
if s=="SAT":
  ans=1
if s=="FRI":
  ans=2
if s=="THU":
  ans=3
if s=="WED":
  ans=4
if s=="TUE":
  ans=5
if s=="MON":
  ans=6
if s=="SUN":
  ans=7
  
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
if s=="SAT":
  ans=1
if s=="FRI":
  ans=2
if s=="THU":
  ans=3
if s=="WED":
  ans=4
if s=="THU":
  ans=5
if s=="MON":
  ans=6
if s=="SUN":
  ans=7
  
print(ans)
Problem p03631 (python)

Fixed submission:
n = int(input())
if n%10 == (n-n%100)/100:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = input()
if n%100 == n/100:
  print("Yes")
else:
  print("No")
Problem p02623 (python)

Fixed submission:
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(' ')]

# N, M, K = [int(x) for x in [2e3, 2e3, 1e9]]
# A = [int(x) for x in range(N)]
# B = [int(x) for x in range(M)]

A_deep = 0
B_deep = 0
time = 0
while A_deep < N:
  if K >= time + A[A_deep]:
    time += A[A_deep]
    A_deep += 1
  else:
    break 
while B_deep < M:
  if K >= time + B[B_deep]:
    time += B[B_deep]
    B_deep += 1
  else:
    break 

i = A_deep - 1
j = B_deep
ans = i + j + 1
while i >= 0 and j < M:
  while i >= 0:
    time -= A[i]
    i -= 1
    if K - time >= B[j]:
      break 
  while j < M:
    if K >= time + B[j]:
      time += B[j]
      j += 1
      ans = max(ans, i + j + 1)
    else: 
      break 


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(' ')]

def search(i, j, count, time):
  a = count 
  b = count 
  if i < N and K >= time + A[i]:
    a = search(i + 1, j, count + 1, time + A[i])
  if j < M and K >= time + B[j]:
    b = search(i, j + 1, count + 1, time + B[j])
  return max(a, b)

print(search(0, 0, 0, 0))
Problem p02729 (python)

Fixed submission:
M, N = [int(k) for k in input().split(' ')]
import math 
res = 0

if N >= 2:
  res += (math.factorial(N) // math.factorial(2) // math.factorial(N - 2))

if M >= 2:
  res += (math.factorial(M) // math.factorial(2) // math.factorial(M - 2))

print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(k) for k in input().split(' ')]

from collections import Counter 
import math 

res = [] # solution for each key in A
res_list = {} # solution for each value in A

# counter ver
A_c = Counter(A)
l = len(A_c)

def ncr(j):
  return j * (j-1) // 2 if j >= 2 else 0

# store ncr for each value 
combs = {k: ncr(v) for k, v in A_c.items()}

s = sum(combs.values())
  
for m in A_c.keys():
  res_list[m] = s - combs[m] + ncr(A_c[m] - 1)

for k in range(N):
  res.append(res_list[A[k]])
print('\n'.join([str(s) for s in res]))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(k) for k in input().split(' ')]

from collections import Counter 
import math 

res = [] # solution for each key in A
res_list = {} # solution for each value in A

# counter ver
A_c = Counter(A)
l = len(A_c)

def ncr(j):
  return math.factorial(j) // math.factorial(2) // math.factorial(j - 2) if j >= 2 else 0

# store ncr for each value 
combs = {k: ncr(v) for k, v in A_c.items()}

s = sum(combs.values())
  
for m in A_c.keys():
  res_list[m] = s - combs[m] + ncr(A_c[m] - 1)

for k in range(N):
  res.append(res_list[A[k]])
print('\n'.join([str(s) for s in res]))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(k) for k in input().split(' ')]

from collections import Counter 
import math 

# res = [] # solution for each key in A
res_list = {} # solution for each value in A

# counter ver
A_c = Counter(A)
l = len(A_c)

def ncr(j):
  return math.factorial(j) // math.factorial(2) // math.factorial(j - 2) if j >= 2 else 0

# store ncr for each value 
combs = {k: ncr(v) for k, v in A_c.items()}

s = sum(combs.values())
  
for m in A_c.keys():
  cnt = combs[m]

  n = s
  n -= cnt # the only inaccurate entry
  n += ncr(A_c[m] - 1)
  res_list[m] = n

res = ''
for k in range(N):
  res += '\n' + str(res_list[A[k]])
print(res[1:])
# print('\n'.join([str(s) for s in res]))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(k) for k in input().split(' ')]

from collections import Counter 
import math 

res = [] # solution for each key in A
res_list = {} # solution for each value in A

# counter ver
A_c = Counter(A)
l = len(A_c)

def ncr(j):
  return math.factorial(j) // math.factorial(2) // math.factorial(j - 2) if j >= 2 else 0

# store ncr for each value 
combs = {k: ncr(v) for k, v in A_c.items()}

s = sum(combs.values())
  
for m in A_c.keys():
  cnt = combs[m]

  n = s
  n -= cnt # the only inaccurate entry
  n += ncr(A_c[m] - 1)
  res_list[m] = n

for k in range(N):
  print(res_list[A[k]])
# print('\n'.join([str(s) for s in res]))
Problem p02596 (python)

Fixed submission:
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = (t * 10 + 7) % K
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
k=int(input())
i=1
while(1):
  if(7*(10**i-1)%9k==0):
    break
  i++
print(i)
Problem p02598 (python)

Fixed submission:
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
x0=0
x1=10**9
while(1):
    sum=0
    mid=(x0+x1)//2
    for i in range(n):
        sum+=math.ceil(a[i]/mid)-1
    if(sum<=k):
        x1=mid
    if(sum>k):
        x0=mid
    if(x0+1==x1):
        print(x1)
        break

Buggy submission (verdict: Runtime Error):
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
x0=0
x1=max(a)
while(1):
    sum=0
    mid=(x0+x1)//2
    for i in range(n):
        sum+=math.ceil(a[i]/mid)-1
    if(sum<=k):
        x1=mid
    if(sum>k):
        x0=mid
    if(x0+1==x1):
        print(x1)
        break

Buggy submission (verdict: Runtime Error):
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
x0=0
x1=max(a)
while(1):
    sum=0
    mid=(x0+x1)//2
    for i in range(n):
        sum+=math.ceil(a[i]/mid)-1
    if(sum<=k):
        x1=mid
    if(sum>k):
        x0=mid
    if(x0+1==x1):
        print(x1)
        break
Problem p02659 (python)

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

Buggy submission (verdict: Runtime Error):
import math
a,b=map(float,input().split())
int(round(a*b,0))
print(x)
Problem p02682 (python)

Fixed submission:
a,b,c,k=map(int,input().split())
ans=0
if(a>=k):
    ans=k
else:
    if((a+b)>=k):
        ans=a
    else:
        x=k-a-b
        ans=a-x
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
ans
if(a>=k):
    ans=k
else:
    if((a+b)>=k):
        ans=a
    else:
        x=k-a-b
        ans=a-x
print(ans)
Problem p02831 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100001)

def gcd(a, b):
    if a == b:
        return a
    elif a == 0:
        return b
    elif b == 0:
        return a
    else:
        if a > b:
            a = a % b
            return gcd(a, b)
        else:
            b = b % a
            return gcd(a, b)

A, B = [int(n) for n in input().split()]

s = A * B // gcd(A, B)

print(s)

Buggy submission (verdict: Runtime Error):
import math

A, B = [int(n) for n in input().split()]

s = A * B // math.gcd(A, B)

print(s)
Problem p02659 (python)

Fixed submission:
a, b = map(str, input().split())
a = int(a)
aux = int(b.replace(".", ""))
print((a * aux) // 100)

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

Fixed submission:
import math
N = int(input())

ans = 0

if N % 2 != 0 or N == 0:
    pass
else:
    max_pow_five = int(math.log(N, 5))
    for i in range(1, max_pow_five + 1):
        ans += N // ((5 ** i) * 2)

print(ans)

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

ans = 0

if N % 2 != 0:
    pass
else:
    max_pow_five = int(math.log(N, 5))
    for i in range(1, max_pow_five + 1):
        ans += N // ((5 ** i) * 2)

print(ans)
Problem p02546 (python)

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

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
d = 0
for a in range(1,N):
  for b in range(1,N):
    for c in range(1,N):
      if a*b+c == N:
        d += 1
print(d)

Buggy submission (verdict: Runtime Error):
N = int(input(""))
d = 0
for a in range(N):
  for b in range(N):
    for c in range(N):
      if a*b+c == N:
        d += 1
print(d)

Buggy submission (verdict: Runtime Error):
N = int(input(""))
d = 0
for a in range(N):
  for b in range(N):
    for c in range(N):
      if a*b+c == N:
        d += 1
Problem p03038 (python)

Fixed submission:
N, M = map(int, input().split())
A = sorted(map(int, input().split()))
BC = sorted([ list(map(int, input().split())) for _ in range(M)], key=lambda x:x[1], reverse=True)

s = 0
i = 0
B = 0
for a in A:
  if B == 0:
    if i < len(BC):
      B, C = BC[i]
      i += 1

  if B > 0 and C > a:
    s += C
    B -= 1
  else:
    s += a

print(s)

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

s = 0
i = 0
B = 0
for a in A:
  if B == 0:
    if i < len(BC):
      B, C = BC[i]
      i += 1

  if B > 0 and C > a:
    s += C
    B -= 1
  else
    s += a

print(s)