Language: C++

using namespace std;
int main()
{
	// 整数の入力
    string input;
    cin >> input;

    string first = input.substr(0,2);
    string second = input.substr(2,2); 
    
    int first_num = atoi(first.c_str());
    int second_num = atoi(second.c_str());
    
    bool first_MM = true;
    bool second_MM = true;
    
    if(first_MM > 12)
    {
        first_MM = false;
    }
    if(second_MM > 12)
    {
        second_MM = false;
    }
    
    if(first_MM && second_MM)
    {
        // どちらもOK
        cout << "AMBIGUOUS"
    }
    else if(first_MM)
    {
        // MMYY フォーマットのみ
        cout << "MMYY"
    }
    else if(second_MM)
    {
        // YYMM フォーマットのみ
        cout << "YYMM"
    }
    else
    {
        // どちらもだめ   
        cout << "NA"
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'string' was not declared in this scope
    5 |     string input;
      |     ^~~~~~
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:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> input;
      |     ^~~
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:6:12: error: 'input' was not declared in this scope; did you mean 'int'?
    6 |     cin >> input;
      |            ^~~~~
      |            int
a.cc:8:11: error: expected ';' before 'first'
    8 |     string first = input.substr(0,2);
      |           ^~~~~~
      |           ;
a.cc:9:11: error: expected ';' before 'second'
    9 |     string second = input.substr(2,2);
      |           ^~~~~~~
      |           ;
a.cc:11:26: error: 'first' was not declared in this scope
   11 |     int first_num = atoi(first.c_str());
      |                          ^~~~~
a.cc:11:21: error: 'atoi' was not declared in this scope
   11 |     int first_num = atoi(first.c_str());
      |                     ^~~~
a.cc:12:27: error: 'second' was not declared in this scope; did you mean 'second_num'?
   12 |     int second_num = atoi(second.c_str());
      |                           ^~~~~~
      |                           second_num
a.cc:29:9: error: 'cout' was not declared in this scope
   29 |         cout << "AMBIGUOUS"
      |         ^~~~
a.cc:29:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:9: error: 'cout' was not declared in this scope
   34 |         cout << "MMYY"
      |         ^~~~
a.cc:34:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:39:9: error: 'cout' was not declared in this scope
   39 |         cout << "YYMM"
      |         ^~~~
a.cc:39:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:44:9: error: 'cout' was not declared in this scope
   44 |         cout << "NA"
      |         ^~~~
a.cc:44:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'