Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
m=0
if n<=(10**7):


    for x in range(n+1):
        l=int(a*x/b)-a*int(x/b)

        if l>=m:

            m=l

else:
    for x in range(10**6,n+1):


        l=int(a*x/b)-a*int(x/b)
        if l>m:

            m=l
print(m)


Fixed submission:
a,b,n=map(int,input().split())
#0<=x<=b-1でfloor(x/b)は0となるので単調増加になる
#単調増加なのでb-1とnの小さいほうがxの最大値
x=min(b-1,n)

print(a*x//b)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
m=0


for x in range(n+1):
    l=int(a*x/b)-a*int(x/b)
    
    if l>=m:

        m=l

print(m)


Fixed submission:
a,b,n=map(int,input().split())
#0<=x<=b-1でfloor(x/b)は0となるので単調増加になる
#単調増加なのでb-1とnの小さいほうがxの最大値
x=min(b-1,n)

print(a*x//b)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
m=0


for x in range(n+1):
    l=int(a*x/b)-a*int(x/b)
    
    if l>=m:

        m=l

print(m)


Fixed submission:
a,b,n=map(int,input().split())
#0<=x<=b-1でfloor(x/b)は0となるので単調増加になる
#単調増加なのでb-1とnの小さいほうがxの最大値
x=min(b-1,n)

print(a*x//b)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
m=0

for x in range(n+1):

    if (int(a*x/b)-a*int(x/b))>=m:

        m=int(a*x/b)-a*int(x/b)

print(m)


Fixed submission:
a,b,n=map(int,input().split())
#0<=x<=b-1でfloor(x/b)は0となるので単調増加になる
#単調増加なのでb-1とnの小さいほうがxの最大値
x=min(b-1,n)

print(a*x//b)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())

c=[]
m=0

for x in range(n+1):

    c.append(int(a*x/b)-a*int((x/b)))

    if int(c[x])>=m:

        m=int(c[x])

print(m)


Fixed submission:
a,b,n=map(int,input().split())
#0<=x<=b-1でfloor(x/b)は0となるので単調増加になる
#単調増加なのでb-1とnの小さいほうがxの最大値
x=min(b-1,n)

print(a*x//b)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())

c=[]

for x in range(n+1):

    c.append(int(a*x/b)-a*int((x/b)))

print(max(c))


Fixed submission:
a,b,n=map(int,input().split())
#0<=x<=b-1でfloor(x/b)は0となるので単調増加になる
#単調増加なのでb-1とnの小さいほうがxの最大値
x=min(b-1,n)

print(a*x//b)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input())

if m>=n:

    print('unsafe')

else:
    print('safe')


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

if m>=n:

    print('unsafe')

else:
    print('safe')

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input())

if m>=n:

    print('unsafe')

else:
    print('safe')


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

if m>=n:

    print('unsafe')

else:
    print('safe')
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())

a=[]
a=list(input().split())


for k in range(m):

    n=n-int(a[k])

    if n < 0:
        n=-1
        break

print(n)


Fixed submission:
import math
a=math.pi

R=int(input())

print(2*R*a)

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

a=[]
a=list(input().split())


for k in range(0,m):

    n=n-int(a[k])

    if n >= 0:
        pass

    else:

        break

print(n)


Fixed submission:
import math
a=math.pi

R=int(input())

print(2*R*a)
Buggy python submission (verdict: Time Limit Exceeded):
n,a,b=map(int,input().split())
s=0
if n>=(a+b):

    while True:

        n=n-(a+b)

        s+=1

        if n-(a+b)<=0:

            break
        else:pass

    if n>=a:

        print(a*(s+1))
    else:
        print(a*s+n)

else:

    if n>=a:

        print(a)

    else:
        print(n)
        


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

if n>=(a+b):

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

    l=int(n%(a+b))

    if l>=a:

        print(a*k+a)

    else:
        print(a*k+l)

else:

    if n>=a:

        print(a)

    else:
        print(n)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
i=1
#N進数m桁であらわせる最大値はN**m-1
j=int(k**i)

import sys

while True:

    if n <=(j-1):

        print(i)

        sys.exit()

    else:
        i+=1
        pass


Fixed submission:
n,k=map(int,input().split())
i=0


while n>=k**i:

    i+=1

else:
    print(i)
Buggy python submission (verdict: Runtime Error):

n=int(input())
a=[]
b=[]
c=[]
a=list(map(int,input().split()))


for i in range(n):

    if a[i]%2==0:
        b.append(a[i])

    else:pass


for k in range(len(b)):

    if b[k]%3==0 or b[k]%5==0:

        c.append(b[k])

if len(b)==len(c):

    print("APPROVED")

else:
    print("DENIED")


Fixed submission:
a=[]
a=list(map(int,input().split()))
a=set(a)

if len(a)==2:

    print("Yes")

else:print("No")
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

flag = True
for i in range(len(S)):
    if S{i} == T[i]:
        pass
    else:
        flag = False
        
if flag:
    print("Yes")
else:
    print("No")

Fixed submission:
S = input()
T = input()

flag = True
for i in range(len(S)):
    if S[i] == T[i]:
        pass
    else:
        flag = False
        
if flag:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))

ans = N - sum(A):
if sum(A) < N
    print(-1)
else:
    print(ans)

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

ans = N - sum(A)
if sum(A) > N:
    print(-1)
else:
    print(ans)

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

ans = N - sum(A)
if sum(A) < N
    print(-1)
else:
    print(ans)

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

ans = N - sum(A)
if sum(A) > N:
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())
A = list(map(int,input().split()))
X = Counter(A)
for i in range(1,N+1):
    if i in A:
        print(X[i])
    else:
        print(0)


Fixed submission:
N = int(input())
X = [0]*N
A = list(map(int,input().split()))
for i in A:
    X[i-1] +=1
print(*X,sep="\n")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

all = S.count("R") * S.count("G") * S.count("B")
count = 0
for i in range(N):
    for j in range(1,N):
        k = 2*j - i
        if k < N and i < j:
            if (S[i] != S[j]) and (S[j] != S[k]) and (S[k] != S[i]):
                count += 1
print(all-count)    

Fixed submission:
N = int(input())
S = input()

all = S.count("R") * S.count("G") * S.count("B")
count = 0
for i in range(N):
    for j in range(1,N):
        k = 2*j - i
        if k < N and i < j:
            if (S[i] != S[j]) and (S[j] != S[k]) and (S[k] != S[i]):
                count += 1
print(all-count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

ans = 0
for i in range(N):
    x = S[i]
    for j in range(i+1,N):
        y = S[j]
        if x == y:
            continue
        else:
            for k in range(j+1,N):
                z = S[k]
                A = j - i
                B = k - j
                if x != z and y != z and (A != B):
                    ans += 1
                    
print(ans)

Fixed submission:
N = int(input())
S = input()

all = S.count("R") * S.count("G") * S.count("B")
count = 0
for i in range(N):
    for j in range(1,N):
        k = 2*j - i
        if k < N and i < j:
            if (S[i] != S[j]) and (S[j] != S[k]) and (S[k] != S[i]):
                count += 1
print(all-count)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

from scipy.special import comb
base = comb(N, 2, exact=True)
base2 = comb(M, 2, exact=True)
print(base+base2)

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

import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
if N < 2:
    base = 0
else:
    base = comb(N,2)
    
if M < 2:
    base2 = 0
else:
    
    base2 = comb(M,2)

print(base+base2)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

X = [0] * N
R = [0] *  N

ans = True
for i in range(M):
    s,c = map(int,input().split())
    if s > N:
        ans = False
        break
        
    if R[s-1] == 0:
        X[s-1] = c
        R[s-1] = "T"
        
    elif R[s-1] == "T" and X[s-1] != c or (s == 1 and c == 0):
        ans = False
        break
        
if ans:
    if i == 0 and X[0] == 0:
            cnt = 1
    else:
        cnt = X[0]
    for i in range(1,N):
        cnt = cnt * 10 + X[i]
        
    print(cnt)

else:
    print(-1)

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

X = [0] * N
R = [0] *  N

ans = True
for i in range(M):
    s,c = map(int,input().split())
    
        
    if R[s-1] == 0:
        X[s-1] = c
        R[s-1] = "T"
        
    elif R[s-1] == "T" and X[s-1] != c :
        ans = False
        break
        
if ans:
    if X[0] == 0 and R[0] == 0 and N != 1:
        cnt = "1"
    else:
        cnt = str(X[0])
    for i in range(1,N):
        cnt = cnt + str(X[i])
    
    if len(cnt) == len(str(int(cnt))):
        
        print(cnt)
    else:
        print(-1)
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
n,a,b = map(int,input().split())
mod = 10 ** 9 + 7

flower_all = pow(2,n,mod)

def calc(n,a):
    ans = 1
    for i in range(a):
        ans *= (n - i) % mod
        
    ans = ans * (pow(factorial(a),mod - 2,mod)) % mod
        
    return ans

f_a = calc(n,a)
f_b = calc(n,b)
print(flower_all - (f_a + f_b) % mod  - 1)

Fixed submission:
from math import factorial
N, A, B = map(int, input().split())
MOD = 10 ** 9 + 7

def calc(n):
    ret = 1
    for i in range(n):
        ret = ret * (N - i) % MOD
    return ret * pow(factorial(n), MOD - 2, MOD) % MOD

print(max(0, (pow(2, N, MOD) - ((calc(A) + calc(B)) % MOD) - 1) % MOD))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

dic = {}

for i in range(N):
    S = input()
    
    if (S in dic) == False:
        dic[S] = 1
    else:
        dic[S] += 1
        
keys = []
for key , value in dic.items():
    if value == max(dic.values()):
        keys.append(key)
k = keys.sort()
for i in keys:
    print(i)

Fixed submission:
N = int(input())

dic = {}

for i in range(N):
    S = input()
    
    if (S in dic) == False:
        dic[S] = 1
    else:
        dic[S] += 1
        
keys = []
maxv = max(dic.values())
for key , value in dic.items():
    if value == maxv:
        keys.append(key)
k = keys.sort()
for i in keys:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.buffer.read#全部読み込むやつ
readline = sys.stdin.buffer.readline#1行読み込むやつ
readlines = sys.stdin.buffer.readlines#リストで読み込むらしい

N,K,*H = map(int,read().split())
N -= K
if N <= 0:
    print(0)
    exit()
    
for i in range(K):
    H.remove(max(H))
    
print(sum(H))

Fixed submission:
import sys
read = sys.stdin.buffer.read#全部読み込むやつ
readline = sys.stdin.buffer.readline#1行読み込むやつ
readlines = sys.stdin.buffer.readlines#リストで読み込むらしい

N,K,*H = map(int,read().split())
N -= K
if N <= 0:
    print(0)
    exit()
    
H.sort()
    
print(sum(H[: N]))

Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read#全部読み込むやつ
readline = sys.stdin.buffer.readline#1行読み込むやつ
readlines = sys.stdin.buffer.readlines#リストで読み込むらしい

N,K,*H = map(int,read().split())
N -= K
if N <= 0:
    print(0)
    exit()
    
for i in N:
    H.remove(max(H))
    
print(len(H))

Fixed submission:
import sys
read = sys.stdin.buffer.read#全部読み込むやつ
readline = sys.stdin.buffer.readline#1行読み込むやつ
readlines = sys.stdin.buffer.readlines#リストで読み込むらしい

N,K,*H = map(int,read().split())
N -= K
if N <= 0:
    print(0)
    exit()
    
H.sort()
    
print(sum(H[: N]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int,input().split()))
ans = 1
for i in range(1,N):
    Pj = min(L[:i])
    Pi = L[i]
    if Pj > Pi:
        ans += 1
print(ans)

Fixed submission:
import sys
read = sys.stdin.buffer.read#全部読み込むやつ
readline = sys.stdin.buffer.readline#1行読み込むやつ
readlines = sys.stdin.buffer.readlines#リストで読み込むらしい


N,*L = map(int,read().split())
ans = 0
Pj = L[0]
for i in L:
    Pj = min(Pj,i)    
    if Pj >= i:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int,input().split()))
ans = 0
for i in range(N):
    Pi = L[i]
    tes = True
    for j in range(i + 1):
        if Pi > L[j]:
            tes = False
    if tes:
        ans +=1 
print(ans)

Fixed submission:
import sys
read = sys.stdin.buffer.read#全部読み込むやつ
readline = sys.stdin.buffer.readline#1行読み込むやつ
readlines = sys.stdin.buffer.readlines#リストで読み込むらしい


N,*L = map(int,read().split())
ans = 0
Pj = L[0]
for i in L:
    Pj = min(Pj,i)    
    if Pj >= i:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
s = sorted(s)
ans = True
if(len(s)>1):
    for i in range(0,len(s),2):
        if(s[i] != s[i+1]):
            ans = False
else:
    ans = False
if(ans):
    print("Yes")
else:
    print("No")

Fixed submission:
n = int(input())
s = input()
s = sorted(s)
ans = True
if(len(s)>1 and len(s)%2 == 0):
    for i in range(0,len(s),2):
        if(s[i] != s[i+1]):
            ans = False
else:
    ans = False
if(ans):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import itertools
import math

N = int(input())
town = list(itertools.permutations(range(N)))
dis = []
for i in range(N):
    s = tuple(map(int,input().split()))
    dis.append(s)
    
ans = 0
for i,j,k in town:
    calc = math.sqrt((dis[i][0]-dis[j][0])**2 + (dis[i][1]-dis[j][1])**2 ) + math.sqrt((dis[j][0]-dis[k][0])**2 + (dis[j][1]-dis[k][1])**2 )
    ans += calc
    
ans/len(town)

Fixed submission:
import itertools
import math
n = int(input())
s = []
for i in range(n):
    x,y = map(int,input().split())
    s.append([x,y])
s = list(itertools.permutations(s))
ans = 0
for i in s:
    for j in range(n-1):
        ans += math.sqrt((i[j][0] - i[j+1][0])**2 + (i[j][1] - i[j+1][1])**2)
print(ans/len(s))
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())

ans = 10**13


for i in range(1,10**6+1:
    if N % i == 0:
        j = N / i
        ans = min(ans,j + i - 2)
        
print(int(ans))

Fixed submission:
import math

N = int(input())

ans = 10**13


for i in range(1,10**6+1):
    if N % i == 0:
        j = N / i
        ans = min(ans,j + i - 2)
        
print(int(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

s = S[0]
i = 1
ans = 1
while(True):
    if s == S[i]:
        pass
    else:
        ans += 1
        s = S[i]
    i += 1
    if i == len(S):
        break
        
print(ans)

Fixed submission:
N = int(input())
S = input()

s = S[0]
i = 1
ans = 1
while(True):
    
    if i == len(S):
        break
    if s == S[i]:
        pass
    else:
        ans += 1
        s = S[i]
    i += 1
        
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
if S == "Sunny":
    print("Cloudy")
elif S == Cloudy:
    print("Rainy")
else:
    print("Sunny")

Fixed submission:
S = input()
if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy":
    print("Rainy")
else:
    print("Sunny")

Buggy python submission (verdict: Runtime Error):
S = input()
if S == "Sunny":
    print("Cloudy")
elif S == Cloudy:
    print("Rainy")
else:
    print("Sunny")

Fixed submission:
S = input()
if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
Buggy python submission (verdict: Runtime Error):
a = int(input())
List_a=list(map(int,input().split()))
List_b=list(map(int,input().split()))
List_c=list(map(int,input().split()))
B = 0
C = 0
count = 0
key = 0
for i in List_a:
  B += List_b[i-1]
  if count > 0 and key+1 ==i:
    C += List_c[i-2]
  key = i
  count += 1
 print(B+C)

Fixed submission:
a = int(input())
List_a=list(map(int,input().split()))
List_b=list(map(int,input().split()))
List_c=list(map(int,input().split()))
B = 0
count = 0
key = 0
for i in List_a:
  B += List_b[i-1]
  if count > 0 and key+1 ==i:
    B += List_c[i-2]
  key = i
  count += 1
 
print(B)
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())

import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
s = lcm(C,D)
X =  A - (A//C + A //D - A//s)
Y =  B - (B//C + B //D - B//s)
print(Y-X)

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

import fractions

def f(N):
    red = N//C
    red += N//D
    X = (C * D // fractions.gcd(C, D))
    red -= N//X
    return N - red

ans = f(B) - f(A-1)
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M =map(int,input().split())
a = [int(input()) for i in range(M)]
DP = [1]*N
mod = 10**9 + 7
for i in a:
    DP[i-1] = 0
for i in range(N):
    if(DP[i] != 0):
        if(i<1):
            DP[i+1] = DP[i]%mod
        else:
            DP[i] = (DP[i-2]%mod + DP[i-1]%mod)
print(DP[-1])

Fixed submission:
N,M =map(int,input().split())
a = [int(input()) for i in range(M)]
DP = [1]*N
mod = 10**9 + 7
for i in a:
    DP[i-1] = 0
if(N != 1):
    for i in range(N):
        if(DP[i] != 0):
            if(i<1):
                DP[i] = DP[i-1]%mod
            else:
                DP[i] = (DP[i-2] + DP[i-1])%mod
else:
    DP = [1]
print(DP[-1])
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools

ans = 0
N,M = map(int,readline().split())
L = []

for i in range(M):
    k,*S = map(int,readline().split())
    L.append(S)

P = list(map(int,readline().split()))

A = list(itertools.product([0,1],repeat=N))

for i in A:
    sw = [False] * N
    for j in range(M):
        count = 0
        for k in L[j]:
            count += i[k-1]

        if count % 2 == P[j]:
            sw[j] = True
            
    if sum(sw) == N:
        ans += 1
print(ans)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools

ans = 0
N,M = map(int,readline().split())
L = []

for i in range(M):
    k,*S = map(int,readline().split())
    L.append(S)

P = list(map(int,readline().split()))

A = list(itertools.product([0,1],repeat=N))

for i in A:
    sw = [False] * M
    for j in range(M):
        count = 0
        for k in L[j]:
            count += i[k-1]

        if count % 2 == P[j]:
            sw[j] = True
            
    if sum(sw) == M:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
A = list(map(int,input().split()))

for i in range(M):
    B,C = map(int,input().split())
    A += [C]*B
A.sort()
print(sum(A[-N:]))

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

L = []
for i in range(M):
    bc = tuple(map(int,input().split()))
    L.append(bc)

L = sorted(L,key=lambda x:-x[1])
n = 0
for b,c in L:
    n += b
    A += [c] * b
    if n >= N:
        break
        
A.sort()
print(sum(A[-N:]))

Buggy python submission (verdict: Time Limit Exceeded):
import heapq

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

for i in range(M):
    B,C = map(int,input().split())
    D = [C]* B
    A = A + D
    
A.sort()
print(sum(A[-N:]))

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

L = []
for i in range(M):
    bc = tuple(map(int,input().split()))
    L.append(bc)

L = sorted(L,key=lambda x:-x[1])
n = 0
for b,c in L:
    n += b
    A += [c] * b
    if n >= N:
        break
        
A.sort()
print(sum(A[-N:]))

Buggy python submission (verdict: Time Limit Exceeded):
import heapq

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

for i in range(M):
    B,C = map(int,input().split())
    D = [C]* B
    A = A + D
    
a = list(map(lambda x: x*(-1), A))
heapq.heapify(a)

ans = 0
for i in range(N):
    ans += heapq.heappop(a)*(-1)
    
print(ans)

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

L = []
for i in range(M):
    bc = tuple(map(int,input().split()))
    L.append(bc)

L = sorted(L,key=lambda x:-x[1])
n = 0
for b,c in L:
    n += b
    A += [c] * b
    if n >= N:
        break
        
A.sort()
print(sum(A[-N:]))

Buggy python submission (verdict: Time Limit Exceeded):
import heapq

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

for i in range(M):
    B,C = map(int,input().split())
    D = [C]* B
    A = A + D
    
a = list(map(lambda x: x*(-1), A))
heapq.heapify(a)

ans = 0
for i in range(N):
    ans += heapq.heappop(a)*(-1)
    
print(ans)

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

L = []
for i in range(M):
    bc = tuple(map(int,input().split()))
    L.append(bc)

L = sorted(L,key=lambda x:-x[1])
n = 0
for b,c in L:
    n += b
    A += [c] * b
    if n >= N:
        break
        
A.sort()
print(sum(A[-N:]))
Buggy python submission (verdict: Runtime Error):
ans = 0
y = []
z = []
for i in range(5):
    X = int(input())
    if X % 10 != 0:
        y.append(10 - X%10)
    z.append(X)
print(sum(z) + sum(y) - max(y))

Fixed submission:
List= [int(input()) for i in range(5)]
amari =9
time = 0
flag = False;
for i in List:
    if(i%10 != 0):
        time += 10 - i%10
        amari = min(amari,i%10)
        flag = True
output = sum(List) + time
if(flag):
    output -= 10 - amari
print(output)

Buggy python submission (verdict: Runtime Error):
List= [int(input()) for i in range(5)]
amari =9
time = 0
flag = False;
for i in List:
    if(i%10 != 0):
        time += 10 - i%10
        amari = min(amari,i%10)
        flag = True
output = sum(List) + time
if(flag = True):
    output += amari
print(output)

Fixed submission:
List= [int(input()) for i in range(5)]
amari =9
time = 0
flag = False;
for i in List:
    if(i%10 != 0):
        time += 10 - i%10
        amari = min(amari,i%10)
        flag = True
output = sum(List) + time
if(flag):
    output -= 10 - amari
print(output)
Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int,input().split())
S = input()
check = "AC"
for i in range(Q):
    l,r = map(int,input().split())
    cnt = S[l-1:r].count(check)
    print(cnt)

Fixed submission:
N,Q = map(int,input().split())
S = input()
T = [0]*(N+1)
for i in range(N):
    T[i+1] = T[i] + (1 if S[i : i + 2] == "AC" else 0)
for i in range(Q):
    l,r = map(int,input().split())
    print(T[r-1] - T[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int,input().split())
S = input()
check = "AC"
for i in range(Q):
    l,r = map(int,input().split())
    T = S[l-1:r]
    cnt = T.count(check)
    print(cnt)

Fixed submission:
N,Q = map(int,input().split())
S = input()
T = [0]*(N+1)
for i in range(N):
    T[i+1] = T[i] + (1 if S[i : i + 2] == "AC" else 0)
for i in range(Q):
    l,r = map(int,input().split())
    print(T[r-1] - T[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int,input().split())
S = input()
check = "AC"
for i in range(Q):
    l,r = map(int,input().split())
    T = S[l-1:r]
    cnt = 0
    for i in range(len(T)-1):
        if(check == T[i:i+2]):
            cnt += 1
    print(cnt)

Fixed submission:
N,Q = map(int,input().split())
S = input()
T = [0]*(N+1)
for i in range(N):
    T[i+1] = T[i] + (1 if S[i : i + 2] == "AC" else 0)
for i in range(Q):
    l,r = map(int,input().split())
    print(T[r-1] - T[l-1])
Buggy python submission (verdict: Runtime Error):
S = input()
N = int(input())

for i in range(min(N,K)):
    if S[i] != "1":
        print(S[i])
        quit()

print(1)

Fixed submission:
S = input()
N = int(input())

for i in range(min(N,len(S))):
    if S[i] != "1":
        print(S[i])
        quit()

print(1)

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

for i in range(min(N,K):
    if S[i] != "1":
        print(S[i])
        quit()

print(1)

Fixed submission:
S = input()
N = int(input())

for i in range(min(N,len(S))):
    if S[i] != "1":
        print(S[i])
        quit()

print(1)