Language: C++

using namespace std;

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(x) cout << x << endl;

int main() {
    string s; cin >> s;

    string a = "";
    string b = "";
    a += s[0];
    a += s[1];
    b += s[2];
    b += s[3];

    int ia = stoi(a);
    int ib = stoi(b);

    int cnt = 0;
    // MMYY
    if(
        1 <= ia && ia <= 12 &&
        0 <= ib && ib <= 99
    ) cnt++;
    // YYMM
    if(
        1 <= ib && ib <= 12 &&
        0 <= ia && ia <= 99
    ) cnt += 2;

    if(cnt == 0){
        OP("NA");
    }else if(cnt == 1){
        OP("MMYY");
    }else if(cnt == 2){
        OP("YYMM");
    }else{
        OP("AMBIGUOUS");
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'string' was not declared in this scope
    8 |     string s; cin >> s;
      |     ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:8:15: error: 'cin' was not declared in this scope
    8 |     string s; cin >> s;
      |               ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:8:22: error: 's' was not declared in this scope
    8 |     string s; cin >> s;
      |                      ^
a.cc:10:11: error: expected ';' before 'a'
   10 |     string a = "";
      |           ^~
      |           ;
a.cc:11:11: error: expected ';' before 'b'
   11 |     string b = "";
      |           ^~
      |           ;
a.cc:12:5: error: 'a' was not declared in this scope
   12 |     a += s[0];
      |     ^
a.cc:14:5: error: 'b' was not declared in this scope
   14 |     b += s[2];
      |     ^
a.cc:17:14: error: 'stoi' was not declared in this scope
   17 |     int ia = stoi(a);
      |              ^~~~
a.cc:17:14: note: 'std::stoi' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:5:15: error: 'cout' was not declared in this scope
    5 | #define OP(x) cout << x << endl;
      |               ^~~~
a.cc:33:9: note: in expansion of macro 'OP'
   33 |         OP("NA");
      |         ^~
a.cc:5:15: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #define OP(x) cout << x << endl;
      |               ^~~~
a.cc:33:9: note: in expansion of macro 'OP'
   33 |         OP("NA");
      |         ^~
a.cc:5:28: error: 'endl' was not declared in this scope
    5 | #define OP(x) cout << x << endl;
      |                            ^~~~
a.cc:33:9: note: in expansion of macro 'OP'
   33 |         OP("NA");
      |         ^~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:5:15: error: 'cout' was not declared in this scope
    5 | #define OP(x) cout << x << endl;
      |               ^~~~
a.cc:35:9: note: in expansion of macro 'OP'
   35 |         OP("MMYY");
      |         ^~
a.cc:5:15: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #define OP(x) cout << x << endl;
      |               ^~~~
a.cc:35:9: note: in expansion of macro 'OP'
   35 |         OP("MMYY");
      |         ^~
a.cc:5:28: error: 'endl' was not declared in this scope
    5 | #define OP(x) cout << x << endl;
      |                            ^~~~
a.cc:35:9: note: in expansion of macro 'OP'
   35 |         OP("MMYY");
      |         ^~
a.cc:5:28: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    5 | #define OP(x) cout << x << endl;
      |                            ^~~~
a.cc:35:9: note: in expansion of macro 'OP'
   35 |         OP("MMYY");
      |         ^~
a.cc:5:15: error: 'cout' was not declared in this scope
    5 | #define OP(x) cout << x << endl;
      |               ^~~~
a.cc:37:9: note: in expansion of macro 'OP'
   37 |         OP("YYMM");
      |         ^~
a.cc:5:15: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #define OP(x) cout << x << endl;
      |               ^~~~
a.cc:37:9: note: in expansion of macro 'OP'
   37 |         OP("YYMM");
      |         ^~
a.cc:5:28: error: 'endl' was not declared in this scope
    5 | #define OP(x) cout << x << endl;
      |                            ^~~~
a.cc:37:9: note: in expansion of macro 'OP'
   37 |         OP("YYMM");
      |         ^~
a.cc:5:28: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    5 | #define OP(x) cout << x << endl;
      |                            ^~~~
a.cc:37:9: note: in expansion of macro 'OP'
   37 |         OP("YYMM");
      |         ^~
a.cc:5:15: error: 'cout' was not declared in this scope
    5 | #define OP(x) cout << x << endl;
      |               ^~~~
a.cc:39:9: note: in expansion of macro 'OP'
   39 |         OP("AMBIGUOUS");
      |         ^~
a.cc:5:15: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #define OP(x) cout << x << endl;
      |               ^~~~
a.cc:39:9: note: in expansion of macro 'OP'
   39 |         OP("AMBIGUOUS");
      |         ^~
a.cc:5:28: error: 'endl' was not declared in this scope
    5 | #define OP(x) cout << x << endl;
      |                            ^~~~
a.cc:39:9: note: in expansion of macro 'OP'
   39 |         OP("AMBIGUOUS");
      |         ^~
a.cc:5:28: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    5 | #define OP(x) cout << x << endl;
      |                            ^~~~
a.cc:39:9: note: in expansion of macro 'OP'
   39 |         OP("AMBIGUOUS");
      |         ^~