Harryxun/stf_run huggingface dataset:
def main():
    n = int(input())
    data = list(map(int, input().split()))

    if n == 1:
        print(data[0])
    elif n == 2:
        print(data[1], data[0])
    else:
        firs_value = [data[0]]
        second_value = [data[1], data[0]]

        def get_value(index, data):
            if index == 0:
                return firs_value
            elif index == 1:
                return second_value
            else:
                lis = get_value(index - 2, data)
                lis.append(data[index - 1])
                lis.insert(0, data[index])
                return lis

        result = get_value(n - 1, data)
        print(" ".join(str(n) for n in result))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n = int(input())
    data = list(map(int, input().split()))

    if n == 1:
        print(data[0])
    else:
        result = [None] * n

        if n % 2 == 0:
            center = int(n / 2)
            for index, value in enumerate(data):
                if index % 2 == 0:
                    result[center + int(index / 2)] = value
                else:
                    result[center - int((index + 1) / 2)] = value
            print(" ".join(str(n) for n in result))
        else:
            center = int(n / 2)
            for index, value in enumerate(data):
                if index % 2 == 0:
                    result[center - int(index / 2)] = value
                else:
                    result[center + int((index + 1) / 2)] = value
            print(" ".join(str(n) for n in result))

if __name__ == '__main__':
    main()
s = input()
c = 0
for i in s:
  if i == '0':
    break
  c += 1
r = list(range(len(s)))
r.reverse()
for i in r:
  if s[i] == '1':
    break
  c += 1
print(len(s) - c + d)

### FIXED CODE ###

s = input()
zero = 0
one = 0
for i in s:
  if i == '0':
    zero += 1
  else:
    one += 1
print(min(zero, one) * 2)
def solve():
  N = int(input())
  S = input()
  stones = []
  look = S[0]
  cnt = 0

  if S[0] == '.': stones.append(0)
  for s in S:
    if look == s: cnt += 1
    else:
      stones.append(cnt)
      cnt = 1
      look = s
  stones.append(cnt)
  if S[N - 1] == '#': stones.append(0)

  count = sum(stones[1::2])
  ans = count

  for i in range(0, len(stones), 2):
    count = count + stones[i] - stones[i + 1]
    if ans > count: ans = count
  return ans

print(solve())


### FIXED CODE ###

def solve():
  A, B, C = map(int, input().split())
  return 'Yes' if min(A, B) < C and C < max(A, B) else 'No'

print(solve())
N=int(input())
A=[]
result=1
for i in range(N):
  A.append(int(input().split()))
for j in range(N):
  result=result*A[j]
if(result>10**18):
  print(-1)
else:
  print(result)

### FIXED CODE ###

def main():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A:
      print(0)
      return
    prod = 1
    for a in A:
      prod *= a
      if prod > 1000000000000000000:
        print(-1)
        return
    print(prod)

main()
N=int(input())
a=list(map(int,input().split()))
c=0
d=[]
for i in range(N):
        if(i+1==a[i]):
            d.append("x")
        else:
            d.append("o")
for i in range(len(d)):
    if d[i]=="x":
        d[i]="o"
        d[i+1]="o"
        c+=1
print(c)

### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))
c=0
d=[]
for i in range(N):
        if(i+1==a[i]):
            d.append("x")
        else:
            d.append("o")
for i in range(len(d)):
    if d[i]=="x":
        if i==len(d)-1:
            d[i]="o"
            d[i-1]="o"
            c+=1
        else:
            d[i]="o"
            d[i+1]="o"
            c+=1
        
print(c)
r =10000001
p = [1]*r
p[0]= p[1] = 0
for i in range(int(r**0.5)):
	if p[i]:
		p[2*i::i] = [0 for j in range(2*i,r,i)]
		
while 1:
	n = input()
	if n == 0: break
	n -= 1-n%2
	while any(not p[n-i] for i in [0,2,6,8]):
		n -= 2
	print n

### FIXED CODE ###

ref = [[[10,8],[4,4]],[[10,2],[4,2]]]
r =10000001
p = [1]*r
p[0]= p[1] = 0
for i in range(int(r**0.5)):
	if p[i]:
		p[2*i::i] = [0]*len(p[2*i::i])
		
while 1:
	try:
		n = input()
		if n == 0: break
		n -= 1-n%2
		while any(not p[n-i] for i in [0,2,6,8]):
			n -= ref[p[n-2]][p[n-6]][p[n-8]]
		print n
	except:
		pass
import math
n,m=map(int,input().split())
a=list(map(int,input().split()))
while m>0:
  a[index(max(a))]=int(math.foor(max(a)/2))
  m=m-1
print(sum(a))

### FIXED CODE ###

import heapq
n,m=map(int,input().split())
a=list(map(lambda x: int(x)*(-1),input().split()))
heapq.heapify(a)
while m>0:
  heapq.heappush(a,(-1)*int((-1)*heapq.heappop(a)//2))
  m=m-1

print(-sum(a))
D, T, S = map(int, input()).split()
if T*S <= D:
  print('Yes')
else: 
  print('No')

### FIXED CODE ###

D, T, S = list(map(int, input().split()))
if T*S >= D:
  print('Yes')
else: 
  print('No')
N, K = map(int,input().split())
P = [(int(x) + 1) / 2 for x in input().split()]
l = []
for i in range(N - K + 1):
    l.append(sum(P[i:(i+K)]))
print('{:.12f}'.format(max(l))) #12桁まで指定


### FIXED CODE ###

S, T= input().split()
A, B= map(int,input().split())
U = input()
if U == S:
    A += -1
else:
    B += -1
print(A, B)
n,l = map(int,input(),split())
s = [input() for _ in range(n)]
s.sort()
for k in s:
  print(k, end ="")

### FIXED CODE ###

n,l = map(int,input().split())
s = [input() for i in range(n)]
s.sort()
for k in s:
  print(k, end ="")
A, B, C = map(int, input().split())
X = int(input())
res = 0
for i_a in range(0, A+1):
    for i_b in range(0, B+1):
        for i_c in range(0, C+1):
            money = 500 * i_a + 100 * i_b + 50 * i_c
            if money == X:
                res += 1
print(res)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())

X = int(input())
res = 0
for i_a in range(0, A+1):
    for i_b in range(0, B+1):
        for i_c in range(0, C+1):
            money = 500 * i_a + 100 * i_b + 50 * i_c
            if money == X:
                res += 1
print(res)
l = int(input())
print(f"{pow(l,3) / 27.0:.10f}")


### FIXED CODE ###

l = int(input())
print(l**3 / 27)
N, K  = map(int, input().split())
h = [int(x) for x in input().split()]

inf = float('inf')
dp = [inf] * N

dp[0] = 0

def chmin(a, b):
    if a > b:
        return b
    else:
        return a

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

print(dp[N - 1])

### FIXED CODE ###

#　最小値を求めるDP　
#　Atcoder DP まとめコンテスト「A.Frog」　https://atcoder.jp/contests/dp/tasks/dp_a

N = int(input())
h = [int(x) for x in input().split()]

inf = float('inf')
dp = [inf] * N

dp[0] = 0
dp[1] = abs(h[1] - h[0]) #　1、２の初期値を設定

def chmin(a, b):
    if a > b:
        return b
    else:
        return a

for i in range(2, N):
    dp[i] = chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    dp[i] = chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

print(dp[N - 1])
a, b = map(int, input().stlip())

if a==1:
    a = 14
if b==1:
    b = 14

if a>b:
    print("Alice")
elif a<b:
    print("Bob")
else:
    print("Draw")

### FIXED CODE ###

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

if a==1:
    a = 14
if b==1:
    b = 14

if a>b:
    print("Alice")
elif a<b:
    print("Bob")
else:
    print("Draw")
a = int(input())
b = map(int, input().split())

cnt = 0
endflag = False

while(True):
  for i in range(0,len(b)-1):
    if ((b[i] % 2 ) == 0):
      b[i] = b[i] /2
    else:
      endflag = true
  cnt = cnt +1
  
  if (endflag):
    break;
      
print(cnt)


### FIXED CODE ###

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

cnt = 0
endflag = False

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

print(cnt)
x1 = input()
x2 = input()
x1 = int(x1)
x2 = int(x2)
x3 = x1+x2
print(x3)

### FIXED CODE ###

z = input()
x, y = z.split()
x = int(x)
y = int(y)
a = x * y
p = 2 * (x+y)
print(a, p)
n=input()
if n//10==9 or n>=90:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n=input()
if n.count('9')>=1:
    print('Yes')
else:
    print('No')
k = int(input())
old = [1,2,3,4,5,6,7,8,9]
new = []
count = 9
if k <= count:
    print(ans[k])
while count < k:
    if len(old) > 0:
        i = old.pop(0)
        last = i%10
        if last != 0:
            new.append(i*10 + (last-1))
            count += 1
            if count == k:
                break
        new.append(i*10 + last)
        count += 1
        if count == k:
            break
        if last != 9:
            new.append(i*10 + (last+1))
            count += 1
            if count == k:
                break
    else:
        old = new
        new = []
print(new[-1])

### FIXED CODE ###

import sys
k = int(input())
old = [1,2,3,4,5,6,7,8,9]
new = []
count = 9
if k <= count:
    print(old[k-1])
    sys.exit()
else:
    while count < k:
        if len(old) > 0:
            i = old.pop(0)
            last = i%10
            if last != 0:
                new.append(i*10 + (last-1))
                count += 1
                if count == k:
                    break
            new.append(i*10 + last)
            count += 1
            if count == k:
                break
            if last != 9:
                new.append(i*10 + (last+1))
                count += 1
                if count == k:
                    break
        else:
            old = new
            new = []
    print(new[-1])
n=int(input())
*p,=map(int, input().split())
#n=3
#p=[1, 3, 7, 9, 5, 4, 8, 6, 2]

for i in range(n*n):p[i]-=1
seats=[
    [min(i,j,n-i-1,n-j-1)for i in range(n)] 
    for j in range(n)
    ]

check=[[False]*n for _ in range(n)]
exist=[[1]*n for _ in range(n)]
dxy=[(0,1),(1,0),(-1,0),(0,-1)]
def dfs(pi):
    global check,exist
    i=pi%n
    j=pi//n
    res=seats[i][j]
    check[i][j]=True
    for dx,dy in dxy:
        idx,jdy=i+dx,j+dy
        if 0<=idx<n and 0<=jdy<n and (not check[idx][jdy]):
            res=min(res,dfs(idx+jdy*n)+exist[idx][jdy])
        if res==0:
            return res
    seats[i][j]=res
    return res
ans=0
for pi in p:
    check=[[False]*n for _ in range(n)]
    ans+=dfs(pi)
    exist[pi%n][pi//n]=0
print(ans)

### FIXED CODE ###

from collections import deque
n=int(input())
*p,=map(int, input().split())

for i in range(n*n):p[i]-=1
seats=[min(i//n,i%n,n-(i//n)-1,n-(i%n)-1) for i in range(n*n)] 

exist=[1]*(n*n)
dxy=(n,-n,1,-1)

ans=0
q=deque()
for pi in p:
    ans+=seats[pi]
    exist[pi]=0
    q.append(pi)
    while q:
        i=q.popleft()
        for dx in dxy:
            idx=i+dx
            if 0<=idx<n*n :
                if seats[i]+exist[i]<seats[idx]:
                    seats[idx]=seats[i]+exist[i]
                    q.append(idx)
print(ans)
import math
A,B,C,D = map(int,input().split())
lcm = int( C*D / math.gcd(C,D)  )

first_c = int( ( A - 1) / C)
first_d = int( ( A - 1) / D)
first_cd = int( ( A - 1) / lcm )
first = ( A - 1 ) - ( first_c + first_d - first_cd )

end_c = int( B / C)
end_d = int( B / D)
end_cd = int( B / lcm )
end_ = B - ( end_c + end_d - end_cd )

print(end_ - first)

### FIXED CODE ###

A,B,C,D = map(int,input().split())
import fractions
lcm = int( C*D / ( fractions.gcd(C,D) ) )

first_c = ( A - 1) // C
first_d = ( A - 1) // D
first_cd = ( A - 1) // lcm 
first = ( A - 1 ) - ( first_c + first_d - first_cd )

end_c = B // C
end_d = B // D
end_cd = B // lcm 
end_ = B - ( end_c + end_d - end_cd )

print(end_ - first)
n,l=map(int,input().split())
lst_kazu=[i for i in range(1,n+1)]
lst_aji=[i-l+1 for i in range(1,n+1)]
lst_aji_sum=sum(lst_aji)
aji_ans=0
for i in range(n):
	if lst_aji[i]==int(lst_aji_sum/n):
    	print(lst_aji_sum-lst_aji[i])
        break
    else:
      	aji_ans=min(aji_ans,ans(lst_aji[i]-int(lst_aji_sum/n)))
print(aji_ans)

### FIXED CODE ###

n , l = map ( int , input ( ).split ( ) ) 
lst = [i + l - 1 for i in range ( 1 , n + 1 )]
ans=1000000 
sum1=sum(lst) 
for i in lst: 
	if abs(i)<abs(ans): 
		ans=i
print(sum1-ans)
a,b,c,k = map(int,input().split())
if a+b >= k:
    print(a)
else: 
    print(a-abs(k-a-b))


### FIXED CODE ###

S = input()
T = input()
if T[:len(T)-1] == S:
    print('Yes')
else:
    print('No')
k = int(input())
a,b = map(int, input().split())
    if i%k == 0:
        print("OK")
        exit()
print("NG")

### FIXED CODE ###

k = int(input())
a,b = map(int, input().split())
for i in range(a,b+1):
    if i%k == 0:
        print("OK")
        exit()
print("NG")
n,m = map(int,input().split())


print( (n-1)*n/2+(m-1)*m/2)


### FIXED CODE ###

s = input()

for i in range(1,len(s)):
    if s[i] != s[i-1]:
        print("Yes")
        exit()

print("No")
#coding utf-8
a,b = map(int,input().split())
if(a == b):
	print('a == b',sep="")
elif(a < b):
	print('a < b',sep="")
else:
	print('a > 


### FIXED CODE ###

a,b = map(int,input().split())
if(a == b):
	print("a == b")
elif(a < b):
	print("a < b")
else:
	print("a > b")
import sys
import math
input = sys.stdin.readline


def main():
    MOD = 10 ** 9 + 7
    sc = Scan()
    n, m = sc.intarr()[0]
    w = sc.intarr()
    is_safe = [True] * (n+2)
    for a in w:
        is_safe[a + 1] = False
    dp = [0] * (n+2)
    dp[1] = 1
    for i in range(2, n+2):
        if is_safe[i]:
            dp[i] = dp[i-1] + dp[i-2]
            dp[i] %= MOD
        else:
            dp[i] = 0

    print(dp[n+1])


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


main()


### FIXED CODE ###

import sys
import math
input = sys.stdin.readline


def main():
    MOD = 10 ** 9 + 7
    sc = Scan()
    n, m = sc.intarr()
    w = sc.intarr_ver(m)
    is_safe = [True] * (n+2)
    for a in w:
        is_safe[a + 1] = False
    dp = [0] * (n+2)
    dp[1] = 1
    for i in range(2, n+2):
        if is_safe[i]:
            dp[i] = dp[i-1] + dp[i-2]
            dp[i] %= MOD
        else:
            dp[i] = 0

    print(dp[n+1])


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


main()
arr = map(int, input().split())
if len(set(a)) == 2:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

arr = map(int, input().split())
if len(set(arr)) == 2:
    print("Yes")
else:
    print("No")
N = int(input())
W = list(map(int,input().split()))
 
ans = 10000
for i in range(N+1):
    if abs(sum(W[0:i]) - sum(W[i:]) < min_first:
        ans = abs(sum(W[0:i]) - sum(W[i:])
print(ans)

### FIXED CODE ###

n = int(input())
w = list(map(int, input().split()))
 
min_diff = 1000
for i in range(n):
	diff = abs(sum(w[0:i]) - sum(w[i:]))
	if diff < min_diff:
		min_diff = diff
print(min_diff)
L, R = map(int, input().split())
mini = 2018
minib = 2018

if R-L >= 2019:
    print('0')
else:
    for i in range(L, R+1):
        if (i % 2019) < mini:
            mini = i % 2019
            ans = i
            if i % 2019 == 0:
                ans = 0
                print('0')
                break

        for j in range(L, R+1):
            if j == ans:
                continue
            if (j % 2019) < minib:
                minib = j % 2019
                sansb = j

    calc = ((ans%2019) * (ansb%2019)) % 2019
    print(calc)

### FIXED CODE ###

L, R = map(int, input().split())
mini = 2020

if R-L >= 2019:
    print('0')
else:
    for i in range(L, R):
        for j in range(i+1, R+1):
            mini = min(mini, (i*j)%2019)
    print(mini)
r = int(input())
print(3*a*a)


### FIXED CODE ###

r = int(input())
print(3*r*r)
n = int(input())

red = []
blue = []

for i in range(n):
    red.append(tuple(map(int, input().split())))
for i in range(n):
    blue.append(tuple(map(int, input().split())))

red.sort(key=lambda x:x[1])
red.reverse()

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

res = 0

for b in range(n):
    for r in range(len(red)):
        if blue[b][0] > red[r][0] and blue[b][1] > red[r][1]:
            res += 1
            del red[r]
            break

print(res)


### FIXED CODE ###

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

if a + b >= c:
    print('Yes')
else:
    print('No')
import sys

[print(len(str(y[0] + y[1]))) for y in [[int(z) for z in x.split()] for x in sys.stdin]]

### FIXED CODE ###

[print(y) for y in sorted([int(input()) for x in range(10)], reverse=True)[:3]]
n=int(input())
m=rond(n/1.08)
if int(m*1.08)==n:
  print(m)
else:
  if int((m-1)*1.08)==n:
    print(m-1)
  elif int((m+1)*1.08)==n:
    print(m+1)
  else:
    print(':(')

### FIXED CODE ###

n=int(input())
m=round(n/1.08)
if int(m*1.08)==n:
  print(m)
  exit()
else:
  if int((m-1)*1.08)==n:
    print(m-1)
    exit()
  elif int((m+1)*1.08)==n:
    print(m+1)
    exit()
  else:
    print(':(')
    exit()
import random
import sys
input = sys.stdin.readline
d=int(input())
c=list(map(int,input().split()))
cn=sorted(c)
h=cn[3]
P=[k+1 for k,v in enumerate(c) if v>=h]
s=[]
for _ in range(d):
    s.append(list(map(int,input().split())))
# t=[]
# for _ in range(d):
#     t.append(int(input()))
# m=int(input())
t=[]
for _ in range(d):
    z=random.randrange(len(P))
    t.append(P[z])

m=1000
q=[]
for _ in range(m):
    z2=random.randrange(len(P))
    z1=random.randrange(d)
    q.append(tuple(z1,P[z2]))
p=-float("inf")
for k in range(m):
    ld=[-1]*26
    sc=0
    od=t[q[k][0]-1]
    t[q[k][0]-1]=q[k][1]

    for i in range(d):
        sc+=s[i][t[i]-1]
        ld[t[i]-1]=i

        C=0
        for j in range(26):
            C+=c[j]*(i-ld[j])
        sc-=C
    if p<sc:
        p=sc
    else:
        t[q[k][0]-1]=od

print(*t)


### FIXED CODE ###

import random
import sys
input = sys.stdin.readline
d=int(input())
c=list(map(int,input().split()))
cn=sorted(c)
h=cn[12]
P=[k+1 for k,v in enumerate(c) if v>=h]
s=[]
for _ in range(d):
    s.append(list(map(int,input().split())))
# t=[]
# for _ in range(d):
#     t.append(int(input()))
# m=int(input())
t=[]
for _ in range(d):
    z=random.randrange(len(P))
    t.append(P[z])
print(*t)
(a, b) = int(input()).split()

print("a * b" + " " + "a * 2 + a * 2")

### FIXED CODE ###

x = input().split()
a = int(x[0])
b = int(x[1])
print(a*b, (a+b)*2)
C:\Users\Y\PycharmProjects\testProject\venv\Scripts\python.exe C:/Users/Y/PycharmProjects/testProject/main.py
210 5
31 41 59 26 53
Yes

Process finished with exit code 0


### FIXED CODE ###

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

print("Yes" if sum(a) >= h else "No")
import math
n,m=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a)
t=math.floor(s/4/m)
a.sort()
for i in a:
  if i<t:
    u=i

  else:
    break
cnt=0
for i in a:
  if i>u:
    cnt+=1

if cnt>=m:
  print('Yes')
  
else:
  print('No')

### FIXED CODE ###

import math
n,m=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a)
t=math.ceil(s/4/m)
a.sort()

cnt=0
for i in a:
  if i>=t:
    cnt+=1

if cnt>=m:
  print('Yes')
  
else:
  print('No')
from collections import defaultdict
n, m = map(int, input().split())
a = list(map(int, input().split()))
add = defaultdict(int)
for i in range(m):
    b, c = map(int, input().split())
    add[c] += b
add = sorted(add)
for i, v in add.items():
    a += [i]*v
    a.sort(reverse=True)
    if a[n] >= i:
        break
print(sum(a[:n]))


### FIXED CODE ###

from collections import defaultdict
n, m = map(int, input().split())
a = list(map(int, input().split()))
add = defaultdict(int)
for i in a:
    add[i] += 1
for i in range(m):
    b, c = map(int, input().split())
    add[c] += b

output = 0
cnt = 0
print()
for i, v in sorted(add.items(), reverse=True):
    if cnt+v >= n:
        output += i*(n-cnt)
        break
    else:
        output += i*v
        cnt += v
print(output)
A, B, C, K = map(int,input().split())
ans = 0
if(K<=A):
  ans = K
else if(K<=A+B):
  ans = A
else:
  ans = A-(K-A-B)
print(ans)

### FIXED CODE ###

A, B, C, K = map(int,input().split())
ans = 0
if(K<=A):
  ans = K
elif(K<=A+B):
  ans = A
else:
  ans = A-(K-A-B)
print(ans)
ss = input().strip()
i=0
for s in ss:
  if s%2==0:
    print(s,end="")
  i+=1

### FIXED CODE ###

ss = input().strip()
i=0
for s in ss:
  if i%2==0:
    print(s,end="")
  i+=1
H,N = map(int, input().split())
lists = list(map(int, input().split()))
lists.sort()
if N>=2:
  if lists[-2]+lists[-1]>=H:
    print('Yes')
  else:
    print('No')
else:
  if lists[0]>=H:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

H, A = map(int,input().split())
a = int(H/A)
b = H/A
if a==b:
  print(a)
else:
  c = a+1
  print(c)
str = "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"
input_field = [int(i) for i in str.split(", ")]
print(input_field[input(int()) - 1])

### FIXED CODE ###

str = "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"
input_field = [int(i) for i in str.split(", ")]
print(input_field[int(input()) - 1])
N, Q = map(int, input().split())
s = input()

Query = [input().split() for i in range(Q)]

left, right = 0, N - 1

for t, d in reversed(Query):
    if d == "L":
        if t == s[left]:
            left += 1
        if right < N - 1 and t == s[right + 1]:
            right = min(right + 1, N - 1)
    else:
        if left > 0 and t == s[left - 1]:
            left = max(left - 1, 0)
        if t == s[right]:
            right -= 1
print(max(right - left + 1, 0))


### FIXED CODE ###

# N, Q = map(int, input().split())
import sys

input = sys.stdin.readline

N, Q = tuple(map(int, input().split()))
s = input()

Query = [input().split() for i in range(Q)]

left, right = 0, N - 1

for t, d in reversed(Query):
    if d == "L":
        if t == s[left]:
            left += 1
        if right < N - 1 and t == s[right + 1]:
            right = min(right + 1, N - 1)
    else:
        if left > 0 and t == s[left - 1]:
            left = max(left - 1, 0)
        if t == s[right]:
            right -= 1
print(max(right - left + 1, 0))
n = int(input())
if n == 1:
  print(0)
else:
  print(n(n-1)//2)

### FIXED CODE ###

n = int(input())
print(n*(n-1)//2)
print(['0','1'][x==1])

### FIXED CODE ###

x=int(input())
print(['1','0'][x==1])
import math
s = input()
n=int(s[0])
s = input().split()
d={}
dc={}
summ=0
for i in s:
    if i not in d:
        d[i]=1
    else:
        d[i]+=1
for i in d:
    n = d[i]
    if n>1:
        a = math.factorial(n)
        b = math.factorial(2)
        c = math.factorial(n-2)
        e=a/b/c
        summ+=e
        dc[i]=e
    else:
        dc[i]=0
for i in s:
    print(int(summ-dc[i]+(dc[i]/d[i]*(d[i]-2))))


### FIXED CODE ###

s = input()
n=int(s[0])
s = input().split()
d={}
dc={}
summ=0
for i in s:
    if i not in d:
        d[i]=1
    else:
        d[i]+=1
for i in d:
    n = d[i]
    if n>1:
        e=n*(n-1)/2
        summ+=e
        dc[i]=e
    else:
        dc[i]=0
for i in s:
    n = d[i]-1
    e = n*(n-1)/2
    print(int(summ-dc[i]+e))
N=int(input())
M=list(map(int,input().split))
S1=0
S2=sum(M)
t=100000
for i in range(N):
    S1+=M[i]
    S2=S2-M[i]
    if t>abs(S2-S1):
        t=abs(S2-S1)
print(t)

### FIXED CODE ###

N=int(input())
M=input().split()
for i in range(N):
    M[i]=int(M[i])
S1=0
S2=sum(M)
t=100000
for i in range(N):
    S1+=M[i]
    S2=S2-M[i]
    if t>abs(S2-S1):
        t=abs(S2-S1)
print(t)