akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
    using namespace std;
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    using namespace __gnu_pbds;
    #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
    #define ll long long
    #define int long long
    #define lb long double
    #define pb push_back
    #define f(i,a,b) for(int i=a;i<b;i++)
    #define fd(i,a,b) for(int i=a-1;i>=b;i--)
    #define pf push_front
    #define fi first
    #define se second
    #define take(a,n) f(i,0,n)cin>>a[i];
    #define show(a,n) f(i,0,n){cout<<a[i]<<" ";}
    #define ashow(a)  for(auto i:a)cout<<i<<" ";
    #define khtm     cout<<endl;
    #define all(s) s.begin(),s.end()
    #define len(a) a.length()
    #define INF 1e18
    #define MAXN 2000009
    const double pi=3.14159265358979323;
    const int mod=1e9+7;
    bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    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; 
} 
     signed main() {

        ios_base::sync_with_stdio(false);
        cin.tie(NULL);  
        cout.tie(0);  
     // -------------------------------------Code starts here--------------------------------------------------------------------- 
    int t=1;
    // cin>>t;
    while(t--)
    {
      

        int n,k,x=1,y=0;
        int mx=-1,mi=INF,mn=INF;
        int tm=0;
         // char c;
        cin>>n;
        int a[n];
        map<int,int>m;
        for(int i=0;i<n;i++){
            cin>>a[i],y+=a[i];
            m[a[i]]++;
        }
        cin>>k;
        int b[k],c[k];
        x=0;
        while(k--)
        {   
            cin>>b[x]>>c[x];
            y+=m[b[x]]*(c[x]-b[x]);
            m[c[x]]+=m[b[x]];
            m[b[x]]=0;
            cout<<y<<endl;
            x++;
        }
}

 }

Measured memory_bytes: 11864
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<random>
#include<deque>
#include<cstdio>
#include<fstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 2000100;
const int MOD = (int)pow(10, 9) + 7;
const ll INF = 1LL << 60;
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define ppp pair<ll,pp>
#define pps pair<string ,ll>
#define fi first
#define se second
#define pb push_back
#define fix(n) fixed<<setprecision(n)
#define itr vector<ll>::iterator
#define print(s) cout<<s<<endl
#define inp(s) cin>>s
string yn(bool b) { return (b ? "Yes" : "No"); }
string YN(bool b) { return (b ? "YES" : "NO"); }

ll n, x, a[1000],ans;
int main() {
	cin >> n >> x;
	rep(i, n)cin >> a[i];
	sort(a, a + n);
	ll sum = 0;
	rep(i, n) {
		//cout << a[i] << endl;
		sum += a[i];
		if (sum > x)break;
		++ans;
	}
	cout << ans -(sum>=x?0:1)<< endl;
	return 0;
}

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

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

	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) cout << "Possible" << endl;
	else cout << "Impossible" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(), v.end()
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define um unordered_multiset
#define us unordered_set
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define cc continue
#define bb break
#define rem 1000000007
#define debug(n1) cout<<"debug... "<<n1<<"\n"
#define PI 3.141592653589793238462643383279502
//fflush(stdin);
// do {
// // process permutation
// } while (next_permutation(permutation.begin(),permutation.end()));
class abc
{
    public:
    ll x,y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll n,W;
    cin>>n>>W;
    ve <ll> w(n),v(n);
    rep (i,0,n)
    {
        cin>>w[i]>>v[i];
    }
    ve <ll> dp(n*1000+1,1e15);
    // dp[i]--> min weight which will give value i
    dp[0]=0;
    rep (i,0,n)
    {
        rev (j,n*1000+1-v[i],0)
        {
            dp[v[i]+j]=min(dp[v[i]+j],dp[j]+w[i]);
        }
    }
    ll ans=0;
    rep (i,0,n*1000+1)
    {
        if (dp[i]<=W)
        {
            ans=max(ans,i);
        }
    }
    cout<<ans<<"\n";
}


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

if A+B <= 2*C:
    ans = A*X + B*Y
else:
    if X < Y:
        A, B, X, Y = B, A, Y, X
    ans = min(C*2*Y + A*(X-Y), C*2*X)

print(ans)

Measured memory_bytes: 3060
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (long long)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
const int MAXN    = 2e5+9;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	int n, m, sum = 0;
	cin >> n >> m;
	vector<int> arr(n);
	for(int i = 0; i < n; i++) {
		cin >> arr[i];
		sum+=arr[i];
	}
	sum=ceil((double)sum/4/m);
	for(int i = 0; i < n; i++) {
		if(arr[i]>=sum)
			m--;
	}
	if(m>0)
		cout << "No";
	else
		cout << "Yes";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define vel vector<long long>
#define vech vector<char>
#define ves vector<string>
#define veb vector<bool>
#define vvel vector<vel>
#define vvech vector<vech>
#define int long long
#define pin pair<int,int>
#define ppin pair<int,pin>
#define mkp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define maxel(vec, j) *max_element(vec.begin(), vec.begin()+j)

using namespace std;
void mmin(int &a, int b) { a = min(a, b); }
void mmax(int &a, int b) { a = max(a, b); }
int vsum(vel v){ return accumulate(v.begin(), v.end(), 0); }
int msum(vvel v){
    int ans = 0;
    rep(i, v.size()){
        ans += vsum(v[i]);
    }
    return ans;
}
class MultiLoop{
    public:
    int N;
    int M;
    vel k;
    vvel s;
    vel p;
    vel swi;
    int case_num;
    MultiLoop(int N, int M, vel k, vvel s, vel p):
        N(N),
        M(M),
        k(k),
        s(s),
        p(p),
        swi(N),
        case_num(0)
    {
    }
    int isOK(){
        rep(i, M){
            int swi_num=0;
            rep(j, k[i]){
                swi_num += swi[s[i][j]-1];
            }
            if(swi_num%2 != p[i]){
                return 0;
            }
        }
        return 1;
    }
    void search(int i){
        if(i<N){
            rep(j, 2){
                swi[i] = j;
                search(i+1);
            }
        }else{
            case_num += isOK();
        }
    }

};
signed main() {
    int pr = 1000;
    pr *= pr * pr; pr += 7;
    int N, M;
    cin >> N;
    cin >> M;
    vel k(M);
    vvel s(M);
    rep(i, M){
        cin >> k[i];
        rep(j, k[i]){
            int temp;
            cin >> temp;
            s[i].push_back(temp);
        }
    }
    vel p(M);
    rep(i, M){
        cin >> p[i];
    }
    MultiLoop temp(N, M, k, s, p);
    temp.search(0);
    cout<<temp.case_num;

    return 0;
}
/*
2 2
2 1 2
1 2
0 1
 */


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<pair<int,int>, null_type,less<pair<int, int> >, rb_tree_tag,tree_order_statistics_node_update>

#define NEWLINE         cerr << "\n";
#define HOISE           cerr << "hoise " << __LINE__ << "\n"
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << "\n"
#define READ            freopen("D:\\moidda CPP\\alu.txt", "r", stdin)
#define WRITE           freopen("D:\\moidda CPP\\vorta.txt", "w", stdout)
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MASK(x)         for(int i = 0; i < 8; i++){ if(x&(1<<i)){ cout << i << " "; } } cout << endl;

#define INF             1e9
#define INFL            8e18
#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

typedef long long ll;
typedef pair<int, int > pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pff;

const int MAX = 1e5 + 5;
const int MAXLOG = log2(MAX) + 2;
const int MAXN = 1e6 + 2;
const int MOD = 998244353 ;
const double PY = acos(-1.0);
const double EPS = 1E-9;

int32_t main()
{
#ifndef ONLINE_JUDGE
//    READ;
//    WRITE;
#endif // ONLINE_JUDGE

    FASTIO;

    ll a, b, c;
    cin >> a >> b >> c;
    ll LHS = 4*a*b;
    ll RHS = c*c+a*a+b*b-2*a*c-2*b*c+2*a*b;
    if(LHS < RHS and c-(a+b)>=0) cout << "Yes";
    else cout << "No";

    return 0;
}



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

typedef long long ll;

int mod = 1e9 + 7;
ll p = 2e6 + 100;
vector<ll> com(p + 1);
vector<ll> inv(p + 1);
vector<ll> mul(p + 1);


ll power(ll a, ll b) {
	ll ans = 1;
	while (b) {
		if(b & 1) {
			ans = (ans * a) % mod;
		}
		a = (a * a) % mod;
		b /= 2;
	}
	return ans;
}

ll C(ll n, ll k) {
	ll maxm = max(k,n - k);
	ll minn = min(k,n - k);
	ll ans = 1;
	for (ll i = n; i > maxm; --i) {
		ans = (ans * i) % mod;
	}
	return (ans * mul[minn]) % mod;
}

int main() {	
	com[0] = 1;
	for (ll i = 1; i <= p; ++i) {
		com[i] = (com[i - 1] * i) % mod;
	} 
    inv[0] = 1;
    inv[1] = 1;
	for (ll i = 2; i <= p; ++i) {
		inv[i] = (mod - (mod / i) * inv[mod % i] % mod) % mod; 
	}
	mul[0] = 1;
	for (int i = 1; i <= p; ++i) {
		mul[i] = (mul[i - 1] * inv[i]) % mod;
	}
	ll n, a , b;
	cin >> n >> a >> b;
	//cout << power(2,n);
	ll ans = (power(2,n) - 1 - (C(n,a) + C(n,b)) % mod + mod) % mod;
	cout << ans;
}









Measured memory_bytes: 50036
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
const int MOD = 1e9+7;
const int MOOD = 998244353;
#define PI 3.14159265359
typedef long long ll;
using namespace std;

int ans[10005];

int main(){
	int n;
	cin >> n;
	for (int i = 1; i <= 100; i++){
		for (int j = 1; j*j <= n - i*i; j++){
			for (int k = 1; k*k <= n - i*i - j*j; k++){
				if (i*i+j*j+k*k+i*j+j*k+k*i <= n){
					ans[i*i+j*j+k*k+i*j+j*k+k*i]++;
				}
			}
		}
	}
	for (int i = 1; i <= n; i++){
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3600
#![allow(unused_imports)]

#[macro_use]
mod _input {
    use std::fmt;
    use std::io::{self, Read};
    use std::str::{self, FromStr};

    macro_rules! input {
        ($($name:ident : $t:tt),*,) => {
            input!($($name: $t),*)
        };
        ($($name:ident : $t:tt),*) => {
            let mut _scanned = ::_input::Scanned::new(::std::io::stdin(), 1024);
            $(
                let $name = unsafe { _read_value!(_scanned, $t) };
            )*
        };
    }

    macro_rules! _read_value {
        ($scanned:expr, ($($t:tt),*)) => {
            ($(_read_value!($scanned, $t)),*)
        };
        ($scanned:expr, [$t:tt; $n:expr]) => {
            (0..$n).map(|_| _read_value!($scanned, $t)).collect::<Vec<_>>()
        };
        ($scanned:expr, _bytes) => {
            _read_value!($scanned, String).into_bytes()
        };
        ($scanned:expr, _1based) => {
            _read_value!($scanned, usize) - 1
        };
        ($scanned:expr, $t:ty) => {
            $scanned.next::<$t>()
        };
    }

    pub struct Scanned {
        buf: Vec<u8>,
        pos: usize,
    }

    impl Scanned {
        pub fn new<R: Read>(mut input: R, estimated: usize) -> Self {
            let mut buf_ = Vec::with_capacity(estimated);
            let _ = io::copy(&mut input, &mut buf_).unwrap();
            debug_assert!(str::from_utf8(&buf_).is_ok());
            debug_assert!(buf_.iter().all(|&c| u32::from(c) <= 0x7F));
            Scanned { buf: buf_, pos: 0 }
        }

        #[inline]
        pub unsafe fn next<T: FromStr>(&mut self) -> T
        where
            T::Err: fmt::Debug,
        {
            let mut start = None;
            loop {
                match (self.buf[self.pos], start.is_some()) {
                    (b' ', true) | (b'\n', true) => break,
                    (_, true) | (b' ', false) | (b'\n', false) => self.pos += 1,
                    (_, false) => start = Some(self.pos),
                }
            }
            let target = &self.buf[start.unwrap()..self.pos];
            str::from_utf8_unchecked(target).parse().unwrap()
        }
    }
}

use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::{self, BufWriter, Read, Stderr, StderrLock, Stdout, StdoutLock, Write};
use std::num::{ParseFloatError, ParseIntError};
use std::ops::{
    Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Div, DivAssign,
    Mul, MulAssign, Neg, Not, Rem, RemAssign, Sub, SubAssign,
};
use std::str::{self, FromStr};
use std::{char, cmp, f32, f64, fmt, i16, i32, i64, i8, mem, thread, u16, u32, u64, u8};

fn main() {
    input! {
        a: u64,
        b: u64,
    }
    println!("{}", f(a, b));
}

fn f(a: u64, b: u64) -> u64 {
    fn g(x: u64) -> u64 {
        match (x + 1) % 4 {
            3 => x ^ 0x1,
            2 => 0x1,
            1 => x,
            _ => 0x0,
        }
    }

    if a == 0 {
        g(b)
    } else {
        g(a - 1) ^ g(b)
    }
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(void){
    int A,B,T,N,SUM=0;
    scanf("%d%d%d",&A ,&B ,&T);
    float t;
    t = T + 0.5;
    N=t/A;
    int i;
    for(i=0;i<N;i++){
        SUM=SUM+B;
    }
    printf("%d",SUM);
}


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

using namespace std;

typedef long long ll;

const int N = 100005;
const int MOD = 1000000007;

vector<int> num;
int k; ll dp[N][105][2];

ll fun(int p, int s, int f) {
  if (p == num.size()) return s % k == 0;
  ll &ret = dp[p][s][f];
  if (ret != -1) return ret;
  ret = 0;
  int j = f ? 9 : num[p];
  for (int i = 0; i <= j; i++) {
    ret += fun(p + 1, (s + i) % k, i < j ? 1 : f);
    ret %= MOD;
  }
  return ret;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s >> k;
  for (auto i : s) {
    num.push_back(i - '0');
  }
  memset(dp, -1, sizeof dp);
  cout << (fun(0, 0, 0) - 1 + MOD) % MOD << endl;
  return 0;
}


Measured memory_bytes: 165248
import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		for (;;) {
			int n = sc.nextInt();
			if (n == 0) {
				break;
			}

			long ans = 0;
			for (int i = 0; i < n; i++) {
				int x = sc.nextInt();
				int y = sc.nextInt();
				int h = sc.nextInt();
				int w = sc.nextInt();

				int length = x + y + h;

				int wt[] = { 2, 5, 10, 15, 20, 25, Integer.MAX_VALUE };
				int lt[] = { 60, 80, 100, 120, 140, 160, Integer.MAX_VALUE };
				int mt[] = { 600, 800, 1000, 1200, 1400, 1600, 0 };
				for (int z = 0;; z++) {
					if (wt[z] >= w && lt[z] >= length) {
						ans += mt[z];
						break;
					}
				}
			}
			System.out.println(ans);
		}

	}

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

}

Measured memory_bytes: 12000
#include<iostream>
#include<cstdio>
#include<math.h>
#define rep(i,a) for(int i = 0; i < a; i++)
using namespace std;

int main(){
	int count[4][3][10] = {0};
	int n, b, f, r, v;
	cin >> n;
	rep(i, n){
		cin >> b >> f >> r >> v;
		count[b-1][f-1][r-1] += v;
	}

	rep(i, 4){
		rep(j, 3){
			rep(k, 10){
				cout << " " << count[i][j][k];
				if(k == 10-1) cout << endl;
			}
		}
		if(i != 4-1) cout << "####################" << endl;
	}
}

Measured memory_bytes: 1160
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define INF 2140000000
#define MOD 1000000007

int main() {
	int n, k;
	string s;

	cin >> n >> k >> s;

	vector<int> l;
	vector<int> r;
	vector<int> ind(n,0);
	int currl = 0;
	bool flag = 0;
	bool flag2 = 0;


	for (int i = 0; i < n; ++i) {
		if (s[i] == '0') {
			flag2 = 1;
		}
	}

	if (flag2 == 0) {
		cout << n << endl;
		return 0;
	}

	for (int i = 0; i < n - 1; ++i) {
		if (s[i] == '1' || s[i + 1] == '1') {
			flag = 1;
		}

		if (s[i] == '0' && s[i + 1] == '1') {
			l.push_back(currl);
			r.push_back(i);
		}

		if (s[i] == '1' && s[i + 1] == '0') {
			currl = i + 1;
		}
	}

	if (s[n  - 1] == '0') {
		l.push_back(currl);
		r.push_back(n - 1);
	}

	if (flag  == 0) {
		cout << n << endl;
		return 0;
	}

	int ans = -1;

	for (int i = 0; i < (int) l.size(); ++i) {
		int ll = i;
		int rr = -1;

		if (i + k - 1 < (int) l.size()) {
			rr = i + k - 1;		
		}
		else {
			rr = (int) l.size() - 1;
		}

		if (ll > 0) {
			ll = r[i - 1] + 1;
		}
		else {
			ll = 0;
		}


		if (rr < (int) l.size() - 1) {
			rr = l[rr + 1] - 1;
		}
		else {
			rr = n - 1;
		}

		ans = max(ans, rr - ll + 1);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1404
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] b = new int[n - 1];

		for (int i = 0; i < n - 1; i++) {
			b[i] = sc.nextInt();
		}

		int a = 0;
		a += b[0];
		a += b[n - 2];
		for (int i = 0; i < n - 2; i++) {
			if (b[i] <= b[i + 1]) {
				a += b[i];
			} else {
				a += b[i + 1];
			}
		}
		System.out.println(a);
		sc.close();
	}
}


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



int main() {
  string A,B,C;
  cin>>A>>B>>C;
  
  int ja=0;
  int jb=0;
  int jc=0;
  
  int kanri=1;
  while(true){
  if(kanri==1){
    if(ja==A.size()){
      cout<<'A'<<endl;
      return 0;
    }
    else{
      if(A.at(ja)=='a'){kanri=1;}
      else if(A.at(ja)=='b'){kanri=2;}
      else if(A.at(ja)=='c'){kanri=3;}
      ja++;
    }
  }
  else if(kanri==2){
    if(jb==B.size()){
      cout<<'B'<<endl;
      return 0;
    }
    else{
      if(B.at(jb)=='a'){kanri=1;}
      else if(B.at(jb)=='b'){kanri=2;}
      else if(B.at(jb)=='c'){kanri=3;}
      jb++;
    }
  }     
  else if(kanri==3){
    if(jc==C.size()){
      cout<<'C'<<endl;
      return 0;
    } 
    else{
      if(C.at(jc)=='a'){kanri=1;}
      else if(C.at(jc)=='b'){kanri=2;}
      else if(C.at(jc)=='c'){kanri=3;}
      jc++;
    }
  }
  }
}

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

const int ContestCount = 26;
int d;
vector<int> c;
vector<vector<int>> s;

int calcMinus(int dd, vector<int> &last) {
  dd++;
  int res = 0;
  rep(i, ContestCount) {
    res += c.at(i) * (dd - last.at(i));
  }
  return res;
}

int calcScore(int dd, int contest, vector<int> &last) {
  int score = 0;
  int plus = s.at(dd).at(contest);
  score += plus;
  last.at(contest) = dd + 1;
  // マイナス分の計算
  int minus = calcMinus(dd, last);
  score -= minus;
  return score;
}

int main() {
  // 入力処理
  cin >> d;
  c.resize(ContestCount);
  rep(i, ContestCount) cin >> c.at(i);
  s.resize(d, vector<int>(ContestCount));
  rep(i, d) {
    rep(j, ContestCount) {
      cin >> s.at(i).at(j);
    }
  }
  // B問題用の入力
  vector<int> t(d);
  rep(i, d) {
    cin >> t.at(i);
    t.at(i)--;
  }

  vector<int> last = vector<int>(ContestCount, 0);

  vector<int> v(d, 0);
  rep(dd, d) {
    // 前処理
    int score;
    if (dd == 0) {
      score = 0;
    } else {
      score = v.at(dd - 1);
    }
    // コンテスト開催
    int contest = t.at(dd);
    score += calcScore(dd, contest, last);
    v.at(dd) = score;
  }
  rep(i, d) {
    cout << v.at(i) << endl;
  }
  return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define pb(v, a) v.push_back(a)
#define sz(s) (ll)s.size()
#define print(d) cout << fixed << setprecision(15) << d
#define pii pair<ll,ll>
#define ppii pair<ll,pii>
#define ff first
#define ss second
const ll MOD = 1000000007;
const ll MAXN = 1e6 + 5;
const ll inf = 2e18;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<pii, null_type, less<pii>, rb_tree_tag,
tree_order_statistics_node_update> ord_set;
#define debug(x) cerr << #x << " = " << x << endl


ll power(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2, m) % m; 
    p = (p * p) % m; 
  
    return (y%2 == 0)? p : (x * p) % m; 
} 


int main()
{
    fast
   ll h,a;
   cin >> h >> a;
   ll arr[h];
   fr(i,0,h)cin >> arr[i];
   sort(arr,arr+h);
   ll ans=0;
   fr(i,0,h-a)ans+=arr[i];
   cout << ans;

    return 0;

}










Measured memory_bytes: 1792
// AOJ 1567 Lucky Number
// 2018.3.18 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// 高速数値入出力
#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()  // 非負整数のみ
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void out(int n)   // 非負整数のみ, 最後改行
{
	int i;
	char ob[20];

	if (!n) pc('0');
	else {
		i = 0; while (n) ob[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(ob[i]);
	}
	pc('\n');
}

#define MOD 1000000007
int N, M, K;
int dp[5002][5002];
long long t[15010];

int main()
{
	int i, j, k, Q, a, b, c;
	int N2, K2;

	N = in(), M = in(), K = in(), Q = in();
	N2 = N << 1, K2 = K << 1;
	k = (N/K2)*K2; if (N % K2) k += K2;
	dp[0][0] = 1;
	for (i = 0; i < M; i++) {
		memset(t, 0, sizeof(t));
		for (j = 0; j < N; j++) {
			t[j] += dp[i][j];
			t[j + K] -= dp[i][j];
			if (j + k < N2) t[j + k] -= dp[i][j];
			if (j + k + K < N2) t[j + k + K] += dp[i][j];
		}
		
		for (j = 0; j < N2; j++) if (j + 1 < N2) t[j + 1] += t[j];
		for (j = 0; j < N2; j++) if (j + K2 < N2) t[j + K2] += t[j];
		for (j = 0; j < N; j++) dp[i + 1][j] = (t[j] + t[j + N]) % MOD;
	}

	while (Q--) {
		a = in(), b = in(), c = in() - a;
		if (c < 0) c += N;
		out(dp[b][c]);
	}
	return 0;
}


Measured memory_bytes: 99476
"use strict";
    
class PriorityQueue {
  constructor() {
    this.heap = [];
  }
 
  push(item) {
    let heap = this.heap;
    let i = heap.length++;
    let j;
 
    while(i) {
      j = Math.floor((i - 1) / 2);
      if(heap[j] <= item) break;
      heap[i] = heap[j]
      i = j;
    }
 
    heap[i] = item;
  }
 
  pop() {
    let heap = this.heap;
    let top = heap[0];
    let popped = heap.pop();
 
    let i = 0;
    let k = Math.floor(heap.length / 2);
    let j;
 
    while(i < k) {
      j = (i * 2) + 1;
      if(heap[j+1] < heap[j]) ++j;
 
      if(popped <= heap[j]) break;
 
      heap[i] = heap[j];
 
      i = j;
    }
 
    if(heap.length) {
      heap[i] = popped;
    }
 
    return top;
  }
 
  size() {
    return this.heap.length;
  }
 
  top() {
    return this.heap[0];
  }
}

const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const M = parseInt(arg[0].split(" ")[1]);
    
    let AB = arg.slice(1, N + 1).map(n=>n.split(" ").map(l=>parseInt(l)));
    AB.push([1e9, 0]);
    AB.sort((a,b)=>a[0]-b[0]);
    
    let answer = 0;
    let j = 0;
    
    let pq = new PriorityQueue();
    
    for(let i=1; i<=M; i++) {
        while(AB[j][0] <= i) {
            pq.push(-AB[j][1]);
            j++;
        }
        
        if(pq.size() > 0) {
            answer += pq.pop();
        }
    }
    
    console.log(0 - answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 53628
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void){
    // Your code here!
    double r,a,b;
    cin >> r;
    a = r * r * 3.141592653589;
    b = 2 * r * 3.141592653589;
    printf("%f %f\n",a,b);
}


Measured memory_bytes: 3288
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//文字列の入力
		String a = sc.next();
		String s = sc.next();
		String c = sc.next();
		//最初の文字の抜き出し(s)
		char S [] = new char [s.length()];
		S[0] = s.charAt(0);
		System.out.println("A" + S[0] + "C");

	}

}


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

int main()
{
    long long n;
    std::cin>>n;
    std::vector<long long> a(n);
    for(int i=1;i<=n;i++){
        std::cin>>a[i-1];
        a[i-1] -= i;
        //std::cout<<a[i-1]<<std::endl;
    }
    std::sort(a.begin(),a.end());
    long long mid = a[n/2];
    long long ans = 0;
    for(int i=0;i<n;i++){
        ans += std::abs(a[i] - mid);
    }
    std::cout<<ans<<std::endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
	int n;
	cin>>n;
	cout<<n/2 + n%2 << "\n";
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

const int mod = (int) 1e9 + 7;

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
		}
	u %= m;
	if (u < 0) u += m;
	return u;
}


long long calc(int n, int r) {
	r = min(r, n - r);

	long long numerator = 1;
	long long denominator = 1;

	for (int i = 1; i <= r; i++) {
		numerator = numerator * (n + 1 - i) % mod;
		denominator = denominator * i % mod;
	}

	long long ret = numerator * modinv(denominator, mod) % mod;

	return ret;
}

int main() {
	int x, y;
	cin >> x >> y;

	bool ok = true;
	if ((x + y) % 3 != 0) {
		ok = false;
	} else if (2 * x - y < 0) {
		ok = false;
	} else if (x - 2 * y > 0) {
		ok = false;
	}

	if (!ok) {
		cout << 0 << endl;
		return 0;
	}

	int n = (x + y) / 3;
	int r = 2 * n - x;

	auto ans = calc(n, r);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 int INF=1001001001;
const int mod=1e9+7;

int main() {
  int N;
  cin>>N;
  vector<int>a(N);
  map<int,int>k;
  for(int i=0;i<N;i++){
    cin>>a[i];
    if(a[i]%4==0){k[4]++;}
    else if(a[i]%2==0){k[2]++;}
    else{k[1]++;}
  }
  bool ok=false;
  if(k[4]>=k[1]){ok=true;}
  else if(k[4]==k[1]-1&&k[2]==0){ok=true;}
  
  if(ok){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
  return 0;
}


Measured memory_bytes: 3796
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] abcdef = br.readLine().split(" ");
        int a = Integer.parseInt(abcdef[0]);
        int b = Integer.parseInt(abcdef[1]);
        int c = Integer.parseInt(abcdef[2]);
        int d = Integer.parseInt(abcdef[3]);
        int e = Integer.parseInt(abcdef[4]);
        int f = Integer.parseInt(abcdef[5]);
        int total, sugar;
        double max_concentration = -1;
        int anstotal = 0, anssugar = 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 && (double)100 * (c*k + d*l) / (100*a*i + 100*b*j) <= e; l++) {
                        total = 100*a*i + 100*b*j + c*k + d*l;
                        sugar = c*k + d*l;
                        
                        if ((double)sugar/total > max_concentration) {
                            max_concentration = (double)sugar/total;
                            anssugar = sugar;
                            anstotal = total;
                        }
                    }
                }
            }
        }
        
        System.out.println(anstotal + " " + anssugar);
    }
}


Measured memory_bytes: 23124
#include <iostream>

using namespace std;
int main()
{
    int x;
    cin >> x;
    if (x < 600) {
        cout << 8;
    } else if (x < 800) {
        cout << 7;
    } else if (x < 1000) {
        cout << 6;
    } else if (x < 1200) {
        cout << 5;
    } else if (x < 1400) {
        cout << 4;
    } else if (x < 1600) {
        cout << 3;
    } else if (x < 1800) {
        cout << 2;
    } else if (x < 2000) {
        cout << 1;
    }
    return 0;
}


Measured memory_bytes: 3228
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;

signed main(){
    cin >> n;
    vec(a,n);
    input(a,n);
    Sort(a);
    int ans = 0;
    REP(i,n){
        FOR(j,i+1,n){
            FOR(k,j+1,n){
                if(a[i]+a[j]>a[k]){
                    ans++;
                }
            }
        }
    }
    print(ans)
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 384
from itertools import accumulate

def main():
    n,k = (int(x) for x in input().split())
    mod = 10**9 + 7
    left = tuple(accumulate(range(n+1)))
    right = tuple(accumulate(reversed(range(n+1))))
    tot = sum(r-l+1 for l, r in zip(left[k-1:], right[k-1:]))
    print(tot%mod)

if __name__ == '__main__':
    main()

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < s.length(); i++){
        if(i%2 == 0){
            if(s[i] == 'p') ans--;
        }
        else{
            if(s[i] == 'g') ans++;
        }
    }
    cout << max(0, ans) << endl;
    return 0;
}

Measured memory_bytes: 512
from collections import deque
import bisect
m=int(input())
def fa(n):
    arr =deque([])
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

x=0
count=0
box=[]
for i in range(1,1000):
    box.append(i*(i+1)//2)
# print(box)
for i,j in fa(m):
    # print(i,j)

    count+=bisect.bisect_right(box, j)


print(count)


Measured memory_bytes: 85708
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(){

  int n, m, i = 0, x[101];
  char s[101];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      x[i - 1] += x[i];
      i--;
    } else if ( s[0] == '-' ){
      x[i - 1] -= x[i];
      i--;
    } else if ( s[0] == '*' ){
      x[i - 1] *= x[i];
      i--;
    } else {
      i++;
      x[i] = atoi(s);
    }
  }
  printf("%d\n", x[i]);
  return 0;
}

Measured memory_bytes: 548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, c;
  in3(a, b, c);
  out(min({a + b, b + c, c + a}));
  memi;
}

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

from itertools import product

N = int(input())

cnt = 0
# 候補となりうる10桁までの数字を列挙
for prod in product(['0', '3', '5', '7'], repeat=10):
    # チェック用に変形
    num = int(''.join(prod))
    s = str(num)
    # 753数ではない
    if (s.find('3') == -1 or s.find('5') == -1
            or s.find('7') == -1 or s.find('0') != -1):
        continue
    # N以下ではない
    if num > N:
        continue
    cnt += 1
print(cnt)


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    vector<int> v, c;
    int i;
    int res, tmp;

    cin >> n;
    for(i=0;i<n;i++){
        cin >> tmp;
        v.push_back(tmp);
    }
    for(i=0;i<n;i++){
        cin >> tmp;
        c.push_back(tmp);
    }
    res = 0;
    for(i=0;i<n;i++){
        if((tmp = v[i]-c[i]) > 0){
            res += tmp;
        }
    }
    cout << res << endl;
}

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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> vec1(M),vec2(M);
  for(int i=0;i<M;i++)
    cin>>vec1.at(i)>>vec2.at(i);
  sort(vec1.begin(),vec1.end());
  sort(vec2.begin(),vec2.end());
  int ans=vec2.at(0)-vec1.at(M-1)+1;
  if(ans<0)
    cout<<0<<endl;
  else
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>
#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
const int MOD = 1000000007;


typedef long long int ll; 
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

void floatOutPutSetup(){
    cout << fixed;
    cout << setprecision(10);
}

int main(){
    string s;
    int k;
    cin>>k>>s;
    if(s.length()<=k){
        cout<<s;
    }else{
        rep(i,k){
            cout<<s[i];
        }
        cout<<"..."<<endl;
    }

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define vll vector<ll>
#define G vector<vll >
#define F first
#define S second
#define pll pair<ll,ll>
#define RFOR(i,a,b) for(int i=a;i>=b;i--)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define endl '\n'
#define clr(a) memset(a,0,sizeof(a))
#define all(x) x.begin(),x.end()
#define rll read_ll();
#define gc getchar
#define pc putchar
#define deb2(a,b,c,d) cout<<a<<":"<<b<<" "<<c<<":"<<d<<endl;
typedef long long ll;
template<class T> inline T lcm(T a,T b){
        return a/gcd(a,b)*b;
}
template<typename T>
void printer(T first) {
    cout << first << "\n";
}
template<typename T, typename... Args>
void printer(T first, Args... args) {
    cout << first << " ";
    printer(args...);
}


ll read_ll(){char c=gc();while((c<'0'||c>'9')&&c!='-')c=gc();ll ret=0;int neg=0;if(c=='-')neg=1,c=gc();while(c>='0'&&c<='9'){ret=10*ret+c-48;c=gc();}return neg?-ret:ret;}

const int N = (int) 1e5 + 10;

int n,m,A[N];
vector<int> g[N];
bool visited[N];
set<int>visitedSet,values;

void dfs(int u)
{
    visitedSet.insert(u);
    values.insert(A[u]);
    visited[u] = true;
    for(auto v : g[u])
    {
        if(visited[v]) continue;
        dfs(v);
    }
}

int main()
{
    clr(A);
    clr(g);
    clr(visited);
    cin>>n>>m;
    int u,v;
    for(int i = 1; i <= n; i++)
        cin>>A[i];
    for(int i = 0; i < m; i++)
    {
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    int ans = 0;
    for(int i = 1; i < n; i++)
    {
        if(!visited[i])
        {
            dfs(i);
            for(auto ele : visitedSet)
            {
                if(values.count(ele))
                    ans++;
            }
            visitedSet.clear();
            values.clear();
        }
    }
    
    cout<<ans;
    
    return 0;
}













Measured memory_bytes: 18560
prime = []
is_prime = [1 for i in range(1000000)]


is_prime[0] = is_prime[1] = 0
for i in range(2,1000000):
    if (is_prime[i]):
        prime.append(i)
        for j in range(2*i,1000000,i):
            is_prime[j] = 0


def solve(a, d, n):
    count = 0
    for p in prime:
        if (p-a < 0):
            continue
        if (not (p-a)%d):
            count += 1
        if (count == n):
            return p
            
def main():
    ans = []
    while True:
        a, d, n = map(int, input().split())
        if (a==0) and (d==0) and (n==0):
            break
        ans.append(solve(a,d,n))

    for i in ans:
        print(i)

main()


Measured memory_bytes: 16584
#include<bits/stdc++.h>
using namespace std;
long long n,s;
long long a[5010];
long long f[5010][5010];
int main(){
	cin>>n>>s;
	for(long long i=1;i<=n;i++){
		cin>>a[i];
	}
	f[0][0]=1;
	for(long long i=1;i<=n+1;i++){
		for(long long j=0;j<=s;j++){
			f[i][j]+=f[i-1][j]*2ll;
			f[i][j]%=998244353;
			if(j+a[i]<=s){
				f[i][j+a[i]]+=f[i-1][j];
				f[i][j+a[i]]%=998244353;
			}
		}
	}
	cout<<f[n][s];
	return 0;
}

Measured memory_bytes: 85948
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <map>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i=0; i<N; i++) {
        cin >> a[i];
    }
    vector<int> ans(N);

    int tmp = 0;
    for(auto e: a) {
        tmp ^= e;
    }

    for(int i=0; i<N; i++) {
        cout << (a[i] ^ tmp) << endl;
    }
    return 0;
}


Measured memory_bytes: 4704
r=lambda x:p[x]>0and r(p[x])or x
(n,m,k),*t=[map(int,t.split())for t in open(0)]
p=[-1]*-~n
s=p[:]
for a,b in t:
 x,y=sorted((r(a),r(b)))
 if(x!=y)*m>0:p[x]+=p[y];p[y]=y=x
 if x==y:s[a]-=1;s[b]-=1
 m-=1
print(*[s[i+1]-p[r(i+1)]for i in range(n)])

Measured memory_bytes: 96856
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    ll N,Q; cin>>N>>Q;
    string s; cin>>s;
    vector<int>a(N,0);
    rep(i,N-1){
        if(s[i]=='A'&&s[i+1]=='C')a[i+1]=a[i]+1;
        else a[i+1]=a[i];
    }
    rep(i,Q){
        ll l,r;
        cin>>l>>r;
        cout<<a[r-1]-a[l-1]<<endl;
    }
}


Measured memory_bytes: 1408
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<functional>
 #include<utility>
 
 using namespace std;
 
 int main()
 {
   int n;
   int arr[1000+5];
   while(cin>>n&&n)
   {
     double sum=0;
     double sum2=0;
     for(int i=0;i<n;i++)
     { 
       cin>>arr[i];
       sum+=arr[i];
     }        
     double average=sum/n;
     for(int i=0;i<n;i++)
     {
       sum2+=pow(arr[i]-average,2);          
     }
     double result=sqrt(sum2/n);
     printf("%.8lf\n",result);
   }
   //while(1);
   return 0;
 }

Measured memory_bytes: 3208
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;

int main(){
	LL a,b,c;
	cin >> a >> b >> c;
	if(a + b + c >= 22) cout << "bust" << endl;
	else cout << "win" << endl;
	return 0;
}

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

std::vector< std::vector<int> > g(200010);
int sum[200010] = { 0 };

void dfs(int node, int parent)
{
    if (parent != -1)
        sum[node] += sum[parent];

    for (int i = 0; i < g[node].size(); ++i)
    {
        int nxt = g[node][i];
        if (nxt != parent)
            dfs(nxt, node);
    }
}

int main()
{
    int n, q;
    std::cin >> n >> q;

    int x, y;
    for (int i = 1; i < n; ++i)
    {
        std::cin >> x >> y;
        --x;
        --y;

        g[x].push_back(y);
        g[y].push_back(x);
    }

    while (q--)
    {
        int v, x;
        std::cin >> v >> x;
        sum[v - 1] += x;
    }

    dfs(0, -1);

    for (int i = 0; i < n; ++i)
    {
        std::cout << sum[i] << " ";
    }
}


Measured memory_bytes: 23424
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
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 ll INF = 1e18;

int main(){
    rep(i,5){
        ll x;
        cin >> x;
        if(x==0){
            cout << i+1 << endl;
            return 0;
        }
    }

    return 0;
}


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

int main() {
  int n, ans = 0;

  cin >> n;

  vector<int> a(n);

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

  sort(a.begin(), a.end(), greater<int>());

  for (int i = 0; i < n; i += 2) {
    ans += a.at(i);
    if (i != n - 1) ans -= a.at(i + 1);
  }

  cout << ans;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

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

    vector<int> A(N), B(N), C(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        A[i]--;
    }
    for (int i = 0; i < N; i++)
        cin >> B[i];
    for (int i = 0; i < N-1; i++)
        cin >> C[i];

    int ans = 0;
    const int init = -1;
    int prev = init;
    for (int i = 0; i < N; i++) {
        ans += B[A[i]];

        if (prev!=init && prev+1 == A[i])
            ans += C[prev];

        prev = A[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long d = sc.nextLong();
		
		
		
		if(b * d < 0 && a * c < 0) {
			if(a * d > b * c) {
				System.out.println(a * d);
			} else {
				System.out.println(b * c);
			}
		}	else if(b * d >= a * c) {
			System.out.println(b * d);
		}   else {
			System.out.println(a * c);
		}
	}
}



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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mp(v1, v2)       make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "yes" : "no");}
//----------------------------------------------------------------

int main(void) {
  string s;
  cin >> s;
  int n = s.size();

  sortall(s);
  uniqueall(s);
  prtok(n==s.size());
}


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

using namespace std;

int main(void)
{
	long long ans = 0;
	int n;
	cin>>n;
	for(int i = 1; i <= n; i++){
		if(i%3 != 0 && i%5 != 0){
			ans+=i;
		}
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3636
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"
int main()
{
	int n,t;
	cin>>n>>t;
	vi a(n);
	for0(i,n) cin>>a[i];
	ll s=t;
	for0(i,n-1){
		s += min(t,a[i+1]-a[i]);
		}
	cout<<s<<nw;
	
	return 0;
}

Measured memory_bytes: 1024