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:
import math

def isPrime(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 = sorted(list(map(int, input().split())))
cnt = N

if len(A) == 1:
  print(N)
  exit()

if A[0] == 1 and A[1] == 1:
  print(N)
  exit()
if A[0] == 1 and A[1] != 1:
  print(N - 1)
  exit()

for i in range(N):
  x = A[i]
  if isPrime(x):
    if i - 1 >= 0:
      if x == A[i - 1]:
        cnt -= 1
        continue
    if i + 1 < N:
      if x == A[i + 1]:
        cnt -= 1
        continue
    continue
    
  for j in range(i):
    y = A[j]
    if x % y == 0:
      cnt -= 1
      break
print(cnt)

Submission status: Runtime Error

Solution code:
x,n=map(int,input().split())
try:
    p=list(map(int,input().split()))
    mina=100
    for i in range(min(p),max(p)):
        if i not in p:
            if mina>abs(i-x):
                mina=abs(i-x)
                ans=i
                if ans>x and (x-mina) not in p:
                    ans=x-mina
except:
    ans=x

print(ans)

Submission status: Runtime Error

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

alist.sort()
#print(alist)
ans=0
for i in range(1,N):
    a=alist[i]
    aaa=[a]*i
    x=np.array(aaa)
    y=np.array(alist[0:i])
    amari=x%y
    if list(amari).count(0)==1:
        ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
A_ = [int(i) for i in input().split()]
A=set(A_)
if len(_A)>len(A) and len(A)=0:
    print(0)
else:
    A.sort()
    A.reverse()
    times = 0
    for n,i in enumerate(A):
        flag = 0
        for j in list(range(n-1,n))+list(range(n+1,len(A))):
            if A[j]<=i:
                if i%A[j]==0:
                    flag = 1
                    break
        if flag == 0:            
            times+=1   
            
    print(times)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9
import fractions

def main():
    n = int(input())
    A = list(map(int, input().split()))

    A.sort()
    ans = len(A)
    if n == 1:
        print(1)
        return
    for i in range(n):
        for j in range(n):
            ri = -i-1
            r = A[ri]
            l = A[j]

            if (ri!=-n and r == A[ri-1]) or (j!=n-1 and r == A[ri+1]):
                ans -= 1
                break
            if n+ri == j:
                break
            if r % l == 0:
                ans -= 1
                break
            if l >= r**(1/2):
                break
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

a = 2*X -Y/2
b = Y/2 - X

if ((a+b) == X) and ((2*a+4*b) == Y):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a,b,c,d,e = int(input())
lists = ['a', 'b', 'c', 'd', 'e']
for i in range(lists(4)):
    if i == 0:
        print(i)

Submission status: Runtime Error

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

count=0
for i in l:
  for j in l:
    if i%j==0:
      if i!=j:
        count+=1
        break
      
print(n-count)

Submission status: Runtime Error

Solution code:
import itertools

def main():
    n = int(input())
    a = list(map(int,input().split()))
    b = set(a)
    ansAry = [0] * 10000000

    num = len(a) - len(b)

    count = 0

    a.sort()

    x =  list(itertools.combinations(a,2))
    # print (x)

    
    for i in range(len(x) // 3 * 2):
        if x[i][1] % x[i][0] == 0 and ansAry[x[i][1]] == 0 :
            count += 1
            ansAry[x[i][1]] = 1

    print(n - count - num)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int,input().split()))
count = N
for i in range(N):
	for j in range(N):
		if a[i]%a[j] ==0 and i!= j:
			count = count -1
			break
print(count)

Submission status: Runtime Error

Solution code:
from numba import jit

@jit
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    if len(set(A)) == 1:
        print(0)
        return
    A.sort()

    ans = 0
    while len(A) > 0:
        a = A.pop(0)
        ans += 1
        A = [i for i in A if i % a != 0]

    print(ans)

resolve()

Submission status: Runtime Error

Solution code:
from collections import deque
n = int(input())
an = list(map(int, input().split()))

an.sort()
an = deque(an)
ls = deque()
same = -1
while an:
    a = an.popleft()
    t = True
    if same == a:
      continue
    for i in ls:
        if i > a ** (1/2):
            t = False
            break
        if a == i:
            ls.pop()
            same = a
            t = False
            break
        if a % i == 0:
            t = False
            break
    if t:
        ls.append(a)

print(len(ls))

Submission status: Runtime Error

Solution code:
import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict
 
x,y = map(int,input().split())
 
for i in range(1, x+1):
    # 足の数
    f = 2 * i + 4 * (x - i)
    if f == y:
        print('Yes')
        sys.exit()
    elif i==x: 
    	print('No')

Submission status: Runtime Error

Solution code:
p=list(map(int,input().split()))
x=p.get(0)
print(x)

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    
    A.sort()
    A_set = set(A)
    count = 0
    last_num = 0
    flag = True
    now_num = 0
    half_num = 0
    count_flag = False
    
    if A.count(1) == 1:
        print(1)
        exit()
    for i in range(N):
        count_flag = True
        now_num = A[i]
        half_num = A[i]/2
        if now_num == last_num:
            if flag:
                count -= 1
                flag = False
        else:
            for j in range(0, i):
                if A[j] > half_num:
                    break
                if now_num % A[j] == 0:
                    count_flag = False
                    break
            if count_flag:
                if not flag:
                    flag = True
                count += 1
            last_num = A[i]
    print(count)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
x, n = map(int, input().split())
if n > 1:
  p = list(map(int, input().split()))
else:
  print(x)
  exit(0)
   
for i in range(n+1):
  if (x-i) not in p:
    print(x-i)
    break
  if (x+i) not in p:
    print(x+i)
    break

Submission status: Runtime Error

Solution code:
from collections import deque
n = int(input())
an = list(map(int, input().split()))

an.sort()
an = deque(an)
ls = deque()
same = -1
while an:
    a = an.popleft()
    t = True
    if same == a:
      continue
    for i in ls:
        if a == i:
            ls.pop()
            same = a
            t = False
            break
        if a % i == 0:
            t = False
            break
    if t:
        ls.append(a)

print(len(ls))

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)

    diff = 0
    while True:
        if not X - diff in Ps:
            print(X - diff)
            break
        if not X + diff in Ps:
            print(X + diff)
            break
        diff += 1

Submission status: Runtime Error

Solution code:
X, Y = map(int, input().split())
if ((4*X - Y) < 0) or (6*X > Y) or ((4*X - Y)%2 != 0):
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

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


for i in range(1,N+1):
    a = X+i
    b = X-i
    if b not in p:
        print(b)
        break
    elif a not in p:
        print(a)
        break

if N==0:
    print(X)

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int,input().split()))
ans=0
dup = [x for x in set(A) if A.count(x) > 1]

A=set(A)
for i in range(len(dup)):
    A.remove(dup[i])


A=sorted(set(A))

if A==0:
    print(0)
else:
    for i in range(len(A)):
        k=0
        for j in range(i):
            if A[i]%A[j]==0:
                k=1
                break


        if k==0:
            
            ans+=1
    print(ans)

Submission status: Runtime Error

Solution code:
x,y=(int(x) for x in input().split())
a=[int(x) for x in input().split()]
1<=x<=100
0<=y<=100
while y>0:
    if y in a:
        z=y+1
    elif not y in a:
        print('y')
        break
    elif z in a:
        z+=1
    else:
        break
while y<100:
    if y in a:
        b=y-1
    elif b in a:
        b+=1
    else:
        break
c=z-y
d=b-y
if not y in a:
    pass
elif abs(c)<abs(d):
    print(c)
else:
    print(d)

Submission status: Runtime Error

Solution code:
def test(X, N, P):
  P_int = []
  
  for i in P:
    P_int.append(int(i))

  lis = []
  
  for i in list(range(101)):
    if i not in P_int:
      lis.append(i)
  
  min_adv = 1000
  min_num = 1000
  
  for i in lis:
    rec_adv = abs(X - i)
    if rec_adv < min_adv:
      min_num = i
      min_adv = rec_adv
      
  print(min_num)

X, N = input().split()
P = input().split()

test(int(X), int(N), P)

Submission status: Runtime Error

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

print(a.index("0"))

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int,input().split()))
count = 0
flag = 0
for i in range(N):
	for j in range(N):
		if a[i]%a[j] ==0 and i!= j:
			flag = 1
			break
	if(flag == 0):
		count = count +1
	flag = 0
print(count)

Submission status: Runtime Error

Solution code:
X, Y = map(int,input().split())
crain = (4 * X - Y) / 2
if crain.is_integer() and crain > -1:
    crain = int(crain)
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
def test(X, N, P):
  P_int = []
  
  for i in P:
    P_int.append(int(i))

  
  lis = []
  
  for i in list(range(101)):
    if i not in P_int:
      lis.append(i)
  
  min_adv = 1000
  min_num = 1000
  
  for i in lis:
    rec_adv = abs(X - i)
    
    if rec_adv < min_adv:
      min_num = i      
      min_adv = rec_adv
      
  print(min_num)

X, N = input().split()
P = input().split()

test(int(X), int(N), P)

Submission status: Runtime Error

Solution code:
X, Y = map(int, input().split())
if (4*X - Y) < 0:
    print("No")
elif 6*X > Y:
    print("No")
elif (4*X - Y)%2 != 0:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

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

print(list.index("0"))

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0

    A.sort(reverse=True)
    A = tuple(A)

    for i in range(N-1):
        flg = True
        for j in range(i+1, N):
            if A[i] % A[j] == 0:
                flg = False
                break
        if flg == True:
            ans += 1

    if A[N-1] != A[N-2]:
        ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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


As = {}
Maxs = {}
Enji = [0 for n in range(N)]
EnjiRate = [0 for n in range(N)]

for i in range(N):
    A, B = map(int, input().split())
    if B in As:
        As[B].append(A)
        Maxs[B] = max(Maxs[B], A)
    else:
        As[B] = [A]
        Maxs[B] = A
    EnjiRate[i] = A
    Enji[i] = B

MaxHist = {}
for k, v in Maxs.items():
    if v in MaxHist:
        MaxHist[v].add(k)
    else:
        MaxHist[v] = set([k])


def addMap(target, key, val):
    if key in target:
        target[key].add(val)
    else:
        target[key] = set([val])


def removeMap(target, key, val):
    if len(target[key]) == 1:
        del target[key]
    else:
        target[key].remove(val)


minMax = sorted(MaxHist)[0]

for i in range(Q):
    c, D = map(int, input().split())
    C = c - 1
    prevPos = Enji[C]
    As[prevPos].remove(EnjiRate[C])
    if EnjiRate[C] == Maxs[prevPos]:
        # 再計算
        prevMax = Maxs[prevPos]
        removeMap(MaxHist, prevMax, prevPos)
        if len(As[prevPos]) > 0:
            currentMax = max(As[prevPos])
            Maxs[prevPos] = currentMax
            addMap(MaxHist, currentMax, prevPos)
    Enji[C] = D
    if D not in As:
        As[D] = []

    As[D].append(EnjiRate[C])

    if D in Maxs:
        if EnjiRate[C] > Maxs[D]:
            # 再計算
            currentMax = EnjiRate[C]
            prevMax = Maxs[D]
            removeMap(MaxHist, prevMax, D)
            Maxs[D] = currentMax
            addMap(MaxHist, currentMax, D)
    else:
        # これが最大
        currentMax = EnjiRate[C]
        Maxs[D] = currentMax
        addMap(MaxHist, currentMax, D)

    if minMax in MaxHist:
        print(minMax)
    else:
        print(sorted(MaxHist)[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b,c,d,e=[int(input()) for i in range(4)]
if i == 0:
    print(range(i))

Submission status: Runtime Error

Solution code:
a,b,c,d,e=map(int,input().split())
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:
#!/usr/bin/env python3
from collections import Counter

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = set()
    for i,l in Counter(A).items():
        if l == 1:
            B.add(i)
    A = sorted(B)
    N = len(A)
    # L = [1] * (N+1)
    # for i in range(N):
    #     L[i+1] = (L[i]*A[i])//gcd(L[i],A[i])
    ans = 0
    # print(A)
    # print(L)
    A.sort()
    for i in range(N):
        flag = True
        for j in range(i):
            if A[i] % A[j] == 0:
                flag = False
                break
        if flag:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
    x = list(map(int,input().split()))
    print(x.index(0)+1)

Submission status: Runtime Error

Solution code:
from itertools import *
X,Y = map(int,input().split())
if X*2 == Y:
    print("Yes")
elif X*4 == Y:
    print("Yes")
else:
    tmp = [2 for i in range(25)]+[4 for i in range(25)]
    li = set(combinations(tmp,X))
    for i in li:
        if sum(i) == Y:
            print("Yes")
            exit()
    print("No")

Submission status: Runtime Error

Solution code:
from itertools import *
X,Y = map(int,input().split())
if X*2 == Y:
    print("Yes")
elif X*4 == Y:
    print("Yes")
else:
    tmp = [2 for i in range(20)]+[4 for i in range(20)]
    li = set(combinations(tmp,X))
    for i in li:
        if sum(i) == Y:
            print("Yes")
            exit()
    print("No")

Submission status: Runtime Error

Solution code:
i = input()
p = i.index(0) + 1
print(p)

Submission status: Runtime Error

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

a = 2*X -Y/2
b = Y/2 - X

if (a+b) == X:
    pass 
    if (2*a+4*b) == Y:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
L=list(map(int,input().split()))
L = [abs(i - A) for i in L]
L +=[0]
L=sorted(L)
x=0
i,j=0,1
while True:
    if L[i] == x and L[j] == x :
        i,j = i+2,j+2
        x += 1
    else:
        break
print(A+x)

Submission status: Runtime Error

Solution code:
i=input()
print(i[])

Submission status: Runtime Error

Solution code:
#atcoder1問目
x=input()
    print(x.index('0')+1)

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int,input().split()))
count = 0
flag = 0
for i in range(N):
	for j in range(N):
		if a[i]%a[j] ==0 and i!= j:
			flag = 1
	if(flag == 0):
		count = count +1
	flag = 0
print(count)

Submission status: Runtime Error

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

if N == 0:
    print(X)
    exit()

P = input().split()
for i in range(len(P)):
    P[i] = int(P[i])

if X not in P:
    print(X)
    exit()

flag_p = True
flag_n = True

abs_num = 0
abs_num_p = X + 1
abs_num_n = X - 1
while True:

    if abs_num_p in P:
        flag_p = True
    else:
        flag_p = False

    if abs_num_n in P:
        flag_n = True
    else:
        flag_n = False

    if(flag_p == True & flag_n == True):
        abs_num_p += 1
        abs_num_n -= 1
        continue;
    elif(flag_p == True & flag_n == False):
        print(abs_num_n)
        break;
    elif(flag_p == False):
        print(abs_num_p)
        break;

Submission status: Runtime Error

Solution code:
x = []
n = 0

for i in x:
  if x[n] == 0:
    print n+1
    break;
  else:
    n += 1

Submission status: Runtime Error

Solution code:
import numpy as np
X, N = map(int, input().split())
p_list = set([int(i) for i in input().split()])
set_all = set(np.arange(-100, 101))
ex_list = set_all-p_list
ex_list = list(ex_list)
diff_list = [np.abs(i-X) for i in ex_list]
min_index = np.argmin(diff_list)
print(ex_list[min_index])

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()))
print(n)
print(type(x))
  
for i in range(1,100):
  if(('n[0] - i' in x) == False):
    print(n[0] - i)
    exit()
  elif(('n[0] + i' in x) == False):
    print(n[0] + i)
    exit()

Submission status: Runtime Error

Solution code:
from sys import stdin

x1 = int(stdin.readline().rstrip())
x2 = int(stdin.readline().rstrip())
x3 = int(stdin.readline().rstrip())
x4 = int(stdin.readline().rstrip())
x5 = int(stdin.readline().rstrip())

ls = [x1, x2, x3, x4, x5]

i = 0
while i < len(ls):
    if ls[i] == 0:
        print(i + 1)
        break
    i += 1

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
count = 1
for i in range(N-1):
  flag = 1
  for j in range(N-1, i, -1):
    if A[i] % A[j] == 0:
      flag = 0
      break
  if flag:
      count += 1
if N == 1:
  print(0)
elif A[0] == A[1]:
  print(0)
else:
  print(count)

Submission status: Runtime Error

Solution code:
def main():
    x, n = map(int, input().split())
    p = list(map(int, input().split()))
    _near = 0
    for i in range(101):
        if i in p:
            continue
        if abs(_near - x) > abs(i - x):
            if _near > i:
                _near = i
    print(_near)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
a = list(map(int,input().split()))
if not a[1] ==0:
  b = list(map(int,input().split()))
  b2 = sorted(b)##小さい順に並べる
  if abs(a[0]-b2[0]) <= abs(a[0]-b2[a[1]-1]):#bがすべて連続の場合の対策
    c = b2[0]-a[0]-1
  else:
    c = b2[a[1]-1]-a[0]+1
  if a[0] < b2[0]:
    print(a[0])
  elif a[0] > b2[a[1]-1]:
    print(a[0])
  else:
    for i in range(a[1]-1):
      if abs(b2[i+1]-b[i])>1:
        for j in range(b2[i+1]-b2[i]-1):##差分が1より大きい場合ソート
          if abs(c) > abs(b2[i]-a[0]+j+1):
            c = b2[i]-a[0]+j+1
    print(c+a[0])
else:
  print(a[0])

Submission status: Runtime Error

Solution code:
x, y = map(int,input().split())
z=-2
if x %2 == 0:
    for i in range(x):
        if i % 2 == 0:
            z +=4
        else:
            z +=2
    if z == y :
            print("Yes")
    elif z!=y :
            print("No")
else:
    for i in range(x):
        if i % 2 == 0:
            z +=4
        else:
            z +=2
    if z == y or z == (y-2):
            print("Yes")
    elif z!=y :
            print("No")

Submission status: Runtime Error

Solution code:
l = int(input())
n = [int(i) for i in input().split()]
u = n.copy()
n.sort()
u.sort(reverse=True)

counter = 0

for j in range(l):
  for i in range(l):
    if n[i] == u[j]:
      pass
    elif u[j] % n[i] == 0:
      counter += 1
      break
    else:
      pass

print(l - counter)

Submission status: Runtime Error

Solution code:
x, y = map(int,input().split())
z=-2
if x %2 == 0:
    for i in range(x):
        if i % 2 == 0:
            z +=4
        else:
            z +=2
    if z == y :
            print("Yes")
    elif z!=y :
            print("No")
elif x%2 != 0:
    for i in range(x):
        if i % 2 == 0:
            z +=4
        else:
            z +=2
    if z == y or z == (y-2):
            print("Yes")
    elif z!=y :
            print("No")

Submission status: Runtime Error

Solution code:
a = list(map(int,input().split()))
print(aa.index(0))

Submission status: Runtime Error

Solution code:
from sys import stdin

x1 = int(stdin.readline().rstrip())
x2 = int(stdin.readline().rstrip())
x3 = int(stdin.readline().rstrip())
x4 = int(stdin.readline().rstrip())
x5 = int(stdin.readline().rstrip())

ls = [x1, x2, x3, x4, x5]

i = 0
while i < len(ls):
    if ls[i] == 0:
        print(i + 1)
        break
    i += 1

Submission status: Runtime Error

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

for i in range(50):
  if X-i not in ps:
    print(X-i)
    break
  elif X+i not in ps:
    print(X+i)
    break

Submission status: Runtime Error

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

if 2*X<Y<4*X and (Y-2*X)%2==0 and (4*X-Y)%2==0:
    print("Yes")
elif (4*X-Y)/2==1 and (Y-2*X)/2==0:
    print("Yes")
elif (4*X-Y)/2==0 and (Y-2*X)/2==1:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
A.sort()
cnt = 0
onaji = 0

for i in range(len(A)):
    if i >= len(A)-1:
        break
    for j in range(len(A)-1,i,-1):
        if A[i] == A[j]:
            onaji = 1
        if A[j] % A[i] == 0:
            del A[j]
            
    if onaji == 1:
        del A[i]
        onaji = 0

print(len(A))

Submission status: Runtime Error

Solution code:
def main1():
    N=int(input())
    A=list(map(int,input().split()))
    A.sort()
    ans=[1]*len(A)
    for i in  range(len(A)-1):
        if ans[i]==0:
            continue
        for j in range(i+1,len(A)):
            if A[j]%A[i]==0:
                ans[j]=0
    an=0
    for i in range(len(A)-1):
        if A[i]!=A[i+1]:
            an+=ans[i]
    an+=ans[-1]
    print(an)
main1()

Submission status: Runtime Error

Solution code:
x, y = map(int,input().split())
z=-2
if x %2 == 0:
    for i in range(x):
        if i % 2 == 0:
            z +=4
        else:
            z +=2
    if z == y :
            print("Yes")
    elif z!=y :
            print("No")
elif x%2 != 0
    for i in range(x):
        if i % 2 == 0:
            z +=4
        else:
            z +=2
    if z == y or z == (y-2):
            print("Yes")
    elif z!=y :
            print("No")

Submission status: Runtime Error

Solution code:
def main():
    sum, leg = map(int, input().split())
    


    for i in range(sum):
        for x in range(sum - i):
            crane = i * 2
            turtle = x * 4
            total = crane + turtle
            if total == leg:
                print('Yes')
                return
    print('No')
    
main()

Submission status: Runtime Error

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

print("No")

Submission status: Runtime Error

Solution code:
#デフォルト
import itertools
from collections import defaultdict
import collections
import math
import sys
sys.setrecursionlimit(200000)
mod = 1000000007

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

a.sort(reverse=True)
ans = 0

for i in range(n):
    for j in range(n):
        if a[i] % a[n - j - 1] == 0 and i != n - j - 1:
            break
        if j == n - 1:
            ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = [int(s) for s in input().split()]
# a = list(range(1, 2*10**5))
ans = 0
for i,j in enumerate(a):
  a_i = sum(a[i]%s==0 for s in a)
  ans += min([2, a_i])
  # print(min([2, a_i]))
# print('###')
print(n - (ans-n))

Submission status: Runtime Error

Solution code:
# a: 総数hiki， b: 足の数
a, b = map(int, input().split())

# かめiひき
for i in range(a+1):
  total = 4*i + 2*(a-i)
  if total == b:
    ans = 'Yes'
    break
  else:
    ans = 'No'

print(ans)

Submission status: Runtime Error

Solution code:
x=list(map(int,input()))
if x[0]==0:
    print(1)
elif x[1]==0:
    print(2)
elif x[2]==0:
    print(3)
elif x[3]==0:
    print(4)
else:
    print(5)

Submission status: Runtime Error

Solution code:
# a: 総数hiki， b: 足の数
a, b = map(int, input().split())

# かめiひき
ans = 'No'
for i in range(a+1):
  total = 4*i + 2*(a-i)
  if total == b:
    ans = 'Yes'
    break

print(ans)

Submission status: Runtime Error

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

A.sort(reverse=True)

for i in range(len(A)-1):
    flg = True
    for j in range(i+1, len(A)):
        if A[i] % A[j] == 0:
            flg = False
            break
    if flg == True:
        print(i)
        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
x1 = int(input())
x2 = int(input())
x3 = int(input())
x4 = int(input())
x5 = int(input())

ls = [x1, x2, x3, x4, x5]

i = 0
while i < len(ls):
    if ls[i] == 0:
        print(i + 1)
        break
    i += 1

Submission status: Runtime Error

Solution code:
# a: 総数hiki， b: 足の数
a, b = map(int, input().split())

# かめiひき
ans = 'No'
for i in range(a+1):
  total = 4*i + 2*(a-i)
  if total == b:
    ans = 'Yes'

print(ans)

Submission status: Runtime Error

Solution code:
X, N = map(int, input().split())
if N > 0:
    l = list(map(int, input().split()))
    A = [0] * N
    for i in range(N):
        A[i] = abs(l[i] - X)
        S = A.count(0)
        if S == 0:
            print(X)
        else:
            for i in range(1, N):
                S = A.count(N)
                if S == 1:
                    if l.count(X - 1) == 0:
                        print(X - 1)
                        break
                    else:
                        print(X + 1)
                        break
                else:
                    pass
else:
    print(X)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# a: 総数hiki， b: 足の数
a, b = map(int, input().split())

# かめiひき
ans = 'No'
for i in range(a+1):
  total = 4*i + 2*(a+1-i)
  if total == b:
    ans = 'Yes'
    break

print(ans)

Submission status: Runtime Error

Solution code:
x,n = map(int, input().split())
p = list(map(int, input().split()))
if n == 0:
  print(x)
elif n == 1:
  if x == p:
    print(x-1)
  else:
    print(x)
else:
  p.sort()
  m = float("inf")
  if x<p[0] or p[n-1]<x:
    print(x)
  else:
    for y in [y for y in range(p[0]-1,p[n-1]) if not y in p]:
      if abs(x-y)<m:
        m = abs(x-y)
        ans_y = y
  print(ans_y)

Submission status: Runtime Error

Solution code:
ar=input().split()
    print(ar.index('0')+1)

Submission status: Runtime Error

Solution code:
x, y = map(int, input().split())
a = y - 2*x
if a < 0:
    print("No")
elif a > x:
    print("No")
elif a % 2 == 0:
    print("Yes")
elif a == 0:
    print("Yes")

Submission status: Runtime Error

Solution code:
a,b,c,d,e = map(int, input().split())
r = o
if a = 0:
  r = a
  else if b = 0:
    r = b
  else if c = 0:
    r = c
  else if d = 0:
    r = d
  else if e = 0:
    r = e
print(r)

Submission status: Runtime Error

Solution code:
X, N = map(int, input("").split(" "))
p = list(map(int,input().split()))
p.sort()
q = [i+1 for i in range(-2*X,2*X)]

ans = 0
diff = 100

for i in q:
    if (abs(X - i) < diff and (not i in p)):
        ans = i
        diff = abs(X-i)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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


i=1
for num in arr:
    if(num==0):
        print(i)
    else:
        i++;

Submission status: Runtime Error

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

while len(a) >= 1:
  ans += 1
  temp=a.pop(0)
  if len(a) >= 1:
    if a[0] == temp:
      ans -= 1
    a = list(filter(lambda x: x % temp != 0, a))
  
print(ans)

Submission status: Runtime Error

Solution code:
a = list(map(,int, input().split()))
n = len(a)
print((n * (n+1) // 2) - sum(a))

Submission status: Runtime Error

Solution code:
X,Y= map(int, input().split())
if (Y/2-X>=0 and 2*X-Y/2>=0) and ( not (Y/2-X<=0 and 2*X-Y/2<=0)):
    print ("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
from sys import stdin, stdout
import sys
import bisect
INF=1e9
def get_int(): return int(stdin.readline().strip())
def get_ints(): return map(int,stdin.readline().strip().split()) 
def get_array(): return list(map(int,stdin.readline().strip().split()))
def get_string(): return stdin.readline().strip()
def op(c): return stdout.write(c)
#from collections import defaultdict 
#for _ in range(int(stdin.readline())):
x=get_array()
for i in range(len(x):
    if x[i]==0:
        print(i+1)

Submission status: Runtime Error

Solution code:
x1 = int(input())
x2 = int(input())
x3 = int(input())
x4 = int(input())
x5 = int(input())

ls = [x1, x2, x3, x4, x5]

i = 0
while i < len(ls):
    if ls[i] == 0:
        print(i + 1)
    i += 1

Submission status: Runtime Error

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

if (1 <= X <= 100) and (0 <= N <= 100) and ((1 <= len(p) <= 100 ) or N == 0) :
    ans = X-1
    bns = X+1
    
    while True:
        if N == 0:
            print(X)
            break
        
        if ans in p:
            ans-=1         
        if ans not in p:
            print(ans)
            break
        
        if bns in p:
            bns+=1
        if bns not in p:
            print(bns)
            break

Submission status: Runtime Error

Solution code:
x = [1, 2, 0, 4, 5] 
for i in x;
  if x[i] == 0: 
  	print i+1 
  break: 
  else: i += 1

Submission status: Runtime Error

Solution code:
l=list(map(int,input()))
print(l.index(0))