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

Fixed submission:
n, p = map(int, input().split())

def prime_factorize(num):
    """
    This function performs prime factorization on the input natural number.
    The result is returned in the form of a dictionary with the prime number as the key
    and its number as the value.
    :param num:
    :return prime_factor: Dictionary with the prime number as the key and its number as the value.
    """
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor


prime_fac = prime_factorize(p)
counts = []
for k, v in prime_fac.items():
    if v >= n:
        counts.append(k**(v//n))

counts.sort(reverse=True)
#print(prime_fac)
#print(counts)
if len(counts) == 0:
    print(1)
elif n == 1:
    print(p)
else:
    r = 1
    num = 0
    for c in counts:
        if num >= n:
            break
        r *= c
        num += 1
    print(r)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = [int(input()) for _ in range(n)]

a_list.sort(reverse=True)

if n == 1:
    print("first" if a_list[0] % 2 == 1 else "second")
    exit()

elif n == 2:
    max_num = a_list[0]
    second_num = a_list[1]
    num = max_num - second_num
    print("first" if num % 2 == 1 else "second")
else:
    max_num = a_list[0] - a_list[2]
    second_num = a_list[1] - a_list[2]
    num = max_num - second_num
    if num == 0:
        print("second")
    print("first" if num % 2 == 1 else "second")
Problem p03200 (python)

Fixed submission:
S = input()
S_list = []
for i in S:
    S_list.append(i)

w_count = S.count("W")
b_count = S.count("B")
c = 0

for i in range(len(S)):

    if S[i] == "B":
        c += w_count
    else:
        w_count -= 1

print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
A_list = list(map(int, input().split()))
two_list = [2 ** i for i in range(32)]
 
count = 0
items = {}
for a in A_list:
    if a in items:
        items[a] += 1
 
    else:
        items[a] = 1
A_list.sort(reverse=True)
 
for a in A_list:
    if items[a] >= 1:
 
        for t in two_list:
            m = t -a
            if m in items:
                if m == a and items[a] >= 2:
                    count += 1
                    items[a] -= 1
                    items[m] -= 1
                    break
 
                elif m != a and items[m] >= 1 and items[a] >=1:
                    count += 1
                    items[a] -= 1
                    items[m] -= 1
                    break
print(count)
Problem p03215 (python)

Fixed submission:
N, K = map(int, input().split())
a_list = list(map(int, input().split()))
sum_list = []

for i in range(N):
    for j in range(i, N):
        sum_list.append(sum(a_list[i:j+1]))
ans = 0
count = 0
tmp = []
for i in range(40, -1, -1):
    for s in sum_list:
        check_num = 1 << i
        logical_and = check_num & s

        if logical_and != 0:
            count += 1

    if count >= K:
        ans += 1 << i
        tmp = [x for x in sum_list if (1 << i) & x != 0]
        sum_list = tmp[:]
    count = 0
print(ans)

Buggy submission (verdict: Runtime Error):
package main

import (
	"bufio"
	"io"
	"os"
	"strconv"
	"fmt"
)

var (
	nstr   func() string
	stdout *bufio.Writer
)

func init() {
	nstr = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func main() {
	defer stdout.Flush()
	n := nint()
	k := nint()
	aList := getIntSlice(n)

	sumList := make([]int, 0)
	for i:=0;i<n ;i++  {
		for j:=i+1;j<n+1 ;j++  {
			sum := 0
			for tmp:=i;tmp<j ;tmp++  {
				sum += aList[tmp]
			}
			sumList = append(sumList, sum)
		}
	}
	var (
		ans int
		count int
	)
	for i:=40; i>=0; i--{
		checkNum := 1 << uint(i)
		for j:=0;j<len(sumList) ;j++  {
			logical := checkNum & sumList[j]
			if logical !=0{
				count ++
			}
		}
		if count >= k{
			ans += checkNum
			tmp := make([]int, 0)
			for m:=0;m<len(sumList) ;m++  {
				if sumList[m] &( 1 << uint(i)) !=0{
					tmp = append(tmp, sumList[m])
				}

			}
			sumList =  tmp
		}
		count = 0

	}
	fmt.Println(ans)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func nint64() int64 {
	i, err := strconv.ParseInt(nstr(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func nint() int {
	return int(nint64())
}

func getIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = nint()
	}
	return b
}

func getStringSlice(n int) []string {
	b := make([]string, n)
	for i := 0; i < n; i++ {
		b[i] = nstr()
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}

func contains(s []int, e int) bool {
	for _, a := range s {
		if a == e {
			return true
		}
	}
	return false
}

func bin(i int, prefix bool) string {
	i64 := int64(i)

	if prefix {
		return "0b" + strconv.FormatInt(i64, 2)
	} else {
		return strconv.FormatInt(i64, 2)
	}
}

func strReverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}

	return string(runes)
}
Problem p03219 (python)

Fixed submission:
X, Y = map(int, input().split())

print(X + Y //2)

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

p_list = []
y_list = []
shi_map = {}

for i in range(M):
    p, y = map(int, input().split())
    p_list.append(p)
    y_list.append(y)
    if p in shi_map:
        shi_map[p].append(y)
    else:
        shi_map[p] = [y]
shi_map2 = {}
for k, v in shi_map.items():
    v = sorted(v)
    shi_map2[k] = v

for i in range(M):
    p = p_list[i]
    y = y_list[i]
    j = shi_map2[p].index(y)
    p_str = str(p).zfill(6)
    j_str = str(j+1).zfill(6)
    print(p_str + j_str)
Problem p03240 (python)

Fixed submission:
N = int(input())

in_list = []
x0, y0, h0 = 0, 0, 0
for i in range(N):
    xyh = list(map(int, input().split()))
    in_list.append(xyh)

for i in range(N):
    if in_list[i][2]:
        x0, y0, h0 = in_list[i]

for Cx in range(0, 101):
    for Cy in range(0, 101):
        for xyh in in_list:
            x, y, h = xyh[0], xyh[1], xyh[2]
            H = h0 + abs(x0-Cx) + abs(y0-Cy)
            if h != max(H-abs(x-Cx)-abs(y-Cy), 0):
                break
        else:
            print(Cx, Cy, H)

Buggy submission (verdict: Runtime Error):
N = int(input())

in_list = []
for i in range(N):
    xyh = list(map(int, input().split()))
    in_list.append(xyh)

H = []
xy = []

for i, xyh in enumerate(in_list):
    x, y, h = xyh[0], xyh[1], xyh[2]

    if i == 0:
        for x1 in range(0, 101):
            for y1 in range(0, 101):
                H1 = h + abs(x-x1) + abs(y-y1)
                H.append(H1)
                xy.append([x1, y1])
    else:
        tmpH = []
        tmpxy = []
        for xy0, h0 in zip(xy, H):
            tm = h0-abs(x-xy0[0])-abs(y-xy0[1])
            if h == max(0, tm):
                tmpH.append(h0)
                tmpxy.append([xy0[0], xy0[1]])
        H = tmpH
        xy = tmpxy

print(xy[0][0], end=" ")
print(xy[0][1], end=" ")
print(H[0], end=" ")
Problem p03262 (python)

Fixed submission:
N, X = map(int, input().split())
x_list = list(map(int, input().split()))

x_list.sort()
def gcd(a, b):
    if a >= b:
        return a if b == 0 else gcd(b, a % b)
    else:
        return gcd(b, a)


D = abs(X-x_list[0])
for i in range(0, N):
    D = gcd(D,  abs(x_list[i]-X))

print(D)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
N = 0
a_map = []
for i in range(H):
    a = list(map(int, input().split()))
    a_map.append(a)
result = []
for i in range(H):
    for j in range(W):
        if a_map[i][j]%2==1:
            if j < W - 1:
                N += 1
                result.append([i + 1, j + 1, i + 1, j + 2])
                a_map[i][j + 1] += 1;
                a_map[i][j] -= 1;
            elif i < H - 1:
                N += 1;
                result.append([i + 1, j + 1, i + 2, j + 1])
                a_map[i][j] -= 1;
                a_map[i + 1][j] += 1;
print(N)
for a in result:
    print(a[0], a[1], a[2], a[3])

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
x_list = list(map(int, input().split()))

x_list.sort()
import math
if N ==1:
    print(x_list[0]-X)
    exit()

if N==2:
    g1 = abs(X-x_list[0])
    g2 = math.gcd(g1, x_list[1]-x_list[0])
    print(g2)
    exit()

m0 = abs(X - x_list[0])

D = 10**9
for i in range(N-2):
    m1 = abs(x_list[i] - x_list[i+1])
    m2 = abs(x_list[i] - x_list[i+2])
    g = math.gcd(m1, m2)

    if g <= D:
        D = g
print(D)

Buggy submission (verdict: Runtime Error):
import math
N, X = map(int, input().split())
x_list = list(map(int, input().split()))

x_list.sort()
if N ==1:
    print(x_list[0]-X)
    exit()

if N==2:
    g1 = abs(X-x_list[0])
    g2 = math.gcd(g1, x_list[1]-x_list[0])
    print(g2)
    exit()

m0 = abs(X - x_list[0])

D = 10**9
for i in range(N-2):
    m1 = abs(x_list[i] - x_list[i+1])
    m2 = abs(x_list[i] - x_list[i+2])
    g = math.gcd(m1, m2)

    if g <= D:
        D = g
print(D)

Buggy submission (verdict: Runtime Error):
import math
N, X = map(int, input().split())
x_list = list(map(int, input().split()))

x_list.sort()
if N ==1:
    print(x_list[0]-X)
    exit()

m0 = abs(X - x_list[0])

D = 10**9
for i in range(N-1):
    m1 = abs(x_list[i] - x_list[i+1])
    g = math.gcd(m1, m0)

    if D >= g:
        D = g
print(D)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
x_list = list(map(int, input().split()))
import math
x_list.sort()
if N ==1:
    print(x_list[0]-X)
    exit()

m0 = abs(X - x_list[0])

D = float("inf")
for i in range(N-1):
    m1 = abs(x_list[i] - x_list[i+1])
    g = math.gcd(m1, m0)

    if g <= D:
        D = g
print(D)
Problem p03274 (python)

Fixed submission:
N, K = map(int, input().split())
x_list = list(map(int, input().split()))

result = []
for i in range(N-(K-1)):
    start = i
    end = i + (K -1)
    result.append(abs(x_list[start]) + abs(x_list[end] - x_list[start]))
    result.append(abs(x_list[end]) + abs(x_list[end] - x_list[start]))
print(min(result))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
x_list = list(map(int, input().split()))

result = []
for i in range(N-K):
    start = i
    end = i + K 
    result.append(abs(x_list[start] + abs(x_list[end] - x_list[start])))
    result.append(abs(x_list[end]) +  abs(x_list[end] - x_list[start] ))
print(min(result))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
x_list = list(map(int, input().split()))

result = []
for i in range(N-K):
    start = i
    end = i + K -1
    result.append(abs(x_list[start] + abs(x_list[end] - x_list[start])))
    result.append(abs(x_list[end]) +  abs(x_list[end] - x_list[start] ))
print(min(result))
Problem p03377 (python)

Fixed submission:
A, B, X = map(int, input().split())
if A + B < X:
    print("NO")
elif A > X:
    print("NO")
else :
    print("YES")

Buggy submission (verdict: Runtime Error):
A, B, X = map(int, input.split())
if A + B < X:
    print("NO")
elif A > X:
    print("NO")
else :
    print("YES")
Problem p03407 (python)

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

if A + B >= C:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
red = []
for i in range(n):
    a, b = map(int, input().split())
    red.append((a, b))
 
blue = []
for i in range(n):
    c, d = map(int, input().split())
    blue.append((c, d))
 
red = sorted(red, key=lambda x: x[1])
blue.sort()
 
count = 0
while len(blue) >= 1:
    c, d = blue.pop()
    tmp = []
    r = []
    while len(red) >= 1:
        a, b = red.pop(0)
        if a < c and b < d:
            r.append((a, b))
        else:
            tmp.append((a, b))
    if len(r) >= 1:
        count += 1
        r = sorted(r, key=lambda x:x[1])
        r.pop()
        tmp.extend(r)
    red.extend(tmp)
print(count)
Problem p03469 (python)

Fixed submission:
S = input()
print(S.replace("2017", "2018"))

Buggy submission (verdict: Runtime Error):
N, H = map(int, input().split())
a_list = []
b_list = []
for i in range(N):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)
count = 0
a = max(a_list)
b_list.sort()
while True:
    if len(b_list) >= 1:
        if b_list[-1] >= a:
            b = b_list.pop(-1)
            H -= b
            count += 1
            if H <= 0:
                break
        else:
            H -= a
            count += 1
            if H <= 0:
                break
    else:
        H -= a
        count += 1
        if H <= 0:
            break
        
print(count)
Problem p03471 (python)

Fixed submission:
N, Y = map(int, input().split())

x = -1
y = -1
z = -1

for a in range(N+1):
    for b in range(N-a+1):
        c = N - a -b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            x, y, z = a, b, c
            print("{} {} {}".format(x, y, z))
            exit()
print("{} {} {}".format(x, y, z))

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

x = -1
y = -1
z = -1

for a in range(N):
    for b in range(N):
        c = N - a -b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            x, y, z = a, b, c
            print(f"{x} {y} {z}")
            exit()
print(f"{x} {y} {z}")
Problem p03472 (python)

Fixed submission:
N, H = map(int, input().split())
a_list = []
b_list = []
for i in range(N):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)
count = 0
a = max(a_list)
b_list.sort()
while len(b_list) >= 1 and H >= 1:
    if b_list[-1] >= a:
        b = b_list.pop(-1)
        H -= b
        count += 1
    else:
        break
if H <= 0:
    print(count)
else:
    tmp = H // a if H % a == 0 else H //a + 1
    print(count + tmp)

Buggy submission (verdict: Runtime Error):
N, H = map(int, input().split())
a_list = []
b_list = []
for i in range(N):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)
count = 0
a = max(a_list)
b_list.sort()
while len(b_list) >= 1 or H >= 1:
    if b_list[-1] >= a:
        b = b_list.pop(-1)
        H -= b
        count += 1
    else:
        break
if H <= 0:
    print(count)
else:
    tmp = H // a if H % a == 0 else H //a + 1
    print(count + tmp)
Problem p03488 (python)

Fixed submission:
s = input()
x, y = map(int, input().split())
command = s.split("T")

command_length = len(command)

x_command = []
y_command = []
for i in range(command_length):
    c = len(command[i])
    if i % 2 == 0:
        x_command.append(c)

    else:
        y_command.append(c)
x -= x_command.pop(0)
x_command.sort(reverse=True)
y_command.sort(reverse=True)

c_x = 0
c_y = 0
for c in x_command:
    if x - c_x >= 0:
        c_x += c
    else:
        c_x -= c

for c in y_command:
    if y - c_y > 0:
        c_y += c
    else:
        c_y -= c
if c_x == x and c_y == y:
    print("Yes")
else:
    print("No")

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

command_length = len(command)
x_command = command_length // 2
y_command = command_length // 2
if command_length % 2 != 0:
    x_command += 1

dpx = [[False for _ in range(8000 + 1)] for _ in range(x_command + 1)]
dpx[0][4000] = True
dpy = [[False for _ in range(8000 + 1)] for _ in range(y_command + 1)]
dpy[0][4000] = True

for i in range(1, x_command + 1):
    f = len(command[2 * (i - 1)])
    for j in range(f, 8000 + 1 - f):
        if dpx[i - 1][j - f] or dpx[i - 1][j + f]:
            dpx[i][j] = True

for i in range(1, y_command + 1):
    f = len(command[2 * (i - 1) + 1])
    for j in range(f, 8000 + 1 - f):
        if dpy[i - 1][j - f] or dpy[i - 1][j + f]:
            dpy[i][j] = True

if dpx[x_command][4000 + x] and dpy[y_command][4000 + y]:
    print("Yes")
else:
    print("No")
Problem p03501 (python)

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

print(min(A*N, B))

Buggy submission (verdict: Runtime Error):
N, C = map(int, input().split())
items = []
for i in range(N):
    items.append(tuple(map(int, input().split())))

times = [0] * 2 * (10 ** 5 + 1)
channel = [[0] * 2 * (10 ** 5 + 1) for _ in range(C)]
for i in range(N):
    s, t, c = items[i]
    c -= 1
    channel[c][2 * s - 1] += 1
    channel[c][2 * t] -= 1

for c in range(C):
    for i in range(len(times) - 1):
        channel[c][i + 1] += channel[c][i]
        if channel[c][i + 1] >= 1:
            times[i + 1] += 1

print(max(times))
Problem p03565 (python)

Fixed submission:
S = input()
T = input()

start = -1
for i in range(len(S)-len(T)+1):
    match = True
    for j in range(len(T)):
        if not (S[i+j] == T[j] or S[i+j] == "?"):
            match = False
    if match:
        start = i


if start == -1:
    print('UNRESTORABLE')
else:
    result = S[:start] + T + S[start+len(T):]
    print(result.replace("?", "a"))

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
tmp = ''
start = 0
result_list = []
for i, s in enumerate(S):
    if s == '?':
        start = i
        tmp += s
    elif s == T[len(tmp)]:
        start = i
        tmp += s
    else:
        tmp = ''
    if len(tmp) == len(T):
        while start + 1 <= len(S) and S[start + 1] == '?':
            start += 1
        result = S[:start - len(T) + 1] + T + S[start + 1:]
        result_list.append(result.replace('?', 'a'))
        tmp = ''
if len(result_list) == 0:
    print('UNRESTORABLE')
else:
    print(result_list[-1])

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
result = []

t_length = len(T)

tmp = ''
result = ''
start = 0
result_list = []
for i, s in enumerate(S):
    if s == '?':
        start =i
        tmp += s
        result += s
    elif s == T[len(tmp)]:
        start = i
        tmp += s
    else:
        tmp = ''
        result += s
    if len(tmp) == len(T):
        while S[start+1] == '?':
            start += 1
        result = S[:start-len(T)+1] + T + S[start+1:]
        result_list.append(result.replace('?', 'a'))
        tmp = ''
if len(result_list) == 0:
    print('UNRESTORABLE')
else:
    print(result_list[-1])
Problem p03612 (python)

Fixed submission:
N = int(input())
p_list = list(map(int, input().split()))

count = 0
for i in range(N-1):
    if p_list[i] == i + 1:
        count += 1
        p_list[i+1] = p_list[i]
if p_list[N-1] == N:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n + 1)]
        self.rank = [0 for _ in range(n + 1)]
        self.weight = [0 for _ in range(n + 1)]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            y = self.find(self.parent[x])
            self.weight[x] += self.weight[self.parent[x]]
            self.parent[x] = y
            return y

    def union(self, x, y, w):
        rx = self.find(x)
        ry = self.find(y)
        if self.rank[rx] < self.rank[ry]:
            self.parent[rx] = ry
            self.weight[rx] = w - self.weight[x] + self.weight[y]
        else:
            self.parent[ry] = rx
            self.weight[ry] = -w - self.weight[y] + self.weight[x]
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

    def check_same(self, x, y):
        return self.find(x) == self.find(y)

    def diff(self, x, y):
        return self.weight[x] - self.weight[y]


N = int(input())
p_list = list(map(int, input().split()))
unionfind = UnionFind(N)
for i in range(N - 1):
    p = p_list[i]
    p2 = p_list[i + 1]
    unionfind.union(p, p2, 1)

diff_list = []
for i in range(N):
    diff_list.append(unionfind.diff(i+1, p_list[i]))

count = 0
f = True
for i in range(len(diff_list)):
    if diff_list[i] == 0:
        diff_list[i+1] = -1
        count += 1
print(count)
Problem p03645 (python)

Fixed submission:
N, M = map(int, input().split())
line = []

for i in range(M):
    ab = list(map(int, input().split()))
    line.append(ab)

start = 1
end = N
first = set()
second = set()

for l in line:
    if end in l:
        second.add(l[0])
        second.add(l[1])
    elif start in l:
        first.add(l[1])
        first.add(l[0])


for f in first:
    if f in second:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
line = []

for i in range(M):
    ab = list(map(int, input().split()))
    line.append(ab)

start = 1
end = N
first = set()
second = set()

for l in line:
    if end in l:
        second.add(l[0])
        second.add(l[1])
    elif start in l:
        first.add(l[1])
        first.add(l[0])
first.remove(start)
second.remove(end)

for f in first:
    if f in second:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')
Problem p03659 (python)

Fixed submission:
N = int(input())
a_list = list(map(int, input().split()))

a_sum = sum(a_list)
min_num = float("inf")
r = []

for i in range(1, N):
    if len(r) == 0:
        r.append(a_list[0])
    else:
        r.append(r[i-2] + a_list[i-1])

    x = r[i-1]
    y = a_sum - x
    if min_num >= abs(x-y):
        min_num = abs(x-y)
print(min_num)

Buggy submission (verdict: Runtime Error):
N = int(input())
a_list = list(map(int, input().split()))

a_sum = sum(a_list)
min_num = float("inf")
r = []

for i in range(1, N):
    if len(r) == 0:
        r.append(a_list[0])
    else:
        r.append(r[i-1] + a_list[i])

    x = r[i-1]
    y = a_sum - x
    if min_num >= abs(x-y):
        min_num = abs(x-y)
print(min_num)
Problem p03665 (python)

Fixed submission:
N, P = map(int, input().split())
a_list = list(map(int, input().split()))
a=[i%2 for i in a_list]
if sum(a)>0:print(2**(N-1))
else:
    if P==0:
        print(2**N)
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
N, P = map(int, input().split())
a_list = list(map(int, input().split()))
a=[i%2 for i in a_list]
if sum(a)>0:print(2**(N-1))
else:
    if M==0:
        print(2**N)
    else:
        print(0)
Problem p03693 (python)

Fixed submission:
r, g, b = input().split()
print("YES" if int(r+g+b) % 4 == 0 else "NO")

Buggy submission (verdict: Runtime Error):
rgb = input()
print("YES" if int(rgb) % 4 == 0 else "NO")
Problem p03713 (python)

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

result = []
for h in range(1, H):
    Sa = W * h

    remain = H - h
    h2 = (remain + 1) // 2
    Sb1 = W * h2
    Sc1 = W * (remain - h2)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    w = (W + 1) // 2
    Sb2 = w * remain
    Sc2 = (W - w) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

for w in range(1, W):
    Sa = H * w

    remain = W - w
    w3 = (remain + 1) // 2
    Sb1 = H * w3
    Sc1 = H * (remain - w3)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    h = (H + 1) // 2
    Sb2 = h * remain
    Sc2 = (H - h) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

print(min(result))

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

result = []
for h in range(1, (H+1)//2):
    Sa = W * h

    remain = H - h
    h2 = (remain + 1) // 2
    Sb1 = W * h2
    Sc1 = W * (remain - h2)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    w = (W + 1) // 2
    Sb2 = w * remain
    Sc2 = (W - w) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

for w in range(1, (W+1)//2):
    Sa = H * w

    remain = W - w
    w3 = (remain + 1) // 2
    Sb1 = H * w3
    Sc1 = H * (remain - w3)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    h = (H + 1) // 2
    Sb2 = h * remain
    Sc2 = (H - h) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

print(min(result))