Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

D = 10**9+7
N = int(input())
A = list(map(int, input().split()))
M = N%2>0
b = 1
if M:
    if A.count(0) != 1 : b = 0
    for i in range(2, N, 2):
        if A.count(i) != 2 : b = 0
else:
    for i in range(1, N, 2):
        if A.count(i) != 2 : b = 0


print((2**(N//2))%D if b else 0)

Fixed submission:
#! /usr/bin/env python3

D = 10**9+7
N = int(input())
A = list(map(int, input().split()))
M = N%2>0
b = 1
C = [0] * (N//2+1)
if M:
    for i in A:
        if i%2 < 1:
            C[i//2] += 1 
    b = (N//2) == sum(1 for x in C[1:] if x == 2) and C[0] == 1
    
else:
    for i in A:
        if i%2 > 0:
            C[i//2] += 1 
    b = (N//2) == sum(1 for x in C if x == 2)

print((2**(N//2))%D if b else 0)
Buggy python submission (verdict: Runtime Error):
S = input()
for i in ['eraser', 'erase', 'dreamer', 'dream']:
    S=S.replace(i, 'R')
print(['NO', 'YES'][len(s) == 1 and 'R' in s])

Fixed submission:
S = input()
for i in ['eraser', 'erase', 'dreamer', 'dream']:
    S=S.replace(i, 'R')
s = set(S)
print(['NO', 'YES'][len(s) == 1 and 'R' in s])
Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

N, x = map(int, input().split())
C = list(map(int, input().split()))
cnt = 0
for i in range(N-1):
    while C[i]+C[i+1] > x:
        cnt += 1
        C[i+1] -= 1
print(cnt)

Fixed submission:
#! /usr/bin/env python3

N, x = map(int, input().split())
C = list(map(int, input().split()))
cnt = 0
for i in range(N-1):
    if C[i]+C[i+1] > x:
        a = C[i]+C[i+1] - x
        cnt += a
        C[i] = min(C[i+1]-a, 0)
        C[i+1] = max(C[i+1]-a, 0)
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

n, k = map(int, input().split())
M = [[(7*i+j-7)%11 for j in range(1, 7+1)] for i in range(1, n+1)]
cnt = 0
f = lambda i, j : sum(M[i+y][j+x] for y in range(3) for x in range(3)) % 11 == k
h = [0] * 11
for i in range(min(n-2, 11)):
    for j in range(7-2):
        if f(i, j) :
            h[i] += 1
cnt = sum(h) * (n // 11)
for i in range(n % 11 - 2):
    cnt += h[i%11]
print(cnt)

Fixed submission:
#! /usr/bin/env python3

n, k = map(int, input().split())
M = [[7*i+j-7 for j in range(1, 7+1)] for i in range(1, min(n+1, 14))]
cnt = 0
f = lambda i, j : sum(M[i+y][j+x] for y in range(3) for x in range(3)) % 11 == k
h = [0] * 11
for i in range(min(max(0, n-2), 11)):
    for j in range(7-2):
        if f(i, j) :
            h[i] += 1
cnt = sum(h) * ((n-2) // 11)
for i in range((n-2) % 11):
    cnt += h[i]
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

n, k = map(int, input().split())
M = [[(7*i+j-7)%11 for j in range(1, 7+1)] for i in range(1, n+1)]
cnt = 0
f = lambda i, j : sum(M[i+y][j+x] for y in range(3) for x in range(3)) % 11 == k
h = [0] * 11
for i in range(min(n-2, 11)):
    for j in range(7-2):
        if f(i, j) :
            h[i] += 1
for i in range(n-2):
    cnt += h[i%11]
print(cnt)

Fixed submission:
#! /usr/bin/env python3

n, k = map(int, input().split())
M = [[7*i+j-7 for j in range(1, 7+1)] for i in range(1, min(n+1, 14))]
cnt = 0
f = lambda i, j : sum(M[i+y][j+x] for y in range(3) for x in range(3)) % 11 == k
h = [0] * 11
for i in range(min(max(0, n-2), 11)):
    for j in range(7-2):
        if f(i, j) :
            h[i] += 1
cnt = sum(h) * ((n-2) // 11)
for i in range((n-2) % 11):
    cnt += h[i]
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

n, k = map(int, input().split())
M = [[7*i+j-7 for j in range(1, 7+1)] for i in range(1, n+1)]
cnt = 0
f = lambda i, j : sum(M[i+y][j+x] for y in range(3) for x in range(3)) % 11 == k
for i in range(n-2):
    for j in range(7-2):
        if f(i, j) :
            cnt += 1
print(cnt)

Fixed submission:
#! /usr/bin/env python3

n, k = map(int, input().split())
M = [[7*i+j-7 for j in range(1, 7+1)] for i in range(1, min(n+1, 14))]
cnt = 0
f = lambda i, j : sum(M[i+y][j+x] for y in range(3) for x in range(3)) % 11 == k
h = [0] * 11
for i in range(min(max(0, n-2), 11)):
    for j in range(7-2):
        if f(i, j) :
            h[i] += 1
cnt = sum(h) * ((n-2) // 11)
for i in range((n-2) % 11):
    cnt += h[i]
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

def f(c, bw):
    r = ""
    b = 1
    if bw[0] != c:
        for i in bw:
            if b and i != c:
                r += c
            else:
                b = 0
                r += i
        return 1, r
    elif bw[-1] != c:
        for i in bw[::-1]:
            if b and i != c:
                r += c
            else:
                b = 0
                r += i
        return 1, r
    return 0, bw
    

bw = input()
cnt = 0
c = ('B', 'W')
while ('B' in bw) and ('W' in bw):
    a = c[cnt%2]
    b, bw = f(a, bw)
    cnt += b
print(cnt)

Fixed submission:
#! /usr/bin/env python3

bw = input()
cnt = 0
t = bw[0]
for i in bw[1:]:
    if i != t:
        cnt += 1
        t = i
print(cnt)
Buggy python submission (verdict: Runtime Error):
#! /usr/bin/env python3

def main():
    d = 10 ** 9 + 7
    ans = 1
    N = int(input())
    T = list(map(int, input().split()))
    A = list(map(int, input().split()))
    L = len(T)
    ST = [T[0]] + [0] * (L-2) + [T[-1] if T[-1] != T[-2] else 0]
    SA = [A[0] if A[0] != A[1] else 0] + [0] * (L-2) + [A[-1]]
    for i in range(0, L-1):
        if T[i] == T[i-1] and A[i] == A[i+1]:
            ans = (ans * min(T[i], A[i])) % d
        else:
            if T[i] != T[i-1] : ST[i] = T[i]
            if A[i] != A[i+1] : SA[i] = A[i]
    mt = ma = 0
    for i in range(L):
        ma = max(ma, SA[i])
        mt = max(mt, ST[L-i-1])
        if ST[i] and SA[i] and ST[i] != SA[i]:
            ans = 0
        if (ST[i] and ST[i] < ma) or (SA[-i-1] and SA[-i-1] < mt):
            ans = 0
    print(ans)
    
if __name__ == '__main__':
    main()

Fixed submission:
c = 0
f = 0
for i in input():
    if i == 'C' : c = 1
    if c and i == 'F':
        f = 1
        break
print( 'Yes' if c + f > 1 else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

def f(a, b, c, d):
    n = 1
    while a > c * n or b > d * n : n += 1
    return c * n, d * n
    
def main():
    a, b = 0, 0
    for i in range(int(input())):
        c, d = map(int, input().split())
        a, b = f(a, b, c, d)
    print(a+b)

if __name__ == '__main__':
    main()

Fixed submission:
#! /usr/bin/env python3

def f(a, b, c, d):
    n = max(1,a//c, b//d)
    while a > c * n or b > d * n : n += 1
    return c * n, d * n
    
def main():
    a, b = 0, 0
    for i in range(int(input())):
        c, d = map(int, input().split())
        a, b = f(a, b, c, d)
    print(a+b)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
while 1:
    i = s.find('ST')
    if i > -1:
        cnt = 0
        for j in range(min(i, len(s)-2-i)):
            if s[i-j-1] == 'S' and s[i+j+2] == 'T':
                cnt += 1
            else:
                break
        s = s[:i-cnt] + s[i+cnt+2:]
    else:
        break
print(len(s))

Fixed submission:
s = input()
cnt = 0
while cnt < 100000:
    n = len(s)
    s = ''.join(s.split('ST'))
    if len(s) != n:
        cnt += (len(s) - n) // 2
    else:
        break
    i = s.find('ST')
    
    stlen = 0
    if i > 0:
        for j in range(min(i, len(s)-2-i)):
            if s[i-j-1] == 'S' and s[i+j+2] == 'T':
                stlen += 1
            else:
                break
        s = s[:i-stlen] + s[i+stlen+2:]
        cnt += 1 + stlen
print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
cnt = 0
while cnt < 100000:
    n = len(s)
    s = ''.join(s.split('ST'))
    if len(s) != n:
        cnt += (len(s) - n) // 2
    else:
        break
print(len(s))

Fixed submission:
s = input()
cnt = 0
while cnt < 100000:
    n = len(s)
    s = ''.join(s.split('ST'))
    if len(s) != n:
        cnt += (len(s) - n) // 2
    else:
        break
    i = s.find('ST')
    
    stlen = 0
    if i > 0:
        for j in range(min(i, len(s)-2-i)):
            if s[i-j-1] == 'S' and s[i+j+2] == 'T':
                stlen += 1
            else:
                break
        s = s[:i-stlen] + s[i+stlen+2:]
        cnt += 1 + stlen
print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = input()
    for i in range(10**10000):
        sp = s.split('ST', 1)
        if len(sp) > 1:
            s = sp[0] + sp[1]
        else:
            break
    print(len(s))

if __name__ == '__main__':
    main()

Fixed submission:
s = input()
cnt = 0
while cnt < 100000:
    n = len(s)
    s = ''.join(s.split('ST'))
    if len(s) != n:
        cnt += (len(s) - n) // 2
    else:
        break
    i = s.find('ST')
    
    stlen = 0
    if i > 0:
        for j in range(min(i, len(s)-2-i)):
            if s[i-j-1] == 'S' and s[i+j+2] == 'T':
                stlen += 1
            else:
                break
        s = s[:i-stlen] + s[i+stlen+2:]
        cnt += 1 + stlen
print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
for i in range(10**10000):
    sp = s.split('ST', 1)
    if len(sp) > 1:
        s = sp[0] + sp[1]
    else:
        break
print(len(s))

Fixed submission:
s = input()
cnt = 0
while cnt < 100000:
    n = len(s)
    s = ''.join(s.split('ST'))
    if len(s) != n:
        cnt += (len(s) - n) // 2
    else:
        break
    i = s.find('ST')
    
    stlen = 0
    if i > 0:
        for j in range(min(i, len(s)-2-i)):
            if s[i-j-1] == 'S' and s[i+j+2] == 'T':
                stlen += 1
            else:
                break
        s = s[:i-stlen] + s[i+stlen+2:]
        cnt += 1 + stlen
print(len(s))
Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

def main():
    N, L = map(int, input().split())
    A = list(map(int, input().split()))
    a, b = 1, N-1
    l = []
    la = N
    for i in range(N-1):
        if A[i] + A[i+1] >= L:
            la = i
            break
    if la == N:
        print('Impossible')
        return
    while len(A) > 2:
        if a-1 != la:
            l += [a]
            a += 1
            A = A[1:]
        else:
            l += [b]
            b -= 1
            A = A[:-1]
    print('Possible')
    l+=[la+1]
    for i in l : print(i)
if __name__ == '__main__':
    main()

Fixed submission:
#! /usr/bin/env python3

def main():
    N, L = map(int, input().split())
    A = list(map(int, input().split()))
    la = N
    for i in range(N-1):
        if A[i] + A[i+1] >= L:
            la = i
            break
    if la == N:
        print('Impossible')
        return
    print('Possible')
    for i in range(la) : print(i+1)
    for i in range(N-la-2) : print(N-i-1)
    print(la+1)
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
print('YNEOS'[input()%18!=17::2])

Fixed submission:
L = list(map(int, input().split()))
print("YES" if 5 in L and 7 in L and sum(L) == 17 else "NO")
Buggy python submission (verdict: Runtime Error):
#! /usr/bin/env python3

N, X = map(int, input().split())
if X*2 == N:
    print(X*3)
else:
    print(X*3*((N-X)//X + (1 if (N-X)%X>0 else 0)))

Fixed submission:
#! /usr/bin/env python3

N = int(input())
L = list(sorted(map(int, input().split())))
ans = 0
for i in range(N):
    ans += min(L[i*2], L[i*2+1])
print(ans)
Buggy python submission (verdict: Runtime Error):
n,x,t=map(int,input().split())
y=ceil(n/x)
print(y*t)


Fixed submission:
from math import ceil
n,x,t=map(int,input().split())
y=ceil(n/x)
print(y*t)
Buggy python submission (verdict: Runtime Error):
if(sum([int(i) for i in input()]) % 9 == 0):
  print("Yes")
else:
  print("No"

Fixed submission:
if(sum([int(i) for i in input()]) % 9 == 0):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a_L = list(map(int,input().split()))


ans = 0
for i in range(0,len(a_L)-1):
    if a_L[i] > a_L[i+1]:
        ans += abs(a_L[i+1] - a_L[i])
        a_L[i+1] = a_L[i]

if a_L[-1] > a_L[-2]:
    ans += abs(a_L[-1]-a_L[-2])
print(ans)

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


if len(a_L) == 1:
    print(0)
    exit()

ans = 0
for i in range(0,len(a_L)-1):
    if a_L[i] > a_L[i+1]:
        ans += abs(a_L[i+1] - a_L[i])
        a_L[i+1] = a_L[i]


if a_L[-2] > a_L[-1]:
    ans += abs(a_L[-1]-a_L[-2])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
ans = 0
dic = {}
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            tmp = [a,b,c]
            tmp = list(sorted(tmp))
            moji = list(map(str,tmp))
            moji = " ".join(moji)
            try:
                dic[moji]
                ans += dic[moji]
            except:
                num = gcd(tmp[0],tmp[1],tmp[2])
                ans += num
                dic[moji] = num

print(ans)

Fixed submission:
k = int(input())
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
ans = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans += gcd(a,b,c)
print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
    n, a, b = map(int, input().split())
    value_max = 2 * (10 ** 5)
    com = [0 for _ in range(value_max + 1)]
    com[1] = n
    mod = 10 ** 9 + 7
    mod_inverse = [pow(i, mod - 2, mod) for i in range(1, value_max + 1)]
    ans = pow(2, n, mod)
 
    # KeyInsight:
    # 全体 - 条件を満たす場合
    # modの世界では割り算の代わりに逆元を使う
    # See:
    # https://www.youtube.com/watch?v=lzAMKPMLdtU&feature=youtu.be
    for i in range(2, min(n, value_max) + 1):
        if (n - i + 1) == 0:
            break
 
        com[i] = com[i - 1] * (n - i + 1)
        com[i] *= mod_inverse[i - 1]
        com[i] %= mod
 
    diff = (com[a] + com[b] + 1) % mod
    print((ans - diff) % mod)
 main()

Fixed submission:
n, a, b = map(int, input().split())
value_max = 2 * (10 ** 5)
com = [0 for _ in range(value_max + 1)]
com[1] = n
mod = 10 ** 9 + 7
mod_inverse = [pow(i, mod - 2, mod) for i in range(1, value_max + 1)]
ans = pow(2, n, mod)

for i in range(2, min(n, value_max) + 1):
    if (n - i + 1) == 0:
        break

    com[i] = com[i - 1] * (n - i + 1)
    com[i] *= mod_inverse[i - 1]
    com[i] %= mod

diff = (com[a] + com[b] + 1) % mod
print((ans - diff) % mod)

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

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

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

sum = pow(2,n,1000000007) -1

a = min(a, n-a)
b = min(b, n-b)
ans = sum - cmb(n,a)-cmb(n,b)

print(ans)

Fixed submission:
n, a, b = map(int, input().split())
value_max = 2 * (10 ** 5)
com = [0 for _ in range(value_max + 1)]
com[1] = n
mod = 10 ** 9 + 7
mod_inverse = [pow(i, mod - 2, mod) for i in range(1, value_max + 1)]
ans = pow(2, n, mod)

for i in range(2, min(n, value_max) + 1):
    if (n - i + 1) == 0:
        break

    com[i] = com[i - 1] * (n - i + 1)
    com[i] *= mod_inverse[i - 1]
    com[i] %= mod

diff = (com[a] + com[b] + 1) % mod
print((ans - diff) % mod)
Buggy python submission (verdict: Time Limit Exceeded):
#n = int(input())
n,k = map(int,input().split())
p_L = list(map(int,input().split()))

mydata = []

kazu = list(range(1,1001))
for i in p_L:

    kitai = sum(kazu[0:i])/i
    mydata.append(kitai)



res = [0] * (n+1)

res[0] = mydata[0]
for i in range(len(mydata)-1):
    res[i+1] = res[i] + mydata[i+1]

# print(mydata)
# print(res)
# print("----")
ans = 0
for i in range(n-k+1):
    ans = max(ans,sum(mydata[i:i+k]))
    #print(mydata[i:i+k])
print(ans)

Fixed submission:
#n = int(input())
n,k = map(int,input().split())
p_L = list(map(int,input().split()))

mydata = []

kazu = list(range(1,1001))
for i in p_L:

    kitai = sum(kazu[0:i])/i
    mydata.append(kitai)

res = [0] * (n+1)

res[0] = mydata[0]
for i in range(len(mydata)-1):
    res[i+1] = res[i] + mydata[i+1]

# print(mydata)
# print(res)
# print("----")
ans = 0
for i in range(n):
    tmp = res[i] - res[i-k]
    ans = max(ans,tmp)
    #print(mydata[i:i+k])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#n = int(input())
n,k = map(int,input().split())
p_L = list(map(int,input().split()))

mydata = []

for i in p_L:
    kitai = sum(list(range(1,i+1)))/i
    mydata.append(kitai)

res = [0] * (n+1)

res[0] = mydata[0]
for i in range(len(mydata)-1):
    res[i+1] = res[i] + mydata[i+1]

# print(mydata)
# print(res)
# print("----")
ans = 0
for i in range(n-k+1):
    ans = max(ans,sum(mydata[i:i+k]))
    #print(mydata[i:i+k])
print(ans)

Fixed submission:
#n = int(input())
n,k = map(int,input().split())
p_L = list(map(int,input().split()))

mydata = []

kazu = list(range(1,1001))
for i in p_L:

    kitai = sum(kazu[0:i])/i
    mydata.append(kitai)

res = [0] * (n+1)

res[0] = mydata[0]
for i in range(len(mydata)-1):
    res[i+1] = res[i] + mydata[i+1]

# print(mydata)
# print(res)
# print("----")
ans = 0
for i in range(n):
    tmp = res[i] - res[i-k]
    ans = max(ans,tmp)
    #print(mydata[i:i+k])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
H = list(input().split())
 
if K >= N:
    print(0)
elif N > K:
    if K == 0:
        print(sum(int(i) for i in H))
    else:
      	# ここを追加
        for i in range(K):
            H.remove(max(H))
        print(sum(int(i) for i in H))

Fixed submission:
n,k = map(int,input().split())
h_L = list(map(int,input().split()))
h_L.sort(reverse=True)
if k ==0:
    print(sum(h_L))
else:
    print(sum(h_L[k:]))

Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
H = list(input().split())
 
if K >= N:
    print(0)
elif N > K:
    if K == 0:
        print(sum(int(i) for i in H))
    else:
      	# ここを追加
      	for i in range(k):
        	H.remove(max(H))
        print(sum(int(i) for i in H))

Fixed submission:
n,k = map(int,input().split())
h_L = list(map(int,input().split()))
h_L.sort(reverse=True)
if k ==0:
    print(sum(h_L))
else:
    print(sum(h_L[k:]))
Buggy python submission (verdict: Runtime Error):
s,t = map(str,input());print(t+s)

Fixed submission:
s,t = map(str,input().split());print(t+s)
Buggy python submission (verdict: Runtime Error):
s = list(input())
ans = 0
n = len(s)
for i in range(len(s)):
  if s[i] != s[n-i]:
    ans += 1
print(ans)

Fixed submission:
s = list(input())
ans = 0
n = len(s)-1
for i in range(len(s)):
  if s[i] != s[n-i]:
    ans += 1
print(int(ans/2))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(200000)

x = int(input())
p_L = [i for i in range(100,106)]

max_count = x/100 + 1

def dfs(ans,next,counter):
    global p_L
    global x
    global max_count

    ans += p_L[next]    
    if ans > x:
        return
    if max_count < counter:
        return
    elif ans == x:
        print(1)
        exit()
    
    counter += 1
    for val in range(0,6):
        dfs(ans,val,counter)

counter = 0
for i in range(0,6):
    dfs(0,i,counter)
print(0)

Fixed submission:
x = int(input())

product = list(range(100,105+1))

dp = [0] * 10**6

dp[0] = 1
for i in product:
    dp[i] = 1

for i in range(0,10**5+1):
    for j in product:
        if dp[i] == 1:
            dp[i+j] = 1

print(dp[x])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(200000)

x = int(input())
p_L = [i for i in range(100,106)]


def dfs(ans,next):
    global p_L
    global x
    global stop_memo


    ans += p_L[next]    
    if ans > x:
        return
    elif ans == x:
        print(1)
        exit()
    
    for val in range(0,6):
        dfs(ans,val)


for i in range(0,6):
    dfs(0,i)
print(0)

Fixed submission:
x = int(input())

product = list(range(100,105+1))

dp = [0] * 10**6

dp[0] = 1
for i in product:
    dp[i] = 1

for i in range(0,10**5+1):
    for j in product:
        if dp[i] == 1:
            dp[i+j] = 1

print(dp[x])

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

x = int(input())
max_c = int(x/100)

p_L = [i for i in range(100,106)]
a = list(itertools.combinations_with_replacement(p_L, max_c))

for val in a:
    if sum(val) == x:
        print(1)
        exit()
print(0)


Fixed submission:
x = int(input())

product = list(range(100,105+1))

dp = [0] * 10**6

dp[0] = 1
for i in product:
    dp[i] = 1

for i in range(0,10**5+1):
    for j in product:
        if dp[i] == 1:
            dp[i+j] = 1

print(dp[x])
Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
ans_L = []
d_L = []

tmp = n
for val in range(1,int(n/2)+1):
    if n % val ==0:
        x = val
        y = int(n/val)
        tmp = min(tmp,int(x+y-2))
print(tmp)

Fixed submission:
import math


n = int(input())
ans_L = []
d = []
for val in range(int(math.sqrt(n)+1),0,-1):
    if n % val ==0:
        x = val
        y = int(n/val)
        #st = str(x) + "*" +str(y)
        #d.append(st) 
        #ans_L.append(int(x+y-2))
        print(int(x+y-2))
        exit()
#print(d)
#print(ans_L)
#print(min(ans_L))

Buggy python submission (verdict: Time Limit Exceeded):
#n,k = map(int,input().split())
#a_L = list(map(int,input().split()))

n = int(input())
ans_L = []
for val in range(1,int(n/2+1)):
    if n % val ==0:
        x = val
        y = n/val
        ans_L.append(int(x+y-2))

#print(ans_L)
print(min(ans_L))

Fixed submission:
import math


n = int(input())
ans_L = []
d = []
for val in range(int(math.sqrt(n)+1),0,-1):
    if n % val ==0:
        x = val
        y = int(n/val)
        #st = str(x) + "*" +str(y)
        #d.append(st) 
        #ans_L.append(int(x+y-2))
        print(int(x+y-2))
        exit()
#print(d)
#print(ans_L)
#print(min(ans_L))

Buggy python submission (verdict: Time Limit Exceeded):
#n,k = map(int,input().split())
#a_L = list(map(int,input().split()))

n = int(input())
ans_L = []
for val in range(1,n+1):
    if n % val ==0:
        x = val
        y = n/val
        ans_L.append(int(x+y-2))

#print(ans_L)
print(min(ans_L))

Fixed submission:
import math


n = int(input())
ans_L = []
d = []
for val in range(int(math.sqrt(n)+1),0,-1):
    if n % val ==0:
        x = val
        y = int(n/val)
        #st = str(x) + "*" +str(y)
        #d.append(st) 
        #ans_L.append(int(x+y-2))
        print(int(x+y-2))
        exit()
#print(d)
#print(ans_L)
#print(min(ans_L))