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()
f = int(S[:2])
g = int(S[2:])
yymm = False
mmyy = False
if f >= 1 and f <= 12:
  mmyy = True
if g >= 1 and g <= 12:
  yymm = True
if yymm:
  if mmyy:
    print("AMBIGUOUS")
  else:
    print("YYMM")
else:
  if mmyy:
    print("MMYY")
  else:
    print("NA")

Submission status: Accepted

Solution code:
seq = input()
st = int(seq[:2:])
nd = int(seq[2::])

if(st == 0 and nd == 0):
    print("NA")
elif((st<=12 and st>0) and (nd<=12 and nd>0)):
    print("AMBIGUOUS")
elif(st<=12 and st>0):
    print("MMYY")
elif(nd<=12 and nd>0):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

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

YYMM = True
MMYY = True

if AA > 12 or AA <= 0:
    MMYY = False

if BB > 12 or BB <= 0:
    YYMM = False

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

Submission status: Accepted

Solution code:
S = input()

if 1 <= int(S[0:2]) <= 12 and 1<= int(S[2:]) <= 12:
    print("AMBIGUOUS")
elif 1 <= int(S[0:2]) <= 12 and 0<= int(S[2:]) <= 99:
    print("MMYY")
elif 0<= int(S[:2]) <= 99 and 1<= int(S[2:]) <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

s = input()
isMaeMM = False
if (0 < int(s[0:2]) < 13):

    isMaeMM = True
isUshiroMM = False
if (0 < int(s[2:]) < 13):

    isUshiroMM = True
if (isMaeMM):
    if (isUshiroMM):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if (isUshiroMM):
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()

HIGH = int(S[:2])
LOW = int(S[2:])

if 1 <= HIGH <= 12:
	if 1 <= LOW <= 12:
		print('AMBIGUOUS')
	else:
		print('MMYY')
else:
	if 1 <= LOW <= 12:
		print('YYMM')
	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 and (b>12 or b==0):
    print("YYMM")
elif (a>12 or a==0) and 1<=b<=12:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S=input()
n1,n2=int(S[:2]),int(S[2:])
isy=lambda n: True
ism=lambda n: n<13 and n>0
isyymm = (isy(n1) and ism(n2))
ismmyy = (ism(n1) and isy(n2))

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

Submission status: Accepted

Solution code:
S = input()

yymm = 1 <= int(S[2:]) <= 12
mmyy = 1 <= int(S[:2]) <= 12

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

Submission status: Accepted

Solution code:
s = str(input())
a = int(s[0]+s[1])
b = int(s[2]+s[3])

def month(k):
    for i in range(1,13):
        if k == i:
            return True
            break
    return False

if month(a) == True:
    if month(b) == True:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if month(b) == True:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:


#n, k = [int(i) for i in input().split()]

s = input()
front = int(s[0] + s[1])
back = int(s[2] + s[3])
answer = ["NA", "YYMM", "MMYY", "AMBIGUOUS"]
ans = 0
if 1 <= back <= 12:
    ans += 1

if 1 <= front <= 12:
    ans += 2

print(answer[ans])

Submission status: Accepted

Solution code:
s = list(map(int, input()))

s1 = s[0] * 10 + s[1]
s2 = s[2] * 10 + s[3]

ans = 0
if (1 <= s1 <= 12 and 0 <= s2 <=99):
    ans += 1
if (1 <= s2 <= 12 and 0 <= s1 <=99):
    ans += 2

if (ans == 0):
    print("NA")
elif (ans == 1):
    print("MMYY")
elif (ans == 2):
    print("YYMM")
elif (ans == 3):
    print("AMBIGUOUS")

Submission status: Accepted

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

def isM(a):
    return  (a >= 1 and a <= 12)

def solve(S: str):
    a = int(S[0:2])
    b = int(S[2:])

    isA = isM(a)
    isB = isM(b)

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




# 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 = next(tokens)  # type: int
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = str(input())

int1 = int(S[0:2])
int2 = int(S[2:4])

YYMM = False
MMYY = False
if (0 <= int1 <= 99) and (1 <= int2 <= 12):
    YYMM = True
if (1 <= int1 <= 12) and (0 <= int2  <= 99):
    MMYY = True
    
if YYMM and MMYY:
    print('AMBIGUOUS')
if YYMM and not MMYY:
    print('YYMM')
if not YYMM and MMYY:
    print('MMYY')
if not YYMM and  not MMYY:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

f = int(S[:2])
b = int(S[-2:])

if 0 < b and b < 13:
    yymm = True
else:
    yymm = False
    
if 0 < f and f < 13:
    mmyy = True
else:
    mmyy = False
    
if yymm and mmyy:
    ans = "AMBIGUOUS"
elif yymm:
    ans = "YYMM"
elif mmyy:
    ans = "MMYY"
else:
    ans = "NA"
    
        
print(ans)

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 and (b == 0 or b > 12):
    print("MMYY") 
elif 0 < b <= 12 and (a == 0 or a > 12):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

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

am = False
bm = False
if a >= 1 and a <= 12:
  am = True
if b >= 1 and b <= 12:
  bm = True

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

Submission status: Accepted

Solution code:
S = input()

s1 = int(S[:2])
s2 = int(S[2:])

#print(s1, s2)

if 1 <= s1 <= 12:
	if 1 <= s2 <= 12:
		print("AMBIGUOUS")
	else:
		print("MMYY")
	exit()

if 1 <= s2 <= 12:
	if 1 <= s1 <= 12:
		print("AMBIGUOUS")
	else:
		print("YYMM")
	exit()

print("NA")

Submission status: Accepted

Solution code:
S = int(input())

str = "NA"

if S%100 > 0 and S%100 < 13:
    str = "YYMM"

if int(S/100) > 0 and int(S/100) < 13:
    if str == "YYMM":
        str = "AMBIGUOUS"
    else:
        str ="MMYY"

print(str)

Submission status: Accepted

Solution code:
S = input()
A = int(S[:2])
B = int(S[2:])

if 0 < A < 13:
    AisM = True
else:
    AisM = False
    
if 0 < B < 13:
    BisM = True
else:
    BisM = False
    
if AisM and BisM:
    print('AMBIGUOUS')
elif AisM and not BisM:
    print('MMYY')
elif not AisM and BisM:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
def canb_month(num):
    if 0 < num and num <= 12:
        return True
    else:
        return False


s = input()
f_half = int(s[:2])
s_half = int(s[2:])

a = None
if canb_month(f_half) and canb_month(s_half):
    a = 'AMBIGUOUS'
else:
    if canb_month(f_half):
        a = 'MMYY'
    elif canb_month(s_half):
        a = 'YYMM'
    else:
        a = 'NA'
        
print(a)

Submission status: Accepted

Solution code:
# n, k = map(int, input().split())
s = input()

mm = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
if s[:2] in mm and s[2:] in mm:
  print('AMBIGUOUS')
elif s[:2] in mm:
  print('MMYY')
elif s[2:] in mm:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
line = input()
n1 = int(line[:2])
n2 = int(line[2:])
if n1 > 12 or n1 == 0:
	v1 = False
else:
	v1 = True
if n2 > 12 or n2 == 0:
	v2 = False
else:
	v2 = True
if v1 and v2:
	print("AMBIGUOUS")
elif v1 and not v2:
	print("MMYY")
elif not v1 and v2:
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

Solution code:

def main():
    buf = input()
    S = buf
    first = int(S[0:2])
    second = int(S[2:4])
    if first == 0 and second == 0:
        print('NA')
        return
    elif 1 <= first and first <= 12:
        if 1 <= second and second <= 12:
            print('AMBIGUOUS')
            return
        else:
            print('MMYY')
            return
    elif 1 <= second and second <= 12:
        print('YYMM')
        return
    else:
        print('NA')
        return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
f = n//100
s = n % 100
ans = "NA"
v = 0
if f in range(1, 13) and s in range(0, 100):
	v += 1
	ans = "MMYY"

if s in range(1, 13) and f in range(0, 100):
	v += 1
	ans = "YYMM"

if v > 1 :
	ans = "AMBIGUOUS"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()


def f(s):
    return '01' <= s <= '12'


ans = (
    'NA' if not f(S[:2]) and not f(S[2:]) else
    'MMYY' if f(S[:2]) and not f(S[2:]) else
    'YYMM' if not f(S[:2]) and f(S[2:]) else
    'AMBIGUOUS'
)

print(ans)

Submission status: Accepted

Solution code:
S = list(input())
a = int("".join(S[0:2]))
b = int("".join(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()

firsthalf = int(S[:2])
lasthalf = int(S[2:])

if lasthalf <= 12 and lasthalf >= 1:
    if firsthalf > 12 or firsthalf == 0:
        ans = "YYMM"
    else:
        ans = "AMBIGUOUS"
else:
    if firsthalf == 0 or firsthalf > 12:
        ans = "NA"
    else:
        ans = "MMYY"

print(ans)

Submission status: Accepted

Solution code:
S = list(input())
yymm=False
mmyy=False

if 0 < int("".join(S[2:])) <= 12:
    yymm = True

if 0 < int("".join(S[:2])) <= 12:
    mmyy = True

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

Submission status: Accepted

Solution code:
s = list(input())
for i in range(len(s)):
    s[i] = int(s[i])

def f(x,y):
    if x == 0:
        if y == 0:
            return 0
        return 1
    elif x == 1:
        if y <= 2:
            return 1
    return 0

fi = f(s[0],s[1])
se = f(s[2],s[3])

if fi < 0 or se < 0:
    print('NA')
elif fi == 0:
    if se == 0:
        print('NA')
    else:
        print('YYMM')
elif se == 0:
    print('MMYY')
else:
    print('AMBIGUOUS')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
Ss = input()

isMM1 = '01' <= Ss[:2] <= '12'
isMM2 = '01' <= Ss[2:] <= '12'

if isMM1:
    if isMM2:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if isMM2:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
# cook your dish here
s=input()
aa=s[:2]
bb=s[2:]
#print(aa,bb)
aa=int(aa)
bb=int(bb)
if aa<=12 and bb<=12 and aa>0 and bb>0:
    print("AMBIGUOUS")
elif aa<=12 and aa>0:
    print("MMYY")
elif bb<=12 and bb>0:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def biger12(s):
    if int(s[0]) >= 2:
        return True
    if int(s[0]) == 1 and int(s[1])>=3:
        return True

    if int(s[0]) == 0 and int(s[1]) == 0:
        return True
        
    return False

def solve():
    s = input()
    s1 = s[0:2]
    s2 = s[2:]

    if biger12(s1) and biger12(s2):
        print('NA')
    elif not biger12(s1) and not biger12(s2):
        print('AMBIGUOUS')
    elif biger12(s1) and not biger12(s2):
        print('YYMM')
    else:
        print('MMYY')



solve()

Submission status: Accepted

Solution code:
a = str(input())
b = int(a[:2])
c = int(a[2:])

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

Submission status: Accepted

Solution code:
def hantei(st):
    if 0<int(st)<=12:
        return True
    else:
        return False

S =input()
if hantei(S[0:2])and hantei(S[2:]):
    print("AMBIGUOUS")
elif hantei(S[0:2])and not hantei(S[2:]):
    print("MMYY")
elif not hantei(S[0:2])and hantei(S[2:]):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    S = str(input().strip())

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

    if (a > 12 and 0 < b <= 12) or (a == 0 and 0 < b <= 12):
        return 'YYMM'
    elif (0 < a <= 12 and b > 12) or (0 < a <= 12 and b == 0):
        return 'MMYY'
    elif 0 < a <= 12 and 0 < b <= 12:
        return 'AMBIGUOUS'
    else:
        return 'NA'


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

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 (A==0 or A>12) and 0<B<=12:
    print("YYMM")
elif 0<A<=12 and (B==0 or B>12):
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
a,b,c,d=map(int,list(input()))
x=a*10+b
y=c*10+d

if 1<=x and x<=12 and 1<=y and y<=12:
  print('AMBIGUOUS')
elif 1<=x and x<=12 and not(1<=y and y<=12):
  print('MMYY')
elif not(1<=x and x<=12) and (1<=y and y<=12):
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def is_ym(a, b):
    if 1 <= int(b) and int(b) <= 12:
        return True
    return False

def solve(s):
    a = s[:2]
    b = s[2:]
    if is_ym(a, b):
        if is_ym(b, a):
            print("AMBIGUOUS")
        else:
            print("YYMM")
    else:
        if is_ym(b, a):
            print("MMYY")
        else:
            print("NA")
            
s = input()
solve(s)

Submission status: Accepted

Solution code:
li = int(input())
a = li//100
b = li-a*100
p = 0
q = 0
if 0<a<13:
    p=1
if 0<b<13:
    q=1
if p==1 and q==1:
    print("AMBIGUOUS")
elif p==1:
    print("MMYY")
elif q==1:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=int(input())
fa=0
fb=0
if s//100>12 or s//100==0:fa+=1
if s%100>12 or s%100==0:fb+=1
if fa==1 and fb==1:print('NA')
elif fa==1 and fb==0:print('YYMM')
elif fa==0 and fb==1:print('MMYY')
else:print('AMBIGUOUS')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
s1 = s[:2]
s2 = s[2:]
r1 = 1 <= int(s1) <= 12
r2 = 1 <= int(s2) <= 12
if r1 and r2:
    print('AMBIGUOUS')
elif r1:
    print('MMYY')
elif r2:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

def is_month(n):
    if 1 <= int(n) <= 12:
        return True

if is_month(s[:2]) and is_month(s[2:]):
    print("AMBIGUOUS")
elif is_month(s[:2]) and not is_month(s[2:]):
    print("MMYY")
elif not is_month(s[:2]) and  is_month(s[2:]):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
mae = int(S[:2])
ushiro = int(S[-2:])


if mae > 12 or mae == 0:
    # YYMM
    if ushiro > 12 or ushiro == 0:
        print("NA")
    else:
        print("YYMM")
else:
    # MMYY
    if ushiro < 13 and ushiro > 0:
        print("AMBIGUOUS")
    else:
        print("MMYY")

Submission status: Accepted

Solution code:
S=int(input())
b=S//100
a=S%100

YYMM=False
MMYY=False

if 0<=b<=99 and 1<=a<=12:
    YYMM=True

if 1<=b<=12 and 0<=a<=99:
    MMYY=True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

x, y = int(S[:2]), int(S[2:])
if 1 <= x <= 12 and 1 <= y <= 12:
    print('AMBIGUOUS')
elif 1 <= x <= 12:
    print('MMYY')
elif 1 <= y <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

maeMM = True if 0< mae and mae<13 else False
usiroMM =True if 0< usiro and usiro<13 else False

if maeMM and usiroMM:
    print('AMBIGUOUS')
elif maeMM:
    print('MMYY')
elif usiroMM:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
# judge
jf, jl = 0 < int(S[:2]) <= 12, 0 < int(S[2:]) <= 12

if jf and jl:
    print('AMBIGUOUS')
elif jf and not jl:
    print('MMYY')
elif not jf and jl:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
# coding:utf-8

import math
import re

def main(params):
    n = list(params[0])
    f = n[0] + n[1]
    s = n[2] + n[3]

    try:
        if (int(f) >= 1 and int(f) <= 12) and (int(s) == 0 or int(s) > 12):
            print "MMYY"
        elif (int(f) >= 1 and int(f) <= 12) and (int(f) >= 1 and int(f) <= 12):
            print "AMBIGUOUS"
        elif (int(s) >= 1 and int(s) <= 12) and (int(f) == 0 or int(f) > 12):
            print "YYMM"
        else:
            print "NA"
    except:
        print "NA"

if __name__ == "__main__":
    cnt = 1 # TODO: edit here
    params = []
    for i in range(cnt):
        param = raw_input()
        params.append(param)
    main(params)

Submission status: Accepted

Solution code:
S = input()

head = S[0] + S[1]
tail = S[2] + S[3]

is_head_month = False
is_tail_month = False

if (int(head) <= 12 and int(head) != 0) :
    is_head_month = True

if (int(tail) <= 12 and int(tail) != 0) :
    is_tail_month = True

if (is_head_month == True and is_tail_month == True) :
    print("AMBIGUOUS")
elif (is_head_month == True and is_tail_month == False) :
    print("MMYY")
elif (is_head_month == False and is_tail_month == True) :
    print("YYMM")
else :
    print("NA")

Submission status: Accepted

Solution code:
S = input()

a = S[:2]
b = S[2:]

a = int(a)
b = int(b)

x = False
y = False

if 0 < a and a < 13:
    x = True

if 0 < b and b < 13:
    y = True

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - YYMM or MMYY
https://atcoder.jp/contests/abc126/tasks/abc126_b

"""
import sys


def solve(S):
    is_YYMM = True
    is_MMYY = True
    first = int(S[:2])
    second = int(S[2:])
    if second > 12:
        is_YYMM = False
    if first > 12:
        is_MMYY = False
    if first == 0:
        is_MMYY = False
    if second == 0:
        is_YYMM = False

    if (not is_YYMM) and (not is_MMYY):
        return 'NA'
    if not is_YYMM:
        return 'MMYY'
    if not is_MMYY:
        return 'YYMM'
    return 'AMBIGUOUS'


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
inp=int(input())
top=inp//100
bot=inp-top*100
if top>=1 and top<=12:
  if bot>=1 and bot<=12:
  	print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if bot>=1 and bot<=12:
  	print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

if S[0:2] > "12":
    if "01" <= S[2:4] <= "12":
        print("YYMM")
    else:
        print("NA")

elif "01" <= S[0:2] <= "12":
    if "01" <= S[2:4] <= "12":
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif S[0:2] == "00":
    if "01" <= S[2:4] <= "12":
        print("YYMM")
    else:
        print("NA")

else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

eligible_months = set(range(1,13))

first = int(S[:2])
second = int(S[-2:])

if first in eligible_months:

    if second in eligible_months:

        print('AMBIGUOUS')

    else:

        print('MMYY')

else:

    if second in eligible_months:

        print('YYMM')

    else:

        print('NA')

Submission status: Accepted

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

m1 = (1 <= s1 <= 12)
m2 = (1 <= s2 <= 12)

if m1 and m2:
    print('AMBIGUOUS')
elif m1 and not m2:
    print('MMYY')
elif m2 and not m1:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
def main():
	S = input()
	SL = int(S[0:2])
	SR = int(S[2:4])
	lm = False
	rm = False
	if 0 < SL < 13:
		lm = True
	if 0 < SR < 13:
		rm = True
	if lm and rm:
		print("AMBIGUOUS")
	elif lm and not rm:
		print("MMYY")
	elif not lm and rm:
		print("YYMM")
	else:
		print("NA")


if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
S=input()
x=int(S[0:2])
y=int(S[2:4])
if (x==0 or x>12) and (y==0 or y>12):
    print('NA')
elif x==0 or x>12:
    print('YYMM')
elif y==0 or y>12:
    print('MMYY')
else:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
S = input()
mae = False
ushiro = False
if int(S[2:4]) <= 12 and int(S[2:4]) != 0:
    ushiro = True
if int(S[0:2]) <= 12 and int(S[0:2]) != 0:
    mae = True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

l = int(s[:2])
r = int(s[2:])

if 0 < l and l <= 12:
    if 0 < r and r <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < r and r <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input().strip()

f1 = s[:2]
f2 = s[2:]

def vm(s):
    if s != '00' and s <= '12':
        return True
    return False

def vd(s):
    return True

if vm(f1) and vm(f2):
    print('AMBIGUOUS')
elif vm(f1) and vd(f2):
    print('MMYY')
elif vd(f1) and vm(f2):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc126_b
# YYMM or MMYY


def is_month(n):
    return 1 <= n <= 12


S = input().strip()
n_upper = int(S[:2])
n_lower = int(S[2:])

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

Submission status: Accepted

Solution code:
s=input()
s1=int(s[0]+s[1])
s2=int(s[2]+s[3])
ans=['YYMM','MMYY','AMBIGUOUS','NA']
if s1==0:
  if s2==0:
    print('NA')
  elif 1<=s2<=12:
    print('YYMM')
  elif s2>=13:
    print('NA')
elif 1<=s1<=12:
  if s2==0:
    print('MMYY')
  elif 1<=s2<=12:
    print('AMBIGUOUS')
  elif s2>=13:
    print('MMYY')
elif s1>=13:
  if s2==0:
    print('NA')
  elif 1<=s2<=12:
    print('YYMM')
  elif s2>=13:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
mae = int(S[:2])
ato = int(S[2:])

def my(x):
    if x == 0:
        return "y"
    if x >= 13:
        return "y"
    return "my"

t = (my(ato),my(mae))
if t==("my","my"):
    print("AMBIGUOUS")
elif t== ("y","y"):
    print("NA")
elif t== ("y","my"):
    print("MMYY")
else:
    print("YYMM")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3.4

# abc126_b

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

def main():
    # input
    s = input()
    s1 = int(s[:2])
    s2 = int(s[2:])
    # get ans
    if isMM(s1) and isMM(s2):
        ans = 'AMBIGUOUS'
    elif isMM(s1):
        ans = 'MMYY'
    elif isMM(s2):
        ans = 'YYMM'
    else:
        ans = 'NA'
    # output
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

former = int(S[0:2])
after = int(S[2:4])


if (13 <= former or former == 0)and 1 <= after <= 12:
    print("YYMM")
elif 1 <= former <= 12 and (13 <= after or after == 0):
    print("MMYY")
elif 1 <= former <= 12 and 1 <= after <= 12:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input().strip()

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

s1_is_month = 1 <= s1 <= 12
s2_is_month = 1 <= s2 <= 12

if s1_is_month and s2_is_month:
    print('AMBIGUOUS')
elif s1_is_month:
    print('MMYY')
elif s2_is_month:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S=input()
y,m=int(S[:2]),int(S[2:])

def im(m):
    return 1 <= m and m <= 12

ay = im(y)
am = im(m)
if ay and am :
    print('AMBIGUOUS')
elif ay:
    print('MMYY')
elif am:
    print('YYMM')
else:
    print("NA")

Submission status: Accepted

Solution code:
s = 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 and  not (1 <= b <= 12):
	print("MMYY")
elif not(1 <= a <= 12) and  1 <= b <= 12:
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

a = S[:2]
b = S[2:]

if 1 <= int(a) <= 12 and 1 <= int(b) <= 12:
    print('AMBIGUOUS')
elif 0 <= int(a) <= 99 and 1 <= int(b) <= 12:
    print('YYMM')
elif 1 <= int(a) <= 12 and 0 <= int(b) <= 99:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
a = 10 * int(S[0]) + int(S[1])
b = 10 * int(S[2]) + int(S[3])

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()
s1=int(s[0:2])
s2=int(s[2:4])
s1MM=False
s2MM=False
if 1<=s1 and 12>=s1:
  s1MM=True
if 1<=s2 and 12>=s2:
  s2MM=True

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

Submission status: Accepted

Solution code:
a =input()
def pp(n):
    n = int(n)
    return 0<n<13
if pp(a[:2]) and pp(a[2:]):
    print("AMBIGUOUS")
elif not pp(a[:2]) and pp(a[2:]):
    print("YYMM")
elif pp(a[:2]) and not pp(a[2:]):
    print("MMYY")
else:
    print("NA")