Harryxun/stf_run huggingface dataset:
X, Y, Z, K = input().split()
X = int(X)
Y = int(Y)
Z = int(Z)
K = int(K)
A = [int(a) for a in input().split()]
A = sorted(A, reverse=True)
B = [int(b) for b in input().split()]
B = sorted(B, reverse=True)
C = [int(c) for c in input().split()]
C = sorted(C, reverse=True)
ABC = []
a, b, c = 0, 0, 0
ABC.append(A[a] + B[b] + C[c])
k = 1
while K+10>k:
    if len(A)>=a+2:
        for y in range(b+1):
            for z in range(c+1):
                ABC.append(A[a+1] + B[y] + C[z])
                k += 1
        a += 1
    if len(B)>=b+2:
        for x in range(a+1):
            for z in range(c+1):
                ABC.append(A[x] + B[b+1] + C[z])
                k += 1
        b += 1
    if len(C)>=c+2:
        for x in range(a+1):
            for y in range(b+1):
                ABC.append(A[x] + B[y] + C[c+1])
                k += 1
        c += 1
    k += 1
ABC_sorted = sorted(ABC, reverse=True)
for i in range(K):
    print(ABC_sorted[i])

### FIXED CODE ###

X, Y, Z, K = [int(x) for x in input().split()]
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
C = [int(c) for c in input().split()]
A = sorted(A, reverse=True)
B = sorted(B, reverse=True)
C = sorted(C, reverse=True)
ABC = []
for a in range(len(A)):
    if a+1 > K:
        break
    for b in range(len(B)):
        if b+1 > K:
            break
        elif (a+1)*(b+1) > K:
            break
        for c in range(len(C)):
            if c+1 > K:
                break
            elif (a+1)*(c+1) > K:
                break
            elif (b+1)*(c+1) > K:
                break
            elif (a+1)*(b+1)*(c+1) > K:
                break
            ABC.append(A[a] + B[b] + C[c])
ABC = sorted(ABC, reverse=True)
for i in range(K):
    print(ABC[i])
import functools
import operator

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

i = 2
res = []

while i<=P**0.5:
  while P%i**N==0:
    P/=i**N
    res.append(i)
  else:
    i += 1
    
print(res)
result = functools.reduce(operator.mul, res)
print(result)

### FIXED CODE ###

N,P = map(int,input().split())
i = round(P**(1/N))
res = []
if N == 1:
  print(P)
elif P == 1:
  print(1)
else:
  for i in range(i,0,-1):
    if P%i**N==0:
      print(i)
      break
import itertools
H, W, K = map(int, input().split())

S = [0]*H
for i in range(H):
  S[i] = input()
Sdivs = []
mcnt = 1100
for b in itertools.product([0, 1], repeat=H-1):
  start = 0
  end = 1
  Sdivs=[]
  for a in b:
    if a==1:
      Sdivs.append(S[start:end])
      start = end
    end += 1
  Sdivs.append(S[start:end])
  cnt = sum(b)
  ones_cum = [0]*len(Sdivs)
  ones = [0]*len(Sdivs)
  mark1,mark2 = False,False
  ws = [0]
  for w in range(1,W):
    if mark2 == True:
      #print(mark)
      break
    for i,Sdiv in enumerate(Sdivs):
      #print(w)
      for s in Sdiv:
        ones_cum[i] += s[w-1]=='1'
        ones[i] += s[w-1]=='1'
      if ones_cum[i] > K:
        mark1 = True
        if w-1 == ws[-1]:
          mark2 = True
        ws.append(w-1)
      #print(ones_cum,ws)
    if mark1 == True:
      mark1 = False
      ones_cum = ones
    ones = [0]*len(Sdivs)
  if mark2 == True:
    continue
  cnt += len(ws)-1
  mcnt = min(mcnt,cnt)
print(mcnt)

### FIXED CODE ###

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

ans = N*(N-1)//2+M*(M-1)//2
print(ans)
n=int(input())
if n<2:
    print(1)
    exit()
A=[[] for _ in range(n)]
B=[0 for _ in range(n)]
for i in range(n-1):
    u,v,w=map(int,input().split())
    u-=1
    v-=1
    A[u].append([v,w,0])
    A[v].append([u,w,0])
def s(x):
    for i,a in enumerate(A[x]):
        if a[2]<1:
            if a[1]%2<1:B[a[0]]=B[x]
            else:B[a[0]]=B[x]^1
            A[x][i][2]=1
            for j,z in enumerate(A[a[0]]):
                if z[0]==x:A[a[0]][j][2]=1
            return s(a[0])
s(0)
for b in B:print(b)


### FIXED CODE ###

import sys
sys.setrecursionlimit(9**9)
n=int(input())
C=[0 for _ in range(n)]
L=[[] for _ in range(n)]
for j in range(n-1):
  u,v,w=map(int,input().split())
  u-=1
  v-=1
  L[u].append([v,w])
  L[v].append([u,w])
def a(n,v,d):
  for i in L[n]:
    if d%2==1:C[n]=1
    if v!=i[0]:a(i[0],n,d+i[1])
a(0,0,0)
for c in C:print(c)
a,b,c,d = map(int, input().split())
x = a
y = c
max = x * y
for x in range(a,b + 1):
  for y in range(c,d + 1):
    if x * y > max:
      max = x * y
print(max)

### FIXED CODE ###

num = int(input())
if num == 0:
  print(1)
else:
  print(0)
import sys
from functools import reduce
from math import gcd

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def eratosthenes(n):
    prime = [2]
    if n == 2:
        return prime
    limit = int(n ** 0.5)
    data = [i + 1 for i in range(2, n, 2)]
    res = [0] * (n + 1)
    res[1] = 1
    for i in range(2, n + 1, 2):
        res[i] = 2
    while True:
        p = data[0]
        if limit <= p:
            return res
        prime.append(p)
        res[p] = p
        for e in data:
            if e % p != 0:
                res[e] = p
        data = [e for e in data if e % p != 0]


def solve():
    _ = int(rl())
    A = list(map(int, rl().split()))
    
    prime_fact = eratosthenes(10 ** 6)
    p_flg = True
    prime_fact_set = set()
    for ai in A:
        num = ai
        prime_fact_ai = set()
        while num != 1:
            prime_fact_ai.add(prime_fact[num])
            num //= prime_fact[num]
        for p in prime_fact_ai:
            if p in prime_fact_set:
                p_flg = False
                break
            prime_fact_set.add(p)
        if not p_flg:
            break
    
    if p_flg:
        print('pairwise coprime')
        return
    
    gcd_a = reduce(gcd, A)
    if gcd_a == 1:
        print('setwise coprime')
        return
    
    print('not coprime')


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
from functools import reduce
from math import gcd

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def eratosthenes(n):
    prime = [2]
    if n == 2:
        return prime
    limit = int(n ** 0.5)
    data = [i + 1 for i in range(2, n, 2)]
    res = [0] * (n + 1)
    res[1] = 1
    for i in range(2, n + 1, 2):
        res[i] = 2
    while True:
        p = data[0]
        if limit <= p:
            for e in data:
                res[e] = e
            return res
        prime.append(p)
        res[p] = p
        for e in data:
            if e % p == 0:
                res[e] = p
        data = [e for e in data if e % p != 0]


def solve():
    _ = int(rl())
    A = list(map(int, rl().split()))
    
    prime_fact = eratosthenes(10 ** 6)
    p_flg = True
    prime_fact_set = set()
    for ai in A:
        num = ai
        prime_fact_ai = set()
        while num != 1:
            prime_fact_ai.add(prime_fact[num])
            num //= prime_fact[num]
        for p in prime_fact_ai:
            if p in prime_fact_set:
                p_flg = False
                break
            prime_fact_set.add(p)
        if not p_flg:
            break
    
    if p_flg:
        print('pairwise coprime')
        return
    
    gcd_a = reduce(gcd, A)
    if gcd_a == 1:
        print('setwise coprime')
        return
    
    print('not coprime')


if __name__ == '__main__':
    solve()
import numpy as np
N = []
FLAGS = True
for i in range(3):
  N1 = list(map(int, input().split(' ')))
  N.append(N1)

N = np.array(N)

M = int(input())

for i in range(M):
  a = int(input())
  
  for j in range(3):
    for k in range(3):
      if N[j, k] == a:
        N[j, k] = 0
  if (np.all(N == 0, axis = 0).any(0)) or (np.all(N == 0, axis = 1).any(0)) or (np.all(np.diag(N) == 0).any(0)) or (np.all(np.diag(N) == 0).any(0)):
  #if (N[0, :].all() == 0) or (N[1, :].all() == 0) or  (N[2, :].all() == 0) or  (N[:, 0].all() == 0) or (N[:, 1].all() == 0) or (N[:, 2].all() == 0) or (np.diag(N).all() == 0) or (np.diag(np.transpose(N)).all() == 0):
    print('Yes')
    FLAGS = True
    break
  else:
    FLAGS = False
    continue
      
if FLAGS == False:     
  print('No')
                                                                
                       

### FIXED CODE ###

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

s_old = []
s_c_old =[]
result = 0
FLAGS = True
for i in range(M):
  s, c = map(int, input().split(' '))

  if (N != 1) & (s == 1) & (c == 0):
    print('-1')
    FLAGS = False
    break
  elif (s in s_old):
    if ([s,c] in s_c_old):
      s_old.append(s)
      s_c_old.append([s,c])
    else:
      print('-1')
      FLAGS = False
      break
  else:
    result += c*10**(N - s)
    s_old.append(s)
    s_c_old.append([s,c])

if (N == 1) and (M == 0):
  result = 0
elif 1 in s_old:
  result = result
#elif N != 1:
else:
  result += 1*10**(N - 1)
  
if FLAGS == True:
  print(result)
a, b, c, d, e, f = [int(x) for x in input().split()]
threshold = e / (100 + e) * 100
max_concent = 0
max_total = 0
max_suger = 0
max_try_water = int(f / 100 * a)
max_try_suger = int(f / c)
for i in range(max_try):
    for j in range(max_try):
        for k in range(max_try):
            for l in range(max_try):                
                water = a * i * 100 + b * j * 100
                suger = c * k + d * l   
                if water == 0:
                    break
                concentration = suger / (water + suger) * 100
                if (water + suger > f or concentration > threshold) :
                    break
                else:
                    if concentration > max_concent:
                        max_concent = concentration
                        max_total = water + suger
                        max_suger = suger
print("{} {}".format(max_total, max_suger))

### FIXED CODE ###

import math
a, b, c, d, e, f = [int(x) for x in input().split()]
threshold = e / (100 + e) * 100
max_concent = 0
max_total = 0
max_suger = 0
max_suger_try = int(threshold/100*f//c)
for i in range(31):
    for j in range(31):
        for k in range(max_suger_try):
            for l in range(max_suger_try):
                water = a * i * 100 + b * j * 100
                suger = c * k + d * l   
                if water == 0:
                    break
                concentration = suger / (water + suger) * 100
                if (water + suger > f or concentration > threshold) :
                    break
                else:
                    if concentration > max_concent:
                        max_concent = concentration
                        max_total = water + suger
                        max_suger = suger
if max_total == 0:
    max_total = a * 100
print("{} {}".format(max_total, max_suger))
for a in Str:
    Codigo.append(a)

lenMax=len(Codigo)-1
k=0

while i < len(Codigo)-1:
    try:
        lenAnterior = len(Codigo)-1
    
        if Codigo[i] == "0" and Codigo[i+1]=="1":
            contador+=2
            Codigo.pop(i)
            Codigo.pop(i)
        elif Codigo[i] == "1" and Codigo[i+1]=="0":
            contador+=2
            Codigo.pop(i)
            Codigo.pop(i)
        
        if lenAnterior != len(Codigo)-1:
            i=i-1
        else:
            i=i+1

        k+=1

        if k >= lenMax:
            break
    except:
        break
    
print(contador)

### FIXED CODE ###

s = input()
print(2*(min(s.count("0"), s.count("1"))))
a,b=map(int,input().split())
x=[0,0,-1,1]
y=[-1,1,0,0]
d=[[0]*a for x in range(b)]
for i in range(b):
    d[i]=list(input())
    
result="Yes"

for i in range(b):
    for j in range(a):
        if d[i][j] == '#':
            check=0
            for xv,yv in zip(x,y):
                if 0 <= xv + j < a  and 0 <= yv + i < b:
                    if d[i+yv][j+xv] == '#':
                        check=1
                        #break
        
            if check==0:
                result="No"
                #break
            
                        
print(result)


### FIXED CODE ###

N,M = map(int, input().split())
boards = [None] * N
passed = [[False] * M for i in range(N)]
for i in range(N):
    boards[i] = list(input())
for i in range(N):
    for j in range(M):
        if boards[i][j] == '#':
            if ((i < N - 1 and boards[i+1][j] == '#') or 
                (i >= 1 and boards [i-1][j] == '#') or 
                (j < M - 1 and boards[i][j+1] == '#') or
                (j >= 1 and boards[i][j-1] == '#')):
                    continue
            else:
                print('No')
                exit()
print('Yes')
A,B = map(int,input().split())
j=0
for i in range(1,100001):
    if int(i*0.08) == A and int(i*0.1) == B:
        j =1
        ans = i
        break
if j == 1:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

S=input()

if S=='AAA' or S=='BBB':
    print('No')
else:
    print('Yes')
a , b =map(int,input().split())
A=str(a)
B=str(b)
for(int i=0; i<a; i++):
    X+="A"
for(int j=0; j<b; j++):
    Y+="B"

if a<b:
    print(X)
if a>b:
    print(Y)


### FIXED CODE ###

a , b =input().split()
print(a*int(b) if a<=b else b*int(a))
import math
from collections import Counter as ct

def gcd_list(l):
    for n,i in enumerate(l):
        if n==0:cur=i
        cur=math.gcd(cur,i)
    return cur

def yakusulist(n):
    ans=[]
    for i in range(1,int(math.sqrt(n+1))+1):
        if n%i==0:
            ans.append(i)
            ans.append(n//i)
    return(set(ans))
    
def warennnokaomaera(n):
    if n==1:return(True)
    for k,i in enumerate(A):
        if k<3:continue
        if i%n:return(False)
    return(True)

N=int(input())
data=[int(i) for i in input().split()]
datagcd=gcd_list(data)
A=[i//datagcd for i in data]
if N>2:
    alpha=sorted(ct(A).keys())
    min3=[alpha[0],alpha[1],alpha[2]]
    p,q,r=[yakusulist(n) for n in min3]
    pq=p&q
    qr=q&r
    rp=r&p
    overtwo=pq|qr|rp
    overtwo=sorted(list(overtwo),reverse=True)
    for i in overtwo:
        if warennnokaomaera(i):
            print(datagcd*i)
            break
else:print(max(data))

### FIXED CODE ###

import math
import fractions
from collections import Counter as ct

def gcd_list(l):
    for n,i in enumerate(l):
        if n==0:cur=i
        cur=fractions.gcd(cur,i)
    return cur

def yakusulist(n):
    ans=[]
    for i in range(1,int(math.sqrt(n+1))+1):
        if n%i==0:
            ans.append(i)
            ans.append(n//i)
    return(set(ans))
    
def warennnokaomaera(n):
    warenai=0
    for k,i in enumerate(A):
        if i%n and warenai==0:
            warenai+=1
            continue
        if i%n and warenai:return(False)
    return(True)

N=int(input())
data=[int(i) for i in input().split()]
datagcd=gcd_list(data)
A=[i//datagcd for i in data]
if N>2:
    co=ct(A)
    alpha=sorted(co.keys())
    if len(alpha)>=3:
        min3=[alpha[0],alpha[1],alpha[2]]
        p,q,r=[yakusulist(n) for n in min3]
        pq=p&q
        qr=q&r
        rp=r&p
        overtwo=pq|qr|rp
        overtwo=sorted(list(overtwo),reverse=True)
        for i in overtwo:
            if warennnokaomaera(i):
                print(datagcd*i)
                break
    elif len(alpha)==2:#Aの数の種類が2種類以下->1個書き換えで違う数ってどっちかが一個じゃないと無理、それ以外はそのまま
        if co[alpha[0]]==1:
            print(datagcd*alpha[1])
        elif co[alpha[1]]==1:
            print(datagcd*alpha[0])
        else:print(datagcd)
    else:print(datagcd)
else:print(max(data))
import math
def nCr(n, r): 

  return (math.fact(n) // (math.fact(r)  
                           * math.fact(n - r))) 
n,m=list(map(int,input().split()))
total=0
if n>1:
  total+=nCr(n,2)
if m>1:
  total+=nCr(m,2)
print(total)

### FIXED CODE ###

import math
def nCr(n, r): 
  
    return (math.factorial(n) // (math.factorial(r)  
                * math.factorial(n - r))) 
n,m=list(map(int,input().split()))
total=0
if n>1:
  total+=nCr(n,2)
if m>1:
  total+=nCr(m,2)
print(total)
# # Educational DP Contest E
# 方針：dp[i][w] := i番目の物の中から，重さwを超えない時の価値の最大値
N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
wv.sort()
dp = [[0] * (W+1) for _ in range(N+1)]
weight_possible_now = wv[0][0]
if N == 1:
    if wv[0][0] <= W:
        print(wv[0][1])
    else:
        print(0)
    exit()

for i in range(N):
    if wv[i-1][0] < W:
        dp[i+1][:wv[i][0]] = dp[i][:wv[i][0]]
    weight_possible_now += wv[i][0]
    for w in range(wv[i][0], W+1):
        if weight_possible_now < W and w == weight_possible_now:
            dp[i+1][w+1:] = [dp[i+1][w]] * (W + 1 - w)
            break
        else:
            if w >= wv[i][0]:
                dp[i+1][w] = max(dp[i][w - wv[i][0]] + wv[i][1], dp[i][w])
            else:
                dp[i+1][w] = dp[i][w]
print(dp[N][W])

### FIXED CODE ###

# # Educational DP Contest E
# 方針：dp[i][v] := i-1番目までの物の中から，価値v以上を達成するように選んだ時の重さの最小値

# 入力
N, W = map(int, input().split())
weight = [0] * N
value = [0] * N
for i in range(N):
    w, v = map(int, input().split())
    weight[i] = w
    value[i] = v

# DPテーブル
max_v = sum(value)
dp = [[float("inf")] * (max_v + 1) for _ in range(N+1)]
dp[0][0] = 0

for i in range(N):
    for v in range(max_v+1):
        if v >= value[i]:       # i番目の物を選ぶ時
            dp[i+1][v] = min(dp[i][v - value[i]] + weight[i], dp[i][v])
        else:
            dp[i+1][v] = dp[i][v]

for v in range(max_v, -1, -1):
    if dp[N][v] <= W:
        ans = v
        break
print(ans)
print(int(input())+int(input())//2)

### FIXED CODE ###

X,Y=list(map(int,input().split()))
print(X+Y//2)
s = input()
K = int(input())

ans = []
for i in range(len(s)):
    if K >= ord('z')-ord(s[i])+1:
        K -= ord('z')-ord(s[i])+1
        ans.append('a')
    else:
        ans.append(s[i])

if K >= 1 and len(ans) >= 1:
    ans[-1] = chr(ord(ans[-1])+K)
else:
    ans[0] = chr(ord(s[0])+K)

print(''.join(ans))


### FIXED CODE ###

s = input()
K = int(input())

ans = []
for i in range(len(s)):
    if K >= ord('z')-ord(s[i])+1 and s[i] != 'a':
        K -= ord('z')-ord(s[i])+1
        ans.append('a')
    else:
        ans.append(s[i])

if K >= 1:
    ans[-1] = chr(ord(ans[-1])+K % 26)

print(''.join(ans))
import sys


def find_paths(mat, n, m, i, j, dp):

    if i == n - 1 and j == m - 1:
        return 1

    if i >= n or j >= m:
        return 0

    if mat[i][j] == "#":
        return 0

    if (i, j) in dp:
        return dp[(i, j)]

    dp[(i, j)] = int((find_paths(mat, n, m, i+1, j, dp) + find_paths(mat, n, m, i, j+1, dp)) % (1e9 + 7))
    return dp[(i, j)]



n, m = list(map(int, sys.stdin.readline().split()))

mat = []

for i in range(n):
    mat.append([ch for ch in sys.stdin.readline().strip()])


dp = {}
# print(mat)
print(find_paths(mat, n, m, 0, 0, dp))


### FIXED CODE ###

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

mat = []
dp = []
m = 10**9+7

for i in range(h):
    mat.append(list(input()))
    dp.append(list([0]*w))

dp[0][0] = 1


for x in range(h):
    for y in range(w):

        if x != 0 or y != 0:
            if mat[x][y] == "#":
                dp[x][y] = 0

            else:
                dp[x][y] += (dp[x - 1][y] + dp[x][y - 1]) % m

print(dp[h - 1][w - 1])
a = input().split()
if s[1] = '+':
    print(int(a[0])+int(a[2]))
else:
    print(int(a[0])-int(a[2]))

### FIXED CODE ###

a = input().split()
if a[1] == '+':
    print(int(a[0])+int(a[2]))
else:
    print(int(a[0])-int(a[2]))
num = []
for p in input().split():
    if p.isdisit():
        num.append(int(p))
    else:
        b = num.pop()
        a = num.pop()
        if p == '*':
            num.append(a * b)
        elif p == '+':
            num.append(a + b)
        elif p == '-':
            num.append(a - b)
print(num.pop())

### FIXED CODE ###

poland = input().split()
num = []
for p in poland:
    if p.isdigit():
        num.append(int(p))
    else:
        b = num.pop()
        a = num.pop()
        if p == '*':
            num.append(a * b)
        elif p == '/':
            num.append(a / b)
        elif p == '+':
            num.append(a + b)
        elif p == '-':
            num.append(a - b)
print(num.pop())
import sys
from collections import defaultdict, deque
readline = sys.stdin.readline

inf = 10 ** 5
n = int(readline())
G = defaultdict(list)
deg = [0] * n
for _ in range(n-1):
    a, b = map(int, readline().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

q = deque([0])
depth = [-1] * n
depth[0] = 0
num = [1, 0]
d = 1
while q:
    x = q.popleft()
    d = depth[x] + 1
    for y in G[x]:
        if depth[y] == -1:
            q.append(y)
            depth[y] = d
            num[d%2] += 1
r0 = list(range(3, n + 1, 3))
r1 = list(range(1, n + 1, 3))
r2 = list(range(2, n + 1, 3))
odd = [i for i in range(n) if depth[i] % 2]
even = [i for i in range(n) if not depth[i] % 2]
if num[0] > num[1]:
   odd, even = even, odd
if num[0] > n / 3 and num[0] > n / 3:
    r = r2 + r0 + r1
else:
    r = r2 + r1 + r0
ans = [0] * n
for i in even:
    ans[i] = r.pop()
for i in odd:
    ans[i] = r.pop()
print(f'{odd=}{even=}{num=}')
print(*ans)


### FIXED CODE ###

import sys
from collections import defaultdict, deque
readline = sys.stdin.readline

inf = 10 ** 5
n = int(readline())
G = defaultdict(list)
deg = [0] * n
for _ in range(n-1):
    a, b = map(int, readline().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

q = deque([0])
depth = [-1] * n
depth[0] = 0
d = 1
while q:
    x = q.popleft()
    d = depth[x] + 1
    for y in G[x]:
        if depth[y] == -1:
            q.append(y)
            depth[y] = d
r0 = list(range(3, n + 1, 3))
r1 = list(range(1, n + 1, 3))
r2 = list(range(2, n + 1, 3))
odd = [i for i in range(n) if depth[i] % 2]
even = [i for i in range(n) if not depth[i] % 2]
if len(even) <= n // 3:
    odd, even = even, odd
if len(odd) <= n // 3:
    r = r2 + r1 + r0
else:
    r = r1 + r0 + r2
ans = [0] * n
for i in odd:
    ans[i] = r.pop()
for i in even:
    ans[i] = r.pop()
# print(f'{even=}{odd=}{num=}')
print(*ans)
a,b=map(int,input().split())
s=input()
y=0
c=[0,1,2,3,4,5,6,7,8,9]
for i in range(a):
    for j in range(len(c)):
        if int(s[i])!=c[j]:
            y+=1
if s[a]!="-":
    y+=1
for i in range(a+1,a+b+1):
    for j in range(len(c)):
        if int(s[i])!=c[j]:
            y+=1
if y!=0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a,b=map(int,input().split())
s=input()
y=0
#c=[0,1,2,3,4,5,6,7,8,9]
for i in range(a):
    if s[i] not in ["0","1","2","3","4","5","6","7","8","9"]:
        y+=1
if s[a]!="-":
    y+=1
for i in range(a+1,a+b+1):
    if s[i] not in ["0","1","2","3","4","5","6","7","8","9"]:
        y+=1
#print(y)
if y==0:
    print("Yes")
else:
    print("No")
s=input()
t=input()

print(t+s)

### FIXED CODE ###

s,t=input().split()

print(t+s)
import itertools


import numpy as np


def solver(H, W, M, HW):
    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)


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

    solver(H, W, M, np.array(HW))


main()


### 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()
c = 0
n = input()
a = map(int, input_raw().split())

for i in range(n):
	for j in range(n -1, i + 1, -1):
		if a[j] < a[j - 1]:
			a[j], a[j - 1] = a[j], a[j - 1]
			c += 1

print(" ".join(map(str, a)))
print(c)

### FIXED CODE ###

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

c = 0
for i in range(n):
    for j in range(n - 1, i, -1):
        if a[j] < a[j - 1]:
            a[j], a[j - 1] = a[j - 1], a[j]
            c += 1

print(" ".join(map(str, a)))
print(c)