Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import copy

def discomfort(dic, n):
    global expenses
    if expenses != None and sum(p_res) >= expenses:
        return
    if n == s_n and g_n in load:
        expenses = sum(p_res)
        Pirates.append(r-(sum(p_res)+p))
        return
    for v in dic[n]:
        p_res.append(p_dic[(n,v)])
        c_l_dic = copy.deepcopy(dic)
        c_l_dic[n].remove(v)
        c_l_dic[v].remove(n)
        load.append(v)
        discomfort(c_l_dic, v)
        del p_res[-1]
        del load[-1]

if __name__ == '__main__':
    l_dic = {}
    p_dic = {}
    for line in open('s.txt').readlines():
        n1, n2, p1, p2 = map(int, line.rstrip().split(','))
        if not n1 in l_dic:
            l_dic[n1] = [n2]
            if not n2 in l_dic:
                l_dic[n2] = [n1]
            else:
                l_dic[n2].append(n1)
        else:
            l_dic[n1].append(n2)
            if not n2 in l_dic:
                l_dic[n2] = [n1]
            else:
                l_dic[n2].append(n1)
        p_dic[(n1,n2)] = p1
        p_dic[(n2,n1)] = p2
    
    s_n, g_n, r, p = map(int, raw_input().split(','))
    p_res = []
    load = [2]
    expenses = None
    Pirates = []
    discomfort(l_dic, s_n)
    print sorted(Pirates)[-1]

Fixed submission:
import copy

def discomfort(dic, n):
    global Pirates, expenses, c
    if expenses != None and sum(p_res) >= expenses:
        return
    if n == c:
        if n == g_n:
            c = s_n
            discomfort(l_dic, g_n)
            c = g_n
            return
        else:
            expenses = sum(p_res)
            Pirates = r-(sum(p_res)+p)
            return
    for v in dic[n]:
        c_l_dic = copy.deepcopy(dic)
        c_l_dic[n].remove(v)
        c_l_dic[v].remove(n)
        p_res.append(p_dic[(n,v)])
        load.append(v)
        discomfort(c_l_dic, v)
        del p_res[-1]
        del load[-1]

if __name__ == '__main__':
    t_c = int(raw_input())
    
    l_dic = {}
    p_dic = {}
    for i in range(input()):
        n1, n2, p1, p2 = map(int, raw_input().split(','))
        if not n1 in l_dic:
            l_dic[n1] = [n2]
            if not n2 in l_dic:
                l_dic[n2] = [n1]
            else:
                l_dic[n2].append(n1)
        else:
            l_dic[n1].append(n2)
            if not n2 in l_dic:
                l_dic[n2] = [n1]
            else:
                l_dic[n2].append(n1)
        p_dic[(n1,n2)] = p1
        p_dic[(n2,n1)] = p2
    
    s_n, g_n, r, p = map(int, raw_input().split(','))
    c = g_n
    Pirates = 0
    p_res = []
    load = [s_n]
    expenses = None
    discomfort(l_dic, s_n)
    print Pirates
Buggy python submission (verdict: Runtime Error):
import sys

s = 'abcdefghijklmnopqrstuvwxyz.?! '
d = {}
for y in range(1, 7):
    for t in range(1, 6):
        d[(str(y),str(t))] = s[0]
        s = s[1:]

for line in sys.stdin:
    line = line.rstrip()
    if len(line) % 2 != 0:
        print 'NA'
        continue
    ans = ''
    for i in range(0, len(line), 2):
        if d[(line[i],line[i+1])]:
            ans += d[(line[i],line[i+1])]
        else:
            print 'NA'
            break
    else:
        print ans

Fixed submission:
import sys

s = 'abcdefghijklmnopqrstuvwxyz.?! '
d = {}
for y in range(1, 7):
    for t in range(1, 6):
        d[(str(y),str(t))] = s[0]
        s = s[1:]

for line in sys.stdin:
    line = line.rstrip()
    if len(line) % 2 != 0:
        print 'NA'
        continue
    ans = ''
    for i in range(0, len(line), 2):
        if (line[i],line[i+1]) in d:
            ans += d[(line[i],line[i+1])]
        else:
            print 'NA'
            break
    else:
        print ans

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

s = 'abcdefghijklmnopqrstuvwxyz.?! '
d = {}
for y in range(1, 7):
    for t in range(1, 6):
        d[(str(y),str(t))] = s[0]
        s = s[1:]

for line in sys.stdin:
    line = line.rstrip()
    if len(line) == 0 or len(line) % 2 != 0:
        print 'NA'
        continue
    ans = ''
    for i in range(0, len(line), 2):
        if d[(line[i],line[i+1])]:
            ans += d[(line[i],line[i+1])]
        else:
            print 'NA'
            break
    else:
        print ans

Fixed submission:
import sys

s = 'abcdefghijklmnopqrstuvwxyz.?! '
d = {}
for y in range(1, 7):
    for t in range(1, 6):
        d[(str(y),str(t))] = s[0]
        s = s[1:]

for line in sys.stdin:
    line = line.rstrip()
    if len(line) % 2 != 0:
        print 'NA'
        continue
    ans = ''
    for i in range(0, len(line), 2):
        if (line[i],line[i+1]) in d:
            ans += d[(line[i],line[i+1])]
        else:
            print 'NA'
            break
    else:
        print ans

Buggy python submission (verdict: Runtime Error):
s = 'abcdefghijklmnopqrstuvwxyz.?! '
d = {}
for y in range(1, 7):
    for t in range(1, 6):
        d[(str(y),str(t))] = s[0]
        s = s[1:]

while True:
    try:
        line = raw_input()
        if len(line) == 0 or len(line) % 2 != 0:
            print 'NA'
            continue
        ans = ''
        for i in range(0, len(line), 2):
            if d[(line[i],line[i+1])]:
                ans += d[(line[i],line[i+1])]
            else:
                print 'NA'
                break
        else:
            print ans
    except EOFError:
        break

Fixed submission:
import sys

s = 'abcdefghijklmnopqrstuvwxyz.?! '
d = {}
for y in range(1, 7):
    for t in range(1, 6):
        d[(str(y),str(t))] = s[0]
        s = s[1:]

for line in sys.stdin:
    line = line.rstrip()
    if len(line) % 2 != 0:
        print 'NA'
        continue
    ans = ''
    for i in range(0, len(line), 2):
        if (line[i],line[i+1]) in d:
            ans += d[(line[i],line[i+1])]
        else:
            print 'NA'
            break
    else:
        print ans
Buggy python submission (verdict: Runtime Error):
import math

def f():
    x = 0; y = 1; r = 2
    for w in L_w:
        A = (tx-w[x])**2 + (ty-w[y])**2 - w[r]**2
        B = (sx-w[x])**2 + (sy-w[y])**2 - w[r]**2
        if 0 < A and 0 < B and (tx-w[w])*(sx-w[x]) < 0:
            P = abs((sy-ty)*w[x] - (sx-tx)*w[y] - (sy-ty)*tx + ty)
            Q = math.sqrt((sy-ty)**2 + (sx-tx)**2)
            print (float(P)/Q)
            if (float(P)/Q) <= w[r]:
                print 'Safe'
                break
        elif A*B < 0:
            print 'Safe'
            break
    else:
        print 'Danger'
   
while True:
    N = input()
    if N == 0: break
    L_w = [map(int, raw_input().split()) for i in range(N)]
    for i in range(input()):
        tx, ty, sx, sy = map(int, raw_input().split())
        f()

Fixed submission:
import math

def f():
    for x, y, r in W:
        A = (tx-x)**2 + (ty-y)**2 - r**2
        B = (sx-x)**2 + (sy-y)**2 - r**2
        if A * B < 0:
            print 'Safe'
            break
        elif 0 < A and 0 < B:
            if tx == sx:
                d = abs(x-tx)
            else:
                P = abs((sy-ty)*x - (sx-tx)*y - (sy-ty)*tx + (sx-tx)*ty)
                Q = math.sqrt((sy-ty)**2 + (sx-tx)**2)
                d = P / Q
            if d <= r:
                if (tx-sx)*(x-sx) + (ty-sy)*(y-sy) > 0:
                    if (sx-tx)*(x-tx) + (sy-ty)*(y-ty) > 0:
                        print 'Safe'
                        break
    else:
        print 'Danger'
   
while True:
    N = input()
    if N == 0: break
    W = [map(int, raw_input().split()) for i in range(N)]
    for i in range(input()):
        tx, ty, sx, sy = map(int, raw_input().split())
        f()
Buggy python submission (verdict: Runtime Error):
N = input()
print sum([int(raw_input()) for i in range(N)]) / N

Fixed submission:
for i in range(input()):
    h, m = map(int, raw_input().split(':'))
    s_h = h*30 + m*0.5
    l_h = m*6
    angle = abs(l_h-s_h)
    if 360-angle < angle:
        angle = 360 - angle
    if 0 <= angle < 30:
        print 'alert'
    elif 30 <= angle < 90:
        print 'warning'
    elif 90 <= angle <= 180:
        print 'safe'
Buggy python submission (verdict: Runtime Error):
import copy

def main():
    _data = copy.deepcopy(data)
    while 1 < len(_data):
        d1, v1 = _data[0]
        d2, v2 = _data[1]
        l = f1(v1, v2)
        v = l
        m1, m2 = list(f2(l, v1, v2))
        d = f1(d1*m1, d2*m2)
        for i in range(2): del _data[0]
        _data.append([d, v])
    else:
        f3(_data[0])

def f1(a, b):
    x, y = (a, b) if a >= b else (b, a)
    g = gcd(x, y)
    return lcm(x, y, g)
    
def f2(l, *s):
    for v in s:
        yield l/v
        
def f3(_data):
    d1, v1 = _data
    for d2, v2 in data:
        ans = str((float(d1)/v1)/(float(d2)/v2))
        print int(ans[:-2])
        
def gcd(x, y):
    while y != 0:
        x = x-(x/y)*y
        x, y = y, x
    else:
        return x
    
def lcm(x, y, g):
    return (x*y)/g

while True:
    n = int(raw_input())
    if n == 0: break
    data = [map(int, line.rstrip().split()) for line in open('s.txt')]
    main()

Fixed submission:
import copy

def main():
    _data = copy.deepcopy(data)
    while 1 < len(_data):
        d1, v1 = _data[0]
        d2, v2 = _data[1]
        l = f1(v1, v2)
        v = l
        m1, m2 = list(f2(l, v1, v2))
        d = f1(d1*m1, d2*m2)
        for i in range(2): del _data[0]
        _data.append([d, v])
    else:
        f3(_data[0])

def f1(a, b):
    x, y = (a, b) if a >= b else (b, a)
    g = gcd(x, y)
    return lcm(x, y, g)
    
def f2(l, *s):
    for v in s:
        yield l/v
        
def f3(_data):
    d1, v1 = _data
    for d2, v2 in data:
        ans = str((float(d1)/v1)/(float(d2)/v2))
        print int(ans[:-2])
        
def gcd(x, y):
    while y != 0:
        x = x-(x/y)*y
        x, y = y, x
    else:
        return x
    
def lcm(x, y, g):
    return (x*y)/g

while True:
    n = int(raw_input())
    if n == 0: break
    data = [map(int, raw_input().split()) for i in range(n)]
    main()
Buggy python submission (verdict: Runtime Error):
while True:
    r, a = raw_input().split()
    if r == a == 0: break
    h = 0
    _r = []
    _a = []
    for i in range(4):
        if a[i] == r[i]:
            h += 1
        else:
            _r.append(r[i])
            _a.append(a[i])
    else:
        print h, len(set(_r)&set(_a))

Fixed submission:
while True:
    r, a = raw_input().split()
    if r == a == '0': break
    h = 0
    _r = []
    _a = []
    for i in range(4):
        if a[i] == r[i]:
            h += 1
        else:
            _r.append(r[i])
            _a.append(a[i])
    else:
        print h, len(set(_r)&set(_a))
Buggy python submission (verdict: Runtime Error):
def f(v):
    for i in range(4):
        if l[i] < v[i]:
            return
    else:
        return True

while True:
    N = int(raw_input())
    if N == 0: break
    data = {}
    for n in range(N):
        i, p, q, r = map(int, raw_input().split())
        data[i] = [p, q, r]
    l = map(int, raw_input().split())
    flag = False
    for i, v in data.items():
        c = 4*v[0]+9*v[1]+4*v[2]
        v.append(c)
        if f(v):

Fixed submission:
def f(v):
    for i in range(4):
        if l[i] < v[i]:
            return
    else:
        return True

while True:
    N = int(raw_input())
    if N == 0: break
    data = [map(int, raw_input().split()) for n in range(N)]
    l = map(int, raw_input().split())
    flag = False
    for v in data:
        v.append(4*v[1]+9*v[2]+4*v[3])
        if f(v[1:]):
            print v[0]
            flag = True
    if not flag:
        print 'NA'
Buggy python submission (verdict: Time Limit Exceeded):
data = [str(i+1)*4 for i in range(9)]
while True:
    n = raw_input()
    if n == '0000': 
        break
    elif n in data:
        print 'NA'
        continue
    c = 0
    while n != '6174':
        L = int(''.join(sorted(list(n), key=int, reverse=True)))
        S = int(''.join(sorted(list(n), key=int)))
        n = str(L-S)
        c += 1
    else:
        print c

Fixed submission:
data = [str(i+1)*4 for i in range(9)]
while True:
    n = raw_input()
    if n == '0000': 
        break
    elif n in data:
        print 'NA'
        continue
    c = 0
    while n != '6174':
        L = int(''.join(sorted(n, reverse=True)))
        S = int(''.join(sorted(n)))
        n = str(L-S).zfill(4)
        c += 1
    else:
        print c
Buggy python submission (verdict: Runtime Error):
import math
while(True):
	date=input()
	date=date.split()
	date=int(date[0])+int(date[1])
	digit=int(math.log10(date))
	print(digit)

Fixed submission:
while(True):
	try:
		date=input()
		a,b=map(int,date.split(" "))
		digit=len(str(a+b))
		print(digit)
	except:
		break
Buggy python submission (verdict: Runtime Error):
num=int(input())

for i in range(num):
	a,b,c=input().split(" ")
	if(a==b==c):
		print("YES")
	else:	
		print("NO"

Fixed submission:
num=int(input())

for i in range(num):
	a=list(map(int,input().split(" ")))
	a.sort()
	if(a[0]**2+a[1]**2==a[2]**2):
		print("YES")
	else:	
		print("NO")
Buggy python submission (verdict: Runtime Error):
date=str(input()).reverse()
print(date)

Fixed submission:
print(input()[::-1])
Buggy python submission (verdict: Runtime Error):
while 1:
	list = raw_input().split()
	x = int(list[0]) + int(list[1])
	print "%d" % len(str(x))

Fixed submission:
one=0
two=0
three=0
while 1:
	try:
		i=int(raw_input())
		if one<i:
			three=two
			two=one
			one=i
		elif two<i:
			three=two
			two=i
		elif three<i:
			three=i
    	except:
	    	print"%d"%(one)
	    	print"%d"%(two)
	    	print"%d"%(three)
	    	break
Buggy python submission (verdict: Runtime Error):
while 1:
	list = raw_input().split()
	x = int(list[0]) + int(list[1])
	print "%d" % len(str(x))

Fixed submission:
while 1:
	try:
		list = str(raw_input()).split()
		x = int(list[0]) + int(list[1])
		print "%d" % len(str(x))

	except:
		break

Buggy python submission (verdict: Runtime Error):
while 1:
	list = raw_input().split()
	x = int(list[0]) + int(list[1])
	print "%d" % len(str(x))

Fixed submission:
while 1:
	try:
		list = str(raw_input()).split()
		x = int(list[0]) + int(list[1])
		print "%d" % len(str(x))

	except:
		break

Buggy python submission (verdict: Runtime Error):
while 1:
	list = str(raw_input()).split()
	x = int(list[0]) + int(list[1])
	print "%d" % len(str(x))

Fixed submission:
while 1:
	try:
		list = str(raw_input()).split()
		x = int(list[0]) + int(list[1])
		print "%d" % len(str(x))

	except:
		break

Buggy python submission (verdict: Time Limit Exceeded):
while 1:
	try:
		list = str(raw_input()).split()
		x = int(list[0]) + int(list[1])
		print "%d" % len(str(x))

	except:
		print"hoge"

Fixed submission:
while 1:
	try:
		list = str(raw_input()).split()
		x = int(list[0]) + int(list[1])
		print "%d" % len(str(x))

	except:
		break
Buggy python submission (verdict: Runtime Error):
for i in range(1, 11):
    for j in range(1, 11):
        str = str(i) + "x" + str(j) + "=" + str(j*i)
        print(str)

Fixed submission:
for i in range(1, 10):
    for j in range(1, 10):
        string = str(i) + "x" + str(j) + "=" + str(j*i)
        print(string)
Buggy python submission (verdict: Runtime Error):
def bubbleSort(list_, n):
    list_ = list_[:]
    count = 0
    for i in xrange(n):
        for j in xrange(n-1, i, -1):
            if list_[j] < list_[j - 1]:
                list_[j], list_[j - 1] = list_[j - 1], list_[j]
                count += 1

    return list_

n = input()
nums = raw_input().split()
sorted_, count = bubbleSort(nums, n)
print sorted
print count

Fixed submission:
def bubbleSort(list_, n):
    count = 0
    for i in xrange(n):
        for j in xrange(n-1, i, -1):
            if list_[j] < list_[j - 1]:
                list_[j], list_[j - 1] = list_[j - 1], list_[j]
                count += 1

    return count

n = input()
nums = map(int, raw_input().split())
count = bubbleSort(nums, n)
print ' '.join(map(str, nums))
print count

Buggy python submission (verdict: Runtime Error):
def bubbleSort(list_, n):
    list_ = list_[:]
    count = 0
    for i in xrange(n):
        for j in xrange(n-1, i, -1):
            if list_[j] < list_[j - 1]:
                list_[j], list_[j - 1] = list_[j - 1], list_[j]
                count += 1

    return list_

n = input()
nums = map(int, raw_input().split())
sorted_, count = bubbleSort(nums, n)
print sorted
print count

Fixed submission:
def bubbleSort(list_, n):
    count = 0
    for i in xrange(n):
        for j in xrange(n-1, i, -1):
            if list_[j] < list_[j - 1]:
                list_[j], list_[j - 1] = list_[j - 1], list_[j]
                count += 1

    return count

n = input()
nums = map(int, raw_input().split())
count = bubbleSort(nums, n)
print ' '.join(map(str, nums))
print count
Buggy python submission (verdict: Runtime Error):
# coding=utf-8
from math import sqrt
x1, y1, x2, y2 = map(int, raw_input().split())
print sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

Fixed submission:
# coding=utf-8
from math import sqrt
x1, y1, x2, y2 = map(float, raw_input().split())
print sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

Buggy python submission (verdict: Runtime Error):
# coding=utf-8
import math.sqrt
x1, y1, x2, y2 = map(int, raw_input().split())
print math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

Fixed submission:
# coding=utf-8
from math import sqrt
x1, y1, x2, y2 = map(float, raw_input().split())
print sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

Buggy python submission (verdict: Runtime Error):
# coding=utf-8
import math
x1, y1, x2, y2 = map(int, raw_input().split())
print math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

Fixed submission:
# coding=utf-8
from math import sqrt
x1, y1, x2, y2 = map(float, raw_input().split())
print sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

Buggy python submission (verdict: Runtime Error):
# coding=utf-8

import math
x1, y1, x2, y2 = map(int, raw_input().split())
print math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

Fixed submission:
# coding=utf-8
from math import sqrt
x1, y1, x2, y2 = map(float, raw_input().split())
print sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
Buggy python submission (verdict: Runtime Error):
import numpy as np

Fixed submission:
# coding=utf-8
from __future__ import division
from  math import sqrt


def main():
    n = input()
    while n:
        scores = map(int, raw_input().split())
        m = sum(scores) / n
        print sqrt(sum([(x - m) ** 2 for x in scores]) / n)
        n = input()


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

uSec = 1
uMinute = 60 * uSec
uHour = 60 * uMinute

input_secs = int(raw_input().rstrip())

h = input_secs / uHour
m = (input_sces - h * uHour) / uMinute
s = (input_secs - h * uHour - m * uMinute) / uSec

print ':'.join([str(x) for x in [h, m, s]])

Fixed submission:
# coding: utf-8
 
uSec = 1
uMinute = 60 * uSec
uHour = 60 * uMinute
 
input_secs = int(raw_input().rstrip())
 
h = input_secs / uHour
m = (input_secs - h * uHour) / uMinute
s = (input_secs - h * uHour - m * uMinute) / uSec
 
print ':'.join([str(x) for x in [h, m, s]])
Buggy python submission (verdict: Runtime Error):
# coding=utf-8
from math import pi
r = float(raw_input().split())
print "{0:f} {1:f}".format(pi * r * r, 2 * pi * r)

Fixed submission:
# coding=utf-8
from math import pi
r = float(raw_input().strip())
print "{0:f} {1:f}".format(pi * r * r, 2 * pi * r)
Buggy python submission (verdict: Runtime Error):
# coding=utf-8

import numpy as np

A = []
n, m = map(int, raw_input().split())
for _ in xrange(n):
    A.append(map(int, raw_input().split()))
A = np.array(A)

b = []
for _ in xrange(m):
    b.append(input())
b = np.array(b)

Ab = np.dot(A, b)
for x in Ab:
    print x

Fixed submission:
# coding=utf-8

n, m = map(int, raw_input().split())
A = [map(int, raw_input().split()) for _ in xrange(n)]
b = [input() for _ in xrange(m)]
Ab = [sum([A[i][j] * b[j] for j in xrange(m)]) for i in xrange(n)]
for x in Ab:
    print x

Buggy python submission (verdict: Runtime Error):
# coding=utf-8

import numpy as np

A = []
n, m = map(int, raw_input().split())
for _ in xrange(n):
    A.append(map(int, raw_input().split()))
A = np.array(A)
# print A

b = []
for _ in xrange(m):
    b.append(input())
b = np.array(b)
# print b

Ab = np.dot(A, b)
# print Ab
for x in Ab:
    print x

Fixed submission:
# coding=utf-8

n, m = map(int, raw_input().split())
A = [map(int, raw_input().split()) for _ in xrange(n)]
b = [input() for _ in xrange(m)]
Ab = [sum([A[i][j] * b[j] for j in xrange(m)]) for i in xrange(n)]
for x in Ab:
    print x

Buggy python submission (verdict: Runtime Error):
# coding=utf-8

import numpy as np

A = []
n, m = map(int, raw_input().split())
for _ in xrange(n):
    A.append(map(int, raw_input().split()))
# print A

b = []
for _ in xrange(m):
    b.append(input())
# print b

Ab = [sum([A[i][j] * b[j] for j in xrange(m)]) for i in xrange(n)]
# print Ab
for x in Ab:
    print x

Fixed submission:
# coding=utf-8

n, m = map(int, raw_input().split())
A = [map(int, raw_input().split()) for _ in xrange(n)]
b = [input() for _ in xrange(m)]
Ab = [sum([A[i][j] * b[j] for j in xrange(m)]) for i in xrange(n)]
for x in Ab:
    print x
Buggy python submission (verdict: Runtime Error):
True:
    line = raw_input()
    if line == '-1 -1 -1':
        break
    middle, final, re = map(int, line.split())
    if middle == -1 or final == -1:
        grade = 'F'
    elif middle + final >= 80:
        grade = 'A'
    elif 65 <= middle + final < 80:
        grade = 'B'
    elif 50 <= middle + final < 65:
        grade = 'C'
    elif 30 <= middle + final < 50:
        if 50 <= re:
            grade = 'C'
        grade = 'D'
    elif middle + final < 30:
        grade = 'F'
    print grade
    

Fixed submission:
# coding=utf-8

def main():
    while True:
        line = raw_input()
        if line == '-1 -1 -1':
            break
        middle, final, re = map(int, line.split())
        if middle == -1 or final == -1:
            grade = 'F'
        elif middle + final >= 80:
            grade = 'A'
        elif 65 <= middle + final < 80:
            grade = 'B'
        elif 50 <= middle + final < 65:
            grade = 'C'
        elif 30 <= middle + final < 50:
            if 50 <= re:
                grade = 'C'
            else:
                grade = 'D'
        elif middle + final < 30:
            grade = 'F'
        print grade

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

line = raw_input()
for s in line:
    if s.isalpha():
        if s.isupper():
            print s.lower(),
        else:
            print s.upper(),
    else:
       print s,
else print

Fixed submission:
# coding: utf-8

line = raw_input()
print ''.join([((s.lower() if s.isupper() else s.upper()) if s.isalpha() else s) for s in line])

Buggy python submission (verdict: Runtime Error):
# coding: utf-8

line = raw_input()
result = ''
for s in line:
    if s.isalpha():
        if s.isupper():
            result += s.lower(),
        else:
            result += s.upper(),
    else:
       print result += s

print result

Fixed submission:
# coding: utf-8

line = raw_input()
print ''.join([((s.lower() if s.isupper() else s.upper()) if s.isalpha() else s) for s in line])

Buggy python submission (verdict: Runtime Error):
# coding: utf-8

line = raw_input()
result = ''
for s in line:
    if s.isalpha():
        if s.isupper():
            result += s.lower()
        else:
            result += s.upper()
    else:
       print result += s

print result

Fixed submission:
# coding: utf-8

line = raw_input()
print ''.join([((s.lower() if s.isupper() else s.upper()) if s.isalpha() else s) for s in line])
Buggy python submission (verdict: Runtime Error):
import sys

l = [True] * 100000
for i in range(2, 100000):
    if (l[i - 1]):
        for j in range(i ** 2 - 1, 100000, i):
            l[j] = False
n = [int(line) for line in sys.stdin]
for nn in n:
    print(l[1:int(n)].count(True))

Fixed submission:
import sys

l = [True] * 1000000
for i in range(2, 1000000):
    if (l[i - 1]):
        for j in range(i ** 2 - 1, 1000000, i):
            l[j] = False

for s in sys.stdin:
    print(l[1:int(s)].count(True))