akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
import bisect
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#############
# Main Code #
#############

N,M = inputIL()
data = []
for i in range(M):
  data.append([i] + inputIL())

dic = {p:[] for p in range(N)}

for i,p,y in data:
  dic[p-1].append((y,i))

ans = []
for p in dic:
  dic[p].sort()
  for k in range(len(dic[p])):
    y,i = dic[p][k]
    ans.append((i,(p+1)*1000000+k+1))
    
ans.sort()   
for i,id in ans:
  print("{:012}".format(id))


Measured memory_bytes: 111956
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using static MyIO;


public class C
{
	public static void Main()
	{
		long mod = 1000000007;

		int N = GetInt();
		int M = GetInt();

		long numDogArray = 1;
		for(int i = 2; i <= N; i++)
			numDogArray = (numDogArray * i) % mod;

		long numMonkeyArray = 1;
		for(int i = 2; i <= M; i++)
			numMonkeyArray = (numMonkeyArray * i) % mod;

		int sub = Math.Abs(N - M);
		if(sub > 1)
		{
			Console.WriteLine(0);
		}
		else if(sub == 1)
		{
			long ans = (numDogArray * numMonkeyArray) % mod;
			Console.WriteLine(ans);
		}
		else
		{
			long ans = (numDogArray * numMonkeyArray) % mod;
			ans = (ans * 2) % mod;
			Console.WriteLine(ans);
		}
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


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

// #undef LOCAL
#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);
  
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  int cnt = 0;
  for (int i = 1; i < n - 1; i++) {
    if (p[i - 1] < p[i] && p[i] < p[i + 1])
      cnt++;
    else if (p[i + 1] < p[i] && p[i] < p[i - 1])
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}

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

using namespace std;

const int N = 1e6+7;
int n, cnt[N], freq[N], x[N], vi[N];

int main(){
#ifdef LOCAL
	freopen("input", "r", stdin);
#endif

	scanf("%d", &n);

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

	for (int i = 0; i < n; i++){
		if (vi[x[i]]) continue;
		vi[x[i]] = true;
		for (int j = 1; j*j <= x[i]; j++){
			if (x[i]%j == 0){
				if (x[i]/j == j){
					cnt[j] += freq[x[i]];
				} else{
					cnt[x[i]/j] += freq[x[i]];
					cnt[j] += freq[x[i]];
				}
			}
		}
	}

	bool coprime = true, pairwise = true;

	for (int i = 2; i <= 1000000; i++){
		if (cnt[i] == n){
			coprime = false;
			break;
		}
		if (cnt[i] > 1){
			pairwise = false;
			//break;
		}
	}

	if (!coprime){
		printf("not coprime\n");
	} else {
		if (pairwise) printf("pairwise ");
		else	printf("setwise ");
		printf("coprime\n");
	}

	return 0;
}

Measured memory_bytes: 19260
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>
#include <tuple>
#include <random>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e6 * 2 + 10, INF = 1e9 * 1e9 + 10;



int main()
{
    fastInp;

    ll n;
	cin >> n;
	ll a, b;
	cin >> a >> b;
	vector<ll> cnt(3);

	for (int i = 0; i < n; i++) {
		ll vl;
		cin >> vl;
		if (vl <= a) {
			cnt[0]++;
		} else if (vl > a && vl <= b) {
			cnt[1]++;
		} else {
			cnt[2]++;
		}
	}

	cout << min(min(cnt[0], cnt[1]), cnt[2]);
    return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a[4]={0},p=0,u=2,q=0;
	string s;
	while(cin>>s){
		p++;
		if(!q&&p>=10){u++;q++;}
		if(s.size()>u+1)a[2]++;
		else if(s[u]=='B')a[1]++;
		else if(s[u]=='O')a[3]++;
		else a[0]++;
	}
	for(int i=0;i<4;i++)cout<<a[i]<<endl;
}

Measured memory_bytes: 2984
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,a,h,p,q,max_h;
  while(cin >> n >> m >> a &&(n||m||a)){
    max_h = -1;
    int yoko[101][1001] = {{0}};
    
    for(int i=0;i<m;i++){
      cin >> h >> p >> q;
      if(h > max_h)max_h = h;
      yoko[p][h] = q;
      yoko[q][h] = p;
    }
    int now = a;
    for(int i=max_h;i>=0;i--){
      if(yoko[now][i]!=0){
	now = yoko[now][i];
      }
    }
    cout << now << endl;
  }
  
}

Measured memory_bytes: 1564
#include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main() {
	int n, va;
	cin >> n >> va;

	for (int x = 0; x < n + 1; x++) {
		for (int y = 0; y < n + 1; y++) {
			int z = n - x - y;
			if (z < 0) {
				continue;
			}
			if(x * 10000 + y * 5000 + z * 1000 == va) {
				cout << x << " " << y << " " << z << endl;
				return 0;
			}
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
struct d_heap {
  int d;
  vector<T> heap;

  d_heap(int d): d(d) {}
  void push(const T& t) {
    heap.push_back(t);

    int i = heap.size() - 1;
    while(i > 0){
      if(heap[(i - 1) / 2] > heap[i]) swap(heap[(i - 1) / 2], heap[i]);
      i = (i - 1) / 2;
    }
  }

  T pop() {
    T ans = heap[0];
    swap(heap.back(), heap.front());
    heap.pop_back();
    for(int i = 1;i < heap.size() && i <= d;i++) {
      if(heap[0] > heap[i]) swap(heap[0], heap[i]);
    }
    return ans;
  }

  bool empty() const {
    return heap.empty();
  }

  T top() {
    return heap[0];
  }
};
#include <vector>
#include <queue>
#include <set>
using namespace std;
 
struct edge{
  int to;
  int cost;
};
int INF = 1 << 30;
using Pii = pair<int,int>;
 
vector<int> Dijkstra(const vector<vector<edge>>& G,int s){
  vector<int> dist(G.size(),INF);
  dist[s] = 0;
  d_heap<Pii> que(3);
  que.push({dist[s],s});
  while(!que.empty()){
    auto d = que.top().first;
    auto v = que.top().second;
    que.pop();
    if(dist[v] < d) continue;
    for(auto & e : G[v]){
      if(dist[e.to] > d + e.cost){
        dist[e.to] = d + e.cost;
        que.push({dist[e.to],e.to});
      }
    }
  }
  return dist;
}
 
#include <iostream>
 
int main(){
  int v,e,r;
  cin >> v >> e >> r;
  vector<vector<edge>> G(v);
  for(int i = 0;i < e;i++){
    int s,t,d;
    cin >> s >> t >> d;
    G[s].push_back({t,d});
  }
  auto res = Dijkstra(G,r);
  for(auto i : res){
    if(i == INF) cout << "INF";
    else cout << i;
    cout << endl;
  }
}




Measured memory_bytes: 12636
n,k = map(int,input().split())
x = [0]*n
for i in range(k):
  p=int(input())
  l = list(map(int,input().split()))
  for j in l:
    x[j-1]+=1
count=0
for i in x:
  if i==0:
    count+=1
print(count)

Measured memory_bytes: 9204
#include <iostream>
using namespace std;
long long int f(int n)
{
    long long int m=1;
    for(long long int i=2; i<=n; i++)
        m*=i;
    return m;
}
int main()
{
    long long int a;
    cin>>a;
        cout<<f(a)<<endl;
}

Measured memory_bytes: 1156
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

def janken(n):
    if n == "r":
        return P
    elif n == "s":
        return R
    else:
        return S

ans = 0

for i in range(K):
    h = T[i::K]
    l = len(h)
    f = 1
    a = ""
    for j in range(l):
        if a != h[j]:
            a = h[j]
            f = 0
            ans += janken(h[j])
        else:
            ans += f * janken(h[j])
            f = - (f - 1)

print(ans)

Measured memory_bytes: 9320
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    class UnionFind:
        def __init__(self,n):
            self.par=[i for i in range(n)]
            self.siz=[1]*n
            
        def root(self,x):
            while self.par[x]!=x:
                self.par[x]=self.par[self.par[x]]
                x=self.par[x]
            return x
        
        def unite(self,x,y):
            x=self.root(x)
            y=self.root(y)
            if x==y:
                return False
            if self.siz[x]<self.siz[y]:
                x,y=y,x
            self.siz[x]+=self.siz[y]
            self.par[y]=x
            return True
        
        def is_same(self,x,y):
            return self.root(x)==self.root(y)
        
        def size(self,x):
            return self.siz[self.root(x)]
    u=UnionFind(13)
    for x in [3,5,7,8,10,12]:
        u.unite(1,x)
    for x in [6,9,11]:
        u.unite(4,x)
    x,y=map(int,input().split())
    YesNo(u.is_same(x,y))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
// Sasageyo! Sasageyo! Shinzou wo Sasageyo !
// https://goo.gl/IwJzbx

#include<bits/stdc++.h>

using namespace std;

typedef pair<int,int> II;
typedef vector<II> VII;
typedef vector<int> VI;
typedef vector< VI > VVI;

typedef long long int LL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define endl '\n'
const int N = 1e5 + 1;
const int MOD = 1e9 + 7;
int fact[N];

int main()
{
  fact[0] = 1;
  for(int i=1;i<N;i++)
    fact[i] = (fact[i-1]*1LL*i)%MOD;
	fast_io;
  int a, b;
  cin >> a >> b;
  if (a < b)
    swap(a, b);
  int ans = 0;
  if(a==b)
    ans = (fact[a]*2LL*fact[a])%MOD;
  else if(a - b == 1)
    ans = (fact[a]*1LL*fact[b])%MOD;
  cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdint.h>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);
static const ll MOD = 1000000007;

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

void solve(std::string S) { cout << S.substr(0, 3) << endl; }

int main() {
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 3632
num = [[[0 for i in range(10)] for i in range(3)] for i in range(4)]

n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    num[b-1][f-1][r-1] +=v
    
for b in range(4):
    for f in range(3):
        print(" " + " ".join(map(str, num[b][f])))
    if b < 3:
        print("#"*20)


Measured memory_bytes: 5608
#include <iostream>

using namespace std;

class String{
private:
	int length;
public:
	String();
	int str_len(char* str);
};

String::String(){
	length = 0;
}

int String::str_len(char* str){
	int i=0;
	while(str[i++]){
		length++;
	}
	return length;
}

int main(void){

	char str[20];
	int len;
	String string;

	cin >> str;
	len = string.str_len(str);

	for(int i=len-1;i>=0;--i){
		cout << str[i] ;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1132
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <unistd.h>
#include <bits/stdc++.h>

#define pii pair<int,int>
#define REP(i, n) for (long long i = 0; i < (n); i++) 
using namespace std;

using Graph = vector<vector<int>>;

typedef long long ll;
static const ll INF = 1000000000000000000LL;
static const ll MOD = 1000000007;


int main()
{
    int N;
    cin >> N;
    vector <int> x(N);
    REP(i, N)cin >> x[i];

    ll res = INF;

    for(int i = 1; i <= 100; ++i)
    {
        ll tmp = 0;
        for(int j = 0; j < N; ++j)
        {
            tmp += pow(x[j] - i, 2.0);
        }

        res = min(res, tmp);
    }
    cout << res << endl;


    return 0;
}

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

template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};
const int mod = 1E+09 + 7;
using modint = ModInt< mod >;

template< typename T >
struct Combination {
  vector< T > _fact, _rfact, _inv;

  Combination(int sz) : _fact(sz + 1), _rfact(sz + 1), _inv(sz + 1) {
    _fact[0] = _rfact[sz] = _inv[0] = 1;
    for(int i = 1; i <= sz; i++) _fact[i] = _fact[i - 1] * i;
    _rfact[sz] /= _fact[sz];
    for(int i = sz - 1; i >= 0; i--) _rfact[i] = _rfact[i + 1] * (i + 1);
    for(int i = 1; i <= sz; i++) _inv[i] = _rfact[i] * _fact[i - 1];
  }

  inline T fact(int k) const { return _fact[k]; }

  inline T rfact(int k) const { return _rfact[k]; }

  inline T inv(int k) const { return _inv[k]; }

  T P(int n, int r) const {
    if(r < 0 || n < r) return 0;
    return fact(n) * rfact(n - r);
  }

  T C(int p, int q) const {
    if(q < 0 || p < q) return 0;
    return fact(p) * rfact(q) * rfact(p - q);
  }

  T H(int n, int r) const {
    if(n < 0 || r < 0) return (0);
    return r == 0 ? 1 : C(n + r - 1, r);
  }
};

const int N_MAX = 500005;
modint S[N_MAX];
modint W[N_MAX];

int main(){
    int n, m;
    cin >> n >> m;
    Combination<modint> COM(n+m);
    modint ans = COM.P(m, n) * COM.P(m, n);
    for(int i = 1; i <= n; i++){
        int c = 1;
        if (i % 2 == 1)c = -1;
        ans += modint(c) * COM.P(m, n) * COM.C(n, i) * COM.P(m-i, n-i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 18572
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;

int main() {
  //std::vector<int> v(5);
  int a,b; cin>>a>>b;
  int h,w; cin>>h>>w;
  cout << (a-h) * (b-w) << endl;
}


Measured memory_bytes: 256
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

n=int(input())
xy=[0]*n
for i in range(n):
    x,y=map(int,input().split())
    xy[i]=[x,y,i]

def prim_heap():
    used = [True] * n #True:不使用
    edgelist = []
    for e in edge[0]:
        heapq.heappush(edgelist,e)
    used[0] = False
    res = 0
    while len(edgelist) != 0:
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,e)
        res += minedge[0]
    return res

#########################

xy.sort()
edge = [[] for i in range(n)]
#隣接リスト edge[i]:[コスト,行先]
for i in range(n-1):
    x1,x2=xy[i][0],xy[i+1][0]
    n1,n2=xy[i][2],xy[i+1][2]
    edge[n1].append((x2-x1,n2))
    edge[n2].append((x2-x1,n1))

xy.sort(key=lambda x: x[1])
for i in range(n-1):
    x1,x2=xy[i][1],xy[i+1][1]
    n1,n2=xy[i][2],xy[i+1][2]
    edge[n1].append((x2-x1,n2))
    edge[n2].append((x2-x1,n1))

print(prim_heap())

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


int main(){
  int N;
  int AC=0;
  int TLE=0;
  int WA=0;
  int RE=0;
  string str;
  cin >> N;

  for(int i=0;i<N;i++){
    cin>>str;
    if(str=="AC") AC++;
    else if(str=="TLE") TLE++;
    else if(str=="WA") WA++;
    else if(str=="RE") RE++;
  }
  cout<< "AC"<<" "<<"x"<<" "<<AC<<endl;
  cout<< "WA"<<" "<<"x"<<" "<<WA<<endl;
  cout<< "TLE"<<" "<<"x"<<" "<<TLE<<endl;
  cout<< "RE"<<" "<<"x"<<" "<<RE<<endl;

  return 0;
}

Measured memory_bytes: 3592
import sys
input = sys.stdin.readline
ri = lambda: int(input())
#rl = lambda: [int(x) if x.isdecimal() else x for x in input().split()]
#rl = lambda: list(input().split()))
rl = lambda: map(int,input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7

N = ri()
AB = []
for i in range(N):
    a,b = rl()
    AB.append((a,b))

AB.sort(key = lambda x: x[1])

time = 0
res = 0
ans = 1
for a,b in AB:
    if time < b:
        res += (b-time)
        time = b
    if res >= a:
        res -= a
    else:
        ans = 0
        break

yn(ans)

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

void test();
int sum_comb(int n);

using namespace std;

int main(void)
{
	test();
	return 0;
}

void test()
{
	int n,comb;

	while (cin >> n)
	{
		comb = sum_comb(n);

		cout << comb << endl;
	}
}

int sum_comb(int n)
{
	int a, b, c, d,cnt;
	cnt = 0;
	for (a = 0; a <= 9; a++)
	{
		for (b = 0; b <= 9; b++)
		{
			for (c = 0; c <= 9; c++)
			{
				for (d = 0; d <= 9; d++)
				{
					if ((a + b + c + d) == n)
						cnt++;
				}
			}
		}
	}
	return cnt;
}

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

using namespace std;

class SegmentTree{
private:
    int n;
    vector<int> t;
    
    int combine(int a, int b){
        return min(a,b);
    }
public:
    SegmentTree(vector<int>& v){                                         // build tree
        n = v.size();
        t.assign(n << 1, 0);
        
        for (int i=0; i<n; i++) t[n+i] = v[i];
        for (int i=n-1; i>0; i--) t[i] = combine(t[i<<1], t[i<<1|1]);
    }
    void modify(int p, int val){                                        // set v[p] = val
        for (t[p+=n]=val; p>>=1; ) t[p] = combine(t[p<<1],t[p<<1|1]);
    }
    int query(int l, int r){                                            // query in range v[l,r)
        int res = INT_MAX;
        for (l+=n, r+=n; l<r; l>>=1, r>>=1){
            if (l&1) res = combine(res,t[l++]);
            if (r&1) res = combine(res,t[--r]);
        }
        return res;
    }
};

int main(){

    ios_base::sync_with_stdio(false);

    /*
     * Input Format (0-base indexing)
     * N = array size
     * Q = number of operation
     */

    // client program for demo

    int N, Q;
    cin >> N >> Q;

    vector<int> v; v.assign(N,0);
    for (int i=0; i<N; i++) v[i] = INT_MAX;

    SegmentTree st(v);

    for (int i=0; i<Q; i++){
        int op;
        cin >> op;

        if (op == 0){                       // modify v[p] to val
            int p, val;
            cin >> p >> val;

            st.modify(p,val);
        }
        if (op == 1){                       // query sum of a[l,r]
            int l, r;
            cin >> l >> r;

            cout << st.query(l,r+1) << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 2324
#include<bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
// greater<int>()
typedef long long ll;
ll GCD(ll x, ll y) { return y ? GCD(y, x%y) : x; }
ll LCM(ll x, ll y) { return x * y / GCD(x, y); }

using namespace std;

int main() {
	int N;
	cin >> N;
	int block = 1;
	int ans = 0;
	vector<int> vec(N);
	bool OK = false;


	for (int i = 0; i < N; i++)
	{
		int temp;
		cin >> temp;
		if (temp == block) {
			block++;
			OK = true;
		}
		else {
			ans++;
		}
	}

	if (OK) {
		cout << ans << endl;
	}
	else {
		cout << -1 << endl;

	}




}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
using namespace std;
int F(long long A,long long B){
    long long X = max(A,B);
    int res = 0;
    while(X > 0){
        X /= 10;
        res++;
    }
    return res;
}
int main(void){
    long long N;
    cin >> N;
    int ans = F(1,N);
    for(long long i=2;i*i<=N;i++){
        if(N % i == 0){
            ans = min(ans,F(i,N/i));
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3188
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef long long int ll;

ll gcd(ll a,ll b){
	if(a<b)swap(a,b);
	return (a%b?gcd(a%b,b):b);
	
}

int main()
{
	ll a,b;
	cin>>a>>b;
	cout<<a*b/gcd(a,b);
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
char in[100000];
int main(){
	int a;scanf("%d",&a);
	int ret=1;
	int val=0;
	for(int i=1;i<=a;i++){
		int tmp=i;
		int v=0;
		while(tmp%2==0){
			tmp/=2;v++;
		}
		if(val<v){
			val=v;ret=i;
		}
	}printf("%d\n",ret);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

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

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int i;
    for(i = 0;; i++) {
        if(1000 * i >= n) {
            break;
        }
    }
    cout << 1000 * i - n << endl;
}

Measured memory_bytes: 3648
#include <stdio.h>

void shuffle(int *card,int p,int c) {
    int backup[50],i;

    for(i = 0; i < c; i++){
	backup[i] = card[p + i];
    }
    for(i = 0; i < p; i++){
	card[p - 1 + c - i] = card[p - 1 - i];
    }
    for(i = 0; i < c; i++){
	card[i + 1] = backup[i];
    }
}

int main(void) {
    int i,n,r,p,c;
    int card[51];

    while (1){
	scanf("%d%d",&n,&r);
	if (n == 0)
	    break;
	for (i = 1;i <= n; i++) {
	    card[i] = n - i + 1;
	}
	for (i = 0;i < r; i++){
	    scanf("%d%d", &p, &c);
	    shuffle(card, p, c);
	}
	printf("%d\n",card[1]);
    }
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x, y, z) max((x), max((y), (z)))
#define tmin(x, y, z) min((x), min((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
using Graph = vector<vector<ll>>;
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//cout << fixed << setprecision(10);


int main(){
    ll n, ans = 0, ma = -1; cin >> n;
    rep(i, n){
        ll a; cin >> a;
        ans += max(ma - a, 0LL);
        chmax(ma, a);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3640
S = gets
N = S.length

a, b = 0, 0
for i in 0...N do
  
  if i % 2 == 0 then
    a += 1 if S[i] == '0'
    b += 1 if S[i] == '1'
  end
  
  if i % 2 == 1 then
    a += 1 if S[i] == '1'
    b += 1 if S[i] == '0'
  end
end

ans = [a, b].min
p ans



Measured memory_bytes: 1916
import sys
from collections import defaultdict

def create_id(p, o):
    p = str(p)
    o = str(o)
    p = '0' * (6 - len(p)) + p
    o = '0' * (6 - len(o)) + o
    return p + o

n, m, *py = map(int, sys.stdin.read().split())
py = zip(*[iter(py)] * 2)

def main():
    db = defaultdict(list)
    i = 0
    for p, y in py:
        db[p].append((y, i))
        i += 1

    res = [None] * m
    for p in db:
        db[p].sort()
        for i in range(len(db[p])):
            res[db[p][i][1]] = create_id(p, i + 1)
    print(*res, sep='\n')

if __name__ ==  '__main__':
    main()

Measured memory_bytes: 46436
#include <bits/stdc++.h>
using namespace std;
#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, n, m) for (int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;
/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 */
int main()
{
    int N, H, W;
    cin >> N >> H >> W;
    int cnt = 0;
    REP(i, N) {
        int a, b;
        cin >> a >> b;
        if(a >= H && b >= W) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

int main() {
  string N ; 
  cin >> N ; 
  //for(int i = 0 ; i < 3 ; i++) cout << N.at(i) << endl ;
  
  if(N.at(0) >= N.at(1) && N.at(0) >= N.at(2) ){

    for(int i = 0 ; i < 3 ; i++){
     int a = N.at(0) - '0' ; 
     cout << a  ; 
    }
  }
   else{
     for(int i = 0 ; i < 3 ; i++){
       int a = N.at(0)  - '0'; 
       cout << a+1 ;
     }
  }
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define fi first
#define se second

using namespace std;

typedef long long ll;

int a,b;

bool check(int p){
	int mid = (p+1)/2;
	
	ll mx=0;
	for(int i=mid-10;i<=mid+10;i++){
		if(i<=0 || i>p+1 || i==a)
			continue;
		
		int below = i-(i>=a);
		int j=p+1+(p>=b)-below;
		j-=(j<=b && p>=b);
		
		if(j<=0 || j>p+1 || j==b)
			continue;
		mx=max(mx,1ll*i*j);
	}
	return mx<1ll*a*b;
}

void test_case(){
	cin >> a >> b;
	if(a>b)
		swap(a,b);
	
	int l=0, r=2e9+5;
	while(l+1<r){
		int mid = (1ll*l+r)>>1;
		if(check(mid)){
			l=mid;
		}
		else{
			r=mid;
		}
	}
	cout << l << endl;
	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int tcase; cin >> tcase;
	while(tcase--){
		test_case();
	}
	
	return 0;
}

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

using namespace std;

#define int long long
#define ff first
#define ss second
#define pb emplace_back
#define pii pair<int, int>
#define mp make_pair

const int MAXN = 100009;
int a[MAXN];
int n, len;

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> len;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n - 1; i++)
    {
        if (a[i] + a[i + 1] >= len)
        {
            cout << "Possible\n";
            for (int e = 0; e < i; e++)
                cout << e + 1 << "\n";
            for (int e = n - 2; e >= i; e--)
                cout << e + 1 << "\n";
            return 0;
        }
    }
    cout << "Impossible";
}


Measured memory_bytes: 1664
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
using namespace std;
const int MAXN = 110;
char s[MAXN][MAXN];
int l[MAXN], r[MAXN];
int has[MAXN];
int main(){
	int n;
	while(~scanf("%d", &n)){
		memset(has,0,sizeof has);
		memset(l,0,sizeof l);
		memset(r,0,sizeof r);
		for(int i = 1;i <= n; i++){
			scanf("%s", s[i]);
			int len = strlen(s[i]);
			for(int j = 0; j < len; j++){
				if(s[i][j] == '(')
					l[i]++;
				else if(s[i][j] == ')'){
					if(l[i] == 0) r[i]++;
					else l[i]--;
				}
			}
		}
		int flag = 0;
		int sum = 0;
		int tmp,tmpl,tmpr;
		for(int c = 1; c <= n; c++){
			tmp = tmpl = tmpr = -1;
			for(int i = 1; i <= n; i++){
				if(has[i]) continue;
				if(sum >= r[i]){
					if(tmpl < l[i]){
						tmp = i;
						tmpl = l[i];
						tmpr = r[i];
					}
					else if(tmpl == l[i] && tmpr > r[i]){
						tmp = i;
						tmpl = l[i];
						tmpr = r[i];
					}
				}
			}
			if(tmp == -1) {
				flag = 1;
				break;
			}
			has[tmp] = 1;
			sum = sum - tmpr + tmpl;
		}
		if(flag) puts("No");
		else if(sum == 0) puts("Yes");
		else puts("No");
	}
	return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
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;
}

int main(){
  
  int n;
  cin>>n;
  double t[n];
  double T = 0.0;
  REP(i,n){
    cin>>t[i];
    T += t[i];
  }
  double v[n+2];
  v[0] = 0;
  v[n+1] = 0;
  REPP(i,n){
    cin>>v[i];
  }
  
  double l[n+2];
  double r[n+2];
  REPP(i,n){
    if(i==1){
      l[i] = 0;
      r[i] = t[i-1];
    }else{
      l[i] = r[i-1];
      r[i] = l[i] + t[i-1];
    }
  }
  l[0] = r[0] = 0.0;
  l[n+1] = r[n+1] = T;
  
  double real_v[2*(int)T+1];
  double temp;
  REP(j,2*(int)T+1){
    REP(i,n+2){
      if(i==0){
        temp = (double)j/2.0;
      }else if(i==n+1){
        temp = min(temp,T-(double)j/2.0);
      }else{
        if((double)j/2.0 < l[i]){
          temp = min(temp, v[i]+l[i]-(double)j/2.0);
        }else if((double)j/2.0 > r[i]){
          temp = min(temp, v[i]+(double)j/2.0-r[i]);
        }else{
          temp = min(temp, v[i]);
        }
      }
    }
    real_v[j] = temp;
  }
  
  double ans = 0.0;
  REP(j,2*(int)T){
    ans += 0.25*(real_v[j]+real_v[j+1]);
  }
  cout << fixed << setprecision(4) << ans << endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  int M = N;
  int S;

  for (int i = 0; i < 9; i++) {
  S += N % 10;
  N /= 10;
  }
  
  int a = M % S;
  
  if(a==0){
  cout << "Yes" << endl;
  }
  
  if(a!=0){
  cout << "No" << endl;
  }

}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

int main() {
	long long int x;
	cin >> x;
	long long int p = 100, cnt = 0;
	while (p < x) {
		p += p / 100;
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vb= vector<bool>;
using vl= vector<ll>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()


int main(){
  ll h,pow2=1,ans=0;
  cin >> h;
  while(1){
    ans+= pow2;
    pow2*=2;
    if(pow2>h){
      break;
    }
  }
  cout << ans;
}


Measured memory_bytes: 256
def p(x):
 for i in range(7,int(x**.5+1),2):
  if x%i==0:return 0
 else:return 1
def f():
 n,c=map(int,input().split());s='9'*n
 if c<0:return(11,s+s)[n>1]
 for h in'9731':
  if n-1:
   for m in range(int(10**~-n),0,-1):
    if((int(h)+sum(int(k)for k in str(m-1)))*2+c)%3:
     t=h+str(m-1).zfill(n-1);a=int(t+str(c)+t[::-1])
     if p(a):return a
  else:
   a=int(h+str(c)+h)
   if p(a):return a
 return s+b+s
print(f())


Measured memory_bytes: 5652
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>

using namespace std;

using ll = long long;

int main(void){
    int n,k;
    cin >> n >> k;

    vector<int> x(n),y(n);
    vector<int> xary,yary;

    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
        xary.push_back(x[i]);
        yary.push_back(y[i]);
    }

    sort(begin(xary), end(xary));
    sort(begin(yary), end(yary));

    //全ての点を含んでいる有限の長方形の長さを求める
    ll ans = 1ll * (xary[n-1] - xary[0]) * (yary[n-1] - yary[0]);

    for(int xi = 0; xi < n; xi++){
        for(int xj = xi + 1; xj < n; xj++){
            for(int yi = 0; yi < n; yi++){
                for(int yj = yi + 1; yj < n; yj++){

                    int num = 0;
                    ll lx = xary[xi], rx = xary[xj];
                    ll by = yary[yi], uy = yary[yj];

                    for(int i = 0; i < n; i++){
                        if(lx <= x[i] and x[i] <= rx and by <= y[i] and y[i] <= uy){
                            num++;
                        }
                    }

                    if(num >= k) ans = min(ans, 1ll * (rx-lx) * (uy - by));
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){
    ll a,b,c;cin>>a>>b>>c;
    if(c-a-b<=0){
        cout<<"No"<<endl;
    }else if(4*a*b<c*c+a*a+b*b-2*a*c-2*b*c+2*a*b){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
    return 0;
}



Measured memory_bytes: 256
use std::collections::HashMap;
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let m = 1000_000_000 + 7;
    let n: usize = read();
    let s: Vec<char> = read::<String>().chars().collect();
    let mut map = HashMap::new();
    let mut ret: u64 = 1;
    for c in s.iter() {
        let count = map.entry(c).or_insert(0);
        *count += 1;
    }
    for (_, value) in map {
        ret *= value + 1;
        ret %= m;
    }
    println!("{}", (ret + m - 1) % m);
}


Measured memory_bytes: 2740
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	char q;
	int a1,a2,a3,b=0,c=0;
	while(cin>>a1>>q>>a2>>q>>a3){
		if(a1==a2)b++;
		if(a1*a1+a2*a2==a3*a3)c++;
	}
	cout<<c<<endl<<b<<endl;
}

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

ll solve() {
    ll N;
    cin >> N;
    vector<ll> C(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> C[i];
    }
    int CMAX = 2e5+1;
    vector<int> pc(CMAX, -1);

    const ll MOD = 1e9 + 7;
    auto Add = [&](ll& x, ll y) { x = ( x + y % MOD ) % MOD; };
    auto Mul = [&](ll& x, ll y) { x = ( x * y % MOD ) % MOD; };
    auto Pow = [&](ll x, ll n) -> ll {
        ll t = x % MOD, r = 1;
        while ( n > 0 ) {
            if ( n & 1 ) Mul(r, t);
        Mul(t, t);
        n >>= 1;
        }
        return r;
    };
    auto Inv = [&](ll a) -> ll {
        return Pow(a, MOD - 2);
    };
    
    vector<ll> dp(N);
    dp[0] = 1;
    pc[C[0]] = 0;
    for ( int i = 1; i < N; i++ ) {
        dp[i] = dp[i-1];
        int pi = pc[C[i]];
        if ( pi >= 0 && i - pi >= 2 ) {
            Add(dp[i], dp[pi]);
        }
        pc[C[i]] = i;
    }
    return dp[N-1];
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4096
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#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)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

vector<set<int>> edges;

const ll MOD = 1000000007;

void dfs(int v, int from, ll& ans, ll K, ll depth) {
    int child_num = 0;
    for (auto c: edges[v]) {
        if (c == from) continue;
        ll tmp = K - depth - child_num;
		if (tmp == 0) {
			ans = 0;
			return;
		}
        ans *= tmp;
        ans %= MOD;
        dfs(c, v, ans, K, 2);
        ans %= MOD;
        child_num += 1;
    }
    return;
}

int main(void)
{
    cin.sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;

    edges.resize(N);
    REP(n, N-1) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        edges[a].insert(b);
        edges[b].insert(a);
    }

    int root = 0;
    ll ans = K;
    dfs(root, -1, ans, K, 1);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 21376
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

struct edge{int to,cost;};

const int max_n = 2e5;
int par1[max_n];
int rnk1[max_n];

int par2[max_n];
int rnk2[max_n];

void init1(int n){
	for(int i=0; i<n; i++){
		par1[i] = i;
		rnk1[i] = 0;
	}
}

int find_root1(int x){
	if(par1[x] == x) return x;
	else			return par1[x] = find_root1(par1[x]);
}

void unite1(int x, int y){
	x = find_root1(x);
	y = find_root1(y);
	if(x == y) return;

	if(rnk1[x] < rnk1[y]){
		par1[x] = y;
	}
	else{
		par1[y] = x;
		if(rnk1[x] == rnk1[y]) rnk1[x]++;
	}
}

bool same1(int x, int y){
	return find_root1(x) == find_root1(y);
}

void init2(int n){
	for(int i=0; i<n; i++){
		par2[i] = i;
		rnk2[i] = 0;
	}
}

int find_root2(int x){
	if(par2[x] == x) return x;
	else			return par2[x] = find_root2(par2[x]);
}

void unite2(int x, int y){
	x = find_root2(x);
	y = find_root2(y);
	if(x == y) return;

	if(rnk2[x] < rnk2[y]){
		par2[x] = y;
	}
	else{
		par2[y] = x;
		if(rnk2[x] == rnk2[y]) rnk2[x]++;
	}
}

bool same2(int x, int y){
	return find_root2(x) == find_root2(y);
}

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

	int n,k,l;
	cin >> n >> k >> l;
	
	init1(n);
	init2(n);
	
	int p,q;
	for(int i=0;i<k;i++){
		cin >> p >> q;
		unite1(p-1,q-1);
	}
	for(int i=0;i<l;i++){
		cin >> p >> q;
		unite2(p-1,q-1);
	}
	map<P,int> m;
	for(int i=0;i<n;i++){
		m[P(find_root1(i),find_root2(i))]++;
	}
	for(int i=0;i<n;i++){
		cout << m[P(par1[i],par2[i])] << (i<n-1?" ":"\n");
	}

	return 0;
}

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

int main(){
  int n,m; cin>>n>>m;
  vector<int> l(m),r(m);
  rep(i,m){
    cin>>l.at(i)>>r.at(i);
  }
  sort(l.begin(),l.end());
  sort(r.begin(),r.end());
  int ans=r.at(0)-l.at(m-1)+1;
  ans=max(0,ans);
  cout<<ans;
}

Measured memory_bytes: 1024
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(ll i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod =1e9+7;
const int N = 1e6+7;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

  int m[10][10];
 
int main()
{

        int n;
        scf(n);
    
    
        rep(i,1,n+1)
        {
            string s=to_string(i);
            
            int x=s.front()-'0';
            
            int y=s.back()-'0';
            
            m[x][y]++;
        
        }
        
        ll ans=0;

        rep(i,0,10)
        rep(j,0,10)
        ans+=(m[i][j]*m[j][i]);
        
        lprin(ans);
        
}

Measured memory_bytes: 3792