akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size() - 1; i++) {
        if (s[i] == 'A' && s[i + 1] == 'C') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define mod ((long long)(1e9 + 7))

int main(void) {
    long long N;
    cin >> N;
    vector<long long> A(N);
    vector<long long> bit(60, 0);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        for (int j = 0; j < 60; j++) {
            if (A[i] & (1ll << j)) bit[j]++;
        }
    }
    long long ans = 0;
    for (int i = 0; i < 60; i++) {
        ans += ((((bit[i] % mod) * ((N - bit[i]) % mod)) % mod) *
                ((1ll << i) % mod)) %
               mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <functional>

using namespace std;
using ll = long long;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

int main()
{
	ll n, c[505], s[505], f[505], i, j, ans, t;

	cin >> n;
	for (i = 0; i < n - 1; i++) {
		cin >> c[i] >> s[i] >> f[i];
	}

	for (i = 0; i < n; i++) {
		ans = 0;
		for (j = i; j < n - 1; j++) {
			/*t = s[j];
			while (t < ans) {
				t += f[j];
			}*/
			if (ans < s[j]) {
				t = s[j];
			}
			else {
				int tmp;
				tmp = (ans - s[j]) % f[j];
				if (tmp == 0) {
					t = ans;
				}
				else {
					t = ans + (f[j] - ((ans - s[j]) % f[j]));
				}
			}
			ans = t + c[j];
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
 
using namespace std;
 
int main() {
	long long int n,k;
	cin  >> n >> k;
	if(n < k )
		cout <<min(n,abs(n-k)) << endl;
	else
	{
		long long z = n%k;
		if(z > 0)
			z = k%z;
		cout << z << endl;
	}
	return 0;
}

Measured memory_bytes: 256
h, w  = map(int, input().split())
T = [input().split() for i in range(h)]

for i in range(h):
    for j in range(w):
        if T[i][j] == "snuke":
            print(chr(ord("A") + j) + str(i + 1))
            break
    else:
        continue
    break

Measured memory_bytes: 3060
import numpy as np
n=int(input())
l=list(map(int,input().split()))


arr=np.array(l)
arr2=np.append(np.hstack((0,arr)),0)
differ=sum(np.abs(np.diff(arr2)))
dif=np.diff(arr2)
for i in range(1,n+1):
    difference=abs(dif[i]+dif[i-1])-abs(dif[i])-abs(dif[i-1])
    print(differ+difference)

   


Measured memory_bytes: 22832
#include <bits/stdc++.h>
using namespace std;

#define int long long
//#define uint __int128_t

#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define low(a,b) lower_bound(all(a),(b))-(a).begin()
#define upp(a,b) upper_bound(all(a),(b))-(a).begin()
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<vint> vvint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;

string A;
int K;
int dp[10010][2][111];

signed main() {
    IOS();
    //(1ll<<N)シフト演算のオーバーフローに気をつける
    //MOD同士の引き算に注意
    cin>>A>>K;
    int N=A.size();
    dp[0][0][0]=1;
    rep(i,0,N){
        rep(j,0,2){
            int x=j?9:A[i]-'0';
            rep(l,0,K){
                int x=j?9:A[i]-'0';
                rep(d,0,x+1){
                    (dp[i+1][j||d<x][(l+d)%K]+=dp[i][j][l])%=MOD;
                }
            }
        }
    }
    cout<<(dp[N][0][0]+dp[N][1][0]-1+MOD)%MOD<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}


Measured memory_bytes: 17664
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  string s;
  cin>>s;
  string ans;

  if(s[0] == '1') {
    ans += "9";
  } else {
    ans += "1";
  }
  if(s[1] == '1') {
    ans += "9";
  } else {
    ans += "1";
  }
  if(s[2] == '1') {
    ans += "9";
  } else {
    ans += "1";
  }
  cout << stoi(ans) << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main(){
    string s;
    cin >> s;
    if(s[0]=='Y' && s[1]=='A' && s[2]=='K' && s[3]=='I')cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void setIO(string s = "") {
	// cin.exceptions(cin.failbit); 
	// throws exception when do smth illegal
	// ex. try to read letter into int
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 2e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
 
int rnd (int l, int r) {
	return uniform_int_distribution<int> (l, r)(gen);
}

int n;
string s[N];

bool cmp (string a, string b) {
	return mp(sz(a), a) < mp(sz(b), b);
}

int nxt[mxn][26];
int cnt[mxn];
int ptr;
int par[mxn];
int has[33];
int rt[mxn];

int add (string &s) {
	int v = 0;
	for (int i = 0; i < sz(s); ++i) {
		int ch = s[i] - 'a';
		if(!nxt[v][ch]) {
			
			nxt[v][ch] = ++ptr;
			par[ptr] = v;
		}
		
		++cnt[v];
		v = nxt[v][ch];
	}
	++rt[v];
	++cnt[v];
	return v;
}

int main () {
	SpeedForce;
	
	cin >> n;
	
	
	for (int i = 1; i <= n; ++i) {
		cin >> s[i];
		reverse(every(s[i]));
	}
	
	sort (s + 1, s + n + 1, &cmp);
	ll ans = 0;
	for (int it = 1; it <= n; ++it) {
		int cur = add(s[it]);
		
		memset(has, 0, sizeof has);
			reverse(every(s[it]));
	
		for (auto ch : s[it]) {
			cur = par[cur];
			
			has[ch-'a'] = 1;
			
			for (int c = 0; c < 26; ++c) if (has[c] && nxt[cur][c]) {
				ans += rt[nxt[cur][c]];
			}
		}
	}
	
	cout << ans-n << '\n';
	
	return Accepted;
}

// B...a


Measured memory_bytes: 123216
#include<stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int p, int r) {
    int x, i, j, t;
    x = A[r];
    i = p - 1;
    for ( j = p; j < r; j++ ) {
        if ( A[j] <= x ){
            i++;
            t = A[i]; A[i] = A[j]; A[j] = t;
        }
    }
    t = A[i + 1]; A[i + 1] = A[r]; A[r] = t;     //この段階でパーティションの値を中央に配置する
    return i + 1;    //パーティションが配置された要素を返却
}

int main() {
    int i, q;
    
    scanf("%d", &n);
    for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
    
    q = partition(0, n - 1);
    
    for ( i = 0; i < n; i++ ) {
        if ( i ) printf(" ");
        if ( i == q ) printf("[");
        printf("%d", A[i]);
        if ( i == q ) printf("]");
    }
    printf("\n");
    
    return 0;
}


Measured memory_bytes: 3080
N = 10**6
K = int(input())
mod = 0
res = 0
for i in range(N):
    mod = (mod%K) * 10 + 7
    res = i + 1
    if mod % K == 0:
        break
    
if res == N:
    print(-1)
else:
    print(res)
    



Measured memory_bytes: 8952
import sys
input = sys.stdin.readline
from collections import defaultdict

# 切り離す必要があるものを辺として、二部グラフの判定
N,M = map(int,input().split())

# 補グラフ
graph = [set(x for x in range(N) if x != y) for y in range(N)]
for _ in range(M):
    a,b = map(lambda x: int(x) - 1,input().split())
    graph[a].remove(b)
    graph[b].remove(a)

color = [None] * N
size = defaultdict(lambda: [0,0])

def set_color(root,x,c):
    if color[x] is not None:
        if color[x] == c:
            return
        else:
            print(-1)
            exit()
    size[root][c] += 1
    color[x] = c
    for y in graph[x]:
        set_color(root,y,1-c)

for x in range(N):
    if color[x] is not None:
        continue
    set_color(x,x,0)

size

# 二部グラフになるべく平均的に分けたい
# 可能なサイズの集合を持つ

se = {0}
for x,y in size.values():
    se = set(s + x for s in se) | set(s + y for s in se)

answer = min(x*(x-1)//2+(N-x)*(N-x-1)//2 for x in se)
print(answer)

Measured memory_bytes: 35956
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);

	ll N, K;
  	cin >> N >> K;
	ll ans = min(N%K, abs(N%K-K));
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

// conversion
//------------------------------------------
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }

// typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c)                                                             \
  for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

// clear memory
#define CLR(a) memset((a), 0, sizeof(a))

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                                               \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"                       \
       << " " << __FILE__ << endl;

void solve(long long n, std::vector<long long> p) {
  int ans=0;
  for(int i=1;i<n-1; i++){
    if((p[i-1]<p[i] && p[i]<p[i+1]) || (p[i-1]>p[i] && p[i]>p[i+1])){
      ans++;
    }
  }
  cout<<ans<<endl;
  return;
}

int main() {
  long long n;
  scanf("%lld", &n);
  std::vector<long long> p(n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &p[i]);
  }
  solve(n, std::move(p));
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main(){
int A,B,C,K;
  cin>>A>>B>>C>>K;
  
  int num=max(A, max(B,C));
  for(int i=0; i<K; i++){
   num*=2;
  }
  
  cout<<num+A+B+C-max(A, max(B,C));
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

int main() {
    int n, m;
    cin >> n >> m;

    VI o(n), p(n);
    vector<VI> d(n), prev(n);
    FOR(i, n)o[i] = INF;
    FOR(i, n) {
        d[i] = o;
        FOR(j, n)p[j] = i;
        prev[i] = p;
    }
    FOR(i, n)d[i][i] = 0;
    int a, b, c;
    FOR(i, m) {
        cin >> a >> b >> c;
        a--, b--;
        d[a][b] = c;
        d[b][a] = c;
    }

    FOR(k, n)FOR(i, n)FOR(j, n) {
        if (d[i][j] > d[i][k] + d[k][j]) {
            d[i][j] = d[i][k] + d[k][j];
            prev[i][j] = prev[k][j];
        }
    }
    set<pair<int, int>> s;
    FOR(i, n)FOR(j, n) {
        int t = j;
        while (i!=t) {
            pair<int,int> x = { prev[i][t],t };
            if (x.first > x.second)swap(x.first, x.second);
            s.insert(x);
            t = prev[i][t];
        }
    }
    cout << m - s.size() << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=100000000000000000;

ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

vector<vector<ll>> aa(100000);
vector<vector<ll>> bb(100000);
vector<vector<ll>> cc(100000);
vector<vector<ll>> dd(100000);
ll counter=0;
ll n;
ll l[10];

void For(ll j,vector<ll> sa,vector<ll> sb,vector<ll> sc,vector<ll> sd){
    if(j==n-1){
        for(ll k=0;k<4;k++){
            aa[counter+k]=sa;
            bb[counter+k]=sb;
            cc[counter+k]=sc;
            dd[counter+k]=sd;
        }
        aa[counter].push_back(j);
        bb[counter+1].push_back(j);
        cc[counter+2].push_back(j);
        dd[counter+3].push_back(j);
        counter=counter+4;
    }else{
        sa.push_back(j);
        For(j+1,sa,sb,sc,sd);
        sa.pop_back();
        sb.push_back(j);
        For(j+1,sa,sb,sc,sd);
        sb.pop_back();
        sc.push_back(j);
        For(j+1,sa,sb,sc,sd);
        sc.pop_back();
        sd.push_back(j);
        For(j+1,sa,sb,sc,sd);
        sd.pop_back();
    }
}

int main(){
    ll a,b,c;cin>>n>>a>>b>>c;
    for(ll i=0;i<n;i++){
        cin>>l[i];
    }
    For(0,aa[0],bb[0],cc[0],dd[0]);
    ll ans=inf;
    ll sia,sib,sic;
    ll sum,sum1;
    for(ll i=0;i<counter;i++){
        sia=aa[i].size();
        sib=bb[i].size();
        sic=cc[i].size();
        if(sia!=0 && sib!=0 && sic!=0){
            sum1=10*(sia+sib+sic-3);
            sum=0;
            for(ll k=0;k<sia;k++){
                sum+=l[aa[i][k]];
            }
            sum1+=abs(sum-a);
            sum=0;
            for(ll k=0;k<sib;k++){
                sum+=l[bb[i][k]];
            }
            sum1+=abs(sum-b);
            sum=0;
            for(ll k=0;k<sic;k++){
                sum+=l[cc[i][k]];
            }
            sum1+=abs(sum-c);
            ans=min(ans,sum1);
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 18176
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
const int mmax=1e6+10;
ll book[100];
int main()
{
	ll n,m;
	while(cin>>n>>m)
	{
		memset(book,0,sizeof(book));
		for(int i=1;i<=m;i++)
		{
			ll a,b;
			cin>>a>>b;
			book[a]++;
			book[b]++;
		}
		for(int i=1;i<=n;i++)
		{
			cout<<book[i]<<endl;
		}
	}
	return 0;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define trav(a, x) for (auto& a : x)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;
#define INF (1ll<<60)

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)


string str[4] = {"dream", "dreamer", "erase", "eraser"};
int dp[100009];

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    string s;
    cin >> s;
    dp[0] = 1;
    FOR(i, 0, SZ(s) - 1) {
        if (dp[i] == 1) {
            REP(j, 4) {
                if (s.substr(i, SZ(str[j])) == str[j]) dp[i + SZ(str[j])] = 1;
            }
        }
    }
    cout << (dp[SZ(s)] ? "YES\n" : "NO\n");
}

Measured memory_bytes: 848
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdlib>
using namespace std;

int main(){
  int M, N, K, A, *foods, count=0;
  cin >> N >> M;
  foods = new int[M];
  for (int i=0;i<N;i++) {
    cin >> K;
    for (int j=0;j<K;j++) {
      cin >> A;
      foods[A-1]++;
    }
  }
  for (int i=0;i<M;i++) {
    if (foods[i] == N) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n, a, b; cin >> n >> a >> b;
    string s; cin >> s;
    int sum = 0, sum_f = 0;
    rep(i,n) {
        if (s[i] == 'a' && sum < (a+b)) {
            cout << "Yes" << endl;
            sum++;
        } else if (s[i] == 'b' && sum < (a+b) && sum_f < b) {
            cout << "Yes" << endl;
            sum++; sum_f++;
        } else cout << "No" << endl;
    }
}

Measured memory_bytes: 3716
#include <iostream>

#define MOD 1000000007

typedef long long ll;

ll f(ll n) {
    ll sum = 0;
    for (ll i=1; i<=n; ++i) {
        ll a;
        std::cin >> a;
        sum += ( 2 * i - n - 1) * a;
        sum %= MOD;
    }
    return sum;
}

int main() {
    ll n, m;
    std::cin >> n >> m;
    std::cout << (f(n) * f(m)) % MOD << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
using namespace std;
main()
{
	long A,B;cin>>A>>B;
	int cnt=1;
	set<long>S;
	for(long i=2;i*i<=A;i++)
	{
		if(A%i==0)
		{
			S.insert(i);
			while(A%i==0)A/=i;
		}
	}
	if(A>1)S.insert(A);
	for(long i=2;i*i<=B;i++)
	{
		if(B%i==0)
		{
			cnt+=S.find(i)!=S.end();
			while(B%i==0)B/=i;
		}
	}
	if(B>1)cnt+=S.find(B)!=S.end();
	cout<<cnt<<endl;
}


Measured memory_bytes: 256
import copy

def bubble_sort(a, n):
    a = copy.deepcopy(a)
    count = 0
    flag = 1
    
    while flag:
        flag = 0
        
        for j in range(n-1, 0, -1):
            if int(a[j][1]) < int(a[j-1][1]):
                a[j-1], a[j] = a[j], a[j-1]
                flag = 1
                count += 1
                
    return a, count

def selection_sort(a, n):
    a = copy.deepcopy(a)
    
    count = 0
    for i in range(n):
        
        minj = i
        for j in range(i, n):
            if int(a[j][1]) < int(a[minj][1]):
                minj = j
        
        if minj != i:
          count += 1
          a[minj], a[i] = a[i], a[minj]
        
    return a, count

n = int(input())
cards = input().split()

bubble_sorted, _ = bubble_sort(a=cards, n=n)
selection_sorted, _ = selection_sort(a=cards, n=n)


print(" ".join(bubble_sorted))
print("Stable")
print(" ".join(selection_sorted))

stable_flag = True
for i in range(n):
    if bubble_sorted[i] != selection_sorted[i]:
      stable_flag = False
      

if stable_flag:
  print("Stable")
else:
  print("Not stable")
    


Measured memory_bytes: 6340
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int N, L;
	cin >> N >> L;
	vector<string> S(N, "");
	for (int i = 0; i < N; i++) {
		cin >> S[i];
	}
	sort(S.begin(), S.end());
	for (string s : S) {
		cout << s;
	}
}

Measured memory_bytes: 256
import sys

s = input()
k = int(input())

def count_min_operation(s):
	i = 0
	j = 0
	count = 0
	length = len(s)
	while j < length-1:
		c = 1
		for j in range(i+1,length):
			if s[i] == s[j]:
				c += 1
			else:
				count += c // 2
				i = j
				c = 1
				break

		if j == length-1:
			count += c // 2

	return count

for i in range(len(s)-1):
	if s[i] != s[i+1]:
		s1 = count_min_operation(s)
		s2 = count_min_operation(s+s)
		update = s2 - s1
		print(s1 + update * (k-1))
		sys.exit()

print(k * len(s) // 2)


Measured memory_bytes: 3064
N,K=map(int,input().split())
I=[0]*K
for m in range(K):
    l,r=map(int,input().split())
    I[m]=(l,r)

Mod=998244353

DP=[0]*(N+1)
DP[1]=1

for x in range(2,N+1):
    DP[x]=DP[x-1]
    for (l,r) in I:
        a=max(0,x-r-1)
        b=max(0,x-l)
        DP[x]+=DP[b]-DP[a]
        DP[x]%=Mod
print((DP[N]-DP[N-1])%Mod)

Measured memory_bytes: 70228
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long int n,i,j,s,min;
    cin>>n;
    s=n;
    long long int p[n];
    for(i=0;i<n;i++)cin>>p[i];
    min=p[0];
    for(i=1;i<n;i++){
    	if(!(p[i]<=min)){
		    s--;
		}
		else min=p[i];
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 1792
#N=gets.to_i
#S=gets.chomp
#A=(0...N).map{gets.to_i}
#sum=A.inject(&:+)
#B=gets.split.map(&:to_i)


A,B=gets.split.map(&:to_i)

if A>=13
  puts B
elsif A>=6
  puts B/2
else
  puts 0
end


Measured memory_bytes: 1788
#include <iostream>
using namespace std;
int main() {
    int a, b; cin >> a >> b;
    if (a < b)
        cout << "a < b\n";
    else if (a > b) 
        cout << "a > b\n";
    else 
        cout << "a == b\n";
    return 0;
}


Measured memory_bytes: 3096
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int m = sc.nextInt();
		List<Integer> list2 = new ArrayList<>();
		for (int i = 0; i < m; i++) {
			list2.add(sc.nextInt());
		}
		int size = Math.min(list.size(), list2.size());
		int res = -1;
		for (int i = 0; i < size; i++) {
			if (list2.get(i) > list.get(i)) {
				res = 1;
				break;
			} else if (list2.get(i) < list.get(i)) {
				res = 0;
				break;
			}
		}
		if (res < 0) {
			if (m > n) {
				res = 1;
			} else {
				res = 0;
			}
		}
		System.out.println(res);
	}
}




Measured memory_bytes: 33364
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin>>a>>b;
    if(a==0){
        if(b<=1911){
            cout<<"M"<<44-(1911-b)<<endl;
        }else if(b<=1925){
            cout<<"T"<<14-(1925-b)<<endl;
        }else if(b<=1988){
            cout<<"S"<<63-(1988-b)<<endl;
        }else if(b<=2016){
            cout<<"H"<<28-(2016-b)<<endl;
        }
    }else if(a==1){
        cout<<1868+b-1<<endl;
    }else if(a==2){
        cout<<1912+b-1<<endl;
    }else if(a==3){
        cout<<1926+b-1<<endl;
    }else if(a==4){
        cout<<1989+b-1<<endl;
    }
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
 
#define TRACE(x) cerr << #x << " = " << x << endl
#define pb push_back
#define mp make_pair
#define fi first
#define se second
 
#define SZ(x) (int)(x).size()
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
 
template<class Num>
Num mabs(Num A){
  if(A < 0) return -A;
  return A;
}

const int N = 1e6 + 5;

int cnt[N];

void prec(){
  for(int i = 1; i < N; i++){
    for(int j = i; j < N; j += i)
      cnt[j] += 1;
  }
}

int n;

int main(){
  prec();
  scanf("%d", &n);
  ll ans = 0ll;
  for(int i = 1; i <= n - 1; i++){
    int ab = n - i;
    ans += (ll)cnt[ab];
  }
  
  printf("%lld\n", ans);
  
  return 0;
}


Measured memory_bytes: 7696
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		String n = in.nextLine();
		int num = 0;
		
		for (int i = 0; i < n.length();i++){
			if(n.charAt(i) == '1')
				num += 9 * Math.pow(10, 2 - i);
			else
				num += Math.pow(10, 2 - i);
		}
		
		System.out.println(num);

	}

}


Measured memory_bytes: 21844
n, m = map(int, input().split())

h = list(map(int, input().split()))

r = [0]
for i in range(n):
    r.append(set())

for i in range(m):
    a, b = map(int, input().split())
    r[a].add(b)
    r[b].add(a)

ans = 0
for i in range(1, n+1):
    if len(r[i]) == 0:
        ans += 1
        continue
    hmax = h[i-1]
    flag = True
    for j in r[i]:
        if h[j-1] == h[i-1]: flag = False
        hmax = max(h[j-1], hmax)
    if hmax == h[i-1] and flag: ans += 1

print(ans)

Measured memory_bytes: 45236
f::String -> Int
f [] = 0
f [_] = 0
f [_,_] = 0
f (x:y:z:xs) = if x =='A' && y == 'B' && z == 'C' then 1 + f xs else f (y:z:xs)
main = do
  _<- getLine
  s<- getLine
  print $ f s

Measured memory_bytes: 380
#include <iostream>
#include <cstdio>
#include <algorithm>

#define MAX_N 52 
#define DIV 1000000007

char dom[2][MAX_N]={};
long N;
using namespace std;

int main() {
    long long ans = 1;
    bool flg=false;
    cin >> N;
    for(int j=0; j<2; j++){
        for(int i=0; i< N; i++){
            cin>>dom[j][i];
        }
    }
    for(int i=0; i<N; i++){
        if(dom[0][i]==dom[1][i]){
            if(flg){
                ans=ans*2%DIV;
            }else{
                ans = i==0 ? ans=3:ans;
            }
            flg=true;
        }else{
            if(flg){
                ans=ans*2%DIV;
            }else{
                ans = i==0? ans*6%DIV :ans*3%DIV;
            }
            flg=false;
            i++;
        }
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
#define mems(p) memset(p,-1,sizeof(p))
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define nl "\n"

const int mxN = 1e5;
const ll MOD = 1e9 + 7;

void fast()
{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

ll gcd(ll a, ll b) {
	return b ? gcd(b, a%b) : a;
}

int main() {
	fast();
	int x;
	cin >> x;
	if (x == 1) {
		cout << 0 << nl;
	} else {
		cout << 1 << nl;
	}
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;

#define int ll

#define pb push_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second

typedef long long ll;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

const int MAX = (1 << 17), INF = 1E17;
int dp[MAX], cost[MAX];

int f(int mask) {
	if(mask == 0)
		return 0;
	if(dp[mask] > -1)
		return dp[mask];
	int ret = -INF;
	for(int submask = mask; submask > 0; submask = (submask - 1) & mask) {
		ret = max(ret, cost[submask] + f(mask ^ submask));
	}
	ret = max(ret, cost[mask]);
	return dp[mask] = ret;
}

int32_t main() {
	memset(dp, -1, sizeof(dp));
	int n, allmask;
	cin >> n;
	allmask = (1 << n) - 1;
	vvi a(n, vi(n));
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n; j++)
			cin >> a[i][j];
	for(int i = 0; i <= allmask; i++) {
		vi v;
		for(int j = 0; j < n; j++) {
			if(i & (1 << j)) {
				v.pb(j);
			}
		}
		for(int j = 0; j < sz(v); j++)
			for(int k = j + 1; k < sz(v); k++) {
				//debug(i, j, k);
				cost[i] += a[v[j]][v[k]];
			}
		//debug(i, cost[i]);
	}
	cout << f(allmask);
}


Measured memory_bytes: 1792
#include"iostream"
#include"stdio.h"
#include"string.h"
#include"map"
using namespace std;

typedef long long ll;
#define MAXN 200050
#define INF 0x7fffffff

long long sum[MAXN];
map<ll, int> cnt;

int main()
{
	int n;
	scanf("%d", &n);
	ll ans = 0;
	cnt[0] = 1;
	for(int i = 1; i <= n; i++)
	{
		int x;
		scanf("%d", &x);
		sum[i] = sum[i - 1] + x;
		ans += cnt[sum[i]];
		cnt[sum[i]]++;
	}
	printf("%lld\n" ,ans);
	return 0;
}


Measured memory_bytes: 14336
#include <iostream>

int main()
{
	for( int i = 0; i < 3; i++ ) {
		for( int j = 0; j < 3; j++ ) {
			char c;
			std::cin >> c;
			if( i == j ) {
				std::cout << c;
			}
		}
	}
	std::cout << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using pii = pair<Int,Int>;
using mapis = unordered_map<Int,string>;
using mapii = unordered_map<Int,Int>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

Int LCM(Int a, Int b){
    return a*b/GCD(a,b);
}


int main() {
    Int n;

    cin >> n;

    double ans;


    Int cnt =0;
    REP(i,1,n+1){
        if(i%2==1){
            cnt++;
        }
    }

    ans = double(cnt)/double(n);
    cout <<std::fixed<< setprecision(10) <<  ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define all(x) begin(x), end(x)
#define range(x) begin(x), begin(x)
#define what(x) cout << #x << ": " << x << '\n'
#define print(x) for (auto &el: x) cout << el << ' '; cout << '\n'
using namespace std;
 
template<typename S, typename T>
ostream& operator <<(ostream &os, pair<S, T> &m) { 
	os << '[' << m.first << " " << m.second << ']'; 
	return os; 
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);

	int n;
	cin >> n;

	int k = 0;
	vector<int> v(n);
	for (int i = 0; i < n; ++i) {
		cin >> v[i];
		k ^= v[i];
	}

	for (auto el: v) cout << (k ^ el) << ' ';

	return 0;
}

Measured memory_bytes: 3908
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using lint = long int;
using llint = long long int;
using namespace std;

int compare(string taro, string hanako) {
    if (taro > hanako) {
        return 1;
    } else if (taro < hanako) {
        return -1;
    } else {
        return 0;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int loop;
    cin >> loop;

    int point[2]{0};
    rep(qi, loop) {
        string taro, hanako;
        cin >> taro >> hanako;
        switch (compare(taro, hanako)) {
        case 1:
            point[0] += 3;
            break;
        case -1:
            point[1] += 3;
            break;
        case 0:
            point[0] += 1;
            point[1] += 1;
            break;
        }
    }

    cout << point[0] << " " << point[1] << endl;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;

const int N=2e5+100;
const int mod=1e9+7;
typedef long long ll;

int a[100000];
int p[101][101];
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    int h,w,n;
    cin>>h>>w>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    int cnt=1;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++) {
            if(i&1) {
               p[i][j]=cnt;
            }
            else{
                p[i][w-j+1]=cnt;
            }
            a[cnt]--;
            if(a[cnt]==0) cnt++;
        }
    }

    for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++)
       cout<<p[i][j]<<" ";
       cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3696
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>   // setprecision
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;

int gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; }
// cout << fixed << setprecision(10);
// vector<vector<int>> vec(H, vector<int>(W))    // int H*W

int main() {
    int N;
    string S;
    cin >> N >> S;
    string target = "000";
    int ans = 0;
    for(size_t i = 0; i < 1000; i++) {
        auto first = find(S.begin(), S.end(), target[0]);
        if(first != S.end()) {
            auto second = find(next(first), S.end(), target[1]);
            if(second != S.end()) {
                auto third = find(next(second), S.end(), target[2]);
                if(third != S.end()) {
                    ans++;
                }
            }
        }

        target = to_string(1 + stoi(target));
        if(target.length() == 4) break;
        while(target.length() != 3) {
            target = "0" + target;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 384
n, m = map(int,input().split())
l, r = map(int,input().split())

for i in range(m-1):
  a, b = map(int,input().split())
  if a > l:
    l = a
  if b < r:
    r = b

ans = r - l + 1
if ans<0:
    print(0)
else:
    print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;

int main() {
  ll n,k;
  cin >> n >> k;
  vector<ll> a(n+1);
  for(int i=1;i<=n;i++){
    cin >> a[i];
  }
  set<ll> st;
  ll cnt=0,x=1;
  while(!st.count(x)){
    cnt++;
    st.insert(x);
    x = a[x];
  }
  ll primary = x;
  ll primary_cnt=-1,secondary_cnt=-1;
  x = 1;
  for(int i=0;i<n;i++){
    if(x==primary && primary_cnt == -1){primary_cnt = i;x = a[x];continue;}
    if(x==primary && primary_cnt != -1){secondary_cnt = i;break;}
  x = a[x];
  }
  if(secondary_cnt == -1) secondary_cnt = n; 
  vector<int> minim;
  x = 1;
  for(int i=0;i<secondary_cnt;i++){
    if(i>=primary_cnt) minim.push_back(x);
    x = a[x];
  }
  int syuuki = secondary_cnt - primary_cnt;
  int amari = (k-primary_cnt)%syuuki;
  if(k>primary_cnt) cout << minim[amari] << endl;
  else{
    x = 1;
    for(int i=0;i<k;i++){
      x = a[x];
    }
    cout << x << endl;
  }
}


Measured memory_bytes: 14556
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
#define tl 1'000'000'007
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REREP(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, n) for (ll i = a; i < n; i++)
#define REFOR(i, n, a) for (ll i = n; i >= a; i--)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false); 
    ll n,k;
    cin >> n >> k;
    ll cnt=1;
    while(n/=k) cnt++;
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N;
  	cin >> N;
  
    int a[N];
  	for( int i=0; i<=N; i++){
		cin >> a[i];
    }
  
  	sort(a, a+N);
  	cout << a[N-1] - a[0];
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define SZ(x) ((int)x.size()-1)
#define ms(a,b) memset(a,b,sizeof a)
#define F(i,a,b) for (int i=(a);i<=(b);++i)
#define DF(i,a,b) for (int i=(a);i>=(b);--i)
using namespace std;
inline int read(){
	char ch=getchar(); int w=1,c=0;
	for(;!isdigit(ch);ch=getchar()) if (ch=='-') w=-1;
	for(;isdigit(ch);ch=getchar()) c=(c<<1)+(c<<3)+(ch^48);
	return w*c;
}
const int mod=1e9+7,M=1e7+10;
LL fast(LL x,LL p){
	LL ret=1;
	for (;p;p>>=1,x=x*x%mod) if (p&1) ret=ret*x%mod; 
	return ret; 
} 
LL fac[M],iv[M],inv[M];
int n,A;
int main(){
	n=read(); A=read();
	fac[0]=1; F(i,1,n) fac[i]=fac[i-1]*i%mod;
	inv[n]=fast(fac[n],mod-2); 
	DF(i,n,1) inv[i-1]=inv[i]*i%mod;
	F(i,1,n) iv[i]=fast(i,mod-2);
	LL ans=0;
	F(i,2,A+1){
		int x=i-1,z=n-A,y=max(0,A-i);
		F(t,0,x){
			if (t&1) ans=(mod-fac[x]*inv[t]%mod*inv[x-t]%mod*(x-t)%mod*iv[x+z-t]%mod*fac[x+y+z-t]%mod+ans)%mod; 
			else  ans=(fac[x]*inv[t]%mod*inv[x-t]%mod*(x-t)%mod*iv[x+z-t]%mod*fac[x+y+z-t]+ans)%mod; 
		}
	}
	cout<<ans<<'\n'; 
	return 0;
}


Measured memory_bytes: 237904
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define endl "\n"
#define pb push_back
#define mod 1000000007
#define MAX 200009
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
int dx8[]={1,-1,0,0,1,1,-1,-1};
int dy8[]={0,0,1,-1,1,-1,1,-1};

ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinvfermat(ll a, ll m)
{
	return binexp(a, m - 2, m);
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}

bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
}
bool sortbyme(const pair<int,int> &a, 
              const pair<int,int> &b){
	return (a.first+a.second > b.first+b.second);

}
struct test 
{ 
   int x, y, z; 
}; 
// ll n;
// ll m;
// ll k;

// vector<pair<ll,ll>> v;
// ll vis[500000];
// ll dist[500000];

// void dfs(ll node){
//     vis[node]=1;
//     for(auto i:v[node]){
//         if(vis[i]==0){
//             dfs(i);
            
//         }
//     }
// }
// void bfs(ll node){
//     queue<ll> q;
//     vis[node]=1;
//     dist[node]=0;
    
//     q.push(node);
//     while(!q.empty()){
//         ll curr=q.front();
//         q.pop();
        
//         for(auto i:v[curr]){
//             if(vis[i]==0){
//                 vis[i]=1;
//                 dist[i]=dist[curr]+1;
//                 q.push(i);
                
                
//             }
//         }
        
//     }
// }




void solve(){

string s;
cin>>s;
if(s[s.size()-1]!='s'){
    cout<<s<<'s'<<endl;
    
}
else{
    cout<<s<<'e'<<'s'<<endl;
    
}
   
return;
}



int main()
{  
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
    fast;
    

    ll t;
    t=1;
   // cin>>t;
    while(t--){
    	solve();
    }
    
   
  



#ifndef ONLINE_JUDGE
	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define pll pair<ll,ll>
#define eb emplace_back
#define ll long long
#define nl '\n'
#define deb(x) cerr<<#x" = "<<x<<nl
#define in() ( { int a ; scanf("%d",&a); a; } )

const int N = 3e5 + 9;
const int mod = 1e9 + 7;

int a[N];
int32_t main()
{
    int n=in(), m=in();
    ll lc=1, inf=2e9;
    for(int i=1; i<=n; i++){
        a[i]=in();
        a[i]/=2;
        lc=min(inf, lc*a[i]/__gcd(lc, 1LL*a[i]));
    }
    ll ans=((m/lc)+1)/2;
    int ok=1;
    for(int i=1; i<=n; i++) if((lc/a[i])%2==0) ok=0;
    if(!ok) ans=0;
    cout<<ans<<nl;
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    vector<ll>A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    vector<ll>sum(N+1, 0);
    for (int i = 1; i <= N; ++i) {
        sum[i] = sum[i-1] + A[i-1];
    }
    sort(sum.begin(), sum.end());
    sum.push_back(1e18);
    ll ans = 0;
    ll cur = 1;
    for (int i = 0; i < N+1; ++i) {
        if(sum[i] == sum[i+1]){
            cur++;
        } else {
            ans += cur * (cur - 1) / 2;
            cur = 1;
        }
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 5760
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
a = 0
sum = 0
for i in range(N):
    A = list(map(int, input().split()))
    for j in range(M):
        sum += A[j] * B[j]
    if sum + C > 0:
        a += 1
        sum = 0
    else :
        sum = 0
print(a)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
int main()
{
    vector<int> alpha(26, 0);
    string S;
    cin >> S;

    rep(i, S.size()) {
        alpha[S[i] - 'a']++;
    }

    bool flag = true;
    rep(i, 26) {
        if (alpha[i] >= 2) {
            flag = false;
            break;
        }
    }

    if (flag) cout << "yes" << endl;
    else cout << "no" << endl;
    return 0;
}

Measured memory_bytes: 256
N,A,B,C,*L = `dd`.split.map &:to_i
X = { a:A, b:B, c:C }
def dfs(h, l, c)
  if l.size == 0
    return 10**15 if h.values.count(0) > 0
    #p h
    return [:a,:b,:c].reduce(0){|a,s| a + (X[s] - h[s]).abs } + c
  end
  [:a,:b,:c,nil].map{ |s|
    if s
      g = h.clone
      o = g[s] > 0 ? 10 : 0
      g[s] += l[0]
      dfs(g, l[1..-1], c + o)
    else
      dfs(h, l[1..-1], c)
    end
  }.flatten.min
end


p dfs({ a:0, b:0, c:0 }, L, 0)


Measured memory_bytes: 4104
#!/usr/bin/env python3

def II(): return int(input())
def MII(): return map(int, input().split())
def LII(): return list(map(int, input().split()))

def main():
    A, B, C, X, Y = MII()

    ans = A * X + B * Y
    for i in range(0, max(X, Y)+1):
        ans = min(ans, max(A * (X - i), 0) + max(B * (Y - i), 0) + C * 2 * i)

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9088
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>

#define FOR(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
using namespace std;

void solver() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a < b && b < c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

int main() {
    solver();
    return 0;
}

Measured memory_bytes: 3116
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int[] as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = std.nextInt();
        }

        Arrays.sort(as);
        int current = Integer.MAX_VALUE;
        boolean distinct = true;
        for (int i = 0; i < as.length; i++) {
            int a = as[i];
            if (current == a) {
                distinct = false;
                break;
            } else {
                current = a;
            }
        }

        if (distinct) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 89348
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP
*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define PB push_back
#define IN insert
#define MP make_pair
#define PI acos(-1)
#define LW(v) sort(v.begin(),v.end());
#define HI(v) sort(v.begin(),v.end(),greater<long long>());
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie (0);
    double t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>n;
    m=2*PI*n;
    cout<<setprecision(20)<<fixed<<m<<endl;
}


Measured memory_bytes: 3844
#include<stdio.h>
#include<stdlib.h>
int main(){
  int A,B,J,K,L ;
  scanf("%d",&A) ;
  scanf("%d",&B) ;
  if(A==B){
    exit(1) ;
  }

  J=A+B ;
  if(J%2 == 1){
    printf("IMPOSSIBLE") ;
    exit(0) ;
    }
  K=(A-B)/2 ;
  L=(A+B)/2 ;
  if(A-K==B-K){
    printf("%d",K) ;
  }else{
    printf("%d",L) ;
  }
}


Measured memory_bytes: 128
#include <iostream>
#include <string.h>
using namespace std;

int main() {
    char s[100];
    char p[100];
    cin >> s;
    cin >> p;

    char s2[200];
    strcpy(s2, s);
    strcat(s2, s);
    if(strstr(s2, p) !=NULL){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
	return 0;
}



Measured memory_bytes: 3092