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

int main(){
  int a,b,c,x;

  cin >> a >> b >> c >>x;
  int res =0;
  for(int i=0; i<=a;i++){
    for(int j=0; j<=b;j++){
      for(int u=0; u<=c;u++){

	int total = 500*i + 100*j + 50*u;

	if(total == x) ++res;
      }
    }
  }
  cout << res <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// bool fun(vector<int>moves,int X,int cs,int i)
// {
//     if(cs==X)
//     return true;
//     if(i==moves.size())
//     return false;
//     bool a=fun(moves,X,cs+moves[i],i+1);
//     bool b=fun(moves,X,cs,i+1);
//     return (a||b);
// }
int main() {
    int n,k;
    cin>>n>>k;
    vector<int>moves(n);
    for(int i=0;i<n;i++)
    cin>>moves[i];
    sort(moves.begin(),moves.end());
    long int sum=0;
    for(int i=0;i<n-k;i++)
    sum+=moves[i];
    cout<<sum;
   // cout<<sum<<" ";
	return 0;
}

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

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

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

#define MAX_V 100000

#define MOD 1000000007L
#define INF 100000000000

signed main() {
	ll s, c;
	cin >> s >> c;
	ll res = c / 2;
	if (c > s * 2) {
		ll cd = c - s * 2;
		res = s + cd / 4;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
//

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

int main(){
  int a, b, k;
  cin >> a >> b >> k;

  if((a+k) <= (b-k)){
    for(int i = 0; i < k; i++){
      cout << a + i << endl;
    }
    for(int i = k-1; i >= 0; i--){
      cout << b - i << endl;
    }
  }else{
    for(int i = a; i <= b; i++){
      cout << i << endl;
    }
  }

  return 0;
}


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

int main() {
  ll N;
  string S;
  cin >> N >> S;
  ll r = 0, g = 0, b = 0;
  for (ll i = 0; i < N; i++) {
    if (S[i] == 'R') r++;
    if (S[i] == 'G') g++;
    if (S[i] == 'B') b++;
  }
  ll ans = r*g*b;
  for (ll i = 1; i <= (N-1)/2; i++) {
    for (ll j = 0; j <= N-(1+2*i); j++) {
      if (S[j] != S[j+i] && S[j] != S[j+2*i] && S[j+i] != S[j+2*i]) {
        ans--;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

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

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = INT_MAX;
const ll linf = 3e18;
const double eps = 1e-9;

struct RMQ { // segtree
    int n;
    vi seg;

    void init(int n_)
    {
        n = 1;
        while (n < n_) n *= 2;
        seg.resize(2 * n - 1);
        for (int i = 0; i < 2 * n - 1; ++i) {
            seg[i] = inf;
        }
    }

    void update(int k, int a)
    {
        k += n - 1;
        seg[k] = a;

        while (k > 0) {
            k = (k - 1) / 2;
            seg[k] = min(seg[k * 2 + 1], seg[k * 2 + 2]);
        }
    }

    int query(int a, int b, int k, int l, int r)
    {
        if (r <= a || b <= l) return inf;
        if (a <= l && r <= b) return seg[k];
        int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        return min(vl, vr);
    }

    int query(int a, int b) {
        return query(a, b, 0, 0, n);
    }
} rmq;

signed main()
{
    omajinai;

    int N, Q; cin >> N >> Q;

    rmq.init(N);

    rep(i, Q) {
        int c, x, y; cin >> c >> x >> y;

        if (c == 0) {
            rmq.update(x, y);
        } else {
            int v = rmq.query(x, y + 1);
            cout << v << endl;
        }
    }
}

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

int main() {
 int N;
 cin >> N;
 vector<int> T(N+1);
 vector<int> X(N+1);
 vector<int> Y(N+1);
 for(int i = 0;i<N;i++){
   cin >> T.at(i+1);
   cin >> X.at(i+1);
   cin >> Y.at(i+1);
 }
  bool flag = true;
  
 for(int i = 0;i<N;i++){
  int dist = abs(X[i+1]-X[i]) + abs(Y[i+1]-Y[i]);
  int dt = T[i+1] - T[i];
  if(dist > dt) flag = false;
  if(dist%2 != dt%2) flag = false;
 }
   
   if(flag) cout << "Yes" << endl;
   else cout << "No" << endl;
     
}



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


Measured memory_bytes: 256
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
//----------------------------------------------------------------

// int MOD = 998244353;
int MOD = 1000000007;


//----------------------------------------------------------------
signed main(){

	ll n;
	cin >> n;
	vll h(n);
	rep(i,n)cin >> h[i];
	ll now = 0;
	ll ans = 0;
	rep(i,n-1){
		if(h[i] >= h[i+1]){
			now++;
			ans = max(ans,now);
		}else{
			now = 0;
		}
	}
	cout << ans << endl;

	
	
	return 0;
}

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

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://ddcc2017-final.contest.atcoder.jp/tasks/ddcc2017_final_b
// rm -r -f test;oj dl https://abc139.contest.atcoder.jp/tasks/abc139_b

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

int main() {
    string s;
    getline(cin,s);
    while (s!="0")
    {
        int sum = 0;
        for (int i = 0; i < s.length(); ++i) {
            sum += s[i] - 48;
        }
        cout<<sum<<endl;
        getline(cin,s);
    }
    return 0;
}


Measured memory_bytes: 3140
#include<stdio.h>
#define INFTY (2<<9)

int A[100][100];

int prim(int n)
{
  int i,m,l,sum=0,S[100],T[100],P[100];

  for(i=0;i<n;++i)
    {
      S[i]=INFTY;
      P[i]=-1;
      T[i]=0;
    }
  S[0]=0;
  while(1)
    {
      l=INFTY;
      m=-1;
      for(i=0;i<n;++i)
        {
          if(T[i]!=2 && l>S[i])
            {
              m=i;
              l=S[i];
            }
        }
      if(m==-1)
        {
          break;
        }
      T[m]=2;
      for(i=0;i<n;++i)
        {
          if(T[i]!=2 && A[m][i]!=INFTY)
            {
              if(S[i]>A[m][i])
                {
                  S[i]=A[m][i];
                  P[i]=m;
                  T[i]=1;
                }
            }
        }
    }
  for(i=0;i<n;++i)
    {
      if(P[i]!=-1)
        {
          sum+=A[i][P[i]];
        }
    }
  return sum;
}

int main()
{
  int n,i,j,x;
  scanf("%d",&n);
  for(i=0;i<n;++i)
    {
      for(j=0;j<n;++j)
        {
          scanf("%d",&x);
          A[i][j]=(x==-1)?INFTY:x;
        }
    }
  printf("%d\n",prim(n));
  return 0;
}



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

template <
    typename TYPE,
    std::size_t SIZE>
std::size_t a_len(const TYPE (&array)[SIZE])
{
    return SIZE;
}

using namespace std;
using ll = long long int;
using vi = vector<ll>;

#define REPS(a, i, n) for (ll(i) = a; (i) < (n); ++(i))
#define REP(i, n) REPS(0, i, n)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 912345678;

string s;


int main()
{
    cin >> s;
    int a = 0;
    for(auto c:s){
        if(c == 'o'){
            a++;
        }
    }
    cout << 700 + 100*a << endl;
}

Measured memory_bytes: 256
// *
// *
// *  Created By :hozaifa wahid
// * "mai maut ko takia aur kafan ko chadar banakar sota hu" 
// *------------------------------------
// *  OS : Ubuntu 16.04
// *  Language : CPP14
// *  Editor : Sublime Text 3
// *  C++ compiler : g++
// *https://www.geeksforgeeks.org/space-and-time-efficient-binomial-coefficient/
// *https://www.geeksforgeeks.org/binomial-coefficient-dp-9/
//https://www.geeksforgeeks.org/compute-ncr-p-set-2-lucas-theorem/
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define inf 1000000007
#define fr first
#define sc second
#define eps 1e-9
#define clr(a) memset(a, 0, sizeof(a))
#define sz(x) x.size()
#define sni(x) scanf("%d",&x)
#define snl(x) scanf("%lld", &x)
#define snc(x) scanf("%c", &c);
#define rep(n) for(int i = 0 ; i < n ;i ++)
#define repc(i, n) for(int i = 0 ; i < n ; i ++)
#define FOR(i, x, y) for(int i = x ; i < y ; i ++)
#define DEC(i, x, y) for(int i = x ; i >= y ; i --)
#define all(v) v.begin(), v.end()
#define min3(a, b, c) min(a, min(b,c))
#define max3(a, b, c) max(a, max(b, c))
#define alla(a, n) a, a+n
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
ll MOD=1000000007;
ll C[2005][2005];
ll min(ll a,ll b)
{
 return a<b?a:b;
}
 
 
ll pw(ll a,ll b){
    if(b==0) return 1;
    ll x=pw(a,b/2);
    x=(x*x)%MOD;
    if(b%2) x=(x*a)%MOD;
    return x;
}
ll comb2(ll n,ll k, ll x)
{
ll res = 1LL; 
  
   
    if ( k > n - k ) 
        k = n - k; 
  
   
    for (int i = 0; i < k; ++i) 
    { 
        res = (res%MOD*(n - i)%MOD)%MOD; 
        res =(res%MOD* pw((i + 1),MOD-2)%MOD)%MOD; 
    } 
  
    //return res; 
return res%MOD;
}
ll n;
ll dp[100005];
ll go(ll x)
{
    if(x==0)
    return 1;
    if(x<0)
    return 0;
    if(dp[x]!=-1)
    return dp[x];
    ll res=0LL;
    FOR(i,3,2005)
    res=(res%MOD+go(x-i)%MOD)%MOD;
    dp[x]=res;
    return res %MOD;
    
}

void solve()
{
//comb(2001,2001);
std::ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
ll t;
t=1;

while(t--)
{
   cin>>n;
   FOR(i,0,n)
   dp[i]=-1;
   ll ans=0LL;
   FOR(i,3,2005)
   ans=(ans%MOD+go(n-i)%MOD)%MOD;
   cout<<ans%MOD;
 
}
}
 
 
 
int main(){
    std::ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    
    solve();
    
}
 
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 3680
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


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

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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define bit(n) (1LL<<(n))
// functions
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(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << p.first << " " << p.second; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  ll x;
  double p; cin >> x >> p;
  p *= 0.01;
  double res = (x / 2) / p;
  if(x & 1)res += 1 / p;
  cout << res << endl;
  return 0;
}


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

const long long int INF = 1000000007;

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

    long long a=1, b=1, c=1;

    a = modpow(10, N, INF);
    b = modpow(9, N, INF);
    c = modpow(8, N, INF);
    b = b * 2 % INF;

    long long ans = ((a - b) % INF + c) % INF;
    ans = (ans + INF) % INF;

    cout << ans << endl;
}

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

int main() {
  int n, m, ac = 0, wa = 0;

  cin >> n >> m;

  vector<pair<bool, int>> tmp(n + 1);

  for (int i = 0; i < m; i++) {
    int p;
    string s;
    cin >> p >> s;
    if (!tmp.at(p).first && s == "AC") {
      ac++;
      wa += tmp.at(p).second;
      tmp.at(p).first = true;
    } else
      tmp.at(p).second++;
  }

  cout << ac << " " << wa;

  return 0;
}

Measured memory_bytes: 1024
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::cmp::min;

    input! {
        H: usize,
        N: usize,
        M: [[usize; 2]; N]
    }

    let mut dp = vec![100000000usize; H + 1];
    dp[0] = 0;

    for p in 0..N {
        let a = M[p][0];
        let b = M[p][1];
        for i in 0..(H + 1) {
            let d = min(H, i + a);
            dp[d] = min(dp[d], dp[i] + b);
        }
    }

    println!("{:?}", dp[H]);
}

Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	string S;
	
	cin>>S;
	
	if(S.size()%2 == 0) {
		for(int i = 0; i < S.size(); i += 2){
			if(S[i] != 'h' || S[i+1] != 'i') {
				cout<<"No"<<endl;
				return 0;
			}
			
		}
		
		cout<<"Yes"<<endl;
		return 0;
	} else {
		cout<<"No"<<endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vint l(n);
    int sum=0;
    REP(i,n){
        cin >> l[i];
        sum+=l[i];
    }
    REP(i,n){
        if(l[i]>=sum-l[i]){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";

    return 0;
}

Measured memory_bytes: 256
c = Array.new(3)

3.times do |i|
    c[i] = gets.split.map(&:to_i)
end

d = [0, c[0][1] - c[0][0], c[0][2] - c[0][0]]
e = [0, c[1][0] - c[0][0], c[2][0] - c[0][0]]

truth = true

3.times do|i|
    3.times do |j|
        truth &= (c[0][0] + d[j] + e[i] == c[i][j])
    end
end

if truth
    puts "Yes"
else
    puts "No"
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int D, N; cin >> D >> N;
	if (N == 100) ++N;
	int res = 0;
	switch(D){
		case 0: res = N; break;
		case 1: res = 100 * N; break;
		case 2: res = 10000 * N; break;
	} // end switch

	cout << res << endl;
 
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int age,fee;
    scanf("%d %d",&age,&fee);
    if(age<=5){
        printf("0\n");
    }else if(6<=age&&age<=12){
        printf("%d\n",fee/2);
    }else{
        printf("%d\n",fee);
    }
    return 0;
}

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

int main() {
    int H, N; cin >> H >> N;
    vector<int> A(N), B(N);
    for(int i=0; i<N; ++i) cin >> A[i] >> B[i];

    vector<int> dp(H + 1, 1001001001); 
    dp[0] = 0;
    for(int v=0; v<dp.size(); ++v) {
        for(int i=0; i<N; ++i) {
            int n = min(v + A[i], H);
            dp[n] = min(dp[n], dp[v] + B[i]);
        }
    }
    cout << dp[H] << '\n';
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

//あたまわるわる～

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


	char S[11];
	int N = fread_unlocked(S, 1, 11, stdin);
	N--;

	ll dp[2] = {};
	dp[0] = S[0] - '0';
	rep1(i, N - 1) {
		dp[1] += dp[1];
		dp[1] += dp[0];
		dp[0] = dp[0] * 10 + (S[i] - '0') * (1 << i);
	}
	printf("%lld", dp[0] + dp[1]);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if((a == b)&&(b != c)){
    cout << "Yes" << endl;
  }
  else if((a == c)&&(a != b)){
    cout << "Yes" << endl;
  }
  else if ((b == c)&&(b != a)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
from heapq import heappop, heappush, heapify
from collections import deque

T = int(input())

for _ in range(T):
    N = int(input())
    camel = [tuple(map(int, input().split())) for i in range(N)]

    pos = []
    neg = []

    for i in range(N):
        k, l, r = camel[i]
        if l - r >= 0:
            pos.append((r - l, k, i))
        else:
            neg.append((l - r, N - k, i))

    pos.sort(key=lambda x:x[1], reverse=True)
    p = len(pos)

    heappos = []
    respos = [None for i in range(N)]

    j = 0
    for i in range(N)[::-1]:
        while j < p and pos[j][1] == i + 1:
            heappush(heappos, pos[j])
            j += 1
        if heappos:
            d, k, id = heappop(heappos)
            respos[i] = id
    for i in range(N)[::-1]:
        if respos[i] is None and heappos:
            d, k, id = heappop(heappos)
            respos[i] = id


    neg.sort(key=lambda x:x[1], reverse=True)
    n = len(neg)

    heapneg = []
    resneg = [None for i in range(N)]

    j = 0
    for i in range(N)[::-1]:
        while j < n and neg[j][1] == i + 1:
            heappush(heapneg, neg[j])
            j += 1
        if heapneg:
            d, k, id = heappop(heapneg)
            resneg[i] = id
    while j < n:
        heappush(heapneg, neg[j])
        j += 1
    for i in range(N)[::-1]:
        if resneg[i] is None and heapneg:
            d, k, id = heappop(heapneg)
            resneg[i] = id

    respos = [respos[i] for i in range(N) if respos[i] is not None]
    resneg = [resneg[i] for i in range(N) if resneg[i] is not None]
    res = respos + resneg[::-1]

    ans = 0

    for i in range(N):
        k, l, r = camel[res[i]]
        if k >= i + 1:
            ans += l
        else:
            ans += r

    print(ans)

Measured memory_bytes: 161192
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Stack<Integer> stack = new Stack<Integer>();
		while (sc.hasNext()) {
			int inputNum = sc.nextInt();

			if (inputNum == 0) {
				System.out.println(stack.pop());
			} else {
				stack.push(inputNum);
			}
		}
	}

}

Measured memory_bytes: 26200
n = gets.to_i
max = (n ** 0.5).to_i + 1

min = n + 1 - 2

1.upto(max) do |a|
  b, mod = n.divmod a
  if mod == 0
    d = a + b - 2
    min = d if d < min
  end
end

puts min

Measured memory_bytes: 1916
import java.util.Scanner;

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

		int h = scan.nextInt();
		int w = scan.nextInt();

		String[] str = new String[h];
		for(int i = 0; i < h; i++){
			str[i] = scan.next();
		}

		for(int i = 0; i < h; i++){
			System.out.println(str[i]);
			System.out.println(str[i]);
		}
	}
}


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

using namespace std;

#define EPS 1e-10

struct Point {
    double x, y;

    Point(){}
    Point(double x, double y) : x(x), y(y) {}

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

double dot(const Point &a, const Point &b)
{
    return a.x * b.x + a.y * b.y;
}

double cross(const Point &a, const Point &b)
{
    return a.x * b.y - b.x * a.y;
}

double norm(const Point &p)
{
    return dot(p, p);
}

#define COUNTER_CLOCKWISE +1
#define CLOCKWISE         -1
#define ONLINE_BACK       +2
#define ONLINE_FRONT      -2
#define ON_SEGMENT        +0
typedef Point Vector;

int ccw(const Point &p0, const Point &p1, const Point &p2)
{
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if (cross(a, b) > EPS) return COUNTER_CLOCKWISE;
    if (cross(a, b) < -EPS) return CLOCKWISE;
    if (dot(a, b) < -EPS) return ONLINE_BACK;
    if (norm(a) < norm(b)) return ONLINE_FRONT;
    return ON_SEGMENT;
}

typedef vector<Point> Polygon;

bool sortY(Point p1, Point p2)
{
    if (p1.y != p2.y) {
	return (p1.y - p2.y < -EPS);
    } else { 
	return (p1.x - p2.x < -EPS);
    }
}

Polygon convex_hull(Polygon &ps)
{
    int N = ps.size(), j = 0;
    Polygon pg(N*2);
    sort(ps.begin(), ps.end(), sortY);
    for (int i = 0; i < N; i++, j++) {
	while (j >= 2 && ccw(pg[j-2], pg[j-1], ps[i]) == -1) {
	    j--;
	}
	pg[j] = ps[i];
    }
    int k = j+1;
    for (int i = N-2; i >= 0; i--, j++) {
	while (j >= k && ccw(pg[j-2], pg[j-1], ps[i]) == -1) {
	    j--;
	}
	pg[j] = ps[i];
    }
    pg.resize(j-1);
    return pg;
}

int main()
{
    Polygon pg(4);
    char c;
    while (cin >> pg[0].x >> c >> pg[0].y) {
        for (int i = 1; i < 4; i++) {
            cin >> c >> pg[i].x >> c >> pg[i].y;
        }
        cout << (convex_hull(pg).size() == 4 ? "YES" : "NO") << endl;
    }
    return 0;
}

Measured memory_bytes: 3144
#include<bits/stdc++.h>
using namespace std ;
#define F first 
#define S second
typedef long long ll ;
const ll N = 200022 ; 
ll n, dp[4022][4022], f[N], nf[N], mod = 1e9+7;
pair<ll,ll> p[N] ; 
ll poww(ll a, ll b){
	if(b == 0) return 1 ; 
	ll k = poww(a, b/2) ; k = (k * k) % mod ;
	if(b & 1) k = (k * a) % mod ; return k ; 
}
ll C(ll a, ll b){
	return (((f[b] * nf[a])%mod)*nf[b-a]) % mod ; 
}
ll ans ;
int main()
{
	ios::sync_with_stdio(false) ; cin.tie() ; cout.tie(); 
	f[0] = nf[0] = 1 ;
	for(int i = 1 ; i < N ; i ++)
		f[i] = (f[i-1] * i) % mod,
		nf[i] = poww(f[i], mod-2) ; 
	cin >> n ;
	for(int i = 1 ; i <= n ; i ++){
		cin >> p[i].F >> p[i].S ; 
		dp[2000-p[i].F][2000-p[i].S] ++ ; 
	}	
	for(int i = 0 ; i < 4022 ; i ++)
		for(int j = 0 ; j < 4022 ; j ++){
			if(i) dp[i][j] = (dp[i][j] + dp[i-1][j]) % mod;
			if(j) dp[i][j] = (dp[i][j] + dp[i][j-1]) % mod;
		}
	for(int i = 1 ; i <= n ; i ++)
		ans = (ans + dp[p[i].F+2000][p[i].S+2000]) % mod ;
	for(int i = 1 ; i <= n ; i ++)
		ans = (ans - C(p[i].F+p[i].F, (p[i].F+p[i].F+p[i].S+p[i].S)) + mod) % mod ;
	ans = (ans * poww(2, mod-2)) % mod ;
	cout << ans ;
}

Measured memory_bytes: 132864
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <random>
#include <cmath>
#include <chrono>
#include <cstring>
#include <algorithm>
#include <string>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
using namespace std;
using LL = long long;
#define eps 1e-8
#define fi first
#define se second
#define eb emplace_back
#define close std::ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define FOR(i, x, y) for (LL i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (LL i = (x), _##i = (y); i > _##i; --i)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define CASET int ___T; cin>>___T; for(int __CS=1;__CS<=___T;__CS++)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
mt19937 dlsrand(random_device{}());
mt19937 mrand(std::chrono::system_clock::now().time_since_epoch().count()); 
int rnd(int x) { return mrand() % x;}
LL bin(LL x, LL n, LL MOD) {LL ret = MOD != 1;for (x %= MOD; n; n >>= 1, x = x * x % MOD)if (n & 1) ret = ret * x % MOD;return ret;}
inline LL get_inv(LL x, LL p) { return bin(x, p - 2, p); }
const double PI = acos(-1.0);
constexpr int maxn = 1e6+10;
constexpr int INF = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3f;
constexpr int mod = 1e9+7;
void add(int &a,int b) {a+=b; if(a>=mod) a-=mod;}
void dec(int &a,int b) {a-=b; if(a<0) a+=mod;}
int main()
{
    int a, b , c;
    cin >> a >> b >> c;
    printf("%d %d %d",c,a,b);
    
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define INF 1000000007

int main(){
  ll n;
  cin >> n;
  cout << (n+1)/2-1 << endl;

  //cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
N, A, B = map(int, input().split())
S = input()
for l in S:
	if l == "a":
		if A + B > 0:
			print("Yes")
			A -= 1
		else:
			print("No")
	elif l == "b":
		if A + B> 0 and B > 0:
			print("Yes")
			B -= 1
		else:
			print("No")
	else:
		print("No")

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);

int n;
ll a[MAX_N];

multiset<ll> mst;

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 0; i < n; ++i) {
    scanf("%lld", &(a[i]));
  }

  mst.insert(INF);

  for (int i = 0; i < n; ++i) {
    auto ptr = mst.upper_bound(a[i] - 1);

    if (mst.empty() || ptr == mst.begin()) {
      mst.insert(a[i]);
      continue;
    }

    auto prv = prev(ptr);
    mst.erase(prv);
    mst.insert(a[i]);
  }

  printf("%d\n", mst.size() - 1);

  return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const int N = 1e5, INF = 1e8;
VI e[N];
int c[N], dp[N][3];

bool dfs(int now, int past){
    bool ret = false;
    int cnt = 0, ma = 0, ma2 = 0;
    for (int next : e[now]){
        if (next == past) continue;
        bool f = dfs(next, now);
        if (f) {
            ret = true;
            cnt++;
            dp[now][2] += dp[next][2] + 2;
            int dif = dp[next][2] - dp[next][1];
            if (dif > ma){
                ma2 = ma;
                ma = dif;
            }else if (dif > ma2){
                ma2 = dif;
            }
        }
    }

    dp[now][0] = dp[now][1] = dp[now][2];

    if (cnt == 1){
        dp[now][1] -= ma + 1;
        dp[now][0] = dp[now][1];
        if (cnt % 2 == c[now]){
            dp[now][0]++;
            dp[now][2]++;
        }else{
            dp[now][1]++;
        }
    }else if (cnt >= 2){
        dp[now][1] -= ma + 1;
        dp[now][0] -= ma + ma2 + 2;
        if (cnt % 2 == c[now]){
            dp[now][0]++;
            dp[now][2]++;
        }else{
            dp[now][1]++;
        }
    }

    if (!ret && c[now]){
        dp[now][0] = dp[now][1] = 1;
        ret = true;
    }

    if (!ret) REP(j,3) dp[now][j] = -1;

    // cout << now << " " << ret << endl;
    return ret;
}

int main() {
    // int n;
    // cin >> n;
    // REP(i,n-1){
    //     int u = in() - 1, v = in() - 1;
    //     e[u].push_back(v);
    //     e[v].push_back(u);
    // }
    // string s;
    // cin >> s;
    // REP(i,n) if (s[i] == 'W') c[i] = 1;

    // int root = -1;
    // REP(i,n){
    //     if (c[i]) root = i;
    // }

    // // root = 0;

    // if (root == -1){
    //     cout << 0 << endl;
    //     return 0;
    // }

    // dfs(root, -1);
    // cout << dp[root][0] << endl;

    // cout << root << endl;
    // REP(i,n){
    //     cout << i + 1 << "  ";
    //     REP(j,3) cout << dp[i][j] << " ";
    //     cout << endl;
    // }

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << (abs(a - c) <= d || (abs(a - b) <= d&& abs(b - c) <= d) ? "Yes" : "No") << endl; 

    return 0;
}


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

long long powd(long long a, long long k) {
	long long res = 1;
	while(k > 0) {
		if(k % 2 == 1) {
			res *= a;
		}
		a *= a;
		k /= 2;
	}
	return res;
}

void solve(long long N, long long P){
	if(N == 1) {
		cout << P << endl;
		return;
	}

	long long res = 1;
	for (long long i = 1; powl(i, N) <= P; ++i) {
		if(P % powd(i, N) == 0) {
			res = i;
		}
	}
	cout << res << endl;
}

int main(){	
	long long N;
	long long P;
	scanf("%lld",&N);
	scanf("%lld",&P);
	solve(N, P);
	return 0;
}



Measured memory_bytes: 512
n = input()
s = []
for c in n:
    s.append(int(c))
s.reverse()
l = len(s)
INF = 1000000000


def get_next(c):
    ret = [
        [INF, INF],
        [INF, INF],
    ]
    # for a in range(10):
    #     for b in range(10):
    #         if a - b == c:
    #             ret[0][0] = min(ret[0][0], a + b)
    #         if 10 + a - b == c:
    #             ret[0][1] = min(ret[0][1], a + b)
    #         if a - 1 - b == c:
    #             ret[1][0] = min(ret[1][0], a + b)
    #         if 10 + a - 1 - b == c:
    #             ret[1][1] = min(ret[1][1], a + b)
    # for b in range(10):
    #     a = c + b
    #     if 0 <= a < 10:
    #         ret[0][0] = min(ret[0][0], a+b)
    #     a = c + b - 10
    #     if 0 <= a < 10:
    #         ret[0][1] = min(ret[0][1], a+b)
    #     a = c + b + 1
    #     if 0 <= a < 10:
    #         ret[1][0] = min(ret[1][0], a + b)
    #     a = c + b - 10 + 1
    #     if 0 <= a < 10:
    #         ret[1][1] = min(ret[1][1], a + b)
    a = c
    ret[0][0] = min(ret[0][0], a)
    b = 10 - c
    if b < 10:
        ret[0][1] = min(ret[0][1], b)
    a = c + 1
    if a < 10:
        ret[1][0] = min(ret[1][0], a)
    b = 9-c
    ret[1][1] = min(ret[1][1], b)

    return ret


dp = [[0 for _ in range(l+1)] for _ in range(2)]

dp[1][0] = INF

for i, c in enumerate(s):
    next_step = get_next(c)
    dp[0][i+1] = min(dp[0][i]+next_step[0][0], dp[1][i]+next_step[1][0])
    dp[1][i+1] = min(dp[0][i]+next_step[0][1], dp[1][i]+next_step[1][1])

print(min(dp[0][l], dp[1][l]+1))
# print(dp)

Measured memory_bytes: 133496
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
typedef pair<ul, ul> P;




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

	vector<int> p;
	int r;
	REP(i, N)
	{
		cin >> r;
		p.push_back(r);
	}
	sort(p.begin(), p.end());
	int sum = 0;
	REP(i, N)
	{
		if(i!=N-1){
			sum += p[i];
		}
		else{
			sum += p[i] / 2;
		}
	}
	cout << sum << endl;

	return 0;
}

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

struct edge{
	int to;
	int cost;
};

vector<edge> to[100005];
vector<int> ans(100005);

void dfs(int v, int p, int d){
	if(d%2==0) {
		ans[v] = 0;
	}else{
		ans[v] = 1;
	}
	for (auto nextv: to[v]){
		if(nextv.to == p) continue;
		dfs(nextv.to, v, d + nextv.cost);
	}
}

int main(){
	int n;
	cin >> n;
	rep(i,n-1){
		int u,v,w;
		cin >> u >> v >> w;
		u--;v--;
		edge e1 = {u,w};
		edge e2 = {v,w};
		to[u].push_back(e2);
		to[v].push_back(e1);
	}
	dfs(0,-1,0);
	rep(i,n){
		cout << ans[i] << endl;
	}
	
    return 0;
}



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

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

    for(int i = 1; i <= 3; i++) {
        if(i != A && i != B) {
            cout << i << endl;
            break;
        }
    }

    return 0;
}

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

int extgcd(int a, int b, int& x, int& y){
	int d = a;
	if(b != 0){
		d = extgcd(b, a%b, y, x);
		y -= (a/b) * x;
	}else{
		x = 1; y = 0;
	}
	return d;
}

int mod_inverse(int a, int m){
	int x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}

int main(){
	int n;
	std::cin >> n;
	std::cin.ignore();
	for(;n--;){
		std::string s;
		std::getline(std::cin, s);
		for(int a=1;a<26;a++){
			if(26 % a == 0 && a != 1)continue; //素ではない
			int b = 0;
			for(;b<26;b++){
				std::string new_s = s;
				int inverse_a = mod_inverse(a, 26);
				std::transform(new_s.begin(), new_s.end(), new_s.begin(),
											 [inverse_a, b](char c){
												 if(c < 'a' || c > 'z')return c;
												 int x = c - 'a';
												 int new_x = inverse_a * (x>b?x-b:x-b+26) % 26;
												 return static_cast<char>(new_x + 'a');
											 });
				if(new_s.find("this") != std::string::npos ||
					 new_s.find("that") != std::string::npos){
					std::cout << new_s << std::endl;
					break;
				}
			}
			if(b < 26){break;}
		}
	}
}

Measured memory_bytes: 1216
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n';
#define no cout<<"No"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  i,j,k,l,n,b;
    string s;
    cin>>n>>b;
    cout<<n*n-b<<endl;

            return 0;
}





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

int rev(int a){
    if(a < 0) return -a;
    else return a;
}

int main() {
    string s;
    cin >> s;
    int ans = 1000;
    for(int i=0; i<s.size()-2; i++){
        if(rev(100*(s.at(i)-'0') + 10*(s.at(i+1)-'0') + (s.at(i+2)-'0') - 753) < ans){
            ans = rev(100*(s.at(i)-'0') + 10*(s.at(i+1)-'0') + (s.at(i+2)-'0') - 753);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 764
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int a,b,c;
string now,dp[55][55][55];
bool ok[55][55][55];
void update(int i,int j,int k,const string&s)
{
	if(s+now>=now+now.substr(0,s.size()))
	{
		if(!ok[i][j][k])
		{
			ok[i][j][k]=1;
			dp[i][j][k]=s;
		}
		else if(dp[i][j][k]<s)dp[i][j][k]=s;
	}
}
bool check()
{
	memset(ok,0,sizeof(ok));
	ok[0][0][0]=1;dp[0][0][0]="";
	for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)for(int k=0;k<=c;k++)
	{
		if(!ok[i][j][k])continue;
		if(i<a)update(i+1,j,k,'a'+dp[i][j][k]);
		if(j<b)update(i,j+1,k,'b'+dp[i][j][k]);
		if(k<c)update(i,j,k+1,'c'+dp[i][j][k]);
	}
	return ok[a][b][c];
}
int main()
{
	cin>>a>>b>>c;
	for(int i=0;i<a+b+c;i++)now+='a';
	for(int i=0,j;i<a+b+c;i++)
	{
		for(j='b';j<='c';j++)
		{
			now[i]=j;
			if(!check())break;
		}
		now[i]=j-1;
	}
	cout<<now<<endl;
	return 0;
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int n=5,a[1001];

int main(){
	ios::sync_with_stdio(false);
	int i;
	for(i=1;i<=n;++i)
		cin>>a[i];
	for(i=1;i<=n;++i)
		if(a[i]==0)
			cout<<i<<" ";
	
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define mod 1000000007

using namespace std;

int main()
{
    IOS;
	int n,q;
    cin>>n>>q;
    string s;
    cin>>s;
    int st[n+1];
    memset(st,0,sizeof(st));
    st[0]=0;
    for(int h=1;h<n;h++)
    {
        if(s[h]=='C'&&s[h-1]=='A')
            st[h]=st[h-1]+1;
        else
            st[h]=st[h-1];
    }
    while(q--)
    {
        int l,r;
        cin>>l>>r;
        cout<<st[--r]-st[--l]<<"\n";
    }

	return 0;
}


Measured memory_bytes: 1488
from math import gcd
a,b,c,d = map(int, input().split())

t = c*d//gcd(c,d)
x = (a-1) - ((a-1)//c + (a-1)//d) + (a-1)//t
y = b - (b//c + b//d) + b//t

print(y-x)

Measured memory_bytes: 9080
a,b,c,x,y = map(int, input().split())
xymin = min(x,y)
case1 = a*x + b*y
case2 = max(x,y)*2*c
case3 = (x-xymin)*a + (y-xymin)*b + xymin*c*2

print(min(case1,case2,case3))

Measured memory_bytes: 3060
<?php
$yen = 100000;
$rate = 0.05;

$week = trim(fgets(STDIN));

for ($i=0; $i<$week; $i++) {
    $yen += $yen * $rate;
    $yen = ceil($yen/1000) * 1000;
}

echo $yen. "\n";


Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
typedef pair<int,int> P;


P a[10];
signed main(){
  rep(i,5){cin >> a[i].se;a[i].fi = a[i].se%10;if(a[i].fi == 0)a[i].fi = 10;}
  int t = 0, ans = 0;
  sort(a, a+5, greater<P>());
  rep(i,5){
    ans += a[i].se;
    if(ans%10 == 0)continue;
    if(i != 4)ans = (ans+10)/10 * 10;
  }
  cout << ans << endl;
  return 0;
}








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

const int MOD=1000000007;
struct modint {
  long long val;
  modint(long long val=0) : val((val % MOD + MOD) % MOD){}
  modint operator-() const { return modint(-val); }
  modint& operator+=(const modint a) { if ((val += a.val)     >= MOD) val -= MOD; return *this; }
  modint& operator-=(const modint a) { if ((val += MOD-a.val) >= MOD) val -= MOD; return *this; }
  modint& operator*=(const modint a) { (val *= a.val) %= MOD; return *this; }
  modint operator+(const modint a) const { return (modint)*this += a; }
  modint operator-(const modint a) const { return (modint)*this -= a; }
  modint operator*(const modint a) const { return (modint)*this *= a; }
  modint pow(long long n) const { modint r(1), m(val); while (n > 0) { if (n & 1) {r *= m;} m *= m; n >>= 1; } return r; }
  modint inv() const { return pow(MOD-2); }
  modint& operator/=(const modint a) { return (*this) *= a.inv(); }
  modint operator/(const modint a) const { return (modint)*this /= a; }
  bool operator==(const modint &p) const { return val == p.val; }
  bool operator!=(const modint &p) const { return val != p.val; }
  friend ostream &operator<<(ostream &os, const modint &p) { return os << p.val; }
  friend istream &operator>>(istream &is, modint &a) { long long t; is >> t; a = modint(t); return (is); }
};

vector<bool> sieve_of_eratosthenes(int n) {
  /* O(n log log n) */
  vector<bool> is_prime(n, true);
  is_prime[0] = is_prime[1] = false;
  for(int i=2; i<=n; i++)
    if(is_prime[i])
      for(int k=2; k * i <= n; k++)
        is_prime[k*i] = false;
  return is_prime;
}

vector<int> prime_list(int n) {
  /* O(n log log n) */
  auto is_prime = sieve_of_eratosthenes(n);
  vector<int> primes;
  for(int i=0; i<=n; i++)
    if(is_prime[i])
      primes.push_back(i);
  return primes;
}

vector<int> primes_;

map<int, int> prime_factorization(int n) {
  map<int,int> factors;
  for(auto i : primes_) {
    while (n%i==0) {
      factors[i]++;
      n /= i;
    }
  }
  if(n!=1) factors[n]++;
  return factors;
}

int N;
int A[10000];

signed main() {
  cin >> N;
  for(int i=0; i<N; i++) cin >> A[i];

  int amax = 0;
  for(int i=0; i<N; i++) amax = max(amax, A[i]);
  
  primes_ = prime_list((int)ceil(sqrt(amax)));

  map<int ,int> lcm_factor;

  for(int i=0; i<N; i++) {
    for(auto m : prime_factorization(A[i])) {
      lcm_factor[m.first] = max(lcm_factor[m.first], m.second);
    }
  }

  modint L = 1;
  for(auto p : lcm_factor) {
    L *= modint(p.first).pow(p.second);
  }

  modint ans=0;
  for(int i=0; i<N; i++) {
    ans += L / modint(A[i]); 
  }
  cout << ans << endl;
}


Measured memory_bytes: 768
#include<stdio.h>
int main()
{
int n,a,b,c;
scanf("%d",&n);

    if((n%1000)!=0)
   {
    a=n%1000;
    b=1000-a;

    printf("%d",b);
   }
   else
   {
       printf("0");
   }

return 0;
}

Measured memory_bytes: 1728