Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
    n = int(input())
    dat = list(map(int, input().split()))
    cur = dat[0]
    can = True
    for i in range(1, n):
        if dat[i] > cur:
            cur = dat[i] - 1
            continue
        if dat[i] == cur:
            continue
        can = False
    print("Yes" if can else "No")

Fixed submission:
n = int(input())
dat = list(map(int, input().split()))
cur = dat[0]
can = True
for i in range(1, n):
    if dat[i] > cur:
        cur = dat[i] - 1
        continue
    if dat[i] == cur:
        continue
    can = False
print("Yes" if can else "No")
Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())
# 2019 = 3 * 673

rr = min(r, l + 2020)

res = 1000000
for i in range(l, rr+1):
    for j in range(l + 1, rr + 1):
        #print("{0}, {1}".format(i, j))
        if i >= j:
            #print("skip")
            continue

        if res > i*j % 2019:
            #print("{0}, {1}".format(i, j))
            res = i*j % 2019
print(res)

Fixed submission:
n,a ,b = map(int, input().split())
s = a * n
print(min(s,b))
Buggy python submission (verdict: Runtime Error):
def nCr(n, r):
    import math
    return math.factorial(n) // ((math.factorial(n - r) * math.factorial(r)))
MOD = 1000000007

n, k = map(int, input().split())
b, r = k, n-k
for i in range(0, k):
    x = nCr(b - 1,  i) # 青いブロックの分け方
    y = nCr(r + 1 , r- i)

    print(x * y % MOD)

Fixed submission:
def nCr(n, r):
    import math
    return math.factorial(n) // ((math.factorial(n - r) * math.factorial(r)))
MOD = 1000000007

n, k = map(int, input().split())
b, r = k, n-k
for i in range(0, k):
    x = nCr(b - 1,  i) # 青いブロックの分け方
    if r - i < 0:
        print(0)
    else:
        y = nCr(r + 1, r - i)
        print(x * y % MOD)

Buggy python submission (verdict: Runtime Error):
def nCr(n, r):
    import math
    return math.factorial(n) // ((math.factorial(n - r) * math.factorial(r)))

def nCr_with_replacement(n, r):
    # 重複を許容するくみあわせ　
    return nCr(n + r - 1, r)

# 並び変えるときの組み合わせ
def nPr(n, r):
    import math
    return math.factorial(n) // math.factorial(n - r)
MOD = 1000000007

n, k = map(int, input().split())
b, r = k, n-k
#b, r = max(b,r), min(b,r)
#print("b,r: {0},{1}".format(b,r))
for i in range(0, k):
    x = nCr(b - 1,  i) # 青いブロックの分け方
    #print(r+1)
    #print(i)
    y = nCr(r + 1 , r- i)

    #print("x,y: {0},{1}".format(x,y))
    print(x * y % MOD)

Fixed submission:
def nCr(n, r):
    import math
    return math.factorial(n) // ((math.factorial(n - r) * math.factorial(r)))
MOD = 1000000007

n, k = map(int, input().split())
b, r = k, n-k
for i in range(0, k):
    x = nCr(b - 1,  i) # 青いブロックの分け方
    if r - i < 0:
        print(0)
    else:
        y = nCr(r + 1, r - i)
        print(x * y % MOD)
Buggy python submission (verdict: Runtime Error):
def nCr(n, r):
    import math
    return math.factorial(n) // ((math.factorial(n - r) * math.factorial(r)))
MOD = 1000000007

n, k = map(int, input().split())
b, r = k, n-k
for i in range(0, k):
    x = nCr(b - 1,  i) # 青いブロックの分け方
    y = nCr(r + 1 , r- i)

    print(x * y % MOD)

Fixed submission:
s = input()
l = ""
res = True
for i in range(4):
    if s[i] == l:
        res = False
    l = s[i]
print("Good" if res else "Bad")
Buggy python submission (verdict: Runtime Error):
    n = int(input())
    tasks = []
    for i in range(n):
        a,b = map(int, input().split())
        tasks.append((a,b))

    tasks.sort(key=lambda x:x[1])
    #print(tasks)

    cur = 0
    c = True
    for i in range(n):
        cur += tasks[i][0]
        if cur > tasks[i][1]:
            c = False

    print("Yes" if c else "No")

Fixed submission:
n = int(input())
tasks = []
for i in range(n):
    a,b = map(int, input().split())
    tasks.append((a,b))

tasks.sort(key=lambda x:x[1])
#print(tasks)

cur = 0
c = True
for i in range(n):
    cur += tasks[i][0]
    if cur > tasks[i][1]:
        c = False

print("Yes" if c else "No")
Buggy python submission (verdict: Runtime Error):
w,h,x,y = map(int, input().split())

# 横
men1 = w * y
men2 = w * (h-y)

# 縦
men3 = x * h
men4 = (w-x) * h


#print("{0} {1} {2} {3}".format(str(men1), str(men2), str(men3), str(men4)))
out1 = max(min(men1, men2), min(men3, men4))
if min(men1, men2) == min(men3, men4):
    out2 = 1
elif x != 0 and y != 0 and (h / w) == (y / x):
    out1 = w * h / 2
    out2 = 1
else:
    out2 = 0

print("{0} {1}".format(out1, out2))

Fixed submission:
n, x = map(int, input().split())
dat_l = list(map(int, input().split()))
cur = 0
c = 0
for i in range(n):
    cur += dat_l[i]
    if cur > x:
        break
    c += 1
print(c+1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
dat = []
for i in range(n):
    a,b = map(int, input().split())
    dat.append([a,b])
dat2 = []
for i in range(n):
    x1, y1 = dat[i]
    for j in range(i+1, n):
        x2, y2 = dat[j]
        dat2.append( (x1-x2, y1-y2) )
import collections
c = collections.Counter(dat2)
#print(c)
print(n - c.most_common(1)[0][1])

Fixed submission:
n = int(input())
dat = []
for i in range(n):
    a,b = map(int, input().split())
    dat.append([a,b])
dat2 = []
if n == 1:
    print(1)
else:
    for i in range(n):
        x1, y1 = dat[i]
        for j in range(n):
            if i == j:
                continue
            x2, y2 = dat[j]
            dat2.append( (x1-x2, y1-y2) )
    import collections
    c = collections.Counter(dat2)
    #print(c)
    ta, tb = c.most_common(1)[0][0]
    res = 0
    for i in range(n):
        canwarp = False
        x1, y1 = dat[i]
        for j in range(n):
            if i == j:
                continue
            x2, y2 = dat[j]
            if x1-x2 == ta and  y1-y2 == tb:
                canwarp = True
        if canwarp:
            continue
        else:
            res += 1
    print(res)
Buggy python submission (verdict: Runtime Error):
r, g, b, n = map(int,input().split())
res = 0
for i in range(n // r + 1):
    for j in range((n-r*i) // g + 1):
        if (n - (i * r) - (g * j) ) % b == 0:
            #print("{0}, {1}, {2}".format(i, j, (n - (i * r) - (g * j) ) % g))
            res += 1

print(res)


Fixed submission:
n, k = map(int, input().split())
print(n - k  + 1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
res = 0
sboth = 0
sa = 0
sb = 0
for i in range(n):
    s = input()
    res += s.count("AB")
    if s[0] == "B" and s[-1] == "A":
        sboth += 1
        continue
    if s[0] == "B":
        sb += 1
        continue
    if s[-1] == "A":
        sa += 1
        continue

num = min(sboth)
res += num
sboth -= num

num = min(sboth, sb)
res += num
sboth -= num

num = min(sa, sb)
res += num
sa -= num
sb -= num

num = min(sboth)
res += num
sboth -= num

num = min(sboth, sb)
res += num
sboth -= num

num = min(sa, sb)
res += num
sa -= num
sb -= num


if sboth > 0:
    sboth = 1
    res += sboth - 1

print(res)



Fixed submission:
n = int(input())
res = 0
numa = numb = numboth = 0
for _ in range(n):
    s = input()
    res += s.count("AB")
    if s[0] == "B" and s[-1] == "A":
        numboth += 1
    elif s[0] == "B":
        numb += 1
    elif s[-1] == "A":
        numa += 1

#print(numboth, numa, numb)
#print(res)

if numboth == 0:
    res += min(numa, numb)
else:
    if numa == 0 and numb == 0:
        res += numboth - 1
    else:
        res += numboth
        res += min(numa, numb)
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())
maze = []
for _ in range(h):
    maze.append(list(input()))
import collections
black = collections.deque([])
cnt = 0
for hh in range(h):
    for ww in range(w):
        if maze[hh][ww] == "#":
            cnt += 1
            black.append([hh, ww, 0])
dh = [ 0, -1, 1, 0]
dw = [ -1, 0, 0, 1]
res = 0
allcount = h*w
res = 0
while cnt < allcount:
    #print("black:", black)
    bh, bw , bturn= black.popleft()
    #print("pop", bh, bw, bturn)
    for di in range(len(dh)):
        nh = bh + dh[di]
        nw = bw + dw[di]
        if nh < 0 or nh > (h-1) or nw < 0 or nw > (w-1):
            continue
        if maze[nh][nw] == "#":
            continue
        black.append([nh, nw, bturn+1])
        #print(nh, nw)
        maze[nh][nw] = "#"
        res = max(res, bturn+1)
        cnt += 1
print(res)

Fixed submission:
h, w = map(int, input().split())
maze = []
for _ in range(h):
    maze.append(list(input()))
import collections
black = collections.deque([])
cnt = 0
for hh in range(h):
    for ww in range(w):
        if maze[hh][ww] == "#":
            cnt += 1
            black.append([hh, ww, 0])
dh = [ 0, -1, 1, 0]
dw = [ -1, 0, 0, 1]
res = 0
allcount = h*w
res = 0
while cnt < allcount:
    #print("black:", black)
    bh, bw , bturn= black.popleft()
    #print("pop", bh, bw, bturn)
    for di in range(len(dh)):
        nh = bh + dh[di]
        nw = bw + dw[di]
        if nh < 0 or nh > (h-1) or nw < 0 or nw > (w-1):
            continue
        if maze[nh][nw] == "#":
            continue
        black.append([nh, nw, bturn+1])
        #print(nh, nw)
        maze[nh][nw] = "#"
        res = max(res, bturn+1)
        cnt += 1
print(res)
Buggy python submission (verdict: Runtime Error):
    n, q = map(int, input().split())
    s = input()
    dat_q = []
    for i in range(q):
        l, r = map(int, input().split())
        dat_q.append((l, r))

    c = [0] * n
    for i in range(1, n):
        if s[i-1:i+1] == "AC":
            c[i] = c[i-1] + 1
        else:
            c[i] = c[i-1]
    for i in range(q):
        l, r = dat_q[i][0], dat_q[i][1]
        print(c[r - 1] - c[l - 1])

Fixed submission:
n, q = map(int, input().split())
s = input()
dat_q = []
for i in range(q):
    l, r = map(int, input().split())
    dat_q.append((l, r))

c = [0] * n
for i in range(1, n):
    if s[i-1:i+1] == "AC":
        c[i] = c[i-1] + 1
    else:
        c[i] = c[i-1]
for i in range(q):
    l, r = dat_q[i][0], dat_q[i][1]
    print(c[r - 1] - c[l - 1])
Buggy python submission (verdict: Runtime Error):
n,m,c = int(map,input().split())
b = int(map,input().split())
count = 0
for i in range(n):
    sum = 0
    a = int(map, input().split())
    for j in range(m):
        sum += a[j] * b[j]
    sum += c
    if sum > 0:
        count += 1
print(count)

Fixed submission:
n,m,c = map(int,input().split())
b = map(int,input().split())
b = list(b)
count = 0
for i in range(n):
    sum = 0
    a = map(int, input().split())
    a = list(a)
    for j in range(m):
        sum += a[j] * b[j]
    sum += c
    if sum > 0:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import math
n, k = map(int, input().split())
dat_h = list(map(int, input().split()))
dp = [math.inf] * (n + 1)
dp[0] = 0
for i in range(1, n):
    #print("i:{0}", i)
    for j in range(1, k + 1):
        #print("j:{0}", j)
        if (i - j) >= 0:
            dp[i] = min(dp[i], dp[i-j] + abs(dat_h[i] - dat_h[i-j]))
#print(dp)
print(dp[n-1])

Fixed submission:
n, k = map(int, input().split())
dat_h = list(map(int, input().split()))
dp = [100000000000] * (n + 1)
dp[0] = 0
for i in range(1, n):
    #print("i:{0}", i)
    for j in range(1, k + 1):
        #print("j:{0}", j)
        if (i - j) >= 0:
            dp[i] = min(dp[i], dp[i-j] + abs(dat_h[i] - dat_h[i-j]))
#print(dp)
print(dp[n-1])
Buggy python submission (verdict: Runtime Error):
    s = input()
    t = input()

    ds = dict()
    dt = dict()
    tr = dict()
    tr2 = dict()
    res = True
    for i in range(len(s)):
        ds[s[i]] = True
        dt[s[i]] = True
        if s[i] not in tr:
            tr[s[i]] = t[i]
        else:
            if tr[s[i]] != t[i]:
                res = False

        if t[i] not in tr2:
            tr2[t[i]] = s[i]
        else:
            if tr2[t[i]] != s[i]:
                res = False

    #if (len(ds) == 26 or len(dt) == 26) and ds != dt:
    #    res = False

    print("Yes" if res else "No")


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

ds = dict()
dt = dict()
tr = dict()
tr2 = dict()
res = True
for i in range(len(s)):
    ds[s[i]] = True
    dt[s[i]] = True
    if s[i] not in tr:
        tr[s[i]] = t[i]
    else:
        if tr[s[i]] != t[i]:
            res = False

    if t[i] not in tr2:
        tr2[t[i]] = s[i]
    else:
        if tr2[t[i]] != s[i]:
            res = False

if (len(ds) == 26 or len(dt) == 26) and ds != dt:
    res = False

print("Yes" if res else "No")
Buggy python submission (verdict: Runtime Error):
def resolve():
s = input()

f = True

if s[0] != "A":
    f = False

ss = s[1:2] + s[3:-2] + s[-1:]
for i in range(len(ss)):
    if ss[i] < "a" or ss[i] > "z":
        f = False

if (s[2] == "C" and s[-2] == "C"):
    f = False
if (s[2] != "C" and s[-2] != "C"):
    f = False

if f:
    print("AC")
else:
    print("WA")


Fixed submission:
s  = input()
f = True
if s[0] != "A":
    f = False
c = 0
for i in range(2, len(s) - 1):
    if s[i] == "C":
        c += 1
if c != 1:
    f=False
ss = s[1:].replace("C", "")
for i in range(len(ss)):
    if ss[i] < "a" or ss[i] > "z":
        f = False
if f:
    print("AC")
else:
    print("WA")
Buggy python submission (verdict: Runtime Error):
n = int(input())
dat = list(map(int, input().split()))
dat_d = []

total = 0
for i in range( n):
    total += (dat[i] - (i+1))
    dat_d.append(dat[i] - (i+1))

#print(dat)
#print(dat_d)
#print(total)
#f = (total // n)
#print(f)

f = (dat_d[n//2])
dat_d = list(map(lambda x: x - f, dat_d))
total = 0
for i in range(n):
    total += abs(dat_d[i])

f = (dat_d[n//2 + 1])
dat_d = list(map(lambda x: x - f, dat_d))
total2 = 0
for i in range(n):
    total2 += abs(dat_d[i])

total = min(total, total2)

print(total)

Fixed submission:
n = int(input())
dat = list(map(int, input().split()))
dat_d = []

total = 0
for i in range( n):
    total += (dat[i] - (i+1))
    dat_d.append(dat[i] - (i+1))

#print(dat)
#print(dat_d)
#print(total)
#f = (total // n)
#print(f)

dat_d.sort()
#print(dat_d)
f = dat_d[n//2]

total = 0
for i in range( n):
    total += abs(dat_d[i] - f)

print(total)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dat = list(map(int, input().split()))
buf = [0] * (n+1)
buf.append(0)
cur = 0
for i in range(0, n):
    cur += dat[i]
    buf[i+1] = cur
 
 
res = 0
for i in range(0, n+1):
    for j in range(i + 1, n+1):
        if buf[i] == buf[j]:
            res += 1
print(res)

Fixed submission:
# k = 1 - nまでの k の和
def sigma1(n):
    return n * (n + 1) // 2

n = int(input())
dat = list(map(int, input().split()))
buf = [0] * (n+1)
cur = 0
import collections
pos = collections.defaultdict(list)

for i in range(0, n):
    cur += dat[i]
    pos[cur].append(i)
    buf[i+1] = cur

buf.sort()
#print(buf)
import collections
res = 0
c = collections.Counter(buf)
for k in c.keys():
    cnt = c[k]
    if cnt < 2:
        pass
    else:
        res += sigma1(cnt - 1)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dat = list(map(int, input().split()))
buf = [0] * (n+1)
buf.append(0)
cur = 0
for i in range(0, n):
    cur += dat[i]
    buf[i+1] = cur

#print(buf)

res = 0
for i in range(0, n+1):
    for j in range(i + 1, n+1):
        if buf[i] == buf[j]:
            res += 1
print(res)


Fixed submission:
# k = 1 - nまでの k の和
def sigma1(n):
    return n * (n + 1) // 2

n = int(input())
dat = list(map(int, input().split()))
buf = [0] * (n+1)
cur = 0
import collections
pos = collections.defaultdict(list)

for i in range(0, n):
    cur += dat[i]
    pos[cur].append(i)
    buf[i+1] = cur

buf.sort()
#print(buf)
import collections
res = 0
c = collections.Counter(buf)
for k in c.keys():
    cnt = c[k]
    if cnt < 2:
        pass
    else:
        res += sigma1(cnt - 1)
print(res)
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
for i in range(k):
    print(a + i)



for j in range(k - 1, -1, -1):
    print(b-j)

Fixed submission:
a,b,k = map(int, input().split())
n = a
c = 1
while n <= b:
    print(n)
    n += 1
    c += 1
    if c > k:
        break
if n <= (b - k):
    n = b - k + 1

c = 1
while n <= b:
    print(n)
    n += 1
    c += 1
    if c > k:
        break

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
for i in list(range(k)):
    print(a + i)



for j in list(range(k - 1, -1, -1)):
    print(b-j)

Fixed submission:
a,b,k = map(int, input().split())
n = a
c = 1
while n <= b:
    print(n)
    n += 1
    c += 1
    if c > k:
        break
if n <= (b - k):
    n = b - k + 1

c = 1
while n <= b:
    print(n)
    n += 1
    c += 1
    if c > k:
        break
Buggy python submission (verdict: Runtime Error):
    n = int(input())
    d,x = map(int, input().split())
    sum = 0
    for i in range(n):
        a = int(input())
        for j in range(100):
            day = 1 + j*a
            if day <= d:
                sum += 1
            else:
                break
    print(x + sum)

Fixed submission:
n = int(input())
d,x = map(int, input().split())
sum = 0
for i in range(n):
    a = int(input())
    for j in range(100):
        day = 1 + j*a
        if day <= d:
            sum += 1
        else:
            break
print(x + sum)

Buggy python submission (verdict: Runtime Error):
    n = int(input())
    d,x = map(int, input().split())
    sum = 0
    for i in range(n):
        a = int(input())
        for j in range(100):
            day = 1 + j*a
            if day <= d:
                sum += 1
            else:
                break
    print(x + sum)

Fixed submission:
n = int(input())
d,x = map(int, input().split())
sum = 0
for i in range(n):
    a = int(input())
    for j in range(100):
        day = 1 + j*a
        if day <= d:
            sum += 1
        else:
            break
print(x + sum)
Buggy python submission (verdict: Time Limit Exceeded):
from pprint import pprint
INF = 1000000
dx = [1, -1, 0,  0]
dy = [0,  0, 1, -1]
# 入力
h, w = map(int, input().split())
maze = []
wallcount = 0
for i in range(h):
    l = list(input())
    maze.append(l)
    wallcount += l.count("#")

# ワーシャルフロイド用に枠を作る。
# 2次元マップしてもいいが面倒なので、１次元にする。[0 - x][0 - y]を[0- x * y]にflattenする
wsmap = lambda a, b: (a * w + b)
dp = []
# 辺がない時はINFを入れのでデフォルト値とする
for i in range(h * w):
    dp.append([INF] * (h * w))

# 迷路ををグラフにする。
for y in range(h):
    for x in range(w):
        if maze[y][x] == "#": # そのマスが壁なら何もしない(他のマストの連結はないので)
            continue
        # ワーシャルフロイドでは自分自身へのコストは0にしておく。
        dp[wsmap(y, x)][wsmap(y, x)] = 0
        # ４方向に移動できるかの判定
        for dir in range(len(dx)):
            nx, ny = x + dx[dir], y + dy[dir]
            if -1 < nx and nx < w and -1 < ny and ny < h: # 枠をはみ出ないかチェック
                if maze[ny][nx] != "#": # そのマスが壁でないなら
                    dp[wsmap(y, x)][wsmap(ny, nx)] = 1 # コストを1にする

# ワーシャルフロイドする
for kk in range(h * w):
    for ii in range(h * w):
        for jj in range(h * w):
            dp[ii][jj] = min(dp[ii][jj], dp[ii][kk] + dp[kk][jj])

# これで結果が出たので
import itertools
res = list(itertools.chain(*dp))# 二次元配列を一次元にして
needstep = dp[0][-1]
res = h * w
res -= wallcount
res -= needstep + 1
print(res if res >= 0 else "-1")


Fixed submission:
from pprint import pprint
INF = 1000000
dx = [1, -1, 0,  0]
dy = [0,  0, 1, -1]
# 入力
h, w = map(int, input().split())
maze = []
wallcount = 0
for i in range(h):
    l = list(input())
    maze.append(l)
    wallcount += l.count("#")

# ワーシャルフロイド用に枠を作る。
# 2次元マップしてもいいが面倒なので、１次元にする。[0 - x][0 - y]を[0- x * y]にflattenする
wsmap = lambda a, b: (a * w + b)
dp = []
# 辺がない時はINFを入れのでデフォルト値とする
for i in range(h * w):
    dp.append([INF] * (h * w))



# 迷路ををグラフにする。
goal = -1
dis = 0
import collections
q = collections.deque( [ (0,0,0) ] ) #x,y,d

while len(q) > 0:
    x, y, d = q.popleft()
    if x == w - 1 and y == h - 1:
        goal = d
    for dir in range(len(dx)):
        nx, ny = x + dx[dir], y + dy[dir]
        if -1 < nx and nx < w and -1 < ny and ny < h:
            if nx == w-1 and ny == h - 1:
                goal = d + 1
                break
            if maze[ny][nx] == ".": # そのマスが壁でないなら
                maze[ny][nx] = d
                q.append( (nx, ny, d + 1) )

    if goal != -1:
        break

# これで結果が出たので
import itertools
if goal == -1:
    print(-1)
else:
    needstep = goal
    res = h * w
    res -= wallcount
    res -= needstep + 1
    print(res)
Buggy python submission (verdict: Runtime Error):
n = int(input())
dat1 = list(map(int, input().split()))
dat2 = list(map(int, input().split()))
s1 = sum(dat1)
s2 = sum(dat2)
dp1 = [0]*20
dp2 = [0]*20
for i in range(n):
    dp1[i+1] = dp1[i] + dat1[i]
    dp2[i+1] = max(dp1[i+1] + dat2[i], dp2[i] + dat2[i])

print(dp2[n])


Fixed submission:
n = int(input())
dat1 = list(map(int, input().split()))
dat2 = list(map(int, input().split()))
s1 = sum(dat1)
s2 = sum(dat2)
dp1 = [0]*200
dp2 = [0]*200
for i in range(n):
    dp1[i+1] = dp1[i] + dat1[i]
    dp2[i+1] = max(dp1[i+1] + dat2[i], dp2[i] + dat2[i])

print(dp2[n])
Buggy python submission (verdict: Time Limit Exceeded):
# 盤面座標は8000x8000(x 2)
N = 8000
s = input()
target_x, target_y = map(int, input().split())

# "FTTFF" -> [1, 0, 2]と変換。'F1TF0TF2T'のFだけとる
dat_f = [len(Fcount) for Fcount in s.split("T")]

# マイナスを含むxとyのDP用配列(=x2)を作る +1するのは原点用
# x, yの閾値判定するのが面倒なので倍(=x2)用意する(index error対策)
curmap_x = [False] * ((N * 2 * 2) + 1)
curmap_y = [False] * ((N * 2 * 2) + 1)
nextmap_x = [False] * ((N * 2 * 2) + 1)
nextmap_y = [False] * ((N * 2 * 2) + 1)

# 初期座標 0,0なのだが、最初Fから始まる場合は(x,0)から始まるし、y軸を向きながら処理する
if s[0] == "F":
    start = 1
    curmap_x[N * 2 + dat_f[0]] = True
    direction_x = False
else:
    start = 0
    curmap_x[N * 2] = True
    direction_x = True

# y=0
curmap_y[N * 2] = True

# 処理すべき最初のFから
for i in range(start, len(dat_f)):
    step = dat_f[i]
    if direction_x:
        for j in range(N, N + (N * 2) + 1):
            nextmap_x[j] = True if curmap_x[j - step] or curmap_x[j + step] else False
        curmap_x, nextmap_x = nextmap_x, curmap_x
    else:
        for j in range(N, N + (N * 2) + 1):
            nextmap_y[j] = True if curmap_y[j - step] or curmap_y[j + step] else False
        curmap_y, nextmap_y = nextmap_y, curmap_y

    # くる
    direction_x = not direction_x

print("Yes" if curmap_x[N * 2 + target_x] and curmap_y[N * 2 + target_y] else "No")


Fixed submission:
from pprint import pprint
# 盤面座標は8000x8000(x 2)
N = 8000

s = input()
target_x, target_y = map(int, input().split())

# "FTTFF" -> [1, 0, 2]と変換。'F1TF0TF2T'のこと
dat_f = [len(Fcount) for Fcount in s.split("T")]

# x, yの閾値判定するのが面倒なので倍用意する(index error対策)
# マイナスを含むxとyのDP用配列を作る +1するのは原点用
curmap_x = [False] * ((N * 2 * 2) + 1)
curmap_y = [False] * ((N * 2 * 2) + 1)
nextmap_x = [False] * ((N * 2 * 2) + 1)
nextmap_y = [False] * ((N * 2 * 2) + 1)

# 初期座標 0,0
if s[0] == "F":
    start = 1
    curmap_x[N * 2 + dat_f[0]] = True
    direction_x = False
else:
    start = 0
    curmap_x[N * 2] = True
    direction_x = True
curmap_y[N * 2] = True

# 今がx軸かの判定

for i in range(start, len(dat_f)):
    step = dat_f[i]
    if direction_x:
        for j in range(N, N + (N * 2) + 1):
            nextmap_x[j] = True if curmap_x[j - step] or curmap_x[j + step] else False
        curmap_x, nextmap_x = nextmap_x, curmap_x
    else:
        for j in range(N, N + (N * 2) + 1):
            nextmap_y[j] = True if curmap_y[j - step] or curmap_y[j + step] else False
        curmap_y, nextmap_y = nextmap_y, curmap_y

    direction_x = not direction_x

print("Yes" if curmap_x[N * 2 + target_x] and curmap_y[N * 2 + target_y] else "No")
Buggy python submission (verdict: Runtime Error):
s = input()
res = 0
for i in len(s):
  if s[i] == "1":
    res+= 1
print(res)

Fixed submission:
s=input()
count = 0
if s[0] == "1":
    count = count + 1
if s[1] == "1":
    count = count + 1
if s[2] == "1":
    count = count + 1
print(count)
Buggy python submission (verdict: Runtime Error):
    r = int(input())
    g = int(input())
    x = (2*g) - r
    print(x)

Fixed submission:
r = int(input())
g = int(input())
x = (2*g) - r
print(x)

Buggy python submission (verdict: Runtime Error):
    r = int(input())
    g = int(input())
    x = (2*g) - r
    print(x)

Fixed submission:
r = int(input())
g = int(input())
x = (2*g) - r
print(x)