Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = [0]*(n+1)
y = [0]*(n+1)
for i in range(n):
  a = int(input())
  x[i+1] = [0]*a
  y[i+1] = [0]*a
  for j in range(a):
    x[i+1][j], y[i+1][j] = map(int, input().split())

t = []
l = []
ans = 0
flag = 0
f = 1
for i in range(n):
  t.append(i+1)
  t_ = [i+1]
  flag = 1
  while(flag == 1):
    flag = 0
    t__ = [z for z in t_]
    t_ = []
    for m in t__:
      for j, k in zip(x[m],y[m]):
        if k == 0:
          if j in t or j in t_:
            f = 0
            t = []
            l = []
            t_ = []
            break
          l.append(j)
        if k == 1:
          if j in l:
            f = 0
            t = []
            l = []
            t_ = []
            break
          if j not in t and j not in t_:
            t_.append(j)
            flag = 1
      if f == 0:
        flag = 0
        t_ = []
        break
    t.extend(t_)
  if f != 0:
    ans = max(ans,len(t))
  remain = list(set(range(1,n+1))-set(t)-set(l))
  if len(remain)>0:
    T = [z for z in t]
    L = [z for z in l]
    for u in remain:
      t.append(u)
      t_ = [u]
      flag = 1
      while(flag == 1):
        flag = 0
        t__ = [z for z in t_]
        t_ = []
        for m in t__:
          for j, k in zip(x[m],y[m]):
            if k == 0:
              if j in t or j in t_:
                f = 0
                t = []
                l = []
                t_ = []
                break
              l.append(j)
            if k == 1:
              if j in l:
                f = 0
                t = []
                l = []
                t_ = []
                break
              if j not in t and j not in t_:
                t_.append(j)
                flag = 1
          if f == 0:
            flag = 0
            t_ = []
            t = [z for z in T]
            l = [z for z in L]
            break
        t.extend(t_) 
      if f != 0:
        ans = max(ans,len(t))
        T = [z for z in t]
    	L = [z for z in l]
print(ans)

Fixed submission:
n = int(input())
x = [0]*(n)
y = [0]*(n)
for i in range(n):
  a = int(input())
  x[i] = [0]*a
  y[i] = [0]*a
  for j in range(a):
    x[i][j], y[i][j] = map(int, input().split())

A = 0
for i in range(2**n):
  flag = 0
  ans = 0
  num = list(format(i, '0{}b'.format(n)))
  for j, k in enumerate(num):
    if k == "1":
      ans += 1
      for l, m in zip(x[j], y[j]):
        if num[l-1] != "{}".format(m):
          flag = 1
          break
    if flag == 1:
      break
  if flag == 0:
  	A = max(A,ans)
print(A)
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_right#(sorted_list,x)で昇順ソート位置

n = int(input())
l = list(map(int, input().split()))

l.sort()
ans = 0
for i in reversed(range(2,n)):
  for j in reversed(range(1,i)):
    s = l[i]-l[j]
    ans += len(l[:j])-bisect_right(l[:j],s)
print(ans)

Fixed submission:
from bisect import bisect_left#(sorted_list,x)で昇順ソート位置

n = int(input())
l = list(map(int, input().split()))

l.sort()
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    s = l[i]+l[j]
    ans += bisect_left(l,s,j+1)-j-1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left#(sorted_list,x)で昇順ソート位置

n = int(input())
l = list(map(int, input().split()))

l.sort()
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    s = l[i]+l[j]
    ans += bisect_left(l[j+1:],s)
print(ans)

Fixed submission:
from bisect import bisect_left#(sorted_list,x)で昇順ソート位置

n = int(input())
l = list(map(int, input().split()))

l.sort()
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    s = l[i]+l[j]
    ans += bisect_left(l,s,j+1)-j-1
print(ans)

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

l.sort()
ans = 0
for i in range(n-2):
  for j in reversed(range(i+2,n)):
    k = i+1
    while(k < j):
      if l[j] < l[i]+l[k]:
        ans += j - k
        break
      else:
        k += 1
print(ans)

Fixed submission:
from bisect import bisect_left#(sorted_list,x)で昇順ソート位置

n = int(input())
l = list(map(int, input().split()))

l.sort()
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    s = l[i]+l[j]
    ans += bisect_left(l,s,j+1)-j-1
print(ans)

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

l.sort()
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    k = n-1
    s = l[i]+l[j]
    while(k > j):
      if l[k] < s:
        ans += k-j
        break
      else:
        k -= 1
print(ans)

Fixed submission:
from bisect import bisect_left#(sorted_list,x)で昇順ソート位置

n = int(input())
l = list(map(int, input().split()))

l.sort()
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    s = l[i]+l[j]
    ans += bisect_left(l,s,j+1)-j-1
print(ans)

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

ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[k] < l[i]+l[j] and l[j] < l[i]+l[k] and l[i] < l[k]+l[j]:
        ans += 1
print(ans)

Fixed submission:
from bisect import bisect_left#(sorted_list,x)で昇順ソート位置

n = int(input())
l = list(map(int, input().split()))

l.sort()
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    s = l[i]+l[j]
    ans += bisect_left(l,s,j+1)-j-1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
import heapq

n, m = map(int, input().split())
a = list(map(int, input().split()))

hq = []
for i in range(n):
  heapq.heappush(hp, a[i]*(-1))

for i in range(m):
  b = heapq.heappop(hq)
  b = b//2
  heapq.heappush(hp, b)

ans = 0
for i in hq:
  ans += i *(-1)
print(ans)


Fixed submission:
import math
import heapq

n, m = map(int, input().split())
a = list(map(int, input().split()))

hq = []
for i in range(n):
  heapq.heappush(hq, a[i]*(-1))

for i in range(m):
  b = heapq.heappop(hq)
  b = ((-1)*b)//2
  heapq.heappush(hq, b*(-1))

ans = 0
for i in hq:
  ans += i *(-1)
print(ans)

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

n, m = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for i in range(n):
  if a[i] in d:
    l = d[a[i]]
    l.append(i)
    d[a[i]] = l    
  else:
    d[a[i]] = [i]

for i in range(m):
  b = max(a)
  li = d[b]
  li0 = li.pop(0)
  d[b] = li
  a[li0] = b/2
  if b/2 in d:
    l = d[b/2]
    l.append(li0)
    d[b/2] = l
  else:
    d[b/2] = [li0]

ans = 0
for i in a:
  ans += math.floor(i)
print(ans)

Fixed submission:
import math
import heapq

n, m = map(int, input().split())
a = list(map(int, input().split()))

hq = []
for i in range(n):
  heapq.heappush(hq, a[i]*(-1))

for i in range(m):
  b = heapq.heappop(hq)
  b = ((-1)*b)//2
  heapq.heappush(hq, b*(-1))

ans = 0
for i in hq:
  ans += i *(-1)
print(ans)

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

n, m = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for i in range(n):
  if a[i] in d:
    l = d[a[i]]
    l.append(i)
    d[a[i]] = l    
  else:
    d[a[i]] = [i]

for i in range(m):
  b = max(a)
  li = d[b]
  a[li[0]] = b/2
  if b/2 in d:
    l = d[b/2]
    l.append(li[0])
    d[b/2] = l
  else:
    d[b/2] = [li[0]]
  del li[0]
  d[b] = li

ans = 0
for i in a:
  ans += math.floor(i)
print(ans)

Fixed submission:
import math
import heapq

n, m = map(int, input().split())
a = list(map(int, input().split()))

hq = []
for i in range(n):
  heapq.heappush(hq, a[i]*(-1))

for i in range(m):
  b = heapq.heappop(hq)
  b = ((-1)*b)//2
  heapq.heappush(hq, b*(-1))

ans = 0
for i in hq:
  ans += i *(-1)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = []
cnt = {}
ans = 0
for i in range(n):
  s_ = list(str(input()))
  s_.sort()
  if s_ in s:
    ans += cnt[s_]
    cnt[s_] += 1
  else:
    s.append(s_)
    cnt[s_] = 1

print(ans)


Fixed submission:
n = int(input())
s = []
cnt = {}
ans = 0
for i in range(n):
  s_ = list(str(input()))
  s_.sort()
  s_ = "".join(s_)
  if s_ in cnt:
    ans += cnt[s_]
    cnt[s_] += 1
  else:
    cnt[s_] = 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
s = []
cnt = []
for i in range(n):
  s_ = list(str(input()))
  s_.sort()
  if s_ in s:
    cnt[s.index(s_)] += 1
  else:
    s.append(s_)
    cnt.appned(1)

print(sum(cnt))

Fixed submission:
n = int(input())
s = []
cnt = {}
ans = 0
for i in range(n):
  s_ = list(str(input()))
  s_.sort()
  s_ = "".join(s_)
  if s_ in cnt:
    ans += cnt[s_]
    cnt[s_] += 1
  else:
    cnt[s_] = 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(range(n))
ans = 0
for i in range(n):
  s[i] = list(str(input()))
  s[i].sort()
  ans += s.count(s[i])-1
     
print(ans)

Fixed submission:
n = int(input())
s = []
cnt = {}
ans = 0
for i in range(n):
  s_ = list(str(input()))
  s_.sort()
  s_ = "".join(s_)
  if s_ in cnt:
    ans += cnt[s_]
    cnt[s_] += 1
  else:
    cnt[s_] = 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(range(n))
for i in range(n):
  s[i] = list(str(input()))
  s[i].sort()

ans = 0
for i in range(n-1):
  for j in range(i+1, n):
    if s[i] == s[j]:
      ans += 1
print(ans)


Fixed submission:
n = int(input())
s = []
cnt = {}
ans = 0
for i in range(n):
  s_ = list(str(input()))
  s_.sort()
  s_ = "".join(s_)
  if s_ in cnt:
    ans += cnt[s_]
    cnt[s_] += 1
  else:
    cnt[s_] = 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(ranege(n))
for i in range(n):
  s[i] = list(str(input()))
  s[i].sort()

ans = 0
for i in range(n-1):
  for j in range(i+1, n):
    if s[i] == s[j]:
      ans += 1
print(ans)

Fixed submission:
n = int(input())
s = []
cnt = {}
ans = 0
for i in range(n):
  s_ = list(str(input()))
  s_.sort()
  s_ = "".join(s_)
  if s_ in cnt:
    ans += cnt[s_]
    cnt[s_] += 1
  else:
    cnt[s_] = 1

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

len_s = len(s)
key = "L"
num = 0
ans = []
for i in range(len_s):
  if s[i] != key:
    num += 1
  else:
    ans.append(num)
    if key == "R":
      key = "L"
    else:
      key = "R"
len_ans = len(ans)
for i in range(len_ans):
  if i % 2 == 0:
    for j in range(ans[i]-1):
      print(0, end=" ")
  	print((ans[i]+1)//2 + (ans[i+1]-1)//2, end=" ")
  else:
    print((ans[i-1]-1)//2 + (ans[i]+1)//2, end=" ")
    for j in range(ans[i]-1):
      print(0, end=" ")

Fixed submission:
s = list(str(input()))

len_s = len(s)
key = "L"
num = 0
ans = []
for i in range(len_s):
  if s[i] != key:
    num += 1
  else:
    ans.append(num)
    num = 1
    if key == "R":
      key = "L"
    else:
      key = "R"
ans.append(num)

len_ans = len(ans)
for i in range(len_ans):
  if i % 2 == 0:
    for j in range(ans[i]-1):
      print(0, end=" ")
    print((ans[i]+1)//2+(ans[i+1])//2, end=" ")
  else:
    print((ans[i-1])//2 + (ans[i]+1)//2, end=" ")
    for j in range(ans[i]-1):
      print(0, end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
a = []
n = int(input())
for i in range(n):
  a.append(int(input()))
for j in range(n):
  b = [a[i] for i in range(n) if i != j]
  print(max(b))

Fixed submission:
b = []
n = int(input())
m = 0
for i in range(n):
  a = int(input())
  b.append(a)
  if m < a:
    m = a
    c = [i]
  elif m == a:
    c.append(i)

if len(c) != 1:
  for i in range(n):
    print(m)
else:
  del b[c[0]]
  for i in range(n):
    if i == c[0]:
      print(max(b))
    else:
      print(m)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(range(n))
k = 2
s = 0
for i in range(n):
  if (n/2-1) < (n-i-1):
    b[n-i-1] = a[n-i-1]
  else:
    for j in range(2,k+1):
      s += b[j*(n-i)-1]
    if s % 2 == a[n-i-1]:
      b[n-i-1] = 0
    else:
      b[n-i-1] = 1
    k += 1
ans = b.count(1)
print(ans)
for i in range(n):
  if b[i] == 1:
    print(i+1)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(range(n))
k = 2
s = 0
for i in range(n):
  if (n/2-1) < (n-i-1):
    b[n-i-1] = a[n-i-1]
  else:
    while n > k*(n-i)-1:
      s += b[k*(n-i)-1]
      k += 1
    if s % 2 == a[n-i-1]:
      b[n-i-1] = 0
    else:
      b[n-i-1] = 1
  k = 2
  s = 0
ans = b.count(1)
print(ans)
for i in range(n):
  if b[i] == 1:
    print(i+1, end=" ")
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int,input().split()))
p.sort()


ans = p[int(n/2)] - [int(n/2)-1]
print(ans)

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

ans = p[int(n/2)] - p[int(n/2)-1]
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())

import fractions
import math

x = int(int(b//c) - int(math.ceil(a/c)) + 1)
y = int(int(b//d) - int(math.ceil(a/d)) + 1)
e = int(int(c*d)//int(fractions.gcd(c,d)))
z = int(int(b//e) - int(math.ceil(a/e)) + 1)

print(int(b-a+1-x-y+z))


Fixed submission:
n =  int(input())

x = []
for i in range(n):
  x.append(list(map(int, input().split())))
x.sort(key=lambda x:(x[1],x[0]))

s = 0
y = 0
for i in range(n):
  s += x[i][0]
  if s > x[i][1]:
    y = 1
    print("No")
    break
if y == 0:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
a = list(map(int,input().split()))

s = 0
j = 0
ans = 0
for i in range(n):
  while(s < k):
    if j == n:
      break
    else:
      s += a[j]
      j += 1
  if s < k:
    break
  ans += n-j+1
  s -= a[i]
print(ans)


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

if n < k:
  print(0)
else:
  print(10)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(range(n))
s = 0
for i in range(n):
  a[i] = int(input())
  s += a[i]

t = s  
for i in range(n):
  t_ = t
  t -= a[i]
  if abs(t) >= abs(t_):
    break
print(abs(t_))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
s = 0
for i in range(n):
  s += a[i]

b = []
t = s
for i in range(n-1):
  s -= a[i]
  b.append(abs(t-s*2))
print(min(b))
Buggy python submission (verdict: Runtime Error):
x = range(m)
y = range(m)
n, m = list(map(int, input().split()))
for i in range(m):
   x[i], y[i] = list(map(int, input().split()))

z = x.extend(y)
N = range(n)
for i in range(n):
    N[i] = z.count(i+1)

ans = 0
for i in range(n):
    ans = ans + N.count(i)/(2**i)
print(ans)


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

if s[k-1] == "A":
    s[k-1] = "a"
if s[k-1] == "B":
    s[k-1] = "b"
if s[k-1] == "C":
    s[k-1] = "c"
print("".join([str(i) for i in s]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))

for i in range(2,n+1):
    if h[n-i] < h[n-i+1]:
        ans = i - 1
        break
print("\n")
print(ans)

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

ans = 0
mx = h[0]
for i in range(n):
    if h[i] >= mx:
        ans = ans + 1
        mx = h[i]
print(ans)

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

for i in range(2,n+1):
    if h[n-i] < h[n-i+1]:
        ans = i - 1
        break
print(ans)

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

ans = 0
mx = h[0]
for i in range(n):
    if h[i] >= mx:
        ans = ans + 1
        mx = h[i]
print(ans)

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

for i in range(1,n):
    if h[n-i] < h[n-i+1]:
        ans = i
        break
print(ans)

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

ans = 0
mx = h[0]
for i in range(n):
    if h[i] >= mx:
        ans = ans + 1
        mx = h[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
n = input()
h = input().split()

for i in range(1,N):
    if h[N-i] < h[N-i+1]:
        ans = i
        break
print(ans)

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

ans = 0
mx = h[0]
for i in range(n):
    if h[i] >= mx:
        ans = ans + 1
        mx = h[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
cnt = {}
by = {}

for i in range(m):
  p, y = map(int, input().split())
  cnt[i] = [p, y]
  if p in by:
    s = by[p]
    s.append(y)
    s.sort()
    by[p] = s
  else:
    by[p] = [y]

for i in range(m):
  print(str(cnt[i][0]*1000000 + (list(by[cnt[i][0]]).index(cnt[i][1]))+1).zfill(12))

Fixed submission:
n, m = map(int, input().split())
cnt = {}
y_p = {}
ans = [1 for i in range(n)]
y_ = []

for i in range(m):
  p, y = map(int, input().split())
  y_.append(y)
  cnt[i] = [p, y]
  y_p[y] = p
y_.sort()

for i in y_:
  p = y_p[i]
  y_p[i] = ans[p-1]
  ans[p-1] += 1

for i in range(m):
  p = cnt[i][0]
  y = cnt[i][1]
  print(str(p*1000000 + y_p[y]).zfill(12))
Buggy python submission (verdict: Runtime Error):
h,w = map(int, input().split())
if max(h,w) >= 3:
  if h >= w :
    ans = w*min(1,(h%3))
  else:
    ans = h*min(1,(w%3))
if h%3 == 0:
  ans = 0
if w%3 == 0:
  ans = 0
if h != 1:  
  for i in range(1,h):
    ans_ = max(i*w,(h-i)*(w+(w%2))//2) - min(i*w,(h-i)*(w-(w%2))//2)
    ans = min(ans,ans_)
if w != 1:  
  for i in range(1,w):
    ans_ = max(i*h,(w-i)*(h+(h%2))//2) - min(i*h,(w-i)*(h-(h%2))//2)
    ans = min(ans,ans_)
print(ans)

Fixed submission:
h,w = map(int, input().split())
ans = 1000000000
if max(h,w) >= 3:
  if h >= w :
    ans = w*min(1,(h%3))
  else:
    ans = h*min(1,(w%3))
if h%3 == 0:
  ans = 0
if w%3 == 0:
  ans = 0
for i in range(1,h):
  ans_ = max(i*w,(h-i)*(w+(w%2))//2) - min(i*w,(h-i)*(w-(w%2))//2)
  ans = min(ans,ans_)
for i in range(1,w):
  ans_ = max(i*h,(w-i)*(h+(h%2))//2) - min(i*h,(w-i)*(h-(h%2))//2)
  ans = min(ans,ans_)
print(ans)

Buggy python submission (verdict: Runtime Error):
h,w = map(int, input().split())
if max(h,w) >= 3:
  if h >= w :
    ans = w*min(1,(h%3))
  else:
    ans = h*min(1,(w%3))
for i in range(1,h):
  ans_ = max(i*w,(h-i)*(w+(w%2))//2) - min(i*w,(h-i)*(w-(w%2))//2)
  ans = min(ans,ans_)
for i in range(1,w):
  ans_ = max(i*h,(w-i)*(h+(h%2))//2) - min(i*h,(w-i)*(h-(h%2))//2)
  ans = min(ans,ans_)
print(ans)

Fixed submission:
h,w = map(int, input().split())
ans = 1000000000
if max(h,w) >= 3:
  if h >= w :
    ans = w*min(1,(h%3))
  else:
    ans = h*min(1,(w%3))
if h%3 == 0:
  ans = 0
if w%3 == 0:
  ans = 0
for i in range(1,h):
  ans_ = max(i*w,(h-i)*(w+(w%2))//2) - min(i*w,(h-i)*(w-(w%2))//2)
  ans = min(ans,ans_)
for i in range(1,w):
  ans_ = max(i*h,(w-i)*(h+(h%2))//2) - min(i*h,(w-i)*(h-(h%2))//2)
  ans = min(ans,ans_)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
M=1
A.sort()
for j in A:
	M=M*j
	if M>10**18:
		M=-1
	if M ==0:
		M=0
		break
print(M)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
M=1
A.sort()
if A[0]==0:
	M=0
else:
	for j in A:
		M=M*j
		if M>10**18:
			M=-1
			break
print(M)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
M=1
for j in A:
	M=M*j
if M>10**18:
	M=-1
print(M)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
M=1
A.sort()
if A[0]==0:
	M=0
else:
	for j in A:
		M=M*j
		if M>10**18:
			M=-1
			break
print(M)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

import collections as clt
import math
import itertools as itt

v = []
for j in itt.product(range(1,K+1),repeat=3):
	v.append(list(j))
sum = 0

#print(v)

from functools import reduce

#def gvc(*numbers):
	#return reduce(math.gcd, numbers)
def gcd_list(numbers):
	return reduce(math.gcd, numbers)

for j in v:
	sum += gcd_list(j)
print(sum)

Fixed submission:
K = int(input())

import collections as clt
import math
import itertools as itt

sum = 0

#print(v)

from functools import reduce

#def gvc(*numbers):
	#return reduce(math.gcd, numbers)
def gcd_list(numbers):
	return reduce(math.gcd, numbers)

for j in itt.product(range(1,K+1),repeat=3):
	sum += gcd_list(j)
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

a = abs(N-K)

b = abs(a-K)

while a > b:
    a = b
    b = abs(b-K)

print(a)

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

a = N%K

b = abs(a-K)

while a > b:
    a = b
    b = abs(b-K)

print(a)

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

a = abs(N-K)

b = abs(a-K)

while a >= b:
    a = b
    b = abs(b-K)

print(a)

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

a = N%K

b = abs(a-K)

while a > b:
    a = b
    b = abs(b-K)

print(a)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(str, input().split()))
#print(A)
import collections as cl

def count_f(B:list):
	c = cl.Counter(B)
	c_sum = 0
	#print(c.keys())
	for i in c.keys():
		if c[i]>1:
			c_sum += c[i]*(c[i]-1)/2
	return print(int(c_sum))
	
B = []
for i in range(1,len(A)+1):
	B = A[:i-1]+A[i:]
	#print(B)
	#print(list_B)
	count_f(B)
	B = []

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

import collections as cl
c_A = cl.Counter(A)
sum_c_A=0
for i in c_A.keys():
	if c_A[i]>1:
		sum_c_A += c_A[i]*(c_A[i]-1)/2

for j in A:
	print(int(sum_c_A-c_A[j]+1))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(str, input().split()))
#print(A)
import collections as cl

def count_f(B:list):
	c = cl.Counter(B)
	c_sum = 0
	#print(c.keys())
	for i in c.keys():
		if c[i]>1:
			c_sum += c[i]*(c[i]-1)/2
	return print(int(c_sum))
	
B = []
for i in range(1,len(A)+1):
	B = A[:i-1]+A[i:]
	#print(B)
	#print(list_B)
	count_f(B)
	B = []

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

import collections as cl
c_A = cl.Counter(A)
sum_c_A=0
for i in c_A.keys():
	if c_A[i]>1:
		sum_c_A += c_A[i]*(c_A[i]-1)/2

for j in A:
	print(int(sum_c_A-c_A[j]+1))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
cnt = 0
from collections import Counter
B=A.Counter
if B.most_common[0][1] <= 1:
	print('YES')
else:
	print('NO')

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
cnt = 0
from collections import Counter
B=Counter(A)
C=B.most_common()
if C[0][1] <= 1:
	print('YES')
else:
	print('NO')

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
cnt = 0
from collections import Counter

if A.most_common[0][1] <= 1:
	print('YES')
else:
	print('NO')

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
cnt = 0
from collections import Counter
B=Counter(A)
C=B.most_common()
if C[0][1] <= 1:
	print('YES')
else:
	print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
cnt = 0
import collections

for i in A:
	if A.count(i)>1:
		cnt = 1
		break
if cnt == 0:
	print('YES')
else:
	print('NO')

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
cnt = 0
from collections import Counter
B=Counter(A)
C=B.most_common()
if C[0][1] <= 1:
	print('YES')
else:
	print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
cnt = 0
import math
for i in A[:len(A)]:
	for j in A[A.index(i)+1:]:
		if i == j:
			cnt = 1
			break
if cnt == 0:
	print('YES')
else:
	print('NO')

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
cnt = 0
from collections import Counter
B=Counter(A)
C=B.most_common()
if C[0][1] <= 1:
	print('YES')
else:
	print('NO')