Language: C++

// Mon Sep 14 19:59:49 IST 2020  


#include <bits/stdc++.h>        
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(ii,a,b)       for(int64 ii = (int64)a ; ii < (int64)b  ; ii++ )
#define scan(any)          for(auto &i:any) cin>>i;
#define debug(x)           cerr << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define int64              long long   
#define all(x)             (x).begin(),(x).end() 
#define ff                 first
#define ss                 second
#define pppp               pair <int,int> 
#define flushOff           fflush(stdout) 
#define precise(x)         cout << fixed << setprecision(12) << x << '\n'; 
using namespace std ;    
// policy based   
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
 
const int MOD1 = 1e9+7;
const int MOD2 = 1e9+9;
const double pi = 3.141592653589793238;
const int INF = 2e9+7;
const int64 big = INT64_MAX;

const int N = 2e5+7;
struct compare{
    bool operator()(pair <int,int> A, pair <int,int> B){
        if(A.first == B.first)
            return A.second > B.second;
        return A.first > B.first;
    }
}; 
void print(vector <int>v){
    for(int t : v) 
        cout << t << ' ';
    cout << '\n';
    return;
}
void printSet(multiset <int>v){
    cout << "===\n";
    for(int t : v) 
        cout << t << ' ';
    cout << '\n';
    return;
}
  
int tests(){ 
    int n,q;
    cin >> n >> q;
    multiset <int> gaps;
    set <int> s;
    forn(_,0,n){
        int x;
        cin >> x;
        s.insert(x);
    }
    for(auto it = next(s.begin()) ; it != s.end() ;it++){
        gaps.insert(*it-*prev(it));
    }
    cout << *prev(s.end())-*s.begin()-*(prev(gaps.end())) << '\n';
    int type,x;
    forn(_,0,q){
        cin >> type >> x;
        
        if(type){
            if(s.empty()){
                s.insert(x);
                cout << 0 << '\n';
                continue;
            }
            else if(s.size() == 1){
                s.insert(x);
                gaps.insert(*(--s.end()) - *s.begin());
                
                cout << 0 << '\n';
                continue;
            }
            auto high = s.upper_bound(x);
            auto low = s.lower_bound(x);
            if(high == s.end()){
                gaps.insert(x-*prev(high));
                s.insert(x);
            }
            else if( low == s.begin()){
                gaps.insert(*s.begin()-x);
                s.insert(x);
            }
            else{
                int gap = *high-*prev(low);
                if(gaps.find(gap) != gaps.end())
                    gaps.erase(gaps.find(gap));
                gaps.insert(*high-x);
                gaps.insert(x-*prev(low));
                s.insert(x);
            }
        }
        else{
            if(s.size() == 1 ){
                s.clear();
                gaps.clear()
                cout << 0 << '\n';
                continue;
            }
            auto posn = s.find(x);
            if(posn == --s.end()){
                int gap = *posn - *(prev(posn));
                if(gaps.find(gap) != gaps.end()) 
                gaps.erase(gaps.find(gap));
                s.erase(posn);
            }
            else if( posn == s.begin()){
                int gap = *(next(posn)) - *(posn);
                if(gaps.find(gap) != gaps.end()) 
                gaps.erase(gaps.find(gap));
                s.erase(posn);     
            }
            else{ 
                int gap = *(next(posn)) - *(prev(posn));
                gaps.erase(gaps.find(*next(posn)-x));
                gaps.erase(gaps.find(x-*prev(posn)));
                gaps.insert(gap);
                
                s.erase(posn);
            }
        }
        if(s.size() < 3) {
            cout << 0 << '\n';
            continue;
        }
        cout << *prev(s.end())-*s.begin()-*(prev(gaps.end())) << '\n';    
    }

    return 0;
}    
int solve(){
	string s;
    cin >> s;
    if(s.back() == 's'){
        s += "es";
    }
  else
    s += "s";
  cout << s;
}
int main(){
    I__O ;      
    int cases = 1 ;  
    // cin >> cases ;
    while(cases--)
        solve(); 
    return 0 ; 
}
 


Compiler output:
a.cc: In function 'int tests()':
a.cc:104:29: error: expected ';' before 'cout'
  104 |                 gaps.clear()
      |                             ^
      |                             ;
  105 |                 cout << 0 << '\n';
      |                 ~~~~         
a.cc: In function 'int solve()':
a.cc:148:1: warning: no return statement in function returning non-void [-Wreturn-type]
  148 | }
      | ^