Problem:


Score : 100 points

Problem Statement

Given is an integer N.

Takahashi chooses an integer a from the positive integers not greater than N with equal probability.

Find the probability that a is odd.

Constraints

1 \leq N \leq 100

Input

Input is given from Standard Input in the following format:

N

Output

Print the probability that a is odd.
Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}.

Sample Input 1

4

Sample Output 1

0.5000000000

There are four positive integers not greater than 4: 1, 2, 3, and 4. Among them, we have two odd numbers: 1 and 3. Thus, the answer is \frac{2}{4} = 0.5.

Sample Input 2

5

Sample Output 2

0.6000000000

Sample Input 3

1

Sample Output 3

1.0000000000



Sample input:
4


Sample output:
0.5000000000

Submission status: Runtime Error

Solution code:
n = int(input())
if n % 2 == 0:
  return 1/2
else:
  return (n/2 + 0.5)/n

Submission status: Runtime Error

Solution code:
n = input()
if n % 2 == 0:
  return 1/2
else:
  return (n/2 + 0.5)/n

Submission status: Runtime Error

Solution code:
n = input
if n % 2 == 0:
  return 1/2
else:
  return (n/2 + 0.5)/n

Submission status: Runtime Error

Solution code:
n = int(input)
if n % 2 == 0:
  return 1/2
else:
  return (n/2 + 0.5)/n

Submission status: Runtime Error

Solution code:
import math
N = int(input())
a = math.celil(N/2)/N
print(a)

Submission status: Runtime Error

Solution code:
N = int(input())
a = math.ceil(N/2)/N
print(a)

Submission status: Runtime Error

Solution code:
N = int(input())
a = ceil(N/2)/N
print(a)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
def yaku(n):
  l=[]
  m=n
  for i in range(1,int((n)**(1/2))+1):
    if m%i==0:
      l.append(i)
      if m//i!=i:
        l.append(m//i)
  return l
l=yaku(a)
cd=[]
for i in l:
  if a%i==0:
    cd.append(i)
count=0
length=len(cd)
def gcd(n,m):
  a=max(n,m)
  b=min(n,m)
  while b!=0:
    a,b=b,a%b
  return a
for i in range(length-1):
  for j in range(i+1,length):
    if gcd(cd[i],cd[j])==1:
      count+=1
print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
a = roundup(N/2)/N

print(a)

Submission status: Runtime Error

Solution code:
N = int(imput())
a = round(N/2)/N
print(a)

Submission status: Runtime Error

Solution code:
N = imput()
a = round(N/2)/N
print(a)

Submission status: Runtime Error

Solution code:
a = round(N/2)/N
print(a)

Submission status: Runtime Error

Solution code:
import math
n = input()
print ( (n //2) + 1)

Submission status: Runtime Error

Solution code:
n=int(input())
if n%2==0:
  print(1/2)
else:
  print((n+1)/2n)

Submission status: Runtime Error

Solution code:
n=int(input())
if n%2=0:
  print(1/2)
else:
  print((n+1)/2n)

Submission status: Runtime Error

Solution code:
n = input()

res = (n-(n/2))/n

print(res)

Submission status: Runtime Error

Solution code:
n = input()

res = (n-(n/2))/n

print(ress)

Submission status: Runtime Error

Solution code:
n=int(input())
if n == 1:
  print(1)
elif n%2 == 0:
  print(0.5):
else:
  print(0.6)

Submission status: Runtime Error

Solution code:
import math
a=int(input())
b=math.floor(float(a/2))
print({}.format(float((a-b)/a)))

Submission status: Runtime Error

Solution code:
import math
a=int(input())
b=math.floor(float(a/2))
print({}.format(float((a-b)/a)))

Submission status: Runtime Error

Solution code:
a = int(input())
if a = 1:
  print(a)
elif a%2 = 0:
  print(0.5)
else:
  print(f'({int(a/2)}+1)/{a}')

Submission status: Runtime Error

Solution code:
a=int(input())
if a = 1:
  print(a)
elif a%2 = 0:
  print(1/2)
else:
  print((int(a/2)+1)/a)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
A,B = [int(i) for i in input().split()] 
 
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
list_a = prime_factorize(A)
list_b = prime_factorize(B)
list_a = set(list_a)
list_b = set(list_b)
ans = [x for x in list_a if x in list_b]
print(len(ans)+1)

Submission status: Runtime Error

Solution code:
a = int(input())
if a = 1:
  print(a)
elif a%2 = 0:
  print(0.5)
else:
  print((int(a/2)+1)/a)

Submission status: Runtime Error

Solution code:
a = int(input())
if a = 1:
  print(a)
elif int(a/2) = 0:
  print((a/2)/a)
else:
  print((int(a/2)+1)/a)

Submission status: Runtime Error

Solution code:
a=int(input())
if a = 1:
  print(a)
elif int(a/2) = 0:
  print((a/2)/a)
else:
  print((int(a/2)+1)/a)

Submission status: Runtime Error

Solution code:
a=int(input())
if a = 1:
  print(a)
elif int(a/2)=0:
  print((a/2)/a)
else:
  print((int(a/2)+1)/a)

Submission status: Runtime Error

Solution code:
a=int(input())
if a=1:
  print(a)
elif a//2=0:
  print((a/2)/a)
else:
  print((int(a/2)+1)/a)

Submission status: Runtime Error

Solution code:
a=int(input())
if a=1:
  print(a)
elif int(a/2)=0:
  print((a/2)/a)
else:
  print((int(a/2)+1)/a)

Submission status: Runtime Error

Solution code:
a=int(input())
if a=1:
  print(a)
elif a%2==0:
  print((a/2)/a)
else:
  print((int(a/2)+1)/a)

Submission status: Runtime Error

Solution code:
a=int(input())
if a=1:
  print(a)
elif a%2==0:
  print((a/2)/a)
else:
  print(-(-a//2)/a)

Submission status: Runtime Error

Solution code:
a=input(int())
if a=1:
  print(a)
elif a%2==0:
  print((a/2)/a)
else:
  print(-(-a//2)/a)

Submission status: Runtime Error

Solution code:
a=input()
if a=1:
  print(1)
elif a%2==0:
  print(0.5)
else:
  print(-(-a//2)/a)

Submission status: Runtime Error

Solution code:
N = int(input())
res = int(N/2)
if N%2 > 0:
  res += 1
return res

Submission status: Runtime Error

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

B = list(range(1,N+1))
ab = []
for i in range(N):
    ab.append([A[i], B[i]])
print(ab)
ab.sort()
print(ab)
for i in range(N):
    print(ab[i][1], end = " ")

print()

Submission status: Runtime Error

Solution code:
N=int(input())

if  N%2=1:
    print((N//2+1)/N)

else:
    print(1/2)

Submission status: Runtime Error

Solution code:
N=int(input())

if  N%2=1
    print((N//2+1)/N)

else  print(1/2)

Submission status: Runtime Error

Solution code:
N=int(input())

if  N%2=1
    print(N//2+1/N)

else  print(1/2)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
d, e = map(int, f.readline().strip().split())
g = list(map(int, f.readline().strip().split()))
#print(d, e)
#print(g)
total = 0
for i in g:
    if i >= e:
        total += 1
print(total)

Submission status: Runtime Error

Solution code:
import math
N = int(raw_input())
(float)avg = ((float)math.ceil(N/2)/N
print avg

Submission status: Runtime Error

Solution code:
number = int(input())
if number * 2 == 0:
	odd_num = number // 2
	percent = odd_num / number
    print(percent)
else:
	odd_num = number // 2 + 1
    percent = odd_num / number
	print(percent)

Submission status: Runtime Error

Solution code:
number = int(input())
if number * 2 = 0:
	odd_num = number // 2
	percent = odd_num / number
    print(percent)
else:
	odd_num = number // 2 + 1
    percent = odd_num / number
	print(percent)

Submission status: Runtime Error

Solution code:
number = int(input())
if number * 2 = 0:
	odd_num = number // 2
	percent = odd_num / number
else:
	odd_num = number // 2 + 1
    percent = odd_num / number
  
print(percent)

Submission status: Runtime Error

Solution code:
number = int(input())
if number * 2 = 0:
	odd_num = number // 2
	percent = odd_num / number
else:
	odd_number = number // 2 + 1
    percent = odd_num / number
  
print(percent)

Submission status: Runtime Error

Solution code:
number = int(imput())
odd_num = number // 2 + 1
percent = odd_num / number
print(percent)

Submission status: Runtime Error

Solution code:
N = int(input())
A = [int(_) for _ in input().split(" ")]
 
ans = sorted(range(1, len(A) + 1), key=lambda x:A[x - 1])
print(*ans)

Submission status: Runtime Error

Solution code:
N = int(input())
if N % 2 == 0:
  print(0.5)
else:
  print((N-(N-1))/2N)

Submission status: Runtime Error

Solution code:
N = int(input())
if N % 2 == 0:
  print(0.5000000000)
else:
  print((N+1)//2N)

Submission status: Runtime Error

Solution code:
N = int(input())
if N %2 ==0:
  prnit(0.5)
else:
  print(2/(N+1))

Submission status: Runtime Error

Solution code:
N=int(input())
a=list(map(int, input().split()))
b=a
c=1
if c<=N:
	d=a[c-1]
	b[d-1]='c'
	c+=1
''.join(b)

Submission status: Runtime Error

Solution code:
N=int(input())
a=list(map(int, input()))
b=a
c=1
if c<=N:
	d=a[c-1]
	b[d-1]='c'
	c+=1
''.join(b)

Submission status: Runtime Error

Solution code:
#################################
#ここからcode
import fractions
A,B = map(int,input().split())

gcd = fractions.gcd(A,B)
if gcd == 1:
    print(1)
else:
    def factorization(n):
        arr = []
        temp = n
        for i in range(2, int(-(-n**0.5//1))+1):
            if temp%i==0:
                cnt=0
                while temp%i==0:
                    cnt+=1
                    temp //= i
                arr.append([i, cnt])

        if temp!=1:
            arr.append([temp, 1])

        if arr==[]:
            arr.append([n, 1])

        return arr

    soinsulist=factorization(gcd)
    print(len(soinsulist)+1)

Submission status: Runtime Error

Solution code:
def main():
  import fractions
  import math

  a,b = map(int,input().split())

  if a>b:
    a,b = b,a
  
  d = [1]
  num = 2

  while num <= min(a,b):
    if a%num == 0 and b%num == 0:
      d.append(num)
      while a%num == 0 and a>1:
        a = a//num
      while b%num == 0 and b>1:
        b = b//num
    num+=1
  
  print(len(d))

if __name__ == "__main__":
  main()

Submission status: Runtime Error

Solution code:
N = input()

print(int((N+1)/2)/N)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)

n, m = map(int, input().split())
e = [[] for _ in range(n)]

for _ in range(m):
    a, b = map(int, input().split())
    e[a-1].append(b-1)

c = [0] * n
def search_path(p, temp):
    c[p] = 1
    for x in e[p]:
        if x in temp:
            ans = [] + temp[temp.index(x):]
            check = 1
            while check == 1:
                check = 0
                #print(ans)
                for i in range(len(ans)-1):
                    for z in e[ans[i]]:
                        if z == ans[i+1]:
                            continue
                        elif z in ans:
                            t = ans.index(z)
                            if t < i:
                                ans = [] + ans[t:i+1]
                            else:
                                ans = [] + ans[i:t+1]
                            #print(ans, z)
                            check = 1
                            break
                    if check == 1:
                        break
                    else:
                        e[ans[i]] = []
                if check == 1:
                    continue
                for z in e[ans[-1]]:
                    if z == ans[0]:
                        continue
                    elif z in ans:
                        ans = [] + ans[ans.index(z):]
                        check = 1
                        #print(z, ans)
                        break
            print(len(ans))
            for z in ans:
                print(z+1)
            exit()
        else:
            search_path(x, temp + [x])


t = 1
for i in range(n):
    if c[i] == 0:
        ans = search_path(i, [i])

print(-1)

Submission status: Runtime Error

Solution code:
import fractions
 
a,b = map(int,input().split())
g = fractions.gcd(a,b)
 
ans=[1]
p=2
while g != 1:
    if g%p == 0:
        ans.append(p)
        g = g//p
    else:
        p += 1
 
print(len(set(ans)))

Submission status: Runtime Error

Solution code:
import fractions

def prime_divisor(n):
  prime_divisor_set = {1}
  end = int(n ** 0.5) + 1
  for i in range(2, 10 ** 5 + 1):
    if not (n % i):
      prime_divisor_set.add(i)
      while (n % i) == 0:
        n //= i
  return prime_divisor_set


a, b = map(int, input().split())
s1, s2 = prime_divisor(a), prime_divisor(b)
ans = len(s1 & s2)
print(len(prime_divisor(fractions.gcd(a, b))))

Submission status: Runtime Error

Solution code:
def prime_divisor(n):
  prime_divisor_set = {1}
  end = int(n ** 0.5) + 1
  for i in range(2, 10 ** 5 + 1):
    if not (n % i):
      prime_divisor_set.add(i)
      while (n % i) == 0:
        n //= i
  return prime_divisor_set


a, b = map(int, input().split())
s1, s2 = prime_divisor(a), prime_divisor(b)
ans = len(s1 & s2)
print(ans)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main() {
	int N;
	cin >> N;

	if (N % 2 == 0) {
		cout << 1.0/2.0 << endl;
	}
	else {
		cout << (N + 1)/ (2.0 * N)<< endl;
	}
}

Submission status: Runtime Error

Solution code:
=int(input())
even=N//2
odd=N-even
print(str(odd/N)+'000000000')

Submission status: Runtime Error

Solution code:
a = input().split()
N = int(a)
ans = 0.5
if N%2 == 0:
    pass
else:
    ans = (N+1)/(2*N)

print(ans)

Submission status: Runtime Error

Solution code:
N = input().split()

ans = 0.5
if N%2 == 0:
    pass
else:
    ans = (N+1)/(2*N)

print(ans)

Submission status: Runtime Error

Solution code:
N = input().split()

if N%2 == 0:
    ans = 0.5
else:
    ans = (N+1)/(2*N)

print(ans)

Submission status: Runtime Error

Solution code:
#abc142d

def gcd(x,y):
 while y:
  x,y=y,x%y
 return x

def factorize(n):
 fct=[]
 b,e=2,0
 while b*b<=n:
  while n%b==0:
   n=n//b
   e =e+1
   if e>0:
    fct.append((b,e))
    b,e=b+1,0
 if n>1:
  fct.append((n,1))
 return fct

a,b=map(int,raw_input().split())
z=gcd(a,b)
print len(factorize(z))+1

Submission status: Runtime Error

Solution code:
n=int(input())

if n%2==0 print(1/2) else print((n+1)/2/n)

Submission status: Runtime Error

Solution code:
x = input()

if x%2 == 0:
  count = int(x/2)
else:
  count = int(x/2) + 1

Submission status: Runtime Error

Solution code:
n = int(input())

d = n//2
print((n-d)/d)

Submission status: Runtime Error

Solution code:
n = int(input())
if (n % 2 == 0):
  print("%.10f" % (1/2))
else:
  print("%.10f" % ((n//2)+1)/n)

Submission status: Runtime Error

Solution code:
import sys
N,M=map(int,input().split())
vs,d=set(),[set()for _ in range(N+1)]
def dfs(v,path,pvs):
    vs.add(v)
    if d[v]&pvs:
        l=[]
        for x in path[::-1]:
            l+=[x]
            if x in d[v]:break
        print("\n".join(str(x)for x in[len(l)]+l[::-1]));sys.exit()
    for u in d[v]:dfs(u,path+[u],pvs|{u})
for _ in range(M):a,b=map(int,input().split());d[a].add(b)
dfs(1,[1],{1})
print(-1)

Submission status: Runtime Error

Solution code:
import sys
N,M=map(int,input().split())
vs,d=set(),[set()for _ in range(N+1)]
def dfs(v,path,pvs):
    vs.add(v)
    for u in d[v]:
        if u in pvs:
            xs=[]
            c = 0
            for x in path[::-1]:
                c+=1
                xs.append(x)
                if x in d[v]:break
            print(c)
            for x in xs:
                print(x)
            sys.exit()
        if u in vs:continue
        dfs(u,path+[u],pvs|{u})
for _ in range(M):a,b=map(int,input().split());d[a].add(b)
dfs(1,[1],{1})
print(-1)

Submission status: Runtime Error

Solution code:
N,M=map(int, input().split())
vs=set()
def dfs(v,path,pvs):
    lp=l=N+1
    for u in d[v]:
        if u in pvs:
            for i, c in enumerate(path):
                if c == u:
                    break
            nlp = path[i+1:]+[u]
            nl = len(nlp)
            if nl < l:
                lp, l = nlp, nl
        if u in vs:
            continue
        vs.add(u)
        nl, nlp = dfs(u,path+[u],pvs|{u})
        if nl < l:
            lp, l = nlp, nl
    return l,lp
d = [set() for _ in range(N+1)]
for _ in range(M):
    a,b=map(int,input().split())
    d[a].add(b)

l,lp=dfs(1,[1],{1})
if l<=N:
	print("\n".join(str(x) for x in[l]+lp))
    break
else:
    print(-1)

Submission status: Runtime Error

Solution code:

import numpy as np

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

ans = np.zeros(N)

for i in range(N):
    ans[A[i]-1] = i+1

for i in range(N):
    print(int(ans[i]), end=' ')

Submission status: Runtime Error

Solution code:
import math

def main():
    inputs = input().split()
    inputs = [int(i) for i in inputs]

    a = inputs[0]
    b = inputs[1]

    g = gcd(a, b)
    d = {}

    min_n = min([a, b])

    for i in range(2, int(math.sqrt(min_n + 1))):
        while True:
            if g % i == 0:
                g /= i
                d[i] = i
            else:
                break

    print(len(d) + 1)

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
    n = int(input())
    """studentNumbers = [(x, str(i)) for x, i in
        zip(input().split(), range(1, 1000000))]
    studentNumbers.sort(key=lambda tup: tup[0])
    print(' '.join([x[1] for x in studentNumbers]))"""
    studentNumbers = [(str(i + 1), x) for i, x in enumerate(input().split())]
    if (n > 1):
        studentNumbers.sort(key=lambda tup: tup[1])
    print(' '.join([x[0] for x in studentNumbers]))

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
    n = int(input())
    """studentNumbers = [(x, str(i)) for x, i in
        zip(input().split(), range(1, 1000000))]
    studentNumbers.sort(key=lambda tup: tup[0])
    print(' '.join([x[1] for x in studentNumbers]))"""
    studentNumbers = [(x, str(i + 1)) for x, i in zip(input().split(), range(n))]
    if (n > 1):
        studentNumbers.sort(key=lambda tup: tup[0])
    print(' '.join([x[1] for x in studentNumbers]))

Submission status: Runtime Error

Solution code:
N = int(input)

count = 0
for i in range(1,N):
  if i%2 == 0:
    count += 1

result = count/N
print(result)

Submission status: Runtime Error

Solution code:
from fractions import gcd
import sys
input = sys.stdin.readline
A, B = map(int, input().split())

count = 0
tmp = 1

for i in range(1, min(A, B)**0.5+1):
    if A%i == 0 and B%i == 0 and gcd(i, tmp) == 1:
        tmp *= i
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
K = list(map(int, input().split()))
n = [0] * N

for i in range(N):
  n[K[i]-1] = i + 1

for i in n:
  print(i, end=" ")

Submission status: Runtime Error

Solution code:
n = int(input())
if n == 1: 
    print (1)
elif n % 2 == 0:
    print(0.5)
else
    print((n+1)/2*n)

Submission status: Runtime Error

Solution code:
#解説放送見てからの書き直し
import sys
import os

INF = 10**12
ans = INF
N, M = map(int,input().split())
A = [0 for _ in range(M)]
B = [0 for _ in range(M)]
C = []
for i in range(M):
    a, b = map(int,input().split())
    A[i] = a  #鍵の金額
    B[i] = b  #開けられる宝箱の種類数
    tmp = list((map(int,input().split())))
    s = 0
    for j in range(b):
        t = tmp.pop(0)-1
        s |= 1 << t
    C.append(s)
dp = [INF]*(1<<N) #2^N
dp[0] = 0
for s in range(1<<N):
    for j in range(M):
        t = s | C[j]
        cost = dp[s] + A[j]
        dp[t] = min(dp[t],cost)
ans = dp[-1]
if ans == INF:
    ans = -1
print(ans)

Submission status: Runtime Error

Solution code:
N = int(intput())

print(round(N / 2) / N)

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
    num,limit=map(int,input().split())
    list = input().split()
    tmp = int()
    for i in list:
        if int(i)>=limit:
            tmp += 1
    print(tmp)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3

def main():
    N, M = map(int, input().split())
    cd = {}
    FAIL = (10 ** 3) * (10 ** 5) + 1
    for _ in range(M):
        ai, _ = map(int, input().split())
        ci = sum(1 << (int(i) - 1) for i in input().split())
        keys = list(cd.keys())
        for i in keys:
            cd[i | ci] = min(cd.get(i | ci, FAIL), cd[i] + ai)
        cd[ci] = min(cd.get(ci, FAIL), ai)
    print(cd.get((1 << N) - 1, -1))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
num = int(input())
each_num = list(map(int, input().split(" ")))

ans = []

i = 1
for k in range(1, num+1):
    ans.append(each_num.index(k) + 1)
print(*ans)

Submission status: Runtime Error

Solution code:
import fractions

A, B = map(int, input().split())

C = fractions.gcd(A, B)

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b += 1
    if n > 1:
        fct.append(n)
    return act

print(len(list(set(factorize(C))) + 1)

Submission status: Runtime Error

Solution code:

A,B =[int(x) for x in input().split()]

def bunkai(n):
    sosu= {1}
    tmp = n
    stop_flag = n
    
    if tmp%2 == 0:
        while tmp%2==0:
            tmp //=2
        sosu.add(2)
    
    for i in range(3,n+1,2):
        if tmp%i == 0:
            while tmp%i==0:
                tmp //=i
            sosu.add(i)
            stop_flag = tmp 
            
        if i > stop_flag:
            break
#        else:
#            stop_flag = int(stop_flag/i) 
            
    if tmp!=1:
        sosu.add(tmp)
                
    if sosu==[1]:
        sosu.add(n)
    
    return sosu

def check_sosu(n,x):
    ans=0
    tmp = n
    for i in x:
        if (tmp % i) == 0:
            ans+=1
    return ans

ans = check_sosu(B,bunkai(A))

print(ans)

Submission status: Runtime Error

Solution code:
def prime_divisor(n):
  prime_divisor_set = {1}
  end = int(n ** 0.5) + 1
  for i in range(2, end):
    if not (n % i):
      prime_divisor_set.add(i)
      while (n % i) == 0:
        n //= i
  return prime_divisor_set


a, b = map(int, input().split())
s1, s2 = prime_divisor(a), prime_divisor(b)
ans = len(s1 & s2)
print(ans)

Submission status: Runtime Error

Solution code:
n, m = list(map(int, input().split()))
key = []

INF = 10**7
p = 1<<n
dp = [INF]*p
dp[0] = 0

for _ in range(m):
    a, _ = map(int, input().split())
    c = sum([1<<(int(i)-1) for i in input().split()])
    def k(s):
        dp[s|c] = dp[s] + a
    [k(s) for s in range(p) if dp[s|c]>dp[s]+a]
ans = dp[-1]
if ans==INF:
    ans = -1
print(ans)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
yaku=[]
flag=0
for i in range(2,min(a,b)+1):
    if a%i==0 and b%i==0:
        yaku.append(i)
ans=len(yaku)
flag=0
for i in range(1,len(yaku)+1):
    flag=0
    for j in range(i+1,len(yaku)+1):
        if yaku[-i]%yaku[-j]==0:
            flag=1
            #print(i)
            break
    if flag==1:
        ans-=1
        #print("ans=",ans)
print(ans+1)

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
 
    if (N < 0 or N > 100):
            return 0
        array_len = len([N for i in range(1, N+1) if(i%2==1)])
        result = array_len / N
        return result
    
if __name__ == "__main__":
    main()