Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
while True:
&#160;&#160;&#160;&#160;num_hoseki=input()
&#160;&#160;&#160;&#160;if num_hoseki==0:
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;break
&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;hoseki_list=[]
&#160;&#160;&#160;&#160;for i in range(num_hoseki):
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;hoseki_list.append(map(int,raw_input().split()))
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;num_meirei=input()
&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;keiro=[]
&#160;&#160;&#160;&#160;x,y=[10,10]
&#160;&#160;&#160;&#160;for i in range(num_meirei):
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;meirei=raw_input()
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;d, l=meirei.split()
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;l=int(l)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if d=='N':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dx,dy=0,1
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;elif d=='S':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dx,dy=0,-1
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;elif d=='W':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dx,dy=-1,0
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;elif d=='E':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dx,dy=1,0
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for j in range(l):
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;keiro.append([x+(j+1)*dx,y+(j+1)*dy])
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;x,y=keiro[-1]
&#160;&#160;&#160;&#160;flag=True
&#160;&#160;&#160;&#160;for hoseki in hoseki_list:
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if not hoseki in keiro:
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag=False
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;break
    if flag:
        print 'Yes'
    else:
        print 'No'

Fixed submission:
while True:
    num_hoseki=input()
    if num_hoseki==0:
        break
    
    hoseki_list=[]
    for i in range(num_hoseki):
        hoseki_list.append(map(int,raw_input().split()))
        
    num_meirei=input()
    
    keiro=[]
    x,y=[10,10]
    for i in range(num_meirei):
        meirei=raw_input()
        
        d, l=meirei.split()
        l=int(l)
        if d=='N':
            dx,dy=0,1
        elif d=='S':
            dx,dy=0,-1
        elif d=='W':
            dx,dy=-1,0
        elif d=='E':
            dx,dy=1,0

        for j in range(l):
            keiro.append([x+(j+1)*dx,y+(j+1)*dy])
        x,y=keiro[-1]
    flag=True
    for hoseki in hoseki_list:
        if not hoseki in keiro:
            flag=False
            break
    if flag:
        print 'Yes'
    else:
        print 'No'
Buggy python submission (verdict: Runtime Error):
print(eval(input())**3)

Fixed submission:
print(int(input())**3)

Buggy python submission (verdict: Runtime Error):
print x**3

Fixed submission:
print(int(input())**3)
Buggy python submission (verdict: Runtime Error):
tmp=input()
a=int(tmp.split(' ')[0])
b=int(tmp.split(' ')[1])
print a*b,2*(a+b)

Fixed submission:
a,b=map(int, raw_input().split())
print a*b, 2*(a+b)

Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
print a*b, 2*(a+b)

Fixed submission:
a,b=map(int, raw_input().split())
print a*b, 2*(a+b)
Buggy python submission (verdict: Runtime Error):
h=S/3600
m=(S%3600)/60
s=(S%3600)%60
print str(h)+':'+str(m)+':'+str(s)

Fixed submission:
time=input()
h=time/3600
m=(time%3600)/60
s=(time%3600)%60
print str(h)+':'+str(m)+':'+str(s)
Buggy python submission (verdict: Runtime Error):
i=0
while True:
    i+=1
    x=raw_input()
    if x==0:
        break
    print 'Case %d: %d' % (i,x)

Fixed submission:
i=0
while True:
    i+=1
    x=raw_input()
    if x=='0':
        break
    print 'Case %d: %s' % (i,x)

Buggy python submission (verdict: Runtime Error):
i=0
while True:
    i+=1
    x=raw_input()
    if x=='0':
        break
    print 'Case %d: %d' % (i,x)

Fixed submission:
i=0
while True:
    i+=1
    x=raw_input()
    if x=='0':
        break
    print 'Case %d: %s' % (i,x)

Buggy python submission (verdict: Runtime Error):
i = 1
while True:
    hoge = input()
    if hoge == "":
        break
    print("Case " + str(i) + ": " + hoge)
    i += 1

Fixed submission:
i = 1
while True:
    hoge = input()
    if int(hoge) == 0:
        break
    print("Case " + str(i) + ": " + hoge)
    i += 1

Buggy python submission (verdict: Runtime Error):
i = 1
while True:
    hoge = input()
    if hoge == "":
        break
    print("Case " + str(i) + ": " + hoge)
    i += 1

Fixed submission:
i = 1
while True:
    hoge = input()
    if int(hoge) == 0:
        break
    print("Case " + str(i) + ": " + hoge)
    i += 1
Buggy python submission (verdict: Runtime Error):
def solve():
    H, W = map(int, input().split())
    c = []
    for _ in range(H):
        c.append(list(map(int, input().split())))

    dp = [[0] * W for _ in range(H)]

    for x in range(H):
        dp[x][0] = 1 if c[x][0] == 0 else 0
    for y in range(H):
        dp[0][y] = 1 if c[0][y] == 0 else 0

    for x in range(H-1):
        for y in range(W-1):
            if c[x+1][y+1] == 1:
                dp[x+1][y+1] = 0
            elif c[x][y+1] == 0 and c[x+1][y] == 0:
                dp[x+1][y+1] = dp[x][y] + 1
            else:
                dp[x+1][y+1] = 1

    print(max([max(item) for item in dp])**2)


if __name__ == '__main__':
    solve()

Fixed submission:
def solve():
    H, W = map(int, input().split())
    c = []
    for _ in range(H):
        c.append(list(map(int, input().split())))

    dp = [[0] * W for _ in range(H)]

    for x in range(H):
        dp[x][0] = 1 if c[x][0] == 0 else 0
    for y in range(W):
        dp[0][y] = 1 if c[0][y] == 0 else 0

    for x in range(H-1):
        for y in range(W-1):
            if c[x+1][y+1] == 0:
                dp[x+1][y+1] = min([dp[x][y], dp[x][y+1], dp[x+1][y]]) + 1

    print(max([max(item) for item in dp])**2)


if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Runtime Error):
def dfs(i, j, m):
    '''
    m[i][j]??¨????????£??????????????°????????????????????????
    '''
    m[i][j] = 0
    for di, dj in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
        ni = i + di
        nj = j + dj
        if ni in range(12) and nj in range(12) and m[ni][nj] == 1:
            dfs(ni, nj, m)                

while True:
    m = []
    for i in range(12):
        m.append(list(map(int, list(input()))))
    
    count = 0
    for i in range(12):
        for j in range(12):
            if m[i][j] == 1:
                count += 1
                dfs(i, j, m)
    
    print(count)

Fixed submission:
def dfs(i, j, m):
    '''
    m[i][j]??¨????????£??????????????°????????????????????????
    '''
    m[i][j] = 0
    for di, dj in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
        ni = i + di
        nj = j + dj
        if ni in range(12) and nj in range(12) and m[ni][nj] == 1:
            dfs(ni, nj, m)                

while True:
    try:
        m = [list(map(int, list(input()))) for _ in range(12)]

        count = 0
        for i in range(12):
            for j in range(12):
                if m[i][j] == 1:
                    count += 1
                    dfs(i, j, m)
        
        print(count)
        input()
    except:
        break

Buggy python submission (verdict: Runtime Error):
def dfs(i, j, m):
    '''
    m[i][j]??¨????????£??????????????°????????????????????????
    '''
    m[i][j] = 0
    for di, dj in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
        ni = i + di
        nj = j + dj
        if ni in range(12) and nj in range(12) and m[ni][nj] == 1:
            dfs(ni, nj, m)                

while True:
    m = []
    for i in range(12):
        m.append(list(map(int, list(input()))))
    
    count = 0
    for i in range(12):
        for j in range(12):
            if m[i][j] == 1:
                count += 1
                dfs(i, j, m)
    
    print(count)
    input()

Fixed submission:
def dfs(i, j, m):
    '''
    m[i][j]??¨????????£??????????????°????????????????????????
    '''
    m[i][j] = 0
    for di, dj in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
        ni = i + di
        nj = j + dj
        if ni in range(12) and nj in range(12) and m[ni][nj] == 1:
            dfs(ni, nj, m)                

while True:
    try:
        m = [list(map(int, list(input()))) for _ in range(12)]

        count = 0
        for i in range(12):
            for j in range(12):
                if m[i][j] == 1:
                    count += 1
                    dfs(i, j, m)
        
        print(count)
        input()
    except:
        break
Buggy python submission (verdict: Runtime Error):
while True:
    N = int(input())
    if N == 0:
        break
    a = list(map(int, input().split()))

    ## dp[i][j]: i???????????°????????§??§j????????????????????°
    dp = [[0 for j in range(21)] for i in range(N-1)]

    dp[0][a[0]] = 1
    for i in range(1, N-1):
        for j in range(21):
            if (j - a[i]) in range(21):
                dp[i][j] += dp[i-1][j-a[i]]
            if (j + a[i]) in range(21):
                dp[i][j] += dp[i-1][j+a[i]]
            
    print(dp[N-2][a[N-1]])

Fixed submission:
N = int(input())
a = list(map(int, input().split()))

## dp[i][j]: i???????????°????????§??§j????????????????????°
dp = [[0 for j in range(21)] for i in range(N-1)]

dp[0][a[0]] = 1
for i in range(1, N-1):
    for j in range(21):
        if (j - a[i]) in range(21):
            dp[i][j] += dp[i-1][j-a[i]]
        if (j + a[i]) in range(21):
            dp[i][j] += dp[i-1][j+a[i]]
        
print(dp[N-2][a[N-1]])

Buggy python submission (verdict: Runtime Error):
while True:
    N = int(input())
    if N == 0:
        break
    a = list(map(int, input().split()))

    dp = [[0 for j in range(21)] for i in range(N-1)]

    dp[0][a[0]] = 1
    for i in range(1, N-1):
        for j in range(21):
            if (j - a[i]) in range(21):
                dp[i][j] += dp[i-1][j-a[i]]
            if (j + a[i]) in range(21):
                dp[i][j] += dp[i-1][j+a[i]]
            
    print(dp[N-2][a[N-1]])

Fixed submission:
N = int(input())
a = list(map(int, input().split()))

## dp[i][j]: i???????????°????????§??§j????????????????????°
dp = [[0 for j in range(21)] for i in range(N-1)]

dp[0][a[0]] = 1
for i in range(1, N-1):
    for j in range(21):
        if (j - a[i]) in range(21):
            dp[i][j] += dp[i-1][j-a[i]]
        if (j + a[i]) in range(21):
            dp[i][j] += dp[i-1][j+a[i]]
        
print(dp[N-2][a[N-1]])
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = a * b
l = a * 2 + b * 2
print(s + " " + l)


Fixed submission:
a, b = map(int, input().split())
s = a * b
l = a * 2 + b * 2
print(str(s) + " " + str(l))

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = a * b
l = a * 2 + b * 2
print(s + " " + l)


Fixed submission:
a, b = map(int, input().split())
s = a * b
l = a * 2 + b * 2
print(str(s) + " " + str(l))
Buggy python submission (verdict: Runtime Error):
time = int(input)
h = time / 3600
m = (time % 3600) / 60
s = time % 60
print(str(h) + ":" + str(m) + ":" + str(s))


Fixed submission:
time = int(input())
s = time % 60
h = time // 3600
m = (time - h * 3600) // 60
print(str(h) + ":" + str(m) + ":" + str(s))
Buggy python submission (verdict: Time Limit Exceeded):
def binary_search(key, l):
    ix = len(l) // 2

    while len(l) > 0:
        if key == l[ix]:
            return True

        if key < l[ix]:
            l = l[:ix]
        else:
            l = l[ix + 1:]
        ix = len(l) // 2

    return False

if __name__ == '__main__':
    n = input()
    s = [int(x) for x in input().split()]
    q = input()
    t = [int(x) for x in input().split()]

    ans = 0
    for e in t:
        ans += 1 if binary_search(e, s) else 0

    print(ans)

Fixed submission:
def binary_search(key, a):
    l = 0
    r = len(a)
    ix = (r - l) // 2

    while r - l > 0:
        if key == a[ix]:
            return True

        if key < a[ix]:
            r = ix
        else:
            l = ix + 1
        ix = l + (r - l) // 2

    return False

if __name__ == '__main__':
    n = input()
    s = [int(x) for x in input().split()]
    q = input()
    t = [int(x) for x in input().split()]

    ans = 0
    for e in t:
        ans += 1 if binary_search(e, s) else 0

    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#-*- coding: utf_8 -*-

data = []
data.append([int(input())])
length = 2
while length != 1:
    r = [int(x) for x in input().split(",")]
    data.append(r)
    length = len(r)

first = data[:int(len(data)/2) + 1]
mx_arr = [0] * 100

def dfs(n, i, mx):
    if n == len(first) - 1:
        s = mx * 2 + data[n][i]
        mx_arr[i] = max(s, mx_arr[i])
        return

    mx += data[n][i]
    dfs(n + 1, i, mx)
    dfs(n + 1, i + 1, mx)

dfs(0, 0, 0)

print(max(mx_arr))

Fixed submission:
#-*- coding: utf_8 -*-

data = []
data.append([int(input())])
length = 2
counter = 0
while length != 1:
    r = [int(x) for x in input().split(",")]
    data.append(r)
    length = len(r)
    counter += 1

N = int((counter + 1 )/ 2) + 1
dp = [[0 for i in range(N)] for j in range(N)]
data_arr = [[0 for i in range(N)] for j in range(N)]

left = data[:N]
right = data[N:]

i = 0
for v in left:
    for idx, r in enumerate(v):
        data_arr[i - idx][idx] = r
    i += 1
right.reverse()
for i, v in enumerate(right):
    for idx, r in enumerate(v):
        data_arr[N - 1 - idx][N - 1 - i + idx] = r


dp[0][0] = data_arr[0][0]

for i in range(1, N):
    dp[0][i] = dp[0][i - 1] + data_arr[0][i]
    dp[i][0] = dp[i - 1][0] + data_arr[i][0]

for i in range(1, N):
    for j in range(1, N):
        dp[i][j] += data_arr[i][j] + max(dp[i - 1][j], dp[i][j - 1])

print(dp[N - 1][N - 1])
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

def main():
  while True:
    (n, m, a) = map(int, raw_input().split(' '))
    if (n, m, a) == (0, 0, 0): break

    bars = []
    for i in range(m):
      (h, p, q) = map(int, raw_input().split(' '))
      bars.append((h, p, q))

    x = a
    while True:
      # Down step by step, and above bars are removed in each step
      next_bar = max([b for b in bars if b[1] == x or b[2] == x])
      x = next_bar[2] if next_bar[1] == x else next_bar[1]
      y = next_bar[0]
      map(lambda b: bars.remove(b), [b for b in bars if b[0] >= y])
      if bars == []: break
    print x

if __name__ == '__main__':
  main()

Fixed submission:
# coding: utf-8

def main():
  while True:
    (n, m, a) = map(int, raw_input().split(' '))
    if (n, m, a) == (0, 0, 0): break

    bars = []
    for i in range(m):
      (h, p, q) = map(int, raw_input().split(' '))
      bars.append((h, p, q))

    x = a
    while True:
      # Down step by step, and above bars are removed in each step
      # To handle straight down case (no possible bars), next_bar can be (0,x,x)
      next_bar = max([b for b in bars if b[1] == x or b[2] == x] + [(0, x, x)])
      x = next_bar[2] if next_bar[1] == x else next_bar[1]
      y = next_bar[0]
      map(lambda b: bars.remove(b), [b for b in bars if b[0] >= y])
      if bars == []: break
    print x

if __name__ == '__main__':
  main()
Buggy python submission (verdict: Runtime Error):
def init():
  global top
  top = 0

def isEmpty():
  global top
  return top == 0

def isFull():
  global top, MAX
  return top >= MAX

def push(x):
  global top, s
  if isFull():
    return False
  s[top] = x
  top += 1


def pop():
  global top, s
  if isEmpty():
    return False
  s[top + 1]
  top -= 1
  return s[top]


def calc(i_1, i_2, op):
  if op == '+':
    return i_1 + i_2
  elif op == '-':
    return i_1 - i_2
  else:
    return i_1 * i_2

data = list(map(str, input().split()))
top = 0
MAX = 100
s = [0 for i in range(MAX)]
for i in data:
  if i == '+' or i == '*' or i == '-':
    a = pop()
    b = pop()
    push(calc(int(b), int(a), i))
  else:
    push(i)
print(s[0])



Fixed submission:
def init():
  global top
  top = -1

def isEmpty():
  global top
  return top == -1

def isFull():
  global top, MAX
  return top >= MAX

def push(x):
  global top, s
  if isFull():
    return False
  s[top] = x
  top += 1


def pop():
  global top, s
  if isEmpty():
    return False
  top -= 1
  return s[top]


def calc(i_1, i_2, op):
  if op == '+':
    return i_1 + i_2
  elif op == '-':
    return i_1 - i_2
  else:
    return i_1 * i_2

data = list(map(str, input().split()))
top = 0
MAX = 100
s = [0 for i in range(MAX)]
for i in data:
  if i == '+' or i == '*' or i == '-':
    a = pop()
    b = pop()
    push(calc(int(b), int(a), i))
  else:
    push(i)
print(s[0])
Buggy python submission (verdict: Runtime Error):
print((lambda x,y : x + y + 1 - (lambda *x, f=lambda f, x, y: f(f, y, x % y) if y else x: f(f, *x))(x,y))(int(input()),int(input())))


Fixed submission:
print((lambda x:int(x[0])+int(x[1])+1-(lambda*x,f=lambda f,x,y:f(f,y,x%y) if y else x:f(f,*x))(int(x[0]),int(x[1])))(input().split()))

Buggy python submission (verdict: Runtime Error):
print((lambda x,y : x + y + 1 - (lambda *x, f=lambda f, x, y: f(f, y, x % y) if y else x: f(f, *x))(x,y))(int(input()),int(input())))


Fixed submission:
print((lambda x:int(x[0])+int(x[1])+1-(lambda*x,f=lambda f,x,y:f(f,y,x%y) if y else x:f(f,*x))(int(x[0]),int(x[1])))(input().split()))
Buggy python submission (verdict: Runtime Error):
while 1:
????????r, c = map(int, raw_input().split())
????????if r == 0: break
????????old = [raw_input().split() for i in range(r)]
????????old = map(list, zip(*old))
????????new = [int("".join(lst),2) for lst in old]
????????ans = 0
????????for i in range(1<<(r-1)):
????????????????ret = 0
????????????????for j in new:
????????????????????????cnt = bin(i^j).count('1')
????????????????????????ret += cnt if cnt > r/2 else r-cnt
????????????????ans = max(ans, ret)
????????print ans

Fixed submission:
while 1:
    r, c = map(int, raw_input().split())
    if r == 0: break
    old = [raw_input().split() for i in range(r)]
    old = map(list, zip(*old))
    new = [int("".join(lst),2) for lst in old]
    ans = 0
    for i in range(1<<(r-1)):
        ret = 0
        for j in new:
            cnt = bin(i^j).count('1')
            ret += cnt if cnt > r/2 else r-cnt
        ans = max(ans, ret)
    print ans

Buggy python submission (verdict: Runtime Error):
while 1:
????????r, c = map(int, raw_input().split())
????????if r == 0: break
????????old = [raw_input().split() for i in range(r)]
????????old = map(list, zip(*old))
????????new = [int("".join(lst),2) for lst in old]
????????ans = 0
????????for i in range(1<<(r-1)):
????????????????ret = 0
????????????????for j in new:
????????????????????????cnt = bin(i^j).count('1')
????????????????????????ret += cnt if cnt > r/2 else r-cnt
????????????????ans = max(ans, ret)
????????print ans

Fixed submission:
while 1:
    r, c = map(int, raw_input().split())
    if r == 0: break
    old = [raw_input().split() for i in range(r)]
    old = map(list, zip(*old))
    new = [int("".join(lst),2) for lst in old]
    ans = 0
    for i in range(1<<(r-1)):
        ret = 0
        for j in new:
            cnt = bin(i^j).count('1')
            ret += cnt if cnt > r/2 else r-cnt
        ans = max(ans, ret)
    print ans

Buggy python submission (verdict: Runtime Error):
while 1:
????????r, c = map(int, raw_input().split())
????????if r == 0: break
????????old = [raw_input().split() for i in range(r)]
????????old = map(list, zip(*old))
????????new = [int("".join(lst),2) for lst in old]
????????ans = 0
????????for i in range(1<<(r)):
????????????????ret = 0
????????????????for j in new:
????????????????????????cnt = bin(i^j).count('1')
????????????????????????ret += cnt if cnt > r/2 else r-cnt
????????????????ans = max(ans, ret)
????????print ans

Fixed submission:
while 1:
    r, c = map(int, raw_input().split())
    if r == 0: break
    old = [raw_input().split() for i in range(r)]
    old = map(list, zip(*old))
    new = [int("".join(lst),2) for lst in old]
    ans = 0
    for i in range(1<<(r-1)):
        ret = 0
        for j in new:
            cnt = bin(i^j).count('1')
            ret += cnt if cnt > r/2 else r-cnt
        ans = max(ans, ret)
    print ans
Buggy python submission (verdict: Runtime Error):
def load_balls():
	LINE_NUM, TOTAL = 0, 0
	balls = []
	i = 0
	for line in sys.stdin:
		line = line.strip()
		LINE_NUM += 1
		if LINE_NUM == 1:
			TOTAL = int(line.strip())
			continue
		balls.append([int(i) for i in line.split(" ")])
		if LINE_NUM == TOTAL+1: break
	return balls

class VesselClass:

	def __init__(self):
		self.BALL_NUM = 10
		self.tmp = []
		self.left = [0]
		self.right = [0]

	def fill(self, balls:list):
		self.tmp = balls

	def DFS(self):
		if len(self.tmp) == 0: print("Yes")
		elif self.left[-1] < self.tmp[0]:
			self.left.append(self.tmp[0])
			self.tmp.pop(0)
			self.DFS()
		elif self.right[-1] < self.tmp[0]:
			self.right.append(self.tmp[0])
			self.tmp.pop(0)
			self.DFS()
		else: print("No")

balls_list = load_balls()
Vessel = VesselClass()
for balls in balls_list:
	Vessel.fill(balls)
	Vessel.DFS()

Fixed submission:
import sys
sys.setrecursionlimit(100000)

def load_balls():
	balls = []
	LINE_NUM, TOTAL = 0, 0
	while True:
		line = sys.stdin.readline().strip()
		LINE_NUM += 1
		if LINE_NUM == 1:
			TOTAL = int(line)+1
			continue
		balls.append([int(i) for i in line.split(" ")])
		if LINE_NUM == TOTAL: break
	return balls
balls_list = load_balls()
for balls in balls_list:
	left, right = [0], [0]
	for ball in balls:
		if left[-1] < ball: left.append(ball)
		elif right[-1] < ball: right.append(ball)
	print("YES" if len(left)-1 + len(right)-1 == 10 else "NO")

Buggy python submission (verdict: Runtime Error):
def load_balls():
	LINE_NUM, TOTAL = 0, 0
	balls = []
	i = 0
	for line in sys.stdin:
		line = line.strip()
		LINE_NUM += 1
		if LINE_NUM == 1:
			TOTAL = int(line.strip())
			continue
		balls.append([int(i) for i in line.split(" ")])
		if LINE_NUM == TOTAL+1: break
	return balls

class VesselClass:

	def __init__(self):
		self.BALL_NUM = 10
		self.tmp = []
		self.left = [0]
		self.right = [0]

	def fill(self, balls:list):
		self.tmp = balls

	def DFS(self):
		if len(self.tmp) == 0: print("Yes")
		elif self.left[-1] < self.tmp[0]:
			self.left.append(self.tmp[0])
			self.tmp.pop(0)
			self.DFS()
		elif self.right[-1] < self.tmp[0]:
			self.right.append(self.tmp[0])
			self.tmp.pop(0)
			self.DFS()
		else: print("No")

balls_list = load_balls()
Vessel = VesselClass()
for balls in balls_list:
	Vessel.fill(balls)
	Vessel.DFS()

Fixed submission:
import sys
sys.setrecursionlimit(100000)

def load_balls():
	balls = []
	LINE_NUM, TOTAL = 0, 0
	while True:
		line = sys.stdin.readline().strip()
		LINE_NUM += 1
		if LINE_NUM == 1:
			TOTAL = int(line)+1
			continue
		balls.append([int(i) for i in line.split(" ")])
		if LINE_NUM == TOTAL: break
	return balls
balls_list = load_balls()
for balls in balls_list:
	left, right = [0], [0]
	for ball in balls:
		if left[-1] < ball: left.append(ball)
		elif right[-1] < ball: right.append(ball)
	print("YES" if len(left)-1 + len(right)-1 == 10 else "NO")