Language: C++

#include<iostream>

using namespace atd;

int main(){
  std::vector<int> p;
  std::vector<int> p2;
  int N;
  cin >> N ;
  int a;
  int count=0;
  for(int i = 0; i<N; i++){
    cin >> a;
    p.push_back(a);
    p2.push_back(i+1);
    if(a-(i+1)!=0){
		count++;
    }
    if(count>2){
      cout << "NO" << endl;
    }else{
      cout << "YES" << endl;
    }
    return 0;
  }
 
  
  	
    

Compiler output:
a.cc:3:17: error: 'atd' is not a namespace-name
    3 | using namespace atd;
      |                 ^~~
a.cc: In function 'int main()':
a.cc:6:8: error: 'vector' is not a member of 'std'
    6 |   std::vector<int> p;
      |        ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | 
a.cc:6:15: error: expected primary-expression before 'int'
    6 |   std::vector<int> p;
      |               ^~~
a.cc:7:8: error: 'vector' is not a member of 'std'
    7 |   std::vector<int> p2;
      |        ^~~~~~
a.cc:7:8: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:7:15: error: expected primary-expression before 'int'
    7 |   std::vector<int> p2;
      |               ^~~
a.cc:9:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |   cin >> N ;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:14:5: error: 'p' was not declared in this scope
   14 |     p.push_back(a);
      |     ^
a.cc:15:5: error: 'p2' was not declared in this scope
   15 |     p2.push_back(i+1);
      |     ^~
a.cc:20:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   20 |       cout << "NO" << endl;
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:20:23: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   20 |       cout << "NO" << endl;
      |                       ^~~~
      |                       std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:22:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   22 |       cout << "YES" << endl;
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:22:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   22 |       cout << "YES" << endl;
      |                        ^~~~
      |                        std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:25:4: error: expected '}' at end of input
   25 |   }
      |    ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^