akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#pragma region atcoder
/*#include <atcoder/fenwicktree>
using namespace atcoder;*/
#pragma endregion
#pragma region macros
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vl = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n - 1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#pragma endregion
#pragma region debug for var, v, vv
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){cout << endl;int cnt = 0;for(const auto& v : vv){cout << cnt << "th : "; view(v); cnt++;} cout << endl;}
#pragma endregion

const ll mod = 998244353;
const int inf = 1001001001;
const ll INF = 1001001001001001001;
const int MAX = 2000005;

//using mint = modint998244353;
//These are for segment tree
/*int op(int a, int b){return max(a, b);}
int e(){return -1;}
bool f(int v){ return v < target;}
*/

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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; }
ll modpow(ll a, ll p){ll ret = 1; while(p){if(p & 1){ret = ret * a % mod;} a = a * a % mod; p >>= 1;} return ret;}

/*--------------------------------------------------------------------------------------------------------------------------------*/
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, Q; cin >> n >> Q;
	vl ver(n + 1, n), hor(n + 1, n);
	int now_v = n, now_h = n;
	ll ans = (n - 2) * (n - 2);
	while(Q--){
		int id, x; cin >> id >> x;
		if(id == 1){
			if(x < now_v){
				now_v = x;
				ver[x] = 1;
				for(int i = x + 1; i < n; i++){
					if(ver[i] != n) break;
					ver[i] = now_h;
				}
				ans -= now_h - 2;
			}
			else{
				ans -= ver[x] - 2;
			}
		}
		else{
			if(x < now_h){
				now_h = x;
				hor[x] = 1;
				for(int i = x + 1; i < n; i++){
					if(hor[i] != n) break;
					hor[i] = now_v;
				}
				ans -= now_v - 2;
			}
			else{
				ans -= hor[x] - 2;
			}
		}
	}
	cout << ans << endl;
} 

Measured memory_bytes: 6348
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, k, g, mx;
  cin >> n >> k >> g;
  mx = g;
  rep(i, n - 1) {
    ll a;
    cin >> a;
    g = gcd(g, a);
    mx = max(mx, a);
  }
  bool ans = true;
  if(k > mx)
    ans = false;
  else if(k % g)
    ans = false;
  cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}

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

int main(){
int a,b;
char op;
cin >> a>>op>>b;
while (op!='?'){
if (op=='+'){
    cout << a+b << "\n";
}else if (op=='-'){
    cout << a-b<<"\n";
}else if (op== '*'){
    cout << a*b<<"\n";
}else if (op=='/'){
    cout << a/b<<"\n";
}
cin >> a>>op>>b;

}return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

ll W,H,N;
ll sx,sy;
vector<P> ps[5];
map<P,bool> dame;

bool vis[20][20][50][1<<5];
ll di[]={-1,-1,-1,0,0,1,1,1,0};
ll dj[]={-1,0,1,-1,1,-1,0,1,0};

struct state{
  ll i,j,t,S;
};

int main(){
  cin>>W>>H>>N;
  cin>>sx>>sy;
  sx--;sy--;
  rep(i,N){
    int tmp;
    cin>>tmp;
    rep(j,tmp){
      int a,b;
      cin>>b>>a;
      a--;b--;
      ps[i].push_back(P(a,b));
    }
    dame[ps[i][tmp-1]]=true;
  }

  queue<state> que;
  vis[sy][sx][0][0]=true;
  que.push((state){sy,sx,0,0});
  while(que.size()){
    state crt=que.front(); que.pop();

    ll nS=crt.S;
    rep(i,N){
      if(crt.t<(ll)ps[i].size()&&ps[i][crt.t]==P(crt.i,crt.j))nS|=(1<<i);
    }
    if(!vis[crt.i][crt.j][crt.t][nS]){
      vis[crt.i][crt.j][crt.t][nS]=true;
      que.push((state){crt.i,crt.j,crt.t,nS});
    }

    rep(dir,9){
      ll ni=crt.i+di[dir],nj=crt.j+dj[dir];
      if(ni>=0&&ni<H&&nj>=0&&nj<W&&crt.t+1<50&&!dame[P(ni,nj)]&&!vis[ni][nj][crt.t+1][crt.S]){
        vis[ni][nj][crt.t+1][crt.S]=true;
        que.push((state){ni,nj,crt.t+1,crt.S});
      }
    }
  }

  rep(t,50){
    rep(i,H)rep(j,W){
      if(vis[i][j][t][(1<<N)-1]){
        cout<<t<<endl;
        return 0;
      }
    }
  }
  cout<<-1<<endl;

  return 0;
}



Measured memory_bytes: 4088
#include<iostream>
#include<vector>
#include<cstring>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
const ll mod=1e9+7;

int main(){
    int N;
    cin >> N;
    ll sum[N+1];
    int tmp, j;
    memset(sum, 0, sizeof(sum));
    for(int i=2; i<=N; i++){
        tmp=i;
        j=2;
        while(tmp>1){
            if(tmp%j==0){
                sum[j]++;
                //cout << j << sum[j--] << endl;
                tmp=tmp/j;
                j=2;
            }else{
                j++;
            }
        }
    }
    ll ans=1;
    for(int i=0; i<N+1; i++){
        //cout << sum[i] << endl;
        if(sum[i]!=0){
            ans*=(sum[i]+1);
            ans%=mod;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define MOD 998244353
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
ll n;
ll a[305];
ll dp[305][90005];
ll sum = 0;
ll half = 0;
ll compute(ll i, ll r)
{
    if(i == n)
    {
        if(r >= half) return 1;
        else return 0;
    }
    if(dp[i][r]!=-1) return dp[i][r];
    ll ans = 0;
    ll cur = compute(i+1, r+a[i]);
    ans += cur;
    ans %= MOD;
    cur = (2*compute(i+1, r))%MOD;
    ans += cur;
    ans %= MOD;
    return dp[i][r] = ans;
}
ll compute2(ll i, ll r)
{
    if(i == n)
    {
        if(r == half) return 1;
        return 0;
    }
    if(dp[i][r]!=-1)return dp[i][r];
    ll ans = 0;
    ll cur = compute2(i+1, r+a[i]);
    ans += cur;
    ans %= MOD;
    cur = compute2(i+1, r);
    ans += cur;
    ans %= MOD;
    return dp[i][r] = ans;
}
int main()
{
    she_told_me_dont_worry
    int i, j;
    cin>>n;
    FOR0(i, n)
    {
        cin>>a[i];
        sum += a[i];
        FOR0(j, 90005) dp[i][j] = -1;
    }
    half = sum/2;
    if(sum%2!=0) half++;
    ll ful = 1;
    FOR0(i, n)
    {
        ful *= 3;
        ful %= MOD;
    }
    ll ans1 = compute(0, 0);
    ans1 *= 3;
    ans1 %= MOD;
    ful -= ans1;
    ful += MOD;
    ful %= MOD;
    FOR0(i, n)FOR0(j, 90005) dp[i][j] = -1;
    if(sum%2==0)
    {
        ans1 = compute2(0, 0);
        ans1 *= 3;
        ans1 %= MOD;
        ful += ans1;
        ful %= MOD;
    }
    cout<<ful;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 213248
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
template<class T>using vv = vector<vector<T>>; template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int N, M;
vv<int> graph;
vector<ll> dist;
vv<bool> visited;

void bfs_kkp(int s, int t) {
    dist.assign(graph.size(), LINF);
    dist[s] = 0;
    queue<pair<int, int>> que;
    que.emplace(s, 0);

    while (!que.empty()) {
        auto& q = que.front();

        if (q.second % 3 == 0) {
            dist[q.first] = q.second / 3;

            if (q.first == t) break;
        }

        for (int u : graph[q.first]) {
            if (visited[u][q.second % 3] == false) {
                visited[u][q.second % 3] = true;
                que.emplace(u, q.second + 1);
            }
        }

        que.pop();
    }
}

int main() {
    cin >> N >> M;
    graph.resize(N);
    rep(i, M) {
        int u, v;
        cin >> u >> v;
        graph[u - 1].push_back(v - 1);
    }
    int S, T;
    cin >> S >> T;

    visited = vvec(N, 3, false);
    bfs_kkp(S - 1, T - 1);
    
    if (dist[T - 1] == LINF) {
        write(-1);
    }
    else {
        write(dist[T - 1]);
    }
}

Measured memory_bytes: 13568
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<string>
#include<map>
#include<list>
#include <iomanip>

#define M_PI 3.14159265358979323846

using namespace std;

using llint = long long int ;
using ullint = unsigned long long int;


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

    int a,b,x;

    cin >> a >> b >> x;

    double ans;

    if(a*a*b <= x*2){
        double mx = a*a*b - x;
        double bx = mx/a/a*2.0;
        ans = atan(bx/a) / M_PI * 180.0;
    }else{
        double ax = (double)x/a/b*2.0;
        ans = atan(b/ax) / M_PI * 180.0;
    }

    cout << setprecision(10) << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
P p[ohara];

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

  cin >> n;
  rep(i, n) {
    cin >> a >> b;
    p[i] = m_p(a, b);
  }
  sort(p, p + n);
  reverse(p, p + n);
  Cout(p[0].fi + p[0].se);
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
main(){
  int n,x;
  cin>>n>>x;
  int m[n];
  int cnt=0;
  for(int i=0;i<n;i++) cin>>m[i];
  for(int i=0;i<n;i++){
    x-=m[i];
    cnt++;
  }
  sort(m,m+n);
  while(x-m[0]>=0){
    x-=m[0];
    cnt++;
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

int main()
{
    string s;
    cin >> s;
    vector<string> t {"maerd", "remaerd", "esare", "resare"};
    reverse(s.begin(), s.end());

    while(s.size() != 0){
        bool exist = false;
        for(auto itr = t.begin(); itr != t.end(); ++itr){
            if(s.substr(0, itr->size()) == *itr){
                s.erase(0, itr->size());
                exist = true;
                break;
            }
        }
        if(exist == false){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


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

using namespace std;

int main(){
  int n,y;
  cin >> n >> y;
  int flag=0,sen,gose,itima;
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n-i;j++){
      int z=y-1000*i-5000*j;
      if(z>=0){
        if(z%10000==0){
          if(z/10000 == n-i-j){
            flag=1;
            sen = i;
            gose = j;
            itima = z/10000;
            break;
          }
        }
      }
    }
  }
  if(flag){
    cout << itima <<" "<<gose<<" "<<sen<<endl;
  }else{
    cout << "-1 -1 -1" << endl;
  }
  return  0;
}


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

namespace B
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = RInt();
            double sum = 0;
            for (int i = 0 ; i < n ; i++)
            {
                string[] line = RStAr();
                if(line[1] == "JPY")
                {
                    sum += double.Parse(line[0]);
                }
                else
                {
                    sum += double.Parse(line[0]) * 380000;
                }

            }
            Console.WriteLine(sum);
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}


Measured memory_bytes: 11092
#define ll long long
#define dd long double
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mp make_pair
#define mt make_tuple
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
//#include<bits/stdc++.h>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<utility>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<bitset>
dd pi = acos(-1) ;
ll z =  1000000007 ;
ll inf = 100000000000000000 ;
ll p1 = 37 ;
ll p2 = 53 ;
ll mod1 =  202976689 ;
ll mod2 =  203034253 ;
ll fact[100] ;
ll gdp(ll a , ll b){return (a - (a%b)) ;}
ll ld(ll a , ll b){if(a < 0) return -1*gdp(abs(a) , b) ; if(a%b == 0) return a ; return (a + (b - a%b)) ;} // least number >=a divisible by b
ll gd(ll a , ll b){if(a < 0) return(-1 * ld(abs(a) , b)) ;    return (a - (a%b)) ;} // greatest number <= a divisible by b
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
ll e_gcd(ll a , ll b , ll &x , ll &y){ if(b > a) return e_gcd(b , a , y , x) ; if(b == 0){x = 1 ; y = 0 ; return a ;}
ll x1 , y1 ; e_gcd(b , a%b , x1 , y1) ; x = y1 ; y = (x1 - ((a/b) * y1)) ; return e_gcd(b , a%b , x1 , y1) ;}
ll power(ll a ,ll b , ll p){if(b == 0) return 1 ; ll c = power(a , b/2 , p) ; if(b%2 == 0) return ((c*c)%p) ; else return ((((c*c)%p)*a)%p) ;}
ll inverse(ll a ,ll n){return power(a , n-2 , n) ;}
ll max(ll a , ll b){if(a > b) return a ; return b ;}
ll min(ll a , ll b){if(a < b) return a ; return b ;}
ll left(ll i){return ((2*i)+1) ;}
ll right(ll i){return ((2*i) + 2) ;}
ll ncr(ll n , ll r){if(n < r|| (n < 0) || (r < 0)) return 0 ; return ((((fact[n] * inverse(fact[r] , z)) % z) * inverse(fact[n-r] , z)) % z);}
void swap(ll&a , ll&b){ll c = a ; a = b ; b = c ; return ;}
//ios_base::sync_with_stdio(0);
//cin.tie(0); cout.tie(0);
using namespace std ;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
//__builtin_popcount(n) -> returns number of set bits in n
// ll seed;
//mt19937 rnd(seed=chrono::steady_clock::now().time_since_epoch().count()); // include bits


void solve()
{
    ll l , r , d ;
    cin >> l >> r >> d;
    ll ans = 0 ;
    for(ll i = l ; i <= r ; i++)
    {
        if(i%d == 0)
            ans++ ;
    }
    cout << ans << endl ;
    return ;
}

int main()
{
    /*ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif*/
    
    ll t ;
    //cin >> t ;
    t = 1 ;
   
    while(t--)
    {
        solve() ;
    }
  //  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
 
    return 0;
}


Measured memory_bytes: 3624
#include<stdio.h>
#include<string.h>
int main()
{
	int i,len,len1,flag=0;
	char a[1005],b[1005];
	scanf("%s%s",a,b);
	len=strlen(a);
	len1=strlen(b);
	if(len>len1)
		{printf("GREATER");
		flag=1;}
	else if(len<len1)
		{printf("LESS");
		flag=1;}
	else
		for(i=0;i<len;i++)
		{
			if(a[i]>b[i])
			{
				printf("GREATER");
				flag=1;
				break;
			}
			else if(a[i]<b[i])
			{
				printf("LESS");
				flag=1;
				break;
			}
		}
		if(flag==0)
			printf("EQUAL");
}

Measured memory_bytes: 128
let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let ($) f g = fun x -> g (f x)
let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n
let s = Array.init n @@fun _ -> read_line () |> split_string |> List.sort compare |> String.concat ""

let rec f n = if n = 0 then 0 else n + f (n - 1)

let () = 
  Array.sort compare s;
  let a = Array.fold_left (fun acc n ->
    match acc with
      | [] -> [(n, 1)]
      | (v, cnt) as t :: xs -> if v = n then (v, cnt + 1) :: xs else (n, 1) :: t :: xs
  ) [] s in
  a |> List.map (snd $ pred $ f) |> List.fold_left (+) 0 |> Printf.printf "%d\n"

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

bool match_these(const string& x, const string& y) {
    for (int i = 0; i < x.size(); i++) {
        if (x.at(i) == '?') continue;
        else if (x.at(i) != y.at(i)) return false;
    }
    return true;
}

vector<int> matching_starting_indices(const string& S, const string& T) {
    int keyword_size = T.size();
    vector<int> indices;
    for (int i = 0; i < S.size() - keyword_size + 1; i++) {
        string substr_S = S.substr(i, keyword_size);
        if (match_these(substr_S, T)) {
            indices.emplace_back(i);
        }
    }
    return indices;
}

int main() {
    string S, T;
    cin >> S;
    cin >> T;
    vector<int> indices = matching_starting_indices(S, T);
    if (indices.empty()) {
        cout << "UNRESTORABLE" << "\n";
        return 0;
    }
    string smallest_string(T.size(), 'x');
    for (auto start : indices) {
        string candidate = S;
        for (int i = 0; i < T.size(); i++) {
            candidate.at(i + start) = T.at(i);
        }
        for (int i = 0; i < candidate.size(); i++) {
            if (candidate.at(i) == '?') candidate.at(i) = 'a';
        }
        smallest_string = min(smallest_string, candidate);
    }
    cout << smallest_string << "\n";
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;


class Program
{
    static void Main(string[] args)
    {
        string S = Console.ReadLine();
        if(S[2]==S[3] & S[4]==S[5]){
            Console.WriteLine("Yes");
        }else{
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <tuple>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, p;
string s;

int main(){
	cin >> n;
	
	tuple<string, ll, ll> rank[100];
	for(ll i = 0; i < n; i++){
		cin >> s >> p;
		rank[i] = make_tuple(s, -p, i+1);
	}
	sort(rank, rank+n);
	for(ll i = 0; i < n; i++){
		cout << get<2>(rank[i]) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int a,b,k;
  cin >> a >> b >> k;
  int cnt = 0;
  for(int i=100; i>=1; i--){
    if(a%i==0&&b%i==0){
      cnt++;
    }
    if(cnt==k){
      cout << i << endl;
      break;
    }
  }
}



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

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

            int N = int.Parse(str.Split(' ')[0]);

            int K = int.Parse(str.Split(' ')[1]);

            int index = 1;
            while (true)
            {
                N = N / K;

                if (N == 0)
                {
                    break;
                }

                index++;
            }

            Console.WriteLine(index);
        }
    }
}


Measured memory_bytes: 27040
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container;
import std.numeric, std.math;
import core.bitop;

string my_readln() { return chomp(readln()); }

long mod = pow(10, 9) + 7;
long moda(long x, long y) { return (x + y) % mod; }
long mods(long x, long y) { return ((x + mod) - (y % mod)) % mod; }
long modm(long x, long y) { return (x * y) % mod; }

void main()
{
	auto tokens = my_readln.split;
	auto N = tokens[0].to!long;
	auto K = tokens[1].to!long;
	auto A = my_readln.split.to!(long[]);

	long ans = 1;
	N -= K;
	while (N > 0)
	{
		++ans;
		N -= K - 1;
	}

	writeln(ans);
	stdout.flush();
}

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

int main() {
	int n;
	cin >> n;
	int m = 1000000000;
	vector<int> a(n);
	for(int i=0;i<n;i++)
	{
		cin >> a.at(i);
	}
	sort(a.begin(),a.end());
	int b=a.at(0),c;
	for(int i=1;i<n;i++)
	{
		c=a.at(i);
		while(b>0)
		{
			int d= c%b;
			c = b;
			b = d;
		}
		b = c;
	}
	cout << b << endl;
	return 0;
}


Measured memory_bytes: 3644
from collections import Counter

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

sum = 0
for i in range(len(A)):
    sum += A[i]

counter = Counter(A)

ans = []
Q = int(input())
for i in range(Q):
    B,C=map(int,input().split())
    if counter[B] != 0:
        add = int(( C - B ) * counter[B])
        sum += add
        counter[C] += counter[B]
        counter[B] = 0
    ans.append(sum)


for i in range(Q):
    print(ans[i])

Measured memory_bytes: 21576
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

template<typename T>
bool updMax(T& tmax, const T& x) {
  if (x > tmax) { tmax = x; return true;  }
  else          {           return false; }
}
int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  auto check = [&](ll K, auto& vec) -> ll {
    ll sz = vec.size();
    vec.resize(sz * 2);
    for (ll i = 0; i < sz; i++) vec[sz + i] = vec[i];
    vector<ll> acc(sz * 2 + 1);
    for (ll i = 0; i < sz * 2; i++) acc[i + 1] = acc[i] + vec[i];
    ll ans = vec[0];
    for (ll i = 0; i < sz; i++) {
      for (ll d = 1; d <= min(sz, K); d++) {
	ll val = acc[i + d] - acc[i];
	updMax(ans, val);
	updMax(ans, val + acc[sz] * ((K - d) / sz));
      }
    }
    return ans;
  };

  ll N, K; cin >> N >> K;
  vector<ll> P(N), C(N);
  vector<bool> done(N);
  for (ll i = 0; i < N; i++) {
    ll p; cin >> p; p--;
    P[i] = p;
  }
  for (ll i = 0; i < N; i++) cin >> C[i];

  ll ans = LLONG_MIN;
  for (ll i = 0; i < N; i++) {
    if (done[i]) continue;
    done[i] = true;
    vector<ll> vec;
    vec.push_back(C[i]);
    for (ll j = P[i]; j != i; j = P[j]) {
      done[j] = true;
      vec.push_back(C[j]);
    }
    ll val = check(K, vec);
    ans = max(ans, val);
  }
  cout << ans << endl;

  return 0;
}



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

int main ()
{
  int N, X, sum;
  cin >> N >> X;
  
  vector<int>a(N);
  for (int i = 0; i < N; i++)
  {
    cin >> a[i];
    sum += a[i];
  }
  
  sort(a.begin(), a.end());
  X -= sum;
  cout << N + X/a[0] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> x(3);
  cin >> x.at(0) >> x.at(1) >> x.at(2);
  
  sort(x.begin(), x.end());
  
  x.at(0) + x.at(1) == x.at(2)? cout << "Yes" << endl : cout << "No" << endl;  
  
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<ld, ld> pld;
typedef pair<string, string> pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define tab                         '\t'
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

inline ll input() {
    ll n;
    cin >> n;
    return n;
}

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

set_random;

const ll MAXN = 2e5 + 10;
const ll INF = 8e18;
const ll MOD1 = 998244353;
const ll MOD2 = 1e9 + 7;
const ll MOD3 = 1e9 + 9;

ll n , k , h[MAXN] , dp[MAXN];

int main() {
    fast_io;
    fill(dp , dp + MAXN , INF);

    cin >> n >> k;
    for(ll i = 1 ; i <= n ; i++) cin >> h[i];

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

    return 0;
}
/*
todo :
    1- set constants
    2- check TimeLimit and MemoryLimit
    3- check special test cases
    4- don't forget BS can help you that is good idea(use for loop for floats)
    5- don't forget printf and scanf can help you in your code speed
*/


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

int main()
{
    int N;
    cin >> N;
    int A[N];
    int B[N];
    for(int i = 1; i <= N; i++){
        B[i] = 0;
    }
    for(int i = 1; i < N; i++){
        cin >> A[i];
        B[A[i]]++;
    }
    for(int i = 1; i <= N; i++){
        cout << B[i] << endl;
    }
}


Measured memory_bytes: 5140
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

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

vector<int> g[100000];

void dfs(vector<int> &d, int u, int v, int l) {
    d[v] = l;
    for (auto t : g[v]) {
        if (t == u)
            continue;
        dfs(d, v, t, l + 1);
    }
}

int main() {
    int n, u, v, a, b;
    cin >> n >> u >> v;
    u--; v--;
    for (int i = 0; i < n - 1; ++i) {
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<int> d_u(n, 0), d_v(n, 0);
    dfs(d_u, u, u, 0);
    dfs(d_v, v, v, 0);

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (d_u[i] < d_v[i])
            ans = max(ans, d_u[i] + (d_v[i] - d_u[i]) - 1);
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define MAXN 2097154
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define se second 
#define FAIL0 {printf("0\n"); return 0;}
#define FAIL_1 {printf("-1\n"); return 0;}

int N;
int A[22][22];
LL dp[MAXN];

void add(LL &a, LL b) {
    a = (a+b) % MOD;
}

int nbit(int n) {
    int r = 0;
    while(n) {
        r += n%2;
        n /= 2;
    }

    return r;
}

int main(int argc, char **argv)
{
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif

    scanf("%d", &N);
    for (int i = 0; i < N; i++)
        for (int j = 0; j < N; j++)
            scanf("%d", &A[i][j]);

    LL ans = 0;
    for (int i = 1; i < (1<<N); i++) {
        int nb = nbit(i)-1;
        if (!nb) {
            for (int b = 0; b < N; b++)
                if (A[0][b] && (i&(1<<b))) {
                    dp[i] = 1;
                }
        } else {
            for (int b = 0; b < N; b++) {
                if ((i&(1<<b)) && A[nb][b]) {
                    add(dp[i], dp[i^(1<<b)]);
                }
            }

        }

        if (nb+1 == N) 
            add(ans, dp[i]);
        //printf("%d %lld\n", i, dp[i]);
    }

    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 16640
using System;

public class hello
{
    public static void Main()
    {
        var w = Console.ReadLine().Trim();
        var count = 0;
        while (true)
        {
            string[] s = Console.ReadLine().Trim().Split(' ');
            if (s[0] == "END_OF_TEXT") break;
            for (int i = 0; i < s.Length; i++)
                if (w.ToUpper() == s[i].ToUpper())
                    count++;
        }
        Console.WriteLine(count);

    }
}

Measured memory_bytes: 9072
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T iabs(const T& x) { return max(x, -x); }
// #define abs gabs

template<class T, class F = plus<T>>
struct Fenwick {
  i64 n;
  vector<T> c;
  F f;
  Fenwick(i64 n, F f = plus<T>(), T init = T())
    : n(n), c(n + 1, init), f(f) {}
  T sum(i64 i) {
    return i > 0 ? f(sum(i - (i & -i)), c[i]) : T();
  }
  void add(i64 i, i64 x) {
    if (i <= n) {
      c[i] = f(c[i], x);
      add(i + (i & -i), x);
    }
  }
};
template<class T, class F = plus<T>>
Fenwick<T, F> make_fenwick(i64 n, F f = plus<T>(), T init = T()) {
  return Fenwick<T, F>(n, f, init);
}
int main() {
    i64 n;
    cin >> n;
    vector<i64> p(n);
    for (int i = 0; i < n; ++i) {
        cin >> p[i];
    }
    Fenwick<int> fen(n + 1);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (fen.sum(p[i]) == 0) ++ans;
        fen.add(p[i], 1);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define inf 1000000100

int dp[41][403][403];

int main()
{
    int n, ma, mb;
    cin >> n >> ma >> mb;
    for(int i = 0; i <= n; i++)
    {
        for(int j = 0; j < 403; j++)
        {
            for(int k = 0; k < 403; k++)
            {
                dp[i][j][k] = 5000;
            }
        }
    }
    vector<tuple<int, int, int>> chemical;

    for(int i = 0; i < n; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        chemical.pb(make_tuple(a, b, c));
    }

    dp[1][0][0] = 0;
    dp[1][get<0>(chemical[0])][get<1>(chemical[0])] = get<2>(chemical[0]);
    for(int i = 1; i < n; i++)
    {
        for(int j = 0; j < 403; j++)
        {
            for(int k = 0; k < 403; k++)
            {
                if(dp[i][j][k] == 5000) continue;
                dp[i+1][j][k] = min(dp[i][j][k], dp[i+1][j][k]);
                dp[i+1][j+get<0>(chemical[i])][k+get<1>(chemical[i])] = min(dp[i+1][j+get<0>(chemical[i])][k+get<1>(chemical[i])], dp[i][j][k] + get<2>(chemical[i]));
            }
        }
    }

    int ans = inf;
    for(int j = 1; j < 403; j++)
    {
        for(int k = 1; k < 403; k++)
        {
            if(j*mb == k*ma)
            {
                ans = min(ans, dp[n][j][k]);
            }
        }
    }
    if(ans == 5000)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << ans << endl;
    }

}

Measured memory_bytes: 26240
#include <stdio.h>

#define MAX 1000

int main(void) {
  int A[MAX][MAX];
  int B[MAX][MAX];
  unsigned long C[MAX][MAX];

  int i, j, k;
  int n, m, l;
  scanf("%d %d %d", &n, &m, &l);

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

  for(i=0; i<m; ++i) {
    for(j=0; j<l; ++j) {
      scanf("%d", &B[i][j]);
    }
  }

  for(i=0; i<n; ++i) {
    for(j=0; j<l; ++j) {
      for(k=0; k<m; ++k) {
        C[i][j] += A[i][k] * B[k][j];
      }
      if(j != l-1) printf("%lu ", C[i][j]);
      else printf("%lu", C[i][j]);
    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 3076
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

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

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

class BIT{
    ll n;
    vl bit;
public:
    void BIT_init(ll _n){
        bit.assign(_n+1,0);
        n=_n;
    }
    ll get_sum(int i){
        ll res=0;
        while(i>0){
            res+=bit[i];
            i-=i&(-i);
        }
        return res;
    }
    void add(int i,ll x){
        while(i<=n){
            bit[i]+=x;
            i+=i&(-i);
        }
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, Q;
    cin >> N >> Q;
    vl c(N);
    rep(i,N){
        cin >> c[i];
    }
    vl last(N+1,-1);
    vP p;
    rep(i,N){
        int l = last[c[i]];//cerr << l << endl;
        if(l != -1){
            p.pb({l+1,i+1});
        }
        last[c[i]] = i;
    }
    /*rep(i,p.size()){
        cerr << p[i].first << ' ' << p[i].second << endl;
    }*/
    BIT bit;
    bit.BIT_init(N+1);
    sort(p.begin(),p.end());
    vector<pair<P,int>> q(Q);
    rep(i,Q){
        cin >> q[i].first.first >> q[i].first.second;
        q[i].second = i;
    }
    vl ans(Q);
    sort(q.begin(),q.end());
    int now=p.size()-1;
    per(i,Q-1){
        while(now>=0&&p[now].first>=q[i].first.first){
            bit.add(p[now].second,1);
            now--;
        }
        ans[q[i].second]=q[i].first.second-q[i].first.first+1-bit.get_sum(q[i].first.second)-bit.get_sum(q[i].first.first-1);
        /*rep(j,N){
            cout << i << ' ' << j << ' ' << bit.get_sum(j) << endl;
        }
        cout << q[i].second << '\n';*/
    }
    rep(i,Q){
        cout << ans[i] << '\n';
    }
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/


Measured memory_bytes: 38348
#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int cnt[N];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		cnt[x]++;
	}
	vector<int> c, p;
	for (int i = 1; i <= n; i++) {
		if (cnt[i])
			c.push_back(cnt[i]);
	}
	sort(c.begin(), c.end());
	p.push_back(c[0]);
	int sz = c.size();
	for (int i = 1; i < sz; i++) {
		p.push_back(p.back() + c[i]);
	}
	for (int i = 1; i <= n; i++) {
		int l = 0, r = n / i;
		while (l < r) {
			int mid = (l + r) / 2 + 1;
			int id = lower_bound(c.begin(), c.end(), mid) - c.begin();
			int t = c.size() - id;
			if (id != 0)
				t += p[id - 1] / mid;
			if (t >= i)
				l = mid;
			else
				r = mid - 1;
		}
		cout << l << "\n";
	}
	return 0;
}

Measured memory_bytes: 5616
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    string s;
    cin >> s;

    long long K;
    cin >> K;

    const int N = 62;
    const long long INF = 1LL << 62;
    vector<vector<long long>> lens(10, vector<long long>(N + 1, 1));

    for (int i = 2; i <= 9; ++i) {
        for (int j = 1; j <= N; ++j) {
            if (lens[i][j - 1] > INF / i) {
                lens[i][j] = INF;
                continue;
            }
            lens[i][j] = lens[i][j - 1] * i;
        }
    }

    int n = s.length();
    long long rem = K - 1;
    int res = -1;
    for (int i = 0; i < n; ++i) {
        if (lens[s[i] - '0'][N] <= rem) {
            rem -= lens[s[i] - '0'][N];
        } else {
            res = s[i] - '0';
            break;
        }
    }

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 256
//Created Time:2019年12月23日 星期一 15时39分53秒
    #include <iostream>
    #include <cstdio>
    #include <algorithm>
    #include <cstring>
    #define N 2005
    #define mod 1000000007
     
    using namespace std;
     
    int n, k;
    int f[N][N], fac[N * N], ifac[N * N], inv[N * N];
     
    int C(int ,int);
     
    int main(){
    	cin >> n >> k; fac[0] = ifac[0] = inv[1] = 1;
    	if (k == 1) { puts("1"); return 0;}
    	for (int i = 2; i <= n * k; ++i) inv[i] = mod - 1ll * mod / i * inv[mod % i] % mod;
    	for (int i = 1; i <= n * k; ++i) fac[i] = 1ll * fac[i - 1] * i % mod, ifac[i] = 1ll * ifac[i - 1] * inv[i] % mod;
    	f[0][0] = 1; //f[i][j] 放了i个白色球和j种颜色球的方案
    	for (int i = 1; i <= n; ++i)
    		for (int j = 0; j <= i; ++j) {
    			f[i][j] = f[i - 1][j];
    			if(j) (f[i][j] += 1ll * C(n - i + (n - j + 1) * (k - 1) - 1, k - 2) * f[i][j - 1] % mod * (n - j + 1) % mod) %= mod;
    		}
    	cout << f[n][n] << endl;
    	return 0;
    }
     
    int C(int x, int y){
    	return 1ll * fac[x] * ifac[y] % mod * ifac[x - y] % mod;
    }

Measured memory_bytes: 62976
#include <iostream>
#include <cstdlib>
using namespace std;
int a[1001][1001]={};
int dp[1001][1001]={};
int m=0,maxsize=0;
void solve() {
  for(int j=0;j<=m/2;j++) {
    dp[0][j] = 0;
  }

  for(int i=0;i<m;i++) {
    for(int j=0;j<=m/2;j++) {
      if(i <= m/2) {
        if(j == 0) {
          dp[i+1][j] = dp[i][j] + a[i][j];
        }
        else {
          dp[i+1][j] = max(dp[i][j-1]+a[i][j],dp[i][j]+a[i][j]);
        }
      }
      else {
        dp[i+1][j] = max(dp[i][j]+a[i][j],dp[i][j+1]+a[i][j]);
      }
    }
  }
  cout << dp[m][0] << endl;
}

int main() {
  string str;
  int size;
  while(true) {
    getline(cin,str);
    if(cin.eof()) break;
    size = (str.size() + 1 ) / 2;
    int to1=0,to2=str.find(',',to1);
    if(to2 == -1) to2 = str.size()-1;
    for(int i=0;i<size;i++) {
      to2=str.find(',',to1+1);
      if(to2 == -1) to2 = str.size()-1;
      a[m][i] = atoi(str.substr(to1 ,to2-to1+1).c_str());
      to1 = to2+1;
    }
    m++;
  }
  solve();
}

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

using namespace std;

int main()
{
  long n, m;
  int i;
  
  cin >> n >> m;
  
  vector<pair<long, long>> vc(n);

  for (i = 0; i < n; i++) {
    cin >> vc[i].first >> vc[i].second;
  }

  sort(vc.begin(), vc.end());

  long price = 0;
 
  for (i = 0; m > 0; i++) {
    price += vc[i].first * min(m, vc[i].second);
    m -= vc[i].second;
  }
 
  cout << price << endl;
 
  return 0;
}


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

namespace ABC066A
{
	class Program
	{
		static void Main(string[] args)
		{
			int a, b, c, r;
			string[] word = Console.ReadLine().Split(' ');

			a = int.Parse(word[0]);
			b = int.Parse(word[1]);
			c = int.Parse(word[2]);

			int ab = a + b;
			int ac = a + c;
			int bc = b + c;

			r = ab;
			if (ac < r)
				r = ac;
			if (bc < r)
				r = bc;

			Console.WriteLine(r);
		}

	}
}

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

int N;
vector<int> A;  
int main(){
    scanf("%d", &N);
    int sum = 0;
    int a;
    for(int i=0; i<N; i++){
        scanf("%d", &a);
        A.push_back(a);
    }
    sort(A.begin(), A.end(), greater<int>());
    for(int i=0; i<N; i++){
        if(i%2 == 0) sum += A[i];
        else sum -=A[i];
    }
    printf("%d", sum);
    return 0;
}


Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

template <class T>
vector<ll> Zarts(const vector<T> &AR, ll CNT = 0) {
  vector<ll> RES;
  map<T, ll> MP;
  for (auto &e : AR) MP[e] = 0;
  for (auto &e : MP) e.se = CNT++;
  for (auto &e : AR) {
    RES.push_back(MP[e]);
  }
  return RES;
}

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, a, b, c, d, tmp, m, h, w, x, y, sum, k, q, st;
ll ok, decr;

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

  cin >> n >> a >> b;
  if (a + b - 1 <= n && n <= a * b) {
    V ans(n + 1);
    st = a * b - a + 1;
    decr = a * b - n;
    rep(i, n) {
      ans[i] = st + cnt;
      if (decr - (a - 1) >= 0) {
        st -= a;
        decr -= a - 1;
        continue;
      }
      cnt += decr;
      decr = 0;
      cnt++;
      if (cnt == a) {
        cnt = 0;
        st -= a;
      }
    }
    auto b = Zarts<ll>(ans);
    rep(i, n) cout << b[i] << " ";
    cout << "\n";
  } else
    Cout(-1);
  return 0;
}

Measured memory_bytes: 27120