akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int N;cin >> N;
    vector<int> A(N);
    REP(i,N) cin >> A[i];
    sort ALL(A);A.pb(INF);
    ll ans = 0;
    REP(i,N){
        repp(j,i,0){
            auto Iter = upper_bound(A.begin(),A.begin()+j,A[i]-A[j]);
            auto cnt = A.begin()+j - Iter;
            ans += cnt;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>

using namespace std;
int main(void){
    int N;
    cin>>N;
    int p[N];
    for(int i=0;i<N;i++){
        cin>>p[i];
    }
    sort(p,p+N);
    int sum=0;
    for(int i=0;i<N;i++){
      if(i==N-1) {sum+=p[i]/2;}
      else {sum+=p[i];}
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 256
;; -*- coding:utf-8 -*-

(defparameter *file-path* *load-pathname*)

(deftype unum () '(integer 0 100000))
(defun clip-to-string ()
  (with-output-to-string (out)
    (sb-ext:run-program "C:/msys64/usr/bin/cat.exe" '("/dev/clipboard") :output out)))

(defun test ()
  (with-input-from-string (*standard-input* (clip-to-string))
    (load *file-path*)))

(declaim (inline manhattan-dist
		 same-parity-p
		 reachable-p))
(defun manhattan-dist (x1 y1 x2 y2)
  (+ (abs (- x1 x2)) (abs (- y1 y2))))

(defun same-parity-p (m n)
  (or (and (evenp m) (evenp n))
      (and (oddp m) (oddp n))))

(defun reachable-p (t1 t2 x1 y1 x2 y2)
  (let ((dist (manhattan-dist x1 y1 x2 y2))
	(duration (- t2 t1)))
    (and (>= duration dist)
	 (same-parity-p duration dist))))

(defun main ()
  (declare (optimize (speed 3) (safety 0)))
  (let ((num (read)))
    (declare (unum num))
    (loop for i from 0 below num
       for current-time = 0 then dest-time
       for current-x = 0 then dest-x
       for current-y = 0 then dest-y
       for dest-time of-type unum = (read)
       for dest-x of-type unum  = (read)
       for dest-y of-type unum = (read)
       do (unless (reachable-p current-time dest-time current-x current-y dest-x dest-y)
	    (write-line "No")
	    (return))
       finally (write-line "Yes"))))

(main)


Measured memory_bytes: 57960
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <typeinfo>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

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

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;  // check the limits, dummy

typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
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;
}

template <class T>
void print(const vector<T> v) {
  cout << "[ ";
  F0R(i, v.size()) { cout << v[i] << ' '; }
  cout << "]" << '\n';
}

int mod(int i, int j) {
  return (i % j) < 0 ? (i % j) + 0 + (j < 0 ? -j : j) : (i % j + 0);
}

// --------------------------------------------------------
// This is tool
// --------------------------------------------------------
void Main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  ll X;
  int B, C, D, N, M, d;
  cin >> X;
  d = 0;
  ll sum = 100;
  while (sum < X) {
    sum = sum + sum * 0.01;
    d++;
    // cout << sum << endl;
  }
  cout << d << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;
 
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
#define PI acos(-1)
 
const double EPS = 1e-10;
 
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

int main(){
    int a,b,h,m; cin >> a >> b >> h >> m;
    double l = (60*h+m)/2.0;
    double r = 6*m;
    double th = abs(l-r);
    th = th*PI/180;
    double co = cos(th);
    double ans = a*a+b*b-2*a*b*co;
    ans = sqrt(ans);
    cout << fixed << setprecision(10);
    cout << ans << endl;
}


Measured memory_bytes: 4164
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>

using namespace std;

int main(void) {
	int dataset_num = 0;
	int sum = 0;
	int max = 0;
	int min = 1001;
	int score;
	int j_num;

	cin >> j_num;

	while (j_num != 0 && dataset_num < 20){
		for (int i = 0; i < j_num; i++){
			cin >> score;

			if (score > max) {
				max = score;
			}
			if (score < min) {
				min = score;
			}

			sum += score;
		}

		sum = sum - max - min;
		double ave_score = sum / (j_num-2);
		cout << ave_score << endl;

		cin >> j_num;
		dataset_num++;
		sum = 0;
		max = 0;
		min = 1001;
	}	
	return 0;
}

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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxN = 16;
const int maxpowN = 1 << 16;
const ll inf = 1e16;

int n;
ll val[maxpowN];
ll dp[maxpowN], a[maxN][maxN];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for0(i, n)
    {
        for0(j, n)
        {
            cin >> a[i][j];
        }
    }
    for0(mask, 1 << n)
    {
        for0(i, n)
        {
            if (mask >> i & 1)
            {
                for0(j, i)
                {
                    if (mask >> j & 1)
                    {
                        val[mask] += a[i][j];
                    }
                }
            }
        }
    }
    for0(mask, 1 << n)
    {
        dp[mask] = val[mask];
        for (int sub = mask; sub; sub = (sub - 1) & mask)
        {
            uax(dp[mask], dp[sub] + val[mask ^ sub]);
        }
        uax(dp[mask], 0LL);
    }
    cout << dp[(1 << n) - 1];
    return 0;
}


Measured memory_bytes: 1280
/**
*   @Author : MeGA
*   @InitTime :01/24/20 13:35:09
*   @Idea : 
*
*
*
*
*
*
*
**/
#include <bits/stdc++.h>
using namespace std;  
int sz[26];
vector<int>pos[26];
int main(){
#ifndef ONLINE_JUDGE
  // freopen("in","r",stdin);
  // freopen("out","w",stdout);
#endif
     string str;
     cin>>str;
          
     for(int i=0;i<str.size();i++){
        pos[str[i]-'a'].push_back(i+1);
     }

     string t;
     cin>>t;
     long long ans=0;
     int prev=0;
     for(char c:t){
        if(pos[c-'a'].size()==0){
           printf("-1");
           return 0;
        }else{
           int cur_idx=upper_bound(pos[c-'a'].begin(),pos[c-'a'].end(),prev)-pos[c-'a'].begin();
           if(cur_idx==pos[c-'a'].size()){
             cur_idx=pos[c-'a'][0];
           }else{
              cur_idx=pos[c-'a'][cur_idx];
           }
        //   cerr<<cur_idx<<endl;
           if(cur_idx <= prev){
     //     cerr<<str.size()<<" "<<prev<<" ho"<<endl;
              ans+=str.size()-prev+cur_idx;
           }else{
       //    cerr<<cur_idx<<" "<<prev<<" hoi"<<endl;
             ans+=(cur_idx-prev);
           }
           prev=cur_idx;
         }
     }

     printf("%lld",ans);


}

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

typedef long long ll;
typedef unsigned long long ull;

struct node {
  bool seen;
  vector<ll> next;
};

void calc(vector<ll> &ans, vector<struct node> &g, ll cur) {
  g[cur].seen = true;

  for (auto i : g[cur].next) {
    if (g[i].seen) continue;

    ans[i] += ans[cur];
    calc(ans, g, i);
  }
}

int main() {
  ll n, q;
  cin >> n >> q;

  vector<ll> ans(n, 0);
  vector<struct node> g(n, node{.seen = false});

  for (ll i = 0; i < n-1; ++i) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].next.push_back(b);
    g[b].next.push_back(a);
  }

  for (ll i = 0; i < q; ++i) {
    ll p, x;
    cin >> p >> x;
    p--;
    ans[p] += x;
  }

  calc(ans, g, 0);

  for (ll i = 0; i < n-1; ++i) {
    cout << ans[i] << " ";
  }
  cout << ans[n-1] << endl;
    
  return 0;
}


Measured memory_bytes: 25856
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  int n, k;
  scan(n, k);
  int ans = 0;
  rep (i, n) {
    int h;
    scan(h);
    if (h >= k) {
      ans += 1;
    }
  }
  print(ans);

  return 0;
}


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

typedef long long int           ll;
typedef unsigned long long int  ull;

ull check_bit(ull N,int POS){return (N & (1ULL<<POS));}

vector<ull>v;
ull gaussian_elimination()
{
    int n=v.size();
    int ind=0;  // Array index
    for(int bit=log2(v[0]);bit>=0;bit--)
    {
        int x=ind;
        while(x<n&&check_bit(v[x],bit)==0)
            x++;
        if(x==n)
            continue; // skip if there is no number below ind where current bit is 1
        swap(v[ind],v[x]);
        for(int j=0;j<n;j++)
        {
            if(j!=ind&&check_bit(v[j],bit))
                v[j]^=v[ind];
        }
        ind++;
    }
    ull ans=v[0];
    for(int i=1;i<n;i++)
        ans=max(ans,ans^v[i]);
    return ans;
}
int main()
{

    int i,j,k,l,m,n,t,kase=1;
    cin>>n;//scanf("%d",&n);
    ull x;
    for(i=0;i<n;i++)
    {
        cin>>x;
        v.push_back(x);
    }
    
    vector<int> cnt(60,0);
    
    for(int i=0;i<n;i++){
        for(int j=0;j<60;j++){
            if(v[i]&(1LL<<j)) cnt[j]++;
        }
    }
    
    ll ans=0;
    
    for(int j=0;j<60;j++){
        if(cnt[j]%2){
            for(int i=0;i<n;i++){
                if(v[i]&(1LL<<j)) v[i]^=(1LL<<j);
            }
            ans+=(1LL<<j);
        }
        //cout<<ans<<endl;
    }
    
    sort(v.rbegin(),v.rend());
    
    //cout<<ans<<endl;
    
    cout<<ans+gaussian_elimination()*2<<"\n";
    return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
vector<P> a[15];
vector<int> alen(15);
    
int main(){
    int n;
    cin >> n;
    rep(i,n){
        cin >> alen[i];
        rep(j,alen[i]){
            int x, y;
            cin >> x >> y;
            a[i].push_back(make_pair(x-1,y));
        }
    }
    int ans = 0;

    rep(bit, 1<<n){
        int tman= 0;
        vector<int> pre(n,0);
        rep(i,n){
            int flag = bit & (1<<i);
            if(flag){
                tman++;
                pre[i] = 1;
                /*
                for(auto j : a[i]){
                    if(pre[j.first]==-1) pre[j.first] = j.second;
                    else if (pre[j.first]!=j.second){
                        tman = 0;
                        i = n;
                        break;
                    } 
                }*/
            }
        }
        rep(i,n){
            if (pre[i]){
                for(auto p : a[i]){
                    if(pre[p.first]!=p.second){
                        tman = 0;
                        i = n;
                        break;
                    }
                }
            }
        }
        ans = max(ans, tman);
    }

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

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

#define maxn 100010
#define INF 1e15
#define ff first
#define ss second
#define endl '\n'
typedef long long ll;

int n, m;
int arr[maxn];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> arr[i];
  priority_queue<pair<int,int>> pq;
  ll sum = 0;
  for (int i = 1; i <= n; ++i) {
    sum += arr[i];
    int x = ceil(arr[i]/2.);
    pq.push({x, i});
  }
  while (m--) {
    auto x = pq.top();
    pq.pop();
    int idx = x.ss;
    int d = x.ff;
    arr[idx] -= d;
    sum -= d;
    pq.push({ceil(arr[idx]/2.), idx});
  }
  cout << sum << endl;
}


Measured memory_bytes: 1784
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

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

int main() {
	int x; cin >> x;
	cout << 360 / gcd(360, x) << endl;
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint factorial(ll n) {
  mint answer = 1;
  while (n > 1) {
    answer *= n;
    n--;
  }
  return answer;
}

mint combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

mint permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

// setprecision(8) 桁数指定
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int p, q, r;
  cin >> p >> q >> r;
  // int ans = p + q + r - max(p, max(q, r));
  int ans = p + q + r - max({p, q, r});
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	cin>>s;
	if(s[0]==s[1]){
		cout<<"Bad"<<endl;
	}
	else if(s[1]==s[2]){
		cout<<"Bad"<<endl;
	}
	else if(s[2]==s[3]){
		cout<<"Bad"<<endl;
	}
	else cout<<"Good"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll x, a, b; cin >> x >> a >> b;
    cout << (x-a)%b << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	//数値の入力
		String str = sc.next();
      	int min = 753;
      	for(int i = 0; i+2 < str.length(); i++){
      	int ans = Math.abs(Character.getNumericValue(str.charAt(i))*100 
          + Character.getNumericValue(str.charAt(i+1))*10 
          +Character.getNumericValue(str.charAt(i+2))
          - 753);
          if(min>=ans){
            min = ans;
          }
        }
      	System.out.println(min);
    }
}

Measured memory_bytes: 35708
import           Control.Monad
import           Data.List

main :: IO ()
main = do
  [h, w, k] <- map read . words <$> getLine
  m <- getMat h
  print $ length [ 1 | rows <- subsequences [0..h-1],
                       cols <- subsequences [0..w-1],
                       numberBlack (paint rows cols m h w) == k ]

getMat 0 = return []
getMat i = do
  s <- getLine
  r <- getMat $ i - 1
  return $ s:r

numberBlack m =
  sum $ map (length . filter (== '#')) m

paint rows cols m h w =
  [ [ if i `elem` rows || j `elem` cols then '.' else m !! i !! j | j <- [0..w-1]] | i <- [0..h-1]]


Measured memory_bytes: 4900
#include <cstdio>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
// ----- very fast input/output ----- //
int read_int() {
	char ch = getchar_unlocked();
	int res = 0;
	while('0' <= ch && ch <= '9') {
		res = res * 10 + ch - '0';
		ch = getchar_unlocked();
	}
	return res;
}
void print_str(const char* str) {
	while(*str != '\0') {
		putchar_unlocked(*str);
		++str;
	}
}
char buf[1024];
void print_int(int x) {
	if(x < 0) {
		putchar_unlocked('-');
		x *= -1;
	}
	int ptr = 0, g;
	do {
		g = x / 10;
		buf[ptr++] = x - g * 10;
		x = g;
	} while(x > 0);
	while(ptr--) {
		putchar_unlocked(buf[ptr] + '0');
	}
}
// ----- main part ----- //
int N, sep[102400], dst[102400], depth[102400], par[102400];
int inputs[307200];
void find_depth(int pos) {
	for(int i = sep[pos]; i < sep[pos + 1]; ++i) {
		depth[dst[i]] = depth[pos] + 1;
		find_depth(dst[i]);
	}
}
int main() {
	// #1. read input
	N = read_int();
	for(int i = 0; i < 3 * N - 1; ++i) {
		inputs[i] = read_int();
	}
	// #2. construct tree
	int curpos = 0;
	for(int i = 0; i < N; ++i) {
		sep[inputs[curpos] + 1] = inputs[curpos + 1];
		curpos += inputs[curpos + 1] + 2;
	}
	for(int i = 0; i < N; ++i) {
		sep[i + 1] += sep[i];
	}
	curpos = 0;
	int root = 0;
	for(int i = 0; i < N; ++i) {
		int id = inputs[curpos];
		for(int j = sep[id]; j < sep[id + 1]; ++j) {
			dst[j] = inputs[curpos + j - sep[id] + 2];
			par[dst[j]] = id;
			root ^= dst[j];
		}
		root ^= i;
		curpos += inputs[curpos + 1] + 2;
	}
	par[root] = -1;
	find_depth(root);
	// step #3. print the answer
	for(int i = 0; i < root; ++i) {
		print_str("node ");
		print_int(i);
		print_str(": parent = ");
		print_int(par[i]);
		print_str(", depth = ");
		print_int(depth[i]);
		if(sep[i] == sep[i + 1]) {
			print_str(", leaf, []\n");
		}
		else {
			print_str(", internal node, [");
			print_int(dst[sep[i]]);
			for(int j = sep[i] + 1; j < sep[i + 1]; ++j) {
				putchar_unlocked(',');
				putchar_unlocked(' ');
				print_int(dst[j]);
			}
			putchar_unlocked(']');
			putchar_unlocked('\n');
		}
	}
	print_str("node ");
	print_int(root);
	print_str(": parent = ");
	print_int(par[root]);
	if(sep[root] == sep[root + 1]) {
		print_str(", depth = 0, root, []\n");
	}
	else {
		print_str(", depth = 0, root, [");
		print_int(dst[sep[root]]);
		for(int i = sep[root] + 1; i < sep[root + 1]; ++i) {
			putchar_unlocked(',');
			putchar_unlocked(' ');
			print_int(dst[i]);
		}
		putchar_unlocked(']');
		putchar_unlocked('\n');
	}
	for(int i = root + 1; i < N; ++i) {
		print_str("node ");
		print_int(i);
		print_str(": parent = ");
		print_int(par[i]);
		print_str(", depth = ");
		print_int(depth[i]);
		if(sep[i] == sep[i + 1]) {
			print_str(", leaf, []\n");
		}
		else {
			print_str(", internal node, [");
			print_int(dst[sep[i]]);
			for(int j = sep[i] + 1; j < sep[i + 1]; ++j) {
				putchar_unlocked(',');
				putchar_unlocked(' ');
				print_int(dst[j]);
			}
			putchar_unlocked(']');
			putchar_unlocked('\n');
		}
	}
	return 0;
}


Measured memory_bytes: 5232
from collections import deque
N,M = map(int,input().split())
l = [[] for _ in range(N+1)]
 
for _ in range(M):
  a,b = map(int,input().split())
  l[a].append(b)
  l[b].append(a)

check = [0]*(N+1)
cnt = 0
for i in range(1,N+1):
  if check[i] == 1:
    continue
  st = deque([i])
  check[i] = 1
  while st:
    s = st.popleft()
    for t in l[s]:
      if check[t] == 0:
        check[t] = 1
        st.append(t)
      continue
  cnt += 1

print(cnt-1)

Measured memory_bytes: 81712
#include <bits/stdc++.h>
#define endl '\n';
typedef long long ll;
const ll INF = 1e17 + 1;
const ll MAX = 2147483647;
const ll MOD = 1000003;

using namespace std;

ll min(ll x, ll y, ll z)
{
    return min(min(x, y), z);
}
ll max(ll x, ll y, ll z)
{
    return max(max(x, y), z);
}

ll min(ll x, ll y, ll z, ll o)
{
    return min(min(x, y, z), o);
}

ll _power(ll b, ll p)
{
    ll res = 1;
    while (p)
    {
        if (p % 2)
            res = (res * b) % MOD;
        b = (b * b) % MOD;
        p /= 2;
    }
    return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> duration(n + 1), end(n + 1);
    for (int i = 0; i < n; i++)
        cin >> duration[i] >> end[i];
    vector<int> indices;
    for (int i = 0; i < n; i++)
        indices.push_back(i);
    sort(indices.begin(), indices.end(), [&](int f, int s) {
        return end[f] < end[s];
    });

    int time = 0;
    for (int i = 0; i < n; i++)
    {
        int d = duration[indices[i]];
        int e = end[indices[i]];
        time += d;
        if(time > e )
        {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 2936
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

const ll MOD = 1e9 + 7;
template<class Type>
Type solve(Type res = Type()){
    ll N,M; cin >> N >> M;

    vector<bool> ok(N+2,true);
    for(int i = 0; i < M;i++){
        int a; cin >> a;
        ok[a] = false;
    }

    vector<ll> dp(N+2);
    dp[0] = 1;

    for(int i = 0; i < N;i++){
        for(int j = 1; j <= 2; j++){
            if(ok[i+j]){
                dp[i+j] += dp[i];
                dp[i+j] %= MOD;
            }
        }
    }
    res = dp[N];
    return res;
}
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    //solve<ll>(0);
    cout << fixed << setprecision(12) << solve<ll>() << endl;
    return 0;
}

Measured memory_bytes: 3960
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <bitset>
#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

struct T
{
	int x,y;
	T(int x, int y) : x(x), y(y) {}
};

signed main() {
	int n;
	std::cin >> n;
	std::vector<std::vector<T> > a(n,std::vector<T>());
	rep(i,n) {
		int m;
		std::cin >> m;
		rep(j,m) {
			int x,y;
			std::cin >> x >> y;
			a[i].emplace_back(x-1,y);
		}
	}

	int max = 0;
	for(int x=0;x<(1<<n);x++) {
		// check if valid
		std::bitset<15> xx = x;
		bool valid = true;
		rep(i,n) {
			if(xx[i]) for(auto t:a[i]) {
				if(xx[t.x]!=t.y) {
					valid = false;
					break;
				}
			}
			if(!valid) break;
		}
		if(!valid) continue;
		max = std::max(max,(int)xx.count());
	}
	print(max);

	return 0;
}


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

int main() 
{
    string s;
    cin >> s;
    auto lo = find(begin(s), end(s), 'A');
    auto hi = find(begin(s), end(s), 'Z');
    while (find(next(hi), end(s), 'Z') != end(s))
        hi = find(next(hi), end(s), 'Z');
    cout << 1 + distance(lo, hi) << endl;
}


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

using namespace std;

#define MAX_N 1
#define INF 1000000000 //1e9
#define PI 3.14159265359
#define mod 1000000007
#define ll long long int

int main(){
    ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin >> s;
	int flag = 0;
	
	for(int i =0 ; i < s.length(); i++)
	{
		if(s[i] == '7')
		{
			cout << "Yes" << "\n"; flag = 1;break;
		}
	}
	if(flag == 0) cout << "No" << "\n";
    
    
    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
  string h,k,a,s,ans;cin>>s;
  h="Sunny";k="Cloudy";a="Rainy";
  if(s==h){
    ans=k;
  }else if(s==k){
    ans=a;
  }else{
    ans=h;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = list(input())
sc = 0
for i in range(n):
  if i+k < n and t[i] == t[i+k]:
    t[i+k] = 'x'
print(t.count('r')*p + t.count('p')*s + t.count('s')*r)

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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int N,M,Q;
int A [2000] [2000];
int cntR [2001] [2001] [2],cntC [2001] [2001] [2];
int acc [2001] [2001];
int accR [2001] [2001] [2],accC [2001] [2001] [2];
bool vis [2000] [2000];
const int dx [] = {0,1,0,-1};
const int dy [] = {-1,0,1,0};

void dfs(int y,int x)
{
	vis [y] [x] = true;
	FOR(i,0,4){
		int ny = y + dy [i],nx = x + dx [i];
		if((ny >= 0 && ny < N && nx >= 0 && nx < M) == false) continue;
		if(vis [ny] [nx] == false && A [ny] [nx]){
			if(ny != y){
				cntR [max(ny,y)] [nx] [ny > y]++;
			}
			if(nx != x){
				cntC [max(nx,x)] [ny] [nx > x]++;
			}
			dfs(ny,nx);
		}
	}
}

int main()
{
	scanf("%d%d%d",&N,&M,&Q);
	FOR(i,0,N){
		char S [3000];
		scanf("%s",S);
		FOR(j,0,M){
			A [i] [j] = S [j] == '1';
		}
	}
	FOR(i,0,N) FOR(j,0,M){
		acc [i + 1] [j + 1] = acc [i + 1] [j] + acc [i] [j + 1] - acc [i] [j];
		if(vis [i] [j] == false && A [i] [j]){
			acc [i + 1] [j + 1]++;
			dfs(i,j);
		}
	}
	
	FOR(i,0,N + 1) FOR(j,0,M){
		accR [i] [j + 1] [0] = accR [i] [j] [0] + cntR [i] [j] [0];
		accR [i] [j + 1] [1] = accR [i] [j] [1] + cntR [i] [j] [1];
	}
	FOR(i,0,M + 1) FOR(j,0,N){
		accC [i] [j + 1] [0] += accC [i] [j] [0] + cntC [i] [j] [0];
		accC [i] [j + 1] [1] += accC [i] [j] [1] + cntC [i] [j] [1];
	}

	FOR(i,0,Q){
		int y1,x1,y2,x2;
		scanf("%d%d%d%d",&y1,&x1,&y2,&x2);
		y1--;
		x1--;
		int ans = 0;
		ans += accR [y1] [x2] [1] - accR [y1] [x1] [1];
		ans += accR [y2] [x2] [0] - accR [y2] [x1] [0];
		ans += accC [x1] [y2] [1] - accC [x1] [y1] [1];
		ans += accC [x2] [y2] [0] - accC [x2] [y1] [0];
		ans += acc [y2] [x2] - acc [y2] [x1] - acc [y1] [x2] + acc [y1] [x1];
		printf("%d\n",ans);
	}

	return 0;
}


Measured memory_bytes: 162688
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)

int main() {
	ll N, X; cin >> N >> X;
	ll minV = 1 << 10;
	rep(i, 0, N) {
		ll m;
		cin >> m;
		X -= m;
		minV = min(minV, m);
	}
	cout << N + X / minV << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
     
     
#define ll long long
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define pld(x) printf("%lld\n",x)
#define pd(x) printf("%d\n",x)
const int MOD = 1e9+7, N = 1e7 + 10;

int main(){
    int k,x;
    sd(k);
    sd(x);
    int start = x-k+1;
    int n = 2*k-1;
    while(n--){
        printf("%d ",start);
        start++;
    }
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<cstdio>
#include<cmath>
using namespace std;
typedef long long ll;
int h, w;
char a[9][9];

bool judge() 
{
	int fx = 0;
	int fy = 0;
	a[fy][fx] = '.';
	while (!(fx == w - 1 && fy == h - 1)) {//goal につくまで進める
		if (fx < w - 1 && fy < h - 1 && a[fy][fx + 1] == '#' && a[fy + 1][fx] == '.') {//右にあって下にない
			fx++;
			a[fy][fx] = '.';
		}
		else if (fx < w - 1 && fy < h - 1 && a[fy][fx + 1] == '.' && a[fy + 1][fx] == '#') {//下にあって右にない
			fy++;
			a[fy][fx] = '.';
		}
		else if (fx == w - 1 && a[fy + 1][fx] == '#') {
			fy++;
			a[fy][fx] = '.';
		}
		else if (fy == h - 1 && a[fy][fx + 1] == '#') {
			fx++;
			a[fy][fx] = '.';
		}
		else {
			//for (int i = 0; i < h; i++) {
				//for (int j = 0; j < w; j++) {
					//cout << a[i][j] << " ";
				//}
				//cout << endl;
			//}
			return false;
		}
	}//右下の経路は終わり
	a[h - 1][w - 1] = '.';
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#')return  false;
		}
	}

	//for (int i = 0; i < h; i++) {
		//for (int j = 0; j < w; j++) {
			//cout << a[i][j] << " ";
		//}
		//cout << endl;
	//}



	return true;

}




int main()
{
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}
	cout << (judge() ? "Possible" : "Impossible" )<< endl;

    return 0;
}



Measured memory_bytes: 888
import sys

input = sys.stdin.readline

N, W = map(int, input().split())
w, v = [], []
for _ in range(N):
    tw, tv = map(int, input().split())
    w.append(tw)
    v.append(tv)

dp = [[float('inf') for _ in range(sum(v) + 1)] for _ in range(N + 1)]
dp[0][0] = 0
# dp[何番目までの品物で][この価値以下を達成する]:=最小の重量

for i in range(N):
    for j in range(sum(v) + 1):
        if j - v[i] >= 0:
            dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i])
        else:
            dp[i + 1][j] = dp[i][j]

for j in sorted(range(sum(v) + 1), reverse=True):
    t = dp[N][j]
    if t <= W:
        print(j)
        break


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

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

    for(int h = 1; h <= 3500; h++){
        for(int n = 1; n <= 3500; n++){
            if((4*h*n-N*n-N*h) != 0 && (N*h*n)%(4*h*n-N*n-N*h) == 0){
                int w = (N*h*n)/(4*h*n-N*n-N*h);
                if(0 < w && w <= 3500){
                    cout << h << " " << n << " " << w << endl;
                    return 0;
                }
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>

using namespace std;

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

    vector<int> ts(n);
    for (int i = 0; i < n; i++) {
        cin >> ts[i];
    }
    vector<int> us(ts);
    for (int i = 1; i < n; i++) {
        us[i] -= ts[i-1];
    }

    long total = 0;
    for (int i = 0; i < n; i++) {
        total += min(us[i], t);
    }
    total += t;

    cout << total << endl;
    return 0;
}

Measured memory_bytes: 1792
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int K = int.Parse(Console.ReadLine());
            int X = int.Parse(Console.ReadLine());
            int Y = int.Parse(Console.ReadLine());

            if (N>K)
            {
                Console.WriteLine(K * X + (N - K) * Y);
            }
            else
            {
                Console.WriteLine(N*X);
            }
        }
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef pair<int,int> pri;
typedef vector<long long> vecll;
typedef pair<long long,long long> prill;

#define REP(i,a,b) for (int i = a; i < b; i++)

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

    int t;
    cin>>t;
    if(t>=30)cout<<"Yes";
    else cout<<"No";

}

Measured memory_bytes: 3596
using System;
using System.Linq;

namespace B
{
	class Program
	{
		static void Main(string[] args)
		{
			var abcd = Console.ReadLine().Split(" ").Select(n => long.Parse(n)).ToArray();
			long a = abcd[0];
			long b = abcd[1];
			long c = abcd[2];
			long d = abcd[3];
			long max = long.MinValue;
			foreach (var ab in new long[] { a, b })
			{
				foreach (var cd in new long[] { c, d })
				{
					max = Math.Max(max, ab * cd);
				}
			}

			Console.WriteLine(max);
		}
	}
}


Measured memory_bytes: 28244
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

typedef long long LL; 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

//ここから書き始める
int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    int A,B,C; cin >> A >> B >> C;

    cout << min(B/A, C) << endl;

}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

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

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
// #define endl '\n'

using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 1e5+5, LG = 17, MOD = 998244353;
const int SQ = 450;
const long double EPS = 1e-7;

int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
  int mx = 0;
  int ans = 0;
  int n, x;
  cin >> n;
  vector<int> a(n);
  for(auto & x : a) cin >> x;
  reverse(a.begin(),a.end());
  multiset<int>st;
  for(auto x : a){
    auto it = st.upper_bound(x);
    if(it!=st.end())st.erase(it);
    st.insert(x);
  }
  cout<<st.size()<<endl;


  return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e14;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N;
    cin >> N;
    vl A(N), B(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];

    ll a = 0, b = 0, d = 0, e = 0;
    rep(i, N) a += A[i], b += B[i], d += max(0ll, A[i] - B[i]), e += max(0ll, B[i] - A[i] + 1) / 2;

    cout << (a <= b&&(b-a)>=d&&(b-a)>=e ? "Yes" : "No") << endl;
}

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PI acos(-1.0)
#define sq(n) (n)*(n)

using namespace std;
typedef long long ll;

int main() {
    FAST;
    string s;
    cin>>s;
    ll sum=0;
    for(ll i=0;i<s.size();i++)
    {
        sum+=s[i]-48;
    }
    //cout<<sum<<endl;

   if(sum%9==0)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }


    return 0;

}




Measured memory_bytes: 3744
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

type UnionFind struct {
	par []int
}

/* コンストラクタ */
func newUnionFind(N int) *UnionFind {
	u := new(UnionFind)
	u.par = make([]int, N)
	for i := range u.par {
		u.par[i] = -1
	}
	return u
}

/* xの所属するグループを返す */
func (u UnionFind) root(x int) int {
	if u.par[x] < 0 {
		return x
	}
	u.par[x] = u.root(u.par[x])
	return u.par[x]
}

/* xの所属するグループ と yの所属するグループ を合体する */
func (u UnionFind) unite(x, y int) {
	xr := u.root(x)
	yr := u.root(y)
	if xr == yr {
		return
	}
	u.par[yr] += u.par[xr]
	u.par[xr] = yr
}

/* xとyが同じグループに所属するかどうかを返す */
func (u UnionFind) same(x, y int) bool {
	if u.root(x) == u.root(y) {
		return true
	}
	return false
}

/* xの所属するグループの木の大きさを返す */
func (u UnionFind) size(x int) int {
	return -u.par[u.root(x)]
}

func main() {
	sc.Split(bufio.ScanWords)

	a, b := nextInt(), nextInt()

	fmt.Println(2 * b - a)
}

Measured memory_bytes: 640
I = [int(e) for e in raw_input().split(' ')]
N = I[0]
A = I[1]
B = I[2]
S = raw_input()

a = 0
b = 0
for i in range(N):
    if S[i] == 'a':
        if a < A+B:
            print 'Yes'
            a+=1
        else:
            print 'No'
    elif S[i] == 'b':
        if a < A+B and b < B:
            print 'Yes'
            a+=1
        else:
            print 'No'
        b+=1
    else:
        print 'No'

Measured memory_bytes: 6276
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;

#define N_MAX n+1

int main() {
	
	int a,b,x;
	cin >> a >> b >> x;
	int y=a+b;
	
	if(y>=x&&a<=x)cout<<"YES";
	else cout<<"NO";
	
	
	
	//cout << ans;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
typedef long long ll;
using namespace std;

int main () {
    ll a, b;
	cin >> a >> b;
	cout << max(a + a - 1, max(a + b, b + b - 1)) << endl;
}


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

int main() {
	string s;
	int k;
	cin >> s >> k;

	set<string> subs;
	for (int i = 0;i < s.size();i++) {
		string a="";
		for (int j = 0;i+j < s.size()&&j<k;j++) {
			a = a + s[i+j];
			subs.insert(a);
		}
	}


	int count = 1;
	for (auto it = subs.begin();;it++) {
		if (count == k) {
			cout << *it << endl;
			return 0;
		}
		count++;
	}

	return 0;
}

Measured memory_bytes: 1664
import math

a, b = map(int, input().split())

tax008 = [(a / 0.08), ((a + 1) / 0.08)]
tax010 = [(b / 0.1), ((b + 1) / 0.1)]
min_value = math.ceil(max(tax008[0], tax010[0]))
max_value = math.floor(min(tax008[1], tax010[1]))
if min_value >= max_value:
    print(-1)
else:
    print(min_value)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N,K,Q; cin>>N>>K>>Q;

    vector<int> A(N,0);
    rep(q,0,Q){
        int a; cin>>a;
        A.at(a-1)++;
    }

    rep(n,0,N){
        if(K-Q+A.at(n)>0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

Measured memory_bytes: 1024
object Main extends App {
  val arr = scala.io.StdIn.readLine().split(" ").map(_.toInt)
  val (n, a, b) = (arr(0), arr(1), arr(2))

  var ls = scala.collection.mutable.ArrayBuffer.empty[Int]
  for (e <- 0 to n) e match {
    case x if x < 10 && (a to b).contains(x) => ls += x
    case x if x >= 10 && (a to b).contains(x.toString.map(_.asDigit).sum) => ls += x
    case _ => None
  }

  val ans = ls.sum

  println(ans)
}

Measured memory_bytes: 32584
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <map>
#include <string>
#include <math.h>
using namespace std;


int main() {

    int N,K;
    cin >> N >> K;
    long long int H[N];

    for(int i=0;i<N;i++){
        cin >> H[i];
    }
    long long int ans = 0;
    if(N<=K){
        cout << 0 << endl;
    }else{
        //vector ver
        //sort(H.begin(),H.end());
        sort(H,H+N);
        for(int i=N-K-1;i>=0;i--){
            ans += H[i];
        }
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1792
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

    ans=1
    for i in range(N):
        if A[i]%2==0:
            ans*=2
    print(3**N-ans)
    
resolve()

Measured memory_bytes: 38384