Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from sys import stdin

def deal(x):
    if abs(x) < 1e-6: return 0
    else: return x

def solve(a, b, c, d, e, f):
    x = 0
    y = 0
    if b == 0:
        x = c / a
        y = (f - d * x) / e
    else:
        x = (b * f - e * c) / (b * d - e * a)
        y = (c - a * x) / b
    
    p = [deal(x), deal(y)]
    return p

for s in stdin:
    s = s[:-1]
    s = map(float, s.split())
    p = solve(s[0], s[1], s[2], s[3], s[4], s[5])
    print ("%.3f "%p[0] + "%.3f"%p[1])

Fixed submission:
from sys import stdin

def deal(x):
    if abs(x) < 1e-6: return 0
    else: return x

def solve(a, b, c, d, e, f):
    x = 0
    y = 0
    if b == 0:
        x = c / a
        y = (f - d * x) / e
    else:
        x = (b * f - e * c) / (b * d - e * a)
        y = (c - a * x) / b
    
    p = [deal(x), deal(y)]
    return p

for s in stdin:
    s = s[:-1]
    s = map(float, s.split())
    p = solve(s[0], s[1], s[2], s[3], s[4], s[5])
    print ("%.3f "%p[0] + "%.3f"%p[1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    if (y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3):
        print("YES")
    else:
        print("NO")

Fixed submission:
n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    if x1 == x2 and x3 == x4:
        print("YES")
    elif x1 == x2 or x3 == x4:
        print("NO")
    elif abs((y2 - y1) / (x2 - x1) - (y4 - y3) / (x4 - x3)) < 1e-10:
        print("YES")
    else:
        print("NO")

Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    if (y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3):
        print("YES")
    else:
        print("NO")

Fixed submission:
n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    if x1 == x2 and x3 == x4:
        print("YES")
    elif x1 == x2 or x3 == x4:
        print("NO")
    elif abs((y2 - y1) / (x2 - x1) - (y4 - y3) / (x4 - x3)) < 1e-10:
        print("YES")
    else:
        print("NO")

Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    if x1 == x2 and x3 == x4:
        print("YES")
    elif (y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3):
        print("YES")
    else:
        print("NO")

Fixed submission:
n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    if x1 == x2 and x3 == x4:
        print("YES")
    elif x1 == x2 or x3 == x4:
        print("NO")
    elif abs((y2 - y1) / (x2 - x1) - (y4 - y3) / (x4 - x3)) < 1e-10:
        print("YES")
    else:
        print("NO")
Buggy python submission (verdict: Runtime Error):
from math import ceil

while True:
    v = input()
    if not v:
        break
    v = float(v)
    print(ceil(v * v / 98 + 1))

Fixed submission:
from math import ceil

while True:
    try:
        v = input()
        v = float(v)
        t = v / 9.8
        y = 4.9 * t * t
        n = ceil((y+5) / 5)
        print(n)
    except:
        break
Buggy python submission (verdict: Runtime Error):
shapes = {
    'A': '1100000011',
    'B': '1000000010000000100000001',
    'C': '1111',
    'D': '01000000110000001',
    'E': '11000000011',
    'F': '100000001100000001',
    'G': '0110000011'
}

while True:
    plane = ''
    for i in range(8):
        plane += input()

    for name in shapes:
        try:
            plane.index(shapes[name])
            print(name)
            break
        except:
            pass



Fixed submission:
shapes = {
    'A': '1100000011',
    'B': '1000000010000000100000001',
    'C': '1111',
    'D': '01000000110000001',
    'E': '11000000011',
    'F': '100000001100000001',
    'G': '0110000011'
}

while True:
    try:
        plane = ''
        for i in range(8):
            plane += input()

        for name in shapes:
            try:
                plane.index(shapes[name])
                print(name)
                break
            except:
                pass

        input()
    except:
        break

Buggy python submission (verdict: Runtime Error):
shapes = {
    'A': '1100000011',
    'B': '1000000010000000100000001',
    'C': '1111',
    'D': '01000000110000001',
    'E': '11000000011',
    'F': '100000001100000001',
    'G': '0110000011'
}

while True:
    plane = ''
    for i in range(8):
        plane += input()

    for name in shapes:
        try:
            plane.index(shapes[name])
            print(name)
            break
        except:
            pass



Fixed submission:
shapes = {
    'A': '1100000011',
    'B': '1000000010000000100000001',
    'C': '1111',
    'D': '01000000110000001',
    'E': '11000000011',
    'F': '100000001100000001',
    'G': '0110000011'
}

while True:
    try:
        plane = ''
        for i in range(8):
            plane += input()

        for name in shapes:
            try:
                plane.index(shapes[name])
                print(name)
                break
            except:
                pass

        input()
    except:
        break
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
friend = [[] for i in range(n)]
for i in range(m):
    s, t = map(int, input().split())
    friend[s].append(t)
    friend[t].append(s)

def are_connected(s, t):
    q = [s]
    checked = [False] * n
    checked[s] = True

    while q:
        user = q.pop(0)
        for f in friend[user]:
            if f == t:
                return True
            elif not checked[f]:
                q.append(f)
                checked[f] = True
    return False

q = int(input())
for i in range(q):
    s, t = map(int, input().split())
    if are_connected(s, t):
        print('yes')
    else:
        print('no')

Fixed submission:
n, m = map(int, input().split())
friend = [[] for i in range(n)]
for i in range(m):
    s, t = map(int, input().split())
    friend[s].append(t)
    friend[t].append(s)

group = [-1 for i in range(n)]
for u in range(n):
    if group[u] == -1:
        group[u] = u
        q = [u]
        while q:
            u1 = q.pop()
            for u2 in friend[u1]:
                if group[u2] == -1:
                    group[u2] = u
                    q.append(u2)

q = int(input())
for i in range(q):
    s, t = map(int, input().split())
    if group[s] == group[t]:
        print('yes')
    else:
        print('no')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
g = []
for i in range(n):
    line = list(map(int, input().split()))
    k = line[1]
    c = [100001] * n
    for j in range(k):
        v = line[2 + 2 * j]
        c[v] = line[3 + 2 * j]
    g.append(c)

distance = [100001] * n
distance[0] = 0
visited = [False] * n
current = 0

while not all(visited):
    min_i = 0
    min_d = 100001
    for i in range(n):
        if not visited[i]:
            if distance[current] + g[current][i] < distance[i]:
                distance[i] = distance[current] + g[current][i]
            if distance[i] < min_d:
                min_i = i
                min_d = distance[i]
    visited[current] = True
    current = min_i

for i in range(n):
    print(i, distance[i])

Fixed submission:
inf = float('inf')
n = int(input())
g = []
for i in range(n):
    line = list(map(int, input().split()))
    k = line[1]
    c = [inf] * n
    for j in range(k):
        v = line[2 + 2 * j]
        c[v] = line[3 + 2 * j]
    g.append(c)

distance = [inf] * n
distance[0] = 0
visited = [False] * n
current = 0

while not all(visited):
    visited[current] = True
    min_i = 0
    min_d = inf
    for i in range(n):
        if not visited[i]:
            if distance[current] + g[current][i] < distance[i]:
                distance[i] = distance[current] + g[current][i]
            if distance[i] < min_d:
                min_i = i
                min_d = distance[i]
    current = min_i

for i in range(n):
    print(i, distance[i])
Buggy python submission (verdict: Time Limit Exceeded):
inf = float('inf')
n = int(input())
g = []
for i in range(n):
    line = list(map(int, input().split()[2:]))
    g.append(zip(line[0::2], line[1::2]))

distance = [inf] * n
distance[0] = 0
visited = [False] * n
current = 0

while not all(visited):
    visited[current] = True
    for v, c in g[current]:
        if not visited[v] and distance[current] + c < distance[v]:
            distance[v] = distance[current] + c
    min_i = 0
    min_d = inf
    for i in range(n):
        if not visited[i] and distance[i] < min_d:
            min_i = i
            min_d = distance[i]
    current = min_i

for i in range(n):
    print(i, distance[i])

Fixed submission:
from heapq import heappush, heappop

inf = float('inf')
n = int(input())
g = []
for i in range(n):
    line = list(map(int, input().split()[2:]))
    g.append(zip(line[0::2], line[1::2]))

dist = [inf] * n
dist[0] = 0
heap = [(0, 0)]

while heap:
    current = heappop(heap)[1]
    for v, c in g[current]:
        new_dist = dist[current] + c
        if new_dist < dist[v]:
            dist[v] = new_dist
            heappush(heap, (new_dist, v))

for i in range(n):
    print(i, dist[i])
Buggy python submission (verdict: Runtime Error):
height = []
for i in range(10)
    height.append(int(input()))
height.sort()
for i in range(9,6,-1)
    print(height[i])

Fixed submission:
a = []
for i in range(10):
    a.append(int(input()))
a.sort()
print(a[9])
print(a[8])
print(a[7])

Buggy python submission (verdict: Runtime Error):
height = []
for i in range(10):
    height.append(int(input()))
for i in range(3):
    most = max(height)
    print(most)
    height[index(most)] = 0

Fixed submission:
a = []
for i in range(10):
    a.append(int(input()))
a.sort()
print(a[9])
print(a[8])
print(a[7])
Buggy python submission (verdict: Runtime Error):
M, N = map(int, input().split())
K = int(input())
P = ['_' * (N + 1) for _ in range(M + 1)]
for mi in range(1, M + 1):
    P[mi] = '_' + input()  # for p in P:
    # print('p', p)
    J = [[0 for _ in range(N + 1)] for _ in range(M + 1)]
    O = [[0 for _ in range(N + 1)] for _ in range(M + 1)]
    I = [[0 for _ in range(N + 1)] for _ in range(M + 1)]
    for i in range(1, M + 1):
        ji, oi, ii = 0, 0, 0
        for j in range(1, N + 1):
            ji += P[i][j] == 'J'
            oi += P[i][j] == 'O'
            ii += P[i][j] == 'I'
            J[i][j] = J[i - 1][j] + ji
            O[i][j] = O[i - 1][j] + oi
            I[i][j] = I[i - 1][j] + ii
            # for j in J:
            # print('j', j)
            # for o in O:
            # print('o', o)
            # for i in I:
            # print('i', i)


def cum(mat, a, b, c, d):
    a -= 1
    b -= 1
    return mat[a][b] + mat[c][d] - mat[a][d] - mat[c][b]


for k in range(K):
    a, b, c, d = map(int, input().split())
    j = cum(J, a, b, c, d)
    o = cum(O, a, b, c, d)
    i = cum(I, a, b, c, d)
    print(j, o, i)


Fixed submission:
M, N = map(int, input().split())
K = int(input())
P = ['_' * (N + 1) for _ in range(M + 1)]
for mi in range(1, M + 1):
    P[mi] = '_' + input()
# for p in P:
#     print('p', p)

J = [[0 for _ in range(N + 1)] for _ in range(M + 1)]
O = [[0 for _ in range(N + 1)] for _ in range(M + 1)]
I = [[0 for _ in range(N + 1)] for _ in range(M + 1)]
for i in range(1, M + 1):
    ji, oi, ii = 0, 0, 0
    for j in range(1, N + 1):
        ji += P[i][j] == 'J'
        oi += P[i][j] == 'O'
        ii += P[i][j] == 'I'
        J[i][j] = J[i - 1][j] + ji
        O[i][j] = O[i - 1][j] + oi
        I[i][j] = I[i - 1][j] + ii
# for j in J:
#     print('j', j)
# for o in O:
#     print('o', o)
# for i in I:
#     print('i', i)


def cum(mat, a, b, c, d):
    a -= 1
    b -= 1
    return mat[a][b] + mat[c][d] - mat[a][d] - mat[c][b]


for k in range(K):
    a, b, c, d = map(int, input().split())
    j = cum(J, a, b, c, d)
    o = cum(O, a, b, c, d)
    i = cum(I, a, b, c, d)
    print(j, o, i)
Buggy python submission (verdict: Runtime Error):
from math import sqrt
n=input()
for i in range(n):
    x1,y1,x2,y2,x3,y3=map(float,raw_input().split())
    A1=2*(x2-x1)
    B1=2*(y2-y1)
    C1=x2**2+y2**2-x1**2-y1**2
    A2=2*(x3-x2)
    B2=2*(y3-y2)
    C2=x3**2+y3**2-x2**2-y2**2
    x=(C1*B2-C2*B1)/(A1*B2-A2*B1)
    y=(A1*C2-A2*C1)/(A1*B2-A2*B1)
    R=sqrt((x1-x)**2+(y1-y)**2)
    print"%.3f %.3f %.3f"%(x,y,R)


Fixed submission:
from math import sqrt
n=input()
for i in range(n):
    x1,y1,x2,y2,x3,y3=map(float,raw_input().split())
    A1=2*(x2-x1)
    B1=2*(y2-y1)
    C1=x2**2+y2**2-x1**2-y1**2
    A2=2*(x3-x2)
    B2=2*(y3-y2)
    C2=x3**2+y3**2-x2**2-y2**2
    x=(C1*B2-C2*B1)/(A1*B2-A2*B1)
    y=(A1*C2-A2*C1)/(A1*B2-A2*B1)
    R=sqrt((x1-x)**2+(y1-y)**2)
    print"%.3f %.3f %.3f"%(x,y,R)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,split())
print(abs(a-b))


Fixed submission:
a,b=map(int,input().split())
print(abs(a-b))
Buggy python submission (verdict: Runtime Error):
l = [i for i in range(1,10)]
for i in l:
  for j in l:
    print(str(i)+ 'x' + str(j) + '=' str(i*j))

Fixed submission:
for i in range(1,10):
 for j in range(1,10):
  print(str(i) + "x" + str(j) + "=" + str(i * j))
Buggy python submission (verdict: Runtime Error):
while True:
  a,b = map(int,input().split())
  if a + b == 0: break
  print(len(str(a+b)))
  

Fixed submission:
import sys
for line in sys.stdin.readlines():
  a,b = map(int,line.split())
  print(len(str(a+b)))

Buggy python submission (verdict: Runtime Error):
import sys.stdin.readlines
for line in sys.stdin.readlines():
  a,b = map(int,line.split())
  print(len(str(a+b)))
  

Fixed submission:
import sys
for line in sys.stdin.readlines():
  a,b = map(int,line.split())
  print(len(str(a+b)))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
for line in sys.stdin.readlines():
  n = int(line)
  count_ = 0
  for i in range(n):
    count = 0
    for j in range(i+1):
      if (i+1) % (j+1) == 0:
        count += 1
    if count == 2:
      count_ += 1
  print(count_)

Fixed submission:
lst = [1 for i in range(10 ** 6 + 1)]
lst[0] = lst[1] = 0
for i in range(10 ** 6 + 1):
  if lst[i] == 1:
    for j in range(i * 2, 10 ** 6 + 1, i):
      lst[j] = 0
while 0 == 0:
  try:
    n = int(input())
    c = 0
    for i in range(n + 1):
      c += lst[i]
    print(c)
  except EOFError:
    break

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def prime(n):
  l = [2]
  for i in range(3,n+1):
    count = 0
    for j in l:
      if i % j == 0:
        count += 1
    if count == 0:
      l.append(i)
  return l
for line in sys.stdin.readlines():
  n = int(line)
  if n == 1:
    print(0)
  else:
    print(len(prime(n)))

Fixed submission:
lst = [1 for i in range(10 ** 6 + 1)]
lst[0] = lst[1] = 0
for i in range(10 ** 6 + 1):
  if lst[i] == 1:
    for j in range(i * 2, 10 ** 6 + 1, i):
      lst[j] = 0
while 0 == 0:
  try:
    n = int(input())
    c = 0
    for i in range(n + 1):
      c += lst[i]
    print(c)
  except EOFError:
    break

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def prime(n):
  i = 2
  if n == 1:
    l = []
  else:
    l = [2]
  while i < n:
    i += 1
    for j in l:
      if i % j == 0:
        break
    else:
      l.append(i)
  return len(l)
for line in sys.stdin.readlines():
  n = int(line)
  print(prime(n))

Fixed submission:
lst = [1 for i in range(10 ** 6 + 1)]
lst[0] = lst[1] = 0
for i in range(10 ** 6 + 1):
  if lst[i] == 1:
    for j in range(i * 2, 10 ** 6 + 1, i):
      lst[j] = 0
while 0 == 0:
  try:
    n = int(input())
    c = 0
    for i in range(n + 1):
      c += lst[i]
    print(c)
  except EOFError:
    break
Buggy python submission (verdict: Runtime Error):
w = int(raw_input())
n = int(raw_input())
l = [i for i in range(1,w+1)]
while n > 0:
  a,b = map(int,raw_input().split(','))
  l[a-1],l[b-1] = l[b-1],l[a-1]
  n -= 1
for i in l:
  print(i)

Fixed submission:
w = int(input())
n = int(input())
l = [i for i in range(1,w+1)]
while n > 0:
  a,b = map(int,input().split(','))
  l[a-1],l[b-1] = l[b-1],l[a-1]
  n -= 1
for i in l:
  print(i)
Buggy python submission (verdict: Runtime Error):
import math
x,y,r = 0,0,90
while True:
  m,n = map(int,raw_input().split(','))
  if (m,n) == (0,0):
    break
  y += m * math.sin(math.radians(r))
  y
  x+= m * math.cos(math.radians(r))
  r -= n
print(int(x))
print(int(y))

Fixed submission:
import math
x,y,r = 0,0,90
while True:
  m,n = map(int,input().split(','))
  if (m,n) == (0,0):
    break
  y += m * math.sin(math.radians(r))
  x += m * math.cos(math.radians(r))
  r -= n
print(int(x))
print(int(y))
Buggy python submission (verdict: Runtime Error):
def f(n,s,x):
  if n == s == 0:
    return 1
  elif n == 0 or x == 0:
    return 0
  else:
    a = 0
    for i in range(x):
      a += f(n-1,s-i,i)
    return a
while True:
  n,s = map(int,raw_input().split())
  if n == s == 0:
    break
  print(f(n,s,10))

Fixed submission:
def f(n,s,x):
  if n == s == 0:
    return 1
  elif n == 0 or x == 0:
    return 0
  else:
    a = 0
    for i in range(x):
      a += f(n-1,s-i,i)
    return a
while True:
  n,s = map(int,input().split())
  if n == s == 0:
    break
  print(f(n,s,10))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def primegen():
  l = [2]
  while True:
    yield max(l)
    n = max(l)
    while True:
      n += 1
      flag = 1
      for i in l:
        if n % i == 0:
          flag = 0
          break
      if flag:
        l.append(n)
        break

for line in sys.stdin:
  n = int(line)
  seq = primegen()
  i1 = 0
  i2 = 0
  while i2 < n:
    i1 = i2
    i2 = seq.__next__()
  if i2 == n:
    i2 = seq.__next__()
  print(str(i1) + " " + str(i2))

Fixed submission:
MAX = 60000
lst = [i for i in range(MAX)]
lst[0] = lst[1] = 0
for i in range(MAX):
  if lst[i] != 0:
    for j in range(i * 2, MAX, i):
      lst[j] = 0
while 0 == 0:
  try:
    n = int(input())
    i = n - 1
    j = n + 1
    while lst[i] == 0:
      i -= 1
    while lst[j] == 0:
      j += 1
    print(lst[i],lst[j])
  except EOFError:
    break
Buggy python submission (verdict: Runtime Error):
print(sum([int(input()) for i in range(10)])

Fixed submission:
print(sum([int(input()) for i in range(10)]))
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().spit())
if b <= a:
  print(No)
elif c <= b:
  print(No)
else:
  print(Yes)

Fixed submission:
a,b,c = map(int,input().split())
if b <= a:
  print('No')
elif c <= b:
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if b <= a:
  print(No)
elif c <= b:
  print(No)
else:
  print(Yes)

Fixed submission:
a,b,c = map(int,input().split())
if b <= a:
  print('No')
elif c <= b:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
from math import pi
r = int(input())
d = pi*r*r
l = 2*pi*r
print(d,l)

Fixed submission:
from math import pi
r = float(input())
d = pi*r*r
l = 2*pi*r
print(d,l)
Buggy python submission (verdict: Runtime Error):
n = input()
l = [int(i) for i in input().split()]
print(' '.join([str(min(l)),str(max(l)),str(sum(l))])

Fixed submission:
n = input()
l = [int(i) for i in input().split()]
print(' '.join([str(min(l)),str(max(l)),str(sum(l))]))
Buggy python submission (verdict: Runtime Error):
l = []
while True:
  h,w = map(int,input().split())
  if (h,w) == (0,0):
    break
  else:
    l.append([h,w])
for i in l:
  r1 = ''
  r2 = ''
  for jin range(i[1]//2):
    r1 += '#.'
    r2 += '.#'
  if i[1]%2 == 1:
    r1 += '#'
    r2 += '.'
  for m in range(i[0]//2):
    print(r1)
    print(r2)
  if i[0]%2 == 1:
    print(r1)
  print()

Fixed submission:
l = []
while True:
  h,w = map(int,input().split())
  if (h,w) == (0,0):
    break
  else:
    l.append([h,w])
for i in l:
  r1 = ''
  r2 = ''
  for j in range(i[1]//2):
    r1 += '#.'
    r2 += '.#'
  if i[1]%2 == 1:
    r1 += '#'
    r2 += '.'
  for m in range(i[0]//2):
    print(r1)
    print(r2)
  if i[0]%2 == 1:
    print(r1)
  print()
Buggy python submission (verdict: Runtime Error):
l = [x+' '+y for x in ['S','H','C','D'] for y in [str(i) for i in range(1,14)]]
n = int(input())
while n > 0:
  l.remove(input())
  n += 1
for i in l:
  print(i)

Fixed submission:
l = [x+' '+y for x in ['S','H','C','D'] for y in [str(i) for i in range(1,14)]]
n = int(input())
while n > 0:
  l.remove(input())
  n -= 1
for i in l:
  print(i)
Buggy python submission (verdict: Runtime Error):
l = []
l= []
while True:
  m,f,r = map(int,input().split())
  if m == f == r == -1:
    break
  else:
    l.append([m,f,r])
for i in l:
  s = ''
  x = i[0] + i[1]
  if i[0] == -1 or i[1] == -1:
    s = 'F'
  elif x >= 80:
    s = 'A'
  elif x >= 65:
    s = 'B':
  elif x >= 50:
    s = 'C':
  elif x >= 30:
    s = 'D'
    if i[2] >= 50:
      s = 'C'
  else:
    s = 'F'
  print(s)

Fixed submission:
def code():
	l = []
	while True:
		m,f,r = map(int,input().split())
		if m == f == r == -1:
			break
		else:
			l.append([m,f,r])
	for i in l:
		s = ''
		x = i[0]+i[1]
		if i[0] == -1 or i[1] == -1:
			s = 'F'
		elif x >= 80:
			s = 'A'
		elif x >= 65:
			s = 'B'
		elif x >= 50:
			s = 'C'
		elif x >= 30:
			s = 'D'
			if i[2] >= 50:
				s = 'C'
		else:
			s = 'F'
		print(s)
code()

Buggy python submission (verdict: Runtime Error):
l = []
while True:
  m,f,r = map(int,input().split())
  if m == f == r == -1:
    break
  else:
    l.append([m,f,r])
for i in l:
  s = ''
  x = i[0] + i[1]
  if i[0] == -1 or i[1] == -1:
    s = 'F'
  elif x >= 80:
    s = 'A'
  elif x >= 65:
    s = 'B':
  elif x >= 50:
    s = 'C':
  elif x >= 30:
    s = 'D'
    if i[2] >= 50:
      s = 'C'
  else:
    s = 'F'
  print(s)

Fixed submission:
def code():
	l = []
	while True:
		m,f,r = map(int,input().split())
		if m == f == r == -1:
			break
		else:
			l.append([m,f,r])
	for i in l:
		s = ''
		x = i[0]+i[1]
		if i[0] == -1 or i[1] == -1:
			s = 'F'
		elif x >= 80:
			s = 'A'
		elif x >= 65:
			s = 'B'
		elif x >= 50:
			s = 'C'
		elif x >= 30:
			s = 'D'
			if i[2] >= 50:
				s = 'C'
		else:
			s = 'F'
		print(s)
code()
Buggy python submission (verdict: Runtime Error):
import sys
import math

for line in sys.stdin:
    a,b = map(int, line.split())
    gc = math.gcd(a,b)
    print("{} {}".format(gc, a*b//gc))

Fixed submission:
import sys

def gcd(a,b):
    if a%b == 0:
        return b
    else:
        return gcd(b, a%b)

for line in sys.stdin:
    a,b = map(int, line.split())
    if a<b:
        tem = a
        a = b
        b = tem
    gc = gcd(a,b)
    print(gc, a*b//gc)

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

for line in sys.stdin:
    a,b = map(int, line.split())
    gc = math.gcd(a,b)
    print("{0} {1}".format(gc, a*b//gc))

Fixed submission:
import sys

def gcd(a,b):
    if a%b == 0:
        return b
    else:
        return gcd(b, a%b)

for line in sys.stdin:
    a,b = map(int, line.split())
    if a<b:
        tem = a
        a = b
        b = tem
    gc = gcd(a,b)
    print(gc, a*b//gc)
Buggy python submission (verdict: Time Limit Exceeded):
while True:
    n = int(input())
    if n==0 : break

    a = []
    for i in range(n):
        a.append(int(input()))

    maxi = 0
    for i in range(1,1+n):
        for j in range(n-i+1):
            if maxi < sum(a[j:j+i]):
                maxi = sum(a[j:j+i])

    print(maxi)

Fixed submission:
while True:
    n = int(input())
    if n==0 : break

    a = []
    for i in range(n):
        a.append(int(input()))

    maxp = -100001
    maxcont = -100001
    for i in range(n):
        maxcont = max(a[i], maxcont + a[i])
        maxp = max(maxp, maxcont)

    print(maxp)
Buggy python submission (verdict: Runtime Error):
while True:
    instr = str(bin(int(input())))
    ans = []
    for i in range(len(instr)):
        if instr[-i]=="1": ans.append(1<<i-1)
    print(" ".join(map(lambda x: str(x), ans)))

Fixed submission:
while True:
    try:
        instr = str(bin(int(input())))
        ans = []
        for i in range(len(instr)):
            if instr[-i]=="1": ans.append(1<<i-1)
        print(" ".join(map(lambda x: str(x), ans)))
    except EOFError:
        break