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))

num_test=int(input())

for test in range(num_test):

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

print(nCm(N-1,K-1))'

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()]