Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
n,m=map(int,input().split())
uf=UnionFind(n)
for i in range(m):
  a,b=map(int,input().split())
  uf.union(a,b)
print(uf.group_count()-1)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
n,m=map(int,input().split())
uf=UnionFind(n)
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  uf.union(a,b)
print(uf.group_count()-1)
Buggy python submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

n,x,m=map(int,input().split())
s=set()
l=[]
flag=False
cnt=1
ans=0

l.append(x)
for i in range(m):
  if x not in s:
    s.add(x)
    x=(x**2)%m
    l.append(x)
  else:
    break

h=len(l)
cnt=1
num=0
for i in range(h):
  if l[i]==l[h-1]:
    while l[i+cnt]!=l[h-1]:
      cnt+=1
    flag=True
    break
  else:
    num+=1
    ans+=l[i]

n-=num
if num!=0:
  del l[h-1]
  del l[0:num]

if n>=len(l):
  mod=n%len(l)
  ans+=sum(l)*(n//len(l))
  for i in range(1,mod):
    ans+=l[i-1]
  print(ans)
else:
  for i in range(n):
    ans+=l[i]
  print(ans)

Fixed submission:
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7
s=str(input())
if s[len(s)-1]=='s':
  print(s+'es')
else:
  print(s+'s')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

n=int(input())
cnt=0
for i in range(1,n+1):
  for j in range(1,n+1):
    if i*j<n:
      cnt+=1
    else:
      break


print(cnt)

Fixed submission:
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

n=int(input())
cnt=0
for i in range(1,n+1):
  for j in range(i+1,n+1):
    if i*j<n:
      cnt+=2
    else:
      break
      
for j in range(1,n+1):
  if j*j<n:
    cnt+=1

print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print(mac(max(a*c,a*d),max(b*c,b*d)))

Fixed submission:
a,b,c,d=map(int,input().split())
print(max(max(a*c,a*d),max(b*c,b*d)))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=0
while n>0:
  s=s+n%10
  n=n//10
if s%9==0:
  print("Yes")
else:
  print("No")

Fixed submission:
n=input()
a=list(map(int,n))
x=sum(a)%9
if x==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
x,k,d=map(int, input().split())

if x==0:
  if d%2==0:
    print(0)
  else:
    print(d)

elif x>0:
  if x-d*k<=0:
    a=x%d
    b=x%d-d
    if ((x-x%d)//d)%2==k%2:
      print(a)
    else:
      print(-1*b)
  else:
    print(x-d*k)

else: #x<0
  if x+kd>=0:
    a=-1*((-1*x)%d)
    b=a+d
    if ((a-x)//d)%2==k%2:
      print(-1*a)
    else:
      print(b)
  else:
    print(x+k*d)

Fixed submission:
x,k,d=map(int, input().split())
if x<0:
  x=-1*x

if x==0:
  if k%2==0:
    print(0)
  else:
    print(d)

else:
  if x-d*k<0:
    a=x%d
    b=x%d-d
    if ((x-x%d)//d)%2==k%2:
      print(a)
    else:
      print(-1*b)
  else:
    print(x-d*k)
Buggy python submission (verdict: Runtime Error):
int(input(n))
print(n%1000)

Fixed submission:
n=int(input())
print((1000-n%1000)%1000)
Buggy python submission (verdict: Runtime Error):
n=int(input())
ac, wa, tle, re=0, 0, 0, 0
for i in range(n):
  str=input(str())
  if str=='AC':
    ac=ac+1
  elif str=='WA':
    wa=wa+1
  elif str=='TLE':
    tle=tle+1
  elif str=='RE':
    re=re+1

print('AC x ', ac)
print('WA x ', wa)
print('TLE x ', tle)
print('RE x ', re)

Fixed submission:
n=int(input())
ac, wa, tle, re=0, 0, 0, 0
for i in range(n):
  s=input(str())
  if s=='AC':
    ac=ac+1
  elif s=='WA':
    wa=wa+1
  elif s=='TLE':
    tle=tle+1
  elif s=='RE':
    re=re+1

print('AC x ', ac)
print('WA x ', wa)
print('TLE x ', tle)
print('RE x ', re)

Buggy python submission (verdict: Runtime Error):
n=int(input())
ac, wa, tle, re=0, 0, 0, 0
for i in range(n):
  str=input(str())
  if str=='AC':
    ac++
  elif str=='WA':
    wa++
  elif str=='TLE':
    tle++
  elif str=='RE':
    re++

print('AC x ', ac)
print('WA x ', wa)
print('TLE x ', tle)
print('RE x ', re)

Fixed submission:
n=int(input())
ac, wa, tle, re=0, 0, 0, 0
for i in range(n):
  s=input(str())
  if s=='AC':
    ac=ac+1
  elif s=='WA':
    wa=wa+1
  elif s=='TLE':
    tle=tle+1
  elif s=='RE':
    re=re+1

print('AC x ', ac)
print('WA x ', wa)
print('TLE x ', tle)
print('RE x ', re)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=list(map(int,input().split()))

for i in range(m):
  a.sort()
  a[n-1]=a[n-1]//2
  
print(sum(a))

Fixed submission:
import heapq

n,m=map(int,input().split())
a=list(map(lambda x:int(x)*(-1),input().split()))
heapq.heapify(a)

for i in range(m):
  top=heapq.heappop(a)
  heapq.heappush(a,(-1)*(-top//2))
  
print(-sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
m,m2=-1,-1
for i in range(n):
  b=int(input())
  a.append(b)
  m2=max(m2,min(m,b))
  m=max(m,b)

if m==m2:
  for i in range(n):
    print(m)
else:
  for i in range(n):
    if a.index(m)==i:
      print(m2)
    else:
      print(m)

Fixed submission:
n=int(input())
a=[]
m,m2=-1,-1
  
for i in range(n):
  b=int(input())
  a.append(b)
  m2=max(m2,min(m,b))
  m=max(m,b)

if m==m2:
  for i in range(n):
    print(m)
else:
  l=[m]*n
  l[a.index(m)]=m2
  for i in range(n):
    print(l[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(n):
  b=int(input())
  a.append(b)
c=a
c=sorted(c)
m=c[n-1]
m2=c[n-2]

if m==m2:
  for i in range(n):
    print(m)
else:
  for i in range(n):
    if a.index(m)==i:
      print(m2)
    else:
      print(m)

Fixed submission:
n=int(input())
a=[]
m,m2=-1,-1
  
for i in range(n):
  b=int(input())
  a.append(b)
  m2=max(m2,min(m,b))
  m=max(m,b)

if m==m2:
  for i in range(n):
    print(m)
else:
  l=[m]*n
  l[a.index(m)]=m2
  for i in range(n):
    print(l[i])
Buggy python submission (verdict: Runtime Error):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,k=map(int, input().split())
for i in range(1,k+1):
  print(comb(n-k+1,i)*comb(k-1,i-1)%(10**9+7))

Fixed submission:
import math
def comb(n, r):
  if n-r>=0:
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  else:
    return 0

n,k=map(int, input().split())
for i in range(1,k+1):
  print(comb(n-k+1,i)*comb(k-1,i-1)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
n=int(input())

l=[]
for i in range(n):
  a,b=map(str, input().split())
  b=100-int(b)
  if b<10:
    b=str('0')+str(b)
  elif b==100:
    b=="999"
  else:
    b=str(b)
  a=a+b
  l.append(a)

l2=sorted(l)

for i in range(n):
  print(l.index(l2[i])+1)

Fixed submission:
n=int(input())

l=[]
for i in range(n):
  a,b=map(str, input().split())
  b=100-int(b)
  if b<10:
    b=str('0')+str(b)
  elif b==100:
    b="999"
  else:
    b=str(b)
  a=a+b
  l.append(a)

l2=sorted(l)

for i in range(n):
  print(l.index(l2[i])+1)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int, input().split())
s=set(range(1, n+1)) #1~nのset
for i in range(m):
  l,r=map(int, input().split())
  s= s & set(range(l, r+1))
print(len(s))

Fixed submission:
n,m=map(int, input().split())
lmax=0
rmin=1000000
for i in range(m):
  l,r=map(int, input().split())
  lmax=max(l, lmax)
  rmin=min(r, rmin)

if rmin-lmax>=0:
  print(rmin-lmax+1)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int, input().split())
A=list(map(int, input().split()))
for i in range(m):
  A.sort()
  b,c=map(int, input().split())
  j=0
  while j<=b-1 and A[j]<c:
    A[j]=c
    j=j+1

print(sum(A))

Fixed submission:
n,m=map(int, input().split())
A=[]
a=list(map(int, input().split()))
for i in  range(n):
  A.append([a[i], 1])
  
l=[]
for i in range(m):
  b,c=map(int, input().split())
  l.append([c,b])

A.extend(l)
A.sort()
A.reverse()
B=[]

j=0
cnt=-1
while cnt<n:
  B.extend([A[j][0]]*A[j][1])
  cnt=cnt+A[j][1]
  if cnt>=n:
    del B[n:]
  j=j+1

print(sum(B))
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
s=str(input())
if s[b]=="A":
  s[b]=="a"
if s[b]=="B":
  s[b]=="b"
if s[b]=="C":
  s[b]=="c"
print(s)

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

ans=0
while x[i]>0:
  ans+=x[i]
  
print(ans)

Fixed submission:
n=int(input())
v=list(map(int, input().split()))
c=list(map(int, input().split()))
x=[]
for i in range(n):
  if v[i]-c[i]>0:
    x.append(v[i]-c[i])

print(sum(x))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input())
cnt=1
for i in range(n-1):
  b=int(input())
  if a<=b:
    cnt++
    a=b

print(cnt)

Fixed submission:
n=int(input())
l=list(map(int, input().split()))
cnt=0
a=l[0]
for i in range(n):
  if a<=l[i]:
    cnt=cnt+1
    a=l[i]

print(cnt)
Buggy python submission (verdict: Runtime Error):
a=[]
b=[]
ori=[]
ans=0
for i in range(5):
  c=int(input())
  ori.append(c)
  a.append((c//10+1)*10)
  
  if c%10==0:
    b.append(100)
  else:
    b.append(c%10)
a.pop(b.index(min(b)))
print(ori[b.index(min(b))]+a.sum())

Fixed submission:
a=[]
b=[]
ori=[]
ans=0
for i in range(5):
  c=int(input())
  ori.append(c)
  if c%10!=0:
    a.append((c//10+1)*10)
  else:
    a.append(c)
  
  if c%10==0:
    b.append(100)
  else:
    b.append(c%10)
a.pop(b.index(min(b)))
print(ori[b.index(min(b))]+sum(a))
Buggy python submission (verdict: Runtime Error):
s=str(input())
ans=0
cnt=0
for i in range(len(s)):
  if s[i]=='A' or 'G' or 'C' or 'T':
    cnt++
  else:
    ans=max(ans, cnt)
    cnt=0
print(ans)

Fixed submission:
s=str(input())
ans=0
cnt=0

for i in range(len(s)):
  
  if s[i]=="A" or s[i]== "G" or s[i]== "C" or s[i]== "T":
    cnt=cnt+1
    ans=max(ans, cnt)
    
  else:
    cnt=0
    
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int, input().split())
for i in 1, 2, ..., min(a,b):
  if a%i==0 and b%i==0:
    k=k-1
  if k==0:
    print(i)
    break


Fixed submission:
a,b,k=map(int, input().split())
for i in reversed(range(1,min(a,b)+1)):
  if a%i==0 and b%i==0 :
    k=k-1
  if k==0:
    print(i)
    break

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int, input().split())
for i in range(min(a,b)):
  if a%i==0 and b%i==0:
    k=k-1
  if k==0:
    print(i)
    break

Fixed submission:
a,b,k=map(int, input().split())
for i in reversed(range(1,min(a,b)+1)):
  if a%i==0 and b%i==0 :
    k=k-1
  if k==0:
    print(i)
    break
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=0
for i in range(n):
  x, u=map(int, str, input().split())
  if u=="BTC":
    x=x*380000
  ans=ans+x
print(ans)

Fixed submission:
n=int(input())
ans=0
for i in range(n):
  x,u=input().split()
  x=float(x)
  if u=="BTC":
    x=x*380000
  ans=ans+x
print(ans)
Buggy python submission (verdict: Runtime Error):
y=int(input())
if y==7 or y==5 0r y==3:
  print("YES")
else:
  print("NO")

Fixed submission:
y=int(input())
if y==7 or y==5 or y==3:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
x=str(input())
a[0]=x
d=bool(True)
for i in range(1, n):
  y=str(input)
  if x[len(x)]!=y[0]:
    d=False
  for i in range(a.size()):
    if y==a[i]:
      d=False
  a.append(y)

if  d:
  print("Yes")
else:
  print("No")

Fixed submission:
n=int(input())
a=[]
x=str(input())
a.append(x)
d=bool(True)

for i in range(1, n):
  y=str(input())
  if x[len(x)-1]!=y[0]:
    d=False
    
  for j in range(len(a)):
    if y==a[j]:
      d=False
  a.append(y)
  x=y

if  d==True:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a,reverse=True)
s = sum(a)
x = [0]*n
y = 0
for i in range(n):
    y = int(a[i]/s*k)
    x[i] = [i, (a[i]/s*k)%1, y]

x.sort(key= lambda val : val[1],reverse=True)
for i in range(k-y):
    x[i][2] += 1
ans = 0
z = 0
for i in range(n):
    ans = max(ans, a[x[i][0]-1]/(x[i][2]+1))
    z += x[i][2]
print(int(-(-ans//1)))

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
s = sum(a)
x = [0]*n
y = 0
r = 0
for i in range(n):
    y = int(a[i]/s*k)
    x[i] = [i, y, a[i]/(y+1), a[i]]
    r += y
x.sort(key= lambda val : val[2],reverse=True)
for i in range(k-r):
    x[i][1] += 1
ans = 0
for i in range(n):
    ans = max(ans, x[i][3]/(x[i][1]+1))
print(int(-(-ans//1)))
Buggy python submission (verdict: Time Limit Exceeded):
def det(x,y,n):
    return (x+y)**2 - 4*(x**2 + y**2 + x*y - n)
def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

n = int(input())

for i in range(1, n+1):
    ans = 0
    for x in range(1,int(pow(n,0.5))+2):
        for y in range(1,int(pow(n,0.5))+2):
            D = det(x,y,i)
            #if x == 1 and y == 1:
                #print(D)
            if D >= 0 and is_integer_num(pow(D,0.5)):
                if -(x+y) + pow(D,0.5) > 0:
                    ans += 1
    print(ans)

Fixed submission:
n = int(input())
ans = [0]*(n+1)
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            
            a = i**2 + j**2 + k**2 + i*j + j*k + k*i
            
            if a < n+1:
                ans[a] += 1
for i in range(1,n+1):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
def score(c,s,t,lis):
    ans = 0
    ans += s[t-1]
    lis[t-1] = 0
    for j in range(26):
        if t-1 != j:
            lis[j] += 1
            ans -= lis[j]*c[j] 
    return ans,lis

d = int(input())
c = list(map(int,input().split()))
s = [0]*d
for i in range(d):
    s[i] = list(map(int,input().split()))
lis = [0]*26
for i in range(d):
    ans = 0
    z = 0
    L = lis
    q = 0
    for j in range(26):
        y,p = score(c,s[i],j,L)
        if ans < y:
            ans = y
            z = j
            q = p
    print(z+1)
    lis = q


Fixed submission:
import numpy
d = int(input())
c = list(map(int,input().split()))
s = [0]*d
for i in range(d):
    s[i] = list(map(int,input().split()))
for i in range(d):
    max_index = numpy.argmax(s[i])
    print(max_index+1)

Buggy python submission (verdict: Time Limit Exceeded):
def score(d,c,s,t):
    ans = 0
    lis = [[0 for j in range(26)] for i in range(d+1)]
    zero = [[] for i in range(26)]
    for i in range(min(d,len(t))):
        ans += s[i][t[i]-1]
        lis[i+1][t[i]-1] = 0
        zero[t[i]-1].append(i+1)
        for j in range(26):
            if t[i]-1 != j:
                lis[i+1][j] = lis[i][j] + 1
                ans -= lis[i+1][j]*c[j] 
    return ans
d = int(input())
c = list(map(int,input().split()))
s = [0]*d
for i in range(d):
    s[i] = list(map(int,input().split()))
t = []
for i in range(d):
    ans = 0
    z = 0
    for j in range(26):
        x = t + [j]
        y = score(d,c,s,x)
        if ans < y:
            ans = y
            z = j
    print(z+1)
    t.append(z)

Fixed submission:
import numpy
d = int(input())
c = list(map(int,input().split()))
s = [0]*d
for i in range(d):
    s[i] = list(map(int,input().split()))
for i in range(d):
    max_index = numpy.argmax(s[i])
    print(max_index+1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dp = [0]*(n+1)
for i in range(2,n+1):
    j = 2
    while 1:
        if i*j <= n:
            dp[i*j] += 1
        else:
            break
        j += 1
ans = 0
for i in range(2,n+1):
    ans += i*dp[i]
print(ans+n*(n+1)-1)

Fixed submission:
n = int(input())
dp = [0]*(n+1)
for i in range(2,n+1):
    j = 2
    while 1:
        if i*j <= n:
            dp[i*j] += 1
        else:
            break
        j += 1
ans = 0
for i in range(2,n+1):
    ans += i*dp[i]
print(ans+n*(n+1)-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = []

s == 0
while 1:
    if s == 1 and n < 1:
        break
    s = 1
    if n%26 == 0:
        ans.append(0)
    else:
        ans.append(n%26)
    n -= n%26
    n = n//26
for i in range(len(ans)):
    if i != len(ans)-1:
        if ans[i] <= 0:
            ans[i+1] -= 1
            ans[i] += 26
    else:
        if ans[i] <= 0:
            del ans[i]
ans = ans[::-1]
for i in range(len(ans)):
    print(chr(96+ans[i]),end="")
print("")

Fixed submission:
n = int(input())
ans = []

s = 0
while 1:
    if s == 1 and n < 1:
        break
    s = 1
    if n%26 == 0:
        ans.append(0)
    else:
        ans.append(n%26)
    n -= n%26
    n = n//26
for i in range(len(ans)):
    if i != len(ans)-1:
        if ans[i] <= 0:
            ans[i+1] -= 1
            ans[i] += 26
    else:
        if ans[i] <= 0:
            del ans[i]
ans = ans[::-1]
for i in range(len(ans)):
    print(chr(96+ans[i]),end="")
print("")
Buggy python submission (verdict: Time Limit Exceeded):
def right(a,n):
    sw = [0]*(n+1)
    for x,y in enumerate(a):
        x_min = max(0,x-y)
        x_max = min(n,x+y+1)
        sw[x_min] += 1
        sw[x_max] -= 1
    s = 0
    for i in range(n):
        s += sw[i]
        a[i] = s
    return a

n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(min(k,50)):
    a = right(a,n)
a = [str(n) for n in a]
print(" ".join(a))

Fixed submission:
def right(a,n):
    sw = [0]*(n+1)
    for x,y in enumerate(a):
        x_min = max(0,x-y)
        x_max = min(n,x+y+1)
        sw[x_min] += 1
        sw[x_max] -= 1
    s = 0
    for i in range(n):
        s += sw[i]
        a[i] = s
    return a

n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(min(k,50)):
    a = right(a,n)
a = [str(n) for n in a]
print(" ".join(a))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = 1
sw = 0
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        sw = 1
import collections
c = collections.Counter(a)

if sw == 1 and c[0] == 0:
    ans = -1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = 1
sw = 0
import collections
c = collections.Counter(a)
if c[0] != 0:
    ans = 0
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        ans = -1
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
a,b = map(float,input().split())
 
c = np.array([a],dtype='f16')
d = np.array([b],dtype='f16')
e = np.array([],dtype='f16')
e = c*d
print(int(e))

Fixed submission:
a,b = map(str,input().split())
from decimal import Decimal
print(int(Decimal(a)*Decimal(b)))
Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())

x = [1]*a+[0]*b+[-1]*c
print(sum(x[:k]))

Fixed submission:
a,b,c,k = map(int,input().split())
if a>k:
    print(k)
elif a+b >= k:
    print(a)
else:
    print(a-(k-a-b))
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
d = [0]*n
a = [0]*n
s = []
for i in range(k):
    d[i] = int(input())
    a[i] = list(map(int,input().split()))
    s.extend(a[i])
d = set(s)

print(n-len(d))

Fixed submission:
n,k = map(int,input().split())
d = [0]*k
a = [0]*k
s = []
for i in range(k):
    d[i] = int(input())
    a[i] = list(map(int,input().split()))
    s.extend(a[i])
d = set(s)
print(n-len(d))
Buggy python submission (verdict: Runtime Error):
a = [0]*m
b = [0]*m
t = []
y = []
for i in range(m):
    a[i],b[i] = map(int,input().split())
    c = str(a[i])+" "+str(b[i])
    y.append(c)
t.extend(a)
t.extend(b)
s = [0]*m
count = 0
sw = [0]*n
ab = list(y)
for i in range(m):
    a[i],b[i] = ab[i].split()
    a[i] = int(a[i])
    b[i] = int(b[i])
    if  h[a[i]-1] >= h[b[i]-1] and sw[a[i]-1] == 0:
        if sw[b[i]-1] == 1 or sw[a[i]-1] == 1:
            count -= 1
        count += 1
        sw[a[i]-1] = 1
    elif h[a[i]-1] < h[b[i]-1] and sw[b[i]-1] == 0:
        if sw[a[i]-1] == 1 or sw[b[i]-1] == 1:
            count -= 1
        count += 1
        sw[b[i]-1] = 1
print(count+n-len(set(t)))

Fixed submission:
n,m = map(int,input().split())
h = list(map(int,input().split()))
a = [0]*m
b = [0]*m
for i in range(m):
    a[i],b[i] = map(int,input().split())
sw = [1]*n
for i in range(m):
    if h[a[i]-1] > h[b[i]-1]:
        sw[b[i]-1] = 0
    elif h[a[i]-1] < h[b[i]-1]:
        sw[a[i]-1] = 0
    else:
        sw[a[i]-1] = 0
        sw[b[i]-1] = 0
print(sw.count(1))