Harryxun/stf_run huggingface dataset:
n,a=map(int,input().split())
x=list(map(lambda x:int(x)-a,input().split()))
m=min(x)*n;M=max(x)*n+1
if M<0 or m>0:print(0);exit()
dp=[[0]*(M-m) for _ in range(n)]
dp[0][x[0]]+=1
dp[0][0]+=1
for i in range(n-1):
    for j in range(m,M):
        dp[i+1][j+x[i+1]]+=dp[i][j]
        dp[i+1][j]+=dp[i][j]
print(dp[n-1][0]-1)

### FIXED CODE ###

n,a=map(int,input().split())
x=list(map(lambda x:int(x)-a,input().split()))
m=0 if min(x)>0 else min(x)*n
M=1 if max(x)<0 else max(x)*n+1
dp=[[0]*(M-m) for _ in range(n)]
dp[0][x[0]]+=1
dp[0][0]+=1
for i in range(n-1):
    for j in range(m,M):
        if j+x[i+1] in range(m,M):dp[i+1][j+x[i+1]]+=dp[i][j]
        dp[i+1][j]+=dp[i][j]
print(dp[n-1][0]-1)
n,k=map(int,input().split())
s=input()
a=[]
a.append(0)
tmp=1
for i in range(len(s)-1):
	if s[i] != s[i+1]:
		a.append(i+1)
a.append(n)

#print(a)

if len(a)==2:
	print(a[1])
else:
	if s[0]=='0':
		m=2*k
	else:
		m=2*k+1
	if m>len(s):
		print(len(s))
	else:
		_max=a[m]
		i=1
		while m+i<len(a):
			tmp=a[i+m]-a[i]
			print(tmp)
			if tmp>_max:
				_max=tmp
			i+=1
		print(_max)


### FIXED CODE ###

n,k=map(int,input().split())
s=input()
a=[]
a.append(0)
for i in range(len(s)-1):
	if s[i] != s[i+1]:
		a.append(i+1)
a.append(n)
if s[-1]=='0':
	m=2*k
else:
	m=2*k+1
t=4*k+1
_max=0
i=len(a)-1
if i- m<0:
	print(n)
else:
	while i-m>=0:
		tmp=a[i]-a[i-m]
		#print('i:{} tmp:{}'.format(i,tmp))
		if tmp>_max:
			_max=tmp
		m=t-m
		i-=1
	if a[i]>_max:
		_max=a[i]
	print(_max)
import numpy as numpy
from scipy.sparse.csgraph import floyd_warshall

N,M,L = map(int,input().split())
gurahu = np.zeros((N,N))

for k in range(M):
    a,b,c = map(int,input().split())
    gurahu[a-1,b-1] = c
    gurahu[b-1,a-1] = c

gurahu = floyd_warshall(gurahu, directed=False)
gurahu = np.where(gurahu <= L and gurahu > 0, 1, 0)
gurahu = floyd_warshall(gurahu) - np.ones((N, N))

Q = int(input())

for k in range(Q):
    s,t = map(int,input().split())
    print(gurahu[s-1,t-1])

### FIXED CODE ###

import numpy as np
from scipy.sparse.csgraph import floyd_warshall

N,M,L = map(int,input().split())
gurahu = np.zeros((N,N))

for k in range(M):
    a,b,c = map(int,input().split())
    gurahu[a-1,b-1] = c
    gurahu[b-1,a-1] = c

gurahu = floyd_warshall(gurahu, directed=False)
gurahu = np.where((gurahu <= L) & (gurahu > 0), 1, 0)
gurahu = floyd_warshall(gurahu) - np.ones((N, N))

Q = int(input())

for k in range(Q):
    s,t = map(int,input().split())
    ans = gurahu[s-1,t-1]
    if ans == float('inf'):
        print(-1)
    else:
        print(int(ans))
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = [0]
D = [0]

for i in range(N):
    s = B[i] - A[i]
    if(s > 0):
        C.append(s)
    elif(s < 0):
        D.append(s)

D = sorted(D)

csum = sum(C)
dsum = sum(D)

if(csum + dsum > 0):
    print(-1)
elif(csum == 0):
    print(0)
else:
    ans = len(C)
    for i in D:
        csum += D
        ans += 1
        if(csum <= 0):
            break
    print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = [0]
D = [0]

for i in range(N):
    s = B[i] - A[i]
    if(s > 0):
        C.append(s)
    elif(s < 0):
        D.append(s)

D = sorted(D)

csum = sum(C)
dsum = sum(D)

if(csum + dsum > 0):
    print(-1)
elif(csum == 0):
    print(0)
else:
    ans = len(C) -1
    for i in D:
        csum += i
        ans += 1
        if(csum <= 0):
            break
    print(ans)
N=input()

if N%2==0:
    print(int(N/2))
else :
    print(int(N/2)+1)

### FIXED CODE ###

N=int(input())

if N%2==0:
    print(int(N/2))
else :
    print(int(N/2)+1)
N, K = map(int, input().split())
A = list(map(int, input().split()))

A = sorted(A, key = lambda x:abs(x), reverse=True)
#print(A)

ans = []
negidx = 0
posidx = 0
neg = False
for i in range(K):
  a = A[i]
  ans.append(a)
  if a<0:
    negidx = i
    neg = not neg
  else:
    posidx = i
#print(ans, neg, negidx)
answer = 1
if neg:
  poppos = list(ans)
  pg = poppos.pop(posidx)
  popneg = list(ans)
  ng = popneg.pop(negidx)
  pgratio = None
  ngratio = None
  found = 0
  for i in range(K+1, N):
    if A[i]>=0 and ngratio is None:
      found = 1
      popneg.append(A[i])
      ngratio = -A[i]/ng
    if A[i]<0 and pgratio is None:
      found = 2
      poppos.append(A[i])
      pgratio = -A[i]/pg
    if pgratio is not None and npratio is not None:
      found = 3
      break
  if found == 1:
    for a in popnep:
      answer *= abs(a)%1000000007
    print(answer%1000000007)
  elif found == 2:
    for a in poppos:
      answer *= abs(a)%1000000007
    print(answer%1000000007)
  elif found == 3:
    if pgratio > ngratio:
      for a in poppos:
        answer *= abs(a)%1000000007
      print(answer%1000000007)
    else:
      for a in popneg:
        answer *= abs(a)%1000000007
      print(answer%1000000007)
  else:
    for i in range(K):
      answer *= A[-(i+1)]%1000000007
    print(answer%1000000007)
else:
  for a in ans:
    answer *= abs(a)%1000000007
  print(answer%1000000007)
      
    
    
  
  
      

### FIXED CODE ###

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

A_neg = []
A_pos = []

for i in range(N):
  if A[i] <= 0:
    A_neg.append(-A[i])
  else:
    A_pos.append(A[i])

A_neg.sort(reverse=True)
A_pos.sort(reverse=True)

ans = 1

if K == N:
  for i in range(N):
    ans *= (A[i]%1000000007)
    ans %= 1000000007
  print(ans)

elif K%2==1 and len(A_pos)==0:
  for i in range(1, K+1):
    ans *= ((-A_neg[-i])%1000000007)
    ans %= 1000000007
  print(ans)

else:
  if K%2==1:
    ans *= A_pos.pop(0)
    K -= 1
  buf = []
  for i in range(len(A_pos)//2):
    buf.append(A_pos[2*i]*A_pos[2*i+1])
  for i in range(len(A_neg)//2):
    buf.append(A_neg[2*i]*A_neg[2*i+1])
  buf.sort(reverse=True)
  for i in range(K//2):
    ans *= (buf[i]%1000000007)
    ans %= 1000000007
  print(ans)
judge = True
while judge:
    a,b = map(int, input().split(" "))
    if a != None:
        c = a+b
        print(len(str(c)))
    else:
        judge = False

### FIXED CODE ###

import fileinput

if __name__ == '__main__':
    for line in fileinput.input():
        tokens = line.strip().split()
        a, b = int(tokens[0]), int(tokens[1])
        c = a+b
        print(len(str(c)))
n = int(input())
p = [int(i) for i in input().split()]

count = 0
for i in range(n-2):
  a = p[i]
  b = p[i+1]
  c = p[i+2]
  if b > a and b < c:
    count+=1
  else b > c and b < a:
    count+=1
print(count)

### FIXED CODE ###

n = int(input())
p = [int(i) for i in input().split()]

count = 0
for i in range(n-2):
  a = p[i]
  b = p[i+1]
  c = p[i+2]
  if b > a and b < c:
    count+=1
  elif b > c and b < a:
    count+=1
print(count)
import math

try:
 while True:
  a,b=map(int,input().split())
  print(math.gcd(a,b),a*b// math.gcd(a, b))
except EOFError:
  pass
 

### FIXED CODE ###

def gcd(x,y):
    while y:
        x, y = y, x % y
    return x


def lcm(x,y):
    return x * y // gcd(x,y)


while True:
    try:
        a = list(map(int,input().split()))
        print(gcd(a[0],a[1]),lcm(a[0],a[1]))
    except:
        break
a, b = map(input().split())
c = a*b

if c%2 = 0:
    print("Even")

    else:
        print("Odd")



### FIXED CODE ###

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

if c % 2:
    print("Odd")

else:
    print("Even")
import math

n=int(input())
n=math.factorial(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)
print(len(divisors)%(10**9+7))

### FIXED CODE ###

import math
n=int(input())

mod=10**9+7
m=math.factorial(n)
ans=1
for i in range(2,n+1):
  tmp=1
  while m%i==0:
    m=m//i
    tmp+=1
  ans*=tmp
print(ans%mod)
You are not allowed to see this code.


### FIXED CODE ###

while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    elif a < b:
        print(a, b)
    else:
        print(b, a)
N = int(input())
A = sorted(list(map(int,input().split())))
cnt = 0
for i in range(N):
    tmp = A[i]
    if i == 0:
        if A[0]==A[1]:
            continue
    elif i == N-1:
        if A[-1]==A[-2]:
            continue
    else:
        if A[i-1]== A[i] or A[i] == A[i+1]:
            continue
    flag = 0
    for j in range(i):
        if A[j]*2 > A[i]:
            break
        else:
            #print(A[j],A[i])
            if A[i]%A[j]== 0:
                flag = 1
                break
            else:
                continue
    #print(A[i],flag)
    if flag == 0:
        #print(A[i])
        cnt +=1
print(cnt)
    


### FIXED CODE ###

import collections
N = int(input())
A = sorted(list(map(int,input().split())))
cA = collections.Counter(A)

li = [1]*(max(A)+1)
for j in range(N):
    for i in range(A[j]*2,A[-1]+1,A[j]):
        li[i] = 0

for key,val in cA.items():
    if val >1:
        li[key]=0
        
sA = sum([li[i] for i in A])
print(sA)
import math
N, K = map(int, input().split())
def comb(n, r):
    if n == 0:
        return 1
    else:
        return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
for i in range(1, K + 1):
    print((comb(K-1,i-1) * comb(N-K+1,i))%(10**9+7))


### FIXED CODE ###

import math
N, K = map(int, input().split())
def comb(n, r):
    if n < r or n < 0 or r < 0:
        return 0
    else:
        return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
for i in range(1, K + 1):
    print((comb(K-1,i-1) * comb(N-K+1,i))%(10**9+7))
S = input()
K = int(input())

cnt = 0
serial = 1
for i in range(len(S)):
  if S[i] == S[(i+1)%len(S)]:
    serial += 1
  else:
    cnt += int(serial/2)
    serial = 1
  #print(serial)
cnt += int(serial/2)
      
#print(cnt)
if S[0]==S[-1] and S[-1]!=S[-2]:
  ans = cnt*K-1
  
else:
  ans = cnt*K

print(ans)

### FIXED CODE ###

S = input()
K = int(input())

if len(set(S))==1:
  ans = int(len(S)*K/2)
elif K == 1:
  ans = 0
  serial = 1
  #print(serial)
  for i in range(len(S)-1):
    if S[i] == S[i+1]:
      serial += 1
    else:
      ans += int(serial/2)
      serial = 1
  ans += int(serial/2)
else:
  #first
  first=0
  serial = 1
  for i in range(len(S)-1):
    if S[i] == S[i+1]:
      serial += 1
    else:
      first += int(serial/2)
      serial = 1
  initial = 1
  for i in range(len(S)-1,1,-1):
    if S[i]==S[i-1]:
      initial += 1
    else:
      break
  cnt = 0
  serial = initial
  #print(serial)
  for i in range(len(S)):
    if S[i] == S[i-1]:
      serial += 1
    else:
      cnt += int(serial/2)
      serial = 1
    #print(cnt)
  #last
      
  #print(cnt)
  last = 0
  serial = initial
  for i in range(len(S)):
    if S[i] == S[i-1]:
      serial += 1
    else:
      last += int(serial/2)
      serial = 1
  last += int(serial/2)
  #print(first,cnt,last)
  ans = first+(K-2)*cnt+last

print(ans)
H, W = [int(hoge) for hoge in input().split()]
print(Possible) if sum([input().count("#") for h in range(H)]) == H+W-1 else print(Impossible)

### FIXED CODE ###

H, W = [int(hoge) for hoge in input().split()]
print("Possible") if sum([input().count("#") for h in range(H)]) == H+W-1 else print("Impossible")
from collections import defaultdict
N,M = list(map(int,input().split()))
# price_howmany = defaultdict(int)
price_howmany = {}
price_list = []
for _ in range(N):
    tmp = list(map(int,input().split()))
    price_list.append(tmp[0])
    if tmp[0] in price_howmany:
        price_howmany[tmp[0]] += tmp[1]
    else:
        price_howmany[tmp[0]] = tmp[1]
# price_list.sort(reverse=True)
price_list.sort()

# price_howmany = dict(price_howmany)

def solve():
    price = 0
    many = 0
    global M
    # while M > 0:
        # low_price = min(price_howmany.keys())
        # low_price = price_list.pop()
        # many = min(M,price_howmany.pop(low_price))
        # price += many * low_price
        # M -= many
    for low_price in price_list:
        many = min(M,price_howmany.pop(low_price))
        price += many * low_price
        M -= many
        if M == 0: break
    print(price)

if __name__ == "__main__":
    solve()

### FIXED CODE ###

# from collections import defaultdict
# N,M = list(map(int,input().split()))
# price_howmany = defaultdict(int)
import sys

stdin = sys.stdin

read_int = lambda : list(map(int,stdin.readline().split()))

N,M = read_int()
price_howmany = {}
# price_list = []

price_set = set()
for _ in range(N):
    tmp = read_int()
    # if tmp[0] not in price_set:
        # price_list.append(tmp[0])
    price_set.add(tmp[0])
    if tmp[0] in price_howmany:
        price_howmany[tmp[0]] += tmp[1]
    else:
        price_howmany[tmp[0]] = tmp[1]
# price_list.sort(reverse=True)
price_list = sorted(list(price_set))

# price_howmany = dict(price_howmany)

def solve():
    price = 0
    global M
    # while M > 0:
        # low_price = min(price_howmany.keys())
        # low_price = price_list.pop()
        # many = min(M,price_howmany.pop(low_price))
        # price += many * low_price
        # M -= many
    for low_price in price_list:
        many = min(M,price_howmany.pop(low_price))
        price += many * low_price
        M -= many
        if M == 0: break
    print(price)

if __name__ == "__main__":
    solve()
n,k=map(int,input().split())
s=list(input())
s[k]=s[k].lower()
for i in range(len(s)):
  print(s[i],end="")
print("\n")

### FIXED CODE ###

n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
s="".join(s)
print(s)
a, b = input().split()
a = int(a)
b = b * 1000
print(int(a*b/1000))

### FIXED CODE ###

from decimal import Decimal
a, b = input().split()
a = Decimal(a)
b = Decimal(b)
print(int(a*b))
N = int(input())
ans_list = [2**i for i in range(7)]
ai = 0
while (ans_list[ai] <= N):
    ai += 1

print(ans_list[max(0, ai-1)])


### FIXED CODE ###

N = int(input())
for i in range(N, 0, -1):
	a = bin(i)
	if a[2] == "1":
		if len(a) == 3:
			print(1)
			exit()
		elif not "1" in a[3:]:
			print(i)
			exit()
S = input()

ans = 0
ACGT = ("A", "C", "G", "T")

count = 0
count_list = []
for s in S:
    if s not in ACGT:
        count_list.append(count)
        count = 0
        continue
    else:
        count += 1
print(max(count_list))

### FIXED CODE ###

S = input()

ans = 0
ACGT = ("A", "C", "G", "T")

count = 0
count_list = [0]
for s in S:
    if s not in ACGT:
        count_list.append(count)
        count = 0
        continue
    else:
        count += 1
count_list.append(count)
print(max(count_list))
W,H,x,y,r=map(int,input().split())
W=-r;H=-r;
if r<=x and r<=y and x<=W and y<=H:
    print(Yes)
else:
    print(No)


### FIXED CODE ###

W,H,x,y,r=map(int,input().split())
if min([x,y])>=r and x<=(W-r) and y<=(H-r):
    print("Yes")
else:
    print("No")
import math
debt = 100000
for x in range (0, int(input())):
    debt = math.ceil(debt * 1.05, -3)
    
print(int(debt))

### FIXED CODE ###

def ceil(src, range):
    k = src / 1000
    if k == int(k):
        return int(src)
    else:
        return ((int)(src / range) + 1 ) * range

debt = 100000
for x in range (0, int(input())):
    debt = ceil(debt * 1.05, 1000)
    
print(int(debt))
n,k,s = map(int, input().split())

ans = [1] * n
if k * 2 <= n:
    i = 0
    while k > 0:
        ans[i], ans[i+1] = 1, s-1
        k -= 1
        i += 2
else:
    if s % 2 == 0:
        i = 0
        while k > 0:
            ans[i] = ans[i+1] = s//2
            k -= 1
            i += 1
    else:
        i = 0
        while k-1 > 0:
            ans[i], ans[i+1] = 1, s-1
            k -= 1
            i += 2
        ans[i] = s
print(" ".join(map(str, ans)))

### FIXED CODE ###

n,k,s = map(int, input().split())
if s < 10 ** 9:
    ans = [s+1] * n
else:
    ans = [1] * n
ans[:k] = [s] * k
print(" ".join(map(str, ans)))
import math
 
datas = input().split(" ")
 
a = int(datas[0])
b = int(datas[1])
c = int(datas[2])
 
if(math.sqrt(a)*math.sqrt(b)+a+b < c):
  print( "Yes" )
else:
  print( "No" )

### FIXED CODE ###

retu = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"

retu = retu.split(",")
retuint=[]
for i in retu :
	retuint.append(int(i))

index=input()

print(retuint[int(index)-1])
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
ans=0
ans2=0
if N%2==0:
    for i in range(N):
        if A[i]%2==1 and (A[i]+1)/2<=N/2:
            B[(A[i]-1)//2]+=1
        else:
            print(0)
            exit()
    for i in range((N//2+N%2)):
        if B[i]!=2:
            print(0)
            exit()
    ans=pow(2,N/2)%(pow(10,9)+7)
    ans2=int(ans)
    print(ans2)
elif N%2==1:
    for i in range(N):
        if A[i]%2==0 and A[i]/2<=(N-1)/2:
            B[A[i]//2]+=1
        else:
            print(0)
            exit()
    if B[0]!=1:
        print(0)
        exit()
    for i in range((N//2+N%2)-1):
        if B[i+1]!=2:
            print(0)
            exit()
    ans=pow(2,(N-1)/2)%(pow(10,9)+7)
    ans2=int(ans)
    print(ans2)
else:
    print(0)


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
IndexCount=0
IndexRe=0
Divider=pow(10,9)+7
ans=1
if N%2==0:
    for i in range(N):
        if A[i]%2==1 and (A[i]+1)/2<=N/2:
            B[(A[i]-1)//2]+=1
        else:
            print(0)
            exit()
    for i in range((N//2+N%2)):
        if B[i]!=2:
            print(0)
            exit()
    IndexCount=int((N/2)//1000)
    IndexRe=int((N/2)%1000)
    for i in range(IndexCount):
        ans=(ans*(pow(2,1000)%Divider))%Divider
    ans=(ans*(pow(2,IndexRe)%Divider))%Divider
    print(ans)
elif N%2==1:
    for i in range(N):
        if A[i]%2==0 and A[i]/2<=(N-1)/2:
            B[A[i]//2]+=1
        else:
            print(0)
            exit()
    if B[0]!=1:
        print(0)
        exit()
    for i in range((N//2+N%2)-1):
        if B[i+1]!=2:
            print(0)
            exit()
    IndexCount=int(((N-1)/2)//1000)
    IndexRe=int(((N-1)/2)%1000)
    for i in range(IndexCount):
        ans=(ans*(pow(2,1000)%Divider))%Divider
    ans=(ans*(pow(2,IndexRe)%Divider))%Divider
    print(ans)
else:
    print(0)
import queue
from collections import deque
h,w,n = map(int,input().split())
factrys = [None] * (n + 1)
ss = ["X" * (w + 2)]
for i in range(h):
  s = "X" + input() + "X"
  if "S" in s:
    factrys[0] = (i + 1, s.index("S"))
  for j in range(1,n + 1):
    if str(j) in s:
      factrys[j] = (i + 1, s.index(str(j)))
  ss.append(s)
ss.append("X" * (w + 2))

def bfs(i):
  mp = [[None] * (w + 2) for j in range(h + 2)]
  x,y = factrys[i]
  mp[x][y] = 0
  que = queue.Queue()
  que.put((x, y))
  while True:
    (x,y) = que.get()
  #  print(i,x,y)
  #  print(mp[x][y])
    if (x,y) == factrys[i + 1]:
      return mp[x][y]
    count = mp[x][y]
    if ss[x + 1][y] != "X" and mp[x + 1][y] is None:
      mp[x + 1][y] = count + 1
      que.put((x + 1, y))
    if ss[x - 1][y] != "X" and mp[x - 1][y] is None:
      mp[x - 1][y] = count + 1
      que.put((x - 1, y))
    if ss[x][y + 1] != "X" and mp[x][y + 1] is None:
      mp[x][y + 1] = count + 1
      que.put((x, y + 1))
    if ss[x][y - 1] != "X" and mp[x][y - 1] is None:
      mp[x][y - 1] = count + 1
      que.put((x, y - 1))

ans = 0
for i in range(n):
  ret = bfs(i)
  if ret is None:
    ans += 0
  else:
    ans += (ret)
print(ans)


### FIXED CODE ###

from collections import deque

def main():
  h, w, n = map(int, input().split())
  mp = ["X" + input() + "X" for _ in range(h)]
  mp.insert(0, "X" * (w + 2))
  mp.append("X" * (w + 2))
  
  poss = [None] * (n + 1)
  for y in range(1, h + 1):
    for x in range(1, w + 1):
      if mp[y][x] == "S":
        poss[0] = (x, y)
      elif "1" <= mp[y][x] <= "9":
        poss[int(mp[y][x])] = (x, y)
  
  ans = 0
  vec = ((1, 0), (0, -1), (-1, 0), (0, 1))
  for i in range(n):
    sx, sy = poss[i]
    gx, gy = poss[i + 1]
    used = [[False] * (w + 2) for _ in range(h + 2)]
    used[sy][sx] = True
    que = deque()
    push = que.append
    pop = que.popleft
    push((0, sx, sy))
    while que:
      cnt, x, y = pop()
      if (x, y) == (gx, gy):
        ans += cnt
        break
      
      for dx, dy in vec:
        nx, ny = x + dx, y + dy
        if used[ny][nx] or mp[ny][nx] == "X":continue
        used[ny][nx] = True
        push((cnt + 1, nx, ny))
  
  print(ans)

main()
X = list(map(int,input().split()))

print(A.index(0)+1)

### FIXED CODE ###

X = list(map(int, input().split()))
sum = X[0] + X[1] + X[2] + X[3] + X[4]
print(15 - sum)
m={}
try:
    while True:
        v=raw_input().split()
        print(m[''.join(v)][1])
except EOFError:
    pass

### FIXED CODE ###

from __future__ import division
import sys
if sys.version_info[0]>=3: raw_input=input

X=4
Y=2
i=0
m={}
prev={}
v=[]
for i in range(X*Y): v.append(str(i))
m[''.join(v)]=[0,0]
prev[''.join(v)]=[''.join(v),None]
q=[v]
while len(q)>0:
	v=q.pop(0)
	coor=m[''.join(v)][0]
	x=coor%X
	y=coor//X
	depth=m[''.join(v)][1]
	nextstr=''.join(v)
	if 0<x:
		v[coor],v[coor-1]=v[coor-1],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor-1,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'R']
		v[coor],v[coor-1]=v[coor-1],v[coor]
	if x<X-1:
		v[coor],v[coor+1]=v[coor+1],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor+1,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'L']
		v[coor],v[coor+1]=v[coor+1],v[coor]
	if 0<y:
		v[coor],v[coor-X]=v[coor-X],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor-X,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'D']
		v[coor],v[coor-X]=v[coor-X],v[coor]
	if y<Y-1:
		v[coor],v[coor+X]=v[coor+X],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor+X,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'U']
		v[coor],v[coor+X]=v[coor+X],v[coor]

try:
	while True:
		v=raw_input().split()
		print(m[''.join(v)][1])
except EOFError:
	pass
N,K = map(int, input().split())
X = N
a = ""
while X > 0:
  a = str(X&K) + a
  X = X/K

  
print(a)

### FIXED CODE ###

N,K = map(int, input().split())
X = N
a = ""
while X > 0:
  a = str(X%K) + a
  X = X//K

  
print(len(a))
import numpy as np
n = int(input())

l = np.empty(n)
l[:] = np.nan
k = 0

for i in range(1,n):
  if n % i == 0:
    l[k] = i + (n / i)
    k += 1
print(int(np.nanmin(l) - 2))

### FIXED CODE ###

n = int(input())

for i in range(int(n ** 0.5)):
  if n % (int(n ** 0.5) - i) == 0:
    j = n // (int(n ** 0.5) - i)
    break
    
print(int(n ** 0.5) - i + j - 2)
import numpy as np
n = int(input())
A = list(map(int, input().split()))
Arr = np.zeros((n, n))
for i in range(0, n-1):
    Arr[i][i] = 0.5
    Arr[i][i+1] = 0.5
Arr[n-1][n-1] = 0.5
Arr[n-1][0] = 0.5
#print(Arr)

inv_Arr = np.linalg.inv(Arr)
#print(inv_Arr)

ans = np.dot(inv_Arr, A)
ans = list(map(int, ans))
print(*ans, sep=" ")

### FIXED CODE ###

from collections import defaultdict as dd

n = int(input())
A = list(map(int, input().split()))
odd_ac = dd(int)
even_ac = dd(int)
for i, a in enumerate(A):
    if i % 2 == 0:
        even_ac[i] = even_ac[i-2] + a
    else:
        odd_ac[i] = odd_ac[i-2] + a
#print(odd_ac)
#print(even_ac)

ans = []
for dam in range(n):
    is_odd = dam % 2
    total = 0
    if is_odd:
        total += odd_ac[n-2] - odd_ac[dam-2]
        total -= even_ac[n-1] - even_ac[dam-1]
        total += even_ac[dam-1]
        total -= odd_ac[dam-2]
    else:
        total += even_ac[n-1] - even_ac[dam-2]
        total -= odd_ac[n-2] - odd_ac[dam-1]
        total -= even_ac[dam-2]
        total += odd_ac[dam-1]

    ans.append(total)

print(*ans, sep=" ")
s = str(input()).split('')

text = ''

for i in s:
  if i == 'B' and len(text) > 0:
    text = text[:-1]
  else:
    text += i
    
print(text)

### FIXED CODE ###

s = input()

ans = ''
for i in s:
    if i == 'B':
        ans = ans[:-1]
    else:
        ans += i
print(ans)