Language: C++

#include<cstdlib>
#include <typeinfo>
using namespace std;


int main(){
    int N = 99;
    string result;
    string new_S;
    string S;
    cin >> S;
    int flag = 0;

    int pre = std::stoi(S.substr(0, 2));
    int post = std::stoi(S.substr(2));


    if (pre <= 0 || 13 <= pre){ // MMYYではない
        if (post <= 0 || 13 <= post){ //YYMMではない
            result = "NA";
        }else {
            result = "YYMM";
        }
    } else if ( (1 <= pre <= 12) && (1 <= post <= 12)){
        result = "AMBIGUOUS";
    } else {
        result = "MMYY";
    }

    cout << result << endl; 
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'string' was not declared in this scope
    8 |     string result;
      |     ^~~~~~
a.cc:3:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    2 | #include <typeinfo>
  +++ |+#include <string>
    3 | using namespace std;
a.cc:9:11: error: expected ';' before 'new_S'
    9 |     string new_S;
      |           ^~~~~~
      |           ;
a.cc:10:11: error: expected ';' before 'S'
   10 |     string S;
      |           ^~
      |           ;
a.cc:11:5: error: 'cin' was not declared in this scope
   11 |     cin >> S;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <typeinfo>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:11:12: error: 'S' was not declared in this scope
   11 |     cin >> S;
      |            ^
a.cc:14:20: error: 'stoi' is not a member of 'std'
   14 |     int pre = std::stoi(S.substr(0, 2));
      |                    ^~~~
a.cc:14:20: note: 'std::stoi' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:15:21: error: 'stoi' is not a member of 'std'
   15 |     int post = std::stoi(S.substr(2));
      |                     ^~~~
a.cc:15:21: note: 'std::stoi' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:20:13: error: 'result' was not declared in this scope
   20 |             result = "NA";
      |             ^~~~~~
a.cc:22:13: error: 'result' was not declared in this scope
   22 |             result = "YYMM";
      |             ^~~~~~
a.cc:25:9: error: 'result' was not declared in this scope
   25 |         result = "AMBIGUOUS";
      |         ^~~~~~
a.cc:27:9: error: 'result' was not declared in this scope
   27 |         result = "MMYY";
      |         ^~~~~~
a.cc:30:5: error: 'cout' was not declared in this scope
   30 |     cout << result << endl;
      |     ^~~~
a.cc:30:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:30:13: error: 'result' was not declared in this scope
   30 |     cout << result << endl;
      |             ^~~~~~
a.cc:30:23: error: 'endl' was not declared in this scope
   30 |     cout << result << endl;
      |                       ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <typeinfo>
  +++ |+#include <ostream>
    3 | using namespace std;