akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <iostream>
#include <map>
using namespace std;

vector<int> k;
vector<bool> canZero;
int M;

int dfs(int depth, vector<bool> &used, int sum){
  if(depth == M) return (sum == 0) ? 1 : 0;

  int res = 0;
  for(int i=0;i<=9;i++){
    if(not used[i]){
      if(i==0 and not canZero[depth]) continue;
      used[i] = true;
      res += dfs(depth+1, used, sum + k[depth]*i);
      used[i] = false;
    }
  }
  return res;
}

int main(){
  int n;
  while(cin >> n){
    if(n == 0) break;

    string s;
    map<char, int> id;
    k = vector<int>(10, 0);
    canZero = vector<bool>(10, true);
    for(int i=0;i<n;i++){
      cin >> s;
      int x = 1;
      for(int j=s.size()-1;j>=0;j--){
        if(id.count(s[j]) == 0) id[s[j]] = id.size()-1;
        k[id[s[j]]] += (i==n-1) ? -x : x;
        x *= 10;
      }
      if(s.size()>1) canZero[id[s[0]]] = false;
    }

    M = id.size();
    vector<bool> used(M, false);
    cout << dfs(0, used, 0) << endl;
  }
}

Measured memory_bytes: 3192
#include "bits/stdc++.h"
using namespace std;
#define fastcin {\
    cin.tie(0);\
    ios::sync_with_stdio(false);\
}
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = a; i >= b; i--)
#define fore(i, a) for(auto &i:a)
#define print(x) cout << x << "\n"
#define SORT(a, n) sort(a, a+n);
#define REVERSE(a,n) reverse(a,a+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VREVERSE(v) reverse(v.begin(), v.end());
#define MOD 998244353
#define yes "YES"
#define no "NO"
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;

// nCk = n!/{(n-k)!*k!}
//     = n! * {(n-k)! * k!}^-1
ll f[300001];
void initC() {
    f[0] = 1;
    rep(i, 1, 300001) f[i] = (f[i-1]*i) % MOD;
}
// inverse by Fermat's little theorem
ll inv(ll x) {
    ll res = 1;
    ll k = MOD-2;
    ll y = x;
    while(k) {
        if(k&1) res = (res*y) % MOD;
        y = (y*y) % MOD;
        k = k/2;
    }
    return res;
}
// a = n!, b = (n-k)!, c = k!
ll combi(int n, int k) {
    ll a = f[n];
    ll b = f[n-k];
    ll c = f[k];

    ll bc = (b*c) % MOD;
    return (a*inv(bc)) % MOD;
}

int main() {
    fastcin;
    ll n, a, b, k, ans = 0;
    cin >> n >> a >> b >> k;
    ll y = k/a;
    initC();
    rrep(i, y, 0) {
        ll kr = k-a*i;
        if(kr%b==0) {
            ll bi = kr/b;
            if(i<=n && bi<=n) {
                ans += (combi(n, i) * combi(n, bi)) % MOD;
                ans %= MOD;
            }
        }
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

//        ...  i  i-1..1   0
// x = 1   0   0   0   1   0
// dp[i][j=0,1] = 上からi桁目まで決めた場合の最大値で、
// j = 0: i桁目まではxがkと一致している
// j = 1: xがk未満確定(以降の桁はなんでもいいので貪欲)
ll dp[100][2];

int main () {
  int n;
  ll k;
  cin >> n >> k;
  vll a(n);
  rep(i,n) cin >> a[i];

  rep(i,100) dp[i][0] = dp[i][1] = -1;
  dp[45][0] = 0;
  for (int d = 44; d >= 0; --d) {
    ll mask = 1LL<<d;
    // a[0], a[1], ..., a[n-1]のd桁目の1の数の合計
    int num = 0;
    rep(i,n) if (a[i] & mask) ++num;

    if (dp[d+1][1] >= 0) {
      // xがk未満確定の場合なので、貪欲
      chmax(dp[d][1], dp[d+1][1] + mask*max(num, n-num));
    }
    if (dp[d+1][0] >= 0) {
      // d+1桁目までは、xとkが一致している
      if (k & (1LL<<d)) {
        // kのd桁目が1の場合、xのd桁目は0でも1でもよくて

        // xのd桁目が0の場合,a[0],a[1], ...a[n-1]のビットの反転はなくて、
        // xがk未満となることが確定する
        chmax(dp[d][1], dp[d+1][0] + mask*num);
        // xのd桁目が1の場合,a[0],a[1], ...a[n-1]のビットが反転して、
        // xとkはd桁目までは一致していることになる
        chmax(dp[d][0], dp[d+1][0] + mask*(n-num));
      }
      else {
        // kのd桁目が0の場合、xのd桁目を0にして一致させておくしかない
        chmax(dp[d][0], dp[d+1][0] + mask*num);
      }
    }
  }
  cout << max(dp[0][0], dp[0][1]) << endl;
  return 0;
}

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

int main() {
  int n; cin >> n;
  vector<int> t(n); REP(i, n) cin >> t.at(i);
  int m; cin >> m;
  int ans = 0; REP(i, n) ans += t.at(i);
  
  int diff = 0;
  int index = -1;
  REP(i, m) {
    int p, x; cin >> p >> x;
    cout << ans - (t.at(p - 1) - x) << endl;
  }
    
  return 0;  
}

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

#define int long long
#define rep(i, n) REP(i, 0, n)
#define REP(i, l, r) for (int i = l; i < r; i++)
#define MOD (int)(1e9+7)
using namespace std;
typedef pair<int, int> P;
struct edge {
    int to, cost;
};

class dijkstra {
private:
    int V;
    int d[100002];
    priority_queue<P, vector<P>, greater<>> que;

public:
    dijkstra(int v, int s, vector<edge> G[]) {
        V = v;
        update(s, G);
    }

    void update(int s, vector<edge> G[]) {
        fill(d, d + V + 1, 100000000000ll);
        d[s] = 0;
        que.push(make_pair(0, s));
        while (!que.empty()) {
            P p = que.top();
            que.pop();
            int v = p.second;
            if (d[v] < p.first)
                continue;
            rep(i, G[v].size()) {
                edge e = G[v][i];
                if (d[e.to] > d[v] + e.cost) {
                    d[e.to] = d[v] + e.cost;
                    que.push(make_pair(d[e.to], e.to));
                }
            }
        }
    }

    int find(int e) {
        return d[e];
    }
};

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

bool prime(int a) {
    if (a == 1)
        return false;
    for (int i = 2; i * i <= a; i++) {
        if (a % i == 0)
            return false;
    }
    return true;
}

class Union_Find {
private:
    vector<int> t, s;

public:
    Union_Find(int max_length) {
        rep(i, max_length + 1) {
            t.push_back(i);
            s.push_back(1);
        }
    }

    void Union(int x, int y) {
        if (same(x, y))
            return;
        int tx = Find(x), ty = Find(y);
        if (s[tx] < s[ty]) {
            s[ty] += s[tx];
            t[tx] = ty;
        } else if (s[tx] > s[ty]) {
            s[tx] += s[ty];
            t[ty] = tx;
        } else if (tx > ty) {
            t[tx] = ty;
            s[ty] += s[tx];
        } else {
            t[ty] = tx;
            s[tx] += s[ty];
        }
    }

    int Find(int n) {
        if (t[n] == n)
            return n;
        else
            return t[n] = Find(t[n]);
    }

    bool same(int x, int y) {
        return Find(x) == Find(y);
    }

    int get_Size(int a) {
        return s[a];
    }
};

vector<int> primeFactorization(int n) {
    vector<int> re;
    int cnt = 2;
    while (n != 1) {
        if (n % cnt != 0) {
            cnt++;
            continue;
        }
        n /= cnt;
        re.push_back(cnt);
    }
    return re;
}

signed main() {
    int l,r;
    cin>>l>>r;
    if(r/2019-(l-1)/2019>0)cout<<0<<endl;
    else{
        int ll=l%2019;
        int rr=r%2019;
        int ans=LLONG_MAX;
        REP(i,ll,rr+1){
            REP(j,ll,i){
                ans=min(ans,i*j%2019);
            }
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 256
n = int(input())
p = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    if i + 1 == p[i]:
        if i != n - 1:
            p[i], p[i + 1] = p[i + 1], p[i]
        else:
            p[i], p[i - 1] = p[i - 1], p[i]
        ans += 1
print(ans)


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

using namespace std;

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

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  ll a,b,x;
  cin>>a>>b>>x;
  if(x<a){
    cout<<(x%MOD)<<endl;
    return 0;
  }
  ll k = a-b;
  ll i = (x-a+1+k-1) / k;
  ll ans = (i%MOD)*(a%MOD);
  x -= i*k;
  assert(x<a);
  ans += x;
  ans %= MOD;
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 3104
#include "bits/stdc++.h"
// Custom Header {{{
#define all(x)      x.begin(), x.end()
#define rep(i,n)    for (i64 i = 0; i < (n); ++i)
#define reps(i,s,t) for (i64 i = (s); i <= (t); ++i)
#define repr(i,s,t) for (i64 i = (s); i >= (t); --i)
#define LF          '\n'

#ifdef DBG
#define trace(...) _trace(#__VA_ARGS__, __VA_ARGS__);
#else
#define trace(...)
#endif

using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template<class T, class U>inline bool chmax(T &a, const U &b){return b>a ? (a=b,1) : 0;}
template<class T, class U>inline bool chmin(T &a, const U &b){return b<a ? (a=b,1) : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template<class T>
ostream& operator<< (ostream &os, const vector<T> &vec) {
    rep(i, vec.size()) os << vec[i] << (i+1 == vec.size() ? "" : " ");
    return os;
}

template<class T, class U>
ostream& operator<< (ostream &os, const pair<T, U> &p) {
    return os << p.first << ' ' << p.second;
}

template <class T>
void _trace(const char *s, T&& x)
{
    clog << '{';
    while(*s != '\0' && *s != ',') clog << *(s++);
    clog << ":" << setw(3) << x << '}' << endl;
}

template <class Head, class... Tail>
void _trace(const char *s, Head&& head, Tail&&... tail)
{
    clog << '{';
    while(*s != ',') clog << *(s++);
    clog << ":" << setw(3) << head << "}, ";
    for (++s; !isgraph(*s); ++s);
    _trace(s, std::forward<Tail>(tail)...);
}
// }}}

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

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << min(a,b) + min(c,d) << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <deque>
#include <set>
#include <numeric>
using namespace std;
using ll = long long;

#define no "no"
#define No "No"
#define NO "NO"
#define yes "yes"
#define Yes "Yes"
#define YES "YES"
#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(elem, _list) for(auto& (elem) : (_list))
#define view(_list) foreach(e, _list){ cout << e << sp; } cout << next
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define ALL(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e)
#define INF 1e+9
#define PI acos(-1)
#define TAU PI * 2
#define EPS 0.00000001
const ll MOD = 998244353;

int main() {
    int n, k;
    cin >> n >> k;
    vector<bool> v(n, false);
    int ans = 0;
    rep(i, k){
        int d;
        cin >> d;
        rep(j, d){
            int a;
            cin >> a;
            a--;
            v[a] = true;
        }
    }

    rep(i, n){
        if(!v[i]){
            ans++;
        }
    }

    println(ans);
}

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

int main()
{
  int n,k;
  cin>>n>>k;
  
  int count = 0;
  for(int i=1;i<n+1;i++)
  {
    if(i+k <= n+1)
      count++;
    else
      break;
  }
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  int x,y,a;
  char d;
  int in[10][10]={0};
  while(cin>>x>>d>>y>>d>>a){
    if(a==1){
      loop(i,-1,2){
	loop(j,-1,2){
	  if(i&&j)continue;
	  if(y+i>=0 &&y+i<10 && x+j>=0&&x+j<10)in[y+i][x+j]++;
	}
      }
    }else if(a==2){
      loop(i,-1,2){
	loop(j,-1,2){
	  if(y+i>=0 &&y+i<10 && x+j>=0&&x+j<10)in[y+i][x+j]++;
	}
      }
    }else if(a==3){
      loop(i,-2,3){
	loop(j,-2,3){
	  if(abs(i)+abs(j)>2)continue;
	  if(y+i>=0 &&y+i<10 && x+j>=0&&x+j<10)in[y+i][x+j]++;
	}
      }
    }
  }
  int co=0;
  int max=0;
  rep(i,10){
    rep(j,10){
      if(!in[i][j])co++;
      if(max<in[i][j])max=in[i][j];
    }
  }
  cout<<co<<endl<<max<<endl;
}

Measured memory_bytes: 1160
//
//  main.cpp
//  Study
//
//  Created by 佐々木勇星 on 2020/03/12.
//  Copyright © 2020 佐々木勇星. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <map>

using namespace std;


int main(int argc, const char * argv[]) {

    int m, d, ans = 0;
    
    cin >> m >> d;
    
    for(int i=11; i<=d; i++)
    {
        int d10 = i / 10;
        int d1 = i - d10 * 10;
        
        if(d1 <= 1 || d10 <= 1) continue;
        
        for(int j=1; j<=m; j++)
        {
            if( d10 * d1 == j) {
                ans++;
                //cout << "d10 = " << d10 << ", d1 = " << d1 << endl;

                //cout << "m = " << j << endl;
            }
        }
        
    }
    
    cout << ans << endl;
    
    return 0;
    
}


Measured memory_bytes: 256
/*
 
श्रीगुरु चरन सरोज रज
निजमनु मुकुरु सुधारि
बरनउँ रघुबर बिमल जसु
जो दायकु फल चारि
बुद्धिहीन तनु जानिके, सुमिरौं पवन-कुमार
बल बुधि बिद्या देहु मोहिं, हरहु कलेस बिकार 
 
*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD (ll)1000000007

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    cout<<pow(n,3);
}

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

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int N = sc.nextInt();
        int[] a = new int[3 * N];
        for (int i = 0; i < 3 * N; ++i) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        long sum = 0;
        for (int i = N; i < 3 * N; i += 2) {
            sum += a[i];
        }
        _out.println(sum);
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 91888
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ulli unsigned long long int
#define what_is(x) cerr << #x << " is " << x << endl;
#define pi 2*acos(0.0)
#define F  first
#define S  second
//#define endl '\n'
#define all(x) x.begin(),x.end()
using namespace std;
const lli INF = 1e18L+5;
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}*/
int main()
{
//cout.precision(10);
//cout.setf(ios::fixed,ios::floatfield);
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
	lli T=1;
    //cin>>T;
	while(T--)
	{
		lli n,i;
		cin>>n;
		vector<double> v;
		double z,ans;
		for(i=0;i<n;i++)
		{
			cin>>z;
			v.pb(z);
		}
		sort(v.begin(),v.end());
		ans=(double)(v[0]+v[1])/2;
		for(i=2;i<n;i++)
		{
			ans=(ans+v[i])/2;
		}
		cout<<ans<<endl;
	}
}


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

#define mod 1000000007
#define pll pair<long long,long long>
#define pdd pair<long double,long double>
#define mp make_pair
#define pb push_back
priority_queue<pll,vector<pll>,greater<pll> >pq;

int n,w;
vector<vector<long long int> >dp(101,vector<long long int>(100001,0));
vector<int>weight(101),value(101);

long long int solve(int i,int w){
    if(i==n)
        return 0;
    if(dp[i][w]!=0)
        return dp[i][w];
    if(weight[i]<=w)
        dp[i][w]=value[i]+solve(i+1,w-weight[i]);
    dp[i][w]=max(dp[i][w],solve(i+1,w));
    return dp[i][w];
}

int main(){
    cin>>n>>w;
    for(int i=0;i<n;i++){
        cin>>weight[i]>>value[i];
    }
    cout<<solve(0,w);

    return 0;
}



Measured memory_bytes: 80256
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
 
#define loop(i,b) for(int i=0;i<n;i++) 
#define min(a,b) (a < b ? a : b)
 
int main(){
	int n,res = 0;
	vector<int> a;
	cin >> n;
	loop(i,n){
		int k;
		cin >> k;
		a.push_back(k);
	}
	sort(a.begin(),a.end());
	int k = a[0];
	int counter = 0;
	for(int i=0;i<n;i++){
		if(k != a[i]){
			if(k > counter)res += counter;
			else res += counter - k;
			counter = 1;
			k = a[i];
		}else{
			counter++;
		}
	}
	if(k > counter)res += counter;
	else res += counter - k;
	cout << res << endl;
}

Measured memory_bytes: 892
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		sc.close();
		String s = "C";
		if(n >= 1000) s = "D";
		ou.println("AB" + s);
		ou.flush();
	}
}

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


class sample
{

	static void Main()
	{
		int N = Convert.ToInt32(Console.ReadLine());
		string[] input = Console.ReadLine().Split(' ');
		List<double> num = new List<double>();

		for(int i = 0;i<input.Length;i++)
		{
			num.Add(Convert.ToDouble(input[i]));

		}

		for(int i =0;i<num.Count;i++)
		{
			if(num[i]%2d > 0d)
			{
				num[i]=3;
			}
		}


		string flag ="APPROVED";

		for(int i=0;i<num.Count;i++)
		{
			if(num[i]%3 != 0 && num[i]%5 != 0)
			{
				flag = "DENIED";
			}
		}
		Console.WriteLine(flag);
	}
}	
	



Measured memory_bytes: 11604
import sys
from collections import deque
from operator import itemgetter
input = sys.stdin.readline

def main():
    n = int(input())
    p = [list(map(int, input().split()))+[i] for i in range(n)]
    tree = [[] for _ in range(n)]
    
    p.sort()
    for i in range(n-1):
        if p[i][0] == p[i+1][0]:
            tree[p[i][2]].append(p[i+1][2])
            tree[p[i+1][2]].append(p[i][2])

    p.sort(key=itemgetter(1))
    for i in range(n-1):
        if p[i][1] == p[i+1][1]:
            tree[p[i][2]].append(p[i+1][2])
            tree[p[i+1][2]].append(p[i][2])

    p.sort(key=itemgetter(2))

    
    already = [False]*n
    ans = -n
    for i in range(n):
        if already[i]:
            continue
        already[i] = True
        not_yet = deque([i])
        key_x = {p[i][0]}
        key_y = {p[i][1]}
        while not_yet:
            key = not_yet.popleft()
            for v in tree[key]:
                if already[v]:
                    continue
                already[v] = True
                key_x.add(p[v][0])
                key_y.add(p[v][1])
                not_yet.append(v)
        ans += len(key_x)*len(key_y)
    
    print(ans)
        
    
    
if __name__ == "__main__":
    main()



Measured memory_bytes: 45628
#include<stdio.h>
#include<math.h>

struct point{double x,y;};

void koch(int n, struct point p1, struct point p2){
  struct point  a,b,c;
  double th=M_PI/3;

  if(n==0) return;

  a.x=(2.0*p1.x+1.0*p2.x)/3.0;
  a.y=(2.0*p1.y+1.0*p2.y)/3.0;
  b.x=(1.0*p1.x+2.0*p2.x)/3.0;
  b.y=(1.0*p1.y+2.0*p2.y)/3.0;
  c.x=(b.x-a.x)*cos(th)-(b.y-a.y)*sin(th)+a.x;
  c.y=(b.x-a.x)*sin(th)+(b.y-a.y)*cos(th)+a.y;

  koch(n-1,p1,a);
  printf("%.8f %.8f\n",a.x,a.y);
  koch(n-1,a,c);
  printf("%.8f %.8f\n",c.x,c.y);
  koch(n-1,c,b);
  printf("%.8f %.8f\n",b.x,b.y);
  koch(n-1,b,p2);

}

int main(){
  int n;
  struct point p1,p2;

  scanf("%d",&n);

  p1.x=0;
  p1.y=0;
  p2.x=100;
  p2.y=0;

  printf("%.8f %.8f\n",p1.x,p1.y);
  koch(n,p1,p2);
  printf("%.8f %.8f\n",p2.x,p2.y);

  return 0;
}


Measured memory_bytes: 2048
N, A, B, C = map(int, input().split())
T = []
for i in range(N):
    T.append(int(input()))

ans = float("inf")
def loop(K):
    global ans
    abs_A = []
    abs_B = []
    abs_C = []
    for i in range(len(K)):
        abs_A.append(abs(A - K[i]))
        abs_B.append(abs(B - K[i]))
        abs_C.append(abs(C - K[i]))
    for i in range(len(K)):
        for j in range(len(K)):
            for k in range(len(K)):
                if i != j and j != k and k != i:
                    ans = min(ans, 10*(N-len(K)) + abs_A[i] + abs_B[j] + abs_C[k])
    if len(K) > 3:
        Next = []
        for i in range(len(K)):
            for j in range(i+1, len(K)):
                for p in range(len(K)):
                    if p != i and p != j:
                        Next.append(K[p])
                Next.append(K[i] + K[j])
                loop(Next)
                Next = []

loop(T)
print(ans)

Measured memory_bytes: 75568
#include <iostream>
using namespace std;
int main(void){
    string S;
    cin>>S;
    if (S[0]=='S'){
        cout<<"Cloudy"<<endl;
    }
    else if(S[0]=='C'){
        cout<<"Rainy"<<endl;
    }
    else{
        cout<<"Sunny"<<endl;
    }
    return 0;
}


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

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


int main() {
    int n;
    cin >> n;
    string s;
    vector<ll> march(5,0);
    for(int i = 0; i < n; i++){
        cin >> s;
        if(s[0] == 'M'){march[0]++;}
        else if(s[0] == 'A'){march[1]++;}
        else if(s[0] == 'R'){march[2]++;}
        else if(s[0] == 'C'){march[3]++;}
        else if(s[0] == 'H'){march[4]++;}
    }
    ll ans = 0;
    ans += march[0]*march[1]*march[2];
    ans += march[0]*march[1]*march[3];
    ans += march[0]*march[1]*march[4];
    ans += march[0]*march[2]*march[3];
    ans += march[0]*march[2]*march[4];
    ans += march[0]*march[3]*march[4];
    ans += march[1]*march[2]*march[3];
    ans += march[1]*march[2]*march[4];
    ans += march[1]*march[3]*march[4];
    ans += march[2]*march[3]*march[4];
    cout << ans << endl;
    return 0;
}


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

int main(){
    string s;
    cin >> s;
    if(s.at(0) == s.at(1) ||
    s.at(1) == s.at(2) ||
    s.at(2) == s.at(3)){
        cout << "Bad" << endl;
    } else {
        cout << "Good" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
use std::io::{stdin, Read};
const MOD: usize = 1000000007;
fn gcd(a: usize, b: usize) -> usize {
    match b {
        0 => a,
        _ => gcd(b, a % b),
    }
}

fn powmod(base: usize, exp: usize, m: usize) -> usize {
    let b: Vec<bool> = format!("{:b}", exp)
        .chars()
        .map(|x| x.to_digit(10).unwrap() != 0)
        .collect();
    let mut v = 1;
    for bi in b {
        v *= v;
        v %= m;
        if bi {
            v *= base;
            v %= m
        }
    }
    return v % m;
}

fn invmod(x: usize, m: usize) -> usize {
    powmod(x, m - 2, m)
}

fn prime_factors(x: usize) -> Vec<usize> {
    let mut res = vec![];
    let mut y = x;
    let mut p = 2;
    let upper = (y as f64).sqrt() as usize;
    while y > 1 && p <= upper {
        match y % p {
            0 => {
                res.push(p);
                y /= p;
            }
            _ => {
                p += 1;
            }
        }
    }
    if y > 1 {
        res.push(y)
    }
    return res;
}

fn get_factorials(n: usize, m: usize) -> Vec<usize> {
    let mut res = vec![0; n as usize];
    res[0] = 1;
    for i in 1..(n as usize) {
        res[i] = (res[i - 1] * (i as usize)) % m;
    }
    res
}

fn get_facinvs(n: usize, m: usize, facts: &Vec<usize>) -> Vec<usize> {
    let mut res = vec![0; n];
    res[n - 1] = invmod(facts[n - 1], m);
    for i in (0..(n - 1)).rev() {
        res[i] = (res[i + 1] * (i + 1)) % m;
    }
    res
}

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: ident) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn combmod(a: usize, b: usize) -> usize {
    let mut x = 1;
    for i in 0..b {
        x *= a - i;
        x %= MOD;
    }
    let mut y = 1;
    for i in 1..(b + 1) {
        y *= i;
        y %= MOD;
    }
    let y = invmod(y, MOD);
    (x * y) % MOD
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    let mut it = s.split_whitespace();
    let (n, a, b): (usize, usize, usize) = parse!(it, 3);
    let ret = 10 * MOD + powmod(2, n, MOD) - combmod(n, a) - combmod(n, b) - 1;
    let ret = ret % MOD;
    println!("{}", ret);
}


Measured memory_bytes: 4352
x = int(raw_input())
a = map(int, raw_input().split())
b = map(int, raw_input().split())
c = map(int, raw_input().split())

a = sorted(a)
b = sorted(b)
c = sorted(c)

def get_res(arr_u, arr_l, arr_res):
    ind_u, ind_l = 0, 0
    acc = 0
    res = []

    while ind_l < len(arr_l):
        while ind_u < len(arr_u) and arr_u[ind_u] < arr_l[ind_l]:
            acc += arr_res[ind_u]
            ind_u += 1

        while ind_l < len(arr_u) and (ind_u == len(arr_u) or arr_u[ind_u] >= arr_l[ind_l]):
            res.append(acc)
            ind_l += 1

    return res

res_b = get_res(a, b, [1,]*len(b))
res_c = get_res(b, c, res_b)
print sum(res_c)


Measured memory_bytes: 18636
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	int N; cin>>N;
	int A[N+1],B[N];
	for(int i=0;i<N+1;i++)
		cin>>A[i];
	for(int i=0;i<N;i++)
		cin>>B[i];
	ll ans = 0;
	
	for(int i=0;i<N;i++)
	{
		if(A[i]<=B[i])
		{
			ans += A[i];
			B[i] -= A[i];
			A[i] = 0;
			if(A[i+1]<=B[i])
			{
				ans += A[i+1];
				A[i+1] = 0;
				B[i] -= A[i+1];
			}
			else
			{
				ans += B[i];
				A[i+1] -= B[i];
			}
		}
		else
		{
			ans += B[i];
			//A[i] -= B[i];
		}		
	}
	cout<<ans<<"\n";
	
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int a[30]={};
  for(int i=0,k;i<28;i++){
    cin>>k;
    a[k-1]=1;
  }
  for(int i=0;i<30;i++){
    if(!a[i]) cout<<i+1<<endl;
  }
  return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
int i,j,n,a,b,s=0,p=1, ans;
int main() {
    scanf("%d",&n);
    if(n%2) {ans=n/2;ans++;}
    else ans=n/2;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(arr) (int)(arr).size()
#define rng(arr) arr.begin(), arr.end()
#define show(x) cout << #x << " = " << x << endl;
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
typedef long long int ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

void Main() {
  Cin(int, n, k);
  Cins(int, n, a);

  cout << ((n - 1 + k - 1 - 1) / (k - 1)) << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
int fg(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
signed main(){
 double a,b,c,d;
 cin>>a>>b>>c>>d;
 double s=ceil(a/d);
 double t=ceil(c/b);
  if(s<t){
  cout<<"No";
  }
  else{
    cout<<"Yes";
  }
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()


 
void solve(){
 ll a,b,c,k;
  cin >> a >> b>> c >> k;
  
  if(k<=a) cout << k << endl;
  else if(k<=a+b) cout << a << endl;
  else cout << a-(k-a-b) << endl;
  
 
}

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


Measured memory_bytes: 3652
#!/usr/bin/env python3
import sys


def solve(S: str, T: str, A: int, B: int, U: str):
    if U ==S and A >=1:
        A -= 1
    if U == T and B >=1:
        B -=1
    print(A, B)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    U = next(tokens)  # type: str
    solve(S, T, A, B, U)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;
//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
 
 
 
 


ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}













bool compare(pi a,pi b){
     if(a.fi-a.se>b.fi-b.se)return  true;
     else if(a.fi-a.se==b.fi-b.se&&a.se<b.se)return true;
     return false;
}




const int N=1000005;
int pr[1000005];
int main()
{
     int n;
     cin>>n;
     int a[n];
     for(int i=0;i<n;i++)cin>>a[i];
     int b[n];
     for(int i=1;i<=n;i++)b[i-1]=a[i-1]-i;
     sort(b,b+n);
     int mid=n/2;
     ll sum=0LL;
     for(int i=0;i<n;i++){
          sum+=abs(b[i]-b[mid]);
     }
     cout<<sum;

}




 
 

















Measured memory_bytes: 1792
#include <stdio.h>
#define MOD 100003
#define SIZE 200006
int hashTable[SIZE];
long long count[SIZE];
void sort(char *t){
    for(int i = 0;i<10;i++){
        for(int j = i+1;j<10;j++){
            if(t[i]>t[j]){
                char c = t[i];
                t[i] = t[j];
                t[j] = c;
            }
        }
    }
}
int computeHash(char *t){
    int hash = 5381;
    int c;
    while(c=*t++){
        hash = ((hash<<5)%MOD + hash + c)%MOD;
    }
    return hash%MOD;
}
int compare(char *s1, char *s2){
    for(int i = 0;s1[i];i++){
        if(s1[i]!=s2[i]) return 0;
    }
    return 1;
}
char s[100020][21];
int getID(int hash,int id){
    while ( hashTable[hash]!=-1 )
    {
        int t = hashTable[hash];
        if(compare(s[t],s[id])) return hash;
        hash++;
        if(hash==SIZE) hash = 0;
    }
    return hash;
    
}
void init(){
    for(int i = 0;i<SIZE;i++) {
        hashTable[i] = -1;
        count[i] = 0;
    }
}
void MRoy(){
    init();
    int n;
    scanf("%d",&n);
    for(int i = 0;i<n;i++){
        scanf("%s",s[i]);
        sort(s[i]);
        int t = computeHash(s[i]);
        int id = getID(t,i);
        count[id]++;
        hashTable[id]=i;
    }
    long long int Ans = 0;
    for(int i = 0;i<SIZE;i++){
        Ans += (long long)(count[i]*(count[i]-1))/2;
    }
    printf("%lld\n",Ans);
    return;
}
int main(){
    MRoy();
    return 0;
}

/*
3
acornistnt
peanutbomb
constraint
*/

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

using namespace std;

stack<int> DigitStack;
stack<char> OpStack;
string Formulation;

void calculation() {
	int num2, result;
	char ch;

	ch = OpStack.top();
	OpStack.pop();
	switch (ch)
	{
	case '+': 
		num2 = DigitStack.top();
		DigitStack.pop();
		result = DigitStack.top();
		DigitStack.pop();
		result += num2; 
		break;
	case '-': 
		num2 = DigitStack.top();
		DigitStack.pop();
		result = DigitStack.top();
		DigitStack.pop(); 
		result -= num2; 
		break;
	case '*':
		num2 = DigitStack.top();
		DigitStack.pop();
		result = DigitStack.top();
		DigitStack.pop();
		result *= num2; 
		break;
	case '/': 
		num2 = DigitStack.top();
		DigitStack.pop();
		result = DigitStack.top();
		DigitStack.pop();
		result /= num2; break;
	default:return;
	}
	DigitStack.push(result);
}

int calculateNumber(int *pIndex) {
	int sum;
	string tmp;
	stringstream ss;

	tmp += Formulation[(*pIndex)++];
	while (isdigit(Formulation[*pIndex])) {
		tmp += Formulation[*pIndex];
		(*pIndex)++;
	}
	//cout << tmp << endl;
	ss << tmp;
	ss >> sum;
	ss.clear();
	(*pIndex)--;

	return sum;
}

int priorityOfOperator(char ch)
{
	switch (ch)
	{
	case '(':
		return 3;
	case '*':
	case '/':
		return 2;
	case '+':
	case '-':
		return 1;
	default:
		return 0;
	}
}

void solve() {
	int i, num, len;
	char cTmp;

	len = Formulation.size() - 1;
	for (i = 0; i < len; i++) {
		cTmp = Formulation[i];
		
		if (isdigit(cTmp)) {
			num = calculateNumber(&i);
			DigitStack.push(num);
			continue;
		}

		if ( cTmp == '(' || OpStack.empty() || OpStack.top() == '(' ) {
			OpStack.push(cTmp);
			continue;
		}

	    if (priorityOfOperator(cTmp) > priorityOfOperator(OpStack.top())) {
			OpStack.push(cTmp);
		}		
		else {
			do {
				calculation();
			} while ( !OpStack.empty() && OpStack.top() != '(' && priorityOfOperator(cTmp) <= priorityOfOperator(OpStack.top()));

			if (cTmp == ')') {
				OpStack.pop();
			}
			else {
				OpStack.push(cTmp);
			}
		}
	}

	while (!OpStack.empty()) {
		calculation();
	}

}

int main() {
	int n, result;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> Formulation;
		//cout << Formulation << endl;
		solve();
		result = DigitStack.top();
		DigitStack.pop();
		cout << result << endl;
	}

	return 0;
}


Measured memory_bytes: 3156
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    
    int temp = n;
    vector<int> a;
    for(int i = 0; i < 3; i++){
        a.push_back(temp % 10);
        temp /= 10;
    }
    
    int mult = 1;
    if(a[0] == 1){
        n += 8;
    }
    else if(a[0] == 9){
        n -= 8;
    }
    else    ;
    
    for(int i = 1; i < 3; i++){
        mult *= 10;
        if(a[i] == 1){
            n += 8 * mult;
        }
        else if(a[i] == 9){
            n -= 8 * mult;
        }
        else    ;
    }
    
    cout << n << endl;
}

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

int main() {
  ll A,B;
  cin >> A >> B;
  if(A % 2 != B % 2){
      cout << "IMPOSSIBLE" << endl;
  }else{
      cout << (A+B)/2 << endl;
  }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define repc(i, s, t) for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(ios_base::fixed);
    cout.precision(12);

    var(int, K, a, b);
    const int x = (a + K - 1) / K;
    if (x * K <= b) {
        print("OK");
    } else {
        print("NG");
    }

    return 0;
}


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

int main(){
    int a,b,c,n=0;
    cin>>a>>b>>c;
    for(int i=1;i<b+1;i++){
        if((a*i)%b==c){
            n++;
            break;
        } 
    }
    if(n==1) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	int A, B, C;
	cin >> A >> B >> C;

	vector<int> li(3);
	li[0] = A; li[1] = B; li[2] = C;
	sort(li.begin(), li.end());
	int count = 0;
	count += (li[1] - li[0]) / 2;
	if ((li[1] - li[0]) % 2 == 0) {
		count += li[2] - li[1];
	}
	else {
		count += li[2] - li[1] + 2;
	}
	cout << count;
	return 0;
}

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

int main() {
  long long x, y; cin >> x >> y;
  long long ans = 1LL << 60;
  if (x <= y) ans = min(ans, y-x);  // 反転しない
  if (-x <= y) ans = min(ans, y+x+1);  // 最初に反転
  if (x <= -y) ans = min(ans, -y-x+1);  // 最後に反転
  if (-x <= -y) ans = min(ans, -y+x+2);  // 最初と最後に反転
  cout << ans << endl;
}

Measured memory_bytes: 256
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    ab = [list(map(int, readline().split())) for _ in range(n)]
    ab.sort()
    print((ab[-1][0] - ab[0][0] + 1) + (ab[0][0] - 1) + (ab[-1][1]))


if __name__ == '__main__':
    solve()


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

int main() {
  int a, b, c;
  std::cin >> a >> b >> c;
  if (a==b && b == c) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
n,m,*t=map(int,open(0).read().split())
a=sorted(t[:n])[::-1]
m=0
for c,b in sorted(zip(t[n+1::2],t[n::2]))[::-1]:
 while a and c>a[-1]and b:m+=c;b-=1;a.pop()
print(m+sum(a))

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

int main(){
  int a,b;
  cin >> a >> b;
  
  int result[]={a+b,a-b,a*b};
  int max=result[0];
  for(int i=1; i<3; i++) if(max<result[i]) max = result[i];
  cout << max << endl;
  return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  a *= (b < 10 ? 10 : (b < 100 ? 100 : 1000));
  a += b;
  int i;
  for (i = 0; ; i++) {
    if (i * i == a) {
      cout << "Yes" << endl;
      break;
    }
    if (i * i > a) {
      cout << "No" << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        long tmp = 0;
        long comp = 0;
        for (long i = A; B >= i;) {
            i = i * 2;
            tmp++;
        }
        System.out.println(tmp);
    }
}

Measured memory_bytes: 21972
#include <iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if (a<b){
		cout<<"a < b"<<endl;
	}else if(a>b){
		cout<<"a > b"<<endl;
	}else{
		cout<<"a == b"<<endl;
	}
	return 0;
}


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


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

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

int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	ll x, y;
	cin >>x >>y;
	
	puts(abs(y-x)<2? "Brown":"Alice");
	return 0;
}


Measured memory_bytes: 256
l = list(int(input()) for i in range(5))
A=[]
sum=0

for i in range(5):
    if l[i]%10 == 0:
        A.append(0)
    else:
        A.append(10-(l[i]%10))
    
if A[0]==A[1]==A[2]==A[3]==A[4]==0:
    print(l[0]+l[1]+l[2]+l[3]+l[4])
else:
    for k in range(5):
        sum += l[k]+A[k]
    print(sum-max(A))
        

Measured memory_bytes: 3064
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		Arrays.sort(arr);
		int total = 0;
		int count = 0;
		int prev = 0;
		for (int i = 0; i < n; i++) {
			if (arr[i] != prev) {
				if (prev > count) {
					total += count;
				} else {
					total+= count - prev;
				}
				prev = arr[i];
				count = 1;
			} else {
				count++;
			}
		}
		if (prev > count) {
			total += count;
		} else {
			total+= count - prev;
		}
		System.out.println(total);
	}
}


Measured memory_bytes: 51824
#include "bits/stdc++.h"
#define ll long long
#define lld long double
#define MOD 1000000007
#define inf 1000000000000000000LL
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
ll power(ll x,ll y, ll md=MOD){ll res = 1;x%=md;while(y){if(y&1)res = (res*x)%md;x *= x; if(x>=md) x %= md; y >>= 1;}return res;}
 
using namespace std;

#define endl '\n'
#define int ll

bool check(string s) {
    int n = s.size();
    for(int i=0;i<n;i++) {
        if(s[i]!=s[n-1-i]) return false;
    }
    return true;
}

signed main() {
    fast;

    int n;
    cin>>n;

    map<int,int> cnt, val;
    vector<int> v(n);

    for(int i=0;i<n;i++) {
        int temp;
        cin>>temp;
        v[i] = temp;

        cnt[temp]++;
    }

    int s = 0;
    for(auto x: cnt) s += (x.s*(x.s-1))/2;


    // cout<<s<<endl;
    for(auto x: cnt) {
        int v = s - (x.s*(x.s-1))/2;

        val[x.f] = (v+((x.s-1)*(x.s-2))/2);
    }
    // cout<<ans;

    for(int i=0;i<n;i++) cout<<val[v[i]]<<endl;
}

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

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

	vector<p> xy(N);
	rep(i, N) cin >> xy[i].first >> xy[i].second;
	vector<double> dist(N);
	rep(i, N) dist[i] = sqrt(double(pow(xy[i].first, 2)) + double(pow(xy[i].second, 2)));

	int ans = 0;
	rep(i, N) {
		if(D >= dist[i]) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6512
import java.util.Scanner;

public final class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int r = scanner.nextInt();

			if (n >= 10 ) {
				System.out.println(r);
			} else {
				System.out.println(r + 100 * (10 - n));
			}
		}
	}

}


Measured memory_bytes: 23124
import sys
import numpy as np
x = int(input())
a = np.arange(1500)
a = np.power(a, 5)

for i in range(1500):
    for j in range(1500):
        if (a[i] + a[j]) == x:
            tmp = i
            i = j
            j = -tmp
            print(i, j)
            sys.exit()
        elif (a[i] - a[j]) == x:
            print(i, j)
            sys.exit()

Measured memory_bytes: 27208