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

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long X = sc.nextLong();
		for(int i=1; i<100000; i++) {
			if(i*(i+1)/2 == X) {
				System.out.println(i);
				return;
			}
			if(i*(i+1)/2 > X) {
				System.out.println(i);
				return;
			}
		}
	}
	static long lcm(long a, long b) {
		return a*(b/gcd(a, b));
	}
	
	static long gcd(long a, long b) {
		long ta = Math.max(a, b);
		long tb = Math.min(a, b);
		long tmp;
		while((tmp = ta%tb) != 0) {
			ta = tb;
			tb = tmp;
		}
		return tb;
	}
	
	static long modcomb(long n, long k, long mod) {
		if(k==1) {
			return n;
		}
		
		long ans = 1;
		for(long i=n; i>=n-k+1; i--) {
			ans = (ans * i)%mod;
		}
		for(long i=k; 0<i; i--) {
			ans = (ans * modpow(i, mod-2, mod)) % mod;
		}
		return ans;
	}
	
	static long modpow(long a, long b, long mod) {
		if(b==0) return 1;
		if(b%2==0) {
			long d = modpow(a, b/2, mod);
			return (d*d)%mod;
		} else {
			return (a*modpow(a, b-1, mod))%mod;
		}
	}
	
	static int disit(long a, long d) {
		int count = 0;
		while(a!=0) {
			a = a/d;
			count++;
		}
		return count;
	}
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, m;
    cin >> n >> m;
    int sum = 0;
    rep(i, m){
        int a;
        cin >> a;
        sum += a;
    }
    cout << ((sum <= n) ? n - sum : -1) << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define mp make_pair
#define f first
#define s second
 
#define all(s) s.begin(),s.end()
#define spresent(s,v) ((s).find(v)!=s.end())
#define present(s,v) (find(all(s),v)!=s.end())
 
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL)
 
#define fill_1d(a,val) fill(a,a+sizeof(a)/sizeof(a[0]),val)
#define fill_2d(a,val) fill(&a[0][0],&a[0][0]+sizeof(a)/sizeof(a[0][0]),val)
#define fill_nd(a,p2f,val) fill(p2f,p2f+sizeof(a)/sizeof(*p2f),val)
 
#define dout(i,s) cout<<"Case #"<<i<<": "<<s<<"\n"
 
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
 
typedef struct node{
	ll val,more=0,less=0;
	bool operator <(const node& a){
		return val<a.val;
	}
}node;
 
const int sz= 1e5+5;
const int M = 998244353;

vi prime;

void seive(int n){
	int sqn = sqrt(n), sq2n = sqrt(sqn);

	bool isprime[sqn+1];
	memset(isprime,1,sizeof(isprime));

	for(int i=2;i<=sq2n;++i){
		if(isprime[i])
			for(int j=i<<1;j<=sqn;j+=i)
				isprime[j]=0;
	}
	for(int i=2;i<=sqn;++i)
		if(isprime[i])
			prime.pb(i);

	// finding primes in [i+1,i+sqn]; i is a multiple of sqn
	for(int i=sqn;i<n;i+=sqn){
		memset(isprime,1,sizeof(isprime));
		sq2n = sqrt(i+sqn);
		for(int p: prime){
			if(p>sq2n)
				break;
			for(int j=(i/p+1)*p;j<=i+sqn;j+=p)
				isprime[j-i]=0;
		}
		for(int j=1;j<=sqn;++j)
			if(isprime[j])
				prime.pb(j+i);
	}
}

ll pow_mod(ll base, ll pow){
	ll ans = 1;
	while(pow){
		if(pow&1)
			ans = ans*base%M;
		base = base*base%M;
		pow>>=1;
	}
	return ans;
}

ll fac[200005];
ll inv_fac[200005];

void factorial(int n){
	fac[0] = fac[1] = 1;
	for(int i=2;i<=n;++i)
		fac[i] = fac[i-1]*i%M;

	inv_fac[n] = pow_mod(fac[n],M-2);
	for(int i=n-1;i>=0;--i){
		inv_fac[i] = inv_fac[i+1]*(i+1)%M;
	}
}

ll multinomial(vi& list){
	ll sum = 0, ans = 1;
	for(int i=0;i<list.size();++i){
		sum+=list[i];
		ans = ans*inv_fac[list[i]]%M;
	}
	ans = ans*fac[sum]%M;
	return ans;
}

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


int main() {
	int n;
	cin>>n;
	ll prod = 1;
	ll max_ = 1e18;
	while(n--){
		ll x;
		cin>>x;
		if(x==0){
			prod=0;
			break;
		}
		if(prod==-1)
			continue;
		// cout<<(x>max_/prod)<<" " <<prod<<"\n";
		if(prod!=0 && x>max_/prod){
			prod=-1;
			continue;
		}
		prod*=x;
	}
	cout<<prod;










	return 0;
}

Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-3;
int dx[4]={0,1,0,1};
int dy[4]={0,0,1,1};
int main(){
    int n;cin>>n;
    int a[100010];
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        int c=0;
        while(a[i]%2==0){
            a[i]/=2;
            c++;
        }   
        ans+=c;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
N=int(input())
A=[int(x) for x in input().split()]
M=10**9+7

def gcd(a,b):
  if a>b:
    a,b=b,a
  while a>0:
    b,a=a,b%a
  return b

l=1
for i in range(N):
  l*=A[i]//gcd(l,A[i])
l%=M

t=0
for i in range(N):
  t=(t+l*pow(A[i],M-2,M))%M

print(t%M)


Measured memory_bytes: 4084
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    set<int> s;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    cout << s.size() << endl;
    return 0;
}

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

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

	string S;
	cin >> S;

	string result = "";
	int nest = 0;

	for (int i = 0; i < N; ++i) {
		if (S[i] == '(') {
			nest++;
		} else if (S[i] == ')') {
			nest--;
		}

		if (nest < 0) {
			result = "(" + result;
			nest++;
		}

		result += S[i];

	}

	if (nest > 0) {
		for(int i=0; i<nest; ++i) {
			result += ")";
		}
	} else if (nest < 0) {
		for(int i=0; i<-nest; ++i) {
			result += "(";
		}
	}

	cout << result << endl;
}


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

int main(){
  int n,i,k;
  cin>>n;
  int a[n];
  for(i=0;i<n;i++){
    a[i]=0;
  }
  for(i=0;i<n-1;i++){
    cin>>k;
    a[k-1]++;
  }
  for(i=0;i<n;i++){
    cout<<a[i]<<endl;
  }

}


Measured memory_bytes: 4392
z[4000],*a=z,*b=z+2000,m,i,j;main(n){for(;scanf("%d",&n),i=n;printf("%d\n",m))for(memset(a,m=0,8e3);i--;j=a,a=b,b=j)for(j=0;j++<=n;)m=fmax(m,b[j]=getchar()-46?0:1+fmin(fmin(b[j-1],a[j-1]),a[j]));}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include <algorithm> 
#define pb push_back
#define fr first
#define sc second
#define all(x) x.begin(), x.end()
#define skip continue
#define NAME "code"

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef long double ld;

void faster(){
  	ios_base::sync_with_stdio(false);
  	cin.tie(NULL);
	cout.tie(NULL);
}

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

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

ll n, a[MAXN], ans, cnt;

int main(){
	faster();

	cin >> n;

	for(int i = 1; i <= n; ++i){
		cin >> a[i];
		if(a[i - 1] == a[i]){
			cnt++;
		}
		else{
			ans += (cnt / 2); 
			cnt = 1;
		}
	}
	ans += (cnt / 2);

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
#define DEBUG 0

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

int X[200000],Y[200000],s[200000];
set<pii> S;
int main() {
    int i;
    int H,W,N;
    scanf("%d %d %d",&H,&W,&N);
    for (i = 0; i < N; i++) scanf("%d %d",&X[i],&Y[i]),X[i]--,Y[i]--,S.insert(mp(Y[i],X[i]));

    int ans = 1e9,f = 0;
    s[0] = 0;
    for (i = 0; i < W; i++) S.insert(mp(i,H));
    for (i = 0; i < W; i++) {
        int x = s[i]+1;
        if (!S.count(mp(i,x))) {
            if (i < W-1) {
                while (S.count(mp(i+1,x))) {
                    if (S.count(mp(i,x+1))) {
                        f = 1;
                        break;
                    }
                    x++;
                }
                s[i+1] = x;
            }
        }
        else f = 1;
        auto it = S.lower_bound(mp(i,x));
        ans = min(ans,it->second);
        if (f) break;
    }
    printf("%d\n",ans);

    return 0;
}



Measured memory_bytes: 24472
#include <stdio.h>

int uruu(int i);

int main(void)
{
	int i,a,b,x=0;

	for(scanf("%d%d",&a,&b); !(a==0 && b==0); scanf("%d%d",&a,&b)){
		int flg=0;
		if(x)
			puts("");
		else
			x=1;
		for(i=a; i<=b; i++){
			if(uruu(i)){
				printf("%d\n",i);
				flg=1;
			}
		}
		if(!flg)
			puts("NA");
	}

	return 0;
}

int uruu(int i)
{
	if(i%400==0)
		return 1;
	else if(i%100==0)
		return 0;
	else if(i%4==0)
		return 1;

	return 0;
}

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

const int MAXN = 100010;

template<typename T> inline T read() {
	T x(0), f(1);
	char ch = getchar();
	for(; !isdigit(ch); ch = getchar()) if(ch=='-') f=-1;
	for(; isdigit(ch); ch = getchar()) x = (x*10)+(ch^48);
	return x * f;
}

int n, a[MAXN<<1];
bool b[MAXN<<1];

inline bool check(int x) {
	for(int i = 1; i <= (n<<1)-1; i++) b[i] = a[i] > x;
	bool flag = b[n]^1;
	for(int l = 1; l < n; l++) {
		if(b[n-l]^flag || b[n+l] ^ flag) break;
		flag ^= 1;
	}
	return flag^1;
}

int main() {
	n = read<int>();
	for(int i = 1; i <= (n<<1)-1; i++) 
		a[i] = read<int>();
	int L = 1, R = (n<<1)-1;
	while(L < R) {
		int mid = (L+R)>>1;
		if(check(mid)) L = mid+1;
		else R = mid;
	}
	printf("%d\n", L);
	return 0;
}


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

int getColor(int rate)
{
        if (rate > 0 && rate < 400) {
                return 0;
        }
        else if (rate > 399 && rate < 800) {
                return 1;
        }
        else if (rate > 799 && rate < 1200) {
                return 2;
        }
        else if (rate > 1199 && rate < 1600) return 3;
        else if (rate > 1599 && rate < 2000) return 4;
        else if (rate > 1999 && rate < 2400) return 5;
        else if (rate > 2399 && rate < 2800) return 6;
        else if (rate > 2799 && rate < 3200) return 7;
        else return 8;
}

int main()
{
        int N;
        cin >> N;
        vector<int> L(9, 0);
        for (int i = 0; i < N; ++i) {
                int rate = 0;
                cin >> rate;
                L[getColor(rate)] ++;
        }
        int min = 0;
        int max = 0;
        for (int i = 0; i < 9; ++i) {
                if (L[i] != 0) {
                        if (i == 8) {
                                max += L[i];
                        }
                        else {
                                min++;
                                max++;
                        }
                }
        }
        if (min == 0) min = 1;
        cout << min << " " << max << endl;



}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


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

  ll ma,mb,da,db;cin>>ma>>da>>mb>>db;
  if(da>db){
    cout<<1<<endl;
  }
  else {
    cout<<0<<endl;
  }
  return 0;

}


Measured memory_bytes: 768
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

import math
p = [a, b, c, d, e]
pa = []
for i in range(len(p)):
    if p[i]%10 == 0:
        pa.append(0)
    else:
        pa.append(10 - p[i]%10)

ans = math.ceil(a/10)*10 + math.ceil(b/10)*10 + math.ceil(c/10)*10 + math.ceil(d/10)*10 + math.ceil(e/10)*10 - max(pa)
print(ans)

Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"
	"strconv"
)

func main() {
	a := readFloat64() / 3

	fmt.Println(a * a * a)
}

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readInt() int {
	return int(readInt64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr(i, n) for (int i = 0; i < (int)n; i++)
#define frab(i, a, b) for (int i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef long double ld;

const ll INF = 1e9 + 10;
const ld PI = acos(-1);
const ld EPS = 1e-9;
const ll MOD = 1e9 + 7;
const int M = 3e5 + 1;
const int N = 1e6 + 10;



int main() {
    //freopen("a.in", "r", stdin);
    ll a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    ll answ = 100 * a, anss = 0;

    for (ll x = 0; x * 100 * a <= f; x++)
        for (ll y = 0; y * 100 * b <= f; y++) {
            if (x || y && x + y <= f) {
                ll l = min(e * (a * x + b * y), f - 100 * (a * x + b * y));
                if (l > 0) {
                    for (ll z = 0; z * c <= l; z++) {
                        ll w = (l - c * z) / d;
                        ll water = 100 * a * x + 100 * b * y;
                        ll sugar = c * z + d * w;
                        if (anss * (water + sugar) < (anss + answ) * sugar)
                            answ = water, anss = sugar;
                    }
                }
            }
        }
    cout << answ + anss << " " << anss;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define UU(a,b,c) for(ll (a)=(b);(a)<=(c);(a)++)
#define DN(a,b,c) for(ll (a)=(b);(a)>(c);(a)--)
#define DU(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)
#define MOD 998244353

int n, DP[400005] = {0}, k;
pii segment[15];

void reset()
{
}

void input()
{
	cin>>n>>k;
	UU(i,1,k) cin>>segment[i].fi>>segment[i].se;
}

ll pref[400005] = {0};
void solve()
{
	ll ans = 0;
	DP[n] = 1;
	pref[n] = 1;
	DU(i,n - 1,1)
	{
		ll total = 0;
		UU(x,1,k)
		{
			total += pref[i + segment[x].fi];
			total -= pref[i + segment[x].se + 1];
			total %= MOD;
			while(total < 0) total += MOD;
		}
		
		DP[i] = total;
		pref[i] += total + pref[i + 1];
		pref[i] %= MOD;
	}
	
	cout<<DP[1] % MOD<<endl;
}

void LetsRock()
{
	solve();
}

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

		input();
		reset();
		LetsRock();
	
	return 0;
}

Measured memory_bytes: 5984
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    int r, g, b;
    cin >> r >> g >> b;
    if ((r*100 + g*10 + b)%4 == 0)cout << "YES" << endl;
    else cout <<"NO" << endl;
}

Measured memory_bytes: 384
inputs = STDIN.readlines.map{|line|line.strip.split()}
line = inputs.shift

n = line[0].to_i
v_list = inputs.shift
v_counts = [Hash.new(0), Hash.new(0)]
n.times do |i|
    v_counts[i % 2][v_list[i].to_i] += 1
end

sorted0 = v_counts[0].sort do |a, b|
    b[1] <=> a[1]
end
sorted1 = v_counts[1].sort do |a, b|
    b[1] <=> a[1]
end
whole = n >> 1
if sorted0[0][0] != sorted1[0][0] then
    puts(whole - sorted0[0][1] + whole - sorted1[0][1])
else
    if sorted0.size > 1 && sorted1.size > 1 then
        puts([
            whole - sorted0[0][1] + whole - sorted1[1][1],
            whole - sorted0[1][1] + whole - sorted1[0][1],
        ].min)
    elsif sorted0.size > 1 then
        puts(whole - sorted1[1][1])
    elsif sorted1.size > 1 then
        puts(whole - sorted1[0][1])
    else
        puts(whole)
    end
end

Measured memory_bytes: 20164
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

N = int(input())
D = input().split(" ")
M = int(input())
T = input().split(" ")


if len(D) < len(T):
	print("NO")
	exit(0)

D.sort()
T.sort()

i = 0
j = 0

while True:
	if i > M-1:
		print("YES")
		break

	elif D[j] == T[i] :
		i += 1
		j += 1

	else:
		j += 1

		if j > N - 1:
			print("NO")
			break

		elif D[j] > T[i]:
			print("NO")
			break


Measured memory_bytes: 35708
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto A = new long[](N);
    foreach (i; 0 .. N)
    {
        A[i] = lread();
    }
    if (A[0] != 0)
    {
        writeln(-1);
        return;
    }
    long ans;
    foreach_reverse (i; 1 .. N)
    {
        long diff = A[i] - A[i - 1];
        if (diff == 1)
        {
            ans++;
            continue;
        }
        if (1 < diff)
        {
            writeln(-1);
            return;
        }
        ans += A[i];
    }
    writeln(ans);
}


Measured memory_bytes: 4860
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define mod 1000000007
#define fastio std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define deb(x) cout<<#x<<" "<<x<<endl;

int main()
{
	fastio;
	ll n;
	cin>>n;
	ll arr[n];
	for (ll i = 0; i < n; i++) {
		cin>>arr[i];
	}

	ll count = 0;
	ll max_count = 0;
	for (ll i = 0; i < n-1; i++) {
		if(arr[i] < arr[i+1]) count = 0;
		else count++;
		max_count = max(count,max_count);
	}
	std::cout << max_count << '\n';
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;

int main(){
	int A,B,K;
	cin>>A>>B>>K;
	for(int i=100;i>0;i--){
		if(A%i==0&&B%i==0){
			K--;
			if(K==0)cout<<i<<endl;
		}
	}
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def solve():
    X, Y = MI()

    for a in range(0, X+1):
        b = X - a
        if a * 2 + b * 4 == Y:
            print('Yes')
            return
    print('No')

if __name__ == '__main__':
    solve()


Measured memory_bytes: 9180
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;
    rep(i, 3){
        cout << s[i];
    }
    cout << endl;
}
   

Measured memory_bytes: 3600
import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
 
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())
def rec(h, w): return [[0] * w for i in range(h)] 

h, w, k = I()
board = []

for _ in range(h):
  s = S()
  board.append([1 if x == '#' else 0 for x in s])

ans = 0
for i in range(2 ** (h + w)):
  b = bin(i)[2:].zfill(h+w)
  s = np.sum([int(b[x // w]) * int(b[h + (x % w)]) * board[x // w][x % w] for x in range(h*w)])
  if s == k:
    ans += 1
  
print(ans)

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

using namespace std;

bool check(const int K, const string& S) {
  const int N = S.size();
  int flip = 0;
  for (int i = 0; i <= N-K; i++) {
    int num = S[i] - '0';
    if ((num ^ flip) != 0) {
      flip ^= 1;
    }
  }
  for (int i = N-K+1; i <= K-1; i++) {
    int num = S[i] - '0';
    if ((num ^ flip) != 0) return false;
  }
  return true;
}

int main() {
  string S;
  cin >> S;
  int low = 0, high = S.size() + 1;
  while (high - low > 1) {
    const int med = (low + high) / 2;
    if (check(med, S)) {
      low = med;
    } else {
      high = med;
    }
  }
  cout << low << endl;
  return 0;
}


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

int main() {
  int q,w,e,r; cin>>q>>w>>e>>r;
  if(q+w<e+r)cout << "Right";
  if(q+w==e+r)cout << "Balanced";
  if(q+w>e+r)cout << "Left";
}

Measured memory_bytes: 3636
#include<stdio.h>
int main(){
    int H,W,i,j,num;
    scanf("%d %d",&H,&W);
    char S[H][W+1];
    for(i=0;i<H;i++){
        scanf("%s",S[i]);
    }
    for(i=0;i<H;i++){
        for(j=0;j<W;j++){
            if(S[i][j]=='.'){
                num=0;
                if(i>0){
                    if(j>0){
                        if(S[i-1][j-1]=='#'){num++;}
                    }
                        if(S[i-1][j]=='#'){num++;}
                    if(j<W-1){
                        if(S[i-1][j+1]=='#'){num++;}
                    }
                }
                if(j>0){
                        if(S[i][j-1]=='#'){num++;}
                }
                if(j<W-1){
                        if(S[i][j+1]=='#'){num++;}
                }
                if(i<H-1){
                    if(j>0){
                        if(S[i+1][j-1]=='#'){num++;}
                    }
                        if(S[i+1][j]=='#'){num++;}
                    if(j<W-1){
                        if(S[i+1][j+1]=='#'){num++;}
                    }
                }
                S[i][j]='0'+num;
            }
        }
    }
    for(i=0;i<H;i++){
        printf("%s\n",S[i]);
    }
    return 0;
}

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

#define INF INT_MAX/2
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long;

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

   int N,Q;
   cin>>N>>Q;
   vector<ll>a(N),x(Q);
   for(int i=0;i<N;i++)cin>>a[i];
   for(int i=0;i<Q;i++)cin>>x[i];
   for(int i=0;i<Q;i++){
      ll res = 0;
      ll right = 0;
      ll sum = 0;
      for(int left=0;left<N;left++){
         while(sum+a[right] <= x[i] && right < N){
            sum += a[right];
            right++;
         }
         res += right - left;

         if(right == left) right++;
         else sum -= a[left];
      }
      cout<<res<<endl;
   }
   return 0; 
}



Measured memory_bytes: 3544
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Arrays;
import java.util.Collection;
import java.util.Scanner;
import java.util.Deque;
import java.util.ArrayDeque;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DDoubleDots solver = new DDoubleDots();
        solver.solve(1, in, out);
        out.close();
    }

    static class DDoubleDots {
        private static final int INF = 1 << 30;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int m = Integer.parseInt(in.next());
            int ans = 0;

            List<Integer> g[] = new ArrayList[n];
            for (int i = 0; i < n; i++) {
                g[i] = new ArrayList<>();
            }
            for (int i = 0; i < m; i++) {
                int a = Integer.parseInt(in.next()) - 1;
                int b = Integer.parseInt(in.next()) - 1;
                g[a].add(b);
                g[b].add(a);
            }
            int[] dist = new int[n];
            Arrays.fill(dist, INF);
            int[] before = new int[n];
            Arrays.fill(before, -1);

            Deque<Integer> q = new ArrayDeque<>();
            q.add(0);
            dist[0] = 0;
            while (!q.isEmpty()) {
                int now = q.poll();
                for (int to : g[now]) {
                    if (dist[to] != INF) continue;
                    dist[to] = dist[now] + 1;
                    before[to] = now;
                    q.add(to);
                }
            }
            for (int i = 1; i < n; i++) {
                if (before[i] == -1) {
                    out.println("No");
                    return;
                }
            }
            out.println("Yes");
            for (int i = 1; i < n; i++) {
                out.println(before[i] + 1);
            }
        }

    }
}



Measured memory_bytes: 76792
fun main(args:Array<String>) {
    val (n, y) = readLine()!!.split(" ").map(String::toInt)

    for(i in 0..n) {
        for(j in 0..n-i) {
            for(k in 0..n-i-j) {
                if(1000*i + 5000*j + 10000*k == y && i+j+k == n) {
                    println("$k $j $i")
                    return
                }
            }
        }
    }

    println("-1 -1 -1")
}

Measured memory_bytes: 37960
#include <iostream>

using namespace std;

int main()
{
    int a , b , max = -100;
    cin >> a >> b;
    if (max <= a * b){
        max = a * b;
    }
    if (max <= a + b){
        max = a + b;
    }
    if (max <= a - b){
        max = a - b;
    }
    cout << max;
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N; cin >> N;
  int s[2]{};
  vector<int> as(N); for (auto &a : as) cin >> a; sort(as.rbegin(), as.rend());
  for (int i = 0; i < N; ++i) s[i % 2] += as[i];
  cout << s[0] - s[1] << endl;}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)
#define FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
//#define IN(a, x, b) (a<=x && x<b)
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;}
template<class T>istream&operator >>(istream&is,vector<T>&vec){for(T&x:vec)is>>x;return is;}
template<class T>inline void IN(T&t){cin>>t;}
template<class T,class... Ts>inline void IN(T&t,Ts&...ts){cin>>t;IN(ts...);}
template<class T>inline void OUT(T t){cout<<t<<"\n";}
template<class T,class... Ts>inline void OUT(T&t,Ts&... ts){cout<<t<<" ";OUT(ts...);}
template<typename T=int>vector<T>mv(size_t a){return vector<T>(a);}
template<typename T=int,typename... Ts>auto mv(size_t a,Ts... ts){return vector<decltype(mv<T>(ts...))>(a,mv<T>(ts...));}
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type FILL(T&t,const V&v){t=v;}
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type FILL(T&t,const V&v){for(auto &e:t)FILL(e,v);}
constexpr long long INF = 1e18;

signed main(){
	int n,k;
	IN(n,k);
	auto a = mv<pair<int,int>>(n);
	REP(i,n)cin>>a[i].first;
	REP(i,n)a[i].second=i;
	REP(i,n)a[i].first-=k;
	REP(i,n-1)a[i+1].first+=a[i].first;
	tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>t;
	int ans = 0;
	t.insert({0,-1});
	REP(i,n){
		int k = t.order_of_key({a[i].first+1,a[i].second});
		ans += k;
		t.insert(a[i]);
	}
	OUT(ans);
}


Measured memory_bytes: 10768
#include <iostream>
using namespace std;
#include<bits/stdc++.h>
typedef long long ll;
#define int long long
#define ff first
#define ss second
#define md 1000000007
#define md1 998244353
#define pb push_back
#define in insert
#define mkp make_pair
#define f(i,yha,wha) for(ll i=yha;i<wha;i++)
#define rf(i,wha,yha) for(ll i=wha;i>=yha;i--)
#define f0(n) for(ll i=0;i<n;i++)
#define f1(n) for(ll i=1;i<=n;i++)
#define fg(i,yha,wha,gap) for(ll i=yha;i<wha;i+=gap)
#define mpll map<ll,ll>
#define len(p) (ll)p.size()
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define mem(a,t) memset(a,t,sizeof(a))
#define endl "\n"
#define ar array
#define vl vector<ll>
#define vpll vector<pair<ll,ll>>


void flash()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const ll N=2e5+10;

void solve()
{
 ll n,k;
 cin>>n>>k;
 ll ans=0;
 f(i,k,n+2)
 {
 	ll mn=(i*(i-1))/2;
 	ll mx=(n*(n+1))/2;
 	ll tp=n-i;
 	mx=mx-(tp*(tp+1))/2;
 	ans=(ans+(mx-mn+1))%md;
// 	cout<<mn<<" "<<mx<<" "<<tp<<" "<<ans<<endl;
 }
 cout<<ans;
	   
}


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

Measured memory_bytes: 3640
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int h=sc.nextInt(),w=sc.nextInt();
        int n=sc.nextInt();
        int sq = h*w;
        int m = Math.max(h,w);
        int ans;
        if(n%m==0)ans = n/m;
        else ans = n/m+1;
        System.out.println(ans);


    }
}


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

typedef long long LL;

LL N;

vector<int> Ans;
vector<int>::iterator it;

int main(){
	int i,j,now;
	scanf("%lld",&N);
	for(i=39;~N>>i&1;i--);
	for(j=1;j<=i;j++)
		Ans.push_back(j);
	for(j=1;j<=i;j++)
		Ans.push_back(j);
	Ans.push_back(i+1);
	Ans.push_back(i+1);
	now=i+1;
	for(i--;~i;i--)
		if(N>>i&1){
			it=find(Ans.begin(),Ans.end(),Ans[i]);
			Ans.insert(it,now+1);
			it=find(Ans.begin(),Ans.end(),Ans[now<<1]);
			Ans.insert(it,now+1);
			now++;
		}
	printf("%d\n",Ans.size());
	for(i=0;i<Ans.size();i++)
		printf("%d ",Ans[i]);
	return 0;
}

Measured memory_bytes: 256
a= [[False]*13 for i in range(4)]
n = int(input())

for i in range(n):
    SHCD,NUMBER = map(str,input().split())
    if SHCD == "S":
        a[0][int(NUMBER)-1] = True
    if SHCD == "H":
        a[1][int(NUMBER)-1] = True
    if SHCD == "C":
        a[2][int(NUMBER)-1] = True
    if SHCD == "D":
        a[3][int(NUMBER)-1] = True

for i in range(4):
    for j in range(13):
        if not a[i][j]:
            if i == 0:
                print("S",j+1)
            if i == 1:
                print("H",j+1)
            if i == 2:
                print("C",j+1)
            if i == 3:
                print("D",j+1)


Measured memory_bytes: 5612
import java.util.*;

public class Main {
    public static void main(String[] args) {
        // Your code here!
    Scanner sc = new Scanner(System.in);
    
    String s = sc.next();
    
        for(int i=0;i<s.length();i++){
            for(int j=i+1;j<s.length();j++){
                if(s.charAt(i) == s.charAt(j)){
                    System.out.println("no");
                    return;
                }
            }
        }
        System.out.println("yes");
    
    }
}

Measured memory_bytes: 35496
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
signed main(){
	int a,b;
	cin>>a>>b;
	int ans=0;
	int z=a;
	while(z<=b){
		z*=2;
		ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
//██████╗ ██╗   ██╗██╗      ██████╗ ███████╗
//██╔══██╗██║   ██║██║      ██╔══██╗██╔════╝
//██████╔╝██║   ██║██║█████╗██║  ██║█████╗
//██╔══██╗██║   ██║██║╚════╝██║  ██║██╔══╝
//██║  ██║╚██████╔╝██║      ██████╔╝███████╗
//╚═╝  ╚═╝ ╚═════╝ ╚═╝      ╚═════╝ ╚══════╝
#include <iostream>
#include <random>
#include <vector>
#include <set>
#include <algorithm>
#include <iomanip>
#include <chrono>
#include <cstdio>


// #pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;

#define fst first
#define snd second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back

#define all(v) (v).begin(), (v).end()
#define sz(v) ((int)(v).size())
#define sqr(x) ((x) * (x))

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;

#define next ajksdslk
#define prev aklsfjk

mt19937_64 mt_rand(chrono::system_clock::now().time_since_epoch().count());

template<typename T1, typename T2> inline bool upmax(T1& a, T2 b) { return (a < b ? (a = b, true) : false); }
template<typename T1, typename T2> inline bool upmin(T1& a, T2 b) { return (b < a ? (a = b, true) : false); }

const int maxn = (int) 1e6 + 100;
const int maxlog = 21;
const int base = 1e9 + 7;
const ld eps = (ld) 1e-9;
const ld PI = acos(-1.);
//const int pp = 41;
const int inf = 2e9;
const ll llinf = 1e18;



int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#ifdef LOCAL
  freopen ("input.txt", "r", stdin);
#endif

  int n; cin >> n;
    cout << n * n ;
  return 0;
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;

constexpr int MOD = 1000000007;

// Data structures.
struct Point {
    double x, y;
    Point(double x = 0, double y = 0) : x(x), y(y) {}
    Point(const Point& p) : x(p.x), y(p.y) {}

    Point operator+(const Point& p) const { return Point(x + p.x, y + p.y); }
    Point operator-(const Point& p) const { return Point(x - p.x, y - p.y); }
    Point operator*(double k) const { return Point(k * x, k * y); }
    Point operator/(double k) const { return Point(x / k, y / k); }

    bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; }
    bool operator==(const Point& p) const { return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS; }

    static double norm(const Point& p) { return sqrt(p.x * p.x + p.y * p.y); }
    static double dot(const Point& p1, const Point& p2) { return p1.x * p2.x + p1.y * p2.y; }
    static double cross(const Point& p1, const Point& p2) { return p1.x * p2.y - p1.y * p2.x; }
};
struct Segment {
    Point s, t;
    Segment(const Point& s, const Point& t) : s(s), t(t) {}
    Segment(const Segment& seg) : s(seg.s), t(seg.t) {}
};

typedef vector<Point> Polygon;

int ccw(const Point& p0, const Point& p1, const Point& p2) {
    double cr = Point::cross(p1 - p0, p2 - p0);
    if (cr > EPS) { return 1; }
    if (cr < -EPS || fabs(cr) < EPS) { return -1; }
    if (Point::dot(p1 - p0, p2 - p0) < -EPS) { return 2; }
    if (Point::dot(p2 - p1, p0 - p1) < -EPS) { return -2; }
    return 0;
}

Polygon andrew(Polygon poly) {
    int n = poly.size();
    if (n < 3) { return poly; }

    // Sort.
    sort(poly.begin(), poly.end(),
         [](const Point& p1, const Point& p2) -> bool { return p1.y != p2.y ? p1.y < p2.y : p1.x < p2.x; });

    // Upper part.
    Polygon U = {poly[0], poly[1]};
    rep(i, 2, n) {
        int j = U.size();
        while (j >= 2 && ccw(U[j - 2], U[j - 1], poly[i]) != -1) {
            U.pop_back();
            --j;
        }
        U.push_back(poly[i]);
    }

    // Lower part.
    Polygon L = {poly[n - 1], poly[n - 2]};
    rrep(i, 0, n - 2) {
        int j = L.size();
        while (j >= 2 && ccw(L[j - 2], L[j - 1], poly[i]) != -1) {
            L.pop_back();
            --j;
        }
        L.push_back(poly[i]);
    }

    reverse(L.begin(), L.end());
    rrep(i, 1, U.size() - 1) { L.push_back(U[i]); }

    return L;
}

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

    int n;
    cin >> n;

    Polygon poly(n);
    rep(i, 0, n) { cin >> poly[i].x >> poly[i].y; }

    Polygon ans = andrew(poly);
    cout << ans.size() << endl;
    rep(i, 0, ans.size()) { cout << ans[i].x << " " << ans[i].y << endl; }

    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll M1, D1;
    ll M2, D2;
    cin >> M1 >> D1;
    cin >> M2 >> D2;
    cout << (D1 > D2) << endl;
    return 0;
}


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

typedef long long ll;
ll N;
int ans = 0;

void check357(ll n, int num3, int num5, int num7) {
    if (n > N){
        return;
    }
    
    if (num3 > 0 && num5 > 0 && num7 > 0) ans++;

    check357(n * 10 + 3, num3 + 1, num5, num7);
    check357(n * 10 + 5, num3, num5 + 1, num7);
    check357(n * 10 + 7, num3, num5, num7 + 1);

}


signed main() {

cin >> N;
check357(0, 0, 0, 0);
cout << ans << endl;

}

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

int main(){
    int N;
    cin >> N;
    vector<char> S(N);
    int64_t count_R = 0, count_G = 0, count_B = 0;
    for (int i = 0; i < N; i++){
        cin >> S.at(i);
        if (S.at(i) == 'R') count_R ++;
        else if (S.at(i) == 'G') count_G ++;
        else if (S.at(i) == 'B') count_B ++;
    }
    int64_t ans;
    int64_t decount = 0;
    if (N > 2){
        for (int i = 0; i < N - 2; i++){
            for(int j = i + 1; j < N - 1; j++){
                if ((2 * j - i >= 0) && (2 * j - i < N) ){
                    //cout << "i " << i << " j " << j << " k " << 2*j - i << endl;
                    if ((S.at(i) != S.at(j)) && (S.at(i) != S.at(2 * j - i)) && (S.at(j) != S.at(2 * j - i))){
                        decount++;
                    }
                    else{
                        continue;
                    }
                }
                else{
                    continue;
                }
            }
        }
        ans = count_R * count_G * count_B - decount;
        //cout << count_R << " " << count_G << " " << count_B << " " << decount << endl;
    }
    else{
        ans = 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
while True:
    n,x = map(int, input().split())
    
    if n == x == 0:
        break
    
    count = 0
    
    for i in range(1,int(x/3)+1):
        for j in range(i+1, int((x-i)/2)+1):
            k = x - (i + j)
            if j < k <= n:
                count += 1
                
    print(count)



Measured memory_bytes: 5596
N = int(input())
x, y = (
    zip(*(map(int, input().split()) for _ in range(N))) if N else
    ((), ())
)

class UnionFindTree:
    def __init__(self, n):
        self.p = [i for i in range(n + 1)]
        self.r = [0 for _ in range(n + 1)]

    def find(self, x):
        if self.p[x] != x:
            self.p[x] = self.find(self.p[x])
        return self.p[x]

    def union(self, x, y):
        px = self.find(x)
        py = self.find(y)
        if px != py:
            if self.r[px] < self.r[py]:
                self.p[px] = py
            else:
                self.p[py] = px
                if self.r[px] == self.r[py]:
                    self.r[px] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)


ans = 10**10

for i in range(N):
    for j in range(N):
        p, q = (x[i] - x[j], y[i] - y[j])
        uft = UnionFindTree(N)
        for u in range(N - 1):
            for v in range(u + 1, N):
                if (x[u] - x[v], y[u] - y[v]) == (p, q) or (x[u] - x[v], y[u] - y[v]) == (-p, -q):
                    uft.union(u, v)
        ans = min(ans, len({uft.find(z) for z in range(N)}))

print(ans)


Measured memory_bytes: 62940
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX

vector<vi> q;
int ans[200001] = {0};
int a[200001];

void s1(int i, vi& c, int p)
{

    bool f = 0;
    bool f1 = 0;
    int in,v;
    if(c.size()==0)
        c.pb(a[0]), ans[i] = 1, f1 = 1;
    else
    {
        int x = lower_bound(c.begin(), c.end(), a[i])-c.begin();
        if(x==c.size())
        {
            c.pb(a[i]);
            f1 = 1;
        }
        else
        {
            f = 1;
            in = x, v = c[x];
            c[x] = a[i];
        }
        ans[i] = c.size();
    }

    loop(q[i])
    {
        if(it!=p)
            s1(it,c,i);
    }

    if(f)
        c[in] = v;
    if(f1)
        c.pop_back();
}

void solve()
{
   int n;
   cin >> n;
   q.rs(n);
   inp(a, n);
   rep(i,0,n-2)
   {
     int l,r;
     cin >> l >> r;
     l--, r--;
     q[l].pb(r);
     q[r].pb(l);
   }

   vi curr;
   s1(0,curr,-1);
   rep(i,0,n-1)
    cout << ans[i] << endl;



}


signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 34436