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

using vi = std::vector<int>;
using vpi = std::vector<std::pair<int, int>>;
using vvpi = std::vector<vpi>;

int N;
vvpi edges;
vi conditions;
std::vector<bool> visited;

bool find(int, int, int);

int main()
{
	scanf("%d", &N);
	edges.resize(N);
	conditions.resize(N - 1);
	for (int i{}; i < N - 1; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		a--; b--;
		edges[a].push_back({b, i});
		edges[b].push_back({a, i});
	}
	int M;
	scanf("%d", &M);
	visited.resize(N);
	for (int i{}; i < M; i++)
	{
		std::fill(visited.begin(), visited.end(), false);
		int u, v;
		scanf("%d%d", &u, &v);
		u--; v--;
		find(u, v, i);
	}
	// for (auto& e: conditions) printf("%d ", e);
	// putchar('\n');
	int dp_size{1 << M};
	std::vector<int64_t> dp(dp_size);
	dp[0] = 1;
	for (auto& e: conditions)
		for (int i{dp_size - 1}; i >= 0; i--)
			dp[i | e] += dp[i];
	printf("%lld\n", dp.back());

	return 0;
}

bool find(int index, int key, int condition_i)
{
	if (visited[index]) return false;
	visited[index] = true;
	if (index == key) return true;
	for (auto& e: edges[index])
	{
		if (!find(e.first, key, condition_i)) continue;
		conditions[e.second] |= (1 << condition_i);
		return true;
	}
	return false;
}


Measured memory_bytes: 8448
#include<iostream>
using namespace std;
const int N = 100000;

int partition(int A[], int p, int r)
{
	int i = p;
	int temp;

	for (int j = p; j < r; j++)
	{
		if (A[j] <= A[r])
		{
			temp = A[i];
			A[i] = A[j];
			A[j] = temp;

			i += 1;
		}
	}
	temp = A[i];
	A[i] = A[r];
	A[r] = temp;
	
	return i;
}

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

	int n, A[N];
	
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> A[i];

	int q = partition(A, 0, n - 1);

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

	return 0;
}


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

using namespace std;

int di[4] = {0, 0, -1, 1};
int dj[4] = {-1, 1, 0, 0};

int n, m;
vector <string> s;
pair <int, int> c, d;
vector <vector<int>> a;
int colour;
vector <vector<int>> graph;

void dfs(int i, int j) {
	if (i < 0 || i == n || j < 0 || j == m) {
		return;
	}

	if (a[i][j] != 0) {
		return;
	}

	if (s[i][j] == '#') {
		a[i][j] = -1;
		return;
	}

	a[i][j] = colour;

	for (int k = 0; k < 4; k++) {
		dfs(i+di[k], j+dj[k]);
	}
}

void bfs() {
	int src = a[c.first-1][c.second-1];
	int dest = a[d.first-1][d.second-1];

	queue <int> q;
	q.push(src);

	vector <bool> visited(1+colour, false);
	vector <int> dist(1+colour, 1e9);

	// cout << src << " " << dest << "\n";

	dist[src] = 0;

	while (!q.empty()) {
		int u = q.front();
		q.pop();

		visited[u] = true;

		if (u == dest) {
			cout << dist[u] << "\n";
			return;
		}

		for (int v: graph[u]) {
			if (dist[v] == 1e9) {
				dist[v] = 1 + dist[u];
				q.push(v);
			}
		}
	}

	cout << -1 << "\n";
}

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

	cin >> n >> m;
	cin >> c.first >> c.second;
	cin >> d.first >> d.second;

	s.assign(n, "");

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

	colour = 0;
	a.assign(n, vector<int>(m, 0));

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (s[i][j] == '#') {
				a[i][j] = -1;
				continue;
			}

			if (a[i][j] == 0) {
				colour++;
				dfs(i, j);
			}
		}
	}

	if (a[c.first-1][c.second-1] == a[d.first-1][d.second-1]) {
		cout << 0 << "\n";
		return 0;
	}

	// for (int i = 0; i < n; i++) {
	// 	for (int j = 0; j < m; j++) {
	// 		if (a[i][j] == -1) {
	// 			cout << "#";
	// 		} else {
	// 			cout << a[i][j];
	// 		}
	// 	} cout << "\n";
	// }

	set <pair<int, int>> warp;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (a[i][j] == -1) {
				continue;
			}

			for (int k = -2; k <= 2; k++) {
				for (int l = -2; l <= 2; l++) {
					if (0 <= i+k && i+k < n) {
						if (0 <= j+l && j+l < m) {
							if (a[i+k][j+l] != -1) {
								int u = a[i][j];
								int v = a[i+k][j+l];

								if (v != u) {
									warp.insert({min(u, v), max(u, v)});
								}
							}
						}
					}
				}
			}
		}
	}

	graph.assign(colour+1, vector<int>());

	for (auto it: warp) {
		// cout << it.first << " " << it.second << "\n";
		graph[it.first].push_back(it.second);
		graph[it.second].push_back(it.first);
	}


	bfs();

	return 0;
}

Measured memory_bytes: 25752
#include<vector>
#include<cstdio>
#define MAX 10000
using namespace std;
const int WHITE = 0,GRAY =1,BLACK = 2;

vector<int> G[MAX];
int color[MAX] = {WHITE};
vector<int> L;

void visit(int n){
    if(color[n] != BLACK){
        color[n] = BLACK;
        for(auto itr = G[n].begin();itr != G[n].end();++itr){
            visit(*itr);
        }
        
        L.insert(L.begin(),n);
    }
}
void topological(int v){
    while(1){
        for(int i = 0;i < v;++i){
            if(color[i] != BLACK){
                visit(i);
                break;
            }
            if(i == v-1) return;
        }
    }
}

int main(){
    int v,e,s,t;
    scanf("%d %d\n",&v,&e);
    for(int i = 0;i < e;++i){
        scanf("%d %d\n",&s,&t);
        G[s].push_back(t);
    }
    topological(v);

    for(int i = 0;i < v;++i){
        printf("%d\n",L[i]);
    }
}



Measured memory_bytes: 3528
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 100100100100100;
const long long MOD = 1000000007;
typedef pair<long long,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

int gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}



int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int N;cin >> N;
    vector<long long> retu(N);
    for(int i = 0;i<N;i++) cin >> retu.at(i);
    
    sort(retu.begin(),retu.end());
    reverse(retu.begin(),retu.end());
    long long ans = retu.at(0);
    int count = 0;
    int index = 0;
    for(int i = 1;i<N;i++){
        if(i == 1){
            count = 2;
            continue;
        }
        if(count == 2){
            index++;
            ans += retu.at(index);
            count = 1;
            continue;
        }
        if(count == 1){
            ans += retu.at(index);
            count = 2;
        }
        //cout << i << " " << ans << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4760
h,w = gets.chomp.split(" ").map(&:to_i)
arr = ["#" * (w + 2)] + h.times.map{"#" + gets.chomp + "#"} + ["#" * (w + 2)]

max = 0
(1..h).each do |sy|
  (1..w).each do |sx|
    next if arr[sy][sx] == "#"
    # deep copy
    maze = Marshal.load(Marshal.dump(arr))

    # 座標, 回数
    bfs = [[sy, sx, 0]]
    maze[sy][sx] = "#"

    # bfs
    result = nil
    while bfs.length > 0 do
      y, x, result = bfs.shift
      [[-1, 0], [1, 0], [0, 1], [0, -1]].each do |(dy, dx)|
        tmp_y = y + dy
        tmp_x = x + dx
        next if maze[tmp_y][tmp_x] == "#"
        maze[tmp_y][tmp_x] = "#"
        bfs << [tmp_y, tmp_x, result + 1]
      end
    end
    max = result if result > max
  end
end

puts max


Measured memory_bytes: 14308
#include<cstdio>
#include<map>
#include<queue>

using namespace std;

const int maxn=2e5+10;
int n,m,vis[maxn],vis2[maxn];

int main()
{
	scanf("%d%d",&n,&m);
	for(int i = 1;i <= m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		if(u==1)vis[v]=1;
		if(v==n)vis2[u]=1;
		//if(v==1)vis[u]=1;
		//if(v==n)vis2[u]=1;
	}
	bool flag=0;
	for(int i = 2;i < n;i++)
		if(vis[i] && vis2[i])flag=1;
	if(flag)printf("POSSIBLE\n");
	else printf("IMPOSSIBLE\n");
	return 0;
}

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

int main() {

  int N;
  cin >> N;
  vector<int> X(N);
  vector<int> Y(N);
  for (int i = 0; i < N; i++) {
    cin >> X.at(i) >> Y.at(i);
  }
  double sumd = 2.0 - 2.0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      sumd += sqrt((X.at(i) - X.at(j)) * (X.at(i) - X.at(j)) + (Y.at(i) - Y.at(j)) * (Y.at(i) - Y.at(j)));
    }
  }
  cout << fixed << setprecision(8) << sumd * 2.0 / N << endl;
                   
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		int kosha[][][] = new int[4][3][10];
		
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		
		// ??\???????????????????´?
		for(int i=1; true; i++){
			//??¶??°????¶???????????????????
			if (i > n) break;
			int a = scan.nextInt();
			int b = scan.nextInt();
			int c = scan.nextInt();
			int d = scan.nextInt();
			int A = a-1;
			int B = b-1;
			int C = c-1;
			int D = kosha[A][B][C];
			kosha[A][B][C] = D + d;
		}
		
		//?????????
		for (int A=0; true; A++){
			for(int B=0; B<=2; B++){
				for(int C=0; C<=9; C++){
					System.out.print(" " + (kosha[A][B][C]));
				}
				System.out.println("");
			}
			if (A==3) break;
			System.out.println("####################");
		}
		
	}

}

Measured memory_bytes: 29676
program two_alpinists
  implicit none
  integer(8), parameter :: md = 1000000007_8
  integer(8) :: t(100000), a(100000), m
  integer :: n, i
  t = 0_8
  a = 0_8
  read(*,*) n
  read(*,*) t(1:n)
  read(*,*) a(1:n)
  m = 1_8
  if (t(1).gt.a(1).or.t(n).lt.a(n)) m = 0_8
  do i = 2, n-1
    if (t(i).ne.t(i-1).and.a(i).ne.a(i+1)) then
      if (t(i).ne.a(i)) m = 0_8
    else if (t(i).ne.t(i-1).and.a(i).eq.a(i+1)) then
      if (t(i).gt.a(i)) m = 0_8
    else if (t(i).eq.t(i-1).and.a(i).ne.a(i+1)) then
      if (t(i).lt.a(i)) m = 0_8
    else
      m = mod(m*min(t(i),a(i)),md)
    end if
  end do
  write(*,'(i0)') m
  stop
end program two_alpinists

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLD = vector<PLD>;

const int INF = numeric_limits<int>::max();

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

    string Sa, Sb, Sc; cin >> Sa >> Sb >> Sc;
    int Ai = 0,  Bi= 0, Ci = 0;
    
    char tmp = 'a';
    while (1)
    {
        if (tmp=='a') {
            if (Ai==Sa.size()) {cout << 'A' << endl; break;}
            tmp = Sa[Ai], Ai++;
        }
        else if (tmp=='b') {
            if (Bi==Sb.size()) {cout << 'B' << endl; break;}
            tmp = Sb[Bi], Bi++;
        }
        else if (tmp=='c') {
            if (Ci==Sc.size()) {cout << 'C' << endl; break;}
            tmp = Sc[Ci], Ci++;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
using namespace std;
int main(void){
    
    int n;
    int h=0;
    cin>>n;
    char a[150];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    
    for(int j=0;j<n;j++){
        if(a[j]=='Y'){
            h=4;
        }
    }
    
    if(h==0){
        cout<<"Three";
    }else{
        cout<<"Four";
    }
    return 0;
    
    
}

Measured memory_bytes: 256
#include <algorithm>
#include <chrono>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using llong = long long;
using ullong = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()
#define loop(i, times) for (llong i = 0; i < times; i++)
#define rloop(i, times) for (llong i = times -1; 0 <= i; i--)

std::chrono::system_clock::time_point  start;

void TimeStart(void)
{
	start = std::chrono::system_clock::now();
}

void TimeEnd(void)
{
	auto time = std::chrono::system_clock::now() - start;
	auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count();
	cerr << endl << msec << " msec " << endl;
}

#endif

struct Box
{
	bool red_;		// 箱に赤が入っている可能性
	llong count_;	// 箱に入っているボールの数
};

struct Move
{
	llong x_;
	llong y_;
};

class AGC002B
{
public:
	AGC002B()
	{
		cin >> n_;
		cin >> m_;

		box_collection_.resize(n_);
		loop(i,n_)
		{
			box_collection_[i].red_ = false;
			box_collection_[i].count_ = 1;
		} 
		box_collection_[0].red_ = true;

		move_collection_.resize(m_);
		loop(i,m_)
		{	// 箱の添字とxやyの数字を一致させるため、入力時点でデクリメントしてしまう。
			cin >> move_collection_[i].x_;
			cin >> move_collection_[i].y_;
			move_collection_[i].x_--;
			move_collection_[i].y_--;
		}

		ans_ = 0;
	}
	void Run(void)
	{
		for (const auto& elm_move : move_collection_)
		{
			if (0 < box_collection_[elm_move.x_].count_)
			{	// xの箱にボールが1つ以上あるなら赤の可能性が1増える可能性がある
				box_collection_[elm_move.y_].count_++;
				box_collection_[elm_move.x_].count_--;
				if (box_collection_[elm_move.x_].red_)
					box_collection_[elm_move.y_].red_ = true;
			}
			// ボールが0になった箱には赤色ボールが存在しない
			if (box_collection_[elm_move.x_].count_ == 0)
				box_collection_[elm_move.x_].red_ = false;
		}

		// 結果出力
		for (const auto& elm_box : box_collection_)
		{
			if (elm_box.red_)
				ans_++;
		}
		cout << ans_;
	}
private:
	llong n_;
	llong m_;
	llong ans_;
	vector<Move> move_collection_;
	vector<Box> box_collection_;
};

int main()
{
	AGC002B agc002b;

	TimeStart();
	agc002b.Run();
	TimeEnd();

	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
using namespace std;

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

    int n,k,h[(int)1e5+5],dp[(int)1e5+5];
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> h[i];
    for(int i = 0; i < 1e5+5; i++) dp[i]=2e9;
    dp[0]=0;
    for(int i = 0; i < n; i++) {
        for(int j = 1; j <= k; j++) {
            if(i+j>=n) continue;
            dp[i+j] = min(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
        }
    }

    cout << dp[n-1];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
const long long INF = 1LL << 60;
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; }

int main(){
    string s, t;
    cin >> s >> t;
    int ans = 1100;
    for(int i=0;i<s.size()-t.size()+1;i++){
        int temp = 0;
        for(int j=0;j<t.size();j++){
            if(s.at(i+j)!=t.at(j)) temp++;
        }
        ans = min(temp, ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
// atcoder/abc134/E/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

template<typename T>
vector<T> LIS(const T num[], const int size)
{
  const int inf = 1 << 28;
  T dp[size];
  int idx[size];
  int len = -inf;
  fill(dp, dp + size, inf);
  for (int i = 0; i < size; ++i) {
    idx[i] = upper_bound(dp, dp + size, num[i]) - dp;
    dp[idx[i]] = num[i];
  }
  len = *max_element(idx, idx + size);
  vector<T> result(len + 1);
  for (int i = 0; i < size; ++i) {
    if (idx[size - 1 - i] == len) {
      result[len--] = num[size - 1 - i];
    }
  }
  return result;
}

const int N = 100000 + 5;
int num[N];

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    for (int i = 0; i < n; ++i) {
      cin >> num[i];
      num[i] *= -1;
    }
    cout << LIS(num, n).size() << endl;
  }

  return 0;
}


Measured memory_bytes: 1792
import sys
input = sys.stdin.readline
N, M, Q = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(M)]
PQ = [list(map(int, input().split())) for _ in range(Q)]

#X[l][r]はlからrをちょうど走る電車の数
X = [[0 for _ in range(N+1)] for _ in range(N+1)]
for l, r in LR:
    X[l][r] += 1
cum = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(1, N+1):
    for j in range(1, N+1):
        cum[i][j] = cum[i][j-1] + X[i][j]

outputs = []
for p, q in PQ:
    ans = 0
    for i in range(p, q+1):
        ans += cum[i][q] - cum[i][p-1]
    outputs.append(ans)

print('\n'.join(map(str, outputs)))


Measured memory_bytes: 118408
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) {sort(all(a));a.erase(unique(all(a)),a.end());}
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

int main(){
    ll n;cin>>n;
    out(10-n/200);
}

Measured memory_bytes: 3588
// Created by Manmeet Singh Parmar
// name of snippet-> temp.sublime-snippet
// path -> sublime text 3/packages/user/temp.sublime-snippet

#include <cmath>
#include <iostream>
using namespace std;

int32_t main()
{
   	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n; cin >> n;
    int m; cin >> m;
    int sum =0;
    int a;
    for(int i=0; i<m; i++) {
    	cin >> a;
    	sum += a;
    }
    if(sum > n)
    	cout << "-1";
    else
    	cout << (n-sum);
    cout << '\n';
    return 0;
}

Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>

using namespace std;

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



int main() {
	

	int n;

	cin >> n;

	cout << n * n * n;

	return 0;
}


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

int main(){
  int k, s;
  cin >> k >> s;
  
  int cnt = 0;
  
  for(int a = 0; a <= k; a++){
    for(int b = 0; b <= k; b++){
      int S = s-a-b;
      if(0 <= S && S <= k)
        cnt++;
    }
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 256
s = input()
q = int(input())
query = [input().split() for _ in range(q)]

add_texts = ["", ""]
head = 0
for q_i in query:
    if q_i[0] == "1":
        head = ~head
    else:
        f, c = q_i[1:]
        if f == "1":
            add_texts[head] += c
        else:
            add_texts[~head] += c

text = add_texts[0][::-1] + s + add_texts[1]
print(text[::[1, -1][head]])

Measured memory_bytes: 40748
a, b, c = map(int, input().split())

if a < b:
    if a < c:
        if c < b:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    if b < c:
        if c < a:
            print('Yes')
        else:
            print('No')
    else:
        print('No')


Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int[] a = new int[m];
        int[] b = new int[m];
        boolean[][] graph = new boolean[n][n];
        boolean[] visited = new boolean[n];
        for (int i = 0; i < m; i++) {
            int aa = Integer.parseInt(sc.next());
            int bb = Integer.parseInt(sc.next());
            a[i] = aa - 1;
            b[i] = bb - 1;
            graph[a[i]][b[i]] = true;
            graph[b[i]][a[i]] = true;
        }
        int ans = 0;
        for (int i = 0; i < m; i++) {
            graph[a[i]][b[i]] = false;
            graph[b[i]][a[i]] = false;
            for (int j = 0; j < n; j++) {
                visited[j] = false;
            }
            dfs(n, 0, graph, visited);
            boolean bridge = false;
            for (int j = 0; j < n; j++) {
                if (!visited[j]) {
                    bridge = true;
                }
            }
            if (bridge) {
                ans++;
            }
            graph[a[i]][b[i]] = true;
            graph[b[i]][a[i]] = true;
        }
        System.out.println(ans);
    }

    private static void dfs(int n, int v, boolean[][] graph, boolean[] visited) {
        visited[v] = true;
        for (int i = 0; i < n; i++) {
            if (!graph[v][i]) {
                continue;
            }
            if (visited[i]) {
                continue;
            }
            dfs(n, i, graph, visited);
        }
    }
}

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

using namespace std;

const int P = 998244353;

template <typename T>
void add(T &x, T y) {
	x = (x + y) % P;
}

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

	string s;
	cin >> s;

	int K;
	cin >> K;

	while(!s.empty() && s.back() == '0') {
		s.pop_back();
	}

	while(!s.empty() && *s.begin() == '1') {
		s.erase(s.begin());
	}

	s += '0';

	int n = s.size();
	int cnt = 0;

	vector<int> black;

	for(int i = 0; i < n; ++i) {
		if(s[i] == '1') {
			cnt += 1;
		}
		if(s[i] == '0') {
			black.emplace_back(cnt);
			cnt = 0;
		}
	}

	int m = black.size();
	
	reverse(black.begin(), black.end());

	vector<vector<vector<long long> > > dp(n + 1, vector<vector<long long> > (n + 1, vector<long long> (n + 1, 0)));
	dp[0][0][0] = 1;

	int sum = 0;

	for(int i = 0; i < m; ++i) {
		for(int j = 0; j <= sum; ++j) {
			for(int k = 0; k <= sum; ++k) {
				for(int d = -j; d <= black[i]; ++d) {
					add(dp[i + 1][j + d][k + (d < 0 ? 0 : d)], dp[i][j][k]);
				}
			}
		}
		sum += black[i];
	}

	long long ans = 0;
	for(int i = 0; i <= min(K, sum); ++i) {
		add(ans, dp[m][0][i]);
	}

	cout << ans << '\n';

	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; cin >> n;
    bool a[n][n];
    FOR(i,0,n-1) FOR(j,0,n-1) cin >> a[i][j];

    const int mod = 1e9 + 7;

    ii v[(1<<n)-1];
    FOR(i,1,(1<<n)-1){
        v[i-1] = ii(__builtin_popcount(i)-1,i);
    }
    sort(v, v+(1<<n)-1);

    int dp[(1<<n)];
    dp[0] = 1;
    for(auto& e : v){
        int i = e.fi, x = e.sc;
        int y = x;
        dp[x] = 0;
        //cout << i << " " << x << endl;
        while (y) {
            int jj = y&-y, j = __builtin_ctz(jj);
            //cout << "dp " << x << " to " << (x & (~jj)) << endl;
            if (a[i][j]) dp[x] = (dp[x] + dp[x & (~jj)]) % mod;
            y -= jj;
        }
        //cout << "DP " << x << " = " << dp[x] << endl;
    }

    cout << dp[(1<<n)-1] << '\n';
}



Measured memory_bytes: 24832
#include <stdio.h>
#include <algorithm>
using namespace std;

int L[205];

int main(){
    int N;
    scanf("%d", &N);
    for(int i=0; i<2*N; i++) scanf("%d", &L[i]);
    sort(L, L+2*N);
    int res=0;
    for(int i=0; i<2*N; i+=2) res += L[i];
    printf("%d", res);
    return 0;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        var abx = Console.ReadLine().Split().Select(int.Parse).ToArray();
        double a = abx[0];
        double b = abx[1];
        double x = abx[2];
        x /= a;
        //
        double res;
        if (x >= a * b / 2) res = Calc(a, (a * b - x) * 2 / a);
        else res = Calc(x * 2 / b, b);
        Console.WriteLine(res);
    }
    //    　/|
    //   　/ |
    //  　/  | b
    // θ/___|
    //   a
    public static double Calc(double a, double b) => Atan(b / a) / PI * 180;
    
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
#define rep(i,l,r) for(ll i=l;i<=r;i++)

ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}
vector<vector<ll>> v1(100010);  //矢印の方向
vector<vector<ll>> v2(100010);  //矢印が入ってくる方向
vector<ll> retu2;
bool seen[100010];

void kiki(ll i){
    for(ll j=0;j<v1[i].size();j++){
        if(seen[v1[i][j]]==false){
            seen[v1[i][j]]=true;
            kiki(v1[i][j]);
        }
    }
    retu2.push_back(i);
}


int main(){
    ll n,m;cin>>n>>m;
    ll a[n+m-1],b[n+m-1];
    rep(i,0,n+m-1-1){
        cin>>a[i]>>b[i];
        v1[a[i]].push_back(b[i]);
        v2[b[i]].push_back(a[i]);
    }
    ll ne=0;
    rep(i,1,n){
        if(v2[i].size()==0){
            ne=i;
        }
    }
    kiki(ne);
    ll retu[n];
    ll ans[n+1];
    ll gya[n+1];
    rep(i,0,n-1){
        retu[i]=retu2[n-1-i];
        gya[retu[i]]=i;
    }
    ll r;
    ll maxi;
    rep(i,0,n-1){
        r=retu[i];
        if(v2[r].size()==0){
            ans[r]=0;
        }else if(v2[r].size()==1){
            ans[r]=v2[r][0];
        }else{
            maxi=-1;
            rep(j,0,v2[r].size()-1){
                maxi=max(maxi,gya[v2[r][j]]);
            }
            ans[r]=retu[maxi];
        }
    }
    rep(i,1,n){
        cout<<ans[i]<<endl;
    }
    
    
    return 0;
}


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

using namespace std;

namespace mod {

const int mod = 1000000007;

class MInt;
MInt Pow(const MInt &base, long long exp);
MInt Inv(const MInt &n);

class MInt {
  long long n_;
public:
  MInt() : n_(0) {}
  MInt(long long n) : n_((n % mod + mod) % mod) {}

  MInt& operator+=(const MInt &rhs) {
    n_ += rhs.n_;
    if (n_ >= mod) {
      n_ -= mod;
    }

    return *this;
  }
  
  MInt& operator-=(const MInt &rhs) {
    n_ += mod - rhs.n_;
    if (n_ >= mod) {
      n_ -= mod;
    }

    return *this;
  }

  MInt& operator*=(const MInt &rhs) {
    n_ = n_ * rhs.n_ % mod;
    return *this;
  }

  MInt& operator/=(const MInt &rhs) {
    return (*this) *= Inv(rhs);
  }

  long long Get() {
    return n_;
  }
};

MInt operator-(const MInt &lhs, const MInt &rhs) {
  MInt res(lhs);
  return res -= rhs;
}

MInt operator+(const MInt &lhs, const MInt &rhs) {
  MInt res(lhs);
  return res += rhs;
}

MInt operator*(const MInt &lhs, const MInt &rhs) {
  MInt res(lhs);
  return res *= rhs;
}

MInt operator/(const MInt &lhs, const MInt &rhs) {
  MInt res(lhs);
  return res /= rhs;
}

MInt Pow(const MInt &base, long long exp) {
  if (exp == 0) {
    return 1;
  }
  
  auto a = Pow(base, exp / 2);
  a *= a;
  if (exp % 2 == 1) {
    a *= base;
  }
  
  return a;
}

MInt Inv(const MInt &n) {
  return Pow(n, mod - 2);
}
}

int factorial(int n) {
  return n <= 1 ? 1 : factorial(n - 1) * n;
}

class BinCoef {
  vector<mod::MInt> f;
public:
  BinCoef(int n): f(n + 1) {
    f[0] = f[1] = 1;
    for (int i = 2; i <= n; i++) {
      f[i] = i * f[i - 1];
    }
  }

  mod::MInt NCM(int n, int m) {
    return f[n] * mod::Inv(f[m] * f[n - m]);
  }
};

int main(int argc, const char *argv[])
{
  int n, k;
  cin >> n >> k;
  k = min(k, n - 1);

  BinCoef bc(n);

  mod::MInt ans(0);
  for (int i = 0; i <= k; i++) {
    ans += bc.NCM(n, i) * bc.NCM(n - 1, i);
  }

  cout << ans.Get() << "\n";
}


Measured memory_bytes: 1792
from collections import Counter


n = int(input())
lst_v = list(map(int, input().split()))


if len(set(lst_v)) == 1:
    ans = n // 2
else:
    lst_odd = lst_v[::2]
    lst_even = lst_v[1::2]
    cnt_odd = sorted(Counter(lst_odd).items(), key=lambda x: -x[1])
    cnt_even = sorted(Counter(lst_even).items(), key=lambda x :-x[1])
    o1 = cnt_odd[0]
    e1 = cnt_even[0]

    if o1[0] == e1[0]:
        o2 = cnt_odd[1] if cnt_odd[1] else (0, 0)
        e2 = cnt_even[1] if cnt_even[1] else (0, 0)
        rem_number = max(o1[1] + e2[1], o2[1] + e1[1])
    else:
        rem_number = o1[1] + e1[1]
    sum_odd = sum(t[1] for t in cnt_odd)
    sum_even = sum(t[1] for t in cnt_even)
    ans = sum_odd + sum_even - rem_number


print(ans)


Measured memory_bytes: 21084
l = []
for i in range(5):
    l.append(int(input()))

dif = 0
ans = 0
for i in l:
    if i % 10 == 0:
        ans += i
    else:
        ans += i + (10 - i % 10)
        dif = max(dif, 10 - i % 10)
print(ans - dif)

Measured memory_bytes: 3060
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
template<typename A, size_t NNN, typename T>
void Fill(A (&array)[NNN], const T &val){
    fill( (T*)array, (T*)(array+NNN), val );
}
#define INF 1e9+7
#define LLINF 1e18+7
ll MOD=1e9+7;
#define N 3000000
ll n,m,k;
int a[100][100];
ll dp[100][100];
vec G[N];
ll b[100][100][100];
ll c[N];
ll ans[100][100][100];
int main(){
    n=in();
    k=lin();
    rep(i,n)rep(j,n){
        b[0][i][j]=in();
    }
    rep(ii,61){
        rep(i,n){
            rep(j,n){
                rep(kk,n){
                    if(b[ii][i][j]&&b[ii][j][kk]){
                        b[ii+1][i][kk]=(b[ii+1][i][kk]+b[ii][i][j]*b[ii][j][kk]%MOD)%MOD;

                    }
                }
            }
        }
    }
    rep(i,100)ans[0][i][i]=1;
    rep2(i,1,61){
        if(k&((ll)1<<(i-1))){
            rep(j,n){
                rep(kk,n){
                    rep(l,n){
                        ans[i][j][l]=(ans[i][j][l]+ans[i-1][j][kk]*b[i-1][kk][l]%MOD)%MOD;
                    }
                }
            }
        }
        else{
            rep(j,n)rep(l,n){
                ans[i][j][l]=ans[i-1][j][l];
            }
        }
    }
    ll sum=0;
    rep(i,n)rep(j,n){
        sum=(sum+ans[61][i][j])%MOD;
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 82048
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long modpow(long long n, int k) {
	long long r = 1;
	while (k > 0) {
		if (k&1) (r *= n) %= mod;
		(n *= n) %= mod;
		k >>= 1;
	}
	return r;
}
long long modinv(int n) {
	return modpow(n, mod-2);
}
vector<long long> fact;
int main() {
	int N, A, B, C;
	cin >> N >> A >> B >> C;

	fact = vector<long long>(2*N+10);
	fact[0] = 1;
	for (unsigned i = 1; i < fact.size(); ++ i) fact[i] = fact[i-1] * i % mod;

	long long p1 = A * modinv(A+B) % mod;
	long long p2 = B * modinv(A+B) % mod;
	long long sum1 = 0;
	long long sum2 = 0;
	for (int i = 0; i < N; ++ i) {
		long long c = fact[N-1+i] * modinv(fact[i]) % mod * modinv(fact[N-1]) % mod;
		long long x1 = modpow(p2, i) * c % mod;
		long long x2 = modpow(p1, i) * c % mod;
		(x1 *= N+i) %= mod;
		(x2 *= N+i) %= mod;
		(sum1 += x1) %= mod;
		(sum2 += x2) %= mod;
	}
	(sum1 *= modpow(p1, N)) %= mod;
	(sum2 *= modpow(p2, N)) %= mod;
	long long res = (sum1+sum2) % mod;
	res = res * 100 % mod * modinv(A+B) % mod;
	cout << res << endl;
}


Measured memory_bytes: 1920
import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
# MOD = 10 ** 9 + 7
MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    n = list(input())

    res = 0
    for s in n:
        res += int(s)
        res %= 9

    print("Yes" if res == 0 else "No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 10872
#include <iostream>
#include <map>
#include <set>
using namespace std;

int main(void) {
    int N;cin>>N;
    map<int, int> mp;
    for (int i = 1; i <= N; i++) {
        int a;cin>>a;
        mp[i] = a;
    }
    set<int> pushed_button;
    int cur = 1;
    int result = 0;
    while (true) {
        if (pushed_button.find(cur) != pushed_button.end()) {
            cout << -1 << endl;
            return 0;
        }
        pushed_button.insert(cur);
        cur = mp[cur];
        result++;
        if (cur == 2) {
            cout << result << endl;
            return 0;
        }
    }
    return 0;
}

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

#define ll long long
#define ld long double
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define int long long

using namespace std;
const int INF = 2e17;
const int MB = 20;
const int MOD = 1e9 + 7;

void solve() {
	int n, x, t;
	cin >> n >> x >> t;
	cout << (n + x - 1) / x * t;
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	//srand(time(0));
	int t = 1;
	//int t;
	//cin >> t;
	while (t--) solve();
}

Measured memory_bytes: 3620
macro_rules! input {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input!{$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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    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! {next,
        n: usize,
        m: usize,
    }
    if n % 2 == 1 {
        for i in 0..m {
            println!("{} {}", i+1, 2*m-i);
        }
    }
    else {
        let a = (m+1)/2;
        let b = m/2;
        for i in 0..a {
            println!("{} {}", i+1, 2*a-i);
        }
        for i in 0..m/2 {
            println!("{} {}", 2*a+i+1, 2*a+1+2*b-i);
        }
    }
}


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

int main() {
  int n; cin >> n;
  int l = 1, r = 99;
  bool ok = true;
  rrep(i,1000) {
    if (l <= n && n <= r) ok = false;
    l += 105;
    r += 100;
  }
  if (ok) cout << 1 << endl;
  else cout << 0 << endl;
}


Measured memory_bytes: 3644
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n, std::vector<long long> a){
    i64 xo = 0;
    for(int i = 0; i < n; ++i)
        xo ^= a[i];
    for(int i = 0; i < n; ++i)
        cout << (xo ^ a[i]) << " \n"[i == n - 1];
}


signed main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, std::move(a));
    return 0;
}


Measured memory_bytes: 4844
/*
How to lambda
  ex) sort(ALL(cont),[](dat a,dat b){return a.l<b.l;});
lower_bound/upper_bound
  1 2 2 2 3 3 
    ^lb   ^ub */
#include <bits/stdc++.h>
#define BR "\n"
#define REP(i,n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a,b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it,cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it,cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define assign_if_greater(V, T) V=max(V,T)
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
  cout << fixed << setprecision(15);
  int A,B,C;
  cin >> A >> B>>C;
  cout << min(C,B/A) <<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);


int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N,X,Y; cin>>N>>X>>Y;
    vector<ll> A(N+1,0);
    
    //     i                      j
    // 1-2-3-....-X-....-Y-....-(N-1)-N
    //            ^------^
    
    rep1(i,N-1)FOR(j,i+1,N+1){
        //i<j
        
        //最短距離
        ll tmp=min(j-i,abs(i-X)+1+abs(j-Y));
        A[tmp]++;
    }
    rep1(i,N-1){
        cout<<A[i]<<endl;
    }
}



Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();
        long k = in.nextLong();
        long aConsumed = Math.min(a, k);
        long bConsumed = Math.min(b, k-aConsumed);
        System.out.print(a-aConsumed);
        System.out.print(' ');
        System.out.print(b-bConsumed);
        System.out.println();
    }
}


Measured memory_bytes: 24020
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
const double Pi=acos(-1.0);
#define cp complex<double>
inline ll read()
{
	ll x=0,w=0;char ch=getchar();
	while(!isdigit(ch))w|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w?-x:x;
}
int r[400000],len,sz=-1;
void fft(cp *a,double fl)
{
	for(reg int i=0;i<len;++i)if(i<r[i]) swap(a[r[i]],a[i]);
	for(reg int l=2;l<=len;l<<=1)
	{
		int m=l>>1;cp wn(cos(Pi/m),fl*sin(Pi/m));
		for(int p=0;p<len;p+=l)
		{
			cp w(1,0);
			for(reg int i=0;i<m;++i,w*=wn)
			{
				cp t=w*a[i+m+p],j=a[i+p];
				a[i+p]=j+t,a[i+p+m]=j-t;
			}
		}
	}
}
ll n,a[300005],b[300005];
cp A[400000];
ll m;
int main()
{
    n=read(),m=read();reg int i;
    for(i=1;i<=n;++i)a[i]=read();
    len=1;while(len<200000)len<<=1,++sz;
    for(i=0;i<len;++i)r[i]=r[i>>1]>>1|((i&1)<<sz);
    for(i=1;i<=n;++i)b[a[i]]++;
    for(i=0;i<len;++i)A[i]=cp(b[i],0);
    fft(A,1.0);
    for(i=0;i<len;++i)A[i]*=A[i];
    fft(A,-1.0);
    for(i=len-1;i>=0;--i)a[i]=(ll)(A[i].real()/len+0.5);
    reg ll t;reg ll ans=0;
    for(i=len-1;i>=0;--i)
    {
        t=min(m,a[i]);
        ans+=1ll*t*i;
        m-=t;
    }cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 12800
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#define int long long
using namespace std;
signed main() {
	char A,B;
    cin>>A>>B;

    if(A=='H'&&B=='H'){
        cout<<'H'<<endl;
    }
    else if(A=='D'&&B=='H'){
        cout<<'D'<<endl;
    }
    else if(A=='D'&&B=='D'){
        cout<<'H'<<endl;
    }
    else{
        cout<<'D'<<endl;
    }
}

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N;
  cin >> N;
  int a;
  map<int, int> count;
  REP(i, N) {
    cin >> a;
    if (count.find(a - 1) == count.end()) {
      count.insert(make_pair((a - 1), 1));
    } else {
      ++count.at(a - 1);
    }

    if (count.find(a) == count.end()) {
      count.insert(make_pair((a), 1));
    } else {
      ++count.at(a);
    }

    if (count.find(a + 1) == count.end()) {
      count.insert(make_pair((a + 1), 1));
    } else {
      ++count.at(a + 1);
    }
  }

  int max_count = 0;
  for (auto const &it : count) {
    max_count = max(max_count, it.second);
  }

  cout << max_count << endl;

  return 0;
}


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

const int INF = 1001001001;

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

    vector<int> a(n);
    rep(i,n){
        cin>>a[i];
    }
    int gap = (n-(n-k+1))/2-1;
    rep(i,n-k){
        if(a[i]<a[i+k]){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }

    return 0;
}


Measured memory_bytes: 4048
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{
    int N;
    cin >> N;
    int d[N];
    for (int i = 0; i < N; i++)
    {
        cin >> d[i];
    }
    long res = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            res += d[i] * d[j];
        }
    }
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 256