Problem:


Score : 200 points

Problem Statement

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

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

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

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

Constraints

S is a digit sequence of length 4.

Input

Input is given from Standard Input in the following format:

S

Output

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

Sample Input 1

1905

Sample Output 1

YYMM

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

Sample Input 2

0112

Sample Output 2

AMBIGUOUS

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

Sample Input 3

1700

Sample Output 3

NA

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



Sample input:
1905


Sample output:
YYMM

Submission status: Accepted

Solution code:
import numpy as np
import math

def is_month(month):
    if (month >= 1) and (month <= 12):
        return True
    else:
        return False

def is_yymm(one, two):
    if is_month(two):
        return True
    else:
        return False

def is_mmyy(one, two):
    if is_month(one):
        return True
    else:
        return False
def main():
    S = input()
    one = int(S[0:2])
    two = int(S[2: 4])
    if is_yymm(one, two) and is_mmyy(one, two):
        print("AMBIGUOUS")
    elif(is_yymm(one, two) and ~is_mmyy(one, two)):
        print("YYMM")
    elif(~is_yymm(one, two) and is_mmyy(one, two)):
        print("MMYY")
    else:
        print("NA")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
A = S[0]+S[1]
B = S[2]+S[3]
L = ['01','02','03','04','05','06','07','08','09','10','11','12']
if (A in L) and (B in L):
  print('AMBIGUOUS')
elif A not in L:
  if B not in L:
    print('NA')
  else:
    print('YYMM')
else:
  print('MMYY')

Submission status: Accepted

Solution code:
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


S = read()[:-1]

flg1, flg2 = False, False

first = int(S[:2])
last = int(S[2:])

# print(first, last)
if 0 < first < 13:
    flg1 = True

if 0 < last < 13:
    flg2 = True

if flg1 and flg2:
    print('AMBIGUOUS')

if flg1 and not flg2:
    print('MMYY')

if flg2 and not flg1:
    print('YYMM')

if not flg2 and not flg1:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S = input()

before = False
after = False
if 0 < int(S[0:2]) <= 12:
    before = True

if 0 < int(S[2:4]) <= 12:
    after = True

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

Submission status: Accepted

Solution code:
S=int(input())
if S//100>=13 or S//100==0:
  if 1<=S%100<=12:
    print("YYMM")
  else:print("NA")
if 1<=S//100<=12:
  if S%100>=13 or S%100==0:
    print("MMYY")
  else:print("AMBIGUOUS")

Submission status: Accepted

Solution code:
from sys import exit

S = input()

first = int(S[0] + S[1])
second = int(S[2] + S[3])

mm_first = True

mm_second = True

if 1 <= first <= 12:
    mm_first = True
else:
    mm_first = False

if 1 <= second <= 12:
    mm_second = True
else:
    mm_second = False

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

Submission status: Accepted

Solution code:
s = input().strip()
left = int(s[:2])
right = int(s[2:])
if (left == 0 or left > 12) and 1 <= right <= 12:
    print('YYMM')
elif 1 <= left <= 12 and (right == 0 or right > 12):
    print('MMYY')
elif 1 <= left <= 12 and 1 <= right <= 12:
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

Solution code:
def has_month_potential(num):
    return num >= 1 and num <= 12

S = input()

formar = int(S[:2])
latter = int(S[2:])

if has_month_potential(formar) and not has_month_potential(latter):
    print('MMYY')
elif not has_month_potential(formar) and has_month_potential(latter):
    print('YYMM')
elif has_month_potential(formar) and has_month_potential(latter):
    print('AMBIGUOUS')
elif not has_month_potential(formar) and not has_month_potential(latter):
    print('NA')

Submission status: Accepted

Solution code:
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsm = lambda: map(str, sys.stdin.readline().split())

s = ns()
lisy = [str(i).zfill(2) for i in range(0, 100)]
lism = [str(i).zfill(2) for i in range(1, 13)]

if str(s[:2]) in lisy and str(s[2:]) in lism:
    if str(s[:2]) in lism and str(s[2:]) in lisy:
        print('AMBIGUOUS')
        exit()
    else:
        print('YYMM')
        exit()
if str(s[:2]) in lism and str(s[2:]) in lisy:
    if str(s[:2]) in lisy and str(s[2:]) in lism:
        print('AMBIGUOUS')
        exit()
    else:
        print('MMYY')
        exit()
print('NA')

Submission status: Accepted

Solution code:
s = input()

m_flag = [False, False]

if 1 <= int(s[:2]) <= 12:
    m_flag[0] = True

if 1 <= int(s[2:]) <= 12:
    m_flag[1] = True

if m_flag[0] and m_flag[1]:
    print("AMBIGUOUS")

if m_flag[0] and not m_flag[1]:
    print("MMYY")

if not m_flag[0] and m_flag[1]:
    print("YYMM")

if not m_flag[0] and not m_flag[1]:
    print("NA")

Submission status: Accepted

Solution code:
s = input()
tuki = ('01','02','03','04','05','06','07','08','09','10','11','12')
mae = s[0] + s[1]
usiro = s[2] + s[3]
if mae in tuki and usiro in tuki:
        print('AMBIGUOUS')
elif mae in tuki:
        print('MMYY')
elif usiro in tuki:
        print('YYMM')
else:print('NA')

Submission status: Accepted

Solution code:
S = input()

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

mm1 = first <= 12 and first > 0
mm2 = second <= 12 and second > 0

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

Submission status: Accepted

Solution code:
S = list(input())

aa = int(S[0]+S[1])
bb = int(S[2]+S[3])

yymm = 0;
mmyy = 0;

if(1<=aa and aa<=12):
    yymm = 1;

if(1<=bb and bb<=12):
    mmyy = 2;

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

Submission status: Accepted

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


def main():
    s = input()
    first = int(s[:2])
    last = int(s[2:])

    if first == 0 or first > 12:
        if last >= 1 and last <= 12:
            print('YYMM')
            return
        else:
            print('NA')
            return
    else:
        # first = 1 ~ 12
        if last >= 1 and last <= 12:
            print('AMBIGUOUS')
            return
        else:
            print('MMYY')
            return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
read = input
s = read()
a, b = map(int , [s[:2], s[2:]])
YYMM = False
MMYY = False
if 1 <= b and b <= 12:
    YYMM = True
if 1 <= a and a <= 12:
    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:
import datetime
s = input()
try:
  a = datetime.datetime.strptime(s, '%y%m')
except ValueError:
  a = None
try:
  b = datetime.datetime.strptime(s, '%m%y')
except ValueError:
  b = None
if a==None and b==None:
  print("NA")
elif a!=None and b!=None:
  print("AMBIGUOUS")
elif a!=None:
  print("YYMM")
elif b!=None:
  print("MMYY")

Submission status: Accepted

Solution code:
S = input()

mae = int(S[:2])
ato = int(S[2:])

mae_f = 0

if mae >= 1 and mae <=12:
    mae_f = 1

ato_f = 0

if ato >= 1 and ato <=12:
    ato_f = 1
    
if mae_f == 0 and ato_f == 0:
    print('NA')
elif mae_f == 1 and ato_f == 1:
    print('AMBIGUOUS')
elif mae_f == 0:
    print('YYMM')
else:
    print('MMYY')

Submission status: Accepted

Solution code:
m = {0:"NA", 1:"YYMM", 2:"MMYY", 3:"AMBIGUOUS"}
s = input()
ans = 0
a = int(s[:2])
b = int(s[2:])
if 0 <= a <= 99 and 1 <= b <= 12:
    ans |= 1
if 0 <= b <= 99 and 1 <= a <= 12:
    ans |= 2
print(m[ans])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()

head = int(s[:2])
tail = int(s[2:])

mmyy = 1 <= head <= 12
yymm = 1 <= tail <= 12

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

Submission status: Accepted

Solution code:
s = list(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

if S == '0000':
    print('NA')
else:
    if '01' <= S[0:2] <= '12' and (S[2:4] >= '13' or S[2:4] == '00'):
        print('MMYY')
    elif '01' <= S[2:4] <= '12' and S[0:2] >= '13' or S[0:2] == '00':
        print('YYMM')
    elif '01' <= S[0:2] <= '12' and '01' <= S[2:4] <= '12':
        print('AMBIGUOUS')
    else:
        print('NA')

Submission status: Accepted

Solution code:
# coding: utf-8
import numpy as np
from functools import lru_cache
import time

def main(): 
    if True:
        S = int(input())
    else:
        pass

    AA = S // 100
    BB = S % 100

    if (0 < AA <= 12) & (0 < BB <= 12):
        print("AMBIGUOUS")
    elif(0 < AA <= 12):
        print("MMYY") 
    elif(0 < BB <= 12):
        print("YYMM")
    else:
        print("NA")

if __name__ =='__main__':
    main()

Submission status: Accepted

Solution code:
S=input()

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

Submission status: Accepted

Solution code:
import sys
import collections
from collections import Counter
from collections import deque
from collections import defaultdict
import itertools
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from itertools import takewhile
from itertools import compress
import functools
from functools import reduce
import math
####from math import gcd
####from math import inf
from math import ceil
from math import floor
##from math import log10
##from math import log2
##from math import log
from math import factorial
import re
from functools import lru_cache

# @lru_cache(maxsize=1000)

# MOD = 10 ** 9 + 7

# N = int(input())
# A = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]

# N, K = [int(x) for x in input().split()]
# A = [int(x) for x in input().split()]


S = input()

a = S[0] + S[1]
b = S[2] + S[3]

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

isYYMM = False
isMMYY = False

if 1 <= b and b <= 12:
    isYYMM = True

if 1 <= a and a <= 12:
    isMMYY = True

# if a >= 13 and (b == 0 or b >= 13):
#     isYYMM = False
#     isMMYY = False



ans = ""
if isYYMM == True and isMMYY == True:
    ans = "AMBIGUOUS"
elif isYYMM == True:
    ans = "YYMM"
elif isMMYY == True:
    ans = "MMYY"
else:
    ans = "NA"

print(ans)

Submission status: Accepted

Solution code:
S = input()
a, b = int(S[:2]), 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("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:
    print('MMYY')
elif 1<=int(S[2:])<=12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S=int(input())
A=S//100
B=S%100
#print(A,B)

if A==0 and B==0:
    print("NA")
elif A==0 and B>=13:
    print("NA")
elif A>=13 and B==0:
    print("NA")
elif A>=13 and B>=13:
    print("NA")
elif A==0 and 1<=B<=12:
    print("YYMM")
elif 1<=A<=12 and B==0:
    print("MMYY")
elif 1<=A<=12 and 1<=B<=12:
    print("AMBIGUOUS")
elif 1<=A<=12 and 13<=B:
    print("MMYY")
elif 13<=A and 1<=B<=13:
    print("YYMM")

Submission status: Accepted

Solution code:
import sys

class SamInput(object):
    def __init__(self):
        self.inp = []
        for i in sys.stdin:
            i = i.replace("\n", "")
            j = list(i.split())
            self.inp.append(j)

    def readln(self):
        if len(self.inp) == 0:
            return False
        else:
            return str.join(" ", self.inp.pop(0))

    def read(self):
        if len(self.inp) == 0:
            return False
        while len(self.inp[0]) == 0:
            self.inp.pop(0)
            if len(self.inp) == 0:
                return False
        return self.inp[0].pop(0)

def main():
    inp = SamInput()
    x = inp.read()

    p1 = int(x[:2])
    p2 = int(x[2:])

    posdm = True
    posmd = True

    if p1 < 1 or p1 > 12:
        posmd = False

    if p2 < 1 or p2 > 12:
        posdm = False

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    S = input()

    former = S[:2]
    latter = S[2:]

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

def mm_ok(s):
    months = ['{:0>2}'.format(i+1) for i in range(12)]
    if s in months:
        return True
    else:
        return False


main()

Submission status: Accepted

Solution code:
S = input()

ml = [str(i).zfill(2) for i in range(1, 13)]

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

Submission status: Accepted

Solution code:
import sys
S = int(input())

mae = S//100
ushiro = S%100

if 0 < mae and mae <= 12:
    if 0 < ushiro and ushiro <= 12:
        print ('AMBIGUOUS')
        sys.exit()
    else:
        print ('MMYY')
        sys.exit()
if 0 < ushiro and ushiro <= 12:
    if 0 < mae and mae <= 12:
        print ('AMBIGUOUS')
        sys.exit()
    else:
        print ('YYMM')
        sys.exit()
print ('NA')

Submission status: Accepted

Solution code:
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
# import statistics
import bisect
import copy
import fractions
import math
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) 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 MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v):
    # ノードに訪れた
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  # そもそもvとv2が辺でつながっていない
            continue
        if visited[v2] == True:  # もう見た
            continue
        dfs(v2)

s = IS()
if 0 < int(s[0:2]) <= 12 and 0 < int(s[2:4]) <= 12:
    print('AMBIGUOUS')
elif 0 <= int(s[0:2]) <= 99 and 0 < int(s[2:4]) <= 12:
    print('YYMM')
elif 0 < int(s[0:2]) <= 12 and 0 <= int(s[2:4]) <= 99:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

s_1 = int(s[:2])
s_2 = int(s[2:])

ans = ""

if (0<s_1<=12):
  if (0<s_2<=12):
    ans = "AMBIGUOUS"
  else:
    ans = "MMYY"
else:
  if (0<s_2<=12):
    ans = "YYMM"
  else:
    ans = "NA"
    
print(ans)

Submission status: Accepted

Solution code:
S = input()

m = int(S[:2])
u = int(S[2:])

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

Submission status: Accepted

Solution code:
def sub():
    S = input()
    head = int(S[:2])
    tail = int(S[2:])

    isHeadMM = False
    if head <=12 and head >0:
        isHeadMM = True

    isTailMM = False
    if tail <=12 and tail >0:
        isTailMM = True

    if isHeadMM is True and isTailMM is False:
        print("MMYY")
    elif isHeadMM is False and isTailMM is True:
        print("YYMM")
    elif isHeadMM is True and isTailMM is True:
        print("AMBIGUOUS")
    else:
        print("NA")

sub()

Submission status: Accepted

Solution code:
S = input()

str1 = int(S[0:2])
str2 = int(S[2:4])

MMYY = False
YYMM = False

# MMYY
if 1 <= str1 and str1 <= 12 and 0 <= str2 and str2 <= 99:
    MMYY = True
# YYMM
if 0 <= str1 and str1 <= 99 and 1 <= str2 and str2 <= 12:
    YYMM = True

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
import math

def judY(y):
    if  0<=y and y <= 99:
        return True
    else:
        return  False

def judM(m):
    if  0<m and m <=12:
        return True
    else:
        return  False



s1 = input()
zenhan = int (s1[0:2])
kohan  = int(s1[2:])

zenhanY = False
zenhanM = False
kohanY = False
kohanM = False
if judY(zenhan):
    zenhanY = True

if judM(zenhan):
    zenhanM = True

if judM(kohan):
    kohanM = True

if judY(kohan):
    kohanY = True


YYMM = False
MMYY = False
if zenhanY and kohanM:
    YYMM = True

if zenhanM and kohanY:
    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 = input()
A = int(S[0]+S[1])
B = int(S[2]+S[3])
if (A > 0 and A < 13) and (B > 0 and B < 13):
    print('AMBIGUOUS ')
elif (A > 0 and A < 13) and (B > 12 or B == 0):
    print('MMYY')
elif (A > 12 or A == 0) and (B > 0 and B < 13):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s=input()
first=int(s[0:2])
last=int(s[2:4])

if last>=1 and last<=12 and first>=1 and first<=12:
    print("AMBIGUOUS")

elif last>=1 and last<=12 :
    print("YYMM")
elif first>=1 and first<=12:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

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

if a and b:
    print("AMBIGUOUS")
if a and not b:
    print("MMYY")
if not a and b:
    print("YYMM")
if not a and not b:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
up_y_flg = False
dw_y_flg = False
up_m_flg = False
dw_m_flg = False

if 1 <= int(S[0:2]) <= 12:
    up_m_flg = True
if 0 <= int(S[0:2]) <= 99:
    up_y_flg = True
if 1 <= int(S[2:4]) <= 12:
    dw_m_flg = True
if 0 <= int(S[2:4]) <= 99:
    dw_y_flg = True


if up_y_flg and dw_m_flg:
    if up_m_flg and dw_y_flg:
        print("AMBIGUOUS")
    else:
        print("YYMM")
elif up_m_flg and dw_y_flg:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
from sys import stdin


def valid_month(n):
    return 0 < n <= 12


def solve(s):
    fst, snd = int(s[:2]), int(s[2:])
    is_yymm = valid_month(snd)
    is_mmyy = valid_month(fst)
    if is_yymm and is_mmyy:
        return 'AMBIGUOUS'
    elif is_yymm or is_mmyy:
        return 'YYMM' if is_yymm else 'MMYY'
    else:
        return 'NA'


def main():
    s = stdin.readlines()[0].strip()
    ans = solve(s)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

S = input()


temp1 = int(S[:2])
temp2 = int(S[2:])

flag1 = 0
flag2 = 0

if temp1 >= 13 or temp1 == 0:
    flag1 = 1
if temp2 >= 13 or temp2 == 0:
    flag2 = 1

if flag1 == 1 and flag2 == 0:
    ans = 'YYMM'
elif flag1 == 0 and flag2 == 1:
    ans = 'MMYY'
elif flag1 == 0 and flag2 == 0:
    ans = 'AMBIGUOUS'
else:
    ans = 'NA'
print(ans)

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
AA, BB = int(S[:2]), int(S[2:])
if 1 <= AA and AA <= 12:
    if 1 <= BB and BB <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= BB and BB <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S=input()
first2 = int(S[0:2])
last2 = int(S[2:4])

if 1 <= first2 and first2 <= 12:
  if 1 <= last2 and last2 <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= last2 and last2 <= 12:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

Solution code:
def isMM(N0,N1):
  if N0*10 + N1>= 13:
    return False
  elif N0==0 and N1==0:
    return False
  else:
    return True
    
S = input()

N0 = int(S[0:1])
N1 = int(S[1:2])
N2 = int(S[2:3])
N3 = int(S[3:4])

D0 = isMM(N0,N1)
D1 = isMM(N2,N3)

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

Submission status: Accepted

Solution code:
#!venv/bin/python

# N, K = [ int(x) for x in input().split() ]
S = input()

def is_yymm(str):
    _yy = int(str[0:2])
    mm = int(str[2:4])
    return (1 <= mm and mm <= 12)

def is_mmyy(str):
    mm = int(str[0:2])
    _yy = int(str[2:4])
    return (1 <= mm and mm <= 12)

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

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
input = sys.stdin.readline

# N = int(input())
# L = [int(x) for x in input().split()]
# N, K = map(int, input().split())
S = input()

first_half = int(S[0 : 2])
second_half = int(S[2 : 4])

is_YYMM = False
is_MMYY = False

if 0 <= first_half and first_half <= 99 and 1 <= second_half and second_half <= 12 :
    is_YYMM = True
if 1 <= first_half and first_half <= 12 and 0 <= second_half and second_half <= 99 :
    is_MMYY = True

print("AMBIGUOUS" if is_YYMM and is_MMYY else "YYMM" if is_YYMM else "MMYY" if is_MMYY else "NA")

Submission status: Accepted

Solution code:
s = input()

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

def is_month(value):
    if value != 0 and value <= 12:
        return True
    else:
        return False

if is_month(a) and is_month(b):
    print("AMBIGUOUS")
elif not is_month(a) and not is_month(b):
    print("NA")
else:
    if is_month(a):
        print("MMYY")
    else:
        print("YYMM")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
 
left = S[0:2]
right = S[2:4]
if left[0] == "0": left = left[1]
if right[0] == "0":right = right[1]
left, right = int(left), int(right)
 
if 1 <= left <= 12 and 1 <= right <= 12:
    print("AMBIGUOUS")
elif 1 <= left <= 12:
    print("MMYY")
elif 1 <= right <= 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 (A > 0) & (A < 13) & (B > 0) & (B < 13):
    print('AMBIGUOUS')
elif (A > 0) & (A < 13):
    print('MMYY')
elif (B > 0) & (B < 13):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
n = input()

firsttwo = int(n[0:2])
lasttwo = int(n[2:4])

if(firsttwo > 00 and firsttwo < 13):
  if(lasttwo > 00 and lasttwo < 13):
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if(lasttwo > 00 and lasttwo < 13):
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
a = str(input())
a = list(a)

XX = int(a[0]+a[1])
YY = int(a[2]+a[3])

x=0
y=0
if(XX<=12 and XX!=0):
    x=1
if(YY<=12 and YY!=0):
    y=1

if(x+y==2):
    print("AMBIGUOUS")
elif(x==1):
    print("MMYY")
elif(y==1):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = int(input())


pre = S // 100
lat = S % 100

# pre is MM?
is_pre_mmable = False
if 0 < pre and pre <= 12:
    is_pre_mmable = True

is_lat_mmable = False
if 0 < lat and lat <= 12:
    is_lat_mmable = True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
AtCoder C
"""
 
# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = int(input()) for _ in range(N) # 1 row N column
 
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
 
def main():
    N = int(input())
    A= N//100
    B= N%100
    if (A==0 and B== 0) or (A==0 and B>12) or (A>12 and B==0)  or (A>12 and B>12):
        print("NA")
    elif ( A>12 or A==0) and(B<13):
        print("YYMM")
    elif(A<13) and(B>12 or B==0):
        print("MMYY")
    elif( A<13 and B<13):
        print("AMBIGUOUS")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = list(input())

S_be = S[0] + S[1]
S_af = S[2] + S[3]

if 0 < int(S_be) and int(S_be) <= 12:
    if 0 < int(S_af) and int(S_af) <= 12:
        print("AMBIGUOUS")
    
    else:
        print("MMYY")

else:
    if 0 < int(S_af) and int(S_af) <= 12:
        print("YYMM")
    
    else:
        print("NA")

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

S = input()

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

am = ay = bm = by = False
if 1 <= a <= 12:
    am = True
if 1 <= b <= 12:
    bm = True
ay = True
by = True

#print(am,ay,bm,by)

if am and bm and ay and by:
    print('AMBIGUOUS')
elif am and by:
    print('MMYY')
elif bm and ay:
    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 and a<=12 and 1<=b and b<=12:
  print("AMBIGUOUS")
elif 1<=a and a<=12:
  print("MMYY")
elif 1<=b and b<=12:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
import sys
import datetime
def input(): return sys.stdin.readline().strip()

s  = lambda: input()

S = s()

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

yymm = True
mmyy = True
try:
  datetime.datetime.strptime(a+b, "%y%m")
except:
  yymm = False

try:
  datetime.datetime.strptime(b+a, "%y%m")
except:
  mmyy = False

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