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

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)
#define x first
#define y second

using namespace std;

typedef long long LL;

const int N = 16;
const int Mod = 1e9 + 7;

inline void add(int &x, int y){
	x += y;
	if(x >= Mod) x -= Mod;
}

int mul(LL x, int y){
	return x * y % Mod;
}

int n, m;
int dp[1 << N], Pow[N * N];
int cnt[N][1 << N];

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

	For(i, 1, m){
		int u, v;
		scanf("%d%d", &u, &v);
		For(j, 0, (1 << n) - 1) if(j & (1 << (v - 1)))
			cnt[u][j]++;
	}

	Pow[0] = 1;
	For(i, 1, n * n) Pow[i] = mul(Pow[i - 1], 2);

	int ans = 0;
	For(i, 0, (1 << n) - 1) if(((i & 3) == 3) || !(i & 3)){
		dp[i] = 1;
		for(int j = (i - 1) & i; j; j = (j - 1) & i) if((j & 3) == 3 || !(j & 3)){
			int ret = dp[i ^ j];
			For(k, 0, n - 1) 
				if((i ^ j) & (1 << k)) ret = mul(ret, Pow[cnt[k + 1][j]] - 1);
				else if(j & (1 << k)) ret = mul(ret, Pow[cnt[k + 1][i ^ j]]);
			add(dp[i], ret);
		}
	}

	printf("%d\n", (Pow[m] - dp[(1 << n) - 1] + Mod) % Mod);
	return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    string S;
    cin >> S;
    int N = (int) S.size();
    vector<int> L, R;
    rep(i, N) {
        if (S[i] == 'L') {
            L.push_back(i);
        } else {
            R.push_back(i);
        }
    }
    vector<int> ans(N, 0);
    rep(i, N) {
        if (S[i] == 'L') {
            int idx = R[lower_bound(R.begin(), R.end(), i) - R.begin() - 1];
            if (abs(idx - i) % 2 == 0) {
                ans[idx]++;
            } else {
                ans[idx + 1]++;
            }
        } else {
            int idx = *lower_bound(L.begin(), L.end(), i);
            if (abs(idx - i) % 2 == 0) {
                ans[idx]++;
            } else {
                ans[idx - 1]++;
            }
        }
    }
    rep(i, N) {
        cout << ans[i] << ' ';
    }
}

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


Measured memory_bytes: 1612
#include<stdio.h>
#define M 200000
#define N 10000
struct Node{
  int p,q,c;
};
struct Node T[M];
int getdepth(int);
int main(){
  int n,i,k,id,c,key,depth[M],j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=T[i].c=T[i].q=-1;
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&id,&k);
    for(j=0;j<k;j++){
      scanf("%d",&c);
      if(j==0){
	T[id].c=c;
	T[c].p=id;
	key=c;
      }
      else{
	T[key].q=c;
	T[c].p=id;
	key=c;
      }
    }
  }
  for(i=0;i<n;i++){
    depth[i]=getdepth(i);
  }
  for(i=0;i<n;i++){
    printf("node %d: parent = %d, depth = %d, ",i,T[i].p,depth[i]);
    if(T[i].p==-1){
      printf("root, [");
      if(T[i].c!=-1){
	printf("%d",T[i].c);
	key=T[i].c;
	while(1){
	  if(T[key].q==-1) break;
	  printf(", %d",T[key].q);
	  key=T[key].q;
	}
      }
    }
    else if(T[i].c==-1){
      printf("leaf, [");
    }
    else{
      printf("internal node, [");
      if(T[i].c!=-1){
	printf("%d",T[i].c);
	key=T[i].c;
	while(1){
	  if(T[key].q==-1) break;
	  printf(", %d",T[key].q);
	  key=T[key].q;
	}
      }
    }
     printf("]\n");
  }
  return 0;
}

  int getdepth(int n){
  if(T[n].p==-1) return 0;
  return getdepth(T[n].p)+1;
}

      
      
      



Measured memory_bytes: 3264
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def main():
    N = int(readline())
    A = tuple(map(int, read().split()))

    if N == 2:
        print(A[1] - A[0])
        exit()

    dp = [10 ** 10] * N
    dp[1] = abs(A[1] - A[0])
    dp[2] = abs(A[2] - A[0])

    for i in range(3, N):
        dp[i] = min(dp[i - 1] + abs(A[i] - A[i - 1]), dp[i - 2] + abs(A[i] - A[i - 2]))

    print(dp[-1])


if __name__ == '__main__':
    main()

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

using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)

typedef long long int64;

int main() {
  string s;
  cin >> s;

  bool flag = false;
  for(int i=0; i<3; i++){
    if(s[i] == s[i+1]){
      flag = true;
      break;
    }
  }

  if(flag) cout << "Bad" << endl;
  else cout << "Good" << endl;

  return 0;
}


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

long long s;
long long a[2001];
const long long M = 1e9 + 7;

int main() {
    cin >> s;
    
    a[0] = 0;
    a[1] = 0;
    a[2] = 0;
    
    if(s > 2){
        for(int i = 3; i <= s; i++){
            a[i] = 1;
            
            for(int j = 3; j < i - 2; j++)
                a[i] = (a[i] + a[j]) % M;
        }
    }
    
    cout << a[s] << endl;
}


Measured memory_bytes: 3592
n=int(input())
i=0
for i in range(n):
    a,b,c=map(int,input().split())
    if a>b:
        a,b=b,a
    if b>c:
        b,c=c,b
    if a>b:
        a,b=b,a
    if a**2+b**2==c**2:
        print("YES")
    else:
        print("NO")
 


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

int main() {
  string S;
  cin>>S;
  int N=S.size();
  if(S=="zyxwvutsrqponmlkjihgfedcba"){
    cout<<"-1"<<endl;
  }
  else if(N==26){
    vector<char> v(26);
    for(int i=0;i<26;i++){
      v[i]=S[i];
    }
    next_permutation(begin(v),end(v));
    for(int i=0;i<26;i++){
      cout<<v[i];
      if(v[i]!=S[i]){
        cout<<endl;
        break;
      }
    }
  }
  else{
    for(int j=0;j<26;j++){
      char a='a'+j;
      int X=0;
      for(int i=0;i<N;i++){
        if(S[i]==a){
          X++;
          break;
        }
      }
      if(X==0){
        cout<<S<<a<<endl;
        break;
      }
    }
  }
      
}

Measured memory_bytes: 3608
n = gets.to_i
a_numbers = gets.split.map(&:to_i)

multiples_of_four = a_numbers.count { |number| number % 4 == 0 }
multiples_of_two_not_four = a_numbers.count(&:even?) - multiples_of_four
rest = n - (multiples_of_four + multiples_of_two_not_four)

if multiples_of_two_not_four.zero?
  puts multiples_of_four + 1 >= rest ? 'Yes' : 'No'
else
  puts multiples_of_four + 1 >= rest + 1 ? 'Yes' : 'No'
end


Measured memory_bytes: 8452
import java.util.Scanner;

public class Main{

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        // input
        int a = scan.nextInt();
        int b = scan.nextInt();
        
        // answer
        if(Math.abs(a - b) % 2 == 0){
            System.out.println(Math.abs(a - b) / 2 + Math.min(a, b));
        } else {
            System.out.println("IMPOSSIBLE");
        }

    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<cstdio>
#include<cstring>
typedef unsigned long long ull;
#define rep(i,a) for(int i=0;i<a;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
using namespace std;
const double eps = 1e-10;
const double pi = acos(-1);
const double inf = (int)1e8;

string s;
int n;
int value[128];

int multiply(int x,int y){
  if(x==2 && y==2) return 2;
  else if(min(x,y) == 0) return 0;
  else return 1;
}

int add(int x,int y){
  if(x==0 && y==0) return 0;
  else if(max(x,y) == 2) return 2;
  else return 1;
}

int form(){
  if(s[n] == '-'){
    n++;
    return 2-form();
  }else if(s[n] =='('){
    n++;
    int x = form();
    char c = s[n++];
    int y = form();
    n++;
    if(c == '*'){ // *
      return multiply(x,y);
    }else{ // +
      return add(x,y);
    }
  }else{
    return value[s[n++]];
  }
}
int main(void){
  value['0'] = 0;
  value['1'] = 1;
  value['2'] = 2;
  
  while(cin>>s,s!="."){
    
    s += "$";
    int res = 0;
    for(int P = 0 ; P <= 2 ; P ++){
      for(int Q = 0 ; Q <= 2 ; Q ++){
	for(int R = 0 ; R <= 2 ; R ++){
	  value['P'] = P;
	  value['Q'] = Q;
	  value['R'] = R;
	  n = 0;
	  res += (form() == 2);
	}
      }
    }
    cout<<res<<endl;
  }
   
  return 0;
}

Measured memory_bytes: 1188
#pragma GCC optimize("O1")
#pragma GCC optimize("O2")
#pragma GCC optimize("O3")
#include<cstdio>
#define LL long long
#define N 310
int n;
LL g[N][N];
signed main()
{
	scanf("%d",&n);LL ans(0);
	for(register int i(1);i<=n;i++)
		for(register int j(1);j<=n;j++)
			scanf("%lld",&g[i][j]);
	for(register int i(1);i<=n;i++)
		for(register int j(1);j<=i;j++)
		{
			bool f(1);
			for(register int k(1);k<=n;k++)
				if(g[i][j]>g[i][k]+g[k][j])
					return puts("-1"),0;
				else if(i-k&&j-k&&g[i][j]==g[i][k]+g[k][j])
					f=0;
			ans+=g[i][j]*f;
		}
	return printf("%lld\n",ans),0;
}

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

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

int main(){
  int H,W;
  cin>>H>>W;
  vector<vector<char>> ans(H+2,vector<char>(W+2,'.'));
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      cin>>ans.at(i).at(j);
    }
  }

  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      if(ans.at(i).at(j)=='#'){
        continue;
      }
      int x=0;
      for(int k=0;k<8;k++){
        if(ans.at(i+dx[k]).at(j+dy[k])=='#'){
          x++;
        }
      }
      ans.at(i).at(j)=(char)(x+'0');
    }
  }
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      cout<<ans.at(i).at(j);
    }
    cout<<endl;
  }
}


Measured memory_bytes: 256
n, k = map(int, input().split())
p = list(map(int, input().split()))

sekiwa = [0]
for i in range(n):
    sekiwa.append(sekiwa[-1]+p[i])

saidai = 0
for i in range(n-k+1):
    if sekiwa[i+k] - sekiwa[i] >= saidai:
        saidai = sekiwa[i+k] - sekiwa[i]
        hajimari = i

ans = 0
for i in range(hajimari, hajimari+k):
    ans += (1+p[i])/2

print(ans)

Measured memory_bytes: 24812
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
#include<cstdlib>
#define ll long long
#define lowbit(x) (x&(-x))
using namespace std;

ll ksm(ll x,ll y){
    ll ans=1;
    for (;y;y>>=1){
        if (y&1) ans=ans*x;
        x=x*x;
    }
    return ans;
}

int main(){
    ll h;cin>>h;
    cout<<ksm(2,log2(h)+1)-1<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) x.begin() , x.end()
#define ll long long 
#define pb push_back
#define mp make_pair
using namespace std;
const int mx = 1e5 + 4;
vector<int>v[mx];
bool visited[mx];
int deg[mx];
vector<int>dp(mx , 0);

void dfs(int x){
    visited[x] = true;
    for(int i : v[x]){
        dp[i] = max(dp[i] , dp[x] + 1);
        --deg[i];
        if(deg[i] == 0)dfs(i);
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n , m ;
    cin>>n>>m;
    for(int i = 0 ; i < m; ++i){
        int x , y; cin>>x>>y;
        v[x].pb(y);
        ++deg[y];
    }
    for(int i = 1 ; i <= n; ++i){
        if(!visited[i] && deg[i] == 0)dfs(i);
    }
    int ans = *max_element(all(dp));
    cout<<ans<<endl;
    

}

Measured memory_bytes: 9728
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
template<class T> inline void chmin(T &a, T b){if(a>=b)a=b;}
template<class T> inline void chmax(T &a, T b){if(a<=b)a=b;}
typedef long long ll;

ll X,Y;


int main(){
    cin >> X >> Y;
    ll ans = 1, num = X;
    while(true){
        num = num * 2;
        if(num <= Y) ++ans;
        else break;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
  
#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed fixed<<setprecision(14)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline lol abs(A &a) { return (a < 0 ? -a : a); }
template <class A, class B> inline A max(A a, B b){return(a>b?a:b);}
template <class A, class B> inline A min(A a, B b){return(a<b?a:b);}
const lol inf=(1LL<<60);
const lol MOD=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
lol n,m,k,r;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >>n;
  lol ans=0;
  int p=-1;
  lol u=n;
  vector<int> se;
  for(lol i=2;i*i<=u;i++){
    if(n%i==0){
      n/=i;
      se.emplace_back(1);
      p++;
    }
    while(n%i==0){
      n/=i;
      se[p]++;
    }
  }
  if(n!=1) ans++;
  for(int i=0;i<=p;i++){
    int sum=1;
    while(se[i]>=sum){
      se[i]-=sum;
      sum++;
      ans++;
    }
  }
  cout <<ans<<'\n';
  return (0);
}

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

int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
vector<int> b(n);
vector<int> c(n);
    vector<vector<int>> dp(n,vector<int>(3));

    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    dp[0]={a[0], b[0], c[0]};
    for(int i=1;i<n;i++)
    {
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
        dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c[i];
    }

int ans=dp[n-1][0]>dp[n-1][1]?max(dp[n-1][0],dp[n-1][2]):max(dp[n-1][1],dp[n-1][2]);
cout<<ans;
return 0;

}

Measured memory_bytes: 9752
from math import floor, sqrt
if __name__ == "__main__":
    Q = int(input())
    acc = [0]*(10**5+1)
    primes = set([2])
    for i in range(3,10**5+1):
        fl = True
        for j in range(2, floor(sqrt(i))+1):
            if i % j == 0:
                fl = False
                break
        acc[i] = acc[i-1]
        if fl:
            primes.add(i)
            if (i+1)//2 in primes:
                acc[i] += 1
    for q in range(Q):
        l, r = map(int,input().split())
        print(acc[r]-acc[l-1])

Measured memory_bytes: 78032
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int ans = 1;
		String[] S = new String[N];
		for (int i = 0; i < N; i++) {
			S[i] = scan.next();
		}

		Arrays.sort(S);

		for (int i = 1; i < N; i++) {
			if (!S[i].equals(S[i-1])) {
				ans++;
			}
		}

		System.out.println(ans);
	}

}

Measured memory_bytes: 70712
import math
N=int(input())
i=2
A=N
app=0
for i in range(2, int(N**(1/2)+1)+1):
    suma=0
    sume=0
    while A%i==0:
        A=A/i
        suma+=1
    if suma>0:
        n=(-1+(1+8*suma)**(1/2))/2
        n=math.floor(n)
        n=int(n)
        app=app+n
    suma=0
    i+=1
if A>1:
    app+=1
if app>0:
    print(app)
if app==0:
    if N>1:
        print(1)
    if N==1:
        print(0)

Measured memory_bytes: 9480
#include<iostream>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long x,y,z;
    int count;
    while(cin >> x >> y){
        z = x + y;
        count=1;
        while(z/=10){
            count++;
        }
        cout<<count<<"\n";
    }
}

Measured memory_bytes: 3124
use std::collections::BTreeMap;
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let s: String = read();

    let mut map = BTreeMap::new();
    for c in s.chars() {
        *map.entry(c).or_insert(0) += 1;
    }

    let ans = if map.len() == 2 && map.values().all(|&x| x == 2) {
        "Yes"
    } else {
        "No"
    };

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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

typedef long long ll;

const int maxn = 305;

int n,k,h[maxn];
int pre[maxn][maxn];
ll dp[maxn][maxn][maxn];

ll solve(int id, int level, int right){
	if(id == n+1)
		return 0;
	if(dp[id][level][right] != -1)
		return dp[id][level][right];
	ll ret = 1e18;
	if(h[level] < h[id]){
		ret = min(ret, solve(id+1, id, right) + h[id] - h[level]);
	} else {
		ret = min(ret, solve(id+1, id, right));
	}
	if(right)
		ret = min(ret, solve(id+1, level, right-1));
//	printf("%d %d %d %lld\n",id,level,right,ret);
	return dp[id][level][right] = ret;
}

int main(){
	
	scanf("%d%d",&n,&k);
	
	for(int i = 1; i <= n; i++)
		scanf("%d",&h[i]);
	
	memset(dp, -1, sizeof dp);
	
	cout << solve(1, 0, k) << endl;
	
	return 0;
}

Measured memory_bytes: 222080
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main
{
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
   static int gcd(int a, int b)
    {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
    public static void main(String args[])
    {
        FastReader obj = new FastReader();
        int k = obj.nextInt();
        long sum = 0;
        for (int i = 1; i <= k; i++)
        {
            for(int j=1;j<=k;j++)
            {
                for(int u=1;u<=k;u++)
                    sum+=gcd(i,gcd(j,u));
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 32812
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

fn run() {
    input! {
        n: usize,
        p: [(f64, f64); n],
    }
    let calc = |x: f64, y: f64| -> f64 {
        let mut res = 0f64;
        for p in p.iter() {
            let dx = x - p.0;
            let dy = y - p.1;
            let d = (dx * dx + dy * dy).sqrt();
            res = res.max(d);
        }
        res
    };
    let f = |x: f64| -> f64 {
        let mut d = 0f64;
        let mut u = 1000f64;
        for _ in 0..60 {
            let dd = (2.0 * d + u) / 3f64;
            let uu = (d + 2.0 * u) / 3f64;
            if calc(x, dd) > calc(x, uu) {
                d = dd;
            } else {
                u = uu;
            }
        }
        (u + d) * 0.5
    };
    let mut l = 0f64;
    let mut r = 1000f64;
    for _ in 0..60 {
        let ll = (2.0 * l + r) / 3.0;
        let rr = (l + 2.0 * r) / 3.0;
        let ly = f(ll);
        let ry = f(rr);
        if calc(ll, ly) > calc(rr, ry) {
            l = ll;
        } else {
            r = rr;
        }
    }
    let y = f((l + r) * 0.5);
    let ans = calc(l, y);
    println!("{:.7}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace Test1 {

    class ClassMain {




        public static void Main(String[] args) {
            string line;
            sensyu[] a = new sensyu[8];
            sensyu[] b = new sensyu[8];
            sensyu[] c = new sensyu[8];
            sensyu[] other = new sensyu[18];
           // while ((line = Console.ReadLine()) != null) {

                for (int i = 0; i < 8; i++)
                {
                    line = Console.ReadLine();
                    string[] strs = line.Split(' ');
                    sensyu x = new sensyu(int.Parse(strs[0]), strs[1]);
                    a[i] = x;                
                }
                Array.Sort(a);
                for (int i = 0; i < 8; i++) {
                    line = Console.ReadLine();
                    string[] strs = line.Split(' ');
                    sensyu x = new sensyu(int.Parse(strs[0]), strs[1]);
                    b[i] = x;
                }
                Array.Sort(b);
                for (int i = 0; i < 8; i++) {
                    line = Console.ReadLine();
                    string[] strs = line.Split(' ');
                    sensyu x = new sensyu(int.Parse(strs[0]), strs[1]);
                    c[i] = x;
                }
                Array.Sort(c);

                for (int i = 2; i < 8; i++) {
                    other[i - 2] = a[i];
                }
                for (int i = 2; i < 8; i++) {
                    other[i + 4] = b[i];
                }
                for (int i = 2; i < 8; i++) {
                    other[i + 10] = c[i];
                }
                Array.Sort(other);

                Console.WriteLine(a[0].toStr_());
                Console.WriteLine(a[1].toStr_());
                Console.WriteLine(b[0].toStr_());
                Console.WriteLine(b[1].toStr_());
                Console.WriteLine(c[0].toStr_());
                Console.WriteLine(c[1].toStr_());
                Console.WriteLine(other[0].toStr_());
                Console.WriteLine(other[1].toStr_());


               // Console.ReadLine();
            //}
        }


    }
    public class sensyu:IComparable {
        public int num;
        public string time;
        public sensyu(int n, string t) { this.num = n; this.time = t; }
        int IComparable.CompareTo(object obj) {
            sensyu x = (sensyu)obj;
            int xs = int.Parse(x.time.Split('.')[0]);
            int s = int.Parse(time.Split('.')[0]);
            if (xs > s) { return -1; }
            if (s > xs) { return 1; }
            int xp = int.Parse(x.time.Split('.')[1]);
            int p = int.Parse(time.Split('.')[1]);
            if (xp > p) { return -1; }
            if (p > xp) { return 1; }
            return 0;
        }
        public string toStr_() {
            
            return num+" "+time; 
        }

    }
}

Measured memory_bytes: 5824
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;
#define ull         unsigned long long int
#define ll          long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.0000000001
#define all(a)      (a).begin(),(a).end()
#define ordered_set     tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> 
 
const long long INF = (long long) 1e11+1;
const long long mod = (long long) 998244353;
const long long hell = (long long) 1000000007;

ll power(ll x,ll y){
  ll res=1;
  while(y>0){
    if(y%2) res=(x%hell*res%hell)%hell;
    x=(x%hell*x%hell)%hell;    
    y=y/2;
  }
  
  return res%hell;
}
 
ll modinv(ll x){
  return power(x,hell-2);
}

ll gcd(ll a,ll b){
    while( b != 0)
	{
		ll  t = b;
		b= a %t;
		a = t;
	}
	return a;
}    
    
void fastIO(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

void solve(){
  ll a,v,b,w,t;
  cin>>a>>v>>b>>w>>t;
  if(v<=w){
    cout<<"NO";
    return;
  }
  ll diff=v-w;
  ll dis=diff*t;
  if(abs(a-b)<=dis){
    cout<<"YES";
  }
  else
  cout<<"NO";
}    

int main(){
   fastIO();
   int test;
   //cin>>test;
   test=1;    
      
   while(test--)
   solve();
}

Measured memory_bytes: 3660
/**
 *   author: sahushivam
 *   created: 22 December 2019 (Sunday)  17:57:51
**/
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1e18
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define int long long
int Z(int n) 
{ 
    // Initialize result 
    int count = 0; 
  
    // Keep dividing n by powers of  
    // 5 and update count 
    for (int i = 5; n / i >= 1; i *= 5) 
        count += n / i; 
  
    return count; 
} 


// Driver code 
signed main(void) 
{ 
	int n; cin>>n; int d = 0; 
	if(n&1) cout<<"0";
	else if(n<10) cout<<"0";
	else
	cout << Z(n/2); 
	return 0; 
} 


Measured memory_bytes: 256
from heapq import heappush, heappop

H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))

a_list = []
for i in range(N):
    heappush(a_list, (a[i], i + 1))

c = [[0] * W for _ in range(H)]
remain = 0
for y in range(H):
    if y % 2 == 0:
        for x in range(W):
            if remain == 0:
                remain, num = heappop(a_list)
            c[y][x] = num
            remain -= 1
    else:
        for x in reversed(range(W)):
            if remain == 0:
                remain, num = heappop(a_list)
            c[y][x] = num
            remain -= 1

for row in c:
    s = ' '.join([str(i) for i in row])
    print(s)

Measured memory_bytes: 4340
// ABC_165_B

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

	ll a = 100;
	ll counter = 0;

	while(a < n) {
		a += a / 100;
		++counter;
	}

	cout << counter << "\n";

	return 0;
}

Measured memory_bytes: 3608
#include <atcoder/all>
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

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

    int n, m;
    cin >> n >> m;
    atcoder::scc_graph graph(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        graph.add_edge(a, b);
    }

    auto vs = graph.scc();
    cout << vs.size() << "\n";
    for(auto &&v : vs) {
        cout << v.size();
        rep(i, v.size()) cout << " " << v[i];
        cout << "\n";
    }

    return 0;
}

Measured memory_bytes: 40116
/**
  @date Time-stamp: <2019-06-25 19:32:25 tagashira>
  @file a.cpp
  @title A - Favorite Sound
  @brief https://atcoder.jp/contests/abc120/tasks/abc120_a
**/

#include <bits/stdc++.h>
using namespace std;

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

  if (B / A >= C) {
    cout << C << endl;
  } else {
    cout << B / A << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import Control.Applicative

t2h :: Int -> Int
t2h t = div t 3600
t2m :: Int -> Int
t2m t = mod (div t 60) 60
t2s :: Int -> Int
t2s t = mod t 60

main = do
  t <- read <$> getLine
  let h = t2h t
  let m = t2m t
  let s = t2s t
  putStrLn $ show h ++ ":" ++ show m ++ ":" ++ show s


Measured memory_bytes: 3580
<?php
fscanf(STDIN,"%d%d%d%d",$w,$h,$x,$y);
$menseki = $w*$h;

/*if($x_menseki==$y_menseki){
  echo 
}elseif($minx>$miny){
  echo $minx." 0";
}else{
  echo $miny." 0";
}*/

if($x*2==$w && $y*2==$h){
  echo ($menseki/2)." 1";
}else{
  echo ($menseki/2)." 0";
}

Measured memory_bytes: 4732
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#include<map>
#include<iomanip>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using pdd = pair<double,double>;
using vvi = vector<vector<int> >;
using vvll =  vector<vector<ll> >;

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
    ll N,X,M;cin>>N>>X>>M;
    vector<int> seen(M+1,-1);
    ll ans = 0;
    //ans += X;
    //X %= M;    
    ll now = X % M;
    //ans += X - now;
    int count = 1;
    int start;
    int period;
    ll sum_period = 0;
    while(true){
        now *= now;
        now %= M;
        if(seen[now] == -1){
            seen[now] = count;
            count++;
        }
        else{
            period = count - seen[now];
            start = now;
            break;
        }
    }

    //cout << period << " "<<start << endl;
    ll where = start;

    REP(i,period){
        sum_period += where;
        where = where * where % M;
    }

    //cout << sum_period << endl;
    now = X;
    REP(i,seen[start]){
        ans += now;
        now = now * now % M;
        //cout <<"1" << endl;
    }
    REP(i,(N - seen[start]) / period){
        ans += sum_period;
        //cout << "2" << endl;
    }

    ll nowend = start;
    for(ll i = seen[start] + ((N - seen[start]) / period) * period; i < N; i++){
        ans += nowend;
        nowend = nowend*nowend % M;
        //cout << "3" << endl;
    }

    cout << ans << endl;


}



Measured memory_bytes: 3712
A,B,C,X = int(input()),int(input()),int(input()),int(input())

c = 0
ans = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            ans = 500*i + 100*j + 50*k
            if ans == X:
                c += 1
print(c)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int pre[maxn];
int a[maxn];
int n,m;
void init(){
    for(int i=1;i<=n;++i)
        pre[i]=i;
}
int fin(int x){
    if(x==pre[x])return x;
    int par=fin(pre[x]);
    return pre[x]=par;
}
void mer(int x,int y){
    int xx=fin(x);
    int yy=fin(y);
    if(xx==yy)return ;
    pre[xx]=yy;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>m;
    init();
    for(int i=1;i<=n;++i)cin>>a[i];
    while(m--){
        int x,y;
        cin>>x>>y;
        mer(x,y);
    }
    int ans=0;
    for(int i=1;i<=n;++i){
        if(fin(i)==fin(a[i]))
            ans++;
    }
    cout<<ans<<endl;
}


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

#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433L;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    int S,W; cin >> S >> W;
    cout << (S<=W?"un":"") << "safe" << endl;    
    return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)
#define rrep(i, j, n) for (int i = (int)n - 1; j <= i; --i)

constexpr ll MOD = 1000000007;
constexpr int INF = 0x3f3f3f3f;
constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

int dp[101][5][2];
int main() {

  string s;
  int k;
  cin >> s >> k;
  int n = (int)s.size();
  dp[0][0][1] = 1;
  rep(i, 0, n) {
    rep(j, 0, k + 1) {
      rep(giri, 0, 2) {
        int x = s[i] - '0';
        int mx = (giri ? x : 9);
        rep(n, 0, mx + 1) {
          int girigiri = giri && (n == mx);
          if (n != 0)
            dp[i + 1][j + 1][girigiri] += dp[i][j][giri];
          else
            dp[i + 1][j][girigiri] += dp[i][j][giri];
        }
      }
    }
  }
  cout << dp[n][k][0] + dp[n][k][1] << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <map>

  # define int long long

class Point {
  public:
    int x;
    int y;
    bool operator < (Point &a) {
      return (x == a.x) ? (y < a.y) : (x < a.x);
    }
};

  int aPoint;
  std::vector <Point> points;
  std::map <std::pair <int, int>, int> diff;

int max(int a, int b) {
  return (a > b) ? a : b;
}

signed main() {
  std::cin >> aPoint;
  for (int i = 0; i < aPoint; ++i) {
    int x;  int y;
    std::cin >> x >> y;
    points.push_back(Point{ x, y });
  }

  // std::sort(points.begin(), points.end());

  for (int i = 0; i < aPoint - 1; ++i) {
    for (int j = i + 1; j < aPoint; ++j) {
      int p = points[i].x - points[j].x;
      int q = points[i].y - points[j].y;
      ++diff[{ p, q }];
      ++diff[{ -p, -q }];
    }
  } 

  int Max = 0;
  for (auto &x : diff) {
    Max = max(Max, x.second);    
  }

  std::cout << aPoint - Max;
}

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

int comp_str(string s1, int pos, string s2) {
    int ret = 0;    // 0: s2の方が順序が小さい
    int size = s2.size();
    
    for ( int ii = 0; ii < size; ii++ ) {
        if ( s1[pos + ii] < s2[ii] ) {
            ret = 1;
            break;
        } else if ( s1[pos + ii] > s2[ii] ) {
            break;
        }
    }
    return ret;
}

int main() {
    int     N, L;
    string  s = "";
    string  tmp;
    int     ret;
    int     ii, jj;
    
    cin >> N >> L;
    
    for ( ii = 0; ii < N; ii++ ) {
        cin >> tmp;
        
        for ( jj = 0; jj < ii; jj++ ) {
            ret = comp_str(s, jj * L, tmp);
            if ( ret == 0 ) {
                s = s.insert(jj * L, tmp);
                break;
            }
        }
        if ( jj == ii ) {
            s.insert(s.size(), tmp);
        }
    }

    cout << s << endl;
    
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
//#include <algorithm>
using namespace std;
int main(){
  long long int n, p[1000000000], ans=0;
  cin >> n;
  for(int i=0; i<n; i++){
    ans += i;
  }
  cout << ans;
  
/*  1 2 3 4 5 6
    2 3 4 5 6 1
    1 2 3 4 5 0
  max 10 51234 */
  return 0;
}

Measured memory_bytes: 256
import sys
import math
n, k = [int(i) for i in sys.stdin.readline().split()]
res = 0
for i in range(1, n+1):
    if i >= k:
        res += 1 / n
    else:
        res += 1 / 2 ** math.ceil(math.log2(k / i)) / n
print(res)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
 
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define debug(x) cout << #x << ": " << x << endl
#define ALL(x) (x).begin(),(x).end()
 
const int INF = 1e9;
const ll LINF = 1e16;
 
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
 
    while (1) {
        double x, y, s;
        cin >> x >> y >> s;
        if (x == 0 && y == 0 && s == 0) break;
 
        int ret = -1;
 
        for (double a = 1; a < 1000; a += 1) {
            for (double b = a; b < 1000; b += 1) {
                int suma = a + a*x / 100;
                int sumb = b + b*x / 100;
                if (suma + sumb == s) {
                    int ssuma = a + a*y / 100;
                    int ssumb = b + b*y / 100;
                    ret = max(ret, ssuma + ssumb);
                }
            }
        }
        cout << ret << endl;
    }
 
  return 0;
}

Measured memory_bytes: 3248
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	int n;
	bool first=true;
	while(cin>>n){
		if(!first)cout<<endl;
		first=false;
		int i,j;
		for(i=0,j=10000;i<5;i++,j/=10){
			if(n/j%10<5)cout<<"*";
			else cout<<" ";
		}
		cout<<endl;
		for(i=0,j=10000;i<5;i++,j/=10){
			if(n/j%10<5)cout<<" ";
			else cout<<"*";
		}
		cout<<endl;
		for(i=0;i<5;i++){
			cout<<"=";
		}
		cout<<endl;
		for(i=0,j=10000;i<5;i++,j/=10){
			if(n/j%5==0)cout<<" ";
			else cout<<"*";
		}
		cout<<endl;
		for(i=0,j=10000;i<5;i++,j/=10){
			if(n/j%5==1)cout<<" ";
			else cout<<"*";
		}
		cout<<endl;
		for(i=0,j=10000;i<5;i++,j/=10){
			if(n/j%5==2)cout<<" ";
			else cout<<"*";
		}
		cout<<endl;
		for(i=0,j=10000;i<5;i++,j/=10){
			if(n/j%5==3)cout<<" ";
			else cout<<"*";
		}
		cout<<endl;
		for(i=0,j=10000;i<5;i++,j/=10){
			if(n/j%5==4)cout<<" ";
			else cout<<"*";
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n,ans;
	queue<ll>q;
	cin>>n;
	for(ll i=1;i<10;i++) q.push(i);
	while(n--){
		ans=q.front();
		q.pop();
		if(ans%10!=0) q.push(ans*10+ans%10-1);
		q.push(ans*10+ans%10);
		if(ans%10!=9) q.push(ans*10+ans%10+1);
	}
	cout<<ans<<endl;
	return  0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 1000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

string s;

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	string s;
	cin >> s;
	int n = s.size();
	if(s[n-1] == 's'){
		cout << s << "es" << endl;
	}else{
		cout << s  << "s" << endl;
	}
	return 0;
} 
//^-^

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX*/                      int gcd(ll a,ll b){return b?gcd(b,a%b):a;}
/*"lcm"   MIN*/                      int lcm(ll a,ll b){return a*b/gcd(a,b);}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a<b&&b<c)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 3092
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int a, b, c; cin >> a >> b >> c;
	cout << c - min(c, a - b) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}


//Greatest Common Divisor
long long GCD(long long a, long long b) {
    return ((b == 0) ? a : GCD(b, a % b));
}

//Least Common Multiple
long long LCM(long long a, long long b) {
    return ((a*b == 0) ? 0 : (a / GCD(a, b)*b));
}


int main() {
	ll A,B,C,D; cin >> A >> B >> C >> D;
	ll lcm = LCM(C,D);

	ll cntB = B - B/C - B/D + B/lcm;
	A--;
	ll cntA = A - A/C - A/D + A/lcm;
	cout << cntB - cntA << endl;
	
	
	
   
	return 0;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

ans = 0

for i in range(n):
    b = B[i]
    if A[i] >= b:
        ans += b
    elif A[i] < b:
        ans += A[i]
        b -= A[i]
        if A[i+1] >= b:
            ans += b
            A[i+1] -= b
        elif A[i+1] < b:
            ans += A[i+1]
            A[i+1] = 0 

print(ans)

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

int N;
int A[210];

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

        int res = 0;
        while(true){
                bool exist_odd = false;
                for(int i=0;i<N;++i){
                        if(A[i]%2){
                                exist_odd = true;
                                break;
                        }else{
                                A[i] /= 2;
                        }
                }
                if(exist_odd){
                        break;
                }else{
                        res += 1;
                }
        }
        cout << res << endl;
}


Measured memory_bytes: 256