Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
S1 = input()
S2 = '2' + S1[0]
res = 0

if len(S1) == 1:
    print(0)

else:
    for s in S1[1::]:
        if S2[-1] == s:
            S2 += s
        else:
            S2 = S2[:-1:]
            res += 2

    print(res)


Fixed submission:
S1 = input()
S2 = ''
res = 0

for s in S1:
    if len(S2) == 0 or S2[-1] == s:
        S2 += s
    else:
        S2 = S2[:-1:]
        res += 2

print(res)

Buggy python submission (verdict: Runtime Error):
S1 = input()
S2 = '2' + S1[0]
res = 0

if len(S1) == 1:
    print(0)

else:
    for s in S1:
        if S2[-1] == s:
            S2 += s
        else:
            S2 = S2[:-1:]
            res += 2

    print(res)


Fixed submission:
S1 = input()
S2 = ''
res = 0

for s in S1:
    if len(S2) == 0 or S2[-1] == s:
        S2 += s
    else:
        S2 = S2[:-1:]
        res += 2

print(res)

Buggy python submission (verdict: Runtime Error):
S1 = input()
S2 = '2' + S1[0]
res = 0

for s in S1[1::]:
    if S2[-1] == s:
        S2 += s
    else:
        S2 = S2[:-1:]
        res += 2

print(res)


Fixed submission:
S1 = input()
S2 = ''
res = 0

for s in S1:
    if len(S2) == 0 or S2[-1] == s:
        S2 += s
    else:
        S2 = S2[:-1:]
        res += 2

print(res)

Buggy python submission (verdict: Runtime Error):
S1 = input()
S2 = '2' + S1[0]
res = 0

for s in S1:
    if S2[-1] == s:
        S2 += s
    else:
        S2 = S2[:-1:]
        res += 2

print(res)


Fixed submission:
S1 = input()
S2 = ''
res = 0

for s in S1:
    if len(S2) == 0 or S2[-1] == s:
        S2 += s
    else:
        S2 = S2[:-1:]
        res += 2

print(res)

Buggy python submission (verdict: Runtime Error):
S1 = input()
S2 = S1[0]
res = 0

for s in S1:
    if S2[-1] == s:
        S2 += s
    else:
        S2 = S2[:-1:]
        res += 2

print(res)


Fixed submission:
S1 = input()
S2 = ''
res = 0

for s in S1:
    if len(S2) == 0 or S2[-1] == s:
        S2 += s
    else:
        S2 = S2[:-1:]
        res += 2

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = list(map(int, input().split()))
dp = [10**9+1] * N
dp[0] = 0

for n in range(N):
    for k in range(n+1, min(n+K+1, N)):
        dp[k] = min(dp[k], dp[n] + abs(H[k] - H[n]))

print(dp[N-1])


Fixed submission:
N, K = map(int, input().split())
H = list(map(int, input().split()))
dp = [10**9+1] * N
dp[0] = 0

for n in range(N):
    for k in range(n+1, min(n+K+1, N)):
        dp[k] = min(dp[k], dp[n] + abs(H[k] - H[n]))

print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())
dp = [-1] * (W+1)
dp[0] = 0

for n in range(N):
    w, v = map(int, input().split())

    for i in range(min(W, W-w), -1, -1):
        if dp[i] != -1:
            dp[i+w] = max(dp[i+w], dp[i]+v)

print(max(dp))


Fixed submission:
N, W = map(int, input().split())
dp = [-1] * (W+1)
dp[0] = 0

for n in range(N):
    w, v = map(int, input().split())

    for i in range(min(W, W-w), -1, -1):
        if dp[i] != -1:
            dp[i+w] = max(dp[i+w], dp[i]+v)

print(max(dp))
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int, input().split(' '))

count = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k == S:
                count += 1

print(count)


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

count = 0
for i in range(K+1):
    for j in range(K+1):
        k = S-(i+j)
        if 0<= k <= K:
            count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int, input().split(' '))

count = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k == S:
                count += 1

print(count)


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

count = 0
for i in range(K+1):
    for j in range(K+1):
        k = S-(i+j)
        if 0<= k <= K:
            count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
price=list(map(int,input().split()))
price.sort(reverse=True)
price_N=price[:K]
j=0
for i in price_K:
	j+=i
print(j)

Fixed submission:
N,K=map(int,input().split())
price=list(map(int,input().split()))
price.sort()
price_K=price[:K]
j=0
for i in price_K:
  j+=i
print(j)
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
print(a*b)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b)
print(a*b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
x=1
a=list(map(int,input().split(" ")))
for i in a:
	x=x*i
    if(x==0):
		break
	if(x>=1000000000000000000):
		break
if(x<=1000000000000000000):
	print(x)
else:
	print(-1)

Fixed submission:
n = int(input())
x=1
a=list(map(int,input().split(" ")))
if(0 in a):
	print(0)
else:
	for i in a:
		x=x*i
		if(x==0):
			break
		if(x>=1000000000000000000):
			break
	if(x<=1000000000000000000):
		print(x)
	else:
		print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x=1
a=list(map(int,input().split(" ")))
for i in a:
	x=x*i
if(x<=1000000000000000000):
	print(x)
else:
	print(-1)

Fixed submission:
n = int(input())
x=1
a=list(map(int,input().split(" ")))
if(0 in a):
	print(0)
else:
	for i in a:
		x=x*i
		if(x==0):
			break
		if(x>=1000000000000000000):
			break
	if(x<=1000000000000000000):
		print(x)
	else:
		print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N, K = map(int, input().split())
P = list(map(int, input().split()))
B = list(itertools.combinations(P, K))
ans = []
if N == 1:
    print(P[0])
    exit(0)
for b in B:
    ans.append(sum(b))
print(min(ans))

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
print(sum(P[0:K]))
Buggy python submission (verdict: Runtime Error):
X ,N = map(int,input().split())
P = list(map(int,input().split()))
A = list(range(min(P),max(P)))
P.sort()
ans = 0
min = 100
if N == 0:
    print(X)
    exit(0)


for a in A:
    if a not in P:
        if abs(a-X) < min:
            min = abs(a-X)
            ans = a
print(ans)

Fixed submission:
X ,N = map(int,input().split())
P = list(map(int,input().split()))
if N == 0:
    print(X)
    exit(0)
A = list(range(0,102))
ans = 0
mins = 100


for a in A:
    if a not in P:
        if abs(a-X) < mins:
            mins = abs(a-X)
if (X - mins) not in P:
    print(X-mins)
else:
    print(X+mins)
Buggy python submission (verdict: Runtime Error):
H_1,M_1,H_2,M_2,K = map(int,input().split())
MaxH = H_2 - H_1
if M_1 > M_2:
    MaxM = M_2 - M_1
if M_1 < M_2:
    MaxM = M_1 - M_2
useTime = MaxH*60 + MaxM
useTime -= K
print(useTime)

Fixed submission:
H_1,M_1,H_2,M_2,K = map(int,input().split())
if H_2 < H_1:
    H_2 += 24
MaxH = abs(H_2 - H_1)
if M_1 >= M_2:
    MaxM = M_2 - M_1
if M_1 < M_2:
    MaxM = abs(M_1 - M_2)
useTime = MaxH*60 + MaxM
useTime -= K
print(useTime)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,M,X = map(int,input().split())
datas = []
point = [0]*M
m = 0
max = 0
count = 0
for i in range(N):
    datas.append(list(map(int,input().split())))
print(datas)
while 1:
    for data in datas:
        if sum(data[1:-1]) > max:
            ans = count
            max = sum(data[1:-1])
        count += 1
    for i in range(M):
        point[i] += datas[ans][i+1]
    m += datas[ans][0]
    if all([x >= 10 for x in point]):
        print(m)
        break
    datas.pop(ans)
    if len(datas) == 0:
        print(-1)
        break
    max,ans,count = 0,0,0


Fixed submission:
import itertools
N,M,X = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
B = list(itertools.product([0,1], repeat=N))
sums = {}
anss = []
for i in range(N):
    for b in B:
        ans = 0
        Point = [0]*M
        count = 0
        for z in b:
            if z == 1:
                for k in range(M):
                    Point[k] += A[count][k+1]
                ans += A[count][0]
                if M == len([Point[n] for n in range(M) if Point[n] >= X]):
                    anss.append(ans)
            count += 1
if len(anss) != 0:
    print(min(anss))
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
S = int(input())
A,B = map(int,input().split())
check = false
ans = 0
i = 1
while S <= B:
  ans = S * i
  if A <= ans and B >= ans:
    check = true
    break
if check:
  print('OK')
else:
  print('NG')


Fixed submission:
S = int(input())
A,B = map(int,input().split())
check = False
ans = 0
i = 1
while ans <= B:
  ans = S * i
  if A <= ans and B >= ans:
    check = True
    break
  i += 1
if check:
  print('OK')
else:
  print('NG')

Buggy python submission (verdict: Runtime Error):
S = int(input())
A,B = map(int,input().split())
check = false
while S <= B:
  S *= S
  if A <= S and B >= S:
    check = true
    break
if check:
  print('OK')
else:
  print('NG')

Fixed submission:
S = int(input())
A,B = map(int,input().split())
check = False
ans = 0
i = 1
while ans <= B:
  ans = S * i
  if A <= ans and B >= ans:
    check = True
    break
  i += 1
if check:
  print('OK')
else:
  print('NG')
Buggy python submission (verdict: Runtime Error):
X = int(input())
check = false
ans = 100
count = 0
while ans < X:
  ans *= 1.01
  count += 1
print(count)
  
 

Fixed submission:
X = int(input())
ans = 100
count = 0
while ans < X:
  ans = int(ans * 1.01)
  count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np
R = int(input())
print(R*2*np.pi)

Fixed submission:
import numpy as np
R = int(input())
print(R*2*np.pi)

Buggy python submission (verdict: Runtime Error):
import numpy as np
R = int(input())
print(R*R*np.pi)

Fixed submission:
import numpy as np
R = int(input())
print(R*2*np.pi)
Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
ans = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            ans += math.gcd(math.gcd(a,b),c)
print(ans)

Fixed submission:
import math
K = int(input())
ans = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            ans += math.gcd(math.gcd(a,b),c)
print(ans)
Buggy python submission (verdict: Runtime Error):
def swap(A,B):
    a = A
    A = B
    B = a
    return A,B
X,Y,Z = map(int,input().split())
X,Y = swap(X,Y)
X,Z = swap(X,Z)
print(f'{X} {Y} {Z}')

Fixed submission:
def swap(A,B):
    a = A
    A = B
    B = a
    return A,B
X,Y,Z = map(int,input().split())
X,Y = swap(X,Y)
X,Z = swap(X,Z)
print(str(X)+' '+str(Y)+' '+str(Z))

Buggy python submission (verdict: Runtime Error):
def swap(A,B):
    a = A
    A = B
    B = a
    return A,B
X,Y,Z = map(int,input().split())
X,Y = swap(X,Y)
X,Z = swap(X,Z)
print(f'{X} {Y} {Z}')

Fixed submission:
def swap(A,B):
    a = A
    A = B
    B = a
    return A,B
X,Y,Z = map(int,input().split())
X,Y = swap(X,Y)
X,Z = swap(X,Z)
print(str(X)+' '+str(Y)+' '+str(Z))
Buggy python submission (verdict: Time Limit Exceeded):
# cook your dish here
n=int(input())
arr=list(map(int,input().split()))
for i in range(0,n):
    temp=0
    for j in range(len(arr)):
        if i+1==arr[j]:
            temp+=1
    print(temp)

Fixed submission:
# cook your dish here
n=int(input())
arr=list(map(int,input().split()))
blank=[0]*n
for i in range(len(arr)):
    blank[arr[i]-1]+=1
for i in blank:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

pro = 1

for i in a:
    pro = pro * i

if pro > 10 ** 18:
    print(-1)
else:
    print(pro)

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

pro = 1

if 0 in a:
    pro = 0
else:
    for i in a:
        if pro > 10 ** 18:
            pro = -1
            break
        else:
            pro = pro * i

if pro > 10 ** 18:
    print(-1)
else:
    print(pro)
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input()) 
total = 0
for a in range(1, n + 1):
    for b in range(1, n + 1):
        for c in range(1, n + 1):
            total += math.gcd(math.gcd(a, b), c)

print(total)    

Fixed submission:
import math

n = int(input()) 
total = 0
for a in range(1, n + 1):
    for b in range(1, n + 1):
        g = math.gcd(a ,b)
        if g == 1:
            total += n
        else:
            for c in range(1, n + 1):
                total += math.gcd(g, c)

print(total)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
cnt = 0

l_R = [i for i , x in enumerate(s) if x == "R"]
l_G = [i for i , x in enumerate(s) if x == "G"]
l_B = [i for i , x in enumerate(s) if x == "B"]

RGB = [[l_R, l_B, l_G], [l_R, l_G, l_B], [l_B, l_G, l_R], 
        [l_B, l_R, l_G], [l_G, l_R, l_B], [l_G, l_B, l_R]]

for A, B, C in RGB:
    for i in A:
        for j in B:
            for k in C:
                if (j - i != k - j) & (i < j < k):
                    cnt += 1
print(cnt)

Fixed submission:
n = int(input())
s = list(input())
cnt = 0

cnt = s.count("R") * s.count("B") * s.count("G")
# j - i = k -j を求める。
sub = 0 
for i in range(n):
    for j in range(i, n):
        k = 2 * j - i
        if k <= n - 1:
            if (s[i] != s[j]) and (s[j] != s[k]) and (s[i] != s[k]):
                sub += 1

print(cnt-sub)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
cnt = 0

for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if (j - i != k - j) & (i < j < k):
                if (s[i] != s[j]) & (s[j] != s[k]) & (s[k] != s[i]):
                    cnt += 1
print(cnt)

Fixed submission:
n = int(input())
s = list(input())
cnt = 0

cnt = s.count("R") * s.count("B") * s.count("G")
# j - i = k -j を求める。
sub = 0 
for i in range(n):
    for j in range(i, n):
        k = 2 * j - i
        if k <= n - 1:
            if (s[i] != s[j]) and (s[j] != s[k]) and (s[i] != s[k]):
                sub += 1

print(cnt-sub)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
cnt = 0



for i in range(n):
    for j in range(1, n):
        for k in range(3, n):
            if (j - i != k - j) & (i < j < k):
                if (s[i] != s[j]) & (s[j] != s[k]) & (s[k] != s[i]):
                    cnt += 1
print(cnt)

Fixed submission:
n = int(input())
s = list(input())
cnt = 0

cnt = s.count("R") * s.count("B") * s.count("G")
# j - i = k -j を求める。
sub = 0 
for i in range(n):
    for j in range(i, n):
        k = 2 * j - i
        if k <= n - 1:
            if (s[i] != s[j]) and (s[j] != s[k]) and (s[i] != s[k]):
                sub += 1

print(cnt-sub)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
lunlun = list(range(1, 10))

for i in range(k-1):
    a = lunlun.pop(0)
    b = a * 10 +  a % 10 
    if a % 10 != 0:
        lunlun.append(b - 1)
    lunlun.append(b)
    if a % 10 != 9:
        lunlun.append(b + 1)

print(lunlun.pop(0))

Fixed submission:
k = int(input())
lunlun = list(range(1, 10))

for i in range(k-1):
    a = lunlun[i]
    b = a * 10 +  a % 10 
    if a % 10 != 0:
        lunlun.append(b - 1)
    lunlun.append(b)
    if a % 10 != 9:
        lunlun.append(b + 1)

print(lunlun[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
lunlun = list(range(1, 10))

for i in range(k-1):
    a = lunlun.pop(0)
    if a % 10 != 0:
        lunlun.append(a * 10 + a % 10 - 1)
    lunlun.append(a * 10 + a % 10)
    if a % 10 != 9:
        lunlun.append(a * 10 + a % 10 + 1)

print(lunlun.pop(0))

Fixed submission:
k = int(input())
lunlun = list(range(1, 10))

for i in range(k-1):
    a = lunlun[i]
    b = a * 10 +  a % 10 
    if a % 10 != 0:
        lunlun.append(b - 1)
    lunlun.append(b)
    if a % 10 != 9:
        lunlun.append(b + 1)

print(lunlun[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    l = a.copy()
    l_q = []
    ttl = 0

    del l[i]
    ll = list(set(l))
    for i in ll:
        l_q.append(l.count(i))
    for i in l_q:
        if i >=2:
            ttl += i * (i - 1) / 2
    print(int(ttl))

    

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

from collections import Counter

ttl = 0
cnt = Counter(a)
for i in cnt.values():
    ttl += i * (i - 1) // 2

k_ttl = 0
for i in range(n):
    print(ttl - (cnt[a[i]] - 1))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())

state = 0
for i in range(q):
    query = list(input().split())
    if query[0] == "1":
        state += 1
    else:
        if (int(query[1]) + state) % 2 == 1:
            s = query[2] + s
        else:
            s += query[2]

if state % 2 == 0:
    print(s)
else:
    s = s[::-1]
    print(s)

Fixed submission:
from collections import deque
s = deque(input())
q = int(input())

state = 0
for i in range(q):
    query = list(input().split())
    if query[0] == "1":
        state += 1
    else:
        if (int(query[1]) + state) % 2 == 1:
            s.appendleft(query[2])
        else:
            s.append(query[2])

if state % 2 == 1:
    s = list(s)[::-1]

print("".join(s))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())

for i in range(q):
    query = list(input().split())
    if query[0] == "1":
        s = s[::-1]
    else:
        if query[1] == "1":
            s = query[2] + s
        else:
            s += query[2]
print(s)

Fixed submission:
from collections import deque
s = deque(input())
q = int(input())

state = 0
for i in range(q):
    query = list(input().split())
    if query[0] == "1":
        state += 1
    else:
        if (int(query[1]) + state) % 2 == 1:
            s.appendleft(query[2])
        else:
            s.append(query[2])

if state % 2 == 1:
    s = list(s)[::-1]

print("".join(s))
Buggy python submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
values = list(map(int, input().split()))
print(sum(sorted(values)[:k])

Fixed submission:
n, k = list(map(int, input().split()))
values = list(map(int, input().split()))
print(sum(sorted(values)[:k]))
Buggy python submission (verdict: Runtime Error):
def sequence(i):
  return 26 * (pow(26, i) - 1) // 25

n = int(input())
group = 1
while(n > sequence(group)):
  group += 1
  
at = n - sequence(group - 1)

name = ''
alph = 'abcdefghijklmnopqrstuvwxyz'

for i in range(group):
    base = n // pow(26, group - 1 - i)
    name += alph[base-1]
    n -= base * pow(26, group - 1 -i)

print(name)


Fixed submission:
alph = 'abcdefghijklmnopqrstuvwxyz'
def acc_seq(i):
  return 26 * (pow(26, i) - 1) // 25

def name_dog(digit, at, name):
  if digit ==1:
    return name + alph[at]
  else:
    group = at // pow(26, digit - 1)
    at -= pow(26, digit - 1) * group
    name += alph[group]
    return name_dog(digit-1, at, name)

n = int(input())
digit = 1
while(n > acc_seq(digit)):
  digit += 1

at = abs(n - acc_seq(digit - 1) - 1)
print(name_dog(digit, at, ''))
Buggy python submission (verdict: Runtime Error):
contest = input()
if "ARC" == contest:
  print("ABC")
else
  print("ARC")

Fixed submission:
contest = input()
if "ARC" == contest:
  print("ABC")
else:
  print("ARC")
Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = list(map(int, input().split()))
flg = False
for i in range(a, b+1):
  if i % k == 0:
    print("OK")
    flg = True
    break
print("NO") if not(flg)

Fixed submission:
k = int(input())
a, b = list(map(int, input().split()))
flg = False
for i in range(a, b+1):
  if i % k == 0:
    flg = True
    break
if flg:
  print("OK")
else:
  print("NG")

Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = list(map(int, input().split()))
flg = False
for i = range(a, b+1):
  if i % k == 0:
    print("OK")
    flg = True
    break
print("NO") if not(flg)

Fixed submission:
k = int(input())
a, b = list(map(int, input().split()))
flg = False
for i in range(a, b+1):
  if i % k == 0:
    flg = True
    break
if flg:
  print("OK")
else:
  print("NG")

Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = list(map(int, input().split()))
for i = range(a, b+1):
  if i % k == 0:
    print("OK")
    return
print("NO")


Fixed submission:
k = int(input())
a, b = list(map(int, input().split()))
flg = False
for i in range(a, b+1):
  if i % k == 0:
    flg = True
    break
if flg:
  print("OK")
else:
  print("NG")

Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = list(map(int, input().split()))
if a == b:
  print("OK") if a % k == 0 else print("NO")
elif b-a >= k:
  print("OK")
else:
  printf("NO")

Fixed submission:
k = int(input())
a, b = list(map(int, input().split()))
flg = False
for i in range(a, b+1):
  if i % k == 0:
    flg = True
    break
if flg:
  print("OK")
else:
  print("NG")
Buggy python submission (verdict: Runtime Error):
r = int(input())

print(3r*r)

Fixed submission:
r = int(input())
print(3*r*r)
Buggy python submission (verdict: Runtime Error):
N = int(input())
nums = [i for i in map(int, input().split())]
nums = sorted(nums)
first_num = nums[0]
branch_point = int(nums[-1]/2)
target_index = 0
target_num=0
answer=[]
first_flag=0
duplicate = [x for x in set(nums) if nums.count(x)>1]
while target_num<branch_point:
    target_num = nums[target_index]
    # if target_num == nums[target_index+1]:

    nums = [num for num in nums if num%target_num !=0]
    nums.append(target_num)
    if first_flag==1 and target_num ==first_num:
        break
    if first_flag==0:
        first_flag=1

for dup in duplicate:
    nums.remove(dup)

print(len(nums))

Fixed submission:
N = int(input())
nums = [i for i in map(int, input().split())]
nums = sorted(nums)
max = nums[-1]
dp = [1]*(max+1)
ans = 0

for i in range(len(nums)-1):
    p = nums[i]
    if dp[p] ==1:
        for q in range(max//p+1):
            dp[p*q]=0
        if nums[i] != nums[i+1]:
            ans+=1
if dp[max]==1:
    ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
nums = [i for i in map(int, input().split(" "))]

target_count = 0
for index in range(N):
    target = nums[index]
    divisible_count = 0
    for num in nums:
        residue = target % num
        if residue ==0:
            divisible_count +=1
        if divisible_count>=2:
            break
    if divisible_count ==1:
        target_count+=1

print(target_count)

Fixed submission:
N = int(input())
nums = [i for i in map(int, input().split())]
nums = sorted(nums)
max = nums[-1]
dp = [1]*(max+1)
ans = 0

for i in range(len(nums)-1):
    p = nums[i]
    if dp[p] ==1:
        for q in range(max//p+1):
            dp[p*q]=0
        if nums[i] != nums[i+1]:
            ans+=1
if dp[max]==1:
    ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
nums = [i for i in map(int, input().split(" "))]

target_count = 0
for index in range(N):
    target = nums[index]
    divisible_count = 0
    for num in nums:
        residue = target % num
        if residue ==0:
            divisible_count +=1
    if divisible_count==1:
        target_count+=1

print(target_count)

Fixed submission:
N = int(input())
nums = [i for i in map(int, input().split())]
nums = sorted(nums)
max = nums[-1]
dp = [1]*(max+1)
ans = 0

for i in range(len(nums)-1):
    p = nums[i]
    if dp[p] ==1:
        for q in range(max//p+1):
            dp[p*q]=0
        if nums[i] != nums[i+1]:
            ans+=1
if dp[max]==1:
    ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
A=[1,2,3,4,5,6,7,8,9]
I=1
while I<=K:
    B=A.pop(0)
    if not B%10==0:
        A.append(B%10+10*B-1)
    A.append(B%10+10*B)
    if not B%10==9:
        A.append(B%10+10*B+1)
    I+=1
print(B)

Fixed submission:
K=int(input())
A=[1,2,3,4,5,6,7,8,9]
I=0
while I<=K:
    if not A[I]%10==0:
        A.append(A[I]%10+10*A[I]-1)
    A.append(A[I]%10+10*A[I])
    if not A[I]%10==9:
        A.append(A[I]%10+10*A[I]+1)
    if len(A)>=K:
      break
    I+=1
print(A[K-1])