Harryxun/stf_run huggingface dataset:
n, m, k = map(int, input().split())
color = [i for i in range(m)]
ans = 0
def dfs(i, daburi, num):
    global ans
    if i == n-1:
        if daburi == k:
            ans += num % 998244353
            return 
        elif daburi < k:
            ans += num % 998244353
            return
    if daburi > k:
        return
    dfs(i+1, daburi, num*(m-1))
    dfs(i+1, daburi+1, num)
dfs(0, 0, m)
print(ans% 998244353)

### FIXED CODE ###

import math
n, m, k = map(int, input().split())

p = 998244353

def comb(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

fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

for i in range(2, n+1):
    fact.append(fact[-1]*i%p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1]*inv[i])%p)
ans = 0

for i in range(k+1):
    row = comb(n-1, i, p)
    column = m * pow(m-1, n-i-1, p)
    ans += row * column
    
print(ans % p)
from math import ceil, floor

K = int(input())
As = list(map(int, input().split()))

L = 2
R = 2
for A in reversed(As):
    if R // A * A < L:
        print('-1')
        exit()
    L = ceil(L / A) * A
    R = floor(R / A) * A + A - 1

print(L, R)


### FIXED CODE ###

N, A, B = map(int, input().split())

if (B - A) % 2 == 0:
    print('Alice')
else:
    print('Borys')
import math
while True:
    line = input().split(" ")
    if(len(line) != 2):
        break
    a = int(line[0])
    b = int(line[1])
    print(int(math.log10(a+b))+1)

### FIXED CODE ###

import math
while True:
    try:
        line = input().split(" ")
        print(int(math.log10(int(line[0])+int(line[1])))+1)
    except:
        break
import math
from functools import reduce
from fractions import Fraction
import numpy as np
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

N = int(input())
A = list(map(int, input().split()))
ans=0
for i in range(N):
    a = A[0]
    del A[0]
    
    b = gcd_list(A)
    if ans < b:
        ans = b
    A.append(a)

print(ans)
        

### FIXED CODE ###

def gcd(x,y):
  if y==0:
    return x
  else:
    return gcd(y, x%y)

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

left_gcd = [A[0]]
a = A[0]
for i in range(1,N-1):
  a = gcd(a, A[i])
  left_gcd.append(a)

right_gcd = [A[N-1]]
b = A[N-1]
for k in range(N-2, 0, -1):
  b = gcd(b, A[k])
  right_gcd.append(b)

ans_gcd = [right_gcd[N-2], left_gcd[N-2]]

for p in range(N-2):
  ans_gcd.append(gcd(left_gcd[p], right_gcd[N-p-3]))

print(max(ans_gcd))
S = input()
n = len(S)
prev = None
cand = []
for i in range(n):
    if i != 0:
        if S[i] != prev:
            cand.append(max(i, n-i))
    prev = S[i]    

print(min(cand))

### FIXED CODE ###

S = input()
n = len(S)

prev = None
cand = []
for i in range(n):
    if i != 0:
        if S[i] != prev:
            cand.append(max(i, n-i))
    prev = S[i]    
if cand:
    print(min(cand))
else:
    print(n)
n = int(input())
arr = map(int, input().split())
arr.sort()

ans = 1
for x in arr:
	ans *= x
    if ans > 10**18:
    	ans = 10**19

if ans == 10**19:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

n = int(input())
arr = list(map(int, input().split()))
arr.sort()

ans = 1
for x in arr:
    ans *= x
    if ans > 10**18:
        ans = 10**19

if ans == 10**19:
  print(-1)
else:
  print(ans)
s,t=map(input().split())
print(s+t)


### FIXED CODE ###

s,t=input().split()
print(t+s)
N, K = map(int, input().split())
C = [0] + list(map(int, input().split()))
P = [0] + list(map(int, input().split()))

max_ans = -10**9
for i in range(1, N+1):
    v = i
    s = 0
    loop = []
    while True:
        loop.append(v)
        s += P[v]
        v = C[v]
        if v == i:
            break

    L = len(loop)
    a = K // L
    r = K % L
    ans = a * max(0, sums[i])

    tmp = P[loop[0]]
    if r > 0:
        for j in range(1, r):
            if P[loop[j]] >= 0:
                tmp += P[loop[j]]
            else:
                break

    ans += tmp
    if ans > max_ans:
        max_ans = ans

print(max_ans)

### FIXED CODE ###

N, K = map(int, input().split())
P = [0] + list(map(int, input().split()))
C = [0] + list(map(int, input().split()))
ans = -float('inf')
for i in range(1, N+1):
    v = i
    score = 0
    size = 0
    while True:
        size += 1
        score += C[v]
        if i == P[v]:
            break
        v = P[v]

    if score > 0:
        tmp = score*(K//size-1)
        num = K%size+size
    else:
        tmp = 0
        num = min(K, size)
    
    v = i
    for _ in range(num):
        tmp += C[v]
        v = P[v]
        ans = max(tmp, ans)

print(ans)
K, X = int(input())
if 500*K >= X:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

K, X = list(map(int,input().split()))
if 500*K >= X:
  print('Yes')
else:
  print('No')
s = input()
N = len(s)
for i in range(N):
  if i%2 ==1:
    s.pop(i)
print(s)
    

### FIXED CODE ###

S = input()
print(S[::2])
import itertools
N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
ls = list(itertools.permutations(range(1,N+1)))
print(abs(ls.index(P) - ls.index(Q)))

### FIXED CODE ###

import itertools
N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))
ls = list(itertools.permutations(range(1,N+1)))
print(abs(ls.index(P) - ls.index(Q)))
N = int(input())
ans = 0
for i in range(N):
    j = N // i
    ans += i * j * (j+1) / 2

print(ans)


### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1, N+1):
    j = N // i
    ans += i * j * (j+1) // 2

print(ans)
a, b, t = map(int, input().split())
 
count = 0
for i range(1, t+1, a):
    count += i * b
print(count)

### FIXED CODE ###

a, b, t = map(int, input().split())
 
count = 0
for i in range(0, t+1, a):
    count += b
print(count - b)
a, b,c = map(str, input().split())
if a[-1]==b[1] and b[-1]==c[1]:
  print('YES')
  exit()
print('NO')

### FIXED CODE ###

a, b,c = map(str, input().split())
if a[-1]==b[0] and b[-1]==c[0]:
  print('YES')
  exit()
print('NO')
print(ord(ord(input())+1))

### FIXED CODE ###

print(chr(ord(input())+1))
N,M=map(int,input().split())
H=list(map(int,input().split))
check=[0]*N
for i in range(M):
  A,B=map(int,input.split)
  if H[A-1]>H[B-1]:
    check[B-1]=check[B-1]+1
  elif H[A-1]<H[B-1]:
    check[A-1]=check[A-1]+1
  else:
      check[A-1]+=1
      check[B-1]+=1
    
    
ans=check.count(0)

print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
H=list(map(int,input().split()))
check=[0]*N
for i in range(M):
  A,B=map(int,input().split())
  if H[A-1]>H[B-1]:
    check[B-1]=check[B-1]+1
  elif H[A-1]<H[B-1]:
    check[A-1]=check[A-1]+1
  else:
      check[A-1]+=1
      check[B-1]+=1
    
    
ans=check.count(0)

print(ans)
import sys
input = sys.stdin.readline
from collections import deque
n = int(input())
a = list(map(int,input().split()))
ls = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
  for j in range(n):
    ls[i][j] = min(i,j,n-1-i,n-1-j)
ans = 0
st = set()
for i in a:
  x,y = divmod(i-1,n)
  ans += ls[x][y]
  st.add((x,y))
  q = deque([i-1])
  while q:
    j = q.popleft()
    px,py = divmod(j,n)
    for nx,ny in (px-1,py),(px+1,py),(px,py+1),(px,py-1):
      if 0 <= nx < n and 0 <= ny < n:
        if (px,py) in st:
          if ls[px][py] < ls[nx][ny]:
            ls[nx][ny] = ls[px][py]
            q.append((nx,ny))
        elif ls[px][py]+1 < ls[nx][ny]:
          ls[nx][ny] = ls[px][py]+1
          q.append((nx,ny))
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import deque
n = int(input())
a = list(map(int,input().split()))
n += 2
ls = [0 for i in range(n*n)]
for i in range(n):
  for j in range(n):
    ls[i*n+j] = min(i,j,n-1-i,n-1-j)-1
ans = 0
st = [0]*(n*n)
for i in a:
  x,y = divmod(i-1,n-2)
  i = (x+1)*n+(y+1)
  ans += ls[i]
  st[i]=1
  q = deque([i])
  while q:
    j = q.popleft()
    for k in (j-n,j+n,j+1,j-1):
      if st[j]:
        if ls[j] < ls[k]:
          ls[k] = ls[j]
          q.append(k)
      elif ls[j]+1 < ls[k]:
        ls[k] = ls[j]+1
        q.append(k)
print(ans)
n,k=map(int,input().split())
h=list(map(int,input().split()))

h.sort(reverse=True)

for i in range(k):
  h[i]=0

sum_=0
for hh in range(h):
  sum_+=hh
print(sum_)

### FIXED CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))

h.sort(reverse=True)

if k>n:
  k=n

for i in range(k):
  h[i]=0

sum_=0
for hh in h:
  sum_+=hh
print(sum_)
N,P = map(int,input().split())
A = list(map(int,input().strip()))
cnt = 0
for i in range(N):
    cnt += A[i]%2
print(2**(N-1))

### FIXED CODE ###

N,P = map(int,input().split())
A = list(map(int,input().split()))
cnt = 0
for i in range(N):
    cnt += A[i]%2
if cnt>0:
    print(2**(N-1))
elif P==1:
    print(0)
else:
    print(2**N)
n=int(input())
f1=list(map(int,input().split()))
c=0
for i in range(n-1):
    if f1[i]==i+1:
        c+=1
        f1[i],f1[i+1]=f1[i+1],f1[i]
if f[n-1]==n:
  f[n-2],f[n-1]=f[n-1],f[n-2]
  c+=1  
print(c)

### FIXED CODE ###

import copy

n=int(input())
f1=list(map(int,input().split()))
f2=copy.deepcopy(f1)
c=0
for i in range(n-1):
    if f1[i]==i+1:
        c+=1
        f1[i],f1[i+1]=f1[i+1],f1[i]

for i in range(n-1,0,-1):
    #print(d)
    if f1[i]==i+1:
        c+=1
        f1[i],f1[i-1]=f1[i-1],f1[i]

print(c)
# coding: utf-8
import math
A, B = [int(x) for x in input().split(" ")]
 
print(int((A*B) / math.gcd(A, B)))

### FIXED CODE ###

# coding: utf-8
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

 #最小公倍数
def lcm(a,b):
  return a*b//gcd(a,b)
 
A, B = [int(x) for x in input().split(" ")]
 
print(lcm(A, B))
import sys

input = sys.stdin.readline

def main():
    def hash_ini(t):
        h = t[0]
        hash_table[0] = h
        p = 1
        for i in range(1, len(t)):
            h = hash_table[i] = (h * base + t[i]) % hash_md
            p = pw[i] = p * base % hash_md

    def hash(s):
        res = 0
        for i, c in enumerate(s[::-1]):
            res = (res + pw[i] * (ord(c) - ord_a)) % hash_md
        return res

    # インデックスがi以上j未満の文字列のハッシュ
    def hash_ij(i, j):
        return (hash_table[j] - hash_table[i] * pw[j - i]) % hash_md

    n = int(input())
    s = input()[:-1]

    # 初期化
    base = 29
    hash_md = pow(3, 19)
    ord_a = ord('a')
    t = [ord(c) - ord_a for c in s]
    hash_table = [0] * len(t)
    pw = [1] * len(t)
    hash_ini(t)

    ok = 0
    ng = n // 2 + 1
    while ok + 1 < ng:
        br = False
        w = (ok + ng) // 2
        for i in range(n - 2 * w + 1):
            ptn = hash_ij(i, i + w)
            for j in range(i + w, n - w + 1):
                if hash_ij(j, j + w) == ptn:
                    ok = w
                    br = True
                    break
            if br: break
        else:
            ng = w
    print(ok)

main()


### FIXED CODE ###

# YouTube
def main():
    n = int(input())
    s = input()
    dp = [[0] * (n + 1) for _ in range(n + 1)]
    for i, c in enumerate(s):
        for j in range(n):
            if c == s[j]:
                dp[i + 1][j + 1] = dp[i][j] + 1
    ans = 0
    for i in range(n):
        for j in range(i+1,n+1):
            tmp=min(dp[i][j],j-i)
            ans=max(tmp,ans)
    print(ans)

main()
s=int(input())
if s==1 or s==4 or s==2:
    print(4)
else:
    count=1
    while s!=4:
        if s%2==0:
            s=s/2
            count+=1
        else:
            s=3*s+1
            count+=1
print(count+3)
    

### FIXED CODE ###

a=int(input())
count=1
if a==1:
  count+=3
elif a==2:
  count+=3
else:
  count+=1
  while a!=1:
    if a%2==0:
        a=a/2
        count+=1
    else:
        a=3*a+1
        count+=1
print(count)
/Users/isiidaisuke/PycharmProjects/program/venv/bin/python /Users/isiidaisuke/PycharmProjects/program/program.py
89
Yes

Process finished with exit code 0


### FIXED CODE ###

a = input()
print("Yes") if "9" in a else print("No")
S=int(input())
W=int(input())
if W>=S:
    print('unsafe')
else:
    print('safe')

### FIXED CODE ###

a=list(map(int,input().split()))
if a[1]>=a[0]:
    print('unsafe')
else:
    print('safe')
N = int(input())
es = [[] for _ in range(N)]

for i in range(N-1):
    u,v,w = map(int, input().split())
    u,v = u-1, v-1
    es[u].append((v,w))
    es[v].append((u,w))


ans = [-1] * N

def dfs(node, c):

    ans[node] = c
    for next,w in es[node]:
        # 未着色であれば
        if ans[next] == -1:
            if w % 2 == 0:
                # 距離が偶数なら同じ色
                dfs(next, c)
            else:
                # 距離が異なるなら違う色
                if c == 0:
                    dfs(next, 1)
                else:
                    dfs(next, 0)

dfs(0,0)

print(*ans, sep="\n")



### FIXED CODE ###

N = int(input())

es = [[] for _ in range(N)]

for i in range(N-1):
    u,v,w = map(int, input().split())

    es[u-1].append((v-1,w))
    es[v-1].append((u-1,w))

ans = [-1] * N

ans[0] = 0

queue = [0]

while len(queue) > 0:
    next_queue = []
    for curr in queue:
        for next,w in es[curr]:
            if ans[next] == -1:
                    next_queue.append(next)
                    if w % 2 == 0:
                        ans[next] = ans[curr]
                    else:
                        ans[next] = 1 if ans[curr] == 0 else 0

    if len(next_queue) > 0:
        queue = next_queue
    else:
        queue = []

print(*ans, sep="\n")
import collections
s = input()
n = len(s)
mod_list = [0]

T = 0
for i in range(n):
    T += int(s[-1-i])*pow(10, i, 2019)%2019
    T = T%2019
    mod_list.append(T)

res = collections.Counter(mod_list)
cnt = 0
for d in res.values:
    cnt += int(d*(d-1)/2)
print(cnt)

### FIXED CODE ###

import collections
s = input()
n = len(s)
mod_list = [0]

T = 0
for i in range(n):
    T += int(s[-1-i])*pow(10, i, 2019)%2019
    T = T%2019
    mod_list.append(T)

res = collections.Counter(mod_list)
cnt = 0
for d in res.values():
    cnt += int(d*(d-1)/2)
print(cnt)
n = int(input())
a = list(map(int,input().split()))

cnt = 0
num = 1

for i in range(n):
  if a[i] == num:
    num += 1
    cnt += 1

if cnt == 0:
  pirnt(-1)
else:
  print(n - cnt)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))

cnt = 0
num = 1

for i in range(n):
  if a[i] == num:
    num += 1
    cnt += 1

if cnt == 0:
  print(-1)
else:
  print(n - cnt)
k,s = map(int,input().split())
f = 0
for i in range(k):
    for j in range(k):
        for l in range(k):
            if sum(i,j,k)==s:
                f+=1
print(f)

### FIXED CODE ###

k,s = map(int,input().split())
f = 0
for i in range(k+1):
    for j in range(k+1):
        l = s-i-j
        if 0 <= l <=k:
            f+=1
print(f)
n = input()
if 9 in n:
  print("Yes")
else:
  print("No")
    

### FIXED CODE ###

n = input()
print("Yes" if "9" in n else "No")
w = raw_input().lower()
sum = 0
while True:
    t = raw_input().split()
    if t == "END_OF_TEXT":
        break
    else:
        sum += t.lower().count(w)
print sum

### FIXED CODE ###

w = raw_input().lower()
sum = 0
while True:
    t = raw_input().split()
    if t[0] == "END_OF_TEXT":
        break
    else:
        for ti in t:
            if ti.lower() == w:
                sum += 1
print sum
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    n,k=map(int,input().split())
    A=list(map(int,input().split()))

    from functools import reduce
    from math import gcd
    G=reduce(gcd,A)

    if k%G==0 and k<=max(A):
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')

resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

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

    ma=max(A)

    from functools import reduce
    from fractions import gcd

    g=reduce(gcd,A)
    if K%g==0 and K<=ma:
        print('POSSIBLE')
    else: print('IMPOSSIBLE')

resolve()
h,a = map(input().split())

print((h+a-1)//a)

### FIXED CODE ###

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

print((h+a-1)//a)
S=[str(input()) for i in range(2*10^1-1)]
S.pop(0)
print(len(set(S))

### FIXED CODE ###

N=int(input())
S = [str(input()) for i in range(N)]
print(len(set(S)))
from re import fullmatch
S = input()
_s = "keyence"
flag = False
for i in range(len(_s)):
    if fullmatch(f".*{_s[:i]}.*{_s[i:]}.*", S):
        flag = True
print("YES") if flag else print("NO")


### FIXED CODE ###

from re import fullmatch
S = input()
_s = "keyence"
flag = False
for i in range(len(_s)):
    tmp = fullmatch("(.*)" + _s[:i] + "(.*)" + _s[i:] + "(.*)", S)
    if tmp and sum([1 for j in range(1, 4) if tmp.group(j)]) <= 1:
        flag = True
print("YES") if flag else print("NO")
# coding: utf-8
# Your code here!

A=int(input())
B=int(input())
C=int(input())
if A+B+C>=22:
    print("bust")
else:
    print("win")

### FIXED CODE ###

# coding: utf-8
# Your code here!

a,b, c = map(int, input().split())
if a+b+c>=22:
    print("bust")
else:
    print("win")
def f(i):
    global ans
    if i == n:
        u = [0] * n
        for j in range(1, 10):
            u[0] = j
            for l in range(1, n):
                if s[l] == 0:
                    if u[l - 1] - 1 >= 0:
                        u[l] = u[l - 1] - 1
                    else:
                        return
                elif s[l] == 2:
                    if u[l - 1] + 1 <= 9:
                        u[l] = u[l - 1] + 1
                    else:
                        return
                else:
                    u[l] = u[l - 1]
            v = "".join(map(str, u))
            ans.append(int(v))
        return
    f(i + 1)
    s[i] = 2
    f(i + 1)
    s[i] = 1
    f(i + 1)
    s[i] = 0

k = int(input())
dp = [[0] * 12 for _ in range(11)]
for i in range(1, 11):
    dp[i - 1][0], dp[i - 1][11] = 0, 0
    for j in range(1, 11):
        if i == 1 and j >= 2:
            dp[i][j] = 1
        else:
            dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j] + dp[i - 1][j + 1]
t = 0
for i in range(1, 11):
    t += sum(dp[i])
    m = t - sum(dp[i])
    if k <= t:
        n = i
        break

ans = []
s = [0] * n
f(0)
ans = list(set(ans))
ans.sort()

print(ans[k - m - 1])

### FIXED CODE ###

from collections import deque

k = int(input())
q = deque()
for i in range(1, 10):
    q.append(i)
for _ in range(k):
    p = q.popleft()
    r = p % 10
    if r != 0:
        q.append(10 * p + r - 1)
    q.append(10 * p + r)
    if r != 9:
        q.append(10 * p + r + 1)
print(p)
def toggle_nth_bit(num: int, n: int):
    return num ^ (1 << n)

def popcount(x):
    '''xの立っているビット数をカウントする関数
    (xは64bit整数)'''

    # 2bitごとの組に分け、立っているビット数を2bitで表現する
    x = x - ((x >> 1) & 0x5555555555555555)

    # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f # 8bitごと
    x = x + (x >> 8) # 16bitごと
    x = x + (x >> 16) # 32bitごと
    x = x + (x >> 32) # 64bitごと = 全部の合計
    return x & 0x0000007f

N = int(input())
X = input()
f = 0
count = 1
for i in range(N-1, -1, -1):
    f = toggle_nth_bit(int(X, 2), i)
    while f % popcount(f) != 0:
        f = f % popcount(f)
        count += 1
    print(count)
    count = 1



### FIXED CODE ###

def pc(x):
    return format(x, 'b').count('1')


N = int(input())
X = input()
Xo = int(X, 2)

count = 0
ans = 0
ori = pc(Xo)
X = list(X)

Xp = Xo%(ori + 1)
if ori == 1:
    Xm = 0
else:
    Xm = Xo % (ori - 1)

# for i in range(N-1, -1, -1):
for i in range(N):
    if ori == 1 and X[i] == '1':
        print(0)
        continue
    else:
        if X[i] == '1':
            # ans = Xm - pow(2, i, ori - 1)
            ans = Xm - pow(2, N-1-i, ori - 1)
            ans %= ori - 1
        else:
            # ans = Xp - pow(2, i, ori + 1)
            ans = Xp + pow(2, N-1-i, ori + 1)
            ans %= ori + 1
    count = 1
    while ans > 0:
        # count += 1
        # if ans == 1:
        #     break
        ans %= pc(ans)
        count += 1

   
    print(count)
    count = 1
S = input()

if len(S) >= 9:
    print("NO")
else:
    if S.count("A") > 4:
        print("NO")
    elif "KIH" not in S:
        print("NO")
    elif S.index("B") > S.index("R") or S.index("B") < S.index("K") or S.index("R") < S.index("K"):
        print("NO")
    elif S[:S.index("K")].count("A") > 1 or S[S.index("H"):S.index("B")].count("A") > 1 or S[S.index("B"):S.index("R")].count("A") > 1 or S[S.index("R"):].count("A") > 1:
        print("NO")
    else:
        print("YES")
    


### FIXED CODE ###

S = input()

if len(S) > 9:
    print("NO")
elif "KIH" not in S or "B" not in S or "R" not in S:
    print("NO")
elif ("A" in S and len(set(S)) > 6) or ("A" not in S and len(set(S)) > 5):
    print("NO")
elif S.index("B") > S.index("R") or S.index("B") < S.index("K") or S.index("R") < S.index("K"):
    print("NO")
elif S[:S.index("K")].count("A") > 1 or S[S.index("H"):S.index("B")].count("A") > 1 or S[S.index("B"):S.index("R")].count("A") > 1 or S[S.index("R"):].count("A") > 1:
    print("NO")
else:
    print("YES")
rS = list(str(input()))
import numpy
S0 = numpy.array(rS).astype(numpy.int32)
S1 = numpy.array(rS).astype(numpy.int32)
lS = len(S0)
def hanten(slist):
    ans = numpy.logical_xor(slist,numpy.ones(len(slist))).astype(int)
    return ans

for i in range(2,lS+1)[::-1]:
    for j in range(lS - i + 1):
        if(S0[j] == 0):
            S0[j:j+i] = hanten(S0[j:j+i])
        if(S1[j] == 1):
            S1[j:j+i] = hanten(S1[j:j+i])
            
    if(sum(S0[:-1]) == len(S0) - 1):
        print(i)
        break;
    if(sum(S1[:-1]) == len(S1) - 1):
        print(i)
        break;

### FIXED CODE ###

A,B,C,D = map(int,input().split())
l = A+B
r = C+D
if(l>r):
    print("Left")
elif(l==r):
    print("Balanced")
elif(l<r):
    print("Right")
a,b = (int(x) for x in input().split())
int(c) = (int(a - b))
if c > ('-1'):
    print int(c)
elif int(c) < ('-1'):
    print('0')

### FIXED CODE ###

X, t = map(int, input().split())
x = X - t
 
if x > 0:
    print(x)
else:
    print(0)
num = int(input())
List = input().split(" ")
height = [int(n) for n in List]
dp = [{} for n in range(1000000)]
def jump(a,now):
  if now in dp[a]:
    return dp[a][now]
  if a == num:
    res = 0
  elif a+2 > num:
    res = jump(a+1,height[a])+abs(now-height[a])
  else:
    res = min(jump(a+1,height[a])+abs(now-height[a]),jump(a+2,height[a+1])+abs(now-height[a+1]))
  dp[a][now] = res
  return res
print(jump(1,height[0]))

### FIXED CODE ###

num = int(input())
List = input().split(" ")
height = [int(n) for n in List]
dp = [0 for n in range(10 ** 5 * 2)]
a = 0
while dp[num-1] == 0:
  a+= 1
  if a == num:
    break
  if a == 1:
    dp[a] = abs(height[a]-height[a-1])
  else:
    dp[a] = min(abs(height[a]-height[a-1])+dp[a-1],abs(height[a]-height[a-2])+dp[a-2])
print(dp[num-1])
a = (int(x) for x in input().split())

print(a + a*a + a*a*a)

### FIXED CODE ###

a = int(input())
print(a + a*a + a*a*a)
# -*- coding: utf-8 -*-
import fractions
def lcm(x, y):
    return (x*y) // fractions.gcd(x, y)
def main():
    A,B,C,D = map(int,input().split())
    E = lcm(C,D)
    Cc = B // C
    Dd = B // D
    Ee = B // E
    flo = A-1
    Cf = flo // C
    Df = flo // D
    Ef = flo // E
    All = B-(Cc+Dd-Ee)
    Sub = flo-(Cf+Df-Ef)
    print(int(All - Sub))
if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*- coding: utf-8 -*-
def main():
    S = list(str(input()))
    #print(S)
    for i in range(len(S)):
        if i == 0:
            t = int(S[0])
            continue
        else:
            t = int(S[i-1])
            #print(t)
            if t == int(S[i]):
                print('Bad')
                return
    print('Good')


if __name__ == '__main__':
    main()
a = 1
while a != 0
	a = int(raw_input())
	print 'Case i: ',a

### FIXED CODE ###

a = int(1)
b = int(1)
while True:
	b = int(raw_input())
	if b != 0:
		print('Case ' + str(a) + ': ' + str(b))
		a += 1
		continue
	else:
		break
n = raw_input()

for i in range(0, n):
   a = input()
   A(n-i) = a

for j in range(0, n):
   print A(j),

### FIXED CODE ###

n = input()
a = map(int, raw_input().split())
    
for i in range(0, n):
   print a[n-i-1],