Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
i = 2
ans = n - 1
while i < n:
  if i * i > n:
    i += 1
    break
  if n % i > 0:
    continue
  j = n // i
  ans = min(ans, i + j - 2)
  i += 1
print(ans)

Fixed submission:
n = int(input())
i = 2
ans = n - 1
while i < n:
  if i * i > n:
    i += 1
    break
  if n % i > 0:
    i += 1
    continue
  j = n // i
  ans = min(ans, i + j - 2)
  i += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
i = 2
ans = n - 1
while i < n:
  if i * i > n:
    break
  if n % i > 0:
    continue
  j = n // i
  ans = min(ans, i + j - 2)
  i += 1
print(ans)

Fixed submission:
n = int(input())
i = 2
ans = n - 1
while i < n:
  if i * i > n:
    i += 1
    break
  if n % i > 0:
    i += 1
    continue
  j = n // i
  ans = min(ans, i + j - 2)
  i += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, x = list(map(float, input().split()))
y = 2 * x / (a * b)
if y > a:
  y = 2 * (a * a * b - x) / (a * a)
  a = math.atan(y / a)
else:
  a = math.atan(b / y)
print(a / math.acos(-1.0) * 180)

Fixed submission:
import math
a, b, x = list(map(float, input().split()))
y = 2 * x / (a * b)
if y > a:
  y = 2 * (a * a * b - x) / (a * a)
  a = math.atan(y / a)
else:
  a = math.atan(b / y)
print(a / math.acos(-1.0) * 180)
Buggy python submission (verdict: Runtime Error):
n = int(input())
b = map(int, input().split())
a = [b[0]]
for i in range(1, n - 1):
  a.append(min(b[i - 1], b[i]))
a.append(b[-1])
print(sum(a))

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
a = [b[0]]
for i in range(1, n - 1):
  a.append(min(b[i - 1], b[i]))
a.append(b[-1])
print(sum(a))
Buggy python submission (verdict: Runtime Error):
n, d = list(map(int, input().split()))
p = []
ans = 0
for i in n:
  p.append(list(map(int, input().split())))
  for j in range(i):
    s = 0
    for k in d:
      s += (p[i][k] - p[j][k]) ** 2
    t = int(s ** 0.5 + 1e-7)
    if t * t == s:
      ans += 1
print(ans)

Fixed submission:
n, d = list(map(int, input().split()))
p = []
ans = 0
for i in range(n):
  p.append(list(map(int, input().split())))
  for j in range(i):
    s = 0
    for k in range(d):
      s += (p[i][k] - p[j][k]) ** 2
    t = int(s ** 0.5 + 1e-7)
    if t * t == s:
      ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n, d = list(map(int, input().split()))
p = []
ans = 0
for i in n:
  p.append(list(map(int, input().split())))
  for j in range(i):
    s = 0
    for k in d:
      s += (p[i] - p[j]) ** 2
    t = int(s ** 0.5 + 1e-7)
    if t * t == s:
      ans += 1
print(ans)

Fixed submission:
n, d = list(map(int, input().split()))
p = []
ans = 0
for i in range(n):
  p.append(list(map(int, input().split())))
  for j in range(i):
    s = 0
    for k in range(d):
      s += (p[i][k] - p[j][k]) ** 2
    t = int(s ** 0.5 + 1e-7)
    if t * t == s:
      ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
a = []
for i in range(m):
	a.append(int(input()))
a.sort()
f0 = 1
if a[0] == 1:
	f1 = 0
else:
	f1 = 1
k = 0
for i in range(2, n + 1):
	while k < len(a) and a[k] < i:
		k += 1
	if k == len(a) or a[k] != i:
		f = (f0 + f1) % 1000000007
	else:
		f = 0
	f0 = f1
	f1 = f
	if f0 == f1 == 0:
		break
print(f1)

Fixed submission:
n, m = list(map(int, input().split()))
a = []
for i in range(m):
	a.append(int(input()))
a.sort()
f0 = 1
if len(a) > 0 and a[0] == 1:
	f1 = 0
else:
	f1 = 1
k = 0
for i in range(2, n + 1):
	while k < len(a) and a[k] < i:
		k += 1
	if k == len(a) or a[k] != i:
		f = (f0 + f1) % 1000000007
	else:
		f = 0
	f0 = f1
	f1 = f
	if f0 == f1 == 0:
		break
print(f1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
links = {u: {} for u in range(1, n + 1)}
for i in range(n - 1):
	x, y, z = map(int, input().split())
	links[x][y] = z
	links[y][x] = z
vis = [0] * (n + 1)
col = [0] * (n + 1)

def dfs(u, c):
	vis[u] = 1
	col[u] = c
	for v, l in links[u].items():
		# print("%d, %d" % (v, l))
		if vis[v] == 0:
			if l & 1:
				dfs(v, c ^ 1)
			else:
				dfs(v, c)

dfs(1, 0)

for u in range(1, n + 1):
	print(col[u])

Fixed submission:
n = int(input())
links = {u: {} for u in range(1, n + 1)}
for i in range(n - 1):
	x, y, z = map(int, input().split())
	links[x][y] = z
	links[y][x] = z
vis = [0] * (n + 1)
col = [0] * (n + 1)

now = 0
q = [(1, 0)]
while now < len(q):
	u = q[now][0]
	c = q[now][1]
	now += 1
	vis[u] = 1
	col[u] = c
	for v, l in links[u].items():
		if vis[v] == 0:
			if l & 1:
				q.append((v, c ^ 1))
			else:
				q.append((v, c))

for u in range(1, n + 1):
	print(col[u])
Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0, cnt = 0
for c in s:
  if c in ['A', 'C', 'T', 'G']:
    cnt += 1
    if cnt > ans:
      ans = cnt
  else:
    cnt = 0
print(ans)

Fixed submission:
s = input()
ans = 0
cnt = 0
for c in s:
  if c in ['A', 'C', 'T', 'G']:
    cnt += 1
    if cnt > ans:
      ans = cnt
  else:
    cnt = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
shop = []
for i in range(n):
  shop.append(list(map(int, input().split())))
shop.sort()
bought = 0
cost = 0
for i in range(n):
  bought += min(m, b[i])
  cost += min(m, b[i]) * a[i]
  m -= min(m, b[i])
print(cost)

Fixed submission:
n, m = map(int, input().split())
shop = []
for i in range(n):
  shop.append(list(map(int, input().split())))
shop.sort()
bought = 0
cost = 0
for i in range(n):
  bought += min(m, shop[i][1])
  cost += min(m, shop[i][1]) * shop[i][0]
  m -= min(m, shop[i][1])
print(cost)
Buggy python submission (verdict: Runtime Error):
n = input()
d = set()
pre = ""
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre == "" or pre[-1] == s[0]:
        d.add(s)
        pre = d
    else:
        print "No"
        exit()
print "Yes"

Fixed submission:
n = input()
d = set()
pre = ""
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre == "" or pre[-1] == s[0]:
        d.add(s)
        pre = s
    else:
        print "No"
        exit()
print "Yes"

Buggy python submission (verdict: Runtime Error):
n = input()
d = set()
pre = ""
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre = "" or pre[-1] == s[0]:
        d.add(s)
        pre = d
    else:
        print "No"
        exit()
print "Yes"

Fixed submission:
n = input()
d = set()
pre = ""
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre == "" or pre[-1] == s[0]:
        d.add(s)
        pre = s
    else:
        print "No"
        exit()
print "Yes"

Buggy python submission (verdict: Runtime Error):
n = input()
d = set()
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre = "" or pre[-1] == s[0]:
        continue
    else:
        print "No"
        exit()
print "Yes"

Fixed submission:
n = input()
d = set()
pre = ""
for i in range(n):
    s = raw_input()
    if s in d:
        print "No"
        exit()
    if pre == "" or pre[-1] == s[0]:
        d.add(s)
        pre = s
    else:
        print "No"
        exit()
print "Yes"
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    if b == 0:
        return a
    return(b, a % b)
n, x = map(int, raw_input().split())
d = map(int, raw_input().split())
g = abs(x - d[0])
for z in d:
    g = gcd(g, abs(z - x))
print g

Fixed submission:
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)
n, x = map(int, raw_input().split())
d = map(int, raw_input().split())
g = abs(x - d[0])
for z in d:
    g = gcd(g, abs(z - x))
print g
Buggy python submission (verdict: Runtime Error):
n, m = map(int, raw_input().split())
a = []
for i in range(n):
    row = map(int, raw_input().split())
    a.append(row)
op = []
for i in range(n):
    for j in range(m - 1):
        if a[i][j] % 2 == 1:
            a[i][j + 1] += 1
            op.append([i + 1, j + 1, i + 1, j + 2])
for i in range(n - 1):
    if a[i][m - 1] % 2 == 1:
        a[i + 1][m - 1] += 1
        op.append([i + 1, m, i + 2, m])
print len(op)
for tup in op:
    print " ".join(tup)

Fixed submission:
n, m = map(int, raw_input().split())
a = []
for i in range(n):
    row = map(int, raw_input().split())
    a.append(row)
op = []
for i in range(n):
    for j in range(m - 1):
        if a[i][j] % 2 == 1:
            a[i][j + 1] += 1
            op.append([i + 1, j + 1, i + 1, j + 2])
for i in range(n - 1):
    if a[i][m - 1] % 2 == 1:
        a[i + 1][m - 1] += 1
        op.append([i + 1, m, i + 2, m])
print len(op)
for tup in op:
    print " ".join(map(str, tup))
Buggy python submission (verdict: Runtime Error):
N=int(input())
n=N-1
for i in range(1,int(N**(1/2))+1):
    if N%i==0:
      n=min(n,i+N/i-2)
print(int(n))

Fixed submission:
a,b=map(int,input().split())
if a>9 or b>9:
  print(-1)
else:
  print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
d=list(map(int,input().split()))
n=0
for k in range(1,10**5+1):
  m=0
  for b in d:
    if b<k:
      m+=1
  if m==N/2:
    n+=1
print(n)

Fixed submission:
N=int(input())
d=sorted(list(map(int,input().split())))
print(d[int(N/2)]-d[int(N/2-1)])
Buggy python submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
n=0
if w%x==0 and h%y==0:
  n=1
print(float(w*h/2), end=" ")
print(n)

Fixed submission:
w,h,x,y=map(int,input().split())
n=0
if w==2*x and h==2*y:
  n=1
print(float(w*h/2), end=" ")
print(n)
Buggy python submission (verdict: Runtime Error):
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
a=[A-(T-H[i]*0.006) for i in range(0,N) if A-(T-H[i]*0.006)>=0]
b=[A-(T-H[i]*0.006) for i in range(0,N) if A-(T-H[i]*0.006)<0]
if a==[]:
  c=max(b)
elif b==[]:
  c=min(a)
elif min(a)>=-max(b):
  c=max(b)
else:
  c=min(a)
print(H.index((T-A+c)/0.006)+1)

Fixed submission:
N=int(input())
T,A=map(int,input().split())
h=list(map(int,input().split()))
AA=[]
for i in range(N):
  a=T-h[i]*0.006-A
  if a<0:
    a*=-1
  AA.append(a)
print(AA.index(min(AA))+1)
Buggy python submission (verdict: Runtime Error):
S=input()
if S[0]!="1":
  print(S[0])
else:
  K=int(input())
  i=0
  while S[i]=="1":
    i+=1
  if i<K:
    print(S[i])
  else:
    print(1)

Fixed submission:
S=input()
if all(S[i]=="1" for i in range(len(S))):
  print(1)
elif S[0]!="1":
  print(S[0])
else:
  K=int(input())
  i=0
  while S[i]=="1":
    i+=1
  if i<K:
    print(S[i])
  else:
    print(1)
Buggy python submission (verdict: Runtime Error):
s=list(input())
n=s.count(o)
print(700+100*n)

Fixed submission:
s=list(input())
n=s.count("o")
print(700+100*n)
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())
x=(a+b)/2
if (a+b)%2==0:
  print(x)
else:
  print(x+1)


Fixed submission:
a,b=map(int,input().split())
x=(a+b)/2
if (a+b)%2==0:
  print(int(x))
else:
  print(int(x)+1)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input(),split())
x=(a+b)/2
if (a+b)%2==0:
  print(int(x))
else:
  print(int(x)+1)

Fixed submission:
a,b=map(int,input().split())
x=(a+b)/2
if (a+b)%2==0:
  print(int(x))
else:
  print(int(x)+1)
Buggy python submission (verdict: Runtime Error):
S=str(input())
print(S.count(”1”))

Fixed submission:
s=str(input())
if s=="111":
  print(3)
elif s=="000":
  print(0)
elif s=="001" or s=="010" or s=="100":
  print(1)
else:
  print(2)

Buggy python submission (verdict: Runtime Error):
S=int(input())
print(S.count(1))

Fixed submission:
s=str(input())
if s=="111":
  print(3)
elif s=="000":
  print(0)
elif s=="001" or s=="010" or s=="100":
  print(1)
else:
  print(2)
Buggy python submission (verdict: Runtime Error):
n=input()
A=list(map(int,input().split())
c=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  c+=1
print(c)


Fixed submission:
n=input()
A=list(map(int,input().split()))
c=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  c+=1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n=input()
A=map(int,input().split())
c=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  c+=1
print(c)


Fixed submission:
n=input()
A=list(map(int,input().split()))
c=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
n=input()
l=list(range(1,n))
m=0
def c(n):
  return n/2
while any(i%2==0 for i in l):
       l=map(c,l)
       m+=1
print(2**m)

Fixed submission:
N=int(input())
c=0
n=range(1,N)
while any(i%2==0 for i in n):
          N=int(N/2)
          n=range(1,N+1)
          c+=1
print(2**c)

Buggy python submission (verdict: Runtime Error):
n=input()
l=list(range(1,n))
m=0
while any(i%2==0 for i in l):
       l=[i/2 for i in l]
       m+=1
print(2**m)

Fixed submission:
N=int(input())
c=0
n=range(1,N)
while any(i%2==0 for i in n):
          N=int(N/2)
          n=range(1,N+1)
          c+=1
print(2**c)

Buggy python submission (verdict: Runtime Error):
n=input()
l=range(1,n)
m=0
while any(i%2==0 for i in l):
       l=[i/2 for i in l]
       m+=1
print(2**m)

Fixed submission:
N=int(input())
c=0
n=range(1,N)
while any(i%2==0 for i in n):
          N=int(N/2)
          n=range(1,N+1)
          c+=1
print(2**c)

Buggy python submission (verdict: Runtime Error):
n=input()
l=range(1,n)
m=0
while any(i&2==0 for i in l):
       l=[i/2 for i in l]
       m+=1
print(2**m)

Fixed submission:
N=int(input())
c=0
n=range(1,N)
while any(i%2==0 for i in n):
          N=int(N/2)
          n=range(1,N+1)
          c+=1
print(2**c)

Buggy python submission (verdict: Runtime Error):
n=input()
l=(range(n+1))[1:]
while any(i%2==0 for i in l):
  l=[i/2 i%2==0 for i in l]
print(int(n))

Fixed submission:
N=int(input())
c=0
n=range(1,N)
while any(i%2==0 for i in n):
          N=int(N/2)
          n=range(1,N+1)
          c+=1
print(2**c)
Buggy python submission (verdict: Runtime Error):
#変数に注意。。。#
def f(n,l):
  m=A[n]
  if m==1:
    print(l)
  elif L[m]==1:
    print(-1)
  else:
    L[m]=1
    return f(m,l+1)

N=int(input())
L=[0 for i in range(N)]
A=[int(input())-1  for _ in range(N)]
L[0]=1
f(0,1)

Fixed submission:
N=int(input())
L=[0 for i in range(N)]
A=[int(input())-1  for _ in range(N)]
n=0
m=1
while L[n]!=1 and A[n]!=1:
  L[n]=1
  m+=1
  n=A[n]
if L[n]==1:
  print(-1)
else:
  print(m)

Buggy python submission (verdict: Runtime Error):
def f(n):
  m=A[n]
  if m==1:
    print(n)
  elif L[m]==1:
    print(-1)
  else:
    n+=1
    L[m]=1
    return f(m)

N=int(input())
L=[0 for i in range(N)]
A=[int(input())-1  for _ in range(N)]
L[0]=1
n=0
if A[0]==1:
  print(1)
else:
  f(0)

Fixed submission:
N=int(input())
L=[0 for i in range(N)]
A=[int(input())-1  for _ in range(N)]
n=0
m=1
while L[n]!=1 and A[n]!=1:
  L[n]=1
  m+=1
  n=A[n]
if L[n]==1:
  print(-1)
else:
  print(m)

Buggy python submission (verdict: Runtime Error):
def f(n):
  m=A[n]
  if m==1:
    print(n)
  elif L[m]==1:
    print(-1)
  else:
    n+=1
    L[m]=1
    return f(m)

N=int(input())
L=[0 for i in range(N)]
A=[int(input())-1  for _ in range(N)]
L[0]=1
n=0
f(0)

Fixed submission:
N=int(input())
L=[0 for i in range(N)]
A=[int(input())-1  for _ in range(N)]
n=0
m=1
while L[n]!=1 and A[n]!=1:
  L[n]=1
  m+=1
  n=A[n]
if L[n]==1:
  print(-1)
else:
  print(m)
Buggy python submission (verdict: Runtime Error):
r,g,b=map(int,input().split())
if (100*r+10*g+b)%4==0:
  print(YES)
else:
  print(NO)

Fixed submission:
r,g,b=map(int,input().split())
if (100*r+10*g+b)%4==0:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
list=[[] for j in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  list[a-1]+="Y"
  list[b-1]+="Y"
for i in range(M):
  print(len(list[i]))

Fixed submission:
N,M=map(int,input().split())
list=[[] for j in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  list[a-1]+="Y"
  list[b-1]+="Y"
for i in range(N):
  print(len(list[i]))
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
n=0
for X in range(0,K+1):
  for Y in range(0,K+1):
    for Z in range(0,K+1):
      if S==X+Y+Z:
        n+=1
print(n)

Fixed submission:
K,S=map(int,input().split())
n=0
for X in range(0,K+1):
  for Y in range(0,K+1):
      if 0<=S-X-Y<=K:
        n+=1
print(n)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# @Time    : 2020/3/1 19:59
# @Author  : DIRICHLET
# @File    : main.py


b=[[0,0,0]]*3
#print(b)
m={}
for i in range(3):
    t=list(map(int,input().split()))
    k=0
    for j in t:
        m[j]=(i,k)
        k+=1
n=int(input())
for i in n:
    t=int(input())
    if t in m:
        #print(m[t])
        b[m[t][0]][m[t][1]]=1
for i in b:
    ans=1
    for j in i:
        ans*=j
    if ans==1:
        print('Yes')
        exit()
for i in range(3):
    ans=1
    for j in range(3):
        ans*=b[j][i]
    if ans==1:
        print('Yes')
        exit()
if b[0][0]*b[1][1]*b[2][2]==1:
    print('Yes')
    exit()
if b[0][2]*b[1][1]*b[2][0]==1:
    print('Yes')
    exit()
print('No')

Fixed submission:
# -*- coding: utf-8 -*-
# @Time    : 2020/3/1 19:59
# @Author  : DIRICHLET
# @File    : main.py


b=[[0,0,0],[0,0,0],[0,0,0]]
#print(b)
m={}
for i in range(3):
    t=list(map(int,input().split()))
    k=0
    for j in t:
        m[j]=(i,k)
        k+=1
n=int(input())
for i in range(n):
    t=int(input())
    if t in m:
        #print(m[t])
        b[m[t][0]][m[t][1]]=1
for i in b:
    ans=1
    for j in i:
        ans*=j
    if ans==1:
        print('Yes')
        exit()
for i in range(3):
    ans=1
    for j in range(3):
        ans*=b[j][i]
    if ans==1:
        print('Yes')
        exit()
if b[0][0]*b[1][1]*b[2][2]==1:
    print('Yes')
    exit()
if b[0][2]*b[1][1]*b[2][0]==1:
    print('Yes')
    exit()
print('No')
Buggy python submission (verdict: Runtime Error):
#data=list(input().split())
a,b,c,d=map(int,input().split())
def gcd(x , y):
    if y == 0 
        return x 
    else gcd(y, x%y)

def gys(a,b):
    remainder = gcd(a,b)
    return int(a*b/remainder)

lcmm=gys(c,d)
def ans(n,k):
    return int(n/k)
def x(s):
    return ans(s,c)+ans(s,d)-ans(s,lcmm)
#print(x(b),x(a))
if a%c==0 or a%d==0:
    print(b-a-x(b)+x(a))
else:
    print(b-a+1-x(b)+x(a))




Fixed submission:
#data=list(input().split())
a,b,c,d=map(int,input().split())
def gcd(x , y):
    if y == 0:
        return x 
    else:
        return gcd(y, x%y)

def gys(a,b):
    remainder = gcd(a,b)
    return a*b//remainder

lcmm=gys(c,d)
def ans(n,k):
    return n//k
def x(s):
    return ans(s,c)+ans(s,d)-ans(s,lcmm)
#print(x(b),x(a))

print(b-a+1-x(b)+x(a-1))
Buggy python submission (verdict: Runtime Error):
a,b=map(int ,input().split())
x=int(pow(b,1/a))
x+=1
while x>=1:
    if b%(pow(x,a))==0:
        print(x)
        exit()
    x-=1



Fixed submission:
a,b=map(int ,input().split())
x=int(pow(b,1/a)+0.00001)
while x>=1:
    if b%(x**a)==0:
        print(x)
        exit()
    x-=1

Buggy python submission (verdict: Runtime Error):
a,b=map(int ,input().split())
x=int(pow(b,1/a))
x+=1
while x>=1:
    if b%(x**a)==0:
        print(x)
        exit()
    x-=1



Fixed submission:
a,b=map(int ,input().split())
x=int(pow(b,1/a)+0.00001)
while x>=1:
    if b%(x**a)==0:
        print(x)
        exit()
    x-=1

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int ,input().split())
x=int(pow(b,1/a))
x+=1
while x>=1:
    if b%(x**a)==0:
        print(x)
        exit()
    x-=1



Fixed submission:
a,b=map(int ,input().split())
x=int(pow(b,1/a)+0.00001)
while x>=1:
    if b%(x**a)==0:
        print(x)
        exit()
    x-=1
Buggy python submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  vector<int>A(N);
  for(int &a:A)cin>>a;
  sort(A.begin(),A.end(),greater<int>());
  map<int,int>m;
  int ans=0;
  for(int a:A){
    if(m.count(a)&&m[a]>0)m[a]--,ans++;
    else m[(1<<(32-__builtin_clz(a)))-a]++;
  }
  cout<<ans<<endl;
}


Fixed submission:
import math
N = int(input())
A = sorted([int(_) for _ in input().split()], reverse=True)
dp = {}
for a in A:
    dp[a] = dp.get(a, 0) + 1
ans = 0
for a in A:
    if dp[a]:
        dp[a] -= 1
        if dp.get(2**int(math.log2(a) + 1) - a, 0) > 0:
            dp[2**int(math.log2(a) + 1) - a] -= 1
            ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
mod = 1000000007
def gcd(a, b):
    while(b > 0):
        a = a%b
        c = b
        b = a
        a = c
    return a

n = int(input())
s = input()

s = s.split(" ")

l = int(s[0])

for i in range(1, n):
    l = (l*int(s[i]))//gcd(l, int(s[i]))

ans = 0
for x in s:
    x = int(x)
    ans = (ans +l//x)%mod

print(ans%mod)




Fixed submission:
def gcd(a, b):
    while(b > 0):
        a = a%b
        c = b
        b = a
        a = c
    return a

n = int(input())
s = input()

s = s.split(" ")
# for i s:
#     x = int(input())
#     arr.append(x)

l = int(s[0])

for i in range(1, n):
    l = (l*int(s[i]))//gcd(l, int(s[i]))

ans = 0
for x in s:
    x = int(x)
    ans += l//x

print(ans%1000000007)
Buggy python submission (verdict: Runtime Error):
n,a,b = list(map(int,input().split()))
kurikaeshi = n // (a + b)
amari = n - (kurikaeshi * (a+b))
ball_list = []
ans = 0
blue = 'b' * a
red = 'r' * b
if(amari - len(blue) < 0):
    ans = 0
if(amari - len(blue) == 0):
    ans = len(blue)
else:
    ans = len(blue) - amari
print(ans)

Fixed submission:
n,a,b = list(map(int,input().split()))
if(a != 0):
    kurikaeshi = n // (a + b)
    mod = n % (a + b)
    ans = a*kurikaeshi
    if(mod - a > 0):
        ans += a
    else:
        ans += mod
if(a == 0):
    ans = 0
print(ans)

Buggy python submission (verdict: Runtime Error):
n,a,b = list(map(int,input().split()))
kurikaeshi = n // (a + b)
amari = n - (kurikaeshi * (a+b))
ball_list = []
ans = 0
blue = 'b' * a
red = 'r' * b
if(amari - len(blue) < 0):
    ans = 0
else:
    ans = len(blue) - amari
print(ans)

Fixed submission:
n,a,b = list(map(int,input().split()))
if(a != 0):
    kurikaeshi = n // (a + b)
    mod = n % (a + b)
    ans = a*kurikaeshi
    if(mod - a > 0):
        ans += a
    else:
        ans += mod
if(a == 0):
    ans = 0
print(ans)

Buggy python submission (verdict: Runtime Error):
n,a,b = list(map(int,input().split()))
kurikaeshi = n // (a + b)
ans = kurikaeshi * a
amari = n - (kurikaeshi * (a+b))
ball_list = []
ans = 0
blue = 'b' * a
red = 'r' * b
for i in range(1,kurikaeshi+2):
    ball_list.append(blue)
    ball_list.append(red)
for l in range(0,a+1):
    if(list(ball_list)[amari] == 'b'):
        ans += 1
print(ans)

Fixed submission:
n,a,b = list(map(int,input().split()))
if(a != 0):
    kurikaeshi = n // (a + b)
    mod = n % (a + b)
    ans = a*kurikaeshi
    if(mod - a > 0):
        ans += a
    else:
        ans += mod
if(a == 0):
    ans = 0
print(ans)