Language: C++

/*
When you walk through a storm
Hold your head up high
And don't be afraid of the dark
At the end of the storm
There's a golden sky
And the sweet silver song
of the lark
Walk on, through the wind
Walk on, through the rain
Though your dreams be tossed
and blown
Walk on, walk on
With hope in your heart
And you'll never walk alone
YNWA
*/
 
//hell_hacker
//IT TAKES EVERYTHING and IT IS NOT LUCK
//PICK ME LAST -- COME OUT OF N^WHERE
//WHY NOT?
 
/*
And you came my way on a winner's day
Shouted loudly come out and play
Can't you tell I got news for you
Sun is shining and so are you
*/
 
// author: SweetPrinces
 
/*
 
___▒▒▒▒______▒▒▒▒▒▒▒▒
__▒▒░░░░▒▒▒▒▒▒▒░░░░▒▒
_▒▒░░░░░░▒▒▒▒▒░░░__░▒▒
▒▒░___░░▒▒▒▒▒▒▒░░__░▒▒
▒▒░__░▒▒▒▒▒▒▒▒▒▒▒_░▒
_▒░░▒▒▒▒▒▒█▒▒▒▒▒█▒▒
___▒▒▒▒▒▒░██▒▒▒▒██_▒___▒▒___▒▒
___▒▒▒▒▒░░░░███░░░▒▒___▒▒__▒▒
___▒▒▒▒▒░░___███____▒▒___▒▒_▒▒
____▒▒░░__▀▄▄▄▄▄▄▀░▒_____▒▒▒▒▒
_____▒▒▒░_____▀▀_░▒▒______▒▒▒▒▒▒
___▒▒▒░▒░░░▒▒▒░_▒▒▒▒▒▒▒▒▒▒▒
__▒▒▒░▒▒▒▒▒░░░▒░▒▒▒▒▒▒▒▒▒
_▒▒▒░▒▒▒▒___▒▒__▒▒▒▒▒▒▒▒▒
_▒▒▒░▒░░_________░▒▒▒▒
 
*/
 
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define ll                  long long
#define ull                 unsigned long long
#define ld                  long double
#define f                   first
#define se                  second
#define SpeedForce          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sqr(x)              ((x)*(x))
#define forn(i, n)          for(ll i=0;i<n;++i)
#define forl(i, a, b)       for(int i=(a);i<=(b);++i)
#define ford(i, a, b)       for(int i=(a);i>=(b);--i)
#define forg(i, a, b, c)    for(ll i=(a);i<=(b);i += (c))
#define cno                 cout<<"NO";return 0;
#define cye                 cout<<"YES";return 0;
#define pb                  push_back
#define mp                  make_pair
#define fbo                 find_by_order
#define ofk                 order_of_key
#define all(a)              (a).begin(), (a).end()
#define pb1                 pop_back
#define sz(x)               ((int)(x).size())
#define fill(a, x)          memset(a, x, sizeof(a))
#define debug(v)            makeDebugInfo(#v, v)
#define dbg(v)              out.put(makeDebugInfo(#v, v)), cout.flush()
#define _read(x) freopen(x, "r", stdin)
#define _write(x) freopen(x, "w", stdout)
#define files(x) _read(x ".txt"); _write(x ".txt")
 
typedef pair < int, int > pii;
typedef pair < char, int > pci;
typedef pair < pii, int > ppii;
typedef pair < ll, ll > pll;
typedef pair < ull, ull > puu;
typedef pair < int, string > pis;
typedef pair < string, int > psi;
typedef map < int, int > mii;
typedef map < int, int > mii;
typedef map < int, char > mic;
typedef map < string, int > msi;
typedef map < string, string > mss;
typedef map < char, int > mci;
typedef map < char, ll > mcl;
typedef map < ll, ll > mll;
typedef map < pii, int > mpii;
typedef vector < int > vi;
typedef vector < char > vc;
typedef vector < ll > vll;
typedef vector < pii > vpii;
typedef vector < pll > vpll;
typedef vector < pis > vpis;
typedef set < int > si;
typedef set< pair < ull, ull > > spuu;
typedef set< pii > spii;
typedef priority_queue< ll > pqll;
 
const int N = 2e5+7;
const int M = 21;
const int MAXK = 1e5+3;
const int Candy = 1e6+3;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 1e18;
const double PI = 3.1415926535897932384626433;
const ld EPS = 1e-12;
 
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
template<class Key, class Value, class Hash = std::hash<Key>>
using unordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;
 
template <typename T> int sgn(T val) {
    return (T(0) < val) - (val < T(0));
}
 
char getChar() { char c = 0; while (c <= ' ') cin >> c; return c; }
 
inline ll fast_pow(ll a, ll b){
	ll res = a, ret = 1;
	while(b>0){
		if(b%2)
			ret = (ret*res)%mod;
		res = (res*res)%mod;
		b/=2;
	}
	return ret;
}
 
inline ll fact(ll n){
    int f = 1;
    forl(i, 2, n) f = f * i % mod;
    return f;
}
 
inline ll Cnk(ll n, ll r){
    r = min(r, n - r);
    ll ans = 1;
    ford(i, n, n - r + 1) ans = (ans * i) % mod;
    forl(i, 1, r) ans = (ans * fast_pow(i, mod - 2)) % mod;
    return ans;
}
 
int a, n, k ++;

int main(){
    SpeedForce
    cin >> n;
    forn(i, n){
        cin >> a;
        if(a - i - 1 != 0) k++;
    }
    if(k > 2) cout << "NO";
    else cout << "YES";
    return (!false && !true) || ((ll)((ll)(1713 + 2377 + 1464) * (ll)(1713 + 2377 + 1464) * (ll)(1713 + 2377 + 1464)) != (ll)(171323771464));
}

Compiler output:
a.cc:162:13: error: expected initializer before '++' token
  162 | int a, n, k ++;
      |             ^~
a.cc: In function 'int main()':
a.cc:169:28: error: 'k' was not declared in this scope
  169 |         if(a - i - 1 != 0) k++;
      |                            ^
a.cc:171:8: error: 'k' was not declared in this scope
  171 |     if(k > 2) cout << "NO";
      |        ^