Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
H, N= map(int,input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
ma = max(A)
dp = [float("inf")] * (H + ma)
dp[0] = 0
for i in range(N):
    a = A[i]
    b = B[i]
    for j in range(1, H + ma):
        dp[j] = min(dp[j - a] + b, dp[j])
print(min(dp[H:]))


Fixed submission:
H, N= map(int,input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
ma = max(A)
dp = [float("inf")] * (H + ma)
dp[0] = 0
for i in range(N):
    a = A[i]
    b = B[i]
    for j in range(1, H + ma):
        dp[j] = min(dp[j - a] + b, dp[j])
print(min(dp[H:]))

Buggy python submission (verdict: Time Limit Exceeded):
H, N= map(int,input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())

def chmin(a, b):
    if a > b:
        return b
    else:
        return a

ma = max(A)
dp = [float("inf")] * (H + ma)
dp[0] = 0
for i in range(N):
    a = A[i]
    b = B[i]
    for j in range(1, H + ma):
        dp[j] = min(dp[j - a] + b, dp[j])
print(min(dp[H:]))


Fixed submission:
H, N= map(int,input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
ma = max(A)
dp = [float("inf")] * (H + ma)
dp[0] = 0
for i in range(N):
    a = A[i]
    b = B[i]
    for j in range(1, H + ma):
        dp[j] = min(dp[j - a] + b, dp[j])
print(min(dp[H:]))

Buggy python submission (verdict: Time Limit Exceeded):
H, N= map(int,input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
ma = max(A)
dp = [0] * (H + ma)
dp[0] = 0
for i in range(N):
    a = A[i]
    b = B[i]
    for j in range(1, H + ma):
        if dp[j] == 0:
            dp[j] = dp[j - a] + b
        else:
            dp[j] = min(dp[j - a] + b, dp[j])
print(min(dp[H:]))


Fixed submission:
H, N= map(int,input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
ma = max(A)
dp = [float("inf")] * (H + ma)
dp[0] = 0
for i in range(N):
    a = A[i]
    b = B[i]
    for j in range(1, H + ma):
        dp[j] = min(dp[j - a] + b, dp[j])
print(min(dp[H:]))
Buggy python submission (verdict: Time Limit Exceeded):
N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
ans = [0]*(N-K+1)
score = 1
for i in range(K):
    score *= A[i]
for i in range(K, N):
    ans[i - K] = score
    score //= A[i - K]
    score *= A[i]
ans[-1] = score
print("\n".join(["Yes" if ans[i] > ans[i-1] else "No" for i in range(1,len(ans))]))

Fixed submission:
N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
ans = ["Yes" if A[i] > A[i - K] else "No" for i in range(K,N)]
print("\n".join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
N = int(input())
A = [int(i) for i in input().split()]
s = reduce(lambda x,y: x*y, A)
if s > 10**18:
    print(-1)
else:
    print(s)

Fixed submission:
from functools import reduce
N = int(input())
A = [int(i) for i in input().split()]
A.sort(reverse=True)
if A[-1] == 0:
    print(0)
else:
    s = 1
    for a in A:
        s *= a
        if s == 0:
            print(0)
            break
        if s > 10**18:
            print(-1)
            break
    else:
        print(s)
Buggy python submission (verdict: Runtime Error):
K = int(input())
S = input()
if len(S) <= K:
    print(S)
else:
    print(S[:K]+"...")7
nikoandsolstice

Fixed submission:
K = int(input())
S = input()
if len(S) <= K:
    print(S)
else:
    print(S[:K]+"...")
Buggy python submission (verdict: Runtime Error):
S = int(input())
if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")

Fixed submission:
S = input()
if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
c = [0,0,0]
for h in range(len(a)):
    n = a[h]
    a[h] = c.count(n)
    c[c.index(n)] += 1
# print(a)
# print(c)
c = 1
for n in a:
    c *= n%1000000007
print(c%1000000007)

Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
c = [0,0,0]
pos = True
for h in range(len(a)):
    try:
        n = a[h]
        a[h] = c.count(n)
        c[c.index(n)] += 1
    except:
        pos = False
        break
# print(a)
# print(c)
if pos:
    c = 1
    for n in a:
        c *= n%1000000007
    print(c%1000000007)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
length = [int(i) for i in input().split()]
pos = []

for a in range(len(length)+1):
    x = sum(length[:a])
    y = sum(length[a:])
    pos.append(max(x,y) - min(x,y))
    # print("pos " + str(a)+":",sum(length[:a]), sum(length[a:]))
# print(pos)

print(min(pos))

Fixed submission:
N = int(input())
length = [int(i) for i in input().split()]
pos = []
s1 = sum(length)
s2 = 0

for a in range(len(length)):
    pos.append(max(s1,s2) - min(s1,s2))
    s1 -= length[a]
    s2 += length[a]
    # print("pos " + str(a)+":",sum(length[:a]), sum(length[a:]))
# print(pos)

print(min(pos))
Buggy python submission (verdict: Runtime Error):
price = list(map(int, input().rstrip().split()))
print(min(price[0]*price[1], price[2])

Fixed submission:
price = list(map(int, input().rstrip().split()))
print(min(price[0]*price[1], price[2]))
Buggy python submission (verdict: Runtime Error):
n = list(map(int, input().rstrip().split(" ")))
ans = 0
coor = []
for a in n[0]:
  coor.append(list(map(int, input().rstrip().split(" "))))
  
def dis(a,b):
  ans = 0
  for i in range(a):
    ans += (a[i] - b[i])**2
  return ans**0.5
  
for a in range(len(coor)):
  for b in range(0,a):
    if coor[a]!=coor[b]:
      if dis(coor[a], coor[b]).is_integer():
        ans += 1
print(ans)

Fixed submission:
n = list(map(int, input().rstrip().split(" ")))
ans = 0
coor = []
for a in range(n[0]):
  coor.append(list(map(int, input().rstrip().split(" "))))
  
def dis(a,b):
  ans = 0
  for i in range(len(a)):
    ans += (a[i] - b[i])**2
  return ans**0.5
  
for a in range(len(coor)):
  for b in range(0,a):
    if coor[a]!=coor[b]:
      if dis(coor[a], coor[b]).is_integer():
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
n = 0
i = 0
while i < len(S):
    # print(S)
    if len(set(S[i:i+2])) == 2:
        S = S[:i]+S[i+2:]
        n += 2
        if i != 0:
            i -= 1
    else:
        i += 1
print(n)

Fixed submission:
S = input()
n = 0
i = 0
while i < len(S):
    # print(S)
    if len(set(S[i:i+2])) == 2:
        S = S[:i]+S[i+2:]
        n += 2
        if i != 0:
            i -= 1
    else:
        i += 1
print(n)
Buggy python submission (verdict: Time Limit Exceeded):
N,W = [int(i) for i in input().split()]
wv = [[int(i) for i in input().split()] for j in range(N)]
dp = [[0]*(W+1) for i in range(N+1)]
for i in range(1, N+1):
    for j in range(1, W+1):
        if 0 <= j-wv[i-1][0]:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-wv[i-1][0]] + wv[i-1][1])
        else:
            dp[i][j] = dp[i-1][j]
print(dp[-1][-1])

Fixed submission:
N,W = [int(i) for i in input().split()]
wv = [[int(i) for i in input().split()] for j in range(N)]
dp = [[0]*(W+1) for i in range(N+1)]
for i in range(1, N+1):
    for j in range(1, W+1):
        if 0 <= j-wv[i-1][0]:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-wv[i-1][0]] + wv[i-1][1])
        else:
            dp[i][j] = dp[i-1][j]
print(dp[-1][-1])
Buggy python submission (verdict: Time Limit Exceeded):
K, S = [int(i) for i in input().split()]
pos = []
for a in range(K+1):
    for b in range(K+1):
        c = S - a - b
        if 0 <= c <= K:
            pos.append([a,b,c])
# for a in pos:
#     print(a)
print(len(pos))

Fixed submission:
K, S = [int(i) for i in input().split()]
t = 0
for a in range(K+1):
    for b in range(a, K+1):
        c = S - a - b
        if 0 <= c <= K and c >= a and c >= b:
            if a == b == c:
                t += 1
            elif a == b or b == c:
                t += 3
            else:
                t += 6
print(t)
Buggy python submission (verdict: Runtime Error):
S = list(input())
t = 0
for n in range(2**(len(S) - 1)):
    f = S[0]
    b = bin(n)[2:]
    b = "0"*(len(S) - len(b) - 1) + b
    for a in range(len(b)):
        if b[a] == "1":
            f += "+"
        f += S[a+1]
    t += eval(f)
print(t)

Fixed submission:
S = list(input())
if len(S) != 1:
    t = 0
    for n in range(2**(len(S) - 1)):
        f = S[0]
        b = bin(n)[2:]
        b = "0"*(len(S) - len(b) - 1) + b
        for a in range(len(b)):
            if b[a] == "1":
                f += "+"
            f += S[a+1]
        t += eval(f)
    print(t)
else:
    print(S[0])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
cnt = 0
for a in range(1,N):
  for b in range(1,N):
    #print(a,b,N-a*b)
    if a*b <= N-1: 
      cnt += 1
    else:
      break
      
print(cnt)

Fixed submission:
N = int(input())
cnt = 0
for a in range(1,N):
  b = (N-1) // a
  cnt += b
      
print(cnt)
Buggy python submission (verdict: Runtime Error):
def multmod(a,b,m):
  ans = 0
  a = a % m
  
  while b:
    if (b & 1): # odd
      ans = (ans + a) % m
    
    a = (2 * a) % m
    b >>= 1 # b = b / 2
    
  return ans

n = int(input())
S = [int(a) for a in input().split()]
divisor = 10**9 + 7
tot = 0
a,b = 0,0
arr_sum = sum(S) #% divisor
arr_ssq = arr_sum*arr_sum % divisor
isq_sum = 0
for i in range(n):
  isq_sum += S[i]*S[i] #% divisor
  
#isq_sum = isq_sum % divisor
tot = (arr_ssq - isq_sum)//2 % divisor

print(tot)

Fixed submission:
D,T,S = [int(n) for n in input().split()]

if D/S <= T:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Fixed submission:
N = int(input())
S = list(map(int,input().split()))
t = 10**18
ans = 1

if 0 in S:
  print(0)
  exit(0)
  
for n in S:
  ans *= n
  if ans > t:
    print(-1)
    exit(0)
  
print(ans)
Buggy python submission (verdict: Runtime Error):
H = int(input())

import math as m
remain = H % 2
H -= remain
n = round(m.log2(H)+0.5)
ans = (2**n) - 1

print(ans)



Fixed submission:
H = int(input())

if H == 1:
  print(1)
  exit(0)

import math as m
n = m.floor(m.log2(H))+1
ans = (2**n) - 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
child = [i for i in range(N)]
child_last = []
t = 0
while True:
  #print(child)
  if t % 2 == 0:
    if child_last == child:
      break
    else:
      child_last = child.copy()
  
  for i in range(N):
    if S[child[i]] == "R":
      child[i] += 1
    else:
      child[i] -= 1
      
  t += 1
  
ans = [0 for _ in range(N)]
for i in range(N):
  ans[child[i]] += 1
  
print(*ans,sep=" ")

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

curr = ["R","L"]
idx = 0
cnt = 0
E = []
for i, ch in enumerate(S):
  if ch != curr[idx]:
    E.append((idx,cnt))
    cnt = 1
    idx = 1 - idx
  else:
    cnt += 1
    
E.append((idx,cnt))
#print(E)

ans = []
for i in range(0,len(E),2):
  Rcnt = E[i][1]
  Lcnt = E[i+1][1]
  Rfill = Lfill = (Rcnt + Lcnt)//2
 
  if (Rcnt + Lcnt) % 2 == 1:
    if Rcnt % 2 == 1:
      Rfill += 1
    else:
      Lfill += 1
  
  for i in range(Rcnt - 1):
    ans.append(0)
  
  ans.append(Rfill)
  ans.append(Lfill)
  
  for i in range(Lcnt - 1):
    ans.append(0)

  
print(*ans,sep=" ")
Buggy python submission (verdict: Runtime Error):
N = int(input())
d = []
visited = [False for _ in range(N+1)]
for _ in range(N):
  d.append(int(input())-1)
  
def dfs(i,cnt):
  if i == 1:
    return cnt
  elif cnt >= N:
    return -1
  elif visited[i]:
    return -1
  else:
    visited[i] = True
    return dfs(d[i],cnt+1)
  
print(dfs(0,0))

Fixed submission:
N = int(input())
d = []
visited = [False for _ in range(N+1)]
for _ in range(N):
  d.append(int(input())-1)

i = 0
cnt = 0
while True:
  if i == 1:
    break
  elif cnt >= N:
    cnt = -1
    break
  elif visited[i]:
    cnt = -1
    break
  else:
    visited[i] = True
    cnt += 1
    i = d[i]
  
print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())
d = []
visited = [False for _ in range(N+1)]
for _ in range(N):
  d.append(int(input())-1)
  
def dfs(i,cnt):
  if i == 1:
    return cnt
  elif visited[i]:
    return -1
  else:
    visited[i] = True
    return dfs(d[i],cnt+1)
  
print(dfs(0,0))

Fixed submission:
N = int(input())
d = []
visited = [False for _ in range(N+1)]
for _ in range(N):
  d.append(int(input())-1)

i = 0
cnt = 0
while True:
  if i == 1:
    break
  elif cnt >= N:
    cnt = -1
    break
  elif visited[i]:
    cnt = -1
    break
  else:
    visited[i] = True
    cnt += 1
    i = d[i]
  
print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())
d = []
visited = [False for _ in range(N)]
for _ in range(N):
  d.append(int(input())-1)
  
def dfs(i,cnt):
  if i == 1:
    return cnt
  elif visited[i]:
    return -1
  else:
    visited[i] = True
    return dfs(d[i],cnt+1)

def main():
  
  return dfs(0,0)
  
print(main())

Fixed submission:
N = int(input())
d = []
visited = [False for _ in range(N+1)]
for _ in range(N):
  d.append(int(input())-1)

i = 0
cnt = 0
while True:
  if i == 1:
    break
  elif cnt >= N:
    cnt = -1
    break
  elif visited[i]:
    cnt = -1
    break
  else:
    visited[i] = True
    cnt += 1
    i = d[i]
  
print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())
d = []
visited = [False for _ in range(N)]
for _ in range(N):
  d.append(int(input())-1)
  
def dfs(i,cnt):
  if visited[i]:
    return -1
  elif i == 1:
    return cnt
  else:
    visited[i] = True
    return dfs(d[i],cnt+1)

def main():
  if d[1] == 1:
    return -1
  
  return dfs(0,0)
  
print(main())

Fixed submission:
N = int(input())
d = []
visited = [False for _ in range(N+1)]
for _ in range(N):
  d.append(int(input())-1)

i = 0
cnt = 0
while True:
  if i == 1:
    break
  elif cnt >= N:
    cnt = -1
    break
  elif visited[i]:
    cnt = -1
    break
  else:
    visited[i] = True
    cnt += 1
    i = d[i]
  
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = [int(a) for a in input().split()]

cnt = 0
for x in range(0,K+1):
  if x > S:
    continue
  for y in range(0,K+1):
    if x+y > S:
      continue
    for z in range(0,K+1):
      check = x+y+z
      if check == S:
        cnt += 1
      elif check > S:
        continue
        
print(cnt)

Fixed submission:
K, S = [int(a) for a in input().split()]

cnt = 0
for x in range(0,K+1):
  if x > S:
    continue
  for y in range(0,K+1):
    if x+y > S:
      continue
    elif x+y+K < S:
      continue
    else:
      cnt +=1
        
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(map(int,input().split()))

d = [[False]*N for _ in range(N)]
cnt = 0
for i in range(N):
  j = S[i] - 1
  d[i][j] = True
  if d[j][i]:
    cnt += 1
  
print(cnt)
         
        

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

d = {}
cnt = 0
for i in range(N):
  j = S[i] - 1
  d[i] = j
  if j in d:
    if d[j] == i: 
      cnt += 1
  
print(cnt)
Buggy python submission (verdict: Runtime Error):
S = input()

F = []
for ch in S:
  if ch == "B":
    F.pop()
  else:
    F.append(ch)
    
print("".join(F))

Fixed submission:
S = input()

F = []
for ch in S:
  if ch == "B": 
    if len(F) > 0:
      F.pop()
  else:
    F.append(ch)
    
print("".join(F))
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
cnt=0
for i in range(n):
  if s[i]=='W':
    cnt+=1
ans=0
for i in range(n):
  if s[i]=='W':
    cnt--
  else:
    ans+=cnt
print(ans)
 
  

Fixed submission:
s=input()
n=len(s)
cnt=0
for i in range(n):
  if s[i]=='W':
    cnt+=1
ans=0
for i in range(n):
  if s[i]=='W':
    cnt-=1
  else:
    ans+=cnt
print(ans)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int,input().split())

s = ''

while N>len(s):
    s += 'b' * A
    s += 'r' * B

print(s[:N].count('b'))

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

a = N // (A+B)
b = N % (A+B)

ans = a * A + min(b,A)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [p for p in map(int,input().split())]

ans = 0

for p,j in zip(P,range(len(P))):
    if len(P[:j]) == 0:
        ans += 1
    elif (min(P[:j]) >= p):
        ans += 1

print(ans)

Fixed submission:
N = int(input())
P = [p for p in map(int,input().split())]

ans = 0
min_p = P[0]

for p in P:
    if min_p >= p:
        min_p = p
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = map(int , input().split())
a = []
from collections import defaultdict as dd
dc = dd(lambda : 0)
for i in range(k):
  d = int(input())
  a = list(map(int , input().split()))
  for i in a:
    dc[i] += 1
cnt = 0
for i in range(1 , n + 1):
  if d[i] == 0:
    cnt += 1
print(cnt)
         

Fixed submission:
n,k = map(int , input().split())
a = []
from collections import defaultdict as dd
dc = dd(lambda : 0)
for i in range(k):
  d = int(input())
  a = list(map(int , input().split()))
  for i in a:
    dc[i] += 1
cnt = 0
for i in range(1 , n + 1):
  if dc[i] == 0:
    cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|  
#  code

def main():
    n , m = map(int , input().split())
    print(1 , n)
    k = 2
    diff = 1
    p = set(list(range(1 , n + 1)))
    p.remove(1)
    p.remove(n)
    m -= 1
    while m > 0:
        if k in p and diff + k + 1 in p:
            print(k , diff + k + 1)
            p.remove(k)
            p.remove(diff + k + 1)
            diff += 1
            m -= 1
        k += 1
    return

if __name__ == "__main__":
    main()

Fixed submission:
#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|  
#  code

def main():
    n , m = map(int , input().split())
    if n % 2 == 0:
        n -= 1
    k = (n + 1) // 2
    j = 1

    while j < k and m > 0:
        print(j , k)
        j += 1
        k -= 1
        m -= 1

    j = (n + 1) // 2 + 1
    k = n

    while j < k and m > 0:
        if k <= n:
            print(j , k)
            m -= 1
        j += 1
        k -= 1
    
    return

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
z=int(input())
i=1
re=0
f=3
b=1
while z>i:
  b=1
  while True:
    x=i*b
    if z>x:
      re+=1
    else:
      break
    b+=1
  i+=1
print(re)

Fixed submission:
z=int(input())
i=1
re=0
b=1
d=1
while z>i:
  b=1
  while True:
    x=i*(i+b)
    if z>x:
      re+=2
    else:
      break
    b+=1
  i+=1
while True:
  if d*d<z:
    d+=1
    re+=1
  else:
    break
print(re)
Buggy python submission (verdict: Runtime Error):
K=int(input())
i=1
if K%2==0 or K%5==0:
  print(-1)
elif K%7==0:
  L=9*K/7
  b=10
  while True:
    b=a%L
    if b==1:
      print(i)
      break
    b=b*10
    i+=1
else:
  L=9*K
  b=10
  while True:
    b=b%L
    if b==1:
      print(i)
      break
    b=b*10
    i+=1
    

Fixed submission:
K=int(input())
i=1
if K%2==0 or K%5==0:
  print(-1)
elif K%7==0:
  L=9*K/7
  b=10
  while True:
    b=b%L
    if b==1:
      print(i)
      break
    b=b*10
    i+=1
else:
  L=9*K
  b=10
  while True:
    b=b%L
    if b==1:
      print(i)
      break
    b=b*10
    i+=1

Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
a=0
b=0
i=0
if K%2==0:
  print(-1)
else:
  while True:
    a=10**i
    b=b+7*a
    i+=1
    if b%K==0:
      print(i)
      break

Fixed submission:
K=int(input())
i=1
if K%2==0 or K%5==0:
  print(-1)
elif K%7==0:
  L=9*K/7
  b=10
  while True:
    b=b%L
    if b==1:
      print(i)
      break
    b=b*10
    i+=1
else:
  L=9*K
  b=10
  while True:
    b=b%L
    if b==1:
      print(i)
      break
    b=b*10
    i+=1

Buggy python submission (verdict: Runtime Error):
b=0
i=0
if K%2==0:
  print(-1)
else:
  while True:
    a=10**i
    b=b+7*a
    i+=1
    if b%K==0:
      print(i)
      break

Fixed submission:
K=int(input())
i=1
if K%2==0 or K%5==0:
  print(-1)
elif K%7==0:
  L=9*K/7
  b=10
  while True:
    b=b%L
    if b==1:
      print(i)
      break
    b=b*10
    i+=1
else:
  L=9*K
  b=10
  while True:
    b=b%L
    if b==1:
      print(i)
      break
    b=b*10
    i+=1
Buggy python submission (verdict: Runtime Error):
n=int(input())

a = 0
for i in range(n):
    li = input().split()
        a+=1
    elif(a<3):
        a=0
    else:
        print("Yes")
        exit()
if(a>2):
    print("Yes")
    exit()

print("No")

Fixed submission:
n=int(input())

a = 0
for i in range(n):
    li = input().split()
    if(li[0]==li[1]):
        a+=1
    elif(a<3):
        a=0
    else:
        print("Yes")
        exit()
if(a>2):
    print("Yes")
    exit()

print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
for i in range(1,n+1):    
    c = a.index(i)
    c += 1
    print(c,end=' ')

Fixed submission:
a = int(input())
if a%2==0:
    print("0.5")
else:
    b = a+1
    b = b/2
    print(b/a)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list()
for i in range(n+1):
    if i==0:
        continue
    else:
        c = a.index(i)
        c = c+1
        b.append(c)
for j in b:       
    print(j,end=' ')

Fixed submission:
a = int(input())
if a%2==0:
    print("0.5")
else:
    b = a+1
    b = b/2
    print(b/a)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list()
for i in range(n+1):
    if i==0:
        continue
    else:
        c = a.index(i)
        c = c+1
        b.append(c)
for j in b:       
    print(j,end=' ') 

Fixed submission:
a = int(input())
if a%2==0:
    print("0.5")
else:
    b = a+1
    b = b/2
    print(b/a)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list()
for i in range(n+1):
    if i==0:
        continue
    else:
        c = a.index(i)
        c = c+1
        b.append(c)
for j in b:       
    print(j,end=' ') 

Fixed submission:
a = int(input())
if a%2==0:
    print("0.5")
else:
    b = a+1
    b = b/2
    print(b/a)
Buggy python submission (verdict: Runtime Error):
n,k = int(imput().split()) 
a = list(map(int,imput().split()))
b = 0
for c in a:
    if c>=k:
        b = b+1
print(b)


Fixed submission:
n,k = input().split() 
k = int(k)
a = list(map(int,input().split()))
b = 0
for c in a:
    if c>=k:
        b = b+1
print(b)
Buggy python submission (verdict: Runtime Error):
n = input()
if '7' in n : print('Yes')
else : print('No')127


Fixed submission:
n = input()
if '7' in n : print('Yes')
else : print('No')
Buggy python submission (verdict: Runtime Error):
n, d = map(int, input().split())
x = [list(map(int,input().split())) for i in range(n)]

ans = 0
for i,j in x:
    if (i**2)+(j**2)) <= d**2:
        ans += 1

print(ans)

Fixed submission:
import math

n, d = map(int, input().split())
x = [list(map(int,input().split())) for i in range(n)]

ans = 0
for i,j in x:
    if math.sqrt((i*i)+(j*j)) <= d:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split()))
H = sorted(h)[::-1]
ans = 0
if k >= len(h):
    print(0)
else:
    for i in H[k:]:
        ans += i
    print(ans)

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

Fixed submission:
s, t = input().split()
print(t,s,sep='')

Buggy python submission (verdict: Runtime Error):
s, t = map(input().split())
print(s, t,sep='')

Fixed submission:
s, t = input().split()
print(t,s,sep='')
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print("bust" a + b + c >= 22 else "win")

Fixed submission:
a, b, c = map(int, input().split())
print("bust" if a + b + c >= 22 else "win")