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

namespace unweighted_graph_n {
template<class EDGE, class VERTEX>
struct Graph {
	using u32 = uint_fast32_t;
	using i32 = int_fast32_t;
	using u64 = uint_fast64_t;
	struct graph_tag {};
	const u32 n;
	vector<vector<EDGE>> e;
	vector<VERTEX> v;
	vector<u64> idx;
	Graph(u32 N) : n(N), e(n), v(n) {}
	template<class...  Args> void add_edge(u32 from, u32 to, Args... args) {
		idx.push_back((static_cast<u64>(from) << 32) | e[from].size());
		e[from].emplace_back(to, args...);
	}
	u32 size() const {return n;}
	using EDGE_TYPE = EDGE;
	using VERTEX_TYPE = VERTEX;
};
using u32 = uint_fast32_t;
struct Vertex {};
struct Edge {
	u32 to;
	Edge(u32 x) : to(x) {}
};
using UnWeightedGraph = Graph<Edge, Vertex>;
UnWeightedGraph make_unweighted_graph(u32 N) {
	return UnWeightedGraph(N);
}
}
using unweighted_graph_n::UnWeightedGraph;
using unweighted_graph_n::make_unweighted_graph;

using u32 = uint32_t;
template<class MM, class U, class CM, class MA>
struct Rerooting {
	MM merge_monoid;
	U unity;
	CM child_to_monoid;
	MA merge_all;
	vector<U> dp, dp_reroot;
	Rerooting(MM mm, U u, CM cm, MA ma) : merge_monoid(mm), unity(u), child_to_monoid(cm) ,merge_all(ma) {}
	template<class graph>
	void build(const graph& g, u32 root = 0) {
		dp.resize(g.size(), unity);
		dp_reroot.resize(g.size(), unity);

		auto dfs = [&](auto&& f, u32 v, u32 parent = -1) -> U {
			for (auto& e : g.e[v]) {
				if (e.to == parent) continue;
				dp[v] = merge_monoid(dp[v], child_to_monoid(f(f, e.to, v)));
			}
			return dp[v] = merge_all(dp[v], v);
		};
		dfs(dfs, root);
		auto dfs_reroot = [&](auto&& f, u32 v, U parent_data, u32 parent = -1) -> void {
			vector<U> left_accum(g.e[v].size()+1, unity);
			vector<U> right_accum(g.e[v].size()+1, unity);
			{
				u32 i = 0;
				for (auto& e : g.e[v]) {
					i++;
					left_accum[i] = right_accum[i-1] = child_to_monoid(e.to == parent ? parent_data : dp[e.to]);
				}
			}
			for (u32 i = 1; i < left_accum.size(); i++) left_accum[i] = merge_monoid(left_accum[i-1], left_accum[i]);
			for (u32 i = right_accum.size() - 1; 0 < i; i--) right_accum[i-1] = merge_monoid(right_accum[i-1], right_accum[i]);
			dp_reroot[v] = merge_all(left_accum.back(), v);
			{
				u32 i = 0;
				for (auto& e : g.e[v]) {
					i++;
					if (e.to == parent) continue;
					f(f, e.to, merge_all(merge_monoid(left_accum[i-1], right_accum[i]), v), v);
				}
			}
		};
		dfs_reroot(dfs_reroot, root, unity);
	}
};

template<class MM, class U, class CM, class MA>
Rerooting<MM, U, CM, MA> make_rerooting(MM mc, U cu, CM cm, MA ma) {
	return Rerooting<MM, U, CM, MA>(mc, cu, cm, ma);
}

using ll = long long;

int main() {
	int N, M; cin >> N >> M;
	auto rerooting = make_rerooting(
		[&](ll a, ll b) {return a * b % M;},
		1ll,
		[&](ll a) -> ll {return (a+1) % M;},
		[&](ll a, u32 b) -> ll {return a;}
	);
	auto g = make_unweighted_graph(N);
	for (int i = 0; i < N-1; i++) {
		int a, b; cin >> a >> b; a--; b--;
		g.add_edge(a, b);
		g.add_edge(b, a);
	}
	rerooting.build(g);
	for (int i = 0; i < N; i++) {
		cout << rerooting.dp_reroot[i] << endl;
	}
}

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

#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(long long i=0;i<(n);i++)

int main() {
  int A, B, T;
  cin >> A >> B >> T;
  int ans = T / A * B;
  cout << ans << endl;
  return 0;
}


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

using ll = long long;

int main() {
   int n;
   cin >> n;
   map<ll, ll> mp;//mapは平衡二分木。特徴は要素の要素数に対する対数オーダーでの高速な検索能力と内部で要素がソート状態で保持されること。map<key, value>と書く。mapはkeyからvalueを検索するのが得意
   for (int i = 0; i < n; i++) {
      int a;
      cin >> a;
      mp[a]++;
      mp[a-1]++;
      mp[a+1]++;
   }

   ll ans = 0;
   for (auto x : mp) {
      ans = max(ans, x.second);
   }

   cout << ans << endl;
}
//詳しくはteratail

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

using namespace std;

using ll = long long;

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

    vector<ll> nums(n);

    for (int i = 0; i < n; i++) {
        ll a;
        cin >> a;
        nums[i] = a;
    }
    sort(nums.begin(), nums.end());

    vector<ll> v(1000000);
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        ll a = nums[i];
        v[a]++;
        sum += a;
    }

    ll q;
    cin >> q;

    for (int i = 0; i < q; i++) {
        ll b, c;
        cin >> b >> c;

        ll diff = c - b;
        sum += (v[b] * diff);
        v[c] += v[b];
        v[b] = 0;
        cout << sum << endl;
    }

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  vector<int> h(n), x(n);
  for(int i = 0; i < n; i++) cin >> h.at(i);
  
  int ans = 0;
  for(int i = n - 2; i >= 0; i--){
    if(h.at(i) >= h.at(i + 1)) x.at(i) = x.at(i + 1) + 1;
    else x.at(i) = 0;
    ans = max(ans, x.at(i));
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<cstdio>

#include<iostream>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<sstream>
#include<queue>
#include<map>
#include<set>
#include<utility>
#include<queue>

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  int c;
  string s;

  cin >> c;
  cin.ignore();
  for (int i = 0; i < c; ++i){
    bool success = true;
    int l,r,in;
    l = r = 0;
    for(int i = 0;i < 10;i++){
      cin >> in;
      if(in > r)r = in;
      else if(in > l)l = in;
      else success = false;
    }
    cout << (success ? "YES" : "NO") << endl;
  }
  return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}

using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  
  int n;
  cin>>n;
  int dp[n+1];//i円を支払うのに必要な硬貨の最小枚数
  dp[0]=0;
  int power;
  REPP(i,n){
    dp[i] = dp[i-1] + 1;
    power = 6;
    while(power<=i){
      dp[i] = min(dp[i], dp[i-power]+1);
      power *= 6;
    }
    power = 9;
    while(power<=i){
      dp[i] = min(dp[i], dp[i-power]+1);
      power *= 9;
    }
  }
  
  int ans;
  ans = dp[n];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 640
import sys
input=sys.stdin.readline
N,M=map(int,input().split())
L=[[]for i in range(N+1)]
S=[0 for i in range(N+1)]
for i in range(M):
    x,y=map(int,input().split())
    L[x].append(y)
    S[y]+=1
#print(L)
#print(S)
start=[]
for i in range(1,N+1):
    if S[i]==0:
        start.append(i)
D=[0 for i in range(N+1)]
Q=[]
for s in start:
    for a in L[s]:
        Q.append([a,1])
for i in range(100000):
    if i==len(Q):
        break
    S[Q[i][0]]-=1
    if D[Q[i][0]]<Q[i][1]:
        D[Q[i][0]]=Q[i][1]
    if S[Q[i][0]]==0:
        for j in L[Q[i][0]]:
            Q.append([j,Q[i][1]+1])
    #print(Q)
print(max(D))
#print(S)

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

int main(){
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  for(int i=0;i<K;i++){
    if(B<=A){
      B*=2;
    }else if(C<=B){
      C*=2;
    }else{
      cout << "Yes" << endl;
      return 0;
    }
  }
  if((B>A)&&(C>B)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
from collections import defaultdict


D = defaultdict(int)
d = defaultdict(lambda: 1)
D[1] = 1

N, M = list(map(int, input().split()))

for i in range(M):
	x, y = list(map(int, input().split()))
	if D[x] == 1:
		if d[x] == 1:
			D[x] = 0
		D[y] = 1

	d[x] -= 1
	d[y] += 1

s = 0
for i in range(1, N + 1):
	if D[i] == 1:
		s += 1

print(s)

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

#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
#define endl '\n'
// #define int long long

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

string s;
vector<string> days = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
int32_t main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> s;
	for(int i=0; i<7; i++){
		if (days[i] == s) {
			cout << 7-i << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int sam(int n){
  int sum=0;
  while(n!=0){
    sum+=n%10;
    n = n/10;
  }
  return sum;
}

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


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <boost/range.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>
#include <boost/lexical_cast.hpp>
using namespace std;
constexpr char nl = '\n';
using ll = long long;
using boost::irange;
namespace rng { using namespace boost; using namespace boost::range; }
namespace adp { using namespace boost::adaptors; }

struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> auto operator>>(istream& in, C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, istream&>::type {
    for (auto& v : c) { in >> v; } return in; }
template<class C> auto operator<<(ostream& out, const C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, ostream&>::type {
    int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
constexpr auto color_s_ = "\033[2m\033[33m", color_e_ = "\033[0m";
template<class T> void trace_(const T& v) { cerr << v; }
template<class T> void trace_(const vector<vector<T>>& m) { cerr << "\n"; for (const auto& v : m) { trace_(v); cerr << "\n"; } }
template<class T> void trace_(const char* s, const T& v) { cerr << color_s_ << s << "="; trace_(v); cerr << color_e_ << "\n"; cerr.flush(); }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { cerr << color_s_; for (; *s != ','; ++s) { cerr << *s; } cerr << "="; trace_(v); cerr << ","; trace_(++s, vs...); }
#define TRACE(...) trace_(#__VA_ARGS__, __VA_ARGS__)
#else
#define TRACE(...)
#endif

int main() {
    string a, b;
    cin >> a >> b;
    int n = boost::lexical_cast<int>(a + b);
    int d = sqrt(n);
    if (d*d == n) {
        cout << "Yes" << nl;
    } else {
        cout << "No" << nl;
    }
}


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

int main()
{
    long long int N, rt, mi, i;
    cin >> N;
    mi=N;
    rt=sqrt(N);
    for(i=1;i<=rt;i++) {
        if(!(N%i)) {
           mi=min(mi,((i-1)+((N/i)-1)));
        }
    }
    cout << mi << endl;
    return 0;
}

Measured memory_bytes: 3592
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        if(a+b==c||a+c==b||c+b==a)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <string>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <bitset>
#include <queue>
#include <utility>
#include <functional>
#include <sstream>
using namespace std;
#define ll long long
 
int main(void){
    ll n, c, k;
    cin >> n >> c >> k;
    ll t[n];
    for(ll i = 0; i < n; i++)
        cin >> t[i];
    sort(t, t+n);
    ll ans = 0; ll count = 0;
    for(ll i = 0; i < n; i++){
        for(ll j = i; j < n; j++){
            if(t[j]-t[i] > k){
                ans++;
                i = j-1;
                break;
            }
            if(j-i+1 == c || j==n-1){
                ans++;
                i = j;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,k = map(int,readline().split())
h = list(map(int,readline().split()))

dp = [float('inf')]*n
dp[0] = 0

for i in range(1,n):
  for j in range(min(k,i)):
    dp[i] = min(dp[i], dp[i-1-j]+abs(h[i]-h[i-1-j]))

print(dp[n-1])

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

int main() {
  int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
  int x = x2 - x1;
  int y = y2 - y1;
  cout << x2 - y << ' ' << y2 + x << ' ' << x1 - y << ' ' << y1 + x << endl; 
  return 0; 
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()){
            int a = in.nextInt();
            int b = in.nextInt();
            if (a > 9 || b > 9){
                System.out.println(-1);
            } else {
                System.out.println(a*b);
            }
        }
    }
}


Measured memory_bytes: 21844
#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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size();
    vector<int>alf1(26),alf2(26);
    rep(i, 0, n){
        alf1[s[i]-'a']++;
        alf2[t[i]-'a']++;
    }
    sort(alf1.begin(), alf1.end());
    sort(alf2.begin(), alf2.end());
    if(alf1==alf2)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 776
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include<math.h>
using namespace std;

int main() {
	int n, ans = 0; cin >> n;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		if (x == 2)ans++;
		else if (x < 2 || x % 2 == 0)continue;
		else {
			int j = 3;
			while (j <= sqrt(x)) {
				if (x % j == 0) {
					ans--;
					break;
				}
				j += 2;
			}
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3112
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-09-26 23:35:00 +0900
# LastModified: 2020-09-26 23:50:15 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    L = list(map(int, input().split()))
    ans = 0
    max_idx = L.index(max(L))
    min_idx = L.index(min(L))
    for i in range(len(L)):
        if i == max_idx or i == min_idx:
            pass
        else:
            medium_idx = i
    ans += (L[max_idx] - L[medium_idx])
    L[medium_idx] = L[max_idx]
    L[min_idx] += ans
    if (L[max_idx]-L[min_idx]) % 2 == 0:
        print(ans + (L[max_idx]-L[min_idx])//2)
    else:
        print(ans + (L[max_idx]-L[min_idx]+1)//2 + 1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9128
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<math.h>

using namespace std;

typedef long long ll;
typedef pair<long long, long long> pll;

int main(){
	int N;
	cin >> N;
	int c = 0;
	for (int i = 0; i < N; i++){
		int a;
		cin >> a;
		if (a % 2 == 1){
			c++;
		}
	}
	if (c % 2 == 1){
		cout << "NO" << endl;
	}
	else{
		cout << "YES" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
int pp[105];
bool vis[105];
pi p[105],p2[105];
int n;
bool dfs(int u)
{
    if(vis[u]) return false;
    vis[u]=1;
    for(int i=1;i<=n;i++)
    {
        if(p[u].first<p2[i].first&&p[u].second<p2[i].second)
        {
            if(!pp[i]||dfs(pp[i]))
            {
                pp[i]=u;
                return true;
            }
        }
    }
    return false;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++) cin>>p[i].first>>p[i].second;
    for(int i=1;i<=n;i++) cin>>p2[i].first>>p2[i].second;
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        memset(vis,0,sizeof(vis));
        if(dfs(i)) ans++;
    }
    print(ans);
}

Measured memory_bytes: 256
using System;

class Program {
    const int mod = 1000000007;

    static void Main() {
#if USE_IDE
        var exStdIn = new System.IO.StreamReader("./../../TestStdin.txt");
        Console.SetIn(exStdIn);
#endif
        var n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine();
        var b = Console.ReadLine();
        var c = Console.ReadLine();

        var ans = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] == b[i] && a[i] == c[i]) {
                continue;
            }

            if (a[i] != b[i] && a[i] != c[i] & b[i] != c[i]) {
                ans += 2;
                continue;
            }

            ans += 1;
        }

        Console.WriteLine(ans);
    }
}

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

static const int N = 1e+5;
vector<int> fr[N], bl[N];
bool visited[N];
int n, group[N], color = 0, conj[N];

void dfs(int u){
	visited[u] = true;
	group[u] = color;
	conj[color]++;
	rep(i, fr[u].size()){
		if(visited[fr[u][i]]) continue;
		dfs(fr[u][i]);
	}
	return;
}

void dfs_init(int s){
	rep(i, n){
		visited[i] = false;
		conj[i] = 0;
	}
	rep(i, n){
		if(visited[i]) continue;
		dfs(i);
		color++;
	}
	return;
}

int main(){
	int m, k, x, y;
	cin >> n >> m >> k;
	rep(i, m){
		cin >> x >> y;
		fr[x-1].push_back(y-1);
		fr[y-1].push_back(x-1);
	} rep(i, k){
		cin >> x >> y;
		bl[x-1].push_back(y-1);
		bl[y-1].push_back(x-1);
	}
	
	dfs_init(0);
	
	int cnt[n];
	rep(i, n){
		cnt[i] = 0;
		for(auto j = bl[i].begin(); j != bl[i].end(); j++){
			if(group[i] != group[*j]) cnt[i]++;
		}
	}
	rep(i, n){
		cout << conj[group[i]] - fr[i].size() 
			- bl[i].size() + cnt[i] - 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 14464
#include <stdio.h>
int n, s, t, f, k, u;
long long a[1000000];
long long e;
int x[1000000];
int p[200];
long long gcd(long long gcd_a, long long gcd_b) {
	if (gcd_a < gcd_b) {
		long long gcd_c;
		gcd_c = gcd_a;
		gcd_a = gcd_b;
		gcd_b = gcd_c;
	}
	if (!gcd_b)return gcd_a;
	return gcd(gcd_b, gcd_a % gcd_b);
}
int main() {
	scanf("%d", &n);
	for (int i = 2; i < 1000; i++) {
		f = 0;
		for (int j = 2; j * j <= i; j++) {
			if (i % j == 0)f++;
		}
		if (f == 0) {
			p[k] = i;
			k++;
		}
	}
	for (int i = 0; i < n; i++) {
		scanf("%lld", a + i);
		s = 0;
		u = 0;
		t = a[i];
		while (s < k) {
			if (t % p[s] == 0) {
				if (!u)x[p[s]]++;
				t /= p[s];
				u = 1;
			}
			else {
				u = 0;
				s++;
			}
		}
		x[t]++;
	}
	f = 0;
	for (int i = 2; i < 1000000; i++) {
		if (x[i] > 1)f++;
	}
	if (f == 0) {
		printf("pairwise coprime\n");
		return 0;
	}
	e = gcd(a[0], a[1]);
	for (int i = 2; i < n; i++) {
		e = gcd(e, a[i]);
	}
	if (e == 1) {
		printf("setwise coprime\n");
	}
	else {
		printf("not coprime\n");
	}
}

Measured memory_bytes: 13200
#include<stdio.h>

int main(){
  int N, A;
  scanf("%d %d", &N, &A);
  
  int x[N];
  for(int i = 0; i < N; i++) scanf("%d", x + i);
  
  long long dp[N + 1][N * A + 1][N + 1];
  for(int i = 0; i <= N; i++){
    for(int j = 0; j <= N * A; j++){
      for(int k = 0; k <= N; k++){
        dp[i][j][k] = 0;
      }
    }
  }
  
  dp[0][0][0] = 1;
  for(int i = 0; i < N; i++){
    for(int j = 0; j <= N * A; j++){
      for(int k = 0; k <= N; k++){
        if(k > 0 && j - x[i] >= 0){
          dp[i + 1][j][k] += dp[i][j - x[i]][k - 1];
        }
        dp[i + 1][j][k] += dp[i][j][k];
      }
    }
  }
  
  long long cnt = 0;
  for(int j = 0; j <= N * A; j++){
    for(int k = 1; k <= N; k++){
      if(k * A == j) cnt += dp[N][j][k];
    }
  }
  
  printf("%lld", cnt);
  
  return 0;
}

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

cost=[]
cost.append(abs(a[0]))
for i in range(n-1):
    cost.append(abs(a[i+1]-a[i]))
a.append(0)
cost.append(abs(a[n-1]))


#print(a)
#print(cost)


costsum=sum(cost)

for i in range(n):
    if i==0:
        if 0<=a[i]<=a[i+1]:
            print(costsum) 
        else:
            print(costsum-cost[i]-cost[i+1]+abs(a[i+1]))
    else:
        if a[i-1]<=a[i]<=a[i+1] or a[i-1]>=a[i]>=a[i+1]: 
            print(costsum)
        else:
            print(costsum-cost[i]-cost[i+1]+abs(a[i+1]-a[i-1]))
        


Measured memory_bytes: 13792
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int d[555][555];
int main()
{
	int num;
	scanf("%d", &num);
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < num; j++)
		{
			char z;
			scanf(" %c", &z);
			d[j][z]++;
		}
	}
	int r = 0;
	for (int i = 0; i < num; i++)
	{
		int m = 0;
		for (int j = 0; j < 500; j++)m = max(m, d[i][j]);
		r += 3 - m;
	}
	printf("%d\n", r);
}

Measured memory_bytes: 384
m,n=map(int,input().split())

if n>m:
	w=n
	n=m
	m=w

if n==1:
	if m==1:
		print(1)
	else:print(m-2)
elif n==2:
	print(0)
else :
	print(n*m - (n-2)*2 - (m-2)*2 -4 )



Measured memory_bytes: 3060
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
long long ans,a,n;
int main()
{
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>a;
		ans+=a;
	}
	cout<<ans-n<<endl;
//	system("pause");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define um unordered_map
#define F first
#define S second
#define MOD 1000000007
#define TC int t; cin >> t; while(t--)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define count_bits(val) __builtin_popcount(val)

signed main(){
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt" , "r" , stdin);
	//freopen("output.txt" , "w" , stdout);
	//#endif
	int n,k;
	cin >> n >> k;
	cout << min(n % k, (k - (n % k))) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
struct runner{
    int num;
    double time;
    bool operator<(const runner &a)const{
        return time<a.time;
    }
};
int main(){
    runner lis[24],calis[18];
    int calissz=0;
    for(int i=0;i<24;i++)cin>>lis[i].num>>lis[i].time;
    for(int i=0;i<3;i++)sort(lis+8*i,lis+8*i+8);
    for(int i=0;i<3;i++){
        for(int j=0;j<8;j++){
            if(j<2)cout<<lis[i*8+j].num<<' '<<lis[i*8+j].time<<endl;
            else{
                calis[calissz]=lis[i*8+j];
                calissz++;
            }
        }
    }
    sort(calis,calis+18);
    for(int i=0;i<2;i++)cout<<calis[i].num<<' '<<calis[i].time<<endl;
    return 0;
}

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

int main(){
  int A, B;
  cin >> A >> B;
  int count = 0;
  for(int i=A;i<=B;i++){
    int a = i%10;
    int b = (i/10)%10;
    int c = (i/100)%10;
    int d = (i/1000)%10;
    int e = (i/10000)%10;
    if(a == e && b == d){
      count += 1;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
int main() {
    string S; cin >> S;
    int ans = INF;
    int tmp = 0;
    for(int i = 0; i < S.length()-1;i++){
        if(S[i] != S[i]+1) tmp++;
    }
    ans = min(ans,tmp);
    tmp = 0;
    for(int i = S.length()-1; i>0;i--){
        if(S[i] != S[i-1]) tmp++;
    }
    ans = min(ans,tmp);
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include<cstdio>
#include<iostream>

using namespace std;

int main(void){

	int inp,arr[100],cnt;
	int wei[]={1,2,4,8,16,32,64,128,256,512};

	while(cin>>inp){
		cnt=0;
		for(int i=9;inp!=0;i--){
			if(inp-wei[i]>=0){
				inp-=wei[i];
				arr[cnt]=wei[i];
				cnt++;
			}
		}
		for(int j=cnt-1;j>=0;j--){
			cout<<arr[j];
			if(j==0) cout<<endl;
			else cout<<" ";
		}
	}

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&a==c) cout<<"No";
	else if(a==b||a==c||b==c) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 3620
/*         Waha tufaan bhi haar jate hain...
        ...Jaha Kastiyan zid pe hoti hain
*/
#include <bits/stdc++.h>
using namespace std;

#define fast ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define fl(i,a,n) for(int i=a; i<n; i++)
#define rfl(i,a,n) for(int i=a; i>=n; i--)
#define ll long long 
#define pb push_back
#define all(v) v.begin(),v.end()
#define in(arr,n) fl(i,0,n)  cin>>arr[i];
#define out(arr,n) fl(i,0,n) cout<<arr[i]<<" ";	    cout<<endl;
#define test()  int tt;  cin>>tt;  while(tt--) 

int main()  {
    fast;
    int k,n;    cin>>k>>n;
    int arr[n];
    int s=0,maxm=0;
    for(int i=0;i<n;i++)    {
        cin>>arr[i];
        if(i!=0)    {
            s+=arr[i]-arr[i-1];
            maxm=max(maxm,(arr[i]-arr[i-1]));
        }
    }
    s+=k-arr[n-1]+arr[0];
    maxm=max(maxm,k-arr[n-1]+arr[0]);
    cout<<s-maxm;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define  m_k make_pair
#define   P  pair<int,int>
#define  V vector
typedef long long LL;
typedef unsigned long long ULL;

void slove_C()
{






}
int main()
{
    //freopen("D:\\CODE\\code_contest\\in.txt","w",stdout);
    //freopen("D:\\CODE\\code_contest\\in.txt","r",stdin);  
    int n,m;
    while(cin>>n>>m)
    {
        vector<int> a(n+1);
        double sum=0;
        for(int i=1;i<=n;i++)
            cin>>a[i],sum+=a[i];
        sum/=(4*m);
        int cnt=0;
        for(int i=1;i<=n;i++)
            if(a[i]>=sum) cnt++;
        if(cnt>=m) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }

    return 0;
}

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

namespace Atc_0028
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();

            int tar = str.Length / 2;

            int index = 0;

            for (int i = 0; i < tar; i++)
            {
                if (str.Substring(i, 1) != str.Substring(str.Length - 1 - i, 1))
                {
                    index++;
                }
            }

            Console.WriteLine(index);

        }
    }
}


Measured memory_bytes: 25904
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;


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

    string s,t;
    cin >> s >> t;
    map<char,vector<ll> >  charHashS,charHashT;
    map<char,char> cc,tt;

    for(ll i = 0; i < s.length();i++){
        if(!cc.count(s[i])){
            cc[s[i]] = t[i];
        }else{
            if(cc[s[i]] != t[i]){
                cout <<  "No" << endl;
                return 0;;
            }
        }
        if(!tt.count(t[i])){
            tt[t[i]] = s[i];
        }else{
            if(tt[t[i]] != s[i]){
                cout <<  "No" << endl;
                return 0;;
            }
        }
        // charHashS[s[i]].push_back(i);
        // charHashT[t[i]].push_back(i);
        
    }

    // for(ll i = 0; i < charHashS.size();i++){
    //     char tmp = t[charHashS[s[i]][0]];
    //     for(ll l = 1; l < charHashS[s[i]].size();l++){
    //         if(tmp != t[charHashS[s[i]][l]]){
    //             cout << "No" << endl;
    //             return 0;
    //         }
    //     }
    // }

    // for(ll i = 0; i < charHashT.size();i++){
    //     char tmp  = s[charHashT[t[i]][0]];
    //     for(ll l = 1; l < charHashT[t[i]].size();l++){
    //         if(tmp != s[charHashT[t[i]][l]]){
    //             cout << "No" << endl;
    //             return 0;
    //         }
    //     }
    // }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 916
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
const int N = 1000006;

bool np[N];
bool vstd[N];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	vector<long long> prims;
	prims.push_back(2);
	np[0] = np[1] = true;
	for(int i=4;i<N;i+=2) np[i] = true;
	for(int i=3;i<N;i+=2){
		if(!np[i]){
			prims.push_back(i);
			for(long long j= (ll)i*i;j<N;j+=i){
				np[j] = true;
			}
		}
	}
	
	int n;
	cin>>n;
	ll gcd = 0;
	bool notcoprime = false;
	
	for(int j=0;j<n;j++){
		ll x;
		cin>>x;
		gcd = __gcd(gcd,x);
		if(notcoprime)continue;
		for(int i=0;i<(int)prims.size();i++){
			if( (ll)prims[i] * prims[i] > x ) break;
			if(x%prims[i] == 0){
				if(vstd[prims[i]]) notcoprime = true;
				else vstd[prims[i]] = true;
			}
			while(x%prims[i] == 0){
				x /= prims[i];
			}
		}
		if(x > 1){
			if(vstd[x]){
				notcoprime = true;
			}
			else vstd[x] = true;
		}
	}
	
	if(gcd == 1 && notcoprime){
		cout<<"setwise coprime";
		return 0;
	}
	if(!notcoprime){
		cout<<"pairwise coprime";
		return 0;
	}
	cout<<"not coprime";
	
	return 0;
}


Measured memory_bytes: 5960
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long N,M,ans=0;
    cin>>N>>M;
    vector<long long> A(N);
    vector<long long> B(N);
    map<long long,long long> mp;
    long long visit=-1;
    for(int i=0;i<N;i++){
        long long a;
        cin>>a;
        A.at(i)=a;
    }
    sort(A.begin(),A.end());
    for(int i=0;i<M;i++){
        long long B,C;
        cin>>B>>C;
        mp[C]+=B;
    }
    int check=0,rock=0;
    for(auto i=mp.end();i!=mp.begin();--i){
        if(check==0){
            check++;
            continue;  
        }
        long long x=i->first;
        long long y=i->second;
        for(int j=visit+1;j<visit+1+y;j++){
            B.at(j)=x;
            if(j==N-1){rock=54;break;}
        }
        if(rock==54){
            for(int i=0;i<N;i++){
                ans+=max(B.at(i),A.at(i));
            }
            cout<<ans<<endl;
            return 0;
        }
        visit=max(visit,visit+y);
    }
    long long X=mp.begin()->first;
    long long Y=mp.begin()->second;
    for(int i=visit+1;i<visit+1+Y;i++){
        B.at(i)=X;
        if(i==N-1){rock=54;break;}
    }
    for(int i=0;i<N;i++){
      ans+=max(B.at(i),A.at(i));
    }
    cout<<ans<<endl;
    return 0;
}

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

struct node{
	unsigned int key;
	struct node *next;
	struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  /* your code */
	NodePointer  cur;
	cur=nil->next;
	while(cur!=nil && cur->key!=key){
		cur=cur->next;
	}
	return cur;
}

void init(){
	nil = malloc(sizeof(struct node));
	nil->next = nil;
	nil->prev = nil;
}

void printList(){
	NodePointer cur = nil->next;
	int isf = 1;
	while(1){
		if ( cur == nil ){
			break;
		}
		if ( isf == 0){
			printf(" ");
		}
		printf("%d", cur->key);
		cur = cur->next;
		isf = 0;
	}
  	printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
	if(t==nil){
		return;
	}
	t->prev->next=t->next;
	t->next->prev=t->prev;
	free(t);
}

void deleteFirst(){
	NodePointer t = nil->next;
	if ( t == nil ) {
		return;
	}
	deleteNode(t);
}

void deleteLast(){
  /* your code */
	NodePointer t = nil->prev;
	if ( t == nil ){ 
		return;
	}
	deleteNode(t);
}

void delete(int key){
  /* your code */
	deleteNode(listSearch(key));
}


void insert(int key){
	NodePointer x;
	x = malloc(sizeof(struct node));
	x->key = key;
  /* 

   your code 


  */
	
	x->next=nil->next;
	nil->next->prev=x;
	nil->next=x;
	x->prev=nil;
}

int main(){
	int key, n, i;
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	scanf("%d", &n);
	init();
	for ( i = 0; i < n; i++ ){
		scanf("%s%d", com, &key);
		if ( com[0] == 'i' ) {
			insert(key); np++; size++;
		}
		else if ( com[0] == 'd' ) {
			if (strlen(com) > 6){
				if ( com[6] == 'F' ){
					deleteFirst();
				}
				else if ( com[6] == 'L' ){
					deleteLast();
				}
			} 
			else {
				delete(key); nd++; 
			}
		size--;
		}
	}
	printList();
	return 0;
}


Measured memory_bytes: 32952
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> //tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <numeric>
using namespace std;

int main() {
    int S, W;
    cin >> S >> W;
    cout << (S <= W ? "unsafe" : "safe") << endl;
}

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

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

  int a;
  vector<int> c(N);
  for (int i = 0; i < N; i++) {
    cin >> a;
    c[a-1]++;
  }
  sort(c.begin(), c.end(), greater<int>());
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (K <= i) {
      ans += c[i];
    }
  }
  cout << ans << endl;
}

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

#define ll long long
#define pb push_back
#define eb emplace_back
//#define st first
#define sc second

using namespace std;

const ll mod = 1e9 + 7;
const int e = 50 + 69;
const int base = 311;

// dung inverse module de tinh nCk
// beginer 74
// mbeginer
// cach tao hoan vi tu n so : n*(n+1)/2;

//vector<pair<ll,ll>>adj[e];
//vector<ll>adj[e];

/*ll Pow(ll n, ll dem)
{
    if(dem == 0) return 1;
    if(dem == 1) return n ;
    ll t = Pow(n, dem/2);
    if(dem % 2 == 0) return (t*t);
    else return ((t * t) * n);
}*/

/*ll C(ll k, ll n)
{
    if(k == 0) return 1;
    if(n < k) return 0;
    return (gt[n]%mod * (igt[k]%mod * igt[n-k]%mod)%mod)%mod;
}*/

int n, m, k;

bool vs[e], chk;
ll a[55], b[55];

int main()
{
    cin >> n >> k;
    vector<ll>x;
    vector<ll>y;
    for(int i=0; i<n; i++)
    {
        cin >> a[i] >> b[i];
        x.pb(a[i]);
        y.pb(b[i]);

    }
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    //for(auto i : x) cout << i << " ";
    //cout << "\n";
    //for(auto i : y) cout << i << " ";
    //cout <<"\n";
    //cout << x[n-1] - x[0]  << " "<<y[n-1] <<"\n";
    ll ans = 5*1e18;
    ans = min(ans, (x[n-1] - x[0])*(y[n-1] - y[0]));
    for(int i=0; i<n-1; i++)
    {
        for(int i1=i+1; i1<n; i1++)
        {
            for(int j=0; j<n-1; j++)
            {
                for(int j1=j+1; j1<n; j1++)
                {
                    ll mn = x[i];
                    ll mx = x[i1];
                    ll mny = y[j];
                    ll mxy = y[j1];
                    ll dem = 0;
                    for(int z=0; z<n; z++)
                    {
                        if(mn <= a[z] && a[z] <= mx && mny <= b[z] && b[z] <= mxy) dem++;
                    }
                    if(dem >= k) ans = min(ans, 1LL *(mx - mn)*(mxy - mny));
                }
            }
        }
    }
    cout << ans;

}
/*

*/


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

int main(){
	int a, b;
	double c;
	double pi = 3.1415926535;
	cin >> a >> b >> c;
	c = c*pi/180;
	printf("%.8lf\n%.8lf\n%.8lf\n", a*b*sin(c)/2.0, a + b + sqrt(a*a + b*b - 2*a*b*cos(c)), b*sin(c));
	return 0;
}

Measured memory_bytes: 3444
#include<stdio.h>
#define N 2000000

int main(){
	int i,n;
  int A[N],B[N],C[N];

	scanf("%d",&n);

	for(i=0; i<n; i++){
	  scanf("%d",&A[i]);
	}

	for(i=0; i<N; i++){
		C[i] = 0;
	}

	for(i=0; i<n; i++){
		C[A[i]]++;
	}

	for(i=1; i<N; i++){
		C[i] = C[i] + C[i-1];
	}

	for(i=n-1; i>=0; i--){
		B[C[A[i]]-1] = A[i];
		C[A[i]]--;
	}

	for(i=0; i<n; i++){
		if(i==0) printf("%d",B[i]);
		else printf(" %d",B[i]);
	}

  printf("\n");

	return 0;
}



Measured memory_bytes: 25128
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
#define inf 100000000/*10^8*/



////////////////////////////////////////


int main(){
    ll h,w,n;cin>>h>>w>>n;
    vector<i_i> v;
    for(int i=1;i<=n;i++){
        int x,y;cin>>x>>y;
        for(int i=-2;i<=0;i++){
            for(int j=-2;j<=0;j++){
                if(1<=x+i&&x+i<=h-2&&1<=y+j&&y+j<=w-2){
                    v.push_back(make_pair(x+i,y+j));
                }
            }
        }
    }
    sort(v.begin(),v.end());
    ll ans[10];for(int i=1;i<=9;i++)ans[i]=0;
    for(int i=0;i<v.size();i++){
        int count=1;
        while(i+1<v.size()&&v[i]==v[i+1]){
            count++;
            i++;
        }
        ans[count]++;
    }
    ans[0]=(h-2)*(w-2);
    for(int i=1;i<=9;i++)ans[0]-=ans[i];
    for(int i=0;i<=9;i++)cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 10476
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
vector<int> v;

main(void){
	scanf("%lld",&n);
	cev=n-1;
	cev-=n/2;
	printf("%lld\n",cev);
	return 0;
}


Measured memory_bytes: 256
import java.io.FileNotFoundException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
import java.util.Stack;

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

	class State {
		int id;
		int col;

		public State(int id_, int col_) {
			id = id_;
			col = col_;
		}
	}

	int R, C, N;

	void run() {
		Scanner sc = new Scanner(System.in);
		C = sc.nextInt();
		R = sc.nextInt();
		N = sc.nextInt();
		ArrayList<State> lis = new ArrayList<>();
		for (int i = 0; i < N; ++i) {
			boolean f = true;
			ArrayList<State> tmp = new ArrayList<>();
			for (int t = 0; t < 2; ++t) {
				int x = sc.nextInt();
				int y = sc.nextInt();
				f &= x == 0 || x == C || y == 0 || y == R;
				if (f)
					tmp.add(new State(edge_id(x, y), i));
			}
			if (f) {
				lis.addAll(tmp);
			}
		}
		Collections.sort(lis, new Comparator<State>() {
			@Override
			public int compare(State o1, State o2) {
				return Integer.compare(o1.id, o2.id);
			}
		});
		ArrayDeque<Integer> stk = new ArrayDeque<Integer>();
		int[] col = new int[N];
		for (int i = 0; i < lis.size(); ++i) {
			State s = lis.get(i);
			if (col[s.col] == 0) {
				stk.addLast(s.col);
				++col[s.col];
			} else {
				int pre = stk.pollLast();
				if (pre != s.col) {
					System.out.println("NO");
					return;
				}
				--col[s.col];
			}
		}
		System.out.println("YES");
	}

	int edge_id(int x, int y) {
		if (y == 0) {
			return x;
		} else if (x == C) {
			return C + y;
		} else if (y == R) {
			return C + R + C - x;
		} else if (x == 0) {
			return C + R + C + R - y;
		} else {
			tr(x, y, C, R);
			throw new AssertionError();
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


Measured memory_bytes: 99032
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
const int INF = 1<<28;

bool prime[200 * 1000] = {};
void pre() {
	memset(prime, true, sizeof(prime));
	prime[0] = prime[1] = false;
	REP(i, 200 * 1000)
		if(prime[i])
			for(int j = i*2; j < 200 * 1000; j += i)
				prime[j] = false;
	return;
}

int main() {
	pre();
	int N, P;
	while(cin >> N >> P) {
		if(N == -1 && P == -1) break;
		vector<int> line;
		int cnt = 0;
		for(int i = N+1;; i++) {
			if(prime[i]) {
				line.push_back(i);
				cnt++;
			}
			if(cnt == P) break;
		}
		vector<int> ans;
		REP(i, line.size())
			FOR(j, i, line.size())
				ans.push_back(line[i] + line[j]);
		sort(ans.begin(), ans.end());
//		REP(i, ans.size()) cout << ans[i] << ", ";
		cout << ans[P-1] << endl; 
	}
	return 0;
}

Measured memory_bytes: 1476
#define _CRT_SECURE_NO_WARNINGS
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <map>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
#include <time.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define FILL(A,val) memset(A,val,sizeof(A))
#define ITER(it,a) for(__typeof(a.begin()) it=a.begin();it!=a.end();++it)
#define DBG1(a) cerr<<#a<<" = "<<(a)<<"\n"
#define DBG2(a,b) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"

#define ALL(V) V.begin(),V.end()
#define SZ(V) (int)V.size()
#define PB push_back
#define MP make_pair
#define y1 frgrwegreg

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;

const double PI = acos(-1.0);
const int MOD = 1000 * 1000 * 1000 + 7;
const int MAX = 100017;


int main()
{
	//freopen("C.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
	//ios::sync_with_stdio(0); cin.tie(0);

	string s;
	int a, b, n;
	cin >> n >> a >> b;
	cin >> s;
	int num1 = 0, num2 = 0;
	FOR (i,0,s.size())
	{
		if (s[i] == 'a')
		{
			if (num1+num2 == a+b) cout << "No\n";
			else cout << "Yes\n", num1++;
		}
		if (s[i] == 'b')
		{
			if (num1+num2 == a+b || num2 == b) cout << "No\n";
			else cout << "Yes\n", num2++;
		}
		if (s[i] == 'c')
		{
			cout << "No\n";
		}
	}
	return 0;

}


Measured memory_bytes: 896
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        long N;
        N = scanner.nextLong();
        long ans =0;
        for(long i=1;i*i<=N;i++){
            if(N%i==0){
                ans =Math.max(ans,i);
            }
        }
        long digit = String.valueOf(N/ans).length();
        System.out.println(digit);
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
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;}

const int INF = 100000; 

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

    int a = n % 10;
    int b = (n / 10) % 10;
    int c = (n / 100) % 10;

    if(a == c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256