akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

long a[100000];

int main()
{
  int N;
  long K;
  cin >> N >> K;
  int count[40] = {};
  for (int i = 0; i < N; i++)
  {
    cin >> a[i];
    for (int j = 39; j >= 0; j--)
    {
      if (a[i] & (1L << j))
      {
        count[j]++;
      }
    }
  }
  long used = 0;
  int div = N / 2;
  bool isOdd = N % 2 == 1;
  for (int j = 39; j >= 0; j--)
  {
    if ((used + (1L << j)) <= K)
    {
      if (count[j] < N - count[j])
      {
        used += (1L << j);
      }
    }
  }
  long result = 0;
  for (int i = 0; i < N; i++)
  {
    result += used ^ a[i];
  }

  cout << result << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

//http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3982722#1
struct SegmentTree{
private:
	vector<ll> node;
	int n;
    ll I=0;//ここに代入

public:
	SegmentTree(){
		int sz=200010;
		n=1;
		//要素数を2のべき乗にする
		while(n<sz) n*=2;
		rep(i,2*n-1) node.push_back(I);//全ての要素をinfで初期化//これは定義される演算における単位元
	}

	//k番目の値をaに変更する
	void update(int k,ll a){
		k+=n-1;
		node[k]=a;
		while(k>0){
			k=(k-1)/2;
			node[k]=max(node[2*k+1],node[2*k+2]);//これは結合則が満たされる任意の演算でok
		}
	}

	//[a,b)の最小値を求める,find(a,b+1)でよぶ
	ll find(int a,int b,int k=0,int l=0,int r=-1){
		if(r<0) r=n;
		if(r<=a || b<=l) return I;
		if(a<=l && r<=b) return node[k];
		else{
			ll vl=find(a,b,2*k+1,l,(l+r)/2);
			ll vr=find(a,b,2*k+2,(l+r)/2,r);
			return max(vl,vr);
		}
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<int> h(n),a(n);
	rep(i,n) cin>>h[i];
	rep(i,n) cin>>a[i];
	SegmentTree seg;
	vector<ll> dp(n+1,0);
	rep(i,n){
		dp[h[i]]=seg.find(0,h[i])+a[i];
		seg.update(h[i],dp[h[i]]);
	}
	cout<<*max_element(begin(dp),end(dp))<<endl;
}

Measured memory_bytes: 7792
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	ll n, k;
	cin >> n >> k;

	ll res = 0;
	for (ll i = k; i <= n + 1; i++) {
		ll mi = i * (i - 1) / 2;
		ll ma = i * (2 * n - i + 1) / 2;
		ll cnt = ma - mi + 1;
		res = (res + cnt) % mod;
	}

	out(res);

	return 0;
}

Measured memory_bytes: 3660
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
#include <map>
#include <numeric>

#define ll long long
using namespace std;
static ll imin = std::numeric_limits<ll>::min();
static ll imax = std::numeric_limits<ll>::max();
#define rep(i, n) for(int i = 0; i<n; ++i)
#define rep1(i, n) for(int i = 1; i<n; ++i)
#define rev_rep(i, n) for(int i = n - 1; i >= 0; --i)
#define range(a, i, b) for(int i = a; i <b; ++i)
#define dump(x) cout << #x << ":" << x << "\n";
#define all(v) v.begin(), v.end()
#define readl(N) ll N; cin >> N
#define readlv(N, vec) vector<ll> vec(N); rep(i, N){cin >> vec[i];}
#define greater_than [](ll l, ll r){return l > r;}
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::map<T1, T2>& mp);
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::pair<T1, T2>& pair);
template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec);
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::pair<T1, T2>& pair){
  os << '(' << pair.first << ',' << pair.second << ')';
  return os;
}

template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(int i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  os << std::endl;
  return os;
}

template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::map<T1, T2>& mp){
  std::size_t n = mp.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(auto && x:mp){
    os << x << " ";
  }
  os << std::endl;
  return os;
}

template<class T>
std::ostream& operator << (std::ostream& os, std::set<T>& mp){
  std::size_t n = mp.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(auto && x:mp){
    os << x << " ";
  }
  os << std::endl;
  return os;
}

template<class T> inline bool chmin(T& a, T const b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T const b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

#ifndef BOOST_TEST_MAIN
int main(int const argc, char const** argv){
  readl(n);
  map<ll, ll> a;
  rep(i, n){
    ll x;
    cin >> x;
    a[x]++;
  }

  // cout << a;

  ll res=0;

  for(auto && x:a){
    if(x.first <= x.second){
      res += x.second - x.first;
    }else{
      res += x.second;
    }
  }
  
  cout << res << endl;
  
}
#endif


Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 5e2+5;
const ll INF = 2e18;

int main()
{
	int n;
	cin >> n;
	bool f = 0;
	while(n){
		int t = n%10;
		if(t == 7) f = 1;
		n /= 10;
	}
	printf("%s",f ?"Yes" :"No");
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
ll power(ll a,ll b)
{ll result=1;
while(b>0)
{if(b%2==1)
 result*=a;
 a*=a;
 b/=2;
}
return result;
}
int main()
{ios_base::sync_with_stdio(false);
    cin.tie(NULL);
string s;
cin>>s;
int n=s.length(),curr=0,count=0;
for(int i=0;i<n;i++)
{if(s[i]=='R'&&s[i]==s[i+1])
  count++;
  else if(s[i]=='R'&&s[i]!=s[i+1])
  {if(count+1>curr)
	 curr=count+1;
	 count=0;
   }
  }
 cout<<curr;
}


Measured memory_bytes: 3632
#include <stdio.h>

int main(void) {
  int i,n,x,y,z;
  scanf("%d",&n);
  for(i=1;i<n+1;i++){
    x=i/10;
    y=i/100;
    z=i/1000;
    if(i%3==0||i%10==3||x%10==3||y%10==3||z%10==3){
      printf(" %d",i);
    }
   }
  printf("\n");
  return 0;
}


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

int main() {
  string s,t;
  cin>>s>>t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(), t.end());
  if(s<t)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
  
}

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

using namespace std;

typedef long long ll;

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

	int n;
	cin >> n;

	cout << fixed << setprecision(10);
	if(n % 2 == 0){
		cout << 0.5 << endl;
	}else{
		cout << 1.0 * ((n + 1) / 2) / n << endl;
	}

}


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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(int _##i = (t), i = (f); i <  _##i; i++)
#define downto(f, t, i)  for(int _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(int _##i = (t), i = (f); i >  _##i; i--)
typedef long double ld;
#define long long long

#if defined(EBUG) && !defined(ONLINE_JUDGE)
    #define debug true
    #define ln << endl
#else
    #define debug false
    #define ln << '\n'
#endif
#define tb << '\t'
#define sp << ' '


long X[100009], X1[100009], X2[100009], I1[100009], I2[100009], L;
int W[100009];

inline long fmod(long k) { return (k % L + L) % L; }

signed main() { // long: 64bit
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }

    long N, T;
    scanf("%lld%lld%lld",&N,&L,&T);

    int N1 = 0, N2 = 0, F1;
    times(N, i) {
        scanf("%lld%d",&X[i],&W[i]);
        if(W[i] == 1) {
            I1[N1] = i;
            X1[N1++] = X[i];
        } else {
            I2[N2] = i;
            X2[N2++] = X[i];
        }
    }
    F1 = W[0] == 1;
    if(F1) {
        X1[0] += L;
        reverse(X1+1, X1+N1);
        reverse(I1+1, I1+N1);
    } else {
        reverse(X1, X1+N1);
        reverse(I1, I1+N1);
    }
    if(debug) {
        cout << "X1: "; times(N1, i) cout << X1[i] sp; cout ln;
        cout << "X2: "; times(N2, i) cout << X2[i] sp; cout ln;
        cout << "I1: "; times(N1, i) cout << I1[i] sp; cout ln;
        cout << "I2: "; times(N2, i) cout << I2[i] sp; cout ln;
    }

    long k;
    if(!N1 || !N2) {
        k = 0;
    } else {
        if(fmod(X2[0] - X1[0]) > T * 2) {
            k = 0;
        } else {
            long l = 0, r = T * 2 + 5;
            while(l < r) {
                long m = (l + r) / 2, m1 = (m + F1) / 2, m2 = (m + !F1) / 2;
                long x1 = L * (m1 / N1), x2 = L * (m2 / N2);
                upto(1, m1 % N1, i) x1 += X1[i-1] - X1[i];
                upto(1, m2 % N2, i) x2 += X2[i] - X2[i-1];
                if(debug) {
                    cout << "[m m1 m2]: " << m sp << m1 sp << m2 sp
                         << "[x1 x2 fmod(...)]: " << x1 sp << x2 sp << fmod(X2[0]-X1[0]) ln;
                }
                if(x1 + x2 + fmod(X2[0] - X1[0]) > T * 2) {
                    if(r == m) break;
                    r = m;
                } else {
                    if(l == m) break;
                    l = m;
                }
            }
            if(debug) cout << "l: " << l ln;
            k = l % 2 == F1 ? I1[(l+1) / 2 % N1] : I2[(l+1) / 2 % N2];
        }
    }

    if(debug) cout << "k: " << k ln;

    times(N, i) X[i] = fmod(W[i] == 1 ? X[i] + T : X[i] - T);
    int c = X[k], j = 0, s = 0;
    times(k, i) s += X[i] == c;
    sort(X, X + N);
    while(X[j] < c) j++;
    if(debug) cout << "c: " << c sp << ", j: " << j ln;
    times(N, i) printf("%d\n", X[(i + j + s) % N]);

    return 0;
}


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

int main(){
  int N;
  cin>>N;
  vector<int> H(N);
  for (int i=0; i<N; i++){
    cin>>H.at(i);
  }
  int Hmax=0;
  int count=0;
  for(int i=0; i<N; i++){
    if (Hmax<=H.at(i)){
      Hmax=H.at(i);
      count++;
    }
  }
  cout<<count<<endl;
}

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

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

  ll r=0;
  ll g=0;
  ll b=0;
 
  rep(i, n){
    if(s[i]=='R') r++;
    else if(s[i]=='G') g++;
    else b++;
  }
  ll ct = r*g*b;
  int ii, jj, kk;
  for(int i=0; i<n; i++){
    for(int j=1; i+j*2<n; j++){
      ii = i;
      jj = i+j;
      kk = i+j*2;
      if(s[ii]!=s[jj] && s[ii]!=s[kk] && s[jj]!=s[kk]) ct--;
    }
  }
  
  cout << ct << endl;
  return 0;
}

Measured memory_bytes: 3588
#include <vector>
#include <list>
#include <map>
#include <set>
#include "queue"
#include <deque>
#include <stack>
#include <numeric>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <complex>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include "fstream"
using namespace std;
#define PI acos(-1)
#define MOD 1000000007
#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGATIVESET(d) if ((d) < 0) d = (d % MOD + MOD) % MOD;
#define pii pair<long long ,long long >
#define ll  long long int
#define loop(i,n) for(ll i=0;i<n;i++)
#define loop2(i,n) for(ll i = 1;i<=n;i+=1)
#define pb push_back
#define mp make_pair
#define EPS 1e-7
using namespace std;
// JAI SHREE KRISHNA
//Verify Each line of code twice

const int MAXN = (ll)1e5+100;
ll a[MAXN];
ll pow2[MAXN];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //Verify each line of code twice
    pow2[0]=1;
    for(int i = 1; i <= 100000; i++)
        pow2[i]=(pow2[i-1]*2)%MOD;
    int n;
    cin>>n;
    for(int i = 0; i < n; i++) cin>>a[i];
    sort(a,a+n);
    if(n&1)
    {
        if(a[0]!=0)
        {
            cout<<0; return 0;
        }
        int pp = 2;
        for(int i = 1; i < n; i+=2)
        {
            if(!(a[i]==pp&&a[i+1]==pp))
            {
                cout<<0; return 0;
            }
            pp+=2;
        }
    }
    else
    {
        int pp = 1;
        for(int i = 0; i < n; i+=2)
        {
            if(!(a[i]==pp&&a[i+1]==pp))
            {
                cout<<0; return 0;
            }
            pp+=2;
        }
    }
    cout<<pow2[n/2]<<'\n';
    //Verify each line of code twice
    return 0;
}


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

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

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

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

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

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

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

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

fn main(){

    input!{
        n: usize,
        a: [usize;n],
    }

    let mut a_tmp: Vec<usize> = Vec::with_capacity(n);
    for i in 0..n {
        a_tmp.push(a[i]);
    }

    a_tmp.sort();
    let mut flag = true;

    for i in 0..n-1 {
        if a_tmp[i]==a_tmp[i+1] {
            println!("NO");
            flag = false;
            return;
        }
    }

    if flag==true {
        println!("YES");
    }
}

Measured memory_bytes: 8444
MOD = 10**9 + 7

n,k = map(int,input().split())
a = list(map(int,input().split()))

ans = 0
ans2 = 0
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        else:
            if i < j and a[i] > a[j]:
                ans += 1
            if i > j and a[i] > a[j]:
                ans2 += 1
            
mal = k*(k+1)//2 % MOD
mal2 = k*(k-1)//2 % MOD
print((ans * mal % MOD + ans2 * mal2 % MOD) % MOD)

Measured memory_bytes: 42604
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>

using namespace std;

typedef long long int lli;

#define N_MAX 100000
#define MOD 1000000007

void solv()
{
	int A, B; scanf("%d%d", &A, &B);
	const int h = 100, w = 100;
	int table[h][w];

	for (int i = 0; i < h / 2; i++){
		fill(table[i], table[i] + w, 0);
	}
	for (int i = h / 2; i < h; i++){
		fill(table[i], table[i] + w, 1);
	}

	A--; B--;

	int x = 0, y = 0;
	for (int i = 0; i < A; i++){
		table[x][y] = 1;
		y += 2;
		if (y >= w){
			x += 2;
			y = 0;
		}
	}
	x = h / 2 + 1; y = 0;
	for (int i = 0; i < B; i++){
		table[x][y] = 0;
		y += 2;
		if (y >= w){
			x += 2;
			y = 0;
		}
	}

	printf("%d %d\n", h, w);
	for (int i = 0; i < h; i++){
		for (int j = 0; j < w; j++){
			if (0 == table[i][j]){
				printf("#");
			}
			else{
				printf(".");
			}
		}
		printf("\n");
	}

	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <utility>

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
const int inf = 1e+9;



int main() {
	vector<ll> as(100001,0);
	ll n, k;
	cin >> n >> k;
	rep(i, n) {
		ll a, b;
		cin >> a >> b;
		as[a]+= b;
	}
	ll count = 0;
	rep(i, 100001) {
		count += as[i];
		if (count >= k) {
			cout << i << endl;
			return 0;
		}
	}


	return 0;
}


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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

template<class T> inline bool chmin(T& a, T b){
    if(a > b){
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

int main(){

    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    for(ll i = 0; i < n; i++){
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b.begin(), b.end());
    for(ll i = 0; i < n; i++){
        if(b[n/2] <= a[i]) cout << b[(n/2)-1] << endl;
        else cout << b[n/2] << endl;
    }

    return 0;
}


Measured memory_bytes: 6336
#include <stdio.h>
#define PI 3.14159265358979323846
int main(){
  int X,Y,Z;
  scanf("%d %d %d", &X, &Y, &Z);
  
  int tmp;
  tmp = X;
  X = Y;
  Y = tmp;
  
  tmp = X;
  X = Z;
  Z = tmp;
  
  printf("%d %d %d", X, Y, Z);
  
}

Measured memory_bytes: 1696
#include <iostream>

using namespace std;

void call(int n);

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

	call(n);

	return 0;
}

void call(int n) {
	int x;
	for (int i = 1; i <= n; i++) {
		x = i;
		if (i % 3 == 0 || i % 10 == 3) {
			cout << " " << i;
		}
		else {
			while (x) {
				x = x / 10;
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}
			}
		}
	}

	cout << endl;
}


Measured memory_bytes: 3104
// khodaya khodet komak kon
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vpl;

const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll N = 2e5 + 10;
const ll INF = 1e18;
const ll LOG = 20;
ll a[N], n, k;

ll chos3(ll x){
	return ((x) * (x - 1) * (x - 2)) / 6;
}
ll chos2(ll x){
	return ((x) * (x - 1)) / 2;
}

int main(){
	IOS;
	cin >> n >> k;
	for (int i = 1; i <= n; i++){
		a[i % k] ++;
	}
	ll ans = 0;
	for (int i = 0; i < k; i++){
		if ((2 * i) % k == 0){
			ans += chos3(a[i]) * 6 + chos2(a[i]) * 6 + a[i];
		}
	}
	cout << ans;
	
	
	
	
	
	return 0;
}






/*
     ,---,           ___                 ,--,
    '  .' \        ,--.'|_             ,--.'|                             ,--,
   /  ;    '.      |  | :,'            |  | :                           ,--.'|    ,---.        ,---,
  :  :       \     :  : ' :            :  : '                 .--.--.   |  |,    '   ,'\   ,-+-. /  |
  :  |   /\   \  .;__,'  /    ,--.--.  |  ' |     ,--.--.    /  /    '  `--'_   /   /   | ,--.'|'   |
  |  :  ' ;.   : |  |   |    /       \ '  | |    /       \  |  :  /`./  ,' ,'| .   ; ,. :|   |  ,"' |
  |  |  ;/  \   \:__,'| :   .--.  .-. ||  | :   .--.  .-. | |  :  ;_    '  | | '   | |: :|   | /  | |
  '  :  | \  \ ,'  '  : |__  \__\/: . .'  : |__  \__\/: . .  \  \    `. |  | : '   | .; :|   | |  | |
  |  |  '  '--'    |  | '.'| ," .--.; ||  | '.'| ," .--.; |   `----.   \'  : |_|   :    ||   | |  |/
  |  :  :          ;  :    ;/  /  ,.  |;  :    ;/  /  ,.  |  /  /`--'  /|  | '.'\   \  / |   | |--'
  |  | ,'          |  ,   /;  :   .'   \  ,   /;  :   .'   \'--'.     / ;  :    ;`----'  |   |/
  `--''             ---`-' |  ,     .-./---`-' |  ,     .-./  `--'---'  |  ,   /         '---'
                            `--`---'            `--`---'                 ---`-'
*/




Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pint pair<int,int>
#define pll pair<ll,ll>
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll dp[5000][5000];

int main(){
  int n,m;
  cin >> n >> m;
  ll a[m+1]={},b[m+1]={};
  ll c[m+1]={};
  rep(i,m){
    cin >> a[i+1] >> b[i+1];
    rep(j,b[i+1]){
      ll x=0;
      cin >> x;
      x--;
      c[i+1]+=((ll)1<<x);
    }
  }
  rep(i,5000){
    rep(j,5000)dp[i][j]=longinf;
  }
  dp[0][0]=0;
  for(int i=1;i<=m;i++){
    rep(j,(1<<n))dp[i][j]=min(dp[i][j],dp[i-1][j]);
    for(int j=0;j<((ll)1<<n);j++){
      ll y=(j|c[i]);
      dp[i][y]=min(dp[i][y],dp[i-1][j]+a[i]);
    }
  }
  ll ans=longinf;
  rep(i,m){
    ans=min(ans,dp[i+1][((ll)1<<n)-1]);
  }
  if(ans>=longinf)ans=-1;
  cout << ans << endl;
return 0;}

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

int main() {
    int n;
    cin>>n;
    int a[n];
    int maxi=0;
    int wa=0;
    for(int i=0;i<n;i++) {
        cin>>a[i];
        maxi=max(maxi, a[i]);
        wa+=a[i];
    }
    
    cout<<wa-(maxi+1)/2<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

int main() {
    int n, t; cin >> n >> t;
    vint a(n);
    rep(i,n) cin >> a[i];
    vint mx(n);
    mx[n-1] = a[n-1];
    for (int i = n-2; i >= 0; i--) {
        if (a[i] > mx[i+1]) mx[i] = a[i];
        else mx[i] = mx[i+1];
    }
    int now = 0;
    int ans = 1;
    rep(i,n-1) {
        if (now < (mx[i+1]-a[i])) {
            now = mx[i+1]-a[i];
            ans = 1;
        }
        else if (now == (mx[i+1]-a[i])) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2")

#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;

#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

inline void setin(string s) {
	freopen(s.c_str(), "r", stdin);
}

inline void setout(string s) {
	freopen(s.c_str(), "w", stdout);
}

template <typename T> inline T range(T l, T r) {
	return uniform_int_distribution <T>(l, r)(rng);
}

template <typename T> void Min(T &a, T b) {
    a = min(a, b);
}
 
template <typename T> void Max(T &a, T b) {
    a = max(a, b);
}

const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 4e2 + 15;
int n, a[N], b[N];
int pw[N][N];
int dp[N][N]; // dp[i][candies_left] = sum
int tmp[N];

inline int add(int a, int b) {
	a += b;
	if(a >= mod)
		a -= mod;
	if(a < 0)
		a += mod;
	return a;
}

inline int mt(int a, int b) {
	return 1ll * a * b % mod;
}

inline void add_t(int &a, int b) {
	a = add(a, b);
}

int c;

main() {
	for(int i = 1; i < N; ++i) {
		pw[i][0] = 1;
		for(int j = 1; j < N; ++j)
			pw[i][j] = mt(pw[i][j-1], i);
	}
	ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	// setin("input.txt");
	cin >> n >> c;
	for(int i = 1; i <= n; ++i)
		cin >> a[i];
	for(int j = 1; j <= n; ++j)
		cin >> b[j];
	dp[0][c] = 1;
	for(int i = 1; i <= n; ++i) {
		for(int x = a[i]; x <= b[i]; ++x) {
			memcpy(tmp, dp[i-1], sizeof(tmp));
			for(int j = c; j; --j)
				add_t(tmp[j-1], mt(x, tmp[j]));
			for(int j = c; j >= 0; --j)
				add_t(dp[i][j], tmp[j]);
		}
	}
	cout << dp[n][0] << endl;
	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

#define MAX_V 41
struct node{
  int id,parent,left,right,sibling;
  node():id(0),parent(-1),left(-1),right(-1),sibling(-1){}
};
node nodes[MAX_V]{};

void set_node(int id, int left,int right){
  nodes[id].id=id;
  nodes[id].left=left;
  nodes[id].right=right;
  if(left>=0){
    nodes[left].id=left;
    nodes[left].parent=id;
    nodes[left].sibling=right;
  }
  if(right>=0){
    nodes[right].id=right;
    nodes[right].parent=id;
    nodes[right].sibling=left;
  }
}
void printPostorder(node n,bool last=false){
  if(n.left>=0) printPostorder(nodes[n.left]);
  if(n.right>=0) printPostorder(nodes[n.right]);
  cout<<n.id<<(last?"\n":" ");
}

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

  vector<int> pre;
  vector<int> in;
  int n; cin>>n;
  REP(i,n) {int tmp; cin>>tmp; pre.push_back(tmp);}
  REP(i,n) {int tmp; cin>>tmp; in.push_back(tmp);}
  if(n==1) {cout<<pre[0]<<endl;return 0;}
  while(true){
    bool found=false;
    for(int i=pre.size()-2;i>=0;i--){
      for(int j=in.size()-2;j>=0;j--){
	if(i<(int)pre.size()-2&&j<(int)in.size()-2){
	  if(pre[i]==in[j+1]&&pre[i+1]==in[j]&&pre[i+2]==in[j+2]){
	    set_node(pre[i],pre[i+1],pre[i+2]);
	    auto iter=pre.begin();
	    REP(k,i+1) iter++;
	    pre.erase(iter); pre.erase(iter);
	    iter=in.begin();
	    REP(k,j) iter++;
	    in.erase(iter);iter++;in.erase(iter);
	    found=true; break;
	  }
	}
	if(pre[i]==in[j]&&pre[i+1]==in[j+1]){
	  set_node(pre[i],-1,pre[i+1]);
	  auto iter=pre.begin();
	  REP(k,i+1) iter++;
	  pre.erase(iter);
	  iter=in.begin();
	  REP(k,j+1) iter++;
	  in.erase(iter);
	  found=true; break;
	}
	if(pre[i]==in[j+1]&&pre[i+1]==in[j]){
	  set_node(pre[i],pre[i+1],-1);
	  auto iter=pre.begin();
	  REP(k,i+1) iter++;
	  pre.erase(iter);
	  iter=in.begin();
	  REP(k,j) iter++;
	  in.erase(iter);
	  found=true; break;
	}
      }
      if(found){break;}
    }
    if((int)pre.size()==1){break;}
  }
  int root=1;
  while(nodes[root].parent!=-1)
    root=nodes[root].parent;
  printPostorder(nodes[root],true);
}

Measured memory_bytes: 1220
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
	int a[3];
	int tc; scanf("%d", &tc);
	for(int tci=0; tci < tc; tci++) {
		scanf("%d%d%d", a,a+1,a+2);
		sort(a,a+3);
		printf("%s\n",a[0]*a[0]+a[1]*a[1]==a[2]*a[2] ? "YES" : "NO");
	}
	return 0;
}

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

typedef long long ll;
const int N = 5005;

int n, c[N], head[N], nxt[N], ver[N], cnt;
ll sum[N], max[N], min[N];
char s[N];

inline void add(int u, int v)
{
	nxt[++cnt] = head[u];
	ver[cnt] = v;
	head[u] = cnt;
}

void solve(int x, int f)
{
	max[x] = min[x] = 0; sum[x] = c[x];
	int max_son = 0;
	for (int i = head[x]; i; i = nxt[i])
	{
		int y = ver[i];
		if (y != f)
		{
			solve(y, x);
			sum[x] += sum[y];
			max[x] += max[y];
			if (max[y] > max[max_son]) max_son = y;
		}
	}
	if (min[max_son] <= max[x] - max[max_son]) min[x] = (max[x] & 1) + sum[x];
	else min[x] = min[max_son] - (max[x] - max[max_son]) + sum[x];
	max[x] += sum[x];
	if (f == 0) max[x] -= sum[x], min[x] -= sum[x], sum[x] -= sum[x];
}

inline char nc()
{
	static char buf[1000000], *p1 = buf, *p2 = buf;
	return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2) ? EOF : *p1++;
}

inline int read()
{
	int res = 0;
	char ch;
	do ch = nc(); while (ch < 48 or ch > 57);
	do res = res * 10 + ch - 48, ch = nc(); while (ch >= 48 and ch <= 57);
	return res;
}

int main()
{
	scanf("%d%s", &n, s + 1);
	for (int i = 1; i <= n; ++i) c[i] = s[i] - 48;
	for (int i = 1; i < n; ++i)
	{
		int u = read(), v = read();
		add(u, v); add(v, u);
	}
	ll ans = 1e18;
	for (int i = 1; i <= n; ++i)
	{
		solve(i, 0);
		if (min[i] == 0) ans = std::min(ans, max[i] >> 1);
	}
	if (ans >= 1e18) puts("-1");
	else printf("%lld", ans);
	return 0;
}


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

int main()
{
    char s[6];
    cin>>s[1]>>s[2]>>s[3]>>s[4]>>s[5]>>s[6];
    if((s[3] == s[4]) && (s[5] == s[6]))
    {
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
n = int(input())
alist = [int(input()) for _ in range(n)]

np = 0
remain = 0
for a in alist:
  if a == 0:
    remain = 0
  elif remain == 0:
    np += a // 2
    remain = a % 2
  else:
    np += (a + remain) // 2
    remain = (a + remain) % 2
print(np)


Measured memory_bytes: 7072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int N,mid;
    string s,ans;
    cin >> N >> s;
    sort(s.begin(),s.end());
    if(N%2==1) mid = N/2;
    else mid = N/2-1;
    char w = s[mid];
    if(w == 'R') ans = "Yes";
    else ans = "No";
    cout << ans<< endl;

}

Measured memory_bytes: 256
N,M = map(int,input().split())

par = [i for i in range(N+1)]

# 木の根を求める
def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]

# xとyが同じ集合に属するか否か
def bool_same(x,y):
    return root(x) == root(y)

# xとyの属する集合を併合
def unite(x,y):
    x = root(x)
    y = root(y)
    if x != y:
        par[x] = y

p = [0] + list(map(int,input().split()))

for i in range(M):
    a,b = map(int,input().split())
    unite(a,b)

ans = 0
for i in range(1,N+1):
    if bool_same(i,p[i]):
        ans += 1

print(ans)



Measured memory_bytes: 17840
from collections import defaultdict

S = input()
kTarget = 2019

mod2cnt = defaultdict(int)
mod2cnt[0] += 1

ord_z = ord('0')
res = 0
for i in range(len(S)-1, -1, -1):
    d = ord(S[i]) - ord_z
    res = (res+d*pow(10, len(S)-1-i, kTarget))%kTarget
    mod2cnt[res] += 1

ans = 0
for cnt in mod2cnt.values():
    ans += cnt*(cnt-1)
print(ans//2)

Measured memory_bytes: 74012
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <math.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll MX = 1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
 
int main() {
  string s;
  cin>>s;
  if(s=="ABC"){
    cout<<"ARC"<<endl;
  }
  else cout<<"ABC"<<endl;
}

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

int n;
int a[100005][3];

int maxCost(){
	int dp[100005][3];
	
	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	
	for(int i=1;i<n;i++){
		for(int j=0;j<3;j++){
			if(j==0){
				dp[i][j]=a[i][j]+max(dp[i-1][1],dp[i-1][2]);
			}
			else
			if(j==1){
				dp[i][j]=a[i][j]+max(dp[i-1][0],dp[i-1][2]);
			}
			else
			    dp[i][j]=a[i][j]+max(dp[i-1][0],dp[i-1][1]);
		}
	}
	return max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			cin>>a[i][j];
		}
	}
	cout<<maxCost()<<endl;
}

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

string s,t;
int sizes, sizet;

bool fuga(int j){
  if(j+sizet > sizes) return false;
  for(int i = 0; i < sizet; i++){
    if(s[i+j] != t[i]) return false;
  }
  return true;
}

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

  sizes = s.size();
  sizet = t.size();

  for(int i = 0; i < sizes; i++){
    if(fuga(i))cout<<i<<endl;
  }
  
  return 0;
}



Measured memory_bytes: 3224
n=int(input())
a=list(map(int,input().split()))

#箱の状態を記録しておく配列
box=[0]*n


for i in range(n):
  num=n-i

  #まず割って、その数より大きい倍数がいくつあるか探る
  baisu=n//num

  if baisu==1:
    box[num-1]=a[num-1]

  #1～baisu倍の箱の状態を調べる。
  temp=0
  for j in range(2,baisu+1):
    temp+=box[num*j-1]
  box[num-1]=abs(temp%2-a[num-1])

ans=[]
for i in range(n):
  if box[i]==1:
    ans.append(i+1)

if sum(ans)!=0:
  print(len(ans))
  print(*ans)
else:
  print("0")

Measured memory_bytes: 14516
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
    int A,B=0;
    cin >>A>>B;
    int max=-1000;
    int a[4];
    
    a[1]=A+B;
    a[2]=A-B;
    a[3]=A*B;
    
    for(int i=1;i<=3;i++)
    {
        if(a[i]>=max)
        {
            max=a[i];
        }
        
    }
    
    cout<<max<<endl;
    
    return 0;
    
}

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())
#define ALL(v) (v).begin(), (v).end()

// π M_PI
// deg = rad*180/M_PI

int main() {
    string s;
    cin >> s;
    int ans = 1;
    for (ll i = 0; i < s.length(); i = i+2) {
        if ( s[i] != 'h' || s[i+1] != 'i' ) {
            ans = 0;
        }
    }

    cout << (ans ? "Yes" : "No" ) << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var N int
	fmt.Scan(&N)
	x := make([]float64, N)
	y := make([]float64, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&x[i], &y[i])
	}
	sum := 0.
	for i := 0; i < N-1; i++ {
		for j := i + 1; j < N; j++ {
			dx := x[i] - x[j]
			dy := y[i] - y[j]
			sum += math.Sqrt(dx*dx + dy*dy)
		}
	}
	fmt.Println(sum / float64(N*(N-1)/2.0) * float64(N-1))
}


Measured memory_bytes: 1848
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>

// 5 2 4 
// 111000
// 000111

using namespace std;

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



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

	cin >> n >> k >> s;


	for(int i = 1; i < n; i++) {

		if (s[0] != s[i]) {
			int sx = i;
			i++;
			while(i < n) {
				if (s[0] == s[i]) {
					break;
				}
				i++;
			}
			for (int j = sx; j < i; j++) {
				s[j] = s[0];
			}
			k--;
			if (k == 0) {
				break;
			}

		}
	}
	char prev = -1;
	int count = 0;
	rep(i, n) {
		if (s[i] == prev) {
			count++;
		}
		prev = s[i];
	}
	cout << count << endl;


	return 0;
}

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

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



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

int main()
{
    int N, D;
    cin >> N >> D;
    int X[N][D];
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < D; ++j) {
            cin >> X[i][j];
        }
    }
    int cnt = 0;
    for(int i = 0; i < N; ++i) {
        for(int j = i+1; j < N; ++j) {
            double dis = 0;
            for(int k = 0; k < D; ++k) {
                dis += (X[i][k] - X[j][k])*(X[i][k] - X[j][k]);
            }
            dis = sqrt(dis);
            int integer = (int)dis;
            if(dis - (double)integer <= 1e-9) ++cnt;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
int main(){
  int A, B, X;
  rd(X);
  rd(A);
  rd(B);
  if(abs(X-A) < abs(X-B)){
    wt_L("A");
    wt_L('\n');
  }
  else{
    wt_L("B");
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// {
//   int X, A, B;
//   rd(X, A, B);
//   wt( if[abs(X-A) < abs(X-B), "A", "B"] );
// }


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = 1001001001;

//mint�p�̒萔 (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int> > miti(n, vector<int> (0));
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        miti[a].emplace_back(b);
        miti[b].emplace_back(a);
    }

    queue<int> room;
    room.push(0);
    vector<int> ans(n, INF);
    while (!room.empty()) {
        int ch = room.front(); room.pop();
        for (int i : miti[ch]) {
            if (ans[i] != INF) continue;
            ans[i] = ch;
            room.push(i);
        }
    }

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

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 10028
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) ((v).begin(), (v).end())
using ll = long long;
using P = pair<int, int>;
/* ------------------------------------------------ */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ------------------------------------------------ */

int main() {
    ll n;
    cin >> n;
    ll count = 0; 
    for(;;) {
        if(n == 1 || n == 2 || n == 4) break;
        if (n % 2 == 1) {
            n = 3 * n + 1;
            count++;
        }
        else {
            n = n / 2;
            count++;
        }
    }
    cout << count + 4 << endl;
    return 0;
}

Measured memory_bytes: 3604
from bisect import bisect_left
from itertools import accumulate

N, M = map(int, input().split())
shop = [list(map(int, input().split())) for _ in range(N)]
shop.sort(key=lambda x: x[0])

cnt = 0
ans = 0

for i in range(N):
    cnt += shop[i][1]
    if M <= cnt:
        dif = cnt - M
        ans += shop[i][0] * shop[i][1] - dif * shop[i][0]
        break
    else:
        ans += shop[i][0] * shop[i][1]

print(ans)

Measured memory_bytes: 28492
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	int n;
	cin >> n;
	vector<ll> a(n), b(n);
	rep(i, n) cin >> a[i] >> b[i];
	ll sum = 0;
	ll mn = 1LL << 60;
	if(a == b) {
		cout << 0 << endl;
		return 0;
	}
	rep(i, n) {
		sum += a[i];
		if(a[i] > b[i]) mn = min(mn, b[i]);
	}
	cout << sum - mn << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
using namespace std;

int n, arr[4];

int main()
{
	cin.sync_with_stdio(0);		cin.tie(0);		cout.tie(0);

	cin >> arr[1];
	cin >> arr[2];
	cin >> arr[3];
	int ans = 0;	
	while(true){
		sort(arr + 1, arr + 3 + 1);
		if(arr[1] == arr[2] && arr[2] == arr[3]) break;

		if(arr[1] + 2 <= arr[2]){
			arr[1] += 2;
		}else{
			arr[2] += 1;
			arr[1] += 1;
		}
		ans++;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
N,M = [int(i) for i in input().split()]
AList = [int(i) for i in input().split()]

H = sum(AList)/(4*M)

S =0

for A in AList:
  if A>= H:
    S = S + 1

if S >= M:
  print('Yes')
else:
  print('No')


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

int main() {
	int n;
	cin >> n;
	int p[n]={};
	p[0]=1;
	p[1]=1;
	if (n>1) {
		for (int i=2; i<=n; i++) {
			p[i]=p[i-1]+p[i-2];
		}
	}
	cout << p[n] << endl;
}


Measured memory_bytes: 3124
#include<iostream>
#include<climits>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;
int main(){

	string s;
	cin >> s;

	bool flag = true;
	if(s[0] != 'A'){
		flag = false;
	}
	
	int cnt = 0;
	for(int i = 2; i < s.size()-1; i++)
	{
		if(s[i] == 'C'){
			cnt ++;
		}
	}
	if(cnt!=1){
		flag = false;
	}

	for(int i = 0; i < s.size(); i++)
	{
		if ( (s[i]!='A' && s[i]!='C')){
			if(!(s[i] >= 'a' && s[i] <= 'z')){
				flag = false;
			}
		}
	}

	if(flag == true){
		cout << "AC" << endl;
	}else{
		cout << "WA" << endl;
	}

	return 0;
}

Measured memory_bytes: 256