akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        try{
            //入力
            int N = scan.nextInt();
            int[] x = new int[N];
            int[] y = new int[N];
            int[] h = new int[N];
            for(int i = 0; i < N; i++){
                x[i] = scan.nextInt();
                y[i] = scan.nextInt();
                h[i] = scan.nextInt();
            }

            int X = 0;
            int Y = 0;
            int H = 0;
            loop: for(int cx = 0; cx <= 100; cx++){
                for(int cy = 0; cy <= 100; cy++){
                    for(int i = 0; i < N; i++){
                        if(h[i] != 0){
                            H = h[i] + Math.abs(cx-x[i]) + Math.abs(cy-y[i]);
                            break;
                        }
                    }
                    H = getHeight(H, cx, cy, N, h, x, y);
                    if(H != -1){
                        X = cx;
                        Y = cy;
                        break loop;
                    }
                }
            }

            System.out.println(X+" "+Y+" "+H);

        }finally{
            scan.close();
        }
    }

    static int getHeight(int H, int cx, int cy, int N, int[] h, int[] x, int[] y){
        for(int i = 0; i < N; i++){
            if(h[i] != Math.max(H-Math.abs(cx-x[i])-Math.abs(cy-y[i]), 0)){
                H = -1;
            }
        }
        return H;
    }
}


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

int main(){
    vector<int> a;
    int sum=0;
    for(int i=0; i<5; i++){
        int x;  cin >> x;
        sum += x;
        if(x%10!=0) a.push_back(10-x%10);
    }
    if(!a.empty()){
        sort(a.begin(), a.end());
        for(int i=0; i<a.size()-1; i++)
            sum += a.at(i);
    }
    cout << sum << endl;

}

Measured memory_bytes: 256
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <random>
#include <queue>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
#define rep(i, j, k) for(int i = j; i <= k; ++ i)
#define per(i, j, k) for(int i = j; i >= k; -- i)
using namespace std;

#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back

typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned uint;
typedef unsigned long long ull;

typedef pair<int, int> pii;
typedef pair<ll, int> pll;

unsigned seed = chrono::system_clock::now().time_since_epoch().count();
mt19937 Rand(seed);
uniform_int_distribution<ll> range(0, 1ll << 32);
inline void ucin() {
   ios::sync_with_stdio(0); cin.tie(0);
}

const int N = 4e5 + 10;
const int mod = 1e9 + 7;

int qpow(int a, int b) {
   int ans = 1;
   for(; b >= 1; b >>= 1, a = (ll) a * a % mod)
      if(b & 1) ans = (ll) ans * a % mod;
   return ans;
}
struct node {
   int k, l, r;
   bool operator < (const node &b) const {
      return abs(l - r) > abs(b.l - b.r);
   }
} a[N];
int n;
set<int> S;
int main() {
   int test; scanf("%d", &test);
   while(test --) {
      scanf("%d", &n);
      rep(i, 1, n) scanf("%d%d%d", &a[i].k, &a[i].l, &a[i].r);
      sort(a + 1, a + n + 1);
      int c = 0;
      rep(i, 1, n) c += a[i].l >= a[i].r;
      S.clear();
      rep(i, 1, n) S.insert(i);
      ll ans = 0;
      rep(i, 1, n) {
         set<int>::iterator it; bool tag = 0;
         if(a[i].l >= a[i].r) {
            it = S.upper_bound(min(c, a[i].k));
            if(it != S.begin()) {
               it --; ans += a[i].l; S.erase(*it); tag = 1;
            } else if(c < a[i].k) {
               it = S.upper_bound(a[i].k);
               if(it != S.begin()) {
                  it --; ans += a[i].l; S.erase(*it); tag = 1;
               }
            }
            if(!tag) {
               ans += a[i].r;
            }
         } else {
            it = S.lower_bound(max(c + 1, a[i].k + 1));
            if(it != S.end()) {
               ans += a[i].r; S.erase(*it); tag = 1;
            } else if(a[i].k < c) {
               it = S.lower_bound(a[i].k + 1);
               if(it != S.end()) {
                  ans += a[i].r; S.erase(*it); tag = 1;
               }
            }
            if(!tag) {
               ans += a[i].l;
            }
         }
      }
      printf("%lld\n", ans);
   }   
   return 0;
} 


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

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

    string S;
    cin >> S;

    ll ans = INF;
    ll tmp = 0;
    rep (i, S.size()) {
        if (i%2 == 0) {
            if (S[i] == '0') {
                tmp++;
            }
        } else {
            if (S[i] == '1') {
                tmp++;
            }
        }
    }
    ans = min(ans, tmp);

    tmp = 0;
    rep (i, S.size()) {
        if (i%2 != 0) {
            if (S[i] == '0') {
                tmp++;
            }
        } else {
            if (S[i] == '1') {
                tmp++;
            }
        }
    }
    ans = min(ans, tmp);

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


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String st = null;
		String[] str = new String[3];
		int a;
		int b;
		String op;
		int result;

		do {
			st = sc.nextLine();
			str = st.split(" ");
			result = 0;

			a = Integer.parseInt(str[0]);
			op = str[1];
			b = Integer.parseInt(str[2]);

			if (op.equals("?")) {
				sc.close();
				break;
			}

			switch(op) {
				case "+":
					result = a + b;
					break;
				case "-":
					result = a - b;
					break;
				case "*":
					result = a * b;
					break;
				case "/":
					result = a / b;
					break;
			}
			System.out.println(result);
		}while(true);


	}

}


Measured memory_bytes: 26064
/* ***********************************************
Author        :taciturnity
Created Time  :2020/2/21 8:23:51
File Name     :TEST.cpp
************************************************ */

#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define ll long long
#define INF 0x3f3f3f3f
#define rep(i,x,y) for(int i = x;i <= y;++i)
#define fori(i,x,y) for(int i = x;i >= y; -- i)
#define bug puts("--------------")
const int N = 5e5+10;
const double eps = 0.00000001;
const ll mod = 1e18 + 7 ;
using namespace std;
ll read()
{
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int main(){
    int n = read();
    cout << (n +1) /2;
}

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 VI = vector<int>;
using VVI = vector<vector<int>>;
using P = pair<int, int>;

int main(){
	int n,k;
    cin >> n >> k;
    VI p(n);
    rep(i,n) cin >> p[i];

    VI E(n-k+1, 0);
    rep(i,k){
        E[0] += p[i] + 1;
    }
    rep(i,n-k){
        E[i+1] = E[i] - p[i] + p[i+k];
    }
    sort(E.begin(), E.end(), greater<int>());

    cout << setprecision(12) << ((double)E[0] / 2.0) << endl;

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
 	 int n;
  cin>>n;
  vector<vector<long long> > dp(n,vector<long long>(3,-1));
  vector<vector<int> > h(n,vector<int>(3));
  for(int i=0;i<n;i++)
    for(int j=0;j<3;j++)
      cin>>h[i][j]; 
  for(int i=1;i<n;i++){
    h[i][0]=h[i][0]+max(h[i-1][1],h[i-1][2]);
  h[i][1]=h[i][1]+max(h[i-1][0],h[i-1][2]);
  h[i][2]=h[i][2]+max(h[i-1][1],h[i-1][0]);
}
  int m=max({h[n-1][0],h[n-1][1],h[n-1][2]});
  cout<<m;
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int a;
  rep(i,n){
    cin>>a;
    if(a%2==0){
      if(a%3!=0 && a%5!=0){
        cout<<"DENIED"<<'\n';
        return(0);
      }
    }
  }
  cout<<"APPROVED"<<'\n';
  return(0);
}


Measured memory_bytes: 256
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

struct state {
    int pos, dist;
    state() {}
    ~state() {}
    state(int pos, int dist): pos(pos), dist(dist) {}
};

int N, K;

vector<vector<int>> graph;
int wall = -1;

int dfs(int v, int p, int d) {
    int ret = d > K/2 ? 1 : 0;
    for (const int w : graph[v]) {
        if (w == p || w == wall) continue;
        ret += dfs(w, v, d+1);
    }
    return ret;
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N >> K;
    graph.resize(N);

    for (int j = 0; j < N-1; ++j) {
        int a, b; cin >> a >> b; --a; --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    int ans = N;

    if (K % 2 == 0) {
        for (int j = 0; j < N; ++j) {
            ans = min(ans, dfs(j, -1, 0));
        }
    } else {
        for (int v = 0; v < N; ++v) {
            for (int w : graph[v]) {
                int x = 0;
                wall = w;
                x += dfs(v, -1, 0);
                wall = v;
                x += dfs(w, -1, 0);

                ans = min(ans, x);
            }
        }
    }

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


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

class dice{
  
public:
  int _1,_2,_3,_4,_5,_6,sus;

  void moveN(){
    sus=_1;
    _1=_2;
    _2=_6;
    _6=_5;
    _5=sus;
  }

  void moveE(){
    sus=_1;
    _1=_4;
    _4=_6;
    _6=_3;
    _3=sus;
  }

  void moveW(){
    sus=_1;
    _1=_3;
    _3=_6;
    _6=_4;
    _4=sus;
  }

  void moveS(){
    sus=_1;
    _1=_5;
    _5=_6;
    _6=_2;
    _2=sus;
  }
  
  void spin(){
    sus=_2;
    _2=_3;
    _3=_5;
    _5=_4;
    _4=sus;
  }
  
};

int main(){
  
  dice d1;

  int dir_t,i,T,F;

  cin>>d1._1>>d1._2>>d1._3>>d1._4>>d1._5>>d1._6;
  cin>>dir_t;

  for(i=0; i<dir_t; i++){

    cin>>T>>F;
    
    if(d1._3==T||d1._4==T)d1.moveE();
    while(d1._1!=T)d1.moveN();
    while(d1._2!=F)d1.spin();
    
    cout<<d1._3<<endl;
    
  }

  return 0;

}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}

void solve(){
	int x,y,z;
	cin>>x>>y>>z;
	swap(x,y);
	swap(x,z);
	cout<<x<<" "<<y<<" "<<z;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

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

typedef long long ll;

int DigitNum(ll x)
{
	int r = 0;
	while (x > 0)
	{
		x /= 10;
		++r;
	}
	return r;
}

int main()
{
	long long N;
	scanf("%lld", &N);

	ll dMax = 0;
	for (ll d = 2; d*d <= N; ++d)
	{
		if (N % d)
			continue;
		dMax = d;
	}

	ll r = N;
	if (dMax)
	{
		r = N / dMax;
	}
	int ans = DigitNum(r);
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 128
from collections import defaultdict, deque

n,m = map(int,input().split())
edge = []
for _ in range(m):
    x,y = map(int,input().split())
    edge.append((x,y))

in_cnt = defaultdict(int)
outs = defaultdict(list)
for x,y in edge:
    in_cnt[y-1]+= 1
    outs[x-1].append(y-1)

res = []
queue = deque([i for i in range(n) if in_cnt[i] == 0])

while  len(queue)> 0:
    node = queue.popleft()
    res.append(node)
    for next_node in outs[node]:
        in_cnt[next_node] -= 1
        if in_cnt[next_node] == 0:
            queue.append(next_node)

dp = [0]*n

for i in range(n):
    for nv in outs[res[i]]:
        dp[nv] =max(dp[nv],dp[res[i]] + 1)
print(max(dp))

Measured memory_bytes: 54296
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using ll = long long;
using Double = long double;
const Int INF = 1LL<<55;
const Int mod = (1e9)+7;
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
ostream& operator<<(ostream& o,T t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  set<int> S;
  
  int q;
  cin>>q;
  while(q--){
    int cmd, num;
    cin>>cmd>>num;
    if(cmd == 0){
      S.insert(num);
      cout<<S.size()<<endl;
    }
    if(cmd == 1){
      cout<<S.count(num)<<endl;
    }
    if(cmd == 2){
      S.erase(num);
    }
  }
  return 0;
}



Measured memory_bytes: 12396
/// Created by ...Lusifer
#include<bits/stdc++.h>
using namespace std;
 
#define pb 		push_back
#define mp 		make_pair
#define prior   priority_queue
#define MOD 	1000000007
#define INF64 	(long long)1e18
#define INF 	(int)1e9
#define PI 		3.1415926535897932384626433832795 
#define ll      long long
#define ld		long double
#define ret     return
#define NUM 	1000001
const int SIZE = 2e5+4;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
void fastio(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

void solveTest(){
	int n;
	cin>>n;
	int t[n+1];
	int x[n+1],y[n+1];
	for(int i=0;i<n;i++){
		cin>>t[i]>>x[i]>>y[i];
	}
	int T0=0;
	int x0=0,y0=0;
	for(int i=0;i<n;i++){
		int T=t[i]-T0;
		int d=abs(x[i]-x0)+abs(y[i]-y0);
		if(d<=T&&(T-d)%2==0){
			T0=t[i];
			x0=x[i];
			y0=y[i];
		}
		else{
			cout<<"No"<<endl;
			return;
		}

	}
	cout<<"Yes"<<endl;
	//cout<<endl<<"Time: "<<(float)clock()/CLOCKS_PER_SEC<<" seconds"<<endl;
	return ;
}
 
int main(){
	fastio();

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

Measured memory_bytes: 4760
#include<bits/stdc++.h>
using namespace std;
int n,W;
long long int w[200],v[200];
long long int dp[200][100006];
long long int knapsack(int i, int w1)
{
    if(i>=n)
    {
        return 0;
    }
    long long int res1=0,res2=0;
    if(dp[i][w1]!=-1)
        return dp[i][w1];
    if(w1+w[i]<=W)
        res1=v[i]+knapsack(i+1,w1+w[i]);
    res2=knapsack(i+1,w1);
    return dp[i][w1]=max(res1,res2);
}
int main()
{
    memset(dp,-1,sizeof dp);
    cin>>n>>W;
    for(int i=0;i<n;i++)
    {
        cin>>w[i]>>v[i];
    }
    cout<<knapsack(0,0)<<endl;

    return 0;
}


Measured memory_bytes: 159816
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)
#define INF (1001001001)
#define EPS (1e-15)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define pra(x) do{rep(__i,(x).size()) pri(x,__i);}while(0)
#define pran(x,n) do{rep(__i,n) pri(x,__i);}while(0)
#define pral(x) do{cerr << (#x) << " =";rep(__i,(x).size()) cerr<<" "<<(x[__i]);cerr<<endl;}while(0)
#define prar(x,b,e) do{repr(__i,b,e) pri(x,__i);}while(0)

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool CHMAX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool CHMIN(T &l,const T &r){return l>r?l=r,1:0;}

ll MOD = 1000000007;

function<void(int,int)> tensi_no_3p=[&](int v,int d){
};

int in() {
	int a;
	scanf("%d ", &a);
	return a;
}

int main() {
	int N, K, Q;
	cin >> N >> K >> Q;
	vint A(N); rep(i, N) cin >> A[i];
	vpint AI(N); rep(i, N) AI[i] = mp(A[i], i);
	sort(AI.begin(), AI.end());
	vint i2o(N);
	rep(i, N) rep(k, N) if (AI[k].second == i) {
		i2o[i] = k;
		break;
	}
	
	ll ans = AI[Q - 1].first - AI[0].first;
	for (int Y = 1; Y <= N - Q; Y++) {
		// (left, right]
		int left = Y + Q - 2;
		int right = N;
		pr(Y);
		if (AI[left + 1].first - AI[Y].first >= ans) continue;
		while (right - left >= 2) {
			int X = (left + right) / 2;
			int count = 0;
			int whole = 0;
			int num = 0;
			rep(i, N + 1) {
				if (i == N || i2o[i] < Y) {
					whole += max(0, min(num - K + 1, count));
					count = 0;
					num = 0;
				}
				else {
					num++;
					if (i2o[i] <= X) {
						count++;
					}
				}
			}
			if (whole >= Q) right = X;
			else left = X;
		}
		pr(right);
		if (right == N) continue;
		ans = min<ll>(ans, AI[right].first - AI[Y].first);
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    set <string> tmp;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        tmp.insert(s);
    }
    cout << tmp.size();
    return 0;
}


Measured memory_bytes: 19276
N=int(input())
a=[list(map(int,input().split())) for _ in range(N)]
dp=[[0,0] for _ in range(N+1)]
f=True
for i in range(N):
  t=a[i][0]-dp[i][1]
  x=a[i][1]
  y=a[i][2]
  if t>=x+y-dp[i][0] and t%2==(x+y+dp[i][1])%2:
    dp[i+1][0]=x+y
    dp[i+1][1]=a[i][0]
  else:
    f=False
    break
if f:print("Yes")
else:print("No")

Measured memory_bytes: 37816
import java.{util => ju}
import scala.collection.{mutable => mu}
import MyPredef._


object Main extends App {
    val g0 = Set(1,3,5,7,8,10,12)
    val g1 = Set(4,6,9,11)
    val x, y = nextInt
    if((g0.contains(x)&&g0.contains(y))||(g1.contains(x)&&g1.contains(y))||(x==y&&x==2))println("Yes")
    else println("No")
}


object MyPredef {
  @inline def rep(n: Int, f: => Unit): Unit = { var c = 0; while (c < n) { f; c += 1 } }
  @inline def rep(n: Int, f: Int => Unit): Unit = { var c = 0; while (c < n) { f(c); c += 1 } }

  private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0
  @inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
  @inline private def hasNextByte(): Boolean =
    if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else { true }
  @inline private def hasNext(): Boolean = {
    while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
    hasNextByte()
  }
  @inline private def readByte(): Byte =
    if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else { -1 }
  def next(): String = {
    if(!hasNext()) ???
    val sb = new StringBuilder; var b = readByte()
    while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
    sb.toString
  }
  def nextInt(): Int = {
    val n = nextLong()
    if (n < Int.MinValue || Int.MaxValue < n) ???
    n.toInt
  }
  def nextLong(): Long = {
    if(!hasNext()) ???
    var minus = false; var b = readByte()
    if (b == '-') { minus = true; b = readByte() }
    def go (b: Byte, n: Long = 0): Long =
      if ('0' <= b && b <= '9') { go(readByte(), n * 10 + b - '0') }
      else if (minus) { -n } else { n }
    go(b)
  }
  def nextDouble(): Double = next.toDouble
}
object MyArray {
  def fillT[T : scala.reflect.ClassTag](dimX: Int, dimY: Int)(f: => T): Array[Array[T]] = {
    val arrs = Array.ofDim[T](dimX, dimY)
    for {
      y <- (0 until dimY)
      x <- (0 until dimX)
    } {
      arrs(x)(y) = f
    }
    arrs
  }
}

Measured memory_bytes: 25404
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>

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

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

	if (b < a*n) {
		cout << b << endl;
	}
	else {
		cout << a*n << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

vector <char> ALPHABET(26); 

int main(){
  int n;
  cin >> n;
//init APLPHABET
  for(int i = 0; i < 26; i++){
    ALPHABET[i] = char('a' + i);
  }
  
  vector<string> S(n);
  for(int i = 0; i < n; i++) cin >> S[i];
  
  vector<int> isect(26,51);
  for(int a = 0; a < isect.size(); a++){
    for(int i = 0; i < n; i++){
      int l = S[i].size();
      int t = 0;
      for(int j = 0; j < l; j++){
        if(S[i][j] == ALPHABET[a]){
          t++;
        }
      }
      if(isect[a] > t) isect[a] = t;
    }
  }
  string ans;
  
  for(int i = 0; i < isect.size(); i++){
    int t = isect[i];
    while(t > 0){
    ans.push_back(ALPHABET[i]);
    t--;
    }
  }
  cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define oo 3005
using namespace std;
int n, cnt, cap[oo], in[oo], w[oo], flag[oo];
struct edge {int ne, to;} e[oo];
inline void add (int u, int v)
{e[++ cnt] = (edge) {cap[u], v}; cap[u] = cnt;}
queue <int> q;
int main ()
{
    scanf("%d", &n);
    for(int i = 1; i <= n; ++ i)
    scanf("%d", &w[i]);
    for(int i = 1, x, y; i < n; ++ i)
    {
        scanf("%d%d", &x, &y);
        if(w[x] > w[y]) add(y, x), ++ in[x];
        if(w[x] < w[y]) add(x, y), ++ in[y];
    }
    for(int i = 1; i <= n; ++ i)
    if(!in[i]) q.push(i);
    while(!q.empty())
    {
        int u = q.front(); q.pop();
        for(int i = cap[u], v; i; i = e[i].ne)
        {
            v = e[i].to; if(!flag[u]) flag[v] = 1;
            -- in[v]; if(!in[v]) q.push(v);
        }
    }
    for(int i = 1; i <= n; ++ i)
    if(flag[i]) printf("%d ", i);
    return 0;
}

Measured memory_bytes: 384
H, W = map(int, input().split())
walls = 0
S = [0] * H
for i in range(H):
    L = input()
    walls += L.count('#')
    S[i] = '#' + L + '#'
S = ['#' * (W+2)] + S + ['#' * (W+2)]
V = [[0] * (W+2) for _ in range(H+2)]

q = [(1, 1, 1)]
while q:
    x, y, c = q.pop(0)

    if (x, y) == (H, W):
        # 最短経路と元々の壁以外を数える
        print(H * W - walls - c)
        break

    for m, n in {(0, 1), (0, -1), (1, 0), (-1, 0)}:
        i, j = x+m, y+n
        if S[i][j] == '#' or V[i][j]:
            continue
        q.append((i, j, c+1))
        V[i][j] = 1

else:
    print(-1)



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


int main() {
    int n,M,m,amax=0,amaxi=0,bmax=0,bmaxi=0;
    cin >> n;
    vector<int> v(n+10),a(100001,0),b(100001,0);

    for(int i = 0;i < n ; i ++){
        cin >> v.at(i);
    }

    for(int i = 0;i < n-1;i +=2){
        a.at(v.at(i)) ++;
        b.at(v.at(i+1)) ++;
    }

    for(int i =0 ;i < 100000;i ++){
        if(a.at(i) > amax){
            amax = a.at(i);
            amaxi = i;
        }
        if(b.at(i) > bmax){
            bmax = b.at(i);
            bmaxi = i;
        }
    }
    if(amaxi == bmaxi){
        sort(a.begin(),a.end());
        reverse(a.begin(),a.end());
        sort(b.begin(),b.end());
        reverse(b.begin(),b.end());

        int c = min(n-a.at(0)-b.at(1),n-a.at(1)-b.at(0));
        cout << c << endl;
    }else{
        cout << n-amax-bmax << endl;
    }
}


Measured memory_bytes: 1916
#include<iostream>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define maxn 30
#define LL long long
#define INF 0x3f3f3f3f
#define mset(p,v) memset(p,v,sizeof(p))
using namespace std;
int n;
void dfs(string s,char cur)
{
    if(s.length()==n)
        cout<<s<<endl;
    else
    {
        for(char c='a';c<=cur;c++)
            dfs(s+c,(c==cur)?cur+1:cur);
    }
}
string s;
int main()
{
    while(~scanf("%d",&n))
    {
        s="";
        dfs(s,'a');
    }

    return 0;
}




Measured memory_bytes: 1536
#include <iostream>
using namespace std;
int main()
{
  long x;
  cin >> x;
  long ans = (x / 11) * 2;
  if (1 <= x % 11 && x % 11 <= 6)
    ans += 1;
  else if (7 <= x % 11 && x % 11 <= 10)
    ans += 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(void) {
  int D, G;
  int p[10], c[10];
  scanf("%d %d", &D, &G);
  G /= 100;
  for (int i = 0; i < D; i++) {
    scanf("%d %d", &p[i], &c[i]);
    c[i] /= 100;
  }

  int all = 0, ans[10] = {}, min = 0x7FFFFFFF;
  while (all < (1 << D)) {
    int score = 0;
    for (int i = 0; i < D; i++) {
      ans[i] = ((all & (1 << i)) > 0) * p[i];
      score += ans[i]*(i+1) + (ans[i]>0)*c[i];
    }
    for (int i = D-1; G > score && i >= 0; i--) {
      if ((all & (1 << i)) > 0) continue;
      if (ceil((G - score) / (double)(i+1)) >= p[i]) {
        ans[i] = p[i];
        score += (i+1)*p[i] + c[i];
      } else {
        ans[i] = ceil(((double)G - score) / (i+1));
        score += (i+1)*ans[i];
      }
    }
    int n = 0;
    for (int i = 0; i < D; i++) n += ans[i];
    if (min >= n) {
      min = n;
    }
    all++;
  }
  printf("%d\n", min);

  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;

LL n,x,v,w;
LL dp[105][100005] = {0};

int main(){
	scanf("%lld %lld",&n,&x);
	for(LL i = 1;i <= n;i ++){
		scanf("%lld %lld",&w,&v);
		for(LL j = 0;j <= x;j ++){
			dp[i][j] = dp[i - 1][j];
			if(j >= w) dp[i][j] = max(dp[i][j],dp[i - 1][j - w] + v);
		}
	}
	printf("%lld\n",dp[n][x]);
	return 0;
}
//

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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    ll n; cin >> n;

    ll ans = n - 1;

    for (ll i = 1; i < 10000000; ++i) {
        if (n % i == 0) {
            ans = min(((i - 1) + (n / i - 1)), ans);
        }
    }

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

Measured memory_bytes: 256
//k_k_dubey_
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define inf 999999999999
#define mx 200005
#define gcd __gcd
#define pb push_back
#define mk make_pair
#define bs binary_search
#define pq priority_queue
#define ub upper_bound
#define lb lower_bound
#define endl "\n"
#define vl vector<ll>
#define vs vector<string>
#define non __builtin_popcount
#define ml map<ll, ll> 
#define ms map<string , ll> 
using namespace std;

bool isp[mx];

void sv(){

	ll i,j;
	memset(isp, true, sizeof(isp));
	
	isp[1]= false;
	for(i=2;i*i<mx;i++){
		if(isp[i]){
			for(j=i*i;j<mx;j+=i)
			isp[j]= false;
		}
	}
}

ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	//sv();
	
	ll n,d,i,j, tmp, k;
	vl v[1000];
	cin>>n>>d;
	for(i=0; i< n; i++){
	    for(j=0; j<d; j++){
	        cin>>tmp;
	        v[i].pb(tmp);
	    }
	}
	ll ans=0;
	
	for(i=0; i<n; i++){
	    
	    for(j= i+1; j<n; j++){
	        tmp=0;
	        for(k=0; k<d; k++){
	            tmp+= ((v[j][k]-v[i][k])*(v[j][k]-v[i][k]));
	        }
	        double kk= sqrt(tmp);
	        if(kk== (ll)kk)
	        ans++;
	    }
	}
	cout<<ans;
    return 0;
}























Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<bitset>
using namespace std;
#define INF (1<<20)
int r[15];
int L;
int N;
double dp[(1<<14)][14];
vector<string> ny;
int bita;
double GetLarge(int r1,int r2){
  return sqrt((r1+r2)*(r1+r2)-abs(r1-r2)*abs(r1-r2))-r1+r2;
}
double solve(int no,int zen){
  double ret=INF;
  //  printf("%d\n",no);
  //  printf("%lf %d %d\n",dp[no][zen],no,zen);
  if(dp[no][zen]>0) return dp[no][zen];
  if(no==bita){
    return dp[no][zen]=(double)(r[zen]*2);
  }
  for(int i=0;i<N;i++){
    if( (no & (1<<i)) != 0) continue;
    double ad;
    ad = GetLarge(r[i],r[zen]);
    ret=min(ret,solve( (no|(1<<i)), i )+ad);
  }
  return dp[no][zen]=ret;
}
main(){
  char buf[256];
  int co;
  while(fgets(buf,sizeof(buf),stdin)!=NULL){
    for(int i=0;i<(1<<13);i++){
      for(int j=0;j<13;j++){
	dp[i][j]=-1.0f;
      }
    }
    string str=buf;
    co=0;
    for(int i=0;i<(int)str.size();i++){
      if(str[i]==' '){
	ny.push_back(str.substr(co,i-co+1));
	co=i+1;
      }
    }
    ny.push_back(str.substr(co,(int)str.size()-co));
    sscanf(ny[0].c_str(),"%d",&L);
    N=0;
    for(int i=0;i<(int)ny.size()-1;i++){
      N++;
      sscanf(ny[i+1].c_str(),"%d",&r[i]);
    }
    bita = (1<<N)-1;
    //  printf("%d %d\n",N,bita);
    double ret = INF;
    for(int i=0;i<N;i++){
      ret=min(ret,solve((1<<i),i));
      //  printf("%lf\n",ret);
    }
    if(ret <= (double)L)
      printf("OK\n");
    else
      printf("NA\n");
    ny.clear();
  }
}

Measured memory_bytes: 2108
#include <stdio.h>
#include <math.h>
#include <time.h>

int main() {
  long N;
  scanf("%ld", &N);
  long tmp = (long)sqrt(N);
  long i;
  time_t t = time(NULL);
  for (i=tmp; i>0; i--) {
    if (N % i == 0) break;
  }
  printf("%ld\n", i + (N / i) - 2);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ph push
#define ptc putchar
#define enter putchar('\n')
#define mod 1000000007
using namespace std;
typedef pair<int,int> pii;
typedef double db;
typedef long double ldb;
typedef long long ll;
typedef long long lnt;
inline int read(){
	int x = 0;char c = getchar();
	while (!isdigit(c)) c = getchar();
	while (isdigit(c)) x = (x << 1) + (x << 3) + c - '0' , c = getchar();
	return x;
}
inline void write(int x){
	if (!x){
       ptc('0');
       return;
	}
	int dg[20] , len = 0;
	while (x) dg[len++] = x % 10 , x /= 10;
	while (len--) ptc(dg[len]+'0');
}
inline void writeln(int x){
	write(x);
	ptc('\n');
}

int add(int x,int y){
	x += y;
	if (x >= mod) x -= mod;
	return x;
}
int sub(int x,int y){
	x -= y;
	if (x < 0) x += mod;
	return x;
}
const int N = 2e5 + 10;

int n , a[N] , f[N] , cod[N];

int main(){
	scanf("%d",&n);
	f[0] = 1;
	for (int i = 1;i <= n;i++){
		scanf("%d",a + i);
	}	
	for (int i = 1;i <= n;i++){
		int j = i;
		while(j + 1 <= n && a[j + 1] == a[i]){
			j++;
		}
		f[j] = add(cod[a[i]] , f[i-1]);
		cod[a[j]] = add(cod[a[i]] , f[i-1]);
		i = j;
	}
	cout<<f[n]<<endl;
	return 0;
}

Measured memory_bytes: 2560
n=int(input())
a=list(map(int,input().split()))
b,c,d=0,0,0
for i in a:
    if i%4==0:
        b+=1
    elif i%2==0:
        c+=1
    else:
        d+=1
if c==0 and b>=d-1:
    print("Yes")
elif b>=d:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 20008
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N =int.Parse(Console.ReadLine());
            var K = int.Parse(Console.ReadLine());
            var X = int.Parse(Console.ReadLine());
            var Y = int.Parse(Console.ReadLine());

            if (K >= N)
                Console.WriteLine(N*X);
            else
                Console.WriteLine(K*X + (N-K)*Y);
        }
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;

void solve() {
	int n; cin >> n;
	vector<LP> v;
	rep(i, n) {
		ll a, b; cin >> a >> b;
		v.push_back({ b,a });
	}
	sort(v.begin(), v.end());
	ll cur = 0;
	rep(i, n) {
		cur += v[i].second;
		if (cur > v[i].first) {
			cout << "No" << endl; return;
		}
	}
	cout << "Yes" << endl;
}

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

	//cout << fixed << setprecision(10);
	//init();
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 6512
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getval(_T& a) {
	std::cin >> a;
}
template<class _T> static void getval(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getval(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}
template <class _T> static _T tp_abs(_T a) {
	if (a < (_T)0) {
		a *= (_T)-1;
	}
	return a;
}
template <class _T> static void tp_swap(_T& right, _T& left) {
	//	usage:  tp_swap<type name>(a, b);
	_T tmp = right;
	right = left;
	left = tmp;
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}

static void exec()
{
	int H, W, N;
	getval(H, W, N);

	std::vector<int> ai(N);
	for (int i = 0; i < N; i++) {
		getval(ai[i]);
	}

	std::vector<std::vector<int>> grid(H, std::vector<int>(W, 0));
	int nowh = 0, noww = 0, dir = 1;
	for (int i = 0; i < N; i++) {
		int count = ai[i];
		int color = i + 1;
		while (count) {
			grid[nowh][noww] = color;
			count--;
			if ((nowh == H - 1) && (dir == 1)) {
				dir = -1;
				noww++;
			}
			else if ((nowh == 0) && (dir == -1)) {
				dir = 1;
				noww++;
			}
			else {
				nowh += dir;
			}
		}
	}
	for (int h = 0; h < H; h++) {
		for (int w = 0; w < W; w++) {
			printf("%d ", grid[h][w]);
		}
		putchar('\n');
	}
}


Measured memory_bytes: 3692
from collections import deque, Counter
from itertools import chain, combinations
import json
import numpy as np
import bisect


def main():
    # N = int(input())
    N, K = [int(a) for a in input().split()]

    for i in range(10000000):
        if N < K ** i:
            print(i)
            return

    # A = [int(a) for a in input().split()]
    #
    # A = sorted(A)
    # A = np.array(A)
    #


if __name__ == "__main__":
    main()


Measured memory_bytes: 17712
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm> 
using namespace std;
int main()
{	
	int n,r,sum;
	cin>>n>>r;
	if(n<=10)
	{
		sum=100*(10-n)+r;
	}
	else
	{
		sum=r;
	}
	cout<<sum;
 } 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int h,w,n,a[10000],r[100][100];

int main(int argc,char** argv) {
	cin >> h >> w >> n;
	for(int i = 0;i < n;i++) cin >> a[i];
	int ind = 0;
	for(int y = 0;y < h;y++) {
			if(y % 2 == 0) {
				for(int x = 0;x < w;x++) {
					r[x][y] = ind + 1;
					a[ind]--;
					if(a[ind] == 0) ind++;
				}
			}else {
				for(int x = w-1;x >= 0;x--) {
					r[x][y] = ind + 1;
					a[ind]--;
					if(a[ind] == 0) ind++;
				}
			}
		}
	for(int y = 0;y < h;y++) {
		for(int x = 0;x < w;x++) {
			cout << r[x][y] << " ";
		}
		cout << endl;
	}
}


Measured memory_bytes: 384
//package unk;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author sguar <shugangcao@gmail.com>
 * welcome to kuaishou
 * Created on 2020-01-10
 */
public class Main {

    public void run() {
        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt();
        Point[] list = new Point[n];
        for (int i = 0; i < n; i++) {
            int x = cin.nextInt();
            int l = cin.nextInt();
            list[i] = new Point(x, l);
        }
        Arrays.sort(list);
        //debug(list);
        int ans = 1;
        Point last = list[0];
        for (int i = 1; i < n; i++) {
            if (list[i].getX() < last.getY()) {

            } else {
                ans++;
                last = list[i];
            }
        }
        System.out.println(ans);
    }
    public static void main(String[] args) {
        new Main().run();
    }

    private void debug(Point[] points) {
        for (int i = 0; i < points.length; i++) {
            System.out.println(points[i]);
        }
    }
    class Point implements Comparable<Point>{
        int x;
        int y;
        int l;
        public Point(int xi, int l) {
            this.x = xi - l;
            this.y = xi + l;
            this.l = l;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }

        public int getL() {
            return l;
        }

        @Override
        public int compareTo(Point o) {
            if (o.y == this.y) {
                return this.x - o.x;
            }
            return this.y - o.y;
        }

        @Override
        public String toString() {
            return "x:" + x + ",y:" + y;
        }
    }
}


Measured memory_bytes: 92212
import sys
input = sys.stdin.buffer.readline
N = int(input())
A = [int(input()) for _ in range(N)]
B = A[:]
max1 = max(A)
A.remove(max1)
max2 = max(A)

for i in B:
    if i == max1:
        print(max2)
    else:
        print(max1)


Measured memory_bytes: 18620
#include <stdio.h>

int main()
{
    int c=0,p,n,k,d,arr[110]={};
    scanf("%d%d",&n,&k);
    for(int i=1;i<=k;i++) {
        scanf("%d",&d);
        while(d--) { scanf("%d",&p); arr[p]++; }
    }
    for(int i=1;i<=n;i++) { if(arr[i]==0) c++; }
    printf("%d",c);

    return 0;
}

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

public class Main {
	static int n, H[];
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		n=Integer.parseInt(in.next()); H=new int[n+1];
		for(int i=1;i<=n;i++) {
			H[i]=Integer.parseInt(in.next());
		}
		buildMaxHeap();
		
		PrintWriter out=new PrintWriter(System.out);
		for(int i=1;i<=n;i++)out.print(" "+H[i]);
		out.println();
		out.flush();
	}
	
	static void maxheapify(int i) {
		if(i*2>n) return;
		
		int max=H[i], u=-1;
		if(H[i*2]>max) {
			max=H[i*2];
			u=i*2;
		}
		if(i*2+1<=n && H[i*2+1]>max) {
			max=H[i*2+1];
			u=i*2+1;
		}
		
		if(u>0) {
			int t=H[i];
			H[i]=H[u];
			H[u]=t;
			maxheapify(u);
		}
	}
	
	static void buildMaxHeap() {
		for(int i=n/2;i>0;i--)maxheapify(i);
	}
}



Measured memory_bytes: 110164
import math

n, q = map(int, input().split())

# make a list whose length is 2^i - 1.
n = pow(2, math.ceil(math.log2(n)))
max_v = 2147483647

A = [max_v for i in range(2 * n - 1)]


def update(i, x):
    i += n - 1
    A[i] = x

    while i > 0:
        i = (i - 1) // 2
        A[i] = min(A[i * 2 + 1], A[i * 2 + 2])

def find(a, b, k, l, r):
    if r <= a or b <= l:
        return max_v
    if a <= l and r <= b:
        return A[k]
    else:
        vl = find(a, b, k * 2 + 1, l, (l + r) // 2)
        vr = find(a, b, k * 2 + 2, (l + r) // 2, r)
        return min(vl, vr)


for i in range(q):
    com, x, y = map(int, input().split())
    if com == 0:
        update(x, y)
    else:
        ans = find(x, y + 1, 0, 0, n)
        print(ans)

Measured memory_bytes: 11196
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	int n;
	cin>>n;
	int array[n][3];
	for(int x=0;x<n;x++){
		cin>>array[x][0]>>array[x][1]>>array[x][2];
	}
	int dp[n][3];
	dp[0][0]=array[0][0];
	dp[0][1]=array[0][1];
	dp[0][2]=array[0][2];
	for(int x=1;x<n;x++){
		dp[x][0]=array[x][0]+max(dp[x-1][1],dp[x-1][2]);
		dp[x][1]=array[x][1]+max(dp[x-1][0],dp[x-1][2]);
		dp[x][2]=array[x][2]+max(dp[x-1][0],dp[x-1][1]);	
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	
	
	
	
	
	
	
return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <iomanip>
#include <cmath>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;

ll BASE_NUM = 1000000007;
int main()
{
    // 整数の入力
    ll N,K;
    cin >> N >> K;
    vector<vector<ll>> A(2,vector<ll>(N,0));
    for (int i = 0; i < N; i++)
    {
        cin >> A[0][i];
    }
    ll last_index =-1;
    for(ll i = 0;i < K ;i++){
        ll current = i% 2;
        ll next = (i+1)% 2;
        last_index = next;
        for (ll j = 0; j < N; j++)
        {
            A[next][j] = 0;
        }

        for(ll j = 0;j < N;j++){
            ll from = max(0ll,j - A[current][j]);
            ll to = min(N-1,j + A[current][j]) + 1;
            A[next][from]++;
            if (to != N){
                A[next][to]--;
            }
        }
        ll next_min = A[next][0];
        for(int j = 1; j < N;j++){
            A[next][j] += A[next][j-1];
            next_min = min(next_min,A[next][j]);
        }

        if (next_min == N){
            // cout << "break" << i << endl;
            break;
        }
    }
    for(int i = 0;i < N;i++){
        if(i != 0){
            cout << " ";
        }
        cout << A[last_index][i];
    }
    cout << endl;
   return 0;
}

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

int main(){
	int a, b , c;
	std::cin>>a>>b>>c;
	std::vector<int> s;
	s.push_back(a);
	s.push_back(b);
	s.push_back(c);
	std::sort(s.begin(), s.end());
	std::cout<<s[2] * 10 + s[1] + s[0]<<std::endl;
	return 0;

}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
   int a,b,c;
   int i;
   int d = 0;
   
   scanf("%d", &a);   scanf("%d", &b);   scanf("%d", &c);
   
   for(i=a;i<=b;i++){
      if(c%i==0){
         d+=1;}}
         
   printf("%d\n", d);
   
   return 0;
}


Measured memory_bytes: 2092
#ifdef Rahul
# include "RAHUL.h"
#else
# include <bits/stdc++.h>
  using namespace std;
# define error(...) 42;
#endif
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
const int MOD = (int) 1e9 + 7;
const i64 INF = (i64) 1e18 + 42;

int main() {
  cin.tie(nullptr) -> sync_with_stdio(false);
  
  char c; cin >> c;
  kek(c >= 'a' ? 'a' : 'A');
}


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

string grid[1010];
int dp[1010][1010];
const int M = 1e9 + 7;

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

	int h, w;
	cin >> h >> w;

	for (int i = 0; i < h; ++i) cin >> grid[i];

	dp[1][1] = 1;
	for (int y = 1; y <= h; ++y) {
		for (int x = 1; x <= w; ++x) {
			if (grid[y-1][x-1] == '#') continue;
			dp[x][y] += (dp[x-1][y] + dp[x][y-1]) % M;
		}
	}
	cout << dp[w][h] << '\n';
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
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;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a, b, c;
    cin >> a >> b >> c;
    cout << a[0] << b[0] << c[0] << "\n";
}

Measured memory_bytes: 3644
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]
"""
n,k = ip()
x = [inp() for i in range(n)]
"""
import sys
sys.setrecursionlimit(10**6)
def dfs(u):
    global vis,graph
    vis.add(u)
    for i in graph[u]:
        if i not in vis:
            dfs(i)


n,m = ip()
graph = {i:[] for i in range(1,n+1)}
for i in range(m):
    a,b = ip()
    graph[a].append(b)
    graph[b].append(a)
vis = set()
ct = 0
for i in range(1,n+1):
    if i not in vis:
        dfs(i)
        ct += 1
print(ct-1)

Measured memory_bytes: 897824