Language: C++

#include <bits/stdc++.h>
using namespace std;
void solve();
int main(){
    int t = 1;
    while(t --) solve();
    return 0;
}

#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define int __int64

const int maxn = 1e6 + 6;
const int mod = 1e9 + 7;

string s;
int E[maxn];
int W[maxn];
void solve(){
    int n;
    cin >> n >> s;
    for(int i = 1; i <= n; i ++){
        if(s[i-1] == 'E') W[i] = 1;
        W[i] += W[i-1];
    }
    for(int i = n; i >= 1; i --){
        if(s[i-1] == 'W') E[i] = 1;
        E[i] += E[i+1];
    }
    int res = E[1] + W[1] - 1;
    for(int i = 2; i <= n; i ++)
        res = max(res, E[i] + W[i] - 1);
    cout << max(n - 1 - res, 0);

}



Compiler output:
a.cc:14:13: error: '__int64' does not name a type; did you mean '__int64_t'?
   14 | #define int __int64
      |             ^~~~~~~
a.cc:16:7: note: in expansion of macro 'int'
   16 | const int maxn = 1e6 + 6;
      |       ^~~
a.cc:14:13: error: '__int64' does not name a type; did you mean '__int64_t'?
   14 | #define int __int64
      |             ^~~~~~~
a.cc:17:7: note: in expansion of macro 'int'
   17 | const int mod = 1e9 + 7;
      |       ^~~
a.cc:14:13: error: '__int64' does not name a type; did you mean '__int64_t'?
   14 | #define int __int64
      |             ^~~~~~~
a.cc:20:1: note: in expansion of macro 'int'
   20 | int E[maxn];
      | ^~~
a.cc:14:13: error: '__int64' does not name a type; did you mean '__int64_t'?
   14 | #define int __int64
      |             ^~~~~~~
a.cc:21:1: note: in expansion of macro 'int'
   21 | int W[maxn];
      | ^~~
a.cc: In function 'void solve()':
a.cc:14:13: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   14 | #define int __int64
      |             ^~~~~~~
a.cc:23:5: note: in expansion of macro 'int'
   23 |     int n;
      |     ^~~
a.cc:24:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   24 |     cin >> n >> s;
      |            ^
      |            yn
a.cc:25:13: error: expected ';' before 'i'
   25 |     for(int i = 1; i <= n; i ++){
      |             ^
a.cc:25:20: error: 'i' was not declared in this scope
   25 |     for(int i = 1; i <= n; i ++){
      |                    ^
a.cc:26:27: error: 'W' was not declared in this scope
   26 |         if(s[i-1] == 'E') W[i] = 1;
      |                           ^
a.cc:27:9: error: 'W' was not declared in this scope
   27 |         W[i] += W[i-1];
      |         ^
a.cc:29:13: error: expected ';' before 'i'
   29 |     for(int i = n; i >= 1; i --){
      |             ^
a.cc:29:20: error: 'i' was not declared in this scope
   29 |     for(int i = n; i >= 1; i --){
      |                    ^
a.cc:30:27: error: 'E' was not declared in this scope
   30 |         if(s[i-1] == 'W') E[i] = 1;
      |                           ^
a.cc:31:9: error: 'E' was not declared in this scope
   31 |         E[i] += E[i+1];
      |         ^
a.cc:33:9: error: expected ';' before 'res'
   33 |     int res = E[1] + W[1] - 1;
      |         ^~~
a.cc:34:13: error: expected ';' before 'i'
   34 |     for(int i = 2; i <= n; i ++)
      |             ^
a.cc:34:20: error: 'i' was not declared in this scope
   34 |     for(int i = 2; i <= n; i ++)
      |                    ^
a.cc:35:9: error: 'res' was not declared in this scope
   35 |         res = max(res, E[i] + W[i] - 1);
      |         ^~~
a.cc:35:24: error: 'E' was not declared in this scope
   35 |         res = max(res, E[i] + W[i] - 1);
      |                        ^
a.cc:35:31: error: 'W' was not declared in this scope
   35 |         res = max(res, E[i] + W[i] - 1);
      |                               ^
a.cc:36:25: error: 'res' was not declared in this scope
   36 |     cout << max(n - 1 - res, 0);
      |                         ^~~