akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
long long dp[101][100005];
#define maxo 1e18

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long n;long W;cin>>n>>W;
    long v[n+1]={0};
    long w[n+1]={0};
    long V=0;
    for(int i=1;i<=n;i++){
        cin>>w[i]>>v[i];
        V+=v[i];
    }
    for(int i=1;i<=V;i++){
        dp[0][i]=1e18;
    }
    //cout<<V<<'\n';
    for(int i=1;i<=n;i++){
        for(int j=1;j<=V;j++){
            dp[i][j]=1e18;
            if(v[i]>j){
                dp[i][j]=dp[i-1][j];
            }
            else{
                dp[i][j]=min(w[i]+dp[i-1][j-v[i]],dp[i-1][j]);
            }
        }
    }
    /*for(int i=1;i<=n;i++){
        for(int j=1;j<=V;j++){
            cout<<dp[i][j]<<" ";
        }
        cout<<'\n';
    }*/
    for(int i=V;i>=0;i--){
        if(dp[n][i]<=W){
            cout<<i;
            break;
        }
    }

}


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

int a[12][12],p[12];
int main()
{
    int n,m; cin>>n>>m;
    for (int i=1; i<=m; i++)
    {
    	int s; cin>>s;
    	for (int j=1; j<=s; j++)
    	{
    		int t; cin>>t;
    		a[i][t]=1;
		}
	}
	for (int i=1; i<=m; i++) cin>>p[i];
	
	int ans=0;
	for (int i=0; i< 1<<n; i++)
	{
		int che=1;
		for (int j=1; j<=m; j++)
		{
			int sum=0;
			for (int u=1; u<=n; u++)
			    if (i & 1<<(u-1) && a[j][u]) sum++;
			if((sum-p[j])%2) che=0;
		}
		if (che) ans++;
	}
	
	cout << ans;
 } 

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <fstream>
#include <bitset>
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; }

const long long INF = 1LL << 60;
const long long MOD = 1000000007LL;
const long long MAX = 500000LL;
using namespace std;
typedef unsigned long long ull;
typedef  long long ll;


int main()
{
	ll N, M;
	cin >> N >> M;
	vector<vector<ll>> g(N);
	vector<ll> idg(N, 0);
	vector<ll> dp(N, -1);
	vector<ll> to;
	for (ll i = 0; i < M; i++) {
		ll a, b;
		cin >> a >> b;

		g[a].push_back(b);
		idg[b]++;
	}
	queue<ll> q;
	for (ll i = 0; i < N; i++) {
		if (idg[i] == 0) {
			dp[i] = 0;
			q.push(i);
			to.push_back(i);
		}
	}
	while (!q.empty()) {
		ll x = q.front();
		q.pop();
		for (ll xx : g[x]) {
			idg[xx]--;
			if (idg[xx] == 0) {
				q.push(xx);
				to.push_back(xx);
			}
		}
	}
	for (ll i = 0; i < to.size(); i++) {
		cout << to[i] << endl;
	}
	return 0;
}



Measured memory_bytes: 4192
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  string s;
  cin >> s;
  bool res = false;
  if(s[0] == s[1] && s[1] == s[2])res = true;
  if(s[1] == s[2] && s[2] == s[3])res = true;
  if(res)cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3552
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    dead_code
)]
//use permutohedron::LexicalPermutation as _;
use proconio::input;
//use proconio::marker::Chars;
//use proconio::marker::Usize1;
//use std::collections::HashSet;
//use std::collections::HashMap;
//use std::collections::BTreeMap;
//use std::cmp::*;
//use std::num;

fn main() {
    input! {
        x:usize,y:usize,z:usize

    }
    println!("{} {} {}", z, x, y);
}


Measured memory_bytes: 2176
A, B, C, X, Y = map(int, input().split())

ans = []

ans.append(A*X + B*Y)  # Aピザ、Bピザだけを使って買う

ans.append(2 * C*max(X, Y))  # ABピザだけを使って買う

if X > Y:
    ans.append(C*2*Y + A*(X-Y))

else:
    ans.append(C*2*X + B*(Y-X))

print(min(ans))


Measured memory_bytes: 3060
N, x = map(int, input().split())
As = list(map(int, input().split()))

ans = 0
for i in range(N - 1):
    num = As[i] + As[i + 1]
    if num <= x: continue
    # (num - x)個減らす必要あり
    ans += num - x
    if As[i + 1] >= num - x:
        As[i + 1] -= num - x
    else:
        As[i + 1] = 0
        As[i] = x

print(ans)


Measured memory_bytes: 14540
#include <stdio.h>
int main(void)
{
	int a, b, c, d, e;
	scanf("%d %d", &a, &b);
	if (a>-1*b)
	{
		printf("1\n");
	}
	else if (a<-1*b)
	{
		printf("-1\n");

	}
	else
	{
		printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define mod 998244353
const int N=200005;

vector <int> adj[N];
int val[N],ans[N];

void dfs(int u,int par,int sm) {
	ans[u]=sm;
	for(auto v:adj[u]) {
		if(v==par) continue;
		dfs(v,u,val[v]+sm);
	}
}

int main() {
	/*#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
	#endif*/
	
    cout<<fixed<<setprecision(15);


    int n,q;
    cin>>n>>q;
    for(int i=0;i<n-1;i++) {
    	int x,y;
    	cin>>x>>y;
    	adj[x].push_back(y);
    	adj[y].push_back(x);
    }
    for(int i=0;i<q;i++) {
    	int p,x;
    	cin>>p>>x;
    	val[p]+=x;
    }

    dfs(1,-1,val[1]);

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

Measured memory_bytes: 24064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
const int N=200050;
struct DSU
{
	int p[N];
	bool ban[N];
	void init(){ for(int i=0;i<N;i++) p[i]=i,ban[i]=0;}
	DSU(){ init();}
	int Find(int x){ return p[x]==x?x:p[x]=Find(p[x]);}
	void Union(int x, int y)
	{
		x=Find(x);y=Find(y);
		if(x==y) ban[x]=1;
		else p[x]=y;
	}
} DS;
int state[N],go[N],a[N],l[N],r[N],id[N];
int main()
{
	int n,h,w;
	scanf("%i %i %i",&n,&h,&w);
	for(int i=1;i<=n;i++)
	{
		scanf("%i %i %i",&l[i],&r[i],&a[i]);
		id[i]=i;
		r[i]+=h;
	}
	sort(id+1,id+1+n,[&](int i, int j){ return a[i]>a[j];});
	ll ans=0;
	for(int j=1;j<=n;j++)
	{
		int i=id[j];
		int x=l[i],y=r[i];
		x=DS.Find(x);
		y=DS.Find(y);
		if(DS.ban[x] && DS.ban[y]) continue;
		if(DS.ban[x]) x=y;
		else if(DS.ban[y]) y=x;
		ans+=a[i];
		DS.Union(x,y);
	}
	printf("%lld\n",ans);
	return 0;
}

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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){
    
    int n;
    ll k;
    cin >> n >> k;

    vector<vector<int>> tele(68, vector<int>(n + 1));

    rep(i, n){
        cin >> tele[1][i + 1];
    }

    for(int i = 2; i <= 67; i++){
        for(int j = 1; j <= n; j++){
            tele[i][j] = tele[i - 1][tele[i - 1][j]];
        }
    }

    function<int(int, ll)> f = [&](int node, ll k) -> int{
        if(k == 0) return node;

        ll tmp = 1;
        int index = 1;

        while(tmp <= k){
            tmp = tmp + tmp;
            index++;
        }
        tmp = tmp / 2;
        index--;

        return f(tele[index][node], k - tmp);
    };

    cout << f(1, k) << endl;

    return 0;
}


Measured memory_bytes: 57384
a,b,k = map(int,input().split())

w = []
for i in range(a, min(a+k, b+1)):
    w.append(i)
for i in range(max(b-k+1, a), b+1):
    w.append(i)

w = sorted(list(set(w)))
for ww in w:
    print(ww)
    

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream& operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream& operator<<(ostream &os, vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream& operator<<(ostream &os, set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream& operator<<(ostream &os, pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream& operator<<(ostream &os, map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

int N, M, Q;
constexpr int Nmax = 2000;
int S[Nmax + 1][Nmax + 1];
int dp[Nmax + 1][Nmax + 1];
int dp2[Nmax + 1][Nmax + 1];
int dp3[Nmax + 1][Nmax + 1];

void build()
{
    FOR(i, 1, N + 1) FOR(j, 1, M + 1) dp[i][j] += dp[i][j - 1] + S[i][j];
    FOR(i, 1, N + 1) FOR(j, 1, M + 1) dp[i][j] += dp[i - 1][j];
    FOR(i, 1, N + 1) FOR(j, 1, M + 1) if (S[i][j]) dp2[i][j] -= S[i][j - 1];
    FOR(i, 1, N + 1) FOR(j, 1, M + 1) dp2[i][j] += dp2[i][j - 1];
    FOR(i, 1, N + 1) FOR(j, 1, M + 1) dp2[i][j] += dp2[i - 1][j];
    FOR(i, 1, N + 1) FOR(j, 1, M + 1) if (S[i][j]) dp3[i][j] -= S[i - 1][j];
    FOR(i, 1, N + 1) FOR(j, 1, M + 1) dp3[i][j] += dp3[i][j - 1];
    FOR(i, 1, N + 1) FOR(j, 1, M + 1) dp3[i][j] += dp3[i - 1][j];
}

int main()
{
    memset(S, 0, sizeof(S));
    memset(dp, 0, sizeof(dp));
    memset(dp2, 0, sizeof(dp2));
    memset(dp3, 0, sizeof(dp3));

    cin >> N >> M >> Q;
    REP(i, N)
    {
        string str;
        cin >> str;
        REP(j, M) S[i + 1][j + 1] = str[j] - '0';
    }

    build();

    REP(_, Q)
    {
        int X1, Y1, X2, Y2;
        cin >> X1 >> Y1 >> X2 >> Y2;
        cout << dp[X2][Y2] - dp[X1 - 1][Y2] - dp[X2][Y1 - 1] + dp[X1 - 1][Y1 - 1]
                + dp2[X2][Y2] - dp2[X1 - 1][Y2] - dp2[X2][Y1] + dp2[X1 - 1][Y1]
                + dp3[X2][Y2] - dp3[X1][Y2] - dp3[X2][Y1 - 1] + dp3[X1][Y1 - 1]
                << endl;
    }
}


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

#define _GLIBCXX_DEBUG
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define NP next_permutation;
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define puf push_front
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;

const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;

template<class T> bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T> void decimal(T a){cout<<fixed<<setprecision(a);}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}

void YesNo(bool a){if(a) out("Yes"); else out("No");}
void yesno(bool a){if(a) out("yes"); else out("no");}
void YESNO(bool a){if(a) out("YES"); else out("NO");}
ll GCD(ll a,ll b){ll c; while(b!=0){c=a%b; a=b; b=c;} return a;}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){ll c=1; while(b>0){if(b&1){c=a * c%mod;} a=a * a%mod; b>>=1;} return c;}
vi calc(ll x){vi res; while(x>0){res.pb(x%10); x/=10;} reverse(all(res)); return res;}

void solve() {
  ll N,Y,y; cin>>N>>Y; y=Y/1000;
  rep(i,N+1){
    rep(j,N-i+1){
      if(10*i+5*j+N-i-j==y){
        cout<<i<<' '<<j<<' '<<N-i-j<<endl;
        return;
      }
    }
  }
  cout<<-1<<' '<<-1<<' '<<-1<<endl;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 256
//⣿⣿⣿⣿⣿⣿⠟⠋⠁⣀⣤⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⣿
//⣿⣿⣿⣿⠋⠁⠀⠀⠺⠿⢿⣿⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠻⣿
//⣿⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣤⣤⣤⠀⠀⠀⠀⠀⣤⣦⣄⠀⠀
//⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⠏⣿⣿⣿⣿⣿⣁⠀⠀⠀⠛⠙⠛⠋⠀⠀
//⡿⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⣰⣿⣿⣿⣿⡄⠘⣿⣿⣿⣿⣷⠄⠀⠀⠀⠀⠀⠀⠀⠀
//⡇⠀⠀⠀⠀⠀⠀⠀⠸⠇⣼⣿⣿⣿⣿⣿⣷⣄⠘⢿⣿⣿⣿⣅⠀⠀⠀⠀⠀⠀⠀⠀
//⠁⠀⠀⠀⣴⣿⠀⣐⣣⣸⣿⣿⣿⣿⣿⠟⠛⠛⠀⠌⠻⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⣶⣮⣽⣰⣿⡿⢿⣿⣿⣿⣿⣿⡀⢿⣤⠄⢠⣄⢹⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⣿⣿⣿⣿⣿⡘⣿⣿⣿⣿⣿⣿⠿⣶⣶⣾⣿⣿⡆⢻⣿⣿⠃⢠⠖⠛⣛⣷⠀
//⠀⠀⢸⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣮⣝⡻⠿⠿⢃⣄⣭⡟⢀⡎⣰⡶⣪⣿⠀
//⠀⠀⠘⣿⣿⣿⠟⣛⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⡿⢁⣾⣿⢿⣿⣿⠏⠀
//⠀⠀⠀⣻⣿⡟⠘⠿⠿⠎⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣵⣿⣿⠧⣷⠟⠁⠀⠀
//⡇⠀⠀⢹⣿⡧⠀⡀⠀⣀⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⢰⣿⠀⠀⠀⠀
//⡇⠀⠀⠀⢻⢰⣿⣶⣿⡿⠿⢂⣿⣿⣿⣿⣿⣿⣿⢿⣻⣿⣿⣿⡏⠀⠀⠁⠀⠀⠀⠀
//⣷⠀⠀⠀⠀⠈⠿⠟⣁⣴⣾⣿⣿⠿⠿⣛⣋⣥⣶⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⣿⡀ 
//
//⣿⠛⣷⠀⠀⢸⣟⡛⠀⠀⣿⠛⣷⠀⠀⢸⣟⡛⠀⠀⣴⢟⣛⡀⠀⠀⣸⢿⣇⠀ 
//⣿⠉⠉⠀⠀⢸⣯⣥⠀⠀⣿⠉⠉⠀⠀⢸⣯⣥⠀⠀⢿⣮⣽⡇⠀⢠⡿⠶⣿⡄ 
#include <bits/stdc++.h>
#define DEBUG false
#define debugf if (DEBUG) printf
#define MAXN 150001
#define MAXM 900009
#define MAXLOGN 20
#define ALFA 256
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
#define EPS 1e-9
#define PI 3.141592653589793238462643383279502884
#define FOR(x,n) for(int x=0; (x)<int(n); (x)++)
#define FOR1(x,n) for(int x=1; (x)<=int(n); (x)++)
#define REP(x,n) for(int x=int(n)-1; (x)>=0; (x)--)
#define REP1(x,n) for(int x=(n); (x)>0; (x)--)
#define pb push_back
#define pf push_front
#define pr printf
#define sc(x) scanf("%d", &x)
#define sc2(x, y) sc(x);sc(y)
#define sc3(x, y, z) sc2(x, y);sc(z)
#define scll(x) scanf("%lld", &x)
#define sc2ll(x, y) scll(x);scll(y)
#define sc3ll(x, y, z) sc2ll(x, y);scll(z)
#define ff first
#define ss second
#define mp make_pair
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define mset(x,y) memset(&x, (y), sizeof(x))
#define LOWBIT(A) (A & -A)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned int uint;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair <ll, ll> pll;
typedef pair < pll, ll > plll;

ll fatorial[(int)1e6 + 2];
ll inv_fatorial[(int)1e6 + 2];

ll fast_expo(ll b, ll e){
    if(e == 0)return 1;
    if(e == 1)return b;
    if(e & 1){
        return (b * fast_expo(b, e - 1))%MOD;
    }else{
        ll aux = fast_expo(b , e / 2 );
        return (aux * aux)%MOD;
    }
}

int main(){
    ll x, y;
    sc2ll(x, y);
    inv_fatorial[0] = 1;
    fatorial[0] = 1;
    FOR1(i, 1e6)fatorial[i] = (fatorial[i - 1] * i)%MOD;
    FOR1(i, 1e6)inv_fatorial[i] = fast_expo(fatorial[i], MOD - 2);
    ll resp = 0;
    FOR(i, x + 1){
        if((x - i)&1)continue;
        int qtdDobY = i * 2;
        int qtdDobX = (x - i) / 2;
        int qtdY = qtdDobX;
        if(qtdDobY + qtdY == y){
            resp = (resp + (((fatorial[qtdDobX + i] * inv_fatorial[i])%MOD) * inv_fatorial[qtdDobX]))%MOD;
        }
    }
    printf("%lld\n", resp);
	return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
#include <numeric>
#include <iomanip>
#define ll long long
#define intm INT_MAX
#define llm LLONG_MAX

using namespace std;
typedef pair<int,int> P;
const int MOD = 998244353;
const ll mod = 1e9 + 7;
const int mxN = 2e5 + 9;

int dp[mxN][35];
int sm[35];

void calc(int a, int i){
    int j = 0;
    while( a > 0 ){
        dp[i][j] = a%2;
        a = a/2;
        ++j;
    }
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n,a;
	cin >> n;
    for(int i=1; i <= n; i++){
        cin >> a;
        calc( a, i );
    }
    for(int i=1; i <= n; i++){
        for(int j=0; j < 35; j++){
            sm[j] += dp[i][j];
        }
    }
    //
    //for(int i=0; i < 6; i++) cout << sm[i] << " ";
    //cout << endl;
    //

    for(int i=1; i <= n; i++){
        string s = "";
        ll ans = 0;
        for(int j=0; j <= 32; j++){
            int x = sm[j] - dp[i][j];
            if( x%2 != 0 ) s += '1';
            else{ s += '0'; }
        }
        //cout << "s = " << s << endl;
        for(int k=0; k < s.length(); k++){
            if( s[k] == '0' ) continue;
            else{ ans += ((ll)pow(2,k)); }
        }
        cout << ans << " ";

    }




}


Measured memory_bytes: 31212
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

typedef pair<int, int> P;

int main(){
  int N;
  while(cin >> N, N){
    int north, west, south, east;
    map<int, P> field;
    field[0] = P(0, 0);
    int n, d;
    for(int i = 1 ; i < N ; i++){
      cin >> n >> d;
      if(d == 0){
	field[i] = P(field[n].first-1, field[n].second);
      }
      else if(d == 1){
	field[i] = P(field[n].first, field[n].second-1);
      }
      else if(d == 2){
	field[i] = P(field[n].first+1, field[n].second);
      }
      else if(d == 3){
	field[i] = P(field[n].first, field[n].second+1);
      }
    }
    
    north = west = south = east = 0;
    
    for(int i = 1 ; i < N ; i++){
      north = max(north, field[i].second);
      south = min(south, field[i].second);
      east = max(east, field[i].first);
      west = min(west, field[i].first);
    }
    
    cout << abs(east - west)+1 << ' ' << abs(north - south)+1 << endl;
  }
  return 0;
}
  

Measured memory_bytes: 1208
local n = io.read("*n")
local a = {}
for i = 1, n do
  a[i] = io.read("*n") - i
end
table.sort(a)
local hn = (n + 1) // 2
local pos = a[hn]
local ret = 0
for i = 1, hn do
  ret = ret + pos - a[i]
end
for i = hn + 1, n do
  ret = ret + a[i] - pos
end
print(ret)


Measured memory_bytes: 4472
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = [0]
b = [0]
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])
j = m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

Measured memory_bytes: 47908
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int n;
  cin >> n;
  
  map<int,int> seq;
  
  for(int i=1; i<=n; i++){
    int come;
    cin >> come;
    seq[come] = i;
  }
  
  for(pair<int,int> p: seq){
    int key = p.first;
    int value = p.second;
    cout << seq.at(key) << " ";
  }
  
  return 0;
  
}

Measured memory_bytes: 5504
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

vector<ll> Gauss(vector<ll> A){
    int rank=0;
    for(int i=60;i>=0;i--){
        int pivot=-1;
        for(int j=rank;j<A.size();j++){
            if(A[j]&(1ll<<i)){
                pivot=j;
                break;
            }
        }
        if(pivot==-1) continue;

        swap(A[rank],A[pivot]);
        for(int j=0;j<A.size();j++) if(j!=rank){
            if(A[j]&(1ll<<i)) A[j]^=A[rank];
        }
        rank++;
    }
    vector<ll> res;
    for(int i=0;i<rank;i++) res.push_back(A[i]);
    return res;
}

int main(){
  int N;
  cin>>N;
  vector<ll> A(N);
  rep(i,N) cin>>A[i];

  ll all=0;
  rep(i,N) all^=A[i];
  
  vector<ll> B=A;
  for(int i=0;i<N;i++){
      for(int k=0;k<60;k++){
          if((all&(1ll<<k))&&(B[i]&(1ll<<k))) B[i]^=(1ll<<k);
      }
  }

  vector<ll> basis=Gauss(B);

  ll ans=0;
  for(int i=0;i<basis.size();i++){
      if(ans<(ans^basis[i])) ans^=basis[i];
  }
  cout<<ans*2+all<<"\n";

  return 0;
}


Measured memory_bytes: 2560
// ------------------------------------
// Date:2018/ 3/24
// Problem:Boxes and candies a.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

static const int MOD = 1e9 + 7;
static const int MAX_N = 1;

int main()
{
  CIN(N, x);
  vector< int > a(N);
  REP(i, N) {
    cin >> a[i];
  }

  ll ans = 0ll;
  REP(i, N - 1) {
    if (a[i] > x) {
      ans += a[i] - x;
      ans += a[i + 1];
      a[i + 1] = 0;
    } else if (not(a[i] + a[i + 1] <= x)){
      ans += a[i + 1] - (x - a[i]);
      a[i + 1] = x - a[i];
    }
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 768
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(ll)(n);++i)
#define _repe3(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(ll)(b)-1;i>=(ll)(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define _rrepe2(i,n) for(ll i=(ll)(n);i>=0;i--)
#define _rrepe3(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)
#define rrepe(...) _overload3(__VA_ARGS__,_rrepe3,_rrepe2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

ll N;
vl A;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> N;
    A = vl(N);
    for(int i = 0; i < N; ++i){
        cin >> A[i];
    }
    solve();
}

// 2 <= N <= 10^5
// 0 <= A_i <= 10^{18}
// 入力は全て整数である。

// ll N, vl A
// 値 A_1 × ... × A_N を整数として出力せよ。ただし、この値が 10^{18} を超える場合は、代わりに -1 を出力せよ。
void solve(){
    rep(i,N){
        if(A[i]==0){
            cout<<0<<endl;
            return;
        }
    }
    ll mx=1e18;
    ll ans=1;
    rep(i,N){
        if(A[i]>LINF/ans){
            cout<<-1<<endl;
            return;
        }
        ans*=A[i];
        if(ans>mx){
            cout<<-1<<endl;
            return;
        }
    }
    cout<<ans<<endl;
}


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

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//ori
#define MOD 1000000007
 
int main() {
  LL S;
  cin >> S;
  
  if(S == 1000000000000000000) {
    cout << "0 0 1000000000 0 0 1000000000" << endl;
    return 0;
  }
  LL x, y;
  x = 1000000000 - S % 1000000000;
  y = (x + S)/1000000000;
  
  cout << "0 0 1000000000 1 " << x << " " << y << endl;
  return 0;
}

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

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

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

int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	
	cin >>n;
	const int MX = n*2+10;
	vector<double> p(n), dp(MX);
	dp[MX/2] =1;
	rep(i,n) cin >>p[i];
	
	rep(i, n){
		vector<double> np(MX);
		rep(j, MX) if(dp[j] !=0){
			np[j+1]+=p[i]*dp[j];
			np[j-1]+=(1.0-p[i])*dp[j];
		}
		swap(dp, np);
	}
	double ans =0;
	rep2(i,MX/2, MX) ans += dp[i];
	printf("%.15f\n",ans);
	//for(auto x :dp) cout<<x <<" "; puts("");
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define mp make_pair
#define debug1(a) cout<<"------\n"<<#a<<" = "<<a<<endl<<"------"<<endl
#define debug2(a,b) cout<<"--------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<endl<<"--------------"<<endl
#define debug3(a,b,c) cout<<"----------------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<" ; "<<#c<<" = "<<c<<endl<<"----------------------"<<endl
#define sz(a) (ll)(a.size())
#define debug4(a) cout<<"chu "<<a<<endl
#define endl "\n"

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll a,b;
  cin>>a>>b;
  if((a+b)%2==0){
    ll ans=(a+b)/2;
    cout<<ans<<endl;
  }else{
    cout<<"IMPOSSIBLE\n";
  }
  return 0;
}


Measured memory_bytes: 256
using System;

class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            
            if ("Sunny".Equals(s)) Console.WriteLine("Cloudy");
            if ("Cloudy".Equals(s)) Console.WriteLine("Rainy");
            if ("Rainy".Equals(s)) Console.WriteLine("Sunny");
            
            return;
            
        }
    }

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

using namespace std;

int main() {
  int a;
  std::cin >> a;
  std::bitset<8> lower3200s{};
  int upper3200 = 0;
  while (std::cin >> a) {
    int i = a / 400;
    if (i < 8) {
      lower3200s.set(i);
    } else {
      upper3200++;
    }
  }
  std::cout << std::max(static_cast<int>(lower3200s.count()), 1) << " "
            << lower3200s.count() + upper3200 << std::endl;
  return 0;
}


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

int main()
{
  static char s[200010];
  scanf("%s",s);
  int n=strlen(s);
  int c[26]={0};
  long long ans=1;
  for(int i=0;i<n;i++){
    ans+=i-c[s[i]-'a'];
    c[s[i]-'a']++;
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int>h(n);
    rep(i,n){
        cin>>h[i];
    }
    sort(h.begin(),h.end());
    int ans=1e9;
    for(int i=0; i<n-k+1; ++i){
        ans=min(ans,h[i+k-1]-h[i]);
    }
    cout<<ans<<endl;
}

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

int main() {
	// your code goes here
	int i,j,k,n,p[100],pp[100],flag=0;
	cin >> n;
	for(i=1;i<=n;i++) {
		cin >> p[i];
		if(p[i]!=i) flag++;
	}
	if(flag==0||flag==2) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n-1;i>s;i--)
#define rep_re(i,s,n)for(ll i = n-1;i>=s;i--)
ll MOD = 1e9 + 7;

int main() {
	ll n, a, b; cin >> n >> a >> b;
	if (a == 0) {
		cout << 0 << endl;
		return 0;
	}
	if (n <= a) {
		cout << n << endl;
		return 0;
	}

	ll r = n / (a + b);

	if (r == 0) {
		cout << a << endl;
		return 0;
	}

	if (n % (a + b) == 0) {
		cout << r * a << endl;
		return 0;
	}


	ll p = n % (a + b);
	ll ans = r * a;

	if (a >= p)ans += p;
	else {
		ans += a;
	}

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
H, W = map(int, input().split())

aij = []
for i in range(H):
    tmp = list(map(int, input().split()))
    aij.append(tmp)

ope = 0
ope_list = []
for i in range(H):
    for j in range(W):
        if aij[i][j] > 0 and aij[i][j] % 2 == 1:
            if j+1 < W : #and aij[i][j+1] % 2 == 1:
                aij[i][j] -= 1
                aij[i][j+1] += 1
                ope += 1
                ope_list.append((i,j,i,j+1))
            elif i+1 < H :#and aij[i+1][j] % 2 == 1:
                aij[i][j] -= 1
                aij[i+1][j] += 1
                ope += 1
                ope_list.append((i,j,i+1,j))


print(ope)
for ol in ope_list:
    print(ol[0]+1,ol[1]+1,ol[2]+1,ol[3]+1)


Measured memory_bytes: 22808
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll a;
  cin>>a;
  ll b=0;
  for(ll i=0;i<a;i++){
    ll c;
    cin>>c;
    for(ll j=0;;){
      if(c%2==0){
        c=c/2;
        j++;
      }
      else{
        b+=j;
        break;
      }
    }    
  }
  cout<<b<<endl;
  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100005]={0};
ll sum[100005]={0};
bool cmp(ll a,ll b)
{
    return a>b;
}
int main()
{
    int n,i;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a+1,a+1+n,cmp);
    for(i=n;i>=1;i--)
    {
        sum[i]=sum[i+1]+a[i];
    }
    int ans=1;
    for(i=2;i<=n;i++)
    {
        if(2*(a[i]+sum[i+1])>=a[i-1])
        {
            ans++;
        }
        else
        {
            break;
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 100000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
/*---------------------------------------------------*/

int main(){
  string s;
  bool ok=false;
  cin>>s;
  rep(i,s.size()-1){
    if(s[i]=='A'&&s[i+1]=='C')ok=true;
  }
  if(ok)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <fstream>
using namespace std;


int main() {
    int n;
    cin>>n;
    string s;
    cin>>s;
    if (s.length()>n)
    {
        for (int i=0;i<n;i++)
            cout<<s[i];
        cout<<"...";}else
            cout<<s;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>

template <class T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }

int w, h;
std::vector<std::vector<int>> grid;

const std::vector<int> dx{-1, 0, 1, 0}, dy{0, -1, 0, 1};

int dfs(int x, int y) {
    if (x < 0 || h <= x || y < 0 || w <= y ||
        grid[x][y] == 0) return 0;

    int ret = 0;
    grid[x][y] = 0;

    for (int d = 0; d < 4; ++d) {
        ret = std::max(ret, dfs(x + dx[d], y + dy[d]));
    }

    grid[x][y] = 1;
    return ret + 1;
}

bool solve() {
    std::cin >> w >> h;
    if (w == 0) return false;

    grid = vec(h, vec(w, 0));
    for (auto& v : grid) {
        for (auto& x : v) {
            std::cin >> x;
        }
    }

    int ans = 0;
    for (int x = 0; x < h; ++x) {
        for (int y = 0; y < w; ++y) {
            ans = std::max(ans, dfs(x, y));
        }
    }

    std::cout << ans << "\n";
    return true;
}

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

    while (solve()) {}

    return 0;
}



Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const ll INF = 1e16;

void solver(int N, map<ll, ll> &D, int M, map<ll, ll> &T, bool &flg){

    bool tmp = true;

    for(auto p: T){
        auto key = p.first;
        auto value = p.second;

        if(D.count(key)){
            if(D[key] < value) tmp = false;
        }
        else tmp = false;
    }
    flg = tmp;

    return;
}

int main(){

    int N;
    cin >> N;
    map<ll, ll> D;
    for(int i = 0; i != N; ++i){
        int tmp;
        cin >> tmp;
        ++D[tmp];
    }
    int M;
    cin >> M;
    map<ll, ll> T;
    for(int i = 0; i != M; ++i){
        int tmp;
        cin >> tmp;
        ++T[tmp];
    }

    bool flg;
    solver(N, D, M, T, flg);

    if(flg) cout << "YES"s << endl;
    else cout << "NO"s << endl;

    return 0;
}

Measured memory_bytes: 28600
r, d, x = [int(i) for i in input().split()]

x = r * x - d
print(x)
x = r * x - d
print(x)
x = r * x - d
print(x)
x = r * x - d
print(x)
x = r * x - d
print(x)
x = r * x - d
print(x)
x = r * x - d
print(x)
x = r * x - d
print(x)
x = r * x - d
print(x)
x = r * x - d
print(x)


Measured memory_bytes: 3064
//CODING ME ACCHHA KARNEKA HAI TERKO TO BAS PRACTICE KARTE REH
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define aisort sort(a,a+n)
#define adsort sort(a,a+n,greater<ll>())

typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef set<ll> Set;

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}
    
//PRIME
    bool isPrime(ll n) { if (n <= 1)  return false; if (n <= 3)  return true;if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } 




int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  int a,b;
  cin>>a>>b;
  cout<<a*b;
}


Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	long long int a = 0;
	long long int b = 0;
	while (cin >> a, cin >> b)
	{
		long long int c = 0;
		long long int d = 0;
		long long int e = 0;
		c = a;
		d = b;
		if (c < d)
		{
			long long int i = 0;
			i = d;
			d = c;
			c = i;
		}
		while (1)
		{
			e = c % d;
			if (e == 0)
			{
				break;
			}
			c = d;
			d = e;
		}
		cout << d << endl;
	}

	return 0;
}

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

const int inf = 1e9 + 7;
pair<int, int> xy1[107];
pair<int, int> xy2[107];

int N;

bool vis[207][207];

int later_fnc_pre()
{
    int cnt = 0;
    for (int i = 1; i <= N; i++) {
        int sumx = inf, sumy = inf;
        for (int j = 1; j <= N; j++) {
            if (xy1[i].first < xy2[j].first && xy1[i].second < xy2[j].second  && !vis[ xy2[j].first  ][ xy2[j].second  ]) {
                if (xy2[j].second < sumy) sumx = xy2[j].first, sumy = xy2[j].second;
            }
        }
        if (sumx != inf) cnt++, vis[sumx][sumy] = 1; //cout << sumx << ' ' << sumy << endl;
    }

    return cnt;
}

bool cmp(pair<int, int> a, pair<int, int> b)
{
    if (a.first > b.first) return true;
    if (a.first == b.first) if (a.second > b.second) return true;
    return false;
}

int main()
{
    cin >> N;
    for (int i = 1; i <= N; i++) cin >> xy1[i].first >> xy1[i].second;
    for (int i = 1; i <= N; i++) cin >> xy2[i].first >> xy2[i].second;

    sort(xy1+1, xy1+N+1, cmp);
    sort(xy2+1, xy2+N+1, cmp);

    //cout << endl;


    int ans = later_fnc_pre();

    cout << ans << endl;
}

/*

3
0 0
2 6
8 0

3 7
4 2
9 1
*/


Measured memory_bytes: 256
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

"""
・順序が固定されるので、区間だったら簡単
・円のときも、地点 0 をそれぞれの方向に通った人数を見れば計算できる
"""

N, L, T = map(int, readline().split())
XW = np.array(read().split(), np.int64)
X = XW[::2]
W = XW[1::2]

speed = np.where(W == 1, 1, -1)

Y = X + speed * T

n = (Y // L - X // L).sum()
n %= N

Y %= L
Y.sort()
Y = np.concatenate((Y[n:], Y[:n]))

print('\n'.join(map(str, Y.tolist())))


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

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))

#define SI(n) scanf("%d",&n)
#define PI(n) printf("%d\n",n)
#define SL(n) scanf("%lld",&n)
#define PL(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define TRACE

#ifdef TRACE
#define TR(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define TR(...)
#endif

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
typedef long long int 	LL;
typedef long double 	LD;
typedef pair<int,int>   II;
typedef vector<int>     VI;
const int MOD = 1e9 + 7;
const int N = 100011;


int main() {
    set<int> s1,s2,s3;
    s1.insert(1);
    s1.insert(3);
    s1.insert(5);
    s1.insert(7);
    s1.insert(8);
    s1.insert(10);
    s1.insert(12);

    s2.insert(4);
    s2.insert(6);
    s2.insert(9);
    s2.insert(11);

    s3.insert(2);

    int x, y;
    cin>>x>>y;
    if(s1.find(x) != s1.end() and s1.find(y) != s1.end())
        cout<<"Yes\n";
    else if(s2.find(x) != s2.end() and s2.find(y) != s2.end())
        cout<<"Yes\n";
    else if(s3.find(x) != s3.end() and s3.find(y) != s3.end())
        cout<<"Yes\n";
    else 
        cout<<"No\n";
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
# input
def horizontal_input(T=str,debug=False):
    data = list(map(T,input().split()))
    if debug:
        print(*data)
    return data

def vertical_input(n,T=str,sep=False,septype=list,debug=False):
    data=[]
    if sep:
        for i in range(n):
            data.append(septype(map(T,input().split())))
    else:
        for i in range(n):
            data.append(T(input()))
    if debug:
        print(*data,sep='\n')
    return data

# Eratosthenes
def eratosthenes(n):
    prime_table = [False,False,True]+[False if i%2!=0 else True for i in range(n-2)]
    i=3
    while i*i<=n:
        if prime_table[i]:
            j=i*i
            while j<=n:
                prime_table[j]=False
                j+=i
        i+=2
    return prime_table

prime_table = eratosthenes(2000000)
primes=[]
for i in range(len(prime_table)):
    if prime_table[i]:
        primes.append(i)

while 1:
    n=int(input())
    if n==0:
        break
    i=0
    while primes[i]<=n:
        i+=1
    i=primes[i-1]
    if i==n:
        print(0)
    else:
        count=1
        j=i+1
        while 1:
            if prime_table[j]:
                break
            j+=1
            count+=1
        print(count)


Measured memory_bytes: 36900
/**********************************************

1.
2.炭田高輝
3.sumita.takaki@gmail.com

last updated: 2013-07-10@12:35

 **********************************************/
#include<iostream>
#include<algorithm>
#include<sstream>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
using namespace std;

int main(void) {

        while(1){
                
        vector<int> w_uni(10);
        vector<int> k_uni(10);

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

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

        sort(w_uni.begin(), w_uni.end());
        sort(k_uni.begin(), k_uni.end());

        int total1 = w_uni[7] + w_uni[8] + w_uni[9];
        int total2 = k_uni[7] + k_uni[8] + k_uni[9];

        if(total1 == 0 && total2 == 0)break;

        cout << total1 << ' '<< total2 << endl;

        }
        

}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#include <string_view>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define AB_BHI_NI_DEGI                \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define int long long
#define pb push_back
#define N 100009
#define inf 1e18
const double PI = 3.141592653589793238462643383279;
int mod = 1e9 + 7;
//int mod = 998244353;
#define P pair<int, int>
#define F first
#define S second
#define ll long long
#define all(v) v.begin(), v.end()
#define vi vector<int>
#define ld long double

#define ordered_set tree<P, null_type, less<P>, rb_tree_tag, tree_order_statistics_node_update>

void solve()
{
    int n;
    cin >> n;
    if (n >= 400 and n < 600)
        cout << "8\n";
    else if (n < 800)
        cout << "7\n";
    else if (n < 1000)
        cout << "6\n";
    else if (n < 1200)
        cout << "5\n";
    else if (n < 1400)
        cout << "4\n";
    else if (n < 1600)
        cout << "3\n";
    else if (n < 1800)
        cout << "2\n";
    else
        cout << "1\n";
}
int32_t main()
{
    AB_BHI_NI_DEGI
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //cout.precision(20);
    //cout << fixed;
    int T = 1;
    //cin >> T;
    int cnt = 1;
    while (T--)
    {
        //cout << "Case #" << cnt++ << ":\n";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<pi, int> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sandybridge __attribute__((optimize("Ofast"), target("arch=sandybridge")))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss

ll a, b, c, d;

int main() {
	fastio; cin >> a >> b >> c >> d;
	cout << max({a*c, a*d, b*c, b*d});
}


Measured memory_bytes: 3648
#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define print(x) cout<<x<<endl;
typedef long long ll;


int main() {
	ll x;
	cin >> x;
	ll ans = 0;
	ans = (x / 11) * 2;
	ll mar = x % 11;
	if (mar == 0) { mar = 0; }
	else if (mar != 0 && mar <= 6) { mar = 1; }
	else if(mar>6){ mar=2; }
	print(ans+mar);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i] << " "
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
bool isPerfectSquare(long double x) {   
    long double sr = sqrt(x); 
    return ((sr - floor(sr)) == 0); 
} 
bool isPrime(int x){
    for(int i = 2; i * i <= x; ++i){
        if(x % i == 0) return 0;
    }
    return 1;
}
int fun(int n){
    if(n & 1) return 3 * n + 1;
    else return n/2;
}
int32_t main(){
    SPEED;
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    int cnt = 0;
    for(char c: s) if(c == '-') cnt++;
    a--;
    if(s[a + 1] == '-' && cnt == 1) cout << "Yes";
    else cout << "No" ;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    map <pll, ll> m;
    ll n, i;
    cin >> n;
    vector <pll> a(n);
    for(i = 0; i < n; i++)
        cin >> a[i].F >> a[i].S;
    sort(all(a));
    for(i = 0; i < n; i++)
        for(ll j = i + 1; j < n; j++)
            m[{(a[i].F - a[j].F), (a[i].S - a[j].S)}]++;
    ll p = LLONG_MIN, q = LLONG_MIN, mf = -1;
    for(auto x : m)
        mf = max(mf, x.S);
    cout << (n == 1 ? 1 : (n - mf)) << endl;
    return 0;
}

Measured memory_bytes: 384
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(N)]

AB=sorted(AB)
sum=0
answer=0
i=0
while sum<M:
    plus=min(AB[i][1],M-sum)
    sum+=plus
    answer+=plus*AB[i][0]
    i+=1

print(answer)


Measured memory_bytes: 28648
#include <stdio.h>


int main() 
{
	int n, a[101], s = 0, x, y, p, ans = 0, i;
	
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d", a + i);
		s += a[i];
	}
	p = x = s / n;
	if(s % n){
		y = x + 1;
		if(y * n - s < s - x * n) p = y;
	}
	for(i = 0; i < n; i++){
		x = a[i] - p;
		ans += x * x;
	}
	printf("%d\n", ans);	
			
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define SZ(X) ((int)(X).size())
#define endl "\n";
typedef long long int ll;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	
   ll a,b,x,f,l,ans=0;
   cin>>a>>b>>x;
   
   f=a/x;
   l=b/x;
   ans=(l-f); 
   if(a%x==0) ans++;
   cout<<ans;
   return 0;
}


Measured memory_bytes: 3652
def coins(c):
    if c>= 500:
        c1 = c//500
        c2 = (c-500*c1)//5
        #print(c1,c2)
        s = c1*1000 + c2*5
        print(s)
    else:
        c2 = c//5
        print(c2*5)

def io():
    c = int(input())
    coins(c)

if __name__=='__main__':
    io()
    


Measured memory_bytes: 2940