Problem:


Score : 200 points

Problem Statement

You have a digit sequence S of length 4. You are wondering which of the following formats S is in:

YYMM format: the last two digits of the year and the two-digit representation of the month (example: 01 for January), concatenated in this order

MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order

If S is valid in only YYMM format, print YYMM; if S is valid in only MMYY format, print MMYY; if S is valid in both formats, print AMBIGUOUS; if S is valid in neither format, print NA.

Constraints

S is a digit sequence of length 4.

Input

Input is given from Standard Input in the following format:

S

Output

Print the specified string: YYMM, MMYY, AMBIGUOUS or NA.

Sample Input 1

1905

Sample Output 1

YYMM

May XX19 is a valid date, but 19 is not valid as a month. Thus, this string is only valid in YYMM format.

Sample Input 2

0112

Sample Output 2

AMBIGUOUS

Both December XX01 and January XX12 are valid dates. Thus, this string is valid in both formats.

Sample Input 3

1700

Sample Output 3

NA

Neither 0 nor 17 is valid as a month. Thus, this string is valid in neither format.



Sample input:
1905


Sample output:
YYMM

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)


def main():
    s = S()
    a = int(s[:2])
    b = int(s[2:])
    af = 1
    if a < 1 or a > 12:
        if b < 1 or b > 12:
            return 'NA'
        return 'YYMM'
    if b < 1 or b > 12:
        return 'MMYY'

    return 'AMBIGUOUS'


print(main())

Submission status: Accepted

Solution code:
s = input()

a = int(s[0:2])
b = int(s[2:])
if 1<=a <= 12 :
    if 1<=b <= 12 :
        print("AMBIGUOUS")
    else :
        print("MMYY")
else:
    if 1<=b<= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
#!/usr/bin/env python

from collections import deque
import itertools as ite
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

S = raw_input()
n1 = int(S[:2])
n2 = int(S[2:])
flag1 = (1 <= n1 <= 12)
flag2 = (1 <= n2 <= 12)
if flag1 and flag2:
    print "AMBIGUOUS"
elif flag1 and not flag2:
    print "MMYY"
elif not flag1 and flag2:
    print "YYMM"
else:
    print "NA"

Submission status: Accepted

Solution code:
S = input()
first = int(S[:2])
last = int(S[2:])
if 1 <= first <= 12 and 1 <= last <= 12:
    print('AMBIGUOUS')
elif 1 <= first <= 12:
    print('MMYY')
elif 1 <= last <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
month = lambda x: 1 <= x <= 12

S = input()
a,b = int(S[:2]), int(S[2:])

if month(a) and month(b):
    print('AMBIGUOUS')
elif month(a):
    print('MMYY')
elif month(b):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
x, y = int(s[:2]), int(s[2:])
a = 1 <= x <= 12
b = 1 <= y <= 12
if a ^ b:
    print("MMYY" if a else "YYMM")
else:
    print("AMBIGUOUS" if a else "NA")

Submission status: Accepted

Solution code:
S = input()
a = int(S[:2]); b = int(S[2:])
if 0 < a <= 12 and 0 < b <= 12:
    print("AMBIGUOUS")
elif 0 < a <= 12:
    print("MMYY")
elif 0 < b <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s=input()
a=int(s[:2])
b=int(s[2:])
j1=1<=a<=12
j2=1<=b<=12
if j1 and j2:
    print("AMBIGUOUS")
elif j1 and not j2:
    print("MMYY")
elif not j1 and j2:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
s1 = int(S[0:2])
s2 = int(S[2:4])


if s1 >= 1 and s1 <= 12 and s2 >= 1 and s2 <= 12:
    print("AMBIGUOUS")
elif s2 >= 1 and s2 <= 12 and s1 >= 1 and s1 <= 12:
    print("AMBIGUOUS")
elif s1 >= 0 and s1 <= 99 and s2 >= 1 and s2 <= 12:
    print("YYMM")
elif s2 >= 0 and s2 <= 99 and s1 >= 1 and s1 <= 12:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:

def read_input():
    s = input()
    former = s[:2]
    latter = s[2:]
    return int(former), int(latter)


def can_month(x):
    return 1 <= x <= 12


def submit():
    f, l = read_input()

    if can_month(f) and can_month(l):
        print('AMBIGUOUS')
        return

    if can_month(f):
        print('MMYY')
        return

    if can_month(l):
        print('YYMM')
        return

    print('NA')

if __name__ == '__main__':
    submit()

Submission status: Accepted

Solution code:
S = input()

mae = int(S[0:2])
ushiro = int(S[2:])

if mae < 13 and mae > 0:

    if ushiro < 13 and ushiro > 0:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if ushiro < 13 and ushiro > 0:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
# from sys import exit
# N = int(input())
# a = [int(input()) for _ in range(N)]
S = str(input())
L = len(S)
# T = str(input())
# exit()
# print(S[2:])
YYMM = 0 < int(S[2:]) <= 12

# print(S[:2])
MMYY = 0 < int(S[:2]) <= 12
if MMYY & YYMM:
    print("AMBIGUOUS")
elif not (MMYY or YYMM):
    print("NA")
else:
    print("YYMM" if YYMM else "MMYY")
# if(S[2:])

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    S = SI()
    a = int(S[:2])
    b = int(S[2:])
    if 1 <= a <= 12 and 1 <= b <= 12:
        ans = 'AMBIGUOUS'
    elif 1 <= a <= 12:
        ans = 'MMYY'
    elif 1 <= b <= 12:
        ans = 'YYMM'
    else:
        ans = 'NA'
    return ans

print(main())

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def local_input():# {{{
    from pcm.utils import set_stdin
    import sys
    from pathlib import Path
    parentdir = Path(os.path.dirname(__file__)).parent
    inputfile = parentdir.joinpath('test/sample-1.in')
    if len(sys.argv) == 1:
        set_stdin(inputfile)
# }}}

def solve():
    s = input()
    a = int(s[0:2])
    b = int(s[2:4])
    dump(a,b)

    if (1 <= a <= 12 and 1 <= b <= 12):
        print("AMBIGUOUS")
    elif (1 <= a <= 12):
        print("MMYY")
    elif (1 <= b <= 12):
        print("YYMM")
    else:
        print("NA")

    return 0

if __name__ == "__main__":# {{{
    try:
        local_input()
        def dump(*args):
            names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
            print(', '.join(names.get(id(arg),'???')+' => '+repr(arg) for arg in args), file=sys.stderr)
    except:
        def dump(*args):
            pass

    solve()

# vim: set foldmethod=marker:}}}

Submission status: Accepted

Solution code:


from math import *




s=input()

if(0<int(s[2:])<13 and 0<int(s[0:2])<13):
	print("AMBIGUOUS")
elif(0<int(s[2:])<13):
	print("YYMM")
elif(0<int(s[0:2])<13):
	print("MMYY")
else:
	print("NA")

Submission status: Accepted

Solution code:
s =input()
a=int(s[:2])
b=int(s[2:])
if a>0 and a<=12:
    if b>0 and b<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if b>0 and b<=12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S = input()
a = S[:2]
b = S[2:]
if "01" <= a <= "12":
    if "01" <= b <= "12":
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if "01" <= b <= "12":
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input().strip()
a, b = int(S[:2]), int(S[2:])
if 1 <= a <= 12:
    if 1 <= b <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= b <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
import atexit
import io
import sys

buff = io.BytesIO()
sys.stdout = buff


@atexit.register
def write():
    sys.__stdout__.write(buff.getvalue())


s = raw_input()
x = int(s[0] + s[1])
y = int(s[2] + s[3]) 
if x >= 1 and x <= 12:
	if y >= 1 and y <= 12:
		print 'AMBIGUOUS'
	else:
		print 'MMYY'
else:
	if y >= 1 and y <= 12:
		print 'YYMM'
	else:
		print 'NA'

Submission status: Accepted

Solution code:


def main():
    S = input()

    n1, n2 = int(S[:2]), int(S[-2:])

    mmyy = 1 <= n1 <= 12
    yymm = 1 <= n2 <= 12

    if mmyy and yymm:
        print("AMBIGUOUS")
    elif mmyy:
        print("MMYY")
    elif yymm:
        print("YYMM")
    else:
        print("NA")



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
# input = sys.stdin.readline
inf = 10 ** 18

S = input()

aa = int(S[:2])
bb = int(S[2:])

flag = 0b00
if 1 <= aa <= 12:
    flag += 0b01
if 1 <= bb <= 12:
    flag += 0b10

if flag == 0b00:
    print('NA')
elif flag == 0b01:
    print('MMYY')
elif flag == 0b10:
    print('YYMM')
else:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
S = input()
a = int(S[:2])
b = int(S[2:])
ret = ""
if 1 <= a and a <= 12 and 1 <= b and b <= 12:
    ret = "AMBIGUOUS"
elif 1 <= a and a <= 12:
    ret = "MMYY"
elif 1 <= b and b <= 12:
    ret = "YYMM"
else:
    ret = "NA"
print(ret)

Submission status: Accepted

Solution code:
s = input()
a, b = int(s[:2]), int(s[2:])

ma = 1 <= a <= 12
mb = 1 <= b <= 12

if ma and mb:
  print("AMBIGUOUS")
elif ma:
  print("MMYY")
elif mb:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = int(input())
a = s // 100
b = s % 100
if 0 < a <= 12 and 0 < b <= 12:
    print('AMBIGUOUS')
elif 0 < a <= 12:
    print('MMYY')
elif 0 < b <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-

def is_YY(s):
    if int(s) >= 0 and int(s) <= 99:
        return True
    return False

def is_MM(s):
    if int(s) >= 1 and int(s) <= 12:
        return True
    return False

def solve():
    S = input()
    upper = S[0:2]
    lower = S[2:]
    if is_YY(upper) and is_MM(lower):
        if is_YY(lower) and is_MM(upper):
            print("AMBIGUOUS")
            return
        print("YYMM")
    elif is_YY(lower) and is_MM(upper):
        print("MMYY")
    else:
        print("NA")


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
a = input()

mm = a[:2]
yy = a[2:]

x = int(mm)
y = int(yy)

xm = False
ym = False

if x > 0 and x <= 12:
    xm = True
if y > 0 and y <= 12:
    ym = True

if xm and ym:
    print("AMBIGUOUS")
elif xm:
    print("MMYY")
elif ym:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
def solve(S):
    L = S[:2]
    R = S[2:]

    if 1 <= int(L) <= 12 and 1 <= int(R) <= 12:
        return "AMBIGUOUS"
    if 1 <= int(L) <= 12:
        return "MMYY"
    if 1 <= int(R) <= 12:
        return "YYMM"
    return "NA"


if __name__ == "__main__":
    S = input()
    print(solve(S))

Submission status: Accepted

Solution code:
S = input()
yymm = "01" <= S[2:4] <= "12"
mmyy = "01" <= S[0:2] <= "12"
if yymm and mmyy:
    print("AMBIGUOUS")
elif yymm:
    print("YYMM")
elif mmyy:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = raw_input()
YYMM = 1<=int(S[2:])<=12
MMYY = 1<=int(S[:2])<=12

if YYMM and not MMYY:
  print "YYMM"
if not YYMM and MMYY:
  print "MMYY"
if YYMM and MMYY:
  print "AMBIGUOUS"
if not YYMM and not MMYY:
  print "NA"

Submission status: Accepted

Solution code:
def can_be_month(n):
    return 1 <= n <= 12


s = input().strip()
f = int(s[:2])
l = int(s[2:])

if can_be_month(f):
    print('AMBIGUOUS' if can_be_month(l) else 'MMYY')
else:
    print('YYMM' if can_be_month(l) else 'NA')

Submission status: Accepted

Solution code:
s=input();a,b=int(s[0:2]),int(s[2:4])
a=0<a<13
b=0<b<13
if a and b:print("AMBIGUOUS")
elif not(a or b):print("NA")
elif b:print("YYMM")
else:print("MMYY")

Submission status: Accepted

Solution code:
S = input()
a = int(S[:2])
b = int(S[2:])
if (a > 12 or a < 1) and (b > 12 or b < 1):
    print('NA')
elif a > 12 or a < 1:
    print('YYMM')
elif b > 12 or b < 1:
    print('MMYY')
else:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

def is_m(n):
    if n > 0 and n < 13:
        return True
    return False


def solve(S: str):
    a = int(S[:2])
    b = int(S[2:])
    if is_m(a) and not is_m(b):
        ret = 'MMYY'
    elif not is_m(a) and is_m(b):
        ret = 'YYMM'
    elif is_m(a) and is_m(b):
        ret = 'AMBIGUOUS'
    else:
        ret = 'NA'
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  # type: int
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=list(map(int, list(input())))
if 0<s[0]*10+s[1]<=12:
    if 0<s[2]*10+s[3]<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0<s[2]*10+s[3]<=12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
a,b,c,d=input()
x,y=int(a+b),int(c+d)
if 0 < x < 13 and 0 < y < 13:
	print("AMBIGUOUS")
elif 0 < x < 13:
	print("MMYY")
elif 0 < y < 13:
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

Solution code:
S=int(input())
m=S%100
n=S//100
if 0<m<=12:
    if 0<n<=12:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if 0<n<=12:
        print('MMYY')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = list(map(int, list(input())))
one, two = False, False
if 0 < s[0]*10 + s[1] <= 12:
	one = True
if 0 < s[2]*10 + s[3] <= 12:
	two = True
if one and two:
	print("AMBIGUOUS")
elif one:
	print("MMYY")
elif two:
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
S = input()

a, b = S[:2], S[2:]
a = int(a)
b = int(b)
if 0 < a and a <= 12 and 0 < b and b <= 12:
    print('AMBIGUOUS')
elif 0 < b and b <= 12:
    print('YYMM')
elif 0 < a and a <= 12:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = str(input())
mm = [i for i in range(1,13)]

if int(s[0]+s[1]) in mm:
    if int(s[2]+s[3]) in mm:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif int(s[2]+s[3]) in mm:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

sys.setrecursionlimit(10000)
INF = float('inf')

S = input()

m = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']

if S[:2] in m and S[2:] not in m:
    print('MMYY')
elif S[:2] not in m and S[2:] in m:
    print('YYMM')
elif S[:2] in m and S[2:] in m:
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
import math

import array
import bisect
import collections
from collections import Counter, defaultdict
import fractions
import heapq
import re

sys.setrecursionlimit(1000000)


def array2d(dim1, dim2, init=None):
    return [[init for _ in range(dim2)] for _ in range(dim1)]

def argsort(l, reverse=False):
    return sorted(range(len(l)), key=lambda i: l[i], reverse=reverse)

def argmin(l):
    return l.index(min(l))

def YESNO(ans, yes="YES", no="NO"):
    print([no, yes][ans])

II = lambda: int(input())
MI = lambda: map(int, input().split())
MIL = lambda: list(MI())
MIS = lambda: input().split()


def main():
    s = input()
    y, m = int(s[:2]), int(s[2:])
    if 1 <= y <= 12 and 1 <= m <= 12:
        return "AMBIGUOUS"
    if 1 <= y <= 12:
        return "MMYY"
    if 1 <= m <= 12:
        return "YYMM"
    return "NA"


if __name__ == "__main__":
    print(main())

Submission status: Accepted

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

S = input()[:-1]
zenhan = S[:2]
kouhan = S[2:]

if 0 < int(zenhan) < 13:
    if 0 < int(kouhan) < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < int(kouhan) < 13:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()
if 1 <= int(s[2:]) <= 12:
    if 1 <= int(s[0:2]) <= 12:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if 1 <= int(s[0:2]) <= 12:
        print('MMYY')
    else:
        print('NA')

Submission status: Accepted

Solution code:
import itertools
import math
from collections import defaultdict

def input_ints():
    return list(map(int, input().split()))

def solve():
    s = input()
    x = int(s[:2])
    y = int(s[2:])
    ans = 0
    if 1 <= x <= 12:
        ans |= 1
    if 1 <= y <= 12:
        ans |= 2
    print(['NA', 'MMYY', 'YYMM', 'AMBIGUOUS'][ans])

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
#
import itertools
from collections import Counter
from collections import defaultdict
import bisect

def main():
    s = input()
    front = int(s[0:2])
    back = int(s[2:4])
    if 0 < front < 13:  # front can be month
        if 0 < back < 13: # back can be month
            print('AMBIGUOUS')
        else: # back can not be month
            print('MMYY')
    else: # front can not be month
        if 0 < back < 13: # back can be month
            print('YYMM')
        else: # back can not be month
            print('NA')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
a = int(S[0:2])
b = int(S[2:4])

hoge = (1 <= a <= 12)
fuga = (1 <= b <= 12)
if hoge and fuga:
    print("AMBIGUOUS")
elif not hoge and not fuga:
    print("NA")
elif fuga:
    print("YYMM")
else:
    print("MMYY")

Submission status: Accepted

Solution code:
S = input()
A, B = int(S[:2]), int(S[2:])
a = False
if 1<=A<=12:
    a = True
b = False
if 1<=B<=12:
    b = True
if a and b:
    print("AMBIGUOUS")
elif a:
    print("MMYY")
elif b:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()

a = 0
if 1 <= int(s[0:2]) <= 12:
    a += 1
if 1 <= int(s[2:]) <= 12:
    a += 2

print(["NA", "MMYY", "YYMM", "AMBIGUOUS"][a])

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(20000000)
#input = sys.stdin.readline
s = input()
a = s[:2]
b = s[2:]
a = int(a)
b = int(b)
if 0<int(a) and int(a) <= 12 and 0<b and b <= 12:
    print("AMBIGUOUS")
elif 0<int(a) and int(a) <= 12:
    print("MMYY")
elif 0<b and b <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys


def is_yymm(S):
    return 1 <= int(S[2:]) <= 12

def is_mmyy(S):
    return 1 <= int(S[:2]) <= 12

S = input()
if is_yymm(S):
    if is_mmyy(S):
        print('AMBIGUOUS')
    else:
        print('YYMM')
elif is_mmyy(S):
    if is_yymm(S):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
a = int(S[:2])
b = int(S[2:])
if 1 <= a <= 12:
    if 1 <= b <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= b <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()
a,b = int(s[:2]), int(s[2:])
c = 1<=a<=12
d = 1<=b<=12
if c and d:
    print('AMBIGUOUS')
elif c:
    print('MMYY')
elif d:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
a = int(s[:2])
b = int(s[2:])
af = 1 <= a and a <= 12
bf = 1 <= b and b <= 12
if af and not bf:
    print('MMYY')
elif not af and bf:
    print('YYMM')
elif af and bf:
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = int(input())
a = s//100
b = s%100
if 1<=a<=12 and 1<=b<=12:
    print("AMBIGUOUS")
elif 1<=a<=12:
    print("MMYY")
elif 1<=b<=12:
    print("YYMM")
else:
    print("NA")

Submission status: Runtime Error

Solution code:
def f(y, m):
	if y in range(1, 13) and m in range(1, 13):
      return "AMBIGUOUS"
    if m in range(1, 13):
      return "YYMM"
    if y in range(1, 13):
      return "MMYY"
    return "NA"
  
S = input()
y, m = int(S[:2]), int(S[2:])
print(f(y, m))

Submission status: Runtime Error

Solution code:
S = input()

month = ["{:02}".format(x) for x in range(1,13)]
years = ["{:02}".format(x) for x in range(0,99)]

ans = 'NA'

S_0 = S[:2]
S_1 = S[2:]

ans_flg = [[False, False], [False, False]]

if S_0 in month:
    ans_flg[0][0] = True
if S_0 in years:
    ans_flg[0][1] = True
if S_1 in month:
    ans_flg[1][0] = True
if S_1 in years:
    ans_flg[1][1] = True

print(S)
print(ans_flg)
if sum(ans_flg[0]) == 0 or sum(ans_flg[0]) == 0:
    ans = 'NA'
elif sum(ans_flg) == 4:
    ans = 'AMBIGUOUS'
elif ans_flg[0] == 1:
    ans = 'MMYY'
else:
    ans = 'YYMM'
print(ans)

Submission status: Runtime Error

Solution code:
s = input()

b = int(s[:2])
a = int(s[2:])

print(b)
print(a)

def yorm(i):
    flag = 'none'
    if 0<i<12:
        flag = 'MM'
    elif i<100:
        flag = 'YY'
    return flag
   
ans = bf+af
if len(ans) != 4:
    ans = 'NA'
if ans == 'MMMM':
    ans = 'AMBIGUOUS'
if ans == 'YYYY':
    ans = 'NA'
print(ans)

Submission status: Runtime Error

Solution code:
a=input(a)
b=int(a[0]+a[1])
c=int(a[2]+a[3])
if 1<=b<=12 and 1<=c<=12:
  print("AMBIGUOUS")
elif b>12:
  if c>12:
    print("Na")
  elif 1<=c<=12:
    print("YYMM")
elif c>12:
  if b>12:
    print("Na")
  elif 1<=b<=12:
    print("MMYY")
else:
  print("NA")

Submission status: Runtime Error

Solution code:
s=input()

if 12<int(s[:2]):
    if 12>=int(s[2:])>=1:
        print("YYMM")
    else:
        print("NA")
else:
    if 12>=int(s[2:])>=1:
        print("AMBIGUOUS")
    elif 12<s[2:]:
        print("MMYY")

Submission status: Runtime Error

Solution code:
n = list(map(int,input().split()))
if n[0][0:2] in range(1,100) and n[0][3] in range(1,13):
  print('YYMM')
elif n[0][1] in range(1,13) and n[0][2:] in range(1,100):
  print('MMYY')
elif n[0][1] or n[0][0:2] in range(1,13) and n[0][2:] in range(1,13):
  print('AMBIGUOUS')
else:
  print('NA')

Submission status: Runtime Error

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

s=int(input())
a=s//100
b=s%100
if (a==0 or a>12) and (b==0 or b>12):
    print("Na")
elif (a==0 or a>12):
    print("YYMM")
elif (b==0 or b>12):
    p12rint("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Runtime Error

Solution code:
if (a==0 and b==0) or (a>=13 and b>=13):
  print("NA")
elif 0<a<=12 and 0<a<=12:
  print("AMBIGUOUS")
elif 0<a<12:
  print("MMYY")
else:
  print("YYMM")

Submission status: Runtime Error

Solution code:
s = str(input())
ans = ['YYMM','MMYY','AMBIGUOUS','NA']
#print(s[:2],s[-2:])
if (0==int(s[:2]) or 13<=int(s[:2])) and (0==int(s[-2:]) or 13<=int(s[-2:])):
    print(ans[4])
if 0<int(s[:2])<=12 and 0<int(s[-2:])<=12:
    print(ans[3])
elif 0<int(s[:2])<=12:
    print(ans[2])
elif 0<int(s[-2:])<=12:
    print(ans[1])

Submission status: Runtime Error

Solution code:
s = str(input())
ans = ['YYMM','MMYY','AMBIGUOUS','NA']
#print(s[:2],s[-2:])
if 0<int(s[:2])<=12 and 0<int(s[-2:])<=12:
    print(ans[3])
elif 0<int(s[:2])<=12:
    print(ans[2])
elif 0<int(s[-2:])<=12:
    print(ans[1])
else:
    print(ans[4])

Submission status: Runtime Error

Solution code:
s = str(input())
ans = ['YYMM','MMYY','AMBIGUOUS','NA']
#print(s[:2],s[-2:])
if 0<int(s[:2])<=12 and 0<int(s[-2:]<=12:
    print(ans[3])
elif 0<int(s[:2])<=12:
    print(ans[2])
elif 0<int(s[-2:])<=12:
    print(ans[1])
else:
    print(ans[4])

Submission status: Runtime Error

Solution code:
s=str(input())
x=s[0]+s[1]
y=s[2]+s[3]
x=int(x)
y=int(y)
if x==0 or y==0:
    ans="NA"
if 0<x<13:
    if 0<y<13:
        ans="AMBIGUOUS"
    elif y>=13:
        ans="MMYY"
        
elif x>=13:
    if 0<y<13:
        ans="YYMM"
    else:
        "NA"
print(ans)

Submission status: Runtime Error

Solution code:
s = input()

n1 = s[0:2]
n2 = s[2:4]

if int(n1) > 12 and int(n2) > 12:
  out_print = 'NA'

  elif int(n1) <= 12 and int(n2) <= 12:
    out_print = 'AMBIGUOUS'
    if int(n1) == 0:
      out_print = 'YYMM'
      elif int(n2) == 0:
        out_print = 'MMYY'
        elif int(n1)==0 and int(n2)==0:
          out_print = 'NA'
          elif int(n1) <= 12 and int(n2) >12:
            out_print = 'MMYY'
            if int(n1) == 0:
              out_print = 'NA'

              elif int(n1) > 12 and int(n2) <= 12:
                out_print = 'YYMM'
                if int(n2) == 0:
                  out_print = 'NA'
                  print(out_print)

Submission status: Runtime Error

Solution code:

s = input()

n1 = s[0:2]
n2 = s[2:4]

if int(n1) > 12 and int(n2) > 12:
    out_print = 'NA'

elif int(n1) <= 12 and int(n2) <= 12:
    out_print = 'AMBIGUOUS'
    if int(n1) == 0:
        out_print = 'YYMM'
    elif int(n2) == 0:
        out_print = 'MMYY'
    elif int(n1)==0 and int(n2)==0
        out_print = 'NA'
elif int(n1) <= 12 and int(n2) >12:
    out_print = 'MMYY'
    if int(n1) == 0:
        out_print = 'NA'

elif int(n1) > 12 and int(n2) <= 12:
    out_print = 'YYMM'
    if int(n2) == 0:
        out_print = 'NA'

print(out_print)

Submission status: Runtime Error

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

n = int(input())
a = []
for i in range(n):
    s, p = map(str, input().split())
    p = int(p)
    a.append((s,p,i+1))
# 要素[1]を逆ソート
a.sort(key=lambda x:x[1], reverse=True)
# 要素[0]を順ソート
a.sort(key=lambda x:x[0])

for i in range(n):
    print(a[i][2])

Submission status: Runtime Error

Solution code:
s = input()
a = int(s[:2])
b = int(s[2:])
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if a<=12 and b<=12:
    print('AMBIGUOUS')
elif 0<a<=12 and 0<b<=days[a]:
    print('YYMM')
elif 0<b<=12 and 0<a<=days[b]:
    print('MMYY')
else:
    print('NA')

Submission status: Runtime Error

Solution code:
s = input()
a = int(s[:2])
b = int(s[2:])
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if a<=12 and b<=12:
    print('AMBIGUOUS')
elif a<=12 and b<=days[a]:
    print('YYMM')
elif b<=12 and a<=days[b]:
    print('MMYY')
else:
    print('NA')

Submission status: Runtime Error

Solution code:
s = raw_input()

a = int(s[:2])
b = int(s[2:])

if 0<a<13:
    if 0<b<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if -1<b<13:
        print("YYMM")
    else:
        print("NA")

Submission status: Runtime Error

Solution code:
S = input()
f = int(S[0]+S[1])
b = int(S[2]+S[3])

def judge(int):
    if 1 <= int <= 12
        return 0
    else:
        return 1
ref = [judge(f), judge(b)]

if ref == [1, 1]:
    print("NA")
elif ref == [0, 1]:
    print("MMYY")
elif ref == [1, 0]:
    print("YYMM")
else:
    print("AMBIGUOUS")

Submission status: Runtime Error

Solution code:
s = input()
s_f = int(s[0]+s[1])
s_b = int(s[2]+s[3])

#print(s_f)
#print(s_b)
if s_f==0 or s_b==0:
    print('NA')
elif s_f<=12 and s_b<=12:
    print("AMBIGUOUS")
elif s_f<=12 and s_b>12:
    print('MMYY')
elif s_f>12 and s_b<=12:
    print('YYMM')
elif s_f>12 and s_b>12
    print('NA')

Submission status: Runtime Error

Solution code:
s = input()
n1 = int(s[:2])
n2 = int(s[2:])
if 1 <= n1 <= 12 and 1 <= n2 <= 12:
  print("AMBIGUOUS)
elif (n1 > 12 or n1 == 0) and 1 <= n2 <= 12:
  print("YYMM")
elif (n2 > 12 or n2 == 0) and 1 <= n1 <= 12:
  print("MMYY")
else:
  print("NA")

Submission status: Runtime Error

Solution code:
s = input()
f = int(s[0]+s[1])
l = int(s[2]+s[3])
if 1<= f <= 12:
    if 1<= l <= 12:
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"
if (f == 0) or (f>13):
    if 1<= l <= 12:
        ans = "YYMM"
    else:
        ans = "NA"
print(ans)

Submission status: Runtime Error

Solution code:
N=int(input(" "))
Y=N%100
M=N//100
if M>11:
    print("YYMM")
elif Y>11:
elif M<13:
    print("AMBIGUOUS")

Submission status: Runtime Error

Solution code:
s = input()
if s[:2] == '00' or s[2:] == '00':
    print('NA')
elif s[:2] > 12 and 0 <= s[2:] <= 12:
    print('YYMM')
elif 0 <= s[:2] <= 12 and 0 <= s[2:] <= 12:
    print('AMBIGUOUS')
else:
    print('MMYY')

Submission status: Runtime Error

Solution code:
x = list(input())
first = 10 * int(x[0]) + int(x[1])
second = 10 * int(x[2]) + int(x[3])


def mc(num):
    if 1 <= num <= 12:
        return True
    else:
        return False


def yc(num):
    if 1 <= num <= 99:
        return True
    else:
        return False


if yc(first):
    if mc(second):
        if yc(second):
            if mc(first):
                print("AMBIGUOUS")
            else:
                print("YYMM")
        else:
            print("YYMM")
    elif yc(second):
        if mc(first):
            print("MMYY")
        else:
            print("NA")
    else:
        pirnt("NA")
elif yc(second):
    if mc(first):
        print("MMYY")
    else:
        print("NA")
else:
    print("NA")