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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

f = int(S[0]+S[1])
b = int(S[2]+S[3])

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

Submission status: Wrong Answer

Solution code:
def main():
  s=input()
  sa=int(s[:2])
  sb=int(s[2:])
  if (1 <= sa and sa <= 12) and (1 <= sb and sb <= 12):
    print('AMBIGUOUS')
  elif (sa > 12) and (1 <= sb and sb <= 12):
    print('YYMM')
  elif (sb > 12) and (1 <= sa and sa <= 12):
    print('MMYY')
  else:
    print('NA')
main()

Submission status: Wrong Answer

Solution code:
def main():
  s=input()
  sa=int(s[:2])
  sb=int(s[2:])
  if (1 <= sa and sa <= 12) and (1 <= sb and sb <= 12):
    print('AMBIGUOUS')
  elif (sa == 0 or sb ==0):
    print('NA')
  elif (sa > 12) and (1 <= sb and sb <= 12):
    print('YYMM')
  else:
    print('MMYY')
main()

Submission status: Wrong Answer

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 0<s_f and s_f<=12 and 0<s_b and s_b<=12:
    print("AMBIGUOUS")
elif 0<s_f and s_f <=12 and s_b>12:
    print('MMYY')
elif s_f>12 and 0<s_b and s_b <=12:
    print('YYMM')
elif s_f>12 and s_b>12:
    print('NA')

Submission status: Wrong Answer

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 0<s_f<=12 and 0<s_b<=12:
    print("AMBIGUOUS")
elif 0<s_f<=12 and s_b>12:
    print('MMYY')
elif s_f>12 and 0<s_b<=12:
    print('YYMM')
elif s_f>12 and s_b>12:
    print('NA')

Submission status: Wrong Answer

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: Wrong Answer

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('YYMM')
elif s_f>12 and s_b>12:
    print("NA")
elif s_f<=12 and s_b<=12:
    print("AMBIGUOUS")
else:
    print('MMYY')

Submission status: Wrong Answer

Solution code:
s = input()
flg1 = (1 <= int(s[:2]) <= 12) and (1 <= int(s[2:]))
flg2 = (1 <= int(s[2:]) <= 12) and (1 <= int(s[:2]))
print(["NA", "YYMM", "MMYY", "AMBIGUOUS"][(flg1 << 1) + flg2])

Submission status: Wrong Answer

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

a_is_month = 0 < a & a <= 12
b_is_month = 0 < b & b <= 12

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

Submission status: Wrong Answer

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 and 1 <= n2 <= 12:
    print("YYMM")
elif 1 <= n1 <= 12 and n2 > 12:
    print("MMYY")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
s = input()

l = list(s)

x = int(l[0]+l[1])
y = int(l[2]+l[3])

if 0 < x < 13 and (y > 12 or y == 0):
    print("MMYY")
elif (x > 12 or x == 0) and 0 < y < 13:
    print("YYMM")
elif x > 12 or y > 12:
    print("NA")
else:
    print("AMBIGUOUS")

Submission status: Wrong Answer

Solution code:
s = input()

l = list(s)

x = int(l[0]+l[1])
y = int(l[2]+l[3])

if 0 < x < 13 and y > 12:
    print("MMYY")
elif x > 12 and 0 < y < 13:
    print("YYMM")
elif x == 0 or y == 0 or x > 12 or y > 12:
    print("NA")
else:
    print("AMBIGUOUS")

Submission status: Wrong Answer

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

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

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

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 S(): return input()
     
def main():
    s = S()
    if int(s[:2]) > 12:
        mmyy = False
    else:
        mmyy = True
    if int(s[2:]) > 12:
        yymm = False
    else:
        yymm = True
    ans = ''
    if yymm and mmyy:
        ans = 'AMBIGUOUS'
    if yymm and not mmyy:
        ans = 'YYMM'
    if not yymm and mmyy:
        ans = 'MMYY'
    if not yymm and not mmyy:
        ans = 'NA'
    if int(s[2:]) == 0 or int(s[:2]) == 0:
        ans = 'NA'
    print(ans)
        

main()

Submission status: Wrong Answer

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

if 1<=x<=12 and 1<=y<=12:
    print("AMBGIOUS")
elif 1<=x<=12:
    print("MMYY")
elif 1<=y<=12:
    print("YYMM")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
S = str(input())
front = int(S[:2])
back = int(S[2:])
S_list = list(S)

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

Submission status: Wrong Answer

Solution code:
S = str(input())
front = int(S[:2])
back = int(S[2:])
S_list = list(S)

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

Submission status: Wrong Answer

Solution code:
S = str(input())
front = int(S[:2])
back = int(S[2:])
S_list = list(S)

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

Submission status: Wrong Answer

Solution code:
s = input()

a, b = int(s[:2]), int(s[2:])
if 0 < a < 13 and 0 < b < 13:
    print('AMBIGOUS')
elif 0 < a < 13:
    print('MMYY')
elif 0 < b < 13:
    print('YYMM')
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
N = input()


p = N[0:1]
s = N[1:2]
d = N[2:3]
f = N[3:4]


p = int(p)
s = int(s)
d = int(d)
f = int(f)

if (p==0 and s<=9 or p==1 and s<=2) and (d ==0 and f<=9 or d==1 or f<=2):
    print("AMBIGUOUS")
elif p==0 and s==0:
    if d<=1 and f>0 and f<=2:
        print("YYMM")
    else:
        print("NA")
elif d==0 and f==0:
    if p<=1 and s>0 and s<=2:
        print("MMYY")
    else:
        print("NA")

elif  p>=1 and s>=2:
     if d==0:
         if f<=9:
             print("YYMM")
     elif d ==1:
         if f<=2:
            print("YYMM")
     else:
        print("NA")


elif d>=1 and f>=2:
     if p==0:
         if s<=9:
             print("MMYY")
     elif p ==1:
         if s<=2:
            print("MMYY")
     else:
        print("NA")

else:
    print("NA")

Submission status: Wrong Answer

Solution code:
S = input()

if 1 <= int(S[0:2]) <= 12:
  if 1 <= int(S[2:4]) <= 12:
    print('AMBIGUOUS')
  elif int(S[2:4]) == 0:
    print('NA')
  elif 13 <= int(S[2:4]) <= 99:
    print('MMYY')
elif int(S[0:2]) == 0:
  if 1 <= int(S[2:4]) <= 12:
    print('YYMM')
  elif int(S[2:4]) == 0:
    print('NA')
  elif 13 <= int(S[2:4]) <= 99:
    print('NA')
elif 13 <= int(S[0:2]) <= 99:
  if 1 <= int(S[2:4]) <= 12:
      print('YYMM')
  elif int(S[2:4]) == 0:
    print('NA')
  elif 13 <= int(S[2:4]) <= 99:
    print('NA')

Submission status: Wrong Answer

Solution code:
def main():
    S = input().rstrip()
    v1 = int(S[:2])
    v2 = int(S[2:])
    if 1 <= v1 <= 12 and 1 <= v2 <= 12:
        print("AMBIGUOUS")
    elif 1 <= v1 <= 12 and v2 >= 13:
        print("MMYY")
    elif v1 >= 13 and 1 <= v2 <= 12:
        print("YYMM")
    else:
        print("NA")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
upper_input = int(s[:2])
lower_input = int(s[2:])

if upper_input >= 0 and upper_input<= 12:
  if lower_input >= 0 and lower_input <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if lower_input >= 0 and lower_input <= 12:
    print('YYMM')
  else:
    print('NA')

Submission status: Wrong Answer

Solution code:
S = input()
if int(S[0]+S[1])<13:	#MMかYY
  if 0<int(S[2]+S[3])<13:	#MMかYY
    print('AMBIGUOUS')
  else:	#YY
    print('MMYY')
else:	#YY
  if 0<int(S[2]+S[3])<13:	#MM
    print('YYMM')
  else:	#YY
    print('NA')

Submission status: Wrong Answer

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

S = input()

yy = int(S[0:2])
mm = int(S[2:])

if yy == 0 or mm == 0 :
    print("NA")
    exit(0)

if yy < 13 and mm < 13 :
    print("AMBIGUOUS")
elif yy < 13 and mm < 100:
    print("MMYY")
elif yy < 100 and mm < 13:
    print("YYMM")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
n=int(input())
a2=n%100
a1=n//100

if 0<a1 and a1<=12 and a2<=12 and a2>0:
			print("AMBIGUOUS")
elif a1<=12 and a2>0:
		print("YYMM")

elif a1<=12 and a1>0:
	print("MMYY")		

else:
	print("NA")

Submission status: Wrong Answer

Solution code:
n=int(input())
a2=n%100
a1=n//100
if 0<a1 and a1<=12:
	print("YYMM")
	
elif 0<a2 and a2<=12:
	print("MMYY")
elif 0<a1 and a1<=12 and a2<=12 and a2>0:
			print("AMBIGUOUS")
	
		

else:
	print("NA")

Submission status: Wrong Answer

Solution code:
n=int(input())
a2=n%100
a1=n//100
if 0<a2 and a1>12:
	print("YYMM")
	
elif 0<a1 and a2>12:
	print("MMYY")
elif 0<a1 and a1<=12 and a2<=12 and a2>0:
			print("AMBIGUOUS")
	
		

else:
	print("NA")

Submission status: Wrong Answer

Solution code:
n=int(input())
a2=n%100
a1=n//100
if 0<a2 and a2<=12 and a1>12:
	print("YYMM")
	
elif 0<a1 and a1<=12 and a2>12:
	print("MMYY")
elif 0<a1 and a1<=12 and a2<=12 and a2>0:
			print("AMBIGUOUS")
	
		

else:
	print("NA")

Submission status: Wrong Answer

Solution code:
n=int(input())
m=n%100
y=n//100
if 0<m and m<=12 and y>12:
	print("YYMM")
	
elif 0<y and y<=12 and m>12:
	print("MMYY")
elif 0<y and y<=12 and m<=12:
			print("AMBIGUOUS")
	
		
elif 0<m and m<=12 and y<=12:
	print("AMBIGUOUS")
	
else:
	print("NA")

Submission status: Wrong Answer

Solution code:
n=int(input())
m=n%100
y=n//100
if 0<m and m<=12 and y>12:
	print("YYMM")
	
elif 0<y and y<=12 and m>12:
	print("MMYY")
elif 0<m and m<=12 and y<=12:
	print("AMBIGUOUS")
	
elif m==0 or y==0 or m>12:
	print("NA")

Submission status: Wrong Answer

Solution code:
n=int(input())
m=n%100
y=n//100
if 0<m and m<=12 and y>12:
	print("YYMM")
	
elif 0<y and y<=12 and m>12:
	print("MMYY")
elif 0<m and m<=12 and y<=12:
	print("AMBIGUOUS")
	
else:
	print("NA")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
s1 = int(s[:2])
s2 = int(s[2:])
if((s1 <= 99)and(s1 != 0))and((s2 <= 12)and(s2 != 0)):
    if(((s1 <= 12)and(s1 != 0))and((s2 <= 99)and(s2 != 0))):
        print("AMBIGUOUS")
    else:
        print("YYMM")
elif(((s1 <= 12)and(s1 != 0))and((s2 <= 99)and(s2 != 0))):
    if((s1 <= 99)and(s1 != 0))and((s2 <= 12)and(s2 != 0)):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    print("NA")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

s1 = int(s[0])*10 + int(s[1])
s2 = int(s[2])*10 + int(s[3])
#print(s1, s2)
if  (s1>12 or s1==0) and (s2>12 or s2==0):
  print('NA')
elif s1>12 and 1<=s2<=12:
  print('YYMM')
elif s2>12 and 1<=s1<=12:
  print('MMYY')
elif 1<=s1<=12 and 1<=s2<=12:
  print('AMBIGUOUS')

Submission status: Wrong Answer

Solution code:
S = input()
month_list = ["01","02","03","04","04","05","06","07","08","09","10","11","12"]

if S[0:2] in month_list:
    if S[2:4] in month_list:
        print("AMBIGUOUS")
    elif S[2:4] == "00":
        print("NA")
    else:
        print("MMYY")

else:
    if S[2:4] in month_list:
        print("YYMM")
    else:
        print("NA")

Submission status: Wrong Answer

Solution code:
S = input()
year_list = ["01","02","03","04","04","05","06","07","08","09","10","11","12"]

if S[0:2] in year_list:
    if S[2:4] in year_list:
        print("AMBIGUOUS")
    elif S[2:4] == "00":
        print("NA")
    elif int(S[2:4]) >= 32:
        print("NA")
    else:
        print("YYMM")
elif S[0:2] == "00":
    print("NA")
elif int(S[0:2]) >= 32:
    print("NA")
else:
    if S[2:4] in year_list:
        print("MMYY")
    else:
        print("NA")

Submission status: Wrong Answer

Solution code:
S = input()
year_list = ["01","02","03","04","04","05","06","07","08","09","10","11","12"]

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

Submission status: Wrong Answer

Solution code:
S = input()
year_list = ["01","02","03","04","04","05","06","07","08","09","10","11","12"]

if S[0:2] in year_list:
    if S[2:4] in year_list:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    if S[2:4] in year_list:
        print("MMYY")
    else:
        print("NA")

Submission status: Wrong Answer

Solution code:
s = input()

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

if a <= 12 and b == 12 and not(a==0 and b==0):
    print("AMBIGUOUS")
elif 0 < a <= 12 and (12 < b or b == 0):
    print('MMYY')
elif (12 < a or a == 0) and 0 < b <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
from decimal import Decimal
from operator import mul

INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 組合せnCr
def combinations_count(n, r):
    if n < r:
        return 0
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定
def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True


# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

# ここから書き始める
s = input()
if 1 <= int(s[:2]) <= 12:
    print("AMBIGUOUS")
else:
    if 1 <= int(s[2:]) <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Wrong Answer

Solution code:
s = input()
a = s[:2]
b = s[2:]
b1 = 0
a1 = 0

if b[0] == '0': b1 = int(b[1])
else: b1 = int(b)
if a[0] == '0': a1 = int(a[1])
else: a1 = int(a)

if (b1>=1 and b1<=12) and (a1>=1 and a1<=12): print("AMBIGUOS")
elif b1>=1 and b1<=12: print("YYMM")
elif a1>=1 and a1<=12: print("MMYY")
else: print("NA")

Submission status: Wrong Answer

Solution code:
s=input()

first = int(s[:2])
second = int(s[2:])

if (first>0) and (first<13) and (second>0) and (second<13):
    print("AMBIGUOUS")
elif (first>0) and (first<13) and ((second==0) or (second>13)):
    print("MMYY")
elif (second>0) and (second<13) and ((first==0) or (first>13)):
    print("YYMM")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    #print(s[:2], s[2:4])
    if int(s[:2]) > 12 and (int(s[2:4]) >= 1 and int(s[2:4]) <= 12) :
        print("YYMM")
    elif int(s[2:4])>12 and (int(s[:2]) >=1 and int(s[:2]) <=12) :
        print("MMYY")
    elif (int(s[:2]) >= 1 and int(s[:2])) <= 12 and (int(s[2:4]) >=1 and int(s[2:4]) <= 12) :
        print("AMBIGUOUS")
    else:
        print("NA")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
s = input()
a=int(s[:2])
b=int(s[-2:])
if a > 12 and b >12:
    print('NA')
elif b>12:
    if a>0:
        print('MMYY')
    else:
        print('NA')
elif a>12:
    if b>0:
        print('YYMM')
    else:
        print('NA')
else:
    print('AMBIGUOUS')

Submission status: Wrong Answer

Solution code:
s = input()

f = (0 < int(s[:2]) < 13)
s = (0 < int(s[2:]) < 13)
ans = 'NA'
if f:
    ans = 'MMYY'
elif s:
    ans = 'YYMM'
elif f and s:
    ans = 'AMBIGUOUS'
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

f = (0 < int(s[:2]) < 12)
s = (0 < int(s[2:]) < 12)
ans = 'NA'
if f:
    ans = 'MMYY'
elif s:
    ans = 'YYMM'
elif f and s:
    ans = 'AMBIGUOUS'
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

f = (0 < int(s[:2]) < 12)
s = (0 < int(s[2:]) < 12)
ans = 'NA'
if f:
    ans = 'YYMM'
elif s:
    ans = 'MMYY'
elif f and s:
    ans = 'AMBIGUOUS'
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

s_u, s_l = int(s[:2]), int(s[2:])
if s_u > 12 and 1 <= s_l <= 12:
    print('YYMM')
elif 1 <= s_u <= 12 and s_l > 12:
    print('MMYY')
elif s_u == 0 or s_l == 0:
    print('NA')
else:
    print('AMBIGUOUS')

Submission status: Wrong Answer

Solution code:
s = input()

s_u, s_l = int(s[:2]), int(s[2:])
if s_u > 12 and 1 <= s_l <= 12:
    print('YYMM')
elif 1 <= s_u <= 12 and s_l > 12:
    print('MMYY')
elif 1 <= s_u <= 12 and 1 <= s_l <= 12:
    print('AMBIGUOUS')
elif s_u == 0 or s_l == 0:
    print('NA')

Submission status: Wrong Answer

Solution code:
s = input()

s_u, s_l = int(s[:2]), int(s[2:])
if s_u > 12 and 1 <= s_l <= 12:
    print('YYMM')
elif 1 <= s_u <= 12 and s_l > 12:
    print('MMYY')
elif 1 <= s_u <= 12 and 1 <= s_l <= 12:
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
s = input()

s_u, s_l = int(s[:2]), int(s[2:])
if s_u != 0 and 1 <= s_l <= 12:
    print('YYMM')
elif 1 <= s_u <= 12 and s_l != 0:
    print('MMYY')
elif 1 <= s_u <= 12 and 1 <= s_l <= 12:
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

else:
    print('NA')

Submission status: Wrong Answer

Solution code:
x = input()
a, b = int(x[0:2]), int(x[2:4])
flag = 0
ans = ["AMBIGUOUS", "YYMM", "MMYY", "NA"]

if (a >= 1 and a <= 12) and (b >= 1 and b <= 12):
    flag = 0
elif (a == 0 and b > 12) or (b == 0 and a > 12) or (b > 12 and a > 12) or (b == 0 and a == 0):
    flag = 3
elif ((a > 0 and a <= 12) and (b >= 13)) or (a == 0 and (b >= 1 and b <= 12)):
    flag = 2
elif ((a >= 13) and (b > 0 and b <= 12)) or (b == 0 and (a >= 1 and a <= 12)):
    flag = 1


print(ans[flag])

Submission status: Wrong Answer

Solution code:
x = input()
a, b = int(x[0:2]), int(x[2:4])
flag = 0
ans = ["AMBIGUOUS", "YYMM", "MMYY", "NA"]

if (a >= 1 and a <= 12) and (b >= 1 and b <= 12):
    flag = 0
elif (a == 0 and b > 12) or (b == 0 and a > 12) or (b > 12 and a > 12) or (b == 0 and a == 0):
    flag = 3
elif ((a > 0 and a <= 12) and (b >= 13)) or (a == 0 and (b >= 1 and b <= 12)) or (b == 0 and (a >= 1 and b <= 12)):
    flag = 2
elif (a >= 13) and (b > 0 and b <= 12):
    flag = 1


print(ans[flag])

Submission status: Wrong Answer

Solution code:
x = input()
a, b = int(x[0:2]), int(x[2:4])
flag = 0
ans = ["AMBIGUOUS", "YYMM", "MMYY", "NA"]

if (a >= 1 and a <= 12) and (b >= 1 and b <= 12):
    flag = 0
elif (a == 0 and b > 12) or (b == 0 and a > 12) or (b > 12 and a > 12):
    flag = 3
elif ((a > 0 and a <= 12) and (b >= 13)) or (a == 0 and (b >= 1 and b <= 12)) or (b == 0 and (a >= 1 and b <= 12)):
    flag = 2
elif (a >= 13) and (b > 0 and b <= 12):
    flag = 1


print(ans[flag])

Submission status: Wrong Answer

Solution code:
x = input()
a, b = int(x[0:2]), int(x[2:4])
flag = 0
ans = ["AMBIGUOUS", "YYMM", "MMYY", "NA"]

if (a >= 1 and a <= 12) and (b >= 1 and b <= 12):
    flag = 0
elif (a == 0 and b > 12) or (b == 0 and a > 12) or (b > 12 and a > 12):
    flag = 3
elif (a > 0 and a <= 12) and (b >= 13):
    flag = 2
elif (a >= 13) and (b > 0 and b <= 12):
    flag = 1


print(ans[flag])

Submission status: Wrong Answer

Solution code:
x = input()
a, b = int(x[0:2]), int(x[2:4])
flag = 0
ans = ["AMBIGUOUS", "YYMM", "MMYY", "NA"]

if (a > 0 and a <= 12) and (b > 0 and b <= 12):
    flag = 0
elif a == 0 or b == 0 or (b > 12 and a > 12):
    flag = 3
elif (a > 0 and a <= 12) and (b >= 13):
    flag = 2
elif (a >= 13) and (b > 0 and b <= 12):
    flag = 1

print(ans[flag])

Submission status: Wrong Answer

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:
        print("NA")
elif yc(second):
    if mc(first):
        print("MMYY")
    else:
        print("NA")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

S = input()

f = int(S[:2])
s = int(S[2:])

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

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

S = input()

f = int(S[:2])
s = int(S[2:])

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

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

S = input()

f = int(S[:2])
s = int(S[2:])

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

Submission status: Wrong Answer

Solution code:
n=input()

n1,n2=int(n[:2]),int(n[2:])
if (n1>12 and n2>12) or n1==0 or n2==0:
    print("NA")
elif (n1!=0 and n1<=12) and (n2!=0 and n2<=12):
    print("AMBIGUOUS")
elif n1!=0 and n1<=12:
    print("MMYY")
elif n2!=0 and n2<=12:
    print("YYMM")
else:
    print("errer")

Submission status: Wrong Answer

Solution code:
n=input()

n1,n2=int(n[:2]),int(n[2:])
if (n1>12 and n2>12) or (n1==0 and n2==0):
    print("NA")
elif (n1!=0 and n1<=12) and (n2!=0 and n2<=12):
    print("AMBIGUOUS")
elif n1!=0 and n1<=12:
    print("MMYY")
elif n2!=0 and n2<=12:
    print("YYMM")
else:
    print("errer")

Submission status: Wrong Answer

Solution code:
n=input()

n1,n2=int(n[:2]),int(n[2:])
if (n1>12 and n2>12) or n1==0 or n2==0:
    print("NA")
elif (n1!=0 and n1<=12) and (n2!=0 and n2<=12):
    print("AMBIGUOUS")
elif n1!=0 and n1<=12:
    print("MMYY")
elif n2!=0 and n2<=12:
    print("YYMM")
else:
    print("errer")

Submission status: Wrong Answer

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

n=input()

n1,n2=int(n[:2]),int(n[2:])
if n1>12 and n2>12 or n1==0 or n2==0:
    print("Na")
elif (n1!=0 and n1<=12) and (n2!=0 and n2<=12):
    print("AMBIGUOUS")
elif n1!=0 and n1<=12:
    print("MMYY")
elif n2!=0 and n2<=12:
    print("YYMM")
else:
    print("errer")

Submission status: Wrong Answer

Solution code:
n=input()

n1,n2=int(n[:2]),int(n[2:])
if n1>12 and n2>12 or n1==0 or n2==0:
    print("Na")
elif (n1!=0 and n1<=12) and (n2!=0 and n2<=12):
    print("AMBIGUOUS")
elif n1!=0 or n1<=12:
    print("MMYY")
elif n2!=0 or n2<=12:
    print("YYMM")
else:
    print("errer")

Submission status: Wrong Answer

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

n=input()

n1,n2=int(n[:2]),int(n[2:])
if n1>12 and n2>12 or n1==0 or n2==0:
    print("Na")
elif n1<=12 and n2<=12:
    print("AMBIGUOUS")
elif n1!=0 or n1<=12:
    print("MMYY")
elif n2!=0 or n2<=12:
    print("YYMM")
else:
    print("errer")

Submission status: Wrong Answer

Solution code:
n=input()

n1,n2=int(n[:2]),int(n[2:])
if n1>12 and n2>12 or n1==0 or n2==0:
    print("Na")
elif n1<=12 and n2<=12:
    print("AMBIGUOUS")
elif n1<=12:
    print("MMYY")
elif n2<=12:
    print("YYMM")
else:
    print("errer")