Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数

N,K,S = imn()
cnt = 0
A = []
for i in range(N):
    
    cnt += 1
    if cnt <= K: 
        A.append(str(S))
    else:
        if S != 10**9:
            A.append(str(10**9)) 
        else:
            A.append(1)
print(join(A, ' '))



Fixed submission:
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数

N,K,S = imn()
cnt = 0
A = []
for i in range(N):
    
    cnt += 1
    if cnt <= K: 
        A.append(str(S))
    else:
        if S != 10**9:
            A.append(str(10**9)) 
        else:
            A.append(str(1))
print(join(A, ' '))
Buggy python submission (verdict: Runtime Error):
# ABC145 D
# 問題
# 二次元グリッド(0,0)に現在いる
# マス(i,j)にあるとき(i+1,j+2)または(i+2,j+1)に移動できる
# (X,Y)まで移動させる方法は何通りあるか
# 10*9+7で割った余りを求める
# 二項係数(nCr)の高速な求め方が必要

X,Y = imn()

# 一回の移動でx座標とy座標の値は3増える。X+Yが3の倍数でないときは0
if (X+Y)%3 != 0:
    print(0)
    exit()
# M + 2N = X, 2M + N = Yの連立方程式が得られるので、M,Nを求める 
M = (2*Y-X)//3
N = (-2*M)+Y

# nCrをやる前に前準備を行う
MAX = 10**6
fact = [1,1]
factinv = [1,1]
inv = [0,1]
for i in range(2, MAX+1):
    fact.append((fact[-1]*i) % MOD)
    inv.append((-inv[MOD%i]*(MOD//i))%MOD)
    factinv.append((factinv[-1]*inv[-1])%MOD)

# nCrを求める
def cmb(n,r):
    if r < 0 or n < r:
        return 0
    r = min(r, n-r)
    return fact[n] * factinv[r] * factinv[n-r] % MOD 

print(cmb(M+N, M))



Fixed submission:
# python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def lprint(l): print(*l, sep='\n')

X,Y = imn()

if (X+Y)%3 != 0:
    print(0)
    exit()

M = (2*Y-X)//3
N = (-2*M)+Y

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

def cmb(n,r,p):
    if r < 0 or n < r:
        return 0
    r = min(r, n-r)
    return fact[n] * factinv[r] * factinv[n-r] % p
print(cmb(M+N, M, MOD))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

prime = prime_factorize(N)
min_cnt = 10**13
if len(prime) == 1:
    print(prime[0]-1)
else:
    for i in range(1,2 ** len(prime)-1):
        x = 1
        y = 1
        index = 0
        while index <= len(prime)-1:
            if i & 1 == 1:
                x *= prime[index] 
            else:
                y *= prime[index]
            i = i >> 1
            index += 1
        min_cnt = min(min_cnt, (x-1) + (y-1))
    print(min_cnt)




Fixed submission:
N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

min_cnt = 10**13
divisor = make_divisors(N)

for i in range(len(divisor)):
    b = N // divisor[i]
    min_cnt = min(min_cnt, (divisor[i]-1 + b-1))
print(min_cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import itertools

N = int(input())
L = list(map(int, input().split()))

cnt = 0

for i in range(N):
    L_t = L[i+1:N]
    for v in itertools.combinations(L_t, 2):
        a = int(L[i])
        b = int(v[0])
        c = int(v[1])

        if a < b + c and b < a + c and c < a + b:
            cnt += 1
print(cnt)




Fixed submission:
import bisect
N = int(input())
L = sorted(map(int, input().split()))

cnt = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        ab = L[i] + L[j]
        c_index = bisect.bisect_left(L, ab)
        cnt += c_index - 1 - j
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import itertools

N = int(input())
L = list(map(int, input().split()))

cnt = 0

for v in itertools.combinations(L, 3):
    a = int(v[0])
    b = int(v[1])
    c = int(v[2])

    if a < b + c and b < a + c and c < a + b:
        cnt += 1
print(cnt)




Fixed submission:
import bisect
N = int(input())
L = sorted(map(int, input().split()))

cnt = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        ab = L[i] + L[j]
        c_index = bisect.bisect_left(L, ab)
        cnt += c_index - 1 - j
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N = int(input())
L = sorted(map(int, input().split()),reverse=True)

cnt = 0
for i in range(N):
    for j in range(i+1, N):
        tmp  = L[i] - L[j]
        for k in range(j+1,N):
            if tmp < L[k]:
                cnt += 1
            else:
                break
print(cnt)





Fixed submission:
import bisect
N = int(input())
L = sorted(map(int, input().split()))

cnt = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        ab = L[i] + L[j]
        c_index = bisect.bisect_left(L, ab)
        cnt += c_index - 1 - j
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
A = sorted(map(int, input().split()))[::-1]
 
total = 0
for i in range(M):
    A[0] = A[0] // 2
    for j in range(N-1-i):
        if A[j] < A[j+1]:
            tmp = A[j]
            A[j] = A[j+1]
            A[j+1] = tmp
        else:
            break
print(sum(A))

Fixed submission:
import heapq
import math

N,M = map(int, input().split())
A = list(map(lambda x : int(x) * -1, input().split()))

heapq.heapify(A)
 
for i in range(M):
    tmp = heapq.heappop(A)
    heapq.heappush(A, int(tmp / 2))
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
A = sorted(map(int, input().split()))[::-1]

total = 0
for i in range(M):
    A[0] = A[0] // 2
    for j in range(N-1):
        if A[j] < A[j+1]:
            tmp = A[j]
            A[j] = A[j+1]
            A[j+1] = tmp
        else:
            break
print(sum(A))
            



Fixed submission:
import heapq
import math

N,M = map(int, input().split())
A = list(map(lambda x : int(x) * -1, input().split()))

heapq.heapify(A)
 
for i in range(M):
    tmp = heapq.heappop(A)
    heapq.heappush(A, int(tmp / 2))
print(-sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
def main(): 
    n = int(input())
    h = list(map(int, input().split()))

    max_i = 0
    
    for i in range(n):
        cnt = 0
        for j in range(i+1, n):
            if h[j-1] >= h[j]:
                cnt += 1
            else:
                break
        max_i = max(max_i, cnt)
        if max_i >= n - i - 1:
            break
    print(max_i)

if __name__ == "__main__":
    main() 

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

    max_i = 0
    i = 0 
    while i < n:
        cnt = 0
        for j in range(i+1, n):
            if h[j-1] >= h[j]:
                cnt += 1
            else:
                i = j
                break
                
        max_i = max(max_i, cnt)
        if max_i >= n - i - 1:
            break
    print(max_i)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main(): 
    n = int(input())

    sum = 0

    for i in range(1, n):
        sum += i

    print(sum)



if __name__ == "__main__":
    main() 

Fixed submission:
def main(): 
    n = int(input())

    print(int((n-1) * n // 2))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main(): 
    n = int(input())
    s = sorted([sorted(input()) for _ in range(n)])
    
    cnt = 0
    for i in range(n):
        for j in range(i+1,n):
            if s[i] == s[j]:
                cnt += 1
            else:
                break

    print(cnt)


if __name__ == "__main__":
    main() 

Fixed submission:
def main(): 
    n = int(input())
    s = [''.join(sorted(input())) for _ in range(n)]
    ans = 0
    dic = {}
    for si in s:
        if si in dic:
            ans += dic[si]
            dic[si] += 1
        else:
            dic[si] = 1
    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main(): 
    n = int(input())
    s = [sorted(input()) for _ in range(n)]
    
    cnt = 0
    for i in range(n):
        for j in range(i+1,n):
            if s[i] == s[j]:
                cnt += 1

    print(cnt)


if __name__ == "__main__":
    main() 

Fixed submission:
def main(): 
    n = int(input())
    s = [''.join(sorted(input())) for _ in range(n)]
    ans = 0
    dic = {}
    for si in s:
        if si in dic:
            ans += dic[si]
            dic[si] += 1
        else:
            dic[si] = 1
    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import math

def main(): 
    A,B,C,D = map(int, input().split())

    c_cnt = (B // C) - ((A-1) // C)
    d_cnt = (B // D) - ((A-1) // D)

    lcm= (C * D) // math.gcd(C, D)

    cd_cnt = (B // lcm) - ((A-1) // lcm)

    print(B - (A-1) - c_cnt - d_cnt + cd_cnt)


    
if __name__ == "__main__":
    main() 

Fixed submission:
import fractions

def main(): 
    A,B,C,D = map(int, input().split())

    c_cnt = (B // C) - ((A-1) // C)
    d_cnt = (B // D) - ((A-1) // D)

    lcm= (C * D) // fractions.gcd(C, D)

    cd_cnt = (B // lcm) - ((A-1) // lcm)

    print(B - (A-1) - c_cnt - d_cnt + cd_cnt)


    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main(): 


    card_cnt, gate_cnt = map(int, input().split())

    LR = set(range(1, 100000+1))

    for _ in range(gate_cnt):
        L, R = map(int, input().split())
        LR.intersection_update(range(L, R+1))
        if len(LR) == 0:
            break

    print(len(LR))


if __name__ == "__main__":
    main() 

Fixed submission:
def main(): 


    card_cnt, gate_cnt = map(int, input().split())

    min_v, max_v = map(int, input().split())
    for _ in range(1, gate_cnt):
        L,R = map(int, input().split())
        min_v = max(min_v, L)
        max_v = min(max_v, R)
        if min_v > max_v:
            print(0)
            break
    else:
        print(len(range(min_v, max_v+1)))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
,b,c=map(int,input().split())

if a <=c <=b:
    print('Yes')
elif a >= c >= b
    print('Yes')
else:
    print('No')

Fixed submission:


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

if a <=c <=b:
    print('Yes')
elif a >= c >= b:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):


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

if a < c < b:
    print('Yes')
else:
    print('No)

Fixed submission:


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

if a <=c <=b:
    print('Yes')
elif a >= c >= b:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

N,Q = imn()
S = input()
lr = [iln() for _ in range(Q)]

s = [0 for _ in range(N+1)]

for i in range(N):
    s[i+1] = s[i]
    if S[i] == 'A' and S[i+1] == 'C':
        s[i+1] += 1

for i in range(Q):
    l = lr[i][0]
    r = lr[i][1]
    print(s[r-1]-s[l-1])


Fixed submission:
N,Q = map(int, input().split())
S = input()
LR = [list(map(lambda x : int(x)-1, input().split())) for _ in range(Q)]

L = [0 for _ in range(N)]
R = [0 for _ in range(N)]

for i in range(1,N):
    if S[i-1:i+1] == 'AC':
        if i == 0:
            L[i] = 1
        else:
            L[i] = L[i-1] + 1
    else:
        if i > 0:
            L[i] = L[i-1]

for i in range(Q):
    Li = LR[i][0]
    Ri = LR[i][1]

    print(L[Ri] - L[Li])
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = str(S)

now_size = len(T)

while True:

    T = T.replace('01','')
    T = T.replace('10','')

    if now_size == len(T):
        break
    else:
        now_size = len(T)

print(len(S) - len(T))

Fixed submission:
S = list(input())

original_length = len(S)

for i in range(len(S)-1, 0, -1):
    if len(S) > i:
        if S[i-1] != S[i]:
            del S[i-1:i+1]

print(original_length - len(S))
Buggy python submission (verdict: Runtime Error):
def main(): 
    
    N = int(input())
    h = list(map(int, input().split()))

    dp = [10000 for _ in range(n)]

    dp[0] = 0

    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 -2] + abs(h[i] - h[i-2]))

    print(dp[N-1])





if __name__ == "__main__":
    main() 

Fixed submission:
def main(): 
    
    N = int(input())
    h = list(map(int, input().split()))

    dp = [0 for _ in range(N)]

    for i in range(1,N):
        if i == 1:
            dp[i] = abs(h[i] - h[i-1])
        else:
            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])

    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
h = list(map(int, input().split()))

dp = [10**10] * N

dp[0] = 0
for i in range(N):
    for k in range(1, K+1):
        if i+k < N:
            dp[i+k] = min(dp[i+k], dp[i] + abs(h[i]-h[i+k]))
        else:
            break
print(dp[N-1])

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

dp = [10**10] * N

dp[0] = 0
for i in range(N):
    for k in range(1, K+1):
        if i+k < N:
            dp[i+k] = min(dp[i+k], dp[i] + abs(h[i]-h[i+k]))
        else:
            break
print(dp[N-1])

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

dp = [10**10] * N

dp[0] = 0
for i in range(1,N):
    for j in range(1,K+1):
        if i - j >= 0:
            dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]))
        else:
            break
print(dp[N-1])

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

dp = [10**10] * N

dp[0] = 0
for i in range(N):
    for k in range(1, K+1):
        if i+k < N:
            dp[i+k] = min(dp[i+k], dp[i] + abs(h[i]-h[i+k]))
        else:
            break
print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,W  = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
dp = [[0 for _ in range(W+1)] for _ in range(N+1)]

for i in range(N):
    weight = wv[i][0]
    for j in range(W+1):
        dp[i+1][j] = dp[i][j]
        if j >= weight:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-weight]+wv[i][1])
print(dp[N][W])



Fixed submission:
N,W  = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
MAX_VAL = 100100
MAX_WEIGHT = 10**10

dp = [[MAX_WEIGHT for _ in range(MAX_VAL+1)] for _ in range(N+1)]

dp[0][0] = 0
for i in range(N):
    value = wv[i][1]
    for v in range(MAX_VAL+1):
        dp[i+1][v] = dp[i][v]
        if v >= value:
            dp[i+1][v] = min(dp[i+1][v], dp[i][v-value]+wv[i][0])
max_v = 0
for i in range(MAX_VAL+1):
    if dp[N][i] <= W:
        max_v = i
print(max_v)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離

s = input()
t = input()
sl = len(s)
tl = len(t)

dp = [[0 for _ in range(tl+1)] for _ in range(sl+1)]

for i in range(sl):
    for j in range(tl):
        if s[i] == t[j]: dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])

ans = ''
while sl > 0 and tl > 0:
    if dp[sl][tl] == dp[sl][tl-1]:
        tl -= 1
    elif dp[sl][tl] == dp[sl-1][tl]:
        sl -= 1
    else:
        ans = s[sl-1] + ans
        sl -= 1
        tl -= 1
print(ans)




Fixed submission:
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離

s = input()
t = input()
sl = len(s)
tl = len(t)

dp = [[0 for _ in range(tl+1)] for _ in range(sl+1)]

for i in range(sl):
    for j in range(tl):
        if s[i] == t[j]: dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])

ans = ''
while sl > 0 and tl > 0:
    if dp[sl][tl] == dp[sl][tl-1]:
        tl -= 1
    elif dp[sl][tl] == dp[sl-1][tl]:
        sl -= 1
    else:
        ans = s[sl-1] + ans
        sl -= 1
        tl -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
def is_target_string(S):
    if S[0] != 'A':
        return false
    C_cnt = 0
    C_index = -1
    for i in range(2, len(S)-1):
        if S[i] == 'C':
            C_cnt += 1
            C_index = i
    if C_cnt != 1:
        return False

    for i in range(len(S)):
        if i != 0 and i != C_index:
            if S[i].isupper():
                return False

    return True

S = input()

print('AC' if is_target_string(S) else 'WA')



Fixed submission:
def is_target_string(S):
    if S[0] != 'A':
        return False
    C_cnt = 0
    C_index = -1
    for i in range(2, len(S)-1):
        if S[i] == 'C':
            C_cnt += 1
            C_index = i
    if C_cnt != 1:
        return False

    for i in range(len(S)):
        if i != 0 and i != C_index:
            if S[i].isupper():
                return False

    return True

S = input()

print('AC' if is_target_string(S) else 'WA')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))

cnt = 0

while True:
    has_divided = False
    for i in range(N):
        if not has_divided and a[i] % 2 == 0:
            a[i] = a[i] // 2
            has_divided = True
        else:
            a[i] *= 3
    if has_divided:
        cnt += 1
    else:
        break
print(cnt)


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

cnt = 0

for i in range(N):
    while True:
        if a[i] % 2 == 0:
            a[i] //= 2
            cnt += 1
        else:
            break
print(cnt)