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

Fixed submission:
from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)

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

def main():
    N = int(input())
    g = defaultdict(list)
    for i in range(N-1):
        u, v, w = (int(_) for _ in input().split())
        g[u].append(edge(v, w))
        g[v].append(edge(u, w))

    color = [0] * (N+1)

    def dfs(ver):
        for e in g[ver]:
            if color[e.to] == 0 and e.cost%2 == 0:
                color[e.to] = color[ver]
                dfs(e.to)
            elif color[e.to] == 0 and e.cost%2 == 1:
                color[e.to] = (-1) * color[ver]
                dfs(e.to)
    color[1] = 1
    dfs(1)
    for i in range(1, N+1):
        if color[i] == -1: color[i] = 0
    print(*color[1:], sep='\n')
    return

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
class edge:
    def __init__(self, to, cost):
        self.to, self.cost = to, cost

def main():
    N = int(input())
    g = defaultdict(list)
    for _ in range(N-1):
        u, v, w = (int(_) for _ in input().split())
        g[u].append(edge(v, w))
        g[v].append(edge(u, w))

    color = [0] * (N+1)

    def dfs(ver):
        for e in g[ver]:
            if color[e.to] == 0 and e.cost%2 == 0:
                color[e.to] = color[ver]
                dfs(e.to)
            elif color[e.to] == 0 and e.cost%2 == 1:
                color[e.to] = (-1) * color[ver]
                dfs(e.to)
    color[1] = 1
    dfs(1)
    for i in range(1, N+1):
        if color[i] == -1: color[i] = 0
    print(*color[1:], sep='\n')
    return

if __name__ == '__main__':
    main()
Problem p03076 (python)

Fixed submission:
l = [int(input()) for _ in range(5)]
m = 100
ind = 100
res = 0
for i in range(5):
    if l[i]%10 == 0:
        continue
    if l[i]%10 < m:
        m = l[i]%10
        ind = i
for i in range(5):
    if i == ind:
        continue
    else:
        res += -(-l[i]//10)*10
if ind < 5:
    res += l[ind]
print(res)

Buggy submission (verdict: Runtime Error):
l = [int(input()) for _ in range(5)]
m = 100
ind = 100
res = 0
for i in range(5):
    if l[i]%10 == 0:
        continue
    if l[i]%10 < m:
        m = l[i]%10
        ind = i
for i in range(5):
    if i == ind:
        continue
    else:
        res += -(-l[i]//10)*10
res += l[ind]
print(res)
Problem p03254 (python)

Fixed submission:
N, x = [int(z) for z in input().split()]
children = [int(z) for z in input().split()]

children.sort()
sum = 0

for i in children:
    sum += i

if sum < x:
    print(N - 1)
elif sum == x:
    print(N)
else:
    cnt = 0
    for i in children:
        if x - i < 0:
            break
        else:
            x -= i
            cnt += 1
    print(cnt)

Buggy submission (verdict: Runtime Error):
N, x = [int(z) for z in input().split()]
children = [int(z) for z in input().split()]

children.sort()
sum = 0

for i in children:
    sum += i

if sum < x:
    print(N - 1)
elif sum == x:
    print(N)
else:
    for i in children:
        if x - i < 0:
            break
        else:
            x -= i
            cnt += 1
    print(cnt)

Buggy submission (verdict: Runtime Error):
N, x = [int(z) for z in input().split()]
children = [int(z) for z in input().split()]

children.sort()
sum = 0

for i in children:
    sum += i

if sum < x:
    print(N - 1)
elif sum == x:
    print(N)
else:
    for i in children:
        if x - i < 0:
            break
        else:
            x -= i
            cnt += 1
print(cnt)
Problem p03264 (python)

Fixed submission:
K = int(input())
print( K//2 * (K - K//2))

Buggy submission (verdict: Runtime Error):
K = int(input())
print( K//2 * (N - K//2))
Problem p03338 (python)

Fixed submission:
N = int(input())
S = input()
res = -1
for i in range(N):
  res = max(len(set(S[:i]) & set(S[i:])), res)
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input
res = -1
for i in range(N):
  res = max(len(set(S[:i]) & set(S[i:])), res)
print(res)
Problem p03386 (python)

Fixed submission:
a, b, k = [int(x) for x in input().split()]
r = range(a, b + 1)
for i in sorted(set(r[:k]) | set(r[-k:])):
    print(i)

Buggy submission (verdict: Runtime Error):
a, b, k = [int(x) for x in input().split()]
lst = list(range(a, b + 1))
res = []
res.extend(lst[:k])
res.extend(lst[-k:])
res = sorted(set(res))
for i in res:
    print(i)

Buggy submission (verdict: Runtime Error):
a, b, k = [int(x) for x in input().split()]
lst = list(range(a, b + 1))
res = []
res.extend(lst[:k])
res.extend(lst[-k:])
res = sorted(set(res))
print(*res, sep='\n')

Buggy submission (verdict: Runtime Error):
a, b, k = [int(x) for x in input().split()]
lst = list(range(a, b + 1))
res = []
res.extend(lst[:k])
res.extend(lst[-k:])
res = sorted(list(set(res)))
print(*res, sep='\n')
Problem p03409 (python)

Fixed submission:
def solve():
    N = int(input())
    R = [[int(x) for x in input().split()] for i in range(N)]
    B = [[int(x) for x in input().split()] for i in range(N)]
    B.sort()
    selected = set()
    for b in B:
        r_lst = []
        for i in range(len(R)):
            if i in selected: continue
            r = R[i]
            if r[0] < b[0] and r[1] < b[1]:
                r_lst.append(i)
        if len(r_lst) == 0:
            continue
        rym = -1
        rym_i = -1
        for i in r_lst:
            if rym < R[i][1]:
                rym = R[i][1]
                rym_i = i
        selected.add(rym_i)
    return len(selected)
if __name__ == '__main__':
    print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    R = [[int(x) for x in input().split()] for i in range(N)]
    B = [[int(x) for x in input().split()] for i in range(N)]
    B.sort()
    selected = set()
    for b in B:
        r_lst = []
        for i in range(len(R)):
            r = R[i]
            if r[0] < b[0] and r[1] < b[1]:
                r_lst.append(i)
        if len(r_lst) == 0:
            continue
        rym = -1
        rym_i = -1
        for i in len(r_lst):
            if rym < r_lst[i][1]:
                rym = r_lst[i][1]
                rym_i = i
        selected.add(i)
    return len(selected)
if __name__ == '__main__':
    print(solve())
Problem p03455 (python)

Fixed submission:
a = list(map(int, input().split()))
b = a[0]*a[1]
if b%2 == 0:
    print('Even')
else:
    print('Odd')

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
if (a[0]*a[1])%2 == 0:
	print('Even')
else
	print('Odd')
Problem p03469 (python)

Fixed submission:
str = input()
print(str.replace('7', '8', 1))

Buggy submission (verdict: Runtime Error):
str = input()
str[3] = '8'
print(str)
Problem p03474 (python)

Fixed submission:
a, b = [int(x) for x in input().split()]
num = '0123456789'
S = input()
flg = True
for i in range(len(S)):
  if i == a:
    if not S[i] == '-':
      flg = False
  else:
    if not S[i] in num:
      flg = False
print('Yes' if flg else 'No')

Buggy submission (verdict: Runtime Error):
a, b = [int(x) for x in input().split()]
num = '0123456789'
S = input()
flg = True
for i in len(S):
  if i == a:
    if not S[i] == '-':
      flg = False
  else:
    if not S[i] in num:
      flg = False
print('Yes' if flg else 'No')

Buggy submission (verdict: Runtime Error):
a, b = [int(x) for x in input().split()]
num = '0123456789'
S = input()
flg = True
for i in len(S):
  if i == A:
    if not S[i] == '-':
      flg = False
  else:
    if not S[i] in num:
      flg = False
print('Yes' if flg else 'No')
Problem p03485 (python)

Fixed submission:
a = list(map(int, input().split()))
sum = a[0] + a[1]
if sum%2 == 0:
  print(int(sum/2))
else:
  print(int((sum + 1)/2))

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
sum = a[0] + a[1]
if sum%2 == 0:
  return sum/2
else:
  return (sum + 1)/2
Problem p03486 (python)

Fixed submission:
def qsort(array):
    if len(array) < 2:
        return array
    else:
        pivot = array[0]
        less = [i for i in array[1:] if i <= pivot]
        greater = [i for i in array[1:] if i > pivot]
        return qsort(less) + [pivot] + qsort(greater)

si = input()
ti = input()

s_sort = qsort(si)
t_sort = qsort(ti)

s = ''
t = ''

for i in s_sort:
    s += i
for i in t_sort[::-1]:
    t += i
if s < t:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def qsort(array):
	if len(array) < 2:
        return array
    else:
        pivot = array[0]
        less = [i for i in array[1:] if i <= pivot]
        greater = [i for i in array[1:] if i > pivot]
        return qsort(less) + [pivot] + qsort(greater)
      
si = input()
ti = input()

s_sort = qsort(si)
t_sort = qsort(ti)

s = ''
t = ''

for i in s_sort:
    s += i
for i in t_sort[::-1]:
	t += i
if s < t:
	print('Yes')
else:
  	print('No')
Problem p03579 (python)

Fixed submission:
from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N, M = ZZ()
    edge = [ZZ() for _ in range(M)]
    E = defaultdict(list)
    for a, b in edge:
        E[a].append(b)
        E[b].append(a)

    color = [0] * (N+1)

    def is_bi(v, c):
        color[v] = c
        for to in E[v]:
            if color[to] == c: return False
            if color[to] == 0 and not is_bi(to, -c): return False
        return True

    if is_bi(1, 1):
        x = color.count(1)
        output = x * (N - x) - M
    else: output = N * (N - 1) // 2 - M
    print(output)

    return

if __name__ == '__main__':
    main()

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

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N, M = ZZ()
    edge = [ZZ() for _ in range(M)]
    E = defaultdict(list)
    for a, b in edge:
        E[a].append(b)
        E[b].append(a)

    color = [0] * (N+1)

    def is_bi(v, c):
        color[v] = c
        for to in E[v]:
            if color[to] == c: return False
            if color[to] == 0 and not is_bi(to, -c): return False
        return True

    if is_bi(1, 1):
        x = color.count(1)
        output = x * (N - x) - M
    else: output = N * (N - 1) // 2 - M
    print(output)

    return

if __name__ == '__main__':
    main()
Problem p03597 (python)

Fixed submission:
N = int(input())
A = int(input())
print(N*N - A)

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = [int(x) for x in input().split()]
a_water = 0
a_sugar = 0
a_conc = 0
max_conc = 100 * E / (100 + E)
for i in range(F//(100*A) + 1):
    for j in range(F//(100*B) + 1):
        water = i * 100 * A + j * 100 * B
        ms = E * water
        for k in range(ms//C + 1):
            for l in range(ms//D + 1):
                sugar = k * C + l * D
                conc = 100 * sugar / (water + sugar) if water + sugar > 0 else 0
                if water + sugar <= F and conc <= max_conc and a_conc < conc:
                    a_water = water
                    a_sugar = sugar
                    a_conc = conc
                else:
                    pass
print(a_water + a_sugar, a_sugar)
Problem p03671 (python)

Fixed submission:
a = sorted([int(x) for x in input().split()])
print(sum(a[:2]))

Buggy submission (verdict: Runtime Error):
a = sorted([int(x) for x in input().split()])
print(sum[:2])
Problem p03759 (python)

Fixed submission:
a, b, c = [int(_) for _ in input().split()]
if a + c == 2 * b:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
a, b, c = [int(_) for _ in input().split()]
if a + c = 2 * b:
  print('YES')
else:
  print('NO')
Problem p03777 (python)

Fixed submission:
a, b = input().split()
print('H' if a == b else 'D')

Buggy submission (verdict: Runtime Error):
a, b = [for x in input().split()]
print('H' if a == b else 'D')
Problem p03827 (python)

Fixed submission:
N = int(input())
S = input()
res = 0
x = 0
for i in range(N):
  if S[i] == 'I':
    x += 1
  else:
    x -= 1
  res = max(res, x)
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
res = 0
x = 0
for i in range(N):
  if S[i] == 'I':
    x += 1
  else:
    x -= 1
  res = max(res, x)
return res
Problem p03855 (python)

Fixed submission:
#Union-Find木の構築
import sys
def 解():
    iN,iK,iL = [int(_) for _ in input().split()]
    aD = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]

    def buildTree(a):
        #aT = [0]*(iN+1)
        aT = list(range(iN+1))
        for p,q in a:
            rp = getRoot(aT,p)
            rq = getRoot(aT,q)
            thisRoot = max(rp,rq,q) #みんな小さい方に合わせてるのでデカい方に合>わせてみる
            aT[p] = thisRoot
            aT[q] = thisRoot
            aT[rp] = thisRoot #これで Union してるつもり
            aT[rq] = thisRoot
        return aT
    def getRoot(a,i): #find
        #if a[i] == i or a[i] == 0:
        #   if a[i] == 0 : a[i] = i
        if a[i] == i :
            return i
    #   elif i < a[i] :
        else :
            a[i] = getRoot(a,a[i])
            return a[i]
    #   else:
    #       print("! ",i,a[i])

    aT道 = buildTree(aD[0:iK])
    aT鉄道 = buildTree(aD[iK:])
    aRet = []
    dRet = {}
    for i in range(1,iN+1):
        # いやはやこんなもんもキーになるのか。
        Comb = (getRoot(aT道,i), getRoot(aT鉄道,i))
        aRet.append(Comb)
        if Comb in dRet:
            dRet[Comb] += 1
        else:
            dRet[Comb] = 1
    print(" ".join([str(dRet[_]) for _ in aRet]))

解()

Buggy submission (verdict: Runtime Error):
N, K, L = [int(x) for x in input().split()]
dict = {}
for i in range(1, N + 1):
    dict[i] = [set(), set()]
    dict[i][0].add(i)
    dict[i][1].add(i)
for i in range(K):
    p, q = [int(x) for x in input().split()]
    dict[p][0].add(q)
    dict[q][0].add(p)
for i in range(L):
    r, s = [int(x) for x in input().split()]
    dict[r][1].add(s)
    dict[s][1].add(r)

def my_dfs(city, opt, s):
    if dict[city][opt] <= s:
        return s
    for i in dict[city][opt]:
        if i in s:
            continue
        if i == city:
            s.add(i)
            continue
        s.add(i)
        s.update(my_dfs(i, opt, s))
    return s

for i in range(1, N + 1):
    dict[i][0].update(my_dfs(i, 0, set()))
    dict[i][1].update(my_dfs(i, 1, set()))
ans_lst = []
for i in range(1, N + 1):
    ans_lst.append(len(dict[i][0] & dict[i][1]))
print(*ans_lst)

Buggy submission (verdict: Runtime Error):
N, K, L = [int(x) for x in input().split()]
dict = {}
for i in range(1, N + 1):
    dict[i] = [set(), set()]
    dict[i][0].add(i)
    dict[i][1].add(i)
for i in range(K):
    p, q = [int(x) for x in input().split()]
    dict[p][0].add(q)
    dict[q][0].add(p)
for i in range(L):
    r, s = [int(x) for x in input().split()]
    dict[r][1].add(s)
    dict[s][1].add(r)

def my_dfs(city, opt, s):
    if dict[city][opt] <= s:
        return s
    for i in dict[city][opt]:
        if i in s:
            continue
        if i == city:
            s.add(i)
            continue
        s.add(i)
        s.update(my_dfs(i, opt, s))
    return s

for i in range(1, N + 1):
    dict[i][0].update(my_dfs(i, 0, set()))
    dict[i][1].update(my_dfs(i, 1, set()))
ans_lst = []
for i in range(1, N + 1):
    ans_lst.append(len(dict[i][0] & dict[i][1]))
print(ans_lst)
Problem p03861 (python)

Fixed submission:
a, b, x = [int(x) for x in input().split()]
a = (a + x - 1)//x
b //= x
print(b - a + 1)

Buggy submission (verdict: Runtime Error):
a, b, x = [int(x) for x in input().split()]
a //= x
b = (b + x - 1)//b
print(b - a + 1)
Problem p02632 (python)

Fixed submission:
mod = 10**9+7
k = int(input())
s = input()
n = len(s)


def inv(a, mod):
    r = [1, 0, a]
    w = [0, 1, mod]
    while w[2] != 1:
        q = r[2]//w[2]
        r_new = [r[0]-q*w[0], r[1]-q*w[1], r[2]-q*w[2]]
        r = w
        w = r_new
    x, y = w[0], w[1]    # a*x+y*mod = 1
    return (mod+x % mod) % mod


max_num = 2*10**6+1
fact = [0 for _ in range(max_num)]
ifact = [0 for _ in range(max_num)]

fact[0] = fact[1] = 1
ifact[0] = ifact[1] = 1

for i in range(2, max_num):
    fact[i] = fact[i-1] * i % mod

ifact[max_num-1] = inv(fact[max_num-1], mod)

for i in range(2, max_num):
    ifact[max_num-i] = (ifact[max_num-i+1] * (max_num-i+1)) % mod


def comb(x, y):
    if x < 0 or y < 0 or x < y:
        return 0
    else:
        return fact[x] * ifact[y] * ifact[x-y] % mod


pow25 = [1]
pow26 = [1]
for i in range(10**6):
    pow25.append((pow25[-1]*25) % mod)
    pow26.append((pow26[-1]*26) % mod)

ans = 0
for i in range(k+1):
    tmp = comb(n-1+i, i)*pow25[i]
    tmp %= mod
    tmp *= pow26[k-i]
    tmp %= mod
    ans += tmp
    # ans += comb(n-1+i, i)*pow(25, i, mod)*pow(26, k-i, mod)
    ans %= mod

print(ans)

Buggy submission (verdict: Runtime Error):
mod = 10**9+7
k = int(input())
s = input()
n = len(s)


def inv(a, mod):
    r = [1, 0, a]
    w = [0, 1, mod]
    while w[2] != 1:
        q = r[2]//w[2]
        r_new = [r[0]-q*w[0], r[1]-q*w[1], r[2]-q*w[2]]
        r = w
        w = r_new
    x, y = w[0], w[1]    # a*x+y*mod = 1
    return (mod+x % mod) % mod


max_num = 2*10**5+1
fact = [0 for _ in range(max_num)]
ifact = [0 for _ in range(max_num)]

fact[0] = fact[1] = 1
ifact[0] = ifact[1] = 1

for i in range(2, max_num):
    fact[i] = fact[i-1] * i % mod

ifact[max_num-1] = inv(fact[max_num-1], mod)

for i in range(2, max_num):
    ifact[max_num-i] = (ifact[max_num-i+1] * (max_num-i+1)) % mod


def comb(x, y):
    if x < 0 or y < 0 or x < y:
        return 0
    else:
        return fact[x] * ifact[y] * ifact[x-y] % mod


ans = 0
for i in range(k+1):
    ans += comb(n-1+i, i)*pow(25, i, mod)*pow(26, k-i, mod)
    ans %= mod

print(ans)
Problem p02748 (python)

Fixed submission:
A, B, M = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

ans = min(a)+min(b)

for i in range(M):
    x, y, c = map(int, input().split())
    ans = min(ans, a[x-1]+b[y-1]-c)

print(ans)

Buggy submission (verdict: Runtime Error):
A, B, M = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

ans = min(a)+min(b)

for i in range(M):
    x,y,c = map(int, input().split())
    ans = min(ans,a[x-1]+b[x-1]-c)

print(ans)
Problem p02845 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 +7

col = [0,0,0]

ans = 1

for i in range(n):
    if not a[i] in col:
        print(0)
        exit()
    else:
        ans *= col.count(a[i])
        ans %= mod
        col[col.index(a[i])] += 1

if sum(col) != n:
    print(0)
    exit()

print(ans%mod)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 +7

if a[0] != 0:
    print(0)
    exit()

col = [1,0,0]

ans = 3
cnt = 2

for i in range(1,n):
    ans *= col.count(a[i])
    ans %= mod
    col[col.index(a[i])] += 1

print(ans)
Problem p02866 (python)

Fixed submission:
n = int(input())
d = list(map(int,input().split()))
mod = 998244353

if d[0] != 0:
    print(0)
    exit()

if n == 1:
        print(1)
        exit()

if n == 2:
    if d[1] == 1:
        print(1)
        exit()
    else:
        print(0)
        exit()


a = [0]*n

while d:
    s = d.pop()
    a[s] += 1

if a[0] >= 2:
    print(0)
    exit()

ans = 1

for i in range(n-1):
        ans *= a[i]**a[i+1]
        ans %= mod

print(ans % mod)

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

if d[0] != 0:
    print(0)
    exit()

if n == 1:
    if d[0] == 0:
        print(1)
        exit()
    else:
        print(0)
        exit()

if n == 2:
    if d[1] == 1:
        print(1)
        exit()
    else:
        print(0)
        exit()


a = [0]*(n-1)

while d:
    s = d.pop()
    a[s] += 1

if a[0] >= 2:
    print(0)
    exit()

ans = 1

for i in range(n-2):
        ans *= a[i]**a[i+1]
        ans %= mod

print(ans % mod)

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

if d[0] != 0:
    print(0)
    exit()

a = [0]*(n-1)

while d:
    s = d.pop()
    a[s] += 1

if a[0] >= 2:
    print(0)
    exit()

ans = 1

for i in range(n-2):
        ans *= a[i]**a[i+1]
        ans %= mod

print(ans % mod)
Problem p02900 (python)

Fixed submission:
from fractions import gcd

def div(n,m):
    divisors = [1]
    for i in range(2, 10**7+1):
        if n % i == 0 and m % i == 0:
            divisors.append(i)
            while n % i == 0 and m % i == 0:
                n = n // i
                m = m // i

    return divisors,n,m

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

d,n,m = div(a,b)

if gcd(n,m) > 1:
    print(len(d)+1)
else:
    print(len(d))

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

def div(n,m):
    divisors = [1]
    for i in range(2, 10**7+1):
        if n % i == 0 and m % i == 0:
            divisors.append(i)
            while n % i == 0 and m % i == 0:
                n = n // i
                m = m // i

    return divisors,n,m

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

d,n,m = div(a,b)

if gcd(n,m) > 1:
    print(len(d)+1)
else:
    print(len(d))
Problem p02903 (python)

Fixed submission:
h,w,a,b = map(int,input().split())
s = [['0']*w for _ in range(h)]

for i in range(b):
    for j in range(a):
        s[i][j] = '1'

for i in range(h-b):
    for j in range(w-a):
        s[i+b][j+a] = '1'

for i in range(h):
    print(''.join(s[i]))

Buggy submission (verdict: Runtime Error):
h,w,a,b = map(int,input().split())
s = [['0']*w for _ in range(h)]

if a == 0 and b == 0:
    print(0)
    exit()
elif a == 0:
    for i in range(b):
        print('1'*w)
    for i in range(h-b):
        print('0'*w)
    exit()
elif b == 0:
    for i in range(h):
        print('1'*a + '0'*(w-a))
    exit()


for i in range(a):
    for j in range(b):
        s[i][j] = '1'

for i in range(h-a):
    for j in range(w-b):
        s[i+a][j+b] = '1'

for i in range(h):
    print(''.join(s[i][:w]))
Problem p02921 (python)

Fixed submission:
s = input()
t = input()

c = 0

for i in range(3):
    if s[i] == t[i]:
        c +=1

print(c)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

c

for i in range(3):
    if s[i] == t[i]:
        c +=1

print(c)
Problem p02950 (python)

Fixed submission:
import sys
input = sys.stdin.readline

p = int(input())
a = [int(i) for i in input().split()]

ans = [0]*p

for i,j in enumerate(a):
    if j == 0:
        continue
    ans[0] -= p-1
    m = 1
    for k in range(p):
        ans[p-1-k] -= m
        ans[p-1-k] %= p
        m *= i
        m %= p

print(*ans)

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

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

b = []
for i in range(p):
    if a[i] ==  1:
        b.append(i)

ans = [0]*p

for i in range(0,p):
    for j in b:
        ans[p-1-i] -= pow(j,i,p)
    ans[p-1-i] %= p
 
ans[0] += -len(b)*(p-1)
ans[0] %= p

print(*ans)
Problem p02952 (python)

Fixed submission:
n = input()

s = len(n)

ans = 0


if s == 1:
    print(int(n))
    exit()

for i in range(0,s-1,2): 
    ans += 9*(10**i)

if s %2 != 0:
    ans += int(n) - (10**(s-1))+1

print(ans)

Buggy submission (verdict: Runtime Error):
n = input()

s = len(n)

ans = 0

for i in range(0,s-1,2): 
    ans += 9*(10**i)

m = n[1:]

if s %2 != 0:
    ans += int(m)+1

print(ans)