Why am I geeting NZEC runtime error?

I am trying to solve FLIPCOIN using python and getting runtime error? I cannot get my head around the reason.
Problem Link: FLIPCOIN Problem - CodeChef

def execute(coins, command):
    action, a, b = command[0], int(command[2]), int(command[4])
    if action == '1':
        counter = 0
        for i in range(a, b+1):
            if coins[i] == 0:
                counter += 1
        print(counter)
    else:
        for i in range(a, b+1):
            coins[i] = 1 - coins[i]

    return coins

n, q = [int(x) for x in input().split()]
coins = [1] * n
for _ in range(q):
    command = input()
    coins = execute(coins, command)