akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

template<class T> class rollinghash {
	const ull mask30 = (1LL << 30) - 1;
	const ull mask31 = (1LL << 31) - 1;
	const ull mod61 = (1LL << 61) - 1;
	vector<ull> base;
	vector<vector<ull>> hashvalue, basepower;
	int length;
	ull multiply(ull a, ull b) {
		ull au = a >> 31; ull ad = a & mask31;
		ull bu = b >> 31; ull bd = b & mask31;
		ull mid = ad * bu + au * bd;
		ull midu = mid >> 30; ull midd = mid & mask30;
		return au * bu * 2 + midu + (midd << 31) + ad * bd;
	}
	ull modulo(ull a) {
		ull au = a >> 61; ull ad = a & mod61;
		ull res = au + ad; if (res >= mod61) res -= mod61;
		return res;
	}
public:
	rollinghash(T s) {
		length = s.size();
		base = { 200015 };
		hashvalue = vector<vector<ull>>(length + 1, vector<ull>(1));
		for (int j = 0; j < 1; j++) {
			for (int i = 0; i < length; i++) {
				hashvalue[i + 1][j] = modulo(multiply(hashvalue[i][j], base[j]) + s[i]);
			}
		}
		basepower = vector<vector<ull>>(length + 1, vector<ull>(1));
		for (int j = 0; j < 1; j++) {
			basepower[0][j] = 1;
			for (int i = 1; i <= length; i++) {
				basepower[i][j] = modulo(multiply(basepower[i - 1][j], base[j]));
			}
		}
	}
	ull hash(ll l, ll r, ll i) {
		assert(l < r && 0 <= l && l < length && 0 < r && r <= length);
		return modulo(hashvalue[r][i] + mod61 * 3 - multiply(hashvalue[l][i], basepower[r - l][i]));
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n;
	cin >> n;
	string s;
	cin >> s;
	rollinghash<string> rol(s);
	int ans = 0;
	rep(i, n) {
		for (int j = i + 1; j < n; j++) {
			int ok = 0, ng = j - i + 1;
			while (ng - ok > 1) {
				int mid = (ok + ng) / 2;
				bool flag = true;
				rep(k, 1) {
					if (j + mid > n || rol.hash(i, i + mid, k) != rol.hash(j, j + mid, k)) flag = false;
				}
				if (flag) ok = mid;
				else ng = mid;
			}
			chmax(ans, ok);
		}
	}
	cout << ans << '\n';
}

Measured memory_bytes: 768
/*pata hai na?*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

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

//#define     int          long long int
#define     ld           long double
#define     fast()       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)       x.begin(),x.end()
#define     mem(a,b)     memset(a,b,sizeof(a))
#define     gcd(a,b)     (__gcd((a),(b)))
#define     lcm(a,b)     (((a)*(b))/gcd((a),(b)))
#define     pb           push_back
#define     ins          insert
#define     pii          pair<int,int>
#define     F            first
#define     S            second
#define     makep        make_pair
#define     maket        make_tuple
#define     show(x)      for(auto c:x)cout<<c<<" ";cout<<"\n";
#define     show2(x)     for(auto c:x)cout<<c.F<<" "<<c.S<<"\n";

const ld pi=acos(-1);
//const int inf=1e18,M=1e9+7;
const int N=2e4+5;

set<int> st[26];

int type[N],x[N],l[N],r[N];
char ch[N];

void solve()
{
    int n;
    cin>>n;

    string s;
    cin>>s;

    int q;
    cin>>q;

    for(int i=0;i<q;++i)
    {
        cin>>type[i];

        if(type[i]==1)
            cin>>x[i]>>ch[i];
        else
            cin>>l[i]>>r[i];
    }

    for(int i=0;i<26;++i)
        st[i].insert(n+1);

    for(int i=0;i<n;++i)
        st[s[i]-'a'].insert(i+1);

    int cnt=0;
    for(int i=0;i<q;++i)
    {
        if(type[i]==1)
        {
            st[s[x[i]-1]-'a'].erase(x[i]);
            st[ch[i]-'a'].insert(x[i]);
            s[x[i]-1]=ch[i];
        }
        else
        {
            cnt=0;
            for(int j=0;j<26;++j)
            {
                auto it=st[j].lower_bound(l[i]);
                if(*it<=r[i])
                    ++cnt;
            }

            cout<<cnt<<"\n";
        }
    }
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}




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

class ArgSort{
public:
  //complex<T>(x, y)またはpair<T, T>(x, y)の入力に対して偏角ソートする。
  template<typename T>
  static vector<pair<T, T> > Sort(vector<pair<T, T> > A){
    sort(A.begin(), A.end(), [&](const auto &p1,const auto &p2){
        return atan2(p1.second, p1.first) < atan2(p2.second, p2.first);
      });
    return A;
  }

  template<typename T>
  static vector<complex<T> > Sort(vector<complex<T> > A){
    sort(A.begin(), A.end(), [&](const auto &p1,const auto &p2){
        return atan2(p1.imag(), p1.real()) < atan2(p2.imag(), p2.real());
      });
    return A;
  }
};

void ABC139_F_pair(){
  using Int = long long;
  using Double = long double;
  using P = pair<Int, Int>;

  Int N;
  cin>>N;
  vector<P> A(N);
  for(int i=0;i<N;i++){
    int x, y;
    cin>>x>>y;
    A[i] = P(x, y);
  }

  A = ArgSort::Sort(A);

  Int ans = 0;
  for(Int i=0;i<N;i++)
    for(Int j=0;j<N;j++){
      Int idx = i;
      Int x = 0, y = 0;
      while(1){
        x += A[idx].first;
        y += A[idx].second;
        ans = max(ans, x * x + y * y);
        if(idx == j) break;
        idx = (idx + 1)%N;
      }
    }
  cout << fixed << setprecision(12);
  cout<<sqrt((Double)ans)<<endl;


}
void ABC139_F_complex(){
  using Int = long long;
  using Double = long double;
  using P = complex<Int>;

  Int N;
  cin>>N;
  vector<P> A(N);
  for(int i=0;i<N;i++){
    int x, y;
    cin>>x>>y;
    A[i] = P(x, y);
  }

  A = ArgSort::Sort(A);

  Int ans = 0;
  for(Int i=0;i<N;i++)
    for(Int j=0;j<N;j++){
      Int idx = i;
      Int x = 0, y = 0;
      while(1){
        x += A[idx].real();
        y += A[idx].imag();
        ans = max(ans, x * x + y * y);
        if(idx == j) break;
        idx = (idx + 1)%N;
      }
    }
  cout << fixed << setprecision(12);
  cout<<sqrt((Double)ans)<<endl;
}

signed main(){

  ABC139_F_complex();
  //ABC139_F_pair();

  return 0;
}


Measured memory_bytes: 640
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

ll gcd(ll a, ll b) {
    if(b == 0) return a;
    return gcd(b, a%b);
}

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#ifdef LOCAL
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N, K;
    cin >> N >> K;

    ll v[N];
    REP(i, N) cin >> v[i];

    ll ans = 0;
    REP(l, N) {
        REP(r, N-l+1) {
            if (l + r > K) continue;

            vector<ll> vv(l + r);
            copy(v, v+l, vv.begin());
            copy(v + N - r, v + N, vv.begin() + l);

            sort(vv.begin(), vv.end(), less<ll>());
          
            ll a = 0;
            int cnt = l + r;
            REP(i, vv.size()) {
                if (vv[i] < 0 && cnt < K) {
                    ++cnt;
                    continue;
                }
                a += vv[i];
            }

            ans = max(ans, a);
        }
    }

    cout << ans << endl;
    
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    map<ll,ll> mp;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        mp[a]++;
        mp[b]++;
    }
    rep2(i,1,n+1){
        if(mp[i]%2==1){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}

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

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

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


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

  int d[300];

  int ans = 0;
  for (int i = 1; i <= n; i += 2) {
    REP (m, n + 1) d[m] = 0;
    int cnt = 1;
    int x = i;
    int j = 2;
    while(x > 1) {
      if (x % j == 0) {
        d[j]++;
        x /= j;
        continue;
      }
      j++;
    }
    REP (k, n + 1) {
      cnt *= d[k] + 1;
    }
    if (cnt == 8) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
 
int main() {
    ll n;
    cin>>n;
    ll ans=n;

    for(ll i=1;i*i<=n;i++) {
        if(n%i==0)  ans=min(ans,i+(n/i)-2);
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define stdi(in) freopen(in, "r", stdin)
#define stdo(out) freopen(out, "w", stdout)
#define stdio(in, out) stdi(in); stdo(out)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define MAX 100007
#define MOD 1000000007
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define ordered_set tree<int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

ll arr[102],n,k;
//ll dp[102][MAX];
ll presum[2][MAX];

int main(){
    /*#ifndef ONLINE_JUDGE
        stdio("in", "out");
    #endif*/
    fast;
    cin>>n>>k;

    for(int i=1;i<=n;i++){
    	cin>>arr[i];
    }

    if(k==0){
    	cout<<1<<'\n';
    	return 0;
    }

    /*for(int i=0;i<=n;i++){
    	dp[i][0] = 1;
    }*/

    ll ans = 0;int ii=1;
    for(int i=1;i<=k;i++){
    	ans = 0;
    	if(arr[1]>=i){
	    	ans = 1;
	    }
    	presum[0][i] = presum[0][i-1]+ans;
    }

    for(int i=2;i<=n;i++){
    	for(int j=1;j<=k;j++){
    		ans = presum[(ii+1)%2][j]-presum[(ii+1)%2][max(j-arr[i]-1, 0LL)];
    		if(arr[i]>=j) ans++;
    		if(ans<0) ans+=MOD;
    		presum[ii][j] = (presum[ii][j-1]+ans)%MOD;
    	}

    	ii = (ii+1)%2;
    }

    cout<<ans<<'\n';


    return 0;   
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
int func(const void *a, const void *b){
  return *(int*)b - *(int*)a;
}
int main(void){
  int a[3];
  scanf("%d %d %d", &a[0], &a[1], &a[2]);
  qsort(a, 3, sizeof(int), func);
  printf("%d\n", a[0] * 10 + a[1] + a[2]);
  return 5 - 5;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll            long long
#define pb            emplace_back
#define fi            first
#define se            second
#define mp            make_pair
//#define int           int64_t

using namespace std;

typedef pair<ll, int> pii;
const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;

int st[N << 2], lz[N << 2], l[N << 2], h[N << 2];
int n, m, lef, rig, res, cnt, pos;
vector<int> p[N];

void build(int x, int low, int high) {
    l[x] = low, h[x] = high;
    if(low == high) {
        st[x] = low - m - 1;
        return;
    }
    int mid = (low + high) >> 1;
    build(x << 1, low, mid);
    build(x << 1 | 1, mid + 1, high);
    st[x] = max(st[x << 1], st[x << 1 | 1]);
}

inline void change(int x, int v) {
    st[x] += v, lz[x] += v;
}

void down(int x) {
    if(lz[x] == 0 || l[x] == h[x]) return;
    change(x << 1, lz[x]); change(x << 1 | 1, lz[x]);
    lz[x] = 0;
}

void upd(int x, int low, int high, int val) {
    down(x);
    if(l[x] > high || h[x] < low) return;
    if(l[x] >= low && h[x] <= high) {
        st[x] += val; lz[x] += val; return;
    }
    upd(x << 1, low, high, val);
    upd(x << 1 | 1, low, high, val);
    st[x] = max(st[x << 1], st[x << 1 | 1]);
}

int get(int x, int low, int high) {
    down(x);
    if(l[x] > high || h[x] < low) return -inf;
    if(low <= l[x] && h[x] <= high) return st[x];
    return max(get(x << 1, low, high), get(x << 1 | 1, low, high));
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #define FileName      "test"
    if(fopen(FileName".inp", "r")) {
       freopen(FileName".inp", "r", stdin);
       freopen(FileName".out", "w", stdout);
    }
    cin >> n >> m;
    for(int i = 1; i <= n; ++i) {
        cin >> lef >> rig;
        p[lef].pb(rig);
    }
    res = max(0, n - m); build(1, 0, m + 1);
    for(int i = 0; i <= m; ++i) {
        sort(p[i].begin(), p[i].end(), greater<int>());
        for(int j: p[i]) {
            upd(1, 0, j, 1);
        }
        res = max(res, get(1, i + 1, m + 1) - i);
//        for(int j = 0; j <= m + 1; ++j) cout << setw(3) << get(1, j, j);
//        cout << '\n';
    }
    cout << abs(res);
}


Measured memory_bytes: 20224
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++) 
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
	string S;
	int N;
	multimap<int, string> mp;
	while( cin >> S >> N )
	{
		mp.emplace( make_pair( N, S ) );
	}
	multimap<string, int> mp2;
	for( auto &x: mp ){
		mp2.emplace( make_pair( x.second, x.first ) );
	}
	string tmp;
	for( auto x : mp2 )
	{
		if( x.first == tmp )cout << " ";
		if( x.first != tmp )
		{
			if( !tmp.empty() )
			{
				cout << endl;
			}
			tmp = x.first;
			cout << x.first << endl;
		}
		cout << x.second;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3224
n=input('')
a=input('')
n=int(n)

a=a.split(' ')

for b in range(n):
    a[b]=int(a[b])

d=0
for c in a:
    if c%2==1:
        d=d+1
    elif c%2==0:
        if c%3==0 or c%5==0:
            d=d+1
        else:
            d=d+0

if d==n:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<ll, II> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 400010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int a, b;
    cin >> a >> b;
    cout << (a * 3 + b) / 2;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

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

/*-------------------------------------------*/

ll calc1(int n, V<ll> x, V<ll> y) {
    rep(i, n) if(x[i] > y[i]) swap(x[i], y[i]);
    sort(ALL(x));
    sort(ALL(y));
    return (x.back() - x.front()) * (y.back() - y.front());
}

ll calc2(int n, V<ll> x, V<ll> y) {
    using P = array<ll, 2>;
    V<P> v;
    ll mn = inf, mx = -inf;
    multiset<ll> st;
    rep(i, n) {
        if(x[i] > y[i]) swap(x[i], y[i]);
        v.push_back(P{x[i], y[i]});
        chmin(mn, x[i]);
        chmax(mx, y[i]);
        st.insert(x[i]);
    }
    sort(ALL(v));
    ll ret = (mx - mn) * (*st.rbegin() - *st.begin());
    rep(i, n) {
        st.erase(st.find(v[i][0]));
        st.insert(v[i][1]);
        chmin(ret, (mx - mn) * (*st.rbegin() - *st.begin()));
    }
    return ret;
}

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

    int n;
    cin >> n;
    V<ll> x(n), y(n);
    rep(i, n) cin >> x[i] >> y[i];
    cout << min(calc1(n, x, y), calc2(n, x, y)) << endl;

    return 0;
}

Measured memory_bytes: 19692
#include<stdio.h>
int main()
{
	int a,b,c,d;
	int n,m;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(a*b>=c*d)
	printf("%d",a*b);
	else
	printf("%d",c*d);
	return 0;
 }

Measured memory_bytes: 760
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        
        Scanner scan = new Scanner(System.in);
        
        int a = scan.nextInt();
        int b = scan.nextInt();
        
        if(a > b){
            System.out.println("a > b");
        }else if(a < b){
            System.out.println("a < b");
        }else{
            System.out.println("a == b");
        }
        
    } 
    
}


Measured memory_bytes: 26256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>
using namespace std;
int main() {
	int a[10001];
	vector<int> num;
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(a, a + n);
	for (int i = 0; i < 10; ++i) {
		for (int j = 0; j < 10; ++j) {
			if (i == j)continue;
			num.push_back(stoi(to_string(a[i]) + to_string(a[j])));
		}
	}
	sort(num.begin(), num.end());
	cout << num[2] << endl;
	return 0;
}


Measured memory_bytes: 3308
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

  int n, a[21], b[21], c[21];
  cin >> n;
  for(int i=1; i<n+1; i++){
    cin >> a[i];
  }
  for(int i=1; i<n+1; i++){
    cin >> b[i];
  }
  for(int i=1; i<n; i++){
    cin >> c[i];
  }
  int ans=0;
  ans+=b[a[1]];
  int t=a[1];
  for(int i=2; i<n+1; i++){
    ans+=b[a[i]];
    if(a[i]-1==t){
      ans+=c[t];
    }
    t=a[i];
  }
  cout << ans << endl;

	return 0;
}

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

const int N = 55;

int n, m;
char s[N][N];
int d[4] = {1, 0, -1, 0};

bool valid(int a, int b) {
    return !(a < 0 or b < 0 or a >= n or b >= m);
}

int main() {
    cin >> n >> m;
    for (int i = 0; i < n; ++i) scanf("%s", s[i]);
    
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j) {
            if (s[i][j] == '.') continue;
            bool ok = false;
            for (int r = 0; r < 4; ++r) {
                int a = i + d[r];
                int b = j + d[r ^ 1];
                if (!valid(a, b)) continue;
                if (s[a][b] == '#') ok = true;
            }
            if (!ok) return !printf("No\n");
        }
    printf("Yes\n");
}

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

using namespace std;

int main(){
  int A1, A2, A3;
  cin >> A1 >> A2 >> A3;
  if(A1 + A2 + A3 >= 22) cout << "bust" << endl;
  else cout << "win" << endl;
  
  return 0;
}

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

int main(void){
  int N;
  std::cin >> N;
  int L[2*N];
  for(int i=0; i<2*N; i++){
    std::cin >> L[i];
  }
  std::sort(L, L+2*N);

  int result = 0;
  for(int i=0; i<2*N; i+=2){
    result+=L[i];
  }
  std::cout << result << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N=505;

int n,p[N<<1],len;
LL a[N][N];
bool b[10005];
LL gcd(LL x,LL y) { 
    return y == 0 ? x : gcd(y,x % y); 
}
int main(){
	scanf("%d",&n);
	if(n==2){
		puts("4 7");
		puts("23 10");
		return 0;
	}
	for(int i=0;i<=n+1;i++)
	for(int j=0;j<=n+1;j++)
		a[i][j]=1LL;
	for(int i=2;len<2*n;i++){
		if(!b[i])p[++len]=i;
		for(int j=1;j<=len&&p[j]*i<=10000;j++){
			b[p[j]*i]=1;
			if(i%p[j]==0)break;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if((i+j)%2==0)a[i][j]*=p[(i+j)>>1];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if((i+j)%2==0)a[i][j]*=p[((i-j+n+1)>>1)+n];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if((i+j)%2){
				LL u=a[i+1][j]/gcd(a[i+1][j],a[i][j+1])*a[i][j+1];
				LL v=a[i-1][j]/gcd(a[i-1][j],a[i][j-1])*a[i][j-1];
				a[i][j]=u/gcd(u,v)*v+1LL;
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			printf("%lld ",a[i][j]);
		}
		puts("");
	}
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long   ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ii, ll>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
#define tam 120000
#define offset 
const ll MOD= 1e9+7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int  main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int k,a,b;
    cin>>k>>a>>b;
    bool ok=0;
    forr(i,a,b+1)
    {
        if (i%k==0)
            ok=1;
    }
    if (ok)
        cout<<"OK\n";
    else
        cout<<"NG\n";
}
// PLUS ULTRA!
    


Measured memory_bytes: 3656
//**************************
//*** writer  :  Alan Hu **
//************************
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#include<queue>
#include<list>
#include<stack>
#include<cstdio>
#include<fstream>
#include<numeric>
#include<functional>
#include<utility>
#include<memory>
#include<cstring>
#include<cmath>

using namespace std;
     
#define CLEAN(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define pb push_back
#define rept(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
     
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

//classes:
int n,m,ans,t1,t2;
vector<pii> v;

//programs:
void inputs()
    {
     cin>>n>>m;
     for(int i=0;i<m;i++)
          {
           int x,y;
           cin>>x>>y;
           if(x>y) swap(x,y);
           v.push_back(make_pair(x,y));
          }
     sort(v.begin(),v.end());
    }

void solve()
    {
     t1=v[0].first;
     t2=v[0].second;
     for(int i=0;i<m-1;i++)
        {
         if(t1!=v[i+1].first) t1=v[i+1].first;
         if(t2>v[i+1].second) t2=v[i+1].second;
         if(t1>=t2) {
                     ans++;
                     //cout<<t1<<" "<<t2<<endl;
                     t1=v[i+1].first;
                     t2=v[i+1].second;
                    }
        }
    }
void outputs()
    {
     cout<<ans+1;
    }

int main()
{
	inputs();
	solve();
	outputs();
	return 0;
}

Measured memory_bytes: 1400
#include <stdio.h>

int main(void){
    int n,q,i,count,t;
    int min,max,mid;
    int s[100000];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&s[i]);
    }
    scanf("%d",&q);
    count = 0;
    for(i=0;i<q;i++){
        scanf("%d",&t);
        min=0;max=n-1;
        while(min<=max){
            mid = (min+max)/2;
            if(s[mid]==t){
                count++;
                break;
            }else if(s[mid]<t){
                min = mid+1;
            }else{
                max = mid-1;
            }
        }
    }
    printf("%d\n",count);
}




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


template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int N;
    cin >> N;
    cout << N/3 << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")

#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING

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


int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);

	int n;
	cin >> n;
	if (n % 1000 == 0) {
		cout << 0 << '\n';
	}
	else {
		cout << ((n / 1000) + 1) * 1000 - n << '\n';
	}

	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head
const int maxx=1e8+10;
int num[13][14],re[12];
int n,m,k,ans=maxx,cnt=0;
void dfs(int u,int cnt,int red[]){
	int flag=0;
	rep(i,0,m){
		if(red[i]<k){
			flag=1;
			break;
		}
	}
	if(flag==0){
		ans=min(ans,cnt);
		return ;
	}
	rep(i,u+1,n){
		dfs(i,cnt,red);//不选i
		rep(j,0,m){
			red[j]+=num[i][j+1];
		} 
		dfs(i,cnt+num[i][0],red);
		rep(j,0,m){
			red[j]-=num[i][j+1];
		} 
	}
} 
int main() {
	scanf("%d%d%d",&n,&m,&k);
	rep(i,0,n){
		rep(j,0,m+1){
			scanf("%d",&num[i][j]);
		}
	}
	rep(i,0,n){
		dfs(i,cnt,re);//不选i
		rep(j,0,m){
			re[j]+=num[i][j+1];
		} 
		dfs(i,cnt+num[i][0],re);
		rep(j,0,m){
			re[j]-=num[i][j+1];
		} 
	}
	if(ans==maxx)printf("-1");
	else cout<<ans<<endl;

} 

Measured memory_bytes: 3768
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define debug(x) cout<<x<<endl;
#define int ll
const ll INF = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 5;
 
int32_t main()
{
	#ifndef ONLINE_JUDGE
		freopen("a.in","r",stdin);
	#endif
	ios::sync_with_stdio(false);
 
 	int n,k;
 	cin>>n>>k;
 	vector<int> v(n);
 	for(int i=0;i<n;i++)
 		cin>>v[i];

 	vector<int> dp(n);
 	dp[0] = 0;

 	for(int i=1;i<n;i++)
 	{
 		dp[i] = dp[i-1] + abs(v[i]-v[i-1]);
 		for(int j=i-1;j>=i-k && j>=0;j--)
			dp[i] = min(dp[i], dp[j] + abs(v[i]-v[j]));
 	}
 
	cout<<dp[n-1]<<endl;
 
	return 0;
}

Measured memory_bytes: 4812
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<utility>
using namespace std;
 
typedef long long ll;



int main(){
  ll n,a=0,sz,u;
  cin >> n;
  string s="abcdefghij", t;
  queue<pair<int,string>> ans;
  ans.push(make_pair(1,"a"));
  for(int i=2; i<n+1;i++){//文字数
  	sz= ans.size();
    for(int j=0; j<sz; j++){//前の分
    	t=ans.front().second;
        u=ans.front().first;
        ans.pop();        
        for(int k=0;k<u+1;k++){
          	if(k<u){
                ans.push({u,t+s[k]});
            }else{
            	ans.push({u+1,t+s[k]});
            }
        }
    }
  }
  sz= ans.size();
  for(int i=0;i<sz; i++){
  	cout << ans.front().second << endl;
    ans.pop();
  }
}

Measured memory_bytes: 8832
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,pair<int,int>>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int mod_) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod_;
		}
		x = x * x % mod_;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
/*--------Library Zone!--------*/

int n, m;
bool ng[114514];
int dp[114514];
signed main() {
	cin >> n >> m;
	rep(i, m) {
		int a; cin >> a;
		ng[a] = 1;
	}
	dp[0] = 1;
	rep(i, n) {
		if (!ng[i + 1]) {
			dp[i + 1] += dp[i];
			dp[i + 1] %= mod;
		}
		if (!ng[i + 2]) {
			dp[i + 2] += dp[i];
			dp[i + 2] %= mod;
		}
	}
	cout << dp[n] % mod << endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  ll n, k, a, b;
  cin >> n >> k;
  // ll n, m, k;
  // cin >> n >> m >> k;
  map<long long, long long> m;
  fi(0, n) {
    cin >> a >> b;
    m[a] += b;
  }
  ll cnt = 0;
  for(auto p: m) {
    cnt += p.second;
    if(cnt >= k) {
      cout << p.first;
      return 0;
    }
  }
  // cout << ans << endl;
  return 0;
}



Measured memory_bytes: 4224
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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

    int N = scanner.nextInt();
    int M = scanner.nextInt();
    int X = scanner.nextInt() - 1;
    Set<Integer> tolls = new HashSet<>();
    for (int i = 0; i < M; i++) tolls.add(scanner.nextInt() - 1);
    int left = 0, right = 0;
    for (int i = X; i >= 0; i--) if (tolls.contains(i)) left++;
    for (int i = X; i < N; i++) if (tolls.contains(i)) right++;
    System.out.println(Math.min(left, right));
  }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...) 0
#endif

template <class T>
struct fenwick {
    vector<T> node;
    int n;

    fenwick(int _n)
        : n(_n) {
        node.resize(n);
    }

    void add(int x, T v) {
        while (x < n) {
            node[x] += v;
            x |= (x + 1);
        }
    }

    T get(int x) {
        T v = 0;
        while (x >= 0) {
            v += node[x];
            x = (x & (x + 1)) - 1;
        }
        return v;
    }

    T get(int a, int b) {
        return get(b) - get(a - 1);
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> b(n), w(n);
    vector<vector<int>> dp(n + 1, vector<int>(n + 1, 100000000));
    dp[n][n] = 0;
    for (int i = 0; i < 2 * n; i++) {
        char c;
        int a;
        cin >> c >> a;
        if (c == 'B') {
            b[a - 1] = i;
        } else {
            w[a - 1] = i;
        }
    }
    fenwick<int> bt(2 * n + 1);
    for (int i = n; i >= 0; i--) {
        fenwick<int> tmp = bt;
        for (int j = n; j >= 0; j--) {
            if (i) {
                int t = i + j - 1 - b[i - 1] + bt.get(b[i - 1]);
                dp[i - 1][j] = min(dp[i - 1][j], dp[i][j] + t);
            }
            if (j) {
                int t = i + j - 1 - w[j - 1] + bt.get(w[j - 1]);
                dp[i][j - 1] = min(dp[i][j - 1], dp[i][j] + t);
                bt.add(w[j - 1], 1);
            }
        }
        bt = tmp;
        if (i) {
            bt.add(b[i - 1], 1);
        }
    }
    cout << dp[0][0] << endl;
    return 0;
}

Measured memory_bytes: 16000
//make sure to check the songs irony and ヒトリゴト by ClariS
//it makes your life better
#include  <bits/stdc++.h>
using namespace std;
int n;
int ans=0;
int main() {
    cin >> n;
    vector<long long> s(n);
    for(int i = 0;i<n;++i){
        cin >> s.at(i);
    }for(int i = 0;i<n;i++){
        for(int j = 0;j<n;++j){
            for(int k = 0;k<n;++k){
                if((s.at(i) != s.at(j) && s.at(j) != s.at(k) && s.at(k) != s.at(i)) && s.at(i) + s.at(j) > s.at(k) && s.at(k) + s.at(j) > s.at(i) && s.at(k) + s.at(i) > s.at(j)){
                    ++ans;
                }
            }
        }
    }cout << ans / 6<< endl;
}


Measured memory_bytes: 3592
def rad(deg)
    return deg * Math::PI / 180.0 
end

def deg(rad)
    return rad  * 180.0 / Math::PI
end

a, b, c = gets.split.map(&:to_i)

S = a * b * Math.sin(rad(c)) * 0.5
L = a + b + Math.sqrt(a**2 + b**2 - 2*a*b * Math.cos(rad(c)))
h = 2.0 * S / a

puts "#{S} #{L} #{h}"


Measured memory_bytes: 6924
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N, K;
    while(cin >> N >> K) {
        if(N < 3) {
            cout << 0 << endl;
            continue;
        }
        ll ans = (N-3)/11*5;
        rep(j, 5) {
            ll r = 8 * (5 * K - j - 9) % 11;
            if(r < 0)r += 11;
            if(r <= (N - 3) % 11)ans++;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = (0 until n).map { sc.next().toInt() }
    println(problem059a(n, a))
}

fun problem059a(n: Int, a: List<Int>): Int {
    var min = Integer.MAX_VALUE
    for (i in -100..100) {
        var sum = 0
        for (j in 0 until a.size) {
            sum += (i - a[j]) * (i - a[j])
        }
        min = Math.min(min, sum)
    }
    return min
}

Measured memory_bytes: 31132
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int n;
ll a[225816],b[225816],f[225816],k;

bool judge(ll t){
	int i;
	ll p=0ll;
	for(i=0; i<n; ++i){
		b[i] = t/f[i];
	}
	for(i=0; i<n; ++i){
		p += max(a[i]-b[i],0ll);
	}
	return (k>=p);
}

int main(void){
	int i;
	ll l,r,m;
	cin >> n >> k;
	for(i=0; i<n; ++i){
		cin >> a[i];
	}
	for(i=0; i<n; ++i){
		cin >> f[i];
	}
	sort(a,a+n);
	sort(f,f+n,greater<ll>());
	l = -1ll; r = MOD*MOD;
	while(r-l>1){
		m = (l+r)/2;
		if(judge(m)){
			r = m;
		}else{
			l = m;
		}
	}
	cout << r << endl;
	return 0;
}


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

typedef long long ll;

int main()
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll ans=-1e18;
	
	ans=max(ans,a*c);
	ans=max(ans,a*d);
	ans=max(ans,b*c);
	ans=max(ans,b*d);
	cout<<ans<<endl;
	
} 

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int sum = 0;
		for (int i = 0; i < s.length(); i++) {
			sum = (sum + s.charAt(i) - '0') % 9;
		}
		System.out.println(sum == 0 ? "Yes" : "No");
	}
}


Measured memory_bytes: 40264
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;

class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        int l = s.length();
        int g = 0;
        int p = 0;

        for(int i=0; i<l; i++){
            if(s.charAt(i)=='g'){
                g++;
            }
            else{
                p++;
            }
        }
        System.out.println((g - p) / 2);
    }
}

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

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define all(x)  (x).begin(), (x).end()
#define MAX 10000
using namespace std;
typedef long long ll;

int main(){
  int n;  cin >> n;
  int ans = 1;
  for(int i=1; ans*2 <= n; i++) ans*=2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
int gcd(int a,int b)
{
	if(b==0)
	return a;
	
	return gcd(b,a%b);
}
ll power(ll x,ll y)
{
	ll res=1;
	x=x%mod;
	while(y>0)
	{
		if(y&1)
		res=(res*x)%mod;
		
		y=y>>1;
		x=(x*x)%mod;
	}
	return res;
}
struct Matrix{ 
	int a[2][2] = {{0,0},{0,0}};
	Matrix operator *(const Matrix& other){
		Matrix product;
		for(int i=0;i<2;i++){
			for(int j=0;j<2;j++){
				for(int k=0;k<2;k++){
						product.a[i][k] =product.a[i][k] + (ll)a[i][j]*other.a[j][k];
				}
			}
		}
		return product;
	}
};
//int modInverse(int n,int p)
//{
	//return power(n,p-2,p);
//}
int main() {
	// your code goes here
	 ios_base::sync_with_stdio(0);
	 cin.tie(0);
	 int n;
	 cin>>n;
	 vector<ll> dp(n+1);
	 dp[3] = 1;
	 for(int i=4;i<=n;i++)
	 {
		 dp[i] = 1;
		 for(int j=3;j<=i;j++)
		 {
			 if(i-j>=3)
			 {
				 dp[i] = (dp[i] + dp[i-j])%mod;
			 }
			 else
			 {
				 break;
			 }
		 }
	 }
	 cout<<dp[n]<<'\n';
	 return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#define int long long
using namespace std;
signed main() {
    string S;
    cin>>S;
    int res=0;
    int n=S.size();

    for (int i = 0; i < n; i++) {
        if (S[i] != S[n - 1 - i]) {
            res++;
        }
    }
    cout<<res/2<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
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;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << a*b-(a*d+b*c-c*d) << "\n";
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int x;
  int s,t;
  scanf("%d",&x);
  if(x > 1){
    if(x % 2 == 1){
      s = (x / 2) + 1;
      t = s*(s-1);
    }else{
      s = x / 2;
      t = s*s;
    }
  }

  printf("%d\n",t );

  return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize(3)
#pragma comment(linker,"/stack:16777216")
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=1;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define repr(a,n) for(int a=n-1;a>=0;a--)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

int n;
priority_queue<pii,vector<pii>,greater<pii>> pq;
int main(){
	cin>>n;
	rep(i,n){
		int a,b;
		cin>>a>>b;
		pq.push(mp(b,a));
	}
	int cur=0;
	while(!pq.empty()){
		pii p=pq.top();
		pq.pop();
		int a=p.sc,b=p.fi;
		if(cur+a>b){
			cout<<"No";
			return 0;
		}
		else{
			cur+=a;
		}
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <math.h>
#include<iomanip>


using namespace std;

int main(void) {

	double a, b, c;
	double s, l, h;

	cin >> a >> b >> c;
	double z = (3.1415926535 / 180)*c;
	s = a * b * sin(z)/2.0;
	l = sqrt(a*a + b*b - (2 * a*b) * cos(z)) + a + b;
	h = 2.0 * s / a;

	cout << fixed << setprecision(5) << s << endl;
	cout << fixed << setprecision(5) << l << endl;
	cout << fixed << setprecision(5) << h << endl;
	
	return 0;
}

Measured memory_bytes: 3476