akhauriyash/Code-Regression huggingface dataset:
#define NAAN_TIKE_PLATYPUS
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;


struct edge {
	int to;
	long long cost;
	int isE;
	edge(int to_, long long cost_, int isE_) :
		to(to_), cost(cost_), isE(isE_) {}
};
const long long INF = 123456789012345;
using P = pair<long long, int>;
void dijkstra(vector<edge>graph_[], long long dist[], int n_, int s_) {
	priority_queue<P, vector<P>, greater<P>>que;
	que.push({ 0,s_ });
	fill(dist, dist + n_, INF);
	dist[s_] = 0ll;
	while (!que.empty()) {
		auto q = que.top();
		que.pop();
		long long thd = q.first;
		int thv = q.second;
		if (thd > dist[thv])
			continue;
		for (auto ed : graph_[thv]) {
			if (dist[ed.to] > ed.cost + thd) {
				dist[ed.to] = ed.cost + thd;
				que.push({ dist[ed.to],ed.to });
			}
		}
	}
}

LL N, T, S, E;
vector<edge>G[123456];
bool mark[123456];
LL cnt[123456];
bool done = false;
bool suc = false;
bool used[123456];
void dfs(int x) {
	//cout << x << endl;
	used[x] = true;
	if (done)return;
	++cnt[x];
	for (auto& p : G[x]) {
		int& v = p.to;
		if (used[v])continue;
		if (p.cost <= (cnt[x] + cnt[p.to]) * T) {
			//渡れない
			done = true;
			return;
		}
		dfs(v);
		if (done)return;
		if (p.cost <= (cnt[x] + cnt[p.to]) * T) {
			//渡れない
			done = true;
			return;
		}
		if (done)return;
		++cnt[x];
	}
	if (x == E) {
		done = true;
		suc = true;
	}
}

LL dS[123456], dE[123456];

int main() {
	cin >> N >> T >> S >> E;
	--S; --E;
	for (int i = 1; i < N; ++i) {
		LL a, b, w;
		cin >> a >> b >> w;
		--a; --b;
		G[a].push_back({ int(b),w,0 });
		G[b].push_back({ int(a),w,0 });
	}
	dijkstra(G, dS, N, S);
	dijkstra(G, dE, N, E);
	LL SE = dS[E];
	for (int i = 0; i < N; ++i) {
		if (dS[i] + dE[i] == SE) {
			mark[i] = true;
		}
	}
	for (int i = 0; i < N; ++i) {
		for (auto& p : G[i]) {
			p.isE = (mark[p.to] && mark[i]);
		}
	}
	for (int x = 0; x < N; ++x) {
		sort(G[x].begin(), G[x].end(), [&](const edge& e1, const edge& e2) {if (e1.isE == e2.isE)return e1.cost > e2.cost; return e1.isE < e2.isE; });
	}
	cnt[S] = -1;
	dfs(S);
	if (suc) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

int main(){
int c[4][4];
  for(int i=1; i<=3; i++){
   for(int j=1; j<=3; j++){
    cin>>c[i][j]; }}
  
  int X=c[1][2]+c[2][1]+c[2][3]+c[3][2]-c[2][2];
  int Y=c[1][1]+c[2][2]+c[3][3];
  int Z=c[1][3]+c[2][2]+c[3][1];
  
  if(X==Y && Y==Z){cout<<"Yes";}
  else{cout<<"No";}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
LL a[SIZE];
int main(){
    DRI(N);
    REP(i,N)cin>>a[i];
    LL an=0;
    while(1){
        LL add[50]={};
        LL sum=0;
        REP(i,N){
            add[i]=a[i]/N;
            sum+=add[i];
            a[i]%=N;
        }
        REP(i,N)a[i]+=sum-add[i];
        an+=sum;
        if(!sum)break;
    }
    cout<<an<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
const ll maxn = 2 * 1e6 + 5;
const ll mod = 1e9 + 7;
int ans[maxn],n,x,y,vis[maxn];
int book[maxn];
vector<int> G[maxn];
void bfs(int x)
{
    book[x] = 1;
    vis[x] = 1;
    queue<int> qu;
    qu.push(x);
    while(qu.size())
    {
        ll t = qu.front();
        qu.pop();
        for(int i = 0; i < G[t].size(); i++)
        {
            ll endd = G[t][i];
            if(vis[endd] == 0)
            {
                vis[endd] = vis[t] + 1;
                if(!book[endd])
                    ans[vis[endd] - 1]++;
                qu.push(endd);
            }
        }
    }
}
int main()
{
    cin >> n >> x >> y;
    for(int i = 1; i <= n - 1; i++)
        G[i].push_back(i + 1),G[i + 1].push_back(i);
    G[x].push_back(y),G[y].push_back(x);
    for(int i = 1; i <= n; i++)
    {
        bfs(i);
        for(int i = 1; i <= n; i++)
            vis[i] = 0;
    }
    for(int i = 1; i <= n - 1; i++)
        cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 51456
n = int(input())
ls_p = list(map(int, input().split()))

cnt = 0

for i in range(1, n-1):
    if (ls_p[i] != min(ls_p[i-1], ls_p[i], ls_p[i+1])) and (ls_p[i] != max(ls_p[i-1], ls_p[i], ls_p[i+1])):
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		if (s.charAt(0)!='A') {
			System.out.println("WA");
			return ;
		}
		int count =0;
		for (int i=2;i<s.length()-1;i++) {
			if (s.charAt(i)=='C') {
				count ++;
			}
		}
		if (count!=1) {
			System.out.println("WA");
			return ;
		}
		for (int i=1;i<s.length();i++) {
			if (s.charAt(i)!='C'&&(s.charAt(i)<'a'||s.charAt(i)>'z')) {
				System.out.println("WA");
				return ;
			}
			if (s.charAt(i)=='C') {
				if (i==1||i==s.length()-1) {
					System.out.println("WA");
					return ;
				}
			}
		}
		System.out.println("AC");
		return ;
	}
}

Measured memory_bytes: 35556
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#define INF 100000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using p = pair<int, int>;


int main() {
    
    ll n,ans;
    ans = 0;
    cin >> n;
    for(int i=1;i<n;i++){
        ans += (n-1)/i;
    }

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

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


#define MAX 100005
#define min(a,b) a<b?a:b

typedef struct
{
	char name[100];
	int time;
}elem;

typedef struct
{
	int length=0;
	int front=0;
	elem Q[MAX];
}Queue;

void EnQueue(Queue &Q, elem e)
{
	int rear = (Q.front + Q.length) % MAX;
	Q.length++;
	Q.Q[rear] = e;
}

elem pop(Queue &Q)
{
	elem t = Q.Q[Q.front];
	Q.front = (Q.front + 1 + MAX) % MAX;
	Q.length--;
	return t;
}

int main()
{
	int  n = 0;
	scanf("%d", &n);
	int q = 0;
	scanf("%d", &q);
	Queue Q;
	for (int i = 0; i < n; i++)
	{
		char name[100]="0";
		scanf("%s",name);
		int time=0;
		scanf("%d", &time);
		elem t;
		strcpy(t.name, name);
		t.time = time;
		EnQueue(Q, t);
	}
	int sum = 0;
	while (Q.length)
	{
		elem t = pop(Q);
		int m = min(q, t.time);
		t.time -= m;
		sum += m;
		if (t.time > 0)
			EnQueue(Q, t);
		else
			printf("%s %d\n", t.name , sum);
	}
	return 0;
}


Measured memory_bytes: 12776
N, A, B, C, D = map(int, input().split())
B = abs(B - A)

if N*C - (N-2)*D <= 0:
  if 0 <= B <= (N-1)*D:
    print('YES')
  else:
    print('NO')
else:
  if B > (N-1)*D:
    print('NO')
  else:
    diff = N*C - (N-2)*D
    lower = (N-1)*C
    while lower >= 0:
      if lower - diff < B < lower:
        print('NO')
        quit()
      lower -= D + C
    print('YES')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
using ll = long long;
using namespace std;

int main(){
    ll n, m;
    cin >> n >> m;
    ll hyaku = 100 * (n - m);
    ll sen = 1900 * m;
    cout << pow(2, m) * (hyaku + sen) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
 
  int n;
  cin>>n;
  if(n<105){
    cout<<0<<endl;
    return 0;
  }
  int ans=1;
  for(int i=107;i<=n;i+=2){
    int cnt=1;
    for(int j=1;j<i;j++){
      if(i%j==0)cnt++;
    }
    if(cnt==8)ans++;
    // cout<<cnt<<endl;
  }
  cout<<ans<<endl;
  return 0;
}

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

#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)
#define bf(i,s) for(int i = head[s]; i; i = e[i].next)
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define VI vector<int>
#define sf scanf
#define pf printf
#define fp freopen
#define SZ(x) ((int)(x).size())
#ifdef MPS
#define D(x...) printf(x)
#else
#define D(x...)
#endif
typedef long long ll;
typedef double db;
typedef unsigned long long ull;
const int inf = 1<<30;
const ll INF = 1ll<<60;
const db Inf = 1e20;
const db eps = 1e-9;

void gmax(int &a,int b){a = (a > b ? a : b);}
void gmin(int &a,int b){a = (a < b ? a : b);}

const int maxn = 105;

int n, m, v[maxn];
struct edge{int u, v;}e[maxn*maxn];

int main()
{
	#ifdef MPS	
		fp("1.in","r",stdin);
		fp("1.out","w",stdout);
	#endif
	sf("%d",&n);
	if(n == 3) return 0 * pf("2\n1 3\n2 3\n");
	fo(i,1,n-1) fo(j,i+1,n) if(i+j!=(n%2==0?n+1:n)) e[++m] = (struct edge){i,j};
	pf("%d\n",m);
	fo(i,1,m) {pf("%d %d\n",e[i].u,e[i].v); v[e[i].u] += e[i].v; v[e[i].v] += e[i].u;}
	D("~~~~~~~~~~~~~~~~\n");
	fo(i,1,n) D("%d %d\n",i,v[i]);
	return 0;
}

Measured memory_bytes: 256
chikei = input()
v_lakes = []
idx_stack = []

for i, c in enumerate(chikei):
	if c is "\\":
		idx_stack.append(i)
	elif c is "/" and idx_stack:
		j = idx_stack.pop()
		v = i - j
		while v_lakes and j < v_lakes[-1][0]:
			v += v_lakes.pop()[1]
		v_lakes.append((j, v))

ans = [len(v_lakes)]
v = [v[1] for v in v_lakes]
ans.extend(v)
print(sum(v))
print(*ans)


Measured memory_bytes: 6508
import sys

if sys.subversion[0] == "PyPy":
    import io, atexit

    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()
RS = raw_input
RA = lambda x=int: map(x, RS().split())
RN = lambda x=int: x(RS())


def solve():
    l = str(n)
    l = [int(i) for i in list(l)]
    s = sum(l)
    if s % 9 == 0:
        print("Yes")
    else:
        print("No")
    return




n = RN()
solve()



Measured memory_bytes: 86568
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
static const ll mod=1000000007;
ll modpow(ll x,ll y){
if(y==0)
  return 1;
  else if(y%2==0){
  ll z=modpow(x,y/2);
    return (z*z)%mod;
  }else{
  ll z=modpow(x,y/2);
    return (x*((z*z)%mod))%mod;
  }
    
}
ll N;
int main(){
  cin>>N;
  ll ans=(modpow(10,N)-2*modpow(9,N)+modpow(8,N)+4*mod)%mod;
   cout<<ans<<endl;
  return 0;
}

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

using namespace std;

using int64 = long long;

int main() {
  int64 a, b, c;
  scanf("%lld/%lld/%lld", &a, &b, &c);
  int64 v = 2019 * 100000000LL + 4 * 100 + 30;
  if(a * 100000000LL + b * 100 + c <= v) puts("Heisei");
  else puts("TBD");
}


Measured memory_bytes: 256
N = int(input())
a = [int(input()) for _ in range(N)]
count = 1
nx = a[0]
for i in range(N+1):
    if nx==2:
        break
    else:
        nx = a[nx-1]
        count += 1
if count==N+2:
    print(-1)
else:
    print(count)

Measured memory_bytes: 49744
#include<bits/stdc++.h>
#include<numeric>
#define int long long
#define ld long double
#define all(x) x.begin(),x.end()
const int maxn=1000000;
#define what_is(x) cerr << #x << " is " << x << endl;
const int MOD = 1e9 + 7;
using namespace std;
string abc="abcdefghijklmnopqrstuvwxyz";
int powmod(int a, int b, int MOD = MOD){
    if(!a and !b)    return 1ll;
    if(!a)    return a;
    int res = 1ll;
    b %= (MOD - 1ll), a %= MOD;
    while(b){
        if(b%2 == 1)    res = (res * a) % MOD;
        a = (a * a) % MOD;
        b /= 2;
    }
    return res;
}
int popcount(uint32_t n)
{
    n = n - ((n >> 1) & 0x55555555);
    n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
    return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
bool check(int n) {return (((double)sqrt(n)-floor((double)sqrt(n)))==0);}
vector<bool> sieve(maxn + 1, true);
void fillprime() {
    sieve[0] = sieve[1] = false;
    for (int i = 2; i <= maxn; ++i) {
        if (sieve[i] && (int) i * i <= maxn) {
            for (int j = i * i; j <= maxn; j += i) {
                sieve[j] = false;
            }
        }
    }
}
const int nn=1e5+5;
int result[100005];
void solve() {
  int n;
  cin>>n;
  int arr[n];
  map<int,int> mp;
  for(int i=0;i<n;++i)
  {
      cin>>arr[i];
      mp[arr[i]]=i+1;
  }
  sort(arr,arr+n);
  for(int i=0;i<n;++i) cout<<mp[arr[i]]<<" ";
   
    
}
int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    //fillprime();
    //int t;cin>>t;while(t--)
    solve();
}

Measured memory_bytes: 10584
#include <stdio.h>
#include <stdlib.h>

struct node{
	int id;
	struct node *parentNode;
	struct node *firstChild;
	struct node *sibling;
};

struct node* createNode(int);
struct node* searchNode(int);
int getHeight(struct node* nd);

struct node* nodes[26];
int n;

int main(){

int i,j;
int id;
int tmpId;
int left, right;
int depth;
struct node* currentNode;
struct node* tmpNode;
struct node* leftChild;
struct node* rightChild;

scanf("%d",&n);
	
for(i=0;i<n;i++){
	
	scanf("%d",&id);
	currentNode = createNode(id);
	
	scanf("%d",&left);
	leftChild = createNode(left);
	scanf("%d",&right);
	rightChild = createNode(right);
	
	if(leftChild){
		leftChild->sibling = rightChild;
		leftChild->parentNode = currentNode;
		currentNode->firstChild = leftChild;
	}
	if(rightChild){
		rightChild->sibling = leftChild;
		rightChild->parentNode = currentNode;
		if(leftChild==NULL) currentNode->firstChild = rightChild;
	}
	
}
	
	for(i=0; i<n; i++){
		
		printf("node %d: ",nodes[i]->id);
		printf("parent = %d, ",(nodes[i]->parentNode?nodes[i]->parentNode->id:-1));
		printf("sibling = %d, ",(nodes[i]->sibling?nodes[i]->sibling->id:-1));
		printf("degree = ");
		if(nodes[i]->firstChild){
			if(nodes[i]->firstChild->sibling) printf("2");
			else printf("1");
		}else{
			printf("0");	
		}
		printf(", ");
		
		depth = 0;
		tmpNode = nodes[i]->parentNode;
		while(tmpNode){
			depth++;
			tmpNode = tmpNode->parentNode;
		}
		printf("depth = %d, ",depth);
		printf("height = %d, ",getHeight(nodes[i]));

		if(depth==0) printf("root");
		else if(nodes[i]->firstChild==NULL) printf("leaf");
		else printf("internal node");
		
		printf("\n");
		
	}

return 0;
}

struct node* createNode(int id){
	struct node *newNode;
	if(id < 0) return NULL;
	if(newNode = searchNode(id)) return newNode;
	newNode = (struct node*)malloc(sizeof(struct node));
	newNode->id=id;
	newNode->parentNode = NULL;
	newNode->firstChild = NULL;
	newNode->sibling = NULL;
	nodes[id] = newNode;
	return newNode;
}

struct node* searchNode(int id){
	if(nodes[id]) return nodes[id];
	return NULL;
}

int getHeight(struct node* nd){
	int tmpLeft=-1, tmpRight=-1;
	if(nd->firstChild) tmpLeft = getHeight(nd->firstChild);
	if(nd->firstChild && nd->firstChild->sibling) tmpRight = getHeight(nd->firstChild->sibling);
	return (tmpLeft>tmpRight?tmpLeft:tmpRight)+1;
}

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

// input
int N;
ll K;
vector<int> A, B;


void input() {
    cin >> N >> K;
    A = B = vector<int>(N);
    rep(i, N) cin >> A[i] >> B[i];
}


int main() {
    input();
    vector<P> w;
    rep(i, N) w.push_back(P(A[i], B[i]));
    sort(w.begin(), w.end());
    ll x = 0;
    rep(i, N) {
        x += w[i].second;
        if (K <= x) {
            cout << w[i].first << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 5112
N, K = map(int, input().split())

if (K % 2) == 1:
    count = N // K
    print(count**3)
else:
    count1 = N // K
    count2 = 0
    for i in range(N + 1):
        if (i % K) == (K / 2):
            count2 += 1
    # print(count1, count2)
    print(count1**3 + count2**3)

Measured memory_bytes: 3060
import java.util.*;
import java.io.*;

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

        if((a * b) % 2 == 0){
            System.out.println("Even");
        }else{
            System.out.println("Odd");
        }

        sc.close();
    }
}

Measured memory_bytes: 21844
w,h,n=map(int,input().split())
a=[[0],[w],[0],[h]]
for i in range(n):
    arr = list(map(int,input().split()))
    if arr[2]==1:a[0].append(arr[0])
    if arr[2]==2:a[1].append(arr[0])
    if arr[2]==3:a[2].append(arr[1])
    if arr[2]==4:a[3].append(arr[1])
if max(a[0])>=min(a[1]) or max(a[2])>=min(a[3]):
    print(0)
else:print((min(a[1])-max(a[0]))*(min(a[3])-max(a[2])))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    string s,t;
    cin >> s >> t;
    cout << (s[0] == t[0]) + (s[1] == t[1]) + (s[2] == t[2]) << endl;

}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]

inf = 10 ** 9 + 7
dp = [[[inf] * 401 for _ in range(401)] for _ in range(N + 1)]
dp[0][0][0] = 0

# DP
for i in range(N):
    for j in range(401):
        for k in range(401):
            if j >= X[i][0] and k >= X[i][1]:
                dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k],
                                      dp[i][j - X[i][0]][k - X[i][1]] + X[i][2])
            else:
                dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k])

# Extract
ans = inf
for j in range(1, 401):
    for k in range(1, 401):
        if j * B == k * A:
            ans = min(ans, dp[-1][j][k])

if ans < inf:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 99292
N,M=map(int,input().split())
s=[[0 for i in range(N+1)] for j in range(M)]
p=[0]*M
a=[0]*N
count=0
for i in range(M):
  s[i]=list(map(int,input().split()))
p=list(map(int,input().split()))
for i in range(1 << len(a)):
    a=[0]*N
    for j in range(len(a)):
        if ((i >> j) & 1) == 1:
            a[j]=1
    c=0
    for l in range(M):
      S=0
      for k in range(1,s[l][0]+1):
        S=S+a[s[l][k]-1]
      if S%2==p[l]:
        c=c+1
    if c==M:
      count=count+1
print(count)

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

int main() {
	int h1, m1, h2, m2, k; cin>>h1>>m1>>h2>>m2>>k;
	cout<<h2 * 60 + m2 - h1 * 60 - m1 - k<<endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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 ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int a,b; cin >> a >> b;
    cout << max(a+b,max(a-b,a*b)) << endl;
    return 0;
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int A, B;
    cin >> A >> B;
    if (A + B >= 10) {
        cout << "error" << endl;
    } else {
        cout << A + B << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC169C()
{
	ll A;
	double b;
	cin >> A >> b;
	b *= 100;
	ll B = static_cast<ll>(b + 0.5);
	ll C = A* B / 100;
	cout << C << endl;
}

int main()
{
	ABC169C();
	return 0;
}


Measured memory_bytes: 3724
#include <stdio.h>
int n, v, a[25][2], r, f[25];
void p1(int u) { if(!~u) return; printf(" %d", u), p1(a[u][0]), p1(a[u][1]); }
void p2(int u) { if(!~u) return; p2(a[u][0]), printf(" %d", u), p2(a[u][1]); }
void p3(int u) { if(!~u) return; p3(a[u][0]), p3(a[u][1]), printf(" %d", u); }
int main() {
    scanf("%d", &n);
    for(int i = 0; i < n; i++) scanf("%d", &v), scanf("%d%d", a[v], a[v] + 1), f[a[v][0]] = f[a[v][1]] = 1;
    for(int i = 0; i < n; i++) if(!f[i]) r = i;
    puts("Preorder"); p1(r); puts("");
    puts("Inorder"); p2(r); puts("");
    puts("Postorder"); p3(r); puts("");
}

Measured memory_bytes: 2744
#include<iostream>

using namespace std;

int main(){

	string str;

	string a;
	string b;
	string c;

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

	str.push_back('A');
	str.push_back(b[0]);
	str.push_back('C');

    cout << str << endl;

	return 0;

}

Measured memory_bytes: 256
use std::io;

fn main() {
    loop {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();

        let n: f64 = s.trim().parse().unwrap();

        if n == 0. {
            break;
        }

        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        let v: Vec<f64> = s.trim().split_whitespace().map(|x| x.parse().unwrap()).collect::<_>();

        let sum: f64 = v.iter().sum();
        let m: f64 = sum / n;

        let tmp: f64 = v.iter().map(|x| (x - m).powi(2)).sum();
        let ans = (tmp / n).sqrt();

        println!("{}", ans);
    }
}



Measured memory_bytes: 5088
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define pii pair<int, int>
#define vii vector< pair<int,int> >
#define vi vector<int>
#define vvi vector< vector< int> >
#define ss second
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace4(x, y, z, d)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#d<<": "<<d<<endl

#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1, 0};int dy[]={0,1,0, -1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
bool compare(const pair<int,int> &a,
             const pair<int,int> &b)
{
    if(a.ff == b.ff) {
        return (b.ss < a.ss);
    }
    return (a.ff<b.ff);
}

bool prime[10000001];
void SieveOfEratosthenes(int n) 
{
    // Create a boolean array "prime[0..n]" and initialize
    // all entries it as true. A value in prime[i] will
    // finally be false if i is Not a prime, else true.

    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
}

int32_t main()
{
    IOS;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    /********************* From here ***********************/
    int r,g,b,n,cnt = 0;
    cin >> r >> g >> b >>n;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            int z = (n- r*i - g*j);
            
            if(z%b==0 && z>=0){
                cnt++;
                //cout <<i << " " << j << " " << z << " " << cnt<< endl;
            }

        }
    }
    cout << cnt;

}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int i, j, k, ans = 0, a;
  for(i = 0; i < 5; ++i) {
    scanf("%d", &a);
    ans += a > 40 ? a : 40;
  }
  ans /= 5;
  printf("%d\n", ans);
  return 0;
}


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

int main(int argc, char const *argv[]) {

  char input[2];
  int s1,s2,s3;
  int out;

  cin >> input;

  s1 = (int)input[2]-'0';
  s2 = (int)input[1]-'0';
  s3 = (int)input[0]-'0';

  out = s3+s2+s1;

  cout << out<< '\n';

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;

int main() {
/*	int a[3];
	cin >> a[0] ;
	a[1] = 3;
	a[2] = a[0] * 10;

	cout << a[0] <<" " << a[1] <<" "<< a[2] << endl;
	
	for (int i = 0; i < 3; i++) {
		cout << a[i] << endl;
	}


	sort(a,a+5);
*/
	int a[10];
	for (int i = 0; i < 10; i++) {
		cin >> a[i];
	}
	
	sort(a,a+10,greater<int>());

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

	return 0;
}

Measured memory_bytes: 3120
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
using namespace std;

int N, M;
bool judge(vector<vector<bool>> &A, vector<vector<bool>> &B, int y, int x){
    for(int i=0; i<M; i++)
        for(int j=0; j<M; j++)
            if(A[i+y][j+x] != B[i][j])
                return false;
    return true;
}

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

    cin >> N >> M;
    vector<vector<bool>> A(N, vector<bool>(N, false));
    vector<vector<bool>> B(M, vector<bool>(M, false));
    for(int i=0; i<N; i++)
        for(int j=0; j<N; j++){
            char c;
            cin >> c;
            if(c=='#')
                A[i][j] = true;
        }
    for(int i=0; i<M; i++)
        for(int j=0; j<M; j++){
            char c;
            cin >> c;
            if(c=='#')
                B[i][j] = true;
        }

    for(int i=0; i<=N-M; i++){
        for(int j=0; j<=N-M; j++){
            if(judge(A, B, i, j)){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main(){
	int h, w;
	cin >> h >> w;
	char maze[h][w];
	rep(i,h)rep(j,w) cin >> maze[i][j];
	int ans = 0;
	rep(i,h)rep(j,w){
        if(maze[i][j]=='#') continue;
		int dis[h][w];
		rep(a,h)rep(b,w) dis[a][b] = inf;
		dis[i][j] = 0;
		int tmpmax = 0;
		queue<P> q;
		q.push(P(i,j));
		while(!q.empty()){
			P p = q.front();
			q.pop();
			int x = p.first;
			int y = p.second;

			rep(k, 4){
				int nx = x + dx[k];
				int ny = y + dy[k];
				if(nx >= 0 && nx < h && ny >= 0 && ny < w && dis[nx][ny] == inf && maze[nx][ny] == '.'){
					dis[nx][ny] = dis[x][y]+1;
					chmax(tmpmax, dis[nx][ny]);
					q.push(P(nx, ny));
				}
			}
		}
		chmax(ans, tmpmax);
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#pragma GCC optimize "trapv"
#define endl '\n'
#define fi first
#define sec second
#define pb push_back 
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define INF INT_MAX
#define LINF LONG_LONG_MAX
ll pow_i(ll base,int exp,int mod=1e9+7,bool ok=0){
	if(ok){base%=(mod-1);} // if ok that means mod is a prime so speed up
	ll ans=1;
	while(exp>0){
		if(exp&1){ans*=base;ans%=mod;}
		base*=base;
		base%=mod;
		exp>>=1;
	}
	return ans;
}
void solve(){
	int  n;
	string x;
	cin>>n>>x;
	int nax=2e5+1;
	vector<int> dp(nax,0);
	for(int i=1;i<nax;i++){
		dp[i]=1+dp[i%(__builtin_popcount(i))];
	}
	int l=0;
	for(auto j:x){if(j=='1'){l++;}}
	int rem1=0;
	int rem2=0;
	for(int i=0;i<n;i++){
		rem1+=(x[i]-'0')*pow_i(2,n-1-i,l+1);
		rem1%=l+1;
		if(l!=1){
			rem2+=(x[i]-'0')*pow_i(2,n-1-i,l-1);
			rem2%=(l-1);
		}
	}
	for(int i=0;i<n;i++){
		if(x[i]=='0'){
			int temp=0;
			temp=rem1+pow_i(2,n-i-1,l+1);
			temp%=(l+1);
			cout<<1+dp[temp]<<endl;
		}
		else{
			if(l==1){cout<<0<<endl;}
			else{
				int temp=0;
				temp=rem2-pow_i(2,n-i-1,l-1);
				temp%=(l-1);
				if(temp<0){temp+=l-1;}
				cout<<1+dp[temp]<<endl;
			}
		}
		
	}
}
int main(){
	fio;
    int test;
    //cin>>test;
    test=1;
    while(test--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 4384
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

class union_find {
    private:
        vector<int> par;
        vector<int> ran;
        vector<ll> size;
    public:
        union_find(int n);
        int find(int x);
        void unite(int x, int y);
        bool same(int x, int y);
        ll show_size(int x);
};

union_find::union_find(int n){
    par.resize(n);
    ran.resize(n);
    size.resize(n);
    rep(i,n) par[i] = i;
    rep(i,n) ran[i] = 0;
    rep(i,n) size[i] = 1;
};

int union_find::find(int x) {
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
};

void union_find::unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return;
    ll t = show_size(x)+show_size(y);
    size[x] = size[y] = t;
    if(ran[x] < ran[y]){
        par[x] = y;
        //size[y] += size[x];
    }
    else{
        par[y] = x;
        //size[x] += size[y];
        if(ran[x] == ran[y]) ran[x]++;
    }
};

ll union_find::show_size(int x) {
    if(par[x] == x) return size[x];
    return show_size(par[x] = find(par[x]));
}

bool union_find::same(int x, int y) {
    return (find(x) == find(y));
};

int main(int argc, char const *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<int> a(m), b(m);
	rep(i,m){
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
	}
	int ans = m;
	rep(i,m){
		union_find uf(n);
		rep(j,m){
			if(i == j) continue;
			uf.unite(a[j], b[j]);
		}
		bool ok = true;
		rep(i,n){
			if(!uf.same(0,i)) ok = false;
		}
		if(ok) ans--;
	}
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main() {
  int n;
  bool p[30];
  
  fill(p, p+30, true);
  REP(i, 28) {
    cin >> n;
    p[n-1] = false;
  }

  REP(i, 30) {
    if(p[i]) cout << i+1 << endl;
  }  
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> D(N-1+1);
	map<ll, ll> m;
	m[0]++;
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&D[i]);
		m[D[i]]++;
	}
	queue<ll> que1, que2;
	que1.push(0);
	
	rep(i, 13) {
		if (m[i] > 2) {
			cout << "0" << endl;
			return 0;
		}
		if (m[i] > 1 && (i == 0 || i == 12)) {
			cout << "0" << endl;
			return 0;
		}
		while(!que1.empty()) {
			if (m[i] == 0) que2.push(que1.front());
			if (m[i] == 1) {
				que2.push(que1.front()+(1<<i));
				que2.push(que1.front()+(1<<((24-i)%24)));
			}
			if (m[i] == 2) que2.push(que1.front()+(1<<i)+(1<<((24-i)%24)));
			que1.pop();
		}
		while(!que2.empty()) {
			que1.push(que2.front());
			que2.pop();
		}
	}
	ll res = 0;
	while(!que1.empty()) {
		ll cnt = 100, start = -1;
		rep(i, 48) {
			// cout << (que1.front()&(1<<(i%24)));
			if ((que1.front()&(1<<(i%24)))) {
				if (start == -1) {
					start = i; 
				} else {
					cnt = min(cnt, (i-start)%24);
					start = i;
				}
			}
		}
		// cout << static_cast<bitset<24> >(que1.front()) << " " << cnt << endl;
		res = max(res, cnt);
		que1.pop();
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 256
<?php
$n = trim(fgets(STDIN));

$num = 200;
for ($i=0; $i < $num; $i++) { 
    for ($j=0; $j < $num; $j++) { 
        if((pow($i,5) + pow($j,5)) == $n){
            if (!$j == 0) {
                $j = $j * (-1);
            }
            echo  $i . " " . $j;
            return;
        }

        if((pow($i,5) - pow($j,5)) == $n){
            echo  $i . " " . $j;
            return;
        }
    }
}

return;


?>


Measured memory_bytes: 16116
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define show(x) cout<<x<<'\n'
#define showh(x) cout<<x<<' '
#define go(i,a,n) for(ll i=a;i<n;i++)
#define gor(i,a,n) for(ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define mod 1000000007
bool prime[1000001];
bool isperfectsquare(ld x)
{
    return (ceil(sqrt(x))==floor(sqrt(x)));
}
bool ispoweroftwo(ll x)
{
    return x && !(x & (x-1));
}
ll xorcal(ll n)
{
    if(n%4==0)
        return n;
    if(n%4==1)
        return 1;
    if(n%4==2)
        return n+1;
    if(n%4==3)
        return 0;
}
void sieve(ll n)
{
    memset(prime,true,sizeof(prime));
    prime[0]=false;
    prime[1]=false;
    for(ll i=2;i*i<=n;i++)
    {
        if(prime[i]==true)
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                prime[j]=false;
            }
        }
    }
}
bool isprime(ll n)
{
    if (n<=1) return false;
    if (n<=3) return true;

    if(n%2==0 or n%3==0) return false;

    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0 or n%(i+2)==0) return false;
    }
    return true;
}

ll modinverse(ll a,ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;

        m = a % m; a = t;
        t = y;

        y = x - q * y;
        x = t;
    }

    if (x < 0)
       x += m0;

    return x;
}

ll gcd(ll a,ll b)
{
    if(a==0)
    {
        return b;
    }
    return gcd(b%a,a);
}
ll power(ll A, ll B)
{
    if (A == 0)
        return 0;
    if (B == 0)
        return 1;

    ll y;
    if (B % 2 == 0) {
        y = power(A, B / 2);
        y = (y * y) % mod;
    }

    else {
        y = A % mod;
        y = (y * power(A, B - 1) % mod) % mod;
    }

    return (ll)((y + mod) % mod);
}
int main()
{
    ios_base::sync_with_stdio(false);
    ll n,l;
    cin>>n>>l;
    ll a[n+1]={0},b[n+1]={0};
    ll sum=0;
    go(i,1,n+1)
    {
       a[i]+=l+i-1 ;
       sum+=a[i];
       b[i]+=abs(l+i-1);
    }
    sort(b+1,b+n+1);
    go(i,1,n+1)
    {
        if(b[1]==abs(l+i-1))
        {
            
            sum-=l+i-1;
            break;
        }
    }
    show(sum);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+50;
const ll inf=1e16;
int gi(){
    char ch=getchar(); int x=0,q=0;
    while(ch<'0'||ch>'9') q=ch=='-'?1:q,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return q?-x:x;
}
int head[N],nn[N][2],d[N],a[N],cnt,flag;
ll ans,w[N],f[N];
#define link(u,v) (nn[++cnt][1]=v,nn[cnt][0]=head[u],head[u]=cnt,++d[v])
void dfs(int x,int fa){
    if (d[x]==1){
	f[x]=a[x]; return;
    }
    ll sum=0,mx=-inf;
    for (int i=head[x],y; i; i=nn[i][0])
	if ((y=nn[i][1])!=fa){
	    dfs(y,x),sum+=f[y];
	    mx=max(mx,f[y]);
	}
    if (sum<a[x]||sum>2*a[x]||mx>a[x])
	flag=1;
    f[x]=2*a[x]-sum;
    return;
}
int main(){
    int n=gi(),x,y;
    for (int i=1; i<=n; ++i)
	a[i]=gi();
    for (int i=1; i<n; ++i)
	x=gi(),y=gi(),link(x,y),link(y,x);
    if (n==2)
	return puts(a[1]==a[2]?"YES":"NO"),0;
    for (int i=1; i<=n; ++i)
	if (d[i]!=1){
	    dfs(i,0);
	    if (f[i]!=0) flag=1;
	    break;
	}
    puts(flag?"NO":"YES");
    return 0;
}


Measured memory_bytes: 12288
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<limits.h>
#include<string>
#include<iomanip>
using namespace std;

long long  mod = 1000000007;

long max(long x, long y) {
	return x > y ? x : y;
}

long min(long x, long y) {
	return x < y ? x : y;
}

long factorial(long n) {
	if (n == 1) {
		return 1;
	}
	else {
		return n * factorial(n - 1);
	}
}

long long  fel(long long  n,long long  f) {

		if (f == 1) {
			return n % mod;
		}
		else if (f % 2 == 0) {
			return (fel(n,f / 2) * fel(n,f / 2)) % mod;
		}
		else {
			return ((n  * fel(n,f / 2) %mod) * fel(n,f / 2))% mod;
		}
	

}


int main()
{
	string s;
	cin >> s;
	/*vector<vector<double>> a(2, vector<double>(n));
	vector<int> b(n);
	*/

	/*long long kai;
	kai = 1;
	for (long long i = 1; i <= nm; i++) {
		kai = (kai * i) % mod;
	}*/


	//cout << fel(kai,mod-2);

	//vector<long long> sei(nm), gyaku(nm);

	int n = s.length();
	int flag = 1;
	for (int i = 0; i < n; i = i + 2) {
		if (s[i] == 'L') {
			flag = 0;
		}
	}
	for (int i = 1; i < n; i = i + 2) {
		if (s[i] == 'R') {
			flag = 0;
		}
	}
	if (flag == 1) {
		cout << "Yes";
	}
	else {
		cout << "No";

	}
}


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

using namespace std;

#define REP(var, n)  for (decltype(n) var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<decltype(var)>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define all(c) begin(c),end(c)

template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}


const int INF = 1 << 29;

auto solve() {
    int H, W, N;
    cin >> H >> W >> N;

    vector<set<int>> obs(W + 2);
    REP(_i, N) {
        int r, c;
        cin >> r >> c;
        obs[c].insert(r);
    }

    int current_r = 1;
    int res = H;
    FOR(i, 1, W + 1) {
//        cerr << " nm down (r,c) " << current_r << "," << i << endl;
//        if (i > H)
//            break;
        auto o = obs[i];
//        cerr << " --- " << i << "  - " << current_r << endl;
        for (auto &&e:o) {
//            cerr << e << endl;
            // simple obs
            if (e >= current_r) {
                res = min(res, e - 1);
//                cerr << " --sa- " << current_r << "," << e << endl;
            }
        }

//        cerr << "  down" <<endl;

        // force down
        {
            auto o = obs[i + 1];
            for (auto &&e: o) {
                if (e == current_r + 1) {
//                    cerr << "   add " << endl;
                    current_r++;
                }
            }
            current_r++;
        }
    }

    return res;
}


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

    cout << solve() << endl;
//    solve();
    return 0;
}


Measured memory_bytes: 19072
mod=10**9+7    
n,k=map(int,input().split())
cnt=[0]*(k+1)
for i in range(k,0,-1):
    cnt[i]+=pow(k//i,n,mod)
    for j in range(2,k//i+1):
      cnt[i]-=cnt[i*j]
ans=0
for i in range(1,k+1):
    ans+=i*(cnt[i])%mod
    ans%=mod
print(ans)

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

signed main(){
    int n,k,c=1;
    cin>>n>>k;
    r(i,n)c*=(k-i),c%=1000000007;
    cout<<c<<endl;
}


Measured memory_bytes: 3132
# -*- coding: utf-8 -*-
"""
Created on Sun Nov  4 18:53:53 2018
ABC113B
@author: maezawa
"""

n = int(input())
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))

temp = [t-h[i]*0.006 for i in range(n)]
dif = [abs(temp[i]-a) for i in range(n)]

near = min(dif)
ans = dif.index(near)+1

print(ans)

Measured memory_bytes: 3064