akhauriyash/Code-Regression huggingface dataset:
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)

int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    double r;
    cin>>r;
    cout<<fixed<<setprecision(9)<<2*PI*r<<endl;
    return 0;
}



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

typedef long long ll;

ll inf = 1e9+7;
ll func[300010] = {0};
ll inv[300010] = {0};

ll mult(ll n, ll m){
	if(m==1) return n%inf;
	else if(m%2==0){
		ll t = mult(n,m/2);
		return (t*t)%inf;
	}else{
		ll t = mult(n,m-1);
		return (t*n)%inf;
	}
}

void functional(ll N){
	for(ll i=0;i<=N;i++){
		if(i==0){
			func[i] = 1;
			inv[i] = 1;
		}
		else{
			func[i] = (i*func[i-1])%inf;
			inv[i] = mult(func[i],inf-2);
		}
	}
}

ll comb(ll n,ll k){
	if(k==0 || n==k) return 1;
	else return (((func[n]*inv[k])%inf)*inv[n-k])%inf;
}

ll H,W,A,B;

int main(){
	cin >> H >> W >> A >> B;
	ll ans = 0;
	functional(H+W-2);
	for(ll i=B;i<W;i++){
		ans += (comb(H-A-1+i,i)*comb(A+W-2-i,W-1-i))%inf;
		ans = ans%inf;
	}
	cout << ans << endl;
}

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

vector<int>E[100000], pr[100000];
int u[200000], v[200000], r[200000], ans[200000], d[100000], cnt = 1;
bool b[200000], ok[100000];

void bfs(int u) {
	queue<int>que;
	que.push(u);
	while (!que.empty()) {
		int p = que.front(); que.pop();
		for (int v : E[p]) {
			if (d[v] == d[p] + 1 && !ok[v]) {
				ok[v] = true; cnt++; que.push(v);
			}
		}
	}
}
int main() {
	int n, m, q; scanf("%d%d%d", &n, &m, &q);
	rep(i, m) {
		scanf("%d%d", &u[i], &v[i]);
		u[i]--; v[i]--;
		E[u[i]].push_back(v[i]); E[v[i]].push_back(u[i]);
	}
	queue<int>que;
	memset(d, -1, sizeof(d));
	d[0] = 0; que.push(0);
	while (!que.empty()) {
		int p = que.front(); que.pop();
		for (int i : E[p]) {
			if (d[i] == -1) {
				d[i] = d[p] + 1; que.push(i);
			}
		}
	}
	rep(i, m) {
		if (d[u[i]] > d[v[i]])swap(u[i], v[i]);
	}
	rep(i, n)E[i].clear();
	rep(i, q) {
		scanf("%d", &r[i]); r[i]--;
		b[r[i]] = true;
	}
	ok[0] = true;
	rep(i, m) {
		if (!b[i]) {
			if (d[v[i]] - d[u[i]] == 1) {
				E[u[i]].push_back(v[i]);
			}
		}
	}
	bfs(0);
	for (int i = q - 1; i >= 0; i--) {
		ans[i] = n - cnt;
		if (d[v[r[i]]] - d[u[r[i]]] == 1 && !ok[v[r[i]]]) {
			E[u[r[i]]].push_back(v[r[i]]);
			if (ok[u[r[i]]]) {
				cnt++; ok[v[r[i]]] = true;
				bfs(v[r[i]]);
			}
		}
	}
	rep(i, q)printf("%d\n", ans[i]);
}

Measured memory_bytes: 16044
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] strArray = br.readLine().split("\\s");
        int[] intArray;
        intArray = new int[strArray.length];
        String strComp = null;
        for (int i = 0; i < strArray.length; i++) {
            intArray[i] = Integer.parseInt(strArray[i]);
        }
        switch (Integer.valueOf(intArray[0]).compareTo(intArray[1])) {
            case 1:
                strComp = ">";
                break;
            case -1:
                strComp = "<";
                break;
            case 0:
                strComp = "==";
                break;
        }
        System.out.println("a " + strComp + " b");
    }
}

Measured memory_bytes: 17096
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int a,v,b,w,t;
    cin>>a>>v;
    cin>>b>>w;
    cin>>t;
    if(a<b){
        for(int i=0;i<t;i++){
           a+=v;
           b+=w;
           if(a>=b){
              cout<<"YES"<<endl;
              return 0;
            }
        }
        if(a<b){
           cout<<"NO"<<endl;
           return 0;
       }
    }
    if(a>b){
        for(int i=0;i<t;i++){
           a-=v;
           b-=w;
           if(a<=b){
              cout<<"YES"<<endl;
              return 0;
            }
        }
        if(a>b){
           cout<<"NO"<<endl;
           return 0;
       }
    }
}

Measured memory_bytes: 3636
#include <stdio.h>

int main(void){
	int train[11], i = 0, n;
	
	while(scanf("%d",&n) != EOF){
		if(n == 0){
			printf("%d\n",train[i]);
			i--;
		}else{
			i++;
			train[i] = n;
		}
	}
	return 0;
}

Measured memory_bytes: 600
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,c,x,y,z;
double d,e,f;
string s,t;
//

signed main() {
  RAPID;
  IN(a);
  if(a==25) OUT("Christmas");
  else if(a==24) OUT("Christmas Eve");
  else if(a==23) OUT("Christmas Eve Eve");
  else OUT("Christmas Eve Eve Eve");
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min};

#[allow(unused_imports)]
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars, Isize1, Usize1};

const LG: usize = 30;

#[allow(non_snake_case)]
#[allow(unused)]
fn main() {
    input! {
        N:usize,
        K:Isize1,
        P:[Usize1;N],
        C:[i32;N],
    }
    let mut dst = vec![vec![0usize; N]; LG];
    let mut sum = vec![vec![0i64; N]; LG];
    let mut opt = vec![vec![0i64; N]; LG];

    for i in 0..N {
        dst[0][i] = P[i];
        sum[0][i] = C[P[i]] as i64;
        opt[0][i] = max(C[P[i]], 0) as i64;
    }

    for k in 1..LG {
        for i in 0..N {
            dst[k][i] = dst[k - 1][dst[k - 1][i]];
            sum[k][i] = sum[k - 1][i] + sum[k - 1][dst[k - 1][i]];
            opt[k][i] = max(opt[k - 1][i], sum[k - 1][i] + opt[k - 1][dst[k - 1][i]]);
        }
    }

    let mut ans = i64::min_value();
    for i in 0..N {
        let mut v = P[i];
        let mut sm = C[v] as i64;
        ans = max(ans, sm);
        for k in 0..LG {
            if (K >> k & 1) == 0 {
                continue;
            }
            ans = max(ans, sm + opt[k][v]);
            sm += sum[k][v];
            v = dst[k][v];
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 5824
#include<bits/stdc++.h> 
    #define ll long long
    using namespace std;
     
    int main(){
    int n;
      cin>>n;
       vector<int> h(n);
      for(int i=0;i<n;i++){
      cin>>h[i];
      }
      vector<ll> dp(n,INT_MAX);
      dp[0]=0;
      
      for(int i=1;i<n;i++){
          
          if(i>1)
            dp[i] = min(dp[i],dp[i-2]+abs(h[i] - h[i-2]));
          dp[i] = min(dp[i],dp[i-1] + abs(h[i]-h[i-1]));
      }
      cout<<dp[n-1]<<"\n";
      return 0;
    }

Measured memory_bytes: 4580
#include <iostream>
#include <cstdlib>
#include <map>

using namespace std;
int main()
{
    int n, a, ans;
    cin >> n;
    ans = 0;
    map<int, int> num;
    for(int i=0; i<n; ++i){
        cin >> a;
        if(num.find(a) != num.end()){
            num.erase(a);
        }
        else {
            num.insert(make_pair(a, 1));
        }
    }
    for(auto itr=num.begin(); itr != num.end(); ++itr){
        ans += (*itr).second;
    }
    cout << ans << endl;
}

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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n; cin >> n;
    vector<ll> x(n), y(n);
    rep(i, n) {
        cin >> x[i] >> y[i];
    }
    ll zmax = -1*INF, zmin = INF;
    ll wmax = -1*INF, wmin = INF;
    rep(i, n) {
        ll z = x[i] + y[i];
        ll w = x[i] - y[i];
        if(z > zmax) zmax = z;
        if(z < zmin) zmin = z;
        if(w > wmax) wmax = w;
        if(w < wmin) wmin = w;
    }
    cout << max(zmax-zmin, wmax-wmin) << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 6436
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

// vi g[N];
// int a[N];

void solve() {
  unsigned ll int i, j, h, w;
  cin >> h >> w;
  if(h==1 || w==1){
    cout << 1;
    return;
  }
  if((h&1) && (w&1))  cout << ((h*w)/2)+1;
  else cout << (h*w)/2;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int t = 1;
    // cin >> t;
    while(t--) {
      solve();
    }

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}


Measured memory_bytes: 3580
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

int main() {
    string S;
    cin >> S;
    ll N = S.size();
    S += 'D';

    ll cnt_a = 0;
    ll ans = 0;
    for(ll i = 0; i < N; i++) {
        if(S[i] == 'A') {
            cnt_a++;
        } else {
            if(S.substr(i, 2) == "BC") {
                ans += cnt_a;
                i++;
            } else {
                cnt_a = 0;
            }
        }
    }

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



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

#ifdef _DEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif

using namespace std;

bool is_palin(const string& s) {
    debug(s);
    string rs = s;
    reverse(rs.begin(), rs.end());
    return rs == s;
}

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

    cout << (is_palin(s) && is_palin(s.substr(0, (s.size() - 1) / 2)) && is_palin(s.substr((s.size() + 3) / 2 - 1)) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
string day[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    char s[4];
    while(cin>>s){
        int cnt=1,mx=1;
        for(int i=1;i<4;i++){
         if(s[i]==s[i-1]){
            cnt++;
            mx=max(mx,cnt);
         }else{
            cnt=1;
         }
        }
        //cout<<mx<<endl;
        if(mx>=3)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}
struct edge {ll to,cost;};
typedef pair<ll,ll> P;
vector<vector<edge>> G(100010);
vector<ll> d;

void dijkstra(ll s){
    // 小さい順に取り出す
    priority_queue<P,vector<P>,greater<P>> pq;
    fill(d.begin(),d.end(),INF);
    d[s] = 0;
    pq.push(P(0,s));
    while(!pq.empty()){
        P p = pq.top();
        pq.pop();
        ll v = p.second;
        if(d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); ++i) {
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                pq.push(P(d[e.to],e.to));
            }
        }
    }
}

int main() {
    int n;
    cin >> n;
    d.resize(100010);
    for (int i = 0; i < n-1; ++i) {
        int a,b,c;
        cin >> a >> b >> c;
        G[a].push_back({b,c});
        G[b].push_back({a,c});
    }
    int q,k;
    cin >> q >> k;
    dijkstra(k);
    vector<int> x(q),y(q);
    for (int i = 0; i < q; ++i) {
        cin >> x[i] >> y[i];
    }
    for (int i = 0; i < q; ++i) {
        ll ans;
        ans = (d[x[i]]+d[y[i]]);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 11120
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int n, a;
string str;

map<string,int> ma[6];

int main() {
    while (cin >> n) {
        for (int i = 0; i < 6; ++i) ma[i].clear();
        for (int i = 0; i < n; ++i) {
            cin >> str; cin >> a;
            ma[str.size()][str] += a;
        }
        
        for (int i = 0; i < 6; ++i) {
            EACH(it,ma[i]) {
                cout << it->first << " " << it->second << endl;
            }
        }
    }
    return 0;
}


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

int main(){
  int n;cin >> n;
  vector<int> a(n);
  long long ans = 0;

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

  int high = a[0];

  for(int i=1;i<n;i++){
    if(high<a[i]){
      high = a[i];
    }else{
      ans += high - a[i];
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 4056
#include <bits/stdc++.h>
using namespace std;
const int mx = 2e5+2;
int a[mx];
int cnt[mx];

int main()
{
    // freopen("../io/in.txt", "r", stdin);
    int n;
    cin >> n;
    for(int i=0; i<n; i++) {
        cin>>a[i];
        cnt[a[i]]++;
    }

    unordered_map<int, long long> mp;
    int x;
    long long total = 0LL;

    for(int i=1; i<=n; i++) {
        x = cnt[i];
        if(x != 0) {
            mp[i] = 1LL*x*(x-1)/2;
            total += mp[i];
        }
    }

    for(int i=0; i<n; i++) {
        x = a[i];
        cout<<total - mp[x] + 1LL*(cnt[x]-1)*(cnt[x]-2)/2 << "\n";
    }

    return 0;
}

    

Measured memory_bytes: 9160
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        public void solve(InputReader in, PrintWriter out) {
           String s = in.next();
           String t = in.next();
           String t_substring = t.substring(0, s.length());
           if(s.length() == t_substring.length() && s.equals(t_substring)){
            out.println("Yes");
           }
           else out.println("No");
        }

        
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong(){
          return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 32704
#include <cstdio>
#include <algorithm>
using namespace std;
#define ll long long
ll mod = 1000000007;
ll big(ll b, ll p){
	if (p == 1) return b;
	ll h = big(b, p / 2);
	if (p % 2 == 0){
		return (h * h) % mod;
	}else{
		return (((h * h) % mod) * b) % mod;
	}
}
int main(){
	int n, k;
	scanf("%d %d", &n, &k);
	ll a[n];
	for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
	sort(a, a + n);
	ll x = 1, ans1 = 0, ans2 = 0, c = 1;
	for (int i = k - 1; i < n; i++){
		ans1 += a[i] * x;
		ans1 %= mod;
		x *= (i + 1);
		x %= mod;
		x *= big(c, mod - 2);
		x %= mod;
		c++;
	}
	reverse(a, a + n);
	x = 1;
	c = 1;
	for (int i = k - 1; i < n; i++){
		ans2 += a[i] * x;
		ans2 %= mod;
		x *= (i + 1);
		x %= mod;
		x *= big(c, mod - 2);
		x %= mod;
		c++;
	}
	printf("%lld\n", (ans1 - ans2 + mod) % mod);
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s,x;
	int mi;
	cin>>s;
	mi=1000;
	for(int i=0;i<s.size()-2;i++){
		x=s.substr(i,3);
		mi=min(mi,abs(753-((x[0]-'0')*100+(x[1]-'0')*10+(x[2]-'0'))));
	}
	cout<<mi<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
//template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
//template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll mod=1e9+7;


int main()
{
    ll x,y,z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
    return 0;
} 


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


int main() {
  int n,k;
  cin >> n >> k;
  vector<int> w(n);

  for (int i = 0;i < n;i++){
      cin >> w.at(i);
  }
  
  int left,right;
  left = 0;
  right = 1000000000;
  int ans;
  while (true){
      int mid;
      mid = (left+right)/2;
      if (right-left <= 1){
          int now = 0;
          int used = 1;
          bool flag = true;
          for(int i = 0;i < n;i++){
              if (w.at(i) > left){
                  flag = false;
              }else if(w.at(i)+now <= left){
                  now+=w.at(i);
              }else{
                  now = w.at(i);
                  used++;
              }
          }
          if (used > k || !flag){
              ans = right;
          }else{
              ans = left;
          }
          break;
      }else{
          int now = 0;
          int used = 1;
          bool flag = true;
          for(int i = 0;i < n;i++){
              if (w.at(i) > mid){
                  flag = false;
                  break;
              }else if(w.at(i)+now <= mid){
                  now+=w.at(i);
              }else{
                  now = w.at(i);
                  used++;
              }
          }
          if (used > k || !flag){
              left = mid;
          }else{
              right = mid;
          }
      }


  }
  cout << ans << endl;

  
}


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

bool search(int*, int, int, int);

int main()
{
	int tmp, s[100000], t, n, m = 1, q, count = 0;

	cin >> n >> s[0];
	for (int i = 1; i < n; i++)
	{
		cin >> s[i];
	}
	cin >> q;
	for (int i = 0; i < q; i++)
	{
		cin >> t;
		count += search(s, 0, n, t);
	}

	cout << count << endl;

	return 0;
}

bool search(int* s, int left, int right, int t)
{
	int mid;
	mid = (right + left) / 2;
	if (right <= left)
		return 0;
	else if (s[mid] == t)
		return 1;
	else if (t < s[mid])
		return search(s, left, mid, t);
	else
		return search(s, mid + 1, right, t);
	return -1;
}


Measured memory_bytes: 3412
# 入力

N, X=map(int, input().split())
a=[]
answer=0
least=2000
memory=0

for i in range(0, N):
    a.append(int(input()))
    # 全部1個ずつ作る
    X-=a[i]
    answer+=1
    # 最小のものを調べておく
    if a[i]<least:
        least = a[i]

answer+=X // least

print(answer)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define fastio() ios_base::sync_with_stdio(false);
using namespace std;
typedef long long ll;


int main(){
	int n, k; scanf("%d %d", &n, &k);
	vector<int> dp(n, 1e9), a(n);
	for(int i = 0; i<n; i++) scanf("%d", &a[i]);
	dp[0] = 0;
	for(int i = 1; i<n; i++){
		for(int j = 1; j<=k; j++)
			if(i-j>=0) dp[i] = min(dp[i], dp[i-j]+abs(a[i]-a[i-j]));
	} 
	printf("%d\n", dp[n-1]);
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>

int main(){
    int a,b,i;
    char op;
    for(i=1;i>0;i++){
         scanf("%d %c %d",&a,&op,&b);
         if  (op=='/'){printf("%d\n",a/b);}
         else if(op=='+'){printf("%d\n",a+b);}
         else if(op=='-'){printf("%d\n",a-b);}
         else if(op=='*'){printf("%d\n",a*b);}
         else if(op=='?'){break;}

         }
    return 0;
    }



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

const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::string S){
    if(N%2 == 0){
        //cout << S.substr(0, S.size()/2) << endl;
        //cout << S.substr(S.size()/2-1, S.size()/2) << endl;
        if(S.substr(0, S.size()/2) == S.substr(S.size()/2, S.size()/2)) cout << YES << endl;
        else cout << NO << endl;
    }else cout << NO << endl;
    return;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 3704
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    ll a, b, k;
    cin >> a >> b >> k;
    
    ll tc = max<ll>(a-k,0);
    ll ac = b;
    if (k-a>0) {
        ac = max<ll>(b-(k-a),0);
    }
    cout << tc << " " << ac << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 87;
int a[N];
int main()
{
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    if (a[0] != 0) {
        cout << -1 << endl;
        return 0;
    }
    ll ans = 0;
    int tp = 0;
    for (int i = n - 1; i >= 0; --i) {
        if (a[i] < tp) {
            cout << -1 << endl;
            return 0;
        }
        if (a[i] > tp) {
            ans += a[i];
            tp = a[i];
        }
        tp = max(0, tp-1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(){
	int i=0,j=0,n,l;
	int a[10],b[10];
	while(scanf("%d",&n)!=EOF){
		if(n==0){
			i--;
			b[j]=a[i];
		    printf("%d\n",b[j]);
			j++;
		}
		else{
		    a[i]=n;
			i++;
		}
	}
	return 0;
}

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

namespace Aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
            string input;
            while((input = Console.ReadLine()) != "0 0") {
                var d = input.Split().Select(p => int.Parse(p)).ToArray();
                Console.WriteLine("{0} {1}" , d[d[0] < d[1] ? 0 : 1] , d[d[0] < d[1] ? 1 : 0]);
            }
        }
    }
}

Measured memory_bytes: 6128
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int v[40][40], x[40][40][4], w, h, z[4], q[4];
void d0(int c, int d, int p1, int p2) {
	if (d == 0) {
		x[p1 + 1][p2][0] = min(x[p1 + 1][p2][d], x[p1][p2][d] + c);
	}
	else if (d == 1) {
		x[p1][p2 + 1][1] = min(x[p1][p2 + 1][d], x[p1][p2][d] + c);
	}
	else if (d == 2) {
		x[p1 - 1][p2][2] = min(x[p1 - 1][p2][d], x[p1][p2][d] + c);
	}
	else {
		x[p1][p2 - 1][3] = min(x[p1][p2 - 1][d], x[p1][p2][d] + c);
	}
}
void d3(int c,int d,int p1,int p2) {
	if (d == 0) {
		x[p1][p2 + 1][1] = min(x[p1][p2 + 1][1], x[p1][p2][d] + c);
	}
	else if (d == 1) {
		x[p1 - 1][p2][2] = min(x[p1 - 1][p2][2], x[p1][p2][d] + c);
	}
	else if (d == 2) {
		x[p1][p2 - 1][3] = min(x[p1][p2 - 1][3], x[p1][p2][d] + c);
	}
	else {
		x[p1 + 1][p2][0] = min(x[p1 + 1][p2][0], x[p1][p2][d] + c);
	}
}
void d2(int c, int d, int p1, int p2) {
	if (d == 0) {
		x[p1 - 1][p2][2] = min(x[p1 - 1][p2][2], x[p1][p2][d] + c);
	}
	else if (d == 1) {
		x[p1][p2 - 1][3] = min(x[p1][p2 - 1][3], x[p1][p2][d] + c);
	}
	else if (d == 2) {
		x[p1 + 1][p2][0] = min(x[p1 + 1][p2][0], x[p1][p2][d] + c);
	}
	else {
		x[p1][p2 + 1][1] = min(x[p1][p2 + 1][1], x[p1][p2][d] + c);
	}
}
void d1(int c, int d, int p1, int p2) {
	if (d == 0) {
		x[p1][p2 - 1][3] = min(x[p1][p2 - 1][3], x[p1][p2][d] + c);
	}
	else if (d == 1) {
		x[p1 + 1][p2][0] = min(x[p1 + 1][p2][0], x[p1][p2][d] + c);
	}
	else if (d == 2) {
		x[p1][p2 + 1][1] = min(x[p1][p2 + 1][1], x[p1][p2][d] + c);
	}
	else {
		x[p1 - 1][p2][2] = min(x[p1 - 1][p2][2], x[p1][p2][d] + c);
	}
}
int main() {
	while (true) {
		memset(x, 1, sizeof(x));
		cin >> w >> h; if (!w) { break; }
		for (int i = 1; i <= h; i++) {
			for (int j = 1; j <= w; j++) {
				cin >> v[i][j];
			}
		}
		cin >> z[0] >> z[1] >> z[2] >> z[3];
		x[1][1][1] = 0;
		for (int t = 0; t < 1999; t++) {
			for (int i = 1; i <= h; i++) {
				for (int j = 1; j <= w; j++) {
					for (int k = 0; k < 4; k++) {
						for (int l = 0; l < 4; l++) {
							if (v[i][j] == l) {
								q[l] = 0;
							}
							else {
								q[l] = z[l];
							}
						}
						d0(q[0], k, i, j);
						d1(q[1], k, i, j);
						d2(q[2], k, i, j);
						d3(q[3], k, i, j);
					}
				}
			}
		}
		cout << min(x[h][w][0], x[h][w][1]) << endl;
	}
}

Measured memory_bytes: 1192
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <climits>
#include <algorithm>
using namespace std;

int main()
{
    int N;
    int T[100007];
    int M;
    vector<int> P;
    vector<int> X;

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> T[i];
    }
    cin >> M;
    for (int i = 0; i < M; i++) {
        int Pi, Xi;
        cin >> Pi >> Xi;
        P.push_back(Pi - 1);
        X.push_back(Xi);
    }

    for (int i = 0; i < P.size(); i++) {
        int ans = 0;
        for (int j = 0; j < N; j++) {
            ans += (P[i] == j) ? X[i] : T[j];
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

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

    int s = 1;
    for (int i = 0; i < d; i++) {
        s *= 100;
    }

    if (n <= 99) {
        cout << n * s << endl;
    } else {
        cout << 101 * s << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,M,X;
  cin>>N>>M>>X;
  int cost=0;
  for(int i=0;i<M;i++){
  int x;
    cin>>x;
    if(x<X)
      cost++;
  }
  cost=min(cost,M-cost);
  cout<<cost<<endl;
   return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

// ABC091 at 2018/03/17

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solveA();
    }

    private void solveA() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        if ((A + B) < C) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }

    private void solveB() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveC() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveD() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveE() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

    private void solveF() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println(N);
    }

}

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

using namespace std;

int main(){
    int n,x,ans = 0;
    cin >> n >> x;

    vector<int>v(n+1,0);

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

    for(int i = 0;i < n+1;i++){
        if(v[i] <= x)ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
long long d[100010]={1};
int mbk(long long a,int n,int m){return n?(mbk((a*a)%m,n/2,m)*(n%2?a:1))%m:1;}
int inv(int a,int m){return mbk((long long)a,m-2,m);}
int aCb(int a,int b,int m){
  if(a<b)return 0;
  return d[a]*inv(d[b],m)%m*inv(d[a-b],m)%m;
}
int main(){
  int n,i,a,l,M=1e9+7,b[100010]={};
  scanf("%d",&n);
  for(i=1;i<=100005;i++)d[i]=(d[i-1]*i)%M;
  for(i=0;i<=n;i++){
    scanf("%d",&a);
    if(b[a])l=i+1-b[a];
    b[a]=i+1;
  }//printf("%d\n",l);
  for(i=0;i<=n;i++)printf("%d\n",(aCb(n+1,i+1,M)-aCb(n-l,i,M)+M)%M);
  return 0;
}


Measured memory_bytes: 2304
#!/usr/bin/env python3


PRIZES = {3: 100000, 2: 200000, 1: 300000}


def solve(x, y):
    res = PRIZES.get(x, 0)
    res += PRIZES.get(y, 0)
    if x == y == 1:
        res += 400000
    return res


def main():
    x, y = (int(z) for z in input().split())
    res = solve(x, y)
    print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
           ///BISMILLAHIR RAHMANIR RAHIM

int main()
{
    int n;
    cin>>n;
    int a[n+1];
    int cnt=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(i%2==1 && a[i]%2==1)
            cnt++;
    }
    cout<<cnt<<endl;

}
/// A L H A M D U L I L L A H



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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////

ll N,K;
ll A[101010];
ll i, j, k,ans;
int main(){
    scanf("%lld%lld", &N, &K);
    
    fornum(i,0,N){
        scanf("%lld", &A[i]);
    }

    printf("%lld\n", (N - 2) / (K - 1) + 1);

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
using ll = long long;
constexpr ll INF = 1LL << 60;

ll n, k, c, a[200010], dp[100010][2];
string s;

int main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n;
  for(int i = 0; i < n; ++i) cin >> a[i];
  for(int i = 0; i <= n / 2 + 1; ++i) {
    dp[i][0] = -INF;
    dp[i][1] = -INF;
  }

  dp[0][0] = 0;
  for (int i = 1; i <= n; ++i) {
    int j = (i - 1) / 2;
    dp[j + 1][0] = max(dp[j + 1][0], dp[j + 1][1]);
    dp[j + 1][1] = dp[j][0] + a[i - 1];

    dp[j][0] = max(dp[j][0], dp[j][1]);
    dp[j][1] = dp[j - 1][0] + a[i - 1];
  }
  cout << max(dp[n / 2][0], dp[n / 2][1]);
  return 0;
}



Measured memory_bytes: 6676
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[101][100001];
ll knapsack(ll wt[],ll val[],ll w,ll n)
{
  if(n==0 || w==0)
  return 0;

  if(dp[n][w]!=-1)
  return dp[n][w];

  if(wt[n-1]<=w)
  {
    dp[n][w]=max((val[n-1]+knapsack(wt,val,w-wt[n-1],n-1)),knapsack(wt,val,w,n-1));
    return dp[n][w];
  }
  else if(wt[n-1]>w)
  {
    dp[n][w]=knapsack(wt,val,w,n-1);
    return dp[n][w];
  }
}

int main()
 {
	ll t,n,w,i,ans=0;
  memset(dp,-1,sizeof(dp));
  cin>>n>>w;
  ll wt[n];
  ll val[n];
  for(i=0;i<n;i++)
  {
    cin>>wt[i]>>val[i];
  }
  ans=knapsack(wt,val,w,n);
  cout<<ans;
	return 0;
}


Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i) = 0; (i) < (n); (i)++)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


int main() {
    int n, m;
    string s;
    cin >> n >> m >> s;
    int r = n;
    vector<int> dist(n+1, 0);
    for(int i = n-1; i >= 0; i--){
        if(s[i] == '1'){
            dist[i] = -1;
            continue;
        }
        while(r > i+m) r--;
        while(dist[r] == -1) r--;
        if(r == i){
            puts("-1");
            return 0;
        }
        dist[i] = dist[r] + 1;
    }

    /*
    for(auto d : dist){
        cout << d << " ";
    }
    cout << endl;
    */


    int running = 0;
    for(int i = 0; i <= n; i++){
        if(dist[i] == dist[running] - 1){
            cout << i - running << " ";
            running = i;
        }
    }
    cout << endl;
}


Measured memory_bytes: 1024
n,p,q=map(int,input().split())
b=[0]*n
for i in range(n):b[i]=p*i+int(input())
b.sort()
a=q*p*n+p*n*~-n//2;s=0
for i in range(1,-~n):
    s+=b[n-i]
    a=max(a,p*q*(n-i)+p*(n-i)*(~-n-i)//2-p*i*(i-1)//2-p*i*(n-i)+s)
print(a)

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

using namespace std;

int main(){
  int h,n,a=0,b;
  cin >>h>>n;
  for(int i=0;i<n;i++){
    cin >>b;
    a+=b;
  }
  if(a>=h){
    cout << "Yes" <<endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String line = null;
			while ((line = br.readLine()) != null) {
				System.out.println(line.toUpperCase());
			}
		}
	}
}

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

int main() {
  string abcd;
  cin >> abcd;
  int A, B, C, D;
  A = abcd.at(0)-'0'; B = abcd.at(1)-'0'; C = abcd.at(2)-'0'; D = abcd.at(3)-'0';
  bool is7=false;
  for (int i=0; i<2; i++) {
    for (int j=0; j<2; j++) {
      for (int k=0; k<2; k++) {
        if (i==0) {
          if (j==0) {
            if (k==0) {
              if (A+B+C+D==7) {
                cout << A << '+' << B << '+' << C << '+' << D << "=7" << endl;
                is7 = true; break;
              }
            } else {
              if (A+B+C-D==7) {
                cout << A << '+' << B << '+' << C << '-' << D << "=7" << endl;
                is7 = true; break;
              }
            }
          } else {
            if (k==0) {
              if (A+B-C+D==7) {
                cout << A << '+' << B << '-' << C << '+' << D << "=7" << endl;
                is7 = true; break;
              }
            } else {
              if (A+B-C-D==7) {
                cout << A << '+' << B << '-' << C << '-' << D << "=7" << endl;
                is7 = true; break;
              }
            }
          }
        } else {
          if (j==0) {
            if (k==0) {
              if (A-B+C+D==7) {
                cout << A << '-' << B << '+' << C << '+' << D << "=7" << endl;
                is7 = true; break;
              }
            } else {
              if (A-B+C-D==7) {
                cout << A << '-' << B << '+' << C << '-' << D << "=7" << endl;
                is7 = true; break;
              }
            }
          } else {
            if (k==0) {
              if (A-B-C+D==7) {
                cout << A << '-' << B << '-' << C << '+' << D << "=7" << endl;
                is7 = true; break;
              }
            } else {
              if (A-B-C-D==7) {
                cout << A << '-' << B << '-' << C << '-' << D << "=7" << endl;
                is7 = true; break;
              }
            }
          }
        }
      }
      if (is7) break;
    }
    if (is7) break;
  }
}


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

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int a,b;cin>>a>>b;

  if (b==1){
    cout << 0 << endl;
    return 0;
  }

  int ans = 1;
  int cur = a;
  while(cur<b){
    ans++;
    cur += (a-1);
  }
  cout << ans << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
using namespace std;
typedef long long ll;
int main()
{
    ll N, C, K;
    cin >> N >> C >> K;
    vector<ll> t(N);
    for (int i = 0; i < N; i++) cin >> t[i];
    sort(ALL(t));
    int ans = 1;
    ll mxc = 1;
    ll mxk = t[0] + K;
    for (int i = 1; i < N; i++) {
        mxc++;
        if (mxc > C) {
            mxc = 1;
            mxk = t[i] + K;
            ans++;
            continue;
        }
        if (mxk < t[i]) {
            mxc = 1;
            mxk = t[i] + K;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#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>;


int main(){
   vector<int> a(3);
   rep(i,3) cin>>a[i];
   sort(a.begin(),a.end());
   cout<<a[2]-a[0]<<endl;
   return 0;
}

   


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

template <std::size_t N>
struct Era {
	int prime_array[ N + 1 ];

	constexpr Era() : prime_array() {
		prime_array[ 0 ] = 0;
		prime_array[ 1 ] = 0;
		rep( i, 2, N + 1 ){
			prime_array[ i ] = 1;
		}
		int lim = N;
		rep( i, 2, lim ){
			if (prime_array[ i ] == 0)
				continue;
			lim = N / i;
			for(int j = i * 2; j < N + 1; j += i){
				prime_array[ j ] = 0;
			}
		};
		rep_d( i, N, 0 ){
			if (prime_array[ i ] == 1 && prime_array[ ( i + 1 ) / 2 ] == 1)
				prime_array[ i ] = 1;
			else
				prime_array[ i ] = 0;
		}
		rep( i, 1, N ){
			prime_array[ i ] += prime_array[ i - 1 ];
		}
	}
};

const int MaxN = 1e5 + 5;
int main( void ){
	constexpr auto era = Era <MaxN>();
	int Q; cin >> Q;
	rep( i, 0, Q ){
		int l, r;
		scanf ( "%d %d", &l, &r );
		printf( "%d\n", era.prime_array[ r ] - era.prime_array[ l - 1 ] );
	}
}


Measured memory_bytes: 1024