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()
ls=[int(c) for c in s]

if ((ls[0]==1 and ls[1]>2) or (ls[0]==0 and ls[1]==0)) and not ((ls[2]==1 and ls[3]>2) or (ls[2]==0 and ls[3]==0)):
    print("YYMM")
elif ((ls[2]==1 and ls[3]>2) or (ls[2]==0 and ls[3]==0)) and not ((ls[0]==1 and ls[1]>2) or (ls[0]==0 and ls[1]==0)):
    print("MMYY")
elif not ((ls[0]==1 and ls[1]>2) or (ls[0]==0 and ls[1]==0)) and not ((ls[2]==1 and ls[3]>2) or (ls[2]==0 and ls[3]==0)):
    print("AMBIGUOUS")
elif ((ls[0]==1 and ls[1]>2) or (ls[0]==0 and ls[1]==0)) and  ((ls[2]==1 and ls[3]>2) or (ls[2]==0 and ls[3]==0)):
    print("NA")

Submission status: Wrong Answer

Solution code:
s =input()
ym=0
my=0
if 0<int(s[0:2]):
    ym+=1
    if int(s[0:2])<13:
        my+=1
    else:
        my-=1
else:
    ym=-1
    my-=1

if 0<int(s[2:4]):
    my+=1
    if int(s[2:4])<13:
        ym+=1
    else:
        ym-=1
else:
    ym=-1
    my-=1
    
if ym==2 and my==2:
    print("AMBIGUOUS")    
elif ym==2:
    print("YYMM")
elif my ==2:
    print("MMYY")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:

S = list(input())

front = int(S[0]+S[1])
rear = int(S[2]+S[3])



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

Submission status: Wrong Answer

Solution code:
import sys
s = int(input())
a = s //100
b = s % 100
mmyy = 0
yymm = 0

if 1<=a <= 12:
    if 1<=b <= 12:
         yymm = 1
         mmyy = 1
elif 0 <= a <= 99:
    if 1<=b <= 12:
         yymm = 1

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

Submission status: Wrong Answer

Solution code:
x = list(input())

if int(x[0]) == 0 and int(x[1]) == 0:
    print('NA')
elif int(x[2]) == 0 and int(x[3]) == 0:
    print('NA')
elif int(x[0]) >= 1 and int(x[1]) > 2:
    if int(x[2]) >= 1 and int(x[3]) > 2:
        print('NA')
    else:
        print('YYMM')
elif int(x[2]) >= 1 and int(x[3]) > 2:
    if int(x[0]) >= 1 and int(x[1]) > 2:
        printf("NA")
    else:
        print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=int(input())
S1=S%100
S2=S/100
if S1<=12 and S1!=0 and S2 <=12 and S2!=0:
    ans='AMBIGUOUS'
elif S1<=12 and S1!=0:
    ans='YYMM'
elif S2 <=12 and S2!=0:
    ans='MMYY'
else:
    ans='NA'
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
S=(stdin.readline().rstrip())
if int(S[0:2]) == 0 or int(S[2:]) ==0:
    print("NA")
elif int(S[0:2]) > 12 and int(S[2:]) > 12:
    print("NA")
else :
    mae=0
    usiro=0
    if int(S[0:2]) > 12:
        mae = 1
    if int(S[2:]) > 12:
        usiro = 1
    
    if mae == 0 and usiro == 0:
        print("AMBIGUOUS")
    elif mae == 0 and usiro ==1:
        print("MMYY")
    elif mae == 1 and usiro ==0:
        print("YYMM")

Submission status: Wrong Answer

Solution code:
s = input();
first = s[0:2]
second = s[2:4]

first = int(first)
second = int(second)

if (0 < first and first < 13) and (0 < second and second < 13):
    print("AMBIGUOUS")

elif 12 < first and (0 < second and second < 13):
    print("YYMM")

elif (0 < first and first < 13) and 12 < second:
    print("MMYY")

else:
    print("NA")

Submission status: Wrong Answer

Solution code:
from sys import stdin
S = stdin.readline().rstrip()
if 13 <= int(S[:2]):
    if 1 <= int(S[2:]) <= 12:
        print('YYMM')
    else:
        print('NA')
elif 1 <= int(S[:2]) <= 12:
    if 1 <= int(S[2:]) <= 12:
        print('AMBIGUOUS')
    elif 13 <= int(S[2:]):
        print('MMYY')
    elif int(S[2:]) == 0:
        print('MMYY')
    else:
        print('NA')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
s=list(input())
ss=s[:2]
sss=s[2:]
x=int("".join(ss))
y=int("".join(sss))
print(x,y)
if 1<=x<=12 and 1<=y<=12:
    print("AMBIGUOUS")
elif 1<=x<=12 :
    print("MMYY")
elif 1<=y<=12:
    print("YYMM")
elif x==0 and y==0:
    print("NA")
elif x>=13 and y==0:
    print("NA")
elif x==0 and y>=13:
    print("NA")
elif x>=13 and y>=13:
    print("NA")

Submission status: Wrong Answer

Solution code:
S = list(input())

S1 = int(''.join(S[0:2]))
S2 = int(''.join(S[2:4]))

S1_state = [0,0]
S2_state = [0,0]
if (S1 > 0 and S1 < 13):
  S1_state[1] = 1
if S1 > 0:
  S1_state[0] = 1
if (S2 > 0 and S2 < 13):
  S2_state[1] = 1
if S2 > 0:
  S2_state[0] = 1

if (S1_state[0] and S2_state[1]) and (S2_state[0] and S1_state[1]):
  print('AMBIGUOUS')
elif S1_state[0] and S2_state[1]:
  print('YYMM')
elif S1_state[1] and S2_state[0]:
  print('MMYY')
else:
  print('NA')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
data = list( input() )
n1 = int( data[0] + data[1] )
n2 = int( data [2] + data[3] )

if 1 <= n1 <= 12 and 1 <= n2 <= 12:
    print('AMBIGUOUS')
elif 1 <= n1 <= 12 and n2 > 0:
    print('MMYY')
elif 1 <= n2 <= 12 and n1 > 0:
    print('YYMM')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
input_int = lambda:int(input())
input_ints = lambda:map(int,input().split())
input_ints_list = lambda:list(input_ints())
input_str = lambda:input()
input_strs = lambda:input().split()
input_lines = lambda n,input_func:[input_func() for _ in range(n)]

import importlib
import_module = lambda module_name:importlib.import_module(module_name)

init_array_1dim = lambda value,n:[value]*n # 1次元配列を生成
init_array_2dim = lambda value,n,m:[init_array_1dim(value,n) for _ in range(m)] # 2次元配列を生成

gcd_base = lambda value1,value2:import_module('fractions').gcd(value1,value2) # 最大公約数（2値)
gcd = lambda lst:import_module('functools').reduce(gcd_base,lst) # 最大公約数（リスト）
lcm_base = lambda value1,value2:(value1*value2)//gcd_base(value1,value2) # 最小公倍数(2値)
lcm = lambda lst:import_module('functools').reduce(lcm_base,lst,1) # 最小公倍数(リスト)

permutations = lambda lst,n:import_module('itertools').permutations(lst,n) # 順列
combinations = lambda lst,n:import_module('itertools').combinations(lst,n) # 組み合わせ
product = lambda lst1,lst2:import_module('itertools').product(lst1,lst2) # 二つのリストの直積

round = lambda value:round(value) # 四捨五入
ceil = lambda value:import_module('math').ceil(value) # 切り上げ
floor = lambda value:import_module('math').floor(value) # 切り捨て

# キュー
init_q = lambda lst: import_module('collections').deque(lst)
q_pop = lambda q: q.popleft() # 先頭から取り出し
q_push = lambda q,value:q.appendleft(value) # 先頭に追加（値）
q_pushlist = lambda q,lst:q.extendleft(lst) # 先頭に追加（リスト）
q_append = lambda q,value:q.append(value) # 末尾に追加（値）
q_appendlist = lambda q,lst:q.extend(lst) # 末尾に追加（リスト）

# プライオリティキュー
init_heap = lambda a:import_module('heapq').heapify(a)
heap_push = lambda a,v:import_module('heapq').heappush(a,v)
heap_pop = lambda a:import_module('heapq').heappop(a) # 最小値を取り出す

def solution():
    # ここに実装
    S = input_str()

    month_1 = False
    year_1 = False
    if '01'<=S[:2]<='12':month_1 = True
    if '00'<=S[:2]<='19':year_1 = True
    month_2 = False
    year_2 = False
    if '01'<=S[2:]<='12':month_2 = True
    if '00'<=S[2:]<='19':year_2 = True
    
    if month_1 and month_2:
        print('AMBIGUOUS')
        return
    if month_1 and year_2:
        print('MMYY')
        return
    if month_2 and year_1:
        print('YYMM')
        return
    print('NA')

if __name__ == '__main__':
    solution()

Submission status: Wrong Answer

Solution code:
s = str(input())
A = int(s[0:2])
B = int(s[2:4])
if A <= 0 or B <= 0:
    ans = "NA"
if A > 12 and B > 12:
    ans = "NA"
if A<= 12 and B > 12:
    ans = "MMYY"
if A > 12 and B <= 12:
    ans = "YYMM"
if 0 < A <= 12 and 0 < B <= 12:
    ans = "AMBIGUOUS"
print(ans)

Submission status: Wrong Answer

Solution code:
s = str(input())
s_1 = s[0:2]
s_2 = s[2:]
s1 = int(s_1)
s2 = int(s_2)
if s2 > 0 and s2 <= 12:
    if s1 > 0 and s1 <= 12:
        print('AMBIGUOUS')
        exit()
    elif s1 > 0:
        print('YYMM')
        exit()
if s1 > 0 and s1 <= 12:
    if s2 > 0:
        print('MMYY')
        exit()
print('NA')

Submission status: Wrong Answer

Solution code:
S = input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

#v = [int(d) for d in input().split()]
v= list(str(input()))


li = list(np.array_split(v,2))

mae = int(''.join(li[0]))
usiro = int(''.join(li[1]))

ma = 0
usi = 0

if int(usiro) >= 1:
    if int(usiro) <= 12:
        usi = 1
    else:
        usi = 2
else:
    print('NA')
    exit()

if int(mae) >= 1:
    if int(mae) <= 12:
        ma = 1
    else:
        ma = 2
else:
    print('NA')
    exit()


if usi == 0:
    print('NA')
    exit()

if ma == 0:
    print('NA')
    exit()

if usi ==1:
    if ma == 1:

        print('AMBIGUOUS')
    else:
        print('YYMM')

if usi == 2:
    if ma == 1:

        print('MMYY')
    else:
        print('NA')

Submission status: Wrong Answer

Solution code:
s = input()
zenhan = int(s[0:2])
kouhan = int(s[2:])

if zenhan > 12:
    if kouhan > 12 or kouhan==0:
        print("NA")
    else:
        print("YYMM")
elif zenhan==0:
    print("NA")
else:
    if kouhan > 12 or kouhan==0:
        print("MMYY")
    else:
        print("AMBIGUOUS")

Submission status: Wrong Answer

Solution code:
date = input()

top = int(date[0:2])
bottom = int(date[2:4])

is_top_mm = False
is_top_yy = False
is_bottom_mm = False
is_bottom_yy = False

def print_result():
    global is_top_mm
    global is_top_yy
    global is_bottom_mm
    global is_bottom_yy

    # check NA case
    if not is_top_mm and not is_top_yy:
        print('NA')
        return
    if not is_bottom_mm and not is_bottom_yy:
        print('NA')
        return


    # check YYMM case
    if is_top_yy:
        if is_bottom_mm:
            print('YYMM')
            return
        if is_bottom_yy:
            print('NA')
            return

    # check MMYY case
    if is_bottom_yy:
        if is_top_mm:
            print('MMYY')
            return
        if is_top_yy:
            print('NA')
            return

    print('AMBIGUOUS')


if 1 <= top <= 12:
    is_top_mm = True

if 13 <= top <= 99:
    is_top_yy = True

if 1 <= bottom <= 12:
    is_bottom_mm = True

if 13 <= bottom <= 99:
    is_bottom_yy = True

print_result()

Submission status: Wrong Answer

Solution code:
s = input()

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

Submission status: Wrong Answer

Solution code:
S = input()

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

S=list(str(input()))
S1=int("".join(S[0:2]))
S2=int("".join(S[2:4]))

if 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")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
import numpy as np

#v = [int(d) for d in input().split()]
v= list(str(input()))


li = list(np.array_split(v,2))

mae = int(''.join(li[0]))
usiro = int(''.join(li[1]))

ma = 0
usi = 0

if int(usiro) >= 1:
    if int(usiro) <= 12:
        usi = 1
    else:
        usi = 2
else:
    print('NA')
    exit()

if int(mae) >= 1:
    if int(mae) <= 12:
        ma = 1
    else:
        ma = 2
else:
    print('NA')
    exit()


if usi == 0:
    print('NA')
    exit()

if ma == 0:
    print('NA')
    exit()
print(ma,usi)

if usi ==1:
    if ma == 1:

        print('AMBIGUOUS')
    else:
        print('YYMM')

if usi == 2:
    if ma == 1:

        print('MMYY')
    else:
        print('NA')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=input()
S1=int(S[:2])
S2=int(S[2:])

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
S = input()
flag1 = False
flag2 = False

num1 = int(S[0] + S[1])
num2 = int(S[2] + S[3])

if num1 > 0 and (num2 >= 1 and num2 <= 12):
    flag1 = True

if (num1 >= 1 and num1 <= 12) and num2 > 0:
    flag2 = True
    

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def judge_format(text):
    former, latter = int(text[:2]), int(text[2:])
    if 1 <= former <= 12 and latter > 12 or latter == 0:
        return 'MMYY'
    elif 1 <= latter <= 12 and former > 12 or former == 0:
        return 'YYMM'
    elif 1 <= former <= 12 and 1 <= latter <= 12:
        return 'AMBIGUOUS'
    else:
        return 'NA'


def main():
    s = input()
    print(judge_format(s))


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

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

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

else:
    print("NA")

Submission status: Wrong Answer

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

ans = "NA"
if (mae == 0 and ato > 12) or (mae > 12 and ato == 0) or (mae > 12 and ato > 12) or (mae == 0 and ato == 0):
    ans = "NA"
elif mae > 12:
    ans = "YYMM"
elif ato > 12:
    ans = "MMYY"
else:
    ans = "AMBIGUOUS"
print(ans)

Submission status: Wrong Answer

Solution code:
s=input().rstrip()
if int(s[0]+s[1])>=1 and int(s[0]+s[1])<=12  and int(s[2]+s[3])>=1 and int(s[2]+s[3])<=12:
    print('AMBIGUOUS')
elif  int(s[0]+s[1])>=1 and int(s[0]+s[1])<=12 and int(s[2]+s[3])>12:
    print('MMYY')
elif int(s[0]+s[1])>12 and int(s[2]+s[3])>=1 and int(s[2]+s[3])<=12:
    print('YYMM')
else:
    #print(int(s[0]+s[1]))
    
    #print(int(s[2]))
    print('NA')

Submission status: Wrong Answer

Solution code:
s = input()

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

if f != 0:
    if b != 0:
        if f > 12:
            print('YYMM')
        else:
            print('AMBIGUOUS')
    else:
        print('NA')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
S = int(input())

before = S % 100
after = S //100

if after == 0 or before == 0:
  print("NA")
elif after >31 and before > 31:
  print("NA")
elif before <= 12 and after <= 12:
  print("AMBIGUOUS")
elif before <= 12 and after > 12 :
  print("YYMM")
elif before > 12 and after <= 12:
  print("MMYY")
else:
  print("NA")

Submission status: Wrong Answer

Solution code:
S= input()
u = int(S[:2])
l = int(S[2:])
YYMM = False
MMYY = False
if u !=0 and 0<l<13:
    YYMM = True
if l !=0 and 0<u<13:
    MMYY = True
if YYMM and MMYY:
    print("AMBIGUOUS")
elif YYMM:
    print("YYMM")
elif MMYY:
    print("MMYY")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
s = int(input())
h = s//100
l = s%100
# print(h,l)

def check_month(i):
    if i <= 12 and i >= 1:
        return True
    else:
        return False

def check_year(i):
    if i != 0:
        return True
    else:
        return False

ym = check_year(h) and check_month(l)
my = check_month(h) and check_year(l)

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

Submission status: Wrong Answer

Solution code:



S=input()

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

if(f==0 and l==0):
	print("NA")
	exit()
if(f==0 and l<=12):
	print("YYMM")
	exit()
if(f<=12 and l==0):
	print("MMYY")
	exit()

if(f>12 and l<=12):#年はありえない
	print("YYMM")
if(f<=12 and l>12):
	print("MMYY")
if(f<=12 and l<=12):
	print("AMBIGUOUS")
if(f>12 and l>12):
	print("NA")

Submission status: Wrong Answer

Solution code:
S = input()

Left  = int(S[0:2])
Right = int(S[2:4])


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

Submission status: Wrong Answer

Solution code:
S = input()
S_bef = int(S[:2])
S_aft = int(S[-2:])

is_bef_yy = False
is_bef_mm = False
is_aft_yy = False
is_aft_mm = False

if S_bef >= 1 and S_bef <= 12:
    is_bef_mm = True
if S_bef >= 1:
    is_bef_yy = True
if S_aft >= 1 and S_aft <= 12:
    is_aft_mm = True
if S_aft >= 1:
    is_aft_yy = True

if is_bef_yy and is_bef_mm and is_aft_yy and is_aft_mm:
    print('AMBIGUOUS')
elif is_bef_yy and is_aft_mm:
    print('YYMM')
elif is_aft_yy and is_bef_mm:
    print('MMYY')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
DAY = input()
YY = int(DAY[:2])
MM = int(DAY[2:])
#print(YY,MM)

if YY < 1 or MM < 1:
  print("NA")

elif YY <= 12 and MM <= 12:
  print("AMBIGIOUS")
  
else:
  if YY < MM:
  	print("YYMM")
  else:
    print("MMYY")

Submission status: Wrong Answer

Solution code:
S = input()
S1 = int(S[:2])
S2 = int(S[2:])
s_dic = {'1':'YYMM', '2':'MMYY', '3':'AMBIGUOUS', '4':'NA'}
if (S1 == 0 and S2 > 12) or (S1 > 12 and S2 == 0) or (S1 > 12 and S2 > 12) or (S1 == 0 and S2 == 0):
    print(s_dic['4'])
elif S1 > 12 and S2 <= 12:
    print(s_dic['1'])
elif S2 > 12 and S1 <= 12:
    print(s_dic['2'])
elif S1 <= 12 and S2 <= 12:
    print(s_dic['3'])

Submission status: Wrong Answer

Solution code:

S = list(input())

front = int(S[0]+S[1])
rear = int(S[2]+S[3])



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

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    s = input()

    i1 = int(s[0:2])
    i2 = int(s[2:4])

    ans = ""
    if i1 < 1 or i2 < 1:
        ans = "NA"
    else:
        if i1 < 13:
            if i2 < 13:
                ans = "AMBIGUOUS"
            else:
                ans = "MMYY"
        else:
            if i2 < 13:
                ans = "YYMM"
            else:
                ans = "NA"
    print(ans)

Submission status: Wrong Answer

Solution code:
S = input().rstrip()
front = int(S[0:2])
back = int(S[2:4])

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

Submission status: Wrong Answer

Solution code:
A = list(int(i) for i in str(input()))
A, B = A[0]*10+A[1], A[2]*10+A[3]
if A == 0:
    if B == 0 and B>12:
        print("NA")
    else:
        print("YYMM")
if A <= 12:
    if 0 < B and B <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
if A > 12:
    if 0 < B and B <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Wrong Answer

Solution code:
l = list(input())

ab = l[0] + l[1]
cd = l[2] + l[3]

if ab[0] == "0":
    ab = ab[1]
if cd[0] == "0":
    cd = cd[1]

ab = int(ab)
cd = int(cd)
if ab < 13 and cd < 13 and ab != 0 and cd != 0:
    print("AMBIGUOUS")
elif ab >= 13 and cd < 13 and ab != 0 and cd != 0:
    print("YYMM")
elif cd >= 13 and ab < 13 and ab != 0 and cd != 0:
    print("MMYY")
elif ab == 0 and cd == 0:
    print("NA")
elif ab >= 13 and cd >= 13:
    print("NA")
elif ab == 0 and cd < 13 and cd != 0:
    print("YYMM")
elif cd == 0 and ab < 13 and ab != 0:
    print("YYMM")
elif ab == 0 and cd >= 13 and cd != 0:
    print("NA")
elif cd == 0 and ab >= 13 and ab != 0:
    print("NA")

Submission status: Wrong Answer

Solution code:
#-*- coding: utf-8 -*-
"""
oj dl https://atcoder.jp/contests/abc116/tasks/abc116_d -d test-d
oj test -d test-d -c "python abc116d.py"
oj test -d test-d -c "python abc116d.py" test-d/sample-3.in
"""
from collections import defaultdict
import sys
import math
from datetime import datetime
import re

def sol(S):
    #YYMM, MMYY, AMBIGUOUS, NA のうち正しいものを出力せよ。
    if re.match("^[0-1][0-2][0-1][0-2]$", S):
        return 'AMBIGUOUS'
    elif re.match("^[0-9][0-9][1][0-2]$", S):
        return 'YYMM'
    elif re.match("^[0-9][0-9][0][1-9]$", S):
        return 'YYMM'
    elif re.match("^[1][0-2][0-9][0-9]$", S):
        return 'MMYY'
    elif re.match("^[0][1-9][0-9][0-9]$", S):
        return 'MMYY'
    else:
        return 'NA'


do_submit = True
#do_submit = False

def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    print(parsed_lines)
    # n = int(parsed_lines[0][0])
    # k = int(parsed_lines[0][1])
    S = parsed_lines[0][0]
    return S


if not do_submit:
    S = input_parse("""
    1905
    """)
    print(sol(S))

    S = input_parse("""
    0112
    """)
    print(sol(S))

    S = input_parse("""
    1700
    """)
    print(sol(S))



else:
    #n, k = list(map(int, input().split()))
    S = input()
    print(sol(S))

    # S = input().strip()
    # print(sol(S))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def isYear(s):
    try:
        s_int = int(s)
        if s_int <= 0:
            return False
        else:
            return True
    except ValueError:
        return None


def isMonth(s):
    try:
        s_int = int(s)
        if s_int <= 0 or s_int > 12:
            return False
        else:
            return True
    except ValueError:
        return None


if __name__ == '__main__':
    s = input()
    # MMは01-12 YY 01-99
    yy_1 = isYear(s[0:2])
    mm_1 = isMonth(s[0:2])
    yy_2 = isYear(s[2:4])
    mm_2 = isMonth(s[2:4])

    if yy_1 is None or mm_2 is None:
        print("NA")
    else:
        yymm = yy_1 and mm_2
        mmyy = mm_1 and yy_2

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

Submission status: Wrong Answer

Solution code:
a=input()
M=int(a[0]+a[1])
Y=int(a[2]+a[3])

if(M==0):
  if(Y==0):
    print('NA')
  else:
    print('YYMM')
elif(M>12):
  if(Y==0):
    print('NA')
  else:
    print('YYMM')
else:
  if(Y==0):
    print('YYMM')
  else:
    print('AMBIGUOUS')

Submission status: Wrong Answer

Solution code:
S = list(input())
s1 = [S[0],S[1]]
s2 = [S[2],S[3]]
s1 = int("".join(s1))
s2 = int("".join(s2))

if s1 > 12 and s2 > 12:
    print("NA")

elif s1 <1 and s2<1:
    print("NA")

elif s1 >0 and s1 <13 and s2>0 and s2 <13:
    print("AMBIGUOUS")

elif s1 > 0 and s2 < 13:
    print("YYMM")

elif s1 < 13 and s2 > 0:
    print("MMYY")

else:
    print("NA")

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    mae = int(S[:2])
    ushiro = int(S[2:])
    if (mae == 0 or mae > 12) and (ushiro == 0 or ushiro > 12): print('NA')
    elif (mae == 0 or mae > 12): print('YYMM')
    elif (ushiro == 0 or ushiro > 12): print('MMYY')
    else: print('AMBIGuOUS')



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s = input()

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

def check(s1, s2):
    if 1 <= s1 <= 12 and 1 <= s2 <= 12:
        return 'AMBIGUOUS'
    if 1 <= s1 <= 12 and 1 <= s2 <= 19:
        return 'MMYY'
    if 1 <= s2 <= 12 and 1 <= s1 <= 19:
        return 'YYMM'
    return 'NA'

print(check(s1, s2))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())
bef=int(s[0])*10+int(s[1])
aft=int(s[2])*10+int(s[3])

ans=''
if 0<aft<13 and 0<bef<13:
  ans='AMBIGUOUS'
elif 100>aft>31 and 0<bef<13:
  ans='MMYY'
elif 100>bef>12 and 0<aft<32:
  ans='YYMM'
else:
  ans='NA'
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
l = int(s[:2])
r = int(s[2:])

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

Submission status: Wrong Answer

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

s = input()


before = int(s[0:2])
after = int(s[2:4])

before_year = False
after_year = False
before_m = False
after_m = False

if before > 12:
    before_year = True
else: before_m = True

if after > 12:
    after_year = True
else: after_m = True

if before ==0 and after_m==True:
    print('YYMM')
elif after == 0 and before_m==True:
    print('MMYY')
elif before==0 or after==0:
    print('NA')
elif before_year==True and after_year==True:
    print('NA')
elif before_m==True and after_m==True:
    print('AMBIGUOUS')
elif before_year==True and after_m==True:
    print('YYMM')
elif before_m==True and after_year==True:
    print('MMYY')
else:
    print('NA')