Problem:


Score : 100 points

Problem Statement

We have five variables x_1, x_2, x_3, x_4, and x_5.

The variable x_i was initially assigned a value of i.

Snuke chose one of these variables and assigned it 0.

You are given the values of the five variables after this assignment.

Find out which variable Snuke assigned 0.

Constraints

The values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.

Input

Input is given from Standard Input in the following format:

x_1 x_2 x_3 x_4 x_5

Output

If the variable Snuke assigned 0 was x_i, print the integer i.

Sample Input 1

0 2 3 4 5

Sample Output 1

1

In this case, Snuke assigned 0 to x_1, so we should print 1.

Sample Input 2

1 2 0 4 5

Sample Output 2

3



Sample input:
0 2 3 4 5


Sample output:
1

Submission status: Runtime Error

Solution code:
lis=list(input().split( ))
 
for i,x in enumerate(lis):
  if x == 0:
    a = i
print a

Submission status: Runtime Error

Solution code:
lis=list(input())

for i,x in enumerate(lis):
  if x == 0:
    a = i
print a

Submission status: Runtime Error

Solution code:
n = int(input())
s = [int(i) for i in input().split()]
l = 0
for i in range(n):
  for j in range(n):
    if (s[i] == s[j] or s[i]%s[j] == 0) and (i != j):
      l += 1
      break
print(len(s)-l)

Submission status: Runtime Error

Solution code:
a,b,c,d,e=map(int,input().split())
list=[a,b,c,d,e]
for i in list():
    if i==0:
        print(list.index(i)+1)

Submission status: Runtime Error

Solution code:
n = int(input())
s = [int(i) for i in input().split()]
s = set(s)
for i in s:
	for j in s:
		if i == j or i%j == 0:
			s.remove(i)
			s.add(-i)
			break
l = [i for i in s if i >= 0]
print(len(l))

Submission status: Runtime Error

Solution code:


num = x
x
if num == 0:

Submission status: Runtime Error

Solution code:
x = list(map(int, input().split()))
for i in range(0, len(x)):
  if x[i] == 0:
    print(i + 1)
    return

Submission status: Runtime Error

Solution code:
a = list(map(int,input().split())
i=0         
for i in len(a):
         if a[i] == 0:
         print(i+1)

Submission status: Runtime Error

Solution code:
a = list(map(int,input().split())
i=0         
for i in range(a):
         if a[i] == 0:
         print(i-1)

Submission status: Runtime Error

Solution code:
x,n=map(int,input().split())

sett=list(map(int,input().split()))
arr=[i for i in range(-1,102) if i not in sett]

min_=100000
num=0
for i in arr:
	if abs(x-i)<min_:
		min_=abs(x-i)
		num=i



print(num)

Submission status: Runtime Error

Solution code:
a1 = input()
a2 = input()
a3 = input()
a4 = input()
a5 = input()
if a1 == 0:
  print(1)
if a2 == 0:
  print(2)
if a3 == 0:
  print(3)
if a4 == 0:
  print(4)
if a5 == 0:
  print(5)

Submission status: Runtime Error

Solution code:
N = int(input().strip())
A = list(map(int, input().strip().split()))
 
count = 0
 
for n in range(N):
  flg = True
  if A.count(A[n]) == 1:
    tmp = [a for a in A if a != A[n]]
    for m in tmp:
      if A[n]%m == 0: flg = False
  else: flg = False
  
  if flg == True: count += 1
    
print(count)

Submission status: Runtime Error

Solution code:
X, Y = map(int, input().split())

for i in range(X+1):
    for j in range(X+1):
        if(i+j > X):
            continue

        if(Y == 4*i+2*j):
            print("Yes")
            exit()

print("No")

Submission status: Runtime Error

Solution code:
X, Y = map(int, input().split())

for i in range(X+1):
    for j in range(X+1):
        if(i+j > X):
            continue
        if(Y == 4*i+2*j):
            print("Yes")
            exit()
 
print("No")

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
 
for i in range(x+1):
  if i*4+(x-i)*2==y:
    print("Yes")
    break   
else:
  print("No")

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
 
for i in range(x+1):
  if i*4+(x-i)*2==y:
    print("Yes")
    
else:
  print("No")

Submission status: Runtime Error

Solution code:
#intの場合


huga = list(map(int, input().split()))

for i in range(len[huga]):
    if huga[i] == 0:
        print(huga[i])

Submission status: Runtime Error

Solution code:
list=[]
for i in range(5):
    list.append(int(input()))
if list[0]==0:
    print(1)
elif list[1]==0:
    print(2)
elif list[2]==0:
    print(3)
elif list[3]==0:
    print(4)
elif list[4]==0:
    print(5)

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
if a==0:
    print(1)
elif b==0:
    print(2)
elif c==0:
    print(3)
elif d==0:
    print(4)
elif e==0:
    print(5)

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

list=[a,b,c,d,e]
print(list.index(0)+1)

Submission status: Runtime Error

Solution code:
list1=[]
for i in range(5):
    list1.append(int(input()))
print(list1.index(0)+1)

Submission status: Runtime Error

Solution code:
a,b,c,d,e=int(input(),split())
if(a==0):
  print(1)
elif(b==0):
  print(2)
elif(c==0):
  print(3)
elif(d==0):
  print(4)
else:
  print(5)

Submission status: Runtime Error

Solution code:
a=input().sprit()
x=0
for n in a:
  x+=1
  if n=="0":
    aa=x
print(aa)

Submission status: Runtime Error

Solution code:
a=input().split()
x=0
for n in a:
  x+=1
  if n=0:
    aa=x
print(aa)

Submission status: Runtime Error

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

n, q = map(int, input().split())
y = [[] for _ in range(2*10**5)] # i番目の幼稚園の(-rate, 幼児) #heap
data = [(0, 0)]*n # i番目の(rate, 所属) #list
import heapq
for i in range(n):
    a, b = map(int, input().split())
    data[i] = (a, b - 1)
    heapq.heappush(y[b - 1], (-a, i))
max_rate = [] # (rate, 幼児, 所属) #heap
max_rate_list = [()]*(2*10**5) #list
for i in range(2*10**5):
    if y[i]:
        s, t = heapq.heappop(y[i])
        heapq.heappush(max_rate, (-s, t, i))
        heapq.heappush(y[i], (s, t))
        max_rate_list[i] = (-s, t)
from collections import defaultdict
ng_num = defaultdict(set)
for _ in range(q):
    c, d = map(int, input().split())
    c -= 1
    d -= 1
    a, b = data[c]
    data[c] = (a, d)
    heapq.heappush(y[d], (-a, c))
    ng_num[b].add(c)
    if c in ng_num[d]:
        ng_num[d].discard(c)
    #print(ng_num)
    while y[b]:
        s, t = heapq.heappop(y[b])
        if t not in ng_num[b]:
            heapq.heappush(max_rate, (-s, t, b))
            heapq.heappush(y[b], (s, t))
            max_rate_list[b] = (-s, t)
            break
    while y[d]:
        s, t = heapq.heappop(y[d])
        if t not in ng_num[d]:
            heapq.heappush(max_rate, (-s, t, d))
            heapq.heappush(y[d], (s, t))
            max_rate_list[d] = (-s, t)
            break
    #print(max_rate)
    while max_rate:
        s, t, r = heapq.heappop(max_rate)
        if t not in ng_num[r] and (s, t) == max_rate_list[r]:#heapqの弱点(不要になった要素を楽に抜くことができない)をリストでカバーしている
            print(s)
            heapq.heappush(max_rate, (s, t, r))
            break
#popしてその要素を戻すという操作でキューの利便性は上がるということに注意
#どの情報を持てばいいのかをしっかり考えたい

Submission status: Runtime Error

Solution code:
x,n = map(int,input().split())
p = list(map(int,input().split()))
ans = float('inf')
for i in range(101):
    if i not in p:
        if abs(i-x) < abs(ans-x):
            ans = i
        elif abs(i-x) == abs(ans -x):
            ans = min(ans,i)
print(ans)

Submission status: Runtime Error

Solution code:
X,N = map(int,input().split())
P = list(map(int,input().split()))

# 0,101は含まなければいけない
P_n = [i for i in range(0,102,1) if i not in P]
abs_value = [abs(X-P_n[j]) for j in range(len(P_n))]


min_abs = min(abs_value)
for k in range(len(abs_value)):
    if abs_value[k] == min_abs:
        print(P_n[k])
        break

Submission status: Runtime Error

Solution code:
import sys
print(sys.split().index("0") + 1)

Submission status: Runtime Error

Solution code:
import sys
print( sys.stdin.split().indx("0"))

Submission status: Runtime Error

Solution code:
print( sys.stdin.split().indx("0"))

Submission status: Runtime Error

Solution code:
import sys

X,N = list(map(int,input().split()))
P = list(map(int,input().split()))

P_n = [i for i in range(1,101,1) if i not in P]
abs_value = [abs(X-P_n[j]) for j in range(len(P_n))]
min_abs = min(abs_value)

for k in range(len(P_n)):
    if abs_value[k] == min_abs:
        print(P_n[k])
        sys.exit()

Submission status: Runtime Error

Solution code:
X, Y = map(int, input().split())
ans = 'No'
for a in range(X + 1):
    b = X - a
    if 2 * a + 4 * b == Y:
        ans = 'Yes'
        print(ans)

Submission status: Runtime Error

Solution code:
import sys
# from collections import deque
# from collections import Counter
# from math import sqrt
# from math import log
# from math import ceil

# def gcd(a, b):
# 	if(a==0):
# 		return b 
# 	return gcd(b%a,a)

# def sieve(n): 
# 	prime=[True for i in range(n+1)]
# 	p=2
# 	while(p*p<=n): 
# 		if (prime[p]==True): 
# 			for i in range(p*p,n+1,p): 
# 				prime[i]=False
# 		p+=1
# 	prime[0]=False
# 	prime[1]=False
# 	s=set()
# 	for i in range(len(prime)):
# 		if(prime[i]):
# 		s.add(i)
# 	return s 

# alpha=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
# mod=10**9+7

fast_reader=sys.stdin.readline
fast_writer=sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i)) for i in argv))
	fast_writer('\n')

def list_input():
	return list(map(int, input().split()))

def sep_input():
	return map(int, input().split())

#_______________________________________________________________________________________________________________________________________

x,n=sep_input()
l=list_input()
s=set(l)
i=0
while(True):
	if(x-i not in s):
		print(x-i)
		break
	elif(x+i not in s):
		print(x+i)
		break
	else:
		i+=1

Submission status: Runtime Error

Solution code:
N = int(input())
leng = 10**6+1
memo = [0]*leng
li = []
for n in map(int, input().split()):
    x = 0
    li.append(n)
    while x < leng:
        memo[x] +=1
        x += n
count = 0
for n in li:
    if memo[n] == 1:
        count+=1
print(count)

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split()))
res = 0
for i in range(len(a)):
	if a[i] == i:
		res = i + 1
        break
print(res)

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split()))
res = 0
for i in range(len(a)):
  	if a[i] == i:
      	res = i + 1
print(res)

Submission status: Runtime Error

Solution code:
from collections import Counter

def main():
    N = int(input())
    *A, = map(int, input().split())
    A.sort()
    C = Counter(A)

    MAX = 2000005
    T = [0]*MAX

    ans = 0
    for a in A:
        if T[a]:
            continue
        else:
            if C[a] == 1:
                ans += 1
            for i in range(2*a, MAX, a):
                T[i] += 1
    print(ans)

@jit()

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
[p]sp?[zr0=p1<x]dsxx

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
A = list(map(int,input().split()))

chofuku_dict = {}
chofuku = []

for a in A:
    if a not in chofuku_dict:
        chofuku_dict[a] = 1
    else:
        chofuku.append(a)
        
chofuku = set(chofuku)

A = list(set(A))
A.sort()

bl = np.array([0] + [1]*A[-1])

ans = 0
for a in A:
    if bl[a] == 0:
        continue
    if a in chofuku:
        continue
    bl[a] = 0
    ans += 1
    bl[2*a::a] = 0
print(ans)

Submission status: Runtime Error

Solution code:
F?++++-p

Submission status: Runtime Error

Solution code:
import streams, sequtils, strutils, algorithm, math, future, sets, tables, hashes
proc `ceilDiv`*[T](x, y: T): T = x div y + ord(x mod y != 0)
proc `//=`*(x: var SomeInteger; y: SomeInteger) = x = x div y
proc `%=`*(x: var SomeInteger; y: SomeInteger) = x = x mod y
var
    X = stdin.readLine.split.map(parseInt)
    ans:int
for i in 0..4:
    if X[i] == 0:
        ans = i.int + 1
echo ans

Submission status: Runtime Error

Solution code:
N=input()
A = list(map(int, input().split()))
T=True
sucl =[]
for i in range(0,int(N)):
  T=True
  for j in range(0,int(N)):
    
    if A[i] % A[j]==0:
      if i==j:
        pass
      else:
        T=False
        break
        
  if T==True:
    sucl.append(i)
print(len(sucl))

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
A = list(map(int,input().split()))

chofuku_dict = {}
chofuku = []

for a in A:
    if a not in chofuku_dict:
        chofuku_dict[a] = 1
    else:
        chofuku.append(a)
        
chofuku = set(chofuku)

A = list(set(A))
A.sort()

bl = np.array([0] + [1]*A[-1])
ans = 0
for a in A:
    if a in chofuku:
        continue
    if bl[a] == 1:
        bl[a] = 0
        ans += 1
        bl[2*a::a] = 0
print(ans)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
from bisect import *
from heapq import *
up=2*10**5
maxi=10**10
kind=[heapify([]) for i in range(up)]

class segtree:
    x_unit=maxi # 要素として入れられる最大値
    x_func=min
    def __init__(self,n):
        self.n=n
        self.x=[self.x_unit]*(2*n)
    def build(self, seq):
        for i,j in enumerate(seq, start=self.n):  # n番目からseqをx配列に移していく
            self.x[i] = j
        for i in range(self.n-1, 0, -1):
            self.x[i] = self.x_func(self.x[i*2], self.x[i*2+1])
            # セグ木トーナメント表の左右を比較
            # 例えばn=8の時、seq[4]はx[12]に、seq[5]はx[13]に入っている
            # さらにx[14]とx[15]の間に来るのはx[7]、x[12]とx[13]の間に来るのはx[6]
            # x_funcに従って値を取得
    def set_val(self,i,j): # 1点更新
        i += self.n
        self.x[i]=j
        while i>1:
            i//=2 # 更新後、木の上へと登っていくついでに更新
            self.x[i]=self.x_func(self.x[i*2], self.x[i*2+1])
    def fold(self,l,r): # 区間[l, r)の最小値などを取得 
        l+=self.n
        r+=self.n
        val_l=self.x_unit
        val_r=self.x_unit
        while l<r:
            if l & 1: # lが奇数
                val_l=self.x_func(val_l,self.x[l])
                l+=1 # 偶数に調節
            if r & 1: # rが奇数
                r-=1 # 開区間なので1個前は偶数番目の要素
                val_r=self.x_func(val_r,self.x[r])
            l //= 2
            r //= 2
        return self.x_func(val_l,val_r)

n,q=map(int, input().split())
shozoku=[-1]*n
rating=[0]*n
for i in range(n):
    a,b=map(int, input().split())
    heappush(kind[b-1],a)
    shozoku[i]=b-1
    rating[i]=a
#print(kind)
seg=segtree(up)
root=[maxi for i in range(up)]

for i in range(up):
    if kind[i]!=[]:
        rate=kind[i][-1]
        root[i]=rate
seg.build(root)

for i in range(q):
    c,d=map(int, input().split())
    c-=1
    d-=1
    if rating[c]==kind[shozoku[c]][-1] and len(kind[shozoku[c]])==1:
        kind[shozoku[c]]=heapify([])
        seg.set_val(shozoku[c], 2<<30)
    elif rating[c]==kind[shozoku[c]][-1]:
        kind[shozoku[c]]=heapify(kind[shozoku[c]][:-1])
        seg.set_val(shozoku[c], kind[shozoku[c]][-1])
    else:
        ind=bisect_right(kind[shozoku[c]],rating[c])
        kind[shozoku[c]]=heapify(kind[shozoku[c]][:ind-1]+kind[shozoku[c]][ind:])
    heappush(kind[d], rating[c])
    seg.set_val(d, kind[d][-1])
    shozoku[c]=d
    print(seg.x[1])

Submission status: Runtime Error

Solution code:
x, n = map(int, input(). split())
m = [0]*200
ans = 0
if n > 0:
  p = list(map(int, input(). split()))
else:
  print(x)
  quit()
for i in range(n):
  l = abs(x-p[i])
  m[l[i]] += 1
if m[0] == 0:
  print(x)
else:
  for j in range(1, 200):
    if m[j] < 2:
      a = x-j
      A = x+j
      b = p.count(a)
      if b == 0:
        ans = a
      else:
        ans = A
      break
print(ans)

Submission status: Runtime Error

Solution code:
l = list(map(int, input().split()))

for i in range(5):
  if l[i] == 0
    print(i + 1)

Submission status: Runtime Error

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    X, N = il()
    P = il()

    if len(P) == 0:
        print(X)
        exit()

    mx = max(P)
    p = MAX
    ret = 0
    for n in range(-1, mx + 1):
        if n not in P and p > abs(X - n):
            ret = n
            p = X - n
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))

T = [False]*(10**6+1)
D = [0]*(10**6+1)
for i in A:
    # iの2以上の倍数の値はTrueに
    for j in range(i*2, 10**6+1, i):
        T[j] = True
    # ダブってる値は2以上に
    D[i] += 1

# TがFalseかつDが1の数を数える
ans = 0
for i in A:
    if T[i] == False and D[i] == 1:
        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
X, N = [int(i) for i in input().split()]
if N == 0:
# if False:
    print(X)
else:
    Ps = set([int(i) for i in input().split()])
    if X not in Ps:
        print(X)

    # print(f'{X} {sorted(Ps)}')
    diff = 0
    while True:
        a = X - diff
        if a not in Ps:
            print(a)
            break
        a = X + diff
        if a not in Ps:
            print(a)
            break
        diff += 1

Submission status: Runtime Error

Solution code:
_,*p=map(int,open(0).read().split())
i=0
p.sort()
while(len(p)!=0):
  t=p[0]
  p=[m if m!=t else 0 for m in p[1:] if m%t!=0 or m==t ]
  if 0 in p:p=[i for i in p if i!=0]
  else:i+=1
print(i)

Submission status: Runtime Error

Solution code:
X, N = [int(i) for i in input().split()]
if N == 0:
    print(X)
else:
    Ps = set([int(i) for i in input().split()])
    if not X in Ps:
        print(X)

    # print(f'{X} {sorted(Ps)}')
    diff = 0
    while True:
        a = X - diff
        if a not in Ps:
            print(a)
            break
        a = X + diff
        if a not in Ps:
            print(a)
            break
        diff += 1

Submission status: Runtime Error

Solution code:
#import numpy as np

N = int(input())
A = list(map(int, input().split()))
A.sort()#わるほう

kouho = sorted([x for x in set(A) if A.count(x) == 1])
#maxA = 10**5

#target = kouho[:]
maxA = A[-1]
work=[0]*(A[-1]+1)

for i in range(len(A)):
    maxN = int(maxA/A[i])
    for n in range(1,maxN+1):
        buf = A[i]*n
        #remove_list.append(buf)
        work[buf]+=1
            #print(A[i]*n)
#target = kouho[:]
#kouho = list(set(kouho) - set(remove_list))

sm=0
for s in A:
    if work[s]==1: sm+=1
print(sm)

#print(len(kouho))

Submission status: Runtime Error

Solution code:
X = list(map(int, input().split()))
if X[0] > 100 or X[1] > 100:
  no_print
if X[1] > X[0]*4 or X[1] < X[0]*2:
  no_print
if X[1] % 2 == 1:
  no_print
 
number_check
  
def no_print():
  print(No)
  exit
 
def number_check():
  turtle = X[0]
  crane = 0
  i = 0
  while i < X[0]:
    result = turtle * 4 + crane * 2 
    if result > X[1]:
      crane += 1
      turtle -= 1
    if result == X[1]:
      print(Yes)
      exit
    if result < X[1]:
      turtle += 1
      crane -= 1
    i += 1

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
print(max(a))

Submission status: Runtime Error

Solution code:
X, N = map(int,input().split())
plist = list(map(int, input().split()))
if len(plist)==0:
  print(X)
  break
abst1 = []
abst2 = []
suci = []
for i in range(1,101):
  if i in plist:
    pass
  else:
    abst1.append(abs(X-i))
    abst2.append([i,abs(X-i)])
A = min(abst1)
for j in range(0,len(abst1)):
  if abst2[j][1] == A:
    print(abst2[j][0])
    break

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a_s = sorted(a)
    a_set = set(a_s)
    maxv = max(a)
    res = [0] * maxv
    rep = 0
    for i in a_s:
        if res[i-1] == 0:
            for j in range(i, maxv+1, i):
                res[j-1] += 1
        else:
            res[i-1] +=1
    cnt = 0
    for i in range(n):
        if res[a[i]-1] == 1:
            cnt += res[a[i]-1]
    print(cnt)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
count = 0
A.sort()
c=0
for k in range(len(A)-1):
    if A[k] == A[k+1]:
        del A[k]
        A.insert(0,0)
        c+=1
        if k <len(A)-2:
            if A[k+1] != A[k+2]:
                del A[k+1]
                A.insert(0,0)
                c+=1
        else:
            del A[k+1]
            A.insert(0,0)
            c+=1
del A[:c]
if len(A)>0:
    saidai = A[-1]
else:
    saidai=0
print(A)
foo = [0 for k in range(saidai+1)]
for k in range(len(A)):
    if foo[A[k]] == 1:
        continue
    else:
        count+=1
        for j in range(A[k], saidai+1, A[k]):
            foo[j] = 1
print(count)

Submission status: Runtime Error

Solution code:
import bisect as bc
 
N = int(input())
A = list(map(int,input().split()))
A.sort()
 
dp = [True for _ in range(A[-1]+1)]
 
for i in range(N):
    ai = A[i]
    for j in range(2,A[-1]+1):
        if ai*j > A[-1]:
            break
        dp[ai*j] = False
 
ans = 0
for i in range(N):
    if dp[A[i]]:
        if bc.bisect_right(A,A[i]) - bc.bisect_left(A,A[i]) == 1:
            ans += 1
            finish[A[i]] = False
 
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
A = sorted(map(int, input().split()), reverse=False)
dp = [0] * (max(A)+1)

for i in range(N):
    if dp[A[i]] == 0:
        dp[A[i]] = 1
        for j in range(i+1, N):
            if A[j] != 2 and A[j] % A[i] == 0:
                dp[A[j]] = 2
print(dp.count(1))

Submission status: Runtime Error

Solution code:
from math import *
x,n=map(int,input().split())
a=[int(x) for x in input().split()]
s=[i for i in range(-100,105)]
s=set(s)-set(a)
s=list(s)
s.sort()
dif=10**18
#a.sort()
ans=s[0]
for i in range(len(s)):
	if abs(s[i]-x)<dif:
		dif=abs(s[i]-x)
		ans=s[i]
print(ans)

Submission status: Runtime Error

Solution code:
X = list(map(int, input().split()))
count = 0
for I in X:
  if I == 0:
    print(count):
    exit
  count++

Submission status: Runtime Error

Solution code:
1,2,3,4,5 = input()
count = 0
for I in input():
  if I == 0:
    print(count)
  count++

Submission status: Runtime Error

Solution code:
list1 = list(map(int, input().split()))


for i in range(1,5):
  if list1[i-1] != i:
    return(i)

Submission status: Runtime Error

Solution code:
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
n = int(input())
#x, y = map(int, sys.stdin.readline().split())
#s = input()
a = list(map(int, sys.stdin.readline().split()))
     
def make_divisors(n):
    i = 1
    while i*i <= n:
        if n % i == 0:
            p = i
            q = n//i
            if p in d:
                return 0
            if q in d:
                return 0
        i += 1
    return 1

a.sort()
ans = 0
if a[0] == a[1]:
    ans -= 1
d = {}
for j in range(n):
    ans += make_divisors(a[j])
    d[a[j]] = a[j]

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
#N = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
C = [True]*len(A)
for i in range(len(A)):
    if C[i]==False:
        continue
    a=A[i]
    for j in range(i+1, len(A)):
        if A[j]%a==0:
            C[j] = False
count = len([i for i in C if i==True])
if A[0] in A[1:]:
    count-=1
print(count)

Submission status: Runtime Error

Solution code:
list = []
list.append(input())



for i in range(1,5):
  if list[i-1] != i:
    return(i)

Submission status: Runtime Error

Solution code:
a = map(int,input().split())
for i in range(0,4):
    if a[i]==0:
        print(i+1)

Submission status: Runtime Error

Solution code:
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
max=a[-1]
dp=[False for _ in range(max+1)]

Submission status: Runtime Error

Solution code:
N = int(input())
A = sorted(list(map(int, input().split())))
memo = {}
ans = 0

for a in A:
    if not a in memo:
        flag = True
        for div in memo:
            if a % div == 0:
                flag = False
                break
        if flag:
            ans += 1
            memo[a] = 1
    else:
        if memo[a] == 1:
            ans -= 1
            memo[a] += 1
        else:
            continue
print(ans)

Submission status: Runtime Error

Solution code:
X, N = map(int, input().split())
P = list(map(int, input().split()))
differ=[]

if N == 0:
    print(X)
else:
    for i in range(0,100):
        if i not in P:
            differ.append(abs(X - i))
        else:
            differ.append(1000)
    ans = differ.index(min(differ))
    print(ans)

Submission status: Runtime Error

Solution code:
a,l=map(int,input().split())
s=0
if l/a==2 or l/a==4:
	print("YES")
else:
	f=a*4
	if f>l:
		while f>l:
			f=f-2
		if f==l:
			print("YES")			
		else:
			print("NO")
	else:
		print("NO")

Submission status: Runtime Error

Solution code:
#import numpy as np

N = int(input())
A = list(map(int, input().split()))
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

#K = int(input())
#S = input()

##一次元配列の初期化
#a=[0]*5
#[i for i in range(100) if i%2==1] #奇数のみ
##二次元配列の初期化
#mod = np.array([[-1 for i in range(N)] for i in range(N)])
#A = list(set(A))
A = sorted(A)#わるほう

kouho = [x for x in set(A) if A.count(x) == 1]
target = list(kouho.copy())
            
for i in range(len(A)):
    if target == []:
        break
    maxN = int(max(target)/A[i])
    for n in range(2,maxN+1):
        if A[i]*n in kouho:
            kouho.remove(A[i]*n)
            #print(A[i]*n)
target = list(kouho.copy())
        
print(len(target))

Submission status: Runtime Error

Solution code:
N=int(input())
A=sorted(map(int,input().split()))

ans=0
dp=[True]*(max(A)+1)
for i in range(N):
    if not dp[A[i]]:
        continue
    if i==N-1:
        ans+=1
    elif i<N-1 and A[i+1]!=A[i]:
        ans+=1
    for j in range(1,max(A)//A[i]+1):
        dp[A[i]*j]=False
print(ans)

Submission status: Runtime Error

Solution code:
x,n =map(int,input().split())
 
if  n==0:
    print(x)
else:
    P =list(map(int,input().split()))
    for i in range(100):
        if  (x-i) not in P:
            print(x-i)
            break
        elif (x+i) not in P:
            print(x+i)
            break

Submission status: Runtime Error

Solution code:
n,*a=map(int,open(0).read().split())
i = 0
while a:
    if a.count(a[0]) == 1:
        i+=1
    a = list(filter(lambda x: x%a[0] >0,a))
print(i)

Submission status: Runtime Error

Solution code:
#import numpy as np

N = int(input())
A = list(map(int, input().split()))
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

#K = int(input())
#S = input()

##一次元配列の初期化
#a=[0]*5
#[i for i in range(100) if i%2==1] #奇数のみ
##二次元配列の初期化
#mod = np.array([[-1 for i in range(N)] for i in range(N)])
#A = list(set(A))
A = sorted(A)#わるほう

kouho = list(A.copy())#わられるほう
target = sorted(list(set(A)))

kouho = [x for x in set(A) if A.count(x) == 1]
target = [x for x in set(A) if A.count(x) == 1]
            
for i in range(len(A)):
    if target == []:
        break
    maxN = int(max(target)/A[i])
    for n in range(2,maxN+1):
        if A[i]*n in kouho:
            kouho.remove(A[i]*n)
            #print(A[i]*n)
    target = list(kouho.copy())
        
print(len(target))

Submission status: Runtime Error

Solution code:
x, n = map(int, input().split())
p = list(map(int, input().split()))
a = 0
ans = ''
p.sort()
print(p)
while ans == '':
  if len(p) == 0:
    ans = x
  elif x - a not in p:
    ans = x - a
  elif x + a not in p:
    ans = x + a
  else:
    a += 1
print(ans)

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    a = sorted(list(map(int, input().split())))
    pool = set()
    count = 0
    limit = 10 ** 6 // 2 +1
    for i in range(n):
        t = a[i]
        if t in pool:
            continue
        for j in range(1, limit):
            x = t*j
            if x > limit:
                break
            pool.add(x)
        if not (n > i+1 and t == a[i+1]):
            count += 1
    print(count)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n = list(map(int, input().split()))
if(n[1] == 0):
  print(n[0])
  exit()
x = list(map(int, input().split()))

for i in range(1,102):
  if n[0] - i not in x:
    print(n[0] - i)
    break
  elif n[0] + i not in x:
    print(n[0] + i)
    break

Submission status: Runtime Error

Solution code:
x,y = map(int, input().split())

for i in range(x + 1):
  legs = 2 * i + 4 * (x - i)
  
  if legs == y:
    print("Yes")
    break
    
  else:
    print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
A = [int(i) for i in input().split()]
ans = 0
A.sort()
if n > 1:
    if A[0] != A[1]:
        ans = 1
for i in range(1, n):
    can_div = False
    for j in range(0, i):
        if A[i] % A[j] == 0:
            can_div = True
            break
        if A[j] > A[i] // 2:
            if A[i-1] == A[i]:
                can_div = True
            else:
                break
    if not can_div:
        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import math
 
def is_prime(n):
    if n == 1: return False
 
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
 
    return True
  
N= int(input())
A = input().split()
ANS = 0
for i in range(N):
  C = A[i]
  if A.count(C) == 1:
    if is_prime(i) == True:
      ANS += 1
print(ANS)

Submission status: Runtime Error

Solution code:
def main(N, a):
    a.sort()
    if a[0] == 1:
        if a[1] == 1:
            return 0
        return 1
    i = 0
    while True:
        num = a[0]
        if 2 > len(a):
            return len(a)+i
        while True:
            if num == a[1]:
                a = [i for i in a if i != num]
                if 2 > len(a):
                    return len(a)+i
                num = a[0]
            else:
                break
        if num*2 > a[len(a)-1]:
            a = [i for i in a if i % num != 0]
            return len(a)+i+1
        a = [i for i in a if i % num != 0]
        i = i+1


N = int(input())
a = list(map(int, input().split()))
print(main(N, a))