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

const ll MOD = 1e9 + 7;

int mpow(int base, int exp);
typedef  vector<int> vi;
typedef  vector<ll> vll;
typedef  vector<pair<ll,ll>> vpll;
typedef  vector<pair<int, int>> vpii;
typedef  pair<int, int> pii;
typedef  pair<ll, ll> pll;
typedef  unordered_map<ll, ll> umpll;
typedef  unordered_map<int, int> umpii;
typedef  unordered_map<ll, int> umpli;
typedef  unordered_set<int> usi;
typedef  unordered_set<ll> usll;
typedef  set<int> si;
typedef  set<ll> sll;
typedef  set<pair<int, int>> spii;
typedef  set<pair<ll, ll>> spll;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define fo(i,n) for(i = 0;i < n; i++)
#define Fo(i,k,n) for(i = k;k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define deb(x) cout << #x << " = " << x << endl
#define deb2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define deb3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", "<< #z << " = " << z << endl

ll randGen(ll lower, ll upper) { return (rand() % (upper - lower + 1)) + lower; }
ll dir[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
// cout << fixed;
// cout.precision(10);
//******************          Function here          *********************//

   void test_case(){
      int n;
      cin >> n;
      vpii a(n);
      for(int i = 0; i < n; i++) {
         int x, y;
         cin >> x >> y;
         a[i] = {x, y};
      }
      for(int i = 0; i < n - 2; i++) {
         if(a[i].ff == a[i].ss && a[i + 1].ff == a[i + 1].ss && a[i + 2].ff == a[i + 2].ss) {
            cout << "Yes\n";
            return;
         }
      }
      cout << "No\n";
   }

//*********************************************************************//

int main()
{
    #ifndef ONLINE_JUDGE
      string inputFile, outputFile;
      inputFile = "input.txt";
      outputFile = "output.txt";
      freopen(inputFile.c_str(), "r", stdin);
      freopen(outputFile.c_str(), "w", stdout);
    #endif

    int t = 1;
    // cin >> t;
    while(t-- > 0){
      test_case();
    }
    return 0;
}



/**********************   Utility Functions  *****************************/
   int mpow(int base, int exp) {
     base %= MOD;
     int result = 1;
     while (exp > 0) {
       if (exp & 1) result = ((ll)result * base) % MOD;
       base = ((ll)base * base) % MOD;
       exp >>= 1;
     }
     return result;
   }
/***********************************************************************/


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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
  int x,y,z;cin>>x>>y>>z;
  swap(x,y);
  swap(x,z);
  cout<<x<<' '<<y<<' '<<z<<endl;
 return 0;
}


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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
    char x,y; cin >> x >> y;
    if(y > x) cout << "<" << endl;
    else if (y==x) cout << "=" << endl;
    else cout << ">" << endl;
    return 0;
}

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

int main(){
string S;
  cin>>S;
  
  int ans=999;
  for(int i=0; i<S.size()-2; i++){
   int num=(S[i]-'0')*100+(S[i+1]-'0')*10+(S[i+2]-'0');
   ans=min(ans, abs(num-753));
  }
  
  cout<<ans;
}


Measured memory_bytes: 256
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))

A = [0]
B = [0]
for i in range(n):
  A.append(A[i] + a[i])
for i in range(m):
  B.append(B[i] + b[i])

res = 0
j = m

for i in range(n + 1):
  if A[i] > k:
    break
  while ((A[i] + B[j]) > k):
    j -= 1
  res = max(res, i + j)
  
print(res)

Measured memory_bytes: 47692
#include<bits/stdc++.h>
#define maxn 100005
using namespace std;
int read(){
	int x=0,c;while(!isdigit(c=getchar()));
	while(x=x*10+c-'0',isdigit(c=getchar()));
	return x;
}
struct edge{
	int to,next,len;
}e[maxn*2];
int last[maxn],cnt=1,x[maxn],y[maxn],s[maxn],a[maxn];
int b[maxn*2],n,m;
int dfs(int x,int y){
	for(int j=last[x];j;j=e[j].next){
		int y=e[j].to,tmp;
		if(b[j]||b[j^1])continue;
		if(a[y]){
			if(a[x]+a[y]>e[j].len)return 1;
			if(a[x]+a[y]<e[j].len)return 0;
		}else{
			a[y]=e[j].len-a[x];if(a[y]<=0)return 1;
			b[j]=1;tmp=dfs(y,a[y]);
			if(tmp!=2)return tmp^1;
		}
	}
	return 2;
}
void solve(){
	int x=1;
	int l=1,r=1e9,res1=0,res2=0,mid,tmp=1e9;
	for(int j=last[x];j;j=e[j].next)tmp=min(tmp,e[j].len);r=tmp;
	while(l<=r){
		mid=(l+r)>>1;memset(a,0,sizeof(a));memset(b,0,sizeof(b));
		int t=dfs(x,a[x]=mid);
		if(t==2)res1=mid,l=mid+1;else 
		if(t==1)r=mid-1;else l=mid+1;
	}
	l=1,r=tmp;
	while(l<=r){
		mid=(l+r)>>1;memset(a,0,sizeof(a));memset(b,0,sizeof(b));
		int t=dfs(x,a[x]=mid);
		if(t==2)res2=mid,r=mid-1;else 
		if(t==1)r=mid-1;else l=mid+1;
	}
	if(res1==0&&res2==0)printf("0");else printf("%d",res1-res2+1);
}
void insert(int x,int y,int z){
	e[++cnt].to=y;e[cnt].next=last[x];last[x]=cnt;e[cnt].len=z;
}
int main(){
	n=read();m=read();
	for(int i=1;i<=m;i++)x[i]=read(),y[i]=read(),s[i]=read(),insert(x[i],y[i],s[i]),insert(y[i],x[i],s[i]);
	solve();
	return 0;
}

Measured memory_bytes: 8448
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> e(100001),o(100001);
    for(int i=0;i<n;i++){
        int v;
        cin>>v;
        if(i%2) o[v]++;
        else e[v]++;
    }
    int i=max_element(e.begin(),e.end())-e.begin();
    int j=max_element(o.begin(),o.end())-o.begin();
    int ans=0;
    if(i!=j) ans=n-o[j]-e[i];
    else{
        sort(e.rbegin(),e.rend());
        sort(o.rbegin(),o.rend());
        ans=min(n-e[0]-o[1],n-o[0]-e[1]);
    }
    cout<<ans<<endl;
}

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

int main(){
  int Q;
  cin >> Q;

  for(int i = 0; i < Q; i++){
    int C, A, N;
    cin >> C >> A >> N;

    int ans = 0;

    for(int CCA = 0; CCA <= 500; CCA++){
      for(int CCC = 0; CCC <= 333; CCC++){
        int C_rem = C - (CCA * 2 + CCC * 3);
        int A_rem = A - CCA;
        int N_rem = N;

        if(C_rem < 0 || A_rem < 0 || N_rem < 0) continue;

        ans = max(ans, CCA + CCC + min(C_rem, min(A_rem, N_rem)));
      }
    }

    cout << ans << endl;
  }
}

Measured memory_bytes: 1164
#include<iostream>
#include<memory.h>
#include<stdio.h>
using namespace std;
char name[1000][1000];
int n,m;

int main(){
    while(cin>>n>>m && (n+m)!=0){
        long long japan[10000];
        long long japan2[10000];
        long long a,b;

        for(int i=1;i<=n;i++){
        scanf("%s",name[i]);
        cin>>a>>b;
        japan[i] = b;
        japan2[i] = b-a;
        }


        long long query;
        for(int i=1;i<=m;i++){
            cin>>query;
            int temp = 0;
            for(int i=1;i<=n;i++){
                if(query <= japan[i] && query >japan2[i]){
                    cout<<name[i]<<" "<<( query - japan2[i]) <<endl;
                    temp = 1;
                    break;
                }
            }
            if(temp == 0){cout<<"Unknown"<<endl;}
        }



    }


    return 0;

}

Measured memory_bytes: 2204
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

vector<int> to[200005];
int buka[200005];
vector<int> branch[200005];

void dfs(int i, int n, int p) {
    if (to[i].size()==1 && p!=-1) {
        buka[i] = 0;
        branch[i].push_back(n-1);
        return;
    }
    for (int e: to[i]) {
        if (e==p) continue;
        dfs(e, n, i);
        buka[i] += (buka[e] + 1);
        branch[i].push_back(buka[e]+1);
    }
    if (buka[i]!=n-1) {
        branch[i].push_back(n-1-buka[i]);
    }
}

int main(){
    int n;
    cin >> n;
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].emplace_back(b);
        to[b].emplace_back(a);
    }
    dfs(0, n, -1);
    mint ans(0);

    rep(i, n) {
        mint res(2);
        res = res.pow(n-1);
        res -= 1;
        for (int e: branch[i]) {
            res -= (mint(2).pow(e)-1);
        }
        ans += res;
    }
    ans /= mint(2).pow(n);
    
    
    
    cout << ans.x << endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;

  for (int i = 0; i < N; i++) {
    string syu;
    cin >> syu;
    if (syu == "Y") {
      cout << "Four"<< endl;
      break;
    }
    if (i == N - 1) {
      cout << "Three"<< endl;
    }    
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int N;
  cin>>N;
  vector <int> a(N);
  for(int i = 0;i<N;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  if(N%2 == 1){
    bool p = 0;
    if(a[0] != 0){
      p = 1;
    }
    int temp = 2;
    for(int i = 1;i<N;i+=2){
      if(a[i] != temp){
        p = 1;
      }
      if(a[i+1] != temp){
        p = 1;
      }
      temp += 2;
    }
    if(p == 1){
      cout << 0 << endl;
    }
    else{
      int ans = 1;
      for(int i = 0;i<(N/2);i++){
        ans = ans*2%MOD;
      }
      cout << ans << endl;
    }
  }
  else{
    bool p = 0;
    int temp = 1;
    for(int i = 0;i<N;i+=2){
      if(a[i] != temp){
        p = 1;
      }
      if(a[i+1] != temp){
        p = 1;
      }
      temp += 2;
    }
    
    if(p == 1){
      cout << 0 << endl;
    }
    else{
      int ans = 1;
      for(int i = 0;i<(N/2);i++){
        ans = ans*2%MOD;
      }
      cout << ans << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 640
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque

class UnionFind():
    """
    下記から拝借
    https://note.nkmk.me/python-union-find/
    """

    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join(
            '{}: {}'.format(r, self.members(r)) for r in self.roots())


# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N, M, AB):
    nf = UnionFind(N)
    for a, b in AB:
        nf.union(a - 1, b - 1)
    print(nf.group_count() - 1)


if __name__ == '__main__':
    # S = input()
    # N = int(input())
    N, M = map(int, input().split())
    # A = [int(i) for i in input().split()]
    # B = [int(i) for i in input().split()]
    AB = [[int(i) for i in input().split()] for _ in range(M)]
    solve(N, M, AB)

    # # test
    # from random import randint
    # from func import random_str
    # solve()


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


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

struct edge {int to; ll cost; };

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

ll GCD(ll a, ll b){
  if(b==0) return a;
  else return GCD(b, a%b);
}

ll LCM(ll a, ll b){
  if(a<b) swap(a,b);
  return a/GCD(a,b)*b;
}
 
int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  for(int i=0; i<n; i++){
    cin >> x[i];
  }
  int ans = 1000000009;
  for(int i=1; i<=100; i++){
    int tmp = 0;
    for(int j=0; j<n; j++){
      tmp += (i-x[j])*(i-x[j]);
    }
    ans = min(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3588
#include<stdio.h>
int main(void){
	int N;
	scanf("%d",&N);
	switch(N%10){
	case 2:
	case 4:
	case 5:
	case 7:
	case 9:
		printf("hon");
		break;
	case 0:
	case 1:
	case 6:
	case 8:
		printf("pon");
		break;
	case 3:
		printf("bon");
		break;
	default:
		break;
	}
	
	return 0;
}


Measured memory_bytes: 1712
// http://betrue12.hateblo.jp/entry/2018/08/26/122740

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
const ll INF=1e18+7;
const ll MOD=1e9+7;

class BIT{
public:
	vector<int> bit;
	int M;
	// 1-index
	BIT(int M):
		bit(vector<int>(M+1, 0)), M(M) {}

	int sum(int i) {
		if (!i) return 0;
		return bit[i] + sum(i-(i&-i));
	}

	void add(int i, int x) {
		if (i > M) return;
		bit[i] += x;
		add(i+(i&-i), x);
	}
};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	vector<ll> a(n);
	FOR(i,0,n)cin>>a[i];
	if(n==1){
		cout<<a[0]<<endl;
		return 0;
	}
	ll l = 1,r = 1e9+1;
	while(r-l>1){
		ll mid = (r+l)/2;
		vector<ll> m,t;
		m = a;
		FOR(i,0,n){
			if(m[i]<mid)m[i] = -1;
			else m[i] = 1;
		}
		ll wa = n+1;
		BIT bit(2*n+1);
		ll ten = 0;
		bit.add(wa,1);
		FOR(i,0,n){
			wa += m[i];
			ten += bit.sum(wa);
			bit.add(wa,1);
		}
		if( (n*(n+1)/4) <= ten){
			l = mid;
		}else{
			r = mid;
		}
	}
	cout << l << endl;
}


Measured memory_bytes: 2672
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int G[100][100];

int main()
{
	int A,B;
	cin >> A >> B;
	cout << "100 100" << endl;
	rep(i,50,100){
		fill(G[i],G[i]+100,1);
	}
	int x=0,y=0;
	while(B>1){
		G[y][x] = 1;
		B--;
		x += 2;
		if(x >= 100){
			x = 0;
			y += 2;
		}
	}
	x = 0;
	y = 51;
	while(A>1){
		G[y][x] = 0;
		A--;
		x += 2;
		if(x >= 100){
			x = 0;
			y += 2;
		}
	}


	rep(i,0,100){
		rep(j,0,100){
			cout << (G[i][j]==0?".":"#");
		}
		cout << endl;
	}
	return 0;
}


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

using namespace std;

typedef long long ll;

const long long MOD = 1e9;

vector<string> num;

void dfs(int n, string s, int k) {
  if (n == 0) {
    if (s.size() > 0 && k == 7) num.push_back(s);
    return;
  }
  dfs(n - 1, s + "7", k | (1));
  dfs(n - 1, s + "5", k | (2));
  dfs(n - 1, s + "3", k | (4));
}

int main() {
  ll N;
  cin >> N;
  for (int i = 3; i <= 10; ++i) dfs(i, "", 0);
  int res = 0;
  for (auto i : num) if (stoll(i) <= N) res++;
  cout << res << endl;
}

Measured memory_bytes: 5616
a, b = list(map(int, input().split()))
ba = b - a
if a % 2 == 0:
	ja = "j0"
else:
	ja = "j1"

if b % 2 == 0:
	jb = "j0"
else:
	jb = "j1"

a2 = format(a, "b")
b2 = format(b, "b")
a2 = str(a2[::-1])
b2 = str(b2[::-1])

a2 += "0" * (len(b2) - len(a2))
c2 = 0

if a2[0] == "0":
	if ba % 4 == 2 or ba % 4 == 1:
		c2 += 1

if a2[0] == "1":
	if ba % 4 <= 1:
		c2 += 1

for i in range(1, len(a2)):
	n = 0
	if a2[i] == "1":
		if ja == "j1":
			n += 1

	if b2[i] == "1":
		if jb == "j0":
			n += 1

	if n % 2 == 1:
		c2 += 2 ** i

print(c2)


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <sstream>
#include <string>
#include <utility>
#include <map>
#include <memory>
#include <set>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>

using namespace std;

class Point
{
public:
  int id;
  int x;
  int y;
  Point(){}
  Point( int i, int j, int k ) : id(i), x(j), y(k) {}
};

bool cmpX( Point a, Point b )
{
  return a.x < b.x;
}

bool cmpY( Point a, Point b )
{
  return a.y < b.y;
}

class RangeSearch
{
public:
  int n;
  vector<Point> d;
  int solve();
  RangeSearch(){}
  RangeSearch( int i ) : n(i) {}
  void mk2dTree( int st, int ed, int dp );
  void findPoint( int sx, int tx, int sy, int ty, int st, int ed, int dp, set<int> &ret );
};

void RangeSearch::mk2dTree( int st, int ed, int dp )
{
  if ( st + 2 > ed ) return;
  
  int md = ( st + ed ) / 2;
  
  if ( dp % 2 == 0 )
    sort( d.begin() + st, d.begin() + ed, cmpX );
  else
    sort( d.begin() + st, d.begin() + ed, cmpY );

  mk2dTree( st, md, dp + 1 );
  mk2dTree( md + 1, ed, dp + 1 );
}

void RangeSearch::findPoint( int sx, int tx, int sy, int ty, int st, int ed, int dp, set<int> &ret )
{
  if ( st + 1 > ed ) return;

  int mid = ( st + ed ) / 2;
  
  if ( sx <= d[mid].x && tx >= d[mid].x && sy <= d[mid].y && ty >= d[mid].y )
    ret.insert( d[mid].id );

  if ( dp % 2 == 0 )
    {
      if ( d[mid].x >= sx )
        findPoint( sx, tx, sy, ty, st, mid, dp + 1, ret );
      if ( d[mid].x <= tx )
        findPoint( sx, tx, sy, ty, mid + 1, ed, dp + 1, ret );
    }
  else
    {
      if ( d[mid].y >= sy )
        findPoint( sx, tx, sy, ty, st, mid, dp + 1, ret );
      if ( d[mid].y <= ty )
        findPoint( sx, tx, sy, ty, mid + 1, ed, dp + 1, ret );
    }
}

int RangeSearch::solve()
{
  for ( auto i = 0; i < n; ++i )
    cout << " " << d[i].x;
  cout << endl;
  for ( auto i = 0; i < n; ++i )
    cout << " " << d[i].y;
  cout << endl;

  return 0;
}

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

  int n;
  // cin >> n;
  scanf( "%d\n", &n );

  RangeSearch rs( n );

  for ( auto i = 0; i < n; ++i )
    {
      int x, y;
      //      cin >> x >> y;
      scanf( "%d %d\n", &x, &y );
      Point p(i, x, y);
      rs.d.push_back( p );
    }

  rs.mk2dTree( 0, n, 0 );
  
  int q;
  // cin >> q;
  scanf( "%d\n", &q );

  for ( auto i = 0; i < q; ++i )
    {
      int sx, tx, sy, ty;
      // cin >> sx >> tx >> sy >> ty;
      scanf( "%d %d %d %d\n", &sx, &tx, &sy, &ty );
      
      set<int> ret;
      rs.findPoint( sx, tx, sy, ty, 0, n, 0, ret );
      
      for ( auto it = ret.begin(); it != ret.end(); ++it )
        // cout << *it << endl;
        printf( "%d\n", *it);
      // cout << endl;
      printf("\n");
    }
  
  return 0;
}

Measured memory_bytes: 9080
#include <iostream>
#include <vector>
#include <set>

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

struct P{
  int minest, double_minest;
};

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n) a[i]--;
  vector<int> idx(n);
  rep(i,n) idx[a[i]] = i;
  set<int> s;
  ll ans = 0;
  for (int x = n-1; x >= 0; --x) {
    int i = idx[x];
    ll c = 0;
    { // calc c
      s.insert(i);
      vector<int> l(2,-1);
      vector<int> r(2,n);
      { // calc l
        auto it = s.find(i);
        rep(j,2) {
          if (it == s.begin()) break;
          --it;
          l[j] = *it;
        }
      }
      { // calc r
        auto it = s.find(i);
        rep(j,2) {
          ++it;
          if (it == s.end()) break;
          r[j] = *it;
        }
      }
      vector<int> ls(2);
      ls[0] = i-l[0]; ls[1] = l[0]-l[1];
      vector<int> rs(2);
      rs[0] = r[0]-i; rs[1] = r[1]-r[0];
      c = (ll)ls[0]*rs[1] + (ll)ls[1]*rs[0];
    }
    ans += c*(x+1);
  }
  cout << ans << '\n';
}


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

int main() 
{
    //std::cout<<std::fixed<<std::setprecision(10);

    int N , K;
    cin >> N >> K;
    
    int H;
    int count = 0;

    for(int i=0; i<N; ++i)
    {
        cin >> H;
        if(H >= K) 
        {
            ++count;
        }
    }
    
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
namespace my_std {
using namespace std;
#define reg register
#define Rint register int
#define FOR(i, a, b) for (register int i = (a), ed_##i = (b); i <= ed_##i; ++i)
#define ROF(i, a, b) for (register int i = (a), ed_##i = (b); i >= ed_##i; --i)
typedef long long i64;
#define Templ(T) template <typename T>
Templ(T) inline T read() {
    reg T ans = 0;
    reg char c = getchar();
    while (!isdigit(c)) c = getchar();
    for (; isdigit(c); c = getchar()) ans = (ans << 1) + (ans << 3) + (c ^ 48);
    return ans;
}
Templ(_Tp) inline int chkmin(_Tp &x, _Tp y) { return x > y ? x = y, 1 : 0; }
Templ(_Tp) inline int chkmax(_Tp &x, _Tp y) { return x < y ? x = y, 1 : 0; }
} // namespace my_std
using namespace my_std;

#define N 200010

int n;
i64 a[N], c[N];
int b[N];

struct Point{
    i64 x, y;
    inline Point(i64 _x = 0, i64 _y = 0){ x = _x, y = _y; }
    inline Point operator -(const Point &t)const{
        return Point(x - t.x, y - t.y);
    }
}d[N];
inline i64 cross(const Point &l, const Point &r){
    return l.x * r.y - r.x * l.y;
}

void init(){
    i64 *aa = new i64[N], mx(-1);
    int *bb = new int[N], pos(0);
    n = read<int>();
    FOR(i, 1, n){
        if(chkmax(mx, aa[i] = read<i64>()))
            pos = i;
    }
    FOR(i, 1, n) bb[i] = read<int>();
    memcpy(a + 1, aa + pos, sizeof(i64) * (n - pos + 1));
    memcpy(a + n - pos + 2, aa + 1, sizeof(i64) * pos);
    memcpy(b + 1, bb + pos, sizeof(int) * (n - pos + 1));
    memcpy(b + n - pos + 2, bb + 1, sizeof(int) * pos);
    delete aa;
    delete bb;
}

int main() {
    init();
    c[1] = 0, ++n;
    FOR(i, 2, n) c[i] = 2 * (c[i - 1] + b[i - 1]) - c[i - 2];
    reg Point t;
    Rint h(0);
    FOR(i, 1, n){
        t = Point(i, a[i] - c[i]);
        while(h > 1 && cross(d[h] - d[h - 1], t - d[h]) > 0) --h;
        d[++h] = t;
    }
    reg i64 ans(0);
    FOR(i, 2, h){
        ans += (d[i].x - d[i - 1].x) * (d[i].y + d[i - 1].y);
    }
    ans += d[1].y + d[h].y;
    ans -= 2 * a[1];
    FOR(i, 1, n) ans += 2 * c[i];
    printf("%.12lf", 0.5 * ans / (n - 1.0));
    return 0;
}

Measured memory_bytes: 11152
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
#define rep(i, n)for(int i=0; i<n; i++)

int main(){
  int a,b,c,k;
  cin >> a>>b>>c>>k;
  
  int count1 = 0, count2 = 0, count3 = 0;
  int ans = 0;
  if(a<=k){
    ans += a;
    k -= a;
  }
  else{
    ans += k;
    k = 0;
  }
  if(b <= k)
    k -= b;
  else
    k = 0;
  if(c <= k){
    ans += (-1)*c;
    k -= c;
  }
  else
    ans += (-1)*k;
    
  cout <<ans << endl;


  return 0;
}


Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static class Icicle implements Comparable<Icicle>{
		int len;
		int pos;
		
		public Icicle(int len, int pos) {
			super();
			this.len = len;
			this.pos = pos;
		}

		@Override
		public int compareTo(Icicle arg0) {
			return arg0.len - this.len;
		}

		@Override
		public String toString() {
			return "Icicle [len=" + len + ", pos=" + pos + "]";
		}
		
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		final int L = sc.nextInt();
		
		int[] array = new int[N];
		for(int i = 0; i < N; i++){
			array[i] = sc.nextInt();
		}
		
		int[] time = new int[N];
		
		Icicle[] icicles = new Icicle[N];
		for(int i = 0; i < N; i++){
			icicles[i] = new Icicle(array[i], i);
		}
		
		Arrays.sort(icicles);
		
		//System.out.println(Arrays.deepToString(icicles));
		
		int max_t = 0;
		for(Icicle ice : icicles){
			int pre_time = 0;
			
			if(ice.pos > 0 && pre_time < time[ice.pos - 1]){
				pre_time = time[ice.pos - 1];
			}
			if(ice.pos < N - 1 && pre_time < time[ice.pos + 1]){
				pre_time = time[ice.pos + 1];
			}
			
			time[ice.pos] = L - ice.len + pre_time;
			
			max_t = Math.max(max_t, time[ice.pos]);
		}
		
		System.out.println(max_t);
	}

}

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

int gcd(int x, int y) {
  if (x < y) swap(x, y);
  if (y == 0) return x;
  return gcd(x % y, y);
}

int main() {
  int N;
  scanf("%d", &N);
  vector<int> A(N, 0);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A.at(i));
  }

  int ans = gcd(A.at(0), A.at(1));
  for (int i = 1; i < N - 1; i++) {
    ans = gcd(ans, gcd(A.at(i), A.at(i + 1)));
  }

  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 640
/**************************
*                         *
*  Nothing Is Impossible  *
*                         *
**************************/
//#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <ctype.h>
#include <string>
#include <vector>
#include <math.h>
#include <stack>
#include <cmath>
#include <map>
#define GetRand(Min, Max) ((rand()%(int)(((Max) + 1)-(Min))) + (Min))
#define Rep(i, min, max) for (int i = min; i < max; ++i)
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    ios::sync_with_stdio(NULL);
    cin.tie(NULL); cout.tie(NULL);
    ll A, B;  cin >> A >> B;
    cout << A * B / __gcd(A,B);
    return 0;
}

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

typedef long long ll;
const int NMAX = 2e5 + 10;
const int MOD = 1e9 + 7;
int main(int argc, char const *argv[])
{
	char status[4];
	scanf("%s",status);
	if(status[0] == status[1] && status[1] == status[2] && status[0] == 'R')
		puts("3");
	else if(status[0] == status[1] && status[1] == status[2] && status[0] == 'S')
		puts("0");
	else if((status[0] == status[1] || status[1] == status[2] )&& status[1] == 'R')
		puts("2");
	else
		puts("1");
	return 0;
}

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

int main()
{
	int a, b;
	cin >> a;
	cin >> b;

	int max = a + b;

	if (a - b > max)
		max = a - b;

	if (a * b > max)
		max = a * b;

	cout << max;

	return 0;
}

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

int main(){
  string s;
  cin>>s;
  int ans=0;
  rep(i,s.size()){
    if(i%2==0){
      if(s[i]=='p')ans--;
    }else{
      if(s[i]=='g')ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int e;
	cin>>e;
	int ans=0;
	if(d>b){
		ans+=(c-a)*60+(d-b)-e;
	}else{
		ans+=(c-a-1)*60+((d+60)-b)-e;
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

#define roop(i, n) for(int i = 0;i < n;i++)

int main(void){

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

    cout << (a+b) % 24 << endl;

    return 0;
}

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

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define f first
#define s second

typedef long long ll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

const int MAX = 1e5+1;

int main(){ _

	int n, W; cin >> n >> W;
	vector<int> w(n), val(n);
	for(int i=0; i<n; i++) cin >> w[i] >> val[i];

	vector<vector<int>> memo(2, vector<int>(MAX,INF));
	memo[0][1] = memo[1][0] = 0;

	for(int i=0; i < n; i++) {
		memo[i&1] = memo[(i&1)^1];
		for(int j=0; j < MAX; j++) if(j-val[i] >= 0)
			memo[i&1][j] = min(memo[i&1][j], memo[(i&1)^1][j-val[i]] + w[i]);
	}

	int ans = 0;
	for(int i=0; i < MAX; i++) if(memo[(n-1)&1][i] <= W) ans = i;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4528
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt(), S = cin.getStr(), K = cin.getInt();
    let ans = [], Ch = S.charAt(K-1);
    for (let n = 0; n < N; n++) {
        ans.push(Ch == S.charAt(n) ? Ch : "*");
    }
    console.log(ans.join(''));
}
class Inputer{constructor(t){this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
import java.util.*;
 class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a<=9&&b<=9){
            System.out.println(a * b);
        } else {
            System.out.println("-1");
        }
    } 
}

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

using namespace std;

const int max_n = 3033, mod = 998244353;

int a, b, c, d, dp[max_n][max_n];

int mul(int x, int y) {
    return 1LL * x * y % mod;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> a >> b >> c >> d;
    dp[a][b] = 1;
    for (int n = a; n <= c; ++n) {
        for (int m = b; m <= d; ++m) {
            if (n == a && m == b) {
                continue;
            }
            dp[n][m] = (mul(dp[n - 1][m], m) + mul(dp[n][m - 1], n)) % mod;
            dp[n][m] += mod - mul(dp[n - 1][m - 1], mul(n - 1, m - 1));
            dp[n][m] %= mod;
            /*for (int i = a; i < n; ++i) {
                dp[n][m] += mod - mul(mul(dp[i][m - 1], i));
            }*/
        }
    }
    cout << dp[c][d] << endl;
    return 0;
}


Measured memory_bytes: 39136
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		SC sc = new SC(System.in);
		//重み付きUFっぽくねぇか
		int N=sc.nextInt();
		WUnionFindTree uft=new WUnionFindTree(N);
		for(int i=0; i<N-1; i++) {
			int u=sc.nextInt();
			int v=sc.nextInt();
			long w=sc.nextLong();
			uft.union(u,v,w);
		}
		int[] nurinuri=new int[N+1];
		nurinuri[1]=0;
		for(int i=2; i<=N; i++) {
			if(uft.diff(1,i)!=null && Math.abs((long) uft.diff(1, i))%2==0){
				nurinuri[i]=0;
			}
			else {
				nurinuri[i]=1;
			}
		}
		for(int i=1; i<=N; i++) {
			pl(nurinuri[i]);
		}
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	public static class WUnionFindTree{
		int[] par; // 親の番号
		long[] ws;  // 親との重みの差
		public WUnionFindTree(int n){
			par = new int[n+1];
			ws  = new long[n+1];
			for(int i = 0; i <= n; i++){ par[i] = -1; }
		}
		public int find(int x){
			if(par[x] < 0){
				return x;
			}else{
				final int parent = find(par[x]);
				ws[x] += ws[par[x]];
				return par[x] = parent;
			}
		}
		public long weight(int x){
			find(x);
			return ws[x];
		}
		public boolean union(int x, int y, long w){ // x <-(w)- y (x + w = y)
			w += weight(x);
			w -= weight(y);
			x = find(x); y = find(y);
			if(x != y){
				if(par[y] < par[x]) {
					int tmp = x; x = y; y = tmp; w = -w;
				}
				par[x] += par[y]; par[y] = x;
				ws[y] = w;
				return true;
			}else{
				return false;
			}
		}
		public boolean same(int x, int y){
			return find(x) == find(y);
		}
		public Long diff(int x, int y){ // y - x を求める. 比較不能ならnull.
			if(!same(x, y)){ return null; }
			return this.weight(y) - this.weight(x);
		}
		public int size(int x){
			return -par[find(x)];
		}
	}
}

Measured memory_bytes: 53128
#include <bits/stdc++.h>
#define DEBUG 1
using namespace std;

namespace output{
    void __(short x){cout<<x;}
    void __(unsigned x){cout<<x;}
    void __(int x){cout<<x;}
    void __(long long x){cout<<x;}
    void __(unsigned long long x){cout<<x;}
    void __(double x){cout<<x;}
    void __(long double x){cout<<x;}
    void __(char x){cout<<x;}
    void __(const char*x){cout<<x;}
    void __(const string&x){cout<<x;}
    void __(bool x){cout<<(x?"true":"false");}
    template<class S,class T>
    void __(const pair<S,T>&x){__(DEBUG?"(":""),__(x.first),__(DEBUG?", ":" "),__(x.second),__(DEBUG?")":"");}
    template<class T>
    void __(const vector<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    template<class T>
    void __(const set<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    template<class T>
    void __(const multiset<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    template<class S,class T>
    void __(const map<S,T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");}
    void pr(){cout<<"\n";}
    template<class S,class... T>
    void pr(const S&a,const T&...b){__(a);if(sizeof...(b))__(' ');pr(b...);}
}

using namespace output;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,char> pic;
typedef pair<double,double> pdd;
typedef pair<ld,ld> pld;
typedef vector<int> vi;
typedef vector<ll> vl;

#define pb push_back
#define fox(i,x,y) for(int i=(x);i<=(y);i++)
#define foxr(i,x,y) for(int i=(y);i>=(x);i--)
#define F first
#define S second

const int MN = 1e5+5;
int N, i, ans, mx;
pii arr[MN], pi[MN], si[MN];
vector<pii> vec; set<pii> hm;
pii inter(pii i,pii j){return make_pair(max(i.F,j.F),min(i.S,j.S));}
int len(pii x){return max(0,x.S-x.F+1);}

int main(){
    for(scanf("%d",&N),i=1;i<=N;i++){
        scanf("%d%d",&arr[i].F,&arr[i].S);
        mx=max(mx,arr[i].S-arr[i].F+1);
    }
    sort(arr+1,arr+N+1,[](pii i,pii j){return i.S-i.F<j.S-j.F;});
    for(i=1;i<=N;i++){
        auto it=hm.lower_bound({arr[i].F,0});
        if(it==hm.end()||it->S>arr[i].S)
            vec.pb(arr[i]);
        hm.insert(arr[i]);
    }
    sort(vec.begin(),vec.end(),[](pii i,pii j){return i.F<j.F;});
    N = vec.size();
    vec.insert(vec.begin(),make_pair(0,0));
    pi[0]={1,1e9}; si[N+1]={1,1e9};
    for(i=1;i<=N;i++)
        pi[i]=inter(pi[i-1],vec[i]);
    for(i=N;i>=1;i--)
        si[i]=inter(si[i+1],vec[i]);
    ans=max(ans,mx+len(si[1]));
    for(i=1;i<=N;i++){
        if(N!=1) ans=max(ans,len(vec[i])+len(inter(pi[i-1],si[i+1])));
        if(i!=N) ans=max(ans,len(pi[i])+len(si[i+1]));
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 8052
// Template begins
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <math.h>
#include <iomanip>
#include <queue> 
#include <string.h>
#include <string>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define fo(i,a,b) for(i=a;i<=b;i++)
#define all(v) (v).begin(),(v).end()
#define sort0(v) sort(all(v))
#define lbb(a,b,arr,x) lower_bound(arr+a,arr+b+1,x)-arr
#define ubb(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-arr
#define freq(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-lower_bound(arr+a,arr+b+1,x)
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define d6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<endl
#define max3(a,b,c) max(max((a),(b)),(c))
#define max4(a,b,c,d) max(max((a),(b)),max((c),(d)))
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
#define printp(x) cout << x.ff << " " << x.ss << endl
 
const ll mod=998244353;
#define inf 9999999999999
#define MAXN   100001 
  
// stores smallest prime factor for every number 
 
 
ll inv(ll i){if(i==1) return 1;return (mod-((mod/i)*inv(mod%i))%mod)%mod;}
 
ll gcd(ll a,ll b){if(a==0) return b;return gcd(b,b%a);}
inline void fastio(){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
// Template ends
const int MN = 2e5+7;

void solve(){
    int n; cin>>n; int cnt=0; bool c=0;
    for(int i=0;i<n;i++){
        int a,b; cin>>a>>b;
        if(a==b){
            cnt++;
            if(cnt==3) c=1;
        }else{
            cnt=0;
        }
    }
    if(c) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
int main(){
    fastio();
    //write code
    int t; t=1;
    while(t--){
        solve();
    }
    return 0;
}

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

#define vl vector<ll>
#define vs vector<string>
#define vll vector< vector<ll> >
#define pll pair<ll,ll>
#define pls pair<ll,string>
#define psl pair<string,ll>
#define tll tuple<ll, ll, ll>
#define vp vector< pair<ll,ll> >
#define vt vector< tuple<ll, ll, ll> >
#define all(c) c.begin(),c.end()

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
 
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
#define NN 2020202

//command
//c++ atcoder.cpp -std=c++14
//./a.out

//cout << setprecision(12) << ans << endl;

int main(){
  ll a, b, c;
  cin >> a >> b >> c;
 
  if (a+b+c>=22){
    cout << "bust" << endl;
  }
  else{
    cout << "win" << endl;
  }
 
  //cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main(){
  string s;
  cin >> s;
  bool ok = true;
  REP(i,s.size()-1){
    if(s[i] == s[i+1]) ok = false;
  }
  if(ok) cout << "Good" << endl;
  else cout << "Bad" << endl;
  return 0;
}

Measured memory_bytes: 3600
import java.util.*;
import java.util.stream.*;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int a[] = new int[n];
		for(int i=0; i<n; i++) a[i]=sc.nextInt();

		long cnt = 0;
		for(int i=0; i<n-1; i++) {
			if(a[i] == i+1) {
				swap(a, i, i+1);
				cnt++;
			}
		}
		if(a[n-1] == n) {
			cnt++;
		}
		System.out.println(cnt);
		sc.close();
	}

	public void swap(int a[], int x, int y) {
		int tmp = a[x];
		a[x] = a[y];
		a[y] = tmp;
	}
}


Measured memory_bytes: 59872
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
typedef long long ll;

using namespace std;

int main(){
    ll n; 
    cin >> n;
    stack<ll> T1;
    queue<ll> T2;
    queue<ll> T3;
    int a;

    for(int i=0; i<n; i++){
        cin >> a;
        T3.push(a);
    }

        if(T3.size()%2 == 0){
            for(int i=0; i<n; i++){
                if(i%2 == 0){
                    a = T3.front(); T3.pop();
                    T2.push(a);
                }else{
                    a = T3.front(); T3.pop();
                    T1.push(a);
                }
            }
        }else{
            for(int i=0; i<n; i++){
                if(i%2 == 0){
                    a = T3.front(); T3.pop();
                    T1.push(a);
                }else{
                    a = T3.front(); T3.pop();
                    T2.push(a);
                }
            }
        }
    
    int l = T1.size() + T2.size();

    cout << T1.top();
    T1.pop();

    while(T1.size() !=  0){
        cout << " " << T1.top();
        T1.pop();
    }
    while(T2.size() != 0){
        cout << " " << T2.front();
        T2.pop();
    }
    cout << endl;
        
    return 0;
}

Measured memory_bytes: 3840
/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const int inf = 1<<30;
const int N =100100;
int n , a[N] , q ;
ll all;
vector < int > v ;
int bit[N<<1];
void add ( int i ){
while ( i < N<<1 ){
    bit[i]++;
    i += i&-i ;
}
return ;
}
int _get ( int i ){
    int ret = 0 ;
while ( i ){
   ret+= bit[i];
    i -= i & -i ;
}
return ret ;
}
bool ok ( int x ){
 memset( bit , 0 , sizeof bit );
 ll cnt =0  , sum = 0;
 add(N);
 for ( int i =0 ; i < n ; i++ ){

        if ( a[i] >= x ) sum+=1;
        else sum-=1 ;
        cnt += (_get(sum+N));
        add(sum+N);
 }
 //cerr << x <<" "  << cnt <<endl;
return cnt >= (all+1LL)/2LL ;
}
int main ( ){
  scanf("%d",&n);
  all = (1LL*n*(n+1))/2LL;
  for  (int i = 0; i < n ;i++ ) {
    int x ;
    scanf("%d",&x);
    a[i] = x ;
    v.push_back(x);
  }
  sort(v.begin(),v.end());
  int lo = 0 , hi = n-1 ;
  while ( lo < hi ){
    int mid = (lo+hi+1)>>1;
    if ( ok( v[mid]) ) lo = mid ;
    else hi = mid-1 ;
  }
  printf("%d",v[lo]);

return 0 ;
}


Measured memory_bytes: 1912
#include<stdio.h>
#include<algorithm>
#define it register int
#define ct const int
#define il inline
using namespace std;
const int N=1000005;
typedef long long ll;
int top,n,m;
ll q[N],tr[N],v[N];
il void work(it pos,ll x,ll val){
	v[pos]+=val*(x/q[pos]),x%=q[pos];
	pos=std::upper_bound(q+1,q+1+pos,x)-q;
	if(pos==1) return tr[1]+=val,tr[x+1]-=val,void();
	work(pos-1,x,val);
}
int main(){
	scanf("%d%d",&n,&m);it i,j;register ll x;
	q[++top]=n;
	for(i=1;i<=m;++i){
		scanf("%lld",&x);
		while(top&&q[top]>x) --top;
		q[++top]=x;
	}
	v[top]=1;
	for(i=top;i>1;--i) work(i-1,q[i],v[i]);
	for(i=1;i<=q[1];++i) tr[i]+=tr[i-1],printf("%lld\n",tr[i]+v[1]);
	n-=q[1];
	while(n--) putchar('0'),putchar('\n'); 
	return 0;
}
// i - 1 Ai / A_{i-1}  Ai % A_{i-1}


Measured memory_bytes: 10624
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
using namespace std;
int main(){
    long long n,y;
    cin>>n>>y;
    long long f=y/10000;
    f(i,0,f+1){
        f(j,0,n-i+1){
            if(10000*i+5000*j+1000*(n-j-i)==y){
                cout<<i<<" "<<j<<" "<<n-i-j<<endl;
                return 0; 
            }
        }
    }
    cout<<-1<<" "<<-1<<" "<<-1<<endl;
    return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node *Node;

#define NIL NULL

Node root;

Node treeMinimum(Node x){

  while(x->left!=NIL){
    x=x->left;
  }

  return x;
}

Node treeMaximum(Node x){

  while(x->right!=NIL){
    x=x->right;
  }

  return x;
  
}

Node treeSearch(Node u, int k){
  u=root;

  while(u!=NIL && u->key!=k){
    if(k < u->key) u=u->left;
    else u=u->right;
  }

  return u;
  
}

Node treeSuccessor(Node x){
  Node y;

  if(x->right!=NIL) return treeMinimum(x->right);

  y=x->parent;

  while(y!=NIL && x==y->right){
    x=y;
    y=y->parent;
  }

  return y;
}

void treeDelete(Node z){
  Node y;
  Node x;

  if(z->left==NIL || z->right==NIL) y=z;
  else y=treeSuccessor(z);

  if(y->left!=NIL) x=y->left;
  else x=y->right;

  if(x!=NIL) x->parent=y->parent;

  if(y->parent==NIL) root=x;
  else if(y==y->parent->left) y->parent->left=x;
  else y->parent->right=x;

  if(y!=z) z->key=y->key;
  
}

void insert(int k){
  Node y=NIL;
  Node x=root;
  Node z;

  z=malloc(sizeof(struct node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;

  while(x!=NIL){
    y=x;
    
    if(z->key < x->key) x=x->left;
    else x=x->right;
  }

  z->parent=y;

  if(y==NIL) root=z;
  else if (z->key < y->key) y->left=z;
  else y->right=z;

}

void inorder(Node u){
  
  if(u==NIL) return;

  if(u->left!=NIL) inorder(u->left);
  
  printf(" %d",u->key);
  
  if(u->right!=NIL) inorder(u->right);
  
}

void preorder(Node u){

  if(u==NIL) return;
  
  printf(" %d",u->key);
  
  if(u->left!=NIL) preorder(u->left);
  

  if(u->right!=NIL) preorder(u->right);
  
  
}

int main(){
  int n, i, x;
  char com[20];
  
  scanf("%d", &n);

  for(i = 0; i < n; i++ ){
    scanf("%s", com);
    if( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



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

using namespace std;

#define OnlineJudge1

#define loop(x,a,n) for(int x = a;x < n;x++)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x)  (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define readline(s) getline(cin,s)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define EPS 1e-7
#define modulo ll (1e9 + 7)
const long double PI = 3.141592653589793238L;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,ll> pill;
typedef pair<ll,ll> pll;

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

#define time__(d) \
    for ( \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second; \
        debug("%s: %lld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false \
    )

void init(){
    cin.tie(0);
    ios::sync_with_stdio(0);
#ifdef OnlineJudge
    freopen("in.in","r",stdin);
    freopen("out.txt","w",stdout);
#endif
}

const int N = 1e7 + 10, M = 55, OO = 0x3f3f3f3f;
const ll llOO = 1e18;


int main(){
    init();

    int h, a;   cin >> h >> a;
    cout << (int)ceil(1.0 * h/a);

}

Measured memory_bytes: 256