Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def main():
	H, W, A, B = map(int, input().split())
	H, W= H-1, W-1
	DIV = 10**9+7
	size = H+W+1

	fact = [0]*size
	inverse = [0]*size
	inv_cal = [0]*size
	fact[:2] = [1, 1]
	inverse[:2] = [1, 1]
	inv_cal[:2] = [0, 1]

	for i in range(2, size):
		fact[i] = (fact[i-1]*i%DIV)
		inv_cal[i] = (-inv_cal[DIV%i]*(DIV//i))%DIV
		inverse[i] = inverse[i-1]*inv_cal[i]%DIV

	def C(n, r):
		ans = fact[n]*inverse[r]%DIV
		return ans*inverse[n-r]%DIV

	ans = 0
	for x in range(B, W+1):
		y = H-A
		tmp = (C(x+y, x)*(C(H+W-x-y-1, W-x))%DIV
		ans += tmp
		ans %= DIV

	print(ans)


if __name__ == '__main__':
	main()

Fixed submission:
def main():
	H, W, A, B = map(int, input().split())
	H, W= H-1, W-1
	DIV = 10**9+7
	size = H+W+1

	fact = [0]*size
	inverse = [0]*size
	inv_cal = [0]*size
	fact[:2] = [1, 1]
	inverse[:2] = [1, 1]
	inv_cal[:2] = [0, 1]

	for i in range(2, size):
		fact[i] = (fact[i-1]*i%DIV)
		inv_cal[i] = (-inv_cal[DIV%i]*(DIV//i))%DIV
		inverse[i] = inverse[i-1]*inv_cal[i]%DIV

	def C(n, r):
		ans = fact[n]*inverse[r]%DIV
		return ans*inverse[n-r]%DIV

	ans = 0
	for x in range(B, W+1):
		y = H-A
		tmp = (C(x+y, x)%DIV)*(C(H+W-x-y-1, W-x)%DIV)%DIV
		ans += tmp
		ans %= DIV

	print(ans)


if __name__ == '__main__':
	main()

Buggy python submission (verdict: Runtime Error):
def main():
	H, W, A, B = map(int, input().split())
	H, W= H-1, W-1
	DIV = 10**9+7

	fact = [0]*(H+W-A+1)
	inverse = [0]*(H+W-A+1)
	inv_cal = [0]*(H+W-A+1)
	fact[:2] = [1, 1]
	inverse[:2] = [1, 1]
	inv_cal[:2] = [0, 1]

	for i in range(2, H+W-A+1):
		fact[i] = (fact[i-1]*i%DIV)
		inv_cal[i] = (-inv_cal[DIV%i]*(DIV//i))%DIV
		inverse[i] = inverse[i-1]*inv_cal[i]%DIV

	def C(n, r):
		ans = fact[n]*inverse[r]%DIV
		return ans*inverse[n-r]%DIV

	ans = 0
	for x in range(B, W+1):
		y = H-A
		tmp = (C(x+y, x)%DIV)*(C(H+W-x-y-1, W-x)%DIV)%DIV
		ans += tmp
		ans %= DIV

	print(ans)


if __name__ == '__main__':
	main()

Fixed submission:
def main():
	H, W, A, B = map(int, input().split())
	H, W= H-1, W-1
	DIV = 10**9+7
	size = H+W+1

	fact = [0]*size
	inverse = [0]*size
	inv_cal = [0]*size
	fact[:2] = [1, 1]
	inverse[:2] = [1, 1]
	inv_cal[:2] = [0, 1]

	for i in range(2, size):
		fact[i] = (fact[i-1]*i%DIV)
		inv_cal[i] = (-inv_cal[DIV%i]*(DIV//i))%DIV
		inverse[i] = inverse[i-1]*inv_cal[i]%DIV

	def C(n, r):
		ans = fact[n]*inverse[r]%DIV
		return ans*inverse[n-r]%DIV

	ans = 0
	for x in range(B, W+1):
		y = H-A
		tmp = (C(x+y, x)%DIV)*(C(H+W-x-y-1, W-x)%DIV)%DIV
		ans += tmp
		ans %= DIV

	print(ans)


if __name__ == '__main__':
	main()
Buggy python submission (verdict: Runtime Error):
print(r**2*3)

Fixed submission:
r = int(input())
print(r**2*3)

Buggy python submission (verdict: Runtime Error):
echo(r^2*3)

Fixed submission:
r = int(input())
print(r**2*3)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
print(f'A:{A}')
x = (sum([A[i] for i in range(N) if i % 2 == 0]) - sum([A[i] for i in range(N) if i % 2 == 1]))
print(x)
for  i in range(N-1):
    x = 2*A[i]-x
    print(x)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
x = (sum([A[i] for i in range(N) if i % 2 == 0]) - sum([A[i] for i in range(N) if i % 2 == 1]))
print(x)
for  i in range(N-1):
    x = 2*A[i]-x
    print(x)
Buggy python submission (verdict: Runtime Error):
import math
from math import gcd as bltin_gcd
def coprime2(a, b):
    return bltin_gcd(a, b) == 1

A, B, C, D = map(int, input().split())
N = B - A + 1  #整数列の長さ

if C == D:
    tmp = 0   #最後にNから引く
    mod = A % C
    tmp += math.ceil((N-mod)/C)
    print(N-tmp)
elif coprime2(C, D):
    tmp = 0   #最後にNから引く
    mod = A % C
    tmp += math.ceil((N-mod)/C)
    mod = A % D
    tmp += math.ceil((N-mod)/D)
    mod = A % (D*C)
    tmp -= math.ceil((N-mod)/(D*C))
    print(N-tmp)
else:
    tmp = 0   #最後にNから引く
    mod = A % min(C, D)
    tmp += math.ceil((N-mod)/min(C, D))
    print(N-tmp)

Fixed submission:
import math
import fractions
A, B, C, D = map(int, input().split())
g = int(C*D/fractions.gcd(C,D))
N = B - A + 1
E = B - B//C  - B//D + B//g
F = A-1 - (A-1)//C - (A-1)//D + (A-1)//g
print(int(E-F))
Buggy python submission (verdict: Runtime Error):
#A
X, A =  map(int, input().split())
if X < A:
    print(f"0")
else:
    print(f"10")

Fixed submission:
#A
X, A =  map(int, input().split())
if X < A:
    print("0")
else:
    print("10")
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
LIST = list(map(int, input().split()))
 
d = 0
i = 0
 
while d <= X:
    d = d + LIST[i]
    i = i + 1
    
print(i)

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

RES = []
ichi = 0
RES.append(ichi)
for i in LIST:
    ichi = ichi + i
    RES.append(ichi)

cnt = 0
for i in RES:
    if i <= X:
        cnt = cnt + 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
#C
W, H, x, y = map(int, input().split())
S = W*H/2
ans = '0'
if W/2 == x and H/2 == y:
    ans = '1'

print(f"{S} {ans}")

Fixed submission:
#C
W, H, x, y = map(int, input().split())
S = W*H/2
ans = '0'
if W/2 == x and H/2 == y:
    ans = '1'

print("{} {}".format(S, ans))

Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())
S = W * H / 2

if x == W // 2 and y == H //2:
    flg = 1

print("{} {}".format(S, flg))

Fixed submission:
#C
W, H, x, y = map(int, input().split())
S = W*H/2
ans = '0'
if W/2 == x and H/2 == y:
    ans = '1'

print("{} {}".format(S, ans))
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 1000000007
n, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
dp = [-1 for _ in range(n+1)]
dp[0] = 1
dp[1] = 1
if 1 in A:
    dp[1] = 0

step = 2
while True:
    if step == n+1:
        break
    
    if step in A:
        dp[step] = 0
    else:
        dp[step] = (dp[step-1] + dp[step-2]) % MOD
        
    step += 1
    
print(dp[n])

Fixed submission:
mod = 1000000007
def add(a, b):
    return (a + b) % mod

N, M = map(int, input().split())
Broken_set = set([])
for _ in range(M):
    Broken_set.add(int(input()))

if 1 in Broken_set:    
    dp = [0]*(N+1)
    dp[0] = 1
    dp[1] = 0
    for i in range(2, N+1):
        if i in Broken_set:
            dp[i] = 0
        else:
            dp[i] = add(dp[i-1], dp[i-2])

else:
    dp = [0]*(N+1)
    dp[0] = 1
    dp[1] = 1
    for i in range(2, N+1):
        if i in Broken_set:
            dp[i] = 0
        else:
            dp[i] = add(dp[i-1], dp[i-2])

print(dp[N])

Buggy python submission (verdict: Runtime Error):
n, M = map(int, input().split())
A = list(map(int, input().split()))
dp = [-1 for _ in range(n+1)]
dp[0] = 1
dp[1] = 1
if 1 in A:
    dp[1] = 0

step = 2
while True:
    if step == n+1:
        break
    
    if step in A:
        dp[step] = 0
    else:
        dp[step] = dp[step-1] + dp[step-2]
        
    step += 1
    
print(dp[n])

Fixed submission:
mod = 1000000007
def add(a, b):
    return (a + b) % mod

N, M = map(int, input().split())
Broken_set = set([])
for _ in range(M):
    Broken_set.add(int(input()))

if 1 in Broken_set:    
    dp = [0]*(N+1)
    dp[0] = 1
    dp[1] = 0
    for i in range(2, N+1):
        if i in Broken_set:
            dp[i] = 0
        else:
            dp[i] = add(dp[i-1], dp[i-2])

else:
    dp = [0]*(N+1)
    dp[0] = 1
    dp[1] = 1
    for i in range(2, N+1):
        if i in Broken_set:
            dp[i] = 0
        else:
            dp[i] = add(dp[i-1], dp[i-2])

print(dp[N])
Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
Field = []
Field.append(['#'] * (W+2))
for _ in range(H):
    Field.append((list('#'+input()+'#')))
Field.append(['#'] * (W+2))

DPL = [[0 for _ in range(W+2)] for _ in range(H+2)]
DPR = [[0 for _ in range(W+2)] for _ in range(H+2)]
DPU = [[0 for _ in range(W+2)] for _ in range(H+2)]
DPD = [[0 for _ in range(W+2)] for _ in range(H+2)]

for h in range(1, H+1):
    for w in range(1, W+1):
        if Field[h][w] == '#':
            DPL[h][w] = 0
        else:
            DPL[h][w] = DPL[h][w-1] + 1
for h in range(1, H+1):
    for w in range(1, W+1):
        if Field[h][W-w+1] == '#':
            DPR[h][W-w+1] = 0
        else:
            DPR[h][W-w+1] = DPR[h][W-w+1+1] + 1
for h in range(1, H+1):
    for w in range(1, W+1):
        if Field[h][w] == '#':
            DPU[h][w] = 0
        else:
            DPU[h][w] = DPU[h-1][w] + 1   
for h in range(1, H+1):
    for w in range(1, W+1):
        if Field[H-h+1][w] == '#':
            DPD[H-h+1][w] = 0
        else:
            DPD[H-h+1][w] = DPD[H-h+1+1][w] + 1 
ans = 0          
for h in range(1, H+1):
    for w in range(1, W+1):
        ans = max(ans,DPL[h][w]+DPR[h][w]+DPU[h][w]+DPD[h][w])
print(ans-3)

Fixed submission:
H, W = map(int, input().split())
Field = []
Field.append(['#'] * (W+2))
for _ in range(H):
    Field.append((list('#'+input()+'#')))
Field.append(['#'] * (W+2))

DPL = [[0 for _ in range(W+2)] for _ in range(H+2)]
DPR = [[0 for _ in range(W+2)] for _ in range(H+2)]
DPU = [[0 for _ in range(W+2)] for _ in range(H+2)]
DPD = [[0 for _ in range(W+2)] for _ in range(H+2)]

for h in range(1, H+1):
    for w in range(1, W+1):
        if Field[h][w] == '#':
            DPL[h][w] = 0
        else:
            DPL[h][w] = DPL[h][w-1] + 1
for h in range(1, H+1):
    for w in range(1, W+1):
        if Field[h][W-w+1] == '#':
            DPR[h][W-w+1] = 0
        else:
            DPR[h][W-w+1] = DPR[h][W-w+1+1] + 1
for h in range(1, H+1):
    for w in range(1, W+1):
        if Field[h][w] == '#':
            DPU[h][w] = 0
        else:
            DPU[h][w] = DPU[h-1][w] + 1   
for h in range(1, H+1):
    for w in range(1, W+1):
        if Field[H-h+1][w] == '#':
            DPD[H-h+1][w] = 0
        else:
            DPD[H-h+1][w] = DPD[H-h+1+1][w] + 1 
ans = 0          
for h in range(1, H+1):
    for w in range(1, W+1):
        ans = max(ans,DPL[h][w]+DPR[h][w]+DPU[h][w]+DPD[h][w])
print(ans-3)
Buggy python submission (verdict: Runtime Error):
import bisect
from collections import deque
N, K = map(int, input().split())
D = list(map(int, input().split()))

ans = 0
for pull_num in range(K+1):
  	if pull_num > N:
        continue
    push_num = K - pull_num
    #print('pull_num:{}'.format(pull_num))
    for left_num in range(pull_num+1):
        right_num = pull_num - left_num
        #print('left_num:{} right_num:{}'.format(left_num, right_num))
        left_D = D[:left_num];  right_D = D[N-right_num:]
        #print('left_D:{} right_D:{}'.format(left_D, right_D))
        temochi = left_D + right_D
        temochi.sort()
        #print('temochi:{}'.format(temochi))
        index = bisect.bisect_left(temochi, 0)
        #print('index:{}'.format(index))
        #print('push_num:{}'.format(push_num))
        if push_num >= index:
            ans = max(ans, sum(temochi[index:]))
        else:
            ans = max(ans, sum(temochi[push_num:]))
print(ans)

Fixed submission:
import bisect
from collections import deque
N, K = map(int, input().split())
D = list(map(int, input().split()))

ans = 0
for pull_num in range(K+1):
    if pull_num > N:
        continue
    push_num = K - pull_num
    for left_num in range(pull_num+1):
        right_num = pull_num - left_num
        left_D = D[:left_num];  right_D = D[N-right_num:]
        temochi = left_D + right_D
        temochi.sort()
        index = bisect.bisect_left(temochi, 0)
        if push_num >= index:
            ans = max(ans, sum(temochi[index:]))
        else:
            ans = max(ans, sum(temochi[push_num:]))
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
if A >= 13:
    print(B)
elif 6 <= A < 13:
    print(b/2)
else:
    print('0')

Fixed submission:
Age, Full_cost= map(int, input().split())

if Age >= 13:
    print(Full_cost)
elif 6 <= Age <=12:
    print(int(Full_cost/2))
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
if A >= 13:
    print(B)
elif 6 <= A < 13:
    print(b/2)
else:
    print('0)

Fixed submission:
Age, Full_cost= map(int, input().split())

if Age >= 13:
    print(Full_cost)
elif 6 <= Age <=12:
    print(int(Full_cost/2))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
#C
N, M = map(int, input().split())
Table = [list(map(int, input().split())) for _ in range(M)]
Table.sort(key=lambda x:x[0])
Table.sort(key=lambda x:x[1])
#print(f'Table:{Table}')
first = Table[0][0]
end = Table[0][1]
Table.pop(0)

#print(f'first:{first} end:{end}')
for task in Table:
    #print(f'task:{task}')
    num = task[0]
    #print(f'num:{num}')
    if num <= end:
        first = num
    else:
        ans = 0
        break

if ans == 0:
    print(ans)
else:
    print(end-first+1)

Fixed submission:
def kasanari(A, B, C, D):
    if B < C or A > D:
        return 0
    elif B <= D:
        if A >= C:
            return [A, B]
        else:
            return [C, B]
    else:
        if A >= C:
            return [A, D]
        else:
            return [C, D]

N, M = map(int, input().split())
L = []
for _ in range(M):
    L.append(list(map(int, input().split())))

tmp = [L[0][0], L[0][1]]
L.pop(0)
for i in L:
    L1 = tmp[0]
    R1 = tmp[1]
    tmp = kasanari(L1, R1, i[0], i[1])
    if tmp == 0:
        print(0)
        exit()
print(tmp[1]-tmp[0]+1)
Buggy python submission (verdict: Runtime Error):
import bisect
N = int(input())
A = list(map(int, input().split()))
A.sort()
insert_index = bisect.bisect_left(A,0)
if insert_index == 0:
    print(sum(A) - A[0]*2)
if insert_index == len(A):
    print(Ans = -1*sum(A) + A[-1]*2)
if len(A[:insert_index]) % 2 == 0:
    print(-1*sum(A[:insert_index])+sum(A[insert_index:]))
else:
    tmp = -1*sum(A[:insert_index])+sum(A[insert_index:])
    print(max(tmp-A[insert_index]*2, tmp+A[insert_index-1]*2))

Fixed submission:
import bisect
total = 0
N = int(input())
A = list(map(int, input().split()))
hu = [i for i in A if i < 0]
sei = [i for i in A if i >= 0]
hu.sort()
sei.sort()
if len(hu) % 2 == 0:
    print(sum(sei)+sum(hu)*-1)
else:
    if sei:
        print(sum(sei)+sum(hu)*-1 - min(-1*hu[-1], sei[0])*2)
    else:
        print(sum(sei)+sum(hu)*-1 + 1*hu[-1]*2)

Buggy python submission (verdict: Runtime Error):
import bisect
N = int(input())
A = list(map(int, input().split()))
A.sort()
insert_index = bisect.bisect_left(A,0)
if len(A[:insert_index]) % 2 == 0:
    Ans = -1*sum(A[:insert_index])+sum(A[insert_index:])
else:
    Tmp = -1*sum(A[:insert_index])+sum(A[insert_index:])
    if insert_index == 0:   #全て正のとき
        Ans = Tmp - A[0]*2
    else:
        if insert_index < len(A):
            Ans = max(Tmp-A[:insert_index]*2, Tmp+A[insert_index-1]*2)
        else:
            Ans = Tmp + A[-1]
print(Ans)

Fixed submission:
import bisect
total = 0
N = int(input())
A = list(map(int, input().split()))
hu = [i for i in A if i < 0]
sei = [i for i in A if i >= 0]
hu.sort()
sei.sort()
if len(hu) % 2 == 0:
    print(sum(sei)+sum(hu)*-1)
else:
    if sei:
        print(sum(sei)+sum(hu)*-1 - min(-1*hu[-1], sei[0])*2)
    else:
        print(sum(sei)+sum(hu)*-1 + 1*hu[-1]*2)

Buggy python submission (verdict: Runtime Error):
import bisect
N = int(input())
A = list(map(int, input().split()))
A.sort()
insert_index = bisect.bisect_left(A,0)
if len(A[:insert_index]) % 2 == 0:
    Ans = -1*sum(A[:insert_index])+sum(A[insert_index:])
else:
    Tmp = -1*sum(A[:insert_index])+sum(A[insert_index:])
    if insert_index == 0:   #全て正のとき
        Ans = Tmp - A[0]*2
    else:
        Ans = max(Tmp-A[insert_index]*2, Tmp+A[insert_index-1]*2)
print(Ans)

Fixed submission:
import bisect
total = 0
N = int(input())
A = list(map(int, input().split()))
hu = [i for i in A if i < 0]
sei = [i for i in A if i >= 0]
hu.sort()
sei.sort()
if len(hu) % 2 == 0:
    print(sum(sei)+sum(hu)*-1)
else:
    if sei:
        print(sum(sei)+sum(hu)*-1 - min(-1*hu[-1], sei[0])*2)
    else:
        print(sum(sei)+sum(hu)*-1 + 1*hu[-1]*2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())

ans = float('inf')
for i in range(len(S)):
    cnt = 0
    Right = S[i+1:]
    Left = S[:i]
    cnt += Right.count('E')  #右にいて東を向いている人の数
    cnt += Left.count('W')  #左にいて西を向いている人の数
    if cnt >= ans:
        continue
    
    ans = cnt

print(ans)

Fixed submission:
N = int(input())
S = list(input())

cnt_right = S[1:].count('E')
cnt_left = 0
ans = cnt_right + cnt_left

for ichi in range(len(S)-1):
    if S[ichi] == 'W':
        cnt_left += 1
    if S[ichi+1] == 'E':
        cnt_right -= 1
    ans = min(ans, cnt_right + cnt_left)
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())

ans = float('inf')
for i in range(len(S)):
    cnt = 0
    Right = S[i+1:]
    Left = S[:i]
    cnt += Right.count('E')  #右にいて東を向いている人の数
    cnt += Left.count('W')  #左にいて西を向いている人の数
    
    ans = min(ans, cnt)

print(ans)

Fixed submission:
N = int(input())
S = list(input())

cnt_right = S[1:].count('E')
cnt_left = 0
ans = cnt_right + cnt_left

for ichi in range(len(S)-1):
    if S[ichi] == 'W':
        cnt_left += 1
    if S[ichi+1] == 'E':
        cnt_right -= 1
    ans = min(ans, cnt_right + cnt_left)
    
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
LIST = list(map(int, input().split()))
LIST.sort()
Bob = 0
Alice = 0

while True:
    if len(LIST)==0:
        break
    Alice = Alice + LIST.pop()
    Bob = Bob + LIST.pop()

print(Alice - Bob)

Fixed submission:
N = int(input())
LIST = list(map(int, input().split()))
LIST.sort()
Bob = 0
Alice = 0

while True:
    if len(LIST) == 0:
        break
    Alice = Alice + LIST.pop()
    if len(LIST) == 0:
        break
    Bob = Bob + LIST.pop()

print(Alice - Bob)
Buggy python submission (verdict: Time Limit Exceeded):
N, Y = map(int, input().split())
exit = False

for i in range(2500):
    if 10000 * i > Y or exit == True:
        break
    for j in range(5000):
        if 10000*i + 5000*j > Y or exit == True:
            break
        for k in range(25000):
                if 10000*i + 5000*j + 1000*k > Y or exit == True:
                    break
                if 10000*i + 5000*j + 1000*k == Y and i + j + k == N:
                    print("{} {} {}".format(i, j, k))
                    exit = True

if exit == False:
    print("-1 -1 -1")

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

for i in range(N+1):
    if exit == True:
        break
    for j in range(N-i+1):
        if exit == True:
            break
        k = N - i - j
        if 10000*i + 5000*j + 1000*k == Y:
            exit = True
            print("{} {} {}".format(i, j, k))
            
if exit == False:
    print("-1 -1 -1")
Buggy python submission (verdict: Time Limit Exceeded):
import sys

N, K = map(int, input().split())
l = list(input().split())

l_set = set(l)
syukei = []
for i in l_set:
    syukei.append(l.count(i))
    syukei.sort()
    
if len(syukei)-K > 0:
    print(sum(syukei[:len(syukei)-K]))
else:
    print(0)

Fixed submission:
import collections
N, K = map(int, input().split())
l = list(input().split())

c = collections.Counter(l)
c = c.most_common()
cnt = 0
if len(c) - K > 0:
    for i in range(1 , len(c) - K + 1):
        cnt += c[-i][1]

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
l = list(map(int, input().split()))

l_set = set(l)
syukei = []
for i in l_set:
    syukei.append(l.count(i))
    syukei.sort()
    
if len(syukei)-K > 0:
    print(sum(syukei[:len(syukei)-K]))
else:
    print(0)

Fixed submission:
import collections
N, K = map(int, input().split())
l = list(input().split())

c = collections.Counter(l)
c = c.most_common()
cnt = 0
if len(c) - K > 0:
    for i in range(1 , len(c) - K + 1):
        cnt += c[-i][1]

print(cnt)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
slide_num = len(S) - len(T)
if slide_num < 0:
    exit()
for slide in range(slide_num+1):
    for j in range(len(S)-slide):
        if S[j+slide] == T[j] or S[j+slide] == '?':
            None
        else:
            break
    else:
        print((S[:slide] + T + S[slide+len(T):]).replace('?', 'a'))
        exit()
print('UNRESTORABLE')

Fixed submission:
S = input()
T = input()
L = []
slide_num = len(S) - len(T)
if slide_num < 0:
    print('UNRESTORABLE')
    exit()
for slide in range(slide_num+1):
    for j in range(len(T)):
        if S[j+slide] == T[j] or S[j+slide] == '?':
            None
        else:
            break
    else:
        L.append((S[:slide] + T + S[slide+len(T):]).replace('?', 'a'))

if L:
    print(L.pop())
else:
    print('UNRESTORABLE')

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
slide_num = len(S) - len(T)
if slide_num < 0:
    exit()
for slide in range(slide_num+1):
    for j in range(len(S)-slide):
        if S[j+slide] == T[j] or S[j+slide] == '?':
            None
        else:
            break
    else:
        print((S[:2] + T + S[2+len(T):]).replace('?', 'a'))
        exit()
print('UNRESTORABLE')

Fixed submission:
S = input()
T = input()
L = []
slide_num = len(S) - len(T)
if slide_num < 0:
    print('UNRESTORABLE')
    exit()
for slide in range(slide_num+1):
    for j in range(len(T)):
        if S[j+slide] == T[j] or S[j+slide] == '?':
            None
        else:
            break
    else:
        L.append((S[:slide] + T + S[slide+len(T):]).replace('?', 'a'))

if L:
    print(L.pop())
else:
    print('UNRESTORABLE')

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
slide_num = len(S) - len(T)
if slide_num < 0:
    pass
for slide in range(slide_num+1):
    for j in range(len(S)-slide):
        if S[j+slide] == T[j] or S[j+slide] == '?':
            None
        else:
            break
    else:
        print((S[:2] + T + S[2+len(T):]).replace('?', 'a'))
        exit()
print('UNRESTORABLE')

Fixed submission:
S = input()
T = input()
L = []
slide_num = len(S) - len(T)
if slide_num < 0:
    print('UNRESTORABLE')
    exit()
for slide in range(slide_num+1):
    for j in range(len(T)):
        if S[j+slide] == T[j] or S[j+slide] == '?':
            None
        else:
            break
    else:
        L.append((S[:slide] + T + S[slide+len(T):]).replace('?', 'a'))

if L:
    print(L.pop())
else:
    print('UNRESTORABLE')
Buggy python submission (verdict: Runtime Error):
phai = 1
cnt = 0
loop_hantei = {1}

for _ in range(N):
    phai = A[phai-1]
    cnt += 1
    if phai in loop_hantei:
        print('-1')
        break
    else:
        loop_hantei.add(phai)
    if phai == 2:
        print(cnt)
        break

Fixed submission:
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

phai = 1
cnt = 0
loop_hantei = {1}

for _ in range(N):
    phai = A[phai-1]
    cnt += 1
    if phai in loop_hantei:
        print('-1')
        break
    else:
        loop_hantei.add(phai)
    if phai == 2:
        print(cnt)
        break
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
l = [i for i in range(K+1)]
cnt = 0
for i in l:
    if i > S:
        break
    elif i == S:
        cnt += 1
        break
    elif i < S:
        for j in l:
            if i+j > S:
                break
            elif i+j == S:
                cnt += 1
                break
            elif i+j < S:
                if K >= S-i-j:
                    cnt += 1
                
print(cnt)

Fixed submission:
K, S = map(int, input().split())
l = [i for i in range(K+1)]
cnt = 0
for i in l:
    if i > S:
        break
    elif i == S:
        cnt += 1
        break
    elif i < S:
        tmp1 = S-i
        if K-tmp1 >= 0:
            cnt += tmp1 + 1
        else:
            tmp2 = 2*K + 1 - tmp1
            if tmp2 > 0:
                cnt += tmp2
                
print(cnt)
Buggy python submission (verdict: Runtime Error):
r=input()
a= 3*r**2
print(a)

Fixed submission:
print(3*int(input())**2)