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

#define rep(i,n) for(int i = 0; i < n; i++)
#define rrep(i,n) for(int i = n - 1; i >= 0; i--)
#define REP(i,k,n) for(int i = k; i < n; i++)

#define vi vector<int>
#define pb push_back
using namespace std;

int main(){
    int n,m;
    while(cin >> n >> m,n) {
        vi hc,tc;
        int tmp;
        int tsum = 0,hsum = 0;
        rep(i,n){
            cin >> tmp;
            tc.pb(tmp);
            tsum += tmp;
        }
        rep(i,m){
            cin >> tmp;
            hc.pb(tmp);
            hsum += tmp;
        }
        int dis = tsum - hsum;
        if(dis % 2 != 0) {
            cout << -1 << endl;
            continue;
        }
        dis /= 2;
        int msum = 1000000,nt,nh;
        rep(i,n) rep(j,m){
            if(tc[i] - hc[j] == dis && msum > tc[i] + hc[j]) {
                msum = tc[i] + hc[j];
                nt = tc[i]; nh = hc[j];
            }
        }

        if(msum == 1000000) cout << -1 << endl;
        else cout << nt << " " << nh << endl;
    }
    return 0;

}



Measured memory_bytes: 3136
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main(void){
    int i;
    int N;
    long m = 1;
    long a[100000];
    int ng = 0;
    int zero = 0;

    scanf("%d", &N);

    for(i = 0;i < N;i++){
        long prv;
        scanf("%ld", &a[i]);
        prv = m;
        m *= a[i];
        if(prv > m || m > 1000000000000000000) ng = 1;
        if(a[i] == 0) zero = 1;
    }

    if(zero) puts("0");
    else if(ng) puts("-1");
    else printf("%ld", m);

    return 0;
}


Measured memory_bytes: 2516
/// Be Kind :)
#include <bits/stdc++.h>
using namespace std;
 
#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("Os")

/*				Who knew evil girls had the prettiest face					*/

/*				We pop out at your party, I'm with the gang
				And it's gon' be a robbery, so tuck ya chain
				I'm a killer girl, I'm sorry, but I cannot change
				We ain't aiming for your body, shots hit you brain
				We come from poverty, man, we ain't have a thing
				It's a lot of animosity, but they won't say my name
				Them killers rock with me, lil' nigga, don't get banged
				'Cause they'll do that job for me while I hop on a plane	*/

/*				I take you to the candy shop								*/

/*				Baby, let me put your panties to the side
				I'ma make you feel alright
				'Cause I'ma give you what you need, yeah					*/

/*				Ooooh ooh, it's me, myself and I
				Solo ride until I die, 'cause I got me for life				*/

/*				So I ball So hard, muh'fuckas wanna find me					*/

/*				Bitch, where you when I was walkin'?
				Now I run the game, got the whole world talkin'				*/
 
/*				Niggas been counting me out
				I'm counting my bullets, I'm loading my clips
				I'm writing down names, I'm making a list					*/

/*				Fuck your friendship, I meant it							*/

/*				The Chanel or Balenciaga, Louis and Vuitton
				She know I got Fendi, Prada when I hit Milan				*/

/*				I ran away, I don't think I'm coming back home				*/
 
#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
 
typedef int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ll maxn=1e5+10, maxm=1e5+10, lg=21, mod=1e9+7, inf=1e18;


ll n,a[maxn],pp[maxn];
vector<ll> g[maxn];

void dfs(ll v,ll p=0){
	if(SZ(g[v])==1){ pp[v]=a[v]; return; }
	ll sum=0,mxm=0;
	for(auto u:g[v])if(u!=p){ dfs(u,v);
		sum+=pp[u];
		mxm=max(mxm,pp[u]);
	}
	if(sum<a[v] || 2*a[v]<sum || a[v]<mxm){
		cout<<"NO";
		exit(0);
	}
	pp[v]=2*a[v]-sum;
}

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<n;i++){
		ll v,u; cin>>v>>u;
		g[v].pb(u), g[u].pb(v);
	}
	if(n==2) return cout<<(a[1]==a[2] ? "YES":"NO"),0;
	ll v=0; for(int i=1;i<=n;i++)if(SZ(g[i])>1) v=i;
	dfs(v);
	if(pp[v]) return cout<<"NO",0;
	cout<<"YES";
	
	return 0;
}



 


Measured memory_bytes: 15104
#include <bits/stdc++.h>
#include <random>
using namespace std;
#define init_random mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define contests_de_diya_kar 0
#define PB push_back
#define MP make_pair
#define int long long
#define sd(n) scanf("%lld", &n)
#define pd(n) printf("%lld", n)
#define MOD ((long long) (1000*1000*1000 + 7))
#define inf (int) 2e15
#define exit(a, b) return cout << a, b;
#define eps (double)1e-9
#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define vi vector<int>
#define vb vector<bool>
#define all(v) v.begin(), v.end()
#define ll long long 
#define pii pair<int, int>
#define mii map<int, int> 
#define print(stuff) cout << stuff << endl
#define len(stuff) stuff.size()

int exp (int a, int b) {
  if (b == 0) return 1LL;
  int ans = exp(a, b/2);
  ans = (ans * ans);
  if (b % 2) ans = (ans * a);
  return ans;
}

int root (int n, int i) {
  int hi = min((int) pow(n, (long double) 1 / (long double) i) + 5LL, n);
  int lo = max(1LL, (int) pow(n, (long double) 1 / (long double) i) - 5LL);

  while (lo < hi - 3) {
    int mid = (lo + hi) / 2;
    int calc = exp(mid, i);
    if (calc > n) {
      hi = mid - 1;
    }
    else {
      lo = mid;
    }
  }

  int ret = lo;
  for (int j = lo; j <= hi + 4LL; j += 1) {
    if (exp(j, i) <= n) ret = j;
  } 
  return ret;
}

vi memo((int) 1e6 + 1, -1);
mii memo_mp;
int f (int n) {
  if (n <= (int) 1e6) {
    if (memo[n] != -1) return memo[n];
  }
  else if (memo_mp.find(n) != memo_mp.end()) return memo_mp[n];
  int ans = n - 1;
  for (int p = 2; p <= 60LL; p += 1) {
    int rt = root(n, p);
    if (rt <= 1) break;
    ans -= f(rt);
  }
  if (n <= (int) 1e6) memo[n] = ans;
  else memo_mp[n] = ans;
  return ans;
}

signed main()
{
  start_routine;
  #ifndef ONLINE_JUDGE
 // freopen("input.txt", "r", stdin);
  #endif

  int a, b;
  cin >> a >> b;

  if (a % 2 == 1 and b % 2 == 1) {
    cout << "Yes";
  }
  else cout << "No";
  end_routine;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll N,maxa=0,ans=0;
  cin>>N;
  unordered_map<ll,ll> mp;
  vector<ll> A(N);
  for(ll i=0;i<N;i++){
    cin>>A.at(i);
    mp[A.at(i)]++;
    if(maxa<A.at(i)){maxa=A.at(i);}
  }
  if(N==1||mp[1]==1){cout<<1<<endl;return 0;}
  if(mp[1]>1){cout<<0<<endl;return 0;}
  sort(A.begin(),A.end());
  for(ll i=0;i<N;i++){
    if(mp[A.at(i)]>1){mp[A.at(i)]=0;}
    if(mp[A.at(i)]==1){ans++;}
    for(ll j=2;j*A.at(i)<=maxa;j++){
      if(mp[j*A.at(i)]>0){mp[j*A.at(i)]=0;}
    }
  }
  cout<<ans<<endl;
}

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

int main(void)
{
    int n;
    cin >> n;
    int a[n+1];
    int b[n];
    int i;
    for(i=1;i<n;i++)
    {
        cin >> b[i];
    }
    a[1] = b[1];
    a[n] = b[n-1];
    for(i=2;i<n;i++)
    {
       if((b[i] > b[i-1]) && (b[i] > b[i+1]))
       {
           a[i] = b[i-1];
       } 
       else if(b[i] <= b[i-1])
       {
           a[i] = b[i];
       }
       else if(b[i] > b[i-1])
       {
           a[i] = b[i-1];
       }
    }
    int sum=0;
    for(i=1;i<n+1;i++)
    {
        sum += a[i];
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

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

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */

int main(){
    int n,d;
    cin >> n >> d;
    cout << ceil((n) / (d*2.0+1)) << endl;
}



Measured memory_bytes: 888
#include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define ll long long
#define mp make_pair
#define ii pair<ll,ll>
using namespace std;
int main()
{
  int k,x;
  cin>>k>>x;
  int L = x-k+1;
  int R = x+k-1;
  for(int i=L;i<=R;i++)
    cout<<i<<" ";
}


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

int main() {
  int n;
  string s;

  cin >> n >> s;
  int sum;
  string x, y;
  int w = 0, e = 0;

  for (int k = 1; k < (int)s.size(); k++) {
    if (s[k] == 'E') e++;
  }
  int min = e;
  for (int k = 1; k < (int)s.size(); k++) {
    if (s[k-1] == 'W') {
      w++;
    }
    if (s[k] == 'E') {
      e--;
    }
    sum = w + e;
    if (min > sum) min = sum;
  }
  cout << min << endl;
}

Measured memory_bytes: 900
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, X, Y, Z = MAP()
M = X + Y + Z

# XYZとの一致をチェックするビット列
check = 1<<(X+Y+Z-1) | 1<<(Y+Z-1) | 1<<(Z-1)
dp = list2d(N+1, 1<<(M-1), 0)
# dp[i][S] := i個目まで見て、前の値M-1以下までの集合がSの時の、XYZを含まないものの通り数
dp[0][0] = 1
msk1 = (1<<M) - 1
msk2 = (1<<(M-1)) - 1
for i in range(N):
    for S in range(1<<(M-1)):
        if not dp[i][S]:
            continue
        for j in range(10):
            # 1ビットずらして1を足してjビットずらしてマスクする
            S2 = (S<<1|1)<<j & msk1
            # 直前Mビットで使った値がXYZと一致していないか確認する
            if (S2 & check) != check:
                dp[i+1][S2&msk2] += dp[i][S]
                dp[i+1][S2&msk2] %= MOD
total = pow(10, N, MOD)
print((total-sum(dp[N])%MOD)%MOD)


Measured memory_bytes: 62316
#include <iostream>
#include <cstring>
#include <stdlib.h>
using namespace std;
void output(int out[],int n)
{
	int i;
	for(i=0;i<n;i++){
		if(i!=n-1)
			cout<<out[i]<<" ";
		else
			cout<<out[i]<<endl; 
	}
} 
int main(int argc, char *argv[]) {
	int tmp,j,i,k,n,input[101];
	cin>>n;
	for(i=0;i<n;i++){
		cin>>input[i];
	}
	output(input,n);
	for(i=1;i<n;i++){
		tmp=input[i];
		j=i-1;
		while(j>=0&&tmp<input[j]){
			input[j+1]=input[j];
			j--;
		}
		input[j+1]=tmp;
		output(input,n);
	}
	return 0;
}


Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    ll r,g,b,n;cin >> r >> g >> b >> n;
    ll res=0;
    rep(i,n+1){
        rep(j,n+1){
            ll t=n-r*i-b*j;
            if(t<0)continue;
            if(t%g)continue;
            res++;
        }
    }
    cout << res <<endl;
}

Measured memory_bytes: 3632
def getval():
    n,m,k = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    a = [A[0]]
    b = [B[0]]
    for i in range(0,n-1):
        a.append(a[i]+A[i+1])
    for i in range(0,m-1):
        b.append(b[i]+B[i+1])
    return n,m,k,a,b

def main(n,m,k,a,b):
    idxa = 0
    ans = 0
    t = 0
    while a[idxa]<=k and idxa<n:
        idxa += 1
        if idxa==n:
            break
    ans = idxa
    idxa -= 1
    t = a[idxa]
    for i in range(m):
        t = a[idxa] + b[i]
        if t<=k:
            ans = max(ans,idxa+i+2)
        else:
            flag = False
            while t>k:
                idxa -= 1
                if idxa<0:
                    a.append(0)
                    break
                t = a[idxa]+b[i]
            ans = max(ans,idxa+i+2)

    print(ans)

if __name__=="__main__":
    n,m,k,a,b = getval()
    main(n,m,k,a,b)

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

using namespace std;

int main(){
    int a,b,c,d,e;
    cin >> a;
    b= a/1000;
    c=a/100-b*10;
    d=a/10-b*100-c*10;
    e=a-1000*b-100*c-10*d;
    if(b==c||c==d||d==e){
        cout << "Bad";
    } else{
        cout << "Good";
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std ;

int main()

{
    int a ,b ;

    cin>>a>>b ;

    if(a-(b*2)>0)
    {
        cout<<a-(b*2)<<endl ;
    }

    else if(a-(b*2)<=0)
    {
        cout<<"0"<<endl ;
    }

    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define fo(i, x, y) for(ll i = x, _b = y; i <= _b; i ++)
#define ff(i, x, y) for(ll i = x, _b = y; i <  _b; i ++)
#define fd(i, x, y) for(ll i = x, _b = y; i >= _b; i --)
#define ll long long
#define pp printf
#define hh pp("\n")
using namespace std;

#define pc putchar

ll T, a, b, c, d;

ll divs(ll x, ll y) {
	return x / y + (x % y != 0);
}

int main() {
	for(scanf("%lld", &T); T; T --) {
		scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
		ll as = a + b + 1; ll k = divs(max(a, b), min(a, b) + 1);
		for(ll l = 0, r = a + b; l <= r; ) {
			ll m = l + r >> 1;
			ll t = m / (k + 1);
			ll a0 = a - t * k - m % (k + 1);
			ll b0 = b - t;
			if(b0 <= a0 * k) l = m + 1; else r = m - 1, as = m;
		}
		ll t = as / (k + 1);
		ll a0 = a - t * k - as % (k + 1);
		ll b0 = b - t;
		ll nas = as + b0 - a0 * k + 1;
		fo(i, c, d) {
			ll x = i;
			if(x <= as) {
				pc(x % (k + 1) == 0 ? 'B' : 'A');
			} else {
				x -= nas;
				pc(x % (k + 1) == 0 ? 'A' : 'B');
			}
		}
		pc('\n');
	}
}


Measured memory_bytes: 384
#include <stdio.h>
int minx(int v[],int n){
	int i,j,k,tmp;
	tmp=v[0];
	for(i=1;i<=n-1;i++){
		if(tmp>v[i])
		tmp=v[i];}
		return tmp;}
int maxx(int v[],int n){
	int i,j,k,tmp;
	tmp=v[0];
	for(i=1;i<=n-1;i++){
		if(tmp<v[i])
		tmp=v[i];}
		return tmp;}
int abs(int n){
		if(n<0){
		return -1*n;}else
		return n;}
int max(int n1,int n2,int n3){
	int tmp;
	tmp=n1;
	if(n2>tmp)
	tmp=n2;
	if(n3>tmp)
	tmp=n3;
	return tmp;}
int min3(int n1,int n2,int n3){
	int tmp;
	tmp=n1;
	if(n2<tmp)
	tmp=n2;
	if(n3<tmp)
	tmp=n3;
	return tmp;}
int main(void)
{int N,A,M,B,j,x,i,k,H,W,l,sum,m,mint,flag;
	scanf("%d",&N);
	int a[100];
	int t[100];
	flag=0;
	sum=0;
	for(i=0;i<=N-1;i++){
		scanf("%d",&a[i]);}
	printf("%d",maxx(a,N)-minx(a,N));



	return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll fac(ll a) { return a > 1 ? fac(a - 1) * a : 1; }
bool echeck(ll a) { return a % 2 == 0 ? 1 : 0; }
ll comb(ll n, ll m){
  ll tmp = 1;
  for(int i = n; i >= n - m + 1; i--){
    tmp *= i;
  }
  ll temp = 1;
  for(int i = 1; i <= m; i++){
    temp *= i;
  }
  return tmp / temp;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  int n;
  cin >> n;
  vector<string>v(n);
  rep(i,n)cin >> v[i];
  int ans = 0;
  rep(i,n)if(v[i] == "E869120")ans++;
  cout << ans << endl;
  return 0;
} 


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  ll n, ans = 0;
  string s, t;
  cin >> n >> s >> t;
  int i = 0;

  bool tate;
  if (s[0] == t[0])
    ans = 3, i++, tate = true;
  else
    ans = 6, i += 2, tate = false;

  for (; i < n; ++i) {
    if (s[i] == t[i]) {
      if (tate)
        ans *= 2;
      else
        ans *= 1;
      tate = true;
    } else {
      if (tate)
        ans *= 2;
      else {
        ans *= 3;
      }
      i++;
      tate = false;
    }
    ans %= MOD;
  }

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


Measured memory_bytes: 256
import sys
N = int(input())
A = list(map(int,input().split()))
ans = "APPROVED"
for a in A:
    if(a % 2== 0):
        if(a % 3 == 0 or a % 5 == 0):
            continue
        else:
            ans = "DENIED"
            break
print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define P pair<int, int>

using namespace std;
const int INF=1e5;

int main(){
  long long n, csm=0, ans=0;
  map<long long, long long> mp;
  mp[0]++;
  cin >> n;
  for(int i=0;i<n;i++){
    long long a;
    cin >> a;
    csm += a;
    ans += mp[csm];
    mp[csm]++;
  }
  cout << ans << endl;
}



Measured memory_bytes: 16076
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::vector<i64> B;
  tools::read(B, N - 1);

  i64 answer = B.front();
  for (auto it1 = B.begin(), it2 = ++B.begin(); it2 != B.end(); ++it1, ++it2) {
    answer += std::min(*it1, *it2);
  }
  answer += B.back();

  std::cout << answer << std::endl;
  return 0;
}

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

#define ff               first
#define ss               second
#define mp               make_pair
#define pb               push_back
#define pii              pair<int,int>
#define vi               vector<int> 
#define mii              map<int,int>
#define setbits(x)       __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod              1000000007
#define inf              1e18
#define endl             "\n"

void h_code()
{
 #ifndef ONLINE_JUDGE
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
 #endif
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

void l_code()
{
 #ifndef ONLINE_JUDGE
     cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
 #endif
}
const int N=100005;

int main() {
  //  h_code();
    int t=1;
    
    while(t--)
    {
        long long h;
        cin>>h;
        h=log2(h);
        h=pow(2,h+1)-1;
        cout<<h;

    }
 //   l_code();
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef vector<int> vi;

const int INF = 1000000000;

int main() {FIN
    
    int n;
    cin >> n;
    cout << (n * (n + 1)) / 2 << "\n";
    
    return 0;
}


Measured memory_bytes: 3528
#include <stdio.h>

int main(void)
{
	int x,a,b;
	scanf("%d%d%d",&x,&a,&b);
	if(b <= a)
		{printf("delicious");}
	else if(b <= a+x)
		{printf("safe");}
	else
		{printf("dangerous");}
	return 0;
}





Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int K = sc.nextInt();
		String S = sc.next();
		
        for(int i=0;i<N;i++){
          if (i+1 == K){
            String tmp = (S.substring(i,i+1));
            System.out.print(tmp.toLowerCase());
          }else{
            System.out.print((S.substring(i,i+1)));
          }
        }
	}
}

Measured memory_bytes: 21332
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000000000000;
const int mod = 1000000007;
int test[345678];
signed main() {
	int n, m, k, a, cnt = 0; string s; cin >> n;
	for (int h = 1; h <= n; h++) {
		if (h % 3 != 0 && h % 5 != 0) { cnt += h; }
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3624
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  out(nin()+nin()>=nin()?'Yes':'No')
}
main()

Measured memory_bytes: 7372
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=100000;
int dp[MAXN+5];//dp[i]表示凑出i元最少需要多少张纸币 
int main()
{
	for(int i=0;i<=MAXN;i++)//若只用1元的纸币 
		dp[i]=i;
	int x=6;
	while(x<=MAXN)
	{
		for(int i=x;i<=MAXN;i++)
			dp[i]=min(dp[i],dp[i-x]+1);
		x*=6;
	}
	x=9;
	while(x<=MAXN)
	{
		for(int i=x;i<=MAXN;i++)
			dp[i]=min(dp[i],dp[i-x]+1);
		x*=9;
	}
	int n;
	scanf("%d",&n);
	printf("%d\n",dp[n]);
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <cstring>

using namespace std;
typedef pair<short, short> pii;

short memo[2000][2000];
pii next[2000][2000];

int recur(const string &s, short left, short right){
	if(memo[left][right] >= 0){ return memo[left][right]; }
	int ret = 0;
	pii p(-1, -1);
	if(left == right){
		ret = 1;
	}else if(left < right){
		if(s[left] == s[right]){
			ret = 2 + recur(s, left + 1, right - 1);
			p = pii(left + 1, right - 1);
		}else{
			int a = recur(s, left + 1, right);
			int b = recur(s, left, right - 1);
			ret = max(a, b);
			if(a > b){
				p = pii(left + 1, right);
			}else{
				p = pii(left, right - 1);
			}
		}
	}
	next[left][right] = p;
	return (memo[left][right] = ret);
}

int main(){
	string s;
	while(cin >> s){
		int n = s.size();
		memset(memo, -1, sizeof(memo));
		int len = recur(s, 0, n - 1);
		pii p(-1, -1);
		for(int i = 0; p.first < 0 && i <= n; ++i){
			for(int j = 0; p.first < 0 && j <= n; ++j){
				if(memo[i][j] == len){ p = pii(i, j); }
			}
		}
		vector<char> answer;
		answer.reserve(n);
		while(p.first >= 0 && memo[p.first][p.second] > 0){
			if(s[p.first] == s[p.second]){ answer.push_back(s[p.first]); }
			p = next[p.first][p.second];
		}
		for(int i = answer.size() - 1 - (len % 2); i >= 0; --i){
			answer.push_back(answer[i]);
		}
		answer.push_back('\0');
		cout << &answer[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 23000
// AOJ 0504
#include<cstdio>
#include<vector>
#define rep(i,a) for(int i=0;i<(a);++i)
#define repd(i,a) for(int i=(a);i>=0;--i)

typedef std::vector<int> dec;

int n, k, m, r;

dec add( const dec &a, const dec &b )
{
	dec ret( 10006 );

	int c = 0;
	repd( i, 10005 )
	{
		int t = a[i]+b[i]+c;
	
		ret[i] += t%10;
		c = t/10;
	}

	return ret;
}

dec recip( int n )
{
	dec ret( 10006 );

	int c = 1;
	rep( i, ret.size() )
	{
		ret[i] = c/n;
		c %= n; c *= 10;
	}

	return ret;
}

int main()
{
	while( scanf( "%d%d%d%d", &n, &k, &m, &r ), n|k|m|r )
	{
		dec ans( 10006 );
		ans = recip( n );
		if( m ) rep( i, n-1 )
			ans = add( ans, recip( n*(i+1) ) );
		
		rep( i, r+1 )
		{
			printf( "%d", ans[i] );
			
			if( !i )
				putchar('.');
		}
		puts("");
	}

	return 0;
}

Measured memory_bytes: 1176
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  ll n,d,ans=0;
  cin >> n >> d;
  for(int i=0;i<n;i++){
    ll x,y;
    cin >> x >> y;
    if(x*x + y*y <= d*d){
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3660
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main() {
	double n,max=0,min=1000000;
	while (cin >> n) {
		if (n > max)max = n;
		if (n <min)min = n;
	}
	cout << max - min << endl;
	return 0;
}


Measured memory_bytes: 3240
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N,A,B;
int X[100010];
int F[100010];

signed main(){
	cin>>N>>A>>B;
	REP(i,N){
		cin>>X[i];
	}
	int ans=0;
	REP(i,N-1){
		ans+=min(A*(X[i+1]-X[i]),B);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int count=0;
  string s,t;
  cin>>s>>t;
  for(int i=0;i<3;i++){
    if(s[i]==t[i]){
      count++;
    }
    else{
      continue;
    }
  }
  cout<<count;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<l_l> vpl;
typedef vector<string> vs;
typedef pair<l_l,ll> lll;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=1;i<=(n);i++)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
const ll dx[4]={1,-1,0,0};
const ll dy[4]={0,0,1,-1};
template<class T> inline bool chmin(T& a,T b){
if(a>b){
a=b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a,T b){
if(a<b){
a=b;
return true;
}
return false;
}
const int mod = 998244353;
struct mint {
ll x;
mint(ll x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res+=a;
}
mint operator-(const mint a) const {
mint res(*this);
return res-=a;
}
mint operator*(const mint a) const {
mint res(*this);
return res*=a;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
mint inv() const {
return pow(mod-2);
}
mint& operator/=(const mint a) {
return (*this) *= a.inv();
}
mint operator/(const mint a) const {
mint res(*this);
return res/=a;
}
};
mint dp[3300][3300];
int main(){
    ll n,s;cin>>n>>s;
    vl a(n);rep(i,n)cin>>a[i];
    rep(i,3300){
        rep(j,3300){
            dp[i][j]=0;
        }
    }
    dp[0][0]=1;
    rrep(i,n){
        rep(j,s+1){
            dp[i][j]+=dp[i-1][j]*2;
            if(j-a[i-1]>=0)dp[i][j]+=dp[i-1][j-a[i-1]];
        }
    }
    cout<<dp[n][s].x<<endl;
    return 0;
}

Measured memory_bytes: 88692
#include <bits/stdc++.h>
using namespace std;
using namespace std;
 
#define ll long long
#define f(i,a,b) for(int i=a;i<b;i++)
#define endl '\n'
#define spc " "
#define pb push_back
#define mp make_pair
#define mod 1000000007

int main() 

{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll n,k,sump=0,sums=0;
    cin>>n>>k;
    ll a[n+1];
    f(i,0,n+1) a[i]=i;
    f(i,0,k){
        sump+=a[i];
    }
    for(int i=n;i>=n-k+1;i--){
        sums+= a[i];
    } 

    ll l=k,m=n-k,ans=0;
    ans=sums%mod-sump%mod+1;
    f(i,0,n-k+1){
        sums= sums+ a[m];
        sump= sump+ a[l];
        ans= ( ans%mod + (sums-sump+1 )%mod )%mod;
        m--;l++;
        //cout<<sums<<sump<<endl;
    }
    cout<<ans<<endl;



}

Measured memory_bytes: 5156
/******************************************
* AHAM BRAHMASHMI ;) *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define F first
#define S second




int main()
{

// #ifndef ONLINE_JUDGE
// 	// for getting input from input.txt
// 	freopen("input1.txt", "r", stdin);
// 	// for writing output to output.txt
// 	freopen("output1.txt", "w", stdout);
// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin >> n;
	vector<int> arr(n, 0);
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	vector<int> opt(n + 1, INT_MAX);
	int i;
	opt[0] = 0;
	for (i = 0; i < n - 2; i++)
	{
		opt[i + 1] = min(opt[i + 1], opt[i] + abs(arr[i + 1] - arr[i]));
		opt[i + 2] = min(opt[i + 2], min(opt[i + 1] + abs(arr[i + 2] - arr[i + 1]), opt[i] + abs(arr[i + 2] - arr[i])));
	}
	opt[i + 1] = min(opt[i + 1], opt[i] + abs(arr[i + 1] - arr[i]));
	cout << opt[n - 1] << "\n";
	return 0;
}

Measured memory_bytes: 1024
import sys
from collections import deque


def diameter(n, links):
    q = deque([(0, -1)])
    v = 0
    while q:
        v, p = q.popleft()
        q.extend((u, v) for u in links[v] if u != p)

    q = deque([(v, -1)])
    w = 0
    parents = [-1] * n
    while q:
        w, p = q.popleft()
        parents[w] = p
        q.extend((u, w) for u in links[w] if u != p)
    parents_rev = [-1] * n
    p = w
    while parents[p] != -1:
        parents_rev[parents[p]] = p
        p = parents[p]
    return v, w, parents, parents_rev


def construct(s, links, parents, parents_rev):
    v = s
    result = []
    while v != -1:
        pv, rv = parents[v], parents_rev[v]
        child_count = 0
        for u in links[v]:
            if u == pv or u == rv:
                continue
            if len(links[u]) != 1:
                return False
            child_count += 1
        my_value = len(result) + 1
        result.extend(range(my_value + 1, my_value + child_count + 1))
        result.append(my_value)
        v = parents[v]
    return result


def solve(n, links):
    d1, d2, parents, parents_rev = diameter(n, links)
    result1 = construct(d1, links, parents_rev, parents)
    if result1 is False:
        return [-1]
    result2 = construct(d2, links, parents, parents_rev)
    return min(result1, result2)


n = int(input())
links = [set() for _ in range(n)]
INF = 10 ** 9

for line in sys.stdin:
    v, w = map(int, line.split())
    v -= 1
    w -= 1
    links[v].add(w)
    links[w].add(v)

print(*solve(n, links))


Measured memory_bytes: 47628
// C - Sum of product of pairs
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

int main(){
	int MOD = 1e9 + 7;
	int N; cin>>N;
	ll s = 0, d = 0;
	for(int i=0; i<N; ++i){
		ll a; cin>>a;
		s += a;
		s %= MOD;
		d += a * a % MOD;
		d %= MOD;
	}
	s = (s * s - d) % MOD * (MOD + 1) / 2;
	cout<< s % MOD <<endl;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define int long long int
using namespace std;
signed main()
{
	int n;
	cin>>n;
	int a[n];
	int sum=0;
	int val=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		val=max(val,a[i]);
		sum+=val-a[i];
	}
	cout<<sum;
}

Measured memory_bytes: 5180
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define vi vector<int>
#define Sort(v) sort(v.begin(),v.end())

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;



bool multi(int x){
    return x%3 == 0;
}

bool digit(int x){
    int ct = 0;
    while(x>0){
        if(x%10 == 3){
            ct++;
            break;
        }
        x /= 10;
    }
    if(ct == 1)return true;
    else return false;
}

int main(){
    int n;
    cin >> n;
    
    Rep(i,1,n+1){
        if(multi(i) or digit(i)) cout <<" " << i;
    }
    cout << endl;
}




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

using namespace std;

constexpr static int MAXN = 1e6;

int n, m;
vector <int> adj[MAXN];
bool vis[MAXN];

void dfs(int i, vector <int>& path) {
    vis[i] = true;
    path.push_back(i);
    for (int j : adj[i])
        if (!vis[j]) {
            dfs(j, path);
            break;
        }
}

int main() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    vector <int> path;
    for (int i = 0; i < n; i++) {
        if (adj[i].size() == 1) {
            dfs(i, path);
            break;
        }
        else if (adj[i].size() >= 2) {
            vector <int> p1;
            dfs(i, p1);
            vector <int> p2;
            dfs(i, p2);

            reverse(p1.begin(), p1.end());
            path = p1;
            for (int i = 1; i < p2.size(); i++)
                path.push_back(p2[i]);
            break;
        }
    }
    cout << path.size() << endl;
    for (int i : path)
        cout << i + 1 << " ";
    cout << endl;
}


Measured memory_bytes: 30968
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] input = br.readLine().split(" ");
		double a = Double.parseDouble(input[0]);
		double b = Double.parseDouble(input[1]);
		double th = Math.PI * Double.parseDouble(input[2]) / 180.0;
		double c = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(th));
		double s = a * b * Math.sin(th) / 2.0;
		System.out.println(s);
		System.out.println(a + b + c);
		System.out.println(2.0 * s / a);
	}
}

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

int main(){
    string S;cin>>S;
    int flag=0;
    for(int i=0;i<S.size();i++){
        if(i%2==0){
            if(S.at(i)=='R' or S.at(i)=='U' or S.at(i)=='D')continue;
            else{
                flag++;
                break;
            }
        }
        if(i%2==1){
            if(S.at(i)=='L' or S.at(i)=='U' or S.at(i)=='D')continue;
            else{
                flag++;
                break;
            }
        }
    }
    if(flag==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

string t = "AKIHABARA";

int main() {
	string s;
	cin >> s;
	int j = 0;
	bool F = true;
	for (int i = 0; i < (int) s.length(); i ++) {
		if (j == t.length()) {
			F = false;
			break;
		}
		if (s[i] == t[j]) j++; else {
			if (t[j] == 'A') j++;
		if (j == t.length()) {
			F = false;
			break;
		}
			if (s[i] == t[j]) j++; else {
				F = false;
				break;
			}
		}
	}
	if (j != (int) t.length() && j != t.length()-1) F = false;
	puts (F?"YES":"NO");
	return 0;
}

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

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); i++)
#define REPS(i, n) for(int i=0; i<=(n); i++)
#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define FORS(i, a, b) for(int i=a; i<=(b); i++)
// for container x
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

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

    bool t = false;
    if (A==B && A!=C) t=true;
    else if (A!=B && A==C) t=true;
    else if (A!=B && B==C) t=true;

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

    return 0;
}

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

#define ls rt<<1
#define rs rt<<1|1
#define lb(x) (x&-x)
typedef pair<int,int> pii;
const int maxn = 4e5 + 10;
const int maxm = 1e6 + 10 ;
const int inf=0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
const int st=(1<<20)-1;
const int mod = 1e9+7;
const double eps = 1e-5;
const int vec[2][2]={1,0,0,1};

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}
int f[maxn],n,m;
inline void add(int x,int p) {
    for(int i=x;i<=m;i+=lb(i)) f[i]+=p;
}
inline int ask(int r) {
    int ans=0;
    for(int i=r;i;i-=lb(i)) ans+=f[i];
    return ans;
}
ll pre[maxn],p[maxn];
int a[maxn];
int main() {
#ifdef LOCAL
    freopen("input.txt","r",stdin);
#endif // LOCAL
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    int k;
    n=read();
    k=read();
    for(int i=1;i<=n;i++) {
        a[i]=read();
        a[i]-=k;
    }
    for(int i=1;i<=n;i++) {
        pre[i]=pre[i-1]+a[i];
        p[++m]=pre[i];
    }
    p[++m]=0;
    sort(p+1,p+1+m);
    m=unique(p+1,p+1+m)-p-1;
    int pos=lower_bound(p+1,p+1+m,0)-p;
    ll ans=0;
    add(pos,1);
    for(int i=1;i<=n;i++) {
        pos=lower_bound(p+1,p+1+m,pre[i])-p;
        ans+=ask(pos);
        add(pos,1);
    }
    cout<<ans;
    return 0;
}
//校园网真tm卡


Measured memory_bytes: 8064
#include <stdio.h>

int main(void)
{
  int a, b, i;
  
  scanf("%d%d", &a, &b);
  
  b *= 10;
  
  for (int i = 0; i < 10; i++)
    if ((b+i) * 8 / 100 == a) {
      printf("%d\n", b+i);
      return 0;
    }
  
  puts("-1");
  
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;

int two(int n){
    int res = 0;
    while(n % 2 == 0){
        res++;
        n /= 2;        
    }

    return res;
}

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

    int n;
    cin >> n;

    int cnt = 0, ans = 1;
    for (int i = 1; i <= n; ++i) {
        int x = two(i);
        if(cnt < x){
            ans = i;
            cnt = x;
        }
    }


    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
//#define int long long
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n, m, q;
	cin >> n >> m >> q;
	vector<string> a(n);
	rep(i, n) cin >> a[i];
	vector<vector<int>> sum(n + 1, vector<int>(m + 1));
	vector<vector<int>> sum2(n + 1, vector<int>(m + 1));
	vector<vector<int>> sum3(n + 1, vector<int>(m + 1));
	rep(i, n) {
		rep(j, m) {
			sum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j];
			sum2[i + 1][j + 1] = sum2[i + 1][j] + sum2[i][j + 1] - sum2[i][j];
			sum3[i + 1][j + 1] = sum3[i + 1][j] + sum3[i][j + 1] - sum3[i][j];
			if (a[i][j] == '1') sum[i + 1][j + 1]++;
			if (i != 0 && a[i - 1][j] == '1'&&a[i][j] == '1') sum2[i + 1][j + 1]++;
			if (j != 0 && a[i][j - 1] == '1'&&a[i][j] == '1') sum3[i + 1][j + 1]++;
		}
	}
	rep(_, q) {
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		x1--; y1--;
		int ans = sum[x1][y1] + sum[x2][y2] - sum[x1][y2] - sum[x2][y1];
		ans -= sum2[x1 + 1][y1] + sum2[x2][y2] - sum2[x1 + 1][y2] - sum2[x2][y1];
		ans -= sum3[x1][y1 + 1] + sum3[x2][y2] - sum3[x1][y2] - sum3[x2][y1 + 1];
		cout << ans << '\n';
	}
} 

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

int main(){
    long long x;
    cin >> x;
    for(long long i=-200;i<200;i++){
        for(long long j=-200;j<200;j++){
            if(i*i*i*i*i-j*j*j*j*j==x){
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3620
///Code by: Luis Alejandro
///Handle: Sekai
///Country: Cuba

#include <bits/stdc++.h>
#define endl '\n'
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("avx2")

using namespace std;

typedef unsigned long long ull;
typedef long long lld;
typedef long double ld;
typedef pair<int,int> pii;

const int MAXN=1e5+5;
const int MOD=1e9+7;
const int INF=1e9;
const ld PI=acos(-1);
const ld EPS=1e-9;

#define lg2(x) 31-__builtin_clz(x)
#define logx(a,b) (log(a)/log(b))
#define pow2(a) a*a
#define pow3(a) a*a*a
#define lcm(a,b) (a*b)/__gcd(a,b)

pii mkp(int a, int b){
    if(a>b)swap(a,b);
    return make_pair(a,b);
}

int mod_pow(int a, int b){
    if(!b)return 1;
    if(b&1)return mod_pow(a,b-1)*a%MOD;
    int power=mod_pow(a,b>>1);
    return power*power%MOD;
}

int modular_inverse(int a){
    return mod_pow(a,MOD-2);
}

vector<int> movy={0,0,1,-1};
vector<int> movx={1,-1,0,0};

void solve(){
    int n, l;
    cin>>n>>l;
    vector<string> a(n);
    for(string &it:a)cin>>it;
    sort(a.begin(),a.end());
    for(string it:a)cout<<it;
    cout<<endl;
}

int main()
{
    #ifndef ONLINE_JUDGE
        //freopen("IN.txt","r",stdin);
        //freopen("OUT.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int samecount(string S){
    int A = 0;
    for(int i = 0;i < S.size();i++){
        int QA = 1;
        for(int j = i ;j < S.size() - 1;j++){
           if(S.at(j) == S.at(j + 1)){
               QA++ ;
           }
           if(S.at(j) != S.at(j + 1)){
               break;
           }
           
        }
        A = max(QA,A);
    }
    return A;
}

int64_t minn(int64_t a,int64_t b){
    if(a >= b) return b;
    else return a;
}
int main(){
    string S;
    cin >>S;
    int ans = 0;
    for(int i = 1 ;i < S.size()/2  ;i++){
        bool frag = 1;
       for(int j = 0;j < i;j++){
           if(S[j] != S[i+j]) frag = 0;
        }
        if(frag) ans = max(ans,2*i);
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


# 2で割れる回数を数える
def f(x):
    t = 0
    while (x % 2 == 0):
        x //= 2
        t += 1
    return t


n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] //= 2

cnt = f(a[0])
for i in range(n):
    # 割れる回数が一致しなければ不可
    if cnt != f(a[i]):
        print(0)
        exit()
    a[i] >>= cnt
m >>= cnt
num = 1
for i in range(n):
    num = lcm(num, a[i])
    if num > m:
        print(0)
        exit()
m //= num
ans = (m + 1) // 2
print(ans)

Measured memory_bytes: 16320
#include <stdio.h>

int main(void)
{
  int a,b;
  scanf("%d %d",&a,&b);
  if(a<b)
    {
      printf("a < b\n");
    }else if(a>b)
    {
      printf("a > b\n");
    }else
    {
      printf("a == b\n");
    }
  return 0;
}

Measured memory_bytes: 580