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

#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)

#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)

#define getI(a) scanf("%d", &a) //next three are handy ways to get ints, it's also force you to use '&' sign
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)

#define wez(n) int (n); scanf("%d",&(n)) //handy if the input is right after the definition of a variable
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))

#define whileZ int T; getI(T); while(T--)
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))

#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) // traverse an STL data structure

#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int

#define mp make_pair
#define fi first
#define se second

// for debug
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,a.size()-1)

#define pb push_back
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;

list <int> adjList[100005];
bool visited[100005];
list <int> tree[100005];
int par[100005];
ll dp[100005][2];

void bfs(int src)
{
    queue <int> q;
    par[src]=-1;
    q.push(src);
    while (!q.empty()) {
        int fr = q.front();
        q.pop();
        for (int v: adjList[fr]) {
            if (v==par[fr] || visited[v]) continue;
            par[v] = fr;
            visited[v] = 1;
            q.push(v);
            tree[fr].pb(v);
        }
    }
}

ll mod = 1000000007LL;

ll getans (int v)
{
    if (dp[v][0]) 
        return (dp[v][0] + dp[v][1]) % mod;
    if (tree[v].empty()) {
        dp[v][0] = dp[v][1] = 1LL;
        return 2LL;
    }
    dp[v][0] = dp[v][1] = 1LL;
    for (auto i: tree[v]) {
        dp[v][0] *= getans(i);
        dp[v][0] %= mod;
    }
    for (auto i: tree[v]) {
        dp[v][1] *= dp[i][0];
        dp[v][1] %= mod;
    }
    return (dp[v][1] + dp[v][0]) % mod;
}

int main()
{
    wez(n);
    F(i,0,n-1) {
        wez2(x,y);
        adjList[x].pb(y);
        adjList[y].pb(x);
    }
    visited[1] = 1;
    bfs(1);
    cout << getans(1) << "\n";
    // F(i,1,4) cout << tree[i].size() << "  " << dp[i][0] << "  " << dp[i][1] << "\n";
    return 0;
}

Measured memory_bytes: 18944
n = gets.to_i

a = gets.split.map(&:to_i).sort!

h = Hash.new(0)
if a[0] == 0
  a.shift
end
a.each do |aa|
  h[aa] += 1
end
# p h

if  h.all? do |k,v|
      v.even?
      if n.odd?
        k.even?

      else
        k.odd?
      end
    end
  if h.length == n / 2
    puts 2**h.length % (10**9 + 7)
    exit
  end
end
puts '0'


Measured memory_bytes: 13424
#include <algorithm>
#include <cstdio>
#include <functional>
#include <fstream>
#include <iostream>
#include <set>
#include <vector>
#include <string.h>

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("file.1", "r", stdin);

  int n;
  cin >> n;
  vector<int> w(n);
  int i, j;
  for (i = 0; i < n; i++) {
    cin >> w[i];
  }
  int delta = 1000;
  int s1, s2;
  for (i = 0; i < n - 1; i++) {
    s1 = 0;
    s2 = 0;
    for (j = 0; j <= i; j++) {
      s1 += w[j];
    }
    for (j = i + 1; j < n; j++) {
      s2 += w[j];
    }
    delta = min(delta, abs(s1 - s2));
    // cout << delta << endl;
  }
  cout << delta << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (){
	char date[10];
	for(int i = 0 ; i<10 ; i++){
	scanf("%c",&date[i]);
	if(date [3] == '7'){
		date [3] += 1;
	}
	printf("%c", date[i]);
	}
	
	return 0;
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

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


typedef pair<int, int> p;

int main(){
  int n;
  scanf("%d", &n);

  vector<int> odd(n / 2);
  vector<int> even(n / 2);

  REP (i, n) {
    if (i % 2 == 0)
      scanf("%d", &even[i / 2]);
    else
      scanf("%d", &odd[i / 2]);
  }

  vector<p> o_num(100010);
  vector<p> e_num(100010);

  REP (i, 100010) {
    o_num[i] = make_pair(0, i);
    e_num[i] = make_pair(0, i);
  }

  REP (i, n / 2) {
    o_num[odd[i]].first++;
    e_num[even[i]].first++;
  }

  sort(o_num.begin(), o_num.end(), greater<p>());
  sort(e_num.begin(), e_num.end(), greater<p>());

  if (o_num[0].second != e_num[0].second) {
    printf("%d\n", ((n / 2) - o_num[0].first) + ((n / 2) - e_num[0].first));
  } else if (o_num[0].first < e_num[0].first) {
    printf("%d\n", ((n / 2) - o_num[1].first) + ((n / 2) - e_num[0].first));
  } else if (o_num[0].first > e_num[0].first) {
    printf("%d\n", ((n / 2) - o_num[0].first) + ((n / 2) - e_num[1].first));
  } else if (o_num[1].first < e_num[1].first) {
    printf("%d\n", ((n / 2) - o_num[0].first) + ((n / 2) - e_num[1].first));
  } else
    printf("%d\n", ((n / 2) - o_num[1].first) + ((n / 2) - e_num[0].first));

}


Measured memory_bytes: 2176
#include <stdio.h>
#define MAX 1000

int main(void)
{
    int value[6] = {1, 5, 10, 50, 100, 500};
    int c1 = 0;
    int c5 = 0;
    int c10 = 0;
    int c50 = 0;
    int c100 = 0;
    int c500 = 0;
    int c1000 = 0;
    int sum = 0;

//    printf("1??????5??????10??????50??????100??????500???????????????????????????????????\????????????????????????");
    scanf("%d%d%d%d%d%d", &c1, &c5, &c10, &c50, &c100, &c500);
    
    sum = ((value[0] * c1) + (value[1] * c5) + (value[2] * c10) + (value[3] * c50) + (value[4] * c100) + (value[5] * c500));
    
    if (sum >= MAX)
    {
       c1000 = 1;
    }
	
	printf("%d\n", c1000);
//    printf("1000??????????????§????????´??????1?????§???????????´??????0??§??¨??????????????????", c1000);

    return 0;
}

Measured memory_bytes: 1824
program name
    implicit none
    character(1),allocatable:: s(:,:)
    integer(4),allocatable:: num(:,:)
    integer(4):: h,w,i,j, dj,di

    read*, h,w
    allocate(s(w,h), num(0:w+1,0:h+1))
    num(:,:) = 0
    block
        character(w):: inpt_s
        do i=1,h
            read*, inpt_s
            do j=1,w
                s(j,i) = inpt_s(j:j)
                if (s(j,i) == '#') then
                    do di = -1,1
                        do dj = -1,1
                            if (di==0 .and. dj==0) cycle
                            num(j+dj,i+di) = num(j+dj,i+di) + 1
                        end do
                    end do
                end if
            end do
        end do
    end block

    do i=1,h
        do j=1,w
            if (s(j,i) == '.') s(j,i) = char(num(j,i) + ichar('0'))
        end do
        print*, s(:,i)
    end do
end program name

Measured memory_bytes: 256
program wall
  implicit none
  integer :: h, w, c(0:9, 0:9) = 0, a(200) = -1, i, j, k, x = 0
  read(*,*) h, w
  do i = 0, 9
    read(*,*) c(i, 0:9)
  end do
  do k = 0, 9
    do i = 0, 9
      do j = 0, 9
        c(i, j) = min(c(i, j), c(i, k) + c(k, j))
      end do
    end do
  end do
  do i = 1, h
    read(*,*) a(1:w)
    do j = 1, w
      if (a(j) < 0) cycle
      x = x + c(a(j), 1)
    end do
  end do
  write(*,'(i0)') x
end program wall

Measured memory_bytes: 2944
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define all(v)    ((v.begin()),(v.end()))
#define sz(v)     ((int)(v.size()))
#define forv(i, v) for(int i = 0; i < sz(v); ++i)
#define forn(i,n)   for(int i = 0; i < (int)(n); i++)
using namespace std;

typedef long long       ll;
typedef long double     ld;
typedef vector<int>     vi;
typedef vector<double>  vd;
typedef vector< vi >    vii;
typedef vector< vd >    vdd;
typedef vector<string>  vs;


int main()
{
	fast;
	ll n, a, b;
	cin >> n >> a >> b;
	ll c = a + b;
	ll ans = 0;
	ans = (n / c) * a;
	ans += min(n % c, a);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}

using namespace std;
// now

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)]);
    }
};


ll nCr (ll n, ll r){
    ll ans = 1;
    for(ll i = n ; i > n-r ; i --){
        ans *= i;
    }
    for(ll i = 1 ; i<= r; i ++){
        ans /= i;
    }
    return ans ;
}

int nPr (int n,int r){
    int ans = 1;
    for(int i = n ; i > n-r ; i --){
        ans *= i;
    }
    return ans ;
}
int ke (int n){
    n--;
    if(n == 1 )return 0;
    int ans = 1;
    while (0 < n){
        ans *= n;
        n--;
    }
    return ans ;

}

int main(){
    int n;
    cin >> n;
    vector<int> vec(n);

    REP(i,n-1){
        int a;
        cin  >> a;
        a--;
        vec[a] ++;
    }

    REP(i,n){
        cout << vec[i] <<endl;
    }
}





Measured memory_bytes: 4068
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define co cout
#define ci cin
#define sf1(n) scanf("%lld",&n);
#define sf2(n,m) scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);
#define en cout<<endl;
#define pb push_back
#define coy cout<< "YES"<<endl;
#define con cout<< "NO"<<endl;
#define For(a,b) for(ll a=0;a<b;a++)
#define br break;
#define i64 long long
i64 M=10000000;
//ll b[805],ans[805];
map< ll,pair<ll,ll> >mp;

int main()
{
    ll t,n,g,k,m,mx=0,mn=1e9,res,c1,x,y,c2;
    ci>>n;
    for(ll i=9;i>0;i--)
    {
        if(n%i==0)
        {
            x=i;
            br
        }
    }
    if((n/x)<10) co<<"Yes";
    else co<< "No";
}



Measured memory_bytes: 256
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

long n;

int main(){
    scanf("%ld", &n);
    printf("%ld\n", n * 800 - n / 15 * 200);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, a;
  cin >> h >> a;
  cout << (h+a-1)/a << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=long long int;

template <typename T>
struct BIT {
private:
    vector<T> v;
public:
    BIT(int n) : v(n, 0) {}
    T sum(int i) {
        T s = 0;
        while (i > 0) {
            s += v[i];
            i = (i & (i + 1)) - 1;
        }
        return s;
    }
    void add(int i, T x) {
        while (i < (int)v.size()) {
            v[i] += x;
            i |= i + 1;
        }
    }
};

int main() {
    int q;
    cin >> q;
    struct Query {
        int k, a, b;
    };
    vector<Query> qa(q);
    vector<int> x;
    for (int i = 0; i < q; ++i) {
        cin >> qa[i].k;
        if (qa[i].k == 1) {
            cin >> qa[i].a >> qa[i].b;
            x.push_back(qa[i].a);
        }
    }

    sort(x.begin(), x.end());
    x.erase(unique(x.begin(), x.end()), x.end());

    BIT<int> bit(x.size()+2);
    int xt = lower_bound(x.begin(), x.end(), qa[0].a) - x.begin();
    bit.add(0, -1);
    bit.add(xt+1, 2);
    int prev = xt+1;
    ll c = qa[0].b;

    for (int i = 1; i < q; ++i) {
        if (qa[i].k == 2) {
            cout << x[prev-1] << " " << c << endl;
            continue;
        }
        int a = -bit.sum(prev-1), b = bit.sum(prev);
        int xt = lower_bound(x.begin(), x.end(), qa[i].a) - x.begin();
        bit.add(0, -1);
        bit.add(xt+1, 2);
        int l = 0, r = x.size()+1;
        while (r - l > 1) {
            int m = (r + l) / 2;
            if (bit.sum(m) >= 0) {
                r = m;
            } else {
                l = m;
            }
        }
        c += qa[i].b;
        c += abs(qa[i].a - x[r-1]);
        if (prev > r) {
            c += (ll)a * (x[prev-1] - x[r-1]);
        } else {
            c += (ll)b * (x[r-1] - x[prev-1]);
        }
        prev = r;
    }

    return 0;
}


Measured memory_bytes: 5880
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < (int)(x); i++)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x,y; cin >> x >> y;
    cout << (abs(x-y) <= 1 ? "Brown" : "Alice") << endl;
}

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

public class Main {
	static final int MOD = (int)1e9+7;

	public static void main(String[] args){
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		int n = sc.nextInt();
		int[] a = sc.nextIntArray(n);
		
		int tmp = a[0]^a[1];
		
		for(int i = 2; i < n; i++) {
			tmp = tmp^a[i];
		}
		
		out.println(tmp == 0 ? "Yes" : "No");
	}

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}

	public static long factorial(int n) {
		long a;

		if(n > 0) {
			a = n * factorial(n - 1);
		}else{
			a = 1;
		}

		return a;
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(K key, V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class UnionFind {
	int[] par;

	public UnionFind(int n) {
		par = new int[n];

		Arrays.fill(par, -1);
	}

	int root(int x) {
		if(par[x] < 0) return x;
		return par[x] = root(par[x]);
	}

	boolean unite(int x,int y) {
		x = root(x);
		y = root(y);

		if(x == y) return false;

		if(size(x) < size(y)) {
			int tmp = x;
			x = y;
			y = tmp;
		}

		par[x] += par[y];
		par[y] = x;

		return true;
	}

	boolean same(int x,int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}

	int size(int a) {
		return -par[root(a)];
	}
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
     }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 33620
H, W, D = map(int, input().split())
M = [(-1, -1)]*(H*W+1)
A = []
for i in range(H):
  As = list(map(int, input().split()))
  for j in range(W):
    a = As[j]
    M[a] = (i, j)
  A.append(As)
#print(M)
Dist = [0]*(H*W+1)
for k in range(0, H*W-D+1):
  i, j = M[k]
  x, y = M[k+D]
  Dist[k+D] = Dist[k]+abs(x-i)+abs(y-j)
Q = int(input())
for i in range(Q):
  L, R = map(int, input().split())
  r = Dist[R]-Dist[L]
  print(r)


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

using namespace std;

const int Nmax = 2e5 + 5, Mod = 1e9 + 7;
typedef long long ll;
typedef pair<int,int> Pair;

int add(int x, int y) {x+=y; return x<Mod ? x : x-Mod;}
int inm(int x, int y) {return (ll) x*y % Mod;}
void addto(int &x, int y) {x+=y; if(x>=Mod) x-=Mod;}
void inmto(int &x, int y) {x = (ll) x*y%Mod;}

int power(int a, int b)
{
    if(!b) return 1;
    if(b&1) return inm(a, power(inm(a,a), b/2));
    return power(inm(a,a), b/2);
}

ll st, mid, dr, ans1, ans2;
int n, i, a[Nmax];

ll check(ll x)
{
    int i;
    for(i=1; i<=n; ++i)
        x -= x%a[i];
    return x;
}

int main()
{
   //  freopen("input", "r", stdin);
    cin.sync_with_stdio(false);

    cin >> n;
    for(i=1; i<=n; ++i) cin >> a[i];

    st = 2; dr = (1LL<<59);

    while(st <= dr)
    {
        mid = (st+dr)/2;
        if(check(mid) >= 2) dr = mid-1;
            else st = mid+1;
    }
    ans1 = st;

    st = 2; dr = (1LL<<59);
    while(st <= dr)
    {
        mid = (st+dr)/2;
        if(check(mid) > 2) dr = mid-1;
            else st = mid+1;
    }
    ans2 = dr;

    if(ans1 > ans2) cout << "-1\n";
        else cout << ans1 << ' ' << ans2 << '\n';
    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#define maxn 100
using namespace std;
long long n, A, B, C, D;
int main(){
	cin >> n >> A >> B >> C >> D;
	bool ok = 0;
	n -= 1;
	for(int i = 0; i <= n; i++){
		long long l1 = i * C;
		long long r1 = i * D;
		long long l2 = (n - i) * C;
		long long r2 = (n - i) * D;
		long long L = l1 - r2;
		long long R = r1 - l2;
		if(L <= (B - A) && (B - A) <= R){
			ok = 1;
			break;
		}
	}
	if(ok)
		puts("YES");
	else
		puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <sstream>
#include <vector>
#include <cmath>
#include <cstdio>
#include <chrono>
#include <unordered_map>



using namespace std;

typedef long long int ll;
typedef int h_int;

#define REP(i, n) for(int i = 0; i < ( n ); ++i )
#define REPR(i, n) for(int i = ( n ); i >= 0; --i)
#define FOR(i, a, n) for(int i = ( a ); i < ( n ); ++i )
#define FORR(i, a, n) for(int i = ( n ); i >= ( a ); --i)

#define DOUT(x) cerr << #x << " = " << x << "\n";
#define COUT(x) cout << ( x ) << "\n";



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

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

        if( a % 3 == 0 )
        {
                std::cout << "Possible" << '\n';
                return 0;
        }
        if( b % 3 == 0 )
        {
                std::cout << "Possible" << '\n';
                return 0;
        }
        if( ( a + b ) % 3 == 0 )
        {
                std::cout << "Possible" << '\n';
                return 0;
        }
        std::cout << "Impossible" << '\n';


        return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#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 <cstring>
#include <iomanip>

using namespace std;

int main(){
   int x[5];
   for (int i = 0; i < 5; i++) {
      cin >> x[i];
      if(x[i]==0){
         cout << i+1 << endl;
         return 0;
      }
   }
   return 0;
}


Measured memory_bytes: 3628
a=[]
for i in range(5):
    a.append(int(input()))
k = int(input())
ans = 0
for i in range(len(a)):
    for j in range(i,len(a)):
        if abs(a[j]-a[i]) > k:
            ans += 1
print('Yay!' if ans == 0 else ':(')


Measured memory_bytes: 9076
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    char c = s[0];
    string draft1 = string(s.length(), c);
    if(draft1 >= s){
        cout << draft1 << endl;
    }else{
        cout << string(s.length(), c + 1) << endl;
    }
}

Measured memory_bytes: 256
n=int(input())
da=list(map(int ,input().split()))
Min=2
Max=2
ju=True
for i in da[::-1]:
    mi=(Min+i-1)//i
    ma=Max//i
    if mi*i>Max or ma*i<Min:
        ju=False
        break
    Min=mi*i
    Max=ma*i+i-1
if ju:
    print(Min,Max)
else:
    print(-1)


Measured memory_bytes: 14252
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
//#pragma GCC target ("avx,avx2,tune=native")
//#pragma GCC optimization ("unroll-loops")
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define orz ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);    
#define inp freopen("input.txt","r",stdin);freopen("out.txt","w",stdout); 
ll mod=1e9+7;
void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);    
    
}
const int N=2e5+5;

 
int main() {
	io();
	int n,k,i;
	cin>>n;
	vector<pair<int,int>> v;
	for(i=0;i<n;i++){
		int x;
		cin>>x;
		v.push_back({x,i});
	}
	sort(v.begin(),v.end());
	for(i=0;i<n;i++){
		cout<<v[i].second+1<<" ";
	}
}	

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


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

vector<int64_t> fct, inv;
void finit(int cmx, ll mod =MD){
	fct.resize(cmx+20); inv.resize(cmx+20);
	auto bin_pows =[](ll x, ll n, ll mod){
		ll res = 1LL;
		for(; n > 0; n >>=1, x = x*x %mod) if(n & 1) res = res * x %mod;
		return res;
	};
	fct[0] = fct[1] = inv[1] = 1;
	for(int i=2;i<cmx+3;i++) fct[i] = fct[i-1] * i % mod;
	inv[cmx] = bin_pows(fct[cmx], mod-2, mod);
	for(int i=cmx;i>=1;i--) inv[i-1] = inv[i] * i % mod;
}
ll nCk(ll n, ll k, ll mod =MD) {
	if(k > n || n <0 || k <0) return 0;
	ll ret =fct[n] * inv[k] % mod * inv[n-k] % mod;
	return ret;
}
int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int h, w, a, b;
	cin >>h >>w >>a >>b;
	finit(h+w+30);
	a = h-a; b--;
	ll ans = 0;
	rep2(i, 1, MD){
		if(a - i <0 || b+i>=w) break;
		int si = a - i;
		int bo = b + i;
		ll tmp = nCk(si+bo, bo);
		si = abs(h-1 - (a-i));
		bo = abs(w-1 - (b+i));
		(tmp *= nCk(si+bo, bo)) %=MD;
		(ans += tmp)%=MD;
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

void cominit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long com(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int n, k;
    cin >> n >> k;
    ll ans[k + 1] = {};
    ans[1] = n - k + 1;
    cominit();
    rep(i, 2, k + 1) {
        if (i > n - k + 1) {
            ans[i] = 0;
        } else {
            ans[i] += com(k - 1, i - 1) * com(n - k - (i - 1) + i, i);
            ans[i] %= MOD;
        }
    }

    rep(i, 1, k + 1) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 12160
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;

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

int main() {
    int64 n, d;
    cin >> n >> d;

    int ans = 0;
    d *= d;
    for (int i=0; i<n; i++) {
        int64 x, y;
        cin >> x >> y;
        if (x*x + y*y <= d) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3188
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner cin = new Scanner(System.in);
        
        int n = 1;
        int a = 0;
        int b = 0;
        
        for(int i = 0; cin.hasNext(); i++){
	        String line = cin.nextLine();
	        
	        if(i == 0) {
	            String[] s = line.split(" ", 0);
	            
	            n = Integer.parseInt(s[0]);
	            a = Integer.parseInt(s[1]);
	            b = Integer.parseInt(s[2]);
	            
	        } else {
	            
	        }
	        
        }
        
        int min = 0;
        
        if(a < b) {
            min = a;
            
        } else {
            min = b;
            
        }
        
        int c = a + b - n;
        
        if(c < 0) {
            c = 0;
            
        }
        
        System.out.println(min + " " + c);
        
    }
    
}


Measured memory_bytes: 23764
import java.util.*;

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

        int N = sc.nextInt();
        int D = sc.nextInt();
        int[][] X = new int[N][D];
        double a = 0;
        int ans = 0;

        for(int i=0; i<N; i++){
            for(int j=0; j<D; j++){
                X[i][j] = sc.nextInt();
            }
        }
        for(int i=0; i<N-1; i++){
            for(int j=1; j<N-i; j++){
                for(int k=0; k<D; k++){
                    a += Math.pow(X[i][k]-X[i+j][k],2);
                }
                if(Math.sqrt(a)==(int)(Math.sqrt(a))){
                    ans += 1;
                } 
                a = 0;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vp;

int main(int argc,char const* argv[])
{
  int r=0;
  cin >> r;
  if(r<1200)
    {
      cout << "ABC" << endl;
    }
  else if(1200<=r && r<2800)
    {
      cout << "ARC" << endl;
    }
  else if(2800<=r)
    {
      cout << "AGC" << endl;
    }
  return 0;
}


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

int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i,n) cin >> a.at(i);
sort(a.begin(),a.end());
cout << abs(a.front()-a.back()) << endl;
 }


Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;


void solve()
{
	string s;
	cin>>s;
	bool ok=false;
	rep(i,size(s)){
		if(s[i]=='7'){
			ok=true;
		}
	}
	if(ok){
		cout<<"Yes"<<endl;
	}else
	{
		cout<<"No"<<endl;
	}
	
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	int A, B, C; cin >> A >> B >> C;
	cout << (B-A==C-B?"YES":"NO") << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<list>
#include<vector>
#include<stdio.h>
#include<cmath>
#include<math.h>

using namespace std;

int main(){
	int N,maxim=0,count;
	cin >> N;
	int a[2][N];
	for(int i=0;i<2;i++){
		for(int k=0;k<N;k++){
			cin >> a[i][k];
		}
	}
	for(int i=0;i<N;i++){
		count = 0;
		for(int k=0;k<=i;k++){
			count = count + a[0][k];
		}
		for(int p=i;p<N;p++){
			count = count + a[1][p];
		}
		maxim = max(maxim,count);
	}
		cout << maxim << endl;
	return 0;
}


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

using namespace std;

int main(){
	
  int a,b,k;cin >> a >> b >> k;
  for(int i=min(a,b);i>=1;--i){
  	if(a%i==0 && b%i==0) k--;
    
    if(k == 0){
    	cout << i;
      return 0;
    }
  }
}

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

//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;
#define ret() return 0;

bool contain(set<string> &s, string a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;


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

    if (n <= 2 && m <= 2) {
        cout << n * m * (n * m % 2) << endl;
        ret();
    }

    if (n > m) swap(n, m);

    if (n == 1) {
        cout << m - 2 << endl;
        ret();
    }

    if (n <= 2) {
        cout << 0 << endl;
        ret();
    }

    cout << (n - 2) * (m - 2) << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
using namespace std;
int main()
{/*一日目*/
	int n;cin >> n;
	switch (n%10) {
	case 3:
		cout << "bon";
		break;
	case 0:
	case 1:
	case 6:
	case 8:
		cout << "pon";
		break;
	default:
		cout << "hon";
		break;
	}
}

Measured memory_bytes: 3632
#include <stdio.h>

inline static int read_int() {
    int x = 0, k;
    while ((k = getchar_unlocked() - '0') >= 0) x = x * 10 + k;
    return x;
}

inline static void put_int(int x) {
    int s = 0;
    char f[4] = {'0', '0', '0', '0'};
    while (x) {
        f[s++] += x % 10;
        x /= 10;
    }

    while (s--) putchar_unlocked(f[s]);
    putchar_unlocked('\n');
}

short highest[2000], streak[2000];

#pragma GCC optimize ("O3")
int main() {
    int h = read_int(), w = read_int(), max = 0, height, width, lastWall, tmp, len;

    for (height = 0; height < h; height++) {
        lastWall = -1;

        for (width = 0; width < w; width++) {
            if (getchar_unlocked() & 1) {
                if (lastWall != width - 1) {
                    len = width - lastWall - 1;
                    for (tmp = lastWall + 1; tmp < width; tmp++) if (len > highest[tmp]) highest[tmp] = len;
                }

                tmp = highest[width] + streak[width];
                if (tmp > max) max = tmp;

                highest[width] = streak[width] = 0;
                lastWall = width;
            } else streak[width]++;
        }

        getchar_unlocked();

        if (++lastWall != width) for (len = width - lastWall; lastWall < width; lastWall++) if (len > highest[lastWall]) highest[lastWall] = len;
    }

    for (width = 0; width < w; width++) {
        if (streak[width] != 0) {
            tmp = highest[width] + streak[width];
            if (tmp > max) max = tmp;
        }
    }

    put_int(max - 1);
}


Measured memory_bytes: 128
#include <iostream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <set>

using namespace std;

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

    multiset<int> S;
    int cmd, x, L, R;
    while (q--)
    {
        cin >> cmd;
        if (cmd == 0)
        {
            cin >> x;
            S.insert(x);
            cout << S.size() << endl;
        }
        else if (cmd == 1)
        {
            cin >> x;
            // cout << (S.find(x) != S.end()) << endl;
            cout << S.count(x) << endl;
        }
        else if (cmd == 2)
        {
            cin >> x;
            S.erase(x);
            // remove(S.begin(), S.end(), x);
        }
        else
        {
            cin >> L >> R;
            multiset<int>::iterator it1 = S.lower_bound(L), it2 = S.upper_bound(R);
            while (it1 != it2)
            {
                cout << *it1 << endl;
                it1++;
            }

        }
        
        
    }
}


Measured memory_bytes: 12324
# AGC035A - XOR Circle
def main():
    """
    a1 ^ a3 = a2 <-> A1 ^ a2 ^ a3 = 0
    a1~4 -> a1 ^ a2 ^ a3 = a2 ^ a3 ^ a4 = 0 -> a1 = a4
    Thus, 1) all 0
          2) 2n/3 of A: x, n/3: 0
          3) x, y, z n/3 each (x ^ y ^ z = 0)
    """
    n = int(input())
    A = tuple(map(int, input().rstrip().split()))
    S = set(A)
    if S == {0}:  # (1)
        flg = 1
    elif len(S) == 2 and A.count(0) == n // 3:  # (2)
        flg = 1
    elif len(S) == 3:
        a, b, c = S
        if A.count(a) == A.count(b) == A.count(c) and a ^ b ^ c == 0:  # (3)
            flg = 1
        else:
            flg = 0
    else:
        flg = 0
    print("Yes" if flg else "No")


if __name__ == "__main__":
    main()

Measured memory_bytes: 14244
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cassert>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

ll gcd(ll x, ll y) {
    if (!y) return x;
    return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

void solve() {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    if (B > D) {
        cout << "No\n";
    } else {
        if (A < B) {
            cout << "No\n";
        } else {
            if (A % B > C) {
                cout << "No\n";
            } else {
                if (B - gcd(B, D) > C) cout << "No\n";
                else cout << "Yes\n";
            }
        }
    }
}

int main() {
    int T;
    cin >> T;
    REP(i, T) solve();
    return 0;
}


Measured memory_bytes: 3560
N,X=map(x->parse(Int,x),split(readline()))
S=0
while X>0
	T=2<<N
	N-=1
	if T-2>=0&&X>T-2
		S+=div(T,2)
		X-=T-1
	else
		X-=1
	end
end
println(S)


Measured memory_bytes: 113532
#include <iostream>
#include <string>
using namespace std;
int main(){
    int i,a=100,b[3],p,q=100;
    for(i=0;i<3;i++){
        cin >> b[i];
        if(b[i]<a){
            a = b[i];
            p = i;
        }
    }
    for(i=0;i<3;i++){
        if(i!=p){
            if(b[i]<q){
                q = b[i];
            }
        }
    }

    cout <<q + a;

}

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

typedef long long int Long;
typedef long double Double;
const int MAXN = 1e5 + 4;

string s;
int n, cnt = 20;
set<int> S;

void ask(int i) {
	if(--cnt >= 0) {
		cout << i << endl;
		cin >> s;
		if(s[0] == 'V')
			exit(0);
		S.erase(i);
	}
}

int main() {
	cin >> n;
	for(int i = 0; i < n; ++i)
		S.insert(i);

	int lo = 1, hi = n - 2, mid;
	char lo_ch, hi_ch;

	ask(0);     lo_ch = s[0];
	ask(n - 1); hi_ch = s[0];

	while(lo <= hi) {
		mid = (lo + hi) >> 1;
		ask(mid);

		if(s[0] == lo_ch && mid >= lo && (mid - lo) % 2 == 0) {
			hi = mid - 1;
			hi_ch = s[0];
		} else if(s[0] == hi_ch && hi >= mid && (hi - mid) % 2 == 0) {
			lo = mid + 1;
			lo_ch = s[0];
		} else if(s[0] != hi_ch && hi >= mid && (hi - mid) % 2 == 1) {
			lo = mid + 1;
			lo_ch = s[0];
		} else {
			hi = mid - 1;
			hi_ch = s[0];
		}
	}

	srand(time(0));
	vector<int> v(S.begin(), S.end());
	while(cnt && v.size()) {
		int r = (rand() ^ (int(rand())<<14)) % int(v.size());
		ask(v[r]);
	}

	return 0;
}


Measured memory_bytes: 5588
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline().strip()

def solve(N: int, K: int, H: "List[int]"):
    H.sort()
    print(sum(H[i] for i in range(N - K)) if K < N else 0)

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    H = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, H)

if __name__ == '__main__':
    main()


Measured memory_bytes: 80848
use std::cmp;
use std::i64;

macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;$n:expr) => {
        (0..$n).map(|_| scan!()).collect::<Vec<_>>()
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (n, k) = scan!(i64, i64);
    let mut xpoints = Vec::new();
    let mut ypoints = Vec::new();
    for _ in 0..n {
        let (x, y) = scan!(i64, i64);
        xpoints.push((x, y));
        ypoints.push((y, x));
    }
    xpoints.sort();
    ypoints.sort();

    let mut ans = i64::MAX;
    for (i, &p0) in xpoints.iter().enumerate() {
        for &p1 in xpoints[(i + 1)..].iter() {
            let x0 = p0.0;
            let x1 = p1.0;
            for (i, &p2) in ypoints.iter().enumerate() {
                for &p3 in ypoints[(i + 1)..].iter() {
                    let y0 = p2.0;
                    let y1 = p3.0;
                    let mut num = 0;
                    for p in xpoints.iter() {
                        if x0 <= p.0 && p.0 <= x1 && y0 <= p.1 && p.1 <= y1 {
                            num += 1
                        }
                    }
                    if num >= k {
                        ans = cmp::min(ans, (x1 - x0) * (y1 - y0))
                    }
                }
            }
        }
    }
    println!("{}", ans)
}


Measured memory_bytes: 4476
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main(void) {

    int x, y; cin >> x >> y;
    bool flag = false;
    for (int i = 0; i <= x; ++i) {
        int j = x - i;
        if (i * 2 + j * 4 == y) {
            flag = true;
        }
    }

    if (flag) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}









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

using namespace std;

int main()
{
  string s; cin >> s;
  for(int i = 0; i < s.size(); i++)
  {
    if(i & 1 && s[i] != 'i')
    {
      cout << "No";
      return 0;
    }
    if(!(i & 1) && s[i] != 'h')
    {
      cout << "No";
      return 0;
    }
  }
  if(s[s.size() - 1] == 'h') cout << "No";
  else cout << "Yes";
  
  return 0;
}

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

#define int long long
using namespace std;

int ans, N, X;

signed main()
{
    cin >> N >> X;
    N -= X;
    while (X) {
        ans += (N - N % X) * 3;
        int x;
        x = X;
        X = (N % X);
        N = x;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
  int n,h;
  cin >> n >> h;
  vector<string> s(n);
  vector<int> t(n);

  for(int i=0;i<n;i++){
    cin >> s[i] >> t[i];
  }

  int total_miss = 0, total_type = 0;
  int i = 0, j = 0, miss = 0;
  for(;;){
    cout << "? " << s[i] << endl;
    fflush(stdout);

    char c;
    cin >> c;
    total_type++;

    if(tolower(s[i][j]) == tolower(c)){
      s[i][j] = '_';
      j++;
      if(j==(int)s[i].size()){
	miss = 0;
	i++;
	j = 0;
      }
    }else{
      miss++;
      total_miss++;
      if(miss>t[i]){
	h--;
	miss = 0;
	i++;
	j = 0;
      }
    }

    if(h==0){
      cout << "! Game Over" << endl;
      fflush(stdout);
      break;
    }
    if(i==n){
      int miss_per = (total_type-total_miss)*1000/total_type;
      cout << "! Game Clear " << miss_per/10 << "." << miss_per%10 << endl;
      fflush(stdout);
      break;
    }   
  }
    return 0;
}

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

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;
    UnionFind uf(n);
    rep(i,m) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        uf.unite(a, b);
    }
    int ans = 0;
    rep(i,n) ans = max(ans, uf.size(i));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4040