akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include <algorithm>

using namespace std;

int main(){
    int N,M;
    cin >> N >> M ;
    vector<long long > v1 = vector<long long >(N);
    vector<long long > v2 = vector<long long >(N);
    vector<long long > v3 = vector<long long >(N);
    vector<long long > v4 = vector<long long >(N);
    vector<long long > v5 = vector<long long >(N);
    vector<long long > v6 = vector<long long >(N);
    vector<long long > v7 = vector<long long >(N);
    vector<long long > v8 = vector<long long >(N);
    for(int i= 0;i<N;i++){
        long long x,y,z;
        cin >> x>>y>>z;
        v1[i] = x+y+z;
        v2[i] = -x+y+z;
        v3[i] = x-y+z;
        v4[i] = x+y-z;
        v5[i] = -x-y+z;
        v6[i] = -x+y-z;
        v7[i] = x-y-z;
        v8[i] = -x-y-z;
    }
    sort(v1.begin(),v1.end(), std::greater<long long>());
    sort(v2.begin(),v2.end(), std::greater<long long>());
    sort(v3.begin(),v3.end(), std::greater<long long>());
    sort(v4.begin(),v4.end(), std::greater<long long>());
    sort(v5.begin(),v5.end(), std::greater<long long>());
    sort(v6.begin(),v6.end(), std::greater<long long>());
    sort(v7.begin(),v7.end(), std::greater<long long>());
    sort(v8.begin(),v8.end(), std::greater<long long>());
    long long max = 0;
    long long sum = 0;
    for(int j=0;j<M;j++){
        sum += v1[j];
    }
    if(max < sum){
        max = sum;
    }    
    sum = 0;
    for(int j=0;j<M;j++){
        sum += v2[j];
    }
    if(max < sum){
        max = sum;
    }    
    sum = 0;
    for(int j=0;j<M;j++){
        sum += v3[j];
    }
    if(max < sum){
        max = sum;
    }
    sum = 0;    
    for(int j=0;j<M;j++){
        sum += v4[j];
    }
    if(max < sum){
        max = sum;
    }
    sum = 0;    
    for(int j=0;j<M;j++){
        sum += v5[j];
    }
    if(max < sum){
        max = sum;
    } 
    sum = 0;   
    for(int j=0;j<M;j++){
        sum += v6[j];
    }
    if(max < sum){
        max = sum;
    }    
    sum = 0;
    for(int j=0;j<M;j++){
        sum += v7[j];
    }
    if(max < sum){
        max = sum;
    }    
    sum = 0;
    for(int j=0;j<M;j++){
        sum += v8[j];
    }
    if(max < sum){
        max = sum;
    }
    cout << max <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n,k;
llong T[MAX];

//最大積載量Pのk台のトラックで何個の荷物を積めるか？
int check(llong P){
	int i=0;
	for (int j=0; j<k; j++){
		llong s=0;
		while(s+T[i] <= P){
			s += T[i];
			i++;
			if(i==n) return n;
		}
	}
	return i;
}

int solve(){
	llong left=0;
	llong right = 100000 * 10000; //荷物の個数×1個当たりの最大重量
	llong mid;
	while(right - left > 1){
		mid = (left + right)/2;
		int v = check(mid); //mid==P を決めて何個積めるかチェック
		if(v>=n)right = mid;
		else left = mid;
	}
	
	return right;
}

main(){
	cin >> n >> k;
	for(int i = 0; i<n; i++)cin >> T[i];
	llong ans = solve();
	cout << ans << endl;
}



Measured memory_bytes: 3880
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

vector<int> v[1001];
int main(){
    int n;
    cin>>n;
    int k=-1;
    FOR(i,1,1001){
        if(i*(i-1)/2==n){
            k=i;
            break;
        }
    }
    if(k==-1){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    cout<<k<<endl;
    int cur=0;
    FOR(i,1,k+1){
        FOR(j,i+1,k+1){
            v[i].pb(++cur);
            v[j].pb(cur);
        }
    }
    FOR(i,1,k+1){
        cout<<v[i].size()<<" ";
        rep(j,v[i].size()) cout<<v[i][j]<<" ";
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 2304
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())

d = [0] * N
s = [0] * N
    
for i in range(N):
  d[i] = x[i] - y[i]
  s[i] = x[i] + y[i]


print(max(max(s)-min(s), max(d)-min(d)))

Measured memory_bytes: 40500
#define M_PI 3.14159265358979323846

//#define _GLIBCXX_DEBUG
//#define all(x) (x).begin(),(x).end()

#include <bits/stdc++.h>

#define TASK ""
#define sqr(x) ((x)*(x))
typedef int ll;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
const ll INFLL = numeric_limits<int>::max();
const ll INFINT = numeric_limits<int>::max();
const ld EPS = 1e-7;
const ll MOD = 1000000000;
const ll MAXN = 223456;

bool used[MAXN];
ll cnt[MAXN];

void run()
{
    ll n, m;
    cin >> n >> m;
    ll ans = 0;
    used[0] = true;
    for (int i = 0; i < n; i++) cnt[i] = 1;
    for (int i = 0; i < m; i++)
    {
        ll x, y;
        cin >> x >> y;
        x--;
        y--;
        if (used[x])
        {
            if (cnt[x] == 1) used[x] = false;
            cnt[x]--;
            cnt[y]++;
            used[y] = true;
        }
        else
        {
            cnt[x]--;
            cnt[y]++;
        }
    }
    for (int i = 0; i < n; i++)
    {
        ans += used[i];
    }
    cout << ans;
}

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

#ifdef LOCAL
//#define STRESS
#ifdef STRESS
    freopen("input.txt", "w", stdout);
    ll N = 10;
    cout << N << endl;
    for (int i = 0; i < N; i++)
        cout << rand() % 30 << " " << rand() % 30 << endl;
    return 0;

#endif
    if (strcmp(TASK, "-") != 0)
    {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
#else
    if (strcmp(TASK, "")   != 0)
    {
        freopen(TASK".in", "r", stdin)  ;
        freopen(TASK".out", "w", stdout)  ;
    }
#endif
    run();

    return 0;
}

Measured memory_bytes: 768
#include<iostream>

using namespace std;

class card {
public:
    char suits;
    int value;
};

void Swap(card &a, card &b) {
    card temp = a;
    a = b;
    b = temp;
}
void BubbleSort(card cards[],int N) {
    for(int i=0; i<N; i++) {
        for(int j=N-1; j>i; j--) {
            if(cards[j].value<cards[j-1].value)Swap(cards[j],cards[j-1]);
        }
    }
}
void SelectionSort(card cards[], int N) {
    for(int i=0; i<N; i++) {
        int minj = i;
        for(int j=i+1; j<N; j++) {
            if(cards[j].value<cards[minj].value)minj = j;
        }
        Swap(cards[i],cards[minj]);
    }
}

void print(card cards[], int N) {
    for(int i=0; i<N-1; i++)cout<<cards[i].suits<<cards[i].value<<' ';
    cout<<cards[N-1].suits<<cards[N-1].value<<endl;
}

bool isStable(card c1[], card c2[],int N) {
    for(int i=0; i<N; i++) {
        if(c1[i].suits != c2[i].suits)return false;
    }
    return true;
}
int main() {
    int N;
    card c1[40],c2[40];

    cin>>N;
    for(int i=0; i<N; i++) {
        cin>>c1[i].suits>>c1[i].value;
        c2[i] = c1[i];
    }

    BubbleSort(c1,N);
    print(c1,N);
    cout<<"Stable"<<endl;

    SelectionSort(c2, N);
    print(c2,N);
    cout<<(isStable(c1,c2,N)?"Stable":"Not stable")<<endl;

    return 0;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
constexpr auto MOD = 1000000007;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VLL;

string s;
long long n, m;

int main()
{
  cin >> n >> s;
  bool flg = 0;
  if(!(n%2)){
    flg = 1;
    for (int i = 0; i < n / 2; i++)
    {
      if (s[i] == s[i + n / 2])
      {
        continue;
      }
      flg = 0;
      break;
    }
  }
  if(flg){
    cout << "Yes" << endl;}
    else{
    cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define sz(v) (ll((v).size()))
#define forn(i,n) for(ll i=0;i<(n);i++)
#define forr(i,n) for(ll i=(n)-1;i>=0;i--)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))


int main()
{
	ios_base::sync_with_stdio(false);

	ll a=1000,b;cin>>b;
	b%=a;a-=b;
	cout<<a%1000<<endl;
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int A[333][333];
int sum[100000];

int main() {
   int H, W, D;
   cin >> H >> W >> D;
   vec<pair<int, int>> p(H*W+10);
   rep (i, H) {
      rep (j, W) {
         cin >> A[i][j];
         p[A[i][j]] = {i, j};
      }
   }

   for (int i = D+1; i <= H*W; i++) {
      sum[i] += sum[i-D] + abs(p[i].first - p[i-D].first) + abs(p[i].second - p[i-D].second);
   }

   int Q;
   cin >> Q;
   while (Q--) {
      int l, r;
      cin >> l >> r;
      cout << sum[r] - sum[l] << endl;
   }

   return 0;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define MOD         (1000000007LL)
#define inc(i, l, r)   for(long long i=(l);i<(r);i++)
#define dec(i, l, r)   for(long long i=(r)-1;i>=(r);i--)
#define se          second
#define fi          first

using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int n;cin >> n;
    int a[300][300];
    int b[300][300];
    inc(i, 0, n){
        inc(j, 0, n){
            cin >> a[i][j];
            b[i][j] = a[i][j];
        }
    }
    inc(k, 0, n){
        inc(i, 0, n){
            inc(j, 0, n){
                b[i][j] = min(b[i][j], b[i][k]+b[k][j]);
            }
        }
    }
    inc(i, 0, n){
        inc(j, 0, n){
            if(b[i][j] < a[i][j]){
                cout << -1 << endl;
                return 0;
            }
        }
    }
    LL ans = 0;
    inc(i, 0, n){
        inc(j, i+1, n){
            bool f = false;
            inc(k, 0, n){
                if(k == i || k == j) continue;
                if(b[i][j] == b[i][k]+b[k][j]) f = true;
            }
            if(!f) ans += b[i][j];
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    if(abs(a - b) % 2){
        cout << "Borys" << endl;
    }else{
        cout << "Alice" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
using System;

	public class Class1
	{
		public static void Main()
		{   
		
			for(int j=0;j<3000;j++)
			{
				string dataSet=Console.ReadLine();
				string[] data=dataSet.Split();
				int x=int.Parse(data[0]);
				int y =int.Parse(data[1]);
				
				
				if(x==0&&y==0)
			{
				break;
			
			}
			else {
					if(x<=y)
				Console.WriteLine("{0} {1}",x,y);
				  else 
				  	Console.WriteLine("{0} {1}",y,x);
			      }
			}
			
		}
	}

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

sys.setrecursionlimit(10**7)
inf = 10**3
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []
    while True:
        n,m,p = LI()
        if n == 0:
            break
        a = [I() for _ in range(n)]
        s = sum(a) * 100 * (100-p) // 100
        if a[m-1] == 0:
            rr.append(0)
        else:
            rr.append(s // a[m-1])

    return '\n'.join(map(str, rr))


print(main())




Measured memory_bytes: 9056
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]

dp=[1]+['']*n

for i in a:
  dp[i]=0

if dp[1]=='':
  dp[1]=1
  

for i in range(2,n+1):
  if dp[i]=='':
    dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)

print(dp[-1])


Measured memory_bytes: 14448
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <iomanip>
#include <deque>
using namespace std;
typedef long long int lo;
#define pb push_back
#define pf push_front
#define ft front
#define mp make_pair
#define st first
#define nd second
#define inf (lo)1e9;
#define FOR for(lo i = 0 ; i < n ; i++)
#define FORV for(lo i = 0 ; i < (lo)v.size() ; i++)
#define ii pair<lo,lo>
#define iii pair<lo, pair<lo,lo> >
lo a,b,c,d,e,n,m,k,t,h,x,y,a1[500005],a2[500005];
char c1[505][505],c2,c3,c4;
string s1,s2,s3,s4;
double d1,d2,d3;
vector <lo> v;
map <lo,lo> mp1, mp2;
set <lo> seet;
queue <lo> q;
priority_queue <lo> pq;
lo vis [10000];
deque <lo> dq;
int main() {
    // freopen("gir.gir", "r", stdin);
    // freopen("cik.cik", "w", stdout);
    cin >> n;
    for(lo i = 0 ; i < n ; i++){
        cin >> a1[i];
        mp1[a1[i]]++;
        seet.insert(a1[i]);
    }
    for(set<lo>::iterator it = seet.begin() ; it != seet.end() ; it++){
        a = *it;
        // cout << a << endl;
        mp2[a] = (mp1[a] * (mp1[a] - 1)) / 2;
        // cout << mp2[a] << endl;
        x += mp2[a];
    }
    for(lo i = 0 ; i < n ; i++){
        k = x;
        k = k - mp2[a1[i]];
        a = mp1[a1[i]] - 1;
        k = k + (a * (a - 1)) / 2;
        cout << k << endl;
    }
    return 0;
}

Measured memory_bytes: 26368
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = 9223372036854775807;
#define Sort(a) sort(a.begin(), a.end())
#define Bsort(a) sort(a.begin(), a.end(), greater<ll>())
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  ll n;
  cin >> n;
  ll a = 0;
  for (ll i = 1; ; i++) {
    a += i;
    if (a >= n) {
      cout << i << '\n';
      n -= i;
      i = 0;
      a = 0;
      if (n == 0) {
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
n , x= map(int , input().split())
arr = list(map(int , input().split()))
ans = []
tot=0
if arr[0]>x:
	tot = tot+(arr[0]-x)
	arr[0]=x
for i in range(1,n):
	if arr[i]+arr[i-1]>x:
		dif = ((arr[i]+arr[i-1])-x)
		tot = tot+dif
		if arr[i]-dif>=0:
			arr[i]=arr[i]-dif
		else:
			arr[i-1]=arr[i-1]-dif
print(tot)

Measured memory_bytes: 85628
def main():
    n,k = map(int,input().split())
    h = []
    for i in range(n):
        hh = int(input())
        h.append(hh)

    h.sort()
    ans = []
    for i in range(k-1,n):
        ans.append(h[i] - h[i-k+1])

    ans.sort()

    print(ans[0])


if __name__ == '__main__':
    main()


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

#define MAXN 100*1000 + 5

vector<int> g[MAXN];

int dist[2][MAXN];

void dfs(int u, int* d) {
	for(int v : g[u]) {
		if(d[v] == -1) {
			d[v] = d[u] + 1;
			dfs(v, d);
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, mouse, cat;
	cin >> n >> mouse >> cat;
	mouse--, cat--;
	for(int i = 0; i < n-1; i++) {
		int u, v;
		cin >> u >> v;
		u--, v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}

	bool ok = false;

	for(int v : g[mouse]) {
		if(v != cat) {
			ok = true;
		}
	}

	if(!ok) {
		cout << 0 << endl;
		return 0;
	}

	// root tree at cat, the furthest node from cat that 
	// the mouse can reach before cat 
	memset(dist, -1, sizeof dist);
	dist[0][cat] = 0;
	dist[1][mouse] = 0;
	dfs(cat, dist[0]);
	dfs(mouse, dist[1]);

	int ans = 0;
	for(int e = 0; e < n; e++) {
		if(dist[1][e] <= dist[0][e]) {
			ans = max(ans, dist[0][e]-1);	
		}
	}

	cout << ans << endl;

}

Measured memory_bytes: 10368
//#include "pch.h"
//#include "stdafx.h"
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define INF				2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define MIN(a, b)		((a) < (b) ? a : b)
#define MAX(a, b)		((a) > (b) ? a : b)
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)		/* 奇数 */
#define IsEven(x)		(!IsOdd((x)))					/* 偶数 */
#define ArrayLength(x)	(sizeof(x) / sizeof(x[0]))
#define DWORD_MAX		(0xFFFFFFFF)
#define BitTstV(a, b)	(a & b)

typedef short SWORD;
typedef unsigned short WORD;
typedef long SDWORD;
typedef unsigned long DWORD;
typedef long long int QWORD;
typedef pair<int, int> P;

#define N_MAX	(100000)
#define M_MAX	(1000)
#define H_MAX	(1000)
#define W_MAX	(1000)

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
typedef struct {
	string name;
	int point;
	int number;
} REST_INFO;

bool cmp(REST_INFO &a, REST_INFO &b)
{
	if (a.name == b.name) {
		return (a.point > b.point);
	} else {
		int result = a.name.compare(b.name);
		return (0 < result) ? false : true;
	}
}

int main()
{
	int swNum, lgtNum;
	cin >> swNum >> lgtNum;

	vector<vector<bool>> connectList(swNum, vector<bool>(lgtNum, false));
	REP(i, lgtNum) {
		int connectNum;
		cin >> connectNum;
		REP(j, connectNum) {
			int swNo;
			cin >> swNo;
			swNo--;
			connectList[swNo][i] = true;
		}
	}

	vector<int> lgtCntCndition(lgtNum, 0);
	REP(i, lgtNum) {
		cin >> lgtCntCndition[i];
	}

	int ret = 0;
	int swPtn = 1 << swNum;
	REP(i, swPtn) {
		vector<int> lgtCntList(lgtNum, 0);
		REP(j, swNum) {
			if (BitTstV(i, 0x1 << j)) {
				REP(k, lgtNum) {
					if (connectList[j][k]) {
						lgtCntList[k]++;
					}
				}
			}
		}

		bool isOn = true;
		REP(k, lgtNum) {
			if (lgtCntCndition[k] != lgtCntList[k] % 2) {
				isOn = false;
				break;
			}
		}
		if (isOn)	ret++;
	}

	cout << ret;
	cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}
 
const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 200010;
const int MAXK = 110;
const int MAXQ = 200010;
 
int n, pointer;
ll con, h[MAXN];
ll a[MAXN], b[MAXN], dp[MAXN];
vector<ll> M, C;
 
ld getIntersection(int l1, int l2) {
    if (l2 == SZ(M)) return 1e20;
    return (ld) (C[l1] - C[l2]) / (M[l2] - M[l1]); 
}
 
ll query(ll k) {
    ll res = 0;
    int dau = 0, cuoi = SZ(M)-1;
    while (dau <= cuoi) {
        int mid = (dau + cuoi) >> 1;
        if (k <= getIntersection(mid, mid+1)) cuoi = mid-1; else dau = mid+1;
    }
    res = M[dau] * k + C[dau];
    return res;
}
 
bool isBad(int l1, int l2, int l3) {
    // bad khi giao cua l1 va l3 nam ben trai giao cua l1 va l2 // intersection(l1,l2) has x-coordinate (c1-c2)/(m2-m1)
    // intersection(l1,l3) has x-coordinate (c1-c3)/(m3-m1)
    return (ld) (C[l3] - C[l1]) / (M[l1] - M[l3]) < (ld) (C[l2] - C[l1]) / (M[l1] - M[l2]);
}
 
void add(ll m, ll c) {
    M.emplace_back(m);
    C.emplace_back(c);
    while (SZ(M) >= 3 && isBad(SZ(M)-3, SZ(M)-2, SZ(M)-1)) {
        M.erase(M.end()-2);
        C.erase(C.end()-2);
    }
}
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> con;
    FOR(i,1,n) cin >> h[i];
    dp[1] = 0;
    add(-h[1], dp[1] + h[1] * h[1]);
    pointer = 0;
    FOR(i,2,n) {
        dp[i] = query(2*h[i]) + con + h[i] * h[i];
        if (i != n) add(-h[i], dp[i] + h[i] * h[i]);
    }
    cout << dp[n];
    return 0;
}

Measured memory_bytes: 7276
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
	ll A,B,K;
	cin >> A >> B >> K;
	cout << max(A-K,(long long) 0) << " " << max(min(B-K+A,B),(long long)0) <<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
const int mod=100000;
int dp[2][2001][3001];
int main(){
    int n,m,s;
    while(cin>>n>>m>>s,n){
        fill(dp[0][0],dp[0][0]+2*2001*3001,0);
        n*=n;

        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                for(int k=1;k<=s;k++){
                    if(i==1){
                        if(k<=j)dp[i&1][j][k]=1;
                    }
                    else{
                        dp[i&1][j][k]=dp[i&1][j-1][k];
                        if(k-j>=0)dp[i&1][j][k]+=dp[(i-1)&1][j-1][k-j];
                    }
                    dp[i&1][j][k]%=mod;
                }
            }
        }

        cout<<dp[n&1][m][s]<<endl;
    }
    return 0;
}

Measured memory_bytes: 48072
#include<bits/stdc++.h>
using ll = long long;
const int INF_INT = 100000000;
const ll INF_LL = 1000000000000;
#define fir first
#define sec second


int main()
{
    int a,b,c;
    std::cin >> a >> b >> c;
    std::cout << std::max({a,b,c}) - std::min({a,b,c}) << std::endl;
}


Measured memory_bytes: 256
def m():
    K, A, B = map(int, input().split())
    ans = 0
    if B - A <= 2:
        return K+1
    if K <= A:
        return K+1
    cnt = K-A+1

    amari = 0
    if cnt % 2 == 1:
        amari = 1
    ans += (cnt//2) * B - ((cnt//2)-1)*A
    ans += amari
    return ans

print(m())

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if((a+b+c)%2==1){
    cout << 0 << endl;
  }
  else if(a==b&&b==c){
    cout << -1 << endl;
  }
  else{
    int x=0,y=0;
    int s=b-a;
    int t=c-b;
    if(s==0){
      x=100;
    }
    else{
      while(s%2==0){
      x++;
      s/=2;
      }
    }
    if(t==0){
      y=100;
    }
    else{
      while(t%2==0){
      y++;
      t/=2;
      }
    }
   cout << min(x,y) << endl;
  }
}


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

using namespace std;

int main(){
    
    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    long long max = a*c;
    if(a*d > max) max = a*d;
    if(b*c > max) max = b*c;
    if(b*d > max) max = b*d;
  
    

    cout << max;

     return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
//const int MAX=2e5+10;
const ll MOD=1e9+7;

typedef long long int number;
typedef vector<number> ary;
typedef vector<ary> mat;

// O( n )
mat identity(int n) {
  mat A(n, ary(n));
  for (int i = 0; i < n; ++i) A[i][i] = 1;
  return A;
}

// O( n^3 )
mat mul(const mat &A, const mat &B, number m) {
  mat C(A.size(), ary(B[0].size()));
  for (int i = 0; i < C.size(); ++i)
    for (int j = 0; j < C[i].size(); ++j)
      for (int k = 0; k < A[i].size(); ++k)
        C[i][j] = (C[i][j] + A[i][k] * B[k][j] ) % m;
  return C;
}
// O( n^3 log e )
mat pow(const mat &A, number e, number m) {
  return e == 0 ? identity(A.size())  :
     e % 2 == 0 ? pow(mul(A, A, m), e/2, m) : mul(A, pow(A, e-1, m), m);
}

int N;
ll K;
void solve(){
    cin>>N>>K;
    mat A(N,ary(N));
    rep(i,N)rep(j,N)cin>>A[i][j];

    mat B= pow(A,K,MOD);
    ll ans=0;
    rep(i,N)rep(j,N)ans=(ans+B[i][j])%MOD;
    cout<<ans<<endl;
}

int main(){
    solve();
}

Measured memory_bytes: 1536
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include<iostream>
using namespace std;

#define int long long int
#define all(x) (x).begin(), (x).end()
#define removeDuplicates(a) a.resize(unique(all(a))-a.begin())
#define endl '\n'

void solve(){
	int n,m;
	cin>>n>>m;
	vector<int>adj[n+1];
	vector<int>indeg(n+1);
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		adj[u].push_back(v);
		indeg[v]++;
	}
	vector<int>dis(n+1);
	function<void(int)>dfs=[&](int u){
		for(int v:adj[u]){
			dis[v]=max(dis[v],dis[u]+1);
			indeg[v]--;
			if(indeg[v]==0){
				dfs(v);
			}
		}
	};
	vector<int>start;
	for(int i=1;i<=n;i++){
		if(indeg[i]==0){
			start.push_back(i);
		}
	}
	for(int i:start){
		dfs(i);
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		ans=max(ans,dis[i]);
	}
	cout<<ans<<endl;
}

int32_t main(){

	//remove for interactive problems
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	solve();
	cerr<<"Time : "<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";

	return 0;
}

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

int k;

int main(){
	cin>>k;
	if(k % 2 == 1){
		cout<<k / 2 * (k / 2 + 1)<<endl;
	}
	else{
		cout<<k / 2 * k / 2<<endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define int long long
using namespace std;
const int maxN = (1 << 15) + 13, N = 15 + 3;
int n, par[N], x[N], y[N], a[N];
long double dp[maxN], dis[N][N];
int get_par(int x) {
    if (x == par[x])
	return x;
    return par[x] = get_par(par[x]);
}

long double mst (int x) {
    long double ret = 0;
    vector<pair<long double, pair<int, int>>> d;
    vector<int> vec;
    vec.clear();
    d.clear();
    for (int i = 0; i < n; i++) {
	if ((1 << i) & x) {
	    vec.push_back(i);
	    par[i] = i;
	}
    }
    for (auto a : vec)
	for (auto b : vec) {
	    if (a != b) 
		d.push_back({dis[a][b], {a, b}});
	    
	}
    sort(d.begin(), d.end());
    for (auto a : d) {
	int u = a.S.F, v = a.S.S;
	long double w = a.F;
	int p1 = get_par(v), p2 = get_par(u);
	if (p1 != p2) {
	    par[p1] = p2;
	    ret += w;
	}
    }
    return ret;
}

int32_t main () {
    cin >> n;
    for (int i = 0; i < n; i++)
	cin >> x[i] >> y[i] >> a[i];
    for (int i = 0; i < n; i++)
	for (int j = 0; j < n; j++) {
	    dis[i][j] = sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
	}

    for (int i = 1; i < (1 << n); i++) {
	int cnt = __builtin_popcount(i), sum = 0;
	long double val = mst(i);
	for (int j = 0; j < n; j++)
	    if ((1 << j) & i) {
		sum += a[j];
	    }
	//cout << fixed << setprecision(10) << sum << " " << val << " " << cnt << endl;
	dp[i] = ((double)sum - val) / cnt;
	//cout << i << " " <<  dp[i] << endl;
    }

    for (int i = 1; i < (1 << n); i++) {
	for (int j = (i - 1) & i; j; j = (j - 1) & i)
	    dp[i] = max(dp[i], min(dp[j], dp[i ^ j]));
	//cout << i << " " << dp[i] << endl;
    }

    cout << fixed << setprecision(10) << dp[(1 << n) - 1] << endl;
}


Measured memory_bytes: 768
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int A = sc.nextInt();

        for (int i = 0; i < 100000; i++) {
            if (i * A >= H) {
                System.out.println(i);
                return;
            }
        }
    }
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define db(x) cout<<#x<<"="<<x<<endl;
using namespace std;
int l,r,mark[2019];
int main() {
	scanf("%d%d",&l,&r);
	for(int i=l; i<=r; i++) {
		if(mark[i%2019])break;
		mark[i%2019]++;
	}
	int Min=2019;
	for(int i=0; i<2019; i++)if(mark[i])
			for(int j=0; j<2019; j++)if(mark[j]) {
					if((i!=j)||(i==j&&mark[i]>1))Min=min(Min,(i*j)%2019);
				}
	printf("%d\n",Min);
	return 0;
}


Measured memory_bytes: 256
N = int(input())
XL = []
for _ in range(N):
    XL.append(tuple(map(int, input().split())))

for i in range(N):
    X, L = XL[i]
    XL[i] = (X-L, X+L)
#print(XL)

XL.sort(key = lambda x:x[1])
#print(XL)

right = XL[0][1]
cnt = 1
for i in range(1, N):
    if right <= XL[i][0]:
        right = XL[i][1]
        cnt += 1
print(cnt)

Measured memory_bytes: 66136
#include <algorithm>
#include <cstdio>
#include <utility>
#include <vector>

std::vector<std::pair<int, int>> v;

int main()
{
    int N;
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        std::pair<int, int> hoge;
        scanf("%d %d", &hoge.second, &hoge.first);
        v.push_back(hoge);
    }
    std::sort(v.begin(), v.end());

    long long time = 0;
    for (int i = 0; i < N; i++) {
        time += v.at(i).second;

        if (false)
            printf("i:%d first:%d second:%d\n", i, v.at(i).first, v.at(i).second);
        if (false)
            printf("i:%d time:%lld\n", i, time);
        if (v.at(i).first < time) {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");

    return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

string replaceOtherStr(std::string &replacedStr, std::string from, std::string to) {
    const ll pos = replacedStr.find(from);
    const ll len = from.length();
 
    if (pos == (ll)std::string::npos || from.empty()) {
        return replacedStr;
    }
 
    return replacedStr.replace(pos, len, to);
}


signed main() {
    ll a, b;
    cin >> a >> b;
    
    if (a >= 13) {
        mes(b);
        re0;
    }
    if (a >= 6) {
        mes(b/2);
        re0;
    }
    
    
    
    mes(0);
   
    
    
}


Measured memory_bytes: 3600
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	int p[200005];
	for (i = 0; i < n; i++)
		scanf("%d", &p[i]);
	int ans = 1, min = p[0];
	for (i = 1; i < n; i++)
	{
		if (p[i] < min)
		{
			ans++;
			min = p[i];
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1024
#include<algorithm>
#include<cmath>
#include<climits>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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

int main()
{
	string S, T;
	cin >> S >> T;

	map<char, char> sTot, tTos;
	
	bool ok = true;

	rep(i, S.size())
	{
		char s = S[i];
		char t = T[i];

		if (sTot.count(s) && sTot[s] != t) ok = false;
		if (tTos.count(t) && tTos[t] != s) ok = false;

		sTot[s] = t;
		tTos[t] = s;
	}

	if(ok)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Aug  2 21:38:01 JST 2020
 **/

struct Mo {
    int width;
    std::vector<int> left, right;
    std::vector<bool> v;

    Mo(int n) : width((int)sqrt(n)), v(n) {}
    void add(int l, int r) {
        left.push_back(l);
        right.push_back(r);
    }
    template <class F, class G, class H> void run(const F &add, const G &del, const H &rem) {
        std::vector<int> order(left.size());
        std::iota(order.begin(), order.end(), 0);
        assert(left.size() == order.size());
        std::sort(begin(order), end(order), [&](int a, int b) {
            int ablock = left[a] / width, bblock = left[b] / width;
            if (ablock != bblock) return ablock < bblock;
            if (ablock & 1) return right[a] < right[b];
            return right[a] > right[b];
        });
        int nl = 0, nr = 0;
        auto push = [&](int idx) {
            v[idx].flip();
            if (v[idx])
                add(idx);
            else
                del(idx);
        };
        for (auto idx : order) {
            while (nl > left[idx]) push(--nl);
            while (nr < right[idx]) push(nr++);
            while (nl < left[idx]) push(nl++);
            while (nr > right[idx]) push(--nr);
            rem(idx);
        }
    }
};

signed main() {
    Int n, Q;
    std::cin >> n >> Q;
    std::vector<Int> a(n);
    REP(i, n) std::cin >> a[i];
    Mo mo(n);
    REP(q, Q) {
        Int l, r;
        std::cin >> l >> r, l--;
        mo.add(l, r);
    }
    Int cur = 0;
    std::vector<Int> cnt(n), ans(Q);
    mo.run(
        [&](Int i) {
            if (cnt[a[i]]++ == 0) cur++;
        },
        [&](Int i) {
            if (--cnt[a[i]] == 0) cur--;
        },
        [&](Int i) { ans[i] = cur; });
    REP(q, Q) std::cout << ans[q] << "\n";
}


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

int main(){

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

    int count = 0;
    bool flag = true;
    while(flag){
        for(int i = 0; i < N; i++){
            if(A[i] % 2 == 1) flag = false;
            A[i] /= 2;
        }
        if(flag) count++;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  int N,A,B;
  cin>>N>>A>>B;
  if(A>B)puts("0");
  else if(N==1){
    if(A==B)puts("1");
    else puts("0");
  }else cout<<B*(N-1)+A-(B+A*(N-1))+1<<endl;
}

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

#define vt          vector
#define sz(x)       int((x).size())
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

using ll = long long;
using pii = pair<int, int>;

void solve() {
    int n;
    cin >> n;
    vt<pii> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].fi;
        a[i].se = i;
    }
    sort(rall(a));

    vt<vt<ll>> dp(n + 1, vt<ll>(n + 1));
    for (int i = 0; i < n; i++) {
        for (int l = 0; l <= i + 1; l++) {
            int r = n - i + l - 1;
            if (r != n)
                dp[i + 1][l] = dp[i][l] + (ll)a[i].fi * abs(a[i].se - r);
            if (l) {
                dp[i + 1][l] = max(
                    dp[i + 1][l],
                    dp[i][l - 1] + (ll)a[i].fi * abs(a[i].se - (l - 1))
                );
            }
        }
    }

    ll ans = 0;
    for (int i = 0; i <= n; i++) {
        ans = max(ans, dp.back()[i]);
    }
    cout << ans;
}

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

    int tcs = 1;
    for (int tc = 1; tc <= tcs; tc++) {
        // cout << "Case " << tc << ": ";
        solve();
    }
}


Measured memory_bytes: 34504
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long

int main() 
{ 
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    int n;
    cin >> n;
    
    for(int i = 0; i < n; i++)
		cout << "ACL";
} 


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


int main() {
    int n,k;
    cin >> n>>k;
    vector<int> lst(n);
    rep(i,k){
        int d;
        cin >> d;
        rep(j,d){
            int a=0;
            cin >> a;
            a--;
            lst.at(a) += 1;
        }
    }
    int cnt=0;
    rep(i,n){
        if(lst.at(i)==0){
            cnt++;
        }
    }
    cout << cnt << endl;


    return 0;
}


Measured memory_bytes: 3644
cards = {
        'S': [0 for _ in range(13)],
        'H': [0 for _ in range(13)],
        'C': [0 for _ in range(13)],
        'D': [0 for _ in range(13)],
        }
   
n = int(input())
for _ in range(n):
    (s, r) = input().split()
    r = int(r)
    cards[s][r - 1] = r
   
for s in ('S', 'H', 'C', 'D'):
    for r in range(13):
        if cards[s][r] == 0:
            print( '{0:s} {1:d}'.format(s, r+1))

Measured memory_bytes: 7708
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define con continue
#define ub upper_bound
#define lb lower_bound
#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

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

const int dx8[] = {-1, 0, 1, 0,1,1,-1,-1};
const int dy8[] = {0, -1, 0, 1,1,-1,1,-1};



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

if(x.back()!='s') x+="s";
else x+="es";
cout << x<< endl;
}



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



}


Measured memory_bytes: 3664
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
    int N,L;
    cin>>N>>L;
    int B=L+N-1;
    int A;
    if((L+N-1)<=0){
        A=B;
    }
    else if(L>=0){
        A=L;
    }
    else{
        A=0;
    }

    int ans=(B+L)*(B-L+1)/2-A;

    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define PI 3.141592653589
#define N_MAX 100

int main()
{
  int a[N_MAX];
  int n,i,j;
  scanf("%d",&n);
  for(i = 0; i < n; i++)
    {
      scanf("%d",&a[i]);
    }
  for(j = n-1; j >= 0; j--)
    {
      printf("%d",a[j]);
      if(j != 0) printf(" ");
    }
  printf("\n");
  return 0;
}

Measured memory_bytes: 600
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())

if a>b:
    r=a-t*v
    s=b-t*w
    if s<r:
        print('NO')
    else:
        print('YES')
else:
    r=a+t*v
    s=b+t*w
    if s>r:
        print('NO')
    else:
        print('YES')


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

int main() {
	int N;
	int K;
	
	scanf("%d %d", &N, &K);
	char S[100];
	scanf("%s", S);
	S[K-1]+= 32;
	printf("%s", S);
	
	return 0;
}

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

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

    int result = 0;
    int quotient = -1;

    while(true) {
        quotient = n / k;
        result++;
        if (quotient != 0) {
            n = quotient;
        } else {
            break;
        }
    }

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;

int main()
{
    while (true) {
        int h, w;
        cin >> h >> w;

        if (!h && !w) {
            break;
        }
        h--;
        w--;
        for (int i = 0; i <= h; i++) {
            for (int j = 0; j <= w; j++) {
                if (!i || !j || i == h || j == w) {
                    putchar('#');
                } else {
                    putchar('.');
                }
            }
            putchar('\n');
        }
        putchar('\n');
    }
}



Measured memory_bytes: 3060
#include<stdio.h>

#define MAX_LENGTH 32
#define SORT_LENGTH (3 - 1)

int main(void)
{
        char line[MAX_LENGTH];
        int i,j;
        int sort[3];
        int tmp;

        fgets(line, sizeof(line), stdin);
        sscanf(line, "%d %d %d", &sort[0], &sort[1], &sort[2]);

        for (j = 0; j < SORT_LENGTH ; j ++) {
                for (i = SORT_LENGTH; i -1 >= j; i--) {
                        if( sort[i - 1] > sort[i] ) {
                                tmp = sort[i];
                                sort[i] = sort[i -1];
                                sort[i -1] = tmp;
                        } else {
                                // do nothing.
                        }
                }
        }

        for (i = 0; i <= SORT_LENGTH; i++) {
                if (i == SORT_LENGTH)
                        printf("%d\n", sort[i]);
                else
                        printf("%d ", sort[i]);
        }

        return 0;
}

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

using namespace std;


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

template <typename T>
void print(T x)
{
	std::cout << x <<" " ;
}


template <typename T>
void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int A;
	cin >> A;
	print(A*A);
}

Measured memory_bytes: 256
S = input()

n = len(S)
ans = 0
for i in range(n):
    cnt = 0
    for j in range(i,n):
        if (S[j] == "A")or(S[j] == "C")or(S[j] == "G")or(S[j] == "T"):
            cnt += 1
        else:
            break

    if (ans < cnt): ans = cnt

print(ans)

Measured memory_bytes: 3064
a, b, c, d = [int(i) for i in input().split()]

if a <= c <= b <= d:
    print(b-c)
elif c <= a <= d <= b:
    print(d-a)
elif a <= c and d <= b:
    print(d-c)
elif c <= a and b <= d:
    print(b-a)
else:
    print(0)

Measured memory_bytes: 3060
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_map>
# include <unordered_set>
# include <thread>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using ui32 = unsigned int;
constexpr ll INFLL = 1e18;

#define CHECK_IMPL1(cond)              \
if (!(cond)) {                         \
    DEBUG("expected cond: " << #cond); \
    assert(cond);                      \
}

#define CHECK_IMPL2(cond, message)                                            \
if (!(cond)) {                                                                \
    DEBUG("expected cond: " << #cond << " failed with message: " << message); \
    assert(cond);                                                             \
}
#define CHECK_IMPL(_1, _2, NAME, ...) NAME
#define CHECK(...) CHECK_IMPL(__VA_ARGS__, CHECK_IMPL2, CHECK_IMPL1, CHECK_IMPL0)(__VA_ARGS__)

#ifdef __APPLE__
#define DEBUG(message) std::cerr << message << "\n";
#else
#define DEBUG(message)
#endif

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> cnt(2, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cnt[a[i] % 2] += 1;
  }
  if (n == 1 || cnt[1] % 2 == 0) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
#ifdef __APPLE__
  freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
#endif
  int t = 1;
//  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 640
import java.io.*;
import java.util.*;

public class Main
{
	public static void main(String[] args) throws Exception
	{
		Scanner scan = new Scanner(System.in);
		int[] arr = new int[10];
		for (int i = 0; i < 10; ++i){
			arr[i] = scan.nextInt();
			//System.out.println();
		}
		Arrays.sort(arr);
		System.out.println(arr[9]);
		System.out.println(arr[8]);
		System.out.println(arr[7]);
	}
}

Measured memory_bytes: 17344