akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>

using namespace std;

int main(){
  int n; cin >> n;
  map<string, int> s;
  for(int i = 0; i < n; i++){
    string a;
    cin >> a;
    if(s.find(a) == s.end()) s[a] = 1;
    else s[a]++;
  }
  vector<pair<int, string>> p;
  int maxi = 0;
  for(auto psi : s){
    p.push_back({psi.second, psi.first});
    maxi = max(maxi, psi.second);
  }
  sort(p.begin(), p.end());
  for(auto pis : p){
    if(pis.first == maxi) cout << pis.second << endl;
  }
}


Measured memory_bytes: 29556
n,m = map(int,input().split())
ss = []
for _ in range(m):
  s = list(map(int,input().split()))[1:]
  ss.append(s)
ps = list(map(int,input().split()))

def get_bit(i,n):
  res = []
  for _ in range(n):
    res.append(i%2)
    i = int(i/2)
  return res[::-1]

ans = 0
for i in range(2**n):
  flags = get_bit(i,n)
  for j in range(m):
    count = 0
    for k in ss[j]:
      count += flags[k-1]
    if count %2 == ps[j]:
      continue
    else:
      break
  else:
    ans += 1
print(ans)



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

int main() {
    string S;
    cin >> S;
    reverse(S.begin(), S.end());
    int len = S.size()/2;
    for (int i=0; i<len; i++) {
        S.erase(0, 2);
        if (S.substr(0, S.size()/2)==S.substr(S.size()/2, S.size()/2)) {
            cout << S.size() << "\n";
            return 0;
        }
    }
    cout << "0\n";
}

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

main(){
  char s[4][101];
  int len[4],i,j[4]={};
  for(int i=1;i<=3;i++){
    cin >> s[i];
    len[i]=std::strlen(s[i]);
  }
  i=1;
  while(1){
    if(len[i]==0){
      if(i==1){
	cout << "A\n";
      }else if(i==2){
	cout << "B\n";
      }else{
	cout << "C\n";
      }
      break;
    }else{
      len[i]--;
      if(s[i][j[i]]=='a'){
	j[i]++;
	i=1;
      }else if(s[i][j[i]]=='b'){
	j[i]++;
	i=2;
      }else{
	j[i]++;
	i=3;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
  int n;
  cin >> n;
  
  vector<double>a(n + 1);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  a[n] = 10000;
  
  sort(a.begin(),a.end());
  
  while(a[1] != 10000){
    a[0] = (a[0] + a[1]) / 2.0;
    a[1] = 10000;
    sort(a.begin(),a.end());
  }
  
  cout << a[0] << endl;
  
  return 0;
}
  



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int R,G,B,N;
	cin >> R >> G >> B >> N;
	int cnt1 = 0;
	int cnt2 = 0;
	int ans = 0;
	while(cnt1 <= N/R)
	{
		while(cnt2 <= (N- R * cnt1)/G)
		{
			if ((N - R * cnt1 - G * cnt2) % B == 0)
			{
				ans++;
			}
			cnt2++;
		}
		cnt2 = 0;
		cnt1++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>
#include<cmath>
#include<cstring>
#include<map>
using namespace std;
 
int main(){
 
long A,B,K;

cin>>A>>B>>K;
 // A の処理
if (K - A >= 0) {
  K -= A;
  A = 0;
  if (K > 0) {
    if (K - B >= 0) {
      K -= B;
      B = 0;
    } else {
      B -= K;
    }
  }
} else {
  A -= K;
}
  
 
cout << A << " " << B << endl;
 
}


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

using namespace std;
int main(void){
    int d;
    cin >> d;
    
    if (d == 25){
        cout << "Christmas" << endl;
    }
    else if (d == 24){
        cout << "Christmas Eve" << endl;
    }
    else if (d == 23){
        cout << "Christmas Eve Eve" << endl;
    }
    else{
        cout << "Christmas Eve Eve Eve" << endl;
    }
    
}


Measured memory_bytes: 3596
#include "bits/stdc++.h"
using namespace std;

int main() {
	char S;
	cin >> S;
			if (S == 'a') {
				S = 'b';
			}
			else if (S == 'b') {
				S = 'c';
			}
			else if (S == 'c') {
				S = 'd';
			}
			else if (S == 'd') {
				S = 'e';
			}
			else if (S == 'e') {
				S = 'f';
			}
			else if (S == 'f') {
				S = 'g';
			}
			else if (S == 'g') {
				S = 'h';
			}
			else if (S == 'h') {
				S = 'i';
			}
			else if (S == 'i') {
				S = 'j';
			}
			else if (S == 'j') {
				S= 'k';
			}
			else if (S == 'k') {
				S = 'l';
			}
			else if (S== 'l') {
				S= 'm';
			}
			else if (S == 'm') {
				S = 'n';
			}
			else if (S == 'n') {
				S = 'o';
			}
			else if (S == 'o') {
				S= 'p';
			}
			else if (S== 'p') {
				S = 'q';
			}
			else if (S == 'q') {
				S= 'r';
			}
			else if (S== 'r') {
				S = 's';
			}
			else if (S == 's') {
				S = 't';
			}
			else if (S== 't') {
				S = 'u';
			}
			else if (S== 'u') {
				S = 'v';
			}
			else if (S== 'v') {
				S = 'w';
			}
			else if (S == 'w') {
				S= 'x';
			}
			else if (S == 'x') {
				S = 'y';
			}
			else if (S == 'y') {
				S = 'z';
			}
cout << S << endl;
}


Measured memory_bytes: 256
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<int,int> P;
typedef pair<P,char> Q;
ll longinf=1ll<<60;
int inf=1<<29;

int main(){
      ll n;
      cin>>n;
      ll a[n],b[n];
      rep0(i,n){
            cin>>a[i];
      }
      rep0(i,n){
            cin>>b[i];
      }
      ll d[n];
      rep0(i,n){
            d[i]=a[i]-b[i];
      }
      sort(d,d+n);
      /*rep0(i,n){
            cout<<d[i]<<" ";
      }
      cout<<endl;*/
      ll sum=0;
      ll ans=0;
      rep0(i,n){
            if(d[i]<0){
                  sum+=d[i];
                  ans++;
            }
      }
      bool ok=true;
      for(int i=n-1;i>=0;i--){
            if(d[i]<0){
                  ans=-1;
                  break;
            }
            else{
                  if(sum>=0){
                        break;
                  }
                  sum+=d[i];
                  ans++;
                  if(sum>=0){
                        break;
                  }
            }
      }
      cout<<ans<<endl;
      return 0;
}

Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
char s[maxn];
int a[maxn],n,q;
int main()
{
	scanf("%d%d%s",&n,&q,s+1);
	for(register int i=2;i<=n;i++)
	{
		a[i]+=a[i-1];
		if(s[i]=='C' && s[i-1]=='A')
			a[i]++;
	}
	for(register int i=1,l,r;i<=q;i++)
	{
		scanf("%d%d",&l,&r);
		printf("%d\n",a[r]-a[l]);
	}
	return 0;
}

Measured memory_bytes: 1280
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

// 重み付き UnionFind - マージテク (QuickFind) を使用した実装
// merge の計算量はならし O(log N)
// Verified: Never Wait for Weights (AOJ 1330)

struct QuickFind {
    int N;
    vector<int> i2g;
    vector< vector<int> > g2i;
    vector<ll> weight;
 
    QuickFind(int N_) {
        N = N_;
        i2g.resize(N);
        g2i.resize(N);
        weight.resize(N);
 
        for(int i=0; i<N; i++) {
            i2g[i] = i;
            g2i[i] = vector<int>{i};
        }
    }
 
    bool same(int u, int v) {
        return i2g[u] == i2g[v];
    }
 
    // v の方が w だけ大きい
    void unite(int u, int v, int w) {
        int ru = i2g[u], rv = i2g[v];
        if(ru == rv) return;
 
        // マージする対象を変更する場合は swap する
        if(g2i[rv].size() > g2i[ru].size()) {
            swap(ru, rv);
            swap(u, v);
            w = -w;
        }
 
        ll prev = weight[v];
        weight[v] = weight[u] + w;
 
        for(auto e : g2i[rv]) {
            i2g[e] = ru;
            ll diff = weight[e] - prev;
            // v 自身は更新済みなのでスキップ (重要)
            if(e != v) weight[e] = weight[v] + diff;
        }
 
        // rv の中身を全部 ru に移す
        for(auto e : g2i[rv]) {
            g2i[ru].push_back(e);
        }
        g2i[rv].clear();
    }
 
    ll query(int u, int v) {
        assert(same(u, v));
        return weight[v] - weight[u];
    }
};
 
signed main() {
    int N, M; cin >> N >> M;

    QuickFind uf(N);
    bool ok = true;
    for(int i=0; i<M; i++) {
        int L, R, D; cin >> L >> R >> D;
        L--; R--;
        if(!uf.same(L, R)) uf.unite(L, R, D);
        else {
            int info = uf.query(L, R);
            if(info != D) ok = false;
        }
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

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

int main() {


	int n;
	cin >> n;

	vector<string> result(n);

	for(int i = 0; i < n; i++) {
		cin >> result[i];
	}



	vector<int> count(4, 0);

	for(int i = 0; i < n; i++) {
		if(result[i] == "AC") {
			count[0] += 1;
		} else 	if(result[i] == "WA") {
			count[1]+= 1;
		} else if(result[i] == "TLE") {
			count[2]+= 1;
		}else if(result[i] == "RE") {
			count[3]+= 1;
		}
	}

	cout << "AC x " << count[0] << endl;
	cout << "WA x " << count[1] << endl;
	cout << "TLE x " << count[2] << endl;
	cout << "RE x " << count[3] << endl;

	return 0;

}



Measured memory_bytes: 6420
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#define ll long long int
#define mod 1000000007
#define pii pair<int, int>
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int n;
    ll a[200005] = {}, b = (ll)mod * mod;
    cin >> n;
    fr1(n) cin >> a[i];
    fr1(n) a[i] += a[i - 1];
    fr1(n - 1) b = min(b, abs(a[n] - a[i] - a[i]));
    cout << b << '\n';
}

Measured memory_bytes: 1792
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    s[5] = ' ';
    s[13] = ' ';

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 3616
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;
using llong = long long;
const int MOD=1000000007;


int main(int argc, char**argv){
    int n;
    cin >> n;
    vector<int> d(n);
    for(int i = 0; i < n; i++){
        cin >> d[i];
    }

    sort(d.begin(), d.end());
    d.erase(unique(d.begin(), d.end()), d.end());

    cout << d.size() << endl;


    return 0;
}










Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    typedef long long ll;
    #define pr pair<ll,ll>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):0;}

    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    inline int mm(const int x){return x>=MOD?x-MOD:x;}
    inline ll qpower(ll x,ll e)
    {
        ll ans=1;
        while(e){if(e&1)ans=ans*x%MOD;x=x*x%MOD;e>>=1;}
        return ans;
    }
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=1e6+10;

	vc<int> tmp;multiset<int> st;
	void main()
	{
		int n=qread(),m=bin(n); 
		for(int i=0;i<m;i++) st.insert(qread());
		tmp.PB(*(--st.end()));st.erase(--st.end());
		
		while(sz(tmp)<m)
		{
			for(int i=sz(tmp)-1;i>=0;i--)
			{
				int a=tmp[i];
				if(sz(st)==0)
				{
					puts("No");
					return;
				}
				multiset<int>::iterator now=st.lower_bound(a);
				if(now==st.begin())
				{
					puts("No");
					return;
				}
				now--;
				tmp.PB(*now);st.erase(now);
			}
			sort(all(tmp));
		}
		puts("Yes");
	}
};
int main()
{
	mine::main();
}

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

using namespace std;
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define mod 1000 * 1000 * 1000 + 7
#define pi 3.1415926536
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fir first
#define sec second

const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

int main()
{
    int n, k;
    cin >> n >> k;
    double ans = 0.0;
    for (int i = 1; i <= n; ++i)
    {
        int x = 0;
        while ((i * pow(2, x)) < k)
            x += 1;
        ans += (1 / (n * pow(2, x)));
    }
    cout << fixed << setprecision(12) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
      Scanner scanner = new Scanner(System.in);
      String str = scanner.next();
      if (str.equals("Sunny")) System.out.println("Cloudy");
      else if (str.equals("Cloudy")) System.out.println("Rainy");
      else if (str.equals("Rainy")) System.out.println("Sunny");
    }
}


Measured memory_bytes: 20564
str = input().strip()
alp = [chr(i) for i in range(65, 65+26)]
ans = {}
for S in str:
    for A in range(26):
        if S == alp[A]:
            if alp[A] in ans.keys():
                ans[alp[A]] += 1
            else:
                ans[alp[A]] = 1
if len(ans) == 2 and max(ans.values()) == 2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String str[] = br.readLine().split(" ");
	System.out.println(str[2] + " " + str[0] + " " + str[1]);
    }
}


Measured memory_bytes: 21204
fn main() {
    let n = read::<usize>();
    let mut xs = read_vec::<i64>();
    xs.sort();

    let x0 = xs[0];
    let x1 = xs[n - 1];
    let mut ans = 1000000000000000;
    for p in x0..x1 + 1 {
        let a = xs.iter().map(|&x| (x - p) * (x - p)).sum::<i64>();
        ans = std::cmp::min(ans, a);
    }
    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,l,r) for (int i=l,i##end=r;i<=i##end;++i)
#define per(i,r,l) for (int i=r,i##end=l;i>=i##end;--i)
#define rep0(i,r) for (int i=0,i##end=r;i<i##end;++i)
#define pr pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pb push_back
using namespace std;
const int N=5003,P=1e9+7;
int p[N],pw[N],fac[N],a[N],f[N];
vector<int> G[N];
bool vis[N],vis2[N];
int dfs(int u){
    int s=1; rep0(i,G[u].size()) s+=dfs(G[u][i]); return s;
}
int main(){
    int n,c=0; scanf("%d",&n);
    rep(i,1,n) scanf("%d",&p[i]),c+=p[i]==-1;
    pw[0]=1; rep(i,1,c) pw[i]=(ll)pw[i-1]*(n-1)%P;
    int cyc=0,l=0;
    rep(i,1,n){
        if (vis[i]) continue;
        rep(j,1,n) vis2[j]=false;
        int u=i; while (p[u]!=-1&&!vis2[u]&&!vis[u]) vis2[u]=vis[u]=true,u=p[u];
        if (vis[u]&&!vis2[u]) continue;
        vis[u]=true; if (vis2[u]) ++cyc;
    }
    rep(i,1,n) if (p[i]!=-1) G[p[i]].push_back(i);
    rep(i,1,n) if (p[i]==-1) a[++l]=dfs(i);
    f[0]=1;
    rep(i,1,l)
        per(j,l,1) f[j]=(f[j]+(ll)f[j-1]*a[i])%P;
    int ans=(ll)(n-cyc)*pw[c]%P;
    fac[0]=1; rep(i,1,l) fac[i]=(ll)fac[i-1]*i%P;
    rep(i,1,l) ans=(ans+P-(ll)(a[i]-1)*pw[c-1]%P)%P;
    rep(i,2,l){
        int s=(ll)fac[i-1]*f[i]%P*pw[c-i]%P;
        ans=(ans+P-s)%P;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4040
n = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(n):
    if a[i]<0:
        count += 1
        a[i] = abs(a[i])
a = sorted(a)
if count%2 != 0:
    a[0] = a[0]*-1
ans = 0
for i in range(n):
    ans += a[i]
print(ans)

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

using namespace std;

int main() {
	int n, k;
	scanf("%d%d",&k,&n);
	if (n-k+1>=-1000000) {
		if (n+k-1<=1000000) {
			for (int i=n-k+1; i<=n+k-1; i++) printf("%d ",i);
		}
		else {
			for (int i=n-k+1; i<=1000000; i++) printf("%d ",i);
		}
	}
	else {
		if (n+k-1<=1000000) {
			for (int i=-1000000; i<=n+k-1; i++) printf("%d ",i);
		}
		else {
			for (int i=-1000000; i<=1000000; i++) printf("%d ",i);
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=10009;

int n,m;
char s[maxn];
char t[maxn];

int ans=1e9;

int main(){
	cin>>(s+1)>>(t+1);
	n=strlen(s+1);
	m=strlen(t+1);
	for(int i=1;i<=n-m+1;++i){
		int cnt=0;
		for(int j=1;j<=m;++j){
			cnt+=s[i+j-1]!=t[j];
		}
		ans=min(ans,cnt);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3648
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int A = l[0], B = l[1];

            if (B == 1)
            {
                Console.WriteLine(0);
                return;
            }

            var ans = A;
            var count = 1;
            B -= A;
            while (B > 0)
            {
                B -= A - 1;
                count++;
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11348
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    for(int i = 1; i <= 100000; i++){
        if(i*8/100 == a && i/10 == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const ll INF = 1LL<<60;
//int INF = numeric_limits<int>::max();

int main(int, char**) {
	ll n; cin >> n;
	string ret = "";
	ll div = 26;

	while (n!=0) {
		n--;
		int now = n%26;
		n = n/26;
		char c = 'a' + now;
		ret = c + ret;
	}
	cout << ret << endl;
	return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define int long long int 
#define mp make_pair
#define pb push_back
#define f first
#define s second

int32_t main()
{
     IOS;
     
     int a[5];
     
     cin>>a[1]>>a[2]>>a[3];
     
     sort(a+1,a+4,greater<int>());
     
     cout<<a[1]*10+a[2]+a[3];
     
     return 0;     
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    while(true){
        int H,W;
        cin>>H>>W;
        if(H==0 && W==0)return 0;
        for(int i=0;i<W;i++)cout<<'#';
        cout<<"\n";
        for(int i=0;i<H-2;i++){
            cout<<'#';
            for(int i=0;i<W-2;i++)cout<<'.';
            cout<<"#\n";
        }
        for(int i=0;i<W;i++)cout<<'#';
        cout<<"\n\n";
    }
}


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, init, n) for(int i = init; i <(int)(n); i++)

int main() {

    string s;
    cin >> s;

    s[3] = '8';

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int cnt[55]={0};
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int a,b;cin>>a>>b;a--,b--;
		cnt[a]++,cnt[b]++;
	}
	for(int i=0;i<n;i++)cout<<cnt[i]<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr long double EPS = 1e-15;
const long double PI = acos(-1);
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

void solve() {
    int n,l;
    cin >> n >> l;
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        sum += l + i - 1;
    }
    int ans = inf;
    int kk = 0;
    for (int i = 1; i <= n; i++) {
        if (abs(l + i - 1) < ans) {
            kk = i;
            ans = abs(l+i-1);
        }
    }
    cout << sum - (l+kk-1) << endl;
}

int main(int argc, char *argv[]){
    // /* Regular */
    // int case_num = 1;
    // if (argc > 1 && stoi(argv[1])) cin >> case_num;
    // REP(case_no, case_num) {
    //   cerr << endl << "case " << case_no + 1 << endl;
    //   solve();
    // }
    /* AOJ */
    solve();
    return 0;
}

Measured memory_bytes: 256
line = gets.split(' ').map(&:to_i)
N = line[0]
M = line[1]
C = line[2]

B = gets.split(' ').map(&:to_i)
ret = 0
for i in 1..N do
    a = gets.split(' ').map(&:to_i)
    tmp = 0
    for j in 0..M-1 do
        tmp += B[j]*a[j]
    end
    if tmp + C > 0 then
        ret += 1
    end
end

puts ret

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MOD 1000000007
 
ll t,n,j,i;
string s;

int main()
{
    
    Fast;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
import fractions
import functools
n=int(input())
a=list(map(int,input().split()))
tmp=1
for f in a:
    tmp*=f
gcd=functools.reduce(fractions.gcd, a)
lcm=tmp//gcd
lcm-=1
ans=0
for f in a:
    ans+=lcm%f
print(ans)

Measured memory_bytes: 5304
#include<iostream>
#include<cstdio>
using namespace std;
int n,x,p,q;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		if (x&1) p++;
		if (x%4==0) q++; 
	}
	if (p+q==n) q++;
	if (q<p) printf("No\n");
	else printf("Yes\n");
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    cout << n * n * n <<endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
d=list(map(int, input().split()))
m=int(input())
t=list(map(int, input().split()))

from collections import Counter
d_c=Counter(d)
t_c=Counter(t)

flag=True
for key in t_c:
    if d_c[key]<t_c[key]:
        flag=False
print('YES' if flag else 'NO')


Measured memory_bytes: 56972
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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;
}

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

//----------------------------------------------------------------

int main()
{
    ll n, m;
    cin >> n >> m;
    map<ll, ll> rensou;
    ll l, r;
    ll lmax = -infll;
    ll rmin = infll;
    for (int i = 0; i < m; i++)
    {
        cin >> l >> r;
        chmax(lmax, l);
        chmin(rmin, r);
    }
    cout << seinomi(rmin - lmax + 1) << endl;
}

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

#define NREP() for(ull i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, x, y) for(ull i = x; i < y; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define MSGF(x, n) MSG(fixed << setprecision(n) << x)
#define END(x) cout << x << endl; exit(0);
#define IPT(v, n) REP(i, 0, n){ cin >> v[i]; }
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<ull> vul;
typedef vector<vector<ull>> vvul;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
const static ll INF = 1LL << 30;

ll a, b, c, d, k, l, m, n, h, w, q, x, y;
string s, t;

ull ans = 0;
ll sum = 0;
ll cnt = 0;
ll cur = 0;
ll tmp = 0;
ll mini = INF;
ll maxi = 0;

double ave = 0.0;

ll mod_pow(ll base, ll power) {
    if (power == 0) return 1;
    if (power == 1) return base % MOD;
    if (power % 2 == 0) return ((mod_pow(base % MOD, (power / 2)) % MOD) * (mod_pow(base, (power / 2)) % MOD)) % MOD;
    return (base % MOD * (mod_pow(base % MOD, power - 1) % MOD)) % MOD;
}

ll mod_fact(ll number) {
    ll ret = 1;
    ll count = 1;
    while (count <= number) {
        ret *= (count % MOD);
        ret %= MOD;
        count++;
    }
    return ret % MOD;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    cin >> n >> m;
    MSG((1900 * m + 100 * (n - m)) * pow(2, m))
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define li          long
#define ll          long long
#define ull         unsigned long long
#define ff          first
#define ss          second
#define pii         pair<int,int>
#define pli         pair<li,li>
#define pll         pair<ll,ll>
#define pb          push_back
#define fo(i,k,n)   for(int i = k;i<n; i++)
#define ro(i,k,n)   for(int i = k; i>=n; i--)
#define tc          int t;cin>>t;while(t--)
#define all(v)      v.begin(),v.end()
#define inf         INT_MAX
#define ninf        INT_MIN
#define W(x)        cout<<x<<endl
#define WW(x,y)     cout<<x<<' '<<y<<endl;
#define in(x)       cin>>x
#define vi          vector<int>
#define vll         vector<long long>
#define vpi         vector<pair<int>>
#define vpll        vector<pair<long long>>
#define vvi         vector<vector<int>>
#define vvll        vector<vector<long long>>
#define vvpi        vector<vector<pair<int,int>>>
#define vvpll       vector<vector<pair<long long>>>
#define int long long
const ll mod1 = 99844353;
const ll mod2 = 1e9+7;
template <class T>
using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

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

template<class T>
T power(T a,T b){
    T res = (T)1;
    while(b>0){
        if(b&1)res = res*a;
        b>>=1;
        a*=a;
    }
    return res;
}

void solve(){
    int a,v,b,w,t;
    cin>>a>>v>>b>>w>>t;
    if(a == b)cout<<"YES\n";
    if(w>v)cout<<"NO\n";
    else if(w == v&&a!=b)cout<<"NO\n";
    else if(w == v&&a == b)cout<<"YES\n";
    else if((a-b)>0&&(w-v)>0&&(a-b)<=t*(w-v))cout<<"YES\n";
    else if((a-b)<0&&(w-v)<0&&(a-b)>=t*(w-v))cout<<"YES\n";
    else if((a-b)>0&&(w-v)<0&&(a-b)<=t*abs((w-v)))cout<<"YES\n";
    else cout<<"NO\n";
}

signed main(){
    fastio();
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3652
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

template <class T>
inline bool chmax(T& a, T b) {
    return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
    return a = (a > b) ? b : a;
}

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

ll const MAX_N = 3000;

ll dp[MAX_N + 5][MAX_N + 5];
ll mv[MAX_N + 5][MAX_N + 5];

int main() {
    INIT;

    string s, t;
    cin >> s >> t;

    rep(i, MAX_N + 5) rep(j, MAX_N + 5) dp[i][j] = 0;
    rep(i, MAX_N + 5) rep(j, MAX_N + 5) mv[i][j] = 0;

    rep(i, SZ(s)) {
        rep(j, SZ(t)) {
            if (s[i] == t[j]) {
                dp[i + 1][j + 1] = dp[i][j] + 1;
                mv[i + 1][j + 1] = 0;
            } else if (dp[i + 1][j] < dp[i][j + 1]) {
                dp[i + 1][j + 1] = dp[i][j + 1];
                mv[i + 1][j + 1] = 1;
            } else {
                dp[i + 1][j + 1] = dp[i + 1][j];
                mv[i + 1][j + 1] = -1;
            }
        }
    }

    // rep(i, SZ(s) + 1) {
    //     rep(j, SZ(t) + 1) { cout << dp[i][j] << " "; }
    //     cout << endl;
    // }
    // cout << dp[SZ(s)][SZ(t)] << endl;

    string lcs = "";
    for (ll i = SZ(s), j = SZ(t); i > 0 && j > 0;) {
        if (mv[i][j] > 0)
            i--;
        else if (mv[i][j] < 0)
            j--;
        else {
            lcs.pb(s[i - 1]);
            i--;
            j--;
        }
    }
    reverse(ALL(lcs));
    cout << lcs << endl;

    return 0;
}

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

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define all(x) (x).begin(),(x).end()
#define IN(type,a) type a;cin >> a


using ll = long long;

int main() {
    bool ans = true;
    IN(int, n);
    IN(string, s);
    if(n%2 == 0){
        REP(i, n/2){
            if (s[i] != s[i+n/2]) {
                ans = false;
            }
        }
    }else{
        ans = false;
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n,y = map(int, input().split())
n10, n5, n1 = -1, -1, -1
for i in range(n+1):
    for j in range(i, n+1):
        if i*10000 + (j-i)*5000 + (n - j)*1000 == y:
            n10 = i
            n5 = j-i
            n1 = n-j
            break
print(n10, n5, n1)


Measured memory_bytes: 2940
# 下d+1桁目が初めて9でないとする
# [__X__]99999
# [_X++_]99999に勝つ必要がある
# 10^d(X+1)-1 / (S(X) + 9d) <= (10^d(X+2)-1) / (S(X)+9d+1)
# (S(X)+9d+1)/(S(X)+9d) <= (10^d(X+2)-1)/(10^d(X+1)-1)
# 1/(S(X)+9d) <= 10^d / (10^d(X+1)-1) <= 1/X
# X <= S(X)+9d <= 135

def S(n):
  if n < 10:
    return n
  return S(n//10) + n%10
  
li = [] # 候補、とりあえず十分量作る

for d in range(20):
  a = 10**d
  for x in range(200):
    y = (x+1)*a-1
    if y > 0:
      z = S(y)
      li.append((y,z))
    
li = sorted(list(set(li)),reverse=True)

# 右から見ていって、その時点での最小値タイ以下なら採用
answer = []
min_N,min_S = li[0]
for n,s in li[1:]:
  # n/s < min_N/min_S
  if n*min_S <= s*min_N:
    min_N = n
    min_S = s
    answer.append(n)


K = int(input())
answer.sort()
answer = answer[:K]
print('\n'.join(map(str,answer)))



Measured memory_bytes: 3572
#include <stdio.h>
#include <string.h>

int main(void){
  int i,j,k,n,s;
  char ca[201],can[201];

  while(1){
    scanf("%s\n%d", ca, &n);
    if(!strcmp(ca, "-")) break;
   
    for(i=0;i<n;i++){
      scanf("%d", &s);
      for(j=s;ca[j]!='\0';j++)
        can[j-s] = ca[j];
      for(k=0;k<s;k++)
        can[j-s+k] = ca[k];
     
      for(j=0;ca[j]!='\0';j++)
        ca[j] = can[j];
    }

    printf("%s\n", ca);
  }

  return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
  int n,i;
  scanf("%d",&n);
  vector<int>a(n);
  vector<int>dp(n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  auto isValid = [&](int i){
    if(i<n)
      return true;
    return false;
  };
  dp[n-1] = 0;
  for(i=n-2;i>=0;i--){
    dp[i] = dp[i+1] + abs(a[i+1] - a[i]);
    if(isValid(i+2)){
      dp[i] = min(dp[i],dp[i+2] + abs(a[i+2] - a[i]));
    }
  }
  printf("%d\n",dp[0]);
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
using ull = unsigned long long;
int fact(int n);  
const ull t = (int) pow(10.0, 9.0) + 7;
int main() {
  int N, M, tmp; cin >> N >> M;
  ull ans;
  if(abs(N - M) > 1) {
    cout << 0 << endl;
  } else if(N - M == 1) {
    ans = fact(M);
    ans = (ans * ans) % t;
    ans = (N * ans) % t;
    cout << ans << endl;
  } else if(M - N == 1) {
    ans = fact(N);
    ans = (ans * ans) % t;
    ans = (M * ans) % t;
    cout << ans << endl;
  } else {
    ans = fact(N);
    ans = 2 * ans * ans;
    ans %= t;
    cout << ans << endl;
  }
}
int fact(int n) {
  ull ans = 1;
  while(n != 1) {
    ans *= n;
    if(ans >= t) {
      ans %= t;
    }
    --n;
  } 
  return ans;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define k 10000
short A[MAX];

int main( ){
  short B[MAX];
  int C[k];
  int n,i,j;

  scanf("%d",&n);
  for(i=0;i <= k;i++) C[i] = 0;

  for(j=1;j <= n;j++){
    scanf("%d",&A[j]);
    C[A[j]]++;
  }

  for(i=1;i <= k;i++){
    C[i] = C[i] + C[i-1];
  }
  
  for(j=n;j >= 1;j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  for(i = 1; i<= n; i++){
    if( i > 1) printf(" ");
    printf("%d", B[i]);
  }
  printf("\n");

  return 0;
}



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

#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvb = vector<vb>;

const int INF = 1e9;
const int MOD = 1e9+7;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int H, W; cin >> H >> W;
    vs s(H); REP(i, H) cin >> s[i];
    vvi dp(H, vi(W, INF));
    dp[0][0] = (s[0][0] == '.') ? 0 : 1;
    REP(i, H)
    {
        REP(j, W)
        {
            if(i > 0)
            {
                if(s[i][j] == '#' && s[i-1][j] == '.') chmin(dp[i][j], dp[i-1][j]+1);
                else chmin(dp[i][j], dp[i-1][j]);
            }
            if(j > 0)
            {
                if(s[i][j] == '#' && s[i][j-1] == '.') chmin(dp[i][j], dp[i][j-1]+1);
                else chmin(dp[i][j], dp[i][j-1]);
            }
        }
    }
    cout << dp[H-1][W-1] << endl;
}

Measured memory_bytes: 384
MOD = 10 ** 9 + 7
N = int(input())
x = list(map(int, input().split()))
x.sort()

kaijo = [1]
for i in range(1, N):
    kaijo.append(kaijo[-1] * i % MOD)

ans = 0
for i in range(N - 1):
    ans = (ans * (i + 1) + (x[-1] - x[i]) * kaijo[i]) % MOD

print(ans)


Measured memory_bytes: 14224
S = list(input())
count = [0, 0]
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "0":
            count[0] += 1
        else:
            count[1] += 1
    else:
        if S[i] == "1":
            count[0] += 1
        else:
            count[1] += 1
print(min(count))


Measured memory_bytes: 3956
import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
##import operator
input=sys.stdin.readline
import random
##sys.setrecursionlimit(10**6)
##fo=open("output1.txt","w")
##fi=open("input1.txt","w")
mod=10**9+7
def cin():
    return map(int,sin().split())
def ain():            
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())

    
for _ in range(1):
    s=sin().strip()
    if(s[-1]=='s'):
        print(s+"es")
    else:
        print(s+'s')
    

    
    
        
        
      
    

##def msb(n):n|=n>>1;n|=n>>2;n|=n>>4;n|=n>>8;n|=n>>16;n|=n>>32;n|=n>>64;return n-(n>>1) #2 ki power
##def pref(a,n,f):             
##    pre=[0]*n
##    if(f==0):         ##from beginning
##        pre[0]=a[0]
##        for i in range(1,n):
##            pre[i]=a[i]+pre[i-1]
##    else:              ##from end
##        pre[-1]=a[-1]
##        for i in range(n-2,-1,-1):
##            pre[i]=pre[i+1]+a[i]
##    return pre
##maxint=10**24 
##def kadane(a,size): 
##    max_so_far = -maxint - 1
##    max_ending_here = 0
##       
##    for i in range(0, size): 
##        max_ending_here = max_ending_here + a[i] 
##        if (max_so_far < max_ending_here): 
##            max_so_far = max_ending_here 
##  
##        if max_ending_here < 0: 
##            max_ending_here = 0   
##    return max_so_far


Measured memory_bytes: 76556
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, m, u[1003] = {}, v[1003] = {}, w[1003] = {}, z = 0, d[102][102] = {};
    vector<pii> g[102] = {};
    cin >> n >> m;
    for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) if (i != j) d[i][j] = 890328;
    for (int i = 0; i < m; i++) cin >> u[i] >> v[i] >> w[i], d[u[i]][v[i]] = d[v[i]][u[i]] = w[i];
    for (int k = 1; k <= n; k++) for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    for (int i = 0; i < m; i++) if (d[u[i]][v[i]] < w[i]) z++;
    cout << z;
}


Measured memory_bytes: 384
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    ll a, b;
    cin >> a >> b;
    int k;
    cin >> k;
    rep(i,k){
        if(i%2){
            b /= 2;
            a += b;
        }else{
            a /= 2;
            b += a;
        }
    }
    cout << a << " " << b << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
        int sum = 100 * a + 10 * b + c;
        
		// 出力
		System.out.println(sum % 4 == 0 ? "YES" : "NO");
	}
}


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

// iterator
#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;

int main() {
    lli H, W;
    cin2(H, W);
    lli h, w;
    cin2(h, w);

    cout << H * W - (h * W + w * H - h * w) << endl;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
p = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(m)]

par = [i for i in range(n)]
rank = [1 for _ in range(n)]


def root(x):
    if x == par[x]:
        return x
    par[x] = root(par[x])
    return par[x]


def is_same(x, y):
    return root(x) == root(y)


def unite(x, y):
    x = root(x)
    y = root(y)
    if x == y:
        return
    par[x] = y


for x, y in xy:
    unite(x - 1, y - 1)


count = 0
for i, p_i in enumerate(p):
    count += 1 if is_same(i, p_i - 1) else 0
print(count)


Measured memory_bytes: 36124
#include <stdio.h>

int main(){
    int n,m,sum=0,count=0;
    scanf("%d %d",&n,&m);
    int a[n];
    for(int i=0;i<n;i++){
        scanf("%d",a+i);
        sum+=*(a+i);
    }
    for(int j=0;j<n;j++){
        if(a[j]>=(float)sum/(4*m)){
            count++;
        }
        if(count==m){
            printf("Yes\n");
            break;
        }
        if(j==n-1){
            printf("No\n");
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll>prime;
bitset<10000009>bs;
ll ans=0;
void find_prime(ll  val)
{
    bs.set();
    bs[1]=0;
    for(ll i=2; i*i<=val; i++)
    {
        if(bs[i]==1)
            for(ll j=i*i; j<=val; j+=i)
                bs[j]=0;
    }
    for(ll i=1; i<=val; i++)
        if(bs[i]==1)
            prime.emplace_back(i);
}
ll prime_fact(ll val)
{
    ll total=1;
    for(auto x:prime)
    {
        ll res=0;
        while(val%x==0 and x>1)
        {
            val/=x;
            res++;
        }
        total*=(res+1);
        if(bs[val]==1)
        {
            total*=2;
            break;
        }
        if(val==1)
            break;
    }
    return total;
}
int main()
{
    find_prime(10000009);
    ll n;
    cin>>n;
    ans+=1;//for 1.
    for(ll i=2; i<=n; i++)
    {
        if(bs[i]==1)
            ans+=(2*i);
        else
        {
            ll ok=prime_fact(i);
            ans+=ok*i;
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 12688
#include <iostream>
using namespace std;
int main() {
    int n, m; cin >> n >> m;
    int a[m], c[m];
    for (int i = 0; i < m; i++) {
        int b; cin >> a[i] >> b;
        c[i] = 0;
        while (b--) { int x; cin >> x; c[i] |= 1 << (x-1); }
    }
    constexpr int INF = 1<<30;
    int S = 1<<n, dp[S];
    fill(dp, dp+S, INF);
    dp[0] = 0;
    for (int i = 0; i < m; i++) {
        for (int s = 0; s < S; s++) {
            int s1 = s | c[i];
            dp[s1] = min(dp[s1], dp[s] + a[i]);
        }
    }
    cout << (dp[S-1] == INF ? -1 : dp[S-1]) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int x,y,sx,sy,tx,ty,i;
  scanf("%d%d%d%d",&sx,&sy,&tx,&ty);
  x=tx-sx;
  y=ty-sy;
  for(i=0;i<y;i++)
  printf("U");
  for(i=0;i<x;i++)
  printf("R");
  for(i=0;i<y;i++)
  printf("D");
  for(i=0;i<=x;i++)
  printf("L");
  for(i=0;i<=y;i++)
  printf("U");
  for(i=0;i<=x;i++)
    printf("R");
  printf("DR");
  for(i=0;i<=y;i++)
  printf("D");
  for(i=0;i<=x;i++)
  printf("L");
  printf("U\n");
  return 0;
}

Measured memory_bytes: 128