Harryxun/stf_run huggingface dataset:
import numpy as np


def solve(string):
    n, m, *py = map(int, string.split())
    p = [[] for _ in range(n)]
    for _p, _y in py:
        p[_p - 1].append(_y)
    for i in range(n):
        p[i] = np.argsort(np.argsort(p[i]))
    counter = [0 for _ in range(n)]
    for _p, _y in py:
        t = "{:06}{:06}".format(_p, p[_p - 1][counter[_p - 1]] + 1)
        print(t)
        counter[_p - 1] += 1
        p[i] = np.argsort(np.argsort(p[i]))


if __name__ == '__main__':
    n, m = map(int, input().split())

    print(solve("{} {}\n".format(n, m) + "\n".join([input() for _ in range(m)])))


### FIXED CODE ###

import time
import numpy as np

# def solve(n, m, py):
"""
n, m = map(int, input().split())
py = [list(map(int, input().split())) for _ in range(m)]
"""

n, m = map(int, input().split())
py = [list(map(int, input().split())) for _ in range(m)]
p = [[] for _ in range(n)]
start = time.time()
for _p, _y in py:
    p[_p - 1].append(_y)
# print(time.time() - start)
for i in range(n):
    p[i] = np.argsort(np.argsort(p[i]))

# print(time.time() - start)
counter = [0 for _ in range(n)]
for _p, _y in py:
    # print("{:06}{:06}".format(_p, p[_p - 1].index(_y) + 1))
    # t = "{:06}{:06}".format(_p, p[_p - 1].index(_y) + 1)
    # print(counter[_y])
    t = "{:06}{:06}".format(_p, p[_p - 1][counter[_p - 1]] + 1)
    print(t)
    counter[_p - 1] += 1
# coding: utf-8
import sys
import numpy as np
import itertools


def main(argv=sys.argv):
  
    packs = list(map(int, input().split(' ')))
    packs = sorted(packs)
    if packs[2] - packs[1] - packs[0] == 0:
        print('Yes')
    else:
        print('No')
  
    return 0


if __name__ == '__main__':
    sys.exit(main())


### FIXED CODE ###

# coding: utf-8
import sys


def main(argv=sys.argv):
  
  n = int(input())
  
  candy_count = 0

  if n == 1:
    candy_count = 1
  else:
    candy_count = (1 + n) * n // 2
    
  print(candy_count)
  
  return 0


if __name__ == '__main__':
  sys.exit(main())
S = [list( input()) for _ in range(3)]
C = ['A', 'B', 'C']
now = 0
nowc = 'A'
while True:
    if not S[i]:
        ans = C[i]
        break
    nowc = S[i].pop(0)
    if nowc == 'a':
        now = 0
    elif nowc == 'b':
        now = 1
    else:
        now = 2
print(ans)

### FIXED CODE ###

S = [list( input()) for _ in range(3)]
C = ['A', 'B', 'C']
now = 0
nowc = 'A'
while True:
    if not S[now]:
        ans = C[now]
        break
    nowc = S[now].pop(0)
    if nowc == 'a':
        now = 0
    elif nowc == 'b':
        now = 1
    else:
        now = 2
print(ans)
from itertools import accumulate
from math import sqrt, floor
from bisect import bisect_left

N = int(input())
n = list(accumulate(range(floor(sqrt(2 * N)) + 1)))

r = bisect_left(n, N)

if n[r] == N:
    print('\n'.join(map(str, range(1, r + 1))))
    exit()

d = n[r] - N
for i in range(1, r + 1):
    if i != d:
        print(i)

### FIXED CODE ###

from itertools import accumulate
from math import sqrt
from bisect import bisect_left

N = int(input())
n = list(accumulate(range(int(sqrt(2 * N)) + 2)))

r = bisect_left(n, N)

if n[r] == N:
    print('\n'.join(map(str, range(1, r + 1))))
    exit()

d = n[r] - N
for i in range(1, r + 1):
    if i != d:
        print(i)
n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  for j in range(a):
    x=[0]*a
    y=[0]*a
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  

c=0
for i in range(n):
  l=[1]*n
  for j in range(i,n-i):
    if l[j]==0:continue
    for k in range(A[j]):
      b=X[j][k]
      #l[b-1]*
      #b=Y[j][k]
  if c < l.count(1):
    c=l.count(1) 
  
        
  
print(c)  
   

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
import bisect
A, B, Q = map(int, input().split())
s = [-INF] + [int(input()) for _ in range(A)] + [INF]
t = [-INF] + [int(input()) for _ in range(B)] + [INF]
for i in range(Q):
  x = int(input())
  sw = bisect.bisect_right(s, x)-1 #xより西で一番近い(同じ場所でもいい)神社の番号
  se = sw + 1 #xより東で一番近い神社の番号
  tw = bisect.bisect_right(t, x)-1
  te = tw + 1
  res = INF
  for S in [sw, se]:
    for T in [tw, te]:
      d1, d2 = abs(x-S) + abs(T-S), abs(x-T) + abs(S-T)
      res = min(res, d1, d2)
  print(res)



### FIXED CODE ###

import bisect
INF = 10**15
A, B, Q = map(int, input().split())
s = [-INF] + [int(input()) for _ in range(A)] + [INF]
t = [-INF] + [int(input()) for _ in range(B)] + [INF]
for i in range(Q):
  x = int(input())
  sw = bisect.bisect_right(s, x)-1 #xより西で一番近い(同じ場所でもいい)神社の番号
  se = sw + 1 #xより東で一番近い神社の番号
  tw = bisect.bisect_right(t, x)-1
  te = tw + 1
  res = INF
  for S in [s[sw], s[se]]:
    for T in [t[tw], t[te]]:
      d1, d2 = abs(x-S) + abs(T-S), abs(x-T) + abs(S-T)
      res = min(res, d1, d2)
  print(res)
import math
N,K = map(int,input().split(" "))
x = N - K #red ball
for i in range(1,K+1):
    a = math.factorial(x+1) // (math.factorial(i)*math.factorial(x+1-i))
    b = math.factorial(K-1) // (math.factorial(i-1)*math.factorial(K-i))
    print(a * b % (10**9+7))


### FIXED CODE ###

import math
N,K = map(int,input().split(" "))
x = N - K #red ball
for i in range(1,K+1):
    if x+1-i >= 0:
        a = math.factorial(x+1) // (math.factorial(i)*math.factorial(x+1-i))
    else:
        a = 0
    b = math.factorial(K-1) // (math.factorial(i-1)*math.factorial(K-i))
    print(a * b % (10**9+7))
import math
from functools import reduce

city_num, start_pos = list(map(int, input().split()))
city_list = list(map(int, input().split()))

# スタート位置を入れて
city_list.append(start_pos)
# 昇順に並び替え
city_list.sort()

# city毎の距離のリストを生成する
distance_list = [city_list[i+1] - city_list[i] for i in range(city_num)]

# 昇順に並び替え
distance_list.sort()

# 出力
print(reduce(math.gcd, distance_list))


### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


city_num, start_pos = list(map(int, input().split()))
city_list = list(map(int, input().split()))

# スタート位置を入れて
city_list.append(start_pos)
# 昇順に並び替え
city_list.sort()

# city毎の距離のリストを生成する
distance_list = [city_list[i+1] - city_list[i] for i in range(city_num)]

# 距離が一つならそれを出力
if len(distance_list) == 1:
    print(distance_list[0])
    exit()

# 昇順に並び替え
distance_list.sort()

# 最大公約数を求める
max_gcd = gcd(distance_list[0], distance_list[1])
for i in range(2, len(distance_list)):
    max_gcd = gcd(max_gcd, distance_list[i])

# 出力
print(max_gcd)
N = int(input())
S = []

for i in range(N):
  S.append(input())
  
S.sort()

ans = sum(S)

for i in range(N):
  if ans % 10 == 0:
    ans -= S[i]
    
  else:
    print(ans)


### FIXED CODE ###

N = int(input())
S = []

for i in range(N):
  S.append(int(input()))
  
S.sort()
ans = sum(S)

if ans % 10 != 0:
  print(ans)
  exit()
  
for i in range(N):
  if S[i] % 10 != 0:
    ans -= S[i]
    print(ans)
    exit()

print(0)
// luogu-judger-enable-o2
a = input()
if a.find("C")!=-1 and a.find("F")!=-1 and a.find("C")<a.find("F"):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = input()
if s.count('C') == 0 or s.count('F') == 0:
    print('No')
else:
    s = s[s.find('C'):]
    if s.count('F') == 0:
        print('No')
    else:
        print('Yes')
import math
a,b = map(int,input().split())
x = math.gcd(a,b)
c= x
ans = 1
for i in range(2,min(int(math.sqrt(x))+1,x)):
    if(c%i==0):
        ans+=1
    while(c%i==0):
        c=c//i
        
if(c>1):
    ans+=1
print(ans)

### FIXED CODE ###

def gcd(a,b):
    if(b==0):
        return a
    return gcd(b,a%b)
import math
a,b = map(int,input().split())
x = gcd(a,b)
c= x
ans = 1
for i in range(2,int(math.sqrt(x))+1):
    if(c%i==0):
        ans+=1
    while(c%i==0):
        c=c//i
        
if(c>1):
    ans+=1
print(ans)
import math
import sys
from decimal import *

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

getcontext().prec = 21

aa = [Decimal(b).log10() for b in a if a != 0]

ans = Decimal('0')

for c in aa:
    ans += c


if ans > 18.0:
    print(-1)
else:
    ans = 1
    for c in a:
        ans *= c
    print(ans)


### FIXED CODE ###

n = int(input())

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

ans = 1

for b in a:
    if b == 0:
        ans = 0
        break
    else:
        ans *= b
        if ans > pow(10, 18):
            ans = -1
            break

print(ans)
from sys import stdin
from functools import lru_cache


# 最小化問題
def chmin(a,b):
    if a > b: return b
    else: return a


class Rec_memo:
    def __init__(self, N, h_arr):
        self.dp = [float('inf')] * (N+2)
        self.h_arr = h_arr

    def rec(self, i):
        if self.dp[i] != float('inf'):
            return self.dp[i]
        elif i == 0:
            return 0
        else:
            self.dp[i] = chmin(self.dp[i],self.rec(i-1)+abs(self.h_arr[i]-self.h_arr[i-1]))
            try:
                if i>1:
                    self.dp[i] = chmin(self.dp[i],self.rec(i-2)+abs(self.h_arr[i]-self.h_arr[i-2]))
                return self.dp[i]
            except:
                return 0


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    h_arr = [0] * (N+2)
    h_arr[0:N] = list(map(int,_in[1].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    # dp[i]:=カエルが足場iへと移動するのに必要な最小コスト
    dp = [float('inf')] * (N+2)  # 最小化問題
    dp[0] = 0                    # 初期条件
    
    # 貰うDP
    #for i in range(0,N):
    #    dp[i] = chmin(dp[i],dp[i-1]+abs(h_arr[i]-h_arr[i-1]))
    #    if i > 1:
    #        dp[i] = chmin(dp[i],dp[i-2]+abs(h_arr[i]-h_arr[i-2]))
    #cnt = dp[N-1]

    # 配るDP
    #for i in range(0,N):
    #    dp[i+1] = chmin(dp[i+1],dp[i]+abs(h_arr[i]-h_arr[i+1]))
    #    dp[i+2] = chmin(dp[i+2],dp[i]+abs(h_arr[i]-h_arr[i+2]))
    #cnt = dp[N-1]

    # メモ化再帰
    memo = Rec_memo(N,h_arr)
    cnt = memo.rec(N-1)
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


### FIXED CODE ###

from sys import stdin


# 最小化問題
def chmin(a,b):
    if a > b: return b
    else: return a


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    h_arr = list(map(int,_in[1].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    dp = [float('inf')] * N  # 最小化問題
    dp[0] = 0                # 初期条件
    
    for i in range(0,N):
        dp[i] = chmin(dp[i],dp[i-1]+abs(h_arr[i]-h_arr[i-1]))
        if i > 1:
            dp[i] = chmin(dp[i],dp[i-2]+abs(h_arr[i]-h_arr[i-2]))
    cnt = dp[N-1]
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)
N=int(input())
S=[[] for _ in range(N)]
for i in range(N-1):
  a,b=map(int, input().split())
  S[a-1].append((b-1, i))
  S[b-1].append((a-1, i))

L=[0]*(N-1)


def dfs(node, pre_col,pre_node):
  col=1
  for next_node, i in S[node]:
    if next_node==pre_node:
      continue
    if col==pre_col:
      col+=1
    L[i]=col
    dfs(next_node, col, node)
    col+=1

dfs(0,-1,-1)
"""
print(max(L))
for l in L:
  print(l)
"""

### FIXED CODE ###

N=int(input())
#再起のlimitを上げる
import sys
sys.setrecursionlimit(4100000)
S=[[] for _ in range(N)]
for i in range(N-1):
  a,b=map(int, input().split())
  S[a-1].append((b-1, i))
  S[b-1].append((a-1, i))

L=[0]*(N-1)


def dfs(node, pre_col,pre_node):
  col=1
  for next_node, i in S[node]:
    if next_node==pre_node:
      continue
    if col==pre_col:
      col+=1
    L[i]=col
    dfs(next_node, col, node)
    col+=1

dfs(0,-1,-1)

print(max(L))
for l in L:
  print(l)
N, M = map(int, input().split())

maxDist = [0 for i in range(N)]
in_degree = [1 for i in range(N)]
adj_list_f = [[] for i in range(N)]
adj_list_b = [[] for i in range(N)]

for i in range(M):
    x, y = map(lambda x:int(x)-1, input().split())
    adj_list_f[x].append(y)
    adj_list_b[y].append(x)
    in_degree[y] += 1

# dp[i] = maximum length of path ending at i
def dfs(node):
    children = adj_list_f[node] if node != -1 else [i for i in range(N)]
    for child in children:
        if node == -1:
            maxDist[child] = max(maxDist[child], 1)
        else:
            maxDist[child] = max(maxDist[child], 1 + maxDist[node])
        in_degree[child] -= 1
        if in_degree[child] == 0:
            dfs(child)
            
dfs(-1)
print(max(maxDist) - 1)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000 + 1)

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

maxDist = [0 for i in range(N+1)]
in_degree = [0 for i in range(N+1)]
adj_list = [[] for i in range(N+1)]

for i in range(M):
    x, y = map(int, input().split())
    adj_list[x].append(y)
    in_degree[y] += 1

for node in range(1, N+1):
    adj_list[0].append(node)
    in_degree[node] += 1

# dp[i] = maximum length of path ending at i
flattenedNodes = []
def dfs(node):
    for child in adj_list[node]:
        maxDist[child] = max(maxDist[child], 1 + maxDist[node])
        in_degree[child] -= 1
        if in_degree[child] == 0:
            dfs(child)
            
dfs(0)
print(max(maxDist) - 1)
a,b,c=input().split()
if a[-1]==b[1] and b[-1]==c[1]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")
from collections import deque, Counter
import itertools

H, W, M = map(int, input().split())
HW = [list(map(int, input().split())) for _ in range(M)]

d_h = deque()
d_w = deque()
for h, w in HW:
    d_h.append(h)
    d_w.append(w)

# 出現頻度順にソート
c_h = Counter(HW[:][0]).most_common()
c_w = Counter(HW[:][1]).most_common()

print(HW[:][0])

# 登場頻度の一番高い回数
n_h = c_h[0][1]
n_w = c_w[0][1]

# 同率のものを数える
t_h = deque()
t_w = deque()

for k, v in c_h:
    if v == n_h:
        t_h.append(k)
    else:
        break

for k, v in c_w:
    if v == n_w:
        t_w.append(k)
    else:
        break

"""q = set(list(itertools.product(t_h, t_w)))

for h, w in HW:
    q.discard((h, w))

if len(q) == 0:
    ans = n_h + n_w - 1
else:
    ans = n_h + n_w

print(ans)
"""


### FIXED CODE ###

import itertools

import numpy as np


def main():
    H, W, M = map(int, input().split())
    HW = [list(map(int, input().split())) for _ in range(M)]

    A = np.zeros(H, dtype=np.int64)
    B = np.zeros(W, dtype=np.int64)

    for h, w in HW:
        A[h - 1] += 1
        B[w - 1] += 1

    maxA = np.max(A)
    maxB = np.max(B)

    # 最大値を取るindex
    ind_A = np.arange(H)[A == maxA]
    ind_B = np.arange(W)[B == maxB]

    # 解の候補の数
    nn = len(ind_A) * len(ind_B)

    # Mより候補の数のほうが多いとok
    # 少ないときはM以下なので可算
    ans = maxA + maxB

    if nn <= M:
        for h, w in HW:
            if A[h - 1] == maxA and B[w - 1] == maxB:
                nn -= 1

    print(ans if nn else ans - 1)


main()
str_lis = input().split()
A, B, K = [int(x) for x in str_lis]
N = min(A, B)
num_lis = [n for n in range(1, N + 1) if A % n == 0 and B % n == 0]
print(num_lis[K]

### FIXED CODE ###

str_lis = input().split()
A, B, K = [int(x) for x in str_lis]
N = min(A, B)
num_lis = [n for n in range(1, N + 1) if A % n == 0 and B % n == 0]
lis = num_lis[::-1]
print(lis[K - 1])
mod=10**9+7
n=int(input())
fact=[1]
fact_inv=[1]
for i in range(n+1):#<< Nの最大値
    new_fact=fact[-1]*(i+1)%mod
    fact.append(new_fact)
    fact_inv.append(pow(new_fact,mod-2,mod))

def mod_comb(n,k,mod):
    return fact[n]*fact_inv[k]%mod*fact_inv[n-k]%mod

ab=[list(map(int,input().split())) for _ in range(n)]
k=[]
for i in range(n):
    a,b=ab[i]
    k.append(b/a)
k.sort()
print(k)
from bisect import bisect_left, bisect_right
ans=pow(2,n,mod)-1
d={}
dd={}
for x in k:
    y=1/x
    c=bisect_right(k,-y)-bisect_left(k,-y)
    cc=bisect_right(k,x)-bisect_left(k,x)
    dame=0
    if c==0:
        continue
    for i in range(2,c+2):
        dame+=pow(2,n-i,mod)*mod_comb(c,i-1,mod)*mod_comb(cc,i-1,mod)
        dame%=mod
    x=max(x,-y)
    if x in d:
        d[x]+=1
    else:
        d[x]=1
    if x in dd:
        pass
    else:
        dd[x]=dame
for v in dd.values():
    ans-=v
print(ans)


### FIXED CODE ###

n=int(input())
ab=[list(map(int,input().split())) for _ in range(n)]
d={}
mod=10**9+7
def gcd(x,y):
    if x==y:
        return x
    elif x>y:
        r=-1
        while r!=0:
            r=x%y
            x=y
            y=r
        return x
    else:
        r=-1
        while r!=0:
            r=y%x
            y=x
            x=r
        return y
z=0
for i in range(n):
    a,b=ab[i]
    if a==0 and b==0:
        z+=1
        continue
    if a==0:
        b=1
        y=(a,b)
        if y in d:
            d[y]+=1
        else:
            d[y]=1
        continue
    if b==0:
        a=1
        y=(a,b)
        if y in d:
            d[y]+=1
        else:
            d[y]=1
        continue
    x=gcd(a,b)
    a//=x
    b//=x
    if a<0:
        a*=-1
        b*=-1
    y=(a,b)
    if y in d:
        d[y]+=1
    else:
        d[y]=1
ans=1
re={}
for t,v in d.items():
    if t in re:
        continue
    a,b=t
    c=0
    if (b,-a) in d:
        c+=d[(b,-a)]
        re[(b,-a)]=1
    if (-b,a) in d:
        c+=d[(-b,a)]
        re[(-b,a)]=1
    ans*=(2**v-1+2**c-1+1)
    ans%=mod
ans-=1
ans+=z
ans%=mod
print(ans)
def calc():
    summ  = sum(A)
    #print(summ)
    
    low = summ / (4*M)
    #print(low)

    newlist = [i for i in A if low <= i]
    #print(newlist)

    num = len(newlist)
    #print(num)

    if M > num:
        print ("No")
    else:
        print ("Yes")

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


#N, M = 10, 10
#A = list(range(1, 11))
calc()


### FIXED CODE ###

#def calc():
    #summ  = sum(A)
    #print(summ)
    
    #low = summ / (4*M)
    #print(low)

    #newlist = [i for i in A if i >= low]
    #print(newlist)

    #num = len(newlist)
    #print(num)

    #if M <= num:
        #print ("Yes")
    #else:
        #print ("No")

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

#N, M = 5, 2
#A = [110, 2, 20, 10, 0]
#calc()

S = sum(A)
cnt = 0

for i in A:
    if i >= S / (4*M):
        cnt += 1
if cnt >= M:
    print("Yes")
else:
    print("No")
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    if min(a, b) == 0:
        return max(a, b)
    while b:
        a, b = b, a % b
    return a

def gcd_l(l):
    if len(l) == 1:
        return l[0]
    else:
        return gcd(l[0], gcd_l(l[1:]))

ans = 0
from copy import deepcopy
for i in range(n):
    li = deepcopy(a)
    li.remove(a[i])
    ans = max(ans, gcd_l(li))

print(ans)


### FIXED CODE ###

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

def gcd(a, b):
    if min(a, b) == 0:
        return max(a, b)
    while b:
        a, b = b, a % b
    return a

l = [0]
r = [0]
for i in range(n):
    l.append(gcd(l[i], a[i]))
    r.append(gcd(r[i], a[n-i-1]))

r = r[::-1]

ans = 0
for i in range(n):
    g = gcd(l[i], r[i+1])
    ans = max(ans, g)

print(ans)
N,L,*S = map(int,open(0).read().split())
S.sort()
print("".join(S))

### FIXED CODE ###

N,L,*S = map(str,open(0).read().split())
S.sort()
print("".join(S))
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b = map(int, input().split())
# 出力
if (a*b) % 2 = 0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b = map(int, input().split())
# 出力
if (a*b) % 2 == 0:
  print("Even")
else:
  print("Odd")
n = int(input())
s = input()
flag = 1

if n % 2:
    print('No')
else:
    for i in range(n):
        if s[i] != s[n/2 + i]:
            flag = 0
    if flag:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

n = int(input())
s = input()
flag = 1

if n % 2:
    print('No')
else:
    for i in range(n//2):
        if s[i] != s[n//2 + i]:
            flag = 0
    if flag:
        print('Yes')
    else:
        print('No')
def main():
  x=int(input())
  y=int(input())
  
  if x>y:
    print(str(y)*x)
  elif x<y:
    print(str(x)*y)
  else:
    print(str(x)*y)
main()

### FIXED CODE ###

def main():
    x, y = [int(i) for i in input().split()]
    if x > y:
        print(str(y) * x)
    elif x < y:
        print(str(x) * y)
    else:
        print(str(x) * y)
main()
def submit():
    n = int(input())
    alist = list(map(int, input().split()))
    blist = list(map(int, input().split()))


    # 順番にグリーディ
    a = alist.copy()
    b = blist.copy()
    score_a = 0
    for i in range(0, n):
        if a[i] < b[i]:
            score_a += a[i]
            b[i] -= a[i]
            a[i] = 0
        else:
            score_a += b[i]
            a[i] -= b[i]
            b[i] = 0

        if a[i + 1] < b[i]:
            score_a += a[i + 1]
            b[i] -= a[i + 1]
            a[i + 1] = 0
        else:
            score_a += b[i]
            a[i + 1] -= b[i]
            b[i] = 0

    # 逆順にグリーディ
    a = alist.copy()
    a.reverse()
    b = alist.copy()
    b.reverse()
    score_b = 0
    for i in range(0, n):
        if a[i] < b[i]:
            score_b += a[i]
            b[i] -= a[i]
            a[i] = 0
        else:
            score_b += b[i]
            a[i] -= b[i]
            b[i] = 0

        if a[i + 1] < b[i]:
            score_b += a[i + 1]
            b[i] -= a[i + 1]
            a[i + 1] = 0
        else:
            score_b += b[i]
            a[i + 1] -= b[i]
            b[i] = 0

    print(max(score_a, score_b))
    

if __name__ == '__main__':
    submit()


### FIXED CODE ###



def submit():
    n = int(input())
    alist = list(map(int, input().split()))
    blist = list(map(int, input().split()))


    # 順番にグリーディ
    a = alist.copy()
    b = blist.copy()
    score_a = 0
    for i in range(0, n):
        if a[i] < b[i]:
            score_a += a[i]
            b[i] -= a[i]
            a[i] = 0
        else:
            score_a += b[i]
            a[i] -= b[i]
            b[i] = 0

        if a[i + 1] < b[i]:
            score_a += a[i + 1]
            b[i] -= a[i + 1]
            a[i + 1] = 0
        else:
            score_a += b[i]
            a[i + 1] -= b[i]
            b[i] = 0


    print(score_a)


if __name__ == '__main__':
    submit()
import math
T = int(input())
data = []
for i in range(T):
    data.append([int(xi) for xi in input().split()])

def judge(A, B, C, D):
    if A < B:   # そもそも買えない
        return False
    if D < B:   # 補充が間に合わないのでいずれ在庫が尽きる
        return False
    if B <= C:  # 補充が間に合う状況で、必ず0個以上の在庫がある
        return True
    G = math.gcd(B, D)   # 昼の買い物の後に残る在庫数の候補のステップ数
    R = A % G       # 例えば A = 3, G = 2の場合、必ず1個あまる
    if C + G - R - B  < 0:
        # C + G - R: 在庫の最小数
        return False
    else:
        return True

for a, b, c, d in data:
    print('Yes') if judge(a, b, c, d) else print('No')



### FIXED CODE ###

import fractions

def judge(A, B, C, D):
    if A < B:   # そもそも買えない
        return False
    if D < B:   # 補充が間に合わないのでいずれ在庫が尽きる
        return False
    if B <= C:  # 補充が間に合う状況で、必ず0個以上の在庫がある
        return True
    G = fractions.gcd(B, D)   # 昼の買い物の後に残る在庫数の候補のステップ数
    R = A % G       # 例えば A = 3, G = 2の場合、必ず1個あまる
    if C + G - R - B  < 0:
        # C + G - R: 在庫の最小数
        return False
    else:
        return True

T = int(input())
data = []
for _ in range(T):
    data.append([int(xi) for xi in input().split()])
for A, B, C, D in data:
    print('Yes') if judge(A, B, C, D) else print('No')
import collections
def main(n:int,lst:list)->int:
    b = True
    lst1 = []
    lst2 = []
    for e in lst:
        if b:
            lst1.append(e)
        else:
            lst2.append(e)
        b = not b
    c1 = collections.Counter(lst1).most_common()
    c2 = collections.Counter(lst2).most_common()
    if c1[0][0] == c2[0][0]:
        if c1[0][1] > c2[0][1]:
            if len(c2) == 1:
                return n - c1[0][1]
            else:
                return n - c1[0][1] - c2[1][1]
        else:
            if len(c1) == 1:
                return n - c2[0][1]
            else:
                return n - c2[0][1] - c1[1][1]
    else:
        return n - c1[0][1] - c2[0][1]

n = int(input())
lst = list(map(int,input().split()))
print(main(n,lst))


### FIXED CODE ###

print(input().replace("1","a").replace("9","1").replace("a","9"))