Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
from heapq import heappush, heappop, heapify
input = sys.stdin.readline
    
def dfs(v, c, p=-1):
    dist[v] = c
    for u, d in g[v]:
        if u == p: continue
        dfs(u, c+d, v)

def main():    
    for i in range(N-1):
        a, b, c = map(int, input().split())
        a -= 1; b -= 1
        g[a].append((b, c))
        g[b].append((a, c))
        
    Q, K = map(int, input().split())
    K -= 1
    
    dfs(K, 0)
    
    for i in range(Q):
        x, y = map(int, input().split())
        print(dist[x-1]+dist[y-1])
    
if __name__ == '__main__':
    N = int(input())
    g = [[] for i in range(N)]
    dist = [0] * N
    main()

Fixed submission:
import heapq


N = int(input())
tree = {i+1:[] for i in range(N)}
route = [10**20 for i in range(N+1)]
visited = [False for i in range(N+1)]

for i in range(N-1):
    a, b, c = list(map(int, input().split()))
    tree[a].append((c, b))
    tree[b].append((c, a))

Q, K = list(map(int, input().split()))

route[K], visited[K] = 0, True
queue = tree[K]

while len(queue):
    c, r = heapq.heappop(queue)

    if not visited[r]:
         visited[r], route[r] = True, c
         for cost, next_r in tree[r]:
             if not visited[next_r]:
                 heapq.heappush(queue, (route[r]+cost, next_r))

for i in range(Q):
    x, y = list(map(int, input().split()))
    print(route[x]+route[y])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))

A = []
B = []

for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        A.append(b)
    elif b == N:
        B.append(a)

ans = 'IMPOSSIBLE'
for a in A:
    if a in B:
        ans = 'POSSIBLE'
        break
print(ans)

Fixed submission:
N, M = list(map(int, input().split()))
A = [0 for i in range(200000+1)]
B = [0 for i in range(200000+1)]
ans = 'IMPOSSIBLE'

for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        A[b] = 1
        if A[b] and B[b]:
            ans = 'POSSIBLE'
            break
    elif b == N:
        B[a] = 1
        if A[a] and B[a]:
            ans = 'POSSIBLE'
            break
print(ans)

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

A = []
B = []
x = []

for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        A.append(b)
    elif b == N:
        B.append(a)

ans = 'IMPOSSIBLE'
for a in A:
    for b in B:
        if a == b:
            ans = 'POSSIBLE'
            break
print(ans)

Fixed submission:
N, M = list(map(int, input().split()))
A = [0 for i in range(200000+1)]
B = [0 for i in range(200000+1)]
ans = 'IMPOSSIBLE'

for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        A[b] = 1
        if A[b] and B[b]:
            ans = 'POSSIBLE'
            break
    elif b == N:
        B[a] = 1
        if A[a] and B[a]:
            ans = 'POSSIBLE'
            break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(input().split())
b = []

for i in range(n//2):
    b.append(a.pop(0))
    b.insert(0, a.pop(0))

if len(a) == 1:
    b.append(a.pop(0))
    b.reverse()

for i in range(n):
    print(b[i], '', end='')

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

if n % 2:
    nums = a[::-2] + a[1::2]
else:
    nums = a[::-2] + a[::2]

for num in nums:
    print(num, '', end='')
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

late = [0 for i in range(9)]

for n in a:
    late[n//400] += 1

max_a = min_a = 8-late[:-1].count(0)
if late[8] and not min_a:
    min_a = 1

if late[8]:
    max_a = min(max_a+late[8], 8)

print(min_a, max_a)

Fixed submission:

from collections import Counter

N = int(input())
a = Counter(list(map(lambda x: x//400, map(int, input().split()))))

c = n = 0
for key in [0,1,2,3,4,5,6,7]:
    if a[key]:
        c += 1
        
for key in [8,9,10,11,12]:
    n += a[key]
        
max_n = c+n
if c:
    min_n = c
else:
    min_n = 1
print(min_n, max_n)
Buggy python submission (verdict: Time Limit Exceeded):
N, A, B = list(map(int, input().split()))
n = A - B
h = [int(input()) for i in range(N)]
count = 0
while len(h) > 0:
	count += 1
	max_n = max(h)
	idx = h.index(max_n)

	h[idx] -= n
	h = list(map(lambda x: x-B, h))
	h = list(filter(lambda x: x > 0, h))
	
print(count)

Fixed submission:
import numpy as np

N, A, B = list(map(int, input().split()))
h = np.array([int(input()) for i in range(N)], dtype='int64')

left, right = 0, np.ceil(np.max(h)/B)

while left+1 < right:
    mid = np.ceil((left + right) / 2)
    x = h - mid*B
    x[x<0] = 0
    x = np.ceil(x / (A - B))

    if np.sum(x) <= mid:
        right = mid
    else:
        left = mid

print(int(right))
Buggy python submission (verdict: Time Limit Exceeded):
INF = float('inf')
N, M = map(int, input().split())
dist = [0] + [INF] * (N-1)
abc = []

for i in range(M):
    a, b, c = map(int, input().split())
    abc.append((a, b, -c))
    
for i in range(N-1):
    for a, b, c in abc:
        dist[b-1] = min(dist[b-1], dist[a-1]+c)
        
ans = dist[-1]
negative = [False] * N

for i in range(N):
    for a, b, c in abc:
        if dist[b-1] > dist[a-1]+c:
            dist[b-1] = dist[a-1]+c
            negative[b-1] = True
        if negative[a-1]:
            negative[b-1] = True
        
if negative[-1]:
    print('inf')
else:
    print(-ans)

Fixed submission:
def main():
    INF = float('inf')
    N, M = map(int, input().split())
    dist = [0] + [INF] * (N-1)
    abc = []
    
    for i in range(M):
        a, b, c = map(int, input().split())
        abc.append((a, b, -c))
        
    for i in range(N-1):
        for a, b, c in abc:
            if dist[a-1] == INF:
                continue
            dist[b-1] = min(dist[b-1], dist[a-1]+c)
            
    ans = dist[-1]
    negative = [False] * N
    
    for i in range(N):
        for a, b, c in abc:
            if dist[a-1] == INF:
                continue
            elif dist[b-1] > dist[a-1]+c:
                dist[b-1] = dist[a-1]+c
                negative[b-1] = True
            if negative[a-1]:
                negative[b-1] = True
            
    if negative[-1]:
        print('inf')
    else:
        print(-ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n,x,=map(int, input().split())
w_list = list(map(int, input().split()))

d=0
for i in range(n+1):
   d=d+w_list[i]
   if(d>x):
       break
print(i+1)


Fixed submission:
x,a=map(int, input().split())
if(x<a):
    print (0)
else:
    print (10)

Buggy python submission (verdict: Runtime Error):
p,q,r=map(int, input().split()) #spaceno
N=[p,q,r]
N.sort()
print (N[0]+N[1])

Fixed submission:
x,a=map(int, input().split())
if(x<a):
    print (0)
else:
    print (10)
Buggy python submission (verdict: Runtime Error):
    d, t, s = list(map(int, input().split()))
    if d / t <= s:
      print('Yes')
    else:
      print('No')

Fixed submission:
d, t, s = list(map(int, input().split()))
if d / t <= s:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
d, t, s = list(map, int(input().split()))
if d / t <= s:
  print('Yes')
else:
  print('No')

Fixed submission:
d, t, s = list(map(int, input().split()))
if d / t <= s:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a_list = list(map(int, input().split()))
sum_ = 0
mod = 10 ** 9 + 7
for i in range(len(a_list) - 1):
  for j in range(i + 1, len(a_list)):
    sum_ += ((a_list[i] % mod) * (a_list[j] % mod)) % mod 
print(sum_ % mod)

Fixed submission:
n = input()
a_list = list(map(int, input().split()))
ruisekiwa = [0] * (len(a_list) + 1) 
for i in range(len(a_list)):
    ruisekiwa[i + 1] = ruisekiwa[i] + a_list[i]
sum_ = 0
mod = 10 ** 9 + 7
for i in range(len(a_list)):
    sum_ += ((a_list[i] % mod) * ((ruisekiwa[-1] % mod) - (ruisekiwa[i + 1] % mod))) % mod
print(sum_ % mod)
Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
max_a_list = [0]*n
max_a_list[0] = a[0]

for i in range(1,n):
  max_a_list[i] = max(max_a_list[i - 1],a[i])
sum_ = 0
for i in range(n):
  sum_ += max(max_a_list[i] - a[i], 0)
print(sum_)



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

for i in range(1,n):
  max_a_list[i] = max(max_a_list[i - 1],a[i])
sum_ = 0
for i in range(n):
  if max_a_list[i] > a[i]:
    sum_ += max_a_list[i] - a[i]
print(sum_)

Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
max_a_list = [0]*n
max_a_list[0] = a[0]

for i in range(1,n):
  max_a_list[i] = max(max_a_list[i - 1],a[i])
sum_ = 0
for i in range(n):
  if max_a_list[i] > a[i]:
    sum_ += max_a_list[i] - a[i]
print(sum_)



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

for i in range(1,n):
  max_a_list[i] = max(max_a_list[i - 1],a[i])
sum_ = 0
for i in range(n):
  if max_a_list[i] > a[i]:
    sum_ += max_a_list[i] - a[i]
print(sum_)
Buggy python submission (verdict: Runtime Error):
s = input()
sum_ = 0
if s[0] == 'R':
  sum_ += 1
  if s[1] == 'R':
    sum_ += 1
    if s[2] == 'R':
      sum_ += 1
  else:
    sum_ = 1
else:
  if s[1] == 'R':
    sum_ += 1
    if s[2] == 'R':
      sum_ += 1
  else:
    s[2] == 'R':
      sum_ = 1
print(sum_)

Fixed submission:
s = input()
sum_ = 0
if s[0] == 'R':
  sum_ += 1
  if s[1] == 'R':
    sum_ += 1
    if s[2] == 'R':
      sum_ += 1
  else:
    sum_ = 1
else:
  if s[1] == 'R':
    sum_ += 1
    if s[2] == 'R':
      sum_ += 1
  else:
    if s[2] == 'R':
      sum_ = 1
print(sum_)
Buggy python submission (verdict: Runtime Error):
n, d = list(map(int, input().split()))
points = []
for i in range(n):
  points.append(list(map(int, input().split())))
  
cnt = 0
for p in points:
  distance = sqrt(p[0] **2 + p[1] **2)
  if distance <= d:
    cnt += 1
print(cnt)
   

Fixed submission:
n, d = list(map(int, input().split()))
points = []
for i in range(n):
  points.append(list(map(int, input().split())))
  
cnt = 0
import numpy as np
for p in points:
  distance = np.linalg.norm(p)
  if distance <= d:
    cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
s = '7'
cnt = 1
while 1:
  if int(s) % k == 0:
    break
  else:
    s += '7'
    cnt += 1
print(cnt)

Fixed submission:
k = int(input())

t = 7
flag = True
for i in range(k):
  if t % k == 0:
    print(i + 1)
    flag = False
    break
  else:
    t = (t * 10 + 7) % k
if flag:
  print('-1')
Buggy python submission (verdict: Runtime Error):
n = input()
if len(n) < 3:
  print(1000 - int(n))
else:
  hasuu = n[len(n) - 3:]
  if hasuu == '000':
    print('0')
  else:
    print(1000-int(hasuu)

Fixed submission:
n = input()
if len(n) < 3:
  print(1000 - int(n))
else:
  hasuu = n[len(n) - 3:]
  if hasuu == '000':
    print('0')
  else:
    print(1000-int(hasuu))
Buggy python submission (verdict: Runtime Error):
n = int(input())
c0 = 0
c1 = 0
c2 = 0
c3 = 0
for i in ragne(n):
  s = input()
  if s == 'AC':
    c0 += 1
  elif s == 'WA':
    c1 += 1
  elif s == 'TLE':
    c2 += 1
  else:
    c3 += 1
print(f'AC x {c0}')
print(f'WA x {c1}')
print(f'TLE x {c2}')
print(f'RE x {c3}')

Fixed submission:
n = int(input())
c0 = 0
c1 = 0
c2 = 0
c3 = 0
for i in range(n):
  s = input()
  if s == 'AC':
    c0 += 1
  elif s == 'WA':
    c1 += 1
  elif s == 'TLE':
    c2 += 1
  else:
    c3 += 1
print(f'AC x {c0}')
print(f'WA x {c1}')
print(f'TLE x {c2}')
print(f'RE x {c3}')
Buggy python submission (verdict: Runtime Error):
n,k = list(map(int, input().split()))
p = list(map(int, input().split()))

print(sum(sorted(p)[:k])

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

print(sum(sorted(p)[:k]))
Buggy python submission (verdict: Runtime Error):
n=int(input())

s = ''
for i in range(11):
  if N != 0:
    n -= 1
    s += chr(ord('a') + N % 26)
    n //= 26
print(s[::-1])

Fixed submission:
n=int(input())

s = ''
for i in range(11):
  if n != 0:
    n -= 1
    s += chr(ord('a') + n % 26)
    n //= 26
print(s[::-1])
Buggy python submission (verdict: Runtime Error):
import decimal
n = int(input())
a = list(map(int, input().split()))
ans = 1
if 0 in a:
  print(-1)
else:
  flag = True
  for i in a:
    ans *= i
    if ans > (10 ** 18):
      print(-1)
      flag = False
      break
  if flag:
    print(ans)


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

Buggy python submission (verdict: Runtime Error):
import decimal
n = int(input())
a = list(map(int, input().split()))
ans = decimal.Decimal(1)
if 0 in a:
  print(-1)
else:
  for i in a:
    ans *= i
  if ans < (10 ** 18 + 1):
    print(ans)
  else:
    print(-1)


Fixed submission:
a,b = list(map(int, input().split()))
print(a * b)
Buggy python submission (verdict: Runtime Error):
import decimal
n = int(input())
a = list(map(int, input().split()))
ans = decimal.Decimal(1)
if 0 in a:
    print(-1)
else:
    for i in a:
        ans *= i
    if ans < (10 ** 18 + 1):
        print(ans)
    else:
        print(-1)

Fixed submission:
def main():
  n = int(input())
  a = list(map(int, input().split()))
  if 0 in a:
    print(0)
    return
  
  ans = 1
  for i in a:
    ans *= i
    if ans > (10 ** 18):
      print(-1)
      return
  print(ans)
  
main()
Buggy python submission (verdict: Runtime Error):
import decimal
n = int(input())
a = list(map(int, input().split()))
ans = 1
if 0 in a:
  print(-1)
else:
  flag = True
  for i in a:
    ans *= i
    if ans > (10 ** 18):
      print(-1)
      flag = False
      break
  if flag:
    print(ans)


Fixed submission:
import decimal
a,b = input().split()
print(int(decimal.Decimal(a) * decimal.Decimal(b)))

Buggy python submission (verdict: Runtime Error):
import decimal
a,b = input().split()
print(int(decimai.Decimal(a) * decimal.Decimal(b)))

Fixed submission:
import decimal
a,b = input().split()
print(int(decimal.Decimal(a) * decimal.Decimal(b)))

Buggy python submission (verdict: Runtime Error):
import decimal
a,b = list(map(float, input().split()))
print(int(decimai.Decimal(a) * decimal.Decimal(b)))

Fixed submission:
import decimal
a,b = input().split()
print(int(decimal.Decimal(a) * decimal.Decimal(b)))

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

print(int(a * b))

Fixed submission:
import decimal
a,b = input().split()
print(int(decimal.Decimal(a) * decimal.Decimal(b)))
Buggy python submission (verdict: Runtime Error):
n,m,x = list(map(int, input().split()))
book = []
for i in range(n):
  book.append(list(map(int, input().split())))
ans = 10 ** 5 * n
for i in product([0,1], repeat=n):
  price = 0
  skill = [0] * m
  for index_, bit in enumerate(i):
    if bit:
      for j in range(m):
        skill[j] += book[index_][ j + 1]
        price += book[index_][0]
  if all(v >= x for v in skill):
    ans = min(ans, price)
        
print(ans)

Fixed submission:
from itertools import product

n,m,x = list(map(int, input().split()))
book = []
for i in range(n):
    book.append(list(map(int, input().split())))

ans = 10 ** 5 * n
flag = False
for i in product([0,1], repeat=n):
    price = 0
    skill = [0] * m
    for index_, bit in enumerate(i):
        if bit:
            for j in range(m):
                skill[j] += book[index_][ j + 1]
            price += book[index_][0]
    if all(v >= x for v in skill):
        ans = min(ans, price)
        flag = True
if flag:
    print(ans)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
n,k = list(map(int, input().split()))
hoge = [1] * n

for i in range(k * 2):
  if i % 2 != 0:
    a = list(map(int, input().split()))
  	for j in a:
      hoge[j - 1] = 0
      
print(sum(hoge))


Fixed submission:
n,k = list(map(int, input().split()))
hoge = [1] * n

for i in range(k * 2):
  a = list(map(int, input().split()))
  if i % 2 != 0:
    for j in a:
      hoge[j - 1] = 0
      
print(sum(hoge))

Buggy python submission (verdict: Runtime Error):
n,k = list(map(int, input().split()))
hoge = [1] * n

for i in range(k * 2):
  if i % 2 == 0:
    a = list(map(int, input().split()))
  	for j in a:
      hoge[j - 1] = 0
      
print(sum(hoge))


Fixed submission:
n,k = list(map(int, input().split()))
hoge = [1] * n

for i in range(k * 2):
  a = list(map(int, input().split()))
  if i % 2 != 0:
    for j in a:
      hoge[j - 1] = 0
      
print(sum(hoge))
Buggy python submission (verdict: Runtime Error):
num = input()
hoge = list(map(int, input().split()))
count = 0
fuga = 0
 
for i in range(1, len(hoge)):
	if hoge[i] != hoge[i - 1]:
		print(i - count)
		fuga += 1
		count = i
		if i == len(hoge) - 1:
			print(i + 1- count)
			fuga += 1
	else:
		if i == len(hoge) - 1:
			print(i + 1- count)
			fuga += 1
for i in range(fuga, num):
	print(0)

Fixed submission:
num = int(input())
hoge = list(map(int, input().split()))

fuga = [0] * num

for i in hoge:
  fuga[i - 1] += 1
for i in fuga:
  print(i)

Buggy python submission (verdict: Runtime Error):
num = input()
hoge = list(map(int, input().split()))
count = 0
fuga = 0

for i in range(1, len(hoge)):
  if hoge[i] != hoge[i - 1]:
    print(i - count)
    fuga += 1
    count = i
    if i == len(hoge) - 1:
      print(i + 1- count)
      fuga += 1
    else:
      if i == len(hoge) - 1:
        print(i + 1- count)
        fuga += 1
for i in range(fuga, num):
  print(0)

Fixed submission:
num = int(input())
hoge = list(map(int, input().split()))

fuga = [0] * num

for i in hoge:
  fuga[i - 1] += 1
for i in fuga:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
hoge = list(map(int, input().split()))
fuga = 0
for i in range(num - 1):
  count = 0
  for j in range(fuga, num - 1):
    if hoge[j] == i + 1:
      count += 1
  fuga += count
  print(count)
print(0)

Fixed submission:
num = int(input())
hoge = list(map(int, input().split()))

fuga = [0] * num

for i in hoge:
  fuga[i - 1] += 1
for i in fuga:
  print(i)

Buggy python submission (verdict: Runtime Error):
num = int(input())
hoge = list(map(int, input().split()))
fuga = 0
for i in range(num):
  count = 0
  for j in range(fuga, num):
    if hoge[j] == i + 1:
      count += 1
  fuga += count
  print(count)

Fixed submission:
num = int(input())
hoge = list(map(int, input().split()))

fuga = [0] * num

for i in hoge:
  fuga[i - 1] += 1
for i in fuga:
  print(i)
Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
a_min = math.ceil(a / 0.08)
a_max = math.floor((a + 1) / 0.08)
b_min = math.ceil(b / 0.1)
b_max = math.floor((b + 1) / 0.1)

if a_max < b_min or b_max < a_min:
  print(-1)
else:
  result = b_min if a_min < b_min else a_min
  print(result)

Fixed submission:
s = list(input())

if len(list(set(s))) != 1:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
a_min = math.ceil(a / 0.08)
a_max = math.floor((a + 1) / 0.08)
b_min = math.ceil(b / 0.1)
b_max = math.floor((b + 1) / 0.1)

if a_max < b_min or b_max < a_min:
  print(-1)
else:
  result = b_min if a_min <= b_min else a_min
  print(result)

Fixed submission:
s = list(input())

if len(list(set(s))) != 1:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s = list(input())

if len(list(set(s)):
       print('Yes')
else:
       print('No')

Fixed submission:
s = list(input())

if len(list(set(s))) != 1:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N,blue,red = input().split()
count = 0
while(1):
  if N > 0:
    N -= blue
    count += 1
  if N > 0:
    N -= red
  else:
    break
print(blue*count + N)

Fixed submission:
N,blue,red = map(int,input().split())
count = N // (blue + red)
amari = N % (blue + red)
if N%(blue+red) >= blue:
    print(blue*(count + 1))
else:
    print(blue * count + amari)
Buggy python submission (verdict: Runtime Error):
_,b = list(map(int, input()))
hoge = list(map(int,input()))

count = 0
for i in hoge:
  if i >= b:
    count += 1
    
print(count)

Fixed submission:
_,a = list(map(int,input().split()))
hoge = list(map(int,input().split()))
count = 0
for i in hoge:
  if i >= a:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np
_ = input()
hoge = np.array(list(map(int, input().split())))

res = ''
for i in np.argsort(hoge):
  res += str(i) + ' '
print(res[:-1]

Fixed submission:
import numpy as np
_ = input()
hoge = np.array(list(map(int, input().split())))

res = ''
for i in np.argsort(hoge):
  res += str(i + 1) + ' '
print(res[:-1])
Buggy python submission (verdict: Runtime Error):
import math
a = input().replace(' ','')
root_a = int(math.sqrt(a))
if a / root_a == root_a:
  print('Yes')
else:
  print('No')


Fixed submission:
import math
a,b = input().split()
hoge = int(a + b)
root_hoge = int(math.sqrt(hoge))
if hoge / root_hoge == root_hoge:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
import math
a,b = input().split()
hoge = int(a + b)
root_hoge = math.sqrt(hoge)
if a / root_hoge == root_hoge:
  print('Yes')
else:
  print('No')


Fixed submission:
import math
a,b = input().split()
hoge = int(a + b)
root_hoge = int(math.sqrt(hoge))
if hoge / root_hoge == root_hoge:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N = input()
hoge = map(int,input().split())
fuga = [bin(i) for i in hoge]
count = 10000000
for i in fuga:
  tmp = i[::-1]
    for j in range(len(i)):
      if tmp[j] == '1'  and count > j:
        count = j
        break
print(count)  


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [bin(i)[2:] for i in a]
c = [0] * n
for i,v in enumerate(b):
  for j in v[::-1]:
    if j == '0':
      c[i] += 1
    else:
      break
print(min(c))

Buggy python submission (verdict: Runtime Error):
N = input()
hoge = map(int,input().split())
fuga = [bin(i) for i in hoge]
count = 10000000
for i in fuga:
   	tmp = i[::-1]
    for j in range(len(i)):
        if tmp[j] == '1'  and count > j:
            count = j
            break
print(count)  
  

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [bin(i)[2:] for i in a]
c = [0] * n
for i,v in enumerate(b):
  for j in v[::-1]:
    if j == '0':
      c[i] += 1
    else:
      break
print(min(c))
Buggy python submission (verdict: Runtime Error):
s = input()
print(s[0]+len(s)-2+s[-1])

Fixed submission:
s = input()
print(s[0]+str(len(s)-2)+s[-1])
Buggy python submission (verdict: Runtime Error):
import math
import numpy
K = int(input())

total = 0
tmp =0
 for a in range(1,K+1) :
     for b in range(1,K+1) :
        tmp=math.gcd(a,b)
         for c in range(1,K+1) :
             total += math.gcd(tmp,c)

print(total)


Fixed submission:
import math
import numpy
K = int(input())

total = tmp = 0
for a in range(1,K+1) :
  for b in range(1,K+1) :
   tmp=math.gcd(a,b)
   for c in range(1,K+1) :
      total += math.gcd(tmp,c)

print(total)
Buggy python submission (verdict: Runtime Error):
x,n=map(int,input().split())
p=set(map(int,input().split()))

s=set()
for i in range(1,101):
    s.add(i)

s=list(s-p)

a=[abs(x-i) for i in s]
print(s[a.index(min(a))])

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

s=set()
for i in range(-100,201):
    s.add(i)

s=list(s-p)

a=[abs(x-i) for i in s]
print(s[a.index(min(a))])
Buggy python submission (verdict: Time Limit Exceeded):
n=input()
a=list(map(int,input().split()))

ans=1
for i in a:
    ans*=i

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

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


if 0 in a:
    print(0)
    exit()
    
ans=1
for i in a:
    ans*=i
    if ans > 10**18:
        print(-1)
        exit()

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(input().split())

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

Fixed submission:
n=int(input())
a=list(input().split())

l = [0 for _ in range(n+1)]
for i in a:
    l[int(i)]+=1

for j in range(1,n+1):
    print(l[j])