akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define df(b, e) ((b) > (e))
#define fore(i, b, e) for(auto i = (b) - df(b, e); i != e - df(b, e); i += 1 - 2 * df(b, e))
#define sz(x) (int) x.size()
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define pb push_back
#define em emplace_back

typedef long long lli;
typedef long double ld;
typedef pair<int, int> ii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
struct rge { T b, e; };

template <class T>
rge<T> range(T i, T j) {
  return rge<T>{i, j};
}

template <class T> auto dud(T *x) -> decltype(cerr << *x, 0);
template <class T> char dud(...);

struct debug {
#ifdef LOCAL
  ~debug() { cerr << endl; }

  template <class T>
  typename enable_if<sizeof dud<T>(0) != 1, debug &>::type operator << (T i) {
    cerr << boolalpha << i;
    return *this;
  }

  template <class T>
  typename enable_if<sizeof dud<T>(0) == 1, debug &>::type operator << (T i) {
    return *this << range(begin(i), end(i));
  }

  template <class A, class B>
  debug & operator << (pair<A, B> d) {
    return *this << "(" << d.first << ", " << d.second << ")";
  }

  template <class T>
  debug & operator << (rge<T> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
      *this << ", " + 2 * (it == d.b) << *it;
    return *this << "]";
  }
#else
  template <class T> 
  debug & operator << (const T&) {
    return *this; 
  }
#endif
};

#define deb(...) " " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " "

string num;
int k;
lli mem[105][4][2];
int done[105][4][2], timer = 0;
#define state [i][k][small]
int dp(int i, int k, bool small) {
  if (i == sz(num))
    return k == ::k;
  lli &ans = mem state;
  if (done state != timer) {
    done state = timer;
    ans = 0LL;
    int hi = small ? 9 : num[i] - '0';
    fore (d, 0, hi + 1) {
      int nk = (k + (d != 0));
      if (nk > ::k) continue;
      ans += dp(i + 1, nk, small | (d < hi));
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  while (cin >> num >> k) {
    ++timer;
    cout << dp(0, 0, 0) << '\n';
  }
  return 0;
}


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

struct FFT {
  using CP = complex<double>;
  const double PI = acos(-1);
  int base = 1;
  vector<CP> roots{CP(0, 0), CP(1, 0)};
  vector<int> rv{0, 1};
  FFT() {}
  void ensure_base(int nb) {
    if (nb <= base) return;
    rv.resize(1 << nb);
    roots.resize(1 << nb);
    for (int i = 0; i < (1 << nb); ++i)
      rv[i] = (rv[i >> 1] >> 1) + ((i & 1) << (nb - 1));
    while (base < nb) {
      double arg = PI * 2.0 / (1 << (base + 1));
      for (int i = 1 << (base - 1); i < (1 << base); ++i) {
        roots[i << 1] = roots[i];
        double narg = arg * (2 * i + 1 - (1 << base));
        roots[(i << 1) + 1] = CP(cos(narg), sin(narg));
      }
      ++base;
    }
  }
  void fft(vector<CP> &a, int n, bool sg = 0) {
    assert((n & (n - 1)) == 0);
    for (int i = 0; i < n; ++i)
      if (i < rv[i]) swap(a[i], a[rv[i]]);
    for (int k = 1; k < n; k <<= 1)
      for (int i = 0; i < n; i += 2 * k)
        for (int j = 0; j < k; ++j) {
          CP z = a[i + j + k] * (sg ? roots[j + k] : conj(roots[j + k]));
          a[i + j + k] = a[i + j] - z;
          a[i + j] = a[i + j] + z;
        }
    if (sg)
      for (int i = 0; i < n; ++i) a[i] /= n;
  }
  vector<long long> mul(const vector<int> &a, const vector<int> &b) {
    int need = a.size() + b.size() - 1;
    int nb = 1;
    while ((1 << nb) < need) ++nb;
    ensure_base(nb);
    int sz = 1 << nb;
    vector<CP> fa(sz), fb(sz);
    for (int i = 0; i < sz; ++i) {
      if (i < a.size()) fa[i] = CP(a[i], 0);
      if (i < b.size()) fb[i] = CP(b[i], 0);
    }
    fft(fa, sz);
    fft(fb, sz);
    for (int i = 0; i < sz; ++i) fa[i] *= fb[i];
    fft(fa, sz, 1);
    vector<long long> res(need);
    for (int i = 0; i < need; ++i) res[i] = llround(fa[i].real());
    return res;
  }
};

const int p = 200003;
int n;
vector<long long> cnt;

long long solve();

int main() {
  cin >> n;
  cnt.resize(p);
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    ++cnt[a];
  }
  cout << solve() << endl;
  return 0;
}

long long solve() {
  vector<int> memo(1, 1), tmp(p);
  int now = 2;
  for (int i = 1; i < p; ++i) {
    tmp[i] = cnt[now];
    memo.push_back(now);
    (now <<= 1) %= p;
  }
  for (int i = 0; i < p; ++i) {
    memo.push_back(now);
    (now <<= 1) %= p;
  }
  FFT fft;
  auto v = fft.mul(tmp, tmp);
  long long res = 0;
  for (long long i = 0; i < 2 * p; ++i) {
    res += v[i] * memo[i];
    if (i < p) res -= cnt[i] * (i * i % p);
  }
  return res / 2;
}

Measured memory_bytes: 37448
#include<stdio.h>
#include<stdlib.h>

#define NUL NULL

int fibonacci(int);

int *F;

int main(){
  int n,re;

  scanf("%d",&n);

  F = malloc(sizeof(int)*n);

  re = fibonacci(n);

  printf("%d\n",re);

  return 0;
}

int fibonacci(int n){
  int i;

  /* if(n == 0 || n == 1){
    F[n] = 1;
    return F[n];
  }
  if(F[n] !=  NUL){
    return F[n];
  }

  F[n] = fibonacci(n - 2) + fibonacci(n - 1);

  return F[n];*/

  F[0] = 1;
  F[1] = 1;
  for(i = 2;i <= n;i++){
    F[i] = F[i - 2] + F[i - 1];
  }
  return F[n];
}

Measured memory_bytes: 596
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let s: Vec<char> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().chars().collect()
    };

    let m = s.len();
    let ans = if m % 2 == 0 && s[0] == s[m - 1] || m % 2 == 1 && s[0] != s[m - 1] { "First" } else { "Second" };

    println!("{}", ans);
}

Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int[][] next = new int[n+1][10];
		int count = 0;

		for(int i = 0; i < 10; i++) next[n][i] = n;

		for (int i = n-1; i >= 0; i--) {
			for (int j = 0; j < 10; j++) {
				next[i][j] = next[i+1][j];
			}
			next[i][s.charAt(i)-'0'] = i;
		}

		/*for (int i = 0; i <= n; i++) {
			System.out.println(Arrays.toString(next[i]));
		}*/

		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				for (int k = 0; k < 10; k++) {
					int first = next[0][i];
					if(first >= n) continue;
					else {
						int second = next[first+1][j];
						if(second >= n) continue;
						else {
							int third = next[second+1][k];
							if(third >= n) continue;
							else {
								count++;
							}

						}
					}
				}
			}
		}
		System.out.println(count);
		sc.close();
	}
}

Measured memory_bytes: 24148
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define fo(i,j,k) for(int i=j;i<=k;++i)
#define fd(i,j,k) for(int i=j;i>=k;--i)
#define ll long long
using namespace std;
const int N=16,M=300,mo=1e9+7;
ll f[1<<N];
int mp[N][1<<N];
int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	fo(i,1,m){
		int x,y;
		scanf("%d %d",&x,&y);
		mp[x][1<<y-1]=1;
	}
	fo(i,1,n)
	fo(j,1,(1<<n)-1) mp[i][j]=mp[i][j-(j&-j)]+mp[i][(j&-j)];
	f[0]=1;
	fo(S,1,(1<<n)-1) if((S&1)==((S&2)>>1)){
		f[S]=1;
		for(int T=(S-1)&S;T;T=(T-1)&S) if((T&1)==((T&2)>>1)){
			int x=S^T;
			ll t=f[x];
			if(!t) continue;
			fo(i,1,n) if(x&(1<<i-1)) t=t*((1<<mp[i][T])-1)%mo;
			else if(T&(1<<i-1)) t=t*(1<<mp[i][x])%mo;
			f[S]=(f[S]+t)%mo;
		}
	}
	ll ans=1;
	fo(i,1,m) ans=ans*2%mo;
	printf("%lld",(ans-f[(1<<n)-1]+mo)%mo);
}


Measured memory_bytes: 3456
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

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

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

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

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

VVI G(101);
int is[101][101];

int dfs(int i, int num, VI& xs){
  if(SZ(xs) == num){
	int res = 0;
	for(int j=0;j<num;++j){
	  int tmp = 1e9;
	  for(int k=0;k<num;++k){
		if(j == k) continue;
		if(!is[xs[j]][xs[k]]) return 0;
		tmp = min(is[xs[j]][xs[k]], tmp);
	  }
	  res += tmp;
	}
	return res;
  }

  int res = 0;
  for(int to: G[i]){
	if(find(ALL(xs), to) != xs.end() || to <= i) continue;
	xs.PB(to);
	res = max(res, dfs(to, num, xs));
	xs.pop_back();
  }

  return res;
}

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

  int N, M; cin >> N >> M;
  REP(i,M){
	int u, v, c; cin >> u >> v >> c;
	--u, --v;
	G[u].PB(v);
	G[v].PB(u);
	is[u][v] = is[v][u] = c;
  }

  int ans = 0;
  for(int i=2;i<=min(N,15);++i){
	VI xs;
	REP(u,N){
	  xs.PB(u);
	  ans = max(ans, dfs(u,i,xs));
	  xs.pop_back();
	}
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1260
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define mem0(s) memset(s,0,sizeof(s))
#define meminf(s) memset(s,0x3f,sizeof(s))
#define mp_insert(a,b,c) mp.insert(map<pair<int,int>,int>::value_type(make_pair(a,b),c))
double pi=acos(-1);
typedef long long ll;
typedef unsigned long long ull;
inline ll lowbit(ll x){return x&(-x);}
inline ll min(ll a,ll b){return a<b?a:b;}
inline ll max(ll a,ll b){return a>b?a:b;}
const ll INF=4223372036854775807,max_n=300005,mod=0x7f7f7f7f7f;
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
inline ll pow(ll a,ll b,ll mod){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
struct Node
{
	int a,b,c,d;
};
Node data1[105];
bool cmp(Node a,Node b)
{
	return a.d>b.d;
}
int n,m,q;
int a[15]={0,1,1,1,1,1,1,1,1,1,1};
ll max1;
ll sum1;
void check()
{
	for(int i=1;i<=q;i++)
	{
		if(a[data1[i].b]-a[data1[i].a]==data1[i].c)
		{
			sum1+=data1[i].d;
		}
	}
	max1=max(max1,sum1);
	sum1=0;
	return;
}
void dfs(int x)
{
	if(x==n+1)
	{
		check();
		return;
	}
	for(int i=a[x-1];i<=m;i++)
	{
		a[x]=i;dfs(x+1);
	}
	
}
int main()
{
	cin>>n>>m>>q;
	for(int i=1;i<=q;i++)
	{
		cin>>data1[i].a>>data1[i].b>>data1[i].c>>data1[i].d;
	}
	//sort(data1+1,data1+1+q,cmp);
	//(int i=1;i<=q;i++)
	//{
	//	cout<<data1[i].a<<' '<<data1[i].b<<' '<<data1[i].c<<' '<<data1[i].d<<endl;
	//}
	dfs(2);//È¥ËÑË÷µÚx¸öÊý×Ö
	cout<<max1;
	return 0;
}

Measured memory_bytes: 3592
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
	private static Scanner sc;
	static int getGCD(int a,int b){
		if(b>a){
			int tmp=a;
			a=b;
			b=tmp;
		}
		while(b!=0){
			int tmp=b;
			b=a%b;
			a=tmp;
		}
		return a;
	}
	static int getLCM(int a,int b){
		return a/getGCD(a,b)*b;
	}
	public static void main(String[] args){
		sc=new Scanner(System.in);
		while(true){
			try{
				int a=sc.nextInt();
				int b=sc.nextInt();
				System.out.print(getGCD(a,b)+" ");
				System.out.println(getLCM(a,b));
			}catch(NoSuchElementException e){
				break;
			}
		}
	}

}

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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

int n, m;

int main(){
	cin >> n;
  	if(n==1){
		cout << "Hello World" << endl;
    }else{
    	cin >> n >> m;
      cout << n+m << endl;
    }
      return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    string S;
    cin >> S;

    if (S[2] == S[3] && S[4] == S[5]) yes;
    else no;
    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc160/abc160_a && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc160/abc160_a && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc160/abc160_a && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 256
import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
#import math
#from itertools import groupby as gb
#from itertools import permutations as perm
#from itertools import combinations as comb
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
n,m = map(int, stdin.readline().rstrip().split())
#AB = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]

if n==m:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include <iostream>
#include <string.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

ll n,k,a[100010];

int main() {
    memset(a,0,sizeof(a));
    scanf("%lld%lld",&n,&k);
    ll left=0,right=0,ksum=0;
    for (int i=1;i<=n;i++) {
        scanf("%lld",a+i);
        if (i<=n-k) {if (a[i]>0) left+=a[i];}
        else ksum+=a[i];
    }
    ll mx=0;
    for (int i=n;i>=k;i--) {
        mx=max(mx,left+right+ksum);
        mx=max(mx,left+right);
        if (a[i]>0) right+=a[i];
        ksum-=a[i];
        ksum+=a[i-k];
        if (a[i-k]>0) left-=a[i-k];
    }
    printf("%lld\n",mx);
}

Measured memory_bytes: 1024
s=input()
n=len(s)
x=[0]
y=[0]
c=1
for i in range(1,n):
    if s[i-1]=="R" and s[i]=="L":
        x.append(i)
    if s[i-1]=="L" and s[i]=="R":
        y.append(i)
y.append(n)
z=[0]*n
for i in range(1,len(x)):
    z[x[i]-1]+=(x[i]-y[i-1]+1)//2+(y[i]-x[i])//2
    z[x[i]]+=(x[i]-y[i-1])//2+(y[i]-x[i]+1)//2
print(*z)

Measured memory_bytes: 14584
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,a=0,sum=0;
	char c1,c2;
	cin>>n>>m;
	cin>>c2;
	for(int i=0;i<n-1;i++){
		c1=c2;
		cin>>c2;
		if(c1==c2)
			sum++;
		else 
			a++;
	}
	if(a>2*m)
		cout<<sum+2*m<<endl;
	else
		cout<<sum+a<<endl;
	return 0;
}

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

using namespace std;

string s1, s2;

int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);

    cin >> s1 >> s2;

    for (int i = 0; i < s1.size(); i++)
    {
        if (s1[i] != s2[i])
        {
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 3644
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int l;

int main()
{
	scanf("%d", &l);
	
	double r = l / 3.0;
	double v = r * r * r;
	printf("%.12lf\n", v);
	
	return 0;
}

Measured memory_bytes: 128
x=eval(input())
num=sorted(list(map(int,input().split())))
res=0
for i in range(x):
    for j in range(i):
        for k in range(x-1,i,-1):
            if num[i]==num[j] or num[i]==num[k] or num[j]==num[k]:
                continue
            else:
                if num[j]-num[k]<num[i] and num[j]+num[i]>num[k]:
                    res+=1
print(res)

Measured memory_bytes: 9232
//abc159
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;

int main(){
    ll n,m;
    cin>>n>>m;
    ll ans=0;
    ans+=n*(n-1)/2;
    ans+=m*(m-1)/2;
    cout<<ans<<endl;
    
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
(全探索できるなら全探索しろ)
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'\n'
*/

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


using namespace std;



int main(){
	int t , temp;
	cin >> t;
	vector <int> a;
	for(int i=0;i<t;i++){
		cin >> temp;
		a.push_back(temp);	
}
sort(a.begin(),a.end());
int sum = INT_MAX;
	for(int i=a[0] ;i<=a[t-1];i++){
        int sum1 = 0;
		for(int j=0;j<t;j++){      
		  sum1 += pow(a[j] - i,2);
		}
        sum = min(sum,sum1);
		
}
cout << sum;

}



Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;


int main()
{
	int N, W;
	cin >> N >> W;
	

	vector<int> w(N), v(N);
	for (int i = 0; i < N; ++i) {
		cin >> w[i] >> v[i];
	}

	vector<long long> v2[4];
	for (int i = 0; i < N; ++i) {
		v2[w[i] - w[0]].push_back(v[i]);
	}
	for (auto &a : v2) {

		sort(a.rbegin(), a.rend());
	}

	long long ans = 0;
	for (int a = 0; a <= v2[0].size(); ++a) {
		for (int b = 0; b <= v2[1].size(); ++b) {
			for (int c = 0; c <= v2[2].size(); ++c) {
				for (int d = 0; d <= v2[3].size(); ++d) {
					long long tmp_v = 0;
					long long tmp_w = 0;
					for (int n = 0; n < a; ++n) {
						if (tmp_w + w[0] <= W) {
							tmp_w += w[0];
							tmp_v += v2[0][n];
						}
						else {
							break;
						}
					}
					for (int n = 0; n < b; ++n) {
						if (tmp_w + w[0] + 1 <= W) {
							tmp_w += w[0] + 1;
							tmp_v += v2[1][n];
						}
						else {
							break;
						}
					}
					for (int n = 0; n < c; ++n) {
						if (tmp_w + w[0] + 2 <= W) {
							tmp_w += w[0] + 2;
							tmp_v += v2[2][n];
						}
						else {
							break;
						}
					}
					for (int n = 0; n < d; ++n) {
						if (tmp_w + w[0] + 3 <= W) {
							tmp_w += w[0] + 3;
							tmp_v += v2[3][n];
						}
						else {
							break;
						}
					}
					ans = max(ans, tmp_v);
				}
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int main(){
	while(true){
		char s[201];
		scanf("%s", s);
		if(s[0] == '-') break;
		int n;
		scanf("%d", &n);
		int len = strlen(s);
		while(n-- > 0){
			int m;
			scanf("%d", &m);
			char t[m+1];
			for(int i = 0; i < m; i++){
				t[i] = s[i];
			}
			for(int i = 0; i < len-m; i++){
				s[i] = s[m+i];
			}
			for(int i = 0; i < m; i++){
				s[len-m+i] = t[i];
			}
		}
		printf("%s\n", s);
	}
	return 0;
}


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

//諸機能
#pragma region MACRO 
#define putans(x)  cerr << "answer: " ; cout << (x) << endl
#define dputans(x) cerr << "answer: "; cout << setprecision(10) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define substr(s,i,l) string((s), (i), (l))
#define tos(x) (to_string((x)))
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define input ifs >>
#else //いい感じにやる
#define input cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#ifndef _DEBUG
#define dbg1 {}
#define dbg2 {}
#define dbg3 {}
#define dbgArray {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(1e9)
#pragma endregion

int main() {
	int n, m; input n >> m;
	int num[100001];
	bool ext[100001];

	fill(num,num +100001,1);
	fill(ext, ext + 100001, false);
	ext[0] = true;
	rep(i, m) {
		int x, y; input x >> y; x--, y--;
		if (ext[x]) {
			ext[y] = true;
		}
		num[x]--; num[y]++;
		if (num[x] == 0) ext[x] = false;

	}
	int count = 0;
	rep(i, n) if (num[i] != 0 && ext[i]) count++;
	putans(count);
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int N; cin >> N;
	vvi ABC(3, vi(N + 1));
	FOR(i, 1, N + 1) cin >> ABC[0][i] >> ABC[1][i] >> ABC[2][i];
	vvi dp(N + 1, vi(3, 0));
	FOR(i,1,N + 1) {
		REP(j,3) {
			REP(k,3) {
				if (j == k) continue;
				dp[i][j] = max(dp[i - 1][k] + ABC[j][i], dp[i][j]);
			}
		}
	}
	cout << max(dp[N][0], max(dp[N][1], dp[N][2])) << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int n,m; cin >> n;
  map<int,int> mp;
  for(int i = 0; i < n; ++i){
    int x; cin >> x;
    mp[x]++;
  }
  cin >> m;
  bool f = true;
  for(int i = 0; i < m; ++i){
    int x; cin >> x;
    mp[x]--;
    f &= mp[x] >= 0;
  }
  cout << (f?"YES":"NO") << endl;
}


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

using namespace std;
 
const long long inf = 1e18;
#define ll long long
#define fr(i,a,n) for (int i=a;i<n;i++)
#define rfr(i,n,a) for (int i=n;i>=a;i--)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define endl "\n"
typedef vector<int> VI;
typedef vector<ll> VL;

ll n,m,k;
char arr[1001][1001];
ll dp[1001][1001];
ll mod = 1e9 + 7;
int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	fr(i,0,n) {
		fr(j,0,m) {
			cin >> arr[i][j];
		}
	}
	dp[1][1] = 1;
	fr(i,1,n+1) {
		fr(j,1,m+1) {
			if (arr[i-1][j-1] == '#')
				continue;
			dp[i][j] += dp[i-1][j] % mod;
			dp[i][j] += dp[i][j-1] % mod;
			dp[i][j] %= mod;
		}
	}
	cout << dp[n][m] << endl;
	return 0;
}

Measured memory_bytes: 9088
#include <iostream>
#include <cstdlib>

int main() {
    int32_t n;
    std::cin >> n;

    auto v = n;
    if (v >= 100) {
        v %= 100;
    }
    v %= 10;
    
    switch(v) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            std::cout << "hon" << std::endl;
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            std::cout << "pon" << std::endl;            
            break;
        case 3:
            std::cout << "bon" << std::endl;
            break;
        default:
            break;
    }
    
    return 0;
}

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N, K;
  IN(N,K);
  ll R, S, P;
  IN(R,S,P);
  string T;
  IN(T);

  vector<string> T_sub(K, "");
  REP(i,N){
    T_sub[i%K] += T[i];
  }

  ll ans = 0;
  REP(i,K){
    vll dp(3,0);
    vll dp_copy(3,0);
    if(T_sub[i][0]=='r') dp[2] += P;
    else if(T_sub[i][0]=='s') dp[0] += R;
    else if(T_sub[i][0]=='p') dp[1] += S;
    //debug_print(i);
    //vec_print(dp);
    REP(j,T_sub[i].size()-1){
      dp_copy[0] = max(dp[1], dp[2]);
      dp_copy[1] = max(dp[2], dp[0]);
      dp_copy[2] = max(dp[0], dp[1]);
      if(T_sub[i][j+1]=='r') dp_copy[2] += P;
      else if(T_sub[i][j+1]=='s') dp_copy[0] += R;
      else if(T_sub[i][j+1]=='p') dp_copy[1] += S;
      //vec_print(dp_copy);
      dp = dp_copy;
    }
    ans += max({dp[0], dp[1], dp[2]});
  }

  OUT(ans);

  return 0;
}


Measured memory_bytes: 5200
#include<algorithm>
#include<vector>
#include<cstring>
#include<iostream>
#include<cmath>

using namespace std;

const int  mod = 1e9+7;

void dfs(int in, vector<int> adj[], bool vis[], long long dp[][2]) {
	vis[in] = 1;
	dp[in][0] = dp[in][1] = 1;

	for(auto node: adj[in]) {
		if(vis[node])
			continue;
		dfs(node, adj, vis, dp);
		dp[in][0] = dp[in][0]*dp[node][1]%mod;
		dp[in][1] = dp[in][1]*(dp[node][0]+dp[node][1])%mod;
	}
}

int main() {
	int n;
	scanf("%d", &n);

	vector<int> adj[n];

	for(int i=0; i<n-1; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		x--; y--;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	bool vis[n];
	long long dp[n][2];
	memset(vis, 0, sizeof vis);
	dfs(0, adj, vis, dp);
	printf("%lld\n", (dp[0][0]+dp[0][1])%mod);
    return 0;
}

Measured memory_bytes: 14336
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using namespace std;
//LLONG_MAX = 90^18
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }
//max_element

int A[3][3];
bool B[3][3];
int N;

signed main()
{
	REP(y, 3)
	{
		REP(x, 3)
		{
			cin >> A[x][y];
		}
	}

	int N;
	cin >> N;
	
	REP(i, N)
	{
		int b;
		cin >> b;

		REP(y, 3)
		{
			REP(x, 3)
			{
				if (A[x][y] == b)
				{
					B[x][y] = true;
				}
			}
		}
	}

	if (B[0][0] && B[0][1] && B[0][2]) { Yes(); return 0; }
	if (B[1][0] && B[1][1] && B[1][2]) { Yes(); return 0; }
	if (B[2][0] && B[2][1] && B[2][2]) { Yes(); return 0; }
	if (B[0][0] && B[1][0] && B[2][0]) { Yes(); return 0; }
	if (B[0][1] && B[1][1] && B[2][1]) { Yes(); return 0; }
	if (B[0][2] && B[1][2] && B[2][2]) { Yes(); return 0; }
	if (B[0][0] && B[1][1] && B[2][2]) { Yes(); return 0; }
	if (B[0][2] && B[1][1] && B[2][0]) { Yes(); return 0; }

	No();
}




Measured memory_bytes: 256
function main()
  
  N = parse(Int, readline())
  A = map(x -> parse(Int,x), split(readline()))
  
  ans = zeros(Int,N)
  
  for i in 1:N
    
    ans[A[i]] = i
    
  end
  
  for i in 1:N
    
    print(string(ans[i])*" ")
    
  end
  
end

main()

Measured memory_bytes: 146544
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
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;}
constexpr int INF = 1e18;


signed main(){
	string s,t;
	cin >> s >> t;
	if(s == t.substr(0,s.size()))out("Yes");
	else out("No");
}

Measured memory_bytes: 3604
s = input()
ans =0
n = len(s)
for i in range(1 , n):
	f=0
	for j in range(0 , i-1):
		if j+i>=n or s[j]!=s[i+j]:
			f=1
	if f==0:
		if n-2*i!=0:
			ans = max(ans, 2*i)
print(ans)

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

using ll = long long;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,c;
    cin >> a >> b >> c;
    if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0){
        cout << 0 << endl;
    }else{
        vector<ll> nums = {a,b,c};
        sort(nums.begin(), nums.end());
        cout << nums[0] * nums[1] << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
void Unused(...) {}
#ifndef DEBUG
  #define echo(...) Unused(__VA_ARGS__)
#else
  #define echo(...) fprintf(stderr, __VA_ARGS__)
#endif

const int MaxN = int(1e5) + 7;

int n;

int main()
{
    scanf("%d", &n);
    int nowmax = 0;
    for (int i = 0; i < n; ++i)
    {
        int now;
        scanf("%d", &now);
        if (nowmax - now > 1)
        {
            printf("No\n");
            return 0;
        }
        nowmax = std::max(nowmax, now);
    }
    printf("Yes\n");
    return 0;
}



Measured memory_bytes: 128
#include<stdio.h>
int main(){
	int n,i;
	double h,m,ang_h,ang_m,ang_d;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lf:%lf",&h,&m);
		ang_m=(m/60)*360;
		ang_h=(h/12)*360+(m/60)*30;
		if(ang_m>ang_h)ang_d=ang_m-ang_h;
		else ang_d=ang_h-ang_m;
		if(ang_d>180)ang_d=360-ang_d;
		if(ang_d>=0.0&&ang_d<30.0)printf("alert\n");
		else if(ang_d>=90.0&&ang_d<=180.0)printf("safe\n");
		else printf("warning\n");
	}
	return 0;}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
	string S;
	cin >> S;
	char kami[6];
	char naka[8];
	char simo[6];
	for (int i = 0; i < 5; ++i)
	{
		kami[i] = S[i];
	}
	for (int i = 6; i < 7 + 6  ; ++i)
	{
		naka[i - 6] = S[i];
	}
	for (int i = 14; i < 5 + 14; ++i)
	{
		simo[i - 14] = S[i];
	}
	cout << kami << " " << naka << " " << simo << endl;
}

Measured memory_bytes: 256
import itertools
s=str(input())
n='keyence'
k=''
w=list(itertools.combinations(range(len(s)+1), 2))
for i,y in w:
    k=s[i:y]
    ss=s.replace(k,'',1)
    #print(ss)
    if ss==n or k==n:
        print('YES')
        exit()
print('NO')

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

struct s1 {
  static int64 op(int64 a, int64 b) { return max(a, b); }
  static int64 e() { return -INF_LL; }
  static int64 mapping(int64 l, int64 r) { return max(l, r); };
  static int64 composition(int64 l, int64 r) { return max(l, r); };
  static int64 id() { return -INF_LL; };
};

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

//  auto op1 = [](int64 a, int64 b) -> int64 {
//    return max(a, b);
//  };
//  auto e = []() { return -INF_LL; };
//  auto mapping = [](int64 l, int64 r) { return max(l, r); };
//  auto composition = [](int64 l, int64 r) { return max(l, r); };
//  auto id = []() { return -INF_LL; };

  string s;
  cin >> s;
  if (s.back() == 's') s += "es";
  else s += "s";
  cout << s << endl;


}



Measured memory_bytes: 3648
N, P = map(int, input().split())
A = list(map(int, input().split()))

flag = True
for a in A:
    if a % 2 != 0:
        flag = False

if flag:
    if P == 0:
        ans = 2 ** N
    else:
        ans = 0
else:
    ans = 2 ** (N-1)

print(ans)

Measured memory_bytes: 38512
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  N,K=LI()
  a=1/N

  ans=0
  for i in range(1,N+1):
    c=1
    x=i
    while True:
      if x>=K:
        break
      else:
        x*=2
        c*=2

    ans+=1/c

  return ans*a

print(main())


Measured memory_bytes: 5536
N = input()
S = input()
times = []
N = int(N)

wt = S.count("W")
et = S.count("E")
w = 0
e = 0
    
for i in S:
    if i == "W":
        w += 1
        times.append(w-1+et-e)
    else:
        e += 1
        times.append(w+et-e)
print(min(times))


Measured memory_bytes: 15520
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;


int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};


int main(){
  int H,W,h,w;
  cin >>H >> W >> h >> w;
  cout << (H -h)*(W - w) << endl;
}


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

#define mp make_pair
typedef long long ll;
typedef pair<int,int>pii;
typedef pair<ll,ll>pll;
const ll mod = 1e9+7;
const int N = 2e3;
ll ncr[N+100][N+100];

int main()
{
	for(int i=0;i<=N;i++){
		for(int j=0;j<=i;j++){
			if(j==0||j==i)ncr[i][j] = 1;
			else{
				ncr[i][j] = (ncr[i-1][j-1]+ncr[i-1][j])%mod;
			}
		}
	}
	ll n,k,m;
	cin >> n >> k;
	m = n-k;
	if(n==k){
		for(int i=1;i<=k;i++){
			if(i==1)printf("1\n");
			else printf("0\n");
		}
		return 0;
	}
	for(int i=1;i<=k;i++){
		ll t1 = ncr[k-1][i-1];
		ll t2 = 0;
		if(i>1){
			t2 = ncr[m-1][i-2];
		}
		ll t3 = ncr[m-1][i-1];
		ll t4 = ncr[m-1][i];
		ll ans = 0;
		ans = (ans+(t1*t2)%mod)%mod;
		ans = (ans+(2*t1*t3)%mod)%mod;
		ans = (ans+(t1*t4)%mod)%mod;
		printf("%lld\n",ans);
	}
}


Measured memory_bytes: 31616
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var nl = IO.ReadSplitInt;
            List<string> ss = new List<string>();
            for (int i = 0; i < nl[0]; i++)
            {
                ss.Add(ReadLine());
            }
            ss.Sort();
            WriteLine(string.Join("", ss));
        }

        public class IO
        {
            #region Input
            public static string ReadString => ReadLine();
            public static int ReadInt => int.Parse(ReadLine());
            public static long ReadLong => long.Parse(ReadLine());
            public static double ReadDouble => double.Parse(ReadLine());

            public static List<string> ReadSplitString => ReadLine().Split().ToList();
            public static List<int> ReadSplitInt => ReadLine().Split().Select(s => int.Parse(s)).ToList();
            public static List<long> ReadSplitLong => ReadLine().Split().Select(s => long.Parse(s)).ToList();
            public static List<double> ReadSplitdouble => ReadLine().Split().Select(s => double.Parse(s)).ToList();
            #endregion

            #region Output
            public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
            public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");

            #endregion
        }

        public class Mod
        {
            #region
            private readonly static long M = 1000000007;

            public static long Add(long a, long b) => (a * b) % M;
            public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
            public static long Multi(long a, long b) => (a * b) % M;
            #endregion
        }

        public static int GCD(int x, int y)
        {
            if (x < y) Swap(ref x, ref y);
            if (y == 0) return x;
            else return GCD(x % y, y);
        }

        public static void Swap(ref int x, ref int y)
        {
            int tmp = x;
            x = y;
            y = tmp;
        }

        public static long Choice2(long n)
        {
            #region
            if (n <= 1)
                return 0;
            if (n == 2)
                return 1;
            else
                return n * (n - 1) / 2;
            #endregion
        }
    }
}

Measured memory_bytes: 13536
def dot(a, b):
  return a.real * b.real + a.imag * b.imag

def projection(a, b):
  return a * dot(a, b) / (abs(a) ** 2)

#複素平面の座標はクラスだから直接加算できr
def solve(p0,p1,p2):
  a=p1-p0
  b=p2-p0
  pro=projection(a,b)
  t=p0+pro
  return t

def main():
  x0,y0,x1,y1=map(float,input().split())
  p0=complex(x0,y0)
  p1=complex(x1,y1)
  q=int(input())
  for i in range(q):
    p2=complex(*map(float,input().split()))
    t=solve(p0,p1,p2)
    print("{:.10f} {:.10f}".format(t.real,t.imag))

main()



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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = 0; i < (a); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int n = s.size();
  int c = 0;
  int ans = n;
  rep(i, n) {
    if(s[i] == 'S') c++;
    else {
      if(c == 0) continue;
      else {
        c--;
        ans -= 2;
      }
    }
  }
  out(ans);
  return 0;
}


Measured memory_bytes: 720
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include <assert.h>
using namespace std;
const long long INF = 1e18;
int n, a[400];
long long ps[400], dp[400][400];
long long get_sum(int l, int r) {
	return ps[r] - ((l > 0) ? ps[l - 1] : 0);
}
long long calc(int l, int r) {
	if (l == r) return 0;
	if (dp[l][r] != -1) return dp[l][r];
	long long res = INF;
	for (int m = l; m < r; m++) {
		res = min(res, calc(l, m) + calc(m + 1, r) + get_sum(l, r));
	}
	return dp[l][r] = res;
}
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	ps[0] = a[0];
	for (int i = 1; i < n; i++) ps[i] = ps[i - 1] + a[i];
	memset(dp, -1, sizeof(dp));
	long long ans = calc(0, n - 1);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<cmath>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cout << '!' << endl;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int alph[27];

int main()
{
	int h,w;
	cin >> h >> w;
	
	
	
	REP(i,h)REP(j,w)
	{
		char tmp;
		cin >> tmp;
		
		alph[tmp-'a']++;
	}
	
	if(h % 2 != 0 && w % 2 != 0)
	{
		int cou1 = 0,cou2 = 0,cou4 = 0;
		REP(i,26)
		{
			if(alph[i] % 4 == 0)
			{
				cou4++;
			}
			else if(alph[i] %2 == 0)
			{
				cou2++;
			}
			else
			{
				cou1++;
			}
			
		}
		
		if(cou1 > 1  || (cou2 > (w / 2)+(h / 2)))
		{
			cout << "No" << endl; 
		}
		else
		{
			cout << "Yes" << endl;
		}
		
	}
	else if(h % 2 == 0 && w % 2 == 0)
	{
		REP(i,26)
		{
			if(alph[i] % 4 != 0)
			{
				cout << "No" << endl;
				return 0;
			}
		}

		cout << "Yes" << endl;

	}
	else
	{
		int cou1 = 0,cou2 = 0,cou4 = 0;
		int guu;

		if(w % 2 == 0)
		{
			guu = w;
		}
		else
		{
			guu = h;
		}
			


		REP(i,26)
		{
			if(alph[i] % 4 == 0)
			{
				cou4++;
			}
			else if(alph[i] %2 == 0)
			{
				cou2++;
			}
			else
			{
				cou1++;
			}
			
		}
		
		if(cou1 > 0 || cou2 > (guu / 2))
		{
			cout << "No" << endl;
		}
		else
		{
			cout << "Yes" << endl;
		}
		
	}
	
	
	return 0;
}

Measured memory_bytes: 256