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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

class UnionFind {
private:
    int n;
    vector<int> a;
public:
    UnionFind(int n) : n(n), a(n, -1) {}
    int find(int x) { return a[x] < 0 ? x : (a[x] = find(a[x])); }
    bool same(int x, int y) { return find(x) == find(y); }
    bool same(ii& p) { return same(p.first, p.second); }
    bool unite(int x, int y) {
        x = find(x), y = find(y);
        if (x == y) return false;
        if (a[x] > a[y]) swap(x, y);
        a[x] += a[y];
        a[y] = x;
        n--;
        return true;
    }
    bool unite(ii& p) { return unite(p.first, p.second); }
    int size() const { return n; }
    int size(int x) { return -a[find(x)]; }
};

int main() {
	ll n, m;
	cin >> n >> m;

	vi a(m), b(m);
	rep(i, m) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
	}

    UnionFind uf(n);
    ll cur = n * (n - 1) / 2;
    vl res;
    rep(i, m) {
        res.push_back(cur);

        int c = a[m - 1 - i], d = b[m - 1 - i];
        if (uf.same(c, d)) continue;

        ll sa = uf.size(c), sb = uf.size(d);
        cur -= sa * sb;
        uf.unite(c, d);
    }

    reverse(ASC(res));
    rep(i, res.size()) cout << res[i] << endl;
}

Measured memory_bytes: 3444
main(){
  int i,j,key,n,c;
  int A[101];

  scanf("%d",&n); /* The n is the number of elements in the sequence. */
  
  if(n<1||n>100){
    return 0;
  }               /* Constraints: 1 <= n <= 100 */
  
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }               /* Scanning n elements of the sequence */
  
  for(i=1;i<=n-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[i]);
  /* Printing scaned n elements of the sequence */

  for(j=2;j<=n;j++){
    key = A[j];
    i = j - 1;
    while(i>0&&A[i]>key){
      A[i+1]=A[i];
      i = i - 1;
    }
    A[i+1]=key;   /* Insertion Sort */

    for(c=1;c<=n-1;c++){
      printf("%d ",A[c]);
    }
    printf("%d\n",A[c]);
  }               /* Printing sorted the sequence */

  return 0;
}

Measured memory_bytes: 0
a,b,m = list(map(int,input().split()))
arr = list(map(int,input().split()))
brr = list(map(int,input().split()))
l = []
for rep in range(m):
	x,y,c = list(map(int,input().split()))
	p = arr[x-1] + brr[y-1] - c
	l.append(p)
alt = min(arr) + min(brr)
print(min(min(l),alt))

Measured memory_bytes: 18736
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) for(auto&& x : v){cout << x << " ";} cout << endl
#define printVV(vv) for(auto&& v : vv){for(auto&& x : v){cout << x << " ";}cout << endl;}
#define printP(p) cout << p.first << " " << p.second << endl
#define printVP(vp) for(auto&& p : vp) printP(p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;
typedef vector<vector<int>> Graph;

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

    int N;
    cin >> N;
    vi a(N);
    rep(i, N) cin >> a[i];

    int ans = 0;
    rep(i, N) {
        if (i != 0 && a[i - 1] > 0 && a[i] > 0) {
            ans++;
            a[i]--;
        }
        ans += a[i] / 2;
        a[i] %= 2;
    }
    cout << ans << endl;

}


Measured memory_bytes: 1024
i = j = 0
n = ''
m = ''


line = input()

while line[i] != ' ':
    n = n + line[i]
    i += 1
    
while i < len(line):
    m = m + line[i]
    i += 1
    
n = int(n)
m = int(m)

if n == m:
    print("a == b")

if n > m:
    print("a > b")

if n < m:
    print("a < b")

Measured memory_bytes: 7636
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define COUNT(i, n) for(int i = 1; i <= n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

int main(void){
    for(int t, n; cin >> t >> n, t;){
        while(n --){
            int s, f; cin >> s >> f;
            t += s - f;
        }
        if(t <= 0) cout << "OK" << endl;
        else cout << t << endl;
    }
 
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
	string s;
	cin >> s;

	std::sort(s.begin(), s.end());
	auto it = std::unique(s.begin(), s.end());
	if (it == s.end())
		cout << "yes";
	else
		cout << "no";
	cout << endl;
		
	return 0;
}


Measured memory_bytes: 256
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9+7;

int main(void) {

    int N; cin>>N;
    vector<int> a(N+1,0);
    for (int i = 2; i <= N; ++i) {

        int tmp = i;
        ll cnt = 0;
        for (int j = 2; j <= tmp; ++j) {
            while(tmp%j==0){
                tmp /= j;
                a[j]++;
            }
        }
    }

    ll ans = 1;
    for (int i = 0; i <= N; ++i) {
        ans *= (a[i]>0)?++a[i]:1;
        ans %= MOD;
    }

    cout<<(ans?ans:0)<<endl;

    return 0;
}

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

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef long double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main() {
	int n; int m; scanf("%d%d", &n, &m);
	vpi jobs;
	forn(i, n) {
		int a, b; scanf("%d%d", &a, &b);
		if(a <=m)
			jobs.pb({a, b});
	}
	sort(all(jobs));
	int total = 0;
	int index = 0;
	priority_queue<int> check; 
	for1(i, m) {
		while(index < jobs.size() && jobs[index].first <= i) {
			int x = jobs[index].second;
			check.push(x);
			index++;
		}
		if(!check.empty()) {
			int x = check.top();
			check.pop();
			total += x;
		} 
	}
	printf("%d", total);








	return 0;
}

Measured memory_bytes: 1908
# frozen_string_literal: true

WHITE = -9999
GRAY = -99_999

$colors = {}
$pair = {}

_n = gets
$graph = readlines.map do |line|
  # 1 2 2 4
  line.split.map(&:to_i)
end

$graph.each do |line|
  $colors[line[0]] = WHITE
end

def bfs(n)
  queue = []
  queue.push([$graph[n - 1], 0])

  while queue.any?
    v, distance = queue.shift
    next unless $colors[v[0]] == WHITE

    $colors[v[0]] = GRAY
    $pair[v[0]] = distance

    v[2..-1].each do |i|
      if $colors[i] == WHITE
        queue.push([$graph[i - 1], distance + 1])
      end
    end
  end
end

bfs(1)

$graph.each do |line|
  v = line[0]
  $pair[v] = -1 if $pair[v].nil?
end

$pair.sort_by { |k, _v| k }.each do |k, v|
  puts "#{k} #{v}"
end




Measured memory_bytes: 6884
#include <iostream>
#include <cmath>

using namespace std;

int main(int argc, const char *argv[])
{
  long long a, b, c;
  cin >> a >> b >> c;

  long long d = (c - a - b);
  if (d >= 0 && 4 * a * b < d * d) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  
  return 0;
}

Measured memory_bytes: 384
import sys
sys.setrecursionlimit(10**7)
import math
mod = 10**9 + 7
def I(): return int(input())
def II(): return map(int, input().split())
def L(): return list(map(int, input().split()))
def TWO(M):
  L=[0]*M
  R=[0]*M
  for i in range(M):
    L[i],R[i] = II()
  return L, R

N = I()
A = [0]*N
for i in range(N):
  A[i] = I()
  
import numpy as np

index = np.argsort(A)

for i in range(N):
  if i == index[N-1]:
    print(A[index[N-2]])
  else:
    print(A[index[N-1]])

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

int main()
{
    int N;
    long long  K;
    cin>>N>>K;
    vector<int>A(N);
 rep(i,N)
   {
       cin>>A[i];
   }
   
  
    vector<int>s;
    vector<int>ord(N+1,-1);
    int v=1;
    int c,l;
  
    while(ord[v]==-1)
    {
        ord[v]=s.size();
        s.push_back(v);
        v = A[v-1];
    }
    
    c = s.size() - ord[v];
    l = ord[v];
  
  
  if(K<l) cout<<s[K]<<endl;
   
  else
  {
      K-=l;
      K%=c;
      cout<<s[l+K]<<endl;
  
  }
    
 
return 0;
}


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

int main(){

  double n,m;

  while(cin >> n >> m){

    bool d = false;
    string c = "";

    if(n < 70 && m < 148) c = "E", d = true;
    if(n < 55 && m < 60+56) c = "D", d = true;
    if(n < 50 && m < 60+45) c = "C", d = true;
    if(n < 43 && m < 60+29) c = "B", d = true;
    if(n < 40 && m < 60+23) c = "A", d = true;
    if(n < 37.50 && m < 60+17) c = "AA", d = true;
    if(n < 35.50 && m < 60+11) c = "AAA", d = true;

    if(d) cout << c << endl;
    if(!d) cout << "NA" << endl;

  }

}

Measured memory_bytes: 1228
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
#include<functional>
#define INF 999999

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

long long int dist[100050];
vector<P>edge[100050];

void bfs(int s)
{
	queue<P> que;
	que.push(P(s,0));
	dist[s]=0;

	while(que.size()!=0){
		P p=que.front(); que.pop();
		int from=p.first;
		for(int i=0;i<edge[from].size();i++){
			int to=edge[from][i].first;
			long long int distance=p.second+edge[from][i].second;
			if(dist[to]==INF){
				dist[to]=distance;
				que.push(P(to,distance));
			}
		}
	}
}



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

	int a[100050],b[100050];
	long long int c[100050];
	
	for(int i=0;i<n;i++){
		dist[i]=INF;
	}

	for(int i=0;i<n-1;i++){
		cin>>a[i]>>b[i]>>c[i];
		a[i]--;b[i]--;
		edge[a[i]].push_back(P(b[i],c[i]));
		edge[b[i]].push_back(P(a[i],c[i]));
	}

	
	int q,k;
	cin>>q>>k;
	bfs(k-1);

	int x[100050];
	int y[100050];
	for(int i=0;i<q;i++){
		cin>>x[i]>>y[i];
	}
	for(int i=0;i<q;i++){
		cout<<dist[x[i]-1]+dist[y[i]-1]<<endl;
	}
	return 0;
}

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

struct State {
	int index;
	int cost;

	State(int i, int c) :index(i), cost(c) {}
};

const int INF = 1 << 29;

int main()
{
	int n;

	cin >> n;

	vector<int> mincost(n, INF);
	vector<int> path(n);
	queue<State> que;

	rep(i, n) {
		cin >> path[i];
	}

	mincost[0] = 0;
	que.push(State(0, 0));

	while (!que.empty()) {
		State temp = que.front();
		que.pop();

		for (int i = 1; i <= 6; i++) {
			int next = temp.index + i;

			bool flag = true;

			while (true) {
				if (next < 0) {
					next = 0;
				}
				else if (next >= n) {
					next = n - 1;
				}

				if (mincost[next] <= temp.cost + 1) {
					flag = false;
					break;
				}

				mincost[next] = temp.cost + 1;

				if (path[next] == 0) {
					break;
				}
				else {
					next += path[next];
				}
			}

			if (flag == true) {
				if (next == n - 1) {
					cout << mincost[n - 1] << endl;
					goto End;
				}
				else {
					que.push(State(next, temp.cost + 1));
				}
			}
		}
	}
End:
	;

	return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

int main(){
	fast;
	ll n;
	cin>>n;
	ll a[n+1];
	for(int i=1;i<=n;i++)cin>>a[i];
	a[0]=-100;int flag=0;
	for(int i=1;i<=n;i++){
		if(a[i]>a[i-1])a[i]--;
	}for(int i=1;i<=n;i++){
		if(a[i]<a[i-1]){
			flag=1;
			break;
		}
	}if(flag==1)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}/*『你强归你强，我永不示弱』*/


Measured memory_bytes: 1024
n=int(input())
h=[int(i) for i in input().split()]
li=[float('inf')]*(n)

li[0]=0
li[1]=abs(h[1]-h[0])
for i in range(2,n):
    li[i] = min(li[i],li[i-1]+abs(h[i-1]-h[i]),li[i-2]+abs(h[i-2]-h[i]))

print(li[-1])
    
    

Measured memory_bytes: 13980
#include "bits/stdc++.h"
using namespace std;
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ar array

typedef long long ll;
typedef long double ld;
ll mod=1e9+7;
bool comp(ll a,ll b)
{
	return a<b;
}
ll fpow(ll a, ll b) {
	ll res=1;
	while(b) {
		if(b&1)
			res=(res*a);
		a=(a*a);
		b>>=1;
	}
	return res;
}

ll minm(ll a,ll b){
	if(a<b) return a;
	return b;
}

ll maxm(ll a,ll b){
	if(a>b){ return a;}
	else return b;
}
    
const int N=1e6+3;
vector<int>adj[N];
vector<bool>vis(N,false);
ll dp[N];

void dfs(int u){
    vis[u]=1;
    for(auto &x:adj[u]){
        if(!vis[x]){
            dfs(x);
        }
        
        dp[u]+=dp[x];
        dp[u]%=mod;
        dp[u]%=mod;
            
    }
}



void solve()
{ 
    int n,m,i,j;
    cin>>n>>m;
    
    for(i=0;i<=n*m;++i)dp[i]=0;
    dp[n*m-1]=1;
    char a[n][m];
    
    for(i=0;i<n;++i)
    {
        for(j=0;j<m;++j){
            cin>>a[i][j];
        }
    }
    
    
    for(i=0;i<n;++i){
        for(j=0;j<m;++j){
            if(a[i][j]=='.'){
                if(i+1<n&&a[i+1][j]=='.') {
                    adj[m*i+j].pb(m*(i+1)+j);
                }
                if(j+1<m&&a[i][j+1]=='.'){
                    adj[m*i+j].pb(m*i+(j+1));
                }
            }
        }
    }
    
    dfs(0);
    cout<<dp[0]<<'\n';
    
}

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



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

int main() {
	int n;cin >> n;
	set<int> st;
	for (int i = 0; i < n; ++i) {
		int tmp;cin >> tmp;
		st.insert(tmp);
	}
	cout << st.size() << endl;
	return 0;
}

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

using namespace std;

int main(void) {
  int N, K;
  cin >> N >> K;
  cout << N - (K - 1) << endl;
  return 0;
}


Measured memory_bytes: 504
from itertools import accumulate
from bisect import bisect_left

N, *A = map(int, open(0).read().split())

A = [0] + list(accumulate(A))

ans = float("inf")
for i in range(2, N - 1):
    lm = A[i] // 2
    l = bisect_left(A, lm)
    if abs(A[l - 1] - lm) < abs(A[l] - lm):
        l -= 1

    rm = (A[i] + A[N]) // 2
    r = bisect_left(A, rm)
    if abs(A[r - 1] - rm) < abs(A[r] - rm):
        r -= 1

    P = A[l]
    Q = A[i] - A[l]
    R = A[r] - A[i]
    S = A[N] - A[r]

    ans = min(ans, max(P, Q, R, S) - min(P, Q, R, S))

print(ans)


Measured memory_bytes: 25116
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, s, n) for (int i = s; i < n; i++)
#define repe(i, s, n) for(int i = s;i<=n;i++)

int main() {
	ll x, y; cin >> x >> y;

	ll count = 0;
	while (x <= y) {
		x *= 2;
		count++;
	}
	cout << count << endl;

	return 0;
}

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

using namespace std;

int main()
{
	string str;
	cin >> str;

	if (str.find("a") != string::npos && str.find("b") != string::npos && str.find("c") != string::npos) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)
#define TF 100000

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    int N;
    cin >>N;

    vector<int> A(N);
    rep(i,N) cin >> A[i];
    vector<int> x(TF+1,0);

    //-----------------------------------
    ll ans=0;
    rep(i,N){
        if(TF<A[i])ans++;
        else x[A[i]]++;
    }
    rep(i,TF){
        if(x[i]==0)continue;
        if(x[i]>=i)ans+=x[i]-i;
        if(x[i]<i)ans+=x[i];
    }

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

Measured memory_bytes: 1024
from math import gcd
from functools import reduce
k = int(input())

ans = 0

for i in range(k):
    i += 1
    for j in range(k):
        j += 1
        m = gcd(i, j)
        for l in range(k):
            l += 1
            ans += gcd(l, m)

print(ans)

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

int main()
{
  int N, Y;
  cin >> N >>Y;
  for(int i = 0; i <= N; i++)
  {
    for(int j  = 0; j <= N-i; j++)
    {
      int k = N - i - j;
      if(Y  == i * 10000 + j * 5000 + k * 1000)
      {
        cout << i << " "<< j<<" "<<k <<endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1 "<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
	int x;
	std::cin >> x;
	
	if (x != 2) {
		if (x % 2 == 0) x++;
		int i;
		while (true) {
			for (i = 3; i * i < x; i += 2) {
				if (x % i == 0) break;
			}
			if (i * i >= x) break;
			x += 2;
		}
	}
	
	std::cout << x << std::endl;
	
	return 0;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x,y;
    cin >> x>>y;
    cout << x*y<<" "<<(x*2)+(y*2)<<"\n";
    }


Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
int dp[100000000];
int ways(int **mat,int n,int p,int mask)
{
    if(mask==((1<<n)-1))
        return 1;
    int ans=0;
    if(dp[mask]>-1)
        return dp[mask];
    for(int i=0;i<n;i++)
    {
        if((mask&(1<<i))==0 && mat[p][i]==1)
        {
            ans=(ans%MOD+ways(mat,n,p+1,(mask|(1<<i)))%MOD)%MOD;
        }
    }
    return dp[mask]=ans;
}
int main()
{
    int n;
    cin>>n;
    int ** mat=new int*[n];
    for(int i=0;i<n;i++)
    {
        mat[i]=new int[n];
        for(int j=0;j<n;j++)
            cin>>mat[i][j];
    }
    memset(dp,-1,sizeof(dp));
    cout<<ways(mat,n,0,0)<<endl;
}

Measured memory_bytes: 394272
#include <iostream>

using namespace std;

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

    int y = 0;
    for(int i = 0; i < N; i++) {
        char ch;
        cin >> ch;
        if (ch == 'Y') y++;
    }

    if (y != 0) {
        cout << "Four" << endl;
    } else {
        cout << "Three" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())
b5=0
b7=0
if a==5:
  b5+=1
if a==7:
  b7+=1
if b==5:
  b5+=1
if b==7:
  b7+=1
if c==5:
  b5+=1
if c==7:
  b7+=1
if b5==2 and b7==1:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 8936
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

count = 0
next_a = a[0]
for i in range(n):
    if next_a < b[i]:
        count += next_a + min(a[i+1], b[i]-next_a)
        next_a = max(a[i+1]-b[i]+next_a, 0)
    else:
        count += b[i]
        next_a = a[i+1]

print(count)




Measured memory_bytes: 81892
//In the name of God!
#include <bits/stdc++.h>
const int maxn = 2e5 + 12;
using namespace std;
vector<int> g[maxn];
int d[maxn];
bool visit[maxn];
void dfs(int v){
    for(int c : g[v]){
        if(!visit[c]){
            visit[c] = 1;
            d[c] += d[v];
            dfs(c);
        }
    }
}
int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int n, q, a, b, p, x;
    cin >> n >> q;
    for(int i = 0; i < n - 1; i++){
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b), g[b].push_back(a);
    }
    while(q--){
        cin >> p >> x;
        p--;
        d[p] += x;
    }
    visit[0] = 1;
    dfs(0);
    for(int i = 0; i < n; i++)
        cout << d[i] << " ";
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    int n, m;
    cin >> n >> m;
    map<int, int> mp;
    for(int i = 0; i <= 100000; i++){
        mp[i] = 0;
    }
    for(int i = 1; i <= n; i++){
        int in;
        cin >> in;
        mp[in]++;
    }
    int odds[100500];
    int evens[100500];
    for(int i = 0; i <= 100000; i++){
        odds[i] = 0;
        evens[i] = 0;
    }
    for(int i = 1; i <= 100000; i++){
        int number = i % m;
        evens[number] += (mp[i] / 2) * 2;
        if(mp[i] % 2 == 1){
            odds[number]++;
        }
    }
    int ans = 0;
    //for(int i = 1; i <= 1; i++){
    for(int i = 1; i * 2 < m; i++){
        int number = min(odds[i], odds[m - i]);
        ans += number;
        odds[i] -= number;
        odds[m - i] -= number;
        //cout << ans << endl;
        number = min(odds[i], evens[m - i]);
        ans += number;
        //cout << ans << endl;
        odds[i] -= number;
        evens[m - i] -= number;
        number = min(evens[i], odds[m - i]);
        ans += number;
        //cout << ans << endl;
        evens[i] -= number;
        odds[m - i] -= number;
        ans += evens[i] / 2;
        ans += evens[m - i] / 2;
        //cout << i << " " << ans << endl;
    }
    ans += odds[0] / 2;
    evens[0] += (odds[0] % 2);
    ans += evens[0] / 2;
    if(m % 2 == 0){
        int check = m / 2;
        ans += odds[check] / 2;
        evens[check] += (evens[check] % 2);
        ans += evens[check] / 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5760
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = map(int, input().split())

count = 0
for key in T:
    U = S + [key]
    i = 0
    while U[i] != key:
        i = i+1
    if i != n:
        count = count + 1
print(count)

Measured memory_bytes: 8384
#include <bits/stdc++.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const ll Lmax=ll(1e18);
const int Nmax=2e5+1;
const int Nd=61;
const int INF=1e5;

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x; //
    return d[x] = find(d[x]); //
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

int main(){
  int n,m; cin>>n>>m;
  vector<int> p(n);
  rep(i,n){
    cin>>p[i];
    p[i]--;
  }
  UnionFind uf(n);
  int x,y;
  rep(i,m){
    cin>>x>>y;
    x--; y--;
    uf.unite(x,y);
  }
  int ans=0;
  rep(i,n){
    if(uf.same(p[i],i)){
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;

}


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

if(S==10**9):
    dummy = 3
else:
    dummy = S+1

ans_l = []
for _ in range(K):
    ans_l.append(S)
for _ in range(N-K):
    ans_l.append(dummy)

print(" ".join(list(map(str,ans_l))))


Measured memory_bytes: 56864
N = int(input())
ABC = [list(map(int, input().split())) for _ in range(N)]

# 0-indexed
dp = [[0 for _ in range(3)] for _ in range(N)] # dp[N日目][前日にした遊び]
dp[0] = ABC[0]

for i in range(1, N):
  a, b, c = ABC[i]
  dp[i][0] = max(dp[i-1][1] + a, dp[i-1][2] + a)
  dp[i][1] = max(dp[i-1][2] + b, dp[i-1][0] + b)
  dp[i][2] = max(dp[i-1][0] + c, dp[i-1][1] + c)
  
print(max(dp[-1]))

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

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

    int sum = 0;
    for (int i = 0; i < N.length(); i++) {
        const char tmp = N[i];
        sum = sum + atoi(&tmp);
        // cout << sum << "\n";
    }
    if (stoi(N)%sum == 0) {
        cout << "Yes";
        return 0;
    }
    cout << "No";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    set<int> s;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        s.insert(a);
    }
    cout << (s.size()==N? "YES\n":"NO\n");
}

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

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

template <class T>
T next()
{
    T x;
    cin >> x;
    return (x);
}

int w, h;
vector<vector<int>> islands;

void dfs(int ii, int jj)
{
    islands[jj][ii] = 0;
    for (int i = ii - 1; i <= ii + 1; i++)
    {
        for (int j = jj - 1; j <= jj + 1; j++)
        {
            if (i < 0 || i == w || j < 0 || j == h)
            {
            }
            else if (islands[j][i] > 0)
            {
                dfs(i, j);
            }
        }
    }
}

int main()
{
    vector<int> ans;
    while (true)
    {
        int cnt = 0;
        w = next<int>();
        h = next<int>();
        if (w + h == 0)
        {
            break;
        }
        islands.resize(h);
        rep(j, h)
        {
            islands[j].resize(w);
            rep(i, w)
            {
                cin >> islands[j][i];
            }
        }
        rep(j, h)
        {
            rep(i, w)
            {
                if (islands[j][i] > 0)
                {
                    cnt++;
                    dfs(i, j);
                }
            }
        }
        ans.push_back(cnt);
    }
    for (int i : ans)
    {
        cout << i << endl;
    }
}


Measured memory_bytes: 3188
/*      ______     _    _______
       |  ___ \   | |  |  ____/   /\
       | |   \ \  | |  | |       /  \
       | |___/ /  | |  | |___   / /\ \
       |     _/   | |  |  __/  / /__\ \
       | |\ \     | |  | |    / ______ \
       | | \ \    | |  | |   / /      \ \
       |_|  \_\   |_|  |_|  /_/        \_\
*/

#include<bits/stdc++.h>

//#define FILEIO

using namespace std;

const int SZ = 52;
const double EPS = 1e-9;
const int MOD = 100000008;
const int INF = ( 1 << 30 ) - 1;
const double PI = 2 * acos( 0.0 );

template <class T> T MIN(T a, T b) { return (a < b) ? a : b; }
template <class T> T MAX(T a, T b) { return (a > b) ? a : b; }
template <class T> void SWAP(T &a, T &b) { T c; c = a; a = b; b = c; }
template <class T> T GCD(T a, T b) { T c; while(b > 0) { c = a % b; a = b; b = c; } return a; }

bool CMP(int a, int b)
{
    return (a > b);
}

int main()
{
    #ifdef FILEIO
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    long long int a, b;
    cin >> a >> b;
    cout << a * b << endl;

    return 0;
}


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

int main()
{
	long n = 0, h = 0, k = 0;

	cin >> n >> h;

	vector<long> a(n, 0), b(n, 0);

	for (long i = 0; i < n; i++)
		cin >> a[i] >> b[i];

	sort(a.rbegin(), a.rend());
	sort(b.begin(), b.end());

	int j = 0;

	for (j = 0; j < n; j++) {
		if (b[j] > a[0])
			break;
	}

	for (int i = n - 1; i >= j; i--) {
		h -= b[i];
		k++;
		if (h <= 0)
			break;
	}

	if (h > 0) {
		if (h % a[0] == 0)
			k += h / a[0];
		else
			k += h / a[0] + 1;
	}

	cout << k << endl;
	
	return 0;
}

Measured memory_bytes: 1792
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(" ").map(String::toInt)
    val aAccum = mutableListOf(aList[0].toLong())
    for (i in 1 until n) {
        aAccum.add(aAccum[i - 1] + aList[i])
    }
    var min = Long.MAX_VALUE
    var left = 0
    var right = 2
    for (center in 1 until (n - 2)) {

        var lDiff = Long.MAX_VALUE
        for (l in left until center) {
            val diff = Math.abs(aAccum[center] - aAccum[l] - aAccum[l])
            if (lDiff > diff) {
                lDiff = diff
                left = l
            } else {
                break
            }
        }

        var rDiff = Long.MAX_VALUE
        for (r in right until (n - 1)) {
            val diff = Math.abs((aAccum[aAccum.size - 1] - aAccum[r]) - (aAccum[r] - aAccum[center]))
            if (rDiff > diff) {
                rDiff = diff
                right = r
            } else {
                break
            }
        }

        val s1 = aAccum[left]
        val s2 = aAccum[center] - aAccum[left]
        val s3 = (aAccum[right] - aAccum[center])
        val s4 = (aAccum[aAccum.size - 1] - aAccum[right])
        val tempMax = Math.max(Math.max(s1, s2), Math.max(s3, s4))
        val tempMin = Math.min(Math.min(s1, s2), Math.min(s3, s4))
        min = Math.min(min,tempMax-tempMin)
    }
    println(min)
}


Measured memory_bytes: 82736
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{
	int A, B, C;
	cin >> A >> B >> C;

	set<int> N;
	N.insert(A);
	N.insert(B);
	N.insert(C);

	if (N.size() == 2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
}

Measured memory_bytes: 3604
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
// #include "prettyprint.hpp"

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

  set<int> divSet;

  // cout << M << endl;
  for (int i = 1; i <= 100000; i++) {
    if (M % i == 0) {
      divSet.insert(i);
      divSet.insert(M / i);
    }
  }

  // cout << divSet << endl;
  vector<int> divs(divSet.begin(), divSet.end());
  sort(divs.begin(), divs.end());

  for (auto a = divs.begin(); a != divs.end(); a++) {
    if (*a >= N) {
      cout << (M / (*a)) << endl;
      break;
    }
  }

  return 0;
}

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

int main(){
  char s[19];
  cin >> s;
  for (int i=0; i < 19; i++) {
    if (i == 5 | i == 13) {
      cout << " ";
    } else {
      cout << s[i];
    }
  }
  cout << endl;
  return 0;
}


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

using namespace std;

int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    int t = a - b;
    string ans;
    if (t >= 0) ans = "delicious";
    else if (x >= abs(t)) ans = "safe";
    else ans = "dangerous";

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int a=Integer.parseInt(in.next()),b=Integer.parseInt(in.next());
        String o;
        
        if(a<b)o=" < ";
        else if(a>b)o=" > ";
        else o=" == ";
        System.out.println("a"+o+"b");
    }
}


Measured memory_bytes: 26176
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author HARSHAD
 */

#include <bits/stdc++.h>


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long

using namespace std;
const int N = 105;
const int V = 1e5 + 5;
int v[N], w[N];
int dp[N][V];


class EKnapsack2 {
public:
    int n, W;

    int rec(int i, int value) {
        if (value <= 0) return 0;
        if (i == n) return INT_MAX;
        if (dp[i][value] != -1) return dp[i][value];
        int res = rec(i + 1, value);
        res = min(res, w[i] + rec(i + 1, value - v[i]));
        return dp[i][value] = res;
    }

    int binarySearch(int low, int high) {
        int res = 0;
        while (low <= high) {
            int mid = (low + high) >> 1;
            if (rec(0, mid) <= W) res = mid, low = mid + 1;
            else high = mid - 1;
        }
        return res;
    }

    void solve(std::istream &in, std::ostream &out) {
        in >> n >> W;
        for (int i = 0; i < n; ++i) in >> w[i] >> v[i];
        memset(dp, -1, sizeof dp);
        out << binarySearch(0, V);
    }
};


int32_t main() {
    EKnapsack2 solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 82304
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define rep(i, beg, end) for (int i = (beg); i < (end); i++)
#define rrep(i, beg, end) for (int i = (beg); i >= (end); i--)
#define sp(i) setprecision(i) << fixed
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 30;
ull p_hash(ull x, ull y) { return (x + y) * (x + y + 1) / 2 + y; } //NxN->N
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
 
 
int fast_power(int a, int b, int p)
{
    int res = 1;
    while (b)
    {
        if (b & 1)
            res = (ll)res * a % p;
 
        b >>= 1;
        a = (ll)a * a % p;
    }
 
    return res;
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    int f1 = fast_power(10, n, mod);
    int f2 = fast_power(9, n, mod);
    int f3 = fast_power(8, n, mod);
    cout << ((f1 - f2 * 2 + f3) % mod + mod)% mod << endl;
 
    return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int n;
	while (cin >> n, n)
	{
		string s;
		cin >> s;
		while (n--)
		{
			s += 'z';
			ostringstream ss;
			for (int i = 0, c = 0; i < s.size()-1; ++i)
			{
				++c;
				if (s[i] != s[i+1])
				{
					ss << c << s[i];
					c = 0;
				}
			}
			s = ss.str();
		}
		cout << s << endl;
	}
}

Measured memory_bytes: 0
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
 var x = Number(lines[0].split(' ')[0]);
 var n = Number(lines[0].split(' ')[1]);
 var ans = '';
 var a = [];

 if(n === 0){
   ans = x;
 }else{
   var p = lines[1].split(' ');
   p = p.map(function(str) { return Number(str)});

   for(i=0; i<=100; i++){
     var minum = x - i
     if(p.indexOf(minum) === -1){
       ans = minum;
       break;
     }
     var plnum = x + i
     if(p.indexOf(plnum) === -1){
       ans = plnum;
       break;
     }
   }

}
   console.log(ans);
   
 

 
  
 
});

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

void fnInput(int& rnNumA, int& rnNumB)
{
  cin >> rnNumA >> rnNumB;
}

int64_t fnLCMGet(int nNumA, int nNumB)
{
  int nDividend = max(nNumA, nNumB);
  int nDivisor  = min(nNumA, nNumB);

  while (nDividend % nDivisor != 0)
  {
    int nRemain = nDividend % nDivisor;
    nDividend = nDivisor;
    nDivisor  = nRemain;
  }

  int nGCD = nDivisor;
  int nQuotA = nNumA / nGCD;
  int nQuotB = nNumB / nGCD;
  return ((int64_t)nGCD * nQuotA * nQuotB);
}

int main()
{
  int nNumA, nNumB;

  fnInput(nNumA, nNumB);
  cout << fnLCMGet(nNumA, nNumB) << endl;

  return 0;
}

Measured memory_bytes: 256
from itertools import *
H,W=map(int,input().split())
c=[list(map(int,input().split())) for i in range(10+H)]
for k,i,j in product(list(range(10)),repeat=3):
    c[i][j]=min(c[i][j],c[i][k]+c[k][j])
print(sum(c[c[i+10][j]][1] if c[i+10][j]!=-1 else 0 for j in range(W) for i in range(H)))

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

using namespace std;

int main()
{
//    freopen("TEST.INP", "r", stdin);
//    freopen("TEST.OUT", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t;
    cin >> t;
    long long ans = 0LL;
    for (int i = 1; i <= t; ++i)
        if (i % 3 != 0 && i % 5 != 0) ans += 1LL * i;
    cout << ans;
    return 0;
}


Measured memory_bytes: 3652
Num = int(input())
Num_Array = list(map(int,input().split()))
Alice,Bob = 0,0

for i in range ( Num ):
    Check_Max = -1

    for x in range(len(Num_Array)):
        if Num_Array[x] > Check_Max :
            Check_Max = Num_Array[x]
            check = x

    Num_Array.pop(check)

    if i % 2 == 0 :
        Alice += Check_Max
    else:
        Bob += Check_Max

print(Alice - Bob)

Measured memory_bytes: 3060
import numpy as np

n, k = map(int, input().split())
a_list = list(map(int, input().split()))

a_dict = {}
for from_a, to_a in enumerate(a_list):
    a_dict[from_a+1] = to_a

now = 1
a_route = [now]
a_set = set([now])
for _ in range(len(a_dict.keys())):
    now = a_dict[now]
    if now in a_set:
        start_c = now
        break
    a_set.add(now)
    a_route.append(now)
a_route = np.array(a_route)

ind = np.where(a_route==start_c)[0][0]
first_path = a_route[:ind]
a_route = a_route[ind:]

if k<=len(first_path)-1:
    print(first_path[k])
else:
    k -= len(first_path)
    print(a_route[k%len(a_route)])

Measured memory_bytes: 67240
N = int(input())
A = [list(map(int, input().split()))+[0] for i in range(N)] + [[2*N+1, -1, 0]]
B = [list(map(int, input().split())) for i in range(N)]
B.sort()


cnt = 0
for a,b in B:
    idx = -1
    for j in range(N):
        c,d,used = A[j]
        if a > c and b > d and used == 0 and A[idx][1] < d:
            idx = j
    if idx != -1:
        A[idx][2] = 1
        cnt += 1
        # print(a,b,A[idx])
print(cnt)


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
#define mod(int)(1000000007)
using namespace std;
signed main() {
	int n; cin >> n;
	for (int h = 1; h <= n; h++) {
		if (h % 3 == 0) { cout << ' ' << h; }
		else {
			int x = h;
			while (x > 0) {
				if (x % 10 == 3) { cout << ' ' << h; break; }
				x /= 10;
				if (x % 10 == 3) { cout << ' ' << h; break; }
			}
		}
	}
	cout << endl;
	return 0;
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int N; cin >> N;
  int A, B; cin >> A >> B;
  if(A>B){
    cout<<0<<endl;
  }
  else if(A==B){
    cout<<1<<endl;
  }
  else{
    if(N==1){
      cout<<0<<endl;
    }
    else{
      int ans=(N-2)*(B-A)+1;
      dump(ans);
      cout<<ans<<endl;
    }
  }

    return 0;
}


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

vector<vector<int>> g;
vector<int> s, e;

void dfs(int v, int& t) {
    if (s[v]) return;
    s[v] = t++;
    for (auto& x : g[v]) {
        dfs(x, t);
    }
    e[v] = t++;
}

int main() {
    int n; cin >> n;
    g.resize(n); s.resize(n); e.resize(n);
    for (int i = 0; i < n; i++) {
        int u, k; cin >> u >> k; u--;
        while (k--) {
            int v; cin >> v; v--;
            g[u].push_back(v);
        }
        sort(g[u].begin(), g[u].end());
    }
    int t = 1;
	for (int i = 0; i < n; i++) dfs(i, t);
    for (int i = 0; i < n; i++) {
        cout << i + 1 << " " << s[i] << " " << e[i] << endl;
    }
}


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

#define G 2019

int main(void){
	int n,*x,m,*a;
	
	scanf("%d",&n);
	x = (int*)malloc(n*sizeof(int));
	for(int i=0;i<n;i++){
		scanf("%d",&x[i]);
	}
	scanf("%d",&m);
	a = (int*)malloc(m*sizeof(int));
	for(int i=0;i<m;i++){
		scanf("%d",&a[i]);
		a[i]--;
	}

	for(int i=0;i<m;i++){
		if(x[a[i]]==G){

		}else if((x[a[i]]+1) != x[a[i]+1]){
			x[a[i]]++;
		}
	}

	for(int i=0;i<n;i++){
		printf("%d\n",x[i]);
	}
	
}


Measured memory_bytes: 2108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClassLibrary1
{
    public class ListNode
    {
        public int val;
        public ListNode next;
        public ListNode(int x) { val = x; }
    }


    public class Class1
    {
        static Dictionary<Tuple<long, long>, long> dic = new Dictionary<Tuple<long, long>, long>();

        static long mod = 1000000007;
        static long[] factorial = new long[100001];
        static long[] invFactorial = new long[100001];

        private static void calcFanctorial(long N)
        {
            factorial[0] = 1;
            for(int i=1; i< N+1; i++)
            {
                factorial[i] = factorial[i - 1] * i;
                factorial[i] %= mod;
            }
            invFactorial[N] = inv(factorial[N]);
            for (int i = (int)N; i > 0; i--)
            {
                invFactorial[i - 1] = invFactorial[i] * i % mod;
            }

        }

        static void Main(string[] args)
        {


            var AA = ReadStringArr();
            var A = AA[0];
            var B = AA[1];

            long res = 0;
            if( int.Parse(A) < int.Parse(B))
            {

                Console.WriteLine( new string(A.ToCharArray()[0], int.Parse(B)));
            } else {
                Console.WriteLine(new string(B.ToCharArray()[0], int.Parse(A)));

            }


        }

        private static long nCm(long n, long m)
        {
            if (n < m) return 0;

             return (factorial[n] * invFactorial[m] % mod) * invFactorial[n-m] % mod;
        }

        public static long pow(long a, long b, long mod)
        {
            a %= mod;

            if (b <= 0) return 1;
            var t = pow(a, b / 2, mod);
            if ((b & 1) == 0) return t * t % mod;
            return t * t % mod * a % mod;
        }

        public static long pow(long a, long b) => pow(a, b, mod);
        public static long inv(long a) => pow(a, mod - 2);


        private static string ReadString()
        {
            return Console.ReadLine();
        }
        private static string[] ReadStringArr()
        {
            return Console.ReadLine().Split(' ');
        }
        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadLongArr()
        {
            string[] s = ReadStringArr();
            long[] l = new long[s.Length];
            for(int i=0; i<l.Length; i++)
            {
                l[i] = long.Parse(s[i]);
            }

            return l;
        }
    }

}


Measured memory_bytes: 12756
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
const long long INF = 1ll << 60;



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

  set<int> st;
  int ans = 1;
  while(true){
    if(st.find(s) != st.end()){
      cout << ans << endl;
      return 0;
    }
    st.insert(s);
    if(s%2 == 0) s/=2;
    else s = s*3+1;
    ans++;
  }


}



Measured memory_bytes: 3604