akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> T INF = 1000000000;

template <typename T>
struct edge {
    int from, to; T cost;
    edge(int to, T cost) : from(-1), to(to), cost(cost) {}
    edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
};

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> c(n), r(n);
    auto f = [&](int i, int j){ return i*n+j; };
    vector<vector<edge<int>>> G(n);
    for (int i = 0; i < n; ++i) cin >> c[i] >> r[i];
    for (int i = 0; i < k; ++i) {
        int a, b;
        scanf("%d %d", &a, &b);
        a--; b--;
        G[a].emplace_back(b, c[a]);
        G[b].emplace_back(a, c[b]);
    }
    vector<vector<int>> dp(n, vector<int>(n, INF<int>));
    priority_queue<tuple<int, int, int>,vector<tuple<int, int, int>>,greater<>> Q;
    dp[0][0] = 0;
    Q.emplace(0, 0, 0);
    while(!Q.empty()){
        int i, j, cost;
        tie(cost, i, j) = Q.top(); Q.pop();
        if(dp[i][j] < cost) continue;
        for (auto &&e : G[i]) {
            auto cost2 = cost + e.cost;
            if(dp[e.to][r[i]-1] <= cost2) continue;
            dp[e.to][r[i]-1] = cost2;
            Q.emplace(cost2, e.to, r[i]-1);
        }
        if(j){
            for (auto &&e : G[i]) {
                if(dp[e.to][j-1] <= cost) continue;
                dp[e.to][j-1] = cost;
                Q.emplace(cost, e.to, j-1);
            }
            if(dp[i][j-1] > cost) {
                dp[i][j-1] = cost;
                Q.emplace(cost, i, j-1);
            }
        }
    }
    int ans = INF<int>;
    for (int i = 0; i < n; ++i) {
        ans = min(ans, dp[n-1][i]);
    }
    cout << ans << "\n";
    return 0;
}


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

#define M_PI 3.14159265358979323846

using namespace std;

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


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

    int a,b,x;

    cin >> a >> b >> x;

    double ans;

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

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

    return 0;
}

Measured memory_bytes: 888
A, B, C, D = map(int, input().split())
def gcd(x,y):
    while y!=0:
        x,y=y,x%y
    return x

NBC = B//C
NBD = B//D
CD_lcm = (C*D)//gcd(C,D)   #CとDの最小公倍数
NBCD = B//CD_lcm #CとD共通で割り切れる数
B_0 = (NBC+NBD)-NBCD  #Bの答え
ans_B = B-B_0
NAC = (A)//C
NAD = (A)//D
NACD = (A)//CD_lcm  
A_0 = (NAC+NAD)-NACD #Aの答え
ans_A = A-A_0
if A%C==0 or A%D==0:
    ans = ans_B-ans_A
else:
    ans = ans_B-ans_A+1
print(ans)

Measured memory_bytes: 3064
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
const long double eps = 1e-12;
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*2
#define REP(a,b) for(long long a = 0;a < b;++a)
long long bad[700][700] = {};
vector<pair<int,int>> vertexs[2][700][700];
int visited[2][700][700];
int coloring[2][700][700];
int main() {
	long long n, d[2];
	cin >> n;
	REP(q, 2) {
		cin >> d[q];
	}
	REP(itr, 2) {
		for (long long a = 0; a * a <= d[itr]; ++a) {
			long long b = sqrt(d[itr] - a * a);
			if (b * b + a * a != d[itr]) continue;
			for (int q = 0; q < 2 * n; ++q) {
				for (int j = 0; j < 2 * n; ++j) {
					if (bad[q][j] == 1) continue;
					int xe[4] = { 1,1,-1,-1 };
					int ye[4] = { 1,-1,1,-1 };
					REP(t, 4) {
						int now_x = q + xe[t] * a;
						int now_y = j + ye[t] * b;
						if (now_x >= 0 && now_x < 2 * n && now_y >= 0 && now_y < 2 * n) {
							if (bad[now_x][now_y] == 1) continue;
							vertexs[itr][q][j].push_back(make_pair(now_x, now_y));
							vertexs[itr][now_x][now_y].push_back(make_pair(q, j));
						}
					}
				}
			}
		}
		for (int q = 0; q < 2 * n; ++q) {
			for (int j = 0; j < 2 * n; ++j) {
				if (visited[itr][q][j] == 0 && bad[q][j] == 0) {
					queue<pair<int, int>> next;
					next.push(make_pair(q, j));
					visited[itr][q][j] = 1;
					vector<pair<int, int>> used;
					int cnt[2] = {};
					while (next.empty() == false) {
						pair<int, int> now = next.front();
						next.pop();
						used.push_back(now);
						REP(i, vertexs[itr][now.first][now.second].size()) {
							pair<int, int> going = vertexs[itr][now.first][now.second][i];
							if (visited[itr][going.first][going.second] == 0) {
								visited[itr][going.first][going.second] = 1;
								coloring[itr][going.first][going.second] = (coloring[itr][now.first][now.second] + 1) % 2;
								cnt[coloring[itr][going.first][going.second]]++;
								next.push(going);
							}
						}
					}
					int yusen = 1;
					if (cnt[0] < cnt[1]) {
						yusen = 0;
					}
					REP(q, used.size()) {
						if (coloring[itr][used[q].first][used[q].second] == yusen) {
							bad[used[q].first][used[q].second] = 1;
						}
					}
				}
			}
		}
	}
	int cnt = 0;
	REP(q, 2 * n) {
		REP(j, 2 * n) {
			if (bad[q][j] == 0) {
				cnt++;
				if (cnt <= n * n) {
					cout << q << " " << j << endl;
				}
			}
		}
	}
}

Measured memory_bytes: 215152
from fractions import gcd
from functools import reduce


def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def func(x):
    return x // 2

def cont(x):
    cnt = 0
    while x % 2 == 0:
        x //= 2
        cnt += 1
    return cnt

def main():
    N, M = map(int, input().split())
    A = list(map(func, map(int, input().split())))

    l = lcm_list(A)
    cnt = cont(A[0])
    for i in range(1, N):
        if cnt != cont(A[i]):
            print(0)
            exit()

    ans = M // l
    if ans % 2 == 0:
        print(ans // 2)
    else:
        print(ans // 2 + 1)



if __name__ == "__main__":
    main()

Measured memory_bytes: 89708
while True:
    m, f, r = map(int, input().strip().split())
    if m == f == r == -1: break
    if m == -1 or f == -1 or m + f < 30:
        print('F')
    elif m + f >= 80:
        print('A')
    elif m + f >= 65:
        print('B')
    elif m + f >= 50:
        print('C')
    elif m + f >= 30:
        print('C' if r >= 50 else 'D')

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

int main(){
	int k, n;
  	cin>>k>>n;
  	int a[n];
  	int max[2]={0};
  	for(int i=0;i<n;i++){
    	cin>>a[i];
      	if(i>0){
        	if(max[0]<a[i]-a[i-1]){
            	max[0]=a[i]-a[i-1];
              	max[1]=i-1;
            }
        }
    }
  	if(max[0]<a[0]+(k-a[n-1])){
    	max[0]=a[0]+(k-a[n-1]);
      	max[1]=n;
    }
  
  	int total=0;
  	if(max[1]==n){
    	total=a[n-1]-a[0];	
    }else{
    	total+=a[max[1]];
      	total+=k-a[max[1]+1];
    }
  
  	cout<<total<<endl;
  
  	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
/* #include <regex> */

using namespace std;

/* g++ -g -std=c++11 */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#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 FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    int n,W;
    while (cin >> n >> W) {
        vector<LL> w(n),v(n);
        FOR(i,0,n)
            cin >> w[i] >> v[i];
        vector<LL> dp(W+1);
        FOR(i,0,n) FORR(j,W,w[i]-1)
            dp[j] = max(dp[j],dp[j-w[i]]+v[i]);
        cout << dp[W] << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
	ll D,X[200001],Y[200001];
int main(){
	int N;

	int ans=0;
	scan(N>>D);
	rep(i,N){
		scan(X[i]>>Y[i]);
		if(X[i]*X[i]+Y[i]*Y[i]<=D*D) ans++;
	}
	prin(ans);
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); i--)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 1e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

int N,D;
string S;

ll dp[MX][105][2];

ll solve_dp(int p, int rem, bool can) {
    if (p == N) return (rem == 0);

    ll& res = dp[p][rem][can];
    if (res != -1) return res;

    res = 0;
    F0R(i,10) {
        if (can) { // I can put any number
            res = (res+solve_dp(p+1,(rem+i)%D,can))%MOD;
        } else { // I can put any number (i <= number) and if i == number I can't free
            int num = S[p]-'0';
            if (num >= i) res = (res+solve_dp(p+1,(rem+i)%D,num != i))%MOD;
        }
    }
    return res;
}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin >> S >> D;

    N = sz(S);

    F0R(i,MX) F0R(j,101) F0R(k,2) dp[i][j][k] = -1;

    cout << ((solve_dp(0,0,0)-1+MOD)%MOD) << "\n";

}


Measured memory_bytes: 165248
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int gcd(int x,int y){
  if(y==0) return x;
  return gcd(y,x%y);
}
int main(){
  int n;cin>>n;
  int i,j;
  vector<int> a(n);
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  vector<int> l(n),r(n);
  for(i=0;i<n-1;i++){
    l[i+1]=gcd(l[i],a[i]);
  }
  for(i=n-1;i>0;i--){
    r[i-1]=gcd(r[i],a[i]);
  }
  int ans=1;
  for(i=0;i<n;i++){
    ans=max(ans,gcd(r[i],l[i]));
  }
  cout<<ans<<endl;

}


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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	long N;
	cin >>N;
	vector<long> a(N*3, 0);
	for (long i=0; i<N*3; i++)
		cin >>a.at(i);
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	long S=0;
	for (long i=0; i<N; i++)
		S +=a.at(i*2+1);
	cout <<S <<endl;
	return 0;
}



Measured memory_bytes: 2560
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;

int A, P;
int main(void){
    cin >> A >> P;
    cout << (3*A+P)/2 << endl;
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <map>
int a[100005], b[100005], fa[200005];
std::map<int, int> app;
int getfa(int u)
{
	if (u == fa[u])
		return u;
	return fa[u] = getfa(fa[u]);
}
int main()
{
	// freopen("AGC016-D.in", "r", stdin);
	int n, cnt = 0, ans = -2;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", a + i);
		a[0] ^= a[i];
	}
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", b + i);
		b[0] ^= b[i];
	}
	for (int i = 0; i < 200005; i++)
		fa[i] = i;
	for (int i = 0; i <= n; i++)
	{
		if (a[i] != b[i] || !i)
		{
			if (!app.count(a[i]))
				app[a[i]] = cnt++;
			if (!app.count(b[i]))
				app[b[i]] = cnt++;
			fa[getfa(app[a[i]])] = getfa(app[b[i]]);
			ans++;
		}
	}
	for (int i = 0; i < cnt; i++)
		ans += i == fa[i];
	std::sort(a, a + n + 1);
	std::sort(b, b + n + 1);
	for (int i = 0; i <= n; i++)
	{
		if (a[i] != b[i])
		{
			puts("-1");
			return 0;
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 8064
#!/usr/bin/env python3
import sys
from itertools import accumulate
INF = float("inf")


def solve(N: int, C: int, s: "List[int]", t: "List[int]", c: "List[int]"):
    seq = [0]*(3*10**5)
    # チャンネルを切り替えない場合、0.5秒のラグが発生しない。
    # 同じチャンネルでしりとあたまがいっしょなら、ひとつの番組にしておく
    c, s, t = zip(*sorted(sorted(zip(c, s, t), key=lambda x: x[1])))
    # いもす法
    # seq = [0]*(40)
    pre_s, pre_t, pre_c = -1, -1, -1
    for sv, tv, cv in zip(s, t, c):
        if pre_c == cv and pre_t == sv:
            seq[2*pre_t] += 1
            seq[2*tv] -= 1
        else:
            seq[2*sv-1] += 1
            seq[2*tv] -= 1
        pre_s, pre_t, pre_c = sv, tv, cv
    acc = list(accumulate(seq))
    # print(seq)
    # print(acc)
    print(max(acc))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    s = [int()] * (N)  # type: "List[int]"
    t = [int()] * (N)  # type: "List[int]"
    c = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        s[i] = int(next(tokens))
        t[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(N, C, s, t, c)


if __name__ == '__main__':
    main()


Measured memory_bytes: 30692
#include <iostream>
using namespace std;
int main(){
    int n, a, b; cin >> n >> a >> b;
    string s; cin >> s;
    int c = 0, b_c = 0;
    for(int i = 0; i < n; i++) {
        if(s[i] == 'a') {
            if(c < a + b) {
                cout << "Yes" << endl;
                c++;
            } else {
                cout << "No" << endl;
            }
        } else if(s[i] == 'b') {
            if(c < a + b && b_c < b) {
                cout << "Yes" << endl;
                c++;
                b_c++;
            } else {
                cout << "No" << endl;
            }

        } else {
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 896
#![allow(non_snake_case, dead_code)]

use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

struct Scanner<'a> {
    cin : StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin : StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}


fn main(){
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let m = 1_001_000;
    let mut g = vec![1; m+1];
    g[0] = 0;
    g[1] = 0;
    for i in 2..m+1 {
        if i*i > m { break; }
        if g[i] > 0 {
            for j in i..m/i+1 {
                g[i*j] = 0;
            }
        }
    }
    loop {
        let mut a: usize = sc.read();
        let d: usize = sc.read();
        let mut n: usize = sc.read();
        if n == 0 { break; }
        loop {
            if g[a] > 0 {
                n -= 1;
                if n == 0 {
                    println!("{}", a);
                    break;
                }
            }
            a += d;
        }
    }
}



Measured memory_bytes: 9020
import numpy as np
import sys

input = sys.stdin.readline

N = int(input())

if N == 1:
    print(1)
    exit()

l = [0]*100
l[0] = 2
l[1] = 1
for i in range(2,100):
    l[i] =l[i-1] + l[i-2]

print(l[N])

Measured memory_bytes: 12392
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

int main()
{
	int money = 0;

	int change = 0;



	while (1)
	{


		int count500 = 0;

		int count100 = 0;

		int count50 = 0;

		int count10 = 0;

		int count5 = 0;

		int count1 = 0;


		cin >> money;

		if (money == 0)break;


		change = 1000 - money;

		count500 = change / 500;

		count100 = (change - (count500 * 500)) / 100;

		count50 = (change - (count500 * 500) - (count100 * 100)) / 50;

		count10 = (change - (count500 * 500) - (count100 * 100) - (count50 * 50)) / 10;

		count5 = (change - (count500 * 500) - (count100 * 100) - (count50 * 50) - (count10 * 10)) / 5;

		count1 = (change - (count500 * 500) - (count100 * 100) - (count50 * 50) - (count10 * 10) - (count5 * 5)) / 1;

		cout << count500 + count100 + count50 + count10 + count5 + count1 << endl;
	}

	return 0;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
#define fr(i,c,b) for(int i=c;i<b;i++)
#define frl(i,c,b) for(ll i=c;i<b;i++)
#define si(x) int x; scanf("%d", &x)
#define sll(x) ll x; scanf("%lld", &x)
#define pi(x) printf("%d", x)
#define pll(x) printf("%lld", x)
#define nl printf("\n")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define MAX 100001
#define M 1000000007
#define pb push_back

typedef long long int ll;

using namespace std;

int main(){
    sll(a); sll(b); sll(c); sll(d);
    ll x,y;
    if(a<0&&b<0&&c<0&&d<0)
    {
        x=min(a,b);
        y=min(c,d);
        cout<<x*y;
    }
    else if(a>0&&b>0&&c>0&&d>0)
    {
        x=max(a,b);
        y=max(c,d);
        cout<<x*y;
    }
    else{
        ll prod1; 
        prod1=max(max(a,b)*max(c,d),min(a,b)*min(c,d));
        ll val=prod1;
        prod1=max(max(a,b)*min(c,d),val);
        prod1=max(prod1,min(a,b)*max(c,d));
        cout<<prod1;        
    }
}

Measured memory_bytes: 3760
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

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

int main() {
	int n, m;
	while (cin >> m >> n, n || m) {
		int v[100];
		REP(i, n) scanf("%d", &v[i]);
		
		int sum[100];
		sum[0] = v[0];
		FOR(i,1,n) sum[i] = sum[i - 1] + v[i];
		
		int ans = 1;
		REP(i, n) ans = max(ans, v[i]);
		ans = max(ans, sum[n - 1] / m);
		
		while (true) {
			int cnt = 0, pos = 0;
			while (pos < n) {
				cnt++;
				if (cnt > m) break;
				
				int now = v[pos++];
				while (pos < n && now + v[pos] <= ans) now += v[pos++];
			}
			
			if (cnt <= m) {
				cout << ans << endl;
				break;
			}
			
			ans++;
		}
	}
	
	return 0;
}

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

long long solve(size_t n)
{
    vector<long long> A(n + 1, 0);
    for (size_t i = 1; i <= n; i++)
    {
        cin >> A[i];
    }

    vector<vector<long long>> dp(n + 1, vector<long long>(3, -1e15));
    dp[0][0] = 0;
    for (size_t i = 1; i <= n; i++)
    {
        if (i % 2 == 0)
        {
            {
                // j = 0
                dp[i][0] = max(dp[i][0], dp[i - 1][0]);
            }
            {
                // j = 1
                dp[i][1] = max(dp[i][1], dp[i - 1][1] + A[i]);
                dp[i][2] = max(dp[i][2], dp[i - 1][1]);
            }
            {
                // j = 2
                dp[i][2] = max(dp[i][2], dp[i - 1][2]);
            }
        }
        else
        {
            {
                // j = 0
                dp[i][0] = max(dp[i][0], dp[i - 1][0] + A[i]);
                dp[i][1] = max(dp[i][1], dp[i - 1][0]);
            }
            {
                // j = 1
                dp[i][1] = max(dp[i][1], dp[i - 1][1]);
            }
            {
                // j = 2
                dp[i][2] = max(dp[i][2], dp[i - 1][2] + A[i]);
            }
        }
    }
    if (n % 2 == 0)
    {
        return max(dp[n][0], dp[n][1]);
    }
    else
    {
        return max(dp[n][1], dp[n][2]);
    }
}

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

    vector<long long> A(N + 1, 0);
    for (size_t i = 1; i <= N; i++)
    {
        cin >> A[i];
    }

    vector<vector<long long>> dp(N + 1, vector<long long>(3, -1e15));
    dp[0][0] = 0;
    for (size_t i = 1; i <= N; i++)
    {
        if (i % 2 == 0)
        {
            {
                // j = 0
                dp[i][0] = max(dp[i][0], dp[i - 1][0]);
            }
            {
                // j = 1
                dp[i][1] = max(dp[i][1], dp[i - 1][1] + A[i]);
                dp[i][2] = max(dp[i][2], dp[i - 1][1]);
            }
            {
                // j = 2
                dp[i][2] = max(dp[i][2], dp[i - 1][2]);
            }
        }
        else
        {
            {
                // j = 0
                dp[i][0] = max(dp[i][0], dp[i - 1][0] + A[i]);
                dp[i][1] = max(dp[i][1], dp[i - 1][0]);
            }
            {
                // j = 1
                dp[i][1] = max(dp[i][1], dp[i - 1][1]);
            }
            {
                // j = 2
                dp[i][2] = max(dp[i][2], dp[i - 1][2] + A[i]);
            }
        }
    }

    if (N % 2 == 0)
    {
        cout << max(dp.back()[0], dp.back()[1]) << endl;
    }
    else
    {
        cout << max(dp.back()[1], dp.back()[2]) << endl;
    }
}


Measured memory_bytes: 15648
while True:
    n=int(input())
    if n==0:
        break
    else:
        score=[0]*n
    for i in range(n):
        score[i]=int(input())
    max=score[0]
    min=score[0]
    for i in range(1,n):
        if max<score[i]:
            max=score[i]
        if min>score[i]:
            min=score[i]
    print(int((sum(score)-max-min)/(n-2)))


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

int main() {
    int N, T; cin >> N >> T;
    int ans = 1e9;
    for (int i = 0; i < N; i++) {
        int c, t; cin >> c >> t;
        if (t <= T) {
            ans = min(ans, c);
        }
    }
    if (ans == 1e9) {
        cout << "TLE" << endl;
    } else {
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
x, n = map(int, input().split())

if n == 0:
    print(x)
    exit(0)

p = list(map(int, input().split()))

n_p = []

for i in range(-1, 102):
    if i in p:
        continue
    else:
        n_p.append(i)


dif = float("inf")
for i in range(len(n_p)):
    if dif > abs(x - n_p[i]):
        dif = abs(x - n_p[i])
        ans = n_p[i]

print(ans)


Measured memory_bytes: 9192
import sys
input = sys.stdin.readline

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

dist = []
A = [0] + A + [K+A[0]]

max_d = 0
for i in range(1, N+2):
    d = A[i]-A[i-1]
    dist.append(d)

    if d > max_d:
        max_d = d

print(K-max_d)


Measured memory_bytes: 25816
#include<stdio.h>
int main() {
	int N;
	int cnt = 0;
	scanf("%d", &N);
	int *A = (int *)malloc(sizeof(int)*N);
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &A[i]);
		if (A[i] % 2 == 1)
		{
			cnt++;
		}
	}
	if (cnt % 2 ==1)
	{
		puts("NO");
		return 0;
	}
	else
	{
		puts("YES");
		return 0;
	}
}

Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
	int H,W;
	int i,j;

	while(1){
	cin >> H >> W;
	if (H==0&&W==0) break;

	
	for (i=0;i<H;i++){
		for (j=0;j<W;j++){
			cout << "#";
		}
		cout << endl;
	}
	cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)

int main() {
    int d, c;
    cin >> d >> c;
    cout << d * c << endl;
}

Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<int,P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int main(){
    int n;
    cin>>n;
    int l=0,r=n-1;
    vs mem(n,"null");
    cout<<0<<endl;
    cin>>mem[0];
    if(mem[0]=="Vacant")return 0;
    cout<<n-1<<endl;
    cin>>mem[n-1];
    if(mem[n-1]=="Vacant")return 0;
    while(r-l>1){
        int mid=(l+r)/2;
        cout<<mid<<endl;
        cin>>mem[mid];
        if(mem[mid]=="Vacant")return 0;
        bool mf=mem[mid]=="Male";
        bool lf=mem[l]=="Male";
        bool rf=mem[r]=="Male";
        if(((mid-l+1)%2&&mf!=lf)||(mid-l+1)%2==0&&mf==lf){
            r=mid;
        }else{
            l=mid;
        }
    }
    return 0;
}

Measured memory_bytes: 1620
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cstring>

using namespace std;

long long int l[500000];
long long int ma[500000];
int n, k;

int main() {
	
	cin >>n >>k;
	
	cin >>l[0];
	if (l[0] < 0) {
		ma[0] = 0;
	}
	else {
		ma[0] = l[0];
	}
	for (int i=1; i<n; i++) {
		int a;
		cin >>a;
		l[i] = l[i-1]+a;
		ma[i] = max(ma[i-1]+a, ma[i-1]);
	}
	
	int p = -1;
	long long int maxi = 0;
	for (int i=k-1; i<n; i++) {
		long long int val = l[i];
		if (p >= 0) {
			val-=l[p];
			val+=ma[p];
		}
		val += ma[n-1]-ma[i];
		if (val > maxi) {
			maxi = val;
		}
		p++;
	}
	p = -1;
	for (int i=k-1; i<n; i++) {
		long long int val = 0;
		if (p >= 0) {
			val+=ma[p];
		}
		val += ma[n-1]-ma[i];
		if (val > maxi) {
			maxi = val;
		}
		p++;
	}
	
	cout <<maxi;
	
	return 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int  main(){
    ll n,d,a,b,dem=0;
    cin>>n>>d;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        if(sqrt(a*a+b*b)<=d) dem++;
    }
    cout<<dem;
    return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, j, n) for (int i = j; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main()
{
    int n, m;
    cin >> n >> m;
    vi tree[n];
    vector<double> e(n, 0);

    rep(i, m)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        tree[a].push_back(b);
    }

    for (int i = n - 2; i >= 0; --i)
    {
        double E = 0;
        for (int u : tree[i])
        {
            E += (e[u]);
        }
        E /= (int)tree[i].size();
        E += 1;
        e[i] = E;
    }
    double ans = e[0];
    for (int nv = 0; nv < n - 1; nv++)
    {
        if (tree[nv].size() == 1)
            continue;
        int nu = tree[nv][0];
        for (int u : tree[nv])
        {
            if (e[u] > e[nu])
                nu = u;
        }
    
    double now = [&] {
        vector<double> e(n);
        for (int i = n - 2; i >= 0; --i)
        {
            double E = 0;
            for (int u : tree[i])
            {
                if(u ==nu && i == nv) continue;
                E += (e[u]);
            }
            int size = (int)tree[i].size();
            if(i == nv) size--;
            E /= size;
            E += 1;
            e[i] = E;
        }
        return e[0];
    }();
    ans = min(ans,now);
    }
    printf("%.10f",ans);
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
}
 int arr[100005];
  int n,k;
  int dp[100005];
  int memo(int i)
  { 
      if(i==0)
      return dp[i]=0;
      if(dp[i]!=-1)
      return dp[i];
      int ca=999999999;
      
      for(int j=i-1;j>=0 and i-j<=k;j--)
      {
          ca=min(ca,memo(j)+abs(arr[i]-arr[j]));
      }
      return dp[i]=ca;
  }
int32_t main()
{
    c_p_c();
    
     memset(dp,-1,sizeof(dp));
    cin>>n>>k;
    
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    memo(n-1);
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 9872
#include <bits/stdc++.h>  // This will work only for g++ compiler. 
using namespace std;
#define fo(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define fon(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
//short hand for usual tokens
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
#define INF (int)1e9
// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal
// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())
//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())
// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) int((a).size())
// Shorthand for commonly used types
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    char ch;
    cin>>ch;
    if(ch >=65 && ch <=90){
        cout<<"A"<<endl;
    }else{
        cout<<"a"<<endl;
    }
    return 0;
}

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

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b)a=b;};
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b)a=b;};


signed main(){
  Int n;
  cin>>n;
  vector<string> va(n);
  vector<Int> vx(n);
  for(Int i=0;i<n;i++) cin>>va[i]>>vx[i];

  map<string, Int> idx;
  for(Int i=0;i<n;i++) idx[va[i]]=i;

  Int m;
  cin>>m;
  vector<vector<Int> > G(n);
  for(Int i=0;i<m;i++){
    string s,t;
    cin>>s>>t;
    G[idx[s]].emplace_back(idx[t]);
    G[idx[t]].emplace_back(idx[s]);
  }

  using P = pair<Int, Int>;
  vector<P> vp;
  for(Int i=0;i<n;i++) vp.emplace_back(vx[i],i);
  sort(vp.begin(),vp.end());

  vector<Int> used(n,-1);
  for(auto p:vp){
    if(~used[p.second]) continue;
    queue<Int> que;
    used[p.second]=p.second;
    que.emplace(p.second);

    while(!que.empty()){
      Int v=que.front();que.pop();
      for(Int u:G[v]){
        if(~used[u]) continue;
        used[u]=used[v];
        que.emplace(u);
      }
    }
  }

  Int ans=0;
  for(Int i=0;i<n;i++) ans+=vx[used[i]];
  cout<<ans<<endl;

  return 0;
}



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

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<ll> vll;
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;
typedef unsigned long long ull;

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

int n, k;
ll ans;

int const MAX = 2e5 + 41;

int cnt[MAX];

void calc0() {
	ans += (ll) cnt[0] * (ll) cnt[0] * (ll) cnt[0];
}

void calc1() {	
	fi(1, k - 1) {
		int rem = (k - i);
		if (rem + rem != k) continue;
		ll v1 = cnt[i];
		ll v2 = cnt[rem];
		ll v3 = cnt[rem];
		ans += v1 * v2 * v3;
	}
}

void solve() {
	fi(1, n) {
		cnt[(i % k)]++;
	}
	calc0();
	err("after calc0 %lld\n", ans);
	calc1();
	printf("%lld\n", ans);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

  scanf("%d %d", &n, &k);
	solve();		

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 640
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] t = new int[3];
        t[0] = sc.nextInt();
        t[1] = sc.nextInt();
        t[2] = sc.nextInt();
        Arrays.sort(t);
        System.out.println(t[0]+t[1]);
    }
}

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

int main(){
    string s;
    int K;
    cin >> s >> K;
    vector<string> v;
    int l = min((int)s.size(), K);
    for(int i=1; i<=l; i++){
        for(int j=0; j<=s.size()-i; j++){
            if(find(v.begin(), v.end(), s.substr(j, i)) == v.end()){
                v.push_back(s.substr(j, i));
            }
        }
    }
    sort(v.begin(), v.end());
    cout << v[K-1];
    return EXIT_SUCCESS;
}


Measured memory_bytes: 1024
import math

n = int(raw_input())
num = list()
count = 0
max = 0

for i in range(n):
    num.append(int(raw_input()))

for i in range(n):
    root_num = math.sqrt(num[i])
    for j in range(2, int(root_num) + 1):
        if num[i] % j == 0:
            count = count + 1
            break

print n - count

Measured memory_bytes: 7376
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+6;
int f[maxn],ans;
int find(int x)
{
	if(f[x] == x)
	return x;
	else return f[x] = find(f[x]);
}
int main()
{
	int a,b;
	cin>>a>>b;
	for(int i = 0 ; i < a ; i++){
		f[i] = i;
	}
	for(int i = 0 ; i < b ; i++){
		int u,v;
		cin>>u>>v;
		if(find(u)==find(v)) ans++;
		else{
			f[find(f[u])] = find(v);
		}
	}
	cout<<a-1-b+ans;
	return 0;
}

Measured memory_bytes: 3944
N, K, C = map(int, input().split())
S = input()

L, R = [], []

i, yasumi = 0, 0
while len(L) < K:
    if S[i] == 'o' and yasumi <= 0:
        L.append(i)
        yasumi = C + 1
    i += 1
    yasumi -= 1

i, yasumi = -1, 0
while len(R) < K:
    if S[i] == 'o' and yasumi <= 0:
        R.append(N+i)
        yasumi = C + 1
    i -= 1
    yasumi -= 1

R = R[::-1]
for i in range(K):
    if L[i] == R[i]:
        print(L[i] + 1)

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


int main(){
    ll H,cnt=0,ans=0;cin>>H;
    while(H>0){
        H/=2;
        ans+=pow(2,cnt);
        cnt++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n,a,b=parseMap(split(readline()))
    println(div(n,(a+b))*a+min(n%(a+b),a))
end
main()

Measured memory_bytes: 111372
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define vec vector<int>
#define pb push_back
#define lis list<int> lst(1000)


int main(){
	int a,b,c,d,e,f,g;
	char o,p,q,r,s,t,u;
	int ans;

	scanf("%d%d",&a,&b);

	ans = a*b;
	if (ans%2==0){
		cout << "Even" << endl;
	}else{
		cout << "Odd" << endl;
	}

	return 0;
}

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

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

  double v = (double)E / (100 + E);
  double maxd = 0;
  int swater = 0, sugar = 0;
  for (int i = 0; 100*A*i <= F; i ++) {
    for (int j = 0; 100*A*i + 100*B*j <= F; j ++) {
      for (int k = 0; 100*A*i + 100*B*j + C*k <= F; k ++) {
        for (int l = 0; 100*A*i + 100*B*j + C*k + D*l <= F; l ++) {
          double dense = (double)(C*k + D*l) / (100*A*i + 100*B*j + C*k + D*l);
          if (v < dense) continue;

          if (maxd <= dense) {
            maxd = dense;
            swater = 100*A*i + 100*B*j + C*k + D*l;
            sugar = C*k + D*l;
          }
        }
      }
    }
  }

  cout << swater << " " << sugar << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;

    vl p(n);
    rep(i, n) {
        cin >> p[i];
        p[i]--;
    }  

    ll ans = 0;
    rep(i, n-1) {
        if(p[i] == i) {
            swap(p[i], p[i+1]);
            ans++;
        }
    }

    if(p[n-1] == n-1) {
        ans++;
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 1024
n=int(input())
a=[0]+list(map(int,input().split()))+[0]

al=0
#print(a)

for i in range(n+1):
    al+=abs(a[i]-a[i+1])

for j in range(n):
    t=(abs(a[j]-a[j+1])+abs(a[j+1]-a[j+2]))-(abs(a[j]-a[j+2]))
    print(al-t)

Measured memory_bytes: 14048
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	
	void doIt() {
		sC();
	}
	
	void sC() {
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X[] = new int[M];
		int d[] = new int[M - 1];
		for(int i = 0; i < M; i++) {
			X[i] = sc.nextInt();
		}
		Arrays.sort(X);
		for(int i = 0; i < M - 1; i++) {
			d[i] = X[i + 1] - X[i];
		}
		Arrays.sort(d);
		int cnt = 0;
		for(int i = 0; i < M - N; i++) {
			cnt += d[i];
		}
		//System.out.println(Arrays.toString(X));
		//System.out.println(Arrays.toString(d));		
		System.out.println(cnt);
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
}


Measured memory_bytes: 60468
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000007
using namespace std;
ll sum[2000009];
ll pow1(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y%2)
            res=res*x%inf;
        x=x*x%inf;
        y/=2;
    }
    return res;
}
ll inv(ll x)
{
    return pow1(x,inf-2);
}
int main()
{
    int a,b,c,d;
    ll tmp,tmp1;
    sum[0]=1;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    for(int i=1;i<=2000008;i++)
        sum[i]=sum[i-1]*(ll)(i)%inf;
    tmp=(sum[c+d+2]*inv(sum[d+1])%inf*inv(sum[c+1])%inf+sum[a+b]*inv(sum[a])%inf*inv(sum[b])%inf)%inf;
    tmp1=(sum[a+d+1]*inv(sum[d+1])%inf*inv(sum[a])%inf+sum[c+b+1]*inv(sum[b])%inf*inv(sum[c+1])%inf)%inf;
    printf("%lld",(tmp-tmp1+inf)%inf);
    return 0;
}


Measured memory_bytes: 15872
C = input()

ans = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
ans2 = int(ans.index(C)) + 1
print(ans[ans2])

Measured memory_bytes: 3060
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while (1) {
		int n, m;
		cin >> n >> m;
		if (!n)break;
		vi h(n), w(m);
		REP(i, n)cin >> h[i];
		REP(i, m)cin >> w[i];
		vi acum(n + 1);
		acum[0] = 0;
		REP(i, n)acum[i + 1] = acum[i] + h[i];
		vi v;
		REP(i, n) {
			FOR(j, i, n) {
				v.push_back(acum[j + 1] - acum[i]);
			}
		}
		vi acum2(m + 1);
		acum2[0] = 0;
		REP(i, m)acum2[i + 1] = acum2[i] + w[i];
		vi u;
		REP(i, m) {
			FOR(j, i, m) {
				u.push_back(acum2[j + 1] - acum2[i]);
			}
		}
		sort(ALL(v)); sort(ALL(u));
		int ans = 0;
		REP(i, v.size()) {
			ans += upper_bound(ALL(u), v[i]) - lower_bound(ALL(u), v[i]);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 23876
#include <iostream>
#include <iomanip>


using namespace std;

const int  MAXN = 150;
const int IFNTY = 1 << 20;
const int NIL = -1;


void dijkstra(int adj_matrix[][MAXN], int n, int u, int dis[]);


int main()
{
	int adj_matrix[MAXN][MAXN];
	
	
	
	for (int i = 0; i < MAXN; i++)
	{
		for (int j = 0; j < MAXN; j++)
		{
			adj_matrix[i][j] = IFNTY;			
		}
	}

	int n;
	cin >> n;
	
	for (int i = 1; i <= n; i++)
	{
		int ID1, degree;
		cin >> ID1 >> degree;
		for (int j = 1; j <= degree; j++)
		{
			int ID2, weight;	
			cin >> ID2 >> weight;
			adj_matrix[ID1][ID2] = weight;		
		}
	}	
	
//	for (int i = 0; i < n; i++)
//	{
//		for (int j = 0; j < n; j++)
//		{
//			if (adj_matrix[i][j] == IFNTY)
//				cout << setw(3) << "-" << " ";
//			else
//				cout << setw(3) << adj_matrix[i][j] << " ";			
//		}
//		cout << endl;
//	}

	int dis[MAXN];	
	
	dijkstra(adj_matrix, n, 0, dis);
	
	for (int i = 0; i < n; i++)
	{
		cout << i << ' ' << dis[i] << endl;
	}
}



void dijkstra(int adj_matrix[][MAXN], int n, int u, int dis[])
{
	bool visited[MAXN] = {0};
	
	for (int v = 0; v < n; v++)
	{
		dis[v] = adj_matrix[u][v];
	}
	
	dis[u] = 0;
	visited[u] = true;
	
	while (true)
	{
		int w = NIL;
		int min = IFNTY;
		for (int v = 0; v < n; v++)
		{
			if (min > dis[v] && !visited[v])
			{
				w = v;
				min = dis[v];
			}
		}
		
		
		if (w == NIL) break;
		
		visited[w] = true;
		for (int v = 0; v < n; v++)
		{
			if (dis[v] > dis[w] + adj_matrix[w][v])
			{
				dis[v] = dis[w] + adj_matrix[w][v];
			}
		}
	}
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cii(n);
    int ans = n * n * n;
    co(ans);
    return 0;
}

Measured memory_bytes: 256