akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    ll T1, T2, A1, A2, B1, B2;
    cin >> T1 >> T2;
    cin >> A1 >> A2;
    cin >> B1 >> B2;

    ll tmp1 = (B1 - A1) * T1;
    ll tmp2 = (B2 - A2) * T2 + tmp1;

    if (tmp2 == 0) {
        cout << "infinity" << endl;
        return 0;
    }
    if ((tmp2 < 0 && tmp1 < 0) || (tmp2 > 0 && tmp1 > 0)) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = (-(tmp1 / tmp2) + 1) * 2 - 1;
    if (tmp1 % tmp2 == 0)
        ans--;
    cout << max(ans, 0LL) << endl;

    return 0;
}


Measured memory_bytes: 3624
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE Strict #-}

module Main where

import Control.Lens
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import qualified Data.Char as Char
import qualified Data.List as List
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

type Point = (Int, Int)

type Strawberry = Point

type LeftTop = Point

type RightBottom = Point

type Area = (LeftTop, RightBottom)

main :: IO ()
main = do
  h : w : _ <- BS.getLine <&> toListOf (unfolded (BS.readInt . BS.dropWhile Char.isSpace))
  ipts <- replicateM h BS.getLine
  let strawberries :: [Strawberry]
      strawberries = ipts ^.. (indexing each <.> indexing each) . filtered (== fromIntegral (Char.ord '#')) . asIndex
  let answer = solve ((0, 0), (h - 1, w - 1)) strawberries
  prettyPrint h w answer

solve :: Area -> [Strawberry] -> [Area]
solve _ [] = error "program error"
solve cake [_] = [cake]
solve cake strawberries@(a : b : _) =
  if a ^. _1 == b ^. _1
    then verticalSplit (a ^. _2) strawberries
    else horizontalSplit (a ^. _1) strawberries
  where
    horizontalSplit p ss =
      let (top, bottom) = List.partition (\s -> s ^. _1 <= p) ss
       in solve (cake & _2 . _1 .~ p) top <> solve (cake & _1 . _1 .~ p + 1) bottom
    verticalSplit p ss =
      let (left, right) = List.partition (\s -> s ^. _2 <= p) ss
       in solve (cake & _2 . _2 .~ p) left <> solve (cake & _1 . _2 .~ p + 1) right

prettyPrint :: Int -> Int -> [Area] -> IO ()
prettyPrint h w cakes =
  let nums :: [Int]
      nums = VU.toList $ VU.create $ do
        vec <- VUM.new (h * w)
        ifor_ cakes $ \i cake ->
          sequence
            [ VUM.write vec (w * h' + w') (i + 1)
              | h' <- [cake ^. _1 . _1 .. cake ^. _2 . _1],
                w' <- [cake ^. _1 . _2 .. cake ^. _2 . _2]
            ]
        pure vec
   in putStrLn $
        nums ^.. unfolded (\case [] -> Nothing; xs -> Just $ List.splitAt w xs)
          & each . each %~ show
          & each %~ unwords
          & unlines


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

int main(){
	string S;
	cin >> S;
	if(S=="Sunny")cout << "Cloudy" << endl;
	if(S=="Cloudy")cout << "Rainy" << endl;
	if(S=="Rainy")cout << "Sunny" << endl;
	return 0;
}

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

ll n,k,vis[5005];
ll p[5005],c[5005],sum[5005],ans=-1e18;
int main(){
    cin >> n >> k;
    for(int i=1; i<=n; i++) cin >> p[i];
    for(int i=1; i<=n; i++) cin >> c[i];
    for(int i=1; i<=n; i++){
        ll s=c[i];
        vector<ll> t; t.push_back(s);
        for(int j=p[i]; j!=i; j=p[j]) s+=c[j],t.push_back(s);
        int len=t.size();
        for(int j=0; j<len; j++){
            ll rest=k-j-1;
            if(rest<0) break;
            ans=max(ans,t[j]+(rest/len)*max(s,0LL));
        }
    }
    cout << ans;
}


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

int main()
{
	int n = 0, a = 0, b = 0;

	cin >> n >> a >> b;

	if((b - a) % 2 == 0)
		cout << "Alice" << endl;
	else 
		cout << "Borys" << endl;

	return 0;
}

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

int main() {
 int a,b,c,d;
 cin>>a>>b>>c>>d;
 int x=0;
 if (abs(a-b)<=d){x++;}
 if (abs(b-c)<=d){x++;}
 if (x==2||abs(a-c)<=d){cout<<"Yes"<<endl;}
 else{cout<<"No"<<endl;}
 return 0;
}

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

int main()
{
	int n, m; cin >> n >> m;
	long long x[n], y[m];

	for(int i = 0; i < n; i++){
		long long tmp; cin >> tmp;
		x[i] = tmp;
	}
	for(int i = 0; i < m; i++){
		long long tmp; cin >> tmp;
		y[i] = tmp;
	}

	const long long mod = 1000000007;


	/* compute sigma_{1<=i<j<=n}(x_j - x_i) */
	long long sum_x = 0;
	for(int k = 0; k < n; k++){
		sum_x += (k * x[k] - (n - k - 1) * x[k]) % mod;
	}
	long long sum_y = 0;
	for(int k = 0; k < m; k++){
		sum_y += (k * y[k] - (m - k - 1) * y[k]) % mod;
	}

	cout << ((sum_x % mod) * (sum_y % mod)) % mod << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

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

int main(void){
    long long int A,B;
    cin >> A >> B;
    cout << lcm(A,B);
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

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

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int w[n];
    int e[n];

    int ans;
    int w_count=0;
    int e_count=0;

    for(int i=0;i<n;i++){
        if(s[i]=='W'){
            w[i]=1;
            e[i]=0;
            w_count++;
        }else{
            w[i]=0;
            e[i]=1;
            e_count++;
        }
    }

    for(int i=1;i<n;i++){
        w[i]+=w[i-1];
        e[i]+=e[i-1];
    }

    ans = e[n-1];

    for(int i=1;i<n-1;i++){
        ans = min(ans,w[i-1]+e_count-e[i]);
    }

    ans = min(ans,w[n-2]);

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

Measured memory_bytes: 3076
using System;
using System.Collections.Generic;

public class CSharp
{
    public static void Main()
    {
        Kyopuro chokudai = new Kyopuro();
        chokudai.AtCoder();
    }
}

public class Kyopuro
{
    public void AtCoder()
    {
        string[] input;
        input = Console.ReadLine().Split(' ');

        int a, b, c, n;
        a = int.Parse(input[0]);
        b = int.Parse(input[1]);
        c = int.Parse(input[2]);
        n = int.Parse(input[3]);

        int ans = 0;
        int x = 0;

        for(int i=0; i<=n; i++)
        {
            for(int j=0; j<=n; j++)
            {
                x = n - a * i - b * j;
                if (x >= 0 && x % c == 0) ans++;
            }
        }

        Console.WriteLine(ans);
    }
    public static void DebugWL(object x) { System.Diagnostics.Debug.WriteLine(x); }
}


Measured memory_bytes: 11092
#include <cstdio>
#include <cstdlib>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<long int, int> P;

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

    vector<P> pairs(N);
    for (int i = 0; i < N; i++) {
        scanf("%ld %d", &pairs[i].first, &pairs[i].second);
    }
    sort(pairs.begin(), pairs.end());    

    long int money = 0;
    int count = 0;

    for (int i = 0; i < N; i++) {
        if (count + pairs[i].second >= M) {
            money += (M - count) * pairs[i].first;
            printf("%ld\n", money);
            break;
        } else {
            money += pairs[i].second * pairs[i].first;
            count += pairs[i].second;
        }
    }

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n;
	
	cin>>n;
  	
	int arr1[n],arr2[n],arr3[n],dp[n+1][3];
	for(int i=0;i<n;i++){
	  cin>>arr1[i];
      cin>>arr2[i];
      cin>>arr3[i];
		
	}
  dp[0][0]=arr1[0];
  dp[0][1]=arr2[0];
  dp[0][2]=arr3[0];
	for(int  i=1;i<n;i++){
    	dp[i][0]=max(dp[i-1][1],dp[i-1][2])+arr1[i];
      dp[i][1]=max(dp[i-1][0],dp[i-1][2])+arr2[i];
      dp[i][2]=max(dp[i-1][1],dp[i-1][0])+arr3[i];
      
    }
  cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
int main(void){
    int i,j,k,l,n,count=0;

    while(scanf("%d",&n)!=EOF){
    count=0;
    for(i=0;i<10;i++){
        for(j=0;j<10;j++){
            for(k=0;k<10;k++){
                for(l=0;l<10;l++){
                if(i+j+k+l==n)count++;
                }

            }

        }

    }
printf("%d\n",count);
}
return 0;
}

Measured memory_bytes: 0
import java.io.PrintWriter

fun main() {
    val pw = PrintWriter(System.out)

    val n = readInputLine().toLong()

    var ans = 0L

    for (i in LongRange(1L, n)) {
        if (i % 3L != 0L && i % 5L != 0L) {
            ans += i
        }
    }

    pw.println(ans)

    pw.flush()
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 34676
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int larger(int x, int y){
	if(x > y){
		return x;
	}
	else{
		return y;
	}
}

int main(){
	int N;
	string S;
	cin >> N >> S;
	int memo[N+1];
	for(int i = 0; i < N + 1; i++){
		memo[i] = 0;
	}
	for(int i = 1; i < N; i++){
		if(S[i] != S[i-1]){
			memo[i+1] = larger(memo[i-1]+1, memo[i]);
		}
		else{
			memo[i+1] = memo[i];
		}
	}
	cout << memo[N] << "\n";
}


Measured memory_bytes: 3724
#include<iostream>
using namespace std;
long long int ryuka[87];
void num(int a) {
	ryuka[a] = ryuka[a - 2] + ryuka[a - 1];
	if(a!=86)
	num(a + 1);
}
int main() {
	int n;
	cin >> n;
	ryuka[0] = 2;
	ryuka[1] = 1;
	num(2);
	cout << ryuka[n]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int n;
struct Node
{
	int bh;//
	char a[15];
}a[100005];
bool cmp(const Node& t1,const Node& t2)
{
	for (int i=1;i<=10;i++)
	{
		if (t1.a[i]<t2.a[i]) return true;
		else if (t1.a[i]>t2.a[i]) return false;
	}
	//printf("%d %d\n",t1.bh,t2.bh);
	return false;
}
bool cmp2(int t1,int t2)
{
	for (int i=1;i<=10;i++)
	{
		if (a[t1].a[i]!=a[t2].a[i]) return false;
	}
	return true;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		for (int k=1;k<=10;k++) scanf(" %c",&a[i].a[k]);
		sort(a[i].a+1,a[i].a+11);
		a[i].bh=i;
	}
	sort(a+1,a+n+1,cmp);
	long long ans=0ll;
	long long sum=1;
	for (int i=2;i<=n;i++)
	{
		if (cmp2(i-1,i))
		{
			sum++;
		}
		else
		{
			ans+=sum*(sum-1ll)/2;
			sum=1;
		}
	}
	ans+=sum*(sum-1ll)/2;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 2176
cnt = 0
n = int(input())
S = list(map(int, input().split()))

def mergeSort(S, left, right):
  if left+1 < right:
    mid = (left + right) // 2
    mergeSort(S, left, mid)
    mergeSort(S, mid, right)
    merge(S, left, mid, right)

def merge(S, left, mid, right):

  L = S[left:mid] + [10**10]
  R = S[mid:right] + [10**10]

  i,j = 0,0

  global cnt
  for k in range(left, right):
    cnt += 1
    if L[i] <= R[j]:
      S[k] = L[i]
      i += 1
    else:
      S[k] = R[j]
      j += 1

mergeSort(S, 0, len(S))
print (' '.join(map(str,S)))
print (cnt)


Measured memory_bytes: 66576
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int hat[100010] = { 0 }, co[100010] = { 0 };
long long ans = 1;
int main(){
	int n;
	int a[100010];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	hat[0] = 3;
	for (int j = 0; j < n; j++) {
		ans = ans * (hat[a[j]] - co[a[j]]) % 1000000007;
		hat[a[j] + 1]++;
		co[a[j]]++;
	}
	cout << ans << endl;
}

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

int main()
{
    int n;
    cin>>n;
    int mx=0,cur=0;
    while(n--) {
        int l,r;
        cin>>l>>r;
        if(l==r)cur++;
        else {
            mx=max(mx,cur);
            cur=0;
        }
    }
    mx=max(mx,cur);
    if(mx>=3)cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

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

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

    int N;
    string S;
    cin >> N >> S;

    vector<int> res;
    int count = 0;

    for (int i = 1; i < N; ++i)
        if (S[i] == 'E')
            ++count;
    res.push_back(count);

    for (int i = 1; i < N; ++i) {
        if (S[i-1] == 'W')
            ++count;
        if (S[i] == 'E')
            --count;
        res.push_back(count);
    }

    cout << *min_element(res.begin(), res.end()) << "\n";
}

Measured memory_bytes: 2700
#include <bits/stdc++.h>
	using namespace std;
	#define mod 1000000007
	#define fi first
	#define se second
	#define mp make_pair
	#define pb push_back
	#define ps push
	#define pll pair<long,long>
	typedef long long ll;
	#define PI 3.14159265
	
	
	const ll INF=(ll)1e16;
	
	
	int main()
	{
		ios::sync_with_stdio(0); 
		cin.tie(0); 
		cout.tie(0);
		
		ll n,x,y;
		cin>>n>>x>>y;
		ll dist[2005][2005];
		for(ll i=1;i<=n;i++)
		{
			for(ll j=1;j<=n;j++)
				dist[i][j]=dist[j][i]=INF;
		}
		for(ll i=2;i<=n;i++)
		{
			dist[i][i-1]=dist[i-1][i]=1;
		}
		dist[x][y]=dist[y][x]=1;
		map<ll,ll> cnt;
		for(ll i=1;i<=n;i++)
		{
			for(ll j=i+1;j<=n;j++)
			{
				dist[i][j]=min(dist[i][j],min(abs(x-i)+1+abs(y-j),abs(j-i)));
				cnt[dist[i][j]]++;
			}
		}
		for(ll i=1;i<n;i++)
		{
			cout<<cnt[i]<<endl;
		}
	}		


Measured memory_bytes: 31744
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

void solve() {
    int n, k;
    cin >> n >> k;
 
    if(k == 1) cout << 0 << endl;
    else cout << n - k << endl;
}

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

    solve();
    return 0;
}
 


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=acos(-1);
const ll INF = 1LL<<62;
const ll MINF = -(1LL<<62);

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)


const ll mod=998244353;
ll dp[3001][3001];

int main() {
	IO;
	int n,s;
	cin>>n>>s;
	dp[0][0]=1;
	for(int i=1;i<=n;++i) {
		ll x;
		cin>>x;
		for(int j=0;j<=s;++j) {
			dp[i][j]=2*dp[i-1][j]+(j-x>=0?dp[i-1][j-x]:0);
			dp[i][j]%=mod;
		}
	}
	
	cout<<dp[n][s]<<"\n";
	return 0;
}


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

signed main() {
  cin.tie(0); ios::sync_with_stdio(false);
  string s; cin >> s;
  int k; cin >> k;
  int n = s.size();
  vector<string> c;
  for (int i = 1; i <= min(k, n); i++) {
    for (int j = 0; j <= n - i; j++) {
      c.push_back(s.substr(j, i));
    }
  }
  sort(c.begin(), c.end());
  auto itr = unique(c.begin(), c.end());
  c.erase(itr, c.end());
  cout << c[k - 1] << '\n';
  return 0;
}

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

typedef long long ll;
using namespace std;
const int maxn = 1e6+5;

int main()
{
    int n, w, h;
    cin >> h >> w >> n;
    int a = max(w, h);
    int b  = n%a;
    if(b == 0) cout << n/a << endl;
    else cout << n/a+1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
int main() {
    
    //ifstream cin("input.txt");
    //ofstream cout("output.txt");
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    /*-----------------Code Begins Here------------------*/
    
    ll n; cin>>n;
    ll a[n],b[n];
    fill(b,b+n,0);
    for(ll i=0;i<n;i++) cin>>a[i];
    ll total=a[0];
    for(ll i=1;i<n;i++){
        total=a[i]^total;
    }
    for(ll i=0;i<n;i++){
        for(ll j=0;j<30;j++){
            if(((1ll<<j)&(total))^((1ll<<j)&(a[i])))
                b[i]+=(1ll<<j);
        }
        cout<<b[i]<<" ";
    }
    
    /*------------------Code Ends Here-------------------*/
    
    return 0;
}

Measured memory_bytes: 6672
tri_nums = [i * (i + 1) // 2 for i in range(1500)]
while True:
  n = int(input())
  if n == 0:
    break
  blst = list(map(int, input().split()))
  if sum(blst) not in tri_nums:
    print(-1)
    continue
  end = [i + 1 for i in range(tri_nums.index(sum(blst)))]
  lenb = n
  cnt = 0
  while blst != end:
    if cnt > 10000:
      print(-1)
      break
    blst = [i - 1 for i in blst if i > 1]
    blst.append(lenb)
    lenb = len(blst)
    cnt += 1
  else:
    print(cnt)


Measured memory_bytes: 5768
#include <bits/stdc++.h>
#define newl "\n"
using namespace std;
using lli = long long int;
using vvint = vector <vector <int>>;
const int mod = 1e9 + 7;

const int N = 2e5 + 1;

void solve(){
	string s;
	cin >> s;
	if(s.back() == 's') s = s + "es";
	else s = s + "s";
	cout << s << newl;

	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(10);
	#ifdef EXECUTE_LOCALLY
		   freopen("in.txt","r",stdin);
	#endif
	int t = 1;
	//cin >> t;
	while(t--) solve();
	#ifdef EXECUTE_LOCALLY
    	cout << setprecision(3) << "program time: " << (double)clock() / CLOCKS_PER_SEC << newl;
	#endif
	return 0;
}


Measured memory_bytes: 3648
let [| n; m; |] = stdin.ReadLine().Split() |> Array.map int
let abs = seq{for _ in 1..n -> stdin.ReadLine().Split() |> Array.map int64 }

abs |> Seq.sort 
|> Seq.fold (fun (totalN,totalPrice) [|a;b|] ->
    match totalN with
    | x when x = int64 m -> (x, totalPrice)
    | x when int64 m - b < x  -> (int64 m, totalPrice + a * (int64 m - x)) 
    | x ->(x + b, totalPrice + a * b)) (0L, 0L)
|> fun (_, totalPrice) -> totalPrice
|> stdout.WriteLine

Measured memory_bytes: 28760
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

type bufReader struct {
	r   *bufio.Reader
	buf []byte
	i   int
}

var reader = &bufReader{
	bufio.NewReader(os.Stdin),
	make([]byte, 0),
	0,
}

func (r *bufReader) readLine() {
	if r.i < len(r.buf) {
		return
	}
	r.buf = make([]byte, 0)
	r.i = 0
	for {
		line, isPrefix, err := r.r.ReadLine()
		if err != nil {
			panic(err)
		}
		r.buf = append(r.buf, line...)
		if !isPrefix {
			break
		}
	}
}

func (r *bufReader) next() string {
	r.readLine()
	from := r.i
	for ; r.i < len(r.buf); r.i++ {
		if r.buf[r.i] == ' ' {
			break
		}
	}
	s := string(r.buf[from:r.i])
	r.i++
	return s
}

func (r *bufReader) nextLine() string {
	r.readLine()
	s := string(r.buf[r.i:])
	r.i = len(r.buf)
	return s
}

var writer = bufio.NewWriter(os.Stdout)

func next() string {
	return reader.next()
}

func nextInt64() int64 {
	i, err := strconv.ParseInt(reader.next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func nextInt() int {
	return int(nextInt64())
}

func nextLine() string {
	return reader.nextLine()
}

func out(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func max64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func max(x, y int) int {
	return int(max64(int64(x), int64(y)))
}

func min64(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func min(x, y int) int {
	return int(min64(int64(x), int64(y)))
}

func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func abs(x int) int {
	return int(abs64(int64(x)))
}

func joinInt64s(a []int64, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.FormatInt(v, 10)
	}
	return strings.Join(b, sep)
}

func joinInts(a []int, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.Itoa(v)
	}
	return strings.Join(b, sep)
}

func divUp64(x, y int64) int64 {
	return (x + y - 1) / y
}

func divUp(x, y int) int {
	return int(divUp64(int64(x), int64(y)))
}

func gcd64(x, y int64) int64 {
	if x < y {
		x, y = y, x
	}
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func gcd(x, y int) int {
	return int(gcd64(int64(x), int64(y)))
}

func lcm64(x, y int64) int64 {
	return x * y / gcd64(x, y)
}

func lcm(x, y int) int {
	return int(lcm64(int64(x), int64(y)))
}

func pow64(x, y int64) int64 {
	return int64(math.Pow(float64(x), float64(y)))
}

func pow(x, y int) int {
	return int(pow64(int64(x), int64(y)))
}

func main() {
	solve()
	writer.Flush()
}

func solve() {
	a, b := nextInt(), nextInt()
	switch {
	case a == 0 || b == 0:
		out("Zero")
	case b < 0:
		if (b-a)&1 == 0 {
			out("Negative")
		} else {
			out("Positive")
		}
	case a > 0:
		out("Positive")
	default:
		out("Zero")
	}
}


Measured memory_bytes: 640
{-# LANGUAGE BangPatterns, OverloadedStrings #-}

import Control.Monad
import Data.Array.Unboxed
import Data.Bits
import Data.Char
import Data.Coerce
import Data.Function
import Data.Int 
import Data.IORef
import Data.List
import Data.Maybe
import qualified Data.Map.Strict as M
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as MV
import qualified Data.ByteString.Char8 as BS

main :: IO ()
main = do
  [a, b, c] <- getIntList
  k <- getInt
  if solve k a b c
    then putStrLn "Yes"
    else putStrLn "No"

solve k a b c
  | k == 0 = a < b && b < c
  | a >= b = solve (k-1) a (2*b) c
  | b >= c = solve (k-1) a b (2*c)
  | otherwise = True

-- Input

getInt :: IO Int
getInt = readLn
second :: (b -> c) -> (a, b) -> (a, c)
second f (a, b) = (a, f b)

readInt :: BS.ByteString -> Maybe (Int, BS.ByteString)
readInt = fmap (second BS.tail) . BS.readInt

getIntVec :: Int -> IO (V.Vector Int)
getIntVec n = V.unfoldrN n readInt <$> BS.getLine
 
getIntList :: IO [Int]
getIntList = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

getIntegerList :: IO [Integer]
getIntegerList = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

getIntPair :: IO (Int, Int)
getIntPair = do
  v <- getIntVec 2
  return (v V.! 0, v V.! 1)

-- Search

bisearch :: (Int -> Bool) -> (Int, Int) -> (Int, Int)
bisearch check = bis
  where
    bis (l, r)
      | l + 1 == r = (l, r)
      | check mid  = bis (mid, r)
      | otherwise  = bis (l, mid)
      where
        mid = l + (r - l) `div` 2

-- Modular Arithmetic
--
 
modulo :: Int64
modulo = 10^9+7
addMod, subMod, mulMod :: Int64 -> Int64 -> Int64
addMod !x !y | x + y >= modulo = x + y - modulo
             | otherwise = x + y
subMod !x !y | x >= y = x - y
             | otherwise = x - y + modulo
mulMod !x !y = (x * y) `rem` modulo

newtype N = N { unwrapN :: Int64 } deriving (Eq)
instance Show N where
  show (N x) = show x
instance Num N where
  (+) = coerce addMod
  (-) = coerce subMod
  (*) = coerce mulMod
  fromInteger n = N (fromInteger (n `mod` fromIntegral modulo))
  abs = undefined; signum = undefined
---
 
exEuclid :: (Eq a, Integral a) => a -> a -> (a, a, a)
exEuclid !f !g = loop 1 0 0 1 f g
  where loop !u0 !u1 !v0 !v1 !f 0 = (f, u0, v0)
        loop !u0 !u1 !v0 !v1 !f g =
          case divMod f g of
            (q,r) -> loop u1 (u0 - q * u1) v1 (v0 - q * v1) g r
 
recipM :: Int64 -> Int64
recipM !x = case exEuclid x modulo of
             (1,a,_) -> a `mod` modulo
             (-1,a,_) -> (-a) `mod` modulo
divM :: Int64 -> Int64 -> Int64
divM !x !y = x `mulMod` recipM y
 
instance Fractional N where
  (/) = coerce divM
  recip = coerce recipM
  fromRational = undefined

-- 組み合わせ
powerset :: [a] -> [[a]]  
powerset xs = filterM (\x -> [True, False]) xs


Measured memory_bytes: 3940
#include<bits/stdc++.h>
 
 
using namespace std;
int main()
{
 
int a,b,c;
 
cin>>a>>b>>c;
 
int max,min;
 
if(a>=b&&a>=c){
    max=a;
}
else if(b>=a&&b>=c){
    max = b;
}
else max=c;
 
if(a<=b&&a<=c){
    min=a;
}
else if(b<=a&&b<=c){
   min = b;
}
else min=c;
 
cout<<max-min<<endl;
 
 
 
    return 0;
}

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

int main(){
	string S;
	cin >> S;
	int num = S.size();
	int s[num];
	for(int i=0; i<num; i++){
		s[i] = S[i] - '0';
	}
	int min = abs(753 - 100*s[0] - 10*s[1] - s[2]);
	for(int i=1; i<num-2; i++){
		int index = 100*s[i] + 10*s[i+1] + s[i+2];
		if(min > abs(753 - index)){
			min = abs(753 - index);
		}
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <tuple>
#define int long long
#define ll long long 
#define rep(i,a,b) for(signed i=a;i<(b);++i)
#define erep(i,a,b) for(signed i=a;i<=(b);++i)
#define per(i,a,b) for(signed i=(a);i>(b);--i)
#define eper(i,a,b) for(signed i=(a);i>=b;--i)
#define fore(i, x, a) for(auto &&x:a) 
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define ALL(x) begin(x),end(x)
#define F first
#define S second
#define debug(x)  cout << #x << ": " << (x) << '\n';
const long long INF=1001001001001001001;
const int MOD=(int)1e9 + 7;
const double EPS=1e-9;
using namespace std;
using Pii = pair<int,int>;
using vii = vector<int>;
template<class T>using  PS_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>using vv = vector<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> ostream& operator<<(ostream &os,const vector<vector<T> > &v) {
    ITR(u,begin(v),end(v))ITR(w,begin(*u),end(*u))os<<*w<<(w==end(*u)-1?"\n":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct edge { int from, to, cost; };
int dy[]={0, 1, -1, 0}; int dx[]={1, 0, 0, -1};
// cout << fixed << setprecision(10) << val;

int n;
signed main() {
 cin.tie(0);
 ios::sync_with_stdio(false);
  cin >> n;
  vii a(n), b(n), c(n-1);
  rep(i, 0, n) cin >> a[i];
  rep(i, 0, n) cin >> b[i];
  rep(i, 0, n-1) cin >> c[i];
  int ans = 0;
  rep(i, 0, n) {
    ans += b[a[i]-1];
    if  (i == n-1) continue;
    if (a[i] + 1 == a[i+1]) {
      ans += c[a[i]-1];
    }
  }
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	int n;
  	int d[100];
  	cin >> n;
  	for(int i=0;i<n;++i) cin >> d[i];
  	sort(d,d+n);
  	reverse(d,d+n);
  	int ans=1;
  	for(int i=0;i<n-1;++i){
    	if(d[i]-d[i+1])
          	ans++;
    }
  	cout << ans << endl;
}

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

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

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;

int v[5000];
int st[5000], dr[5000];
int init[5000];
int a[5000], b[5000];
int dp[5000][5000];

void perm(int st, int dr, bool inv = 0)
{
    vector <int> nr;
    for (int i(st); i <= dr; i++)
        if (v[i])
            nr.push_back(v[i]), v[i] = 0;
    for (int i(inv ? dr - nr.size() + 1 : st), j(0); j < nr.size(); i++, j++)
        v[i] = nr[j];
}

int main()
{
    int n, m, id = 1;
    cin >> n >> m;

    for (int i(1); i <= n; i++) {
        char c;
        cin >> c;
        if (c == '1')
            init[i] = id++;
    }

    for (int i(1); i <= m; i++)
        cin >> a[i] >> b[i];

    for (int i(1); i <= n; i++)
        v[i] = init[i];

    for (int i(1); i <= m; i++)
        perm(a[i], b[i]);

    for (int i(1); i <= n; i++)
        if (v[i])
            st[v[i]] = i; /// am calculat st[i]

    for (int i(1); i <= n; i++)
        v[i] = init[i];

    for (int i(1); i <= m; i++)
        perm(a[i], b[i], 1);

    for (int i(1); i <= n; i++)
        if (v[i])
            dr[v[i]] = i; /// am calculat dr[i]

    dp[0][0] = 1;

    for (int i(1); i <= n; i++) {
        for (int j(0); j < id; j++) {
            dp[i][j] = dp[i - 1][j];
            if (j > 0 && st[j] <= i && dr[j] >= i)
                dp[i][j] = (dp[i][j] + dp[i - 1][j - 1]) % mod;
        }
    }

    cout << dp[n][id - 1];

    return 0;
}


Measured memory_bytes: 58752
N, M = gets.split.map(&:to_i)
a = []
M.times do |i|
  a << gets.to_i
  if a.size > 1
    if a[i] - a[i - 1] == 1
      p 0
      exit
    end
  end
end

dp = Array.new(N + 2, 0)
mod = 10 ** 9 + 7

dp[0] = 1
j = 0
N.times do |i|
  j += 1 if j < M && a[j] <= i
  unless j < M && a[j] == i + 1
    dp[i + 1] += dp[i]
    dp[i + 1] %= mod
  end
  unless j < M && a[j] == i + 2 || j + 1 < M && a[j + 1] == i + 2
    dp[i + 2] += dp[i]
    dp[i + 2] %= mod
  end
end

p dp[N]


Measured memory_bytes: 3380
//write for s26

#include <bits/stdc++.h>
using namespace std;
int main(){
    long long a;
    string b;
    cin>>a>>b; 
    long long B=(b[0]-'0')*100+(b[2]-'0')*10+(b[3]-'0')*1;
    cout<<a*B/100<<endl;
    return 0;
}


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

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

  for (int i=0;i<w+2;i++) {
    cout << '#';
  };

  cout << endl;

  for (int i=0;i<h;i++) {
    string str;
    cin >> str;
    cout << '#' << str << '#' << endl;
  }
  
  for (int i=0;i<w+2;i++) {
    cout << '#';
  };

  cout << endl;

  return 0;
}

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

using namespace std;

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

    for(int i = 0; i <= 25; i++) {
        for(int j = 0; j <= 14; j++) {
            if((i*4+j*7) == N) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#template
def inputlist(): return [int(j) for j in input().split()]
def listinput(): return input().split()
#template
N = int(input())
X = inputlist()
ans = 10**9+7
for i in range(101):
    tmp = 0
    for j in range(N):
        tmp += (X[j]- i)**2
    ans = min(ans,tmp)
print(ans)

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

namespace ConsoleApp11
{
    class Class35
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            Dictionary<string, long> Table = new Dictionary<string, long>();
            for(int i = 0; i < N; i++)
            {
                string read =string.Join("", Console.ReadLine().OrderBy(x => x).ToArray());
                if (Table.Keys.Contains(read))
                {
                    Table[read] += 1;
                }
                else
                {
                    Table[read] = 0;
                }
            }
            long ans = Table.Values.Sum(x => x * (x + 1) / 2);

            Console.WriteLine(ans);
        }
        
    }
}


Measured memory_bytes: 28160
#include <iostream>
#include <algorithm>

using namespace std;


int main()
{
	int N, K;
	int diff;
	int diff_min = 1000000000;

	cin >> N >> K;

	int* h = new int[N];
	for (int i = 0; i < N; i++) cin >> h[i];

	sort(h, h + N);

	for (int i = 0; i < N - K + 1; i++) {
		diff = h[i + K - 1] - h[i];

		if (diff < diff_min) diff_min = diff;
	}

	cout << diff_min << endl;

	return 0;
}


Measured memory_bytes: 640
N = input()
n = []
for v in N:
    n.append(v)
if (n[0]>=n[1]) and (n[0]>=n[2]):
    print(int(n[0]+n[0]+n[0]))
else:
    n[0] = str(int(n[0]) + 1)
    print(int(n[0]+n[0]+n[0]))

Measured memory_bytes: 3060
#include <cmath>
#include <chrono>
#include <random>
#include <ctime>
#include <algorithm>
#include <iosfwd>
#include <iostream>
#include <list>
#include <ostream>
#include <streambuf>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define fori(i, n) for(ll i = 0; i < (n); ++i)
#define forI(i, n) for(ll i = 1; i <= (n); ++i)
#define pll pair<ll, ll>
#define ff first
#define ss second

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

#define pt pair<ll, ll>
#define x first
#define y second

pll operator+ (pll a, pll b){ return {a.x + b.x, a.y + b.y}; }

ll rand0m() {
    return (ull(rand()) << 15ull | ull(rand()));
}                   //[0 ... n)
ll rand0m(ll x) {
    return rand0m() % x;
}               //[0 ... n)
ll rand0m(ll minn, ll maxx) {
    return rand0m(maxx - minn + 1) + minn;
}   //[minn ... maxx]

const ll MAXN = 1e5 + 1;
const ll mod = 1e9 + 7;
const ll INF = 2e9 + 1000;

ll n, m;
bool win[MAXN];
ll a[100];

void solve(){
    cin >> n >> m;
    fori(i, n) cin >> a[i];
    fori(i, m){
        if(win[i]) continue;
        fori(j, n) if(i + a[j] <= m) win[i + a[j]] = true;
    }
    cout << (win[m] ? "First" : "Second");
}

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //stress();
    solve();
}

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

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  string s;
  cin >> s;
  
  for (int i = 0; i < 8; i++) {
    int sum = s[0] - '0';
    for (int j = 0; j < 3; j++) {
      sum += ((i >> j) & 1 ? 1 : -1) * (s[j + 1] - '0');
    }
    if (sum == 7) {
      for (int j = 2; j >= 0; j--) {
        s.insert(j + 1, ((i >> j) & 1 ? "+" : "-"));
      }
      cout << s << "=7" << endl;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 256
n = int(input())

ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
    s = input()
    if s == 'AC':
        ac += 1
    elif s == 'WA':
        wa += 1
    elif s == 'TLE':
        tle += 1
    else:
        re += 1

print('AC x', ac)
print('WA x', wa)
print('TLE x', tle)
print('RE x', re)

Measured memory_bytes: 9004
import heapq

n,m=map(int,input().split())
a=[-int(i) for i in input().split()]

heapq.heapify(a)
for i in range(m):
 max=-heapq.heappop(a)
 heapq.heappush(a,-1*(max//2))

print(sum([-int(i) for i in a]))

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p){os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N, H, W;
    cin >> N >> H >> W;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        int h, w;
        cin >> h >> w;
        if (h >= H && w >= W) cnt++;
    }
    cout << cnt << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

using namespace std;

int main() 
{
    ll x, y; 
    cin >> x >> y;

    ll upper_limit = x * (y/x);
    ll ans = 0;

    while(x <= upper_limit) {
        if(x*2 % x == 0) { ans++; }
        x *= 2;
    }

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



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

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main() {
	int n;
	cin >> n;
	int cnt = 0, ma = 0;
	int ans = 1;
	for(int i = 1; i <= n; i++){
		int j = i;
		while(j >= 0){
			if(j % 2 == 0){
				cnt++;
				j /= 2;
			}else{
				break;
			}
		}
		if(ma < cnt){
			ans = i;
			ma = cnt;
		}
		cnt = 0;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
struct line{
    int V;
    vector<int> len,dire;
    line():V(0){}
};
int dir(int a,int b){
    if(b==0){
        if(a>0)return 0;
        else return 2;
    }else{
        if(b>0)return 1;
        else return 3;
    }
}
int n;
int m[100];
int x[100][100];
int y[100][100];
line li[100];
bool check(line l1,line l2){
    if(l1.V != l2.V)return false;
    for(int i=0;i<l1.len.size();i++){
        if(l1.len[i]!=l2.len[i])return false;
    }
    int angle = (l1.dire[0]+4-l2.dire[0])%4;
    for(int i=0;i<l1.dire.size();i++){
        if(l1.dire[i]!=(l2.dire[i]+angle)%4)return false;
    }
    return true;
}
int solve(){
    scanf("%d",&n);
    for(int i=0;i<n+2;i++){
        li[i].dire.clear();
        li[i].len.clear();
    }
    if(n==0)return 1;
    for(int i=0;i<=n;i++){
        scanf("%d",&m[i]);
        li[i].V = m[i];
        for(int j=0;j<m[i];j++){
            scanf("%d %d",&x[i][j],&y[i][j]);
        }
        for(int j=1;j<m[i];j++){
            li[i].dire.pb(dir(x[i][j]-x[i][j-1],y[i][j]-y[i][j-1]));
            li[i].len.pb(max(abs(x[i][j]-x[i][j-1]),abs(y[i][j]-y[i][j-1])));
        }
    }
    li[n+1].V=m[0];
        for(int j=m[0]-2;j>=0;j--){
            li[n+1].dire.pb(dir(x[0][j]-x[0][j+1],y[0][j]-y[0][j+1]));
            li[n+1].len.pb(max(abs(x[0][j]-x[0][j+1]),abs(y[0][j]-y[0][j+1])));
        }
    for(int i=1;i<=n;i++){
        if(check(li[0],li[i])||check(li[n+1],li[i]))printf("%d\n",i);
    }
    printf("+++++\n");
    return 0;
}
int main(){
    while(1){
        if(solve())return 0;
    }
    return 0;
}

Measured memory_bytes: 3304
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
static const double pi = 3.141592653589793;

int main(){
    double ans, theta;
    int a,b,h,m; cin >> a >> b >> h >> m;
    theta = (double)(h/12.0)+(double)(m/(60.0*12.0)) - (double)(m/60.0);
    // cout << theta << endl;
    ans = (double)(a*a + b*b) - (double)(2*a*b*cosl(2*pi*theta));
    ans = sqrt(ans);
    printf("%.10f\n",ans);
}

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

c = 0
up = '?'
pre = A[0]
for a in A:
    if a > pre:
        if up is False:
            c += 1
            up = '?'
        else:
            up = True
    elif a < pre:
        if up is True:
            c += 1
            up = '?'
        else:
            up = False
    pre = a

c += 1

print(c)

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int sz;
    sz = s.size();
    int mn, mx;
    mn = sz;
    mx = 0;
    for(int i=0; i<sz; i++){
        if(s[i]=='A'){
            mn = min(mn,i);
        }
        if(s[i]=='Z'){
            mx = max(mx,i);
        }
    }
    cout << mx-mn+1 << endl;
}




Measured memory_bytes: 3732
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <tuple>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    //    ifstream in("input.txt");
    //    cin.rdbuf(in.rdbuf());
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int k;
    cin >> k;
    
    cout << ((k+1)/2) * (k/2) << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <typeinfo>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0; i<n; i++)
int a=0,b=0,c=0;

signed main(){
    string n;
    cin>>n;
    rep(i,n.size()){a=n[i]-'0';b+=a;}
    if(b%9==0)cout<<"Yes"<<endl;
    else
    {
        cout<<"No"<<endl;
    }
    
}

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

int main(){
  ll n,ans,a,i;
  cin >> n;
  ll b[n];
  for(i=1;i<n;i++)cin >> b[i];
  ans=b[1];
  a=b[1];
  for(i=2;i<n;i++){
    ans=ans+min(a,b[i]);
    a=b[i];
  }
  ans=ans+b[n-1];
  cout << ans;
}

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

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

    vector<string> board(H);
    for (int i = 0; i < H; i++) {
        cin >> board.at(i);
    }

    bool can = true;
    const vector<int> dx = {1, 0, 0, -1};
    const vector<int> dy = {0, 1, -1, 0};
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            bool can2 = false;
            if (board.at(i).at(j) == '#'){
                for(int d = 0; d < 4; d++) {
                    const int ni = i + dx.at(d);
                    const int nj = j + dy.at(d);
                    if (ni >= 0 && ni < H
                        && nj >= 0 && nj < W
                        && board.at(ni).at(nj) == '#') {
                            can2 = true;
                        }
                } 
                can = can2;
            }
            if(!can) break;
        }
        if (!can) break;
    }

    if (can) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

struct point{
	double x,y;
	point operator+(point p){
		return point{x+p.x,y+p.y};
	}
	point operator-(point p){
		return point{x-p.x,y-p.y};
	}
	point operator*(double p){
	return point{x*p,y*p};
	}
	point operator/(double p){
		if(!p) return point{0,0}; 
		return point{x/p,y/p};
	}
	bool operator==(point p){
		return fabs(x-p.x)<eps&&fabs(y-p.y)<eps;
	}
};

typedef pair<point,point> pp;
const point O{0,0};

class Geom{
	public:
	double Length(point x,point y){
		point z=y-x;
		return sqrt(z.x*z.x+z.y*z.y);
	}
	double IP(point p,point q){
		return p.x*q.x+p.y*q.y;
	}
	double CP(point p,point q){
		return p.x*q.y-q.x*p.y;
	}
	string Parallel_Orthogonal(pp a,pp b){
		point A=a.second-a.first,B=b.second-b.first;
		double ip=IP(A,B),cp=CP(A,B);
		if(cp<eps&&cp>-eps) return "Parallel";
		if(ip<eps&&ip>-eps) return "Orthogonal";
		else return "Commonly";
	}
	void Point_in(point& p){
		cin>>p.x>>p.y;
	}
};

int Q;
vector<point> p(4);

int main(){
	Geom geo;
	cin>>Q;
	for(int i=0;i<Q;i++){
		for(int j=0;j<4;j++) geo.Point_in(p[j]);
		string ans=geo.Parallel_Orthogonal(pp(p[0],p[1]),pp(p[2],p[3]));
		if(ans=="Parallel") cout<<2<<endl;
		else if(ans=="Orthogonal") cout<<1<<endl;
		else cout<<0<<endl;
	}
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


int main(){
    char n;
    cin >> n;
    printf("%c\n",n+1);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
int main() {
  string n;
  cin >> n;
  for(int i=0; i<n.size(); i++) {
    if (n[i] == '9') {
      cout << "Yes" << endl;
      return 0;
    } 
  } 
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a,b,k;
int main(){
	cin>>a>>b>>k;
	if(k<a)
	{
		cout<<a-k<<" "<<b;
		return 0;
	}
	k=k-a;a=0;
	if(k>b)
	{
		cout<<a<<" "<<'0';
		return 0;
	}
	cout<<a<<" "<<b-k;
	return 0;
} 

Measured memory_bytes: 256