code not working depending

Hi!
This has happened on other places, not just codechef. I’ll have code that works on my downloaded IDE, but not on codechef, or the other way around.
Do you have any suggestions?
As an example, I just made this on my computer:

for _ in range(int(input())):
    total = 0
    for _ in range(int(input())):
        j = input()
        lj = list(j)
        left = ['d','f']
        right = ['j','k']
        count = 2
        for y in range(1,len(j)):
            if lj[y] in left and lj[y-1] in left:
                count += 2
            if lj[y] in right and lj[y-1] in right:
                count += 2
            if lj[y] in right and lj[y-1] in left:
                count += 4
            if lj[y] in left and lj[y-1] in right:
                count += 4
        total += count
    print(total)

And it worked fine, but it got an EOF error on codechef…
Any suggestions on how to avoid these issues?