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:
S=input()
ym=False
my=False
if 1<=int(S[0:2])<=12:
    my=True
if 1<=int(S[2:4])<=12:
    ym=True
if my and ym:
    print('AMBIGUOUS')
elif my:
    print('MMYY')
elif ym:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
s1 = int(s[:2])
s2 = int(s[2:])

# 01 <= s <= 12 なら MM
# 00 <= s <= 99 なら YY (実質無制限)

# どちらかがMMであるか確かめる
mm_like = [1 <= s <= 12 for s in [s1, s2]]
# print(mm_like)

if mm_like == [True, False]:
    print("MMYY")
elif mm_like == [False, True]:
    print("YYMM")
elif mm_like == [True, True]:
    print("AMBIGUOUS")
elif mm_like == [False, False]:
    print("NA")

Submission status: Accepted

Solution code:
s = list(input())
f = int(''.join(s[0:2]))
b = int(''.join(s[2:]))
if f == 0:
    if b == 0:
        print('NA')
    elif b > 13:
        print('NA')
    else:
        print('YYMM')
elif b == 0:
    if f > 13:
        print('NA')
    else:
        print('MMYY')
elif 1<=f<=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 = int(S[:2])
b = int(S[2:])

def isMM(num):
    return 1 <= num <= 12 

if isMM(a):
    if isMM(b):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if isMM(b):
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
#
# abc126 f
#


def main():
    s = input()
    a = int(s[:2])
    b = int(s[2:])
    if b == 0:
        if a > 12 or a == 0:
            print("NA")
        else:
            print("MMYY")
    elif b > 12:
        if a > 12 or a == 0:
            print("NA")
        else:
            print("MMYY")
    else:
        if a > 12 or a == 0:
            print("YYMM")
        else:
            print("AMBIGUOUS")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=int(input())
a=s//100
b=s-a*100
res=0
wes=0
if a==0 or a>12:
    res=1
if b==0 or b>12:
    wes=1
if res==1 and wes==1:
    print("NA")
if res==0 and wes==1:
    print("MMYY")
if res==1 and wes==0:
    print("YYMM")
if res==0 and wes==0:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S = input()

u = S[0] + S[1]
l = S[2] + S[3]

u = int(u)
l = int(l)

if (0 < u <= 12) :
	if (0 < l <= 12) : 
		print ("AMBIGUOUS")
	else:
		print ("MMYY")
else:
	if (0 < l <= 12) :
		print ("YYMM")
	else:
		print ("NA")

Submission status: Accepted

Solution code:
s=input()

a=s[:2]
b=s[2:]

#print(a,b)

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

ans=""
if a in mo:
  if b in mo:
    ans="AMBIGUOUS"
  else:
    ans="MMYY"
else:
  if b in mo:
    ans="YYMM"
  else:
    ans="NA"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

S = raw_input()

if 0 < int(S[0:2]) < 13:
    if  0 < int(S[2:4]) < 13:
        print "AMBIGUOUS"
    else:
        print "MMYY"
else:
    if  0 < int(S[2:4]) < 13:
        print "YYMM"
    else:
        print "NA"

Submission status: Accepted

Solution code:
#!/usr/bin/env python
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()
s0 = int(s[:2])
s1 = int(s[2:])

is_s0 = 1 <= s0 and s0 <= 12
is_s1 = 1 <= s1 and s1 <= 12

if is_s0==True and is_s1==True:
    print('AMBIGUOUS')
elif is_s0==True and is_s1==False:
    print('MMYY')
elif is_s0==False and is_s1==True:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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


def solve(S: str):
    p1 = int(S[:2])
    p2 = int(S[2:])

    if(0 < p1 <= 12 and 0 < p2 <= 12):
        print('AMBIGUOUS')
    elif(0 < p1 <= 12 and (p2 == 0 or p2 > 12)):
        print('MMYY')
    elif((p1 == 0 or p1 > 12) and 0 < p2 <= 12):
        print('YYMM')
    else:
        print('NA')

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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 = input()
front = int(s[:2])
back = int(s[2:])

# MM 01 ~ 12
# YY 00 ~ 99

def withinMonths(num):
  if (num >= 1 and num <= 12):
    return True
  else:
    return False

if (withinMonths(front) and withinMonths(back)):
  print("AMBIGUOUS")
elif (withinMonths(front) and not withinMonths(back)):
  print("MMYY")
elif (not withinMonths(front) and withinMonths(back)):
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
#YYMM, MMYY
S = input()

mae = S[:2]
ato = S[-2:]

is_MM = (int(mae) >= 1 and int(mae) <= 12) * 10 + (int(ato) >= 1 and int(ato) <= 12)

if is_MM == 11:
  print('AMBIGUOUS')
elif is_MM == 10:
  print('MMYY')
elif is_MM == 1:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

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


def mm(s):
    return re.match(r'01|02|03|04|05|06|07|08|09|11|12', s)


def solv(s):
    a = s[0:2]
    b = s[2:]
    if mm(a):
        if mm(b):
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if mm(b):
            return 'YYMM'
        else:
            return 'NA'


if __name__ == '__main__':

    s = input()
    ans = solv(s)

    print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun May 19 21:11:48 2019

@author: Yamazaki Kenichi
"""

S = input()

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

if a > 0 and a <= 12:
    if b > 0 and b <= 12:
        ans = 'AMBIGUOUS'
    else:
        ans = 'MMYY'
else:
    if b > 0 and b <= 12:
        ans = 'YYMM'
    else:
        ans = 'NA'
print(ans)

Submission status: Accepted

Solution code:
S = input()

YYMM = MMYY = False
if 1 <= int(S[:2]) <= 12:
    MMYY = True
if 1 <= int(S[2:]) <= 12:
    YYMM = True

ans = "NA"
if YYMM and MMYY:
    ans = "AMBIGUOUS"
elif YYMM:
    ans = "YYMM"
elif MMYY:
    ans = "MMYY"
print(ans)

Submission status: Accepted

Solution code:
i=input()
l,m=map(int,[i[:2],i[2:]])
my=int(1<=l and l<=12)
ym=int(1<=m and m<=12)<<1
print(["NA","MMYY","YYMM","AMBIGUOUS"][my+ym])

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

s = input()


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


aY=0
bY=0
aM=0
bM=0
if 1 <= a <= 12:
    aM=1
if 1 <= b <= 12:
    bM=1

if a==0:
#    print(a,b,"a0")
    if bM==1:
        print("YYMM")
    else:
        print("NA")
elif b==0:
#    print(a,b,"b0")
    if aM==1:
        print("MMYY")
    else:
        print("NA")
else:
    if aM == 1 and bM==1:
       print("AMBIGUOUS")
    elif aM == 1:
       print("MMYY")
    elif bM == 1:
       print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s=input()

s1=s[0:2]
s2=s[2:4]

if 1 <= int(s1) <= 12 and 1 <= int(s2) <= 12:
  print('AMBIGUOUS')
elif 1 <= int(s2) <= 12 and not 1 <= int(s1) <= 12:
  print('YYMM')
elif 1 <= int(s1) <= 12 and not 1 <= int(s2) <= 12:
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
input = sys.stdin.readline
 
# bisect_left(lists, 3)
# bisect_right(lists, 3)
 
def main():
	#N, K = map(int, input().split(" "))
	S = input()
	S = S[:-1]
	S = list(S)

	fst_han = 0
	fst_str = S[:2]
	tmp = ""
	for i in fst_str:
		tmp += i
	fst = int(tmp)

	snd_han = 0
	snd_str = S[2:]
	tmp = ""
	for i in snd_str:
		tmp += i
	snd = int(tmp)

	if fst > 0 and fst < 13:
		fst_han = 1
	if snd > 0 and snd < 13:
		snd_han = 1
	
	if fst_han == 1 and snd_han == 1:
		print("AMBIGUOUS")
	elif fst_han == 1 and snd_han == 0:
		print("MMYY")
	elif fst_han == 0 and snd_han == 1:
		print("YYMM")
	else:
		print("NA")
	#print("{} {}".format(fst, snd))

		

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
a = input()
b, c = '01' <= a[:2] <= '12', '01' <= a[2:] <= '12'

if b and c:
    answer = 'AMBIGUOUS'
elif not(b or c):
    answer = 'NA'
elif b:
    answer = 'MMYY'
elif c:
    answer = 'YYMM'
print(answer)

Submission status: Accepted

Solution code:
s=input()
s01=int(s[0])*10+int(s[1])
s23=int(s[2])*10+int(s[3])
if (0<s01<13)and(0<s23<13):
    print("AMBIGUOUS")
elif 0<s01<13:
    print("MMYY")
elif 0<s23<13:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()
s1 = int(s[:2])
s2 = int(s[2:])
yymm = False
mmyy = False

if 1 <= s1 <= 12:
  mmyy = True
if 1 <= s2 <= 12:
  yymm = True

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

Submission status: Accepted

Solution code:
S = input()

AA = int(S[:2])
BB = int(S[2:])

if 0 < AA and AA <= 12 and (12 < BB or BB == 0):
    print('MMYY')
elif 0 < BB and BB <= 12 and (12 < AA or AA == 0):
    print('YYMM')
elif 0 < AA and AA <= 12 and 0 < BB and BB <= 12:
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

Solution code:
S=input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    s = input()
    s1, s2 = s[:2], s[2:]
    if int(s1) in range(1, 13):
        if int(s2) in range(1, 13):
            result = "AMBIGUOUS"
        else:
            result = "MMYY"
    else:
        if int(s2) in range(1, 13):
            result = "YYMM"
        else:
            result = "NA"

    print(result)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
p = S[0:2]
q = S[2:4]

p = int(p)
q = int(q)

p_year_flag = 0
p_month_flag = 0
q_year_flag = 0
q_month_flag = 0

if 1 <= p and p <= 12:
    p_month_flag = 1

if 0 <= p and p <= 99:
    p_year_flag = 1
    
if 1 <= q and q <= 12:
    q_month_flag = 1
    
if 0 <= q and q <= 99:
    q_year_flag = 1
    
YYMM_flag = 0
MMYY_flag = 0

if p_year_flag == 1 and q_month_flag == 1:
    YYMM_flag = 1
if p_month_flag == 1 and q_year_flag == 1:
    MMYY_flag = 1
    
if YYMM_flag == 1 and MMYY_flag == 1:
    print('AMBIGUOUS')
    
elif YYMM_flag == 1:
    print('YYMM')
    
elif MMYY_flag == 1:
    print('MMYY')
    
else:
    print('NA')

Submission status: Accepted

Solution code:
def is_month(s):
    if s[0] == "1":
        if s[1] == "0" or s[1] == "1" or s[1] == "2":
            return True
    elif s[0] == "0":
        if s[1] == "0":
            return False
        else:
            return True
    return False


def is_year(s):
    return True


S = input()

s0 = S[:2]
s1 = S[2:]

is_mmyy = False
is_yymm = False
if is_month(s0) and is_year(s1):
    is_mmyy = True
if is_year(s0) and is_month(s1):
    is_yymm = True

if is_mmyy:
    if is_yymm:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if is_yymm:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = list(input())
S1 = ''.join(S[0:2])
S2 = ''.join(S[2:4])

if int(S1) >= 1 and int(S1) <= 12 :
    if int(S2) >= 1 and int(S2) <= 12 :
        print('AMBIGUOUS')
    else :
        print('MMYY')

else :
    if int(S2) >= 1 and int(S2) <= 12 :
        print('YYMM')
    else :
        print('NA')

Submission status: Accepted

Solution code:
s = input()
fir = int(s[:2])
sec = int(s[2:])

if (0 < fir <= 12 and 0 < sec <= 12):
  print('AMBIGUOUS')
elif ((fir == 0 or fir > 12)  and 0 < sec <= 12):
  print('YYMM')
elif (0 < fir <= 12 and (sec == 0 or sec > 12)):
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()[:4]

mae = S[:2]
ato = S[2:]

if mae.isnumeric() and ato.isnumeric():
    mae, ato = int(mae), int(ato)
    maeY, maeM, atoY, atoM = False, False, False, False
    
    if 1 <= mae <= 12:
        if  1 <= ato <= 12:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    elif 1<= ato <= 12:
        print("YYMM")
    else:
        print("NA")
else:
    print("NA")

Submission status: Accepted

Solution code:
import sys


def parse(file):
    s = file.readline()
    return s,


def is_month(s):
    if (0 < int(s)) & (int(s) <= 12):
        return 1
    else:
        return 0


def main(s):
    ans = is_month(s[:2]) * 2 + is_month(s[2:])

    if ans == 0:
        return 'NA'
    elif ans == 1:
        return 'YYMM'
    elif ans == 2:
        return 'MMYY'
    elif ans == 3:
        return 'AMBIGUOUS'

    raise RuntimeError


if __name__ == '__main__':
    print(main(*parse(sys.stdin)))

Submission status: Accepted

Solution code:
S = input()
MM = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
if (S[0:2] in MM) & (S[2:] in MM):
	print('AMBIGUOUS')
elif S[0:2] in MM:
	print('MMYY')
elif S[2:] in MM:
	print('YYMM')
else:
	print('NA')

Submission status: Accepted

Solution code:
# def gcd(a_gcd, b_gcd):
#     while b_gcd != 0:
#         a_gcd, b_gcd = b_gcd, a_gcd % b_gcd
#     return a_gcd
#
#
# def lcm(a_lcm, b_lcm):
#     return a_lcm * b // gcd(a_lcm, b_lcm)
#
#
# def max_sum(N_max_sum, a_max_sum):
#     dp = [0] * (N_max_sum + 1)
#     for i in range(N_max_sum):
#         dp[i + 1] = max(dp[i], dp[i] + a_max_sum[i])
#     return dp[N]
#
#
# def knapsack(N_knapsack, W, weight, value):
#     inf = float("inf")
#     dp = [[-inf for _ in range(W+1)] for j in range(N_knapsack + 1)]
#     for i in range(W+1):
#         dp[0][i] = 0
#
#     for i in range(N_knapsack):
#         for w in range(W+1):
#             if weight[i] <= w:
#                 dp[i+1][w] = max(dp[i][w-weight[i]]+value[i], dp[i][w])
#             else:
#                 dp[i+1][w] = dp[i][w]
#     return dp[N_knapsack][W]

# n = int(input())
# N, K = map(int, input().split())
S = input()

first = int(S[0]) * 10 + int(S[1])
second = int(S[2]) * 10 + int(S[3])
MMYY = False
YYMM = False

if first >= 1 and first <= 12:
    if second >= 0 and second <= 99:
        MMYY = True

if second >= 1 and second <= 12:
    if first >= 0 and first <= 99:
        YYMM = True

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

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

S = str(input())

if 0 < int(S[0:2]) < 13 and 0 < int(S[2:]) < 13:
    ans = "AMBIGUOUS"
elif 0 < int(S[:2]) < 13:
    ans = "MMYY"
elif 0 < int(S[2:]) < 13:
    ans = "YYMM"
else:
    ans = "NA"

print(ans)

Submission status: Accepted

Solution code:
S = input()

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

if a in range(1, 13):
    if b in range(1, 13):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if b in range(1, 13):
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = int(input())

upper = S // 100
downer = S % 100

flag = 0
if(upper <= 12 and upper > 0):
  flag += 1

if(downer <= 12 and downer > 0):
  flag += 2  
if(flag == 0):
  print('NA')
elif(flag == 1):
  print('MMYY')
elif(flag == 2):
  print('YYMM')
else:
  print('AMBIGUOUS')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
s1 = s[:2]
s2 = s[2:]
li = ["01","02","03","04","05","06","07","08","09","10","11","12"]

if s1 in li and s2 in li:
    print("AMBIGUOUS")
elif s1 in li and not s2 in li:
    print("MMYY")
elif s2 in li and not s1 in li:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())

A = int("".join(s[:2]))
B = int("".join(s[2:]))

if A <= 12 and B <= 12 and A >= 1 and B >= 1:
    print('AMBIGUOUS')
elif (A > 12 or A == 0) and B <= 12 and B != 0:
    print('YYMM')
elif A <= 12 and (B > 12 or B == 0) and A != 0:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
a=input()
a=[i for i in a]
x=int(a[0]+a[1])
y=int(a[2]+a[3])
cy=0
cm=0
if 0<x<13 and y<=99:
    cm+=1
if x<=99 and 0<y<13:
    cy+=1
if cy==1:
    if cm==1:
        print("AMBIGUOUS")
    else:
        print("YYMM")
elif cm==1:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
N=list(input())
mae=int(N[0])*10+int(N[1])
ato=int(N[2])*10+int(N[3])
if 0<mae<13:
    if 0<ato<13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0<ato<13:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S = input()

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

s1 = S[0:2]
s2 = S[2:4]
ok1 = s1 in oklist
ok2 = s2 in oklist

if ok1 and ok2:
    print('AMBIGUOUS')
elif ok1:
    print('MMYY')
elif ok2:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    S = str(input())

    AA = int(S[0:2])
    BB = int(S[2:4])

    if (1 <= AA <= 12) and (1 <= BB <= 12):
        answer = "AMBIGUOUS"
    elif (AA == 0 or AA >= 13) and (1 <= BB <= 12):
        answer = "YYMM"
    elif (1 <= AA <= 12) and (BB == 0 or BB >= 13):
        answer = "MMYY"
    else:
        answer = "NA"

    print(answer)

Submission status: Accepted

Solution code:
s = input()

mae = int(s[:2])
usiro = int(s[2:4])

def is_mm(val):
    if (1<=val)and (12>=val):
        return True
    else:
        return False

is_mae = is_mm(mae)
is_usiro = is_mm(usiro)

if (is_mae is True) and (is_usiro is True):
    print('AMBIGUOUS')
elif(is_mae is False) and (is_usiro is True):
    print('YYMM')
elif(is_mae is True) and (is_usiro is False):
    print('MMYY')
elif(is_mae is False) and (is_usiro is False):
    print('NA')

Submission status: Accepted

Solution code:
s=input()
a=int(s[0])*10+int(s[1])
b=int(s[2])*10+int(s[3])
YYMM=0
MMYY=0
if a<13 and a>0:
  MMYY=1
if b<13 and b>0:
  YYMM=1
if MMYY==1 and YYMM==1:
  print('AMBIGUOUS')
elif MMYY==1 and YYMM==0:
  print('MMYY')
elif MMYY==0 and YYMM==1:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
###
### atcorder test program
###

import sys

### math class
class math:
    ### pi
    pi = 3.14159265358979323846264338

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

math = math()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#A, B, C = [x for x in input().split()]
#inlist = [int(w) for w in input().split()]
#R = float(input())
#A = [int(x) for x in input().split()]
#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

S = input()

A = int(S[:2])
B = int(S[2:])

ans = "NA"

if (0<A<13) and (0<B<13):
    ans = "AMBIGUOUS"
elif (0<A<13):
    ans = "MMYY"
elif (0<B<13):
    ans = "YYMM"

print(ans)

Submission status: Accepted

Solution code:
words = input()

first = int(words[0:2])
end= int(words[2:])

MMYY=False
YYMM=False
if(1<=first<=12):
    MMYY=True
if(1<=end<=12):
    if(1<=end<=12):
        YYMM =True

if MMYY:
    if YYMM:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if YYMM:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = list(input())
head = int(S[0] + S[1])
tail = int(S[2] + S[3])

if 0 < head < 13 and  0 < tail < 13:
    print('AMBIGUOUS')
elif 0 < head < 13:
    print('MMYY')
elif 0 < tail < 13:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
left = int(s[:2])
right = int(s[2:])
left_y = False
left_m = False
right_y = False
right_m = False
if 1 <= left <= 12:
    left_m = True
if 0 <= left:
    left_y = True
if 1 <= right <= 12:
    right_m = True
if 0 <= right:
    right_y = True

mmyy = False
yymm = False
if left_m and right_y:
    mmyy = True
if left_y and right_m:
    yymm = True
if mmyy and yymm:
    print("AMBIGUOUS")
elif mmyy and yymm == False:
    print("MMYY")
elif mmyy == False and yymm:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
S = input()
if 1 <= int(S[:2]) <= 12:
    if 1 <= int(S[2:]) <= 12:
        print ("AMBIGUOUS")
    else:
        print ("MMYY")
else:
    if 1 <= int(S[2:]) <= 12:
        print ("YYMM")
    else:
        print ("NA")

Submission status: Accepted

Solution code:
S = input()

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


def judge(num):
    if num > 0 and num < 13:
        return True
    else:
        return False


if judge(a) and judge(b):
    print('AMBIGUOUS')
elif not judge(a) and not judge(b):
    print('NA')
elif judge(a) and not judge(b):
    print('MMYY')
elif not judge(a) and judge(b):
    print('YYMM')

Submission status: Accepted

Solution code:
S = input()
YY = int(S[0:2])
MM = int(S[2:4])

if 0 < YY <= 12 and 0 < MM <= 12:
    print("AMBIGUOUS")
elif 0 <= YY <= 99 and 0 < MM <= 12:
    print("YYMM")
elif 0 < YY <= 12 and 0 <= MM <= 99:
    print("MMYY")
else:
	print("NA")

Submission status: Accepted

Solution code:
s=input()
ans='NA'
m=['01','02','03','04','05','06','07','08','09','10','11','12']
if s[:2] not in m and s[2:] in m:
    ans='YYMM'
elif s[:2] in m and s[2:] not in m:
    ans='MMYY'
elif s[:2] in m and s[2:] in m:
    ans='AMBIGUOUS'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
S=list(s)
m1=0
m2=0
if S[0]=='0':
    if S[1]!='0':
        m1=1
    else:
        m1=0

elif S[0]=='1':
    if S[1]=='0' or S[1]=='1' or S[1]=='2':
        m1=1
    else:
        m1=0
else:
    m1=0

if S[2]=='0':
    if S[3]!='0':
        m2=1
    else:
        m2=0
elif S[2]=='1':
    if S[3]=='0' or S[3]=='1' or S[3]=='2':
        m2=1
    else:
        m2=0
else:
    m2=0

if m1==1 and m2==1:
    print('AMBIGUOUS')

elif m1==1:
    print('MMYY')

elif m2==1:
    print('YYMM')

else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
months = ["{:02d}".format(n) for n in range(1,13)]
if (s[:2] in months) & (s[2:] in months):
    print("AMBIGUOUS")
elif s[:2] in months:
    print("MMYY")
elif s[2:] in months:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
a = int(input())
s = []
for i in range(4):
  s.append(int(a%10))
  a /= 10
s.reverse()
if (s[0]*10+s[1] >= 13 or s[0]*10+s[1] == 0) and s[2]*10+s[3] >=1 and s[2]*10+s[3]<=12:
  print('YYMM')
elif s[0]*10+s[1] >= 1 and s[0]*10+s[1] <= 12 and (s[2]*10+s[3] >=13 or s[2]*10+s[3] ==0):
  print('MMYY')
elif s[0]*10+s[1] >= 1 and s[0]*10+s[1] <= 12 and s[2]*10+s[3] >= 1 and s[2]*10+s[3] <= 12:
  print('AMBIGUOUS')
else:
  print('NA')

Submission status: Accepted

Solution code:
s = raw_input()

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

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: Accepted

Solution code:
S = input()
A = S[:2]
B = S[2:]
if 0<int(A)<13:
  if 0<int(B)<13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 0<int(B)<13:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

def f(x):
        if x >= 13 or x == 0:
                return False
        else:
                return True

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

Submission status: Accepted

Solution code:
a = list(input())
for i in range(4):
	a[i] = int(a[i])
s = [0,0]
s[0] = a[0]* 10 +a[1]
s[1] = a[2] * 10 + a[3]
def judge(a):
	if 0<a<13:
		return True
	else:
		return False
if judge(s[0]):
	if judge(s[1]):
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if judge(s[1]):
		print("YYMM")
	else:
		print("NA")

Submission status: Accepted

Solution code:
S = input()
first, second = int(S[:2]), int(S[2:])

if 1 <= first <= 12 and 1 <= second <= 12:
    print("AMBIGUOUS")
elif 1 <= second <= 12:
    print("YYMM")
elif 1 <= first <= 12 and second <= 99:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
s=str(input())
aa=int(s[0:2])
bb=int(s[2:])

if bb < 1 or bb > 12:
  if aa < 1 or aa > 12:
    print('NA')
  else:
    print('MMYY')
else:
  if aa < 1 or aa > 12:
    print('YYMM')
  else:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
s = input()

s1 = int(s[0:2])
s2 = int(s[2:])

yymm, mmyy = True, True
if s1 > 12 or s1 == 0:
    mmyy = False

if s2 > 12 or s2 == 0:
    yymm = False

print("AMBIGUOUS" if yymm == True and mmyy == True else "YYMM" if yymm == True
        else "MMYY" if mmyy == True else "NA")

Submission status: Accepted

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

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  s=S()
  a=s[:2]
  b=s[2:]
  if a=='00' and int(b)>12:
    print('NA')
  elif int(a)>12 and b=='00':
    print('NA')
  elif a=='00' and b=='00':
    print('NA')
  elif a=='00' and int(b)<=12:
    print('YYMM')
  elif int(a)<=12 and b=='00':
    print('MMYY')
  elif int(a)>12 and int(b)>12:
    print('NA')
  elif int(a)<=12 and int(b)>12:
    print('MMYY')
  elif int(a)>12 and int(b)<=12:
    print('YYMM')
  else:
    print('AMBIGUOUS')

main()
# print(main())