Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def downA(chair):
    for i in range(1,n+1):
        if chair[i]=="#":
            chair[i]="A"
            return

def downB(chair):
    for i in range(n,0,-1):
        if chair[i]=="#" and chair[i-1]!="A" and chair[i+1]!="A":
            chair[i]="B"
            return
    else:
        chair[chair.index("#")]="B"

def downC(chair):
    if set(chair[1:-1])==set(['#']):
        if n%2==0:
            chair[n/2+2]="C"
        else:
            chair[(n+1)/2+1]="C"
        return
    for i in range(1,n+1):
        if chair[i]!="#":
            if chair[i+1]=="#":
                chair[i+1]="C"
                return
            elif i-1>=1 and chair[i-1]=="#":
                chair[i-1]="C"
                return


def downD(chair):
    if set(chair[1:-1])==set(["#"]):
        chair[1]="D"
        return
    t=[0]*n
    cnt=0
    for i in range(1,n+1):
        if chair[i]!="#":
            cnt=0
        else:
            cnt+=1
            t[i]=cnt
    cnt=0
    for i in range(n,0,-1):
        if chair[i]!="#":
            cnt=0
        else:
            cnt+=1
            t[i]=min(cnt,t[i])
    maxInt=max(t)
    chair[t.index(maxInt)]="D"

while True:
    n,m=map(int,raw_input().split())
    if n==m==0:break
    chair=["X"]+["#"]*n+["X"]
    for i in range(m):
        p=raw_input()
        if p=="A":
            downA(chair)
        elif p=="B":
            downB(chair)
        elif p=="C":
            downC(chair)
        elif p=="D":
            downD(chair)
    print "".join(chair[1:-1])

Fixed submission:
def downA(C):
    C[C.index("#")]="A"

def downB(C):
    for i in range(n,0,-1):
        if C[i]=="#" and C[i-1]!="A" and C[i+1]!="A":
            C[i]="B"
            return
    C[C.index("#")]="B"

def downC(C):
    if set(C[1:-1])==set(['#']):
        C[n/2+1]="C"
        return
    for i in range(1,n+1):
        if C[i]!="#":
            if C[i+1]=="#":
                C[i+1]="C"
                return
            elif C[i-1]=="#":
                C[i-1]="C"
                return

def getDist(p):
    l,r=0,0
    while C[p+l-1]=="#":l-=1
    if C[p+l-1]=="X":l=-100000
    while C[p+r+1]=="#":r+=1
    if C[p+r+1]=="X":r=100000
    return min(-1*l,r)

def downD(C):
    if set(C[1:-1])==set(["#"]):
        C[1]="D"
        return
    md=-1
    for i in range(1,n+1):
        if C[i]!="#":continue
        d=getDist(i)
        if (d>md):
            md=d
            mi=i
    C[mi]="D"

while True:
    n,m=map(int,raw_input().split())
    if n==m==0:break
    C=["X"]+["#"]*n+["X"]
    for i in range(m):
        p=raw_input()
        if p=="A":downA(C)
        elif p=="B":downB(C)
        elif p=="C":downC(C)
        elif p=="D":downD(C)
    print "".join(C[1:-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
    p = list(map(float, input().split()))
    if p[2] == p[1]:
        print("YES" if p[4] == p[6] else "NO")
    else:
        print("YES" if (p[3] - p[1]) / (p[2] - p[0]) == (p[7] - p[5]) / (p[6] - p[4]) else "NO")

Fixed submission:
n = int(input())
for i in range(n):
    p = list(map(float, input().split()))
    print("YES" if abs((p[3] - p[1]) * (p[6] - p[4]) - (p[7] - p[5]) * (p[2] - p[0])) < 1e-10 else "NO")
Buggy python submission (verdict: Runtime Error):
while True:
  mem = {}
  p, q = map(int, raw_input().split())
  a, b, c = "", p % q, 0
  while True:
    b = (b % q) * 10
    if b in mem or not b: 
      break
    mem[b] = len(a)
    a += str(b // q)
  print(a)
  if b != 0:
    print(" " * mem[b] + "^" * (len(a) - mem[b]))

Fixed submission:
while True:
  mem = {}
  try:
    p, q = map(int, raw_input().split())
  except EOFError:
    break
  a, b, c = "", p % q, 0
  while True:
    b = (b % q) * 10
    if b in mem or not b: 
      break
    mem[b] = len(a)
    a += str(b // q)
  print(a)
  if b != 0:
    print(" " * mem[b] + "^" * (len(a) - mem[b]))
Buggy python submission (verdict: Runtime Error):
MN = 100000
prime = []
mem = [False] * 2 + [True] * MN
for i in range(2, MN):
  if not mem[i]:
    continue
  prime.append(i)
  for j in range(i + i, MN, i):
    mem[j] = False

while True:
  N, ans = input(), 0
  if not N:
    break

  for p in prime:
    if p > N / 2:
      break
    if mem[N - p]:
      ans += 1
  print(ans)

Fixed submission:
MN = 1000000
prime = []
mem = [False] * 2 + [True] * MN
for i in range(2, MN):
  if not mem[i]:
    continue
  prime.append(i)
  for j in range(i + i, MN, i):
    mem[j] = False

while True:
  N, ans = input(), 0
  if not N:
    break

  for p in prime:
    if p > N / 2:
      break
    if mem[N - p]:
      ans += 1
  print(ans)
Buggy python submission (verdict: Runtime Error):

stones = [0, 0]
n = input()
stones.append(input())
stones[0] = (stones[2] + 1) % 2
stones.append(1)
for i in range(n - 1):
  m = input()
  if i % 2 == 1:
    if stones[-2] == m:
      stones[-1] += 1
    else:
      stones.append(m)
      stones.append(1)
  else:
    if stones[-2] == m:
      stones[-1] += 1
    else:
      stones[-3] += stones[-1] + 1
      stones = stones[:-2]
ans = 0
for j in range(0, len(stones), 2):
  if stones[j] == 0:
    ans += stones[j + 1]
print ans

Fixed submission:

while True:
  stones = [0, 0]
  n = input()
  if not n:
    break
  stones.append(input())
  stones.append(1)
  for i in range(n - 1):
    m = input()
    if i % 2 == 1:
      if stones[-2] == m:
        stones[-1] += 1
      else:
        stones.append(m)
        stones.append(1)
    else:
      if stones[-2] == m:
        stones[-1] += 1
      else:
        if len(stones) > 2:
          stones[-3] += stones[-1] + 1
          stones = stones[:-2]
        else:
          stones[-2] = m
          stones[-1] += 1
  ans = 0
  for j in range(0, len(stones), 2):
    if stones[j] == 0:
      ans += stones[j + 1]
  print ans

Buggy python submission (verdict: Runtime Error):

while True:
  stones = [0, 0]
  n = input()
  if not n:
    break
  stones.append(input())
  stones[0] = (stones[2] + 1) % 2
  stones.append(1)
  for i in range(n - 1):
    m = input()
    if i % 2 == 1:
      if stones[-2] == m:
        stones[-1] += 1
      else:
        stones.append(m)
        stones.append(1)
    else:
      if stones[-2] == m:
        stones[-1] += 1
      else:
        stones[-3] += stones[-1] + 1
        stones = stones[:-2]
  ans = 0
  for j in range(0, len(stones), 2):
    if stones[j] == 0:
      ans += stones[j + 1]
  print ans

Fixed submission:

while True:
  stones = [0, 0]
  n = input()
  if not n:
    break
  stones.append(input())
  stones.append(1)
  for i in range(n - 1):
    m = input()
    if i % 2 == 1:
      if stones[-2] == m:
        stones[-1] += 1
      else:
        stones.append(m)
        stones.append(1)
    else:
      if stones[-2] == m:
        stones[-1] += 1
      else:
        if len(stones) > 2:
          stones[-3] += stones[-1] + 1
          stones = stones[:-2]
        else:
          stones[-2] = m
          stones[-1] += 1
  ans = 0
  for j in range(0, len(stones), 2):
    if stones[j] == 0:
      ans += stones[j + 1]
  print ans
Buggy python submission (verdict: Runtime Error):
mass = [0] * 1000
num = [0] * 1000
while True:
  N, M = map(int, raw_input().split())
  if N == 0 and M == 0:
    break
  p = 0
  for i in range(N):
    mass[i] = input()
  for i in range(M):
    num[i] = input()

  for i in range(M):
    p += num[i];
    p += mass[p]
    if p >= N - 1:
      print i + 1
      break

Fixed submission:
mass = [0] * 2000
num = [0] * 1000
while True:
  N, M = map(int, raw_input().split())
  if N == 0 and M == 0:
    break
  p = 0
  for i in range(N):
    mass[i] = input()
  for i in range(M):
    num[i] = input()

  for i in range(M):
    p += num[i];
    p += mass[p]
    if p >= N - 1:
      print i + 1
      break
Buggy python submission (verdict: Runtime Error):
l = []
t = []
ans = [False] * 500
while True:
  l = []
  t = []
  ans = [False] * 500
  N = input()
  M = input()
  if N == 0 and M == 0:
    break
  for i in range(M):
    a, b = map(int, raw_input().split())
    l.append([a, b])
    if a == 1:
      t.append(b)
    if b == 1:
      t.append(a)
  for i in t:
    ans[i] = True
    for j in range(M):
      if l[j][0] == i:
        ans[l[j][1]] = True
      if l[j][1] == i:
        ans[l[j][0]] = True
  res = 0
  for i in range(len(ans)):
    if ans[i] and i != 1:
      print "tes: %d" % (i) 
      res += 1

  print res

Fixed submission:
l = []
t = []
ans = [False] * 501
while True:
  l = []
  t = []
  ans = [False] * 501
  N = input()
  M = input()
  if N == 0 and M == 0:
    break
  for i in range(M):
    a, b = map(int, raw_input().split())
    l.append([a, b])
    if a == 1:
      t.append(b)
    if b == 1:
      t.append(a)
  for i in t:
    ans[i] = True
    for j in range(M):
      if l[j][0] == i:
        ans[l[j][1]] = True
      if l[j][1] == i:
        ans[l[j][0]] = True
  res = 0
  for i in range(len(ans)):
    if ans[i] and i != 1:
      res += 1

  print res
Buggy python submission (verdict: Runtime Error):
W, H = map(int, input().split())
m = [list(map(int, input().split())) for i in range(H)]
dx = [[1, 1, 1, 0, -1, 0], [0, 1, 0, -1, -1, -1]]
dy = [-1, 0, 1, 1, 0, -1]
def dfs(x, y):
    if m[y][x] != 0:
        return
    m[y][x] = 2
    for xx, yy in zip(dx[y % 2], dy):
        tx, ty = x + xx, y + yy
        if 0 <= tx < W and 0 <= ty < H:
            dfs(tx, ty)

for x in range(W):
    dfs(x, 0)
    dfs(x, H - 1)
for y in range(H):
    dfs(0, y)
    dfs(W - 1, y)

from itertools import product
n = 0
for x, y in product(range(W), range(H)):
    if m[y][x] != 1:
        continue
    fn = n
    for xx, yy in zip(dx[y % 2], dy):
        tx, ty = x + xx, y + yy
        if 0 <= tx < W and 0 <= ty < H:
            if m[ty][tx] == 2:
                n += 1
        else:
            n += 1
print(n)

Fixed submission:
import sys
sys.setrecursionlimit(100000)
W, H = map(int, input().split())
m = [list(map(int, input().split())) for i in range(H)]
dx = [[1, 1, 1, 0, -1, 0], [0, 1, 0, -1, -1, -1]]
dy = [-1, 0, 1, 1, 0, -1]
def dfs(x, y):
    if m[y][x] != 0:
        return
    m[y][x] = 2
    for xx, yy in zip(dx[y % 2], dy):
        tx, ty = x + xx, y + yy
        if 0 <= tx < W and 0 <= ty < H:
            dfs(tx, ty)

for x in range(W):
    dfs(x, 0)
    dfs(x, H - 1)
for y in range(H):
    dfs(0, y)
    dfs(W - 1, y)

from itertools import product
n = 0
for x, y in product(range(W), range(H)):
    if m[y][x] != 1:
        continue
    fn = n
    for xx, yy in zip(dx[y % 2], dy):
        tx, ty = x + xx, y + yy
        if 0 <= tx < W and 0 <= ty < H:
            if m[ty][tx] == 2:
                n += 1
        else:
            n += 1
print(n)
Buggy python submission (verdict: Runtime Error):
null

Fixed submission:
while 1:
  n, a, b, c, x = map(int, raw_input().split())
  if not n:
    break
  i = f = 0
  y = map(int, raw_input().split())
  while f <= 10000:
    if x == y[i]:
      i += 1
    x = (a * x + b) % c
    if i == n:
      print f
      break
    f += 1
  else:
    print -1
Buggy python submission (verdict: Runtime Error):
while 1:
    m, f, r = map(int, raw_input().split())
    if m < 0 and f < 0 and r < 0:
        break
    elif m < 0 or f < 0 or m + f < 30:
        a = "F"
    elif m + f >= 80:
        a = "A"
    elif m + f >= 65:
        a = "B"
    elif m + f >= 50 or r >= 50:
        a = "C"
    print a

Fixed submission:
while 1:
    m, f, r = map(int, raw_input().split())
    if m < 0 and f < 0 and r < 0:
        break
    elif m < 0 or f < 0 or m + f < 30:
        a = "F"
    elif m + f >= 80:
        a = "A"
    elif m + f >= 65:
        a = "B"
    elif m + f >= 50 or r >= 50:
        a = "C"
    else:
        a = "D"
    print a
Buggy python submission (verdict: Runtime Error):
mem = [0] * 26
s = raw_input().upper()
for c in s:
  mem[ord(c) - ord('A')] += 1
for i in range(26):
  print chr(i + ord('a')) + " : %d" % mem[i]

Fixed submission:
import sys
mem = [0] * 26
for s in sys.stdin:
  for c in s.upper():
    if(c < 'A' or c > 'Z'):
      continue
    mem[ord(c) - ord('A')] += 1
for i in range(26):
  print chr(i + ord('a')) + " : %d" % mem[i]

Buggy python submission (verdict: Runtime Error):
import sys
mem = [0] * 26
for s in sys.stdin:
  for c in s.upper():
    if(c < 'A' or c > 'Z'):
      continue
    mem[ord(c) - ord('A')] += 1
  for i in range(26):
    print chr(i + ord('a')) + " : %d" % mem[i

Fixed submission:
import sys
mem = [0] * 26
for s in sys.stdin:
  for c in s.upper():
    if(c < 'A' or c > 'Z'):
      continue
    mem[ord(c) - ord('A')] += 1
for i in range(26):
  print chr(i + ord('a')) + " : %d" % mem[i]
Buggy python submission (verdict: Runtime Error):
n = input()
c = map(int, raw_input().split())
q = input()
t = map(int, raw_input().split())

mem = [False] * 101
a = 0
for i in c:
    mem[i] = True
for i in t:
    if mem[i]:
        a += 1
print a

Fixed submission:
n = input()
c = map(int, raw_input().split())
q = input()
t = map(int, raw_input().split())

mem = [False] * 501
a = 0
for i in c:
    mem[i] = True
for i in t:
    if mem[i]:
        a += 1
print a
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

n = int(input())

for data in sys.stdin:
    if n <= 0:
        break
    n--
    x1, y1, x2, y2, x3, y3 = map(float, data.split())
    a1 = x2 - x1
    b1 = y2 - y1
    a2 = x3 - x1
    b2 = y3 - y1
    px = (b2 * (a1 * a1 + b1 * b1) - b1 * (a2 * a2 + b2 * b2)) / (2 * (a1 * b2 - a2 * b1))
    py = (a1 * (a2 * a2 + b2 * b2) - a2 * (a1 * a1 + b1 * b1)) / (2 * (a1 * b2 - a2 * b1))
    r = math.sqrt(px * px + py * py)
    px += x1
    py += y1
    print("{0:.3f} {1:.3f} {2:.3f}".format(px, py, r))

Fixed submission:
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

n = int(input())

for data in sys.stdin:
    x1, y1, x2, y2, x3, y3 = map(float, data.split())
    a1 = x2 - x1
    b1 = y2 - y1
    a2 = x3 - x1
    b2 = y3 - y1
    px = (b2 * (a1 * a1 + b1 * b1) - b1 * (a2 * a2 + b2 * b2)) / (2 * (a1 * b2 - a2 * b1))
    py = (a1 * (a2 * a2 + b2 * b2) - a2 * (a1 * a1 + b1 * b1)) / (2 * (a1 * b2 - a2 * b1))
    r = math.sqrt(px * px + py * py)
    px += x1
    py += y1
    print("{0:.3f} {1:.3f} {2:.3f}".format(px, py, r))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

n = int(input())
anss = []

for _ in range(n):
    x = int(input())
    y = int(input())
    anss.append(x+y)
    if int(math.log10(x)+1) > 80:
        print("overflow")
    elif int(math.log10(y)+1) > 80:
        print("overflow")
    elif int(math.log10(x+y)+1) > 80:
        print("overflow")

for data in anss:
    print(data)

Fixed submission:
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

n = int(input())
result = 0

for i in range(n):
    result = 0
    x = int(input())
    y = int(input())

    result = x + y
    length = len(str(result))
    if length > 80:
        print("overflow")
    else:
        print(result)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

n = int(input())
anss = []

for _ in range(n):
    x = int(input())
    y = int(input())
    if int(math.log10(x)+1) > 80:
        print("overflow")
    elif int(math.log10(y)+1) > 80:
        print("overflow")
    elif int(math.log10(x+y)+1) > 80:
        print("overflow")
    else:
        anss.append(x+y)

for data in anss:
    print(data)

Fixed submission:
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

n = int(input())
result = 0

for i in range(n):
    result = 0
    x = int(input())
    y = int(input())

    result = x + y
    length = len(str(result))
    if length > 80:
        print("overflow")
    else:
        print(result)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

def digit(x):
    d = 0
    while x >= 1:
        x /= 10
        d += 1

    return d

n = int(input())
anss = []

for _ in range(n):
    x = int(input())
    y = int(input())
    if int(digit(x)) > 80:
        print("overflow")
    elif int(digit(y)) > 80:
        print("overflow")
    elif int(digit(x+y)) > 80:
        print("overflow")
    else:
        anss.append(x+y)

for data in anss:
    print(data)

Fixed submission:
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

n = int(input())
result = 0

for i in range(n):
    result = 0
    x = int(input())
    y = int(input())

    result = x + y
    length = len(str(result))
    if length > 80:
        print("overflow")
    else:
        print(result)
Buggy python submission (verdict: Runtime Error):
import sys

count = [0 for _ in range(100)]
mode = [0]

for s in sys.stdin:
    x = int(s)
    count[x-1] += 1

for i in range(len(count)):
    if count[i] > mode[0]:
        mode.clear()
        mode.append(i+1)
    elif count[i] == mode[0]:
        mode.append(i+1)

for i in mode:
    print(i)

Fixed submission:
import sys

count = [0 for _ in range(101)]
mode = 0

for s in sys.stdin:
    x = int(s)
    count[x] += 1
    mode = max(mode, count[x])

for i in range(101):
    if count[i] == mode:
        print(i)

Buggy python submission (verdict: Runtime Error):
import sys

count = [0 for _ in range(101)]
mode = [0]

for s in sys.stdin:
    x = int(s)
    count[x] += 1

for i in range(len(count)):
    if count[i] > mode[0]:
        mode.clear()
        mode.append(i)
    elif count[i] == mode[0]:
        mode.append(i)

for i in mode:
    print(i)

Fixed submission:
import sys

count = [0 for _ in range(101)]
mode = 0

for s in sys.stdin:
    x = int(s)
    count[x] += 1
    mode = max(mode, count[x])

for i in range(101):
    if count[i] == mode:
        print(i)
Buggy python submission (verdict: Runtime Error):
import sys

def stackBall(stackB, stackC, ball):
	if len(ball) == 0:
		return True
	if len(stackB) == 0 or stackB[-1] < ball[0]:
		stackB.append(ball.pop(0))
		if stackBall(stackB, stackC, ball):
			return True
	if len(stackC) == 0 or stackC[-1] < ball[0]:
		stackC.append(ball.pop(0))
		if stackBall(stackB, stackC, ball):
			return True
	return False

n = input()

for _ in range(n):
	ball = list(map(int, input().split()))
	if stackBall([], [], ball):
		print("YES")
	else:
		print("NO")

Fixed submission:
import sys

def stackBall(ball):
	sB, sC = [0], [0]
	for b in ball:
		if max(sB[-1], sC[-1]) < b:
			if sB[-1] >= sC[-1]:
				sB.append(b)
			else:
				sC.append(b)
		elif min(sB[-1], sC[-1]) < b:
			if sB[-1] >= sC[-1]:
				sC.append(b)
			else:
				sB.append(b)
		else:
			return False
	return True


n = int(input())

for _ in range(n):
	ball = list(map(int, input().split()))
	if stackBall(ball):
		print("YES")
	else:
		print("NO")
Buggy python submission (verdict: Runtime Error):
import sys

for s in sys.stdin:
	sur = [list(map(int, s.strip()))]
	if 1 not in sur[0]:
		sur.pop()
	for _ in range(7):
		sur.append(list(map(int, input().strip())))
		if 1 not in sur[-1]:
			sur.pop()

	if len(sur) == 1:
		print("C")
	elif len(sur) == 2:
		if sur[0].index(1) == sur[1].index(1):
			print("A")
		elif sur[0].index(1) < sur[1].index(1):
			print("E")
		else:
			print("G")
	elif len(sur) == 3:
		if sur[0].index(1) > sur[2].index(1):
			print("D")
		else:
			print("F")
	elif len(sur) == 4:
		print("B")

Fixed submission:
import sys

while True:
	sur = []

	for _ in range(8):
		sur.append(list(map(int, input().strip())))
		if 1 not in sur[-1]:
			sur.pop()

	if len(sur) == 1:
		print("C")
	elif len(sur) == 2:
		if sur[0].index(1) == sur[1].index(1):
			print("A")
		elif sur[0].index(1) < sur[1].index(1):
			print("E")
		else:
			print("G")
	elif len(sur) == 3:
		if sur[0].index(1) > sur[2].index(1):
			print("D")
		else:
			print("F")
	elif len(sur) == 4:
		print("B")

	try:
		line = input()
	except:
		break

Buggy python submission (verdict: Runtime Error):
import sys

for s in sys.stdin:
	sur = [list(map(int, s.strip()))]
	if 1 not in sur[0]:
		sur.pop()
	for _ in range(7):
		sur.append(list(map(int, input().strip())))
		if 1 not in sur[-1]:
			sur.pop()

	if len(sur) == 1:
		print("C")
	elif len(sur) == 2:
		if sur[0].index(1) == sur[1].index(1):
			print("A")
		elif sur[0].index(1) < sur[1].index(1):
			print("E")
		else:
			print("G")
	elif len(sur) == 3:
		if sur[0].index(1) > sur[2].index(1):
			print("D")
		else:
			print("F")
	elif len(sur) == 4:
		print("B")

Fixed submission:
import sys

while True:
	sur = []

	for _ in range(8):
		sur.append(list(map(int, input().strip())))
		if 1 not in sur[-1]:
			sur.pop()

	if len(sur) == 1:
		print("C")
	elif len(sur) == 2:
		if sur[0].index(1) == sur[1].index(1):
			print("A")
		elif sur[0].index(1) < sur[1].index(1):
			print("E")
		else:
			print("G")
	elif len(sur) == 3:
		if sur[0].index(1) > sur[2].index(1):
			print("D")
		else:
			print("F")
	elif len(sur) == 4:
		print("B")

	try:
		line = input()
	except:
		break
Buggy python submission (verdict: Runtime Error):
import sys

def is_onepair(x):
    for i in range(4):
        if x.count(x[i]) == 2:
            return True

    return False

def is_twopair(x):
    count = 0
    for e in x:
        for e2 in x:
            if e == e2:
                count += 1
            if count == 2:
                return True

    return False

def is_threecard(x):
    for i in range(3):
        if x.count(x[i]) == 3:
            return True

    return False

def is_straight(x):
    x.sort()
    if x[0] == 1 and x[1:] = [10, 11, 12, 13]:
        return True
    for i in range(4):
        if x[i]+1 != x[i+1]:
            return False
    
    return True

def is_fullhouse(x):
    if is_threecard(x) and is_onepair(x):
        return True

    return False
    
def is_fourcard(x):
    for i in range(2):
        if x.count(x[i]) == 4:
            return True

    return False

for line in sys.stdin.readlines():
    hand = list(map(int, line.split(',')))
    if is_fourcard(hand):
        print("four card")
    elif is_fullhouse(hand):
        print("full house")
    elif is_straight(hand):
        print("straight")
    elif is_threecard(hand):
        print("three card")
    elif is_twopair(hand):
        print("two pair")
    elif is_onepair(hand):
        print("one pair")
    else:
        print("null")

Fixed submission:
import sys

def is_onepair(x):
    for i in range(4):
        if x.count(x[i]) == 2:
            return True

    return False

def is_twopair(x):
    count = 0
    i = 0
    x.sort()
    while i < 5:
        if x.count(x[i]) == 2:
            i += 2
            count += 1
        else:
            i += 1
        if count == 2:
            return True

    return False

def is_threecard(x):
    for i in range(3):
        if x.count(x[i]) == 3:
            return True

    return False

def is_straight(x):
    x.sort()
    if x[0] == 1 and x[1:] == [10, 11, 12, 13]:
        return True
    for i in range(4):
        if x[i]+1 != x[i+1]:
            return False
    
    return True

def is_fullhouse(x):
    if is_threecard(x) and is_onepair(x):
        return True

    return False
    
def is_fourcard(x):
    for i in range(2):
        if x.count(x[i]) == 4:
            return True

    return False

for line in sys.stdin.readlines():
    hand = list(map(int, line.split(',')))
    if is_fourcard(hand):
        print("four card")
    elif is_fullhouse(hand):
        print("full house")
    elif is_straight(hand):
        print("straight")
    elif is_threecard(hand):
        print("three card")
    elif is_twopair(hand):
        print("two pair")
    elif is_onepair(hand):
        print("one pair")
    else:
        print("null")