Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from collections import Counter
import collections
a = list(map(int,input().split()))
b = list(map(int,input().split()))
#値を大きさ順に並べる
b = sorted(b)
l = Counter(b)
#dに大きさ順に出てきた数を入れる
d = np.array([])
d = np.append(d,list(l.values()))
c = np.array([])
c = np.append(c,list(l.elements()))
c = list(c)
c =sorted(set(c), key=c.index)
#cに要素を大きさ順にかぶらず入れる
e = [d[i]-c[i] if d[i] - c[i]>=0 else d[i] for i in range(len(c))]
print(int(sum(e)))

Fixed submission:
import numpy as np
from collections import Counter
import collections
a = list(map(int,input().split()))
b = list(map(int,input().split()))
#値を大きさ順に並べる
b = sorted(b)
l = Counter(b)
Num = 0
for k,v in l.items():
  if v-k>=0 :
  	Num += v-k
  else:
    Num += v 
print(Num)
Buggy python submission (verdict: Runtime Error):
import numpy as np
a = list(map(int,input().split()))
N = a[0]
K = a[1]
b = list(map(int,input().split()))
li = list(set(b))
c = np.array(b)
d = np.array([])
h = len(li) -K
Num = 0
if K >= len(li):
  print(0)
  exit()
for i in li :
  ind = np.take(c,np.where( c== i),axis = 0)
  d = np.append(d,ind.shape)
d = np.sort(d)
print(d)
for i in range(h):
  Num += d[i]
print(int(Num))

Fixed submission:
l = list(input())
n=0
for i in l :
  if int(i)==1:
    n += 1
print(n)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = list(input())
a = list(map(int,input().split()))

for i in range(1,30):
  b = np.array([n/2 if n%2==0 else 0 for n in a])
  a = b
  if 0 in list(b):
    print(i-1)
    exit()

Fixed submission:
l = list(input())
n=0
for i in l :
  if int(i)==1:
    n += 1
print(n)

Buggy python submission (verdict: Runtime Error):
l = list(input())
n=0
for int(i) in l :
  if int(i)==1:
    print(i)
    n += 1
print(n)

Fixed submission:
l = list(input())
n=0
for i in l :
  if int(i)==1:
    n += 1
print(n)
Buggy python submission (verdict: Runtime Error):
    import numpy as np
    N = list(input())
    a = list(map(int,input().split()))
     
    for i in range(1,10):
      b = np.array([n/2 if n%2==0 else 0 for n in a])
      a = b
      if 0 in list(b):
        print(i-1)
        exit()

Fixed submission:
import numpy as np
N = list(input())
a = list(map(int,input().split()))

for i in range(1,31):
  b = np.array([n/2 if n%2==0 else 0 for n in a])
  a = b
  if 0 in list(b):
    print(i-1)
    exit()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
a = list(map(int,input().split()))
N = a[0]
K = a[1]
b = list(map(int,input().split()))
li = list(set(b))
c = np.array(b)
d = np.array([])
h = len(li) -K
Num = 0
if K >= len(li):
  print(0)
  exit()
for i in li :
  ind = np.take(c,np.where( c== i),axis = 0)
  d = np.append(d,ind.shape[1])
d = np.sort(d)
for i in range(h):
  Num += d[i]
print(int(Num))

Fixed submission:
import numpy as np
from collections import Counter
import collections
a = list(map(int,input().split()))
N = a[0]
K = a[1]
d = np.array([])
b = list(map(int,input().split()))
li = list(set(b))
c = np.array(b)
l = Counter(b)
h = len(li) -K
Num = 0
if K >= len(li):
  print(0)
  exit()
d = np.append(d,list(l.values()))
d = np.sort(d)
for i in range(h):
  Num += d[i]
print(int(Num))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
a = list(map(int,input().split()))
N = a[0]
K = a[1]
b = list(map(int,input().split()))
li = list(set(b))
c = np.array(b)
d = np.array([])
h = len(li) -K
Num = 0
if K >= len(li):
  print(0)
  exit()
for i in li :
  ind = c[np.where(c== i)]
  d = np.append(d,ind.shape)
d = np.sort(d)
print(int(np.sum(d[:h])))

Fixed submission:
import numpy as np
from collections import Counter
import collections
a = list(map(int,input().split()))
N = a[0]
K = a[1]
d = np.array([])
b = list(map(int,input().split()))
li = list(set(b))
c = np.array(b)
l = Counter(b)
h = len(li) -K
Num = 0
if K >= len(li):
  print(0)
  exit()
d = np.append(d,list(l.values()))
d = np.sort(d)
for i in range(h):
  Num += d[i]
print(int(Num))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
a = list(map(int,input().split()))
N = a[0]
K = a[1]
b = list(map(int,input().split()))
li = list(set(b))
c = np.array(b)
d = np.array([])
h = len(li) -K
Num = 0
if K >= len(li):
  print(0)
  exit()
for i in li :
  ind = c[np.where(c== i)]
  d = np.append(d,ind.shape)
d = np.sort(d)
for i in range(h):
  Num += d[i]
print(int(Num))

Fixed submission:
import numpy as np
from collections import Counter
import collections
a = list(map(int,input().split()))
N = a[0]
K = a[1]
d = np.array([])
b = list(map(int,input().split()))
li = list(set(b))
c = np.array(b)
l = Counter(b)
h = len(li) -K
Num = 0
if K >= len(li):
  print(0)
  exit()
d = np.append(d,list(l.values()))
d = np.sort(d)
for i in range(h):
  Num += d[i]
print(int(Num))
Buggy python submission (verdict: Runtime Error):
import sys
from itertools import accumulate
input = sys.stdin.readline
def inputs():return [int(x) for x in input().split()]
N,C = inputs()
stc = [inputs() for i in range(N)]
ans = [0]*(10**5+1)
for i in range(N):
    s,t,c, = stc[i]
    ans[s]+=1
    ans[t+1]-=1
ans = list(accumulate(ans))
print(max(ans))

Fixed submission:
import sys
from itertools import accumulate
input = sys.stdin.readline
def inputs():return [int(x) for x in input().split()]
N,C = inputs()
stc = [inputs() for i in range(N)]
stc = sorted(stc,key=lambda x:x[1])
stc = sorted(stc,key=lambda x:x[2])
ans = [0]*(10**5+2)
for i in range(N):
    s,t,c, = stc[i]
    if i>0 and c==stc[i-1][2] and s==stc[i-1][1]:
      ans[s+1]+=1
      ans[t+1]-=1
      continue
    ans[s]+=1
    ans[t+1]-=1
ans = list(accumulate(ans))
print(max(ans))
Buggy python submission (verdict: Runtime Error):
X,Y = [input().split()]
if X>Y:
  print(">")
elif X<Y:
  print("<")
else:
  print("=")

Fixed submission:
X,Y = input().split()
if X>Y:
  print(">")
elif X<Y:
  print("<")
else:
  print("=")
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
s2= list(s)
if s2==s2[::-1]:
  print(0)
  exit()
s1 = []
le = []
lex = []
cnt= 0
for i in list(s):
  if i!="x":
    le.append(cnt)
    s1.append(i)
  else:
    lex.append(cnt)
  cnt+=1
if s1!=s1[::-1]:
  print(-1)
  exit()
ans = []
res=0
if len(le)%2==1:
  midlle=le[len(le)//2]
  for i in lex:
    if not i-midlle in ans:
      res+=1
      ans.append(abs(i-midlle))
    else:
      res-=1
  print(res)
else:
  midlle=(le[len(le)//2]+le[len(le)//2-1])//2
  for i in lex:
    if not i-midlle in ans:
      if i-midlle==0:
        continue
      res+=1
      ans.append(abs(i-midlle))
    else:
      res-=1
  print(res)

Fixed submission:
s = list(input())
s1=s[::-1]
ans = 0
cnt = 0
cnt1 = 0
while cnt<len(s) and cnt1<len(s) and cnt<=len(s)-1-cnt1:
  if s[cnt]!=s1[cnt1]:
    if s[cnt]=="x" and s1[cnt1]!="x":
      cnt+=1
      ans+=1
    elif s1[cnt1]=="x" and s[cnt]!="x":
      cnt1+=1
      ans+=1
    elif s[cnt]!="x" and s1[cnt1]!="x":
      print(-1)
      exit()
  elif s[cnt]==s1[cnt1]:
    cnt+=1
    cnt1+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
s = input()
s1 = []
le = []
lex = []
cnt= 0
for i in list(s):
  if i!="x":
    le.append(cnt)
    s1.append(i)
  else:
    lex.append(cnt)
  cnt+=1
if s1!=s1[::-1]:
  print(-1)
  exit()
midlle=le[len(le)//2]
ans =[]
for i in lex:
  ans.append(abs(i-midlle))
ans = list(set(ans))
print(len(ans))

Fixed submission:
s = list(input())
s1=s[::-1]
ans = 0
cnt = 0
cnt1 = 0
while cnt<len(s) and cnt1<len(s) and cnt<=len(s)-1-cnt1:
  if s[cnt]!=s1[cnt1]:
    if s[cnt]=="x" and s1[cnt1]!="x":
      cnt+=1
      ans+=1
    elif s1[cnt1]=="x" and s[cnt]!="x":
      cnt1+=1
      ans+=1
    elif s[cnt]!="x" and s1[cnt1]!="x":
      print(-1)
      exit()
  elif s[cnt]==s1[cnt1]:
    cnt+=1
    cnt1+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
s = input()
s1 = []
le = []
cnt= 0
for i in list(s):
  if i!="x":
    le.append(cnt)
    s1.append(i)
  cnt+=1
if s1!=s1[::-1]:
  print(-1)
  exit()
print(le[len(le)//2])

Fixed submission:
s = list(input())
s1=s[::-1]
ans = 0
cnt = 0
cnt1 = 0
while cnt<len(s) and cnt1<len(s) and cnt<=len(s)-1-cnt1:
  if s[cnt]!=s1[cnt1]:
    if s[cnt]=="x" and s1[cnt1]!="x":
      cnt+=1
      ans+=1
    elif s1[cnt1]=="x" and s[cnt]!="x":
      cnt1+=1
      ans+=1
    elif s[cnt]!="x" and s1[cnt1]!="x":
      print(-1)
      exit()
  elif s[cnt]==s1[cnt1]:
    cnt+=1
    cnt1+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

l = map(int, input().split())
if l[0]==l[1]:
	print(l[2])
elif l[0] ==l[2]:
	print(l[1])
elif l[1] ==l[2]:
	print(l[0])

Fixed submission:
l = list(map(int, input().split()))
if l[0]==l[1]:
	print(l[2])
elif l[0] ==l[2]:
	print(l[1])
elif l[1] ==l[2]:
	print(l[0])

Buggy python submission (verdict: Runtime Error):
import numpy as np

l = map(int, raw_input().split())
if l[0]==l[1]:
	print(l[2])
elif l[0] ==l[2]:
	print(l[1])
elif l[1] ==l[2]:
	print(l[0])

Fixed submission:
l = list(map(int, input().split()))
if l[0]==l[1]:
	print(l[2])
elif l[0] ==l[2]:
	print(l[1])
elif l[1] ==l[2]:
	print(l[0])

Buggy python submission (verdict: Runtime Error):
import numpy as np

l = map(int, raw_input().split())
if l[0]==l[1]:
  print(l[2])
elif l[0] ==l[2]:
  print(l[1])
elif l[1] ==l[2]:
  print(l[0])

Fixed submission:
l = list(map(int, input().split()))
if l[0]==l[1]:
	print(l[2])
elif l[0] ==l[2]:
	print(l[1])
elif l[1] ==l[2]:
	print(l[0])
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
def inputs():return [int(x) for x in input().split()]
N,K = inputs()
xy = [inputs() for _ in range(N)]
#xy = sorted(xy,key=lambda x: x[1])
xy = sorted(xy,key=lambda x: x[0])
#print(xy)
ans = 10**20
for i in range(N-K+1):
  for j in range(i+K-1,N):
    #print(i,j)
    xy1 = xy[i:j+1]
    #print(xy1)
    xy1 = sorted(xy1,key=lambda x: x[1])
    mi = min(xy1[i+K-1]-xy1[i] for i in range(len(xy1)-K+1))
    ans = min(ans,(xy[j][0]-xy[i][0])*mi)
print(ans)
    
    

Fixed submission:
import sys
input = sys.stdin.readline
def inputs():return [int(x) for x in input().split()]
N,K = inputs()
xy = [inputs() for _ in range(N)]
#xy = sorted(xy,key=lambda x: x[1])
xy = sorted(xy,key=lambda x: x[0])
#print(xy)
ans = 10**20
for i in range(N-K+1):
  for j in range(i+K-1,N):
    #print(i,j)
    xy1 = xy[i:j+1]
    #print(xy1)
    xy1 = sorted(xy1,key=lambda x: x[1])
    mi = min(xy1[i+K-1][1]-xy1[i][1] for i in range(len(xy1)-K+1))
    ans = min(ans,(xy[j][0]-xy[i][0])*mi)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#import numpy as np
#from scipy.sparse.csgraph import floyd_warshall,csgraph_from_dense
#from scipy.sparse import csr_matrix
import sys
input = sys.stdin.readline
def inputs():return [int(x) for x in input().split()]
N= int(input())
dist_mat=[inputs() for _ in range(N)]
ans=0
for i in range(N):
  for j in range(N):
    for k in range(N):
      if dist_mat[j][k]==dist_mat[j][i]+dist_mat[i][k] and dist_mat[j][i]>0 and dist_mat[i][k]>0:
        #ans+=dist_mat[j][k]
        dist_mat[j][k]=0
      elif dist_mat[j][k]>dist_mat[j][i]+dist_mat[i][k] and dist_mat[j][i]>0 and dist_mat[i][k]>0:
        print(-1)
        exit()
for i in range(N):
  for j in range(N):
    ans +=dist_mat[i][j]
print(ans//2)
#print(ans//2)



Fixed submission:
#import numpy as np
#from scipy.sparse.csgraph import floyd_warshall,csgraph_from_dense
#from scipy.sparse import csr_matrix
import sys
input = sys.stdin.readline
def inputs():return [int(x) for x in input().split()]
N= int(input())
dist_mat=[inputs() for _ in range(N)]
ans=0
for i in range(N):
  for j in range(N):
    for k in range(N):
      if dist_mat[j][k]==dist_mat[j][i]+dist_mat[i][k] and dist_mat[j][i]>0 and dist_mat[i][k]>0:
        #ans+=dist_mat[j][k]
        dist_mat[j][k]=0
      elif dist_mat[j][k]>dist_mat[j][i]+dist_mat[i][k] and dist_mat[j][i]>0 and dist_mat[i][k]>0:
        print(-1)
        exit()
for i in range(N):
  for j in range(N):
    ans +=dist_mat[i][j]
print(ans//2)
#print(ans//2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
graph=[[float("INF")]*(N+1) for _ in range(N+1)]
E ={i:[] for i in range(N+1)}
for i in range(N-1):
  a,b,c = [int(x) for x in input().split()]
  E[a].append([b,c])
  E[b].append([a,c])
Q,K = [int(x) for x in input().split()]
cost= [0]*(N+1)
stk=[[K,-1,0]]
while stk:
  v,p,c = stk.pop()
  if cost[v]!=0:
    continue
  cost[v]=c
  for i,j in E[v]:
    if i!=p:
      stk.append([i,v,c+j])
for i in range(Q):
  a,b = [int(x) for x in input().split()]
  print(cost[a]+cost[b])

Fixed submission:
N = int(input())
E ={i:[] for i in range(N+1)}
for i in range(N-1):
  a,b,c = [int(x) for x in input().split()]
  E[a].append([b,c])
  E[b].append([a,c])
Q,K = [int(x) for x in input().split()]
cost= [0]*(N+1)
stk=[[K,-1,0]]
while stk:
  v,p,c = stk.pop()
  if cost[v]!=0:
    continue
  cost[v]=c
  for i,j in E[v]:
    if i!=p:
      stk.append([i,v,c+j])
for i in range(Q):
  a,b = [int(x) for x in input().split()]
  print(cost[a]+cost[b])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
graph=[[float("INF")]*(N+1) for _ in range(N+1)]
for i in range(N-1):
  a,b,c = [int(x) for x in input().split()]
  graph[a][b] =c
  graph[b][a] =c
for k in range(N+1):
  for i in range(N+1):
    for j in range(N+1):
      if i==j:
        graph[i][j]=0
      graph[i][j] = min(graph[i][j],graph[i][k]+graph[k][j])
Q,K = [int(x) for x in input().split()]
for i in range(Q):
  a,b = [int(x) for x in input().split()]
  print(graph[a][K]+graph[K][b])

Fixed submission:
N = int(input())
E ={i:[] for i in range(N+1)}
for i in range(N-1):
  a,b,c = [int(x) for x in input().split()]
  E[a].append([b,c])
  E[b].append([a,c])
Q,K = [int(x) for x in input().split()]
cost= [0]*(N+1)
stk=[[K,-1,0]]
while stk:
  v,p,c = stk.pop()
  if cost[v]!=0:
    continue
  cost[v]=c
  for i,j in E[v]:
    if i!=p:
      stk.append([i,v,c+j])
for i in range(Q):
  a,b = [int(x) for x in input().split()]
  print(cost[a]+cost[b])
Buggy python submission (verdict: Runtime Error):
from collections import deque
def dfs(v,N,memo):
    ans =0
    if not False in memo.values():
        return 1
    for u in E[v]:
        if memo[u]!=True:
            memo[u] = True
            ans += dfs(u,N,memo)
            memo[u] = False
    return ans
N,M = list(map(int,input().split()))
memo = {i:False for i in range(1,N+1)}
E = {i: []for i in range(1,M+1)}
for i in range(M):
    u,v = list(map(int,input().split()))
    E[u].append(v)
    E[v].append(u)
memo[1] = True
print(dfs(1,N,memo))

Fixed submission:
from collections import deque
def dfs(v,N,memo):
    ans =0
    if not False in memo.values():
        return 1
    for u in E[v]:
        if memo[u]!=True:
            memo[u] = True
            ans += dfs(u,N,memo)
            memo[u] = False
    return ans
N,M = list(map(int,input().split()))
memo = {i:False for i in range(1,N+1)}
E = {i: []for i in range(1,N+1)}
for i in range(M):
    u,v = list(map(int,input().split()))
    E[u].append(v)
    E[v].append(u)
memo[1] = True
print(dfs(1,N,memo))
Buggy python submission (verdict: Runtime Error):
s = input()
if s[2] = s[3] and s[4] = s[5]:
    print('Yes')
else
    print('No')

Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else
    print('No')

Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
ans = 0
for i in range(1, int(input()) + 1):
  t = 0
  z = i
  while z > 0:
    t = t + z % 10
    z = z // 10
  if t >= a and t <= b:
    ans = ans + i
print(ans)

Fixed submission:
ans = 0
n, a, b = map(int, input().split())
for i in range(1, n + 1):
  t = 0
  z = i
  while z > 0:
    t = t + z % 10
    z = z // 10
  if t >= a and t <= b:
    ans = ans + i
print(ans)
Buggy python submission (verdict: Runtime Error):
    n, a, b = map(int, input().split())
    fst = (n - 1) * b + a
    sec = (n - 1) * a + b
    if a > b:
      print(0)
    elif n == 1 and a != b:
      print(0)
    else:
      print(fst - sec + 1)

Fixed submission:
n, a, b = map(int, input().split())
fst = (n - 1) * b + a
sec = (n - 1) * a + b
if a > b:
  print(0)
elif n == 1 and a != b:
  print(0)
else:
  print(fst - sec + 1)
Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
for x in s:
  if x == '+':
    ans++
  else:
    ans--
print(ans)

Fixed submission:
s = input()
ans = 0
for x in s:
  if x == '+':
    ans+=1
  else:
    ans-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if a==0:
  print('0')
elif (a+b)*(10**100 )<=n:
  print(a*(10**100))
    
else:
  amari=n%(a+b)
  cnt=int(n/(a+b))
if amari<=a:
  print(cnt*a+amari)
else:
  print(cnt*(a+1))

Fixed submission:
n,a,b=map(int,input().split())
amari=n%(a+b)
cnt=n//(a+b)
print(cnt*a+min(amari,a))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
ans=6-(a+b)
print(ans)

Fixed submission:
a=int(input())
b=int(input())
ans=6-(a+b)
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(a,b)
ans=6-(a+b)
print(ans)

Fixed submission:
a=int(input())
b=int(input())
ans=6-(a+b)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
cnt=len(s)
a='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans=''
for i in range(cnt):
  ans=ans+a[i+n]
print(ans)  


Fixed submission:
n=int(input())
s=input()
cnt=len(s)
a='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans=''
for i in range(cnt):
  
  l=a.index(s[i])
  ans=ans+a[(l+n)%26]
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
List=[int(i) for i in input().split()]
print(Lint)
      
   

Fixed submission:
n=int(input())
List=[int(i) for i in input().split()]
ans=0
for i in range(0,n-1):
  for r in range(i+1,n):
    a=List[i]
    b=List[r]
    ans=ans+a*b
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import gcd
M = 10**9+7


def lcm(a, b): return (a//gcd(a, b))*b


totalLCM = 1

n = int(input())
a = [int(x) for x in input().split()]
for i in a:
    totalLCM = lcm(totalLCM, i)

ans = 0
for i in a:
    ans += (totalLCM//i)
    ans %= M

print(ans % M)


Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
preMin = [a[0]]
for i in range(1,n):
    preMin.append(min(preMin[-1],a[i]))
ans = 1
for i in range(1,n):
    if a[i]<preMin[i-1]:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input.split())
print('bust') if a+b+c>= 22 else print('win')

Fixed submission:
a,b,c = map(int,input().split())
if a+b+c>= 22:
  print('bust')
else:
  print('win')
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
n = int(input())
seen = defaultdict(int)
for _ in range(n):
  s = sorted(input())
  seen[s]+=1

ans = 0
for i in seen:
  ans+= seen[i]*(seen[i]-1)//2
print(ans)

Fixed submission:
from collections import defaultdict
n = int(input())
seen = defaultdict(int)
for _ in range(n):
  s = "".join(sorted(input()))
  seen[s]+=1

ans = 0
for i in seen:
  ans+= seen[i]*(seen[i]-1)//2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
K = int(input()) 
a=0
for i in range(1,K+1):
  for j in range(1,K+1):
    for l in range(1,K+1):
      a=a+gcd(i,j,l)
print(a)
      

Fixed submission:
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
K = int(input()) 
a=0
for i in range(1,K+1):
  for j in range(1,K+1):
    for l in range(1,K+1):
      a=a+gcd(i,j,l)
print(a)
Buggy python submission (verdict: Runtime Error):
S1, S2, S3 = map(int,input().split())
S = S1 + S2 + S3

print(str(S))

Fixed submission:
s = input()
print(s.count("1"))

Buggy python submission (verdict: Runtime Error):
S1, S2, S3 = map(int,input().split()) #'1'あるいは'0'
print(str(S1 + S2 +S3))

Fixed submission:
s = input()
print(s.count("1"))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

result = 0

while n != 0:
    q = n // 10
    mod = n % 10

    result += mod
    n = q

if (result % 9) == 0:
    print('Yes')
else:
    print('No')


Fixed submission:
n = str(input())

count = 0
for v in list(n):
    count += int(v)

if (count % 9) == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import sys

n, x, t = sys.stdin.readlines()[0].split()
n, x, t = int(n), int(x), int(t)
return math.ceil(n/x) * t

Fixed submission:
import sys
import math

n, x, t = sys.stdin.readlines()[0].split()
n,x,t = float(n),int(x),int(t)

print(int(math.ceil(n/x) * t))

Buggy python submission (verdict: Runtime Error):
s = int(input().split())
N,X,T =s[0],s[1],s[2]
n = N//X
if N % X != 0:
  n += 1
out = n * T
print(out)


Fixed submission:
import numpy as np 

s_ = np.array(input().split())
s = [int(i) for i in s_]
N,X,T =s[0],s[1],s[2]
n = N//X
if N % X != 0:
  n += 1
out = n * T
print(out)

Buggy python submission (verdict: Runtime Error):
n,x,t=map(int,input().split())
print((n//x+((n%x)!=0)*t)


Fixed submission:
n,x,t=map(int,input().split())
print((n//x+((n%x)!=0))*t)
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
ans=1
s=7
if k%2==0:
    print(-1)
else:
    mod=k
    while s%mod!=0:
        s=(10*s+7)%mod
        ans+=1
    print(ans)

Fixed submission:
k=int(input())
ans=1
s=7
if k%2==0 or k%5==0:
    print(-1)
else:
    mod=k
    while s%mod!=0:
        s=(10*s+7)%mod
        ans+=1
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
ans=[0]*(10**5+1)
for i in a:
  ans[i]+=1
for _ in range(q):
  b,c=map(int,input().split())
  ans[c]+=ans[b]
  ans[b]=0
  s=0
  for i,x in enumerate(ans):
    s+=i*x
  print(s)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
q=int(input())
ans=[0]*(10**5+1)
for i in a:
  ans[i]+=1
res=sum(a)
for _ in range(q):
  b,c=map(int,input().split())
  ans[c]+=ans[b]
  res-=ans[b]*b
  res+=ans[b]*c
  ans[b]=0
  print(res)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
ans=[0]*(10**5+1)
for i in a:
  ans[i]+=1
for _ in range(q):
  b,c=map(int,input().split())
  ans[c]+=ans[b]
  ans[b]=0
  s=0
  for i,x in enumerate(ans):
    s+=i*x
  print(s)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
q=int(input())
ans=[0]*(10**5+1)
for i in a:
  ans[i]+=1
res=sum(a)
for _ in range(q):
  b,c=map(int,input().split())
  ans[c]+=ans[b]
  res-=ans[b]*b
  res+=ans[b]*c
  ans[b]=0
  print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n,k,*a=map(int,open(0).read().split())
for _ in range(k):
  b=[0]*(n+1)
  for i,c in enumerate(a):
    b[max(0,i-c)]+=1
    b[min(n,c+i+1)]-=1
  for i in range(n):
    b[i+1]+=b[i]
  a=b[:-1]
  if a==[n]*n:
    print(*a)
    exit()
print(*a)

Fixed submission:
n,k,*a=map(int,open(0).read().split())
for _ in range(k):
  b=[0]*(n+1)
  for i,c in enumerate(a):
    b[max(0,i-c)]+=1
    b[min(n,c+i+1)]-=1
  for i in range(n):
    b[i+1]+=b[i]
  a=b[:-1]
  if a==[n]*n:
    print(*a)
    exit()
print(*a)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k,*a=map(int,open(0).read().split())
for _ in range(k):
  b=np.zeros(n+1,dtype=int)
  for i,c in enumerate(a):
    b[max(0,i-c)]+=1
    b[min(n,c+i+1)]-=1
  b=np.cumsum(b,dtype=int)
  a=b[:-1]
  if all(a==n):
    print(*a)
    exit()
print(*a)

Fixed submission:
n,k,*a=map(int,open(0).read().split())
for _ in range(k):
  b=[0]*(n+1)
  for i,c in enumerate(a):
    b[max(0,i-c)]+=1
    b[min(n,c+i+1)]-=1
  for i in range(n):
    b[i+1]+=b[i]
  a=b[:-1]
  if a==[n]*n:
    print(*a)
    exit()
print(*a)