Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
from collections import defaultdict as dd

class UFT(object):
  def __init__(self,n):
    self.parent={i:i for i in range(1,n+1)}
    self.height={i:0 for i in range(1,n+1)}
  def find(self,a):
    if self.parent[a]!=a:
      self.parent[a]=self.find(self.parent[a])
    return self.parent[a]
  def unite(self,a,b):
    a=self.find(a)
    b=self.find(b)
    if self.height[a]>self.height[b]:
      self.parent[b]=a
    else:
      if self.height[a]==self.height[b]:
        self.height[b]+=1
      self.parent[a]=b
  def isunited(self,a,b):
    return self.find(a)==self.find(b)


n,k,l=map(int,input().split())
uk=UFT(n)
ul=UFT(n)
dc=dd(int)

for _ in range(k):
  a,b=map(int,input().split())
  uk.unite(a,b)

for _ in range(l):
  a,b=map(int,input().split())
  ul.unite(a,b)
  
for i in range(1,n+1):
  dc[(uk.find(i),ul.find(i))]+=1

print(" ".join(map(str,(dc[(uk.find(i),ul.find(i))] for i in range(1,n+1)))))

Fixed submission:
from itertools import product
from collections import defaultdict as dd

class UFT(object):
  def __init__(self,n):
    self.parent={i:i for i in range(1,n+1)}
    self.height={i:0 for i in range(1,n+1)}
  def find(self,a):
    if self.parent[a]!=a:
      self.parent[a]=self.find(self.parent[a])
    return self.parent[a]
  def unite(self,a,b):
    a=self.find(a)
    b=self.find(b)
    if self.height[a]>self.height[b]:
      self.parent[b]=a
    else:
      if self.height[a]==self.height[b]:
        self.height[b]+=1
      self.parent[a]=b
  def isunited(self,a,b):
    return self.find(a)==self.find(b)


n,k,l=map(int,input().split())
uk=UFT(n)
ul=UFT(n)
dc=dd(int)
du={}

for _ in range(k):
  a,b=map(int,input().split())
  uk.unite(a,b)

for _ in range(l):
  a,b=map(int,input().split())
  ul.unite(a,b)
  
for i in range(1,n+1):
  du[i]=(uk.find(i),ul.find(i))
  dc[du[i]]+=1

print(*(dc[du[i]] for i in range(1,n+1)))
Buggy python submission (verdict: Runtime Error):
s=input()
if len(s)%2==0^s[0]==s[-1]:
  print("Second")
else:
  print("First")

Fixed submission:
s=input()
if (len(s)%2==0)^(s[0]==s[-1]):
  print("Second")
else:
  print("First")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
f=lambda x:int(x)-1

langs=[[] for _ in range(m)]
speakers=[[] for _ in range(n)]
used_langs=[False]*m
used_speakers=[False]*n

for i in range(n):
  *l,=map(f,input().split()[1:])
  speakers[i].extend(l)
  for j in l:
    langs[j].append(i)

def dfs(n):
  if used_speakers[n]:
    return
  used_speakers[n]=True
  for i in speakers[n]:
    if used_langs[i]:continue
    used_langs[i]=True
    for j in langs[i]:
      dfs(j)

dfs(0)
if not False in used_speakers:
  print("YES")
else:
  print("NO")

Fixed submission:
import sys
sys.setrecursionlimit(100000)

n,m=map(int,input().split())
f=lambda x:int(x)-1

langs=[[] for _ in range(m)]
speakers=[[] for _ in range(n)]
used_langs=[False]*m
used_speakers=[False]*n

for i in range(n):
  *l,=map(f,input().split()[1:])
  speakers[i].extend(l)
  for j in l:
    langs[j].append(i)

def dfs(n):
  if used_speakers[n]:
    return
  used_speakers[n]=True
  for i in speakers[n]:
    if used_langs[i]:continue
    used_langs[i]=True
    for j in langs[i]:
      dfs(j)

dfs(0)
if not False in used_speakers:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n=int(input())
*l,=map(int,input().split())

*a,=range(1,n+1)
b=a[::-1]

for i,j in enumerate(l):
  b[j-1]+=i
for i in range(1,n):
  if not b[i-1]>b[i]:
    df=b[i]-b[i-1]+1
    b[i]-=df
    a[i]+=df

if b[-1]<1:
  tg=abs(b[-1])+1
  *b=map(lambda x:x+tg,b)

print(*a)
print(*b)

Fixed submission:
n=int(input())
*l,=map(int,input().split())

*a,=range(1,30000*n+1,30000)
b=a[::-1]

for i,j in enumerate(l):
  b[j-1]+=i

print(*a)
print(*b)
Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
if x==1 or x==2*n-1:
  print("No")
else:
  print("Yes")
  l=[0]*(2*n-1)

  l[n-2]=x-1
  l[n-1]=x
  l[n]=x+1
  l[n+1]=x-1
  print(*l,sep="\n")
  

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

if n==2 and x==2:
  print("Yes",*[1,2,3],sep="\n")
elif x==1 or x>=2*n-1:
  print("No")
else:
  print("Yes")
  if x==2:
    t=[4,2,1,3]
  else:
    t=[x-1,x+1,x,x-2]
  p=[i for i in range(1,2*n) if i not in t]
  print(*p[:n-3]+t+p[n-3:],sep="\n")
Buggy python submission (verdict: Runtime Error):
print(len({input().split()}))

Fixed submission:
print(len({i for i in input().split()}))
Buggy python submission (verdict: Runtime Error):
a,b,h=map(int,input().split())
print((a+b)*h//2)

Fixed submission:
a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2))
Buggy python submission (verdict: Time Limit Exceeded):
r=lambda :map(int,input().split())
n,x=r()
*a,=r()
dp=[[0]*n for _ in range(n)]
for i,j in enumerate(a):
  dp[0][i]=j
for i in range(1,n):
  for j in range(n):
    dp[i][j]=min(dp[i-1][j],a[(j-i)%n])
print(min(i*x+sum(j) for i,j in enumerate(dp)))

Fixed submission:
r=lambda :map(int,input().split())
n,x=r()
*a,=r()
dp=[[0]*n for _ in range(n)]
for i,j in enumerate(a):
  dp[0][i]=j
for i in range(1,n):
  for j in range(n):
    dp[i][j]=min(dp[i-1][j],a[(j-i)%n])
print(min(i*x+sum(j) for i,j in enumerate(dp)))
Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
*x,=map(int,input().split())
b=max(x)
dp=[[[0]*(n*b+1) for i in range(n+1)] for _ in range(n+1)]

for i in range(n+1):
    for j in range(n+1):
        for k in range(n*b+1):
            if i==0 and j==0 and k==0:
                dp[i][j][k]=1
            elif i and k<x[i-1]:
                dp[i][j][k]=dp[i-1][j][k]
            elif i and j and k>=x[i-1]:
                dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-x[i-1]]

v=0
for i in range(1,n+1):
    v+=dp[n][i][i*a]
print(v)

Fixed submission:
n,a=map(int,input().split())
l=list(map(int,input().split()))
x=max(l)
x=max(x,a)
dp=[[[0 for _ in range(n*x+1)] for _ in range(n+1)] for _ in range(n+1)]

for j in range(n+1):
  for k in range(n+1):
    for s in range(n*x+1):
      if j==0 and k==0 and s==0:
        dp[j][k][s]=1
      elif j>=1 and s<l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]
      elif j>=1 and k>=1 and s>=l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-l[j-1]]
      else:
        dp[j][k][s]=0

s=0
for k in range(1,n+1):
  s+=dp[n][k][k*a]

print(s)

Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
l=list(map(int,input().split()))
x=max(l)
dp=[[[0 for _ in range(n*x+1)] for _ in range(n+1)] for _ in range(n+1)]

for j in range(n+1):
  for k in range(n+1):
    for s in range(n*x+1):
      if j==0 and k==0 and s==0:
        dp[j][k][s]=1
      elif j>=1 and s<l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]
      elif j>=1 and k>=1 and s>=l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-l[j-1]]
      else:
        dp[j][k][s]=0

s=0
for k in range(1,n+1):
  s+=dp[n][k][k*a]

print(s)

Fixed submission:
n,a=map(int,input().split())
l=list(map(int,input().split()))
x=max(l)
x=max(x,a)
dp=[[[0 for _ in range(n*x+1)] for _ in range(n+1)] for _ in range(n+1)]

for j in range(n+1):
  for k in range(n+1):
    for s in range(n*x+1):
      if j==0 and k==0 and s==0:
        dp[j][k][s]=1
      elif j>=1 and s<l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]
      elif j>=1 and k>=1 and s>=l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-l[j-1]]
      else:
        dp[j][k][s]=0

s=0
for k in range(1,n+1):
  s+=dp[n][k][k*a]

print(s)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations as c

n,a=map(int,input().split())
l=list(map(int,input().split()))
v=0
for i in range(1,n+1):
  v+=sum([1 for j in c(l,i) if sum(j)==a*i])
print(v)

Fixed submission:
n,a=map(int,input().split())
l=list(map(int,input().split()))
x=max(l)
x=max(x,a)
dp=[[[0 for _ in range(n*x+1)] for _ in range(n+1)] for _ in range(n+1)]

for j in range(n+1):
  for k in range(n+1):
    for s in range(n*x+1):
      if j==0 and k==0 and s==0:
        dp[j][k][s]=1
      elif j>=1 and s<l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]
      elif j>=1 and k>=1 and s>=l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-l[j-1]]
      else:
        dp[j][k][s]=0

s=0
for k in range(1,n+1):
  s+=dp[n][k][k*a]

print(s)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[]
for i in range(1,n+1):
  a=int(input())
  l.extend([i]*a)

c=0
s=0
while s<len(l)-1:
  if l[s+1]-l[s]<=1:
    c+=1
    s+=2
  else:
    s+=1

print(c)

Fixed submission:
n=int(input())
l=[int(input()) for _ in range(n)]
v,s=0,0
for i in l:
  if i:
    s+=i
  else:
    v+=(s//2)
    s=0
if s:
  v+=(s//2)
print(v)
Buggy python submission (verdict: Runtime Error):
h,w,a,b=map(int,input().split())
mod=10**9+7

n=h+w+1
fc,inv=[1]*n,[1]*n
for i in range(1,n):
    fc[i]=i*fc[i-1]%mod
inv[n-1]=pow(fc[n-1],mod-2,mod)
for i in range(n-1,0,-1):
    inv[i-1]=inv[i]*i%mod
f=lambda a,b:fc[a+b]*inv[a]*inv[b]%mod

v=0
for i in range(b,w):
    v+=f(h-a-1,i)*f(a-1,w-i-1)%mod
print(v%mod)


Fixed submission:
l=sorted(map(int,input().split()))
if l==[5,5,7]:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
s,l=map(int,input().split())
m=sorted([input() for _ in range(l)])
print("".join(m))


Fixed submission:
n,l=map(int,input().split())
m=sorted([input() for _ in range(n)])
print("".join(m))
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**15)

def f(a,b):
    if a==b:return a
    if not a<b:a,b=b,a
    return f(a,b-a)+2*a

N,X=map(int,input().split())
print(f(X,N-X)+N)


Fixed submission:
import sys
sys.setrecursionlimit(10**7)

def f(a,b):
    if a==b:return a
    if not a<b:a,b=b,a
    return 2*(b//a)*a+f(a,b%a) if b%a else 2*(b//a)*a-a

N,X=map(int,input().split())
print(f(X,N-X)+N)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**7)

def f(a,b):
    if a==b:return a
    if not a<b:a,b=b,a
    return f(a,b-a)+2*a

N,X=map(int,input().split())
print(f(X,N-X)+N)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)

def f(a,b):
    if a==b:return a
    if not a<b:a,b=b,a
    return 2*(b//a)*a+f(a,b%a) if b%a else 2*(b//a)*a-a

N,X=map(int,input().split())
print(f(X,N-X)+N)
Buggy python submission (verdict: Time Limit Exceeded):
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    n=int(input())
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    a=list(map(int,sys.stdin.readline().split(' ')))
    ams=1
    for x in a:
        ams*=x

    if ams>pow(10,18):
        ams=-1

    print(ams)
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

Fixed submission:
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    n=int(input())
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    a=list(map(int,sys.stdin.readline().split(' ')))
    ams=1

    if 0 in a:
        print(0)
        continue
        
    for x in a:
        ams*=x
        if ams> 1000000000000000000:
            ams=-1
            break

    print(ams)
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()
Buggy python submission (verdict: Runtime Error):
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=1
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    n=str(input())
    if '7' in n:
        print("Yes")
    else:
        print("No")
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    #a=list(map(int,sys.stdin.readline().split(' ')))
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

Fixed submission:
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    n=str(input())
    if '7' in n:
        print("Yes")
    else:
        print("No")
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    #a=list(map(int,sys.stdin.readline().split(' ')))
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()
Buggy python submission (verdict: Runtime Error):
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=1
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    s=str(input())
    v=s.count('o')
    v+=15-len(s)
    if(v<8):
        print("NO")
    else:
        print("YES")
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    #a=list(map(int,sys.stdin.readline().split(' ')))
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

Fixed submission:
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    s=str(input())
    v=s.count('o')
    v+=15-len(s)
    if(v<8):
        print("NO")
    else:
        print("YES")
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    #a=list(map(int,sys.stdin.readline().split(' ')))
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()
Buggy python submission (verdict: Runtime Error):
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=1
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
s=str(input())
if(len(s)==2):
    print(s)
else:
    print(s[::-1])
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

Fixed submission:
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
s=str(input())
if(len(s)==2):
    print(s)
else:
    print(s[::-1])
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

MOD = 10**9+7
ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        ans += (a[i] * a[j]) % MOD
print(ans%MOD)

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

A = [0]
for i in range(n):
    A.append(A[i] + a[i])

MOD = 10**9+7
ans = 0
for i in range(n-1):
    ans += (a[i] * (A[-1]-A[i+1])) % MOD

print(ans%MOD)
Buggy python submission (verdict: Runtime Error):
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
# t = []
# for _ in range(d):
#     t.append(int(input()))

cl = sum(c)
D = [0]*26
ans = [0]*d
T = [0]*d

for i in range(d):
    count = 0
    for j in range(26):
        D[j] += 1
    for j in range(d):
        sas = 0
        S = s[i][j-1]
        C = c[j-1]
        D[j-1] = 0
        dc = 0
        for k in range(26):
            dc += D[k]*c[k]
        sas = S - dc + sum(T[:i])
        if sas > count:
            count = sas
            ans[i] = j
            T[i] = sas
            
for i in ans:
    print(i)
        

Fixed submission:
import copy
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]

cl = sum(c)
D = [0]*26
ans = [0]*d
T = [0]*d

for i in range(d):
    count = 0
    for j in range(26):
        D[j] += 1
    for j in range(26):
        sas = 0
        S = s[i][j]
        C = c[j]
        Ds = copy.copy(D)
        Ds[j] = 0
        dc = 0
        for k in range(26):
            dc += Ds[k]*c[k]
        sas = S - dc + sum(T[:i])
        if sas > count:
            count = sas
            ans[i] = j+1
            T[i] = count

for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
s = ([0]*1000000)
a.sort()
for i in a:
    s[i] += 1
ans = 0
for j in range(1000000):
    if s[j] == 1:
        ans += 1
    if s[j] > 0:
        for k in range(j, 1000000, j):
            s[k] = 0
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = ([0]*1000001)
a.sort()
for i in a:
    s[i] += 1
ans = 0
for j in range(1000001):
    if s[j] == 1:
        ans += 1
    if s[j] > 0:
        for k in range(j, 1000001, j):
            s[k] = 0
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
s = ([0]*100)
a.sort()
for i in a:
    s[i] += 1
ans = 0
for j in range(100):
    if s[j] == 1:
        ans += 1
    if s[j] > 0:
        for k in range(j, 100, j):
            s[k] = 0
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = ([0]*1000001)
a.sort()
for i in a:
    s[i] += 1
ans = 0
for j in range(1000001):
    if s[j] == 1:
        ans += 1
    if s[j] > 0:
        for k in range(j, 1000001, j):
            s[k] = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
v
from collections import deque
n, m = map(int, input().split())
l = [[0] for _ in range(n+1)]
vi = [0]*(n+1)

for _ in range(m):
    a,b = map(int, input().split())
    l[a].append(b)
    l[b].append(a)
d = deque([1])
s = set([1])

while d:
    x = d.popleft()
    for k in l[x]:
        if k not in s:
            s.add(k)
            d.appendleft(k)
            vi[k] = x
print('Yes')
for i in vi[2:]:
    print(i)

Fixed submission:
from collections import deque
n,m=map(int,input().split())
l=[[0] for _ in range(n+1)]
vi=[0 for _ in range(n+1)]

for i in range (m):
  a,b=map(int,input().split())
  l[a].append(b)
  l[b].append(a)
st=deque([1])
f=set([1])


while st:
  x=st.popleft()
  for k in l[x]:
    if k not in f:
      st.append(k)
      f.add(k)
      vi[k]=x   
  
print("Yes")
for m in vi[2:]:
  print(m)
Buggy python submission (verdict: Runtime Error):
a, b, c, x = map(int, input().split())
alist = [1]
blist = [0]
clist = [-1]
list = alist*a + blist*b + clist*c
print(sum(list[:x]))

Fixed submission:
a, b, c, k = map(int, input().split())
if a >= k:
    print(k)
elif a + b >= k:
    print(a)
else:
    print(2*a - k + b)
Buggy python submission (verdict: Runtime Error):
s = input()
if s = 'ABC':
  print('ARC')
else:
  print('ABC')

Fixed submission:
s = input()
if s == 'ARC':
    print('ABC')
else:
    print('ARC')
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
h = list(map(int, input().split()))
x = []
for j in range(m):
    a = list(map(int, input().split()))
    s = a[0] - 1
    t = a[1] - 1
    if h[s] <= h[t]:
        x.append(t)
    else
        x.append(s)

print(len(set(x)))    

        

Fixed submission:
n, m = map(int, input().split())
h = list(map(int, input().split()))
x = [0 for _ in range(n)]
for j in range(m):
    a = list(map(int, input().split()))
    s = a[0] - 1
    t = a[1] - 1
    if h[s] < h[t]:
        x[s] = 1
    elif h[s] > h[t]:
        x[t] =1
    else:
        x[s] = 1
        x[t] = 1

print(x.count(0))
Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input(),split())
for i in range(a, b+1):
    if i % k == 0:
        print('OK')
        exit()
print('NO')

Fixed submission:
k = int(input())
a, b = map(int, input().split())
for i in range(a, b+1):
    if i % k == 0:
        print('OK')
        exit()
print('NG')
Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split())
ans = 0
if n < b-1:
    ans = ((a*n)//b - a*(n//b))
else:
    for i in range(b-1, n+1, b):
        ans = max(ans, (a*i)//b - a*(i//b))
print(ans)
        

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

c = int(a*n/b) - a*int(n/b)

if n < b:
    print(c)
else:
    c = int(a*(b-1)/b) - a*int((b-1)/b)
    print(c)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = list(map(int, input().split()))
if math.ceil(c/b) > math.ceil(a/d):
    print('No')
else:
    print('Yes')



Fixed submission:
import math
a, b, c, d = list(map(int, input().split()))
if math.ceil(c/b) > math.ceil(a/d):
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
import math
n, k = map(int, input().split())
x = math.ceil( n/k )
if abs(n - k*x) < n:
    n = abs(n - k*x)
print(n)

Fixed submission:
x, y, z = map(int, input().split())
x, y = y, x
x, z = z, x
print(x, y, z)