akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using llpair=pair<ll,ll>;
using llvec=vector<ll>;
using llmat=vector<vector<ll>>;
#define llmattp(name,a,b,num) name(a,vector<ll>(b,num))
#define LLINF 1LL<<60
#define ABS(x) ( (x)>0 ? (x) : -(x) )

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;
}

ll gcd(ll a, ll b) {
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

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

ll factorial(ll x) {
	ll f=1;
	for(ll i=2; i<x; i++) {
		f*=i;
	}
	return f;
}

ll nPr(ll n, ll r) {
	ll result=1;
	for(ll i=r+1; i<=n; i++) result*=i;
	return result;
}

ll nCr(ll n, ll r) {

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }
	if (n == r) { return 1; }

	if (r > n / 2) { r = n / 2; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return (ll)result;
}

bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (ll i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

ll GreaterBinarySearch(ll *array, ll key, ll max, ll min) {
	if(array[max]<array[min]) {
		return NULL;
	} else {
		ll mid = max + (min-max)/2;
		if(array[mid]<key) {
			return GreaterBinarySearch(array,key,max,mid-1);
		} if(array[mid]>key) {
			return GreaterBinarySearch(array,key,mid+1,min);
		} else {
			return mid;
		}
	}
}

int main() {
	int a,b,c; cin>>a>>b>>c;
	int k; cin>>k;
	if(b>a) swap(a,b);
	if(c>a) swap(a,c);

	cout<<a*pow(2,k)+b+c<<endl;
}


Measured memory_bytes: 256
s = gets.chomp
n = s.length

def check(word)
  word = word.to_s
  return word == word.reverse ? true : false
end

s_front = s[0...(n-1)/2]
s_back = s[(n+3)/2-1..n-1]

if check(s) && check(s_front) && check(s_back)
  ans = "Yes"
else
  ans = "No"
end

puts ans

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

int main(){
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  priority_queue<int> pq;
  pq.push(A);
  pq.push(B);
  pq.push(C);
  for(int i=0;i<K;i++){
    int x=pq.top();
    pq.pop();
    pq.push(x*2);
  }
  int ans=0;
  while(!pq.empty()){
    ans+=pq.top();
    pq.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string.h>
#include<ctype.h>
#include<string>
#include<math.h>
#define pi 3.141592653589
#include<iomanip>
#include<vector>
using namespace std;
#include<algorithm>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 1e9
#define LINF 1e17
#define ll long long
#define MOD (int)(1e9+7)

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



int main() {

	int n;

	cin >> n;

	cout << "ABC" << n << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, init, n) for(int i = init; i <(int)(n); i++)

int main() {

    ll N, K;
    cin >> N >> K;
    vector<ll> v(N+1, 0);
    ll tmp;
    REP(i, N){
        cin >> tmp;
        v[tmp]++;
    }
    sort(v.begin(), v.end(), greater<ll>());
    ll ans = 0;
    REP(i, K) ans += v[i];
    cout << (N - ans) << endl;

    return 0;
}



Measured memory_bytes: 1792
n,q=map(int,input().split())
c=input()
s=[input().split() for _ in [0]*q]
def judge(x,opt):
    for y in s:
        if y[0]==c[x]:
            if y[1]=='L':
                x-=1
            else:
                x+=1
            if not opt:
                if x>=n:
                    return False
                elif x<0:
                    return True
            else:
                if x<0:
                    return False
                elif x>=n:
                    return True
    return False
def bisect(l,r,opt):
    center=(r+l)//2
    if judge(center,opt):
        if r-l<=1:
            if not opt:
                return l+1
            else:
                return  n-l
        if not opt:
            return bisect(center+1,r,opt)
        else:
            return bisect(l,center,opt)
    else:
        if r-l<=1:
            if not opt:
                return l
            else:
                return n-r
        if not opt:
            return bisect(l,center,opt)
        else:
            return bisect(center+1,r,opt)
def func():
    l=bisect(0,n,0)
    r=bisect(0,n,1)
    print(n-l-r)
func()

Measured memory_bytes: 41368
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s,co;
bool fl;
struct edge{int to,cost;};
P kazu[ohara];
P iti[ohara];
ll st;

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>co;
    rep(i,Size(co)-1){
        if(co[i]=='B'&&co[i+1]=='C')s+="D",i++;
        else s+=co[i];
    }
    rep(i,Size(s)){
        if((s[i]=='A'||s[i]=='D')&&!fl){
            st=i;
            fl=true;
        }
        else if(s[i]!='A'&&s[i]!='D'&&fl){
            iti[cnt++]=m_p(st,i-1);
            fl=false;
        }
    }
    if(fl){
        iti[cnt++]=m_p(st,Size(s)-1);
    }
    rep(i,cnt){
        ll stt,enn;
        stt=iti[i].fi,enn=iti[i].se;
        ll cou=0;
        rrep(j,stt,enn+1){
            if(s[j]=='D'){
                ans+=(j-stt)-cou;
                cou++;
            }
        }
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 1684
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//絶対値
long long int change_plus(long long int a) {
	if (a < 0) { return -a; }
	if (a >= 0) { return a; }
}
//大小比較(大)
long long int big(long long int a, long long int b) {
	if (a >= b) {
		return a;
	}
	else {
		return b;
	}
}

//大小比較(小)
long long int small(long long int a, long long int b) {
	if (a >= b) {
		return b;
	}
	else {
		return a;
	}
}

int main() {
	long long int n, m, k = 0;
	char str[15],str2[15],str3[15];
	scanf("%s%s%s",str,str2,str3);
	
	printf("%c%c%c",str[0]-0x20,str2[0]-0x20,str3[0]-0x20);
}

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

string s, t;

int main() {
	cin >> s;
	cin >> t;
	int ans = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == t[i])ans++;
	}
	cout << ans << endl;
}

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

int main() {
  int N; cin >> N;
  string S; cin >> S;
  if(S.size() == 1 || N % 2 == 1) {
    cout << "No" << endl;
    return 0;
  }
  string s = S.substr(0, N/2);
  string t = S.substr(N/2, s.size());
  if(s == t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(auto i = (N) - 1; i >= 0; i -= 1)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define rand mtrand
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cout << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,...) do { cout << #v << " = "; array_out(v , ##__VA_ARGS__);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
#endif
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = 0x1FFFFFFFFFFFFFFFLL;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}

random_device seed_gen; mt19937_64 mtrand(seed_gen());
constexpr int MOD = 1000000007;
//////////////////////////////////////////

int main(){
  ini(N,l,h);
  vi a(3,0);
  rep(i,N){
    ini(x);
    a[x<=l ? 0 : x<=h ? 1 : 2]++;
  }
  out(min({a[0],a[1],a[2]}));

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstring>
#include<climits>
using namespace std;
#define add(x) accumulate(x)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end() 
#define rep(i, a, b) for (int i=a; i<(b); i++)
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
ll countCostDP(ll *A, ll n, ll k){
	ll dp[n] = {};
	// filling last part
	for(int i=n-2;i>=n-k;i--){
		ll curr = A[i];
		ll max = INT_MAX;
		for(int j=i+1;j<n;j++){
			ll diff = abs(curr - A[j]);
			diff += dp[j];
			if(diff < max){
				max = diff;
			}
		}
		dp[i] = max;
	}
	// fill first part
	for(int i=n-k-1;i>=0;i--){
		ll curr = A[i];
		ll max = INT_MAX;
		for(int j=i+1;j<=i+k;j++){
			ll diff = abs(curr - A[j]);
			diff += dp[j];
			if(diff < max){
				max = diff;
			}
		}
		dp[i] = max;
	}
	ll ans = dp[0];
	return ans;
}
ll countCost(ll *A,ll n, ll k){
	if(n < 1){
		return INT_MAX;
	}
	if(n == 1){
		return 0;
	}
	ll ans = INT_MAX;
	for(int i=1;i<=k;i++){
		ll temp = countCost(A+i,n-i,k);
		if(temp != INT_MAX){
			temp += abs(A[0] - A[i]);
		}
		if(temp < ans){
			ans = temp;
		}
	}
	return ans;
}
void solve(){
	ll n,k;
	cin >> n >> k;
	ll A[n];
	for(int i=0;i<n;i++){
		cin >> A[i];
	}
	ll ans = countCostDP(A,n,k);
	cout << ans << endl;
	return;
}
int main(int argc, char const *argv[])
{
	/*hs;
	#ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt", "r", stdin);
    //for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif*/

    ll t = 1;
    while(t--){
    	solve();
    }
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    ll A[100010];
    cin >> N;
    rep(i,0,N){
        cin >> A[i];
    }
    sort(A, A+N, greater<ll>());
    ll ans = 0;
    if(N % 2 == 0){
        rep(i,0,N/2 - 1){
            ans += 2 * A[i];
        }
        ans += A[N/2 - 1];
        ans -= A[N/2];
        rep(i,N/2 + 1, N){
            ans -= 2 * A[i];
        }
    }else{
        ll ans_1 = 0, ans_2 = 0;
        rep(i,0,(N+1)/2 - 2){
            ans_1 += 2 * A[i];
        }
        ans_1 += A[(N+1)/2 - 2] + A[(N+1)/2 - 1];
        rep(i,(N+1)/2,N){
            ans_1 -= 2 * A[i];
        }
        sort(A, A+N);
        rep(i,0,(N+1)/2 - 2){
            ans_2 -= 2 * A[i];
        }
        ans_2 -= (A[(N+1)/2 - 2] + A[(N+1)/2 - 1]);
        rep(i,(N+1)/2,N){
            ans_2 += 2 * A[i];
        }
        ans = max(ans_1, ans_2);

    }
    print(ans);
    // ll arr[100010] = {};
    // rep(i,0,N/2){
    //     arr[2 * i + 1] = A[i];
    // }
    // ll ans = 0;
    // if(N == 2){
    //     print(abs(A[0] - A[1]));
    //     return 0;
    // }
    // if(N % 2 == 1){
    //     ll val = (N-1)/2;
    //     if(val == 1){
    //         ans += A[0] - A[2];
    //         ans += max(abs(A[0]-A[1]), abs(A[1] - A[2]));

    //     }else{
    //         rep(i,0,val-2){
    //             ans += 2 * A[i];
    //         }
    //         rep(i,val-2, val){
    //             ans += A[i];
    //         }
    //         rep(i,0,val-1){
    //             ans -= 2 * A[N-1-i];
    //         }
    //         ll amari1 = A[val];
    //         ll amari2 = A[val + 1];
    //         ans += abs(A[val-2] - amari2);
    //         ans += max(abs(amari2 - amari1), abs(A[val-1] - amari1));
    //     }

    // }else{
    //     ll val = N/2;
    //     rep(i,0,val-2){
    //         ans += 2 * A[i];
    //     }
    //     rep(i,val-2, val){
    //         ans += A[i];
    //     }
    //     rep(i,0,val-1){
    //         ans -= 2 * A[N-1-i];
    //     }
    //     ll amari = A[val];
    //     ans += max(abs(A[val-2] - amari), abs(A[val-1] - amari));

    // }
}


Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<iterator>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<cstdint>
#include<chrono>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);
#define chmax(a, b) (((a) < (b)) ? (b) : (a))
#define chmin(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;



signed main() {

	int N, M, P;
	cin >> N >> M >> P;
	vector<int>A(M), B(M), C(M);
	rep(i, M)cin >> A[i] >> B[i] >> C[i];

	vector<vector<int>>graph(N), graphrev(N);

	rep(i, M) {
		A[i]--;
		B[i]--;
		C[i] = -(C[i] - P);

		graph[A[i]].push_back(B[i]);
		graphrev[B[i]].push_back(A[i]);
	}

	vector<int>BF(N, intmax);
	BF[0] = 0;

	rep(i, N - 1) {
		rep(j, M) {
			BF[B[j]] = min(BF[B[j]], BF[A[j]] + C[j]);
		}
	}

	stack<int>dfs1;
	vector<int>searched1(N);
	dfs1.push(0);
	while (!dfs1.empty()) {
		int x = dfs1.top();
		dfs1.pop();
		if (searched1[x])continue;
		searched1[x] = 1;
		for (int y : graph[x]) {
			dfs1.push(y);
		}
	}
	stack<int>dfsN;
	vector<int>searchedN(N);
	dfsN.push(N-1);
	while (!dfsN.empty()) {
		int x = dfsN.top();
		dfsN.pop();
		if (searchedN[x])continue;
		searchedN[x] = 1;
		for (int y : graphrev[x]) {
			dfsN.push(y);
		}
	}


	rep(i, M) {
		if (BF[B[i]] > BF[A[i]] + C[i]) {
			if (searched1[B[i]] != 0 && searchedN[B[i]] != 0) {
				cout << -1 << endl;
				return 0;
			}
		}
	}

	int answer = chmax(-BF[N - 1], 0LL);

	cout << answer << endl;




	return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> as(n);
    for (auto& a : as) {
        cin >> a;
    }
    
    int total_sum = 0;
    for (auto a : as) {
        total_sum += a;
    }
    
    int num_good = 0;
    for (auto a : as) {
        num_good += a * 4 * m >= total_sum;
    }
    if (num_good >= m) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(true){
			int[] a=new int[21];
			a[0]=cin.nextInt();
			int L=cin.nextInt();
			if(a[0]==0 && L==0){
				break;
			}
			for(int i=0;i<20;i++){
				int[] dc=new int[10];
				int x=a[i];
				for(int n=0;n<10;n++){
					dc[n]=0;
				}
				for(int m=0;m<L;m++){
					dc[x%10]++;
					x=x/10;
				}
				int max=0,min=0;
				for(int l=9;l>=0;l--){
					for(int o=dc[l];o>0;o--){
						max=max*10;
						max+=l;
					}
				}
				for(int p=0;p<=9;p++){
					for(int q=dc[p];q>0;q--){
						min=min*10;
						min+=p;
					}
				}	
			a[i+1]=max-min;
			}
			int ians=0,jans=0;
			for(int w=0;w<=20;w++){
				for(int s=0;s<w;s++){
					if(a[w]==a[s]){
						ians+=w;
						jans+=s;
						w=21;
						s=21;
					}
				}
			}
			System.out.print(jans+" ");
			System.out.print(a[jans]+" ");
			System.out.println(ians-jans);
		}

	}
}

Measured memory_bytes: 20452
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

//# include <ext/pb_ds/assoc_container.hpp>
//# include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;
 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int a[N];
int p[N];
int lst[N];
//	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//	shuffle(permutation.begin(), permutation.end(), rng);



int main () {
	scanf("%d", &n);
	ll ans = 0;
	for (int i = 1, x; i <= n; ++i) {
		scanf("%d", &x);
		for (int j = 0; j < 30; ++j) {
			if(x & (1 << j)) {
				p[i] = max(p[i], lst[j]);
				lst[j] = i;
			}
		}
		p[i] = max(p[i], p[i-1]);
		ans += i - p[i];
	}
	printf("%lld", ans);
	return Accepted;
}

// B...a

Measured memory_bytes: 2304
"use strict";

var main = function main(input) {
  // 奇数進むには奇数秒、偶数進むには偶数秒必要
  // 秒数<距離は無理 -> 秒数>=距離 && 秒数の偶奇==距離の偶奇 ならいける
  // 次の点までの時間を秒数, 次の点までの総距離(x方向とy方向の和)を距離とする
  var args = input.split('\n');
  var T = [];
  var posX = [];
  var posY = [];
  args.forEach(function (element, i) {
    if (i > 0 && element != '') {
      T.push(element.split(' ')[0]);
      posX.push(element.split(' ')[1]);
      posY.push(element.split(' ')[2]);
    }
  });
  var X = 0;
  var Y = 0;
  var now = 0;
  var flag = true;

  for (var i = 0; i < T.length; i++) {
    var element = T[i]; // 総移動距離の計算

    var distance = Math.abs(X - posX[i]) + Math.abs(Y - posY[i]);
    var time = element - now;

    if (distance > time || distance % 2 != time % 2) {
      flag = false;
      break;
    }

    X = posX[i];
    Y = posY[i];
    now = element;
  }

  if (flag) {
    console.log('Yes');
  } else {
    console.log('No');
  }
};

main(require('fs').readFileSync('/dev/stdin', 'utf-8'));

Measured memory_bytes: 49352
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int[][] a=new int[3][n];
    for(int i=0;i<n;i++){
      for(int j=0;j<3;j++){
        a[j][i]=sc.nextInt();
      }
    }
    int[][] dp=new int[3][n];
    for(int i=0;i<3;i++){
      dp[i][0]=a[i][0];
    }
    for(int i=1;i<n;i++){
      for(int j=0;j<3;j++){
        dp[j][i]=Math.max(
          dp[m(j+1)][i-1]+a[j][i],
          dp[m(j+2)][i-1]+a[j][i]
        );
      }
    }
    int ans=Math.max(Math.max(dp[0][n-1],dp[1][n-1]),dp[2][n-1]);
    System.out.println(ans);
  }
  static int m(int i){
    return i>2?i-3:i;
  }
}

Measured memory_bytes: 93140
K = int(input())
N = 50
L = list(range(N))
q,r = divmod(K,N)
for i in range(N):
    L[i] += N * q + (N if r > i else 0)
    L[i] -= (N-1) * q + (r-1 if r > i else r)
print(N)
print(*L)

Measured memory_bytes: 3064
// ------------------------------------
// Date:2018/ 3/11
// Problem:ABC 090 . c.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl

typedef long long ll;

static const int MOD = 1000000007;
const int MAX_N = 1e9 + 1;

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

  ll N, M;
  cin >> N >> M;

  ll ans;
  if (N >= 2 and M >= 2) {
    ans = (N - 2) * (M - 2);
  } else {
    if (N < 2 and M < 2) {
      ans = 1;
    } else if (N >= 2 and M < 2) {
      ans = N - 2;
    } else {
      ans = M - 2;
    }
  }

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



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define SORT(v) sort(v.rbegin() , v.rend())
#define si(n) scanf( "%d" , &n)
#define sii(n , m) scanf( "%d %d" , &n , &m)
#define sl(n) scanf( "%lld" , &n)
#define sll(n , m) scanf( "%lld %lld" , &n, &m)
#define ss(cad) scanf( "%s" , cad)
#define sz(x) (int)x.size()
#define PB push_back
#define fst first
#define scn second
#define DBG(x) cerr << #x << " = " << (x) << endl
#define M 1000000007
#define N_MAX 1000010
#define EPS 1e-9

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<pi> vp;

vector<vi> gr;
vb con;
int dfs(int nodo){
	int cnt = 1;
	con[nodo] = 1;
	for(int x: gr[nodo]){
		if(con[x] == false)
			cnt += dfs(x);
	}
	return cnt;
}

int main(){
	int n, m;
	sii(n, m);
	gr.resize(n);
	con.resize(n);
	while(m--){
		int a, b;
		sii(a, b);
		a--;
		b--;
		gr[a].push_back(b);
		gr[b].push_back(a);
	}
	int ans = 1;
	for(int i = 0; i < n; i++){
		if(con[i] == 0)
			ans = max(ans, dfs(i));
	}
	printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 23504
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
  int N;
  cin>>N;
  map<string, int> m;
  vector<string> name[5];
  REP(i, N){
    string s; int n;
    cin>>s>>n;
    m[s] += n;
    name[s.size() - 1].push_back(s);
  }
  REP(i, 5){
    sort(name[i].begin(), name[i].end());
    name[i].erase(unique(name[i].begin(), name[i].end()), name[i].end());
    REP(j, name[i].size()){
      cout<<name[i][j]<<" "<<m[name[i][j]]<<endl;
    }
  }
  return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> res(n);
    for(int i=0; i<n; i++)
    	cin >> res[i];
    sort(res.begin(),res.end());
    float prev=((float)res[0]+res[1])/2;
  for(int i=2;i<res.size();i++)
  	prev = (prev+res[i])/2;    
    cout << prev;
    return 0;
}

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


int main(void)
{
    string str;
    cin >> str;
    int min = 9999;

    for (int i = 0; i < str.size()-2;i++ ) {
        int sum=0;
        for(int j =0;j < 3; j++ ){
            sum = sum * 10 + (str[i+j] - '0');
        }
        sum = abs(753 - sum);
        if (min > sum) min = sum;
    }
    cout << min << endl;
    
}

Measured memory_bytes: 256
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X, Y = map(int, input().split())

if (X + Y) % 3 != 0:
    print(0)
    exit()

MAX = 2 * 10 ** 6 + 2
MOD = 10 ** 9 + 7

fac = [0 for i in range(MAX)]
finv = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]

def comInit(mod):
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod


def com(n, r, mod):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod
    
comInit(MOD)

if X < Y:
    X, Y = Y, X
b = (2 * X - Y) // 3
a = X - 2 * b
print(com(a + b, b, MOD))


Measured memory_bytes: 213876
import java.util.Scanner;
public class Main {
	static int num = 0;
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		
		int frequency = stdIn.nextInt();
		String str = stdIn.next();
		char[] str_array = str.toCharArray();
		
		for(int r = 0; r < frequency; r++) {
			String input = stdIn.next();
			char[] input_array = input.toCharArray();
			int idx1 = 0, idx2;
	NEXT:	for(int c = 0; c < input_array.length; c++) {
				if(input_array[c] == str_array[0]) {//b探し
					for(int td = c; td < input_array.length; td++) {
						if(input_array[td] == str_array[1]) {//a探し
							idx2 = 2;
							int diff = td - c;
							if(td + (td - c) < input_array.length) idx1 = td + diff; //変更点
					ASearch:		for(;idx1 < input_array.length; idx1 += diff) {
								if(str_array[idx2] == input_array[idx1]) {
									if(idx2 + 1 < str_array.length) idx2++;                            
								} else {
									break ASearch;
								}
								if(idx2 == str_array.length - 1) {
									num++;
									break NEXT;
								}
							} 
						}
					}
				}
			}
		}
	System.out.println(num);
	}
}

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

int main() {
  int one,m;
  char S;
  cin >> S;
  
  if (S=='a')
    cout << "vowel" << endl;
  else if (S=='i')
    cout << "vowel" << endl;
  else if (S=='u')
    cout << "vowel" << endl;
  else if (S=='e')
    cout << "vowel" << endl;
  else if (S=='o')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        CF_Reader in = new CF_Reader();

        double a = in.doubleNext();
        double b = in.doubleNext();
        double mx = in.doubleNext();

        double minB = Math.min(b - 1, mx);
        double res = Math.floor((a * minB) / b) - a * Math.floor(minB / b);
        out.println((long) res);

        out.close();
    }

    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        public int[] nextIntArray(final int n) throws IOException {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = intNext();
            return a;
        }

        public long[] nextLongArray(final int n) throws IOException {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = longNext();
            return a;
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

int main(){
  int n;
  cin >> n;
  vector<p> v(n, {0, 0});
  for (int i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
  }
  sort(rall(v));
  cout << v[0].first + v[0].second << endl;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  string s; cin >> s;
  int n = int(s.size());
  ll ans = 0;
  for(int i = 0; i < (1<<(n-1)); ++i){
    ll sum = 0;
    ll tmp = 0;
    for(int j = 0; j < n; ++j){
      tmp *= 10;
      tmp += s[j]-'0';
      if((1<<j)&i){
	sum += tmp;
	tmp = 0;
      }
    }
    sum += tmp;
    ans += sum;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3612
a,b,c,X,Y = map(int,input().split())

min1 = 10**10
for z in range(0,200001,2):
    x = max(0,X-z//2)
    y = max(0,Y-z//2)
    min1 = min(min1,a*x + b*y + c*z)

print(min1)

Measured memory_bytes: 9180
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
    string s; cin >> s;
    int q; cin >> q;
    string front, back;
    bool rev = false;
    while (q--) {
        int t; cin >> t;
        if (t == 1) rev = !rev;
        else {
            int f; char c; cin >> f >> c;
            if ((f == 1) == rev) back.push_back(c);
            else front.push_back(c);
        }
    }
    reverse(front.begin(), front.end());
    s = front + s + back;
    if (rev) reverse(s.begin(), s.end());
    cout << s << endl;
}


Measured memory_bytes: 1348
#include <bits/stdc++.h>
    using namespace std;
    const int maxn = 1e5+10;
    map<int,long long> cnt;
    int main(){
    	int n;
	long long k;
    	int a,b;
    	cin >> n >> k;
    	for(int i = 0; i < n; i++){	
    		scanf("%d%d", &a, &b);
    		cnt[a] += (long long)b;	
    	}
    	long long sum = 0, cur = 0;
    	for(map<int,long long>::iterator it = cnt.begin(); it != cnt.end(); it++){
    		sum += it->second;
    		if(sum >= k) {
    			cout << it->first << endl;	
    			break;
    		}	
    	}
    	return 0;
    }

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

K, A, B = map(int, input().split())

ans = 0
if K >= A - 1:
    K -= A - 1
    ans = A
else:
    K = 0
    ans = K + 1

if B - A >= 2:
    if K % 2 == 0:
        ans += (K // 2) * (B - A)
    else:
        ans += ((K - 1) // 2) * (B - A) + 1
else:
    ans += K

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
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; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
#define fs first
#define sc second

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;



int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n,k;
    cin >> n >> k;
    print(n - k + 1);

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
//g++ -std=c++11 

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7

string S;
ll dp[100005][20];

int main(){
	cin >> S;

	dp[0][0] = 1;

	rep(i, S.size()) {
		char ch = S[i];

		if(ch == '?') {
			rep(from, 13) {
				rep(num, 10) {
					dp[i + 1][(from * 10 + num)%13] += dp[i][from];
					dp[i + 1][(from * 10 + num)%13] %= DIV;
				}
			}
		} else {
			ll num = ch - '0';
			rep(from, 13) {
				dp[i + 1][(from * 10 + num)%13] += dp[i][from];
				dp[i + 1][(from * 10 + num)%13] %= DIV;
			}
		}
	}

	cout << dp[S.size()][5] << endl;
}

Measured memory_bytes: 19372
#include <bits//stdc++.h>
using namespace std;
int main() {
	int n,x;
	cin>>n>>x;
	int l[n],num=0,ans=0;
	for(int i=0;i<=n;i++){
		if(num<=x){
			ans++;
		}else{
			cout<<ans;
			return 0;
		}
		cin>>l[i];
		num+=l[i];
	}
  cout<<ans;
	return 0;
}



Measured memory_bytes: 256
N=int(input())
S=input()
t=N+1
ans=0

for s in range(1,t):
    a=set(S[0:s])
    b=set(S[s:])
    cnt=0
    for chr in a:
        if chr in b:cnt+=1
    if cnt>ans: ans=cnt
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//SOLVE
void solve(void)
{
  int N;
  cin>>N;
  vector<int> H (N+1,0); 
  for (int i = 0; i < N; i++)
  {
    cin>>H[i+1];
  }
  H[0] = H[1];
  vector<int> DP (N+1,INF);
  DP[0] = 0;
  for (int i = 0; i < N; i++)
  {
    for (int j = 1; j <= 2; j++)
    {
      int nV = i + j;
      if(nV > N)continue;
      chmin(DP[nV], DP[i] + abs(H[i] - H[nV]));
    }
      // DEBUG(DP);
  }

  cout<<DP[N]<<endl;
  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 1792
#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>;
ll INF = pow(10,9)+7;

int main(){
  int n,ans,end;
  ans = 1;
  cin >> n;
  vector<P> v;
  rep(i,n){
    int a,b;
    cin >> a >> b;
    v.push_back(make_pair(a+b,a-b));
  }
  sort(v.begin(),v.end());
  end=v[0].first;
  rep(i,n){
    if(v[i].second>=end){
      end = v[i].first;
      ans++;
    }
  }
  cout << ans << endl;
}

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

int main()
{
    std::string S;
    std::cin >> S;
    int flag=0;
    for(int i=0; i<S.length()-1;i++){
        if(S[i]==S[i+1]){
            flag=1;
        }
    }
    if(flag==1){
        std::cout << "Bad" << std::endl;
    }else{
        std::cout << "Good" << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define sz(a) (int)(a.size())
#define deb(a) cout << #a << ": " << a << ENDL;
#define all(a) begin(a),end(a)
#define fore(i, a, b) for(int i(a), ThkMk(b); i < ThkMk; ++i)
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli> ii;
typedef vector<lli> vi;

int main()
{   _
    lli n, tot = 0; cin >> n;
    fore(i, 1, n) {
        if(n % i == 0) tot += (n / i) - 1;
        else tot += (n - n %i) / i;
    }
    cout << tot << ENDL;
    return 0;
}


Measured memory_bytes: 3648
s = input()
for i in range(1, len(s)):
    if s[i-1] == s[i]:
        print(i, i+1)
        exit()
for i in range(2, len(s)):
    if s[i-2] == s[i]:
        print(i-1, i+1)
        exit()
print(-1,-1)

Measured memory_bytes: 3188
#include<stdio.h>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<utility>
#include<stack>
#include<algorithm>
#include<string>
#include<string.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;

const int N = 1e6;

set<int> ls;

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n; cin >> n;
    while(n--){
        int x; cin >> x;
        if(ls.count(x))ls.erase(x);
        else ls.insert(x);
    }

    cout << ls.size() << endl;

}

Measured memory_bytes: 4992
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <climits>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
int h, w;
string s[8];

bool dfs(int x, int y){
  if(x == h - 1 && y == w - 1)return true;
  if(y < w - 1 && s[x][y+1] == '#' && dfs(x, y + 1))return true;
  if(x < h - 1 && s[x+1][y] == '#' && dfs(x + 1, y))return true;
  return false;
}

int main(int argc, char const* argv[])
{
  cin >> h >> w;
  for(int i = 0; i < h; i++)cin >> s[i];
  int sum = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s[i][j] == '#')sum++;
    }
  }
  if(dfs(0, 0) && sum == h + w - 1)cout << "Possible" << endl;
  else cout << "Impossible" << endl;
	return 0;
}


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

int main() {
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            for (int k = 0; k < 10; k++) {
                bool a, b, c;
                a = b = c = false;
                for (int l = 0; l < N; l++) {
                    if (!a && !b && !c && S[l]-'0' == i) a = true;
                    else if (a&&!b&&!c&&S[l]-'0'==j)b=true;
                    else if (a&&b&&!c&&S[l]-'0'==k)c=true;
                }
                if (a&&b&&c)ans++;
            }
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;
int Sieve(int x){
    long long n = 100004;
    long long ans;
    vector<bool> flags(n, true);
    flags[0] = false;
    flags[1] = false;
    for(long long p = 2; p<n; ++p){
        if(!flags[p]) continue;
        for(long long mult = p * p; mult < n; mult += p)
            flags[mult] = false;
    }
    for(ans=x; ans<n; ++ans){
        if(flags[ans]) return ans;
    }
}
int main(){
    long long x,ans;
    cin >> x;
    ans = Sieve(x);
    cout << ans << "\n";
    return 0;
}

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


int main() {
  int64_t a, b, c, d;
  cin >> a >> b >> c >> d;
  
  int64_t ac, ad, bc, bd;
  ac = a * c;
  ad = a * d;
  bc = b * c;
  bd = b * d;
  
  int64_t larger_a = max(ac, ad);
  int64_t larger_b = max(bc, bd);
  int64_t result = max(larger_a, larger_b);
  
  cout << result << endl;
}


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

int main() {
  int X, N; cin >> X >> N;
  set<int> p;
  int pi;
  for(int i=0; i<N; i++){
    cin >> pi;
    p.insert(pi);
  }
  int abs=100, ans, i=X;
  while(i>=0){
    if(p.count(i)==0 && abs>X-i) {abs=X-i; ans=i; break;}
    i--;
  }
  i=X+1;
  while(i<=101){
    if(p.count(i)==0 && abs>i-X) {abs=i-X; ans=i; break;}
    i++;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair<int, int> pii;  // pair<int, int> に pii という別名を付ける
typedef long long ll;
typedef unsigned long long ull;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ull H, W;
  ull ans, area;
  cin >> H >> W;
  if (H == 1 || W == 1){
    ans = 1;
  }
  else{
    area = ((H*W+1)/2);
    ans = floor(area);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    int A,B;cin>>A>>B;
    if(A==1)A=14;
    if(B==1)B=14;
    if(A>B){
        cout<<"Alice"<<endl;
    }else if(A<B){
        cout<<"Bob"<<endl;
    }else{
        cout<<"Draw"<<endl;
    }
}

Measured memory_bytes: 3584