akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
using namespace std;

int main(void) {
	long long N, A, B;
	cin >> N >> A >> B;
	if (A < B) swap(A, B);

	long long ans;
	if ((A-B)%2==0) {ans = (A-B)/2;}
	else {
		long long l = B-1;
		long long r = N-A;
		ans = min(l, r) + ((A-B)+1)/2;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define double long double
using namespace std;

string s;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5])
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(void){
    int i,n;
    int v[20];
    int c[20];
    int sum=0;
    scanf("%d",&n);
    for(i=0; i<n; i++){
        scanf("%d",&v[i]);
    }
    for(i=0; i<n; i++){
        scanf("%d",&c[i]);
    }
    for(i=0; i<n; i++){
        if(v[i] > c[i]){
            sum = sum + v[i] - c[i];
        }
    }
    printf("%d\n",sum);

    return 0;
}

Measured memory_bytes: 128
// Author : Nachiket Kanore
// Institute : PICT, Pune

/* It does not matter how slowly you go as long as you do not stop.*/

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define rep(x,s,e) for(int x=s;x<=(e);x++)
#define repn for(int x=0;x<n;x++)
#define rep1n for(int x=1;x<=n;x++)
#define rep1m for(int y=1;y<=m;y++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define precise(x) cout << fixed << setprecision(x)
#define bits(x) __builtin_popcount(x)
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;


void __print(int x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define see(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define see(x...)
#endif

const int inf = 1e18;
const int N = 1005;


int32_t main(){
    FAST;

    int a, b;
    cin >> a >> b;
    cout << (a+b)%24;

    return 0;
}




Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

const int MAX_N = 2005;

int n, A[2 * MAX_N], poz_B[MAX_N], poz_W[MAX_N];
int cnt_B[2 * MAX_N][MAX_N], cnt_W[2 * MAX_N][MAX_N], DP[MAX_N][MAX_N];
char L[2 * MAX_N];

int main() {
    scanf("%d", &n);
    for(int i = 1; i <= 2 * n; i++) {
        scanf(" %c %d", &L[i], &A[i]);
        if(L[i] == 'B') poz_B[A[i]] = i;
        else poz_W[A[i]] = i;
    }
    for(int i = 2 * n; i >= 1; i--) {
        for(int j = 1; j <= n; j++) {
            cnt_B[i][j] = cnt_B[i + 1][j];
            cnt_W[i][j] = cnt_W[i + 1][j];
        }
        if(L[i] == 'B') {
            for(int j = A[i]; j <= n; j++) cnt_B[i][j]++;
        }
        if(L[i] == 'W') {
            for(int j = A[i]; j <= n; j++) cnt_W[i][j]++;
        }
    }
    DP[0][0] = 0;
    for(int i = 1; i <= n; i++) DP[0][i] = DP[0][i - 1] + cnt_W[poz_W[i]][i - 1];
    for(int i = 1; i <= n; i++) DP[i][0] = DP[i - 1][0] + cnt_B[poz_B[i]][i - 1];
    
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            int d1 = DP[i - 1][j] + cnt_B[poz_B[i]][i - 1] + cnt_W[poz_B[i]][j];
            int d2 = DP[i][j - 1] + cnt_B[poz_W[j]][i] + cnt_W[poz_W[j]][j - 1];
            DP[i][j] = min(d1, d2);
        }
    }
    printf("%d", DP[n][n]);
    return 0;
}

Measured memory_bytes: 78592
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+5;
const int mod=1e9+7;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define per(i,a,n) for(int i=n-1;i>=a;i--)
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
ll qpow(ll a,ll b){ll ans=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)ans=ans*a%mod;a=a*a%mod;}return ans;}
ll gcd(ll a,ll b){return b>0?gcd(b,a%b):a;}
ll a[maxn];
int cnt[2];
int main(){
	ll n,m,T,k;
	//cin>>T;
    cin>>n>>k;
    ll ans=0;
    rep(i,0,n){
        cin>>a[i];
    }
    per(i,0,50){
        cnt[0]=cnt[1]=0;
        rep(j,0,n){
            cnt[(a[j]>>(i*1ll))&1ll]++;
        }
        //cout<<cnt[0]<<" "<<cnt[1]<<endl;
        if(cnt[1]<cnt[0]&&(ans|(1ll<<(i*1ll)))<=k)
        {
            //cout<<i<<endl;
            ans|=(1ll<<i);

        }
    }
    ll sum=0;
    //cout<<ans<<endl;
    rep(i,0,n){
        sum+=(a[i]^ans);
    }
    cout<<sum<<endl;
}




Measured memory_bytes: 1024
//#include<bits/stdc++.h>
#include<string>
#include<cstring>
#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>
#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define ll long long
//#define ll unsigned long long
#define inf 0x3f3f3f3f
#define mod 1000000007
#define eps 1e-6
#define pi acos(-1)
#define mysetit set<ll>::iterator
#define mymsetit multiset<ll>::iterator
#define mymapit map<ll,ll>::iterator
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define lowbit(x) (x&(-x))
#define mp make_pair
#define pb push_back
#define si size()
#define E exp(1.0)
#define fixed cout.setf(ios::fixed)
#define fixeds(x) setprecision(x)
using namespace std;
inline ll read(){ll s=0,w=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();return s*w;}
void put1(){puts("YES");}void put2(){puts("NO");}void put3(){puts("-1"); }
ll qpf(ll a,ll b,ll p){ll ret=0;while(b){if(b&1)ret=(ret+a)%p;a=(a+a)%p;b>>=1;}return ret%p;}
ll qp(ll a,ll n,ll p){ll ret=1;while(n){if(n&1)ret=qpf(ret,a,p);a=qpf(a,a,p);n>>=1;}return ret%p;}
using namespace std;
const int manx=1e6+5;

ll a[manx];
int main(){
    ll n=read(),k=read();
    for(int i=1;i<=n;i++) a[i]=read();
    sort(a+1,a+1+n);
    ll L=-1e18,R=1e18;
    while(L+1!=R){  //这里枚举的就是答案
        ll M=(L+R)/2,cnt=0;
        for(int i=1;i<=n;i++){
            ll l=i,r=n+1;
            if(a[i]<0){
                while(l+1!=r){ //这里是二分下标
                    ll m=(l+r)/2;
                    if(a[i]*a[m]<=M) r=m;//因为a[i}<0所以向下枚举答案
                    else l=m;
                }
        //a[i]<0枚举答案所以要向下枚举 找到第一个不满足条件的
        //那么就有 n-r+1 个数 * a[i]<=M
                cnt+=n+1-r;
            }
            else{ //a[i]>0枚举答案所以要向上枚举
                while(l+1!=r){
                    ll m=(l+r)/2;
                    if(a[i]*a[m]<=M) l=m;
                    else r=m;
                }//找到第一个不满足条件  那么满足条件的就有l-i
                cnt+=l-i;
            }
        }
        if(cnt<k) L=M;
        else R=M;
    }
    printf("%lld",R);
    return 0;
}


Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 998244353;

char s[15][1005];

int main(){
	ll h,w,k; cin >> h >> w >> k;
	rep(i,h) rep(j,w) cin >> s[i][j];
	ll answer = inf;
	rep(bit,1<<(h-1)){
		ll ans = 0;
		rep(i,h-1){
			if(bit>>i & 1) ans++;
		}
		ll num = ans;
		vl group(num+1,0);
		vl nxt(num+1,0);
		bool f = true;
		rep(j,w){
			ll id = 0;
			rep(i,h){
				if(s[i][j]=='1') nxt[id]++;
				if(i<h-1 && (bit>>i & 1)) id++;
			}
			bool flag = true;
			rep(i,num+1){
				if(group[i] + nxt[i] > k){
					if(nxt[i] > k){
						f = false;
						break;
					}
					ans++;
					flag = false;
					break;
				}
			}
			if(!f) break;
			rep(i,num+1){
				if(flag) group[i] += nxt[i];
				else group[i] = nxt[i];
				nxt[i] = 0;
			}
		}
		if(f) chmin(answer,ans);
	}
	cout << answer << endl;
}

Measured memory_bytes: 256
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

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

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> h(n);
    REP(i, n){
        cin >> h[i];
    }
    int ans = 0;
    int now =  h[0];
    int cnt = 0;
    REP(i, n-1){
        if(now >= h[i+1]){
            cnt++;
            now = h[i+1];
        }
        else {
            ans = max(ans, cnt);
            cnt = 0;
            now = h[i+1];
        }
    }
    ans = max(ans, cnt);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
const ll MOD=1000000007;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define range(i) (i).begin(),(i).end()
#define rrange(i) (i).rbegin(),(i).rend()
inline ll gcd(ll a, ll b) {return b?gcd(b, a%b):a;}
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans*(b&1?a:1);
}
inline constexpr int modpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
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;}
const ll LINF=0x1fffffffffffffff;

struct unionfind{
    vector<ll> d;
    unionfind(ll x):d(x,-1){}
    ll root(ll x) {return d[x]<0?x:d[x]=root(d[x]);}
    ll size(ll x) {return -d[root(x)];};
    bool unite(ll x,ll y) {x=root(x),y=root(y); if(x!=y){if(d[x]>d[y])swap(x,y);d[x]+=d[y];d[y]=x;}return x!=y;}
    bool find(ll x,ll y) {return root(x)==root(y);}
};
int main(){
  ll a,b;
  cin>>a>>b;
  if(b==1) {
      cout<<0;
      return 0;
  }
  else{
    ll cnt=0;
    while(cnt*(a-1)+a<b){
      cnt++;
    }
    cout<<cnt+1;
  }
}

Measured memory_bytes: 256
#include<iostream>//標準の入出力に必要
using namespace std;//名前空間、名前の衝突を防ぐ。
#define MAX 100000  //定数100000、問題中の制約
typedef long long llong;//64bitの新しい型llongを定義以下llong型が使える

int n, k;//kはトラックの台数、nは荷物の数
llong T[MAX];//荷物(の重さ)を入れておく配列

//↓は仮定されたPの値で荷物を積んでいくシミュレーション
int check(llong P){//solveからmid=P(仮定)が送られてくる
	int i = 0;
	for (int j = 0;j<k;j++){//トラックの数だけ繰り返す
		llong s = 0;//積める荷物の重さを格納する準備
		while(s + T[i]<=P){//仮定したPの値より積んだ荷物の重量が軽い間繰り返す。
			s+=T[i];//Tの要素を一個ずつ足していく
			i++;//Tの次の要素に移る
			if(i==n)return n;//積める荷物の数を返す
		}
	}
	return i;//積める荷物の数を返す
}

int solve(){
	llong left=0;//Pがとりうる最小数
	llong right = 100000*10000;//Pがとりうる最大数
	llong mid;//導きたい最終的な答え
	while(right-left>1){//right(最大値)とleft(最小値)の差を縮めていき、答えを導出する。
		mid=(left+right)/2;//暫定的に中央値を採用、範囲を狭める。
		int v = check(mid);//mid==Pを決めて(仮定して)何個積めるかを調べる。	
		if(v>=n)right=mid;//vが荷物の総数より多ければ上限の範囲を縮めてやり直す
		else left=mid;//vが荷物の総数より少なければ下限の範囲を縮めてやり直す
	}
	return right;//求めたい最大数
}

int Allocation(){
	cin>>n>>k;//標準入力、一つ目をnに、二つ目をkに格納
	for(int i=0;i<n;i++)cin >> T[i];//入力された荷物をTに順番に格納
	llong ans = solve();//最終的な解答ansにsolveで出した解答を格納
	cout << ans << endl;//[cout]は標準出力、[endl]で改行
	return 0;
}

int main(){
	Allocation();
}


Measured memory_bytes: 3880
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int n, m;
	cin >> n;
    map<string, int> mp;
    int result = 0;
    rep(i, n){
        string a;
        cin >> a;
        mp[a]++;
    }

    cin >> m;
    rep(i, m){
        string a;
        cin >> a;
        mp[a]--;
    }

    for(auto itr = mp.begin(); itr != mp.end(); itr++){
        auto& hoge = *itr;
        if(hoge.second > result){
            result = hoge.second;
        }
    }

	
	cout << result << endl;
	return 0;
}

Measured memory_bytes: 256
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    # i+1番目からR番目まで足すとt以上となるような最小のRを返す
    def bisect_plus(self, i, t):
        L = i
        R = self.size
        R_prev = R
        sum_i = self.sum(i)
        while True:
            range_sum = self.sum(R) - sum_i
            if range_sum < t:
                if R == self.size:
                    return self.size + 1
                L, R = R, R_prev
            else:
                R_prev = R
                R = (L + R + 1) // 2
                if R == R_prev:
                    return R

    # L番目からi-1番目まで足すとt以上となるような最小のRを返す
    def bisect_minus(self, i, t):
        L = 1
        R = i
        L_prev = L
        sum_i = self.sum(i - 1)
        while True:
            range_sum = sum_i - self.sum(L - 1)
            if range_sum < t:
                if L == 1:
                    return 0
                L, R = L_prev, L
            else:
                L_prev = L
                L = (L + R) // 2
                if L == L_prev:
                    return L


N = int(input())
P = list(map(int, input().split()))

place = [-1] * (N + 1)
for i in range(N):
    p = P[i]
    place[p] = i

ans = 0
big_place = Bit(N)
big_place.add(place[N] + 1, 1)
for i in range(N - 1, 0, -1):
    pos = place[i] + 1
    right = big_place.bisect_plus(pos, 1)
    right2 = big_place.bisect_plus(pos, 2)
    left = big_place.bisect_minus(pos, 1)
    left2 = big_place.bisect_minus(pos, 2)
    if left > 0:
        left_cand = left - left2
    else:
        left_cand = 0
    right_cand = right - pos
    ans += i * left_cand * right_cand

    if right < N + 1:
        right_cand = right2 - right
    else:
        right_cand = 0
    left_cand = pos - left
    ans += i * left_cand * right_cand

    big_place.add(pos, 1)

print(ans)


Measured memory_bytes: 58628
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }
//V,P(大文字)使用不可
//乗算の際にオーバーフローに注意せよ！！（適切にmodをとれ）

const ll INF=1e18;

signed main(){
    int n;
    cin>>n;
    if(n%2==0) cout<<n/2;
    else cout<<n/2+1;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.*;
public class Main {
	static int r; 
	static int c;
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		boolean[] ans = new boolean[1001];
		for(int i = 1; i < 1001; i++) {
			int eight = (int)(i * 0.08);
			int ten = (int) (i * 0.1);
			ans[i] = ((eight == a) && (ten == b));
		}
		String res = "-1";
		for(int i = 1; i < 1001; i++) {
			if(ans[i] == true) {
				res = i + "";
				break;
			}
		}
		System.out.println(res);
	}
} 


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

const int LENGTH = 3;

int main() {
	int a[LENGTH];
	for(int i = 0; i < LENGTH; ++i) {
		cin >> a[i];
	}
	
	for(int end = LENGTH - 1; end > 0; --end) {
		for(int start = 0; start < end; ++start) {
			if(a[start] > a[start + 1]) {
				int tmp  = a[start];
				a[start] = a[start + 1];
				a[start + 1 ] = tmp;
			}
		}
	}
	
	for(int i = 0; i < LENGTH - 1; ++i) {
		cout << a[i] << " ";
	}
	cout << a[LENGTH - 1] << endl;
}

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

void solve(long long A, long long B, long long C, long long X)
{
    long long count = 0;
    for (int i = 0; i <= A; i++)
    {
        for (int j = 0; j <= B; j++)
        {
            for (int k = 0; k <= C; k++)
            {
                if (i * 500 + j * 100 + k * 50 == X)
                {
                    count++;
                }
            }
        }
    }

    cout << count << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    long long X;
    scanf("%lld", &X);
    solve(A, B, C, X);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		double N = sc.nextDouble();
		double K = sc.nextDouble();
		ArrayList<Integer> ary = new ArrayList<Integer>();
		int num = (int)K;
		while(num != 1) {
			ary.add(num);
			num = (int)Math.ceil((double)num / (double)2);
		}
		ary.add(1);
		
		if(N >= K) {
			double ans = 0;
			int cnt = 0;
			for(int i = (int)N; i > 0; i--) {
				if(i > K) {
					ans += 1 / N;
				} else {
				while(ary.get(cnt) > i) {
					cnt++;
				}
				ans += Math.pow(0.5, cnt) / N; 
				}
			}
			System.out.println(ans);
		} else {
			double ans = 0;
			int cnt = 0;
			for(int i = (int)N; i > 0; i--) {
				while(ary.get(cnt) > i) {
					cnt++;
				}
				ans += Math.pow(0.5, cnt) / N; 
			}
			System.out.println(ans);
		}
	}
}


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

int main() {
  string S,T;
  cin >> S >> T;
  
  int s=S.size();
  int t=T.size();
  
  int ans=t;
  int kari=0;
  
  
  for(int i=0;i<s-t+1;i++){
    kari = 0;
    for(int j=0;j<t;j++){
      if(S[i+j]!=T[j]) kari++;
    }
    if(ans > kari) ans = kari;
  }
  cout << ans << endl;
  
 
  
}


Measured memory_bytes: 3628
import java.util.*;
public class Main { 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
		int h = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
      	int cnt = 0;
      	if(h % a != 0)
          cnt++;
        cnt += h / a;
        System.out.println(cnt);
    }
}

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

int main() {
  string S;
  cin >> S;
  int ans = 0;
  for (int i = 0; i < 4; i++) {
    if (S[i] == '+')ans++;
    if (S[i] == '-')ans--;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
t, a = [], []
n.times do |i|
    t[i], a[i] = gets.chomp.split.map(&:to_i)
end

tt = 1
aa = 1

0.upto(n-1) do |i|
    m = [(tt+t[i]-1)/t[i], (aa + a[i] - 1)/a[i]].max
    tt = m * t[i]
    aa = m * a[i]
end

puts tt + aa


Measured memory_bytes: 1788
readline()
cnt=ones(Int,26)*1145141919
for s=readlines()
  now=zeros(Int,26)
  for c=chomp(s)
    now[Int(c)-96]+=1
  end
  for i=1:26
    cnt[i]=min(cnt[i],now[i])
  end
end
for i=1:26
  for j=1:cnt[i]
    print(Char(i+96))
  end
end
println()

Measured memory_bytes: 110344
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include<climits>
#define MOD 1000000007
#define INFTY (1<<30)
typedef long long ll;
using namespace std;

int n;

void dijkstra(vector<pair<int,ll>> *adj,ll *d,int start){
  priority_queue<pair<int,ll>,vector<pair<int,ll>>,greater<pair<int,ll>>> PQ;
  for(int i=0;i<=n;i++) d[i]=LLONG_MAX;
  d[start]=0;

  PQ.push(make_pair(start,0));
  while(!PQ.empty()){
    pair<int,ll> f=PQ.top();
    PQ.pop();
    int u=f.first;
    if(d[u]<f.second) continue;

    for(int i=0;i<adj[u].size();i++){
      int v=adj[u][i].first;
      if(d[v]>d[u]+adj[u][i].second){
        d[v]=d[u]+adj[u][i].second;
        PQ.push(make_pair(v,d[v]));
      }
    }
  }
}

int main(){
  int m,s,t;
  cin>>n>>m>>s>>t;

  vector<pair<int ,ll>> adj_y[n+1],adj_s[n+1];
  ll d_y[n+1],d_s[n+1];
  for(int i=0;i<m;i++){
    int u,v;
    ll a,b;
    cin>>u>>v>>a>>b;
    adj_y[u].push_back(make_pair(v,a));
    adj_y[v].push_back(make_pair(u,a));
    adj_s[u].push_back(make_pair(v,b));
    adj_s[v].push_back(make_pair(u,b));
  }
  dijkstra(adj_y,d_y,s);
  dijkstra(adj_s,d_s,t);

  ll tmp[n+1]={};
  tmp[n]=d_y[n]+d_s[n];
  for(int i=n-1;i>0;i--){
    tmp[i]=min(tmp[i+1],d_y[i]+d_s[i]);
  }
  for(int i=1;i<=n;i++) cout<<1000000000000000-tmp[i]<<endl;
  return 0;
}


Measured memory_bytes: 23104
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;
using i64 = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
const int INF = (1 << 30);
const i64 INFL = (1LL << 62);
const i64 MOD = 1000000007;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
i64 mod_pow(i64 a, i64 n, T mod) {
  mod = (i64)mod;
  i64 res = 1, p = a % mod;
  while (n) {
    if (n & 1) res = res * p % mod;
    p = p * p % mod;
    n >>= 1;
  }
  return res;
}
void print() { std::cout << std::endl; }
template <typename T, typename... A>
void print(const T& first, const A&... rest) {
  cout << sizeof...(rest) << endl;
  std::cout << first;
  if (sizeof...(rest)) std::cout << " ";
  print(rest...);
}
template <typename... A>
void print(const A&... rest) {
  print(rest...);
}
template <typename A>
void print(const std::vector<A>& v) {
  std::for_each(v.begin(), v.end(), [](A x) { std::cout << x << " "; });
  std::cout << std::endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w;
  cin >> h >> w;
  vector<string> a(h);
  rep(i, h) { cin >> a[i]; }
  queue<vector<int>> q;
  rep(i, h) {
    rep(j, w) {
      if (a[i][j] == '#') {
        q.push({i, j, 0});
      }
    }
  }
  int ans = 0;
  while (!q.empty()){
    vector<int> tmp = q.front();
    q.pop();
    int i = tmp[0];
    int j = tmp[1];
    int cnt = tmp[2];
    ans = max(ans, cnt);
    int d[4][2] = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}};
    rep(dd, 4){
      int ni = i + d[dd][0];
      int nj = j + d[dd][1];
      if (ni < 0 || ni > h - 1 || nj < 0  || nj > w - 1){
        continue;
      }
      if(a[ni][nj] == '.'){
        q.push({ni, nj, cnt+1});
        a[ni][nj] = '#';
      }
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 56756
import sys
input=sys.stdin.readline
n,hp=map(int,input().split())
ata,sute=zip(*[tuple(map(int,input().split())) for i in range(n)])
ata=max(ata)
sute=sorted(list(sute),reverse=1)

ans=float("inf")
for i in range(n):
    hp-=sute[i]
    ans=min(ans,-(-max(0,hp)//ata)+i+1)
print(ans)

Measured memory_bytes: 24380
N, K = map(int, input().split())
points = list(map(int, input().split()))
hand = {'r': 0, 's': 1, 'p': 2}
T = [hand[t] for t in input()]
win = [False] * N
ans = 0
for i in range(N):
    if i < K or T[i] != T[i-K] or not win[i-K]:
        win[i] = True
        ans += points[(T[i]+2) % 3]
print(ans)


Measured memory_bytes: 4796
//g++ -std=c++11 -Wall -O2 -o main.exe main.cpp
//g++ -std=c++14 -Wall -O2 -o main.exe main.cpp

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <complex>
#include <numeric>
#include <queue>
#include <stack>
#include <tuple>

using namespace std;

#define spc " "
#define com ", "

typedef long long ll;
typedef long double ld;
typedef pair<int, int> p_ii;

//------------------------------------------------------------------------------

int main(){
    int n, k;
    cin >> n >> k;

    ll ans = 1;
    for(int i = 0; i < n; i++){
        ans *= k;
        if(i == 0) k--;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import math

N, K = map(int, input().split())

ans = 0

if K == 1:
    print(1)
    exit()

for i in range(1, min(N+1, K)):
    #print(2 ** -np.ceil(np.log2(K/i)))
    ans += 2 ** -math.ceil(math.log2(K/i))

ans = ans/N

if N > K:
    ans += (N-K+1)/N    

print(ans)

Measured memory_bytes: 3060
n=int(input())
a=list(map(int,input().split()))
a.sort()
if n%2==1:
  if a.count(0)!=1:
    print(0)
    exit()
  else:
    for i in range(1,n,2):
      if a[i]!=a[i+1] or a[i]!=i+1:
        print(0)
        exit()
else:
  for i in range(0,n,2):
    if a[i]!=a[i+1] or a[i]!=1+i:
      print(0)
      exit()
print(2**(n//2)%(10**9+7))

Measured memory_bytes: 14008
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"

using namespace std;
typedef long long ll;

int main()
{
  int w, h, n;
  cin >> w >> h >> n;
  int x[110], y[110], a[110];
  int s[4] = {0, w, 0, h};
  for (int i = 0; i < n; i++)
  {
    cin >> x[i] >> y[i] >> a[i];
    if (a[i] == 1)
    {
      s[0] = max(s[0], x[i]);
    }
    if (a[i] == 2)
    {
      s[1] = min(s[1], x[i]);
    }
    if (a[i] == 3)
    {
      s[2] = max(s[2], y[i]);
    }
    if (a[i] == 4)
    {
      s[3] = min(s[3], y[i]);
    }
  }
  if ((s[1] - s[0]) > 0 && (s[3] - s[2]) > 0)
  {
    cout << (s[1] - s[0]) * (s[3] - s[2]) << "\n";
  }
  else
  {
    cout << 0 << "\n";
  }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int m,i,j,k;
	int fund,year,type;
	int check,tesu;
	double nenri;
	int temp,temp1,max;
	int finfund[100];
	
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%d",&fund);
		scanf("%d",&year);
		scanf("%d",&type);
		max = 0;
		for(j=0;j<type;j++)
		{
			scanf("%d %lf %d",&check,&nenri,&tesu);
			if(check==0)
			{
				temp = fund;
				temp1 = 0;
				for(k=0;k<year;k++)
				{
					temp1+=(int)(temp*nenri);
					temp-=tesu;
				}
				//printf("%d\n",temp+temp1);
				finfund[j] = temp+temp1;
			}
			else
			{
				temp = fund;
				temp1 = 0;
				for(k=0;k<year;k++)
				{
					temp1=(int)(temp*nenri);
					temp+=temp1-tesu;
				}
				//printf("%d\n",temp);
				finfund[j] = temp;
			}
			if(max<finfund[j])
			max=finfund[j];
		}
		printf("%d\n",max);
	}
	return 0;
}

Measured memory_bytes: 632
L, N = map(int, input().strip().split())
s1, e1 = 0, 10**5
for i in range(N):
    s, e = map(int, input().strip().split())
    s1, e1 = max(s, s1), min(e, e1)
    
print(max(0, e1 - s1+1))

Measured memory_bytes: 3060
import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array, std.functional;

int happiness(string s) {
  int r = 0;
  foreach(i; 0..s.length) {
    if (s[i] == 'L' && i != 0 && s[i-1] == 'L') r++;
    if (s[i] == 'R' && i != s.length - 1 && s[i+1] == 'R') r++;
  }
  return r;
}

string inverse(string s, int l, int r) {
  assert(l<=r);
  char[] res = s.dup;
  foreach(i; 0..(r-l+1)) {
    if(s[l+i] == 'L') res[r-i] = 'R';
    if(s[l+i] == 'R') res[r-i] = 'L';
  }
  return cast(string)res;
}

void main() {
  auto input = readln.split.to!(int[]);
  auto N = input[0], K = input[1];
  auto S = readln.split[0];

  auto h = happiness(S);
  auto num = 1;
  foreach(i; 1..S.length) {
    if(S[i] != S[i-1]) num++;
  }

  while(K > 0 && num >= 3) {
    K--;
    num-=2;
    h+=2;
  }
  if(K > 0 && num == 2) {
    K--;
    num--;
    h++;
  }
  h.writeln;
}


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

int main(){
        int n,i;
        float tmp,v1,v2;
        cin >> n;
        priority_queue<float,vector<float>,greater<float>> v;
        for(i=0;i<n;++i){
                cin >> tmp;
                v.push(tmp);
        }
        while(1){
                v1 = v.top();
                v.pop();
                v2 = v.top();
                v.pop();
                v.push((v1+v2)/2.0);
                if(v.size()==1) break;
        }
        cout << v.top() << endl;
        return 0;
}

Measured memory_bytes: 3792
/* @CopyRight:   Script by vimer(micro.script@hotmail.com). All rights reserved.
 * @Version:     1.0
 * @Date:
 * @Description: 2017-05-13 Contest 061 Between Two Integers
 * @Environment: Code::Blocks 16.01, GCC 4.9.
 */
#include<iostream>
using namespace std;

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


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

input = readlines
n = input[0].to_i
v = input[1].split(' ').map(&:to_i)
c = input[2].split(' ').map(&:to_i)

sum = 0
v.each_with_index do |v, i|
  sum += v - c[i] if v > c[i]
end
p sum

Measured memory_bytes: 1788
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
typedef long long int ll;
struct uf_tree{
	vector<ll> par, sizes;
	uf_tree(ll n) : par(n), sizes(n,1){
		for(ll i=0; i<n; i++){
			par[i]=i;
		}
	}
	ll find(ll x){
		if(x==par[x])return x;
		return par[x]=find(par[x]);
	}
	void unite(ll x, ll y){
		x=find(x);
		y=find(y);
		if(x==y) return;
		if(sizes[x] < sizes[y]){ swap(x,y); }
		par[y] = x;
		sizes[x] += sizes[y];
	}
	bool same(ll x, ll y){
		return find(x)==find(y);
	}
	ll size(ll x){
		return sizes[find(x)];
	}

};


int main()
{
	ll N, M;
	cin >> N >> M;

	vector<ll> A(M), B(M);
	for(ll i=0; i<M; i++){
		cin >> A.at(i) >> B.at(i);
		A.at(i)--;
		B.at(i)--;
	}
	uf_tree uf(N);

	//ll ans=0;
	vector<ll> ans(M,0);
	ans.at(M-1) = N*(N-1)/2;
	for(int i=M-2; i>=0; i--){
		if(uf.same(A.at(i+1),B.at(i+1))){
			ans.at(i) = ans.at(i+1);
		}else{
//			uf.unite(A.at(i+1), B.at(i+1));
			ans.at(i) = ans.at(i+1) - uf.size(uf.find(A.at(i+1))) * uf.size(uf.find(B.at(i+1)));
//			cout << uf.size(A.at(i+1)) << " " << uf.size(B.at(i+1)) << endl;
			uf.unite(A.at(i+1), B.at(i+1));
			/*
			for(int j=0; j<N; j++){
				for(int k=j+1; k<N; k++){
					if(!uf.same(j,k)){
						ans.at(i)++;
					}
				}
			}*/
		}
//		cout << ans << endl;
//		uf.unite(A.at(i),B.at(i));
	}

	for(int i=0; i<M; i++){
		cout << ans.at(i) << endl;
	}

	return 0;
}

Measured memory_bytes: 5248
program V1003;
 var
  a:array[1..3] of longint;
  i,n,x:longint;
 begin
  readln(n);
  fillchar(a,sizeof(a),0);
  for i:=1 to n do
   begin
    read(x);
    if x mod 4=0 then inc(a[3])
                 else if x mod 2=0 then inc(a[2])
                                   else inc(a[1]);
   end;
  readln;
  if a[2]>0 then a[2]:=1;
  if a[2]+a[1]>a[3]+1 then writeln('No')
                      else writeln('Yes');
 end.


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	if(n>=0&&m<=0||(n<=0&&m>=0)) printf("Zero");
	else {
		if((max(n-m,m-n)+1)%2==0||(n>0&&m>0)) printf("Positive");
		else printf("Negative");
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
#define pb push_back

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n; cin >> n;
	VE x(n), y(n), h(n); rep(i, n)cin >> x[i] >> y[i] >> h[i];
	rep(i, 101) {
		rep(j, 101) {
			int tmp = 0;
			rep(k, n) {
				if (h[k]) {
					tmp = h[k] + abs(x[k] - i) + abs(y[k] - j); break;
				}
			}
			bool ok = true;
			rep(k, n) {
				if (h[k] != max(0LL, tmp - abs(x[k] - i) - abs(y[k] - j)))ok = false;
			}
			if (ok) {
				cout << i << " " << j << " " << tmp << endl;
			}
		}
	}
	return 0;
}

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

using namespace std;

int main() {
	int N, K;
	string S;
	cin >> N >> K >> S;
	S[K - 1] = (S[K - 1] - 'A') + 'a';
	cout << S << endl;
	return 0;
}

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


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	int res = n % k;
	if (res == 0) cout << 0 << endl;
	else cout << 1 << endl;
 	return 0;
}

Measured memory_bytes: 256
import sys

N = int(input())
XY = [[int(_) for _ in input().split()] for i in range(N)]

mc = [0, 0]
maxl = 0

for x, y in XY:
    l = abs(x) + abs(y)
    maxl = max(maxl, l)
    mc[l % 2] += 1

if mc[0] > 0 and mc[1] > 0:
    print(-1)
    sys.exit()

def calc(sx, sy, ex, ey, d):
    dx, dy = ex - sx, ey - sy
    if dx > dy:
        if dx > -dy:
            return "R", sx + d, sy
        else:
            return "D", sx, sy - d
    else:
        if dx > -dy:
            return "U", sx, sy + d
        else:
            return "L", sx - d, sy

import math

l = math.ceil(math.log(maxl + 1, 2))

ms = [1 << i for i in range(l)][::-1]

rms = ms

if mc[0] > 0:
    rms = [1] + ms

print(len(rms))
print(*rms)

for ex, ey in XY:
    x, y = 0, 0
    w = ""
    if mc[0] > 0:
        w = "R"
        x += 1
    for m in ms:
        d, x, y = calc(x, y, ex, ey, m)
        w += d
    print(w)



Measured memory_bytes: 3444
import java.util.*;

public class Main {
    static long ans;
    
    public static void main(String[] args) throws Exception {
        // Your code here! 
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        ans = n-1;
        divisorList(n);
        System.out.println(ans);
    }
    
    public static List<Long> divisorList(long n) {
        List<Long> res = new ArrayList<Long>();
        for (long i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                res.add(i);
                
                long j = n / i;
                if (j != i) {
                    res.add(j);
                }
                
                ans = Math.min(ans, i+j-2);
            }
        }
        res.sort(Comparator.naturalOrder());
        
        return res;
    }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
int main()
{

    set<int> s;
    vector<int> v;
    int num, num1, num2;
    scanf("%d", &num);

    for (int i = 0; i < num; i++){
        scanf("%d", &num1);
        if (num1 == 0){
            scanf("%d", &num2);
            s.insert(num2);
            //printf("--%d--", s.size());
            v.push_back(s.size());
        }
        else if(num1 == 1){
            scanf("%d", &num2);
            s.find(num2);
            //printf("--%d--", s.count(num2));
            v.push_back(s.count(num2));
        }
    }

    for (auto val : v){
        cout << val << "\n";
    }

    return 0;
}



Measured memory_bytes: 13044
#include <cstdio>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

using ll = long long;

constexpr int MAX_N = 100000;

ll N, L;
ll a[MAX_N];

int main()
{
  scanf( "%lld%lld", &N, &L );
  rep( i, N )
    scanf( "%lld", a+i );

  int p = -1;
  rep( i, N-1 ) if( a[i]+a[i+1] >= L )
  {
    p = i;

    break;
  }

  if( p == -1 )
    puts( "Impossible" );
  else
  {
    puts( "Possible" );

    rep( i, p )
      printf( "%d\n", i+1 );
    for( int i = N-2; i >= p+1; --i )
      printf( "%d\n", i+1 );

    printf( "%d\n", p+1 );
  }
  
  return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <ctime>

#define inf 0x3f3f3f3f
#define Inf 0x3FFFFFFFFFFFFFFFLL
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Rep(i, n) for (int i = 1; i <= (n); ++i)
#define clr(x, a) memset(x, (a), sizeof x)
using namespace std;
typedef long long ll;
int const N = 500020 * 4;
int tree[N];
char s[N];
void build(int l, int r, int p) {
  if (l == r) {
    tree[p] = 1 << (s[l] - 'a');
    return;
  }
  int mid = (l + r) / 2, lp = p << 1, rp = p << 1 | 1;
  build(l, mid, lp);
  build(mid+1, r, rp);
  tree[p] = tree[lp] | tree[rp];
}
void update(int l, int r, int a, int c, int p) {
  if (l == r) {
    tree[p] = 1 << c;
    return;
  }
  int mid = (l + r) / 2, lp = p << 1, rp = p << 1 | 1;
  if (a <= mid) update(l, mid, a, c, lp);
  else update(mid+1, r, a, c, rp);
  tree[p] = tree[lp] | tree[rp];
}
int query(int l, int r, int a, int b, int p) {
  if (l == a && r == b) {
    return tree[p];
  }
   int mid = (l + r) / 2, lp = p << 1, rp = p << 1 | 1;
   if (b <= mid) return query(l, mid, a, b, lp);
   else if (a > mid) return query(mid+1, r, a, b, rp);
   else {
     return query(l, mid, a, mid, lp) | query(mid+1, r, mid+1, b, rp);
   }
}
int main() {
  int n, q; scanf("%d %s %d", &n, s + 1, &q);
  build(1, n, 1);
  rep(i, q) {
    int t; scanf("%d", &t);
    if (t == 1) {
      int x; char ch; scanf(" %d %c", &x, &ch);
      update(1, n, x, ch - 'a', 1);
    } else {
      int x, y; scanf("%d%d", &x, &y);
      int ret = __builtin_popcount(query(1, n, x, y, 1));
      printf("%d\n", ret);
    }
  }
  return 0;
}



Measured memory_bytes: 5120
#include <iostream>
using namespace std;
int main(){
    int n,ans=0; cin >> n;
    if (n<10) ans += n;
    else if (n<100) ans += 9;
    else if (n<1000) ans += n - 90;
    else if (n<10000) ans += 909;
    else if (n<100000) ans += n - 9090;
    else ans += 90909;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
using ll = long long;
const ll MOD = 1000000007;

int uft[100010], siz[100010];
vector<int> G[100010];

int root(int x) {
	if (uft[x] == x)return x;
	uft[x] = root(uft[x]);
	return uft[x];
}

bool same(int x, int y) {
	return root(x) == root(y);
}

void unite(int x, int y) {
	x = root(x);
	y = root(y);
	if (x == y)return;
	uft[x] = y;
	siz[y] += siz[x];
}

int main() {
	for (int i = 0;i < 100010;i++)uft[i] = i, siz[i] = 1;
	int N, M, K, a, b;
	cin >> N >> M >> K;
	for (int i = 0;i < M;i++) {
		cin >> a >> b;
		unite(a, b);
		G[a].push_back(b);
		G[b].push_back(a);
	}
	set<pair<int, int>> S;
	for (int i = 0;i < K;i++) {
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	
	int cnt;
	for (int i = 1;i <= N;i++) {
		cnt = siz[root(i)];
		for (auto x : G[i]) {
			if (same(i, x))cnt--;
		}

		cout << cnt - 1;
		if (i == N)cout << endl;
		else cout << " ";
	}
}


Measured memory_bytes: 8696
#include<stdio.h>

int main(){
  int n = 0;
  int k = 0;
  int q = 0;
  int a[100000] = {};
  int acount[100000] = {};
  int i = 0;
  int j = 0;
  
  scanf("%d %d %d",&n,&k,&q);
  
  for(i = 0;i < q;i++){
    scanf("%d",&a[i]);
  }
  
  for(i = 0;i < q;i++){
    acount[a[i]-1]++;
  }
  
  for(i = 0;i < n;i++){
    if(k -(q - acount[i])<= 0){
      printf("No\n");
    }else{
      printf("Yes\n");
    }
  }
  return 0;
}
    

Measured memory_bytes: 1280
n = int(input())
As = list(map(int, input().split()))

As.sort()
from bisect import bisect_right
n = As[-1]
Xs = As[:-1]
s = [(abs(n/2-x),i) for i, x in enumerate(Xs)]
s.sort()
print(n, Xs[s[0][1]])



Measured memory_bytes: 20836
import sys

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

H2= reversed(H)

maxC=-1
tmpC=0

tmp=0

for i in H2:
  if tmp == 0:
      tmp=i
  elif tmp<=i:
    tmpC+= 1
    tmp= i
  else:
    if maxC< tmpC:
      maxC= tmpC
    tmpC= 0
    tmp=i

if maxC == -1:
  maxC= tmpC

print(maxC)


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

int main(){

  int a,b,c,k;

  cin >> a >> b >> c >> k;

  int sum = 0;

  for(int i=0;i<k;i++){
    if(a>0){
      a--;
      sum+=1;
    }else if(b>0){
      b--;
      sum=sum;
    }else{
      c--;
      sum-=1;
    }
  }

  cout << sum << endl;

}

Measured memory_bytes: 3636
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 1e18;
long long int mod = 1000000007;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1 , number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1 , number1);
    }
}

ll i,j,k,ii,jj,n,m,a,b,c,d,e,f,g,h,r,w,l;
ll num,ans,sum,ok,ng;
ll x[500005],y[500005],z[500005];
char s[500005];
bool dame,flag;

int main(){
	cin >> n >> a >> b;
	pe(min(a,b));
	p(max(0ll,a+b-n));
	return 0;
}

Measured memory_bytes: 26236
n=int(input())
arr=[]
arr=[0]+[int(i) for i in input().split(" ")]
dp=[0]*(n+1)
dp[n]=0
dp[n-1]=abs(arr[n-1]-arr[n])
for i in range(n-2,0,-1):
    dp[i]=min( dp[i+1]+abs(arr[i]-arr[i+1]) , dp[i+2]+abs(arr[i]-arr[i+2]) )
print(dp[1])


Measured memory_bytes: 13980
import sys
input = sys.stdin.readline

n, m = list(map(int, input().rstrip().split()))
ans = [""] * m
arr = []
cnt = 1
for i in range(m):
    p, y = map(int, input().split())
    arr += [(p, y, i)]
arr = sorted(arr)

ans[arr[0][2]] = "{:06}{:06}".format(arr[0][0], cnt)
for i in range(1, m):
    if arr[i - 1][0] == arr[i][0]:
        cnt += 1
    else:
        cnt = 1
    ans[arr[i][2]] = "{:06}{:06}".format(arr[i][0], cnt)

for i in ans:
    print(i)

Measured memory_bytes: 29044