Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#include <string.h>
#include <map>
#define Z #include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#include <string.h>
#include <map>
#define Z class
#define ln cout<<'\n'
#define ll long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
//ASCII a=97, A=65
// int H[N]; rep(i,N) scanf("%d", &H[i]);
// int max_x = *std::max_element(x.begin(), x.end());
// int min_y = *std::min_element(y.begin(), y.end());
// sort(vec.begin(), vec.end()); std::greater<>()
// reverse(vec.begin(), vec.end());
// scanf("%s",s);
// printf("%d\n",end-start+1);
// ceil (a + (b - 1)) / b

using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;

int main(){
    string s; cin >> s;
    int num = atoi(s.c_str());
    int start = num/100;
    int end = num%100;
    string res;

    if((0<start && start <= 12) && (end > 12 || end == 0)){
        res = "MMYY";
    } else if((start > 12 || start == 0) && (0<end && end <= 12)) {
        res = "YYMM";
    } else if((0<start && start<=12) && (0<end && end<=12)){
        res = "AMBIGUOUS";
    } else {
        res = "NA";
    }
    cout << res << endl;
}

#define ln cout<<'\n'
#define ll long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
//ASCII a=97, A=65
// int H[N]; rep(i,N) scanf("%d", &H[i]);
// int max_x = *std::max_element(x.begin(), x.end());
// int min_y = *std::min_element(y.begin(), y.end());
// sort(vec.begin(), vec.end()); std::greater<>()
// reverse(vec.begin(), vec.end());
// scanf("%s",s);
// printf("%d\n",end-start+1);
// ceil (a + (b - 1)) / b

using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;

int main(){
    string s; cin >> s;
    int num = atoi(s.c_str());
    int start = num/100;
    int end = num%100;
    string res;

    if(start <= 12 && (end > 12 || end == 0)){
        res = "MMYY";
    } else if((start > 12 || start == 0) && end <= 12) {
        res = "YYMM";
    } else if((0<start && start<=12) && (0<end && end<=12)){
        res = "AMBIGUOUS";
    } else {
        res = "NA";
    }
    cout << res << endl;
}


Compiler output:
a.cc:23:9: warning: "Z" redefined
   23 | #define Z class
      |         ^
a.cc:12:9: note: this is the location of the previous definition
   12 | #define Z #include <iostream>
      |         ^
a.cc:82:31: error: redefinition of 'template<class T> bool chmax(T&, T)'
   82 | template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
      |                               ^~~~~
a.cc:38:31: note: 'template<class T> bool chmax(T&, T)' previously declared here
   38 | template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
      |                               ^~~~~
a.cc:83:31: error: redefinition of 'template<class T> bool chmin(T&, T)'
   83 | template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
      |                               ^~~~~
a.cc:39:31: note: 'template<class T> bool chmin(T&, T)' previously declared here
   39 | template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
      |                               ^~~~~
a.cc:84:19: error: redefinition of 'template<class A> void pr(A)'
   84 | template<Z A>void pr(A a){cout<<a;ln;}
      |                   ^~
a.cc:40:19: note: 'template<class A> void pr(A)' previously declared here
   40 | template<Z A>void pr(A a){cout<<a;ln;}
      |                   ^~
a.cc:85:23: error: redefinition of 'template<class A, class B> void pr(A, B)'
   85 | template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
      |                       ^~
a.cc:41:23: note: 'template<class A, class B> void pr(A, B)' previously declared here
   41 | template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
      |                       ^~
a.cc:86:27: error: redefinition of 'template<class A, class B, class C> void pr(A, B, C)'
   86 | template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
      |                           ^~
a.cc:42:27: note: 'template<class A, class B, class C> void pr(A, B, C)' previously declared here
   42 | template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
      |                           ^~
a.cc:87:31: error: redefinition of 'template<class A, class B, class C, class D> void pr(A, B, C, D)'
   87 | template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
      |                               ^~
a.cc:43:31: note: 'template<class A, class B, class C, class D> void pr(A, B, C, D)' previously declared here
   43 | template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
      |                               ^~
a.cc:88:19: error: redefinition of 'template<class A> void PR(A, long long int)'
   88 | template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
      |                   ^~
a.cc:44:19: note: 'template<class A> void PR(A, long long int)' previously declared here
   44 | template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
      |                   ^~
a.cc:90:5: error: redefinition of 'int GCD(int, int)'
   90 | int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
      |     ^~~
a.cc:46:5: note: 'int GCD(int, int)' previously defined here
   46 | int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
      |     ^~~
a.cc:91:17: error: redefinition of 'const long long int INF'
   91 | const long long INF = 1LL << 60;
      |                 ^~~
a.cc:47:17: note: 'const long long int INF' previously defined here
   47 | const long long INF = 1LL << 60;
      |                 ^~~
a.cc:93:5: error: redefinition of 'int main()'
   93 | int main(){
      |     ^~~~
a.cc:49:5: note: 'int main()' previously defined here
   49 | int main(){
      |     ^~~~