Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
from collections import deque
dic = {1:1}
queue = deque()
queue.appendleft([1,1])
while queue:
    v,cost = queue.popleft()
    v_ = (v+1)%k
    if not v_ in dic or cost+1<dic[v_]:
        dic[v_] = cost+1
        queue.appendleft([v_,cost+1])
    v_ = v*10%k
    if not v_ in dic or cost<dic[v_]:
        dic[v_] = cost
        queue.appendleft([v_,cost])

print(dic[0])


Fixed submission:
k = int(input())
from collections import deque
dic = {1:1}
queue = deque([[1,1]])
while queue:
    v,cost = queue.popleft()
    if not (v+1)%k in dic or cost+1<dic[(v+1)%k]:
        dic[(v+1)%k] = cost+1
        queue.appendleft([(v+1)%k,cost+1])
    if not v*10%k in dic or cost<dic[v*10%k]:
        dic[v*10%k] = cost
        queue.append([v*10%k,cost])

print(dic[0])

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
g = [[] for _ in range(k)]
from collections import deque
dic = {1:1}
queue = deque([[1,1]])
while queue:
    v,cost = queue.popleft()
    if not v+1 in dic.keys() or cost+1<dic[v+1]:
        dic[v+1] = cost+1
        queue.append([v+1,cost+1])
    if not v*10%k in dic.keys() or cost<dic[v*10%k]:
        dic[v*10%k] = cost
        queue.append([v*10%k,cost])

print(dic[0])

Fixed submission:
k = int(input())
from collections import deque
dic = {1:1}
queue = deque([[1,1]])
while queue:
    v,cost = queue.popleft()
    if not (v+1)%k in dic or cost+1<dic[(v+1)%k]:
        dic[(v+1)%k] = cost+1
        queue.appendleft([(v+1)%k,cost+1])
    if not v*10%k in dic or cost<dic[v*10%k]:
        dic[v*10%k] = cost
        queue.append([v*10%k,cost])

print(dic[0])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for i in range(n):
    for j in range(i,n):
        if i==j:
            continue
        dp = 10**9+1
        for k in range(n):
            if k==j or k==i:
                continue
            dp = min(dp,a[i][k]+a[k][j])
        if a[i][j]<dp:
            ans += a[i][j]
        elif a[i][j]>dp:
            print(-1)
            exit()
print(ans)

Fixed submission:
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for i in range(n):
    for j in range(i,n):
        if i==j:
            continue
        dp = 10**9+1
        for k in range(n):
            if k==j or k==i:
                continue
            dp = min(dp,a[i][k]+a[k][j])
        if a[i][j]<dp:
            ans += a[i][j]
        elif a[i][j]>dp:
            print(-1)
            exit()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
g = {}
for i in range(1,n+1):
    g[i] = []
for _ in range(n-1):
    a,b,c = map(int,input().split())
    g[a].append([b,c])
    g[b].append([a,c])
Q,k = map(int,input().split())
q = [list(map(int,input().split())) for _ in range(Q)]
from collections import deque
queue = deque(g[k])
shortest = [0]*(n+1)
while queue:
    a,c = queue.pop()
    shortest[a] = c
    for v in g[a]:
        if shortest[v[0]]==0:
            queue.appendleft([v[0],v[1]+c])
for x,y in q:
    print(shortest[x]+shortest[y])

Fixed submission:
n = int(input())
g = {}
from collections import deque
for i in range(1,n+1):
    g[i] = deque([])
for _ in range(n-1):
    a,b,c = map(int,input().split())
    g[a].appendleft([b,c])
    g[b].appendleft([a,c])
Q,k = map(int,input().split())
q = [list(map(int,input().split())) for _ in range(Q)]
queue = deque(g[k])
shortest = [0]*(n+1)
while queue:
    a,c = queue.pop()
    shortest[a] = c
    while g[a]:
        v = g[a].pop()
        if shortest[v[0]]==0:
            queue.appendleft([v[0],v[1]+c])
for x,y in q:
    print(shortest[x]+shortest[y])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
g = {}
for i in range(1,n+1):
    g[i] = []
for _ in range(n-1):
    a,b,c = map(int,input().split())
    g[a].append([b,c])
    g[b].append([a,c])
Q,k = map(int,input().split())
q = [list(map(int,input().split())) for _ in range(Q)]
from collections import deque
queue = deque(g[k])
shortest = [0]*(n+1)
while queue:
    a,c = queue.popleft()
    shortest[a] = c
    for v in g[a]:
        if shortest[v[0]]==0:
            queue.append([v[0],v[1]+c])
for x,y in q:
    print(shortest[x]+shortest[y])

Fixed submission:
n = int(input())
g = {}
from collections import deque
for i in range(1,n+1):
    g[i] = deque([])
for _ in range(n-1):
    a,b,c = map(int,input().split())
    g[a].appendleft([b,c])
    g[b].appendleft([a,c])
Q,k = map(int,input().split())
q = [list(map(int,input().split())) for _ in range(Q)]
queue = deque(g[k])
shortest = [0]*(n+1)
while queue:
    a,c = queue.pop()
    shortest[a] = c
    while g[a]:
        v = g[a].pop()
        if shortest[v[0]]==0:
            queue.appendleft([v[0],v[1]+c])
for x,y in q:
    print(shortest[x]+shortest[y])
Buggy python submission (verdict: Runtime Error):
n = int(input())
num=0
for i in range(1,n+1):
    k=0
    c=i
    while True:
        if c%2==0:
            c/=2
            k+=1
        else:
            break
    if k>num:
        num=k
        ans=i
print(ans)


Fixed submission:
n = int(input())
num=0
if n==1:
    print(1)
    exit()
else:
    for i in range(1,n+1):
        k=0
        c=i
        while True:
            if c%2==0:
                c/=2
                k+=1
            else:
                break
        if k>num:
            num=k
            ans=i
print(ans)
Buggy python submission (verdict: Runtime Error):
n,p=map(int,input().split())
a = list(map(int,input().split()))
for a_ in a:
    if not a_%2==0:
        k=1
        break
if k:
    print(1<<(n-1))
else:
    print(0) if p==1 else print(1<<n)

Fixed submission:
n,p=map(int,input().split())
a = list(map(int,input().split()))
k=0
for a_ in a:
    if not a_%2==0:
        k=1
        break
if k:
    print(1<<(n-1))
else:
    print(0) if p==1 else print(1<<n)
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())
import math
if a==b:
  print(math.factorial(a)**2*2%(10**9+7))
elif abs(a-b)==1:
  print(math.factorial(max(a,b))**2//max(a,b))
else:
  print(0)

Fixed submission:

a,b = map(int,input().split())
import math
if a==b:
  print((math.factorial(a)%(10**9+7))**2*2%(10**9+7))
elif abs(a-b)==1:
  print((math.factorial(max(a,b))%(10**9+7))*(math.factorial(min(a,b))%(10**9+7))%(10**9+7))
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):

a,b = map(int,input().split())
import math
if a==b:
  print(math.factorial(a)**2*2%(10**9+7))
elif abs(a-b)==1:
  print(math.factorial(a)*math.factorial(b))
else:
  print(0)

Fixed submission:

a,b = map(int,input().split())
import math
if a==b:
  print((math.factorial(a)%(10**9+7))**2*2%(10**9+7))
elif abs(a-b)==1:
  print((math.factorial(max(a,b))%(10**9+7))*(math.factorial(min(a,b))%(10**9+7))%(10**9+7))
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):

a,b = map(int,input().split())
import math
if a==b:
  print(math.factorial(a)**2*2%(10**9+7))
elif abs(a-b)==1:
  print(math.factorial(a)*math.factorial(b))
else:
  print(0)

Fixed submission:

a,b = map(int,input().split())
import math
if a==b:
  print((math.factorial(a)%(10**9+7))**2*2%(10**9+7))
elif abs(a-b)==1:
  print((math.factorial(max(a,b))%(10**9+7))*(math.factorial(min(a,b))%(10**9+7))%(10**9+7))
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().spilit())
import math
if a==b:
  print(math.factorial(a)**2*2%(10**9+7))
elif abs(a-b)==1:
  print(math.factorial(a)*math.factorial(b))
else:
  print(0)

Fixed submission:

a,b = map(int,input().split())
import math
if a==b:
  print((math.factorial(a)%(10**9+7))**2*2%(10**9+7))
elif abs(a-b)==1:
  print((math.factorial(max(a,b))%(10**9+7))*(math.factorial(min(a,b))%(10**9+7))%(10**9+7))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a+b>=10:
  print(error)
else:
  print(a+b)

Fixed submission:
a,b = map(int,input().split())
if a+b>=10:
  print('error')
else:
  print(a+b)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input()split())
print('#'*(b+2))
for _ in range(a):
  c = input()
  print('#{}#'.format(c))
print('#'*(b+2))

Fixed submission:
a,b = map(int,input().split())
ans = []
for _ in range(a):
  c = input()
  ans.append('#{}#'.format(c))
print('#'*(b+2))
for _ in ans:
    print(_)
print('#'*(b+2))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 1
for i in range(1,n+1):
  ans *= i
print(ans%(10**9+7))

Fixed submission:
n = int(input())
ans = 1
c = 10**9+7
for i in range(1,n+1):
  ans *= i
  ans %= c
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a==b:
  print('Draw')
elif a==1:
  print('Alice')
elif b==1 or :
  print('Bob')
elif a>b:
  print('Alice')
else:
  print('Bob')

Fixed submission:
a,b = map(int,input().split())
card = [2,3,4,5,6,7,8,9,10,11,12,13,1]
if card.index(a)==card.index(b):
  print('Draw')
elif card.index(a)>card.index(b):
  print('Alice')
else:
  print('Bob')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
odd = 0
for i in range(n):
    if a[i]%2==1:
        odd+=1
if odd%2==0:
    print('YES')
else:
    pritn('NO')

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
odd = 0
for i in range(n):
    if a[i]%2==1:
        odd+=1
if odd==0 or odd%2==0:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
a,b,c = input().split()
if b=='+':
  print(int(a)+int(c))
else:
  print(int(a)-int(b))

Fixed submission:
a,b,c = input().split()
if b=='+':
  print(int(a)+int(c))
else:
  print(int(a)-int(c))
Buggy python submission (verdict: Time Limit Exceeded):
n,a = map(int,input().split())
x = list(map(int,input().split()))
mx = max(x)
mx = max(mx,a)
dp = [[[0]*(n*mx+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(1,n+1):
    for j in range(i+1):
        for k in range(n*mx+1):
            if k<x[i-1]:
                dp[i][j][k] = dp[i-1][j][k]
            elif j>0 and k>=x[i-1]:
                dp[i][j][k] = dp[i-1][j][k]+dp[i-1][j-1][k-x[i-1]]
ans = 0
for i in range(n+1):
        ans += dp[n][i][a*i]
print(ans-1)

Fixed submission:
n,a = map(int,input().split())
x = list(map(int,input().split()))
mx = max(x)
mx = max(mx,a)
dp = [[[0]*(n*mx+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(1,n+1):
    for j in range(i+1):
        for k in range(n*mx+1):
            if k<x[i-1]:
                dp[i][j][k] = dp[i-1][j][k]
            elif j>0 and k>=x[i-1]:
                dp[i][j][k] = dp[i-1][j][k]+dp[i-1][j-1][k-x[i-1]]
ans = 0
for i in range(n+1):
        ans += dp[n][i][a*i]
print(ans-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,a = map(int,input().split())
x = list(map(int,input().split()))
ans = 0
def dfs(sum, cnt, num):
    global ans
    if cnt==n:
        if num!=0 and sum/num==a:
            ans = ans + 1
        return 1
    dfs(sum+x[cnt],cnt+1,num+1)
    dfs(sum,cnt+1,num)
    return 1
dfs(0,0,0)
print(ans)

Fixed submission:
n,a = map(int,input().split())
x = list(map(int,input().split()))
mx = max(x)
mx = max(mx,a)
dp = [[[0]*(n*mx+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(1,n+1):
    for j in range(i+1):
        for k in range(n*mx+1):
            if k<x[i-1]:
                dp[i][j][k] = dp[i-1][j][k]
            elif j>0 and k>=x[i-1]:
                dp[i][j][k] = dp[i-1][j][k]+dp[i-1][j-1][k-x[i-1]]
ans = 0
for i in range(n+1):
        ans += dp[n][i][a*i]
print(ans-1)
Buggy python submission (verdict: Runtime Error):
N = list(map(int, input().split())) 
for i in N:
  if N[i] == 0:
    print(i+1)
    

Fixed submission:
a=list(map(int,input().split()))
print(a.index(0)+1)

Buggy python submission (verdict: Runtime Error):
N = list(map(int, input().split())) 
print(N)
for i in N:
  if N[i] == 0:
    print(i+1)

Fixed submission:
a=list(map(int,input().split()))
print(a.index(0)+1)
Buggy python submission (verdict: Runtime Error):
A, V = map(int, input().split()) 
B, W= map(int, input().split()) 
T = int(input())


diff1 = B - A
diff2 = (V - W)*T

if ( diff1 < diff2):
  print("YES")
else:
  print("NO")

Fixed submission:
s = input()
print(s[0:3])
Buggy python submission (verdict: Runtime Error):
s = int(input())
str1, str2 = [s for s in input().split()]
print(str1)
print(str2)
ans=[]
for i in range(s-1):
  ans += str1[i]
  ans += str2[i]

  
print(''.join(ans))

Fixed submission:
a = int(input())
b = int(input())
c = a+b
print(6-c)
Buggy python submission (verdict: Runtime Error):
s = int(input())
str1, str2 = [s for s in input().split()]

ans=[]
for i in range(4):
  ans += str1[i]
  ans += str2[i]

  
print(''.join(ans))

Fixed submission:
s = int(input())
str1, str2 = [s for s in input().split()]


ans=[]
for i in range(s):
  ans += str1[i]
  ans += str2[i]

  
print(''.join(ans))
Buggy python submission (verdict: Runtime Error):
A = int(input())
c = 0
for i in range(1,10):
  if (A % i == 0 and A // i < 10):
    c += 1
if c > 0:
  print("Yes")
else:
  print("No"

Fixed submission:
A = int(input())
c = 0
for i in range(1,10):
  if (A % i == 0 and A // i < 10):
    c += 1
if c > 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import fractions
A = int(input())
for i in range(2,A):
  a = fractions.gcd(A,i)
  b = A/a
  break
print(int(i + b -2))
    

Fixed submission:
import math
n = int(input())
n_s = int(math.sqrt(n))
for i in range(1, n_s+1):
    if n % i == 0:
        a = i
        b = n / i
        
print(int(a + b - 2))

Buggy python submission (verdict: Runtime Error):
A = int(input())

for i in range(2,A):
  if (A % i == 0):
    a = i
    break

b = A / a
print(int(a+b-2))
    

Fixed submission:
import math
n = int(input())
n_s = int(math.sqrt(n))
for i in range(1, n_s+1):
    if n % i == 0:
        a = i
        b = n / i
        
print(int(a + b - 2))
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=str(input())

a=N

for i in range(N-1):
    if S[i]==S[i+1]:
        a-=1

print(a)






Fixed submission:
from sys import stdin
A, B = [int(x) for x in stdin.readline().rstrip().split()]
if A > 2*B:
  print(A - 2*B)
elif A <= 2*B:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
s = int(input())
for a in range(10**9):
  for b in range(10**9):
    for c in range(10**9):
      for d in range(10**9):
        
            if s == (a*d) -(b*c):
               
              print(0, 0, a, b, c, d)
              exit()
            

Fixed submission:
# calc
seq = {i: 10 ** i for i in range(0, 9+1)}
squared = {index: x ** 2 for index, x in seq.items()}


def sq(number):
    for i, s in squared.items():
        if number <= s:
            return i


def main():
    target = int(input())
    first_e = sq(target)
    first = 10 ** first_e

    if target == squared[first_e]:
        second = first
    else:
        second = (target // seq[first_e]) + 1
    over = first * second
    rest = over - target
    x0 = 0
    y0 = 0
    x1 = first
    y1 = 1
    x2 = rest
    y2 = second
    print(x0, y0, x1, y1, x2, y2)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
r = input()
s = 3*r**2
print(s)

Fixed submission:
r = int(input())
s = 3*r**2
print(s)
Buggy python submission (verdict: Runtime Error):
i=int(input())


lst = []
while i > 0:
    lst.append(i%10)
    i //= 10 
lst.reverse()
if (lst[0] == lst[1] or lst[1] == lst[2] or lst[2] == lst[3] ):
    print('Bad')
else:
    print('Good')

Fixed submission:
# coding: utf-8
# Your code here!

i=int(input())


lst = []
while i > 0:
    lst.append(i%10)
    i //= 10 
lst.reverse()
#print(lst)
if (len(lst) == 4):
    if (lst[0] == lst[1] or lst[1] == lst[2] or lst[2] == lst[3] ):
        print('Bad')
    else:
        print('Good')
elif (len(lst) == 3):
    if (lst[0] == lst[1] or lst[1] == lst[2]):
        print('Bad')
    else:
        print('Good')
elif (len(lst) == 2 or 1 or 0):
    print('Bad')
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())	
S = input()

#print(S[K-1])
S = (S[:K-2]+S[K-1].lower()+S[K:]
print(S)

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

#print(S[K-1])
S = (S[:K-1] + S[K-1].lower() + S[K:])
print(S)

Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())	
S = input()

#print(S[K-1])
S = (S[:K-2]+S[K-1].lower()+S[K:]
print(S)

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

#print(S[K-1])
S = (S[:K-1] + S[K-1].lower() + S[K:])
print(S)

Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())	
S = input()
S = S.replace(S[K],S[K].lower(),1)
print(S)

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

#print(S[K-1])
S = (S[:K-1] + S[K-1].lower() + S[K:])
print(S)

Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())	
Se = input()

S = S.replace(S[K-1],S[K-1].lower())
print(S)

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

#print(S[K-1])
S = (S[:K-1] + S[K-1].lower() + S[K:])
print(S)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
x=input()
y=input()

if x<=0 or x>=10 or y<=0 or y>=10:
    print("-1")
else:
    print(x*y)

Fixed submission:
# coding: utf-8
# Your code here!
x,y=input().split()

if int(x)<=0 or int(x)>=10 or int(y)<=0 or int(y)>=10:
    print("-1")
else:
    print(int(x)*int(y))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = input().split()
a = [int(i) for i in a]
s = sum(a)
dif = (1 / (4*m)) * s
cont = 0
for i in a:
     cont += (1 if i >= dif else 0)
print ('Yes' if cont >= m else 'No')


Fixed submission:
n, m = map(int, input().split())
n = n % m
if m == 1:  
    print(0)
elif n < m:
    print(min(abs(n-m), n))
else: 
    print(abs(n - m))
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

bool check_STR(string cad, int n)
{
    for (int i = 0, j = n - 1; i < n/2; i++, j--)
        if (cad[i] != cad[j])
            return false;
    return true;
}
int main()
{
    string cad, cad_S, cad_E; cin >> cad;
    int n = cad.size();
    cad_S = cad.substr(0, (n - 1)/ 2);
    cad_E = cad.substr((n+3)/2 - 1);
    if (check_STR(cad, n) && check_STR(cad_S, cad_S.size()) && check_STR(cad_E, cad_E.size()))
        puts("Yes");
    else
        puts("No");
 
}

Fixed submission:
def check(s):
    i, j = 0, len(s) - 1
    while i < j:
        if s[i] != s[j]:
            return False
        i += 1; j -= 1
    return True
s = input()
n = len(s)
n_S = s[0:(n - 1)//2]
n_E = s[(n+3)//2 - 1::]

if check(s) and check(n_S) and check(n_E):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=int(float(b)*100)
print(string(a*b)[:-2])

Fixed submission:
a,b=input().split()
a=int(a)
b=b.replace(".","")
b=int(b)
ans=str(a*b)
if (len(ans)>=3):
    print(ans[:-2])
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=(float(b)*100)
print(string(a*b)[:-2])

Fixed submission:
a,b=input().split()
a=int(a)
b=b.replace(".","")
b=int(b)
ans=str(a*b)
if (len(ans)>=3):
    print(ans[:-2])
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=int(b)
print(int(a*b))

Fixed submission:
a,b=input().split()
a=int(a)
b=b.replace(".","")
b=int(b)
ans=str(a*b)
if (len(ans)>=3):
    print(ans[:-2])
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import sys
s = sys.stdin.readline().rstrip()
t = sys.stdin.readline().rstrip()

count = 0
for i in range(len(s)):
  if s[i] != s[t]:
    count += 1

print(count)

Fixed submission:
import sys

s = sys.stdin.readline().rstrip()
t = sys.stdin.readline().rstrip()

count = 0
for i in range(len(s)):
  if s[i] != t[i]:
    count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
s = sys.stdin.readline().rstrip()
t = sys.stdin.readline().rstrip()

count = 0
for i in range(len(s)):
  if s[i] != s[t]:
    count += 1
print(count)

Fixed submission:
import sys

s = sys.stdin.readline().rstrip()
t = sys.stdin.readline().rstrip()

count = 0
for i in range(len(s)):
  if s[i] != t[i]:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import sys
a = map(int, sys.stdin.readline().rstrip().split(' '))

for i in range(len(a)):
  if a[i] == 0:
    print(i+1)
    break

Fixed submission:
import sys
a = list(map(int, sys.stdin.readline().rstrip().split(' ')))
 
for i in range(len(a)):
  if a[i] == 0:
    print(i+1)
    break
Buggy python submission (verdict: Runtime Error):
def main():
    n, *A = map(int, f.read().split())
    A.sort()
    n = A[-1]
    isPrime = [True] * (n + 1)
    prep = 0
    for i in A:
        if prep == i:
            isPrime[prep] = False
            continue
        if isPrime[i]:
            for j in range(i * 2, n + 1, i):
                isPrime[j] = False
        prep = i

    prep = res = 0
    for i in A:
        if prep == i:
            continue
        if isPrime[i]:
            res += 1
        prep = i
    print(res)


if __name__ == '__main__':
    main()

Fixed submission:
from collections import defaultdict, Counter

def main():
  n, *A = map(int, open(0).read().split())
  A.sort()
  n = A[-1]
  isPrime = [True] * (n + 1)
  prep = 0
  for i in A:
    if prep == i:
      isPrime[prep] = False
      continue
    if isPrime[i]:
      for j in range(i * 2, n + 1, i):
        isPrime[j] = False
    prep = i

  prep = res = 0
  for i in A:
    if prep == i:
      continue
    if isPrime[i]:
      res += 1
    prep = i
  print(res)
if __name__ == '__main__':
  main()

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import chain
from collections import Counter

def factors(n):
    yield from chain.from_iterable(({i, n//i} for i in range(1, int(n ** 0.5) + 1) if n % i == 0))

def get_non_divisible():
    n, *lst = map(int, open(0).read().split())
    c = Counter(lst)
    d = {val: sum((-c.get(f, 0) for f in factors(val)), len(lst)) for val in c}
    res = 0
    for i in lst:
      if d[i] == n - 1:
        res += 1
    return res
  
if __name__ == '__main__':
    print(get_non_divisible())

Fixed submission:
from collections import defaultdict, Counter

def main():
  n, *A = map(int, open(0).read().split())
  A.sort()
  n = A[-1]
  isPrime = [True] * (n + 1)
  prep = 0
  for i in A:
    if prep == i:
      isPrime[prep] = False
      continue
    if isPrime[i]:
      for j in range(i * 2, n + 1, i):
        isPrime[j] = False
    prep = i

  prep = res = 0
  for i in A:
    if prep == i:
      continue
    if isPrime[i]:
      res += 1
    prep = i
  print(res)
if __name__ == '__main__':
  main()

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict, Counter

def main():
  n, *A = map(int, open(0).read().split())
  cnt = defaultdict(int, Counter(A))
  dset = defaultdict(set)
  l = len(A)
  for i in cnt:
    for j in range(1, int(i ** 0.5) + 1):
      if not i % j:
        dset[i].add(j)
        dset[i].add(i // j)
  res = [l - sum([cnt[j] for j in dset[i]]) == n - 1 for i in A]
  print(sum(res))
  
if __name__ == '__main__':
  main()

Fixed submission:
from collections import defaultdict, Counter

def main():
  n, *A = map(int, open(0).read().split())
  A.sort()
  n = A[-1]
  isPrime = [True] * (n + 1)
  prep = 0
  for i in A:
    if prep == i:
      isPrime[prep] = False
      continue
    if isPrime[i]:
      for j in range(i * 2, n + 1, i):
        isPrime[j] = False
    prep = i

  prep = res = 0
  for i in A:
    if prep == i:
      continue
    if isPrime[i]:
      res += 1
    prep = i
  print(res)
if __name__ == '__main__':
  main()