Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
cost, money, enogh = map(int, input().split())

times = money // cost
if(times > enough):
    print(enough)
else:
    print(times)


Fixed submission:
cost, money, enough = map(int, input().split())

times = money // cost
if(times > enough):
    print(enough)
else:
    print(times)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()

idx = 0
pick = 0
while(("0" in S) and ("1" in S)):
#    print("S = " + S)
    if(S[idx] != S[idx + 1]):
#        print("idx = {} : S[:idx] = {}, S[idx + 2:] = {}, new str = {} ".format(idx, S[:idx], S[idx + 2:], S[:idx] + S[idx + 2:]))
        S = S[:idx] + S[idx + 2:]
        pick = pick + 2
    else:
        idx = idx + 1

    if(idx > len(S) - 2):
        idx = 0

print(pick)


Fixed submission:
S = input()

cnt0 = 0
cnt1 = 0
for i in range(len(S)):
    if("0" == S[i]):
        cnt0 = cnt0 + 1
    else:
        cnt1 = cnt1 + 1

print(2 * min(cnt0, cnt1))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

ans = 1
for k in range(1, M + 1):
    if(0 == M % k):
        if((M // k) < k):
            break
        if((M // k) > N - 1):
            ans = max(ans, k)
#            print("k = {}, M/k = {}, ans = {}".format(k, M//k, ans))
#        else:
#            print("k = {}, M/k = {}, ans = {}, skip".format(k, M//k, ans))
        k_ = M // k
        if((M // k_) > N - 1):
            ans = max(ans, k_)
#            print("k = {}, M/k = {}, ans = {}".format(k_, M//k_, ans))
#        else:
#            print("k = {}, M/k = {}, ans = {}, skip".format(k_, M//k_, ans))
    else:
#        print("k = {}, M % k = {}, skip".format(k, M % k))
        continue

print(str(ans))


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

ans = 1
k = 1
while(k * k <= M):
    if(0 == M % k):
        if(M >= N * k):
            ans = max(ans, k)
        k_ = M // k
        if(M >= N * k_):
            ans = max(ans, k_)
    k += 1

print(str(ans))
Buggy python submission (verdict: Runtime Error):
import math
[N, X] = list(map(int, input().split()))
print(int(3*(N-math.gcd(N,X))))


Fixed submission:
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)

[N, X] = list(map(int, input().split()))
print(int(3*(N-gcd(N,X))))
Buggy python submission (verdict: Runtime Error):
x = int(input())

print(n+1//2)

Fixed submission:
x = int(input())

print((x+1)//2)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if (a == 1 and b == 2) or (a == 2 and b == 1) :
  print(3)
elif (a == 2 and b == 3) or (a == 3 or b == 2) :
  print(1)
else:
  pritn(2)

Fixed submission:
a = int(input())
b = int(input())

if (a == 1 and b == 2) or (a == 2 and b == 1) :
  print(3)
elif (a == 2 and b == 3) or (a == 3 and b == 2) :
  print(1)
elif (a == 1 and b == 3) or (a == 3 and b == 1) :
  print(2)
Buggy python submission (verdict: Runtime Error):
r = input()

print(3*r**2)

Fixed submission:
r = int(input())

print(3*r**2)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

if a <= 8 ans b <= 8:
  print('Yay!')
else:
  print(':(')


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

if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
  print('Possible')
else:
  pritn('Impossible')

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

if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
  print('Possible')
else:
  print('Impossible')
Buggy python submission (verdict: Runtime Error):
x,a,b = map(int,input().split())

if b < a:
  print('delicious')
elif b <= x:
  pritn('safe')
elif b > x:
  print('dangerous')

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

if a>=b:
  print('delicious')
elif b - a < x + 1:
  print('safe')
else:
  print('dangerous')
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

print(a+b if a+b < 10 else error)

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

print(a+b if a+b < 10 else 'error')
Buggy python submission (verdict: Runtime Error):
a,b,h = map(int,input().split())

print(((a+b)*h)//2)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())

print(((a+b)*h)//2)

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

print((a+b)*h//2)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())

print(((a+b)*h)//2)

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

print((a+b)*h//2)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())

print(((a+b)*h)//2)
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))

a,sort()
print('YES' if a[0] == 5 and a[1] == 5 and a[2] == 7 else 'NO')


Fixed submission:
a = list(map(int,input().split()))
 
a.sort()
print('YES' if a[0] == 5 and a[1] == 5 and a[2] == 7 else 'NO')
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = [1]*(n+1)
b = [0]*(n+1)
for i in range(m):
  x,y = map(int,input().split())
  u = x
  while a[u]==0:
    u = b[u]
  v = y
  while a[v]==0:
    v = b[v]
  if u!=v:
    b[v] = u
    a[u] += a[v]
    a[v] = 0
print(max(a))

Fixed submission:
n,m = map(int,input().split())
a = [1]*(n+1)
b = [0]*(n+1)
for i in range(m):
  x,y = map(int,input().split())
  u = x
  while a[u]==0:
    u = b[u]
  v = y
  while a[v]==0:
    v = b[v]
  if u!=v:
    b[v] = u
    b[y] = u
    b[x] = u
    a[u] += a[v]
    a[v] = 0
print(max(a))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
x = 1
for i in range(q):
  a = input().split()
  if a[0] == '1':
    x = -x
  elif (1.5-int(a[1]))*x > 0:
    s = ''.join([a[2],s])
  else:
    s = ''.join([s,a[2]])
if x == -1:
  s = s[::-1]
print(s)

Fixed submission:
s = input()
q = int(input())
x = 1
f, b = '', ''
for i in range(q):
  a = input().split()
  if a[0] == '1':
    x = -x
  elif (1.5-int(a[1]))*x > 0:
    f = a[2] + f
  else:
    b = b + a[2]
s = f + s + b
if x == -1:
  s = s[::-1]
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
x = 1
for i in range(q):
  a = input().split()
  if a[0] == '1':
    x = -x
  elif (1.5-int(a[1]))*x > 0:
    s = ''.join([a[2],s])
  else:
    s = ''.join([s,a[2]])
if x == -1:
  s = s[::-1]
print(s)

Fixed submission:
s = input()
q = int(input())
x = 1
f, b = '', ''
for i in range(q):
  a = input().split()
  if a[0] == '1':
    x = -x
  elif (1.5-int(a[1]))*x > 0:
    f = a[2] + f
  else:
    b = b + a[2]
s = f + s + b
if x == -1:
  s = s[::-1]
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = {}
for i in range(n):
  s = input()
  a[s] = a.get(s,0) + 1
b = sorted([i for i in a.keys() if a[i]==max(a.values())])
[print(i) for i in b]

Fixed submission:
n = int(input())
a = {}
for i in range(n):
  s = input()
  a[s] = a.get(s,0) + 1
max_a = max(a.values())
b = sorted([i for i in a.keys() if a[i]==max_a])
[print(i) for i in b]
Buggy python submission (verdict: Time Limit Exceeded):
n, k  = map(int,input().split())
p = list(map(int,input().split()))
s = 0
for i in range(n-k+1):
  s = max(s,sum(p[i:(k+i)]))
print((s+k)/2)

Fixed submission:
n, k  = map(int,input().split())
p = list(map(int,input().split()))
t = sum(p[0:k])
s = t
for i in range(1,n-k+1):
  t = t - p[i-1] + p[i+k-1]
  s = max(s,t)
print((s+k)/2)
Buggy python submission (verdict: Time Limit Exceeded):
import math
h, n = map(int, input().split())
a, b = [], []
for i in range(n):
  x, y = map(int, input().split())
  a.append(x)
  b.append(y)

c = [min(b)] + [h*max(b)]*(h-1)

for i in range(1,h):
  for j in range(n):
    if a[j] >= i+1:
      c[i] = min(c[i], b[j])
    else:
      c[i] = min(c[i], c[i-a[j]]+b[j])
print(c[h-1])

Fixed submission:
import math
h, n = map(int, input().split())
a, b = [], []
for i in range(n):
  x, y = map(int, input().split())
  a.append(x)
  b.append(y)

c = [min(b)] + [h*max(b)]*(h-1)

for i in range(1,h):
  for j in range(n):
    if a[j] >= i+1:
      c[i] = min(c[i], b[j])
    else:
      c[i] = min(c[i], c[i-a[j]]+b[j])
print(c[h-1])
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split)
if n==m:
  print('Yes')
else:
  print('No')

Fixed submission:
n, m = map(int, input().split())
if n==m:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [int(i) for i in input().split()]

score = 1
for i in range(1,n):
  if min(p[:i]) >= p[i]:
    score += 1
    
print(score)

Fixed submission:
n = int(input())
p = [int(i) for i in input().split()]

score = 1
m = p[0]
for i in range(1,n):
  m = min(m, p[i-1])
  if m >= p[i]:
    score += 1
    
print(score)
Buggy python submission (verdict: Time Limit Exceeded):
n, m, v, p = map(int, input().split())
a = sorted(list(map(int, input().split())))
if p >= v:
  print(sum([1 for b in a if b+m >= a[n-p]]))
else:
  s = p-1
  for i in range(n-p+1):
    if a[i]+m >= a[n-p] and (a[i]+m)*(n-p-i) - sum(a[(i+1):(n-p+1)]) >= (v-p-i)*m:
      s += 1
  print(s)

Fixed submission:
n, m, v, p = map(int, input().split())
a = sorted(list(map(int, input().split())))
if p >= v:
  print(sum([1 for b in a if b+m >= a[n-p]]))
else:
  s = p-1
  t = sum(a[:(n-p+1)])
  for i in range(n-p+1):
    t -= a[i]
    if a[i]+m >= a[n-p] and (a[i]+m)*(n-p-i) - t >= (v-p-i)*m:
      s += 1
  print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

a = {}
ii = [0]*10
jj = [0]*100
for i in range(n-2):
  si = int(s[i])
  if sum(ii) == 10:
    break
  elif ii[si] == 1:
    next
  else:
    ii[si] = 1
  for j in range(i+1,n-1):
    sij = 10*si + int(s[j])
    if sum(jj[10*si:10*(si+1)]) == 10:
      break
    elif jj[sij] == 1:
      next
    else:
      jj[sij] = 1
    for k in range(j+1,n):
      a["".join([s[i],s[j],s[k]])] = 1
print(sum(a.values()))

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

a = 0
ii = [0]*10
for i in range(n-2):
  si = int(s[i])
  if sum(ii) == 10:
    break
  elif ii[si] == 1:
    continue
  else:
    ii[si] = 1
  jj = [0]*10
  for j in range(i+1,n-1):
    sj = int(s[j])
    if sum(jj) == 10:
      break
    elif jj[sj] == 1:
      continue
    else:
      jj[sj] = 1
    kk = [0]*10
    for k in range(j+1,n):
      sk = int(s[k])
      if sum(kk) == 10:
        break
      else:
        kk[sk] = 1
    a += sum(kk)
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

a = {}
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      a["".join([s[i],s[j],s[k]])] = 1

print(sum(a.values()))

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

a = 0
ii = [0]*10
for i in range(n-2):
  si = int(s[i])
  if sum(ii) == 10:
    break
  elif ii[si] == 1:
    continue
  else:
    ii[si] = 1
  jj = [0]*10
  for j in range(i+1,n-1):
    sj = int(s[j])
    if sum(jj) == 10:
      break
    elif jj[sj] == 1:
      continue
    else:
      jj[sj] = 1
    kk = [0]*10
    for k in range(j+1,n):
      sk = int(s[k])
      if sum(kk) == 10:
        break
      else:
        kk[sk] = 1
    a += sum(kk)
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l.sort()
s = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    ab = abs(l[i]-l[j])
    for k in range(j+1,n):
      if l[k] >= l[i] + l[j]:
        break
      if ab < l[k]:
        s += 1
print(s)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
l.sort()
s = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    high = n-1
    low = j+1
    ab = l[i] + l[j]
    if l[j+1] >= ab:
      continue
    while high - low > 1:
      mid = (high+low)//2
      if l[mid] < ab:
        low = mid
      else:
        high = mid
    if l[high] < ab:
      s += high - j
    else:
      s += low - j
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l.sort()
s = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      ab = abs(l[i]-l[j])
      if l[k] >= l[i] + l[j]:
        break
      if ab < l[k]:
        s += 1
print(s)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
l.sort()
s = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    high = n-1
    low = j+1
    ab = l[i] + l[j]
    if l[j+1] >= ab:
      continue
    while high - low > 1:
      mid = (high+low)//2
      if l[mid] < ab:
        low = mid
      else:
        high = mid
    if l[high] < ab:
      s += high - j
    else:
      s += low - j
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
c = min(a,b)
s = [1]
i = 2
while i <= c:
  if a%i==0 and b%i==0:
    a //= i
    b //= i
    if not(i in s):
      s.append(i)
    i = max(s)
    c = min(a,b)
  else:
    i += 1
print(len(s))

Fixed submission:
a, b = map(int, input().split())
c = min(a,b)
s = [1]
i = 2
while i <= c**0.5+1:
  if a%i==0 and b%i==0:
    a //= i
    b //= i
    if not(i in s):
      s.append(i)
  else:
    if a%i==0: a//=i
    if b%i==0: b//=i
    i += 1
  c = min(a,b)
if c!=1 and max(a,b)%c==0 and all([i==1 or c%i>0 for i in s]):
  s.append(c)
print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
c = min(a,b)
s = [1]
i = 2
while i <= c:
  if a%i==0 and b%i==0:
    a //= i
    b //= i
    if not(i in s):
      s.append(i)
    i = 2
    c = min(a,b)
  else:
    i += 1
print(len(s))

Fixed submission:
a, b = map(int, input().split())
c = min(a,b)
s = [1]
i = 2
while i <= c**0.5+1:
  if a%i==0 and b%i==0:
    a //= i
    b //= i
    if not(i in s):
      s.append(i)
  else:
    if a%i==0: a//=i
    if b%i==0: b//=i
    i += 1
  c = min(a,b)
if c!=1 and max(a,b)%c==0 and all([i==1 or c%i>0 for i in s]):
  s.append(c)
print(len(s))
Buggy python submission (verdict: Time Limit Exceeded):
def o():return map(int,input().split())
n,q=o()
a=[[]for i in range(n)]
x=[0]*n
for i in range(n-1):
  u,v=o()
  a[u-1]+=[v-1]
  a[v-1]+=[u-1]
for i in range(q):
  u,v=o()
  x[u-1]+=v
p=[0]
m=[0]
while p:
  r=p.pop()
  m+=[r]
  for i in a[r]:
    if not(i in m):
      p+=[i]
      x[i]+=x[r]
print(*x)

Fixed submission:
def o():return map(int,input().split())
n,q=o()
a=[[]for i in range(n)]
x=[0]*n
for i in range(n-1):
  u,v=o()
  a[u-1]+=[v-1]
  a[v-1]+=[u-1]
for i in range(q):
  u,v=o()
  x[u-1]+=v
p=[[0,0]]
s=0
while p:
  r,s=p.pop()
  for i in a[r]:
    if i!=s:
      p+=[[i,r]]
      x[i]+=x[r]
print(*x)

Buggy python submission (verdict: Runtime Error):
def o():return map(int,input().split())
n,q=o()
a=[[]for i in range(n)]
x=[0]*n
for i in range(n-1):u,v=o()
  a[u-1]+=[v-1]
for i in range(q):u,v=o()
  p=[u-1]
  while p:r=p.pop()
    x[r]+=v
    p+=a[r]
print(*x)

Fixed submission:
def o():return map(int,input().split())
n,q=o()
a=[[]for i in range(n)]
x=[0]*n
for i in range(n-1):
  u,v=o()
  a[u-1]+=[v-1]
  a[v-1]+=[u-1]
for i in range(q):
  u,v=o()
  x[u-1]+=v
p=[[0,0]]
s=0
while p:
  r,s=p.pop()
  for i in a[r]:
    if i!=s:
      p+=[[i,r]]
      x[i]+=x[r]
print(*x)
Buggy python submission (verdict: Time Limit Exceeded):
def o():return map(int,input().split())
n,m=o()
c=[[0] for i in range(m)]
for i in range(n):
  a,b=o()
  if a<=m:
    c[m-a]+=[b]
d=[]
for i in range(m):
  c[i].sort()
  d+=[c[i].pop()]
ans=0
for i in range(m-1,-1,-1):
  j=i+d[i:].index(max(d[i:]))
  if d[j]>0:
    ans+=d[j]
    d[j]=c[j].pop()
print(ans)

Fixed submission:
import heapq as hp
def o():return map(int,input().split())
n,m=o()
c=[[0] for i in range(m)]
for i in range(n):
  a,b=o()
  if a<=m:
    c[m-a]+=[-b]
d=[]
ans=0
for i in range(m-1,-1,-1):
  for j in c[i]:
    hp.heappush(d,j)
  ans-=hp.heappop(d)
print(ans)
Buggy python submission (verdict: Runtime Error):
import copy
n,m=map(int,input().split())
a=[[0 for _ in range(m+2)] for _ in range(n+2)]
a[0][0]=1
a[1][2]=1
for i in range(1,n):
  b=copy.deepcopy(a)
  for j in range(0,i+2):
    for k in range(0,m+1):
      if k>=2*j:
        a[j][k]=(2*j+1)*b[j][k-2*j]+(j+1)**2*b[j+1][k-2*j]
        if j>0:
          a[j][k]+=b[j-1][k-2*j]
      else:
        a[j][k]=0
print(a[0][m]%(10**9+7))

Fixed submission:
import copy
n,m=map(int,input().split())
a=[[0 for _ in range(m+3)] for _ in range(n+2)]
a[0][0]=1
a[1][2]=1
for i in range(1,n):
  b=copy.deepcopy(a)
  for j in range(0,i+2):
    for k in range(0,m+1):
      if k>=2*j:
        a[j][k]=(2*j+1)*b[j][k-2*j]+(j+1)**2*b[j+1][k-2*j]
        if j>0:
          a[j][k]+=b[j-1][k-2*j]
        a[j][k]%=(10**9+7)
      else:
        a[j][k]=0
print(a[0][m])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
b=[0]*n
for i in range(n//2):
  b[2*i]=s-2*sum([a[(2*i+2*j+1)%n] for j in range(n//2)])
  b[2*i+1]=2*a[2*i]-b[2*i]
b[-1]=2*a[-1]-b[0]
print(*b)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[sum([a[i]*(1-i%2*2) for i in range(n)])]
for i in range(n-1):
  b+=[2*a[i]-b[-1]]
print(*b)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
ab=[[] for i in range(n+1)]
for i in range(n-1):
  a,b=map(int,input().split())
  ab[a]+=[[b,a]]
  ab[b]+=[[a,b]]
x=k
c=[]
c+=ab[1]
d=[0]*(n+1)
d[1]=1
while c:
  y,z=c.pop()
  for i in ab[y]:
    if i[0]!=z:
      c+=[i]
  x=(x*max(0,k-1-sum([d[i[0]] for i in ab[z]])))%(10**9+7)
  d[y]=1
print(x)

Fixed submission:
n,k=map(int,input().split())
ab=[[] for i in range(n+1)]
for i in range(n-1):
  a,b=map(int,input().split())
  ab[a]+=[[b,a]]
  ab[b]+=[[a,b]]
x=k
c=[]+ab[1]
d=[0]*(n+1)
while c:
  y,z=c.pop()
  c+=[i for i in ab[y] if i[0]!=z]
  x=(x*max(0,k-1-d[z]))%(10**9+7)
  d[z]+=1
  d[y]=1
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
l = input()
m = 10**9+7
ans = 0
c = 1
while len(l) > 1:
  ans = (ans+c*pow(3,len(l)-1,m))%m
  j = 1
  while l[j] == '0':
    j += 1
    if j == len(l):
      j -= 1
      break
  l = l[j:]
  c = (2*c)%m
ans = (ans+(2*int(l)+1)*c)%m
print(ans)

Fixed submission:
l = input()
m = 10**9+7
ans = 0
c = 1
while len(l) > 1:
  ans = (ans+c*pow(3,len(l)-1,m))%m
  j = 1
  while l[j] == '0':
    j += 1
    if j == len(l):
      j -= 1
      break
  l = l[j:]
  c = (2*c)%m
ans = (ans+(2*int(l)+1)*c)%m
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
l = input()
m = 10**9+7
ans = 0
k = 0
while len(l) > 1:
  c = 1
  for i in range(len(l)):
    ans = (ans+c*pow(2,i+k,m))%m
    c = c*(len(l)-1-i)//(i+1)
  j = 1
  while l[j] == '0':
    j += 1
    if j == len(l):
      j -= 1
      break
  l = l[j:]
  k += 1
ans = (ans+(2*int(l)+1)*pow(2,k,m))%m
print(ans)

Fixed submission:
l = input()
m = 10**9+7
ans = 0
c = 1
while len(l) > 1:
  ans = (ans+c*pow(3,len(l)-1,m))%m
  j = 1
  while l[j] == '0':
    j += 1
    if j == len(l):
      j -= 1
      break
  l = l[j:]
  c = (2*c)%m
ans = (ans+(2*int(l)+1)*c)%m
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())

print(a*b)

Fixed submission:
a,b=map(int,input().split())
 
print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
s=1
for i in range(n):
  l=a.pop()
  if l == 0:
    s=0
    break
  else:
    s=s*l

if s>10**18:
  print(-1)
else:
  print(s)

Fixed submission:
from collections import deque
n=int(input())
a=deque()
a=list(map(int,input().split()))
s=0
if a.count(0) == 0:
  s=1
  for i in range(n):
    l=a.pop()
    s=s*l      
  
    if len(str(s)) >= 19:
      if s == 10**18 and i==n-1:
        break
      s=-1
      break

    
print(s)
Buggy python submission (verdict: Runtime Error):
import math
from collections import deque
a,b=map(float,input().split())
a=int(a)
A=a
lst=deque()
while a > 0:
    lst.append(a%10)
    a //= 10
lst.reverse()

c=lst.pop()
if len(lst)>=2:
  c+=10*lst.pop()
d=math.floor(c*b)

A-=c
A=int(A/100)
b=int(b*100)
print(A*b+d)

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

print(int(a*b//100))
Buggy python submission (verdict: Runtime Error):
n = int(input())
N = n
ans = 0
d = 0
i = 2
while n>1 and i*i<=N:
  c = 0
  if n % i == 0:
    d == 1
    while n % i == 0:
      n = int(n / i)
      c += 1

    while c>=Y:
      ans=ans+1
      Y=Y+U
      U=U+1

  i += 1
      
    
if n > 1:
  ans = 1
print(ans)

Fixed submission:
N=int(input())
ans=0
p=2
 
while N>1 and p*p<=N:
  if N%p==0:
    c=0
    while N%p==0:
      N=N/p
      c=c+1
    Y=1
    U=2
    while c>=Y:
      ans=ans+1
      Y=Y+U
      U=U+1
  p=p+1
 
if N>1:
  ans=ans+1
 
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque
n,k=map(int,input().split())
l=list(map(int,input().split()))
kiseki=deque()
tori=[-1]*n
#町1からスタート
u=1
kiseki.append(1)
for i in range(len(l)):
  u=l[u-1]
  if kiseki.count(u)==0:
    kiseki.append(u)
  else:
    kiseki.append(u)
    break
kuri=[]
while True:
  if u == kiseki[0]:
    kiseki.pop()
    break
  kuri.append(kiseki.popleft())

if k<=len(kuri):
  print(kuri[k])
else:
  K=k-len(kuri)
  amari=K%len(kiseki)
  print(kiseki[amari])

Fixed submission:
n,k=map(int,input().split())
l=list(map(int,input().split()))
kiseki=[-1]*n
i=0
v=1
while kiseki[v-1]==-1:
  kiseki[v-1]=i
  v=l[v-1]
  i+=1
saisyo=kiseki[v-1]
kuri=i-saisyo

if saisyo>k:
  print(kiseki.index(k)+1)
else:
  amari=(k-saisyo)%kuri
  print(kiseki.index(amari+saisyo)+1)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
l=list(map(int,input().split()))
kiseki=[]
u=1
kiseki.append(1)
for i in l:
  u=l[u-1]
  if kiseki.count(u)==0:
    kiseki.append(u)
  else:
    kiseki.append(u)
    break
kuri=kiseki[kiseki.index(u):len(kiseki)-1]
if k<=len(kiseki)-(len(kuri)+1):
  print(kiseki[k])
else:
  K=k-(len(kiseki)-(len(kuri)+1))
  amari=K%len(kuri)
  print(kuri[amari])

Fixed submission:
n,k=map(int,input().split())
l=list(map(int,input().split()))
kiseki=[-1]*n
i=0
v=1
while kiseki[v-1]==-1:
  kiseki[v-1]=i
  v=l[v-1]
  i+=1
saisyo=kiseki[v-1]
kuri=i-saisyo

if saisyo>k:
  print(kiseki.index(k)+1)
else:
  amari=(k-saisyo)%kuri
  print(kiseki.index(amari+saisyo)+1)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
iran=[]
l=list(map(int,input().split()))
#n,k=6,727202214173249351
#l=[6,5,2,5,3,2]
for i in range(N):
  if l.count(i+1)==0:
    iran.append(i+1)
kiseki=[]
#町1からスタート
u=1
kiseki.append(1)
for i in l:
  u=l[u-1]
  if kiseki.count(u)==0:
    kiseki.append(u)
  else:
    kiseki.append(u)
    break
kuri=kiseki[kiseki.index(u):len(kiseki)-1]
if k<=len(kiseki)-(len(kuri)+1):
  print(kiseki[k])
else:
  K=k-(len(kiseki)-(len(kuri)+1))
  amari=K%len(kuri)
  print(kuri[amari])

Fixed submission:
n,k=map(int,input().split())
l=list(map(int,input().split()))
kiseki=[-1]*n
i=0
v=1
while kiseki[v-1]==-1:
  kiseki[v-1]=i
  v=l[v-1]
  i+=1
saisyo=kiseki[v-1]
kuri=i-saisyo

if saisyo>k:
  print(kiseki.index(k)+1)
else:
  amari=(k-saisyo)%kuri
  print(kiseki.index(amari+saisyo)+1)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
c = deque()
for i in range(n):
  C = input()
  if c.count(C) == 0:
    c.append(C)
print(len(c))

Fixed submission:
n = int(input())
c = []
for i in range(n):
  c.append(input())

print(len(list(set(c))))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = []
for i in range(n):
  C = input()
  if c.count(C) == 0:
    c.append(C)
print(len(c))

Fixed submission:
n = int(input())
c = []
for i in range(n):
  c.append(input())

print(len(list(set(c))))