Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
f = 1
a = list(map(int, input().split()))
f = 1
for i in  a:
    f = f * i
if(f>1000000000000000000):
    print(-1)
else:
    print(f)


Fixed submission:
def fun(a,n):
    if 0 in a:
        return 0
    z = 1
    for i in a:
        z=z*i 
        if(z>1000000000000000000):
            return -1
    return z

n = int(input())
a = list(map(int,input().split()))
f = fun(a,n)
print(f)

Buggy python submission (verdict: Time Limit Exceeded):
# Multiplication2
import math
N = int(input())
A = list(map(int,input().split()))
ans = 1
for a in A:
    ans *= a
ans = [-1, ans][ans <= 10**18]
print(ans)

Fixed submission:
# Multiplication2
import math
N = int(input())
A = sorted(list(map(int,input().split())))
ans = 1
for a in A:
    ans *= a
    if ans == 0:
        break
    elif ans > 10**18:
        ans = -1
        break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# Multiplication2
import math
N = int(input())
A = list(map(int,input().split()))
ans = [-1, math.prod(A)][math.prod(A) <= 10**18]
print(ans)

Fixed submission:
# Multiplication2
import math
N = int(input())
A = sorted(list(map(int,input().split())))
ans = 1
for a in A:
    ans *= a
    if ans == 0:
        break
    elif ans > 10**18:
        ans = -1
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
ans = int((A*B) // 1)
print(ans)

Fixed submission:
# Multiplication 3
A, B = input().split()
A = int(A)
B = int(B.replace('.', ''))
ans = (A*B) // 100
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# Next Prime
import numpy as np

# input
X = int(input())

# solve
primes = np.array([1])
numbers = np.array(list(range(2, 10**5 + 1)))
while len(numbers) > 0 and max(primes) < X:
    primes = np.append(primes, numbers[0])
    numbers = numbers[numbers % numbers[0] != 0]

res = int(max(primes))

# output
print(res)

Fixed submission:
# Next Prime
import numpy as np

# input
X = int(input())

# solve
prime = 0
numbers = np.array(list(range(2, 10**5 + 4)))

while prime < X:
    prime = numbers[0]
    numbers = numbers[numbers % prime != 0]

# output
print(prime)

Buggy python submission (verdict: Runtime Error):
# Next Prime
import numpy as np

# input
X = int(input())

# solve
primes = np.array([])
numbers = np.array(list(range(2, 10**5 + 1)))
while len(numbers) > 0:
    primes = np.append(primes, numbers[0])
    numbers = numbers[numbers % numbers[0] != 0]

res = int(min(primes[primes >= X]))

# output
print(res)

Fixed submission:
# Next Prime
import numpy as np

# input
X = int(input())

# solve
prime = 0
numbers = np.array(list(range(2, 10**5 + 4)))

while prime < X:
    prime = numbers[0]
    numbers = numbers[numbers % prime != 0]

# output
print(prime)
Buggy python submission (verdict: Runtime Error):
# Snack
from collections import deque
import numpy as np
import math


# input
A, B = map(int, input().split())
A, B = max(A,B), min(A,B)

# solve
# -----------------
# 約数列挙
def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = deque()
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return list(divisor_list)
# -----------------

div_A = make_divisor_list(A)
div_B = make_divisor_list(B)

for b in [b for b in div_B if b not in div_A]:
    if A * b % B == 0:
        res = A * b
        break

# output
print(res)

Fixed submission:
# Snack
from collections import deque
import numpy as np
import math


# input
A, B = map(int, input().split())
A, B = max(A,B), min(A,B)

# solve
# -----------------
# 約数列挙
def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = deque()
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return list(divisor_list)
# -----------------

div_A = make_divisor_list(A)
div_B = make_divisor_list(B)

rem = [b for b in div_B if b not in div_A]

if len(rem) != 0:
    for b in [b for b in div_B if b not in div_A]:
        if A * b % B == 0:
            res = A * b
            break
else:
    res = A

# output
print(res)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = list(map(int, input().split()))
rank = {}
for i in range(N):
    rank[A[i]] = str(i+1)
    
print(' '.joint(rank.values()))

Fixed submission:
import numpy as np

N = int(input())
A = list(map(int, input().split()))
rank = {}
for i in range(N):
    rank[A[i]] = str(i+1)
    
print(' '.join(rank.values()))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = list(map(int, input().split()))
for i in range(1,N+1):
    print(A.index(i)+1, end = ' ')

Fixed submission:
import numpy as np

N = int(input())
A = list(map(int, input().split()))
rank = {}
for i in range(N):
    rank[A[i]] = str(i+1)
    
print(' '.join(rank.values()))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = list(map(int, input().split()))
dic = {i:A.index(i)+1 for i in A}

print(' '.join([str(e[1]) for e in sorted(dic.items())]))

Fixed submission:
import numpy as np

N = int(input())
A = list(map(int, input().split()))
rank = {}
for i in range(N):
    rank[A[i]] = str(i+1)
    
print(' '.join(rank.values()))
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))

pos = 0
iter = 0

while pos <= X and len(L) >= iter:
    iter += 1
    pos += L[iter-1]
    

print(iter)


Fixed submission:
import numpy as np

N, X = map(int, input().split())
L = np.array([0] + list(map(int, input().split()))) 

res = sum([1 if e <= X else 0 for e in np.cumsum(L)])

print(res)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [0] * (N+1)
for _ in range(M):
    i = int(input())
    a[i] = 1
dp = [0] * (N+2)
dp[N] = 1
mod = 1_000_000_007

for i in range(N-1, -1, -1):
    if a[i]:
        dp[i] = 0
        continue
    dp[i] = (dp[i+1] + dp[i+2]) % mod 

print(dp[0])

Fixed submission:
N, M = map(int, input().split())
a = [0] * (N+1)
for _ in range(M):
    i = int(input())
    a[i] = 1

dp = [0] * (N+2)
dp[N] = 1
mod = 1000000007

for i in range(N-1, -1, -1):
    if a[i]:
        dp[i] = 0
        continue
    dp[i] = (dp[i+1] + dp[i+2]) % mod 

print(dp[0])
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

count = 0
cand = []
denom = 0

for i in range(1, min(A, B)):
    denom += 1
    if A % denom == 0 and B % denom == 0:
        cand.append(denom)

print(cand[-K])

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

count = 0
cand = []
denom = 0

for i in range(1, min(A, B)+1):
    denom += 1
    if A % denom == 0 and B % denom == 0:
        cand.append(denom)

print(cand[-K])
Buggy python submission (verdict: Runtime Error):
k, a, b = map(int, input().split())

if a < b - 2:
    if k > (a + 2):
        k2 = k - (a + 2)
        res = b + (k2//2 + 1) * (b - a)
        if k2 % 2 == 0:
            res += 1
else:
    res = k + 1

print(res)

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

if a < b - 2 and k >= a + 1:
    k -= a - 1
    res = a
    res += (k//2) * (b - a) + (k % 2)
else:
    res = k + 1

print(res)

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

if a < b - 2:
    if k > (a + 2):
        k2 = k - (a + 2)
        res = b + (b-a) + (k2//2) * (b - a) -1
        if k2 % 2 == 1:
            res += 1
else:
    res = k + 1

print(res)

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

if a < b - 2 and k >= a + 1:
    k -= a - 1
    res = a
    res += (k//2) * (b - a) + (k % 2)
else:
    res = k + 1

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
abd = sorted([[e[0], e[1], e[0]+e[1]] for e in ab], key=lambda x:x[2], reverse=True)

res = 0
for i in range(n):
    abi = abd.pop(0)
    if i % 2 == 0:
        res += abi[0]
    else:
        res -= abi[1]

print(res)

Fixed submission:
n = int(input())
dd = []
sb = 0
for _ in range(n):
    a, b = map(int, input().split())
    dd.append(a+b)
    sb -= b

abd = sorted(dd, reverse=True)

res = 0
for i in range(n):
    d = abd.pop(0)
    if i % 2 == 0:
        res += d

print(res+sb)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ab = sorted([list(map(int, input().split())) for _ in range(n)])

res = 0
for i in range(n):
    a = max(ab, key=lambda x:x[0])
    b = max(ab, key=lambda x:x[1])
    if max(a) > max(b):
        ind = ab.index(a)
    else:
        ind = ab.index(b)
    abi = ab.pop(ind)
    if i % 2 == 0:
        res += abi[0]
    else:
        res -= abi[1]

print(res)

Fixed submission:
n = int(input())
dd = []
sb = 0
for _ in range(n):
    a, b = map(int, input().split())
    dd.append(a+b)
    sb -= b

abd = sorted(dd, reverse=True)

res = 0
for i in range(n):
    d = abd.pop(0)
    if i % 2 == 0:
        res += d

print(res+sb)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = {}
for i in range(n):
    x = int(input())
    if x in h.keys():
        h[x] += 1
    else:
        h[x] = 1

res = max(h.keys()) - min(h.keys())
ih = sorted(h.keys())

for i in range(len(h)):
    hi = ih[i]
    cnum = h[hi]
    ip = i+1
    if cnum >= k:
        d = 0
        res = 0
        break
    else:
        d = max(h.keys()) - min(h.keys())
    while cnum < k and ip < len(h):
        hi2 = ih[ip]
        cnum += h[hi]
        ip += 1
        if cnum >= k:
            d = abs(hi - hi2)
    res = min(res, d)

print(res)

Fixed submission:
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]
h.sort()
res = [h[i+k-1]-h[i] for i in range(n-k+1) ]
print(min(res))
Buggy python submission (verdict: Runtime Error):
import numpy as np
import math

s = input()
dg = len(s)

count = 0

if dg < 5:
    for i in range(1,int(s)):
        if set(list(str(i))) == {'7','5','3'}:
            count += 1

    print(count)
else:
    import ipdb; ipdb.set_trace()
    base = (math.factorial(dg-1))/(math.factorial(dg-4)*math.factorial(3)) * (3**(dg-4))
    for i in range(10**dg, int(s)+1):
        if set(list(str(i))) == {'7','5','3'}:
            count += 1
    print(count + base)

Fixed submission:
s = input()
n = int(s)
dg = len(s)

all_list = []

for i in '753':
    for j in '753':
        for k in '753':
            all_list.append(''.join([i,j,k]))

for i in range(4,dg+1):
    add_list = []
    for c in '753':
        add_list += [''.join(c+e) for e in all_list]
    all_list += add_list

all_list = set(all_list)
res = sum([True for _ in all_list if set(list(_))=={'7','5','3'} and int(_) <= n])
print(res)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if (a*b)%2 == 0:
    print('No')
else:
    print('Yes')

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

if (a*b)%2 == 0:
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if (a*b)%2 ==0:
    print('No')
else:
    print('Yes')

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

if (a*b)%2 == 0:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
s_list = list(map(int, list(S)))

for k in range(len(S)):
    if s_list[k] != 1:
        flag = True
        break

if flag:
    print(s_list[1])
else:
    print(1)
    

Fixed submission:
S = input()
K = int(input())
s_list = list(map(int, list(S)))

flag = False
for k in range( min(len(S), K) ):
    if s_list[k] != 1:
        flag = True
        break

if flag:
    print(s_list[k])
else:
    print(1)

Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
s_list = list(map(int, list(S)))

for k in range(len(S)):
    if s_list[k] != 1:
        flag = True
        break

if flag:
    print(s_list[k])
else:
    print(1)
    

Fixed submission:
S = input()
K = int(input())
s_list = list(map(int, list(S)))

flag = False
for k in range( min(len(S), K) ):
    if s_list[k] != 1:
        flag = True
        break

if flag:
    print(s_list[k])
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

# 最小公倍数を求める関数
def lcm(a,b):
    return int((a*b)/gcd(a,b))

n = int(input())
a = list(map(int, input().split()))


m = lcm(a[0],a[1])
for i in range(1,len(a)):
    m = lcm(m,a[i])

res = int(sum([(m-1) % e for e in a]))
print(res)

Fixed submission:
n = int(input())
res = sum(list(map(int, input().split()))) - n
print(res)

Buggy python submission (verdict: Runtime Error):
from math import gcd

# 最小公倍数を求める関数
def lcm(a,b):
    return int((a*b)/gcd(a,b))

n = int(input())
a = list(map(int, input().split()))


m = lcm(a[0],a[1])
for i in range(1,len(a)):
    m = lcm(m,a[i])

res = int(sum([(m-1) % e for e in a]))
print(res)

Fixed submission:
n = int(input())
res = sum(list(map(int, input().split()))) - n
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
# 最大公約数を求める関数
def gcd(a,b):
    rem = a % b
    while rem != 0:
        a = b
        b = rem
        rem = a % b
    return b

# 最小公倍数を求める関数
def lcm(a,b):
    return (a*b)/gcd(a,b)

n = int(input())
a = list(map(int, input().split()))


m = lcm(a[0],a[1])
for i in range(1,len(a)):
    m = lcm(m,a[i])

res = int(sum([(m-1) % e for e in a]))
print(res)

Fixed submission:
n = int(input())
res = sum(list(map(int, input().split()))) - n
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
x = list(map(int, input().split()))

for i in range(n):
    x2 = x.copy()
    x2.pop(i)
    print(int(np.median(x2)))

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

if n == 2:
    print(x[1])
    print(x[0])
else:
    y = sorted(x)
    m1 = y[int(n/2)-1]
    m2 = y[int(n/2)]
    if m1 == m2:
        for _ in range(n):
            print(m1)
    else:
        for i in range(n):
            if x[i] <= m1:
                print(m2)
            elif x[i] >= m2:
                print(m1)
Buggy python submission (verdict: Runtime Error):
iter_list = list(range(a,a+k+1)) + list(range(b-k, b+1))
cand = sorted(list(set(iter_list)))
for i in cand:
    if a <= i and i <= b:
        print(i)

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

res = set()

for i in range(a, a+k):
    if i <= b:
        res.add(i)

for i in range(b-k+1, b+1):
    if a <= i:
        res.add(i)

# print(res)

for i in sorted(list(res)):
    print(i)

Buggy python submission (verdict: Runtime Error):
for i in range(a,b+1):
    if i <= (a+k) or i >= (b-k):
        print(i)

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

res = set()

for i in range(a, a+k):
    if i <= b:
        res.add(i)

for i in range(b-k+1, b+1):
    if a <= i:
        res.add(i)

# print(res)

for i in sorted(list(res)):
    print(i)
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
ds = [abs(e - max(a)) for e in a if e-max(a) != 0]

if ds:
    base = min(ds) - 1
    rem = max(ds) - base
    if rem == 1:
        print(base + 1)
    elif rem % 2 == 0:
        res = base + (rem - 2) // 2 + 3
    elif rem % 2 != 0:
        res = base + (rem - 1) // 2 + 1
else:
    res = 0

print(res)

Fixed submission:
a = list(map(int, input().split()))
ds = [abs(e - max(a)) for e in a if e-max(a) != 0]

if len(ds) == 1:
    if ds[0] % 2 == 0:
        res = ds[0] // 2
    else:
        res = (ds[0]-1) // 2 + 2
elif len(ds) > 1:
    base = min(ds) - 1
    rem = max(ds) - base
    if rem == 1:
        res = base + 1
    elif rem % 2 == 0:
        res = base + (rem - 2) // 2 + 3
    elif rem % 2 != 0:
        res = base + (rem - 1) // 2 + 1
else:
    res = 0

print(res)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a*b % 2 = 0:
  print("Even")
else:
  print("Odd")
    
 

Fixed submission:
a, b = map(int, input().split())
if a*b % 2 == 0:
    print('Even')
else:
    print('Odd')

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a*b % 2 = 0:
    print("Even")
else:
    print("Odd")
    
 

Fixed submission:
a, b = map(int, input().split())
if a*b % 2 == 0:
    print('Even')
else:
    print('Odd')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))

# c(i)をiのaにおける個数とする
res = 0

for i in set(a):
    # aにおけるiの個数
    ci = a.count(i)
    # c(i) > iの時は c(i) = i になるまで取り除くしかない
    if ci > i:
        res += ci - i
    # c(i) < iの時は，ci個取り除く
    elif ci < i:
        res += ci

print(res)

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

res = 0

num = [0]*(N)
cnt = [0]*(N)

for i in range(N):
    if A[i] > N:
        res += 1
    else:
        cnt[A[i]-1] += 1

for i in range(N):
    if cnt[i] < i+1:
        res += cnt[i]
    else:
        res += cnt[i] - (i+1)

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = sorted(list(map(int, input().split())))

# c(i)をiのaにおける個数とする
res = 0

for i in set(a):
    # aにおけるiの個数
    ci = a.count(i)
    # c(i) > iの時は c(i) = i になるまで取り除くしかない
    if ci > i:
        res += ci - i
    # c(i) < iの時は，ci個取り除く
    elif ci < i:
        res += ci

print(res)




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

res = 0

num = [0]*(N)
cnt = [0]*(N)

for i in range(N):
    if A[i] > N:
        res += 1
    else:
        cnt[A[i]-1] += 1

for i in range(N):
    if cnt[i] < i+1:
        res += cnt[i]
    else:
        res += cnt[i] - (i+1)

print(res)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split())
print(max(a) - min(a))

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
print(max(a) - min(a))
Buggy python submission (verdict: Time Limit Exceeded):
# cook your dish here
h,w,m=map(int,input().split())
a=[0 for i in range(h+1)]
b=[0 for i in range(w+1)]

v={}
for i in range(m):
    x,y=map(int,input().split())
    # v.append([x,y])
    v[(x,y)]=1
    a[x]+=1
    b[y]+=1
    

maxx=max(a)
aa=[]
for i in range(1,len(a)):
    if a[i]==maxx:
        aa.append(i)

maxy=max(b)
bb=[]
for i in range(1,len(b)):
    if b[i]==maxy:
        bb.append(i)

ans=0
for i in range(len(aa)):
    for j in range(len(bb)):
        if (aa[i],bb[j]) in v:
            ans=max(ans,a[aa[i]]+b[bb[j]]-1)
            
        else:
            ans=max(ans,a[aa[i]]+b[bb[j]])
            
print(ans)

Fixed submission:
# cook your dish here
h,w,m=map(int,input().split())
a=[0 for i in range(h+1)]
b=[0 for i in range(w+1)]

v={}
for i in range(m):
    x,y=map(int,input().split())
    # v.append([x,y])
    v[(x,y)]=1
    a[x]+=1
    b[y]+=1
    

maxx=max(a)
aa=[]
for i in range(1,len(a)):
    if a[i]==maxx:
        aa.append(i)

maxy=max(b)
bb=[]
for i in range(1,len(b)):
    if b[i]==maxy:
        bb.append(i)

ans=0
flag=0
for i in range(len(aa)):
    for j in range(len(bb)):
        if (aa[i],bb[j]) in v:
            ans=max(ans,a[aa[i]]+b[bb[j]]-1)
            
        else:
            ans=max(ans,a[aa[i]]+b[bb[j]])
            flag=1
            break
        
    if flag==1:
        break
            
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# cook your dish here
h,w,m=map(int,input().split())
a=[0 for i in range(h+1)]
b=[0 for i in range(w+1)]

v=[]
for i in range(m):
    x,y=map(int,input().split())
    v.append([x,y])
    a[x]+=1
    b[y]+=1
    

maxx=max(a)
aa=[]
for i in range(1,len(a)):
    if a[i]==maxx:
        aa.append(i)

maxy=max(b)
bb=[]
for i in range(1,len(b)):
    if b[i]==maxy:
        bb.append(i)

ans=0
for i in range(len(aa)):
    for j in range(len(bb)):
        if [aa[i],bb[j]] in v:
            ans=max(ans,a[aa[i]]+b[bb[j]]-1)
            
        else:
            ans=max(ans,a[aa[i]]+b[bb[j]])
            
print(ans)

Fixed submission:
# cook your dish here
h,w,m=map(int,input().split())
a=[0 for i in range(h+1)]
b=[0 for i in range(w+1)]

v={}
for i in range(m):
    x,y=map(int,input().split())
    # v.append([x,y])
    v[(x,y)]=1
    a[x]+=1
    b[y]+=1
    

maxx=max(a)
aa=[]
for i in range(1,len(a)):
    if a[i]==maxx:
        aa.append(i)

maxy=max(b)
bb=[]
for i in range(1,len(b)):
    if b[i]==maxy:
        bb.append(i)

ans=0
flag=0
for i in range(len(aa)):
    for j in range(len(bb)):
        if (aa[i],bb[j]) in v:
            ans=max(ans,a[aa[i]]+b[bb[j]]-1)
            
        else:
            ans=max(ans,a[aa[i]]+b[bb[j]])
            flag=1
            break
        
    if flag==1:
        break
            
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    k = int(input())
    ans = 0

    if k % 2 == 0 or k % 5 == 0:
        print(-1)
    else:
        a = 7
        while 1:
            if a % k == 0:
                print(len(str(a)))
                break
            else:
                a = a * 10 + 7

if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    k = int(input())
    ans = 1

    if k % 2 == 0 or k % 5 == 0:
        print(-1)
    else:
        a = 7
        while 1:
            if a % k == 0:
                print(ans)
                break
            else:
                a = (a % k) * 10 + 7
                ans += 1
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    x, n = map(int, input().split())
    p = list(map(int, input().split()))
    absol = 1000

    for i in range(1, 101):
        if i not in p:
            if abs(i - x) < absol:
                absol = abs(i - x)
                ans = i
    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    x, n = map(int, input().split())
    p = list(map(int, input().split()))

    if x not in p:
        print(x)
    else:
        off = 1
        for i in range(200):
            k = x - off
            if k not in p and -99 < k <= 200:
                print(k)
                break
            k = x + off
            if k not in p and -99 < k <= 200:
                print(k)
                break
            off += 1

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for i in range(1, n+1):
    print(a.count(i))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n

for i in a:
    ans[i-1] += 1
for i in ans:
    print(i)