Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 03 13:03:51 2015

@author: hirose
"""

while(1):
    n = map(int, raw_input().split())
    a = n[0]
    b = n[1]
    count = 1
    n = 10
    while(1):
        if((a+b)/n > 0):
            count += 1
            n = n*10
        else:
            break
        print count

Fixed submission:
while True:
    try:
        a, b = map(int, raw_input().split())
        print len(str(a+b))
    except EOFError:
        break

Buggy python submission (verdict: Runtime Error):
while(1):
    n = map(int, raw_input().split())
    if(len(n) == 0):
        break
    a = n[0]
    b = n[1]
    count = 1
    n = 10
    while(1):
        if((a+b)/n > 0):
            count += 1
            n = n*10
        else:
            break
    print count

Fixed submission:
while True:
    try:
        a, b = map(int, raw_input().split())
        print len(str(a+b))
    except EOFError:
        break
Buggy python submission (verdict: Runtime Error):
from math import *

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

Fixed submission:
from math import *

x1, y1, x2, y2 = map(float, raw_input().split())
distance = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))
print distance
Buggy python submission (verdict: Runtime Error):
n = input() #カードの枚数
taro = 0
hanako = 0
for i in range(n):
    x = map(str, raw_input().split())  #x[0]:太郎，x[1]:花子
    #print x[0]
    #print x[1]
    if(x[0] > x[1]):
        taro += 3
    elif(x[0] == x[1]):
        taro += 1
        hanako += 1
    else:
        hanako += 3
print '%d %d' %(taro, hanako)

Fixed submission:
n = input()
taro = 0
hanako = 0
for i in range(n):
    x = map(str, raw_input().split())
    #print x[0]
    #print x[1]
    if(x[0] > x[1]):
        taro += 3
    elif(x[0] == x[1]):
        taro += 1
        hanako += 1
    else:
        hanako += 3
print '%d %d' %(taro, hanako)

exit(0)

Buggy python submission (verdict: Runtime Error):
n = input() #カードの枚数
taro = 0
hanako = 0
for i in range(n):
    x = map(str, raw_input().split())  #x[0]:太郎，x[1]:花子
    #print x[0]
    #print x[1]
    if(x[0] > x[1]):
        taro += 3
    elif(x[0] == x[1]):
        taro += 1
        hanako += 1
    else:
        hanako += 3
print '%d %d' %(taro, hanako)
exit(0)

Fixed submission:
n = input()
taro = 0
hanako = 0
for i in range(n):
    x = map(str, raw_input().split())
    #print x[0]
    #print x[1]
    if(x[0] > x[1]):
        taro += 3
    elif(x[0] == x[1]):
        taro += 1
        hanako += 1
    else:
        hanako += 3
print '%d %d' %(taro, hanako)

exit(0)
Buggy python submission (verdict: Runtime Error):


def solve(s):

    dic = {}
    ll = 'qwertasdfgzxcvb'
    rr = 'yuiophjklnm'

    for l_i in list(ll):
        dic[l_i] = -1

    for r_i in list(rr):
        dic[r_i] = 1

    ans = 0
    prev = 0

    for s_i in s:
        current = dic[s_i]
        if current != prev:
            if abs(current - prev) == 2:
                ans += 1

        prev = current

    return ans


while 1:
    s = input()
    if s == '#':
        break

    print(solve(s))

Fixed submission:


def solve(s):

    dic = {}
    ll = 'qwertasdfgzxcvb'
    rr = 'yuiophjklnm'

    for l_i in list(ll):
        dic[l_i] = -1

    for r_i in list(rr):
        dic[r_i] = 1

    ans = 0
    prev = 0

    for s_i in s:
        current = dic[s_i]
        if current != prev:
            if abs(current - prev) == 2:
                ans += 1

        prev = current

    return ans


while 1:
    s = raw_input()
    if s == '#':
        break

    print(solve(s))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
R = [int(input()) for i in list(range(N))]
maxv = -1000000000

for j in list(range(1, N)):
    for i in list(range(0, j)):
        maxv = max(maxv, R[j] - R[i])

print(maxv)

Fixed submission:
N = int(input())
R = [int(input()) for i in list(range(N))]
maxv = -1000000000
minr = R[0]

for i in list(range(1, N)):
    maxv = max(maxv, R[i] - minr)
    minr = min(minr, R[i])

print(maxv)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,raw_input().split(' '))
x = max(a,b)
n = min(a,b)
f = False
for i in range(n,0,-1):
	if x%i == 0 and n %i==0:
		print i
		break

Fixed submission:
a,b = map(int,raw_input().split(' '))
while(True):
	if(a == b):
		print a
		break
	if(a < b):
		t = a
		a = b
		b = t
	a,b = b,a%b
	if(b == 0):
		print a
		break
Buggy python submission (verdict: Time Limit Exceeded):
N = input()
c = 0
p = [0 for i in range(N)]
for i in range(0,N):
	p[i] = input()
for i in range(N):
	j = p[i]-1
	while(j > 1):
		if(p[i]%j == 0):break
		j -= 1
	if(j == 1):
		c += 1
print c

Fixed submission:
import math
N = input()
c = 0
p = [0 for i in range(N)]
for i in range(0,N):
	p[i] = input()
for i in range(N):
	s = math.sqrt(p[i])
	j = 2
	while(j <= s):
		if(p[i]%j == 0):
			break
		j += 1
	if(j > s):
		c += 1
print c
Buggy python submission (verdict: Runtime Error):
import math
x1,y1,x2,y2 = map(int,raw_input().split(' '))
x = abs(x1 - x2);
y = abs(y1 - y2);
a = y/math.sin(math.radians(45))
print a

Fixed submission:
import math
x1,y1,x2,y2 = map(float,raw_input().split(' '))
x = abs(x1-x2);
y = abs(y1-y2);
a = math.sqrt(x**2 + y**2) 
print a
Buggy python submission (verdict: Runtime Error):
a = 'abcdefghijklmnopqrstuvwxyz'
b = [0 for i in range(len(a))]
while True:
	S = raw_input().lower()
	if len(S) == 0:
		break
	for j in range(26):
		b[j] += S.count(a[j])
for i in range(len(a)):
	print str(a[i])+" : "+str(b[i])

Fixed submission:
a = 'abcdefghijklmnopqrstuvwxyz'
b = [0 for i in range(len(a))]
while True:
	try:
		S = raw_input().lower()
	except:
		break
	for j in range(26):
		b[j] += S.count(a[j])
for i in range(len(a)):
	print str(a[i])+" : "+str(b[i])

Buggy python submission (verdict: Runtime Error):
a = 'abcdefghijklmnopqrstuvwxyz'
b = [0 for i in range(len(a))]
while True:
	S = raw_input().lower()
	if S == "":
		break
	for j in range(26):
		b[j] += S.count(a[j])
for i in range(len(a)):
	print str(a[i])+" : "+str(b[i])

Fixed submission:
a = 'abcdefghijklmnopqrstuvwxyz'
b = [0 for i in range(len(a))]
while True:
	try:
		S = raw_input().lower()
	except:
		break
	for j in range(26):
		b[j] += S.count(a[j])
for i in range(len(a)):
	print str(a[i])+" : "+str(b[i])
Buggy python submission (verdict: Runtime Error):
?import sys

while True:
    h, w = map(int, sys.stdin.readline().split(' '))
    if h == 0 and w == 0:
        break

    for i in range(h):
        for j in range(w):
            sys.stdout.write('#' if (i+j) % 2 == 0 else '.')
        print ''
    print ''
??

Fixed submission:
import sys

while True:
    h, w = map(int, sys.stdin.readline().split(' '))
    if h == 0 and w == 0:
        break

    for i in range(h):
        for j in range(w):
            sys.stdout.write('#' if (i+j) % 2 == 0 else '.')
        print ''
    print ''
Buggy python submission (verdict: Runtime Error):
x = input()
y = input()

if x < y:
	tmp = x
	x = y
	y = tmp

x_y_divisor = list()
y_divisor = list()
x_mod_y = x % y


for i in range(1,(x_mod_y)+1):
	if x_mod_y % i == 0:
		x_y_divisor.append(i)


for i in range(1,y+1):
	if y % i == 0:
		y_divisor.append(i)


x_y_divisor_set = set(x_y_divisor)
y_divisor_set = set(y_divisor)

ans_divisor = y_divisor_set.intersection(x_y_divisor_set)
print(max(ans_divisor))



Fixed submission:
import sys

input_list = map(int, raw_input().split())

x = input_list[0]
y = input_list[1]

if x < y:
	tmp = x
	x = y
	y = tmp
elif x == y:
	print(x)
	sys.exit(0)


r = 0
while y != 0:
	r = x % y
	x = y
	y = r

print(x)

Buggy python submission (verdict: Runtime Error):
input_list = map(int, raw_input().split())

x = input_list[0]
y = input_list[1]

if x < y:
	tmp = x
	x = y
	y = tmp

x_y_divisor = list()
y_divisor = list()
x_mod_y = x % y


for i in range(1,(x_mod_y)+1):
	if x_mod_y % i == 0:
		x_y_divisor.append(i)


for i in range(1,y+1):
	if y % i == 0:
		y_divisor.append(i)


x_y_divisor_set = set(x_y_divisor)
y_divisor_set = set(y_divisor)

ans_divisor = y_divisor_set.intersection(x_y_divisor_set)
print(max(ans_divisor))



Fixed submission:
import sys

input_list = map(int, raw_input().split())

x = input_list[0]
y = input_list[1]

if x < y:
	tmp = x
	x = y
	y = tmp
elif x == y:
	print(x)
	sys.exit(0)


r = 0
while y != 0:
	r = x % y
	x = y
	y = r

print(x)
Buggy python submission (verdict: Runtime Error):
a = raw_input()
a = a * a * a
print(a)

Fixed submission:
a = int(input())
print(pow(a,3))

Buggy python submission (verdict: Runtime Error):
a = input()
a = a * a * a
print(a)

Fixed submission:
a = int(input())
print(pow(a,3))

Buggy python submission (verdict: Runtime Error):
N = input()
print(N*N*N)

Fixed submission:
a = int(input())
print(pow(a,3))
Buggy python submission (verdict: Runtime Error):
a = map(int,raw_input().split())
print(a[0]*a[1])
print(" ")
print(a[0]*2 + a[1]*2)

Fixed submission:
data = input().split()
a = int(data[0])
b = int(data[1])
print(str(a*b) + " " + str(a*2+b*2))
Buggy python submission (verdict: Runtime Error):
data = input().split()
a=int(data[0])
b=int(data[1])
if a == b:
	print("a == b")
elif a > b:
	print("a > b")
else
	print("a < b")
	

Fixed submission:
data = input().split()
a=int(data[0])
b=int(data[1])
if a == b:
	print("a == b")
elif a > b:
	print("a > b")
else:
	print("a < b")
Buggy python submission (verdict: Runtime Error):
a = input()
b = 1
while(a = NULL):
	print("Case " + str(i) + ": " + str(a))

Fixed submission:
a = int(input())
b = 1
while(a != 0):
	print("Case " + str(b) + ": " + str(a))
	b = b + 1
	a = int(input())

Buggy python submission (verdict: Runtime Error):
a = input()
b = 1
while(a != -1):
	print("Case " + str(b) + ": " + str(a))
	b = b + 1
	a = input()

Fixed submission:
a = int(input())
b = 1
while(a != 0):
	print("Case " + str(b) + ": " + str(a))
	b = b + 1
	a = int(input())

Buggy python submission (verdict: Runtime Error):
data = input().split()
a = int(data[0])
b = int(data[1])
c = int(data[2])
divisor = list()
for i in range(a,b+1):
	if c % i == 0:
		divisor.append(i)

print(len(divisor))

Fixed submission:
a = int(input())
b = 1
while(a != 0):
	print("Case " + str(b) + ": " + str(a))
	b = b + 1
	a = int(input())

Buggy python submission (verdict: Runtime Error):
data = input().split()
a = int(data[0])
b = int(data[1])
c = int(data[2])
divisor = list()
for i in range(a,b+1):
	if c % i == 0:
		divisor.append(i)

print(len(divisor))

Fixed submission:
a = int(input())
b = 1
while(a != 0):
	print("Case " + str(b) + ": " + str(a))
	b = b + 1
	a = int(input())
Buggy python submission (verdict: Runtime Error):
data = input().split()
a = int(data[0])
b = int(data[1])
while(a != 0 and b != 0):
	print(str(b) + " " + str(a))
	data = input().split()
	a = int(data[0])
	b = int(data[1])

Fixed submission:
data = input().split()
a = int(data[0])
b = int(data[1])
while(a != 0 or b != 0):
	if a > b:
		temp = a
		a = b
		b = temp
	print(str(a) + " " + str(b))
	data = input().split()
	a = int(data[0])
	b = int(data[1])

Buggy python submission (verdict: Runtime Error):
data = input().split()
a = int(data[0])
b = int(data[1])
while(a != 0 and b != 0):
	if a > b:
		temp = a
		a = b
		b = temp
	print(str(b) + " " + str(a))
	data = input().split()
	a = int(data[0])
	b = int(data[1])
	

Fixed submission:
data = input().split()
a = int(data[0])
b = int(data[1])
while(a != 0 or b != 0):
	if a > b:
		temp = a
		a = b
		b = temp
	print(str(a) + " " + str(b))
	data = input().split()
	a = int(data[0])
	b = int(data[1])

Buggy python submission (verdict: Runtime Error):
data = input().split()
a = int(data[0])
b = int(data[1])
while(a != 0 or b != 0):
	if a > b:
		temp = a
		a = b
		b = temp
	print(str(a) + " " + str(b))
	data = input().split()
	a = int(data[0])
	b = int(data[1])
	

Fixed submission:
data = input().split()
a = int(data[0])
b = int(data[1])
while(a != 0 or b != 0):
	if a > b:
		temp = a
		a = b
		b = temp
	print(str(a) + " " + str(b))
	data = input().split()
	a = int(data[0])
	b = int(data[1])
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(a*b,2*a+2*b);

Fixed submission:
a,b=map(int,input().split())
print(a*b,2*a+2*b);
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/python

if __name__ == "__main__":
	S = raw_input()
	c = ['A','B','C']
	
	while True:
		if S == "ABC":
			print "Yes"
			break
		
		T = S.strip().split("ABC")
		P = ''.join(T)
		
		cnt = 0
		for x in c:
			if x in P:
				cnt += 1
			else:
				S = x.join(T)
		
		if cnt != 2:
			print "No"
			break

Fixed submission:
#!/usr/bin/python

if __name__ == "__main__":
	S = raw_input()
	c = ['A','B','C']
	
	while True:
		if len(S) <= 3:
			print "Yes" if S == "ABC" else "No"
			break
		
		T = S.strip().split("ABC")			
		P = ''.join(T)
		
		cnt = 0
		for x in c:
			if x in P:
				cnt += 1
			else:
				S = x.join(T)
		
		if len(T) == 1 or cnt != 2:
			print "No"
			break

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/python

if __name__ == "__main__":
	S = raw_input()
	c = ['A','B','C']
	
	while True:
		if len(S) <= 3:
			print "Yes" if S == "ABC" else "No"
			break
		
		T = S.strip().split("ABC")			
		P = ''.join(T)
		
		cnt = 0
		for x in c:
			if x in P:
				cnt += 1
			else:
				S = x.join(T)
		
		if len(t) == 1 or cnt != 2:
			print "No"
			break

Fixed submission:
#!/usr/bin/python

if __name__ == "__main__":
	S = raw_input()
	c = ['A','B','C']
	
	while True:
		if len(S) <= 3:
			print "Yes" if S == "ABC" else "No"
			break
		
		T = S.strip().split("ABC")			
		P = ''.join(T)
		
		cnt = 0
		for x in c:
			if x in P:
				cnt += 1
			else:
				S = x.join(T)
		
		if len(T) == 1 or cnt != 2:
			print "No"
			break
Buggy python submission (verdict: Runtime Error):
while True:
    a,b = map(int, raw_input().split())
    print len(str(a+b))

Fixed submission:
import sys
for v in sys.stdin:
    a,b = map(int, v.split())
    print len(str(a+b))
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    r = a % b
    while r > 0:
        a = b
        b = r
        r = a % b
    return b

def lcm(a,b):
    return a*b / gcd(a,b)

while True:
    try:
        a,b = map(int, raw_input().split())
        print gcd(a,b) + " " + lcm(a,b)
    except EOFError:
        break

Fixed submission:
def gcd(a,b):
    r = a % b
    while r > 0:
        a = b
        b = r
        r = a % b
    return b

def lcm(a,b):
    return a*b / gcd(a,b)

while True:
    try:
        a,b = map(int, raw_input().split())
        print str(gcd(a,b)) + " " + str(lcm(a,b))
    except EOFError:
        break
Buggy python submission (verdict: Runtime Error):
import itertools

l = [1,2,3,4,5,6,7,8,9]

while True:
    try:
        N = int(raw_input())
        res = 0
        for element in itertools.combinations_with_replacement(l,5):
          if sum(element) == N:
          res += 1
        print res
    except EOFError:
        break

Fixed submission:
import itertools

l = [0,1,2,3,4,5,6,7,8,9]

while True:
    try:
        N = int(raw_input())
        res = 0
        for element in itertools.product(l,repeat=4):
            if sum(element) == N:
                res += 1
        print res
    except EOFError:
        break
Buggy python submission (verdict: Time Limit Exceeded):
W=input()
A=map(int,raw_input().split())
ans=0
for i in xrange(W):
    if A[i]<=0: continue
    lout = A[i]
    if 0 in A[:i]:
        for j in xrange(i-1,-1,-1):
            if A[j]==0:
                break
            elif A[j]<0:
                lout=max(0,min(lout,j-i-A[j]))
                if lout==0: break
    else:
        lout = 0
    rout = A[i]
    if 0 in A[i+1:]:
        for j in xrange(i+1,W+1):
            if A[j]==0:
                break
            elif A[j]<0:
                rout=max(0,min(rout,i-j-A[j]))
                if rout==0: break
    else:
        rout = 0
    ans+=max(lout,rout)
print ans

Fixed submission:
W=input()
A=map(int,raw_input().split())
L=[0]*W
R=[0]*W
now0=-1
for i in xrange(W):
    if A[i]==0:
        now0=i
        nowx=10**6
    if now0==-1: continue
    nowx-=1
    if A[i]<0: nowx=min(nowx,-A[i])
    if A[i]>0: L[i]=min(A[i],nowx)
now0=-1
for j in xrange(W):
    i = W-j-1
    if A[i]==0:
        now0=i
        nowx=10**6
    if now0==-1: continue
    nowx-=1
    if A[i]<0: nowx=min(nowx,-A[i])
    if A[i]>0: R[i]=min(A[i],nowx)
ans=0
for i in xrange(W):
    if max(L[i],R[i])>0: ans+=max(L[i],R[i])
print ans
Buggy python submission (verdict: Runtime Error):
(a,b)=map(int, raw_input().split())
if a<b
    print "a < b"
else if a>b
    print "a > b"
else
    print "a == b"

Fixed submission:
(a,b)=map(int, raw_input().split())
if a<b:
    print "a < b"
if a>b:
    print "a > b"
if a==b:
    print "a == b"

Buggy python submission (verdict: Runtime Error):
(a,b)=map(int, raw_input().split())
if a<b:
    print "a < b"
else if a>b:
    print "a > b"
else:
    print "a == b"

Fixed submission:
(a,b)=map(int, raw_input().split())
if a<b:
    print "a < b"
if a>b:
    print "a > b"
if a==b:
    print "a == b"
Buggy python submission (verdict: Runtime Error):
while 1:
    str = raw_input()
    if str=="0": break;
    resul = 0
    for ch in str:
        resul += int ch
    print resul

Fixed submission:
while 1:
    str = raw_input()
    if str=="0": break;
    resul = 0
    for ch in str:
        resul += int(ch)
    print resul
Buggy python submission (verdict: Runtime Error):
list = map(int, raw_input().split())
x0 = list[2] - list[4]
y0 = list[3] - list[4]
x1 = list[2] + list[4]
y1 = list[3] + list[4]

if x0 >= 0 and y0 >= 0 and x1 =< list[0] and y1 =< list[1]:
    print "Yes"
else :
    print "No"
    

Fixed submission:
list = map(int, raw_input().split())
x0 = list[2] - list[4]
y0 = list[3] - list[4]
x1 = list[2] + list[4]
y1 = list[3] + list[4]

if x0 >= 0 and y0 >= 0 and x1 <= list[0] and y1 <= list[1]:
    print "Yes"
else :
    print "No"
Buggy python submission (verdict: Runtime Error):
list = map(int, raw_input().split())
print list[0] / list[1], list[0] % list[1], "&.5f" %(1.0*list[0] / list[1])

Fixed submission:
list = map(int, raw_input().split())
print list[0] / list[1], list[0] % list[1], "%.5f" %(1.0*list[0] / list[1])
Buggy python submission (verdict: Runtime Error):
while 1:
    dd = raw_input()
    d = int(dd)
    i = 1
    ans = 0
    while i * d < 600:
        ans += (i * d) * (i * d) * d
        i += 1
    print ans

Fixed submission:
while 1:
    try:
        dd = raw_input()
        d = int(dd)
        i = 1
        ans = 0
        while i * d < 600:
            ans += (i * d) * (i * d) * d
            i += 1
        print ans
    except:
        break
Buggy python submission (verdict: Runtime Error):
import sys
for jk in sys.stdin:
    j,k=map(int,jk.split())
    print len(j+k)

Fixed submission:
import sys
for jk in sys.stdin:
    j,k=map(int,jk.split())
    print len(str(j+k))
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    while a%b:
        a,b=b,a%b
    return b

def lcm(a,b):
    return a*b/gcd(a,b)

while 1:
    a,b=map(int, raw_input().split())
print gcd(a,b),lcm(a,b)

Fixed submission:
import sys

def gcd(a,b):
    while a%b:
        a,b=b,a%b
    return b

def lcm(a,b):
    return a*b/gcd(a,b)

for ab in sys.stdin:
    a,b=map(int, ab.split())
    a,b=max(a,b),min(a,b)
    print gcd(a,b),lcm(a,b)

Buggy python submission (verdict: Runtime Error):

def gcd(a,b):
    while a%b:
        a,b=b,a%b
    return b

def lcm(a,b):
    return a*b/gcd(a,b)

while 1:
    a,b=map(int, raw_input().split())
    a,b=max(a,b),min(a,b)
    print gcd(a,b),lcm(a,b)

Fixed submission:
import sys

def gcd(a,b):
    while a%b:
        a,b=b,a%b
    return b

def lcm(a,b):
    return a*b/gcd(a,b)

for ab in sys.stdin:
    a,b=map(int, ab.split())
    a,b=max(a,b),min(a,b)
    print gcd(a,b),lcm(a,b)
Buggy python submission (verdict: Runtime Error):
while 1:
    try:
        n=int(raw_input())
    except EOFError:
        break
    print len(=[1 for i in range(10) for j in range(10) for k in range(10) for l in range(10) if i+j+k+l==n]

Fixed submission:
import itertools
import sys
s=range(0,10)
chk=list(itertools.product(s,repeat=4))
for j in sys.stdin:
    ans=0
    for k in chk:
        if sum(k)==int(j):
            ans+=1
    print ans

Buggy python submission (verdict: Runtime Error):
import itertools
s,ans=range(0,10),0
chk=list(itertools.combinations_with_replacement(s,4))
for j in sys.stdin:
    for k in chk:
        if sum(k)==int(j):
            ans+=1
    print ans

Fixed submission:
import itertools
import sys
s=range(0,10)
chk=list(itertools.product(s,repeat=4))
for j in sys.stdin:
    ans=0
    for k in chk:
        if sum(k)==int(j):
            ans+=1
    print ans

Buggy python submission (verdict: Runtime Error):
import itertools
s=range(0,10)
chk=list(itertools.product(s,repeat=4))
for j in sys.stdin:
    ans=0
    for k in chk:
        if sum(k)==int(j):
            ans+=1
    print ans

Fixed submission:
import itertools
import sys
s=range(0,10)
chk=list(itertools.product(s,repeat=4))
for j in sys.stdin:
    ans=0
    for k in chk:
        if sum(k)==int(j):
            ans+=1
    print ans
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
for n in sys.stdin:
    prime=[]
    n=int(n)
    for i in range(2,n+1):
        if all(i%p!=0 for p in prime):
            prime+=[i]
    print len(prime)

Fixed submission:
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#from __future__ import print_function
import time
import sys
import io
import re
import math
start = time.clock()

def prime(n):
    l=[True for _ in range(n+1)]
    i=2
    while i**2<=n:
        if l[i]:
            j=i+i
            while j<=n:
                l[j]=False
                j+=i
        i+=1
    return l
#    lis=[i for i in range(n+1) if l[i] and i>=2]

for n in sys.stdin:
    print (prime(int(n))).count(True)-2
Buggy python submission (verdict: Runtime Error):
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main(){
    double x1,y1,x2,y2,x3,y3,xp,yp;
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
        if (((x2-x1)*(y2-y3))-((y1-y3)*(x2-x3))>0 && ((x3-x2)*(y3-yp))-((y1-yp)*(x3-xp))>0) {
        //if(((x2-x1)*(y2-yp)-(y2-y1)*(x2-xp)>0)&&((x3-x2)*(y3-yp)-(y3-y2)*(x3-xp)>0)&&((x1-x3)*(y1-yp)-(y1-y3)*(x1-xp)>0)){
            printf("YES\n");
        //}else if(((x2-x1)*(y2-yp)-(y2-y1)*(x2-xp)<0)&&((x3-x2)*(y3-yp)-(y3-y2)*(x3-xp)<0)&&((x1-x3)*(y1-yp)-(y1-y3)*(x1-xp)<0)){
        //    printf("YES\n");
        }else{
            printf("NO\n");
        }

    }
    return 0;
}

Fixed submission:
while 1:
    try:
        x1,y1,x2,y2,x3,y3,xp,yp=map(float,raw_input().split())
        print 'YES' if ((x2-x1)*(y2-yp)-(y2-y1)*(x2-xp)>0)==((x3-x2)*(y3-yp)-(y3-y2)*(x3-xp)>0)==((x1-x3)*(y1-yp)-(y1-y3)*(x1-xp)>0) else 'NO'
    except:
        break
Buggy python submission (verdict: Runtime Error):
ans=1
for i in range(1,int(raw_input()+1):
    ans*=i
print ans

Fixed submission:
ans=1
for i in range(1,int(raw_input())+1):
    ans*=i
print ans
Buggy python submission (verdict: Runtime Error):
n=int(raw_input())

def parallel(x1,y1,x2,y2,x3,y3,x4,y4):
    print 'YES' if (y1-y2)/(x1-x2) == (y3-y4)/(x3-x4) else 'NO'

while n:
    n-=1
    l=map(float,raw_input().split())
    parallel(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7])

Fixed submission:
n=int(raw_input())

while n:
    n-=1
    x1,y1,x2,y2,x3,y3,x4,y4=map(float,raw_input().split())
    print 'YES' if abs((y3-y4)*(x1-x2)-(y1-y2)*(x3-x4))< 1e-10 else 'NO'