Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
t=input()
dp=[[""]*(len(t)+1) for _ in range(len(s)+1)]
for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
            dp[i+1][j+1]="".join([dp[i][j],s[i]])
        else:
            if len(dp[i+1][j])>len(dp[i][j+1]):
                dp[i+1][j+1]=dp[i+1][j]
            else:
                dp[i+1][j+1]=dp[i][j+1]
print(dp[len(s)][len(t)])

Fixed submission:
s=input()
t=input()
dp=[[0]*(len(t)+1) for _ in range(len(s)+1)]
for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])

res=""
i=len(s); j=len(t)
while i>0 and j>0:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    elif dp[i][j]==dp[i][j-1]:
        j-=1
    else:
        res="".join([s[i-1],res])
        i-=1
        j-=1
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
t=input()
dp=[[""]*(len(t)+1) for _ in range(len(s)+1)]
for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+s[i]
        else:
            if len(dp[i+1][j])>len(dp[i][j+1]):
                dp[i+1][j+1]=dp[i+1][j]
            else:
                dp[i+1][j+1]=dp[i][j+1]
print(dp[len(s)][len(t)])


Fixed submission:
s=input()
t=input()
dp=[[0]*(len(t)+1) for _ in range(len(s)+1)]
for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])

res=""
i=len(s); j=len(t)
while i>0 and j>0:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    elif dp[i][j]==dp[i][j-1]:
        j-=1
    else:
        res="".join([s[i-1],res])
        i-=1
        j-=1
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
t=input()
dp=[[""]*(len(t)+1) for _ in range(len(s)+1)]
for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+s[i]
        else:
            if len(dp[i+1][j])>len(dp[i][j+1]):
                dp[i+1][j+1]=dp[i+1][j]
            else:
                dp[i+1][j+1]=dp[i][j+1]
print(dp[len(s)][len(t)])

Fixed submission:
s=input()
t=input()
dp=[[0]*(len(t)+1) for _ in range(len(s)+1)]
for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])

res=""
i=len(s); j=len(t)
while i>0 and j>0:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    elif dp[i][j]==dp[i][j-1]:
        j-=1
    else:
        res="".join([s[i-1],res])
        i-=1
        j-=1
print(res)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[[]for _ in range(n+1)]
for _ in range(m):
    x,y=map(int,input().split())
    l[x].append(y)

memo=[0]*(n+1)
def chain(v):
    if memo[v]!=0:
        return memo[v]
    else:
        for a in l[v]:
            memo[v]=max(chain(a)+1,memo[v])
        return memo[v]
res=0
for i in range(1,n+1):
    res=max(res,chain(i))
print(res)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
n,m=map(int,input().split())
l=[[]for _ in range(n+1)]
for _ in range(m):
    x,y=map(int,input().split())
    l[x].append(y)

memo=[0]*(n+1)
def chain(v):
    if memo[v]!=0:
        return memo[v]
    else:
        for a in l[v]:
            memo[v]=max(chain(a)+1,memo[v])
        return memo[v]
res=0
for i in range(1,n+1):
    res=max(res,chain(i))
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(int(2e6))

h,w=map(int,input().split())
a=[]
for _ in range(h):
    a.append(list(input()))

dp=[[0]*w for _ in range(h)]
z=[[0]*w for _ in range(h)]
dp[h-1][w-1]=1
z[h-1][w-1]=1
def c(i,j):
    if z[i][j]!=0:
        return dp[i][j]
    if 1<=i+1<=h-1 and 0<=j<=w-1:
        if a[i+1][j]!="#":
            dp[i][j]+=c(i+1,j)
        else:
            z[i+1][j]=1
    if 1<=j+1<=w-1 and 0<=i<=h-1:
        if a[i][j+1]!="#":
            dp[i][j]+=c(i,j+1)
        else:
            z[i][j+1]=1
    z[i][j]=1
    return dp[i][j]
print(c(0,0)%(10**9+7))

Fixed submission:
h,w=map(int,input().split())
a=[]
for _ in range(h):
    a.append(list(input()))

dp=[[0]*w for _ in range(h)]
dp[0][0]=1
for i in range(h):
    for j in range(w):
        if i+1<h and a[i+1][j]=='.':
            dp[i+1][j]+=dp[i][j]%(10**9+7)
        if j+1<w and a[i][j+1]=='.':
            dp[i][j+1]+=dp[i][j]%(10**9+7)
print(dp[h-1][w-1]%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(int(2e6))
h,w=map(int,input().split())
a=[]
for _ in range(h):
    a.append(list(input()))

dp=[[0]*w for _ in range(h)]
z=[[0]*w for _ in range(h)]
dp[h-1][w-1]=1
z[h-1][w-1]=1
def c(i,j):
    if z[i][j]!=0:
        return dp[i][j]
    if 1<=i+1<=h-1 and 0<=j<=w-1:
        if a[i+1][j]!="#":
            dp[i][j]+=c(i+1,j)
    if 1<=j+1<=w-1 and 0<=i<=h-1:
        if a[i][j+1]!="#":
            dp[i][j]+=c(i,j+1)
    z[i][j]=1
    return dp[i][j]
print(c(0,0)%(10**9+7))

Fixed submission:
h,w=map(int,input().split())
a=[]
for _ in range(h):
    a.append(list(input()))

dp=[[0]*w for _ in range(h)]
dp[0][0]=1
for i in range(h):
    for j in range(w):
        if i+1<h and a[i+1][j]=='.':
            dp[i+1][j]+=dp[i][j]%(10**9+7)
        if j+1<w and a[i][j+1]=='.':
            dp[i][j+1]+=dp[i][j]%(10**9+7)
print(dp[h-1][w-1]%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(int(2e6))
h,w=map(int,input().split())
a=[]
for _ in range(h):
    a.append(list(input()))
    
dp=[[0]*w for _ in range(h)]
z=[[0]*w for _ in range(h)]
dp[h-1][w-1]=1
def c(i,j):
    if z[i][j]!=0:
        return dp[i][j]
    if 1<=i+1<=h-1 and 0<=j<=w-1:
        if a[i+1][j]!="#":
            dp[i][j]+=c(i+1,j)
    if 1<=j+1<=w-1 and 0<=i<=h-1:
        if a[i][j+1]!="#":
            dp[i][j]+=c(i,j+1)
    z[i][j]=1
    return dp[i][j]
print(c(0,0)%(10**9+7))

Fixed submission:
h,w=map(int,input().split())
a=[]
for _ in range(h):
    a.append(list(input()))

dp=[[0]*w for _ in range(h)]
dp[0][0]=1
for i in range(h):
    for j in range(w):
        if i+1<h and a[i+1][j]=='.':
            dp[i+1][j]+=dp[i][j]%(10**9+7)
        if j+1<w and a[i][j+1]=='.':
            dp[i][j+1]+=dp[i][j]%(10**9+7)
print(dp[h-1][w-1]%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n,k=map(int,input().split())
a=list(map(int,input().split()))
I=10**9+7

if sum(a)<k:
    print(0)
    sys.exit()

dp=[[float("inf")]*(k+1) for _ in range(n+1)]
for p in range(k+1):
    dp[0][p]=0
    if a[0]<p:
        dp[1][p]=0
    else:
        dp[1][p]=1
for i in range(1,n):
    s=[0]*(k+2)
    for j in range(k+1):
        s[j+1]=s[j]+dp[i][j]
        dp[i+1][j]=s[j+1]-s[max(0,j-a[(i+1)-1])]

print(dp[n][k]%I)

Fixed submission:
import sys
n,k=map(int,input().split())
a=list(map(int,input().split()))
I=10**9+7

if sum(a)<k:
    print(0)
    sys.exit()

dp=[[float("inf")]*(k+1) for _ in range(n+1)]
for p in range(k+1):
    dp[0][p]=0
    if a[0]<p:
        dp[1][p]=0
    else:
        dp[1][p]=1
for i in range(1,n):
    s=[0]*(k+2)
    for j in range(k+1):
        s[j+1]=s[j]+dp[i][j]%I
        dp[i+1][j]=s[j+1]-s[max(0,j-a[(i+1)-1])]

print(dp[n][k]%I)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
sys.setrecursionlimit(10**6)
n=int(input())
a=list(map(int,input().split()))
s=[0]+list(itertools.accumulate(a))

dp=[[10**10]*(n+1) for _ in range(n)]
for l in range(n):
    dp[l][l+1]=0
def c(i,j):
    if dp[i][j]!=10**10:
        return dp[i][j]
    else:
        S=s[j]-s[i]
        for k in range(1,j-i):
            dp[i][j]=min(c(i,i+k)+c(i+k,j)+S,dp[i][j])
        return dp[i][j]

print(c(0,n))

Fixed submission:
import itertools

n=int(input())
a=list(map(int,input().split()))
s=[0]+list(itertools.accumulate(a))

dp=[[10**20]*(n+1) for _ in range(n)]
for l in range(n):
    dp[l][l+1]=0
for d in range(2,n+1): 
    for k in range(1,d):
        for i in range(n-d+1):
            j=i+d
            S=s[j]-s[i]
            dp[i][j]=min(dp[i][i+k]+dp[i+k][j]+S,dp[i][j])

print(dp[0][n])
Buggy python submission (verdict: Time Limit Exceeded):
def popcount(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8) 
    x = x + (x >> 16) 
    x = x + (x >> 32) 
    return x & 0x0000007f
f=popcount
a=[]
n=int(input())
for _ in range(n):
    a.append(tuple(map(int,input().split())))

S=1<<n
dp=[0]*(S)


dp[0]=1

for s in range(1,S):
    i=f(s)
    for j in range(n):
        if s>>j&1:
            if a[i-1][j]:
                dp[s]+=dp[s-(1<<j)]
        else:
            dp[s]%=10**9+7
            continue
# print(dp)
print(dp[S-1]%(10**9+7))


Fixed submission:
def popcount(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8) 
    x = x + (x >> 16) 
    x = x + (x >> 32) 
    return x & 0x0000007f
f=popcount
a=[]
n=int(input())
for _ in range(n):
    a.append(tuple(map(int,input().split())))

S=1<<n
dp=[0]*(S)


dp[0]=1

for s in range(1,S):
    i=f(s)
    for j in range(n):
        if s>>j&1:
            if a[i-1][j]:
                dp[s]+=dp[s-(1<<j)]
        else:
            dp[s]%=10**9+7
            continue
# print(dp)
print(dp[S-1]%(10**9+7))
Buggy python submission (verdict: Runtime Error):
import fraction
n,m=map(int,input().split())
s=input()
t=input()
b=0
for i in range(n):
    if (i*m)%n==0 and (i*m)//n<m:
        if not t[(i*m)//n]==s[i]:
            b=1

if b:
    print(-1)
else:
    print(n*m//fraction.gcd(n,m))

Fixed submission:
import fractions
n,m=map(int,input().split())
s=input()
t=input()
b=0
for i in range(n):
    if (i*m)%n==0 and (i*m)//n<m:
        if not t[(i*m)//n]==s[i]:
            b=1

if b:
    print(-1)
else:
    print(n*m//fractions.gcd(n,m))

Buggy python submission (verdict: Runtime Error):
import math
n,m=map(int,input().split())
s=input()
t=input()
b=0
for i in range(n):
    if (i*m)%n==0 and (i*m)//n<m:
        if not t[(i*m)//n]==s[i]:
            b=1

if b:
    print(-1)
else:
    print(n*m//math.gcd(n,m))

Fixed submission:
import fractions
n,m=map(int,input().split())
s=input()
t=input()
b=0
for i in range(n):
    if (i*m)%n==0 and (i*m)//n<m:
        if not t[(i*m)//n]==s[i]:
            b=1

if b:
    print(-1)
else:
    print(n*m//fractions.gcd(n,m))
Buggy python submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
d1=[0]*(10**5+1)
d2=[0]*(10**5+1)

for i in range(n):
    if i%2==0:
        d1[v[i]]+=1
    else:
        d2[v[i]]+=1
assert n-max(d1)-max(d2)<0
print(n-max(d1)-max(d2))


Fixed submission:
n=int(input())
v=list(map(int,input().split()))
d1=[0]*(10**5+1)
d2=[0]*(10**5+1)

for i in range(n):
    if i%2==0:
        d1[v[i]]+=1
    else:
        d2[v[i]]+=1
if d1.index(max(d1))==d2.index(max(d2)):
    d1n=sorted(d1,reverse=True)
    d2n=sorted(d2,reverse=True)
    if d1n[1]>d2n[1]:
        print(n-d1n[1]-d2n[0])
    else:
        print(n-d1n[0]-d2n[1])
else:
    print(n-max(d1)-max(d2))
Buggy python submission (verdict: Runtime Error):
import string
ABC=list(string.ascii_lowercase)
s=input()
S=s[::-1]

if s=='zyxwvutsrqponmlkjihgfedcba':
    print(-1)
else:
    if len(s)==26:
        for i in range(len(s)):
            n=ABC.index(S[i])
            if not set(ABC[n+1:])<=set(S[i+1:]):
                j=i
                break
        L=list(set(ABC[n+1])-set(S[j+1:]))
        L.sort()
        sgyku=L[0:1]+S[j+1:]
        print("".join(sgyku[::-1]))
    else:
        L=list(set(ABC)-set(s))
        L.sort()
        print(s+L[0])

Fixed submission:
import string
ABC=list(string.ascii_lowercase)
s=input()
S=list(s[::-1])

if s=='zyxwvutsrqponmlkjihgfedcba':
    print(-1)
else:
    if len(s)==26:
        for i in range(len(s)):
            n=ABC.index(S[i])
            if not set(ABC[n+1:])<=set(S[i+1:]):
                j=i
                break
        L=list(set(ABC[n+1:])-set(S[j+1:]))
        L.sort()
        sgyku=L[0:1]+S[j+1:]
        print("".join(sgyku[::-1]))
    else:
        L=list(set(ABC)-set(s))
        L.sort()
        print(s+L[0])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(n):
    m=int(input())
    if m in a:
        a.remove(m)
    else:
        a.append(m)
print(len(a))

Fixed submission:
from collections import defaultdict
n=int(input())
a=[]
d=defaultdict(int)
D=[]
for i in range(n):
    a.append(input())

for key in a:
    d[key]+=1

for k,v in d.items():
    if v%2==1:
        D.append(k)
print(len(D))

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
    m=int(input())
    if m in a:
        a.append(m)
    else:
        a.remove(m)
print(len(a))

Fixed submission:
from collections import defaultdict
n=int(input())
a=[]
d=defaultdict(int)
D=[]
for i in range(n):
    a.append(input())

for key in a:
    d[key]+=1

for k,v in d.items():
    if v%2==1:
        D.append(k)
print(len(D))

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
    m=int(input())
    if m in a:
        a.append(m)
    else:
        a.remove(a)
print(len(a))

Fixed submission:
from collections import defaultdict
n=int(input())
a=[]
d=defaultdict(int)
D=[]
for i in range(n):
    a.append(input())

for key in a:
    d[key]+=1

for k,v in d.items():
    if v%2==1:
        D.append(k)
print(len(D))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
import math

if abs(n-m) > 1:
    print(0)
else:
    print(math.factorial(n)*math.factorial(m)

Fixed submission:
n,m=map(int,input().split())
import math
a=math.factorial(n)
b=math.factorial(m)
if abs(n-m) > 1:
    print(0)

elif abs(n-m)==1:

    print((a*b)%(10**9+7))
else:
    print((a*b*2)%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
l=[0]
for _ in range(n):
    a,b=map(int,input().split())
    l+=[a]*b
l.sort()
print(l[k])

Fixed submission:
n,k=map(int,input().split())
l=[0]*(10**5+1)
for _ in range(n):
    a,b=map(int,input().split())
    l[a]+=b
s=0    
for i in range(len(l)):
    s+=l[i]
    if s>=k:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
A=a[len(a)-1]
B=b[0]
B1=b[len(b)-1]
C=c[0]

If A==B and B1==C:
    print(“YES”)
else:
    print(“NO”)

Fixed submission:
a,b,c=input().split()
A=a[len(a)-1]
B=b[0]
B1=b[len(b)-1]
C=c[0]

if A==B and B1==C:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())
x0=x
y0=y
X=[1,1,-1,-1]
Y=[1,-1,1,-1]
l=[]
for i in range(4):
    x=x*X[i]
    y=y*Y[i]
    if y-x>=0:
      q=y-x
      if X[i]==-1:
        q+=1
      if Y[i]==-1:
        q+=1
    l.append(q)
    x=x0
    y=y0  
print(min(l))

Fixed submission:
x,y=map(int,input().split())
X=abs(x)
Y=abs(y)
if X<Y:
    if x<y:
        if x*y>=0:
            p=y-x
        else:
            p=y-(-x)+1      
    else:
        if x*y>0:
            p=(-y)-(-x)+2
        else:
            p=(-y)-x+1

else:
    if x<y:
        if x*y>=0:
            p=y-x
        else:
            p=(-y)-x+1
    else:
        if x*y>0:
            p=(-y)-(-x)+2
        else:
            p=y-(-x)+1
print(p)
Buggy python submission (verdict: Runtime Error):
print(l)
indexes=[[] for _ in range(2**(n-1))]
for k in range(2**(n-1)):
    indexes[k]=[i for i, x in enumerate(l[k]) if x == 1]
#print(indexes)
SUM=0
for j in range(2**(n-1)):
    L=len(indexes[j])
    if L==0:
        SUM+=int(s)
        #print(SUM)
    else:
        SUM+=int(s[:indexes[j][0]+1])
        #print(SUM)
        SUM+=int(s[indexes[j][L-1]+1:])
        #print(SUM)
        if L>1:
            for h in range(L-1):
                SUM+=int(s[indexes[j][h]+1:indexes[j][h+1]+1])
                #print(SUM)
print(SUM)

Fixed submission:
s=input()
n=len(s)
l=[[] for _ in range(2**(n-1))]
for b in range(2**(n-1)):
    x=b
    for i in range(n-1):
        if x%2==1:
            l[b].append(1)
        else:
            l[b].append(0)
        x//=2
#print(l)
indexes=[[] for _ in range(2**(n-1))]
for k in range(2**(n-1)):
    indexes[k]=[i for i, x in enumerate(l[k]) if x == 1]
#print(indexes)
SUM=0
for j in range(2**(n-1)):
    L=len(indexes[j])
    if L==0:
        SUM+=int(s)
        #print(SUM)
    else:
        SUM+=int(s[:indexes[j][0]+1])
        #print(SUM)
        SUM+=int(s[indexes[j][L-1]+1:])
        #print(SUM)
        if L>1:
            for h in range(L-1):
                SUM+=int(s[indexes[j][h]+1:indexes[j][h+1]+1])
                #print(SUM)
print(SUM)
Buggy python submission (verdict: Time Limit Exceeded):
N = int( input())
Xs = list(map(int, input().split()))

for i,x in enumerate(Xs):
    arr = Xs[:i] + Xs[i+1:]
    arr.sort(reverse=True)
    m = int(N/2)-1
    print(arr[m])

Fixed submission:
N = int(input())
Xs = list(map(int, input().split()))
s = sorted(Xs)
a = s[N//2-1]
b = s[N//2]
for x in Xs:
    if x < b:
        print(b)
    else :
        print(a)
Buggy python submission (verdict: Runtime Error):
import random

name = input()
start = random.randint(0, len(name) - 4)
nickname = name[start:start + 3]
print(nickname)

Fixed submission:
import random

name = input()
start = random.randint(0, len(name) - 3)
nickname = name[start:start + 3]
print(nickname)
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())
a = sorted(list(map(int, input().split())))
memo = ['Yes'] * n
ans = 0
max = a[-1]

for i, a_i in enumerate(a):
    if memo[i] == 'No':
        continue
    for j in range(i+1, n):
        if a[j] % a_i == 0:
            memo[j] = 'No'
    if i != n-1 and a_i == a[i+1]:
        continue
    ans += 1

print(ans)

Fixed submission:
n = int(input())
a = sorted(list(map(int, input().split())))
max = a[-1]
memo = ['Yes'] * (10**6+1)
ans = 0

for i, a_i in enumerate(a):
    if memo[a_i] == 'No':
        continue
    for j in range(a_i, max+1, a_i):
        memo[j] = 'No'
    if i != n-1 and a_i == a[i+1]:
        continue
    ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = sorted(list(map(int, input().split())))
memo = ['Yes'] * n
ans = 0

for i, a_i in enumerate(a):
    if memo[i] == 'No':
        continue
    for h in [j for j in range(i+1, n) if a[j] % a_i == 0]:
        memo[h] = 'No'
    if i != n-1 and a_i == a[i+1]:
        continue
    ans += 1

print(ans)

Fixed submission:
n = int(input())
a = sorted(list(map(int, input().split())))
max = a[-1]
memo = ['Yes'] * (10**6+1)
ans = 0

for i, a_i in enumerate(a):
    if memo[a_i] == 'No':
        continue
    for j in range(a_i, max+1, a_i):
        memo[j] = 'No'
    if i != n-1 and a_i == a[i+1]:
        continue
    ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = sorted(list(map(int, input().split())))
memo = ['Yes'] * n
ans = 0

for i, a_i in enumerate(a):
    if memo[i] == 'No':
        continue
    for h in [j for j in range(i+1, n) if a[j] % a_i == 0]:
        memo[h] = 'No'
    if i != n-1 and a_i == a[i+1]:
        continue
    ans += 1

print(ans)

Fixed submission:
n = int(input())
a = sorted(list(map(int, input().split())))
max = a[-1]
memo = ['Yes'] * (10**6+1)
ans = 0

for i, a_i in enumerate(a):
    if memo[a_i] == 'No':
        continue
    for j in range(a_i, max+1, a_i):
        memo[j] = 'No'
    if i != n-1 and a_i == a[i+1]:
        continue
    ans += 1

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

for count in range(k):
    range_diff = [0] * n
    for pos in range(n):
        candidate_min = pos - a[pos]
        candidate_max = pos + a[pos] + 1
        if pos - a[pos] >= 0:
            min = pos - a[pos]
        else:
            min = 0
        range_diff[min] += 1
        if candidate_max <= n-1:
            range_diff[candidate_max] -= 1
    for i in range(1, n):
        range_diff[i] += range_diff[i-1]
    a = range_diff
    if count >= 43:
        break

print(' '.join(list(map(str,a))))

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

for count in range(k):
    range_diff = [0] * n
    for pos in range(n):
        candidate_min = pos - a[pos]
        candidate_max = pos + a[pos] + 1
        if pos - a[pos] >= 0:
            min = pos - a[pos]
        else:
            min = 0
        range_diff[min] += 1
        if candidate_max <= n-1:
            range_diff[candidate_max] -= 1
    for i in range(1, n):
        range_diff[i] += range_diff[i-1]
    a = range_diff
    if count >= 43:
        break

print(' '.join(list(map(str,a))))
Buggy python submission (verdict: Runtime Error):
x = input()
y = input()

groupA = [1,3,5,7,8,10,12]
groupB = [4,6,9,11]
groupC = [2]

if x in groupA and y in groupA:
    print("Yes")
elif x in groupB and y in groupB:
    print("Yes")
elif x in groupC and y in groupC:
    print("Yes")
else:
    print("No")

Fixed submission:
x,y = [int(i) for i in input().split()]

groupA = [1,3,5,7,8,10,12]
groupB = [4,6,9,11]
groupC = [2]

if x in groupA and y in groupA:
    print("Yes")
elif x in groupB and y in groupB:
    print("Yes")
elif x in groupC and y in groupC:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

sa = abs(a - b)
sas = abs(v - w)
if w >= v:
    print("NO")
    exit(0)

for i in range(t):
    sa -= sas
if sa <= 0:
    print("YES")
else:
    print("NO")



Fixed submission:
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

sa = abs(a - b)
sas = abs(v - w)
if w >= v:
    print("NO")
    exit(0)

d = sa // sas

if d >t:
    print("NO")
if d == t:
    if sa % sas == 0:
        print("YES")
    else:
        print("NO")
if d < t:
    if sa - (d*sas) -sas <=0:
        print("YES")
    else:
        print("NO")
Buggy python submission (verdict: Runtime Error):
from collections import deque

n, m = map(int, input().split())
a = [0] * m
b = [0] * m
c = [[-1] * n for i in range(n)]
lead = [0] * n
i_n = [0] * n
for i in range(m):
    a[i], b[i] = map(int, input().split())
    a[i] -= 1
    b[i] -= 1
    c[b[i]][i_n[b[i]]] = a[i]
    c[a[i]][i_n[a[i]]] = b[i]
    i_n[b[i]] += 1
    i_n[a[i]] += 1

d = deque()
d.append(0)

while len(d):
    k = len(d)
    for i in range(k):
        p = d[0]
        for j in range(n):
            if c[p][j] == -1:
                break
            if lead[c[p][j]] == 0:
                lead[c[p][j]] = p + 1
                d.append(c[p][j])
        d.popleft()

print('Yes')
for i in range(n - 1):
    print(lead[i + 1])


Fixed submission:
n = int(input())
n= n %10
if n == 3:
    print('bon')
elif n == 0 or n== 1 or n==6 or n==8:
    print('pon')
else:
    print('hon')
Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split())

ans = 0
if b > n:
    x = n
    ans = int(a * x // b) - int(a * (x // b))
else:
    m = 0
    for i in range(b):
        if int(a * (n - i) // b) - int(a * ((n - i) // b)) > m:
            m = int(a * (n - i) // b) - int(a * ((n - i) // b))
    ans = m
print(ans)


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

ans = 0
if b > n:
    x = n
    ans = int(a * x // b) - int(a * (x // b))
else:
    x = n
    ans1 = int(a * x // b) - int(a * (x // b))
    x = (n//b)*b-1
    ans2 = int(a * x // b) - int(a * (x // b))
    ans = max(ans1,ans2)
print(ans)
Buggy python submission (verdict: Runtime Error):
a=sorted(list(map(int,input().split())))
if  a[0]==a[1]:
	if a[1] == a[2]:
		print("No")
	else:
		print("Yes")
else:
	if a[2] == a[3]:
		print("Yes")
	else:
		print("No")


Fixed submission:
a=sorted(list(map(int,input().split())))
if  a[0]==a[1]:
	if a[1] == a[2]:
		print("No")
	else:
		print("Yes")
else:
	if a[1] == a[2]:
		print("Yes")
	else:
		print("No")