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

Fixed submission:
n,m = map(int,input().split())
k_and_s = list(list(map(int,input().split()))for i in range(m))
p = list(map(int,input().split()))

k = []
s = []
switch = list([[0 for i in range(m)]for i in range(n)])
switch_1 = [0 for i in range(n)]
cnt = 0

for i in range(1,len(p)+1):
    if p[i-1] == 1:
        cnt += 2**(m-i)
    if i == m:
        p_1 = cnt

for i in range(m):
    k.append(k_and_s[i][0:1][0])
    s.append(k_and_s[i][1:])

for i in range(len(s)):
    for j in range(len(s[i])):
        switch[s[i][j]-1][i] = 1

for i in range(len(switch)):
    cnt = 0
    for j in range(1,len(switch[i])+1):
        if switch[i][j-1] == 1:
            cnt += 2**(m-j)
        if j == m:
            switch_1[i] = cnt

ans = 0
for i in range(1<<n):
    t = 0
    for j in range(n):
        if i >> j & 1 != 0:
            t ^= switch_1[j]
    if t==p_1:
        ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m = map(int,input().split())
k_and_s = list(list(map(int,input().split()))for i in range(m))
p = list(map(int,input().split()))
k = []
s = []
p1 = np.array(p)
print("p1 = ",p1,"\n")
for i in range(m):
    k.append(k_and_s[i][0:1][0])
    s.append(k_and_s[i][1:])
switch = np.array([[0 for i in range(m)]for i in range(n)])
for i in range(len(s)):
    for j in range(len(s[i])):
        switch[s[i][j]-1][i] = 1
ans = 0
for s in range(1<<n):
    t = 0
    for i in range(n):
        if s>>i & 1 == 0:
            t ^= switch[i]
            print("t = ",t,"\n")
            if t == p1:
                ans +=1
            
print("\nswitch = ",switch,"\n")
print("m = ",m)
print("n = ",n)
print("k and s = ",k_and_s)
print("k = ",k)
print("s = ",s)
print("p = ",p1)
#print(len(s))
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
k1 = list(list(map(int,input().split()))for i in range(m))
p = map(int,input().split())
s = list(k1[i][1:]for i in range(m))
ans = 0

for i in range(2**n):
    on = True
    for j in range(m):
        on = bin(s[j]&i)lcount('1')%2 == p[j]
        if not on:
            break
    ans += on
print(ans)
Problem p02983 (python)

Fixed submission:
L, R = map(int, input().split())

ans = 2018
R = min(R, L+2020)
for i in range(L, R+1):
    f = False
    for j in range(i+1, R+1):
        m = (i*j)%2019
        if  m  == 0:
            ans = m
            f = True
            break     
        ans = min(ans, m)
    if f:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
for i in range(L, R+1):
    f = False
    for j in range(i+1, R+1):
        m = (i*j)%2019
        if  m  == 0:
            print(0)
            f = True
            break     
        ans = min(ans, m)
    if f:
        break
print(ans)
Problem p02995 (python)

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

def gcd(m, n):
    x=max(m, n)
    y=min(m, n)
    if x%y == 0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z

def lcm(x, y):
    return (x * y) // gcd(x, y)

lcmCD=lcm(C, D)
ans=B-A+1
ans-=((B//C) - ((A-1)//C))
ans-=((B//D) - ((A-1)//D))
ans+=((B//lcmCD) - ((A-1)//lcmCD))
print(ans)

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

ans = 2019
for i in range(L, R):
    f = False
    for j in range(i, R):
        if  ((i*j) % 2019) == 0:
            print(0)
            break
        ans = min(ans, (i*j)%2019)
    if f:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import math

A, B, C, D = map(int, input().split())
ans=0

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

lcmCD=lcm(C, D)
ans=B-A+1
ans-=((B//C) - (A//C))
ans-=((B//D) - (A//D))
ans+=((B//lcmCD) - (A//lcmCD))
print(ans)
Problem p03000 (python)

Fixed submission:
n, x = map(int, input().split())
l = [int(i) for i in input().split()] 

d = 0
i = 0
if x > 0:
    while d <= x:
        d = d + l[i]
        i = i + 1
        if i >= n:
            break
    if d > x:
        print(i)
    elif d <= x:
        print(n+1)
elif x <= 0:
    print(1)

Buggy submission (verdict: Runtime Error):
, x = map(int, input().split())
l = [int(i) for i in input().split()] 

d = 0
i = 0
if x > 0:
    while d <= x:
        d = d + l[i]
        i = i + 1
        if i >= n:
            i = i + 1
            break
    print(i)
elif x <= 0:
    print(1)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = [int(i) for i in input().split()] 

d = 0
i = 0
if x > 0:
    while d <= x:
        d = d + l[i]
        i = i + 1
    print(i)
elif x <= 0:
    print(1)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = [int(i) for i in input().split()] 

d = 0
if x > 0:
    for i in range(n):
        d = d + l[i]
        print(i, l[i])
        if d > x:
            break
    print(i+1)
elif x <= 0:
    print(1)
'''
Problem p03086 (python)

Fixed submission:
s = input()
acgt='ACGT'

x = 0; l=[]
for c in s:
    if c in acgt:
        x += 1
    else:
        l.append(x)
        x = 0
l.append(x)
print(max(l))

Buggy submission (verdict: Runtime Error):
s = input()
acgt='ACGT'

x = 0; l=[]
for c in s:
    if c in acgt:
        x += 1
    else:
        l.append(x)
        x = 0
print(max(l))
Problem p03471 (python)

Fixed submission:
import sys

stdin = sys.stdin

na = lambda: list(map(int, ns().split()))
ns = lambda: stdin.readline()

N, Y = na()

ans="-1 -1 -1"
for i in range(N+1):
    if (i * 10000) > Y:
        continue
    for j in range(N+1-i):
        k = N - i - j
        if ((i * 10000) + (j * 5000)) > Y:
            continue
        if (i*10000) + (j*5000) + (k*1000) == Y:
            ans = str(i) + " " + str(j) + " " + str(k)
            break
    else:
        continue
    break

print(ans)

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

na = lambda: list(map(int, ns().split()))
ns = lambda: stdin.readline()

N, Y = na()

ans="-1 -1 -1"
for i in range(N+1, -1, -1):
    if (i * 10000) > Y:
        continue
    for j in range(N+1-i):
        k = n - i - j
        if ((i * 10000) + (j * 5000)) > Y:
            continue
        if (i*10000) + (j*5000) + (k*1000) == Y:
            ans = str(i) + " " + str(j) + " " + str(k)
            break
    else:
        continue
    break

print(ans)
Problem p02850 (python)

Fixed submission:
from sys import setrecursionlimit


setrecursionlimit(10**6)



n = int(input())
t = [list(map(int, input().split())) for _ in range(n-1)]



hands = [0 for _ in range(n+1)]
for a, b in t:
    hands[a] += 1
    hands[b] += 1

number_of_colors = max(*hands)

def next_color(i):
    return i+1 if i < number_of_colors else 1



class edge():
    def __init__(self, en):
        self.ends = en
        self.color = 0

    def set_color(self, co):
        self.color = co

class nord():
    def __init__(self, tr):
        self.parent = tr
        self.edges = []

    def add(self, ed):
        self.edges.append(ed)

    def set_color(self, previous_color):
        co = next_color(previous_color)
        for ed in self.edges:
            if ed.color == 0:
                ed.set_color(co)
                for i in ed.ends:
                    no = self.parent.nords[i-1]
                    if self is not no:
                        no.set_color(co)
                co = next_color(co)

class tree():
    def __init__(self):
        self.nords = []

    def add_nord(self, no):
        self.nords.append(no)

    def add_edge(self, ed):
        for i in ed.ends:
            self.nords[i-1].add(ed)

    def set_color(self):
        self.nords[0].set_color(0)


tr = tree()
for _ in range(n):
    no = nord(tr)
    tr.add_nord(no)

e_tree = []
for en in t:
    ed = edge(en)
    e_tree.append(ed)
    tr.add_edge(ed)

tr.set_color()

print(number_of_colors)
for e in e_tree:
    print(e.color)

Buggy submission (verdict: Runtime Error):
n = int(input())
t = [list(map(int, input().split())) for _ in range(n-1)]



hands = [0 for _ in range(n+1)]
for a, b in t:
    hands[a] += 1
    hands[b] += 1

number_of_colors = max(*hands)

def next_color(i):
    return i+1 if i < number_of_colors else 1



class edge():
    def __init__(self, en):
        self.ends = en
        self.color = 0

    def set_color(self, co):
        self.color = co

class nord():
    def __init__(self, tr):
        self.parent = tr
        self.edges = []

    def add(self, ed):
        self.edges.append(ed)

    def set_color(self, previous_color):
        co = next_color(previous_color)
        for ed in self.edges:
            if ed.color == 0:
                ed.set_color(co)
                for i in ed.ends:
                    no = self.parent.nords[i-1]
                    if self is not no:
                        no.set_color(co)
                co = next_color(co)

class tree():
    def __init__(self):
        self.nords = []

    def add_nord(self, no):
        self.nords.append(no)

    def add_edge(self, ed):
        for i in ed.ends:
            self.nords[i-1].add(ed)

    def set_color(self):
        self.nords[0].set_color(0)


tr = tree()
for _ in range(n):
    no = nord(tr)
    tr.add_nord(no)

e_tree = []
for en in t:
    ed = edge(en)
    e_tree.append(ed)
    tr.add_edge(ed)

tr.set_color()

print(number_of_colors)
for e in e_tree:
    print(e.color)
Problem p02963 (python)

Fixed submission:
import math
from collections import Counter

s = int(input())

def primes(n) :
    ps = [2]
    for i in range(3, n+1) :
        for p in ps :
            if i%p == 0 :
                break
        else :
            ps.append(i)
    return ps

def factorint(n) :
    ps = primes(n)
    l = []
    while n != 1 :
        for p in ps :
            if n%p == 0 :
                n //= p
                l.append(p)
                break
    return Counter(l)

a = math.ceil(math.sqrt(s))
print(0, 0, a, 1, a**2-s, a)

Buggy submission (verdict: Runtime Error):
from math import *
s=int(input())
a=math.ceil(math.sqrt(s))
print(0,0,a,1,a**2-s,a)

Buggy submission (verdict: Runtime Error):
import math
a = math.ceil(math.sqrt(s))
print(0, 0, a, 1, a**2-s, a)
Problem p02975 (python)

Fixed submission:
from math import log2, floor
from operator import or_
from functools import reduce

n = int(input())
a = list(map(int, input().split()))

if max(a) == 0 :
    bl = [0]
else :
    bl = [0 for _ in range(floor(log2(max(a)))+1)]
for ai in a :
    aj = ai
    if ai == 0 :
        pass
    else :
        for i in range(floor(log2(ai))+1) :
            if aj & 1 == 1 :
                bl[i] += 1
            aj >>= 1

ans = reduce(or_, map(lambda x : x&1, bl))
if ans :
    print("No")
else :
    print("Yes")

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

if max(a) == 0 :
    bl = [0]
else :
    bl = [0 for _ in range(floor(log2(max(a)))+1)]
for ai in a :
    aj = ai
    if ai == 0 :
        pass
    else :
        for i in range(floor(log2(ai))+1) :
            if aj & 1 == 1 :
                bl[i] += 1
            aj >>= 1

ans = reduce(or_, map(lambda x : x&1, bl))
if ans :
    print("No")
else :
    print("Yes")

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

if True :
    n = int(input())
    a = list(map(int, input().split()))
else :
    n = 10**5
    a = list(np.full(3, 0))

if max(a) == 0 :
    bl = [0]
else :
    bl = [0 for _ in range(floor(log2(max(a)))+1)]
for ai in a :
    aj = ai
    if ai == 0 :
        pass
    else :
        for i in range(floor(log2(ai))+1) :
            if aj & 1 == 1 :
                bl[i] += 1
            aj >>= 1

ans = reduce(or_, map(lambda x : x&1, bl))
if ans :
    print("No")
else :
    print("Yes")

Buggy submission (verdict: Runtime Error):
from math import log2, floor
from operator import or_
from functools import reduce
import numpy as np

if True :
    n = int(input())
    a = list(map(int, input().split()))
else :
    n = 10**5
    a = list(np.random.randint(0, 10**9, n))

bl = [0 for _ in range(floor(log2(max(a)))+1)]
for ai in a :
    aj = ai
    for i in range(floor(log2(ai))+1) :
        if aj & 1 == 1 :
            bl[i] += 1
        aj >>= 1

ans = reduce(or_, map(lambda x : x&1, bl))
if ans :
    print("No")
else :
    print("Yes")

Buggy submission (verdict: Runtime Error):
from sys import setrecursionlimit
from math import log2, floor
from operator import or_
from functools import reduce

setrecursionlimit(100000)

n = int(input())
a = list(map(int, input().split()))

bl = [0 for _ in range(floor(log2(max(a)))+1)]
for ai in a :
    aj = ai
    for i in range(floor(log2(ai))+1) :
        if aj & 1 == 1 :
            bl[i] += 1
        aj >>= 1

ans = reduce(or_, map(lambda x : x&1, bl))
if ans :
    print("No")
else :
    print("Yes")

Buggy submission (verdict: Runtime Error):
from math import log2, floor
from operator import or_
from functools import reduce

n = int(input())
a = list(map(int, input().split()))

bl = [0 for _ in range(floor(log2(max(a)))+1)]
for ai in a :
    aj = ai
    for i in range(floor(log2(ai))+1) :
        if aj & 1 == 1 :
            bl[i] += 1
        aj >>= 1

ans = reduce(or_, map(lambda x : x&1, bl))
if ans :
    print("No")
else :
    print("Yes")
Problem p02993 (python)

Fixed submission:
S = input()
if "11" in S or "22" in S or "33" in S or \
   "44" in S or "55" in S or "66" in S or \
   "77" in S or "88" in S or "99" in S or "00" in S :
    print("Bad")
else :
    print("Good")

Buggy submission (verdict: Runtime Error):
import fractions
a, b, c, d = list(map(int, input().split()))
e = c * d // fractions.gcd(c, d)

cko = b//c - (a-1)//c
dko = b//d - (a-1)//d
eko = b//e - (a-1)//e
print(b-a+1-cko-dko+eko)
Problem p02995 (python)

Fixed submission:
import fractions
a, b, c, d = list(map(int, input().split()))
e = c * d // fractions.gcd(c, d)

cko = b//c - (a-1)//c
dko = b//d - (a-1)//d
eko = b//e - (a-1)//e
print(b-a+1-cko-dko+eko)

Buggy submission (verdict: Runtime Error):
import math
a, b, c, d = list(map(int, input().split()))
e = c * d / math.gcd(c, d)

cko = math.floor(b/c) - math.ceil(a/c) + 1
dko = math.floor(b/d) - math.ceil(a/d) + 1
cdko = math.floor(b/e) - math.ceil(a/e) + 1
print(b-a+1-cko-dko+cdko)
Problem p03035 (python)

Fixed submission:
a, b = list(map(int, input().split()))
if a > 12 :
    print(b)
elif a > 5 :
    print(b//2)
else :
    print(0)

Buggy submission (verdict: Runtime Error):
#D
n, m = list(map(int, input().split()))
alist = list(map(int, input().split()))
for i in range(m) :
    b, c = list(map(int, input().split()))
    alist += [c] * min(n, b)
alist.sort()
print(sum(alist))
Problem p03037 (python)

Fixed submission:
n, m = list(map(int, input().split()))
llist = []
rlist = []
for i in range(m) :
    l, r = list(map(int, input().split()))
    llist.append(l)
    rlist.append(r)
ll = max(llist)
rr = min(rlist)
print(max(0, min(rr, n)-ll+1))

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
def cutterl(l, lst) :
    if lst == [] :
        return []
    elif lst[0] < l :
        return cutterl(l, lst[1:])
    else :
        return lst
def cutterr(r, lst) :
    if lst == [] :
        return []
    elif r < lst[-1] :
        return cutterr(r, lst[:-1])
    else :
        return lst
nlist = list(map(lambda x : x + 1, range(n)))
llist=[]
rlist=[]
for i in range(m) :
    l, r = list(map(int, input().split()))
    llist.append(l)
    rlist.append(r)
nlist = cutterl(max(llist), nlist)
nlist = cutterr(min(rlist), nlist)
print(len(nlist))

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
def cutterl(l, lst) :
    if lst == [] :
        return []
    elif lst[0] < l :
        return cutterl(l, lst[1:])
    else :
        return lst
def cutterr(r, lst) :
    if lst == [] :
        return []
    elif r < lst[-1] :
        return cutterr(r, lst[:-1])
    else :
        return lst
nlist = list(map(lambda x : x + 1, range(n)))
for i in range(m) :
    l, r = list(map(int, input().split()))
    nlist = cutterl(l, nlist)
    nlist = cutterr(r, nlist)
print(len(nlist))
Problem p03047 (python)

Fixed submission:
n, m = list(map(int, input().split()))
print(n-m+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
B_start, A_end, B__A, AB_in = 0, 0, 0, 0
for n in range(N) :
    star = input()
    if star[0] == "B" :
        B_start += 1
    if star[-1] == "A" :
        A_end += 1
        if star[0] == "B" :
            B__A += 1
    AB_in += star.count("AB")
    
if B_start == A_end and A_end == B__A :
    print(B__A+AB_in-1)
else :
    print(min(B_start, A_end)+AB_in)
Problem p03068 (python)

Fixed submission:
n = int(input())
s = input()
k = int(input())
for a in range(n) :
    if s[a] != s[k-1] :
        s = s[:a]+"*"+s[a+1:]
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())
for a in range(n) :
    if s[a] != s[k] :
        s = s[:a]+"*"+s[a+1:]
print(s)
Problem p03071 (python)

Fixed submission:
A, B = list(map(int, input().split()))
if A == B :
    print(2*A)
else :
    print(2*max(A, B)-1)

Buggy submission (verdict: Runtime Error):
A, B = list(map(int, input().split()))
if A == B :
    print(2*A)
else :
    print(2*max(a, b)-1)
Problem p03080 (python)

Fixed submission:
n,s=open(0);b=s.count("B");print("YNeos"[b>=int(n)-b::2])

Buggy submission (verdict: Runtime Error):
n,s=open(0);b=s.count("B");print("YNeos"[b>=n-b::2])
Problem p03105 (python)

Fixed submission:
a, b, c = list(map(int, input().split()))
print(min(b//a, c))

Buggy submission (verdict: Runtime Error):
a, b, c = int(input())
print(min(b//a, c))
Problem p03111 (python)

Fixed submission:
from itertools import product, combinations

n, *abc = list(map(int, input().split()))
ll = [int(input()) for _ in range(n)]

# 合成してから短縮/延長すればよい
# 合成方法を全探索する

ans = float("inf")
for n_use in range(3, n+1) : # 何本使うか
    for l_use in combinations(ll, n_use) : # どの竹を使うか
        for dist in product(*[range(3) for _ in range(n_use)]) : #竹をどう合成するか
            if len(set(dist)) != 3 :
                continue

            labc = [0, 0, 0]
            for i, l in zip(dist, l_use) :
                labc[i] += l
    
            diff = [abs(labc[i]-abc[i]) for i in range(3)]
            ans = min(ans, 10*(n_use-3)+sum(diff))

print(ans)

Buggy submission (verdict: Runtime Error):
import math
n, a, b, c = list(map(int, input().split()))
ll = tuple([int(input()) for _ in range(n)])

def nearest(key, lst) :
    ans = math.inf
    d = math.inf
    for el in lst :
        if abs(el - key) < d :
            ans = el
            d = abs(el - key)
    return ans, d

def tend(lln) :
    llm = list(lln)
    al, ad = nearest(a, llm)
    llm.remove(al)
    bl, bd = nearest(b, llm)
    llm.remove(bl)
    cl, cd = nearest(c, llm)
    return ad + bd + cd

def synth(lln) :
    lol = []
    for i in range(len(lln)-1) :
        for j in range(i+1, len(lln)) :
            llm = list(lln)
            lj = llm.pop(j)
            li = llm.pop(i)
            llm.append(li+lj)
            lol.append(tuple(llm))
    return lol

def synth2(lolln) :
    lol = []
    for lln in lolln :
        lol.extend(synth(lln))
    return tuple(lol)


ans = tend(ll)
lolln = set((ll,))
for i in range(5) :
    if n >= i+4 :
        lolln = set(synth2(lolln))
        for lln in lolln :
            ans = min(ans, 10*(i+1)+tend(lln))

print(ans)
Problem p03155 (python)

Fixed submission:
n,h,w=map(int,open(0).read().split());print((n-h+1)*(n-w+1))

Buggy submission (verdict: Runtime Error):
n,h,w=map(int,open(0).read().split);print((n-h+1)*(n-w+1))
Problem p03156 (python)

Fixed submission:
N,A,B,*P=map(int,open(0).read().split());b=len([p for p in P if p>A]);c=len([p for p in P if p>B]);print(min(N-b,b-c,c))

Buggy submission (verdict: Runtime Error):
N,A,B,*P=map(int,open(0).read().split());b=len(p for p in P if p>A);c=len(p for p in P if p>B);print(min(N-b,b-c,c))
Problem p03240 (python)

Fixed submission:
import numpy as np
n = int(input())
xyhl = [list(map(int, input().split())) for _ in range(n)]
xyhl1 = [xyh for xyh in xyhl if xyh[2] != 0]
xyhl0 = [xyh for xyh in xyhl if xyh[2] == 0]

tmaps = np.zeros((101, 101, len(xyhl1)), dtype="int64")
for d in range(len(xyhl1)) :
    for i in range(101) :
        for j in range(101) :
            x, y, h = xyhl1[d]
            tmaps[i, j, d] = abs(x-i)+abs(y-j)+h

tmap0 = np.zeros((101, 101, len(xyhl0)), dtype="int64")
for d in range(len(xyhl0)) :
    for i in range(101) :
        for j in range(101) :
            x, y, h = xyhl0[d]
            tmap0[i, j, d] = abs(x-i)+abs(y-j)+h

dmaps = np.diff(tmaps, axis=2)
xmap = np.logical_or.reduce(dmaps, axis=2)
place = np.where(np.logical_not(xmap))

for i, j in zip(place[0],place[1]) :
    for t in tmap0[i, j, :].flat :
        if tmaps[i, j, 0] > t :
            break
    else :
        ans = [i, j, tmaps[i, j, 0]]

print("{} {} {}".format(ans[0], ans[1], ans[2]))

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
xyhl = [list(map(int, input().split())) for _ in range(n)]

tmaps = np.zeros((101, 101, n), dtype="int64")
for d in range(n) :
    for i in range(101) :
        for j in range(101) :
            x, y, h = xyhl[d]
            tmaps[i, j, d] = abs(x-i)+abs(y-j)+h

dmaps = np.diff(tmaps, axis=2)
xmap = np.logical_or.reduce(dmaps, axis=2)
place = np.where(np.logical_not(xmap))
cx, cy = place[0][0], place[1][0]
h = tmaps[cx, cy, 0]
print("{} {} {}".format(cx, cy, h))
Problem p03262 (python)

Fixed submission:
from numpy import*;N,X=input().split();x=array(list(map(int,input().split())));g=lambda x,y:g(y%x,x)if y%x else x;print(abs(frompyfunc(g,2,1).reduce(x-int(X))))

Buggy submission (verdict: Runtime Error):
from numpy import*;N,X=input().split();x=array(list(map(int,input().split())));print(gcd.reduce(x-int(X)))
Problem p03263 (python)

Fixed submission:
H, W = map(int, input().split())
lastcol = []
anslist = []
for y in range(H) :
    A = list(map(int, input().split()))
    for x, a in enumerate(A) :
        if x == W-1 :
            lastcol.append(a)
        elif a%2 :
            anslist.append((y+1, x+1, y+1, x+2))
            A[x+1] += 1
for y, a in enumerate(lastcol) :
    if y == H-1 :
        pass
    elif a%2 :
        anslist.append((y+1, W, y+2, W))
        lastcol[y+1] += 1

print(len(anslist))
for ans in anslist :
    print(*ans)

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split());B=[];l=[]
for y in range(H):
  A=list(map(int,input().split()))
  for x in range(1,W):
    if A[x-1]%2:l.append((y+1,x,y+1,x+1));A[x]+=1
  B.append(A[x])
  if y and B[-2]%2:l.append((y,W,y+1,W));B[y]+=1
print(len(l))
for a in l:print(*a)
Problem p03294 (python)

Fixed submission:
print(-int(input())+sum(map(int,input().split())))

Buggy submission (verdict: Runtime Error):
n,a=open(0);print(eval(a.replace(" ","+")+"-"+n[:-1]))

Buggy submission (verdict: Runtime Error):
n,a=open(0);print(eval(a.replace(" ","+")+"-"+n))
Problem p03311 (python)

Fixed submission:
from statistics import median
N = int(input())
A = list(map(int, input().split()))
B = [a-i for i, a in enumerate(A)]
m = int(median(B))
print(sum(abs(b-m) for b in B))

Buggy submission (verdict: Runtime Error):
from math import log2
N = int(input())
A = list(map(int, input().split()))
B = [a-i for i, a in enumerate(A)]
m = sum(B)//N
l = int(log2(N))
print(min(sum(abs(b-m-i) for b in B)for i in range(-l,l)))
Problem p03416 (python)

Fixed submission:
print(sum(s[0]==s[4]and s[1]==s[3]for s in map(str,range(*map(sum,enumerate(map(int,input().split())))))))

Buggy submission (verdict: Runtime Error):
print(sum(s[0]==s[4]for s in map(str,range(*map(sum,enumerate(map(int,input().split()))))))if s[1]==s[3])
Problem p03425 (python)

Fixed submission:
from itertools import*;N,*S=open(0);print(sum(a*b*c for a,b,c in combinations([sum(1for s in S if s[0]==c)for c in"MARCH"],3)))

Buggy submission (verdict: Runtime Error):
from itertools import*;N,*S=open(0);print(sum(a*b*c for a,b,c in combinations(sum(1for s in S if s[0]==c)for c in"MARCH",3)))

Buggy submission (verdict: Runtime Error):
from itertools import*;N,*S=open(0);print(sum(a*b*c for a,b,c in combinations(sum(1for s in S if s[0]==c)for c in"MARCH",3)))