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

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

p = set(p)
for i in range(200):
    if X - i not in p:
        print(X - i)
        break
    if X + i not in p:
        print(X + i)
        break

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

if n == 0:
    print(x)

p = set(p)
else:
    _x = x 
    x_ = x
    while True:
        _x -= 1
        x_ += 1
        if _x not in p:
            print(_x)
            break
        if x_ not in p:
            print(x_)
            break

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

if n == 0:
    print(x)
else:
    q = []
    r = []
    min_ = 1000
    for i in range(1, 101):
        if not i in p:
            q.append(i)

    for j in q:
        k = int(abs(x - j))
        if min_ == k:
            r.append(before_j)
            r.append(j)
        min_ = min(k, min_)
        if min_ == k:
            before_j = j

    print(min(r))

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

q = []
r = []
min_ = 1000
for i in range(1, 101):
    if not i in p:
        q.append(i)
        
for j in q:
    k = int(abs(x - j))
    if min_ == k:
        r.append(before_j)
        r.append(j)
    min_ = min(k, min_)
    if min_ == k:
        before_j = j

print(min(r))

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

q = []
r = []
min_ = 1000
for i in range(1, 101):
    if not i in p:
        q.append(i)
        
for j in q:
    k = int(abs(x - j))
    if min_ == k:
        r.append(before_j)
        r.append(j)
    min_ = min(k, min_)
    if min_ == k:
        before_j = j

print(min(r))
Problem p02658 (python)

Fixed submission:
n = int(input())

a = list(map(int, input().split()))
ans = 1
if 0 in a:
    print(0)
else:
    for num, val in enumerate(a):
        ans *= val
        if ans > 10**18:
            print(-1)
            break 
    else:
        print(ans)

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

a = list(map(int, input().split()))
for _, val in enumerate(a):
    ans *= val
if ans > 10**18:
    print(-1)
else:
    print(ans)
Problem p02664 (python)

Fixed submission:
t = input()
 
ans = t.replace("?", "D")
print(ans)

Buggy submission (verdict: Runtime Error):
t = input()
 
ans = replace("?", "D")
print(ans)

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

ans = replace("?", "D")
print

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

if t[0] == "?":
    if t[1] == "P":
        t[0] = "D"
    else:
        t[0] = "P"
        
for i in range(1, len(t) - 1):
    if t[i] == "?":
        if t[i - 1] == "P":
            t[i] = "D"
        else:
            if t[i + 1] == "P":
                t[i] = "D"
            else:
                t[i] = "P"
if t[len(t) - 1] == "?":
        t[len(t) - 1] = "D"
            
                
ans = "".join(t)
print(ans)

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

if t[0] == "?":
    if t[1] == "P":
        t[0] = "D"
    else:
        t[0] = "P"
        
for i in range(1, len(t)):
    if i < len(t) - 1:
        if t[i] == "?":
            if t[i - 1] == "P":
                t[i] = "D"
            else:
                if t[i + 1] == "P":
                    t[i] = "D"
                else:
                    t[i] = "P"
        else:
            t[len(t) - 1] = "D"
            
                
ans = "".join(t)
print(ans)

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

if t[0] == "?":
    if t[1] == "P":
        t[0] = "D"
    else:
        t[0] = "P"
        
for i in range(1, len(t)):
    if t[i] == "?":
        if t[i - 1] == "P":
            t[i] = "D"
        else:
            if t[i + 1] == "P":
                t[i] = "D"
            else:
                t[i] = "P"
                
ans = "".join(t)
print(ans)

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

if t[1] == "?":
    if t[2] == "P":
        t[1] = "D"
    else:
        t[1] = "P"
        
for i in range(2, len(t)):
    if t[i] == "?":
        if t[i - 1] == "P":
            t[i] = "D"
        else:
            if t[i + 1] == "P":
                t[i] = "D"
            else:
                t[i] = "P"
                
ans = "".join(t)
print(ans)
Problem p02718 (python)

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

a.sort(reverse=True)
if a[m-1] >= (sum(a)*(1/(4*m))):
    print("Yes")
else:
    print("No")

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

a.sorted(reverse=True)
if a[m-1] >= (sum(a)*(1/(4*m))):
    print("Yes")
else:
    print("No")
Problem p02747 (python)

Fixed submission:
s = input()
 
l = len(s)
 
if l % 2 != 0:
    print("No")
else:
    for i in range(0, l, 2):
        if s[i:i+2] == "hi":
            if i == l-2:
                print("Yes") 
            else:
                continue

        else:
            print("No")
            break

Buggy submission (verdict: Runtime Error):
import sys
s = input()

l = len(s)

if l % 2 == 1:
    print("No")
    return
    sys.exit(0)
else:
    for i in range(0, l, 2):
        if s[i:i+2] == "hi":
            continue
        else:
            print("No")
            sys.exit(0)
    print("Yes")

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

l = len(s)

if l % 2 == 1:
    print("No")
else:
    for i in range(0, l, 2):
        if s[i:i+2] == "hi":
            continue
        else:
            print("No")
            return
    print("Yes")

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

l = len(s)
# print(l)
# print(s[0:1])
if l % 2 != 0:
    print("No")
else:
    for i in range(0, l, 2):
        if s[i:i+2] == "hi":
            # print(s[i:i+1])
        else:
            print("No")
            break
    print("Yes")
Problem p02755 (python)

Fixed submission:
a, b = map(int, input().split())
r = -1
for price in range(1010):
    tax_8 = int(price * 0.08)
    tax_10 = int(price * 0.1)
    if tax_8 == a and tax_10 == b:
        r = price
        break
print(r)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
r = -1
for price in range(1010):
    tax_8 = int(price * 0.08)
    tax_10 = int(price * 0.1)
    if tax_8 == a and tax_10 == b:
        r = price
        braek
print(r)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
r = "-1"
for price in range(1010):
    tax_8 = int(price * 0.08)
    tax_10 = int(price * 0.1)
    if tax_8 == a and tax_10 == b :
        r = price
        braek
print(r)
Problem p02756 (python)

Fixed submission:
from collections import deque

s = input()
q = int(input())

t = deque(s)
flg = False
for _ in range(q):
    query = input()
    if query[0] == "1":
        flg = not flg
    elif query[0] == "2":
        _, f, c = query.split()
        if f == "1":
            if flg:
                t.append(c)
            else:
                t.appendleft(c)
        elif f == "2":
            if flg:
                t.appendleft(c)
            else:
                t.append(c)
result = "".join(t)
if flg:
    result = result[::-1]
print(result)

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
flg = False

for i in range(q):
    x = input()
    if int(len(x)) == 1:
        a = int(x)
        if flg == False:
            flg = True
        else:
            flg = False
        print("G:",s)
    else:
        a, b, c = map(str, x.split()) 
        if flg == False and int(b) == 1:
            s = c + s
        elif flg == False and int(b) == 2:
            s = s + c
        elif flg == True and int(b) == 1:
            s = s + c
        else:
            s = c + s

if flg == True:
    s = s[::-1]
print(s)
Problem p02760 (python)

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

Size = 3
bingo = False
for row in a:
    if all(item in b for item in row):
        bingo = True
for col in zip(*a):
    if all(item in b for item in col):
        bingo = True
if all(a[i][i] in b for i in range(Size)):
    bingo = True
if all(a[i][Size - 1 - i] in b for i in range(Size)):
    bingo = True
 
print("Yes" if bingo else "No")

Buggy submission (verdict: Runtime Error):
res = False
for row in a:
    if all(num in b for num in row):
        res = True
for col in zip(a):
    if all(num in b for num in col):
        res = True
if all(a[i][i] in b for i range(3)):
        res = True
if all(a[i][2 - i] in b for i range(3)):
        res = True


print("Yes" if res else("No"))
Problem p02786 (python)

Fixed submission:
h = int(input())

def dev_(n):
    if n == 1:
        return 1
    else:
        return 1 + dev_(n//2) * 2

print(dev_(h))

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

def dev(n):
    if n == 1:
        retuen 1
    else:
        retuen 1 + dev(n//2) * 2

print(dev(h))

Buggy submission (verdict: Runtime Error):
def dev(n):
    if n = 1:
        retuen 1
    else:
        retuen 1 + dev(n//2) * 2

print(dev(h))

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

def dev(n):
    if n = 1:
        retuen 1
    else:
        retuen 1 + dev(n//2) * 2

print(def(h))
Problem p02791 (python)

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

cnt = 1
tmp_min = p[0]
for i in range(1, n):
    tmp_min = min(tmp_min, p[i]) 
    if tmp_min == p[i]:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
cnt = 1
tmp_min = p[0]
for i in range(n-1):
    tmp_min = min(tmp_min, p[i+1]) 
    if tmp_min == p[i+1]:
        cnt += 1
print(cnt)
Problem p02802 (python)

Fixed submission:
from collections import defaultdict

n, m = map(int, input().split()) 

d = defaultdict(int)
ans = 0
pena = 0

for _ in range(m):
    p, s = input().split()
    if s == "AC":
        if d[p] == -1:
            continue
        else:
            ans += 1
            pena += d[p]
            d[p] = -1
    else:
        if d[p] == -1:
            continue
        else:
            d[p] += 1

print(ans, pena)

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

str_list = ["WA"] * n # 問題数分のリスト
int_list = [0] * n    # 問題数分のリスト
num = 0
ac = 0    

for p_, s in  ps: # p：問題番号 s：AC or WA
    p = int(p_) - 1
    if s == "AC":
        str_list[p] = "AC" # WAリスト
    else: # s!= WA
        if str_list[p] !="AC": # まだACされていない問題が、WAだったら
            int_list[p] += 1   # 問題ごとのWAの回数

for i in range(n): 
    if str_list[i] == "AC": ペナルティはACできた問題のみ
        num += int_list[i] # WAの回数
        ac += 1            # ACの数

print(ac, num)

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

seito = 0
pena  = 0

str_list = ["WA"] * n # 問題数分のリスト
int_list = [0] * n　　# 問題数分のリスト
num = 0
ac = 0    

for p_, s in  ps: # p：問題番号　s：AC or WA
    p = int(p_) - 1
    if s == "AC":
        str_list[p] = "AC"  # WAリスト
    else: # s!= WA
        if str_list[p] !="AC": # まだACされていない問題が、WAだったら
            int_list[p] += 1   # 問題ごとのWAの回数

for i in range(n): #
    if str_list[i] == "AC": ペナルティはACできた問題のみ
        num += int_list[i] # WAの回数
        ac += 1　　　　　　# ACの数

print(ac, num)

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

n, m = map(int, input().split()) 

d = defaultdict(int)
ans = 0
pena = 0

for _ in range(m):
    p, s = input().split()
    if s == "AC":
        if d[p] == -1:
            continue
        else:
            ans += 1
            pena += d[p]
            d[p] = -1
    else:
        if d[p] == -1:
            continue
        else;
            d[p] += 1

print(ans, pena)

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

seito = 0
pena  = 0

for i in range(n):
    flg = False
    for j in range(m):
        if sp[j][0] == i and ps[j][1] == "AC":
            if flg == False:
                seito += 1
                flg = True
            elif ps[j][0] == i and ps[j][1] == "WA":
                if flg == False:
                    pena += 1
            else:
                pass

print(seito, pena)
Problem p02818 (python)

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

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

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

def cookie(t, s, p):
        if t > 0:
            t = t - 1
        elif s > 0:
            s = s - 1
        else:
            pass
        p -= 1
        if p > 0:
            cookie(t, s, p)
        return t, s
    
res = cookie(a, b, k)
t, s = res
print(t, s)

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

def cookie(t, s, p):
        if t > 0:
            t = t - 1
        elif s > 0:
            s = s - 1
        else:
            pass
        p -= 1
        if p > 0:
            cookie(t, s, p)
        return t, s
    
res = cookie(a, b, k)
print(res)
Problem p02837 (python)

Fixed submission:
n = int(input())

xy_arr = [[] for _ in range(n)]
for i in range(n):
    a = int(input())
    for _ in range(a):
        x, y = map(int, input().split())
        xy_arr[i].append((x, y))

max_res = 0
for i in range(2 ** n):           
    ok_flg = True
    bin_i = format(i, "015b")[::-1] 
                                    
    for j in range(n):
        for x, y in xy_arr[j]: 
            if bin_i[j] == "1" and y != int(bin_i[x - 1]):
                ok_flg = False
                break
        else:
            continue
        break
        
    if ok_flg:
        res = sum(int(x) for x in bin_i)
        max_res = max(max_res, res)
        
print(max_res)

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

xy_arr = [[] for _ in range(n)]
for i in range(n):
    a = int(input())
    for j in range(a):
        x, y = int(map(int, input().split()))
        xy_arr[i].append(x, y)
        
max_res = 0
for i in range(2 ** n):           
    ok_flg = True
    bin_i = format(i, "015b")[::-1]
                                    
        for j in range(n):
            for x, y in xy_arr[j]:　
                if bin_i[j] == 1 and y != int(bin_i[x - 1]):
                    ok_flg = False
                    break
            else:
                continue
            break
        
    if ok_flg:
        res = sum(int(x) for x in bin_i)
        mas_res = (max_res, res)
        
print(max_res)
Problem p02887 (python)

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

t = ""
cnt = 0
for i in s:
    if i != t:
        cnt += 1
        t = i
print(cnt)

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

t = []
for i in range(1, len(s)):
    if s[i] == s[i - 1]:
        continue
    else:
        t.append(s[i - 1])
t.append(s[i])
print(len(t))
Problem p02988 (python)

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

cnt = 0
for i in range(1, n - 1):
    if (p[i] - p[i - 1] > 0 and p[i + 1] - p[i] >= 0) or (p[i] - p[i - 1] <= 0 and p[i + 1] - p[i] < 0):
        cnt += 1
print(cnt)

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

cnt = 0
for i in range(1, n):
    if (p[i] - p[i - 1] > 0 and p[i + 1] - p[i] >= 0) or (p[i] - p[i - 1] <= 0 and p[i + 1] - p[i] < 0):
        cnt += 1
print(cnt)

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

cnt = 0
for i in range(1, n):
    if (p[i] - p[i - 1] > 0 and p[i + 1] - p[i] >= 0) or (p[i] - p[i - 1] <= 0 and p[i + 1] - p[i] < 0):
        print("==", i, "==")
        cnt += 1
print(cnt)

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

cnt = 0
for i in range(1, n):
    if (p[i] - p[i - 1] > 0 and p[i + 1] - p[i] >= 0) or (p[i] - p[i - 1] <= 0 and p[i + 1] - p[i] < 0):
        print("==", i, "==")
        cnt += 1
print(cnt)
Problem p03160 (python)

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

dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2, n):
    dp[i] = min(dp[i - 1] + abs(h[i]-h[i - 1]), dp[i - 2] + abs(h[i]-h[i - 2]))

print(dp[n - 1])

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

dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[2]-h[1])

for i in range(2, n):
    dp[i] = min(dp[i-1] + abs(h[i]-h[i - 1]), dp[i-2] + abs(h[i]-h[i - 2]))

print(dp[n - 1])

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

dp = [-1] * n
dp[0] = 0
dp[1] = abs(h[2]-h[1])

for i in range(2, n):
    dp[i] = dp[i-1] + abs(h[i]-h[i - 1])
    if i > 1:
        dp[i] = min(dp[i], dp[i-2] + abs(h[i]-h[i - 2]))

print(dp[n - 1])

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

dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[2]-h[1])

for i in range(1, n):
    dp[i] = dp[i-1] + abs(h[i]-h[i - 1])
    if i > 1:
        dp[i] = min(dp[i], dp[i-2] + abs(h[i]-h[i - 2]))

print(dp[n - 1])

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

dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[2]-h[1])

for i in range(2, n):
    dp[i] = dp[i-1] + abs(h[i]-h[i - 1])
    if i > 1:
        dp[i] = min(dp[i], dp[i-2] + abs(h[i]-h[i - 2]))

print(dp[n - 1])

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

dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[2] - h[1])

for i in range(1, n ):
    dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
    if i > 1:
        dp[i] = min(dp[i], dp[i] + abs(h[i] - h[i - 2]))

print(dp[n-1])

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

dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[2] - h[1])

for i in range(1, n ):
    dp[i] =  dp[i - 1] + abs(h[i] - h[i - 1])
    if i > 1:
        dp[i] = min(dp[i], dp[i] + abs(h[i] - h[i - 2]))

print(dp[n-1])

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

dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[2] - h[1])

for i in range(2, n ):
    dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]))

print(dp[n-1])
Problem p02631 (python)

Fixed submission:
n=int(input())
a_array=list(map(int,input().split()))
all_xor=0
for a in a_array:
    all_xor^=a
print(" ".join([str(all_xor^a) for a in a_array]))

Buggy submission (verdict: Runtime Error):
import math

n=int(input())
a_array=list(map(int,input().split()))
next_xor=[0 for _ in range(n-1)]
max_dig=math.floor(math.log2(a_array[0]))
for i in range(n-1):
    next_xor[i]=a_array[i]^a_array[i+1]
    max_dig=math.floor(math.log2(a_array[i+1]))
flag_1=True
ans_1=[0]
ans_2=[2<<max_dig]
SUP=10**9
for xo in next_xor:
    if ans_1[-1]^xo >= SUP:
        flag_1=False
    ans_1.append(ans_1[-1]^xo)
    ans_2.append(ans_2[-1]^xo)
print(" ".join(map(str,ans_1 if flag_1 else ans_2)))
Problem p02903 (python)

Fixed submission:
h, w, a, b = map(int, input().split())
for i in range(b):
    for j in range(a):
        print(0, end="")
    for j in range(w - a):
        print(1, end="")
    print()
for i in range(h - b):
    for j in range(a):
        print(1, end="")
    for j in range(w - a):
        print(0, end="")
    print()

Buggy submission (verdict: Runtime Error):
h, w, a, b = map(int, input().split())
for i in ragne(b):
    for j in range(a):
        print(1,end="")
    for j in range(w-a):
        print(0,end="")
    print()
for i in range(w-b):
    for j in range(a):
        print(0,end="")
    for j in range(w-a):
        print(1,end="")
    print()
Problem p02937 (python)

Fixed submission:
s=input()
t=input()
length=len(s)
exi={chr(97+i): False for i in range(26)}
jump={chr(97+i): [0 for _ in range(2*length)] for i in range(26)}
cru={chr(97+i):0 for i in range(26)}
pointer=0
flag=True
for i,ch in enumerate(s*2):
    exi[ch]=True
    for j in range(cru[ch],i+1):
        jump[ch][j]=1+i-j
    cru[ch]=i+1
for ch in t:
    if exi[ch]:
        pointer+=jump[ch][pointer%length]
    else:
        flag=False
        break
if flag:
    print(pointer)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
length=len(s)
pointer=0
flag=True
for string in t:
    count=0
    while flag and (string != s[pointer%length]):
        pointer+=1
        count+=1
        flag= not(count==length)
    if not flag:
        break
    count+=1
if flag:
    if pointer<length*10**100
    print(pointer+1)
else:
    print(-1)
Problem p02985 (python)

Fixed submission:
N,K=map(int,input().split())
mod=1000000007
path=[[] for i in range(N)]
for i in range(N-1):
  a,b=map(int,input().split())
  a=a-1
  b=b-1
  path[a].append(b)
  path[b].append(a)
#print(path)
  
abc=[False for i in range(N)] #0ならまだ塗ってない
 
abc[0]=True
cnt=0
ans=K%mod
nx=[]
for i in range(len(path[0])):
  child=path[0][i]
  if abc[child]:
    continue
  ans=ans*(K-1-cnt)
  ans=ans%mod
  cnt=cnt+1
  abc[child]=True
  nx.append(child)
while len(nx)>0:
  a=nx.pop()
  cnt=0
  for i in range(len(path[a])):
    child=path[a][i]
    if abc[child]:
      continue
    ans=ans*(K-2-cnt)
    ans=ans%mod
    cnt=cnt+1
    abc[child]=True
    nx.append(child)
      
print(ans%mod)

Buggy submission (verdict: Runtime Error):
import math
num_vertax,num_coler=map(int,input().split())
ver_array=[0]*num_vertax
for i in range(num_vertax-1):
    a,b=map(int,input().split())
    ver_array[a-1]+=1
    ver_array[b-1]+=1
ans=num_coler
factorial=math.factorial(num_coler-1)
def permutation_modp(n,k):
    global factorial
    ans=factorial//n
    ans//=math.factorial(k)
    return ans
ans*=permutation_modp(1,num_coler-ver_array.pop(0)-1)
for ver in ver_array:
    ans*=permutation_modp(num_coler-1,num_coler-ver-1)
print(ans%1000000007)

Buggy submission (verdict: Runtime Error):
def permutation(n,k,mod):
    ans=1
    for i in range(k):
        ans*=(n-i)%mod
        ans%=ans
    return ans
num_vertax,num_coler=map(int,input().split())
ver_array=[[i+1,[]] for i in range(num_vertax)]
for i in range(num_vertax-1):
    a,b=map(int,input().split())
    ver_array[a-1][1].append(ver_array[b-1][0])
    ver_array[b-1][1].append(ver_array[a-1][0])
ans=num_coler
top=1
for ver in ver_array:
    ans*=permutation(num_coler-2+top,len(ver[1])+top-1,1000000007)%1000000007
    top=0
print(ans%1000000007)

Buggy submission (verdict: Runtime Error):
import math

def permutation(n,k):
    return math.factorial(n)//math.factorial(n-k)

if __name__=="__main__":
    num_vertax,num_coler=map(int,input().split())
    ver_array=[[i+1,[]] for i in range(num_vertax)]
    for i in range(num_vertax-1):
        a,b=map(int,input().split())
        ver_array[a-1][1].append(ver_array[b-1][0])
        ver_array[b-1][1].append(ver_array[a-1][0])
    ans=num_coler
    top=1
    for ver in ver_array:
        ans*=permutation(num_coler-top,len(ver[1])+1-top)
        top=2
    print(ans%1000000007)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
if len(s)+1 ==len(t) and all(s[i]==t[i] for i in range(len(s))):
    print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
if len(s)+1 ==len(t):
	if all(s[i]==t[i] for i in range(len(s))):
    	print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
if len(s)+1 ==len(t)
	if all(s[i]==t[i] for i in range(len(s))):
    	print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
s = input()
p = input()
if p == s + -:
    print("Yes")
else: print("No")