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

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(a>b)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream&os, const pair<t,u>&p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream&operator <<(ostream&os,const vc<t>&v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

template<class t>
void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

const int inf=LLONG_MAX/3;

template<class d>
struct maxflow{
	struct E{
		int to,rev;
		d cap;
	};
	vvc<E> g;
	vi itr,lv;
	maxflow(int n):g(n),itr(n),lv(n){}
	void ae(int s,int t,d c){
		g[s].pb({t,(int)g[t].size(),c});
		g[t].pb({s,(int)g[s].size()-1,0});
	}
	void bfs(int s){
		fill(all(lv),-1);
		lv[s]=0;
		queue<int> q;
		q.push(s);
		while(q.size()){
			int v=q.front();q.pop();
			for(auto e:g[v])if(e.cap>0&&lv[e.to]==-1){
				lv[e.to]=lv[v]+1;
				q.push(e.to);
			}
		}
	}
	d dfs(int v,int t,d f){
		if(v==t)return f;
		d res=0;
		for(int&i=itr[v];i<(int)g[v].size();i++){
			E&e=g[v][i];
			if(e.cap>0&&lv[e.to]==lv[v]+1){
				d a=dfs(e.to,t,min(f,e.cap));
				if(a>0){
					e.cap-=a;
					g[e.to][e.rev].cap+=a;
					res+=a;
					f-=a;
					if(f<=0)break;
				}
			}
		}
		return res;
	}
	d calc(int s,int t){
		d f=0;
		while(1){
			bfs(s);
			if(lv[t]==-1)
				return f;
			fill(all(itr),0);
			f+=dfs(s,t,inf);
		}
	}
};

struct unionfind{
	vi p,s;
	int c;
	unionfind(int n):p(n,-1),s(n,1),c(n){}
	int find(int a){
		return p[a]==-1?a:(p[a]=find(p[a]));
	}
	bool unite(int a,int b){
		a=find(a);
		b=find(b);
		if(a==b)return false;
		p[b]=a;
		s[a]+=s[b];
		c--;
		return true;
	}
	bool same(int a,int b){
		return find(a)==find(b);
	}
	int sz(int a){
		return s[find(a)];
	}
};

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	
	int n,m;cin>>n>>m;
	
	maxflow<int> mcf(1+n+n+1);
	rep(i,n){
		mcf.ae(0,1+i,1);
		mcf.ae(1+n+i,1+n+n,1);
	}
	
	unionfind uf(n*2);
	vi iso(n*2,1);
	int x=m,y=m;
	
	rep(_,m){
		int a,b;cin>>a>>b;
		a--;
		b--;
		mcf.ae(1+a,1+n+b,1);
		
		a=uf.find(a);
		b=uf.find(n+b);
		if(iso[a]&&iso[b])y--;
		if(!uf.same(a,b)&&!iso[a]&&!iso[b])y++;
		uf.unite(a,b);
		iso[a]=0;
	}
	
	x-=mcf.calc(0,1+n+n);
	
	cout<<x<<" "<<y<<endl;
}



Measured memory_bytes: 3356
#include <iostream>

using namespace std;

int main()
{
	int n;
	int a[100000];
	int odd=0;
	cin >> n;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}

	for(int i=0;i<n;i++)
	{
		if(a[i]%2 != 0)
		{
			odd++;
		}
	}

	if(odd%2==0)
	{
		cout << "YES" <<endl;
	}else{
		cout << "NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 640
#うまくグルーピングしてあげればおｋ
#奇数の場合,一番大きい数字をソロ、それ以外は2個ずついい感じで分ける
#偶数の場合は、i番目に大きいやつとi番目に小さいやつをペア
n = int(input())
ans = []
if n % 2 == 0:
    for i in range(1,n+1):
        for j in range(i,n+1):
            #自分と、自分のペア以外に辺を張る
            if j != i and i + j != n + 1:
                ans.append([i,j])
    print(len(ans))
    for i in range(len(ans)):
        print("{} {}".format(ans[i][0], ans[i][1]))
else:
    for i in range(1,n):
        #頂点nからは全ての辺に対して張る
        ans.append([n,i])
        for j in range(i,n):
            #自分と、自分のペア以外に辺を張る
            if j != i and i + j != n:
                ans.append([i,j])
    print(len(ans))
    for i in range(len(ans)):
        print("{} {}".format(ans[i][0], ans[i][1]))

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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
const long long MOD = 1e9 + 7;
///////////////////////////////////////////////
// for template
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;
}
///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
int main() {
    string S; cin >> S;
    cout << S[0] << S[1] << S[2] << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

void read();
template<typename First, typename... Rest> void read(First& first, Rest&... rest);
void write();
template<typename First, typename... Rest> void write(First first, Rest... rest);
template<typename T> void write_vec(vector<T>& v, char divider);

ll llpow(ll n, ll r) {
    if(r == 0) return 1;
    if(n == 0) return 0;
    if(r % 2 == 0) {
        ll tmp = llpow(n, r / 2);
        return tmp * tmp;
    }
    else {
        return n * llpow(n, r - 1);
    }
}

ll sg(ll n){
    if(n < 0) return -1;
    return 1;
}

int main(){
    ll X;
    read(X);
    vector<pair<ll, ll>> n;
    for(ll i = 0; llpow(i, 5) - llpow(i - 1, 5) <= 1000000000; i++){
        n.push_back(make_pair(i, llpow(i, 5)));
    } 
    ll A = 0;
    while(llpow(A, 5) - llpow(A - 1, 5) <= 1000000000){
        ll B5 = -(X - llpow(A, 5));
        for(int i = 0; i < n.size(); i++){
            if(n[i].second == abs(B5)) {
                cout << A << ' ' << n[i].first * sg(B5);
                return 0;
            }
        }
        A++;
    }
    return 0;
}

//配列以外の入力を受け取る
void read(){

}
template<typename First, typename... Rest>
void read(First& first, Rest&... rest){
    cin >> first;
    read(rest...);
}
//
//配列以外を出力する
void write(){

}
template<typename First, typename... Rest>
void write(First first, Rest... rest){
    cout << first << " ";
    write(rest...);
}
//
//配列を区切って出力する
template<typename T>
void write_vec(vector<T>& v, char divider){
    for(size_t i = 0; i < v.size(); i++){
        cout << v[i] << divider;
    }
}
//

Measured memory_bytes: 3624
//#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<ctype.h>
#include <fstream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
int dy[4]={0,1,0,-1};
//----------program from here----------

int main(){
  int M=0;
  cin >> M;
  cout << 48-M << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define sz(v) (int)(v.size())
#define all(x) x.begin(), x.end()
#define prec fixed << setprecision(20)
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define test int t; cin >> t; while(t--)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef set<int> si;
typedef map<int, int> mii;
typedef vector<pii> vpi;

int n, m, k, c[20], a[20][20];

int cost(int x) {
	vi v;
	while (x) {
		v.pb(x % 2);
		x /= 2;
	}
	int skill[20];
	int res = 0;
	for (int i = 0; i < m; ++i) skill[i] = 0;
	for (int i = 0; i < v.size(); ++i) {
		if (v[i]) {
			res += c[i];
			for (int j = 0; j < m; ++j) skill[j] += a[i][j];
		}
	}

	for (int i = 0; i < m; ++i) if (skill[i] < k) res = LLONG_MAX;
	return res;
}

void solve() {
	cin >> n >> m >> k;
	rep(i, 0, n - 1) {
		cin >> c[i];
		rep(j, 0, m - 1) cin >> a[i][j];
	}
	int ans = LLONG_MAX;
	rep(i, 0, (1 << n) - 1) {
		ans = min(ans, cost(i));
	}
	cout << (ans == LLONG_MAX ? -1 : ans);
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);


#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	// test
	solve();

	return 0;
}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n = 5;
  vector<int> a(n);
  for (auto&& e : a) cin >> e;
  cout << find(begin(a), end(a), 0) - begin(a) + 1 << '\n';
}


Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main (){
int H,W,i,j,x;
for(;;){
cin>>H>>W;
if(H==0&&W==0){
	break;
}
for(i=1;i<=H;i++){
for(j=1;j<=W;j++){
	x=j%2;
	if(i%2==0){
		if(x==0){
			cout<<"#";
		}
		else{
			cout<<".";
		}
	}
	else if(i%2!=0){
		if(x==0){
			cout<<".";
		}
		else{
			cout<<"#";
		}
	}
}
cout<<endl;
}
cout<<endl;
}
return 0;
}


Measured memory_bytes: 3040
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a,b,c,d;
	string s;
	cin >>n>>a>>b>>c>>d;
	a--;b--;c--;d--;
	cin >>s;
	bool flg=false;
	int cnt=0;
	if (c>d){
		for(int i=b;i<=d;++i){
			flg |= (s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.');
		}
		if (!flg){
			cout <<"No";
			return 0;
		}
	}
	flg=false;
	cnt = 0;
	for(int i=b;i<d;++i){
		if (s[i]=='#')
			cnt++;
		else
			cnt=0;
		if (cnt==2)
			flg=true;
	}
	cnt = 0;
	for(int i=a;i<c;++i){
		if (s[i]=='#')
			cnt++;
		else
			cnt=0;
		if (cnt==2)
			flg=true;
	}
		if (!flg)
			cout <<"Yes";
		else
			cout <<"No";
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>

using namespace std;
int main(){
    int w,h,x,y,r;
    cin >> w >> h >> x >> y >> r;
    
    if ((x-r)>=0 && (x+r)<=w && (y-r)>=0 && (y+r)<=h){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
}
  
    


Measured memory_bytes: 3120
s = ""

def format_input(filename = None):
	global s
	if filename == None:
		s = input()

	elif filename == '__random__':
		from random import randint as rng
		from random import choices
		s = ''.join(choices('abcdefghijklmnopqrstuvwxyz', k = rng(3, 99)))

def get_answer():
	answer = 'No'
	n = len(s)
	rev_s = ''.join(list(reversed(s)))
	for_s = s[:(n-1)//2]
	rev_for_s = ''.join(list(reversed(for_s)))
	lat_s = s[(n+3)//2-1:]
	rev_lat_s = ''.join(list(reversed(lat_s)))
	if s == rev_s and for_s == rev_for_s and lat_s == rev_lat_s:
		answer = 'Yes'
	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)


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

int main(){
    char S[12];
    fgets(S,sizeof(S),stdin);
    S[strlen(S)-1]='\0';
    fflush(stdin);
    int cnt=0;
    int cnt_max=0;
    for(int i; i<11; i++){
        if(S[i]=='A' || S[i]=='C' || S[i]=='G' || S[i]=='T'){
            cnt++;
        }else if(cnt>cnt_max){
            cnt_max=cnt;
            cnt=0;
        }else{
            cnt=0;
        }
    }
    printf("%d\n", cnt_max);
    return 0;
}

Measured memory_bytes: 128
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long 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 debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;
int h, w;
char m[9][9];
char g[9][9];
const int dx[] = {1, 0};
const int dy[] = {0, 1};
void print(){
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cout << m[i][j];
        }
        cout << nl;
    }
    cout << nl;
}
void go(int x, int y){
    if(x == h - 1 && y == w - 1){
        // print();
        bool ok = true;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                ok &= (m[i][j] == g[i][j]);
            }
        }
        if(ok){
            cout << "Possible";
            exit(0);
        }
    }
    for(int i = 0; i < 2; i++){
        int nx = dx[i] + x;
        int ny = dy[i] + y;
        if(nx >= 0 && nx < h && ny >= 0 && ny < w){
            m[nx][ny] = '#';
            go(nx, ny);
            m[nx][ny] = '.';
        }
    }
}
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin >> h >> w;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> g[i][j];
            m[i][j] = '.';
        }
    }
    m[0][0] = '#';
    go(0, 0);
    cout << "Impossible";
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    ll n, l, t;
    cin >> n >> l >> t;
    vector<ll> x(n), y(n), w(n);
    ll k = 0;
    for (int i = 0; i < n; ++i) {
        cin >> x[i] >> w[i];

        if (w[0] != w[i]) {
            if (w[0] == 1 && 2 * t >= x[i] - x[0]) {
                k += (2 * t - x[i] + x[0]) / (l) + 1;
            } else if (w[0] == 2 && 2 * t >= x[0] - x[i] + l) {
                k -= (2 * t - x[0] + x[i] - l) / (l) + 1;
            }
        }

        if (w[i] == 1)
            y[i] = (x[i] + t) % l;
        else
            y[i] = ((x[i] - t) % l + l) % l;
    }

    k = ((k % n) + n) % n;

    ll y0 = y[0];
    sort(y.begin(), y.end());
    int m = lower_bound(y.begin(), y.end(), y0) - y.begin();

    if (w[0] == 1 && m < n - 1 && y[m + 1] == y0)
        ++m;

    for (int i = 0; i < n; ++i) {
        x[(k + i) % n] = y[(m + i) % n];
    }

    for (int i = 0; i < n; ++i) {
        cout << x[i] << endl;
    }

    return 0;
}

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

#define MAX 100001
int N, d[MAX], ans[MAX];
bool seen[MAX];
vector<pair<int, int> > M[MAX];

void dfs(int u){
    seen[u] = true;
    vector<pair<int, int> >::iterator i;
    for(i = M[u].begin(); i != M[u].end(); i++){
        int v = i->first, w = i->second;
        if(seen[v]) continue;
        else{
            d[v] = (d[u] + w) % 2;
            dfs(v);
        }
    }
    return;
}

int main(){
    cin >> N;
    for(int i = 1; i < N; i++){
        int u, v;
        long w;
        cin >> u >> v >> w;
        M[u].push_back(make_pair(v, (int)(w % 2)));
        M[v].push_back(make_pair(u, (int)(w % 2)));
    }
    for(int i = 1; i <= N; i++) seen[i] = false;
    d[1] = 0; dfs(1);
    for(int i = 1; i <= N; i++)
        cout << d[i] << endl;
    return 0;
}

Measured memory_bytes: 7680
n = int(input())
s = list(input())
max_count = 0
for i in range(1,n):
    count = 0
    l = set(s[0:i])
    r = set(s[i:n])
    for j in r:
        if j in l:
            count = count + 1
    else:
        if count > max_count:
            max_count = count

print(max_count)

Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long long dp[110][11000];
long long inv[110000];
int K;
long long calc(int a,int b){
	if(dp[a][b]>=0)return dp[a][b];
	if(a==0)return dp[a][b]=0;
	long long ret=0;
	for(int i=0;i<=K;i++){
		int f=(b+i)/a;
		int h=(b+i)%a;
		if(i>a){
			f=0;h=b+i;
		}
		ret=(ret+inv[K+1]*(calc(a-1,b+f)+h))%mod;
	}
	return dp[a][b]=ret;
}
int main(){
	inv[1]=1;
	for(int i=2;i<110000;i++)inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	int a,b;scanf("%d%d",&a,&b);
	K=b;
	for(int i=0;i<110;i++)for(int j=0;j<11000;j++)dp[i][j]=-1;
	long long ret=calc(a,0);
	for(int i=0;i<a;i++)ret=ret*(b+1)%mod;
	printf("%lld\n",ret);
}

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

int main()
{
    int n;

    while( cin >> n )
    {
        if( n == 0 )
            break;
        int a[n];

        double sum = 0;
        for( int i = 0; i < n; i++ )
        {
            cin >> a[i];
            sum += a[i];
        }

        double ave = sum / n;
        int cnt = 0;
        for( int i = 0; i < n; i++ )
            if( a[i] <= ave )
                cnt++;

        cout << cnt << endl;
    }
    return 0;
}


Measured memory_bytes: 3160
// A: Crackers
"use strict";

const DEBUG_MODE = false;
const rawInput = DEBUG_MODE
  ? "6 3"
  : require("fs")
      .readFileSync("/dev/stdin", "utf8")
      .trim();

const process = input => {
  const processedInput = input.split(" ");
  const crackerCount = parseInt(processedInput[0]);
  const peopleCount = parseInt(processedInput[1]);

  const output = crackerCount % peopleCount > 0 ? 1 : 0;

  console.log(output);
};

process(rawInput);


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

int main(){
	int N,T;
	int c,t;
	int ans = 1001;
	
	cin >> N >> T;
	while(N--){
		cin >> c >> t;
		
		if(t<=T&&ans > c){
			ans = c;
		}
	}
	
	if(ans!=1001){
		cout << ans << endl;
	}
	else cout << "TLE" << endl;
	return 0;
}

Measured memory_bytes: 256
N=gets.to_i
x,y=gets.chomp.split(" ").map(&:to_i)
s1=[x,y]
s2=[x,y]
s3=[x,y]
s4=[x,y]
(N-1).times do
    x,y=gets.chomp.split(" ").map(&:to_i)
    if x+y >= s1[0]+s1[1]
        s1=[x,y]
    end
    if x-y >= s4[0]-s4[1]
        s4=[x,y]
    end
    if x+y <= s3[0]+s3[1]
        s3=[x,y]
    end
    if x-y <= s2[0]-s2[1]
        s2=[x,y]
    end
end
r1 = (s1[0]-s3[0]).abs + (s1[1]-s3[1]).abs
r2 = (s2[0]-s4[0]).abs + (s2[1]-s4[1]).abs
puts r1>r2 ? r1 : r2


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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int n;
    Scd(n);
    int a;
    int ans = 0;
    Rep(i,n){
        Scd(a);
        ans += a%2;
    }

    if( ans ) printf ("first\n");
    else printf("second\n");

    return 0;
}



Measured memory_bytes: 256
def countingsort(a, n):
    c = [0]*10001

    for i in range(n):
        c[a[i]] += 1

    for j in range(1, 10001):
        c[j] += c[j - 1]

    b = [0]*(n+1)

    for k in range(n, 0, -1):
        b[c[a[k-1]]] = a[k-1]
        c[a[k-1]] -= 1

    return b[1:]


n = int(input())
a = list(map(int, input().split()))
print(*countingsort(a, n))

Measured memory_bytes: 230636
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void qmax(int &x,int y) {if (x<y) x=y;}
void qmin(int &x,int y) {if (x>y) x=y;}
inline int read()
{
    char s;
    int k=0,base=1;
    while((s=getchar())!='-'&&s!=EOF&&!(isdigit(s)));
    if(s==EOF)exit(0);
    if(s=='-')base=-1,s=getchar();
    while(isdigit(s)){k=k*10+(s^'0');s=getchar();}
    return k*base;
}
inline void write(int x)
{
    static char cnt,num[15];cnt=0;
    if (!x)
    {
        printf("0");
        return;
    }
    for (;x;x/=10) num[++cnt]=x%10;
    for (;cnt;putchar(num[cnt--]+48));
}
const ll mod=1e9+7;
const ll maxn=1e6+100;
ll p[maxn],ans,n,ny[maxn],f[maxn];
ll ksm(ll x,int y)
{
	ll sum=1;
	while (y)
	{
		if (y&1) sum=sum*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return sum;
}
ll C(int x,int y)
{
	if (x<y) return 0;
	return p[x]*ny[y]%mod*ny[x-y]%mod;
}
int main()
{
	n=read();
	p[0]=1;ny[0]=1;
	for (int i=1;i<n;i++) p[i]=p[i-1]*i%mod,ny[i]=ksm(p[i],mod-2);
	for (int i=(n+1)/2;i<n;i++)
	{
		f[i]=C(i-1,n-i-1)*p[i]%mod*p[n-i-1]%mod;
	}
	for (int i=(n+1)/2;i<n;i++)
	{
		ans+=(f[i]-f[i-1])*i%mod;
		ans%=mod;
	}
	ans=(ans%mod+mod)%mod;
	cout<<ans;
}

	

Measured memory_bytes: 21632
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> table(n,vector<int>(m,0));
    //要素ｍの配列がｎ個
    for(int i=0;i<n;++i){
        for(int j=0;j<m;++j){
            cin >>table.at(i).at(j);
        }
    }
    vector<int> vec(m);
    for(int j=0;j<m;++j){
        cin >> vec.at(j);
    }
    vector<int> ans(n,0);
    for(int i=0;i<n;++i){
        for(int j=0;j<m;++j){
            ans.at(i) += table.at(i).at(j) * vec.at(j);
        }
    }
    cout << ans.at(0);
    for(int i=1;i<n;++i){
        cout << endl <<ans.at(i);
    }
    cout << endl;
}


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

int main(){
  long long a,b,c,k;
  long long ans = 0;
  cin >> a >> b >> c >> k;
  if(k<=a){ans = k;}
  else if(k<=a+b){ans = a;}
  else {ans = a - (k-(a+b));}
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
from collections import Counter

N, M = map(int, input().split())
counter = Counter()
for i in range(M):
    a, b = map(int, input().split())
    counter[a] += 1
    counter[b] += 1

if all(x % 2 == 0 for x in counter.values()):
    print("YES")
else:
    print("NO")


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

int main(){

  int N,T;
  cin >> N >> T;

  int a[100001] = {};
  for(int i = 0; i < N; i++){
    int l,r;
    cin >> l >> r;

    a[l]++; a[r]--;
    
  }

  for(int i = 1; i < T; i++){
    a[i] += a[i-1];
  }

  int ans = 0;
  for(int i = 0; i < T; i++){
    ans = max(ans,a[i]);
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3500
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  ll n,m,v,p;
  cin >> n >> m >> v >> p;
  vector<ll>a(n);
  rep(i,n) cin >> a[i];
  sort(all(a),greater<ll>());
  int ok=0,ng=n;
  while(abs(ok-ng)>1){
    int mid=(ok+ng)/2;
    if(mid<p)ok=mid;
    else if(a[p-1]>a[mid]+m)ng=mid;
    else {
      ll vote=0;
      vote+=(p-1)*m+(n-mid)*m;
      exrep(i,p-1,mid-1){
        vote+=max(0ll,a[mid]+m-a[i]);
      }
      if(vote>=m*v)ok=mid;
      else ng=mid;
    }
  }
  cout << ok+1 << endl;
  
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
int main()
{
	ll a,b,c,d,k;
	cin>>a>>b>>c>>k;
	if(k%2==0)cout<<a-b<<endl;
	else if(k%2==1)cout<<b-a<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    m = 100
    l = [0]*10**5
    for i in range(1, m):
        for j in range(1, m):
            for k in range(1, m):
                l[i**2 + j**2 + k**2 + i*j + j*k + k*i] += 1
    n = ni()
    prn(l[1:n+1])
    return

solve()


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

void solve(int a, int b, int c, int d){
  int op1, op2, op3;
  string oo1, oo2, oo3;
  int ab, abc, abcd;
  bool flag = 0;
  for (int i=0; i<2; i++){
    if (i) ab = a+b; else ab = a-b;
    for (int j=0; j<2; j++){
      if (j) abc = ab+c; else abc = ab-c;
      for (int k=0; k<2; k++){
        if (k) abcd = abc+d; else abcd = abc-d;
        if (abcd == 7){
          op1 = i; op2 = j; op3 = k;
          flag = 1;
          break;
        }
      }
      if (flag) break;
    }
    if (flag) break;
  }
  if (op1) oo1 = "+"; else oo1 = "-";
  if (op2) oo2 = "+"; else oo2 = "-";
  if (op3) oo3 = "+"; else oo3 = "-";
  
  cout <<a <<oo1 <<b <<oo2 <<c <<oo3 <<d <<"=7" <<endl;
}

int main() {
  int ha, a, b, c, d;
  cin >> ha;
  a = ha/1000; b = ha/100%10; c = ha/10%10; d = ha%10;
  // とりあえずabcdというやつにはなった
  
  solve(a, b, c, d);
}


Measured memory_bytes: 256
n = int(input())
A = list(input().split())
B = ""
m = n//2
if n%2 == 0:
  for i in range(m):
    B += A[n-1-2*i]
    B += " "
  for i in range(m):
    B += A[i*2]
    B += " "
else:
  for i in range(m+1):
    B += A[n-1-2*i]
    B += " "
  for i in range(m):
    B += A[i*2+1]
    B += " "
print(B[:-1])

Measured memory_bytes: 27712
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
	ll h;
    cin>>h;
    int cnt=0;
    while(h>=1){
        h/=2;
        cnt++;
    }
    ll ans=0;
    ans=pow(2,cnt)-1;
    OUT(ans);
	return 0;
}

Measured memory_bytes: 256
import sys
import itertools
import numpy as np
MOD = 3
INF = 1000000000


def input():
    return sys.stdin.readline().rstrip()


def main():
    n, c = [int(e) for e in input().split()]
    dMat = [[int(e) for e in input().split()] for _ in range(c)]
    cMat = [[int(e) for e in input().split()] for _ in range(n)]

    cost = [[0 for _ in range(c)] for _ in range(MOD)]
    for hi in range(n):
        for wi in range(n):
            cMod = ((hi + 1) + (wi + 1)) % MOD
            for ci in range(c):
                cost[cMod][ci] += dMat[cMat[hi][wi] - 1][ci]

    ans = INF
    for perm in itertools.permutations(range(c), MOD):
        costSum = 0
        for di in range(MOD):
            costSum += cost[di][perm[di]]
        ans = min(ans, costSum)
    print(ans)


main()


Measured memory_bytes: 24816
#include <iostream>
#include <iomanip>
#include <vector>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int n;
    cin >> n;
    vector<int> a(n, 0);
    int cnt = 1, M = 0;
    repi(i, n, 0)
    {
        cin >> a[i];
        if (M == a[i])
            cnt++;

        if (M < a[i])
        {
            cnt = 1;
            M = a[i];
        }
    }
    if (cnt > 1)
    {
        repi(i, n, 0)
        {
            cout << M << "\n";
        }
    }
    else
    {
        repi(i, n, 0)
        {
            if (M == a[i])
            {
                int m = 0;
                repi(j, n, 0)
                {
                    if (M == a[j])
                        continue;
                    if (m < a[j])
                        m = a[j];
                }
                cout << m << "\n";
            }
            else
            {
                cout << M << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 2432
#include <stdio.h>
int main()
{
	int A=0,B=0,C=0;
	scanf("%d %d %d",&A,&B,&C);
	
	if(A<=C&&C<=B)
	{
		printf("Yes");
	}
	
	else if(B<=C&&C<=A)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
int main(){
    string s,t;
    cin>>s>>t;
    int c=0;
    int n= s.length();
    rep(i,n){
        if(s[i]!=t[i])c++;
    }
    cout<<c<<endl;
}

Measured memory_bytes: 3848
#include<bits/stdc++.h>
namespace P_TEMPLATE{
	#define endl '\n'
	#define rgi register int
	typedef long long ll;
	class fastin{private:int _ch,_f;
	public:inline fastin&operator>>(char&c){c=getchar();return*this;}
	template<typename _Tp>inline fastin&operator>>(_Tp&_x){
	_x=0;while(!isdigit(_ch))_f|=(_ch==45),_ch=getchar();
	while(isdigit(_ch))_x=(_x<<1)+(_x<<3)+(_ch^48),_ch=getchar();
	_f&&(_x=-_x,_f=0);return*this;}fastin(){_ch=_f=0;}
	}fin;class fastout{private:int _num[32],_head;
	public:inline fastout&operator<<(char c){putchar(c);return*this;}
	template<typename _Tp> inline fastout&operator<<(_Tp _x){
	_Tp _k;if(_x==0){putchar('0');return *this;}if(_x<0)putchar('-'),_x=-_x;
	while(_x>0)_k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k;
	while(_head>0)putchar(_num[_head]),--_head;return*this;}fastout(){_head=0;}
	}fout;inline void P_INIT(){
	#ifdef D_STDOUT_UNBUFFERED
	setbuf(stdout,NULL),setbuf(stdin,NULL);
	#endif
}}using namespace P_TEMPLATE;
// ----------------------------
// #define int ll
using namespace std;
const int maxn=1000004;
const int mod=1000000007,inf=1201201201;

bool isnp[maxn];
int pr[maxn],d[maxn],t[maxn],cnt;
inline void init(int n) {
	d[1]=1;
	for(rgi i=2;i<=n;++i) {
		if(!isnp[i]) pr[++cnt]=i,d[i]=2,t[i]=1;
		for(rgi j=1;j<=cnt&&i*pr[j]<=n;++j) {
			isnp[i*pr[j]]=1;
			if(i%pr[j]==0) {
				t[i*pr[j]]=t[i]+1;
				d[i*pr[j]]=d[i]/(t[i]+1)*(t[i]+2);
				break;
			} d[i*pr[j]]=d[i]*d[pr[j]],t[i*pr[j]]=1;
		}
	}
}

signed main()
{P_INIT();
	int n;
	fin>>n;
	init(n);
	ll ans=0;
	for(rgi i=1;i<n;++i) ans+=d[i];
	fout<<ans;
	return 0;
}
// ----------------------------
// by imzzy

Measured memory_bytes: 12716
#[allow(unused_imports)]
use proconio::{input, marker::*};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

fn main() {
    input! {
        n:usize,
        x: usize,
        t: usize,
    }
    println!("{}", ((n - 1) / x + 1) * t);
}


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

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    double l;
    cin >> l;
    cout << setprecision(13) << fixed << (l/3)*(l/3)*((l/3)+(((int)l%3!=0)*1e-13));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  int i;
  for(i=0;i<3;i++){
    if(N%10==7){
      cout << "Yes" << endl;
      break;
    }
    N/=10;
  }
  if(i==3){
    cout << "No" << endl;
  }
}


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

void solve()
{
 int n;
 string s;
 cin>>n>>s; int cnt=0;
 for(int i=0; i<s.size()-2; i++)
 {
     if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') cnt++;
 }
 cout<<cnt<<endl;


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

    }
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
int d[507][507];
int main()
{
	int a,b,aa,bb;
	scanf("%d %d %d %d",&a,&b,&aa,&bb);
	if(aa==1&&bb==1)
		printf("No\n");
	else
	{
		int i,j;
		int aaa,bbb;
		long long int ans=a*b*(long long)((1e9-!((long long)1e9%(aa*bb-1)))/(aa*bb-1));
		aaa=aa;
		while(aaa<=a)
		{
			bbb=bb;
			while(bbb<=b)
			{
				ans=ans-aa*bb*(long long)((1e9-!((long long)1e9%(aa*bb-1)))/(aa*bb-1))-1;
				bbb=bbb+bb;
			}
			aaa=aaa+aa;
		}
		if(ans>0)
		{
			for(i=1;i<=a;i++)
				for(j=1;j<=b;j++)
				{
					if(!(i%aa)&&!(j%bb))
						d[i][j]=-(aa*bb-1)*(long long)((1e9-!((long long)1e9%(aa*bb-1)))/(aa*bb-1))-1;
					else
						d[i][j]=(long long)((1e9-!((long long)1e9%(aa*bb-1)))/(aa*bb-1));
				}
			printf("Yes\n");
			for(i=1;i<=a;i++)
			{
				for(j=1;j<=b;j++)
					printf("%d ",d[i][j]);
				printf("\n");
			}
		}
		else
			printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 3968
package main

import (
	"fmt"
	"math"
)

func main() {
	var x, n int
	fmt.Scan(&x, &n)
	if n == 0 {
		fmt.Print(x)
		return
	}
	var p = make([]int, n)
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scan(&tmp)
		p[i] = tmp
	}
	ans := 100
	num := 0
	for i := -1; i < 102; i++ {
		bl := false
		for _, e := range p {
			if i == e {
				bl = true
				break
			}
		}
		if bl == true {
			continue
		}
		abs := int(math.Abs(float64(i - x)))
		if abs < ans {
			ans = abs
			num = i
		}
	}
	fmt.Print(num)
}


Measured memory_bytes: 1824
import Control.Applicative
import Control.Monad
import Data.List
import Data.Set (Set)
import qualified Data.Set as S

main :: IO ()
main = do
  [n, m] <- f
  solve n <$> replicateM m f >>= print
  where
    f = map read <$> words <$> getLine

solve :: Int -> [[Int]] -> Int
solve n abs = foldl' f 0 (permutations [2 .. n])
  where
    es = S.fromList (map (\[a, b] -> (a, b)) abs)
    f ct xs
      | all (\(a,b) -> S.member (a, b) es || S.member (b, a) es) (zip (1:xs) xs) = ct + 1
      | otherwise = ct


Measured memory_bytes: 1020
#include <algorithm>
#include <cctype>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

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

    vector<long> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int p = 0;
    for (int i = 0; i < n; i++) {
        if (abs(a[i]) > abs(a[p])) {
            p = i;
        }
    }

    vector<int> x;
    vector<int> y;
    if (a[p] > 0) {
        for (int i = 0; i < n; i++) {
            if (a[i] >= 0) {
                continue;
            }
            a[i] += a[p];
            y.push_back(i);
            x.push_back(p);
        }

        for (int i = 0; i < n - 1; i++) {
            if (a[i] > a[i + 1]) {
                a[i + 1] += a[i];
                y.push_back(i + 1);
                x.push_back(i);
            }
        }
    } else {
        for (int i = 0; i < n; i++) {
            if (a[i] <= 0) {
                continue;
            }
            a[i] += a[p];
            y.push_back(i);
            x.push_back(p);
        }

        for (int i = n - 1; i > 0; i--) {
            if (a[i - 1] > a[i]) {
                a[i - 1] += a[i];
                y.push_back(i - 1);
                x.push_back(i);
            }
        }
    }

    int len = x.size();
    cout << len << endl;
    for (int i = 0; i < len; i++) {
        cout << x[i] + 1 << " " << y[i] + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 888
#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <iostream>
#include <fstream>
#include <numeric>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <iterator>
#include <iomanip>
#include <unordered_map>

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    
    int n,k,p,ans=0;
    cin>>n>>k;
    int dice[n+1];
    dice[0]=0;
    for (int i = 1; i < n+1; ++i)
    {
        cin>>p;
        dice[i]=dice[i-1]+p;
    }
    for (int i = k; i < n+1; ++i)
    {
        ans=max(ans,dice[i]-dice[i-k]);
    }
    cout<<setprecision(12)<<(ans+k)/2.0;
    
}


Measured memory_bytes: 1024
#include<iostream>
#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;

int counter = 0;
void findP(vector<int> points);
int n, m;
vector<pair<int, int>> edge;

int main()
{
#ifdef LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin >> n >> m;
    
    for(int i=0;i<m;i++){
        int p1, p2;
        cin >> p1 >> p2;
        edge.push_back({p1, p2});
    }

    vector<int> points = {1};
    findP(points);

    cout << counter << endl;

    return 0;
}
void findP(vector<int> points){
    if(points.size() >= n){
        counter++;
    }
    else{
        for(auto iter:edge){
            vector<int> tmpPoint = points;
            if(iter.first == tmpPoint[points.size()-1] && std::count(tmpPoint.begin(), tmpPoint.end(), iter.second) == 0){
                tmpPoint.push_back(iter.second);
                findP(tmpPoint);
            }
            else if(iter.second == tmpPoint[points.size()-1] && std::count(tmpPoint.begin(), tmpPoint.end(), iter.first) == 0){
                tmpPoint.push_back(iter.first);
                findP(tmpPoint);
            }
        }
    }
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    ll A[N];
    rep(i, N){
        ll a; cin >> a;
        A[i] = a - (i+1);
    }
    //|A[0]-b| + |A[1]-b| + ... + |A[N-1]-b|の最小値
    sort(A, A+N);
    int mid = A[N/2];
    ll ans = 0;
    rep(i, N) ans += abs(A[i]-mid);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

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

int main(){
    ll h;
    cin >> h;
    int num=0;
    ll ans=1;
    while(h>1){
        h/=2;
        num++;
        ans+=pow(2,num);
    }
    cout << ans << endl;
}

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

ll n, s, sum = -1;

ll work(ll n, ll b) {
	ll ans = 0;
	while(n) ans += n%b, n /= b;
	return ans;
}

int main() {
	scanf("%lld%lld", &n, &s);
	ll u = sqrt(n)+1;
	for(ll i = 2; i <= u; i++) {
		ll c = work(n,i);
		if(s == c) { sum = i; break; }
	}
	if(n == s) sum = n+1;
	if(sum == -1 && n > s) {
		ll c = n - s;
		u = c/(u-1)+1;
    	for (ll i = u; i >= 1; i--) {
    		ll b = c/i+1;
    		if (!(c % i) && s >= i && (s-i) < b && i < b) {
        		sum = b;
        		break;
        	}
    	}
	}
	printf("%lld", sum);
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
using ll = long long;




int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a > b) a = b;
	if (c > d) c = d;
	cout << a + c << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
const int N = 50;
int a[N], cnt[1 << 18];
int main()
{
	int n, k, s, t;
	long long ans = 0, csum[N + 1] = {};
	scanf("%d%d%d%d", &n, &k, &s, &t);
	for (int i = 0; i < n; ++i) {
		scanf("%d", a + i);
		if ((a[i] & s) != s || (a[i] | t) != t) {
			--i;
			--n;
		}
	}
	if (n == 0)
		goto nosolution;
	for (int i = 1; i <= n; ++i) {
		long long com = 1;
		for (int j = 1; j <= i && j <= k; ++j)
			csum[i] += com = com * (i - j + 1) / j;
	}
	for (int i = n; i >= 1; --i)
		csum[i] -= csum[i - 1];
	for (int mask = 1 << 18; mask; ) {
		long long cur = 0;
		mask = (mask - 1) & (s ^ t);
		for (int i = 0; i < n; ++i)
			cur += csum[++cnt[a[i] & mask]];
		if (__builtin_popcount(mask) & 1)
			ans -= cur;
		else
			ans += cur;
		for (int i = 0; i < n; ++i)
			cnt[a[i] & mask] = 0;
	}
nosolution:
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 4744
using System;

namespace OfficialHouse
{
	class MainClass
	{
		public static void Main (string[] args)
		{

			int[, ,] room = new int[4, 3, 10];
			int b, f, r, v;
			string inputn = Console.ReadLine();
			int n = int.Parse(inputn);

			for (int i = 0; i < n; i++)
			{
				string[] str = Console.ReadLine().Split(' ');
				b = int.Parse(str[0]);
				f = int.Parse(str[1]);
				r = int.Parse(str[2]);
				v = int.Parse(str[3]);

				room[b-1, f-1, r-1] += v; 
			}


			for(int i = 0; i < 4; i++)
			{
				for(int j = 0; j < 3; j++)
				{
					for(int k = 0; k < 10; k++)
					{
						Console.Write(" {0}", room[i, j, k]);
					}
					Console.Write("\n");
				}
				if (i < 3)
					Console.WriteLine("####################");
			}
		
		}
	}
}

Measured memory_bytes: 5692
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(b)-1;i>=(a);--i)
#define ALL(a) a.begin(),a.end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double EPS = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if (a < b) { a = b; return true; }
    return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if (a > b) { a = b; return true; }
    return false;
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp);
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v);

template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << "(" << p.first << ":" << p.second << ")";
    return os;
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "{";
    int a = 0;
    for (auto &tp : mp) {
        if (a) os << ", ";
        a = 1; os << tp;
    }
    return os << "}";
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}


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

    int N, M; cin >> N >> M;
    if (N & 1) {
        REP(i, M) {
            cout << i+1 << ' ' << N+1-(i+1) << endl;
        }
    }
    else {
        REP(i, M) {
            if (i & 1) {
                int n = i / 2 + 1;
                cout << n << ' ' << N - n << endl;
            }
            else {
                int n = i / 2;
                cout << N / 2 - n << ' ' << N / 2 + 1 + n << endl;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3656
# D - Lazy Faith

import bisect

A, B, Q = map(int, input().split())
s,t,x = [],[],[]
for _ in range(A):
    s.append(int(input()))
for _ in range(B):
    t.append(int(input()))
for _ in range(Q):
    x.append(int(input()))
    
for start in x:
    ans_list = []
    
    tmp_idx = bisect.bisect_left(s,start)
    if start < s[0]:
        west_s = -1
    else:
        west_s = s[tmp_idx-1]
    if s[-1] < start:
        east_s = -1
    else:
        east_s = s[tmp_idx]
    
    tmp_idx = bisect.bisect_left(t,start)
    if start < t[0]:
        west_t = -1
    else:
        west_t = t[tmp_idx-1]
    if t[-1] < start:
        east_t = -1
    else:
        east_t = t[tmp_idx]
        
    if east_s != -1 and east_t != -1: # 東→東
        ans_list.append(abs(east_s - east_t) + (min(east_s, east_t) - start))
    if west_s != -1 and west_t != -1: # 西→西
        ans_list.append(abs(west_s - west_t) + (start - max(west_s, west_t)))
    if east_s != -1 and west_t != -1: # 東神社→西寺 or 西寺→東神社
        ans_list.append(east_s - start + (east_s - west_t))
        ans_list.append(start - west_t + (east_s - west_t))
    if west_s != -1 and east_t != -1: # 東寺→西神社 or 西神社→東寺
        ans_list.append(east_t - start + (east_t - west_s))
        ans_list.append(start - west_s + (east_t - west_s))

    print(min(ans_list))

Measured memory_bytes: 16152