Harryxun/stf_run huggingface dataset:
import sys

# import bisect
# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter

# import math

# from numba import jit

# from scipy import
# import numpy as np
# import networkx as nx

# import matplotlib.pyplot as plt

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, s = list(map(int, readline().split()))
    a = list(map(int, readline().split()))

    dp = [[0] * 6001 for _ in range(n + 1)]
    s_appeared = {0}

    for ai in range(n):
        s_add=set()
        w = a[ai]
        dp[ai][0] += 1

        for si in s_appeared:
            dp[ai + 1][si] += dp[ai][si]
            dp[ai + 1][si + w] += dp[ai][si]
            s_add.add(si + w)
        s_appeared = s_appeared|s_add

    ans = 0
    for ai in range(n + 1):
        ans += dp[ai][s]

    print(ans % 998244353)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

readline = sys.stdin.readline
MOD = 998244353
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, s = map(int, readline().split())
    a = list(map(int, readline().split()))
    dp = [[0] * (s + 1) for _ in range(n + 1)]
    dp[0][0] = 1

    for i in range(n):
        cur = a[i]
        dp[i + 1][0] += 1
        for j in range(s + 1):
            dp[i + 1][j] += dp[i][j]
            dp[i + 1][j] %= MOD
            nx = cur + j
            if nx <= s:
                dp[i + 1][nx] += dp[i][j]
                dp[i + 1][nx] %= MOD
    ans = 0

    for i in range(1, n + 1):
        ans += dp[i][s]
        ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()
N,M = map(int,input().split())
Output = [0] * N
num = ""

for i in range(M):
    s,c = map(int,input().split())
    if(Output[s-1]==0 or Output[s-1]>c):
        Output[s-1] = c
    if(c==0):
        print(-1)

if(Output[0]==0):
    print(-1)
else:
    for i in Output:
        if(i>9):
            print(-1)
        num += str(i)
    print(num)

### FIXED CODE ###

N = int(input())

if N % 2 == 0:
    print(N//2)
else:
    print(N//2+1)
a=input()
b=input()
c=input()

if a<c and b>c :
  print("Yes")
elif a>c and b<c :
  print("Yes")
else:
  print("No)

### FIXED CODE ###

x=input().split()
z=[int(v) for v in x]

if z[0]<z[2] and z[1]>z[2] :
  print("Yes")
elif z[0]>z[2] and z[1]<z[2] :
  print("Yes")
else:
  print("No")
k=int(input())
x=int(input())
 
if 500*k >= x:
print("'Yes'")
else:
print("'No'")

### FIXED CODE ###

k,x=map(int,input().split())

if 500*k >= x:
	print("Yes")
else:
	print("No")
a, b = map(int, input().split())

c = a + b

if c%2 == 1	:
  priint('Odd')
else :
  print('Even')




### FIXED CODE ###

a, b = map(int, input().split())
 
c = a * b
 
if c%2 == 1	:
  print('Odd')
else :
  print('Even')
import itertools
    N = int(input())
    print(sum([1 for i,j,k in itertools.product(range(1,N+1),range(1,N+1),range(1,N+1))]))

### FIXED CODE ###

print(int(input())**3)
import sys

s=int(input())
k=int(input())

for i in range(len(s)):
  if s[i] != '1':
    print(s[i])
    break
  elif i == k - 1:
    break    
        

### FIXED CODE ###

import sys
 
s=input()
k=int(input())
 
for i in range(len(s)):
  if s[i] != '1':
    print(s[i])
    break
  elif i == k - 1:
    print(1)
    break
# -*- coding: utf-8 -*-
n=raw_input()
k=raw_input()
inans=int(n)
ikans=int(k)
ans=inans%ikans
if ans==0:
    print"0"
else:
    print"1"


### FIXED CODE ###

# -*- coding: utf-8 -*-
n=raw_input().split()
ina=int(n[0])
ika=int(n[1])
ans=ina%ika
if ans==0:
    print"0"
else:
    print"1"
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
p = LIST()
 
ans = 0
i = 0
for i, x in enumerate(p):
    if i+1 == x:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1

print(ans)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
p = LIST()

ans = 0
i = 0
while i < N:
	if p[i] == i+1:
		ans += 1
		i += 1
	i += 1
print(ans)
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
x=[]
for i in range(m):
    b,c=map(int,input().split())
    x.append([b,c])
y=sorted(x,key=lambda x:(x[1],x[0]),reverse=True)

d=[]
for i in range(m):
    d.extend([y[i][1]]*y[i][0])

for i in range(n):
    if d[i]>a[i]:
        a[i]=d[i]
    else:
        break
print(sum(a))

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
x=[]
for i in range(m):
    b,c=map(int,input().split())
    x.append([b,c])
y=sorted(x,key=lambda x:(x[1],x[0]),reverse=True)

p=0
q=0
for i in range(n):
    if a[i]<y[p][1]:
        a[i]=y[p][1]
        q+=1
    else:
        break
    if q==y[p][0]:
        p+=1
        q=0
        if p==m:
            break

print(sum(a))
import math

a = int(input())
b = int(input())

x = (b)/(a-1)

print(math.ceil(x))

### FIXED CODE ###

import math
A, B = list(map(int, input().split()))
print(math.ceil((B-1)/(A-1)))
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = []
for i in range(1, m+1) :
  if a[i] < sum(a) / (4 * m) :
    continue
  else :
    ans.append(a[-1])

if len(ans) == m :
  print('Yes')
else :
  print('No')

### FIXED CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = []
for i in range(m) :
  if a[i] < sum(a) / (4 * m) :
    continue
  else :
    ans.append(a[-1])

if len(ans) == m :
  print('Yes')
else :
  print('No')
a,b =map(int,input().split(' ')
if a + b == 15:
    print('+')
elif a ＊ b == 15:
    print('＊')
else:
    print('x')

### FIXED CODE ###

a,b = map(int,input().split(' '))
if a + b == 15:
    print('+')
elif a * b == 15:
    print('*')
else:
    print('x')
a = int(input())
b = int(input())

if b > 1:
    c = 1
    for i in range(1,21):
        c = c + (a - 1)
        if c >= b:
            print(i)
            break
else:
    print(0)

### FIXED CODE ###

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

if b > 1:
    c = 1
    for i in range(1,21):
        c = c + (a - 1)
        if c >= b:
            print(i)
            break
else:
    print(0)
a = input().split()
num = 3

if a[0] == a[1]:
    num = num - 1
    if a[0] == a[2]:
        num = num - 1:
elif a[0] == a[2]:
    num = num - 1
elif a[1] == a[2]:
    num = num - 1
    
print(num)

### FIXED CODE ###

a = input().split()
num = 3

if a[0] == a[1]:
    num = num - 1
    if a[0] == a[2]:
        num = num - 1
elif a[0] == a[2]:
    num = num - 1
elif a[1] == a[2]:
    num = num - 1
    
print(num)
from functools import lru_cache
from tqdm import tqdm



S=input()
count=[0 for i in range(2019)]
length=len(S)
#S=int(S)
S=S+'0'
S=S[::-1]
_S=0

base=1
for i,s in enumerate(S):
    _S=base*int(s)+_S
    count[_S%2019]+=1
    base*=10
    base=base%2019
    _S=_S%2019



retval=0
for key in range(2019):
    retval+=count[key]*(count[key]-1)//2


print(retval)


### FIXED CODE ###

from functools import lru_cache



S=input()
count=[0 for i in range(2019)]
length=len(S)
#S=int(S)
S=S+'0'
S=S[::-1]
_S=0

base=1
for i,s in enumerate(S):
    _S=base*int(s)+_S
    count[_S%2019]+=1
    base*=10
    base=base%2019
    _S=_S%2019



retval=0
for key in range(2019):
    retval+=count[key]*(count[key]-1)//2


print(retval)
import numpy as np
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

n, m = map(int, input().split())
F = [set() for _ in range(n)]
G = np.zeros((n, n))
for _ in range(m):
  u, v = map(int, input().split())
  u -= 1
  v -= 1
  F[u].add(v)
for i in range(n):
  for j in F[i]:
    for k in F[j]:
      for l in F[k]:
        G[i][l] = 1
csr = csr_matrix(G)
s, t = map(int, input().split())
s -= 1
t -= 1
A = dijkstra(csr, indices=s)
if A[t] == float("inf"):
  print(-1)
else:
  print(int(A[t]))

### FIXED CODE ###

from collections import deque

n, m = map(int, input().split())
F = [set() for _ in range(3*n)]
for _ in range(m):
  u, v = map(int, input().split())
  u = (u-1)*3
  v = (v-1)*3
  F[u].add(v+1)
  F[u+1].add(v+2)
  F[u+2].add(v)
s, t = map(int, input().split())
s = (s-1)*3
t = (t-1)*3
dist = [-1]*(3*n)
dist[s] = 0
dq = deque([s])
while dq:
  v = dq.popleft()
  for nv in F[v]:
    if dist[nv] != -1:
      continue
    dist[nv] = dist[v]+1
    dq.append(nv)
    if nv == t:
      break
  else:
    continue
  break
print(dist[t]//3)
i=0
a,b,c = map(int,input().split())
for x in range(a+1,b)
  if c % x == 0: i+=1
print(i)


### FIXED CODE ###

i=0
a,b,c = map(int,input().split())
for x in range(a,b+1):
  if c % x == 0: i+=1
print(i)
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	static class Point {
		double x;
		double y;
		public Point(double x, double y) {
			this.x = x;
			this.y = y;
		}
		public String toString() {
			return String.format("%.8f %.8f", x, y);
		}
	}
	
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		reader.close();		
		getKochCurve(n, new Point(0, 0), new Point(100, 0));
	}

	private static void getKochCurve(int n, Point start, Point end) {
		System.out.println(start);
		getKochCurve(0, n, start, end);
		System.out.println(end);
	}

	private static void getKochCurve(int i, int n, Point start, Point end) {		
		if (i < n) {
			Point firstPoint = getPoint(start, end, 1.0/3.0);
			Point thirdPoint = getPoint(start, end, 2.0/3.0);
			Point secondPoint = getSecondPoint(start, end, firstPoint, thirdPoint);
			getKochCurve(i + 1, n, start, firstPoint);
			System.out.println(firstPoint);
			getKochCurve(i + 1, n, firstPoint, secondPoint);
			System.out.println(secondPoint);
			getKochCurve(i + 1, n, secondPoint, thirdPoint);
			System.out.println(thirdPoint);
			getKochCurve(i + 1, n, thirdPoint, end);
		}
	}

	private static Point getPoint(Point start, Point end, double d) {
		double deltaX = end.x - start.x;
		double deltaY = end.y - start.y;
		deltaX *= d;
		deltaY *= d;
		return new Point(start.x + deltaX, start.y + deltaY);
	}

	private static Point getSecondPoint(Point start, Point end, Point second, Point third) {
		double deltaX = third.x - second.x;
		double deltaY = third.y - second.y;
		double len = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));		
		double x;
		double y;		
		if (deltaY == 0) {
			x = start.x + (end.x - start.x) / 2;
			y = second.y + Math.sqrt((Math.pow(len, 2) - Math.pow(len / 2.0, 2)));
		} else if (start.x < end.x && start.y < end.y) {
			x = start.x;
			y = third.y;
		} else if (start.x < end.x && start.y > end.y) {
			x = end.x;
			y = second.y;
		} else if (start.x > end.x && start.y < end.y) {
			x = end.x;
			y = second.y;
		} else {
			x = start.x;
			y = third.y;
		}
		return new Point(x, y);
	}
}


### FIXED CODE ###

import math
class Point:
	def __init__(self,x,y):
		self.x=x
		self.y=y
	def __str__(self):
		return str(self.x)+' '+str(self.y)
	
def koch(n,a,b):
	if n==0: return
	s=Point(0,0)
	t=Point(0,0)
	u=Point(0,0)
	th=math.pi*60/180
	s.x=(2*a.x+1*b.x)/3
	s.y=(2*a.y+1*b.y)/3
	t.x=(1*a.x+2*b.x)/3
	t.y=(1*a.y+2*b.y)/3
	u.x=(t.x-s.x)*math.cos(th)-(t.y-s.y)*math.sin(th)+s.x
	u.y=(t.x-s.x)*math.sin(th)+(t.y-s.y)*math.cos(th)+s.y
	
	koch(n-1,a,s)
	print(s)
	koch(n-1,s,u)
	print(u)
	koch(n-1,u,t)
	print(t)
	koch(n-1,t,b)

n=int(input())
a=Point(0,0)
b=Point(100,0)
print(a)
koch(n,a,b)
print(b)
import math

x, y = map(int, input().split())
mod = 10 ** 9 + 7
a = (2 * y - x) / 3
b = (2 * x - y) / 3

if (not a.is_integer()) or (not b.is_integer()):
    print(0)
else:
    a, b = int(a), int(b)
    I = [1] * (a + b + 1)
    for n in range(1, a+b+1):
        I[n] = I[n-1] * n
        I[n] %= mod
    i, j, k = I[a+b], I[a], I[b]
    j = pow(j, mod-2, mod)
    k = pow(k, mod-2, mod)

    ans = i * j * k
    ans %= mod
    print(ans)

### FIXED CODE ###

import math

x, y = map(int, input().split())
mod = 10 ** 9 + 7
a = (2 * y - x) / 3
b = (2 * x - y) / 3

if (not a.is_integer()) or (not b.is_integer()) or \
    (a < 0) or (b < 0):
    print(0)
else:
    a, b = int(a), int(b)
    I = [1] * (a + b + 1)
    for n in range(1, a+b+1):
        I[n] = I[n-1] * n
        I[n] %= mod
    i, j, k = I[a+b], I[a], I[b]
    j = pow(j, mod-2, mod)
    k = pow(k, mod-2, mod)

    ans = i * j * k
    ans %= mod
    print(ans)
N = input()

print(N*N*N)

### FIXED CODE ###

n = int(input())
print(n*n*n)
#C

K=int(input())
if K==1:
    ans=1
elif K==2 or K==5 or K==10:
    ans=-1
else:
    p=0
    for i in range(1,K+2):
        p = (p*10+7)%K 
        #print(i,p)
        if p==0:
            ans=i
            break

print(ans)

### FIXED CODE ###

#C

K=int(input())
ans=-1
if K==1:
    ans=1
elif K==2 or K==5 or K==10:
    ans=-1
else:
    p=0
    for i in range(1,K+1):
        p = (p*10+7)%K 
        #print(i,p)
        if p==0:
            ans=i
            break

print(ans)
A,B,C = map(int,input().split())
if B >= A and B >= C:
  print(B*10+C+A)
if C >= A and C >= B:
  print(C*10+A+B)
if A >= B and A >= C:
  print(A:10+B+C)

### FIXED CODE ###

L = list(map(int,input().split()))
L.sort(reverse = True)
print(L[0]*10+L[1]+L[2])
S = input()
T = input()

ans = 0
for i in range(len(S)):
  tmp = 0
  for j in range(len(T)):
    if S[i + j] == T[j]:
      tmp += 1
  ans = max(ans, tmp)

print(len(T) - ans)
  


### FIXED CODE ###

S = input()
T = input()

ans = 0
for i in range(len(S) - len(T) + 1):
  tmp = 0
  for j in range(len(T)):
    if S[i + j] == T[j]:
      tmp += 1
  ans = max(ans, tmp)

print(len(T) - ans)
def sol():
    n,m=map(int,input().split())
    w={}
    p,q=set(),set()
    for i in range(m):
        l,r,d=[int(i) for i in input().split()]
        if l in w:
            w[l].add((r,d))
        else:
            w[l]={(r,d)}
        p.add(l)
        q.add(r)
    s=p-q
    for i in s:
        k={j for j in w[i]}
        g=set()
        cnt=0
        while len(k):
            x=k.pop()
            cnt+=1
            if cnt==5000:
                print(p[100])
            if x[0] not in w:
                g.add(x)
            else:
                for j in w[x[0]]:
                    k.add((j[0],j[1]+x[1]))
        y=set()
        for j in g:
            if j[0] in y or j[0]==i:
                print("No")
                exit()
            else:
                y.add(j[0])
    print("Yes" if len(s) or m==0 else "No")

if __name__=="__main__":
    sol()

### FIXED CODE ###

def sol():
    n,m=map(int,input().split())
    t,w={},{}
    p,q=set(),set()
    for i in range(m):
        l,r,d=[int(i) for i in input().split()]
        if l in w: w[l].add((r,d))
        else: w[l]={(r,d)}
        p.add(l)
        q.add(r)
    s=p-q
    chk=set()
    if len(s)==0:
        print(["No","Yes"][m==0])
        exit()
    for i in s:
        chk.add((i,0))
        while len(chk):
            x=chk.pop()
            if x[0] in w:
                for j in w[x[0]]:
                    if (i,j[0]) in t and t[(i,j[0])]!=t[(i,x[0])]+j[1]:
                        print("No")
                        exit()
                    elif (i,j[0]) not in t:
                        #t[(i,j[0])]=t[(i,x[0])]+j[1]
                        t[(i,j[0])]=x[1]+j[1]
                        chk.add((j[0],x[1]+j[1]))
    print("Yes")

if __name__=="__main__":
    sol()
w = [str(input()) for i in range(5)]
num = ['0','9','8','7','6','5','4','3','2','1']
w1 = []
m = 0
t = 0
for h in w:
    for j in num:
        if h[-1] == j:
            w1.append(int(h)+num.index(j))
            if m < num.index(j):
                m = num.index(j)
                k = w.index(h)
for l in range(5):
    if l != k:
        t += w1[l]
print(t+int(w[k]))

### FIXED CODE ###

w = [str(input()) for i in range(5)]
num = ['0','9','8','7','6','5','4','3','2','1']
w1 = []
m = 0
t = 0
for h in w:
    for j in num:
        if h[-1] == j:
            w1.append(int(h)+num.index(j))
            if m <= num.index(j):
                m = num.index(j)
                k = w.index(h)
for l in range(5):
    if l != k:
        t += w1[l]
print(t+int(w[k]))
import sys

N, X, M = map(int, input().split())

if(M == 0):
    print(0)
    sys.exit()

rec = []
s = set()
rec.append(X)
s.add(X)
r = X

for i in range(N):
    r = (r**2)%M
    if(r not in s):
        rec.append(r)
        s.add(r)
    else:
        rec.append(r)
        idx = i+1
        break
    
for i in range(len(rec)):
    if(rec[i] == rec[idx]):
        idx1 = i
        break

if(idx1 != idx):       
    ans = sum(rec[:idx1])
    ans += sum(rec[idx1:idx])*((N-idx1)//(idx-idx1))+sum(rec[idx1:(idx1+(N-idx1)%(idx-idx1))])
    print(ans)
else:
    ans = sum(rec[:idx1])
    ans += rec[idx]*(N-idx1)
    print(ans)

### FIXED CODE ###

N, X, M = map(int, input().split())

rec = []
s = set()
rec.append(X)
s.add(X)
r = X
idx = -1
idx1 = -1
for i in range(N+1):
    r = (r**2)%M
    if(r not in s):
        rec.append(r)
        s.add(r)
    else:
        rec.append(r)
        idx = i+1
        break
    
for i in range(len(rec)):
    if(rec[i] == rec[idx]):
        idx1 = i
        break

if(idx == -1 or idx1 == -1):
    print(sum(rec[:N]))
elif(idx1 != idx):       
    ans = sum(rec[:idx1])
    ans += sum(rec[idx1:idx])*((N-idx1)//(idx-idx1))+sum(rec[idx1:(idx1+(N-idx1)%(idx-idx1))])
    print(ans)
else:
    ans = sum(rec[:idx1])
    ans += rec[idx]*(N-idx1)
    print(ans)
from collections import deque

n = int(input())

q = deque()
for i in range(n):
    cmd = input().strip()
    if cmd == 'deleteFirst':
        q.popleft()
        continue
    if cmd == 'deleteLast':
        q.pop()
        continue
    cmd, x = cmd.split()
    if cmd == 'insert':
        q.appendleft(x)
        continue
    if cmd == 'delete':
        q.remove(x)
        continue

print(' '.join(q))

### FIXED CODE ###

import sys
from collections import deque

n = int(sys.stdin.readline())
q = deque()
for i in range(n):
    cmd = sys.stdin.readline()[:-1]
    if cmd[0] == 'i':
        q.appendleft(cmd[7:])
    elif cmd[6] == ' ':
        try:
            q.remove(cmd[7:])
        except:
            pass
    elif cmd[6] == 'F':
        q.popleft()
    else:
        q.pop()

print(' '.join(q))
def resolve():
    n, m = map(int, input().split())
    a = [int(input()) for _ in range(m)]
    dp = [-1] * (n + 1)

    for i in a:
        dp[i] = 0

    print(i_step(n, a, dp) % 1000000007)

# i段目にたどり着くまでの移動方法の総数
def i_step(i, a, dp):
    if i < 0:
        return 0

    if i == 0:
        return 1

    ret = 0
    if dp[i - 1] != -1:
        ret += dp[i - 1]
    else:
        ret += i_step(i - 1, a, dp)

    if i == 1:
        return ret

    if dp[i - 2] != -1:
        ret += dp[i - 2]
    else:
        ret += i_step(i - 2, a, dp)

    dp[i] = ret
    return ret
  
resolve()

### FIXED CODE ###

def step(n):
  if n == 0:
      return 1
  steps = [0 for i in range(n + 2)]
  steps[1] = 1
  steps[2] = 2
  for i in range(3, n + 1):
    steps[i] = steps[i - 1] + steps[i - 2]
  return steps[n]

n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]

a.append(n)

sum = 1

for i in range(m + 1):

  if i == 0:
    sum *= step(a[i] - 1)
    continue
  
  elif i == m:
    sum *= step(a[m] - a[m-1] -1)
    
  elif a[i] - a[i-1] == 1:
    sum = 0
    break

  else:
    sum *= step(a[i] - a[i-1] -2)
    
if m == 0:
  sum = step(n)

print(sum % 1000000007)
n = int(input())
p = [str(input()) for _ in range(n)]
import collections
c = collections.Counter(p)
m = max(c.values())
keys = [k for k, v in d.items() if v == m]
keys.sort()
for i in keys:
    print(i)

### FIXED CODE ###

n = int(input())
p = [str(input()) for _ in range(n)]
import collections
c = collections.Counter(p)
m = max(c.values())
keys = [k for k, v in c.items() if v == m]
keys.sort()
for i in keys:
    print(i)
# -*- coding: utf-8 -*-

"""
再帰
"""

import sys

# 再帰呼び出しの回数制限(デフォルト1000)
sys.setrecursionlimit(10 ** 9)

N, X = map(int, input().split())

def dfs(cur, L):
    if L == N:
        return cur
    return dfs('B' + cur + 'P' + cur + 'B', L + 1)

burger = dfs('P', 0)

print(burger[:X].count('P'))


### FIXED CODE ###

# -*- coding: utf-8 -*-

"""
解説参考
・必要な値を出してから再帰で場合分け
"""

N, X = map(int, input().split())

# まず、それぞれのレベルについて全体の厚さとパティの枚数を求める
A = [1] * (N+1)
P = [1] * (N+1)
for i in range(1, N+1):
    A[i] = A[i-1] * 2 + 3
    P[i] = P[i-1] * 2 + 1

# レベルn、食べる厚さx
def dfs(n, x):
    # レベル0まで来て食べる厚さが残ってればパティ1枚
    if n == 0:
        if x >= 1:
            return 1
        else:
            return 0
    # ひとつ前の総数 + 左端バンズ = 真ん中のパティの手前まで
    if x <= A[n-1] + 1:
        # 前のレベルを調べる(食べる厚さは左端バンズを引く)
        return dfs(n-1, x-1)
    # 食べる厚さが真ん中のパティまでより多い
    else:
        # ひとつ前の総取り + 真ん中 + 前のレベルを調べる
        # (食べる厚さは前半のひとつ前の分と、左端バンズと真ん中パティを引く)
        # ※右端バンズを食べる場合でも、最終的にn == 0で1を返す時xの残数が1多いだけなので考慮しなくていい
        return P[n-1] + 1 + dfs(n-1, x-A[n-1]-2)

print(dfs(N, X))
def algo(s):
  if len(s) == 1:
    return 0
  elif len(s) == 2:
    if s[0] != s[1]:
      return 2
    else:
      return 0
  else:
    tmp = ""
    for i in range(1, len(s)-1):
      if s[i] != s[i+1]:
        tmp += s[0:i] + s[i+2:]
        break
    return 2 + algo(tmp)
    
x = input()
ans = algo(x)
print(ans)

### FIXED CODE ###

x = input()
cnt1 = 0
cnt2 = 0
for i in x:
  if i == '1':
    cnt1 += 1
  else:
    cnt2 += 1
print(min(cnt1, cnt2)*2)
strlist1 = input()
strlist2 = input()

flag = True

for i in range(3):
  if strlist1[i] != strlist2[2 - i]:
    flag = false

if flag:
  print("YES")
else:
  print("NO")


### FIXED CODE ###

strlist1 = input()
strlist2 = input()

flag = True

for i in range(3):
  if strlist1[i] != strlist2[2 - i]:
    flag = False

if flag:
  print("YES")
else:
  print("NO")