Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
result=1
a.sort()
if a[0]==0:
    print(0)
    exit(0)
for i in range(n//2):
    result=result*a[i]*a[n-i-1]
if n%2==1:
    result*=a[n//2+1]
if result==1000000000000000000:
    print(result)
elif 18< len(str(result)):
    print(-1)
else:
    print(result)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
result=1
for i in a:
    result*=i
    if 10**18<result:
        result=-1
        break
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
result=1
a.sort()
for i in a:
    if i==0:
        result=0
        break
    result*=i
if result==1000000000000000000:
    print(result)
elif 18< len(str(result)):
    print(-1)
else:
    print(result)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
result=1
for i in a:
    result*=i
    if 10**18<result:
        result=-1
        break
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
result=1
for i in a:
    result*=i
if result==1000000000000000000:
    print(result)
elif 18< len(str(result)):
    print(-1)
else:
    print(result)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
result=1
for i in a:
    result*=i
    if 10**18<result:
        result=-1
        break
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
result=1
for i in a:
    result*=i
if pow(10,18)<result:
    print(-1)
else:
    print(result)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
result=1
for i in a:
    result*=i
    if 10**18<result:
        result=-1
        break
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
result=1
for i in a:
    result*=i
if (10**18)<result:
    print(-1)
else:
    print(result)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
result=1
for i in a:
    result*=i
    if 10**18<result:
        result=-1
        break
print(result)
Buggy python submission (verdict: Runtime Error):
k=int(input())
a,b=map(int,input.split())
if b-a>k:
    print('OK')
else:
    print('NG')

Fixed submission:
k=int(input())
a,b=map(int,input().split())
x=b%k
y=b-x
if b-a>k:
    print('OK')
elif y>a:
    print('OK')
elif a%k==0:
    print('OK')
else:
    print('NG')
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
w='z'*a+'x'*b
f=''
for i in range(1000):
    f+=w
    d=f[:n]
print(d.count('z'))

Fixed submission:
s=input()
if s =='AAA' or s=='BBB':
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
w='z'*a+'x'*b
f=''
for i in range(1000):
    f+=w
    d=f[:n]
print(d.count('z'))


Fixed submission:
n,a,b=map(int,input().split())
x=n//(a+b)
y=n%(a+b)
if y<a:
    print(x*a+y)
else:
    print(x*a+a)
Buggy python submission (verdict: Runtime Error):
n=input()
a=list(map(int,input().split()))
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            pass
        else:
            print('DENIED')
            exit(0)
print('APPROVED')


Fixed submission:
a=list(map(int,input().split()))
a.sort()
if a[0]==a[1]!=a[2] or a[0]!=a[1]==a[2]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n=input()
a=list(map(int,input().split()))
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            result='APPROVED'
        else:
            result='DENIED'
            break
print(result)

Fixed submission:
n=input()
a=list(map(int,input().split()))
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            pass
        else:
            print('DENIED')
            exit(0)
print('APPROVED')
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
for i in range(k):
    if a>=1:
        a-=1
    elif b>=1:
        b-=1
print(a,b)

Fixed submission:
a,b,k=map(int,input().split())
if a-k>=0:
    print(a-k,b)
else:
    if (a+b)>k:
        print(0,b-(k-a))
    else:
        print(0,0)
Buggy python submission (verdict: Runtime Error):
n=int(input())


count=len(str(n))
ans=''
if count%2==0:
    for i in range(count-1):
        if i%2==0:
            ans+='9'
        else:
            ans+='0'
else:
    ans=count//2*'90'
    ans=n-int(ans)
print(int(ans))

Fixed submission:
n=int(input())


count=len(str(n))
ans=''
if count%2==0:
    for i in range(count-1):
        if i%2==0:
            ans+='9'
        else:
            ans+='0'
else:
    ans=(count//2)*'90'
    try:
        ans=n-int(ans)
    except:
        ans=n
print(int(ans))
Buggy python submission (verdict: Runtime Error):
s=input()
for i in range(len(s)):
    if s[i]==s[i+1]:
        result='Bud'
        break
    else:
        result='Good'
print(result)


Fixed submission:
s=input()
for i in range(len(s)-1):
    if s[i]==s[i+1]:
        result='Bad'
        break
    else:
        result='Good'
print(result)
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
z=[]
for i in range(1,a):
    if a%i==0 and b%i==0:
        z.append(i)
print(z[k-1])

Fixed submission:
a,b,k=map(int,input().split())
count=0
for i in range(a+1,0,-1):
    if a%i==0 and b%i==0:
        count+=1
        if count==k:
            print(i)
Buggy python submission (verdict: Runtime Error):
t,x=(int,input().split())
print(t/x)

Fixed submission:
t,x=map(int,input().split())
print(t/x)
Buggy python submission (verdict: Runtime Error):
n,i=map(int,input(),split())
print(n-i+1)

Fixed submission:
n,i=map(int,input().split())
print(n-i+1)
Buggy python submission (verdict: Runtime Error):
s=input()
count=0
for i in s:
    if i='+':
        count+=1
    else:
        count-=1
print(count)

Fixed submission:
s=input()
count=0
for i in s:
    if i=='+':
        count+=1
    else:
        count-=1
print(count)

Buggy python submission (verdict: Runtime Error):
s=input()
count=0
for i in s:
    if i='+':
        count+=1
    else:
        count-=1

Fixed submission:
s=input()
count=0
for i in s:
    if i=='+':
        count+=1
    else:
        count-=1
print(count)
Buggy python submission (verdict: Runtime Error):
import re
result=re.fullmatch(r'(\d{3})(\d)/(\d{2})/(\d{2})',input())
print(result.group(1)+'8/'+result.group(3)+'/'+result.group(4)

Fixed submission:
import re
s=input()
result=re.fullmatch(r'(\d{3})(\d)/(\d{2})/(\d{2})',s)
print(result.group(1)+'8/'+result.group(3)+'/'+result.group(4))
Buggy python submission (verdict: Runtime Error):
a,o,b=map(str,input().split())
if o=='+':
    print(a+b)
else:
    print(a-b)

Fixed submission:
a,o,b=map(str,input().split())
a=int(a)
b=int(b)
if o=='+':
    print(a+b)
else:
    print(a-b)
Buggy python submission (verdict: Runtime Error):
class ABC109Solver():
    def __init__(self):
        self.a = int()
        self.b = int()
    def input(self, a, b):
        self.a = a
        self.b = b
    def solve(self):
        # return 'Yes'
        # return 'No' if self.b%2 == 0 else 'Yes'
        return 'No' if self.a%2 == 0 or self.b%2 == 0 else 'Yes'
      
a = int(input())
b = int(input())
solver = ABC109Solver()
solver.input(a,b)

print( solver.solve() )


Fixed submission:
class ABC109Solver():
    def __init__(self):
        self.a = int()
        self.b = int()
    def input(self, a, b):
        self.a = a
        self.b = b
    def solve(self):
        # return 'Yes'
        # return 'No' if self.b%2 == 0 else 'Yes'
        return 'No' if self.a%2 == 0 or self.b%2 == 0 else 'Yes'

vals = input().split(' ')
a, b = int(vals[0]), int(vals[1])
solver = ABC109Solver()
solver.input(a,b)
 
print( solver.solve() )

Buggy python submission (verdict: Runtime Error):

class ABC109Solver():
    def __init__(self):
        self.a = int()
        self.b = int()
    def input(self, a, b):
        self.a = a
        self.b = b
    def solve(self):
        # return 'Yes'
        # return 'No' if self.b%2 == 0 else 'Yes'
        return 'No' if self.a%2 == 0 or self.b%2 == 0 else 'Yes'
      
a = int(input())
b = int(input())
solver = ABC109Solver()

print( solver.solve() )

Fixed submission:
class ABC109Solver():
    def __init__(self):
        self.a = int()
        self.b = int()
    def input(self, a, b):
        self.a = a
        self.b = b
    def solve(self):
        # return 'Yes'
        # return 'No' if self.b%2 == 0 else 'Yes'
        return 'No' if self.a%2 == 0 or self.b%2 == 0 else 'Yes'

vals = input().split(' ')
a, b = int(vals[0]), int(vals[1])
solver = ABC109Solver()
solver.input(a,b)
 
print( solver.solve() )

Buggy python submission (verdict: Runtime Error):

class ABC109Solver():
    def __init__(self):
        self.a = int()
        self.b = int()

    def input(self, a, b):
        self.a = a
        self.b = b

    def solve(self):
        # return 'Yes'
        # return 'No' if self.b%2 == 0 else 'Yes'
        return 'No' if self.a%2 == 0 or self.b%2 == 0 else 'Yes'
      
a = input()
b = input()
solver = ABC109Solver()
solver.input(a, b)
print( solver.solve() )

Fixed submission:
class ABC109Solver():
    def __init__(self):
        self.a = int()
        self.b = int()
    def input(self, a, b):
        self.a = a
        self.b = b
    def solve(self):
        # return 'Yes'
        # return 'No' if self.b%2 == 0 else 'Yes'
        return 'No' if self.a%2 == 0 or self.b%2 == 0 else 'Yes'

vals = input().split(' ')
a, b = int(vals[0]), int(vals[1])
solver = ABC109Solver()
solver.input(a,b)
 
print( solver.solve() )
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
if K % 2 == 0:
    print(-1)
    exit()
i = 1
ans = 1
while True:
    if int("7" * i) % K == 0:
        print(ans)
        break
    i += 1
    ans += 1

Fixed submission:
K = int(input())
n = 7 % K
for k in range(1, K + 1):
    if n == 0:
        print(k)
        exit()
    n = (n*10+7)%K
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import math
N = int(input())
for n in range(1, N + 1):
    ans = 0
    x = math.ceil(n ** (1/2))
    for i in range(1, x):
        for j in range(1, x):
            for k in range(1, x):
                if i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i == n:
                    ans += 1
    print(ans)

Fixed submission:
N = int(input())
A = [0] * (N + 1)
for i in range(1, 102):
    for j in range(1, 102):
        for k in range(1, 102):
            t = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + i * k
            if t <= N:
                A[t] += 1
for n in range(1, N + 1):
    print(A[n])

Buggy python submission (verdict: Time Limit Exceeded):
#<C>
import math
N = int(input())
for n in range(1, N + 1):
    ans = 0
    x = math.ceil(n ** (1/2))
    for i in range(1, x):
        for j in range(1, x):
            for k in range(1, x):
                if i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i == n:
                    ans += 1
    print(ans)


Fixed submission:
N = int(input())
A = [0] * (N + 1)
for i in range(1, 102):
    for j in range(1, 102):
        for k in range(1, 102):
            t = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + i * k
            if t <= N:
                A[t] += 1
for n in range(1, N + 1):
    print(A[n])
Buggy python submission (verdict: Runtime Error):
from collections import deque
ans = 0
n, m, k = map(int,input().split())
a = deque(list(map(int,input().split())))
b = deque(list(map(int,input().split())))
result = 0

while True:
    if ans > k:
        print(result-1)
        break
    if a[0] + b[0] == 2 * (10 ** 9 + 1):
        print(result)
        break
    if len(a) == 0 or len(b) == 0:
        a.append(10 ** 9 + 1)
        b.append(10 ** 9 + 1)
    if a[0] > b[0]:
        ans += b.popleft()
        result += 1
    else:
        ans += a.popleft()
        result += 1



#<D>
#import math
##def search_divisor_nu

Fixed submission:
#(0)環境
from itertools import accumulate
import bisect
n, m, k = map(int,input().split())
#[0]足すことで上から０冊読んだという要素として加えると実装が楽に(一冊も読めんかった)
#accumulate:累積和などが求められる
a = [0] + list(accumulate(map(int,input().split())))
b = [0] + list(accumulate(map(int,input().split())))
ans =[0]

for i in range(n + 1):
    c = bisect.bisect_right(b, k - a[i]) - 1
    #k-s<0のときはインデックスがー１なので除外しなあかん
    if c != -1:
        ans.append(c + i)
print(max(ans))

Buggy python submission (verdict: Runtime Error):
ans = []
n, m, k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

i = 0
j = 0
while True:
    
    if a[i] < b[j]:
        ans += [a[i]]
        i += 1
    else:
        ans += [b[j]]
        j += 1

    if sum(ans) > k:
        print(len(ans) - 1)
        break
    

Fixed submission:
#(0)環境
from itertools import accumulate
import bisect
n, m, k = map(int,input().split())
#[0]足すことで上から０冊読んだという要素として加えると実装が楽に(一冊も読めんかった)
#accumulate:累積和などが求められる
a = [0] + list(accumulate(map(int,input().split())))
b = [0] + list(accumulate(map(int,input().split())))
ans =[0]

for i in range(n + 1):
    c = bisect.bisect_right(b, k - a[i]) - 1
    #k-s<0のときはインデックスがー１なので除外しなあかん
    if c != -1:
        ans.append(c + i)
print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=0
for i in range(1,n+1):
    x,y=i,(n//i)*i
    ans+=((n//i)*(x+y)//2)
print(ans)

Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
    x, y = i, (n // i) * i
    #等差数列の和は(1/2)*(項数(今回はn//i))*(初項＋末項)
    ans += ((n // i) * (x + y) // 2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(1, n + 1):
    x, y = i, (n // i) * i
    #等差数列の和は(1/2)*(項数(今回はn//i))*(初項＋末項)
    ans += ((n // i) * (x + y) // 2)
print(ans)

Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
    x, y = i, (n // i) * i
    #等差数列の和は(1/2)*(項数(今回はn//i))*(初項＋末項)
    ans += ((n // i) * (x + y) // 2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
###<AOJ.1-6>
###<B>
##n = int(input())
##for i in range(n):
##    x, y = map(str,input().split())
##    y = int(y)
##    

def factorization(n):
    def factor_sub(n, m):
        c = 0
        while n % m == 0:
            c += 1
            n /= m
        return c, n
    #
    buff = []
    c, m = factor_sub(n, 2)
    if c > 0: buff.append((2, c))
    c, m = factor_sub(m, 3)
    if c > 0: buff.append((3, c))
    x = 5
    while m >= x * x:
        c, m = factor_sub(m, x)
        if c > 0: buff.append((x, c))
        if x % 6 == 5:
            x += 2
        else:
            x += 4
    if m > 1: buff.append((m, 1))
    return buff

def divisor_num(n):
    a = 1
    for _, x in factorization(n):
        a *= x + 1
    return a

n = int(input())
ans = 0
for i in range(1, n + 1):
    ans += i * divisor_num(i
                           )
    #print(num_divisors_table(i))

print(ans)
    




Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
    x, y = i, (n // i) * i
    #等差数列の和は(1/2)*(項数(今回はn//i))*(初項＋末項)
    ans += ((n // i) * (x + y) // 2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = map(str, input().split())
a = " ".join(a)

m = int(input())
for i in range(m):
               b, c = map(str,input().split())
               #ans = sum([int(i) for i in a])
               a=a.replace(b,c).replace(" ","+")
               
               print(eval(a))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
m = int(input())
t = [0] * (10 ** 5 + 1)
ans = sum(a)
for i in a:
    t[i] += 1
for i in range(m):
               b, c = map(int,input().split())
               #ans = sum([int(i) for i in a])
               ans -= b * t[b]
               ans += c * t[b]
               t[c] += t[b]
               t[b] = 0
               #ans = ans - a.count("b")(int("c")-int("b"))
               print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = map(str, input().split())
a = " ".join(a)

m = int(input())
for i in range(m):
               b, c = map(str,input().split())
               #ans = sum([int(i) for i in a])
               a=a.replace(b,c)
               a=a.replace(" ","+")
               
               print(eval(a))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
m = int(input())
t = [0] * (10 ** 5 + 1)
ans = sum(a)
for i in a:
    t[i] += 1
for i in range(m):
               b, c = map(int,input().split())
               #ans = sum([int(i) for i in a])
               ans -= b * t[b]
               ans += c * t[b]
               t[c] += t[b]
               t[b] = 0
               #ans = ans - a.count("b")(int("c")-int("b"))
               print(ans)
Buggy python submission (verdict: Runtime Error):


n=int(input())
a=list(map(int,input().split()))
ans=1
for i in range(len(a)):
    ans*=a[i]
if ans > 10**18:
    print(-1)
else:
    print(ans)


Fixed submission:
a,b=map(int,input().split())
print(a*b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
limit=10**18
a.sort()
result=A[0]
for k in A[1:]:
    result*=k
    if result > limit:
        print(-1)
        exit()
print(result)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
limit=10**18
a.sort()
result=a[0]
for k in a[1:]:
    result*=k
    if result > limit:
        print(-1)
        exit()
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

n=int(input())
a=list(map(int,input().split()))
ans=reduce(lambda x,y:x*y,a)
if ans <= 10**18:
    print(ans)
else:
    print(-1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
limit=10**18
a.sort()
result=a[0]
for k in a[1:]:
    result*=k
    if result > limit:
        print(-1)
        exit()
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator
n=int(input())
a=list(map(int,input().split()))
ans=functools.reduce(operator.mul, a)
if ans > 10**18:
    print(-1)
else:
    print(ans)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
limit=10**18
a.sort()
result=a[0]
for k in a[1:]:
    result*=k
    if result > limit:
        print(-1)
        exit()
print(result)

Buggy python submission (verdict: Time Limit Exceeded):


n=int(input())
a=list(map(int,input().split()))
ans=1
for i in range(len(a)):
    ans*=a[i]
if ans > 10**18:
    print(-1)
else:
    print(ans)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
limit=10**18
a.sort()
result=a[0]
for k in a[1:]:
    result*=k
    if result > limit:
        print(-1)
        exit()
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

n=int(input())
a=list(map(int,input().split()))
ans=reduce(lambda x,y:x*y,a)
if ans > 10**18:
    print(-1)
else:
    print(ans)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
limit=10**18
a.sort()
result=a[0]
for k in a[1:]:
    result*=k
    if result > limit:
        print(-1)
        exit()
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
n=int(input())
rn=int(sqrt(n))
s=[0]*(rn+1)
s[0]=-1
s[1]=-1
t=[0]*(rn+1)
for i in range(2,rn+1):
    if s[i] != 0:
        continue
    s[i] = i
    j = i
    while j < rn + 1:
        t[j] = 1
        j *= i
        for j in range(i * i, rn + 1,i):
            if s[j] == 0:
                s[j] == i

result = 0
last = -1
for i in range(2,rn+1):
    if t[i] == 0:
        continue
    if n % i == 0:
        result += 1
        n //= i
        last =i
if n != 1 and n > rn:
    result += 1
print(result)

Fixed submission:
from math import sqrt

N = int(input())

rn = int(sqrt(N))
sieve = [0] * (rn + 1)
sieve[0] = -1
sieve[1] = -1
t = [0] * (rn + 1)
for i in range(2, rn + 1):
    if sieve[i] != 0:
        continue
    sieve[i] = i
    j = i
    while j < rn + 1:
        t[j] = 1
        j *= i
    for j in range(i * i, rn + 1, i):
        if sieve[j] == 0:
            sieve[j] = i

result = 0
last = -1
for i in range(2, rn + 1):
    if t[i] == 0:
        continue
    if N % i == 0:
        result += 1
        N //= i
        last = i
if N != 1 and N > rn:
    result += 1
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
n=int(input())
rn=int(sqrt(n))
s=[0]*(rn+1)
s[0]=-1
s[1]=-1
t=[0]*(rn+1)
for i in range(2,rn+1):
    if s[i] != 0:
        continue
    s[i] = i
    j = i
    while j < rn + 1:
        t[j] = 1
        j *= i
        for j in range(i * i, rn + 1):
            if s[j] == 0:
                s[j] == i

result = 0
last = -1
for i in range(2,rn+1):
    if t[i] == 0:
        continue
    if n % i == 0:
        result += 1
        n //= i
        last =i
if n != 1 and n > rn:
    result += 1
print(result)

Fixed submission:
from math import sqrt

N = int(input())

rn = int(sqrt(N))
sieve = [0] * (rn + 1)
sieve[0] = -1
sieve[1] = -1
t = [0] * (rn + 1)
for i in range(2, rn + 1):
    if sieve[i] != 0:
        continue
    sieve[i] = i
    j = i
    while j < rn + 1:
        t[j] = 1
        j *= i
    for j in range(i * i, rn + 1, i):
        if sieve[j] == 0:
            sieve[j] = i

result = 0
last = -1
for i in range(2, rn + 1):
    if t[i] == 0:
        continue
    if N % i == 0:
        result += 1
        N //= i
        last = i
if N != 1 and N > rn:
    result += 1
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,k=map(int,input().split())
ans=[]
for i in range(a+1):
    for j in range(b+1):
        ans.append(i+j*0-(k-i-j))
print(max(ans))

Fixed submission:
a,b,c,k=map(int,input().split())
ans=[]
if k <= a:
    print(k)
elif k == a+b:
    print(a)
else:
    print(a+b*0-(k-a-b))
Buggy python submission (verdict: Runtime Error):
S,W=int(input())
if S < W:
    print("safe")
else:
    print("unsafe")

Fixed submission:
S,W=map(int,input().split())
if S > W:
    print("safe")
else:
    print("unsafe")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in range(1,n+1):
    ans[i-1]=a.count(i)
print(*ans,sep="\n")



Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in a:
    ans[i-1]+=1
for k in ans:
    print(k)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=[]
for i in range(1,n+1):
    ans.append(a.count(i))
print(*ans,sep="\n")



Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in a:
    ans[i-1]+=1
for k in ans:
    print(k)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=[]
for i in range(1,n+1):
    ans.append(a.count(i))
for k in ans:
    print(k)



Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in a:
    ans[i-1]+=1
for k in ans:
    print(k)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=[]
for i in range(1,n+1):
    ans.append(a.count(i))
for k in range(len(ans)):
    print(ans[k])



Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in a:
    ans[i-1]+=1
for k in ans:
    print(k)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
x=[N,abs(N-K)]
i=1
while x[i] < x[i-1]:
    x.append(abs(x[i]-K))
    i+=1
print(x[i-1])


Fixed submission:
N,K = map(int,input().split())
print(min(N%K,-N%K))