akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
string s;
bool nono(){
	for (int i=0;i<s.size();i+=2) if (s[i]!='h' || s[i+1]!='i'){
		return 1;
	}
	return 0;
}
int main(){
	cin>>s;
	if (s.size()%2==1 || nono()) puts("No");
	else puts("Yes");
}

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

using namespace std;

int i,lb,ub;
string s;
long long v;
char s1[5];

bool check(string tmp, long long num){
	tmp += num + '0';
	while(tmp.size() < 11)
	tmp += '9';
	
	cout << "? " << tmp << endl;
	fflush(stdout);
	
	scanf("%s", s1);
	
	return s1[0] == 'Y';
}

char ask(long long num){
	printf("? %lld\n", num);
	fflush(stdout);
	
	scanf("%s", s1);
	
	return s1[0];
}

long long num(string s){
	long long tmp = 0;
	for(int ii = 0; ii < s.size(); ii++)
	tmp = tmp * 10 + s[ii] - '0';
	return tmp;
}

int main(){
	while(true){
		if(s.size() == 0){
			lb = 0;
			ub = 9;
		}
		else{
			lb = -1;
			ub = 9;
		}
		
		while(ub - lb > 1){
			int mid = (lb + ub) / 2;
			
			if(check(s, mid))
			ub = mid;
			else
			lb = mid;
		}
		
		s += ub + '0';
		v = num(s);
		
		bool all9 = 1;
		
		for(i = 0; i < s.size(); i++)
		all9 &= (s[i] == '9');
		
		if(all9){
			s[s.size() - 1]--;
			s += '0';
			int tmp = num(s);
			s.pop_back();
			s[s.size() - 1]++;
			
			if(ask(tmp) == 'N')
			break;
		}
		else if(ask(v + 1) == 'Y')
		break;
	}
	
	printf("! %lld\n", v);
}


Measured memory_bytes: 596
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    a = LI()
    d = defaultdict(lambda : 0)
    for i in a:
        d[i] += 1
    ans = 0
    for i in set(a):
        if d[i] < i:
            ans += d[i]
        else:
            ans += d[i]-i
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 63200
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N, K;
	in >> N >> K;
	std::vector<LL>A(N), F(N);
	rep(i, N) in >> A[i];
	rep(i, N) in >> F[i];

	std::sort(A.begin(), A.end());
	std::sort(F.rbegin(), F.rend());
	LL left = -1, right = 1123456789012;
	while (right - left > 1)
	{
		LL mid = (left + right) / 2, res = 0;
		rep(i, N)
		{
			if (A[i] * F[i] > mid) res += A[i] - mid / F[i];
		}
		if (res <= K) right = mid;
		else left = mid;
	}

	out << right << std::endl;
}


Measured memory_bytes: 3328
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;


typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;

#define rep(i,b) for(i=0;i<b;++i)
#define repp(i,a,b) for(i=a;i<b;++i)

int main() {
    ll len, n;
    cin >> n >> len;
    string s[n];
    for(int i = 0; i < n; i++){

        cin >> s[i];
    }
    sort(s, s+n);
    for(auto i: s) cout << i;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define RFOR(i, a, b) for(int i = a; i >= b; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
const int INF = 1e9;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
int main() {
    int n;
    cin >> n;
    int a[n], b[n], c[n-1];
    REP(i, n) cin >> a[i];
    REP(i, n) cin >> b[i];
    REP(i, n-1) cin >> c[i];
    int sum = 0;
    int j = -999;
    REP(i, n) {
        sum += b[a[i]-1];
        if(j+1 == a[i]) sum += c[j-1];
        j = a[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
#define INF 10000000000000000
typedef long long ll;

int main() {
    
    ll N, T;
    cin >> N >> T;
    
    ll sum=0, pre=0, nxt;
    rep(i,N){
        cin>>nxt;
        sum += min(T,nxt-pre);
        swap(pre,nxt);
    }
    cout1(sum+T);
}

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

int main() {
	long long a, b, x;
	cin >> a >> b >> x;
	if (a%x != 0) a = a + x - a%x;
	b = b - b%x;
	long long ans;
	if (a > b) ans = 0;
	else ans = (b - a) / x + 1;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#n , m , l = map(int , input().split())

# list_n = list(map(int , inpuut().split()))<Paste>

#n = input()
# list = [input() for i in range(N)

#list = [[i for i in range(N)] for _ in range(M)]


N = int(input())
list_A = list(map(int, input().split()))

list_A.sort(reverse=True)
print(sum(list_A[0::2]) - sum(list_A[1::2]))


Measured memory_bytes: 9020
#include <stdio.h>

int main(void)
{
  long a, b;

  while(scanf("%ld %ld", &a, &b) != EOF)
  {
    printf("%ld ", a / b);
    printf("%ld ", a % b);
    printf("%.5lf\n", ((double)a / (double)b));
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const int MOD = 1000000007; 

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int ret = 0; 
    gnr(j, 1, n/2) {
        bool is_ok = true;
        rep(i, j) {
            if (s[i] != s[i+j]) {
                is_ok = false; 
                break;
            } ;
        }
        if (is_ok) {
            ret = 2*j;
            cout << ret << endl;
            return 0; 
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const vector<int> dir = { 0, 1, 0, -1 };
int H, W;
int main() {
	cin >> H >> W;
	vector<string> s(H);
	vector<int> cx, cy;
	for (int i = 0; i < H; i++) {
		cin >> s[i];
		for (int j = 0; j < W; j++) {
			if (s[i][j] != '.') {
				cx.push_back(j);
				cy.push_back(i);
			}
		}
	}
	sort(cx.begin(), cx.end());
	cx.erase(unique(cx.begin(), cx.end()), cx.end());
	int rx = cx.size();
	for (int i = 1; i < rx; i++) {
		if (cx[i] - cx[i - 1] >= 2) cx.push_back(cx[i - 1] + 1);
	}
	sort(cx.begin(), cx.end());
	sort(cy.begin(), cy.end());
	cy.erase(unique(cy.begin(), cy.end()), cy.end());
	int ry = cy.size();
	for (int i = 1; i < ry; i++) {
		if (cy[i] - cy[i - 1] >= 2) cy.push_back(cy[i - 1] + 1);
	}
	sort(cy.begin(), cy.end());
	H = cy.size(), W = cx.size();
	vector<string> t(H, string(W, '.'));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (s[cy[i]][cx[j]] != '.') t[i][j] = s[cy[i]][cx[j]];
		}
	}
	int ret = 0;
	while (true) {
		bool flag = false;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (t[i][j] != '.') continue;
				vector<vector<pair<int, int> > > d(26);
				for (int k = 0; k < 4; k++) {
					int tx = j, ty = i;
					while (0 <= tx && tx < W && 0 <= ty && ty < H) {
						if (t[ty][tx] != '.') {
							d[t[ty][tx] - 65].push_back(make_pair(tx, ty));
							break;
						}
						tx += dir[k];
						ty += dir[k ^ 1];
					}
				}
				for (int k = 0; k < 26; k++) {
					if (d[k].size() == 2) {
						flag = true; ret += 2;
						t[d[k][0].second][d[k][0].first] = '.';
						t[d[k][1].second][d[k][1].first] = '.';
					}
				}
			}
		}
		if (!flag) break;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 3268
import math
n,d = map(int,input().split())
x = [0] * n
y = [0] * n
count = 0

for i in range(n):
    x[i],y[i] = map(int,input().split())
    if d >= math.sqrt(x[i]*x[i] + y[i]*y[i]):
        count += 1
print(count)

Measured memory_bytes: 24580
#include<stdio.h>
#include<stdlib.h>
const unsigned long long lim = 1000000000000000000ull;

static inline unsigned long long mul(unsigned long long lhs,unsigned long long rhs){
    if((long double)lim / lhs < (long double)rhs){
        puts("-1");
        exit(0);
    }
    return lhs * rhs;
}

int main(void){
    int n;
    register int i;
    scanf("%d",&n);
    unsigned long long a[n],tmp = 1;
    for(i = 0;i < n;i++)scanf("%llu",&a[i]);
    for(i = 0;i < n;i++)if(!a[i]){
        puts("0");
        return 0;
    }
    for(i= 0;i < n;i++){
        tmp = mul(tmp,a[i]);
    }
    printf("%llu",tmp);
}

Measured memory_bytes: 2460
function main(input) {
	var a = input[0].split(' ');

	if(parseInt(a[0]) < parseInt(a[1])){
		if(parseInt(a[1])< parseInt(a[2])){
			console.log(parseInt(a[0]) + " " + parseInt(a[1]) + " " + parseInt(a[2]))
		}else{
			console.log(parseInt(a[0]) + " " + parseInt(a[2]) + " " + parseInt(a[1]))
		}
	}else if(parseInt(a[0]) > parseInt(a[2])){
		if(parseInt(a[1])<parseInt(a[2])){
			console.log(parseInt(a[1]) + " " + parseInt(a[2]) + " " + parseInt(a[0]))
		}else{
			console.log(parseInt(a[2]) + " " + parseInt(a[1]) + " " + parseInt(a[0]))
		}
	}else{
		if(parseInt(a[1])<parseInt(a[2])){
			console.log(parseInt(a[1]) + " " + parseInt(a[2]) + " " + parseInt(a[0]))	
		}else{
			console.log(parseInt(a[2]) + " " + parseInt(a[1]) + " " + parseInt(a[0]))
		}
	}
}

var input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main(input);
});

Measured memory_bytes: 7644
N, M, C = map(int, input().split(" "))

B = input().rstrip().split(" ")
B = list(map(int, B))

count = 0

for i in range(N):
    sum = 0
    A = input().rstrip().split(" ")
    A = list(map(int, A))
    for i in zip(A, B):
        sum += i[0] * i[1]
    if sum + C > 0:
        count += 1

print(count)

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

#define endl '\n'
#define int ll
using namespace std;
typedef long long ll;
typedef pair<int, ll> Edge;
#define idx first
#define len second

const int N = 100005;

int vn;
vector<Edge> tree[N];

void init();
void process();

int32_t main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    init();
    process();
    cout.flush();
    return 0;
}

void init()
{
    cin >> vn;
    for(int i = 1; i < vn; i++)
    {
        int a, b; ll w; cin >> a >> b >> w;
        a--, b--;
        tree[a].emplace_back(b, w);
        tree[b].emplace_back(a, w);
    }
}

vector<bool> color;

void dfs(int idx, int pa)
{
    for(auto x:tree[idx])
    {
        if(x.idx == pa) continue;
        if(x.len%2 == 1) color[x.idx] = !color[idx];
        else color[x.idx] = color[idx];
        dfs(x.idx, idx);
    }
}

void process()
{
    color.resize(vn, false);
    dfs(0, 0);
    for(int i = 0; i < vn; i++)
        cout << (color[i]? '1' : '0') << endl;
}



Measured memory_bytes: 10240
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <cmath>

using namespace std;

int main(int argc, char *argv[]) {
  int ice[10], n;
  while (cin >> n, n) {
    memset(ice, 0, sizeof(int) * 10);
    for (int i = 0; i < n; i++) {
      int tmp;
      cin >> tmp;
      ice[tmp]++;
    }
    for (int i = 0; i < 10; i++) {
      if (ice[i] > 0) {
        for (int j = 0; j < ice[i]; j++)
          cout << '*';
        cout << endl;
      } else {
        cout << '-' << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1156
N=int(input())

def func(x,y,z):
  return x*x+y*y+z*z+x*y+y*z+z*x

for i in range(1,N+1):
  answer_set=set()
  for x in range(int(i**0.5)+1):
    for y in range(1,x+1):      
      for z in range(1,y+1):
        if func(x,y,z)==i:
          answer_set.add((x,y,z))
          answer_set.add((x,z,y))
          answer_set.add((y,x,z))
          answer_set.add((y,z,x))
          answer_set.add((z,y,x))
          answer_set.add((z,x,y))
        elif func(x,y,z)>i:
          break
          
  print(len(answer_set))

Measured memory_bytes: 72860
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
int a,b;
int main()
{
    int ans=-1;
    scanf("%d%d",&a,&b);
    for(int i=1;i<=1005;i++)
    {
        int l=(int)floor(i*0.08);
        int r=(int)floor(i*0.1);
        if(l==a&&r==b){ans=i;break;}
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll long long
int main()
{
    ll x1,x2,x3,x4;
    ll n;
    scanf("%lld%lld%lld%lld",&x1,&x2,&x3,&x4);
    scanf("%lld",&n);
    x2=min(x1*2,x2);
    x3=min(x2*2,x3);
    x4=min(x3*2,x4);
    if(n%2)
    printf("%lld\n",n/2*x4+x3);
    else
        printf("%lld\n",n/2*x4);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() 
{
    int A,B;
    cin>>A>>B;

    if(A>12)
    {
        cout<<B<<endl;
    }
    else if(A<=12&&A>=6)
    {
        cout<<B/2<<endl;
    }
    else
    {
        cout<<"0"<<endl;
    }

    return 0;
}


Measured memory_bytes: 3616
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        String s = scanner.next();
        long k = scanner.nextLong();
        Matcher matcher = Pattern.compile("[2-9]").matcher(s);
        if (matcher.find() && matcher.start() < k) {
            System.out.println(matcher.group());
        } else {
            System.out.println(1);
        }
    }
}

Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define pi pair<int,int>
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for(int i=(int)(l);i<(int)(r);i++)
#define repd(i, l, r) for (int i=(int)(l);i>=(int)(r);i--)
#define clrg(i, l, r) for(int i=(int)(l);i<(int)(r);i++)vis[i]=0,v[i].clear();
int power(int x, unsigned int y){int res = 1;while (y > 0){ if (y & 1){res = res*x;} y = y>>1;x = x*x;}return res;}
int powermod(int x, unsigned int y, int p){int res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
#define print2d(mat,n,m){for(int i=0;i<(int)(n);i++){for(int j=0;j<(m);j++){cout<<mat[i][j]<<" ";}cout<< endl;}}
#define clr(a,x) memset(a,x,sizeof(a))
#define rr(v) for(auto &val:v)
#define print(v) for (const auto itr : v){cout<<itr<<' ';}cout<<"\n";
#define ln length()
#define sz size()
#define mod 1000000007
#define elif else if
int dp[1005][1005],h,w;
char ar[1005][1005];
int solve(int i,int j){
  if(i==h-1 and j==w-1)return 1;
  if(dp[i][j]!=-1)return dp[i][j];
  if(ar[i][j]=='#')return dp[i][j]=0;
  int ans=0;
  if(i<h-1)ans+=solve(i+1,j),ans%=mod;
  if(j<w-1)ans+=solve(i,j+1),ans%=mod;
  dp[i][j]=ans;
  return ans;
}
int32_t main(){
   cin>>h>>w;
  rep(i,0,h)rep(j,0,w)cin>>ar[i][j];
  clr(dp,-1);
  cout<<solve(0,0)<<"\n";
   return 0;
}
/*
Edge cases? n=1? a[i]<=0?
long vs int? 1LL? 64bits?
Re-read problem. Is it as easy as it seems?
KEEP CORRECTING AND SUBMITTING!
*/


Measured memory_bytes: 12528
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

typedef long long ll;

const int N=105;

int n,m,k,Mo,C[N][N],f[N][N][N][2];

int pwr(int x,int y) {
	int z=1;
	for(;y;y>>=1,x=(ll)x*x%Mo)
		if (y&1) z=(ll)z*x%Mo;
	return z;
}

int main() {
	scanf("%d%d%d%d",&n,&m,&k,&Mo);
	fo(i,0,max(n,m)) {
		C[i][0]=1;
		fo(j,1,i) C[i][j]=(C[i-1][j]+C[i-1][j-1])%Mo;
	}
	f[0][0][0][0]=1;
	fo(x,0,k-1) 
		fo(i,0,n) fo(j,0,m) {
			int ret=1,cnt=(pwr(x+1,m-j)-pwr(x,m-j))%Mo;
			cnt=(ll)cnt*pwr(k-x,j)%Mo;
			fo(l,0,n-i) {
				(f[x][i+l][j][1]+=(ll)f[x][i][j][0]*C[n-i][l]%Mo*ret%Mo)%=Mo;
				ret=(ll)ret*cnt%Mo;
			}
			ret=1;cnt=(pwr(k-x,i)-pwr(k-x-1,i))%Mo;
			cnt=(ll)cnt*pwr(x+1,n-i)%Mo;
			fo(l,0,m-j) {
				(f[x+1][i][j+l][0]+=(ll)f[x][i][j][1]*C[m-j][l]%Mo*ret%Mo)%=Mo;
				ret=(ll)ret*cnt%Mo;
			}
		}
	printf("%d\n",(f[k][n][m][0]+Mo)%Mo);
	return 0;
}

Measured memory_bytes: 8960
#include<bits/stdc++.h>
//#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long int
#define mkp make_pair
#define maxN 1005
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,a,b) for(int i=a;i<b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define  vi vector<int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define in cin>>
#define out cout<<
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
void printArray(int arr[],int n)
{
   for(int i=0;i<n;i++)cout<<arr[i]<<' ';
}
void printMp(mp m)
{
  mp ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printUmp(ump m)
{
  ump ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printSt(st s)
{
  st ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printMst(mst s)
{
  mst ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printVec(vector<int>v)
{
for(int i=0;i<v.size();i++)cout<<v[i]<<' ';
}
void printVec2(vector<int>v[],int n)
{
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<v[i].size();j++)
            cout<<v[i][j]<<' ';
        cout<<endl;
    }
}
 set<pair<int,int>> primeset;
void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
        for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          primeset.insert(mkp(p,1));
}
pi g1[1000006],g2[1000006];
int arr[maxN][maxN];

int32_t main(){
    fastio;
int a;in a;int b;in b;
SieveOfEratosthenes(11);
if(b==1)
    out 0<<endl;
else{
    int temp=a;
    SieveOfEratosthenes(11);
    int ans=1;
    SieveOfEratosthenes(11);
    while(a<b){
        ans++;SieveOfEratosthenes(11);
        a=temp-1+a;
    }SieveOfEratosthenes(11);
    out ans;
}
}


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

int main(){
    int n, i, j;
    string s;
    cin >> n >> s;
    int count = n;
    for(i = 0;i < n-1;i++){
        if(s.at(i) == s.at(i+1)) count--;
    }
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 512
import math

n = int(input())
x = []
y = []
for i in range(n):
  a,b = map(int,input().split())
  x.append(a)
  y.append(b)
total = 1
for i in range(1,n+1):
  total*=i
  
length = []
for i in range(n-1):
  for s in range(1,n):
    if i<s:
      length.append(math.sqrt((x[i]-x[s])**2+(y[i]-y[s])**2))

h = (n-1)/len(length)
if n==2:
  print(sum(length))
else:
  print(h*sum(length))
    

Measured memory_bytes: 62272
#include<iostream>
using namespace std;

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

    for(int k = 0; k < n-1; k++){
        cout << a[k] << " ";
    }
    cout << a[n-1] << endl;

    for(int i = 1; i < n;i++){
        int v, j;
        v = a[i];
        j = i-1;
        while(j >= 0 && a[j] > v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;

        for(int k = 0; k < n-1; k++){
                cout << a[k] << " ";
            }
            cout << a[n-1] << endl;

    }

    return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N,K; cin >> N >> K; int ans=0;
    vector<int> V(N,0); rep(i,N) cin >> V[i];
    if(N-K>=0){
    for(int i=N-K;i<N;i++){
        for(int j=0;j<N-i+1;j++){
            vector<int> S;
            S=V;
            S.erase(S.begin()+j,S.begin()+j+i);
            sort(S.begin(),S.end());
            int a=i-N+K;
            while(S[0]<0 && a>0 && S.size()>0){
                S.erase(S.begin());
                a--;
            }
            int pos=0;
            rep(k,S.size()){
                pos+=S[k];
            }
            ans=max(ans,pos);
        }    
    }
    }
    else {
        sort(V.begin(),V.end());
        int a=K-N;
        while(V[0]<0 && V.size()>0 && a>0){
            V.erase(V.begin());
            a--;
        }
        int pos=0;
        rep(i,V.size()){
            pos+=V[i];
        }
        ans=max(ans,pos);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#define mod 998244353
using namespace std;
int n,m,k;
long long ans=0,tmp=1;
long long qpow(long long x,long long y)
{
	long long res=1;
	while(y)
	{
		if(y&1) res=res*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return res;
}
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<=k;i++)
	{
		ans=(ans+(tmp*m%mod)*qpow(m-1,n-i-1))%mod;
		tmp=tmp*(n-i-1)%mod;
		tmp=tmp*qpow(i+1,mod-2)%mod;
	}
	printf("%lld\n",ans);
}

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

#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define fr(i, a, b) for(int i = a ; i < b ; i++)
#define frr(i, a, b) for(int i = a ; i >= b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str() // int to string
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)
#define deb(x) cout << #x" = " << x << '\n'
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

char s[1234], t[1234], tt[1234];

int main() {
//    freopen("input.in", "r", stdin);
	scanf("%s %s %s", s, t, tt);
	printf("%c%c%c\n", s[0], t[0], tt[0]);
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define LL long long
#define FOR(i,a,b) for(int i=a;i<=b;++i)
using namespace std;

const int mn=1e5+7;

int main()
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	c=(c+b-1)/b;a=(a+d-1)/d;
	puts(a>=c?"Yes":"No");
}

Measured memory_bytes: 3764
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String[] tokens = in.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int D = Integer.parseInt(tokens[1]);
		int result = (N / (2 * D + 1));
		if (N % (2 * D + 1) != 0) {
			result++;
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 23124
#include<iostream>
using namespace std;
int main(){
  int N;
  int A;
  cin >> N >> A;

  bool can = false;
  for(int i = 0; i < 11000; i++)
  {
    /* code */
    for(int j = 0; j <= A; j++)
    {
      /* code */
      int sum = 500 * i + j;
      //cout << sum << endl;
      if(sum == N){
        can = true;
        break;
      }
    }
    
  }
  if(can){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
unittest
{
	assert( [ "2 3", "10 1", "1", "15 1", "2", "30 2", "1 2" ].parse.expand.solve == 25 );
	assert( [ "12 1", "100000 1", "2" ].parse.expand.solve == -1 );
	assert( [ "4 6", "67786 3", "1 3 4", "3497 1", "2", "44908 3", "2 3 4", "2156 3", "2 3 4", "26230 1", "2", "86918 1", "3" ].parse.expand.solve == 69942 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nm = input.front.split.to!( long[] );
	auto acs = new Tuple!( long, long )[ nm[ 1 ] ];
	foreach( ref ac; acs )
	{
		input.popFront;
		auto ab = input.front.split.to!( long[] );
		input.popFront;
		auto cs = input.front.split.to!( long[] );
		ac = tuple( ab[ 0 ], cs.toBits );
	}
	return tuple( nm[ 0 ], acs );
}

auto solve( long n, Tuple!( long, long )[] acs )
{
	// dp[ i個目の鍵 ][ 対応する宝箱（bit列） ] = 最小コスト
	auto dp = new long[][]( 1 + acs.length, 1L << n );
	foreach( ref dpp; dp )
	{
		dpp[] = long.max;
	}
	dp[ 0 ][ 0 ] = 0L;
	
	foreach( i, ac; acs )
	{
		for( auto b = 0L; b < dp[ i ].length; b++ )
		{
			if( dp[ i ][ b ] == long.max ) continue;
			dp[ i + 1 ][ b           ] = min( dp[ i + 1 ][ b           ], dp[ i ][ b ]           );		// 買わない場合
			dp[ i + 1 ][ b | ac[ 1 ] ] = min( dp[ i + 1 ][ b | ac[ 1 ] ], dp[ i ][ b ] + ac[ 0 ] );		// 買う場合
		}
	}
	
	if( dp[ $ - 1 ][ $ - 1 ] == long.max ) return -1;
	else                                   return dp[ $ - 1 ][ $ - 1 ];
}

// 整数列をビットパターンに変換（整数は1～32限定）
auto toBits( long[] ns )
{
	auto b = 0U;
	foreach( n; ns ) b |= 1 << ( n - 1 );
	return b;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

// 最大公約数 : 3,4 ->  1
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

void solve()
{
  int n, x;
  cin >> n >> x;
  vector<int> pos(n);
  for(int i = 0; i < n; ++i)
  {
    cin >> pos[i];
  }
  int min_pos = *min_element(pos.begin(), pos.end());

  x -= min_pos;
  int ans = abs(x);
  for(int i = 0; i < n; ++i)
  {
    ans = gcd(ans, pos[i] - min_pos);
  }
  cout << ans;

}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3716
loop do
  break if (n=gets.to_i)==0
  min=80000
  for a in 0..n/200 do
    for b in 0..(n-200*a)/300 do
      for c in 0..(n-200*a-300*b)/500 do
        if a*200+b*300+c*500==n then
          p=a/5*1520+a%5*380+b/4*1870+b%4*550+c/3*2244+c%3*850
          min=p if p < min
        end
      end
    end
  end
  p min
end

Measured memory_bytes: 8708
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;

int main(){
    int h,n;
    cin >> h >> n;
    vector<pair<int,int>> magic(n);
    for(int i=0;i<n;i++) cin >> magic[i].first >> magic[i].second;
    sort(magic.begin(),magic.end());
    vi dp(h+magic[n-1].first,1e9);
    dp[0]=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<n;j++){
            dp[i+magic[j].first]=min(dp[i+magic[j].first],dp[i]+magic[j].second);
        }
    }
    int ans=1e9;
    for(int i=h;i<h+magic[n-1].first;i++){
        ans=min(ans,dp[i]);
    }
    cout << ans << endl;
}

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

int main(){
    int64_t i, j, k;
    int N;
    vector<vector<int64_t>> weight;
    cin >> N;
    for(i=0; i<N; i++){
        int64_t a, b;
        scanf("%lld %lld", &a, &b);
        weight.push_back({a, 0LL, i});
        weight.push_back({b, 1LL, i});
    }
    sort(weight.begin(), weight.end());
    int use_side[2] = {0, 0};
    bool dub = false;
    bool use_num[100000];
    for(i=0; i<N; i++) use_num[i] = false;

    int64_t ans = 0;
    for(i=0; i<N; i++){
        auto v = weight[i];
        ans += v[0];
        use_side[v[1]]++;
        if(use_num[v[2]]) dub = true;
        use_num[v[2]] = true;
    }

    if(use_side[0]>0 && use_side[1]>0 && !dub){
        int64_t loss;
        if(weight[N-1][2] == weight[N][2] && use_side[weight[N-1][1]] > 1){
            loss = min(weight[N+1][0] - weight[N-1][0], weight[N][0] - weight[N-2][0]);
        }else{
            loss = weight[N][0] - weight[N-1][0];
        }
        ans += loss;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12464
// 2020 0330 157 D Friend Suggestion
//comment: https://youtu.be/TdR816rqc3s?t=6822
#include <iostream>
#include <vector>
#include <cstdio>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;

struct UnionFind {
    vector<int> d; // child -> ID of parent, parent -> -size (マイナス サイズ)
                   // child >= 0, parent < 0
                   // スパゲッティソース？
    UnionFind(int n): d(n, -1) {}
    int find(int x){
        // findのみ -> 単純な実装
        // 今のノードが根(負)なら頂点番号を返す
        // 根ではないなら，親についてfind()する(再帰関数)
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y) {
        // 径路縮約，メモ化
        // 2つの頂点をもってくる
        // どちらも根にしておく
        x = find(x); y = find(y);
        if(x == y) return false;
        // false にしておくと便利なことがある(Minimmum Spanning Tree, 最小全域木のクラスカル法で)
        // くっつけるのに成功したかどうか
        if(d[x] > d[y]) swap(x, y);
        // 大きい方(y)を小さい方(x)にくっつける
        // d[] = -size なので注意 
        // -d[x] > -d[y] -> d[x] < d[y]
        d[x] += d[y]; // 連結成分をあわせてる？　
        d[y] = x;   // xをyにくっつける？
        return true;
    }
    bool  same(int x, int y) { return find(x) == find(y);}
    // おまけ.おなじ集合に属してるかどうか
    //　これがあると便利
    int size(int x) { return -d[find(x)];}
    // 連結成分サイズ
    // 根のマイナスをとったもの
};

int deg[100005]; // 次数, 直接の友達の数
vector<int> to[100005];

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        deg[a]++;
        deg[b]++;
        uf.unite(a, b);
        // 友達関係のUF
        // 実は辺の情報は不要で，友達関係の次数だけあればいい
    }
    rep(i, k) {
        // ブロック関係
        // ある頂点から出てるブロック関係の隣接リスト
        int a, b;
        cin >> a >> b;
        --a; --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    rep(i, n) {
        int ans = uf.size(i) - 1 - deg[i];
        // 連結成分サイズ - 自分 - 直接の友達
        for (int u : to[i]) {
            // 範囲for文
            // 配列やコンテナを簡潔に扱うためのfor文の別表現
            if(uf.same(i, u)) --ans;
            // 同じ連結成分内のブロック関係ならば引く
        }
        printf("%d%c", ans, i==n-1?'\n':' ');
        // 最後なら改行，そうでなければスペースを出力
        // AtCoder はスペースや改行のチェックはあんまり厳しくないので
        // すべて改行にしててもACはする
    }


    return 0;
}


Measured memory_bytes: 6784
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            String line = sc.nextLine();
            String answer = "";
            int length = line.length();
            for(int i = 0;i < length;i++){
                char ch = line.charAt(i);
                if(Character.isLowerCase(ch)){
                    answer += Character.toUpperCase(ch);
                }else{
                    answer += Character.toLowerCase(ch);
                }
            }
            System.out.println(answer);
        }
    }
}


Measured memory_bytes: 31428
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdio.h>

using namespace std;

//typedefリスト
typedef vector<long long int> vint;
typedef vector<vector<long long int>> vvint;
typedef vector<string> vstr;
typedef long long int llint;

llint gcd(llint x, llint y) {
	while (y != 0) {
		if (x > y) {
			llint r = x % y;
			x = y;
			y = r;
		}
		else {
			llint r = y % x;
			y = r;
		}
	}
	return x;
}

int main(void) {
	int W, H, C;
	cin >> W >> H >> C;
	int x=gcd(W, H);

	cout << (W / x)*(H / x)*C << endl;
}




Measured memory_bytes: 3112
#include <iostream>
#include <cstdio>
#include <set>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <fstream>
#include <iomanip>
//#include <unordered_map>
using namespace std;
#define dbg(x) cerr << #x " = " << x << endl;
typedef pair<int, int> P;
typedef long long ll;
#define FIN freopen("in.txt", "r", stdin);

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin>> n >> m;
    int l = 1, r= n;
    for(int i = 0; i < m; i++)
    {
        int L, R;
        cin >> L >> R;
        l = max(L, l);
        r = min(r, R);
    }
    if(l > r)
    {
        cout << 0 << endl;
        return 0;
    }
    cout << r - l + 1 << endl;
    return 0;
}

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

int main()
{
    long long int N, i, ans, ten, nine1, nine2, eight, div;
    cin >> N;
    ans = 0;
    ten = 1;
    nine1 = 1;
    nine2 = 1;
    eight = 1;
    div = 1;
    for (i = 0; i < 9; i++)
    {
        div *= 10;
    }
    div += 7;
    for (i = 0; i < N; i++)
    {
        ten *= 10;
        nine1 *= 9;
        nine2 *= 9;
        eight *= 8;
        ten = ten % div;
        nine1 = nine1 % div;
        nine2 = nine2 % div;
        eight = eight % div;
    }
    ans = ten + div - nine1 + div - nine2 + eight;
    ans = ans % div;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3604
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    S = list(input() for _ in range(n))

    cnt_AB = 0
    cnt_A = 0
    cnt_B = 0
    res = 0
    for s in S:
        res += s.count("AB")
        if s[0] == "B" and s[-1] == "A":
            cnt_AB += 1
        elif s[0] == "B":
            cnt_B += 1
        elif s[-1] == "A":
            cnt_A += 1

    if cnt_A + cnt_B > 0:
        print(res + cnt_AB + min(cnt_A, cnt_B))
    else:
        print(res + max(0, cnt_AB - 1))


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 44760
#include <iostream>
#include <vector>

void solve() {
    int k;
    std::cin >> k;

    int ans = 0;
    std::vector<int> dp(k + 1, 0);
    for (int g = k; g >= 1; --g) {
        dp[g] = (k / g) * (k / g) * (k / g);
        for (int p = g * 2; p <= k; p += g) {
            dp[g] -= dp[p];
        }
        ans += dp[g] * g;
    }

    std::cout << ans << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a,b,c;
    cin >> a >> b >> c;

    if (a+b >= c) {
	    cout << "Yes" << endl;
    }
    else
    {
	    cout << "No" << endl;
    }
}


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

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

    int k = 0;
    int t = n;
    while(true) {
        if (t == 0) break;
        k += t % 10;
        t /= 10;
    }

    if (n % k == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    string s; cin >> s;
    vector<int> e[n];
    vector<vector<int>> cnt(n, vector<int>(2, 0));
    vector<bool> dead(n, 0);
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        a--, b--;
        e[a].emplace_back(b);
        e[b].emplace_back(a);
        cnt[a][s[b]%2]++, cnt[b][s[a]%2]++;
    }
    queue<int> q;
    for (int i = 0; i < n; i++) {
        if (cnt[i][0] * cnt[i][1] == 0) q.emplace(i), dead[i] = 1;
    }
    while (!q.empty()) {
        int curr = q.front(); q.pop();
        int c = s[curr] % 2;
        for (auto &to: e[curr]) {
            if (dead[to]) continue;
            if (--cnt[to][c] == 0) {
                dead[to] = 1; q.emplace(to);
            }
        }
    }
    bool ok = 0;
    for (int i = 0; i < n; i++) ok |= !dead[i];
    if (ok) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

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


#define    boost        ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define    nl           "\n"
#define    ll           long long
#define    pb           push_back
#define    mpr          make_pair
#define    fr(i,a,n)   for(ll i=a;i<n;++i)
#define    fr0(i,n)     for(ll i=0;i<n;++i)
#define    pii          pair<ll, ll>
#define    mem(a)       memset(a,0,sizeof(a))
const ll mod = 1000000007;

void fio()
{
#ifndef ONLINE_JUDGE
    freopen("Input.txt", "r", stdin);
    freopen("o.txt", "w", stdout);
#endif
}

template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
    double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
    time_taken *= 1e-9;
    cout << "\nExecuted in: " << fixed
         << time_taken << setprecision(9);
    cout << " sec";
#endif
}


void solve(){
    string s;
    cin>>s;

    if(s[s.size()-1]=='s'){
        s=s+"es";
    }

    else s=s+"s";

    cout<<s;


}   


int main()
{
    //auto start = chrono::high_resolution_clock::now();
    boost;
    fio();
    ll t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    //auto end = chrono::high_resolution_clock::now();
    //TIME(start, end);
    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using D = double;
using uint = unsigned int;
template<typename T>
using pair2 = pair<T, T>;

#ifdef WIN32
    #define LLD "%I64d"
#else
    #define LLD "%lld"
#endif

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

const int maxn = 200005;

set<int> segs[maxn];
char s[maxn];
int need[maxn], deladd[maxn];
int n;


void merge(set<int> &a, set<int> &b)
{
    if (a.size() < b.size()) a.swap(b);
    for (auto t : b) a.insert(t);
    b.clear();
}

int main()
{
    scanf("%s", s);
    int len = strlen(s);
    scanf("%d", &n);
    int mid1 = len / 2 - 1;
    int mid2 = len / 2 + len % 2;
    for (int i = 0; i < n; i++)
    {
        int l, r;
        scanf("%d%d", &l, &r);
        l--, r--;
        while (l > mid1 && l < mid2) l++;
        while (r > mid1 && r < mid2) r--;
//         cout << mid1 << ' ' << mid2 << ' ' << l << ' ' << r << endl;
        if (l > r) continue;
        if (l <= mid1 && r >= mid2)
        {
            tie(l, r) = make_pair(min(max(-1, mid1 - l), max(-1, r - mid2)) + 1, max(max(-1, mid1 - l), max(-1, r - mid2)));
//             l = min(max(-1, mid1 - l), max(-1, r - mid2)) + 1;
//             r = max(max(-1, mid1 - l), max(-1, r - mid2));
//             cout << l << ' ' << r << endl;
        } else if (r <= mid1)
        {
            tie(l, r) = make_pair(mid1 - r, mid1 - l);
        } else
        {
            l = l - mid2;
            r = r - mid2;
        }
//         cout << "seg " << l << ' ' << r << endl;
        if (l <= r) segs[l].insert(r);
    }
    int m = len / 2;
    for (int i = 0; i < m; i++)
    {
        need[i] = (s[mid1 - i] - s[mid2 + i]) % 26;
//         cout << need[i] << ' ';
    }
//     cout << endl;
    int curadd = 0;
    for (int i = 0; i < m; i++)
    {
        curadd -= deladd[i];
        curadd %= 26;
        need[i] += curadd;
        need[i] %= 26;
        while (!segs[i].empty() && *segs[i].begin() < i) segs[i].erase(segs[i].begin());
        if (need[i] != 0)
        {
            if (segs[i].empty())
            {
                cout << "NO" << endl;
                return 0;
            }
        }
        if (!segs[i].empty())
        {
            int minr = *segs[i].begin();
            while (!segs[i].empty() && *segs[i].begin() <= minr) segs[i].erase(segs[i].begin());
            curadd += -need[i];
            deladd[minr + 1] += -need[i];
            deladd[minr + 1] %= 26;
            merge(segs[minr + 1], segs[i]);
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 14848
m[31][50];main(n,p,d,x){
  long long int a[50],b;
  for(;scanf("%d",&n),n;){
    memset(m,0,sizeof(m));
    for(p=0;p<n;a[p]=(long long int)1<<p,p++)
      for(scanf("%d",&x);x;x--)scanf("%d",&d),m[d][p]=1;
    for(d=1;d<31;d++){
      for(b=p=0;p<n;p++)if(m[d][p])b|=a[p];
      for(p=0;p<n;p++)
        if(m[d][p]){
          a[p]=b;
          if(a[p]==((long long int)1<<n)-1){printf("%d\n",d);goto s;}
        }
    }
    puts("-1");s:;
  }
  return 0;
}

Measured memory_bytes: 416
#include"bits/stdc++.h"

using namespace std;


typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
    ll K, ans = 0;
    cin >> K;
    for (ll i = 1; i <= K; i++){
        for (ll j = 1; j <= K; j++){
            for (ll k = 1; k <= K; k++){
            ans = ans + __gcd(i, __gcd(j, k));
            }
            
        }
        
    }
    
    cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <string>

int main(){
    std::string S;
    std::string T;
    std::cin >> S;
    std::cin >> T;

    uint8_t cnt = 0;
    for(uint8_t i = 0; i < 3; i++){
        if(S[i] == T[i]){
            cnt++;
        }
    }
    std::cout << int(cnt);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int H, W;
        public long MOD = 1000000007;
        public char[,] M;
        public long[,] DP;
        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                H = line[0];
                W = line[1];
            }

            M = new char[H, W];
            for (int y = 0; y < H; y++)
            {
                var line = Console.ReadLine();
                for (int x = 0; x < W; x++)
                {
                    M[y, x] = line[x];
                }
            }

            DP = new long[H, W];
            DP[0, 0] = 1;
            for (int y = 0; y < H; y++)
            {
                for (int x = 0; x < W; x++)
                {
                    if (M[y, x] == '#') continue;
                    if (y > 0)
                    {
                        DP[y, x] += DP[y - 1, x];
                        DP[y, x] %= MOD;
                    }

                    if (x > 0)
                    {
                        DP[y, x] += DP[y, x - 1];
                        DP[y, x] %= MOD;
                    }
                }
            }

            Console.WriteLine(DP[H - 1, W - 1]);
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 24924
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int main(){
  int h,w;
  cin >> h >> w;
  char arr[h][w];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> arr[i][j];
    }
  }
  unsigned long long dp[h][w];
  dp[0][0]=0;
  int x;
  bool flag=0;
  for(int i=1;i<w;i++){
    if(arr[0][i]=='#'){
      x = i;
      flag = 1;
      break;
    }
  }
  if(flag==0){
    x = w;
  }
  for(int i=1;i<w;i++){
    if(i<x){
      dp[0][i]=1;
    }
    else{
      dp[0][i]=0;
    }
  }
  /*for(int i=0;i<w;i++){
    cout << dp[0][i] << " ";
  }*/
  //cout << "\n";
  int y;
  bool flag1 = 0;
  for(int j=1;j<h;j++){
    if(arr[j][0]=='#'){
      y = j;
      flag1 = 1;
      break;
    }
  }
  if(flag1 == 0){
    y = h;
  }
  for(int j=1;j<h;j++){
    if(j<y){
      dp[j][0]=1;
    }
    else{
      dp[j][0]=0;
    }
  }
  /*for(int j=0;j<h;j++){
    cout << dp[j][0] << " ";
  }*/

  for(int i=1;i<h;i++){
    for(int j=1;j<w;j++){
      if(arr[i][j]=='.')
        dp[i][j]=(dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
      else{
        dp[i][j]=0;
      }
    }
  }
  /*for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cout << dp[i][j] << " ";
    }
    cout << "\n";
  }*/
  cout << dp[h-1][w-1];
  return 0;
}


Measured memory_bytes: 9088