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

Fixed submission:
n = int(input())
robots = []
for i in range(n):
    x, l = map(int, input().split())
    robots.append([x + l, x - l])
robots.sort()

r = - 10 ** 9 - 1
cnt = 0
for i in range(n):
    if r <= robots[i][1]:
        cnt += 1
        r = robots[i][0]
print(cnt)

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

cnt = n
j = 0
for i in range(n):
    if x[j][0] + x[j][1] > x[j + 1][0] - x[j][1]:
        cnt -= 1
        j += 1
    j += 1
    if j >= n - 1:
        break
print(cnt)
Problem p02818 (python)

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

if a >= k:
    print(a - k, b)
else:
    print(0, max(0, b - k + a))

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

if a >= k:
    print(a - k, b)
else:
    print(0, max(b - k + a))
Problem p02866 (python)

Fixed submission:
from collections import Counter
n = int(input())
d = list(map(int, input().split()))

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

cnt = Counter(d)

if cnt[0] != 1:
    print(0)
    exit()

ans = 1
for i in d:
    if i != 0:
        ans = (ans * cnt[i-1]) % 998244353
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
d = list(map(int, input().split()))

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

cnt = Counter(d)

if cnt[0] != 1:
    print(0)
    exit()

ans = 1
for i in d:
    if i != 0:
        ans *= cnt[i-1] % 998244353
print(and % 998244353)
Problem p02899 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = [0 for i in range(n+1)]
for i in range(n):
    ans[a[i]] = i + 1
print(*ans[1:])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
disk, idx = list(range(n + 1)), list(range(n + 1))

now = 0
for _ in range(m):
    nxt = int(input())
    disk[idx[nxt]], idx[nxt], idx[now] = now, 0, idx[nxt]
    now = nxt
print(*disk[1:], sep="\n")
Problem p02911 (python)

Fixed submission:
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]

pt = [k-q for _ in range(n)]
for i in a:
    pt[i-1] += 1

for i in pt:
    if i > 0:
        print("Yes")
    else:
        print("No")

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

if n == 1:
    a = int(input())
    for i in range(m):
        a //= 2
    print(a)
    exit()

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

for i in range(m):
    mx = max(a)
    a[index(mx)] //= 2
print(sum(a))
Problem p02975 (python)

Fixed submission:
from collections import Counter as ct
import sys
input = sys.stdin.readline

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

if c[0] == n:
    print("Yes")
elif len(c) == 2 and c[0] * 3 == n:
    print("Yes")
elif len(c) == 3 and len(set(c.values())) == 1:
    a, b, c = c.keys()
    if (a ^ b ^ c) == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter as ct
import sys
input = sys.stdin.readline

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

if c[0] == n:
    print("Yes")
elif len(c) == 2 and c[0] * 3 == n:
    print("Yes")
elif len(c) == 3 and len(set(c.values())) == 1 and :
    a, b, c = c.keys()
    if (a ^ b ^ c) == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Problem p02993 (python)

Fixed submission:
s = input()
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print("Bad")
else:
    print("Good")

Buggy submission (verdict: Runtime Error):
s = input()
if s[0] == s[1] or s[1] == s[2] or s[2] == 2[3]:
    print("Bad")
else:
    print("Good")
Problem p03037 (python)

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

ans = 0
L, R = 0, 114514

for i in range(m):
    l, r = map(int, input().split())
    L, R = max(L, l), min(R, r)

print(R - L + 1 if R - L + 1 >= 1 else 0)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
     
id, gate = map(int, input().split())
a = [list(map(int,input().split())) for i in range(gate)]
b = []

for i in range(gate)
    c = range(a[i, 0], a[i, 1])
    b.extend(c)

d = range(id)

d = set(d)
b = set(b)

list = list(b&d)
print(len(list))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
     
id, gate = map(int, input().split())
for i in range(gate)
    a = [list(map(int,input().split()))]
b = []

for i in range(gate)
    c = range(a[i, 0], a[i, 1])
    b.extend(c)

d = range(id)

d = set(d)
b = set(b)

list = list(b&d)
print(len(list))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
     
z = []
id, gate = map(int, input().split())
for i in range(gate)
    a = [list(map(int,input().split()))]
    z.append(a)
b = []

for i in range(gate)
    c = range(a[i, 0], a[i, 1])
    b.extend(c)

d = range(id)

d = set(d)
b = set(b)

list = list(b&d)
print(len(list))
Problem p03076 (python)

Fixed submission:
n = []
for i in range(5):
    n.append(int(input()))

n_ = [0]
for i in n:
    if i % 10 == 0:
        continue
    n_.append(10 - i % 10)

print(sum(n) + sum(n_) - max(n_))

Buggy submission (verdict: Runtime Error):
n = []
for i in range(5):
    n.append(int(input()))

n_ = []
for i in n:
    if i % 10 == 0:
        continue
    n_.append(10 - i % 10)

print(sum(n) + sum(n_) - max(n_))
Problem p03101 (python)

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

print(H * W - H * w - W * h + h * w)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def main():
    n, m, c = map(int, input().split())
    b = list(map(int, input().split()))
    a = [list(map(int, input().split())) for i in range(n)]

    ans = 0
    for i in a:
        cnt = c
        for j in range(m):
            cnt += i[j] * b[j]
        
        if cnt > 0:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()
Problem p03284 (python)

Fixed submission:
n, k = map(int, input().split())
if n % k == 0:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
if n % k = 0:
    print(0)
else:
    print(1)
Problem p03292 (python)

Fixed submission:
a = list(map(int, input().split()))
a.sort()
print(a[2] - a[0])

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

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

lcm = a[0]
for i in a:
    lcm = lcm * i // gcd(lcm, i)
ans = 0
for i in a:
    ans += (lcm-1) % i
print(ans)
Problem p03472 (python)

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

a = 0
b = []
for i in range(n):
    A, B = map(int, input().split())
    a = max(a, A)
    b.append(B)
b = sorted([i for i in b if a < i], reverse=True)

cnt = 0
for i in b:
    cnt += 1
    h -= i
    if h <= 0:
        print(cnt)
        exit()
print(cnt + (h + a - 1) // a)

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

n, h = map(int, input().split())
a = 0
b = []
for i in range(n):
    A, B = map(int, input().split())
    a = max(a, A)
    b.append(B)
b = np.array(b, dtype=np.int64)
b = np.sort(b[b > a])[::-1]

if b.sum() >= h:
    cnt = 0
    for i in b:
        h -= b
        cnt += 1
        if h < 0:
            print(cnt)
            exit()

print((h - b.sum() + a - 1) // a + len(b))
Problem p03474 (python)

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

for i in range(len(s)):
    if i == a:
        if s[a] != "-":
            print("No")
            exit()
    else:
        if not "0" <= s[i] <= "9":
            print("No")
            exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = input()
l = list(range(10))
for i in range(len(s)):
    if i == 3:
        if s[i] != "-":
            print("No")
            exit()
    else:
        if int(s[i]) not in l:
            print("No")
            exit()
print("Yes")
Problem p03601 (python)

Fixed submission:
a, b, c, d, e, f = map(int, input().split())
a, b = 100 * a, 100 * b
limit = 100 * e / (100 + e)
mx = -1

for i in range(f // a + 1):
    for j in range((f - i * a) // b + 1):
        for k in range((f - i * a - j * b) // c + 1):
            for l in range((f - i * a - j * b - k * c) // d + 1):
                water = i * a + j * b + k * c + l * d
                sugar = k * c + l * d
                if water > f or water == 0:
                    break
                if (100 * sugar / water) <= limit:
                    if (100 * sugar / water) > mx:
                        mx = (100 * sugar / water)
                        x, y = water, sugar
print(x, y)

Buggy submission (verdict: Runtime Error):
a, b, c, d, e, f = map(int, input().split())
limit = 100 * e / (100 + e)
mx = -1

waters = set()
for i in range(0, f // a + 1, 100 * a):
    for j in range(0, (f - i * a) // b + 1, 100 * b):
        waters.add(i + j)

sugars = set()
for i in range(0, f // c + 1, c):
    for j in range(0, (f - c) // d + 1, d):
        sugars.add(i + j)

for i in waters:
    for j in sugars:
        if i + j > f or i + j == 0:
            break
        noudo = (100 * j / (i + j))
        if noudo <= limit:
            if noudo > mx:
                mx = noudo
                x, y = i + j, j
print(x, y)
Problem p03673 (python)

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

odd = []
even = []
for i in range(n):
    if i % 2 == 0:
        even.append(a[i])
    else:
        odd.append(a[i])

if n % 2 == 1:
    ans = even[::-1]+odd
else:
    ans = odd[::-1]+even
print(*ans)

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

odd = []
even = []
for i in range(n):
    if i % 2 == 0:
        even.append(a[i])
    else:
        odd.append(a[i])

if n % 2 == 1:
    print(*even[::-1], *odd)
else:
    print(*odd[::-1], *even)
Problem p03696 (python)

Fixed submission:
n = int(input())
s = input()

tmp = 0
a = 0
for i in s:
    if i == "(":
        tmp -= 1
    else:
        tmp += 1
    a = max(a, tmp)
ans = a * "(" + s
print(ans + ")" * (ans.count("(") - ans.count(")")))

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

x = n - s[::-1].find(")")
l = 0
r = 0
for i in range(x):
    if s[i] == "(":
        l += 1
    else:
        r += 1

if l < r:
    ans = "(" * (r - l) + s
print(ans + ")" * max(0, (ans.count("(") - ans.count(")"))))
Problem p03761 (python)

Fixed submission:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]

cnt = Counter(s[0])
for i in s[1:]:
    cnt &= Counter(i)
ans = ""
for i, v in sorted(cnt.items()):
    ans += i * v
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
length = 100
for i in range(n):
    S = sorted(input())
    s.append(S)
    length = min(length, len(S))

ans = ""
for i in range(length):
    tmp = 0
    for j in range(n-1):
        if s[j][i] == s[j+1][i]:
            tmp += 1
    if tmp == n - 1:
        ans += s[j][i]
print(ans)
Problem p03838 (python)

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

if x < y:
    if x * y >= 0:
        print(y - x)
    else:
        print(abs(x + y) + 1)
else:
    if x * y <= 0:
        print(abs(x + y) + 1)
    else:
        print(x - y + 2)

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

if abs(x) < abs(y):
    if X == 1 and Y == 1:
        print(abs(x - y))
    elif X == -1 and Y == -1:
        print(abs(x - y) + 2)
    else:
        print(abs(x - y) + 1)
elif abs(x) == abs(y):
    if X == Y:
        print(0)
    else:
        print(1)
else:
    if X == 1 and Y == 1:
        print(abs(x - y) + 2)
    elif X == -1 and Y == -1:
        print(abs(x - y))
    else:
        print(abs(x - y) + 1)
Problem p03945 (python)

Fixed submission:
s = input()
ans = 0
bw = s[0]
for i in s:
    if bw == "B" and i == "W":
        ans += 1
        bw = "W"
    elif bw == "W" and i == "B":
        ans += 1
        bw = "B"
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
f = 0
ans = 0
if s[0] == "B":
    ans += 1
    while s[0] == "B":
        s = s[1:]

s = s[::-1]

if s[0] == "B":
    ans += 1
    while s[0] == "B":
        s = s[1:]

print(ans+s.count("B")*2)
Problem p04033 (python)

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

if a > 0:
    print("Positive")
elif b < 0:
    print("Negative" if (abs(a - b)) % 2 == 0 else "Positive")
else:
    print("Zero")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.buffer.readline

n, m = map(int, input().split())
b = [False] * (n + 1)
c = [1] * (n + 1)
for i in range(m):
    x, y = map(int, input().split())
    c[x] -= 1
    c[y] += 1
    if b[x]:
        b[y] = True
    if c[x] == 0:
        b[x] = False
print(sum(b))
Problem p02536 (python)

Fixed submission:
import collections
import sys
sys.setrecursionlimit(10**6)
def dfs(visited,v,adj):
    visited[v]=True 
    for i in adj[v]:
        if not visited[i]:
            dfs(visited,i,adj)  
adj=collections.defaultdict(list)
n,m=map(int,input().split()) 
visited=[False]*n  
for i in range(m):
    u,v=map(int,input().split()) 
    adj[u-1].append(v-1)  
    adj[v-1].append(u-1) 
c=0 
for i in range(n):
    if not visited[i]:
        dfs(visited,i,adj) 
        c+=1 
print(c-1)

Buggy submission (verdict: Runtime Error):
import collections
sys.setrecursionlimit(10**6)
def dfs(visited,v,adj):
    visited[v]=True 
    for i in adj[v]:
        if not visited[i]:
            dfs(visited,i,adj)  
adj=collections.defaultdict(list)
n,m=map(int,input().split()) 
visited=[False]*n  
for i in range(m):
    u,v=map(int,input().split()) 
    adj[u-1].append(v-1)  
    adj[v-1].append(u-1) 
c=0 
for i in range(n):
    if not visited[i]:
        dfs(visited,i,adj) 
        c+=1 
print(c-1)

Buggy submission (verdict: Runtime Error):
import collections

def dfs(visited,v,adj):
    visited[v]=True 
    for i in adj[v]:
        if not visited[i]:
            dfs(visited,i,adj)  
adj=collections.defaultdict(list)
n,m=map(int,input().split()) 
visited=[False]*n  
for i in range(m):
    u,v=map(int,input().split()) 
    adj[u-1].append(v-1)  
    adj[v-1].append(u-1) 
c=0 
for i in range(n):
    if not visited[i]:
        dfs(visited,i,adj) 
        c+=1 
print(c-1)
Problem p02719 (python)

Fixed submission:
def gcd(x, y): 
  
   while(y): 
       x, y = y, x % y 
  
   return x 
a,b=map(int,input().split())
if a==0:
    print(0)
else:
    if a%b==0:
        print(0)
    else:
        x=a%b 
        while True:
            if x>abs(x-b):
                x=abs(x-b)
            else:
                break 
        print(x)

Buggy submission (verdict: Runtime Error):
from math import gcd
a,b=map(int,input().split())
if a%b==0:
    print(0)
else:
    print(gcd(a,b))
Problem p02534 (python)

Fixed submission:
# -*- coding: utf-8 -*-
k = input()

str = ""
for i in range(int(k)):
  str += "ACL"
 
print(str)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
k = int(input())

str = ""
for i in k:
  str += "ALC"
 
print(str)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
k = int(input())

for i in k:
  str += "ALC"
 
print(str)
Problem p02582 (python)

Fixed submission:
wt = str(input())
if wt == 'SSS':
    print(0)
elif wt == "RRR":
    print(3)
else:
    id = wt.index('R')
    if wt.count('R') == 2 and wt[id] == wt[id+1] == 'R':
        print(2)
    else:
        print(1)

Buggy submission (verdict: Runtime Error):
wt = str(input())
if wt == 'SSS':
    print(0)
if wt == "RRR":
    print(3)
else:
    id = wt.index('R')
    if wt.count('R') == 2 and wt[id] == wt[id+1] == 'R':
        print(2)
    else:
        print(1)
Problem p02772 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
even_num = []
for i in A:
    if i % 2 == 0:
        even_num.append(i)
for j in range(len(even_num)):
    if even_num[j] % 3 != 0 and even_num[j] % 5 != 0:
        print('DENIED')
        exit()
print('APPROVED')

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

    flag = True
    for i in range(N):
        if A[i] % 2 == 0:
            if A[i] % 3 == 0 or A[i] % 5 == 0:
                pass
            else:
                flag = False

    if flag:
        print("APPROVED")
    else:
        print("DENIED")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
for i in A:
    if i % 2 == 0:
        even_num.append(i)
for j in range(len(even_num)):
    if even_num[j] % 3 != 0 and even_num[j] % 5 != 0:
        print('DENIED')
        exit()
print('APPROVED')
Problem p02632 (python)

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

fact = [1] * 2200000
invfact = [1] * 2200000
 
for i in range(1, 2200000):
    fact[i] = fact[i-1] * i % MOD
 
invfact[2200000 - 1] = pow(fact[2200000 - 1], MOD-2, MOD)
 
for i in range(2200000-1, 0, -1):
    invfact[i-1] = invfact[i] * i % MOD

def comb(n, k):
    return fact[n] * invfact[k] * invfact[n-k] % MOD

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

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

def cmb(n, r, MOD):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % MOD

N = 10 ** 6
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)

for i in range(k+1):
    b = pow(26, k-i, MOD)
    b *= pow(25, i, MOD)
    b *= cmb(i+n-1, n-1, MOD)
    ans += (b % MOD)
    
print(ans%MOD)
Problem p02642 (python)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
A.sort()

ac = A.count(1)
if ac == 1:
    print(1)
    exit()
if ac >= 2:
    print(0)
    exit()

num = [0]*1000005
for a in A:
    num[a] += 1

b = [False]*1000005
seen = [False]*1000005
cnt = 0
A = list(set(A))
A.sort()
for a in A:
    if seen[a]:
        continue

    seen[a] = True
    if b[a] == False:
        cnt += 1
        if num[a] > 1:
            cnt -= 1

    for i in range(a, 1000005, a):
        b[i] = True
print(cnt)

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

ac = A.count(1)
if ac == 1:
    print(1)
    exit()
if ac >= 2:
    print(0):
    exit()

num = [0]*1000005
for a in A:
    num[a] += 1

b = [False]*1000005
seen = [False]*1000005
cnt = 0
A = list(set(A))
A.sort()
for a in A:
    if seen[a]:
        continue

    seen[a] = True
    if b[a] == False:
        cnt += 1
        if num[a] > 1:
            cnt -= 1

    for i in range(a, 1000005, a):
        b[i] = True
print(cnt)
Problem p02727 (python)

Fixed submission:
x, y, a, b, c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
p = p[:x]
q = q[:y]
ap = p + q + r
ap.sort(reverse=True)
print(sum(ap[:x+y]))

Buggy submission (verdict: Runtime Error):
x, y, a, b, c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
r.sort()
ans = 0
n = x+y
ma = [-1, -1, -1]
for i in range(n):
    if p:
        ma[0] = p[-1]
    if q:
        ma[1] = q[-1]
    if r:
        ma[2] = r[-1]

    if ma.index(max(ma)) == 0:
        if x:
            x -= 1
            ans += p[-1]
            p.pop()
        else:
            if r:
                if q:
                    if r[-1] > q[-1]:
                        y -= 1
                        ans += r[-1]
                        r.pop()
                    else:
                        y -= 1
                        ans += q[-1]
                        q.pop()
                else:
                    y -= 1
                    ans += r[-1]
                    r.pop()
            else:
                y -= 1
                ans += q[-1]
                q.pop()
    elif ma.index(max(ma)) == 1:
        if y:
            y -= 1
            ans += q[-1]
            q.pop()
        else:
            if r:
                if p:
                    if r[-1] > p[-1]:
                        x -= 1
                        ans += r[-1]
                        r.pop()
                    else:
                        x -= 1
                        ans += p[-1]
                        p.pop()
                else:
                    x -= 1
                    ans += r[-1]
                    r.pop()
            else:
                x -= 1
                ans += p[-1]
                p.pop()
    else:
        if p[-1] > q[-1]:
            if y:
                y -= 1
            else:
                x -= 1
        else:
            if x:
                x -= 1
            else:
                y -= 1
        ans += r[-1]
        r.pop()
print(ans)
Problem p02801 (python)

Fixed submission:
al = 'abcdefghijklmnopqrstuvwxyz'
c = input()
print(al[al.index(c)+1])

Buggy submission (verdict: Runtime Error):
al = 'abcdefghijklmnopqrstuvwxy'
c = input()
print(al[al.index(c)+1])
Problem p02845 (python)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
ans = 1
MOD = 1000000007
c = [0, 0, 0]
for a in A:
    cnt = c.count(a)
    if cnt == 0:
        print(0)
        exit()
    ans *= cnt
    ans %= MOD
    c[c.index(a)] += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
ans = 1
MOD = 1000000007
c = [0, 0, 0]
for a in A:
    cnt = c.count(a)
    ans *= cnt
    ans %= MOD
    c[c.index(a)] += 1
print(ans)
Problem p02855 (python)

Fixed submission:
h, w, k = map(int, input().split())
s = [input() for _ in range(h)]
a = [[0]*w for _ in range(h)]
cnt = 0
later = []
for i in range(h):
    if '#' not in s[i]: continue
    later.append(i)
    fst = False
    idx = -1
    for j in range(w):
        if not fst and not s[i][j] == '#':
            continue
        if not fst and s[i][j] == '#':
            idx = j
        if s[i][j] == '#':
            fst = True
            cnt += 1
        a[i][j] = cnt
    for j in range(idx):
        a[i][j] = a[i][idx]

for i in later:
    if i >= h-1: break
    for j in range(w):
        k = i
        while k < h-1:
            if a[k+1][j] == 0:
                a[k+1][j] = a[k][j]
                k += 1
            else:
                break
                
if later[0] != 0:
    for i in range(later[0], 0, -1):
        for j in range(w):
            a[i-1][j] = a[i][j]
for ans in a:
    print(*ans)

Buggy submission (verdict: Runtime Error):
h, w, k = map(int, input().split())
s = [input() for _ in range(h)]
a = [[0]*w for _ in range(h)]
cnt = 1
later = []
for i in range(h):
    if '#' not in s[i]: continue
    if i < h-1: later.append(i)
    fst = True
    for j in range(w):
        if not fst and s[i][j] == '#':
            cnt += 1
        if fst and s[i][j] == '#':
            fst = False
        a[i][j] = cnt
    cnt += 1

for i in later:
    if a[i+1][0] != 0: continue
    for j in range(w):
        k = i
        while k < h-1:
            if a[k+1][j] == 0:
                a[k+1][j] = a[k][j]
                k += 1
            else:
                break
                
if later[0] != 0:
    for i in range(later[0], 0, -1):
        for j in range(w):
            a[i-1][j] = a[i][j]
for ans in a:
    print(*ans)
Problem p02898 (python)

Fixed submission:
n, k = map(int, input().split())
H = list(map(int, input().split()))
cnt = 0
for h in H:
    if h >= k:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
H = list(map(int, input().split()))
cnt = 0
for h in H:
    if h >= k:
        cn
        t += 1
print(cnt)