NZEC error in Sums in a Triangle - Python 2.7

I wrote the following code for the problem Sums in a Triangle. It is working in my computer but here on codechef I am getting NZEC. The input isn’t that big then why this error?

import sys
from itertools import islice

def p(): 
    cases = int(sys.stdin.readline())
    for case in xrange(cases):
        height = int(sys.stdin.readline())
        triangle = [map(int, i.split()) for i in islice(sys.stdin,height)]
        for i in xrange(1, height):
            cur_row = triangle[i]

            cur_row[0] += prev_row[0]
            cur_row[len(cur_row) - 1] += prev_row[len(prev_row) - 1]

            for j in xrange(1, len(cur_row) - 1):
                if(prev_row[j - 1] > prev_row[j]):
                    cur_row[j] += prev_row[j - 1]
                    cur_row[j] += prev_row[j]

            prev_row = cur_row

        print max(prev_row)


Asked the answer on stackoverflow and got the answer.