EOF error but works perfectly with custom input

def nCm(n,m):
if m==0:
return 1
if m==n:
return 1

return int((n/m)*nCm(n-1,m-1))


for test in range(num_test):

N,K=[s for s in map(int, input().split())]


Why does it give EOF error?

Here is the correct method for reading input:
N,K = map(int, input().split())

And here array reading:
arr = [int(s) for s in input().split()]