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

Fixed submission:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


n = input()[:-1]

if n[-1] == "s":
    print(n + "es")
else:
    print(n + "s")

Buggy submission (verdict: Runtime Error):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


n = input().split()[:-1]

if n[-1] == "s":
    print(n + "es")
else:
    print(n + "s")
Problem p02598 (python)

Fixed submission:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans


def nibu(x,n,r):
    ll = 1
    rr = r
    while True:
        mid = (ll+rr)//2
        
        if rr == mid:
            return ll
        
        if cou(x,mid) <= n:
            rr = mid
        else:
            ll = mid+1

def cou(x,le):
    co = 0
    for i in range(len(x)):
        if le != 0:
            co += -(-x[i]//le) - 1
    return co


n,k = m()

a = l()

left = 0

right = 10**9


aaa = nibu(a,k,right)
print(aaa)

Buggy submission (verdict: Runtime Error):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans


def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2
        
        if rr == mid:
            return ll
        
        if cou(x,mid) <= n:
            rr = mid
        else:
            ll = mid+1

def cou(x,le):
    co = 0
    for i in range(len(x)):
        co += -(-x[i]//le) - 1
    return co


n,k = m()

a = l()

left = 0

right = 10**9


aaa = nibu(a,k,right)
print(aaa)
Problem p02659 (python)

Fixed submission:
import sys,collections as cl,bisect as bs,math
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(float,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

a,b = m()

b = int(b*1000)

	


print(int((int(a)*b)//(1000)))

Buggy submission (verdict: Runtime Error):
import sys,collections as cl,bisect as bs,math
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(float,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

a,b = m()
co = 0
po = b
while True:
	if int(po) == po:
		break

	else:
		po *= 10
		co += 1 
	


print(int(a)*po//(10**co)))
Problem p02863 (python)

Fixed submission:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,t = m()

li = [l() for i in range(n)]

ma = []
for i in range(n):
    ma.append([li[i][1],i])

ma.sort(reverse = True)

li.sort(key = lambda x:x[0])

dp = [0 for i in range(t + 3000)]

for i in range(n):
    for k in range(li[i][0]+t-1,li[i][0]-1,-1):
        if dp[k] <= dp[k-li[i][0]] + li[i][1]:
            dp[k] = dp[k-li[i][0]] + li[i][1]


dp.sort(reverse = True)
ans = dp[0]

print(ans)

Buggy submission (verdict: Runtime Error):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,t = m()

li = [l() for i in range(n)]

ma = []
for i in range(n):
    ma.append([li[i][1],i])

ma.sort(reverse = True)


t = t-1
dp = [0 for i in range(t + 3000)]

for i in range(n):
    for k in range(li[i][0]+t,li[i][0]-1,-1):
        if dp[k] <= dp[k-li[i][0]] + li[i][1]:
            dp[k] = dp[k-li[i][0]] + li[i][1]


dp.sort(reverse = True)
ans = dp[0]

print(ans)
Problem p02915 (python)

Fixed submission:
import sys,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

print(n**3)

Buggy submission (verdict: Runtime Error):
import sys,bisect as bs,collections as cl
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

p = [0] + l() + [n+1]
ans = 0
a = [0 for i in range(n+2)]

for i in range(n+2):
    a[p[i]] = i

l = [set() for i in range(n+2)]
r = [set() for i in range(n+2)]

for i in range(n+2):
    l[i].add(max(0,i-1))
    l[i].add(max(0,i-2))
    r[i].add(min(n+1,i+1))
    r[i].add(min(n+1,i+2))


for i in range(n+1):
    m = a[i]
    x2,x1,y1,y2 = min(l[m]),max(l[m]),min(r[m]),max(r[m])
    hoge= i*(abs((m-x1)*(y2-y1)) + abs((y1-m)*(x1-x2)))
    ans += hoge

    r[x1].clear()
    r[x1].add(y1)
    r[x1].add(y2)

    l[y1].clear()
    l[y1].add(x1)
    l[y1].add(x2)
    
    r[x2].clear()
    r[x2].add(x1)
    r[x2].add(y1)

    l[y2].clear()
    l[y2].add(y1)
    l[y2].add(x1)
    

print(ans)
Problem p03015 (python)

Fixed submission:
n = input()

c = 0
co = 0
nn = len(n)

mmm = [1 for i in range(nn+1)]
mm = [1 for i in range(nn+1)]

for i in range(1,nn+1):
	mmm[i] = mmm[i-1]*2 
	mmm[i] %= (10**9+7)
	mm[i] = mm[i-1]*3 
	mm[i] %= (10**9+7)


for i in range(0,nn):
	if n[i] == "1":
		co += (mm[nn - i - 1])*(mmm[c])
		co %=  (10**9+7)
		c += 1
print((co + mmm[c])%(10**9+7))

Buggy submission (verdict: Runtime Error):
n = input()
mod = 10**9+7
c = 0
co = 0
nn = len(n)

dp = [[0,0] for i in range(nn+1)]

dp[0][0] = 1

for i in range(nn):
	if n[i] == "0":
		dp[i+1][0] = dp[i][0]
		dp[i+1][1] = (dp[i][1] + dp[i][1] * 2 )% mod
	else:
		dp[i+1][0] = dp[i][0]*2 % mod
		dp[i+1][1] = (dp[i][0] + dp[i][1] + dp[i][1]*2) % mod
print(sum(dp[n])%mod)
Problem p03033 (python)

Fixed submission:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
    return list(map(int,input().split()))
def m():
    return map(int,input().split())
def onem():
    return int(input())
def s(x):
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa == x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x):
    return " ".join(map(str,x))

n,m = m()

l = [l() for i in range(n)]
l.sort(key = lambda x:x[2])
ans = [-1]*m
ju = [-1]*m
d = [onem() for i in range(m)]
for s,t,x in l:
    ore = bs.bisect_left(d,s-x)
    o = bs.bisect_left(d,t-x)
    while (ore < o):
        k = ju[ore]
        if k == -1:
            ans[ore] = x
            ju[ore] = o
            ore += 1
        else:
            ore = k
for i in range(m):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
    return list(map(int,input().split()))
def m():
    return map(int,input().split())
def onem():
    return int(input())
def s(x):
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa == x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x):
    return " ".join(map(str,x))

n,m = m()

l = [l() for i in range(n)]
l.sort(key = lambda x:x[2])
ans = [-1]*m
ju = [-1]*m
d = [onem() for i in range(m)]
for s,t,x in l:
    ore = bs.bisect_left(d,s-x)
    o = s.bisect_left(d,t-x)
    while (ore < o):
        k = ju[ore]
        if k == -1:
            ans[ore] = x
            ju[ore] = o
            ore += 1
        else:
            ore = k
for i in range(m):
    print(ans[i])
Problem p03041 (python)

Fixed submission:
import sys,collections as cl,bisect as bs
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x):
	return " ".join(map(str,x))

n,m = m()
a = list(input())

if a[m-1] == "A":
	a[m-1] = "a"
elif a[m-1] == "B":
	a[m-1] = "b"
else:
	a[m-1] = "c"
print("".join(a))

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

a[m] = a[m].replace("A","a").replace("B","b").replace("C","c")
print("".join(a))

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

a[m] = a[m].remove("A","a").remove("B","b").remove("C","c")
print("".join(a))
Problem p03107 (python)

Fixed submission:
a = list(map(int,list(input())))
c = 1
co = 0
p = a[0]
pp = []
for i in range(len(a)-1):
	if a[(i+1)] == p:
		c += 1
	else:
		pp.append(c)
		c = 1
		p = a[i+1]
pp.append(c)
if len(pp) != 1:
	ppp = pp[0]
	for i in range(len(pp)-1):
		if pp[i] >= 0:
			co += 2*(max(pp[i],pp[i+1]) - abs(pp[i] - pp[i+1]))
			pp[i+1] = pp[i+1] - pp[i]
		else:
			pp[i+1] = pp[i+1] - pp[i]
print(co)

Buggy submission (verdict: Runtime Error):
a = list(map(int,list(input())))
c = 1
co = 0
p = a[0]
pp = []
for i in range(len(a)-1):
	if a[(i+1)] == p:
		c += 1
	else:
		pp.append(c)
		c = 1
		p = a[i+1]
ppp = pp[0]

kkk = 0
for i in range(len(pp)-1):
	if pp[i] >= 0:
		co += 2*(max(pp[i],pp[i+1]) - abs(pp[i] - pp[i+1]))
		pp[i+1] = pp[i+1] - pp[i]
	else:
		pp[i+1] = pp[i+1] - pp[i]
print(co)
Problem p03209 (python)

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

l = 1

c = [1]
d = [1]

for i in range(50):
	c.append(2*c[-1]+3)
	d.append(2*d[-1]+1)
k = 0
while True:
	if a == 0:
		k += 1
		break
	elif b==1:
		break
	elif c[a] // 2 == b:
		k += d[a-1]
		break
	elif c[a] // 2 > b:
		a -= 1
		b -= 1
	elif c[a] // 2 + 1 == b:
		k += 1 + d[a-1]
		break
	elif c[a] // 2 + 1 < b and c[a] != b:
		a -= 1
		k += d[a]+1
		b -= c[a]+2
	else:
		k += d[a]
		break


print(k)

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

l = 1

c = [1]
d = [1]

for i in range(50):
	c.append(2*c[-1]+3)
	d.append(2*d[-1]+1)
k = 0
while True:
	if b == 1 && a == 0:
		k += 1
		break
	elif b==1:
		break
	elif c[a] // 2 == b:
		k += d[a-1]
		break
	elif c[a] // 2 > b:
		a -= 1
		b -= 1
	elif c[a] // 2 + 1 == b:
		a -= 1
		k += 1 + d[a]
		break
	elif c[a] == b:
		k = d[a]
		break
	elif a == 0:
		k += 1
		break
	else:
		a -= 1
		k += d[a]+1
		b -= c[a] + 2


print(k)
Problem p03221 (python)

Fixed submission:
import sys
input = sys.stdin.readline

a,b = map(int,input().split())
aa = []
d = []
for i in range(b):
    k,kk = map(int,input().split())
    d.append([k, kk,i+1])

da = sorted(d)

kkk = da[0][0]
ll = 0
for i in range(b):
    kkkk = da[i][0]
    if kkk == kkkk:
        ll += 1
    else:
        kkk = kkkk
        ll = 1
    aa.append([da[i][2],da[i][0],ll])
aa.sort()

for i in aa:
    m = str(i[1])
    n = str(i[2])
    m = "0"*(6-len(m))+m
    n = "0"*(6-len(n))+n
    print(m+n)

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

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

da = [[] for i in range(a)]
d = []
for i in range(b):
    k,kk = map(int,input().split())
    da[k-1].append(kk)
    d.append([k, kk])


da.sort()

for i in d:
    p = da[i[0]-1].index(i[1])

    n = str(i[0])
    m = str(p+1)

    n = "0"*(6-len(n)) + n
    m = "0"*(6-len(m)) + m

    print(n+m)
Problem p03222 (python)

Fixed submission:
import sys,collections as cl
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a

h,w,k = m()

a = [1,1]

for i in range(98):
	a.append(a[-1] + a[-2])

l = [[0 for i in range(w+2)] for j in range(h+1)]
l[0][1] = 1

for i in range(h):
	for j in range(w):
		l[i+1][j+1] = (l[i][j]*(a[max(0,j-1)] * a[w - 1 - j]) +l[i][j+1]*(a[j] * a[w - 1 - j]) + l[i][j+2]*(a[j] * a[max(0,w - 2 - j)]))%(10**9+7)
print(l[h][k])

Buggy submission (verdict: Runtime Error):
import sys,collections as cl
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a

h,w,k = m()

a = [1,1,2,3,5,8,13]

l = [[0 for i in range(w+2)] for j in range(h+1)]
l[0][1] = 1

for i in range(h):
	for j in range(w):
		l[i+1][j+1] = (l[i][j]*(a[max(0,j-1)] * a[w - 1 - j]) +l[i][j+1]*(a[j] * a[w - 1 - j]) + l[i][j+2]*(a[j] * a[max(0,w - 2 - j)]))%(10**9+7)
print(l[h][k])

Buggy submission (verdict: Runtime Error):
import sys,collections as cl
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a

h,w,k = m()

a = [1,1,2,3,5,8,13]

l = [[0 for i in range(w+2)] for j in range(h+1)]
l[0][1] = 1

for i in range(h):
	for j in range(w):
		l[i+1][j+1] = l[i][j]*(a[max(0,j-1)] * a[w - 1 - j]) +l[i][j+1]*(a[j] * a[w - 1 - j]) + l[i][j+2]*(a[j] * a[max(0,w - 2 - j)])
print(l[h][k])
Problem p03242 (python)

Fixed submission:
a = list(input())
for i in range(3):
	a[i] = int(a[i])
	if a[i] ==1:
		a[i] = 9
	else:
		a[i] = 1
print(a[0]*100+a[1]*10+a[2])

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

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,6)+1)]
cc = [0 for i in range(pow(10,6)+1)]
for i in range(len(b)):
    if i % 2 == 0:
        cc[b[i]-1] += 1
    else:
        c[b[i]-1] += 1

one = 0
onee = 0
two = 0
twoo = 0
k = 0
kk = 0
for i in range(len(c)):
    if one <= c[i]:
        onee = one
        one = c[i]
        k = i
    if two <= cc[i]:
        twoo = two
        two = cc[i]
        kk = i

t = max(one+twoo,onee+two)

if k != kk:
    print(a-one-two)
else:
    print(a-t)

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

b = list(map(int,input().split()))
d = max(b)
c = [0 for i in range(pow(10,5)+100)]
cc = [0 for i in range(pow(10,5)+100)]
for i in range(a):
    if i % 2 == 0:
        c[b[i]] += 1
    else:
        cc[b[i]] += 1

one = 0
onee = 0
two = 0
twoo = 0
k = 0
kk = 0
for i in range(len(c)):
    if one <= c[i]:
        onee = one
        one = c[i]
        k = i
    if two <= cc[i]:
        twoo = two
        two = cc[i]
        kk = i

t = max(one+twoo,onee+two)

print(a-one-two)
Problem p03286 (python)

Fixed submission:
n = int(input())

s = ""

while n != 0:
	s = str(n%2) + s
	n = -(n//2)

print(s if s != "" else 0)

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

s = ""

while n != 0:
	s = str(n%2) + s
	s = -(s//2)

print(s if s != "" else 0)
Problem p03291 (python)

Fixed submission:
a = list(input())

dp = [[0]*3 for i in range(len(a)+1)]

ppp = 1
for i in range(len(a))[::-1]:
	if a[i] == "A":
		dp[i][0] += dp[i+1][0] + dp[i+1][1]
		dp[i][1] += dp[i+1][1]
		dp[i][2] += dp[i+1][2]
	elif a[i] == "B":
		dp[i][0] += dp[i+1][0]
		dp[i][1] += dp[i+1][1] + dp[i+1][2]
		dp[i][2] += dp[i+1][2]
	elif a[i] == "C":
		dp[i][0] += dp[i+1][0]
		dp[i][1] += dp[i+1][1]
		dp[i][2] += dp[i+1][2] + ppp
	else:
		dp[i][0] += 3 * dp[i+1][0] + dp[i+1][1]
		dp[i][1] += 3 * dp[i+1][1] + dp[i+1][2]
		dp[i][2] += 3 * dp[i+1][2] + ppp
		ppp *= 3
		ppp %= 10**9+7
	for j in range(3):
		dp[i][j] %= (10**9 + 7)
print(dp[0][0] % (10**9 + 7))

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

dp = [[0]*3 for i in range(len(a)+1)]

ppp ~ 1
for i in range(len(a))[::-1]:
	if a[i] == "A":
		dp[i][0] += dp[i+1][0] + dp[i+1][1]
		dp[i][1] += dp[i+1][1]
		dp[i][2] += dp[i+1][2]
	elif a[i] == "B":
		dp[i][0] += dp[i+1][0]
		dp[i][1] += dp[i+1][1] + dp[i+1][2]
		dp[i][2] += dp[i+1][2]
	elif a[i] == "C":
		dp[i][0] += dp[i+1][0]
		dp[i][1] += dp[i+1][1]
		dp[i][2] += dp[i+1][2] + ppp
	else:
		dp[i][0] += 3 * dp[i+1][0] + dp[i+1][1]
		dp[i][1] += 3 * dp[i+1][1] + dp[i+1][2]
		dp[i][2] += 3 * dp[i+1][2] + ppp
		ppp *= 3
		ppp %= 10**9+7
	for j in range(3):
		dp[i][j] %= (10**9 + 7)
print(dp[0][0] % (10**9 + 7))