Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p04005 (python)

Fixed submission:
from sys import stdin
from sys import stdout

A,B,C = stdin.readline().split()

if int(A)%2 == 0 or int(B)%2 == 0 or int(C)%2 == 0 :
        print 0
        exit()

AB = int(A) * int(B)
BC = int(C) * int(B)
AC = int(A) * int(C)
ABC = AB * int(C)

area = sorted([AB,BC,AC])[0]                                                                                                                                         
print area

Buggy submission (verdict: Runtime Error):
from sys import stdin                                                                                                                                                
from sys import stdout

A,B,C = stdin.readline().split()

if A%2 == 0 or B%2 == 0 or C%2 == 0 : 
        print 0
        exit()

AB = int(A) * int(B)
BC = int(C) * int(B)
AC = int(A) * int(C)
ABC = AB * int(C)

area = (AB,BC,AC).sort().reverse()[0]
print area
Problem p03631 (python)

Fixed submission:
N = input()
if N[0] == N[2]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
T = []
for _ in range(N):
    T.append(int(input()))

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

result = lcm(T[0],T[1])

for x in range(2,N):
    result = lcm(result, T[x])

print(result)
Problem p03834 (python)

Fixed submission:
a, b, c = input().split(sep = ",")
 
print(a, b, c)

Buggy submission (verdict: Runtime Error):
a, b, c = input().split(sep = ", ")
if(len(a) == 7):
    print(b.lower() + " " + a.lower() + " " + c.lower())
elif(len(b) == 7):
    print(a.lower() + " " + b.lower()  + " " + c.lower())
elif(len(c) == 7):
    print(a.lower() + " " + c.lower() + " " + b.lower*(()

Buggy submission (verdict: Runtime Error):
a, b, c = input().split(sep = ", ")

print(a + " " + b + " " + c)
Problem p03617 (python)

Fixed submission:
a,b,c,d=[int(i) for i in input().split()]
M=[4*a,2*b,c,d/2]
N=int(input())

if M[0]==min(M):
    print(N*M[0])
elif M[1]==min(M):
    print(N*M[1])
elif M[2]==min(M):
    print(N*M[2])
else:
    if N%2==0:
        print(int(N//2*int(M[3]*2)))
    else:
        if M[0]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[0])
        elif M[1]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[1])
        elif M[2]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[2])

Buggy submission (verdict: Runtime Error):
a,b,c,d=[int(i) for i in input().split()]
M=[4*a,2*b,c,d/2]
N=int(input())

if M[0]==min(M):
    print(N*M[0])
elif M[1]==min(M):
    print(N*M[1])
elif M[2]==min(M):
    print(N*M[2])
else:
    if N%2==0:
        print(int(N//2*int(M[3]*2))
    else:
        if M[0]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[0])
        elif M[1]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[1])
        elif M[2]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[2])
Problem p03631 (python)

Fixed submission:
S=list(map(int, input()))

if S[0]==S[2]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys;sys.setrecursionlimit(int(1e7))
from sys import stdin
from collections import deque
 
input = stdin.readline
N = int(input())
tree = [[] for _ in range(N+1)]
for _ in range(N-1):
    a, b, c = map(int,input().split())
    tree[a].append((b,c))
    tree[b].append((a,c))
 
Qn,K = map(int,input().split())
XY = [tuple(map(int,input().split())) for _ in range(Qn)]
 
depth = [None]*(N+1)
def DFS(v,p,d):
    depth[v] = d
    for e in tree[v]:
        if e[0] != p:
            DFS(e[0], v, d + e[1])
DFS(K,0,0)
 
for i in range(Qn):
    print(depth[XY[i][0]] + depth[XY[i][1]])

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    #a=min(a,b)
    #b=max(a,b)
    while b:
        a,b= b, a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)
T=[]
N=int(input())
for i in range(N):
    T.append(int(input()))

ans=1
for t in T:
    ans=lcm(ans, t)

print(ans)
Problem p03803 (python)

Fixed submission:
a, b = map(int, input().split())
if a == 1:
    a = 14
if b == 1:
    b = 14

if a > b:
    print("Alice")
elif a < b:
    print("Bob")
else:
    print("Draw")

Buggy submission (verdict: Runtime Error):
a, b = int(input())
if a == 1:
    a = 14
elif b == 1:
    b = 14

if a > b:
    print("Alice")
elif a < b:
    print("Bob")
else:
    print("Draw")
Problem p03631 (python)

Fixed submission:
print "Yes" if (lambda x: x == x[::-1])(raw_input()) else "No"

Buggy submission (verdict: Runtime Error):
import sys
#sys.stdin = open('Transit_Tree_Path.txt', 'r')

def dfs(g, start):
    dist = [-1 for i in xrange(len(g))]
    dist[start] = 0

    q = [start]
    while len(q) > 0:
        u = q.pop()
        for v, l in g[u].iteritems():
            if dist[v] == -1 or dist[u] + l < dist[v]:
                dist[v] = dist[u] + l
                if not v in q:
                    q.append(v)
                    
    return dist

n = int(raw_input())
g = [{} for i in xrange(n+1)]

for i in xrange(n-1):
    u, v, l = map(int, raw_input().split())
    g[u][v] = l
    g[v][u] = l


q, k = map(int, raw_input().split())
dist = dfs(g, k)
for i in xrange(q):
    x, y = map(int, raw_input().split())
    print dist[x] + dist[y]

Buggy submission (verdict: Runtime Error):
import sys
#sys.stdin = open('Transit_Tree_Path.txt', 'r')

def spfa(g, start):
    dist = [1e15 for i in xrange(len(g))]
    dist[start] = 0

    q = [start]
    while len(q) > 0:
        u = q.pop(0)
        for v, l in g[u].iteritems():
            if dist[u] + l < dist[v]:
                dist[v] = dist[u] + l
                if not v in q:
                    q.append(v)
                    
    return dist

n = int(raw_input())
g = [{} for i in xrange(n+1)]

for i in xrange(n-1):
    u, v, l = map(int, raw_input().split())
    g[u][v] = l
    g[v][u] = l


q, k = map(int, raw_input().split())
dist = spfa(g, k)
for i in xrange(q):
    x, y = map(int, raw_input().split())
    print dist[x] + dist[y]
Problem p03634 (python)

Fixed submission:
import sys
import collections

sys.setrecursionlimit(int(1e7))

def dfs(node, parent, distance):
    depth[node] = distance
    for next_node, cost in Tree[node]:
        if next_node != parent:
            dfs(next_node, node, distance + cost)

N = int(input())

Tree = collections.defaultdict(list)

for i in range(N - 1):
    a, b, c = map(int, input().split())
    Tree[a].append((b, c))
    Tree[b].append((a, c))

q, k = map(int, input().split())

depth = {}
dfs(k, -1, 0)

for i in range(q):
    x, y = map(int, input().split())
    print(depth[x] + depth[y])

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

sys.setrecursionlimit(1e7)

def dfs(node, parent, distance):
    depth[node] = distance
    for next_node, cost in Tree[node]:
        if next_node != parent:
            dfs(next_node, node, distance + cost)

N = int(input())

Tree = collections.defaultdict(list)

for i in range(N - 1):
    a, b, c = map(int, input().split())
    Tree[a].append((b, c))
    Tree[b].append((a, c))

q, k = map(int, input().split())

depth = {}
dfs(k, -1, 0)

for i in range(q):
    x, y = map(int, input().split())
    print(depth[x] + depth[y])

Buggy submission (verdict: Runtime Error):
import collections

def dfs(node, parent, distance):
    depth[node] = distance
    for next_node, cost in Tree[node]:
        if next_node != parent:
            dfs(next_node, node, distance + cost)

N = int(input())

Tree = collections.defaultdict(list)

for i in range(N - 1):
    a, b, c = map(int, input().split())
    Tree[a].append((b, c))
    Tree[b].append((a, c))

q, k = map(int, input().split())

depth = {}
dfs(k, -1, 0)

for i in range(q):
    x, y = map(int, input().split())
    print(depth[x] + depth[y])
Problem p03617 (python)

Fixed submission:
input1 = input("").split(" ")
Q = int(input1[0])
H = int(input1[1])
S = int(input1[2])
D = int(input1[3])
N = int(input(""))

print((N%2) * min(Q*4,H*2,S) + (N//2) * min(Q*8,H*4,S*2,D))

Buggy submission (verdict: Runtime Error):
from math import pi

input1 = list(map(int,input("").split(" ")))
N = int(input(""))
src = {"x":input1[0],"y":input1[1]}
dist = {"x":input1[2],"y":input1[3]}

spring = []
for i in range(N):
	temp = list(map(int,input("").split(" ")))
	if temp[0] in range(min(src['x'],dist['x']),max(src['x'],dist['x'])+1):
		if temp[1] in range(min(src['y'],dist['y']),max(src['y'],dist['y'])+1):
			spring.append({'x':temp[0], 'y':temp[1]})

# print(spring)
path = (abs(src['x']-dist['x']) + abs(src['y']-dist['y'])) * 100
if len(spring) > 0:
	r = 10
	if src['x'] == dist['x'] or src['y'] == dist['y'] :
		#半円
		path += r*pi - 2*r 
	else:
		#1/4円
		if (src['x']-dist['x'])*(src['y']-dist['y']) > 0:
			spring.sort(key=lambda k: k['x'])
		else:
			spring.sort(key=lambda k: k['x'], reverse=True)
		L = [spring[0]['y']]
		length = 1
		for i in range(1,len(spring)):
			if L[length-1] < spring[i]['y']:
				L.append(spring[i]['y'])
				length += 1
			else:
				for j in range(length):
					if spring[i]['y'] <= L[j]:
						L[j] = spring[i]['y']
						break
		path += (r*pi/2 - 2*r) * length

print(path)
Problem p03617 (python)

Fixed submission:
sum=0
Q,H,S,D=input().split()
Q=int(Q)
H=int(H)
S=int(S)
D=int(D)

if not(1<=Q<=10**8 and 1<=H<=10**8 and 1<=S<=10**8 and 1<=D<=10**8):
	print("input error1")

QQ=Q*4
HH=H*2

QQQ=8*Q
HHH=4*H
SSS=2*S
N=int(input())

if not(1<=N<=10**9):
	print("input error2")

if N==1:
	sum=min(QQ,HH,S)
else:
	sum+=(N//2)*min(QQQ,HHH,SSS,D)
	if N%2==1:
		sum+=min(QQ,HH,S)

print(sum)

Buggy submission (verdict: Runtime Error):
#coding:UTF-8
#
#問題：AtCoder Grand Contest019 #A Ice Tea Store
#
#手法：入力Nは整数で与えられるので、Nが2以上のときは2リットル当たりの値段が安いドリンクをN/2個買い、
#Nが奇数だったら、残りの1リットルは1リットル当たりの値段が安いドリンク買う
sum=0#合計金額
#入力(0.25リットル,0.5リットル,1リットル,2リットル)
Q,H,S,D=input().split()
Q=int(Q)
H=int(H)
S=int(S)
D=int(D)
#入力チェック
if not(1<=Q<=10**8 and 1<=H<=10**8 and 1<=S<=10**8 and 1<=D<=10**8):
	print("input error1")
#1リットル当たりのQ,Hの値段QQ,HHを求める
QQ=Q*4
HH=H*2
#2リットル当たりのQ,H,Sの値段QQQ,HHH,SSSを求める
QQQ=8*Q
HHH=4*H
SSS=2*S
N=int(input())
#Nの入力チェック]
if not(1<=N<=10**9):
	print("input error2")
#N=1のとき、QQ,HH,Sの最小値がsumになる
if N==1:
	sum=min(QQ,HH,S)
else:#Nが2以上の時
	sum+=(N//2)*min(QQQ,HHH,SSS,D)
	if N%2==1:#Nが奇数のときは、sumにQQ,HH,Sの中の最小値を加える
		sum+=min(QQ,HH,S)
print()	
print(sum)
#print("Q,H,S,D=",Q,H,S,D)
Problem p03631 (python)

Fixed submission:
N = int(input())

a = 0
b = 0

for i in range(1,10):
    if N > 100:
        N = N - 100
        a = a + 1

for j in range(1,10):
    if N > 10:
        N = N - 10
        b = b + 1
c = N

if a == c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

if B <= C:
    print(0)
else:
    print(min(B, D) - max(A,C))
Problem p03631 (python)

Fixed submission:
x = input()
if x[0] == x[2]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
if a==c:
    print(abs(b-d))
elif a>c:
    if a>d:
        print(0)
    elif a<d<b:
        print(abs(a-d))
    else:
        print(abs(a-b))
else:
    if c>b:
        print(0)
    elif c<b<d:
        print(abs(c-b))
    else:
        print(abs(c-d))

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
if a==c:
    print(abs(b-d))
elif a>c:
    if a>d:
        print(0)
    elif a<d<b:
        print(abs(a-d))
    else:
        print(abs(a-b))
else:
    if c>b:
        print(0)
    elif c<b<d:
        print(abs(c-b))
    else:
        print(abs(c-d))

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
if a==c:
    print(abs(b-d))
elif a>c:
    if a>d:
        print(0)
    elif a<d<b:
        print(abs(a-d))
    else:
        print(abs(a-b))
else:
    if c>b:
        print(0)
    elif c<b<d:
        print(abs(c-b))
    else:
        print(abs(c-d))

Buggy submission (verdict: Runtime Error):
x = input()↲
if x[0] == x[2]:↲
    print('Yes')↲
else:↲
    print('No')↲
Problem p03631 (python)

Fixed submission:


def isPal(n):
    sum = 0
    while(n>0):
        rem = n % 10
        sum = (sum * 10) + rem
        n = n//10

    return sum

n = int(input().strip())

if(n == isPal(n)):print('Yes')
else:print('No')

Buggy submission (verdict: Runtime Error):



a,b,c,d = map(int,input().split())

if(b<c):print (0)
elif(b==c):
    if(b == 0):print(0)
    else:print(1)
else:
    start = a if a>c else c
    end = b if b<d else d
    print(end - start)
Problem p03631 (python)

Fixed submission:
a=input()
b=''.join(reversed(a))
if(a==b):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a=input()
b=.join(reversed(a));
if(a==b):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a=input()
b=reverse(a);
if a==b:
 print('Yes')
else:
 print('No')
Problem p03631 (python)

Fixed submission:
n = input()

a = [i for i in n]
b = [i for i in reversed(n)]

if a == b:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())


one = [i for i in range(a, b)]
two = [i for i in range(c, d)]

count = 0
for i in one:
    if i in two:
        count += 1
print(count)
Problem p03631 (python)

Fixed submission:
kaibun = str(input())
#print(kaibun)
#print(kaibun[::-1])
if kaibun == kaibun[::-1]:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
sec = input().split(' ')
#sec = ['0','75','25','100']
#sec = ['0','33','66','99']
#print(sec[0],sec[1],sec[2],sec[3])
#開始時間選定
start = max(sec[0],sec[2])
#print('開始:' + start)
#終了時間選定
end = min(sec[1],sec[3])
#print('終了:' + end)
kekka =(int(end) - int(start))
if kekka < 1:
	kekka = 0
	print(kekka)
else:
	print(kekka)
Problem p03631 (python)

Fixed submission:
n=input()
if n[0]==n[-1]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=input()
if n[0]==n[-1]:
  return 'Yes'
else:
  return 'No'
Problem p03803 (python)

Fixed submission:
l = input().split()

A = int(l[0])
B = int(l[1])

if A == 1:
    A = 14
if B == 1:
    B = 14
    
if A > B:
    print("Alice")
if A == B:
    print("Draw")
if A < B:
    print("Bob")

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if A > B:
    print("Alice")
if A == B:
    print("Draw")
if A < B:
    print("Bob")

Buggy submission (verdict: Runtime Error):
A = input("")
B = input("")

if A > B:
    print("Alice")
if A == B:
    print("Draw")
if A < B:
    print("Bob")

Buggy submission (verdict: Runtime Error):
A = input()
B = input()

if A > B:
    print("Alice")
if A == B:
    print("Draw")
if A < B:
    print("Bob")
Problem p03634 (python)

Fixed submission:
N=int(input())
import sys
sys.setrecursionlimit(10**6)
T=[[] for _ in range(N)]
for i in range(N-1):
    a,b,c=map(int, input().split())
    T[a-1].append((b-1,c))
    T[b-1].append((a-1,c))

Q,K=map(int, input().split())
D=[-1]*N
D[K-1]=0
def dfs(start, nowd):
    to=T[start]
    for t in to:
        next_node,c=t
        if D[next_node]!=-1:
            continue
        nextd=nowd+c
        D[next_node]=nextd
        dfs(next_node, nextd)
dfs(K-1,0)
# print(D)
for i in range(Q):
    x,y=map(int, input().split())
    print(D[x-1]+D[y-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
import sys
# sys.setrecursionlimit(10**6)
T=[[] for _ in range(N)]
for i in range(N-1):
    a,b,c=map(int, input().split())
    T[a-1].append((b-1,c))
    T[b-1].append((a-1,c))

Q,K=map(int, input().split())
D=[-1]*N
D[K-1]=0
def dfs(start, nowd):
    to=T[start]
    for t in to:
        next_node,c=t
        if D[next_node]!=-1:
            continue
        nextd=nowd+c
        D[next_node]=nextd
        dfs(next_node, nextd)
dfs(K-1,0)
# print(D)
for i in range(Q):
    x,y=map(int, input().split())
    print(D[x-1]+D[y-1])
Problem p03834 (python)

Fixed submission:
a, b, c = input().split(",")
print(a, b, c)

Buggy submission (verdict: Runtime Error):
a, b, c = input().split(,)
print(a, b, c)

Buggy submission (verdict: Runtime Error):
x, y ,z = input().split(,)
print(x, y, z)
Problem p03724 (python)

Fixed submission:
from collections import defaultdict

def unplanned_queries():
	n, m = map(int, raw_input().split(" "))
	a = []
	for i in range(m):
		a.append(map(int, raw_input().split(" ")))
	dic = defaultdict(int)
	for i in range(m):
		dic[a[i][0]] += 1
		dic[a[i][1]] += 1
	for key,value in dic.iteritems():
		if value%2!=0:
			print "NO"
			return
	print "YES"


if __name__ == "__main__":
	unplanned_queries()

Buggy submission (verdict: Runtime Error):
def unplanned_queries():
	n, m = map(int, raw_input().split(" "))
	a = []
	for i in range(m):
		a.append(map(int, raw_input().split(" ")))
	dic = defaultdict(int)
	for i in range(m):
		dic[a[i][0]] += 1
		dic[a[i][1]] += 1
	for key,value in dic.iteritems():
		if value%2!=0:
			print "NO"
			return
	print "YES"


if __name__ == "__main__":
	unplanned_queries()
Problem p04005 (python)

Fixed submission:
a,b,c = (int(x) for x in input().split())
ans = abs(a*b*(c//2)-a*b*(c-c//2))
ans = min(ans, abs(a*c*(b//2)-a*c*(b-b//2)))
ans = min(ans, abs(b*c*(a//2)-b*c*(a-a//2)))
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c = (int(x) for x in input())
ans = abs(a*b*(c//2)-a*b*(c-c//2))
ans = min(ans, abs(a*c*(b//2)-a*c*(b-b//2)))
ans = min(ans, abs(b*c*(a//2)-b*c*(a-a//2)))
print(ans)
Problem p03723 (python)

Fixed submission:
A,B,C = map(int,raw_input().split())

if A==B and B==C:
    if A%2==0 and B%2==0 and C%2==0:
        print -1
    else:
        print 0
else:
    for i in range(1000):
        if A%2==1 or B%2==1 or C%2==1:
            print i
            break
        newA = B/2 + C/2
        newB = C/2 + A/2
        newC = A/2 + B/2
        A = newA
        B = newB
        C = newC

Buggy submission (verdict: Runtime Error):
N,M = map(int,raw_input().split())
node_list = [0 for l in range(N)]
for i in range(M):
    items = map(int,raw_input().split())
    node_list[items[0]-1]+=1
    node_list[items[1]-1]+=1
flag=False
for n in range(N):
    if n%2==1:
        flag=True
        
if flag:
    print 'NO'
else:
    print 'YES'

Buggy submission (verdict: Runtime Error):
N,M = map(int,raw_input().split())
node_list = [0 for l in range(N)]
for i in range(M):
    items = map(int,raw_input().split())
    node_list[items[0]-1]+=1
    node_list[items[1]-1]+=1
flag=False
for n in range(N):
    if n%2==1:
        flag=True
        
if flag:
    print 'NO'
else:
    print 'YES'

Buggy submission (verdict: Runtime Error):

N,M = map(int,raw_input().split())
node_list = [0 for l in range(N)]
for i in range(M):
    items = map(int,raw_input().split())
    node_list[items[0]-1]+=1
    node_list[items[1]-1]+=1
flag=False
for i in range(N):
    if node_list[i]%2==1:
        flag=True
        
if flag:
    print 'YES'
else:
    print 'NO'
Problem p03745 (python)

Fixed submission:
N = int(raw_input())
A = map(int,raw_input().split())

count=1
z1=0
for i in range(N-1):
    if A[i+1]-A[i]>0:
        z2 = 1
    elif A[i+1]-A[i]<0:
        z2 = -1
    elif A[i+1]-A[i]==0:
        z2 = 0
    if z2*z1<0:
        count+=1
        z1=0
    elif z2!=0:
        z1=z2

print str(count)

Buggy submission (verdict: Runtime Error):

N = int(raw_input())
A = map(int,raw_input().split())

count=1
z1=0
for i in range(N-1):
    if A[i+1]-A[i]>0:
        z2=1
    elif A[i+1]-A[i]<0:
        z2=-1
    elif A[i+1]-A[i]==0:
        z=0
    if z2*z1<0:
        count+=1
    if z2!=0:
        z1=z2

print str(count)

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
A = map(int,raw_input().split())

count=1
z1=0
for i in range(N-1):
    if A[i+1]-A[i]>0:
        z2=1
    elif A[i+1]-A[i]<0:
        z=-1
    elif A[i+1]-A[i]==0:
        z=0
    if z2*z1<0:
        count+=1
    if z2!=0:
        z1=z2

print str(count)
Problem p03776 (python)

Fixed submission:
import itertools,math,bisect,pprint,sys
n, a, b = map(int, raw_input().split())
v = sorted(map(int, raw_input().split()))[::-1]
res1 = sum(v[:a])*1.0/a
print '{0:.6f}'.format(res1)
res2 = 0
def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)
if a==v[:a].count(v[a-1]):
    res2 = 0
    for i in range(a,b+1):
        if i <= v.count(v[a-1]):
            res2 += nCr(v.count(v[a-1]),i)
    print res2
else:
    print nCr(v.count(v[a-1]),v[:a].count(v[a-1]))

Buggy submission (verdict: Runtime Error):
import itertools,math,bisect,pprint,sys
n, a, b = map(int, raw_input().split())
v = sorted(map(int, raw_input().split()))[::-1]
res1 = sum(v[:a])*1.0/a
print res1
res2 = 0
def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)
if a==v[:a].count(v[a-1]):
    res2 = 0
    for i in range(a,b+1):
        res2 += nCr(v.count(v[a]),i)
    print res2
else:
    print nCr(v.count(v[a-1]),v[:a].count(v[a-1]))

Buggy submission (verdict: Runtime Error):
import itertools,math,bisect,pprint,sys
n, a, b = map(int, raw_input().split())
v = sorted(map(int, raw_input().split()))[::-1]
res1 = sum(v[:a])*1.0/a
print res1
res2 = 0
def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)
if a==v[:a].count(v[a]):
    res2 = 0
    for i in range(a,b+1):
        res2 += nCr(v.count(v[a]),i)
    print res2
else:
    print nCr(v.count(v[a]),v[:a].count(v[a]))

Buggy submission (verdict: Runtime Error):
import itertools,math,bisect,pprint,sys
n, a, b = map(int, raw_input().split())
v = sorted(map(int, raw_input().split()))[::-1]
res1 = sum(v[:a])*1.0/a
print res1
res2 = 0
def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)
if a==v[:a].count(v[a]):
    res2 = 0
    for i in range(a,b):
        res2 += nCr(v.count(v[i]),i)
else:
    print nCr(v.count(v[a]),v[:a].count(v[a]))
Problem p03804 (python)

Fixed submission:
n, m = map(int, input().split())
A, B = [], []

for i in range(n):
    A.append(input())

for i in range(m):
    B.append(input())

def is_contain(i, b_pos):
    containing = True
    for k in range(1, m):
        if A[i+k][b_pos:(b_pos+len(B))] != B[k]:
            containing = False
    return containing

if n < m or len(A) < len(B):
    print("No")
    exit()

for i in range(n - m + 1):
    lineA = A[i]
    lineB = B[0]
    lineB_pos = lineA.find(lineB)
    if lineB_pos >= 0:
        if is_contain(i, lineB_pos):
            print("Yes")
            exit()

print("No")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A, B = [], []

for i in range(n):
    A.append(input())

for i in range(m):
    B.append(input())

def is_contain(i, b_pos):
    containing = True
    for a_i in range(i+1, i+m):
        if A[a_i][b_pos:(b_pos+len(B))] != B[a_i]:
            containing = False
    return containing

if n < m or len(A) < len(B):
    print("No")
    exit()

for i in range(n - m + 1):
    lineA = A[i]
    lineB = B[i%m]
    lineB_pos = lineA.find(lineB)
    if lineB_pos >= 0:
        if is_contain(i, lineB_pos):
            print("Yes")
            exit()

print("No")
Problem p03803 (python)

Fixed submission:
A, B = map(int,input().split())
if(A == B):
    print('Draw')
elif(B != 1 and (A == 1 or A > B)):
    print('Alice')
elif(A != 1 and (B == 1 or B > A)):
    print('Bob')

Buggy submission (verdict: Runtime Error):
A, B = map(int,input())
if(A == B):
    print('Draw')
elif(B != 1 and (A == 1 or A > B)):
    print('Alice')
elif(A != 1 and (B == 1 or B > A)):
    print('Bob')
Problem p03834 (python)

Fixed submission:
s = input().split(',')
print(s[0] +' '+ s[1] + ' ' + s[2])

Buggy submission (verdict: Runtime Error):
K, S = map(int, input().split())
OK = 0
for x in range(K+1):
    if(0<=S-x & S-x<=2*K): # 計算の成立条件
        if(S-x<=K): # yとzの和がk以下
            OK += S-x+1
        else: # yとzの和がk以上
            OK += (K-((S-x)-K))+1
print(OK)