Harryxun/stf_run huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

typedef char* String;

String string_input(void){
    int i,len;
    char buf[100];
    String str;
    scanf("%s",buf);//buf=入力した文字列が入るchar型の配列
    
    len=strlen(buf);//len=文字列の長さを表すint型変数
    NEW(str,len+1);//strはただのポインタだから、ここでNEWを使ってメモリを確保しなくちゃいけない
    for(i=0;i<len;i++){
        str[i]=buf[i];
    }
    str[len]=0;
    
    return str;
}

int main(void){
    int N;
    scanf("%d",&N);

    //A[0]~A[N-1]に格納する
    String* S;
    NEW(S,N);
    for(int i=0;i<N;i++){
        S[i]=string_input();
    }

    int* ans;
    NEW(ans,26);
    for(int i=0;i<26;i++) ans[i]=50;

    int* tmp;
    NEW(tmp,26);
    for(int i=0;i<N;i++){
        for(int j=0;j<26;j++) tmp[j]=0;

        for(int j=0;j<strlen(S[i]);j++){
            tmp[S[i][j]-'a']++;
        }

        for(int j=0;j<26;j++) ans[j]=MIN(ans[j],tmp[j]);
    }

    for(int i=0;i<26;i++){
        char c='a'+i;
        for(int j=1;j<=ans[i];j++) printf("%c",c);
    }
    printf("\n");

    return 0;
}

### FIXED CODE ###

#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
#from scipy.misc import comb

N = int(input())
S = []
for _ in range(N):
    s = input()
    S.append(s)

cnt = [10000]*26
for s in S:
    for i in range(26):
        cnt[i] = min(cnt[i], s.count(chr(97+i)))

ans = ""
for i in range(26):
    if cnt[i] < 10000: ans += chr(97+i)*cnt[i]

print(ans)
N = input()
ans = 0
for n in range(1, len(N), 2):
    ans += 9 * 10 ** (n-1)

if len(N) % 2 != 0:
    ans += ans * (int(N[0]) - 1)
    ans += int(N[1:]) + 1

print(ans)


### FIXED CODE ###

N = input()
ans = 0
for n in range(1, len(N), 2):
    ans += 9 * 10 ** (n-1)

if len(N) == 1:
    ans = int(N)


elif len(N) % 2 != 0:
    ans += (10 ** (len(N)-1)) * (int(N[0])-1)
    ans += int(N[min(1, len(N)-1):]) + 1


print(ans)
N = int(input())
R = int(input())

if 0<=R<=4111 and 1<=N<=100:
    if N>=10:
        IR = R
        print(IR,end='\n')
    elif N<10:
        IR = R + 100*(10-N)
        print(IR,end='\n')


### FIXED CODE ###

InputValue = input().split(' ')

N = int(InputValue[0])
R = int(InputValue[1])

if 0<=R<=4111 and 1<=N<=100:
    if N>=10:
        IR = R
        print(IR,end='\n')
    elif N<10:
        IR = R + 100*(10-N)
        print(IR,end='\n')
import math
from collections import Counter

n, m = map(int, input().split())
mod = 10**9 + 7

fact = [0] * (n+21)
ifact = [0] * (n+21)
fact[0] = 1
for i in range(1,n+21):
    fact[i] = fact[i-1] * i % mod
ifact[n+20] = pow(fact[n+20], mod-2, mod)
for i in reversed(range(1,n+21)):
    ifact[i-1] = ifact[i] * i % mod

def comb(n, k):
    return fact[n] * ifact[n-k] % mod * ifact[k] % mod

def getprime(n):
    primes = []
    i = 2
    while n > i * i:
        while n % i == 0:
            n //= i
            primes.append(i)
        i += 1
    if n != 1:
        primes.append(n)
    return primes

ans = 1
counter = Counter(getprime(m))
print(counter)
for k in counter.values():
    print(n+k-1, k, comb(n+k-1, k))
    ans *= comb(n+k-1, k)
    ans %= mod
print(ans)

### FIXED CODE ###

import math
from collections import Counter

n, m = map(int, input().split())
mod = 10**9 + 7

K = 50
fact = [0] * (n+1+K)
ifact = [0] * (n+1+K)
fact[0] = 1
for i in range(1,n+1+K):
    fact[i] = fact[i-1] * i % mod
ifact[n+K] = pow(fact[n+K], mod-2, mod)
for i in reversed(range(1,n+1+K)):
    ifact[i-1] = ifact[i] * i % mod

def comb(n, k):
    return fact[n] * ifact[n-k] % mod * ifact[k] % mod

def getprime(n):
    primes = []
    i = 2
    while n >= i * i:
        while n % i == 0:
            n //= i
            primes.append(i)
        i += 1
    if n != 1:
        primes.append(n)
    return primes

ans = 1
counter = Counter(getprime(m))
for k in counter.values():
    ans *= comb(n+k-1, k)
    ans %= mod
print(ans)
print(int(input()) * int(input()))

### FIXED CODE ###

a,b = map(int,input().split())
print(a * b)
import math

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

print(math.floor(mean(a,b)))

### FIXED CODE ###

import math
import statistics as st

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

print(math.ceil(st.mean((a,b))))
n,l=map(int,input().split())
li=[]
for i in range(1,n+1):
  li.append(l+i-1)
print(sum(li)-li[li.index(min(list(map(abs,li))))])

### FIXED CODE ###

n,l=map(int,input().split())
li=[]
for i in range(1,n+1):
  li.append(l+i-1)
print(sum(li)-[i for i in li if abs(i)==min(list(map(abs,li)))][0])
import sys

input = sys.stdin.readline


def acinput():
    return list(map(int, input()[:-1].split(" ")))


class SegmentTree:
    # 初期化処理
    # f : SegmentTreeにのせるモノイド
    # default : fに対する単位元
    def __init__(self, size, f=lambda x, y: x+y, default=0):
        self.size = 2**(size-1).bit_length()  # 簡単のため要素数Nを2冪にする
        self.default = default
        self.dat = [default]*(self.size*2)  # 要素を単位元で初期化
        self.f = f

    def update(self, i, x):
        i += self.size
        self.dat[i] = x
        while i > 0:
            i >>= 1
            self.dat[i] = self.f(self.dat[i*2], self.dat[i*2+1])

    def query(self, l, r):
        l += self.size
        r += self.size
        lres, rres = self.default, self.default
        while l < r:
            if l & 1:
                lres = self.f(lres, self.dat[l])
                l += 1

            if r & 1:
                r -= 1
                # モノイドでは可換律は保証されていないので演算の方向に注意
                rres = self.f(self.dat[r], rres)
            l >>= 1
            r >>= 1
        res = self.f(lres, rres)
        return res


def acinput():
    return list(map(int, input()[:-1].split(" ")))


N, K = acinput()

A = [int(input()) for _ in range(N)]

st = SegmentTree(30000+10, f=max)

res = 0
for sa in A:
    L = max(sa-K, 0)
    R = min(sa+K+1, 300000)

    tmp = st.query(L, R+1)+1
    st.update(sa, tmp)
    res = max(tmp, res)

print(res)


### FIXED CODE ###



class SegmentTree:
    # 初期化処理
    # f : SegmentTreeにのせるモノイド
    # default : fに対する単位元
    def __init__(self, size, f=lambda x, y: x+y, default=0):
        self.size = 2**(size-1).bit_length()  # 簡単のため要素数Nを2冪にする
        self.default = default
        self.dat = [default]*(self.size*2)  # 要素を単位元で初期化
        self.f = f

    def update(self, i, x):
        i += self.size
        self.dat[i] = x
        while i > 0:
            i >>= 1
            self.dat[i] = self.f(self.dat[i*2], self.dat[i*2+1])

    def query(self, l, r):
        l += self.size
        r += self.size
        lres, rres = self.default, self.default
        while l < r:
            if l & 1:
                lres = self.f(lres, self.dat[l])
                l += 1

            if r & 1:
                r -= 1
                # モノイドでは可換律は保証されていないので演算の方向に注意
                rres = self.f(self.dat[r], rres)
            l >>= 1
            r >>= 1
        res = self.f(lres, rres)
        return res


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

A = [int(input()) for _ in range(N)]

st = SegmentTree(300000+10, f=max)

res = 0
for sa in A:
    L = max(sa-K, 0)
    R = min(sa+K, 300001)

    tmp = st.query(L, R+1)+1
    st.update(sa, tmp)
    res = max(tmp, res)

print(res)
N,M=map(int,input().split())
print(N(N-1)/2 +M(M-1)/2)


### FIXED CODE ###

N,M=map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)
from sys import argv
X, Y, Z = argv

A = Z
B = X
C = Y

print(f"{A} {B} {C}")

### FIXED CODE ###

X,Y,Z = map(int,input().split())
print(Z ,X ,Y)
K,X = map(int, input().split())

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')
from scipy.special import comb
from collections import Counter, deque

D = deque(map(int, list(input())))
num_mod = {}
value = 0

for i in range(len(D)):
    value = value + D.pop() * 10**i
    modulo = value % 2019
    #print(modulo)
    if modulo in num_mod.keys():
        num_mod[modulo] += 1
    else:
        num_mod[modulo] = 1

fix = 0
ans = [comb(i, 2, exact=True) for i in num_mod.values() if i > 1]
#print(b)
if 0 in num_mod.keys():
    if num_mod[0] == 1:
        fix = 1
print(sum(ans)+fix)


### FIXED CODE ###

import sys
from collections import deque
def input():
    return sys.stdin.readline()[:-1]

S = deque(map(int, list(input())))
num = 0
dict = {}
dict[0] = 1
ans = 0

for i in range(len(S)):
    num += S.pop() * pow(10,i,2019)
    cand = num % 2019
    if cand in dict.keys():
        dict[cand] += 1
    else:
        dict[cand] = 1

for key in dict.keys():
    ans += dict[key] * (dict[key] - 1) // 2
print(ans)
kotae = input()
print(kotae*kotae*kotae)

### FIXED CODE ###

input_lines = int(input())
print(input_lines **3)
N = input()
K = input()
counter = 0
for i in range(N)
    if input() >= K :
       counter++
print(counter)


### FIXED CODE ###

N,K = map(int,input().split())
height_list = list(map(int,input().split()))
print(sum([1 for i in height_list if i >= K]))
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
d=[0]*(n+1)
d[0]=1 
if a[0]==1:
  d[1]=0
else:
  d[1]=1
for i in range(2,n+1):
  if i in a:
    d[i]=0
  else:
    d[i]=d[i-1]+d[i-2]
print(d[n])

### FIXED CODE ###

n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
mod=10**9+7
d=[mod]*(n+1)
d[0]=1;d[1]=1
for i in a:
  d[i]=0
for i in range(2,n+1):
  d[i]=min(d[i],(d[i-1]+d[i-2])%mod)
print(d[n])
r, g = map(int, input().split())
print((r + g) / 2)


### FIXED CODE ###

r, g = [int(input()) for _ in range(2)]
print(2*g - r)
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve( lst_a, lst_b,n):
    if n.count("-")>=2:
        return "No"
    else:
        N,NN=n.split("-")
        if lst_a == len(N) and lst_b == len(NN):
            answer = "Yes"
        else:
            answer = "No"
    return answer
# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    [str_n, str_i] = line1.split(' ')
    line2 = sys.stdin.readline().rstrip()
    return (int(str_n), int(str_i), line2)

def main():
    n, i, s = readQuestion()
    answer = solve(n, i, s)
    print(answer)
    
if __name__ == '__main__':
    main()
    

### FIXED CODE ###

import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(a,b,c):
    if len(c) == a+b+1:
        if  c.count("-")!=1:
            return "No"
        elif c[a]==("-"):
            return "Yes"
        else:
            return "No"
    else:
        return "No"
# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    [str_n, str_i] = line1.split(' ')
    line2 = sys.stdin.readline().rstrip()
    return (int(str_n), int(str_i), line2)

def main():
    n, i, s = readQuestion()
    answer = solve(n, i, s)
    print(answer)
    
if __name__ == '__main__':
    main()
k, n = map(int, input().split())
if n == 0:
    print(0)
else:
    l = list(map(int, input().split()))
    l.sort()
    k1 = [i for i in range(min(l), max(l) + 1) if i not in l]
    d = {}
    for i in range(len(k1)):
        d[k1[i]] =max(k1[i],k)-min(k1[i],k)
    k2 = min(d, key=d.get)
    if len(d)==0:
      print(0)
    else:
      print(k2)

### FIXED CODE ###

x,n=map(int,input().split())
l=list(map(int,input().split()))
if x not in l:
    print(x)
elif n==0:
    print(x)
else:
    a=101
    p1=0
    for i in range(102):
        if i not in l:
            if abs(x-i)<a:
                a=abs(x-i)
                p1=i

    print(p1)
a,b = input().split()
a = int(a)
b = int(b*100)
print(a*b//100)

### FIXED CODE ###

a,b = input().split()
a = int(a)
b = b[:-3] + b[-2:]
b = int(b)
print(a*b//100)
import sys
sys.setrecursionlimit(100000)
n = int(input())
a = [int(input()) for i in range(n)]

switch = [False] * (n + 1)
def button(x,cnt):
    if switch[x]:
        print(-1)
        return -1
    if x == 2:
        print(cnt)
        return
    switch[x] = True
    button(a[x - 1], cnt + 1)
    return cnt

ans = button(1, 0)

### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)
n = int(input())
a = [int(input()) for i in range(n)]

switch = [False] * (n + 1)
def button(x,cnt):
    if switch[x]:
        print(-1)
        return -1
    if x == 2:
        print(cnt)
        return
    switch[x] = True
    button(a[x - 1], cnt + 1)
    return cnt

ans = button(1, 0)
import numpy as np
from itertools import accumulate

N, M = map(int, input().split())
P = []
p = [0] * (N+1)
for i in range(M):
    p1, y1 = map(str, input().split())
    p[int(p1)] += 1
    P.append(int(p1+y1.rjust(6,"0")))
    
ans = np.argsort(P)
ans = np.argsort(ans)
p = list(accumulate(p))

for i in range(M):
    a = int(P[i]) // 10 ** 6 
    print(str(a).rjust(6,"0") + str(ans[i] - p[a-1] + 1).rjust(6,"0"))

### FIXED CODE ###

import numpy as np
from itertools import accumulate

N, M = map(int, input().split())
P = []
p = [0] * (N+1)
for i in range(M):
    p1, y1 = map(str, input().split())
    p[int(p1)] += 1
    P.append(int(p1+y1.rjust(10,"0")))
    
ans = np.argsort(P)
ans = np.argsort(ans)
p = list(accumulate(p))

for i in range(M):
    a = P[i] // 10 ** 10 
    print(str(a).rjust(6,"0") + str(ans[i] - p[a-1] + 1).rjust(6,"0"))
N,K=map(int,input().split())
tree=[[]for _ in range(N+1)]
MOD=10**9+7
ans=K
for i in range(N-1):
    a,b=map(int,input().split())
    tree[a].append(b)
    tree[b].append(a)
def enu(a,b):
    num=1
    for i in range(b):
        num=num*(a-i)
        num%=MOD
    return num
def dfs(a,b):
    if a==1:
        node=len(tree[a])
        ret=enu(K-1,node)%MOD
    else:
        node=len(tree[a])-1
        ret=enu(K-2,node)%MOD
    for i in tree[a]:
        if i==b:
            continue
        ret=ret*dfs(i,a)%MOD
    return max(ret,1)
ans*=dfs(1,0)
print(ans%MOD)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
N,K=map(int,input().split())
tree=[[]for _ in range(N+1)]
MOD=10**9+7
ans=K
enuk=[1]*(N)
for i in range(N-1):
    a,b=map(int,input().split())
    tree[a].append(b)
    tree[b].append(a)
    enuk[i+1]=(enuk[i]*(K-2-i))%MOD
def dfs(a,b):
    if a==1:
        node=len(tree[a])
        ret=1
        for i in range(node):
            ret*=K-1-i
            ret%=MOD
    else:
        node=len(tree[a])-1
        ret=enuk[node]%MOD
    for i in tree[a]:
        if i==b:
            continue
        ret=ret*dfs(i,a)%MOD
    return ret
ans*=dfs(1,0)
print(ans%MOD)
import sys
input = sys.stdin.readline

S = str(input())
Q = int(input())
A = [[input().split("")] for _ in range(Q)]

for i in range(Q):
  if A[i] == ["1"]:
    S = ''.join(list(reversed(S)))
  else:
    if A[i][1] == "1":
      S = A[i][2] + str(S)
    else:
      S = str(S) + A[i][2] 
      
print(S)
    


### FIXED CODE ###

s = input()
q = int(input())
par = 0
pre = ""
pos = ""

for i in range(q):
  t = input().split()
  if t[0] == "1":
    par += 1
  elif (par + int(t[1]))%2 == 1:
    pre = t[2] + pre
  else:
    pos = pos + t[2]
    
ans = pre + s + pos

if par%2 == 0:
  print(ans)
else:
  print(ans[::-1])
# -*- 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')
s=list(input())
k=int(input())

al=list('bcdefghijklmnopqrstuvwxyza')

ans=''
for i in range(len(s)):
    d=25-al.index(s[i])
    if d<=k or s[i]=='a':
        ans+='a'
        k-=d
    else:
        ans+=s[i]
k=k%26
f=al.index(ans[-1])
ans[-1]=al[min(f+k,f+k-26)]
print(ans)

### FIXED CODE ###

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

al=list('bcdefghijklmnopqrstuvwxyza')

ans=''
for i in range(len(s)):
    d=25-al.index(s[i])
    if d<=k or s[i]=='a':
        ans+='a'
        k-=d
    else:
        ans+=s[i]
k=k%26
f=al.index(ans[-1])
kai=list(ans)
kai.pop(-1)
ans=''.join(kai)
ans+=al[min(f+k,f+k-26)]
print(ans)
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    cnt = [0]*9
    for a in A:
        cnt[a//400] += 1
    ans = sum(int(a > 0) for a in cnt[:-1])
    print(ans, ans+cnt[-1])


if __name__ == '__main__':
    main()


### FIXED CODE ###

from bisect import bisect
def grade(rate,breakpoints=[400,800,1200,1600,2000,2400,2800,3200],grades=["gray","brown","green","light blue","blue","yellow","orange","red","anything"]):
    i = bisect(breakpoints,rate)
    return grades[i]

n = int(input())
a = [int(i) for i in input().split()]
colors = [grade(r) for r in a]
anything_count = colors.count("anything")
ans = len(set(colors))
print(*(ans,ans) if anything_count == 0 else (ans-1+(1 if ans == 1 else 0),ans-1+anything_count))
s = input()

front = s[:2]
back =s[2:]

if (front == "00" or back == "00") or (front > 13 and back >13):
    print("NA")
elif 1 <= int(back) <= 12:
    if 1 <= int() <= 12:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    print("MMYY")

### FIXED CODE ###

s = input()

front = int(s[:2])
back = int(s[2:])

if 1 <= front <= 12:
    if 1 <= back <=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<= back <= 12:
        print("YYMM")
    else:
        print("NA")
def lcm(a, b):
    ax = a
    bx = b
    c = 0
    if a<b:
        ax, bx = (bx, ax)
    while True:
        if ax%bx == 0:
            gcd = bx
            break
        else:
            c = bx
            bx = ax%bx
            ax = c
    return a*b // gcd

n = int(input())
Mx = int(input())
lst = [Mx]
lst2 = []
for i in range(n-1):
    a = int(input())
    if Mx%a != 0:
        lst.append(a)
        lst.sort()
        if Mx<a:
            Mx = a

while True:
    lst2.append(lcm(lst[0], lst[1]))
    lst.pop(0)
    lst.pop(0)
    lst2.extend(lst)
    x = len(lst2)
    if x==1:
        print(lst2[0])
        break
    lst.clear()
        
    lst.append(lcm(lst2[0], lst2[1]))
    lst2.pop(0)
    lst2.pop(0)
    lst.extend(lst2)
    y = len(lst)
    if y==1:
        print(lst[0])
        break
    lst2.clear()

### FIXED CODE ###

def lcm(a, b):
    ax = a
    bx = b
    if a<b:
        ax, bx = (bx, ax)
    while True:
        if ax%bx == 0:
            gcd = bx
            break
        else:
            c = bx
            bx = ax%bx
            ax = c
    return a*b // gcd

n = int(input())
lst = []
lst2 = []
for i in range(n):
    a = int(input())
    lst.append(a)

while True:    
    if n==1:
        print(lst[0])
        break
    lst2.append(lcm(lst[0], lst[1]))
    lst.pop(0)
    lst.pop(0)
    lst2.extend(lst)
    if len(lst2)==1:
        print(lst2[0])
        break
    lst.clear()
        
    lst.append(lcm(lst2[0], lst2[1]))
    lst2.pop(0)
    lst2.pop(0)
    lst.extend(lst2)
    if len(lst)==1:
        print(lst[0])
        break
    lst2.clear()
#入力
N = int.input()
#出力
if N % 10 == 3:
  print('bon')
elif N % 10 == 1:
  print('pon')
elif N % 10 == 6:
  print('pon')
elif N % 10 == 8:
  print('pon')
elif N % 10 == 0:
  print('pon')
else:
  print('hon')

### FIXED CODE ###

x = int(input())
y = x%10
if y == 3:
  print("bon")
elif y == 0:
  print("pon")
elif y == 1:
  print("pon")
elif y == 6:
  print("pon")
elif y == 8:
  print("pon")
else:
  print("hon")
n,m = map(int,input().split())
h = list(map(int,input().split()))

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

ans = []

for i in range(m):
    if h[a[i][0]-1] < h[a[i][1]-1]:
        ans.append(h[a[i][1]-1])
    else:
        if ans.index(h[a[i][0]-1]):
            ans.remove(h[a[i][0]-1])
        ans.append(h[a[i][0]-1])
    
ans = set(ans)

print(len(ans))

### FIXED CODE ###

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

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

ans = []

for i in range(m):
    if h[a[i][0]-1] > h[a[i][1]-1]:
        ans.append(a[i][1])
    elif h[a[i][0]-1] < h[a[i][1]-1]:
        ans.append(a[i][0])
    if h[a[i][0]-1] == h[a[i][1]-1]:
        ans.append(a[i][0])
        ans.append(a[i][1])
        

ans = set(ans)

print(int(len(h)) - int(len(ans)))
#2,3,5

1,4,4
X, A = map(int, input().split())
if X < A:
    print("0")
else:
    print("10")

### FIXED CODE ###

X, A = map(int, input().split())
if X < A:
    print(0)
else:
    print(10)
x=input()
aa=x[:2]
bb=x[3:]
aa=int(aa)
bb=int(bb)
if 0<aa<=12 and bb==0:
	print("MMYY")
if aa==0 and 0<bb<=12:
	print("YYMM")
if 0<aa<=12 and 0<bb<=12:
	print("AMBIGUOUS")
elif 0<aa<=12:
	print("MMYY")
elif 0<bb<=12:
	print("YYMM")
else:
	print("NA")

### FIXED CODE ###

ll=lambda : list(map(int,input().split()))

[n,k]=ll()
s=input()
k-=1
s=list(s)
s[k]=s[k].swapcase()
print("".join(s))
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpln(n)[::-1]
q = deque([])

for i,j in enumerate(a):
  if i == 0:
    q.append(j)
    continue
  c = bisect.bisect_left(q,j)
  if c == 0:
    q.appendleft(j)
  else:
    q[c] = j
    
print(len(q))
  


### FIXED CODE ###

from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpln(n)
q = deque([])

for i,j in enumerate(a):
  if i == 0:
    q.append(j)
    continue
  c = bisect.bisect_left(q,j)
  if c == 0:
    q.appendleft(j)
  else:
    q[c-1] = j
    
print(len(q))
import numpy as np


def main():
    N, M = [int(x) for x in input().split()]
    d = dict()
    for _ in range(M):
        s, c = [int(x) for x in input().split()]
        if s in d and d[s] != c or (s==1 and c==0):
            print(-1)
            return
        d[s] = c
    nums = [0] * N
    for s, c in d.items():
        nums[s-1] = c
    for i in range(min(d.keys())-1):
        nums[i] = 1
    ans = "".join(map(str, nums))
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    N, M = [int(x) for x in input().split()]
    d = dict()
    for _ in range(M):
        s, c = [int(x) for x in input().split()]
        s -= 1
        if s in d and d[s] != c:
            print(-1)
            return
        d[s] = c

    def is_ok(n) -> bool:
        t = str(n)
        if len(t) != N:
            return False
        for s, c in d.items():
            if t[s] != str(c):
                return False
        return True

    for i in range(10**N):
        if is_ok(i):
            print(i)
            return
    print(-1)


if __name__ == '__main__':
    main()
import math
X,Y = map(int,input().split())
def comb(n,r):
    return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
if (X+Y)%3 != 0:
    print(0)
else:
    n = int((2*Y-X)/3)
    m = int((2*X-Y)/3)
    print((comb(n+m,min([n,m])))%(10**9+7))

### FIXED CODE ###

r = int(input())
print(int(r**2))
r = int(input())
print(r**2*3.14, 2*r*3.14)


### FIXED CODE ###

import math
r = float(input())  #入力値が実数の時
print("{0} {1}".format(r**2 * math.pi, 2 * r * math.pi))
# ABC072
# C
# Together
import itertools

n = int(input())
a = [int(i) for i in input().split()]

a.sort()
gr = itertools.groupby(a)
hoge_list = [0]*10001
ans = 0

for key, group in gr:
    hoge_list[key] = len(list(group))

for i in range(1,10000,1):
    _tmp = hoge_list[i-1] + hoge_list[i] + hoge_list[i+1]
    if ans < _tmp:
        ans = _tmp

print(ans)
    

### FIXED CODE ###

# ABC072
# C
# Together
import itertools

n = int(input())
a = [int(i) for i in input().split()]

a.sort()
gr = itertools.groupby(a)
hoge_list = [0]*100001
ans = 0

for key, group in gr:
    hoge_list[key] = len(list(group))

for i in range(1,100000,1):
    _tmp = hoge_list[i-1] + hoge_list[i] + hoge_list[i+1]
    if ans < _tmp:
        ans = _tmp

print(ans)
x = int(input(x?\n))
y = int(input(y?\n))

print(x + y/2)


### FIXED CODE ###

x,y = tuple(map(int,input().split()))

answer = int(x) + int(y)/2

print(int(answer))