```
```import math

n,k=input().split(' ')

n,k=int(n),int(k)

st=set()

for i in range(k):

c=int(input())

for j in st:

k=math.gcd(c,j)

if k==c:

st.discard(j)

elif c==j:

break

else:

st.add(c)

sum=0

ln=len(st)

for v in st:

sum+=1+(n-1)//v

print(n-sum+(ln*(ln+1))//2+1)

i had submitted the above code as a solution to a problem.
It ran fine on my ide and with custom input.
But running it otherwise or submitting returns a runtime error(eof while running).
Why is this so?
this is the problem i was solving https://www.codechef.com/IARCSJUD/problems/LEAFEAT