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

using namespace std;

#define ll long long 
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353
#define inf 1e18

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

ll n,k;
ll ar[200005];

ll calc(ll ans)
{
    ll temp=k;

    for(ll i=0;i<n;i++)
    {
        ll no=ar[i];

        if(no<=ans)
        continue;

        ll t=no/ans;

        ld no2=ceil((no/t)-0.5);

        if(no2<ans)
        {
            temp-=(t-1);
        }
        else
        {
            temp-=t;
        }
    }

    if(temp>=0)
    {
        return 1;
    }
    else
    {
        return 0;
    }
    
}

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

    ll test=1;
    // cin>>test;
    while(test--)
    {
        cin>>n>>k;

        for(ll i=0;i<n;i++)
        cin>>ar[i];

        ll low=1,high=1000000005;

        ll ans=1;

        // cout<<calc(3)<<endl;

        while(low<high)
        {
            ll mid=(low+high)/2;

            if(calc(mid))
            {
                ans=mid;
                high=mid;
            }
            else
            {
                low=mid+1;
            }
        }

        cout<<ans;
    }
}

Measured memory_bytes: 5168
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

const int MAX=510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        //???
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}



//n!
ll fact_mod(ll n) {
    ll ret=1; 
    for(ll i=2;i<=n;i++) ret=ret*(i%mod)%mod;
    return ret;
}
 
// 繰り返し二乗法 
ll pow_mod(ll x, ll n){
    if(n==0) return 1;
    ll ret=pow_mod((x*x) % mod, n/2);
    if(n&1) ret=(ret*x)%mod;
    return ret;
}
 
//nCr O(r) nがでかくても安心
ll combination_mod(ll n, ll r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    ll a=1;
    //a=n!/(n-r)!=n~n-r+1までの総積->O(r)
    for(ll i=0;i<r;i++) a=a*((n-i)%mod)%mod;
    //b=inv(r!)
    ll b=pow_mod(fact_mod(r), mod-2);
    return (a%mod)*(b%mod)%mod;
}
 
ll inv_mod(ll n){
    // フェルマーの小定理
    return pow_mod(n,mod-2);
}



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

    COMinit();

    ll n,A,B,C;cin>>n>>A>>B>>C;
    ll ans=0;
    ll S=A+B;
    A=A*100*inv_mod(S)%mod;
    B=B*100*inv_mod(S)%mod;

    ll a=A*inv_mod(100),b=B*inv_mod(100),c=C*inv_mod(100);
    a%=mod;b%=mod;c%=mod;
    ll susumu=(100*inv_mod(S))%mod;

    ll apn=pow_mod(a,n),bpn=pow_mod(b,n);
    for(ll m=n;m<2*n;m++){
        ll XM=COM(m-1,n-1)*((apn*pow_mod(b,m-n)%mod+bpn*pow_mod(a,m-n))%mod)%mod;
        ll YM=m*susumu%mod;
        ans+=(XM*YM)%mod;
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}


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

int n,m,q;
int a[11];
int b[21];
LL X[53],Y[53],Z[53],W[53];
int main(){
	
	cin >> n >> m >> q;
	for(int i=1; i<=q ;i++){
		cin >> W[i] >> X[i] >> Y[i] >> Z[i];
	}
	for(int i=1; i<m ;i++)
		b[i]=0;
	
	for(int i=m; i<m+n ;i++) 
		b[i]=1;
		
		
	LL ans=0;
	do{
		{
			int val=1,cnt=1;
		    for(int i=1; i<m+n;i++){
		
			if(!b[i]) val++;
			else{
				a[cnt++]=val;
			}
		}
		}
		LL res=0;
		for(int i=1; i<=q ;i++){
			if(a[X[i]]-a[W[i]]==Y[i]) res+=Z[i];
		}
		ans=max(ans,res);
	}while(next_permutation(b+1,b+m+n));
	cout<<ans<<endl;
}

Measured memory_bytes: 3644
N=int(input())
L= list(map(int,input().split()))
L_sorted=sorted(L,reverse=False)
count=0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            Li=L_sorted[i]
            Lj=L_sorted[j]
            Lk=L_sorted[k]
            if Li!=Lj!=Lk and Li+Lj>Lk:
                count+=1

print(count)

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

#define pb push_back
#define ll long long
int mo =  1e9+7;
// int dp[1000][1000];
using namespace std;


int main(int argc, char const *argv[])
{
	// ios::sync_withss_stdio(false);
	// cin.tie(0);
	// cout.tie(0);

	int n, k;
	scanf("%d ", &n);

	int a[n][3];
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < 3; ++j)
		{
			scanf("%d", &a[i][j]);
		}
	}

	ll dp[n][3];

	memset(dp, 0, sizeof(dp));

	for(int i = 0; i<3; i++){
		dp[0][i] = a[0][i];
	}

	for (int i = 1; i < n; ++i)
	{
		for (int j = 0; j < 3; ++j)
		{
			dp[i][j] = a[i][j] + max(dp[i-1][(j+1)%3], dp[i-1][(j+2)%3]);
		}
	}

	printf("%lld\n", max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2])));

}




Measured memory_bytes: 7324
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF 2147483647//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

int main() {
    int n;
    cin >> n;
    int digits = digsum(n);
    if(n%digits == 0)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int n;
    int card[52]={0};
    
    scanf("%d\n",&n);
    for(int i=0; i<n; i++){
        char c;
        int a;
        scanf("%c %d\n",&c,&a);
        if(c=='S') card[a-1]=1;
        else if(c=='H') card[a+12]=1;
        else if(c=='C') card[a+25]=1;
        else if(c=='D') card[a+38]=1;
    }
    for(int i=0; i<52; i++){
        if(card[i]==0){
            if(i<13) printf("S ");
            else if(i<26) printf("H ");
            else if(i<39) printf("C ");
            else if(i<52) printf("D ");
            printf("%d\n", i%13+1);
        }
    }
    return 0;
}



Measured memory_bytes: 2732
from time import time
def timer(func):
    def f(*args, **kwargs):
        before = time()
        rv = func(*args, **kwargs)
        after = time()
        print('temps écoulé', after - before)
        return rv
    return f


def A(S): 
    nb = 0
    if S == 'RSR':
        print(1)
        exit
    else:
        for i in S:
            if i == 'R':
                nb = nb+1
        print(nb)


@timer
def B():
    ...

@timer
def C():
    ...


S = input()
A(S)


Measured memory_bytes: 9128
#!/usr/bin/env ruby

n = gets.chomp.to_i

caps = gets.chomp.split(//)

r = 0
caps.each do |c|
  if (c == 'R')
    r += 1
  end
end

if (r > (caps.size / 2))
  puts "Yes"
else
  puts "No"
end


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

using namespace std;

int main(void) {
    string str;
    cin >> str;

    if((str.at(2) == str.at(3)) && str.at(4) == str.at(5)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def solve(data):
    from math import factorial
    fact = factorial(data)
    txt = str(fact)
    ctz = 0
    while txt.endswith('0'):
        ctz += 1
        txt = txt[:-1]
    return ctz


if __name__ == '__main__':
    # ??????????????\???
    while True:
        data = int(input())
        if data == 0:
            break

        # ????????¨???????????¨???
        result = solve(data)
        print(result)

Measured memory_bytes: 7772
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int compare(const void *a, const void *b) {
	return strcmp(a, b);
}

int main(void) {
	int i;
	int n, l;
	char s[100][101];

	scanf("%d %d", &n, &l);
	for (i = 0; i < n; i++)
		scanf("%s", s[i]);

	qsort(s, n, sizeof(char [101]), &compare);

	for (i = 0; i < n; i++)
		printf(s[i]);
	putchar('\n');

	return 0;
}


Measured memory_bytes: 128
using System;

namespace ABC157c
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int N = int.Parse(str[0]);
            int M = int.Parse(str[1]);

            int[] s = new int[M];
            int[] c = new int[M];
            
            for(int i = 0; i < M; i++)
            {
                str = Console.ReadLine().Split(' ');
                s[i] = int.Parse(str[0]);
                c[i] = int.Parse(str[1]);
            }

            bool[] b = new bool[N];
            int[] r = new int[N];

            for(int i = 0; i < N; i++)
            {
                b[i] = false;
                r[i] = -1;
            }
            for (int i = 0; i < M; i++)
            {

                if (b[s[i]-1] && r[s[i]-1] != c[i])
                {
                    Console.WriteLine("-1");
                    return;
                }
                r[s[i]-1] = c[i];
                b[s[i]-1] = true;
            }
            if(N != 1 && r[0] == 0)
            {
                Console.WriteLine("-1");
                return;
            }
            if (N != 1 && r[0] == -1)
            {
                r[0] = 1;
            }
            for (int i = 0; i < N; i++)
            {
                int a = r[i];
                if(a == -1)
                {
                    a = 0;
                }
                Console.Write(a);
            }
            Console.WriteLine("");
        }
    }
}


Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		char[][] A = new char[N][N];
		char[][] B = new char[M][M];
		for(int i = 0;i < N;++i) {
			String s = sc.next();
			for(int j = 0;j < N;++j) {
				A[j][i] = s.charAt(j);
			}
		}
		for(int i = 0;i < M;++i) {
			String s = sc.next();
			for(int j = 0;j < M;++j) {
				B[j][i] = s.charAt(j);
			}
		}
		sc.close();
		
		boolean ans = false;
		for(int ax = 0;ax <= N-M;++ax) {
			for(int ay = 0;ay <= N-M;++ay) {
				boolean flag = true;
				for(int bx = 0;bx < M;++bx) {
					for(int by = 0;by < M;++by) {
						if(A[ax+bx][ay+by] != B[bx][by]) {
							flag = false;
							break;
						}
					}
					if(!flag)break;
				}
				if(flag) {
					ans = true;
					break;
				}
			}
			if(ans)break;
		}
		if(ans)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}


Measured memory_bytes: 22612
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;

    if((a+b)%2==0){
      cout << (a+b)/2 << endl;
    }else{
      cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}


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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

#define int ll

main(){
  vi p = {5, 12, 17, 24, 31};
  
  while(1){
    int n; cin >> n; if(n == 0) break;

    vs w(n); rep(i,n) cin >> w[i];
    vi l(n+1); rep(i,n) l[i+1] = sz(w[i]);
    rep(i,n) l[i+1] += l[i];

    rep(i,n){
      bool f = true;
      rep(j,5) if(not binary_search(all(l),p[j] + l[i])) f = false;
      if(f){
	cout << i + 1 << endl;
	break;
      }
    }
  }
}


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

int main(){
    string str;
    getline(cin,str);
    string str2;
    getline(cin,str2);
    str+=str;
    int pos=str.find(str2);
    if(pos==string::npos){
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3212
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<set>
#define N 300005
#define ll long long
#define db double
#define dbg(x) cout<<#x<<"="<<x<<"\n"
using namespace std;
int n,cnt,ans,tmp,an[N],len;
int main()
{
	int i,s,a,b,j,k;
	scanf("%d%d%d",&n,&a,&b);
	if(a+b>n+1){printf("-1");return 0;}
	if((ll)a*b<n){printf("-1");return 0;}
	for(i=b;i;i--)an[++len]=i;
	tmp=b,cnt=n-b-a+1;
	for(i=2;i<=a;i++)
	{
		an[++len]=tmp+min(cnt,b-1)+1,tmp=an[len];
		for(s=1;s<=min(cnt,b-1);s++)an[++len]=tmp-s;
		cnt-=min(cnt,b-1);
	}
	for(i=1;i<n;i++)printf("%d ",an[i]);
	printf("%d\n",an[n]);
	return 0;
}

Measured memory_bytes: 3328
N = int(input())
a = list(map(int,input().split()))
s = [0]*(len(a)+1)
for i in range(len(a)):
    s[i+1] = s[i] + a[i]
b = {}
for x in s:
    if str(x) not in b:
        b[str(x)] = 1
    else:
        b[str(x)] += 1
n = 0
for x in b:
    n += b[x]*(b[x]-1)/2
print(int(n))

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

#define pb                push_back
#define mp                make_pair
#define all(x)            (x).begin(),(x).end()
#define fi                first
#define se                second
#define vc                vector
#define pii               pair<bint,bint>
#define endl              "\n"
#define rep(i,a,b)        for(bint i=a;i<b;i++)
#define repe(i,a,b)       for(bint i=a;i<=b;i++)
#define bac(i,a,b)        for(bint i=a;i>b;i--)
#define bace(i,a,b)       for(bint i=a;i>=b;i--)
#define fast              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

//CHANGE IF REQ
#define int               long long int
#define bint              int
//-----------------

#define ld                long double
#define mod1              (bint)(1e9 + (bint)7)
#define mod2              (bint)998244353
#define pi                (float)3.14159265358979323846
#define inf               LLONG_MAX
#define ninf              (bint)-1*LLONG_MAX

#define DECIMAL(n)        std::cout << std::fixed << std::setprecision(n)
#define SORT(v)           sort(all(v))
#define RSORT(v)          sort(all(v),greater<bint>())
#define REVERSE(v)        reverse(all(v))

#define trav(a, x)        for(auto& A : x)
#define display(x)        trav(A,x) cout<<A<<endl;
#define pow(i,n)          (bint)pow((bint)i,n)
#define pow2(n)           ((bint)1<<n)
#define sz(x)             (bint)x.size()

typedef std::priority_queue<bint, std::vector<bint>, std::greater<bint> > min_pq;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

inline string inttos(bint a){std::stringstream soso; soso<<a; return soso.str();}
inline bint stoint(const std::string &s) {std::stringstream soso; soso << s; long long x; soso >> x; return x;}
inline std::string inttobin(bint x) {return std::bitset<40>(x).to_string();}
inline void swp(bint &a, bint &b){auto temp=a;a=b;b=temp;}

//pri - 1000000009
//ba  - 937,991,1013,1409,1741

void solve(){
    int n;
    cin>>n;
    DECIMAL(10);
    float x = 2*pi*n;
    cout<<x<<endl; 
}


signed main(){
    fast


    int t=1;
    //cin>>t;
    rep(i,0,t){
       solve();
    }
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

bool f(string s,int n,int k) {
    for(int i=n;i<k/2;i++) {
        if(s[i]!=s[k-i-1])    return false;
    }
    return true;
}

 
int main() {

    string s;
    cin >> s;
    int n=s.size();

    if(f(s,0,n)==true&&f(s,0,(n-1)/2)==true&&f(s,(n+3)/2-1,n)==true)  cout<<"Yes"<<endl;
    else    cout<<"No"<<endl;

 return 0;
}

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

int main(void) {
	long long N=0, M=0, C=0;
	
	
	std::cin >> N >> M >> C;
	long long A[20][20], B[20];
	
	for (int i = 0; i < M; i++) {
		std::cin >> B[i];
	}
	long long a = 0;
	
	long long correct = 0;
	for (int i = 0; i < N; i++) {
		long long ans = C;
		for (int j = 0; j < M; j++) {
			std::cin >> a;
			ans += a*B[j];
		}
		if (ans > 0) {
			correct += 1;
		}
	}

	

	std::cout << correct << std::endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int N=0;
    long x=0;
    long count=0;
    long a[100002]={0};
    scanf("%d %ld",&N,&x);
    for(int i=0;i<N;i++){
        scanf("%ld",&a[i]);
    }
    for(int i=0;i<N-1;i++){
        if(i==0&&a[i]>x){
            count+=a[i]-x;
            a[i]=x;
        }
        if(a[i]+a[i+1]>x){
            count+=a[i]+a[i+1]-x;
            a[i+1]-=a[i]+a[i+1]-x;
        }
    }
    printf("%ld\n",count);
    return 0;
}

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

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#define ll              long long int
#define ull             unsigned long long
#define vi              vector<int>
#define vl              vector<ll>
#define vvi             vector<vector<int> >
#define pi              pair<int,int>
#define vii             vector<pi>

#define sz(v)           ((int)(v).size())
#define all(s)          s.begin(),s.end()
#define allr(s)         s.rbegin(),s.rend()
#define unq(c)          (sort(all(c)), c.resize(distance(c.begin(),unique(all(c)))))
#define get_pos(c,x)    (lower_bound(all(c),x)-c.begin())

#define MS0(v)          memset((v), 0, sizeof((v)))
#define MS1(v)          memset((v), -1, sizeof((v)))
#define LEN(v)          strlen(v)

#define MP              make_pair
#define pb              push_back
#define pob             pop_back
#define ff              first
#define ss              second
#define sc              scanf
#define pf              printf
#define endl            "\n"

#define TEST_CASE       int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define PRINT_CASE      printf("Case %d: ",cs)

#define vpf(v)          for(int i=0;i<v.size();i++){cout<<v[i];if(i!=v.size()-1)cout<<" ";else cout<<"\n";}
#define vsc(v)          for(int i=0;i<v.size();i++)cin>>v[i];

#define REP(i, n)       for (int i = 0; i < (n); i++)
#define REPP(i, a, b)   for (int i = (a); i < (b); i++)
#define FOR(i, a, b)    for (int i = (a); i <= (b); i++)
#define FORS(i, s)      for (int i = 0; s[i]; i++)

#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fileio          freopen("in.txt","r",stdin);freopen("out.txt","w",stdout)

#define intlim          2147483648
#define infinity        (1LL<<50)

#define gcd(a, b)       __gcd(a, b)
#define lcm(a, b)       ((a)*((b)/gcd(a,b)))


int on_bit(int N,int pos){return N = N | (1<<pos);}
int off_bit(int N,int pos){return N = N & ~(1<<pos);}
bool check_bit(ll N,int pos){return (bool)(N & (1<<pos));}


#define start_clock     clock_t tStart = clock()
#define end_clock       printf("\n>>Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC)



//____________________________________________________________________________________________________________




int main(){ 
    string s;
    cin>>s;
    if(s.size() == 6){
        if(s[2]==s[3] && s[4]==s[5])cout<<"Yes\n";
        else cout<<"No\n";
    }
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n;
    cin >> n;
    cout << ( n - 1 ) / 2 << endl;
    return 0;
}


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

int main() {
  int x;
  cin >> x;
  
  int a = 1,b;
  while(true){
    long n = a * a * a * a * a;
    for(int i = a*(-1) + 1; i < a; i++){
      if(n == x + i*i*i*i*i){
        b = i;
        cout << a << " " << b << endl;
        return 0;
      }
    }
    a++;
  }
}

Measured memory_bytes: 3592
//# define FLAG
///delet....................................
# include   <bits/stdc++.h>
using namespace std;
# define    pb                      push_back
# define    mp                      make_pair
# define    IOS                     ios::sync_with_stdio(false)
# define    mem(a,b)                memset(a,b,sizeof(a))
# define    FO(i,n,a)               for(int i=n; i>=a; --i)
# define    FOR(i,a,n)              for(int i=a; i<=n; ++i)
# define    MAX(a,b)                (a)>(b)?(a):(b)
# define    MIN(a,b)                (a)<(b)?(a):(b)
# define    lowbit(x)               ((x)&(-x))
# define    LINF                    0xfcfcfcfcfcfcfcf
# define    INF                     0x3f3f3f3f
# define    MOD                     1000000007
# define    eps                     0.00000001
# define    pi                      3.141592653
# define    ee                      2.718281828459
# define    hr                      ptc('\n')
# define    kb                      ptc(' ')
# define    bug                     puts("H");
# pragma    comment(linker,"/STACK:1024000000,1024000000")
typedef     pair<int,int>           PII;
typedef     vector<int>             VI;
typedef     long long               LL;
typedef     unsigned long long      ULL;
inline char gtc() {
    static char buf[100000],*p1=buf-1,*p2=buf-1;
    return p1==p2&&(p2=(p1=buf-1)+fread(buf,1,100000,stdin),p1==p2)?EOF:*++p1;
}
static char bufout[2000000],*chout=bufout-1;
inline void ptc(char ch) {
    *++chout=ch;
}
# define    Template                LL
inline Template read() {
    char ch=gtc();
    while(!(ch>='0'&&ch<='9'||ch=='-'))ch=gtc();
    Template sum=0,flag=(ch=='-'?(ch=gtc()):0);
    while(ch>='0'&&ch<='9')sum=sum*10+ch-'0',ch=gtc();
    return flag?-sum:sum;
}
inline void out(Template x) {
    if(x<0)ptc('-'),x=-x;
    if(x>9)out(x/10);
    ptc(x%10+'0');
}
inline void write() {
    fwrite(bufout,1,chout-bufout+1,stdout);
}
///coding...................................

int a[200005],b[200005];
map<int,int>M;

int main() {
    IOS;
#ifdef FLAG
    //freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif
    int n,m;
    cin>>n;
    FOR(i,1,n)cin>>a[i],++M[a[i]];
    cin>>m;
    FOR(i,1,m) {
        cin>>b[i];
        if(M[b[i]])--M[b[i]];
        else {
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    return 0;
}










///delete FLAG..............................




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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

typedef long long ll;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;

/*************************************************************************/

int dfs(int v, VVI &g) {
    VI val;
    for (int u : g[v]) {
        val.pb(dfs(u, g));
    }
    
    val.pb(0);
    sort(val.begin(), val.end(), greater <int> ());
    
    FORE(i,val) val[i] += i + 1;
    return *max_element(val.begin(), val.end());
}

/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    int n;
    cin >> n;
    
    VVI g(n);
    FOR(i,1,n-1) {
        int par;
        cin >> par; par--;
        
        g[par].pb(i);
    }
    
    cout << dfs(0, g) - 1;

    return 0;
}

/*************************************************************************/


Measured memory_bytes: 15104
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;
int num;
double x,yy1,yy2,yy3,yy4;
const double eps = 1e-8;
const double inf = 1e20;
const double pi = acos(-1.0);
int sgn(double x){
    if(fabs(x)<eps){
        return 0;
    }
    if(x<0){
        return -1;
    }else{
        return 1;
    }
}
struct Point{
    double x,y;
    Point(){}
    void input(){
        scanf("%lf%lf",&x,&y);
    }
    Point(double _x,double _y){
        x = _x;y = _y;
    }
    bool operator < (Point b)const{
        return sgn(x-b.x)==0?sgn(y-b.y)<0:x<b.x;
    }
    Point operator - (const Point &b)const{
        return Point(x-b.x,y-b.y);
    }
    double operator *(const Point &b)const{
        return x*b.x+y*b.y;
    }
    double operator ^(const Point &b)const{
        return x*b.y-y*b.x;
    }
    double distance(Point p){
        return hypot(x-p.x,y-p.y);
    }
};
struct Line{
    Point s,e;
    Line(){}
    Line(Point _s,Point _e){
        s = _s;e = _e;
    }
    // 线段长度
    double length(){
        return s.distance(e);
    }
    // 判断线段是否相交
    int segcrossseg(Line v){
        int d1 = sgn((e-s)^(v.s-s));
        int d2 = sgn((e-s)^(v.e-s));
        int d3 = sgn((v.e-v.s)^(s-v.s));
        int d4 = sgn((v.e-v.s)^(e-v.s));
        if((d1^d2) == -2 && (d3^d4)==-2){
            return 2;
        }
        return (d1==0&&sgn((v.s-s)*(v.s-e))<=0)||(d2==0&&sgn((v.e-s)*(v.e-e))<=0)||(d3==0&&sgn((s-v.s)*(s-v.e))<=0)||(d4==0&&sgn((e-v.s)*(e-v.e))<=0);
    }
    // 点线距离
    double dispointtoline(Point p){
        return fabs((p-s)^(e-s))/length();//面积除以高
    }
    // 点到线段距离（当是钝角的时候，距离不是延长线，而是到两个端点的最小值）
    double dispointtoseg(Point p){
        if(sgn((p-s)*(e-s))<0||sgn((p-e)*(s-e))<0){
            return min(p.distance(s),p.distance(e));
        }
        return dispointtoline(p);
    }
    // 线段到线段的距离
    // 用之前判断是否相交
    double dissegtoseg(Line v){
        return min(min(dispointtoseg(v.s),dispointtoseg(v.e)),min(v.dispointtoseg(s),v.dispointtoseg(e)));
    }
};
int main(){
    int q;
    scanf("%d",&q);
    Point p0,p1,p2,p3;
    while(q--){
        p0.input();
        p1.input();
        p2.input();
        p3.input();
        Line line1(p0,p1);
        Line line2(p2,p3);
        double ans = 0;
        if(line1.segcrossseg(line2) == 0){
            ans = line1.dissegtoseg(line2);
        }
        printf("%.10f\n",ans);
    }

    return 0;
}



Measured memory_bytes: 3292
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int n, a[100];
    
    scanf("%d", &n);
    
    for (int i=0; i<n; i++) {
        scanf("%d", &a[i]);
    }
    for (int i=n-1; i>=0; i--) {
        printf("%d", a[i]);
        if(i != 0) {
            printf(" ");
        } else {
            printf("\n");
        }
    }
    
    return 0;
}



Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int n,i,g;
  long a,b,h[100010],l=0,r=1e9,mid,s;
  cin >> n >> a >> b;
  for (i=0;i<n;i++) cin >> h[i];
  while (r-l>1){
    mid=(l+r)/2;
    s=0;
    for (i=0;i<n;i++) if (h[i]>b*mid) s+=(h[i]-b*mid+a-b-1)/(a-b);
    if (s>mid){
      l=mid;
      g=1;
    }else{
      r=mid;
      g=0;
    }
  }
  if (g) mid++;
  cout << mid << endl;
  return 0;
}

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

if N < 100:
    print(min(N, 9))
elif N < 1000:
    print((N-99) + 9)
elif N < 10000:
    print(909)
elif N < 100000:
    print((N-9999) + 909)
elif N == 100000:
    print(90909)

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main(void){
    int H, W, M, hbuf, wbuf;
    cin >> H >> W >> M;
    vector<int> TargetH(H, 0);
    vector<int> TargetW(W, 0);
    set<pair<int, int>> Targets;
    vector<int> maxRows;
    vector<int> maxColumns;
    for(int i=0; i<M; i++){
        cin >> hbuf >> wbuf;
        hbuf--;
        wbuf--;
        TargetH[hbuf]++;
        TargetW[wbuf]++;
        Targets.insert(pair<int, int>(hbuf, wbuf));
    }
    int maxH = 0;
    int maxW = 0;
    for(int i=1; i<H; i++)if(TargetH[maxH] < TargetH[i])maxH = i;
    for(int i=1; i<W; i++)if(TargetW[maxW] < TargetW[i])maxW = i;
    for(int i=0; i<H; i++)if(TargetH[maxH] == TargetH[i])maxRows.push_back(i);
    for(int i=0; i<W; i++)if(TargetW[maxW] == TargetW[i])maxColumns.push_back(i);
    int intBombatTarget = -1;
    bool breakable = false;
    if(maxColumns.size()*maxRows.size() <= M){
        for(int row: maxRows){
            for(int column: maxColumns){
                if(Targets.find(pair<int, int>(row, column))==Targets.end()){
                    intBombatTarget = 0;
                    breakable = true;
                    break;
                }else{
                    Targets.erase(pair<int, int>(row, column));
                }
            }
            if(breakable)break;
        }
    }else intBombatTarget = 0;
    cout << TargetH[maxH]+TargetW[maxW]+intBombatTarget << endl;
    return 0;
}

Measured memory_bytes: 23796
#include<stdio.h>
int main(){

  int i,n,k,w[100001];

  scanf("%d", &n );
  scanf("%d", &k );

  for ( i = 0; i < n; i++ ){
    scanf("%d", &w[i] );
  }

  int P,sum,cnt,min,max;

  min = 1;
  max = 1000000000;

  while(1){

    sum = 0;
    cnt = 1;
    P = ( min + max ) / 2;

    for ( i = 0; i < n; i++ ){

      if ( w[i] > P ) {
	cnt = k + 1;
	break;
      } else if ( sum + w[i] > P ){
	sum = w[i];
	cnt += 1;
      } else {
	sum = sum + w[i];
      }
    
    }

    if ( min == max ){
      P = min;
      break;
    } else if ( cnt > k ){
      min = P + 1;      
    } else {
      max = P;
    }

  }

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

  return 0;

}

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

char map[20][20]={0};
int number=1;
int h,w;

void debug(void) {
	for(int i=0;i<h;i++) { for(int j=0;j<w;j++) putchar(map[i][j]); putchar('\n'); }
}

void trace(int x,int y) {
	if(x-1 >= 0 && map[y][x-1]=='.') {
		map[y][x-1] = '@';
		trace(x-1,y);

		number++;
	}

	if(x+1 < w && map[y][x+1]=='.') {
		map[y][x+1] = '@';
		trace(x+1,y);
		number++;
	}
	if(y-1 >= 0 && map[y-1][x]=='.') {
		map[y-1][x] = '@';
		trace(x,y-1);
		number++;
	}

	if(y+1 < h && map[y+1][x]=='.') {
		map[y+1][x] = '@';
		trace(x,y+1);
		number++;
	}
}

int main(void) {
	char buf[21];

	int x,y;


	for(;;) {

		number=1;
		scanf("%d %d\n",&w,&h);

		if(w==0 || h==0) break;

		for(int i=0;i<h;i++) {
			fgets(buf,1024,stdin);

			memcpy(&map[i],buf,w);
		}


		for(int j=0;j<h;j++) {
			for(int i=0;i<w;i++) {
				if(map[j][i] == '@'){
					x=i;y=j;
				}
			}
		}


		trace(x,y);

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

	}

	//debug();

	return 0;
}

Measured memory_bytes: 1056
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define digit(x) floor(log10(x))+1
#define mod 1000000007
typedef long long ll;
typedef long double ld;
typedef vector<vector<ll>> matrix;
typedef vector<ll> arr;
typedef vector<string> vs;
typedef vector<pair<ll,ll>> pv;
#define in1(x) scanf("%lld",&x)
#define in2(x,y) scanf("%lld %lld",&x,&y)
#define in3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define all(x) x.begin(),x.end()
#define debug(x) cerr << #x << " is " << x << endl;
int main(){
    fast;
    ll n,m;
    cin>>n>>m;
    ll x=((n*(n-1))/2);
    ll y=((m*(m-1))/2);
    cout<<x+y<<endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define mod 1000000007
using namespace std;

long long n,m,x[100010],y[100010],sum1,sum2;

int main()
{
//我最强啦~
	scanf("%lld%lld",&n,&m);
	for(int i=1; i<=n; i++)
	{
		scanf("%lld",&x[i]);
	}
	for(int i=1; i<=m; i++)
	{
		scanf("%lld",&y[i]);
	}
	for(int i=1; i<=n; i++)
	{
		sum1+=(i-1)*x[i]-(n-i)*x[i];
	}
	sum1%=mod;
	for(int i=1; i<=m; i++)
	{
		sum2+=(i-1)*y[i]-(m-i)*y[i];
	}
	sum2%=mod;
	printf("%lld\n",sum1*sum2%mod);
}

Measured memory_bytes: 1792
/* #                          */

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#include <deque>
#include <map>
//#pragma warning(disable:4996)

using namespace std;


/** Type Define **/
typedef long long int           ll;
typedef pair<int, int>          pii;
typedef pair<ll, ll>            pll;
typedef vector<string>          vs;
typedef vector<bool>            vb;
typedef vector<int>             vi;
typedef vector<long long>		vl;
typedef vector<vi>              vvi;
typedef vector<vl>				vvl;
typedef vector<char>            vch;

constexpr int               inf = 0x3f3f3f3f;
constexpr long long 		INF = 9123456789123456789;
constexpr long long         MOD = 1000000007LL;
/*************************************************/
int N;
vi a;

void sol() {

}

int main() {
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cin.tie(nullptr);
    cin >> N;
    a.resize(N);
    for (auto& x : a)
        cin >> x;
    bool ans(true);
    sort(a.begin(), a.end());
    for (int i = 0; i < N-1; i++) {
        if (a[i] == a[i + 1])
            ans = false;
    }
    if (ans) cout << "YES\n";
    else cout << "NO\n";

    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
 
int main(void) {
	int s;
	short int a[100000];
	int j, i = 0;
 
	scanf("%d", &s);
 
	while (1) {
		if (s % 2 == 0) {
			a[i] = s;
			s = s / 2;
		}
		else {
			a[i] = s;
			s = 3 * s + 1;
		}
 
		for (j = 0; j <= i; j++) {
			if (a[j]==s) {
				printf("%d\n", i+2);
				return 0;
			}
		}
 
		i++;
	}
 
	return 0;
}

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

int main() {
    int n, k;
  	cin >> n >> k;
  	vector<int> v(n);
  	rep(i, n) {
    	cin >> v.at(i);
    }
  	sort(v.begin(), v.end(), greater<int>());
  	int sum = 0;
  	rep(i, k) {
    	sum += v[i];
    }
  	cout << sum << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  ll ans=0;
  while ( n-- ) {
    int l,r;
    cin >> l >> r;
    r++;
    ans=ans+r-l;
  }
  cout << ans << '\n';
  return 0;
}

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

using namespace std;

#define ll long long
#define M 1005000
#define ii pair<ll, ll>
#define fi first
#define se second

ll n, cnt = 0, a[M], l[M], r[M];

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    string s;
    cin >> s;
    n = s.size();
    s = " " + s;
    for (int i = 1; i <= n; i++){
        r[i] = r[i - 1];
        if (s[i] == 'R') r[i] = i;
    }
    for (int i = n; i > 0; i--){
        l[i] = l[i + 1];
        if (s[i] == 'L') l[i] = i;
    }
    for (int i = 1; i <= n; i++){
        if (s[i] == 'L'){
            if ((i - r[i]) % 2 == 1) a[r[i] + 1]++;
            else a[r[i]]++;
        }
        else{
            if ((l[i] - i) % 2 == 1) a[l[i] - 1]++;
            else a[l[i]]++;
        }
    }
    for (int i = 1; i <= n; i++) cout << a[i] << ' ';
    return 0;
}

Measured memory_bytes: 9580
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    String t = sc.next();
    String ans = "";
    for(int i = 0; i < n; i++) {
      ans += String.valueOf(s.charAt(i));
      ans += String.valueOf(t.charAt(i));
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
n=int(input())
v=list(map(int,input().split()))
e=[0 for _ in range(1,10**5+2)]
o=[0 for _ in range(1,10**5+2)]
for i in range(0,n,2):
    e[v[i]]+=1
    o[v[i+1]]+=1
ans=0
if len(set(v))==1:
    ans=n//2
else:
    me=max(e)
    mo=max(o)
    mei=e.index(me)
    moi=o.index(mo)
    if mei==moi:
        e[mei]=0
        o[moi]=0
        ans += n-me-max(max(e),max(o))
    else:
        ans=n-max(e)-max(o)
print(ans)

Measured memory_bytes: 17020
from collections import deque
H, W = map(int, input().split())
g = [list(input()) for i in range(H)]
direction = [[0,1],[1,0],[0,-1],[-1,0]]
ans=0
for sh in range(H):
    for sw in range(W):
        #スタート地点が壁ならスキップ
        if g[sh][sw]=="#":
            continue
        dist=[[-1]*W for i in range(H)]
        dist[sh][sw] = 0
        que = deque([[sh,sw]])

        while que:
            nh, nw = que.pop()
            for dh, dw in direction:
                if not ((0 <= nh + dh < H) and (0 <= nw + dw < W)):
                    continue
                if g[nh+dh][nw+dw]=="#":
                    continue
                if dist[nh+dh][nw+dw]!=-1:
                    continue
                
                #dist[nh+dw][nw+dw] = dist[nh][nw]+1
                #que.appendleft([nh + dh,nw+dw])
                dist[nh + dh][nw + dw] = dist[nh][nw] + 1
                que.appendleft([nh + dh, nw + dw])
        ans = max (ans, max([max(d) for d in dist]))
print(ans)



Measured memory_bytes: 3444
#include<iostream>
#include<cstdio>
#include<cctype>
using namespace std;

int main(){
  char c;
  while(1){
    scanf("%c", &c);
    if(isalpha(c)){
      if(islower(c)) printf("%c", toupper(c));
      if(isupper(c)) printf("%c", tolower(c));
    }else printf("%c", c);
    if(c=='\n') break;
  }
  return 0;
}

Measured memory_bytes: 3148
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = a+b;

        if (a % 3 == 0 || b % 3 == 0 || c % 3 == 0)
            System.out.println("Possible");
        else
            System.out.println("Impossible");
    }
}


Measured memory_bytes: 35732
package main

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

func main() {
	Takahashi, Aoki, Count := readInt(), readInt(), readInt()
	Takahashi -= Count
	if Takahashi < 0 {
		Aoki -= abs(Takahashi)
		Takahashi = 0
		if Aoki < 0 {
			Aoki = 0
		}
	}

	fmt.Println(Takahashi, Aoki)
}

/////////////////////////////////////////
var scanner = bufio.NewScanner(os.Stdin)

func init() {
	scanner.Split(bufio.ScanWords)
	//scanner.Split(bufio.ScanLines)
}

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	return t
}

func Loop(start, end int, f func(i int)) {
	for i := start; i < end; i++ {
		f(i)
	}
}

func abs(i int) int {
	if i >= 0 {
		return i
	} else {
		return i * -1
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define OP ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> pii;
const int inf = int(1e9);
const int mod = inf + 7;
const double PI = acos(-1.0);
using namespace std;
const int N = 1e5 + 155;
template<typename T>
inline void read(T&x){
    x=0;int f=1;char ch = getchar();
    while(ch<'0' ||ch>'9'){ if(ch=='-')f=-1;ch=getchar(); }
    while(ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
    x*=f;
}

void solve(){
    int n;
    cin >> n;
    cout << "Christmas ";
    for(int i = 25; i > n; i--) {
        cout << "Eve ";
    }
}
 
int main(){
    OP
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

ll gcd(ll x, ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}

bool bfs(vector<vector<int>> g, vector<int> &dist, int sv){
	queue<int> q;
	q.push(sv);
	dist[sv]=0;
	while(!q.empty()){
		int now = q.front(); q.pop();
		for(auto v : g[now]){
			if(dist[v]!=-1) continue;
			dist[v] = dist[now]+1;
			q.push(v);
		}
	}
}

int main(void) {
	string n; cin >> n;	
	int d; cin >> d;
	vi v; rep(i,n.size()) v.push_back(n[i]-'0');
	int l=v.size();
	vector<vector<vector<ll>>> dp(l+1,vvll(2,vll(d,0)));
	dp[0][0][0]=1;
	rep(i,l)rep(j,2)rep(k,d){
		for(int x=0; x<=(j?9:v[i]); x++){
			dp[i+1][j||x!=v[i]][(k+x)%d] += dp[i][j][k];
			dp[i+1][j||x!=v[i]][(k+x)%d] %= MOD;
		}
	}
	out( ((dp[l][0][0]+dp[l][1][0])%MOD -1ll + MOD )%MOD);
}




Measured memory_bytes: 17152
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
	int N;
	cin >> N;
	vector<int> vArray(N);
	REP(idx, N) {
		cin >> vArray[idx];
	}

	//sort
	sort(ALL(vArray));

	double value = vArray[0];

	FOR(idx, 1, N) {
		value = (value + (double)vArray[idx]) / 2.0;
	}

	cout << value << endl;

	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) v.erase(remove(v.begin(), v.end(), a), v.end())
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i) = 0; (i) <= (n); (i)++)
using namespace std;

int N;

signed main()
{
	cin >> N;
	REP(h, 3500)
	{
		REP(n, 3500)
		{
			int a = N * h * n;
			int b = 4 * h * n - (N * n + N * h);
			if (b > 0 && (a % b == 0))
			{
				cout << h << " " << n << " " << (a / b);
				return 0;
			}
		}
	}
}

Measured memory_bytes: 384
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String w = scanner.next();
		Map<String, Integer> appear_num = new HashMap<String, Integer>();
		for (int i = 0; i < w.length(); i++) {
			if(!appear_num.containsKey(w.substring(i,i+1))) {
				appear_num.put(w.substring(i,i+1), 1);
			}
			else {
				appear_num.put(w.substring(i,i+1),
						appear_num.get(w.substring(i,i+1))+1);
			}
		}

		for(Map.Entry<String,Integer> entry : appear_num.entrySet()) {
			if(entry.getValue() % 2 !=0) {
				System.out.println("No");
				System.exit(0);
			}
		}

		System.out.println("Yes");
	    scanner.close();
		}
}


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


#define ll          long long
#define uint        unsigned int 
#define ld          long double
#define SAM         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define mod         1000000007
#define mxn         200005
#define pb          push_back
#define pii         pair<int,int>
#define f           first
#define s           second
#define sz(x)       (int)x.size()
#define all(x)      x.begin(),x.end()

using namespace std;


int main()
{
    SAM;
    string s,t;
    cin>>s>>t;
    int count=0;
    FOR(i,0,s.length())
    {
        if(s[i]!=t[i])
            count++;
    }
    cout<<count;
    
    return 0;
}




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

int main() {
	int N, ans = 0;
	char C[300][300];
	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> C[i][j];
		}
	}
	for (int i = 0; i < N; i++) {
		char D[300][300];
		bool check = true;
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < N; k++) {
				D[j][k] = C[(j + i) % N][k];
			}
		}
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < N; k++) {
				if (D[j][k] != D[k][j]) check = false;
			}
		}
		if (check) ans += N;
	}
	cout << ans;
}

Measured memory_bytes: 512
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
using namespace std;
const int maxn=200010,inf=0x3f3f3f3f;
int a[maxn],n,logs[maxn],d[2][maxn][30],pos[maxn];
struct cyc{
	int l,r,x;
	bool operator <(const cyc &a)const
	{return x>a.x;}
};
priority_queue<cyc>q;

void RMQ_INIT(int k){
	for(int j=1;(1<<j)<=n;j++)
		for(int i=1;i+(1<<j)-1<=n;i++)
			d[k][i][j]=min(d[k][i][j-1],d[k][i+(1<<(j-1))][j-1]);//printf("d[%d][%d][%d]=%d\n",k,i,j,d[k][i][j]);
}
int rmq(int l,int r,int k){
	int K=logs[r-l+1]; 
 	return min(d[k][l][K],d[k][r-(1<<K)+1][K]);
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		d[i&1][i][0]=a[i];//1奇数 
		d[(i&1)^1][i][0]=inf;//0偶数 
		pos[a[i]]=i;//因为是排列可以直接记位置，省去RMQ的位置记录。 
	}
	logs[0]=-1;for(int i=1;i<=n;i++)logs[i]=logs[i>>1]+1;
	RMQ_INIT(0);RMQ_INIT(1);
	q.push((cyc){1,n,rmq(1,n,1)});
	int L,R,p1,p2;
	while(!q.empty()){
		cyc x=q.top();q.pop();
		L=x.l;R=x.r;p1=pos[x.x];
		p2=pos[rmq(p1+1,R,(p1&1)^1)];
		printf("%d %d ",a[p1],a[p2]);
		if(L<p1)q.push((cyc){L,p1-1,rmq(L,p1-1,(L&1))});
		if(p1<p2-1)q.push((cyc){p1+1,p2-1,rmq(p1+1,p2-1,(p1+1)&1)});
		if(p2<R)q.push((cyc){p2+1,R,rmq(p2+1,R,(p2+1)&1)});
	}
	return 0;
}

Measured memory_bytes: 51320