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

Fixed submission:
n_k = list(map(int, input().split()))
n, k = n_k[0], n_k[1]
tree_list = []
for i in range(n):
    tree_list.append(int(input()))
tree_list.sort()
min = 999999999
for i in range(n-k+1):
    if tree_list[i+k-1]-tree_list[i] <= min:

        min = tree_list[i+k-1]-tree_list[i]
print(int(min))

Buggy submission (verdict: Runtime Error):
n_k=list(map(int,input().split()))
n,k=n_k[0],n_k[1]
h_list=[]
for i in range(n):
    h_list.append(int(input()))
h_list=h_list.sort()
max = 99999999
for i in range(n-k+1):
    if max>h_list[i+k-1]-h_list[i]:
        max=h_list[i+k-1]-h_list[i]
print(max)
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 a[i] + b[j] > K:
        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()))

acs = [0]*(N+1)
for i in range(N):
    acs[i+1] = acs[i]+A[i]
    if acs[i+1] > K:
        A = A[:i]
        acs = acs[:i]
        break
A = A[::-1]

bcs = [0]*(M+1)
for i in range(M):
    bcs[i+1] = bcs[i]+B[i]
    if bcs[i+1] > K:
        B = B[:i]
        bcs = bcs[:i]
        break
B = B[::-1]

lng = []
srt = []
if len(acs) >= len(bcs):
    lng = A
    srt = bcs[::]
else:
    lng = B
    srt = acs[::]

lcs = [0]*(len(lng)+1)
lcs[0] = K-sum(lng)
for i in range(len(lng)):
    lcs[i+1] = lcs[i]+lng[i]
lng = lcs

sidx = 0
if len(srt)>0:
    for i in range(len(srt)):
        if srt[i] < lng[i]: sidx = i
lidx = 0
if len(lng)>0:
    for i in range(len(lng)):
        if lng[i] < srt[sidx]: lidx = i

print(len(lng)+sidx-lidx-1)
Problem p03038 (python)

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
d = {}
for a in A:
    if not a in d: d[a] = 0
    d[a] += 1
for i in range(M):
    B, C = map(int, input().split())
    if not C in d: d[C] = 0
    d[C] += B
T = sorted(d.items(), key=lambda x:x[0], reverse=True)
ans = 0
cnt = 0
for t in T:
    if t[1] <= N - cnt:
        ans += t[0] * t[1]
        cnt += t[1]
    else:
        ans += t[0] * (N - cnt)
        break
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
d = {}
for a in A:
    if not a in d: d[a] = 0
    d[a] += 1
for i in range(M):
    B, C = map(int, input().split())
    if not C in d: d[C] = 0
    d[C] += B
T = sorted(d.items(), key=lambda x:x[0], reverse=True)
B = []
for t in T:
    B.extend([t[0]] * t[1])
    if len(B) >= N: break
print(sum(B[:N]))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
d = {}
for i in range(M):
    B, C = map(int, input().split())
    if not C in d: d[C] = 0
    d[C] += B
T = sorted(d.items(), key=lambda x:x[0], reverse=True)
B = []
for t in T:
    B.extend([t[0]] * t[1])
    if len(B) >= N: break
n = min(len(A), len(B))
c = n
for i in range(n):
    if A[i] > B[i]:
        c = i
        break
ans = sum(B[:c])
if c < len(A): ans += sum(A[c:])
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
d = {}
for i in range(M):
    B, C = map(int, input().split())
    if not C in d: d[C] = 0
    d[C] += B
T = sorted(d.items(), key=lambda x:x[0], reverse=True)
B = []
for t in T:
    B.extend([t[0]] * t[1])
    if len(B) > N: break
N = min(N, len(B))
c = N
for i in range(N):
    if A[i] > B[i]:
        c = i
        break
ans = sum(B[:c])
if c < len(A): ans += sum(A[c:])
print(ans)
Problem p03127 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = min(A)
while True:
    for i in range(len(A)):
        if A[i] % ans != 0:
            A[i] %= ans
    if min(A) < ans:
        ans = min(A)
    else:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import fraction
from functools import reduce

def gcd_list(numbers):
    return reduce(fraction.gcd, numbers)

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

print(gcd_list(A))
Problem p02833 (python)

Fixed submission:
n = int(input())
if n % 2 == 1:
  print(0)
else:
  i = 10
  ans = 0
  while i <= n:
    ans += n // i
    i *= 5
  print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
if i % 2 == 1:
  print(0)
else:
  i = 10
  ans = 0
  while i <= n:
    ans += n // i
    i *= 5
  print(ans)
Problem p02627 (python)

Fixed submission:
mozi=input()
ju=mozi.islower()
ju2=mozi.isupper()
if ju==True:
  print("a")
else:
  print("A")

Buggy submission (verdict: Runtime Error):
mozi=int(input())
ju=mozi.islower()
ju2=mozi.isupper()
if ju==True:
  print("a")
 else:
  print("A")
Problem p02693 (python)

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


if a%k==0 or b%k==0:
    print("OK")
elif b//k-a//k>=1:
    print("OK")
elif b/k-a/k<1 and a%k>b%k:
    print("OK")
else:
    print("NG")

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

aa=a//k
bb=b//k

if bb-aa=>1:
    print("OK")
else:
    print("NG")
Problem p02712 (python)

Fixed submission:
def sum(x):
    a=int(x//3)
    b=int(x//5)
    c=int(x//15)
    sall=int((1+x)*(x/2))
    #print(sall)
    s3=int((3*(a-1)+6)*(a/2))
    #print(s3)
    s5=int((5*(b-1)+10)*(b/2))
    #print(s5)
    s15=int((15*(c-1)+30)*(c/2))
    #print(s15)
    ans=int(s15-s3-s5+sall)
    print(ans)
n=int(input())
sum(n)

Buggy submission (verdict: Runtime Error):
print(sum([x for x in range(a,int(input())+1) if (x%3!=0)and(x%5!=0)]))
Problem p02729 (python)

Fixed submission:
n,m=list(map(int,input().split()))
x=0
if n<2 and m<2:
    x=0
elif n<2 :
    x=int(m*(m-1)/2)
elif m<2:
    x=int(n*(n-1)/2)
else:
    x=int(m*(m-1)/2+n*(n-1)/2)
print(x)

Buggy submission (verdict: Runtime Error):
a=0
b=0
def ball(x,y):
    a=x*(x-1)//2
    b=y*(y-1)//2
    if a!=0 and b!=0:
        print(a+b)
    elif a=0:
        print(b)
    else:
        print(a)


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

Buggy submission (verdict: Runtime Error):
n=int(input())
a=(input().split())
for i in range(n):
    x=0
    for j in range(n):
        for k in range(n):
            if j>k:
                if a[j]==a[k] and j!=i and k!=i:
                    x=x+1
    print(x)
Problem p02753 (python)

Fixed submission:
S=set(input())

if len(S)==1:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
s=input()
if s="AAA"or s="AAB"or s="ABA"or s="ABB"or s="BBA"or s="BAB"or s="BBA":
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if s="AAA","AAB","ABA","ABB","BBA","BAB","BBA":
    print("Yes")
else:
    print("No")
Problem p02754 (python)

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

m=n%(b+r)
l=n//(b+r)
x=n-l*(b+r)

if x<b:
    s=m
else:
    s=b

if m==0:
    n_b=l*b
else:
    n_b=l*b+s
print(n_b)

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

m=n%(b+r)
l=n//(b+r)

if m<b:
    s=b
else:
    s=m

if m!=0:
    n_b=l*b+s
else:
    n_b=l*b

print(n_b)
Problem p03137 (python)

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

s.sort()
term=[]
if n-m>=0:
    print(0)
else:
    for i in range(m-1):
        term.append(s[i+1]-s[i])
    
    term.sort()

    for i in range(n-1):
        del term[-1]
    
    print(sum(term))

Buggy submission (verdict: Runtime Error):
n,m=list(map(int,input().split()))
s=list(map(int,input().split()))

a.sort()
term=[]
if n-m>=0:
    print(0)
else:
    for i in range(m-1):
        term.append(s[i+1]-s[i])
    
    term.sort()

    for i in range(n-1):
        del term[-1]
    
    print(sum(term))
Problem p02693 (python)

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

for i in range(b+1):
    s = k*i
    if a <= s and s <= b:
        print('OK')
        break
    elif s > b:
        print('NG')
        break

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input().split())
ans = 0
for i in range(1000):
  j = k*i - a
  if a <= j and j <= b:
    print('OK')
    break
  elif:
    print('NG')
Problem p03207 (python)

Fixed submission:
n = int(input())
a = list([input() for i in range(n)])
z = 0
ax = 0
for i in range(n):
    a[i] = int(a[i])
    if a[i] > ax:
        z = i
        ax = a[i]
        
print(int(sum(a)-a[z]/2))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list([input() for i in range(n)])
z = 0
for i in range(n):
  a[i] = int(a[i])
  if a[i] > z:
    z = i+1

print(sum(a)-a[z]/2)
Problem p03242 (python)

Fixed submission:
n = int(input())
 
if n == 111:
    print(999)
elif n == 119:
    print(991)
elif n == 191:
    print(919)
elif n == 199:
    print(911)
elif n == 911:
    print(199)
elif n == 919:
    print(191)
elif n == 991:
    print(119)
elif n == 999:
    print(111)

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

if n = 111:
  print(999)
elif n = 119:
  print(991)
elif n = 191:
  print(919)
elif n = 199:
  print(911)
elif n = 911:
  print(199)
elif n = 919:
  print(191)
elif n = 991:
  print(199)
else:
  print(111)
Problem p02623 (python)

Fixed submission:
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
pa, pb = [0] * (n+1), [0] * (m+1)
for i in range(n):
    pa[i+1] = pa[i] + a[i]
for i in range(m):
    pb[i+1] = pb[i] + b[i]
mx = 0
j = m
for i in range(n+1):
    if pa[i] > k:
        break
    v = k - pa[i]
    while pb[j] > v:
        j -= 1
    mx = max(mx, i+j)
print(mx)

Buggy submission (verdict: Runtime Error):
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
pa, pb = [0] * (n+1), [0] * (m+1)
for i in range(n):
    pa[i+1] = pa[i] + a[i]
for i in range(m):
    pb[i+1] = pb[i] + b[i]
mx = 0
for i in range(len(pa)):
    j = m
    if pa[i] > k:
        break
    v = k - pa[i]
    while pb[j] <= v:
        j -= 1
    mx = max(mx, i+j)
print(mx)

Buggy submission (verdict: Runtime Error):
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
while k > 0:
    if a[0] < b[0] and a[0] <= k:
        k -= a[0]
        a.pop(0)
        ans += 1
    elif b[0] <= k:
        k -= b[0]
        b.pop(0)
        ans += 1
    else:
        break
print(ans)
Problem p02624 (python)

Fixed submission:
from numba import njit
import numpy as np


@njit("i8(i8)")
def solve(n):
    ans = 1
    res = np.ones(n + 1, dtype=np.int64)
    for i in range(2, n + 1):
        for j in range(i, n + 1, i):
            res[j] += 1
        ans += i * res[i]
    return ans


N = int(input())
print(solve(N))

Buggy submission (verdict: Runtime Error):
from numba import njit

@njit("i8(i8)")
def solve(n):
    s = [1] * (n+1)
    ans = 1
    for i in range(2,n+1):
        for j in range(i,n+1,i):
            s[j] += 1
        ans += (i * s[i])
	return ans
n = int(input()) 
print(solve(n))

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

@njit("i8(i8)")
def solve(n):
    s = np.ones(n + 1, dtype=np.int64)
    ans = 1
    for i in range(2,n+1):
        for j in range(i,n+1,i):
            s[j] += 1
        ans += (i * s[i])
n = int(input()) 
print(solve(n))

Buggy submission (verdict: Runtime Error):
from numba import njit
import numpy as np
 
 
@njit("i8(i8)")
def solve(n):
    s = [1]*(n+1)
    ans = 1
    for i in range(2,n+1):
        for j in range(i,n+1,i):
            s[j] += 1
        ans += (i * s[i])
n = int(input()) 
print(solve(n))

Buggy submission (verdict: Runtime Error):
from numba import njit

@njit("i8(i8)")

n = int(input())    

def solve(n):
    s = [1]*(n+1)
    ans = 1
    for i in range(2,n+1):
        for j in range(i,n+1,i):
            s[j] += 1
        ans += (i * s[i])

print(solve(n))

Buggy submission (verdict: Runtime Error):
from numba import njit 
@njit("i8(i8)")
n = int(input())    

s = [1]*(n+1)
ans = 1
for i in range(2,n+1):
    for j in range(i,n+1,i):
        s[j] += 1
    ans += (i * s[i])

print(ans)
Problem p02624 (python)

Fixed submission:
if __name__ == "__main__":
    N = int(input())
    ans = 0
    for i in range(1, N+1):
        Y = N//i
        ans += Y*(Y+1)*i//2
    print(ans)

Buggy submission (verdict: Runtime Error):
import math

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

    return data

def factorization(n, data):
    arr = []
    temp = n
    num = 0
    for i in data:
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    
    return math.prod([f[1]+1 for f in arr])
if __name__ == "__main__":
    N = int(input())
    ans = 0
    data = get_sieve_of_eratosthenes(N)
    for i in range(1, N+1):
        ans += i*factorization(i, data)
    print(ans-1)
Problem p02689 (python)

Fixed submission:
if __name__ == "__main__":
    N, M = list(map(int, input().split()))
    H = list(map(int, input().split()))
    adj_max = [0 for i in range(N)]
    for i in range(M):
        a, b = list(map(int, input().split()))
        if adj_max[a-1] < H[b-1]:
            adj_max[a-1] = H[b-1]
        if adj_max[b-1] < H[a-1]:
            adj_max[b-1] = H[a-1]
    num = 0
    for i in range(N):
        if H[i] > adj_max[i]:
            num += 1
    print(num)

Buggy submission (verdict: Runtime Error):
if __name__ == "__main__":
    N, M = list(map(int, input().split()))
    H = list(map(int, input().split()))
    good_obs = [True for i in range(M)]
    for i in range(M):
        a, b = list(map(int, input().split()))
        if H[a-1] > H[b-1]:
            godd_obs[b-1] = False
        elif H[a-1] < H[b-1]:
            good_obs[a-1] = False
    print(sum(good_obs))

Buggy submission (verdict: Runtime Error):
if __name__ == "__main__":
    N, M = list(map(int, input().split()))
    H = list(map(int, input().split()))
    adj_mat = [[0 for i in range(N)] for i in range(N)]
    for i in range(M):
        a, b = list(map(int, input().split()))
        adj_mat[a-1][b-1] = 1
        adj_mat[b-1][a-1] = 1
    num = 0
    for i in range(N):
        h = H[i]
        for j in range(N):
            if adj_mat[i][j] == 1:
                flag = True
                if h < H[j]:
                    flag = False
                    break
        if flag:
            num += 1
    print(num)
Problem p02729 (python)

Fixed submission:
from math import factorial

def conb2(a):
    if a == 1:
        return 0
    else:
        return int(a*(a-1)/2)


if __name__ == "__main__":
    M, N = list(map(int, input().split()))
    print(conb2(M)+conb2(N))

Buggy submission (verdict: Runtime Error):
from math import factorial

def conb2(a):
    if a == 1:
        return 0
    else:
        return int(factorial(a) / factorial(2) / factorial(a-2))


if __name__ == "__main__":
    M, N = list(map(int, input().split()))
    print(conb2(M)+conb2(N))
Problem p02763 (python)

Fixed submission:
import bisect
n = int(input().strip())
S = list(input().strip())
L=[[] for _ in range(26)]
for i,s in enumerate(S):
    L[ord(s)-ord("a")].append(i)

q = int(input().strip())
for _ in range(q):
    query=input().strip().split()
    if query[0]=="1":
        i=int(query[1])
        i-=1
        c=query[2]
        if S[i]!=c:
            delInd=bisect.bisect_left(L[ord(S[i])-ord("a")],i)
            del L[ord(S[i])-ord("a")][delInd]
            bisect.insort(L[ord(c)-ord("a")], i)
            S[i]=c
    else:
        l,r=map(int,[query[1],query[2]])
        l-=1; r-=1
        ans=0
        for j in range(26):
            ind=bisect.bisect_left(L[j],l)
            if ind<len(L[j]) and L[j][ind]<=r:
                ans+=1
        print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
n = int(input().strip())
S = input().strip()
L=[[] for _ in range(26)]
for i,s in enumerate(S):
    L[ord(s)-ord("a")].append(i)

q = int(input().strip())
for _ in range(q):
    query=input().strip().split()
    if query[0]=="1":
        i=int(query[1])
        i-=1
        c=query[2]
        if S[i]!=c:
            delInd=bisect.bisect_left(L[ord(S[i])-ord("a")],i)
            del L[ord(S[i])-ord("a")][delInd]
            bisect.insort(L[ord(c)-ord("a")], i)
            S[i]=c
    else:
        l,r=map(int,[query[1],query[2]])
        l-=1; r-=1
        ans=0
        for j in range(26):
            ind=bisect.bisect_left(L[j],l)
            if ind<len(L[j]) and L[j][ind]<=r:
                ans+=1
        print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
n = int(input().strip())
S = input().strip()
L=[[] for _ in range(26)]
for i,s in enumerate(S):
    L[ord(s)-ord("a")].append(i)

q = int(input().strip())
for _ in range(q):
    query=input().strip().split()
    if query[0]=="1":
        i=int(query[1])
        i-=1
        c=query[2]
        if S[i]!=c:
            delInd=bisect.bisect_left(L[ord(S[i])-ord("a")],i)
            del L[ord(S[i])-ord("a")][delInd]
            bisect.insort(L[ord(c)-ord("a")], i)
    else:
        l,r=map(int,[query[1],query[2]])
        l-=1; r-=1
        ans=0
        for j in range(26):
            ind=bisect.bisect_left(L[j],l)
            if ind<len(L[j]) and L[j][ind]<=r:
                ans+=1
        print(ans)
Problem p02862 (python)

Fixed submission:
# import numpy as np
#N=int(input().strip())
#x=[0]*N
#y=[0]*N
#
#for i in range(N):
#    x[i],y[i]=list(map(int,input().strip().split()))

import sys

def power_l(x,power): # for mod
    if power==0:
        return 1
    elif power<0:
        print('error')
        sys.exit(1)
    res = 1
    sq = x%mod
    while(power>0):
        if power&1 > 0:
            res*=sq
            res=res%mod
        sq = sq**2 %mod
        power = power >> 1
    return res%mod

def inv(x): # x^(-1)=x^(p-2) mod
    ans = power_l(x,mod-2)
    return ans
##########################
mod = 10**9+7

X, Y = list(map(int,input().strip().split()))

if (X+Y)%3 !=0:
    print(0)
    sys.exit()
m = int((2*X-Y)//3)
n = int(X-2*m)

if m<0 or n<0:
    print(0)
    sys.exit()

# compute m+nCm=(m+n)!/(m!n!)
# make factorial
f=[1,1]
for i in range(m+n-1):
    f.append((f[i+1]*(i+2))%mod)

denom = (f[m]*f[n])%mod

ans=(f[m+n] * inv(denom)) %mod
print(ans)

Buggy submission (verdict: Runtime Error):
# import numpy as np
#N=int(input().strip())
#x=[0]*N
#y=[0]*N
#
#for i in range(N):
#    x[i],y[i]=list(map(int,input().strip().split()))

import sys

def power_l(x,power): # for mod
    if power==0:
        return 1
    elif power<0:
        print('error')
        sys.exit(1)
    res = 1
    sq = x%mod
    while(power>0):
        if power&1 > 0:
            res*=sq
            res=res%mod
        sq = sq**2 %mod
        power = power >> 1
    return res%mod

def inv(x): # x^(-1)=x^(p-2) mod
    ans = power_l(x,mod-2)
    return ans
##########################
mod = 10**9+7

X, Y = list(map(int,input().strip().split()))

if (X+Y)%3 !=0:
    print(0)
    sys.exit()
m = (2*X-Y)//3
n = X-2*m

# compute m+nCm=(m+n)!/(m!n!)
# make factorial
f=[1]
for i in range(m+n-1):
    f.append((f[i]*(i+2))%mod)

denom = (f[m-1]*f[n-1])%mod

ans=(f[m+n-1] * inv(denom)) %mod
print(ans)
Problem p02912 (python)

Fixed submission:
import heapq


n, m = map(int, input().split())
a = [-int(x) for x in input().split()]

heapq.heapify(a)

for i in range(m):
    t = -heapq.heappop(a)
    heapq.heappush(a, (t // 2) * (-1))

print(-sum(a))

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

for i in range(m):
    max = 0
    for j in range(n):
        if max < a[j]:
            max = a[j]
            max_i = j
    a[max_i] = math.floor(a[max_i] / 2)
###    a[a.index(max(a))] = math.floor(a[a.index(max(a))] / 2)

print(sum(a))
Problem p02951 (python)

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

if ((c - (a - b)) >= 0):
    print(c - (a - b))
else:
    print(0)

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

if ((c - (a - b)) >= 0):
    print(c - (a - b))
else print(0)
Problem p02659 (python)

Fixed submission:
import sys
import math

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

a,b = input().split(' ')
ash_1 = int(a[-1])
ash_2 = int(a[-2:])
bsh_1 = int(b[-2])
bsh_2 = int(b[-1])
bsh_0 = int(b[0])
kuri = (ash_1*bsh_1*10 + ash_2*bsh_2) //100
if len(a) == 1:
    res = int(a)*bsh_0 + kuri
elif len(a) == 2:
    a1 = a[:-1]
    res = int(a)*bsh_0 + int(a1)*bsh_1 + kuri
else:
    a1 = a[:-1]
    a2 = a[:-2]
    res = int(a)*bsh_0 + int(a1)*bsh_1 + int(a2)*bsh_2 + kuri
print(res)

Buggy submission (verdict: Runtime Error):
import sys
import math

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

a,b = input().split(' ')
a = int(a)
b = float(b)
t = str(b).replace('.','')
res = 0
for i in range(3):
    res += int(str(t)[i]) * a // (10 ** i)
print(int(res))

Buggy submission (verdict: Runtime Error):
import sys
import math

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

a,b = input().split(' ')
a = int(a)
b = float(b)
t = int(b * 100)
res = 0
for i in range(3):
    res += int(str(t)[i]) * a // (10 ** i)
print(int(res))
Problem p02682 (python)

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

a_ = k - a
b_ = k - a - b

res = 0
if a_ <= 0:
    res += k
elif b_ <= 0:
    res += a 
else:
    res += a - b_

print(res)

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

ti = [1] * a
[ti.append(0) for _ in range(b)]
[ti.append(-1) for _ in range(c)]

res = 0
for i in range(k):
    res += ti[i]
print(res)
Problem p02695 (python)

Fixed submission:
from itertools import combinations_with_replacement as comb

n,m,q = map(int, input().split(' '))
lis = [list(map(int, input().split())) for _ in range(q)]
tes = comb(range(1,m+1),n)
res = 0
for i in tes:
    te = 0
    for a,b,c,d in lis:
        if c == i[b-1] - i[a-1]:
            te += d
    res = max(te,res)
print(res)

Buggy submission (verdict: Runtime Error):
from itertools import combinations_with_replacement as comb

n,m,q = map(int, input().split(' '))
lis = [list(map(int, input().split())) for _ in range(q)]
tes = comb(range(1,m))
res = 0
for i in tes:
    te = 0
    for a,b,c,d in lis:
        if c == i[b-1] - i[a-1]:
            te += d
    res = max(te,res)
print(res)