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

Fixed submission:
#coding: utf-8

group={'a':[1,3,5,7,8,10,12],'b':[4,6,9,11],'c':[2]}

input_lines=raw_input()
input_numbers=input_lines.split()
n=map(int,input_numbers)#n[0]とn[1]に数字

first_group = False
second_group = False

for i in group:
    for j in range(0,len(group[i])):
        if group[i][j] == n[0]:
            first_group = True
        if group[i][j] == n[1]:
            second_group = True
    if first_group == True and second_group==False or first_group == False and second_group == True:
        print "No"
        break

if first_group and second_group:
    print "Yes"

Buggy submission (verdict: Runtime Error):
group =[0,1,3,1,2,1,2,1,1,2,1,2,1]

input_lines=raw_input()
input_numbers=input_lines.split()
n=map(int,input_numbers)

if group[n[0]] == group[n[1]]
    print "Yes"
else:
    print "NO"

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

group={'a':[1,3,5,7,8,10,12],'b':[4,6,9,11],'c':[2]}

input_lines=raw_input()
input_numbers=input_lines.split()
n=map(int,input_numbers)#n[0]とn[1]に数字

first_group = False
second_group = False

for i in group:
    for j in range(0,len(group[i])):
        if group[i][j] == n[0]:
            first_group = True
        if group[i][j] == n[1]:
            second_group = True
    if first_group == True and second_group==False or first_group == False and second_group == True:
        print "No"
        break

if first_group and second_group:
    print "Yes"
Problem p03712 (python)

Fixed submission:
import sys

H,W = raw_input().split()
a =[]
for line in range(int(H)):
    a.append(raw_input())

for i in range(0,int(W)+2):
    sys.stdout.write("#")
print

for i in range(0,int(H)):
    sys.stdout.write("#")
    for j in range(0,int(W)):
        sys.stdout.write(a[i][j])
    sys.stdout.write("#")
    print

for i in range(0,int(W)+2):
    sys.stdout.write("#")
print

Buggy submission (verdict: Runtime Error):
coding:utf-8
import sys

H,W = raw_input().split()
a =[]
for line in range(int(H)):
    a.append(raw_input())

print a

for i in range(0,int(W)+2):
    sys.stdout.write("#")
print

for i in range(0,int(H)):
    sys.stdout.write("#")
    for j in range(0,int(W)):
        sys.stdout.write(a[i][j])
    sys.stdout.write("#")
    print

for i in range(0,int(W)+2):
    sys.stdout.write("#")
print
Problem p03719 (python)

Fixed submission:
#coding:utf-8

input_lines = raw_input().split()
n = map(int,input_lines)

if n[0] <= n[2] and n[2]<=n[1]:
    print "Yes"
else:
    print "No"

Buggy submission (verdict: Runtime Error):
def max_score(edge,N):
    inf =float("inf")
    w = [-inf for i in range(int(N)+1)]
    w[1] = 0;
    while True:
        update = False
        negative = False
        for e in edge:
            if e[0] > e[1] and e[2]>0:
                negative = True
                update = True
                break

            elif w[e[0]] != -inf and w[e[1]] < w[e[0]]+e[2] and e[0] < e[1]:
                w[e[1]] = w[e[0]]+e[2]
                update = True

        if not update:
            break

    if not negative:
        return w[int(N)]
    else:
        return "inf"


N, M = raw_input().split()
edge = []
for i in range(int(M)):
    edge.append(map(int,raw_input().split()))

print max_score(edge,int(N))
Problem p03864 (python)

Fixed submission:
_, x = map(int, input().split())
a = [int(i) for i in input().split()]
cnt = 0

for i in range(len(a) - 1):
    s = a[i] + a[i + 1]
    if x < s:
        sub = s - x
        a[i + 1] = max(0, a[i + 1] - sub)
        cnt += sub
print(cnt)

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

class Edge:
    def __init__(self, to, cost):
        self.to = to
        self.cost = cost

def dijkstra(G, s):
    from heapq import heappush, heappop
    l = len(G)
    dist = [float('inf')] * l
    done = [False] * l
    dist[s] = 0
    pq = []
    heappush(pq, (0, s))
    while pq:
        c, v = heappop(pq)
        done[v] = True
        for e in G[v]:
            cost = dist[v] + e.cost
            if cost < dist[e.to] and not done[e.to]:
                dist[e.to] = cost
                heappush(pq, (cost, e.to))
    return dist

xs, ys, xt, yt = map(int, input().split())
N = int(input())
xyr = [[int(i) for i in input().split()] for _ in range(N)]
xyr += [[xs, ys, 0], [xt, yt, 0]]

G = [[] for _ in range(N + 2)]

for i, (x, y, r) in enumerate(xyr):
    for j, (x2, y2, r2) in enumerate(xyr[i + 1:]):
        w = max(0, sqrt((x - x2)**2 + (y - y2)**2) - r - r2)
        G[i].append(Edge(i + j + 1, w))
        G[i + j + 1].append(Edge(i, w))

print(dijkstra(G, len(G) - 2)[-1])
Problem p03719 (python)

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

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
m_list = [0] * (N + 1)
for i in range(M):
    a, b = map(int, input().split())
    m_list[a] += 1
    m_list[b] += 1
for j in m_list[1:]:
    print(j)
Problem p03773 (python)

Fixed submission:
b = input().split()
a = [int(b[i]) for i in range(len(b))]

if(a[0] + a[1] >= 24 ):
  print(a[0] + a[1] - 24)
else:
  print(a[0] + a[1])

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10000)


def memoize(f):
    cache = {}

    def func(*args):
        if args not in cache:
            cache[args] = f(*args)
        return cache[args]

    return func


@memoize



def combi(n, r):
  if r == 0 or n == r:
    return 1
  return combi(n-1, r-1) + combi(n-1, r)

n, a, b = map(int, input().split())
items = sorted(map(int, input().split()), reverse=True)
max_ave_list = items[:a]
print(sum(max_ave_list)/len(max_ave_list))

m = max_ave_list.count(max_ave_list[-1])
l = items.count(max_ave_list[-1])
if l == m:
  print(1)
elif max_ave_list[0] != max_ave_list[-1]:
  print(combi(l, m))
else:
  print(sum(combi(l, k) for k in range(m, min(b, l) + 1)))
Problem p03778 (python)

Fixed submission:
W, a, b = map(int, input().split())

abs = max(a, b) - min(a, b) - W

print(max(0, abs))

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

abs = max(a[1], a[2]) - min(a[1], a[2]) - a[0]

print(max(0, abs))
Problem p03701 (python)

Fixed submission:
import sys

def gen_list(lst):
    length = len(lst)
    dp = [{}] * length
    dp[0] = {lst[0]: True}
    dp[0][0] = True

    # s[i]までで出る数字
    for i in range(1, length):
        s = lst[i]
        dp[i] = dp[i-1]
        keys = [k for k in dp[i].keys()]
        for val in keys:
            dp[i][val + s] = True
    
    return sorted(dp[length-1].keys(), reverse=True)

N = int(input())
s = [int(input()) for _ in range(N)]

for m in gen_list(s):
    if m % 10 != 0:
        print(m)
        sys.exit()

print('0')

Buggy submission (verdict: Runtime Error):
    sum_ = sum(s)
    if (sum_ % 10) != 0:
        return sum_
    else:
        st = sorted(s)
        m = 0
        for i in range(len(st)):
            s2 = sum(s[:i-1]+s[i+1:])
            if (s2 % 10) != 0:
                return s2

        for i in range(len(st)):
            s2 = sum(s[:i-1]+s[i+2:])
            if (s2 % 10) != 0:
                return s2
    return 0

N = int(input())
a = [int(input()) for i in range(N)]
print(max_of(a)) # [a1, a2, a3, ..., aN]
Problem p03701 (python)

Fixed submission:
import sys


class Solution(object):
    def __init__(self):
        self.N = int(sys.stdin.readline())
        self.s = []
        for _ in range(self.N):
            self.s.append(int(sys.stdin.readline()))

    # def solve(self):
    def naive_solve(self):
        sums = [0]
        for num in self.s:
            sums.extend([s + num for s in sums])
        for r in sorted(sums, reverse=True):
            if r % 10:
                return r
        return 0

    def answer_solve(self):
        S = sum(self.s)
        if S % 10:
            return S
        smallest = float('inf')
        for num in self.s:
            if num % 10:
                smallest = min(smallest, num)
        if smallest != float('inf'):
            return S - smallest
        return 0




print(Solution().answer_solve())

Buggy submission (verdict: Runtime Error):
import sys

import math


class Solution(object):
    def __init__(self):
        self.N, self.A, self.B = map(int, sys.stdin.readline().split(' '))
        self.h = []
        for _ in range(self.N):
            self.h.append(int(sys.stdin.readline()))
        self.extra_damage = self.A - self.B

    def solve(self):
        max_h = max(self.h)
        at_most = int(max_h / self.B) + 1
        at_least = int(max_h / self.A) + 1
        result = self.binary_search_lowest_kaisu(at_least, at_most)
        print(result)

    def binary_search_lowest_kaisu(self, low, high):
        if low == high:
            return low
        mid = low + (high - low) // 2
        if self.enough(mid):
            return self.binary_search_lowest_kaisu(low, mid)
        else:
            return self.binary_search_lowest_kaisu(mid + 1, high)

    def enough(self, kaisu):
        hps_remain = []
        for x in self.h:
            hp_remain = x - kaisu * self.B
            if hp_remain > 0:
                hps_remain.append(hp_remain)
        counter = 0
        for hp_remain in hps_remain:
            counter += math.ceil(hp_remain / self.extra_damage)
            if counter > kaisu:
                return False
        return True

Solution().solve()
Problem p03732 (python)

Fixed submission:
#coding:utf-8

N, W = map(int, raw_input().split(" "))
items = [tuple(map(int, raw_input().split(" "))) for _ in range(N)]
dic = {}

def search(i, j):
    if i == N:
        return 0
    if (i, j) not in dic:
        dic[(i, j)] = search(i + 1, j)
        w, v = items[i]
        if j + w <= W:
            dic[(i, j)] = max(dic[(i, j)] , search(i + 1, j + w) + v)
    return dic[(i, j)]

print search(0, 0)

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

if __name__ == "__main__":
    N, W = map(int, raw_input().split(" "))
    item = []
    for i in range(N):
        item.append(map(int, raw_input().split(" ")))

    table = [[0 for j in range(W + 1)] for i in range(N)]

    for i in range(N):
        for j in range(W + 1):
            if item[i][0] <= j:
                table[i][j] = max(table[i - 1][j], table[i - 1][j - item[i][0]] + item[i][1])
            else:
                table[i][j] = table[i - 1][j]

    print table[N - 1][W]
Problem p03815 (python)

Fixed submission:
x = int(input())
# 5 or 6
if x % 11 == 0:
    ans = x // 11 * 2
elif x % 11 <= 6:
    ans = x // 11 * 2 + 1
else:
    ans = x // 11 * 2 + 2

print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
# 5 or 6
if x % 11 == 0:
    ans = x // 11 * 2
elif x % 11 <= 6:
    ans = x // 11 * 2 + 1
else:
    ans = x // 11 * 2 + 2

print(ans
Problem p03844 (python)

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

if aopb[1] == '+':
    print(int(aopb[0]) + int(aopb[2]))
else:
    print(int(aopb[0]) - int(aopb[2]))

Buggy submission (verdict: Runtime Error):
n = input()
ti = input().split()
sum_ti = sum(map(int, ti))

m = input()
for m in range(int(m)):
    px = input().split()
    sum_p = sum_ti - int(ti[int(px[0])-1]) + int(px[1])
    print(sum_p)

Buggy submission (verdict: Runtime Error):
aopb = input().split('+'or'-')

if aopb[1] == '+':
    print(int(aopb[0]) + int(aopb[2]))
else:
    print(int(aopb[0]) - int(aopb[2]))
Problem p03846 (python)

Fixed submission:

from collections import Counter

n = int(input())
a = list(map(int, input().split()))
m = n // 2
ca = Counter(a)

if n % 2 == 1 and ca[0] == 1 and all(ca[(i+1)*2] == 2 for i in range(m)):
    ans = (2 ** m) % (10 ** 9 + 7)
    print(ans)
elif n % 2 == 0 and all(ca[i*2 + 1] == 2 for i in range(m)):
    ans = (2 ** m) % (10 ** 9 + 7)
    print(ans)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
m = n//2
ca = Counter(a)

if n % 2 == 0 and all(ca[i*2 + 1] == 2 for i in range(m)):
    ans = (2 ** m) % (1e9 + 7)
    print(int(ans))
elif n % 2 == 1 and ca[0] == 1 and all(ca[(i+1)*2] == 2 for i in range(m)):
    ans = (2 ** m) % (1e9 + 7)
    print(int(ans))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
m = n//2
ca = Counter(a)

if n % 2 == 0 and all(ca[i*2 + 1] == 2 for i in range(m)):
    ans = 2 ** m % (1e9 + 7)
    print(int(ans))
elif n % 2 == 1 and ca[0] == 1 and all(ca[(i+1)*2] == 2 for i in range(m)):
    ans = 2 ** m % (1e9 + 7)
    print(int(ans))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
m = n//2
ca = Counter(a)

if n % 2 == 0 and all(ca[i*2 + 1] == 2 for i in range(m)):
    ans = 2 ** m % (1e9 + 7)
    print(int(ans))
elif n % 2 == 1 and all(ca[(i+1)*2] == 2 for i in range(m)):
    ans = 2 ** m % (1e9 + 7)
    print(int(ans))
else:
    print(0)
Problem p03711 (python)

Fixed submission:
import sys
x, y = [int(i) for i in input().split()]
list = [1,3,5,7,8,10,12,4,6,9,11,2,0]
slice1 = list[0:7]
slice2 = list[7:11]
slice3 = list[11:12]

if x in slice1 and y in slice1:
    print('Yes')
elif x in slice2 and y in slice2:
    print ('Yes')
elif x in slice3 and y in slice3:
    print ('Yes')
else:
    print ('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
#from scipy.interpolate import interpld
from matplotlib import pyplot as plt
%matplotlib inline
import sys
x, y = [int(i) for i in input().split()]
list = [1,3,5,7,8,10,12,4,6,9,11,2,0]
slice1 = list[0:7]
slice2 = list[7:11]
slice3 = list[11:12]

if x in slice1 and y in slice1:
    print('Yes')
elif x in slice2 and y in slice2:
    print ('Yes')
elif x in slice3 and y in slice3:
    print ('Yes')
else:
    print ('No')
Problem p03711 (python)

Fixed submission:

i = raw_input().strip().split(" ")
x = int(i[0])
y = int(i[1])

groups = []
groups.append([1, 3, 5, 7, 8, 10, 12])
groups.append([4, 6, 9, 11])
groups.append([2])

for g in groups:
    if x in g and y in g:
        print "Yes"
        break
else:
    print "No"

Buggy submission (verdict: Runtime Error):
hw = raw_input().split(" ")
h = int(hw[0])
w = int(hw[1])
print("#"*(w+2))
for i in range(h):
    print("#" + raw_input() + "#")

print("#"*(w+2))
Problem p03729 (python)

Fixed submission:
a = input()
b = a.split()

if b[0][-1] == b[1][0] and b[1][-1] == b[2][0]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
i = input().split()
a = int(i[0])
b = int(i[1])
c = int(i[2])

answer = "NO"
while a <= a*b:
    if a%b==c:
        answer = "YES"
        break
    a += a 
    
print(answer)
Problem p03711 (python)

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

a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
i=int(ipt[0])
j=int(ipt[1])
if i==j:
    print('Yes')
elif i in a and j in a:
    print('Yes')
elif i in b and j in b:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
array=[int(n) for n in input().split()]
lst=[]
for i in range(N+1):
    left_array=array[:N+i]
    print(left_array)
    l = sorted(left_array)[-N:]
    print('l:',l)
    right_array=array[N+i:]
    print(right_array)
    r = sorted(right_array)[:N]
    print('r:',r)
    ans = sum(l)-sum(r)
    print(ans)
    lst.append(ans)
print(max(lst))

Buggy submission (verdict: Runtime Error):
h, w = [int(n) for n in input().split()]
i = min(h, w)
j = max(h, w)
area = i * j
if i % 3 == 0 or j % 3 == 0:
    print(0)
else:
    p = j // 3 + 1
    pp = i // 3 + 1
    q = j // 3 - 1
    qq = i // 3 - 1
    a1 = i * p
    aa1 = j * p
    a2 = i * q
    aa2 = j * q
    b1 = i // 2 * (j - p)
    bb1 = j // 2 * (i - p)
    b2 = i // 2 * (j - q)
    bb2 = j // 2 * (i - q)
    c1 = (j - p) // 2 * i
    cc1 = (i - p) // 2 * j
    c2 = (j - q) // 2 * i
    cc2 = (i - q) // 2 * j
    tup = [(a1, b1), (a2, b2), (aa1, bb1), (aa2, bb2),
        (a1, c1), (a2, c2), (aa1, cc1), (aa2, cc2)]
    lst = [abs(max(a, b, area - a - b) - min(a1, b1, area - a1 - b1))) for a, b in tup]
    print(min(lst))

Buggy submission (verdict: Runtime Error):
h, w = [int(n) for n in input().split()]
i = min(h, w)
j = max(h, w)
area = i * j
if i % 3 == 0 or j % 3 == 0:
    print(0)
else:
    p = j // 3 + 1
    pp = i // 3 + 1
    q = j // 3 - 1
    qq = i // 3 - 1
    a1 = i * p
    aa1 = j * p
    a2 = i * q
    aa2 = j * q
    b1 = i // 2 * (j - p)
    bb1 = j // 2 * (i - p)
    b2 = i // 2 * (j - q)
    bb2 = j // 2 * (i - q)
    c1 = (j - p) // 2 * i
    cc1 = (i - p) // 2 * j
    c2 = (j - q) // 2 * i
    cc2 = (i - q) // 2 * j

    print(min(
        abs(max(a1, b1, area - a1 - b1) - min(a1, b1, area - a1 - b1))
        abs(max(aa1, bb1, area - aa1 - bb1) - min(aa1, b1, area - aa1 - bb1))
        abs(max(aa2, bb2, area - aa2 - bb2) - min(aa2, bb2, area - aa2 - bb2))
        abs(max(a2, b2, area - a2 - b2) - min(a2, b2, area - a2 - b2))
        abs(max(a1, c1, area - a1 - c1) - min(a1, c1, area - a1 - c1))
        abs(max(aa1, cc1, area - aa1 - cc1) - min(aa1, c1, area - aa1 - cc1))
        abs(max(aa2, cc2, area - aa2 - cc2) - min(aa2, cc2, area - aa2 - cc2))
        abs(max(a2, c2, area - a2 - c2) - min(a2, c2, area - a2 - c2))

    ))

Buggy submission (verdict: Runtime Error):
ipt = input().split()

a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
i=int(ipt[0])
j=int(ipt[1])
if i==j:
    print('Yes')
elif i in and j in a:
    print('Yes')
elif i in b and j in b:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
ipt = list(map(int, input().split()))
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]

if ipt[0] == ipt[1]:
    return True
else:
    if ipt[0] in a:
        return ipt[1] in a
    else:
        ipt[0] in b:
        return ipt[1] in b
Problem p03712 (python)

Fixed submission:
h, w = [int(n) for n in input().split()]

ans=''
for i in range(h):
    ans+='#'+input()+'#'+'\n'
print('#'*(w + 2))
print(ans+'#'*(w + 2))

Buggy submission (verdict: Runtime Error):
h, w = [int(n) for n in input().split()]

ans=''
for i in range(h):
    ipt = input().split()
    ans+='#'+ipt[0]+ipt[1]+'#'+'\n'
print('#'*(w + 2))
print(ans+'#'*(w + 2))

Buggy submission (verdict: Runtime Error):
h, w = [int(n) for n in input().split()]


print('#'*(w + 2))
for i in range(h):
    ipt = input().split()
    print('#'+ipt[0]+ipt[1]+'#')
print('#'*(w + 2))

Buggy submission (verdict: Runtime Error):
h, w = [int(n) for n in input().split()]


print('#'*(w + 2))
for i in range(h):
    ans='#'
    ans+=input().split()
    ans+='#'
    print(ans)
print('#'*(w + 2))

Buggy submission (verdict: Runtime Error):
ipt=input().split()
h,w = [int(n) for n in ipt[:1]]
img= [input().split()[2:]]
print(
    for i in w+2:
        '#',
    "/n",
    for i in h:
    '#',img[w*i,w*(i+1)],'#',"/n"
    for i in w+2:
        ,'#')

Buggy submission (verdict: Runtime Error):
import numpy as np

ipt =np.array(input()[3:])

np.pad(ipt,1,'#')
Problem p03711 (python)

Fixed submission:
x, y = map(int,input().split())

group_1 = [1, 3, 5, 7, 8, 10, 12]
group_2 = [4, 6, 9, 11]
group_3 = [2]

groups = [group_1, group_2, group_3]

for group in groups:
    if x in group and y in group:
        print("Yes")
        break
    else:
        None
    if group == group_3:
        print("No")

Buggy submission (verdict: Runtime Error):
x, y = map(int,input().split())

grpup_1 = [1, 3, 5, 7, 8, 10, 12]
group_2 = [4, 6, 9, 11]
group_3 = [2]

groups = [group1, group_2, group_3]

for group in groups:
    if x, y in group:
        print("Yes")
    else:
        print("No")
Problem p03711 (python)

Fixed submission:
x, y = map(int, input().split())
if x == 2 or y == 2:
    print('No')
else:
    m1 = set([1, 3, 5, 7, 8, 10, 12])
    m2 = set([4, 6, 9, 11])
    if (x in m1 and y in m1) or (x in m2 and y in m2):
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
if x == 2 or y == 2:
    print('No')
else:
    m1 = set(1, 3, 5, 7, 8, 10, 12)
    m2 = set(4, 6, 9, 11)
    if (x in m1 and y in m1) or (x in m2 and y in m2):
        print('Yes')
    else:
        print('No')
Problem p03711 (python)

Fixed submission:
G1 = [1, 3, 5, 7, 8, 10, 12]
G2 = [4, 6, 9, 11]
 
x, y = map(int, input().strip().split(' '))
 
if x in G1 and y in G1 or x in G2 and y in G2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
G1 = [1, 3, 5, 7, 8, 10, 12]
G2 = [4, 6, 9, 11]

x, y = map(int, input().strip().split(' '))

if x in G1 and y in G1or x in G2 and y in G2:
    print("Yes")
else:
    print("No")
Problem p03713 (python)

Fixed submission:
def parallel_divide(H, W):
    return 0 if W % 3 == 0 else H
 
def perpendicular_divide(H, W):
    if W % 2 == 0:
        return W // 2
    S1 = (H - 1) // 3 if H % 3 == 1 else (H + 1) // 3
    S2 = (W + 1) // 2 * (H - S1)
    S3 = (W - 1) // 2 * (H - S1)
    S1 = S1 * W
    return max(S1, S2, S3) - min(S1, S2, S3)
 
H, W = map(int, input().strip().split(' '))
print(min(parallel_divide(H, W), parallel_divide(W, H), perpendicular_divide(H, W), perpendicular_divide(W, H)))

Buggy submission (verdict: Runtime Error):
def paralell_divide(H, W):
    return 0 if W % 3 == 0 else H

def perpendicular_divide(H, W):
    if W % 2 == 0:
        return W / 2
    a = (H - 1) / 3 if H % 3 == 1 else (H + 1) / 3
    b = (W + 1) / 2 * (H - a)
    c = (W - 1) / 2 * (H - a)
    a = a * W
    return max(a, b, c) - min(a, b, c)

H, W = map(int, input().strip().split(' '))
print min(parallel_divide(H, W), parallel_divide(W, H), perpendicular_divide(H, W), perpendicular_divide(W, H))
Problem p03719 (python)

Fixed submission:
def siritori(a):
    s1 = int(a[0])
    s2 = int(a[1])
    s3 = int(a[2])
    if s1<=s3 and s3<=s2:
        print("Yes")
    else:
        print("No")

siritori(input().split(" "))

Buggy submission (verdict: Runtime Error):
b = input().split(" ")
num = [0 for i in range(int(b[0]))] 
for i in range(int(b[1])):
    a = input().split(" ")
    num[int(a[0])-1] = num[int(a[0])-1]+1
    num[int(a[1])-1] = num[int(a[1])-1]+1

for i in range(int(b[0])):
    print(num[i])

Buggy submission (verdict: Runtime Error):
a = input().split(" ")
num = [0 for i in range(int(a[0]))] 
for i in range(int(a[1])):
    a = input().split(" ")
    num[int(a[0])-1] = num[int(a[0])-1]+1
    num[int(a[1])-1] = num[int(a[1])-1]+1

for i in range(int(a[1])):
    print(num[i])
Problem p03721 (python)

Fixed submission:
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])

num = [0 for i in range(10**5)]
for i in range(N):
    tmp = input().split(" ")
    a = int(tmp[0])
    b = int(tmp[1])
    num[a-1] = num[a-1] + b

tmp = 0
i = 0
while tmp < K:
    tmp = tmp + num[i]
    if tmp >= K:
        print(i+1)
    i = i + 1

Buggy submission (verdict: Runtime Error):
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])

num = [0 for i in range(N)] 
for i in range(N):
    tmp = input().split(" ")
    a = int(tmp[0])
    b = int(tmp[1])
    num[a-1] = num[a-1] + b

tmp = 0
i = 0
while tmp < K:
    tmp = tmp + num[i]
    if tmp >= K:
        print(i+1)
    i = i + 1

Buggy submission (verdict: Runtime Error):
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])

num = [0 for i in range(N-1)] 
for i in range(N-1):
    tmp = input().split(" ")
    a = int(tmp[0])
    b = int(tmp[1])
    num[a-1] = num[a-1] + b

tmp = 0
i = 0
while tmp <= K:
    tmp = tmp + num[i]
    if tmp >= K:
        print(i+1)
    i = i + 1

Buggy submission (verdict: Runtime Error):
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])

num = [0 for i in range(N-1)] 
for i in range(N):
    tmp = input().split(" ")
    a = int(tmp[0])
    b = int(tmp[1])
    num[a-1] = num[a-1] + b

tmp = 0
i = 0
while tmp <= K:
    tmp = tmp + num[i]
    if tmp >= K:
        print(i+1)
    i = i + 1

Buggy submission (verdict: Runtime Error):
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])

num = [0 for i in range(N)] 
for i in range(N):
    tmp = input().split(" ")
    a = int(tmp[0])
    b = int(tmp[1])
    num[a-1] = num[a-1] + b

tmp = 0
i = 0
while tmp <= K:
    tmp = tmp + num[i]
    if tmp >= K:
        print(i+1)
    i = i + 1