akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> v(H);
    for (int i = 0; i < H; i++) cin >> v[i];
    vector<int> R(H), C(W);
    int sum = 0;
    for (int i = 0; i < H; i++)
        for (int j = 0; j < W; j++)
            if (v[i][j] == '#') sum++;

    for (int i = 0; i < H; i++)
        for (int j = 0; j < W; j++)
            if (v[i][j] == '#') R[i]++;
    for (int i = 0; i < W; i++)
        for (int j = 0; j < H; j++)
            if (v[j][i] == '#') C[i]++;

    int ans = 0;
    for (int b1 = 0; b1 < (1 << H); b1++) {
        for (int b2 = 0; b2 < (1 << W); b2++) {
            vector<int> r, c;
            for (int i = 0; i < H; i++) if ((b1 >> i) & 1) r.push_back(i);
            for (int i = 0; i < W; i++) if ((b2 >> i) & 1) c.push_back(i);
            int tmp = sum;
            for (int ri : r) tmp -= R[ri];
            for (int ci : c) tmp -= C[ci];
            for (int ri : r) {
                for (int ci : c) {
                    if (v[ri][ci] == '#') tmp++;
                }
            }
            if (tmp == K) ans++;
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3600
import collections
import sys
n=int(input())
a=list(map(int,input().split()))
b=list(collections.Counter(a).items())
b.sort(key=lambda x:int(x[0]))
if len(b)==1:
  print(n)
  sys.exit()
lst=[]
num=b[0][1]
if int(b[1][0])-int(b[0][0])==1:
  num+=b[1][1]
lst.append(num)
for i in range(1,len(b)-1):
  num=b[i][1]
  if int(b[i+1][0])-int(b[i][0])==1:
    num+=b[i+1][1]
  if int(b[i][0])-int(b[i-1][0])==1:
    num+=b[i-1][1]
  lst.append(num)
num=b[len(b)-1][1]
if int(b[len(b)-1][0])-int(b[len(b)-2][0])==1:
  num+=b[len(b)-2][1]
lst.append(num)
print(max(lst)) 

Measured memory_bytes: 63980
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const double INF = 3 * (1e9) ;
bool taken[MAXN];
double d[MAXN];

struct point{
    long long x, y, r;
} p[MAXN];

double dist(point a, point b)
{
    return max(0.0, sqrt(double((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y))) - double(a.r + b.r));
}

int main()
{
    cin >> p[0].x >> p[0].y >> p[1].x >> p[1].y;
    p[0].r = p[1].r = 0;
   // cout << p[0].r << p[1].r << endl;
    int N;
    cin >> N;
    for (int i = 2; i < N+2; i++)
    {
        cin >> p[i].x >> p[i].y >> p[i].r;
    }

    d[0] = 0;
    for (int i = 1; i < N+2; i++)
        d[i] = INF;

  //  cout << setprecision(10) << INF;

    int v = 0;
    while(v != 1)
    {
        taken[v] = true;
        int minidx = 1;
        for (int i = 1; i < N+2; i++)
        {
            if (!taken[i])
            {
                d[i] = min(d[i], d[v] + dist(p[i], p[v]));
                if (d[i] < d[minidx])
                    minidx = i;
            }
        }
        v = minidx;
       // cout << v << " " << d[v] << endl;
    }
    cout << setprecision(12) << d[1];
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

use std::collections::{BinaryHeap};

#[derive(Debug, Copy, Clone)]
struct State {
    cost: u32,
    x: usize,
    y: usize,
}

impl Ord for State {
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        other.cost.cmp(&self.cost)
    }
}

impl PartialOrd for State {
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}

impl PartialEq for State {
    fn eq(&self, other: &Self) -> bool {
        self.cost == other.cost
    }
}

impl Eq for State {}

fn main() {
    input!{
        h: usize,
        w: usize,
        cell: [chars; h],
    };

    let mut visited = vec![vec![false; w]; h];
    visited[0][0] = true;

    let mut heap = {
        let mut heap = BinaryHeap::new();
        heap.push(State {
            cost: 0,
            x: 0,
            y: 0,
        });
        heap
    };
    let mut c = if cell[0][0] == '#' && cell[h-1][w-1] == '#' {1} else {0};
    while let Some(s) = heap.pop() {
        let mut a = s.clone();
        if s.x + 1 < w {
            a.x += 1;
            if cell[s.y][s.x] != cell[a.y][a.x] {
                a.cost += 1;
            }
            if (a.x + 1, a.y + 1) == (w, h) {
                c += a.cost;
                break;
            } else if !visited[a.y][a.x] {
                heap.push(a);
                visited[a.y][a.x] = true;
            }
        }
        let mut a = s.clone();
        if s.y + 1 < h {
            a.y += 1;
            if cell[s.y][s.x] != cell[a.y][a.x] {
                a.cost += 1;
            }
            if (a.x + 1, a.y + 1) == (w, h) {
                c += a.cost;
                break;
            } else if !visited[a.y][a.x] {
                heap.push(a);
                visited[a.y][a.x] = true;
            }
        }
    }
    println!("{}", (c + 1) / 2);
}


Measured memory_bytes: 4352
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

// template version 2.0
using namespace std;
#include <bits/stdc++.h>

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T> inline void chmax(T &a, const T &b) { if ((a) < (b)) (a) = (b); }
template <class T> inline void chmin(T &a, const T &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define divceil(a, b) ((a) + (b)-1) / (b)
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


int solve() {
    ll h1, m1, h2, m2, k;cin>>h1>>m1>>h2>>m2>>k;

    ll d = (h2 - h1) * 60;
    d += m2 - m1;
    cout << d - k << endl;

    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


Measured memory_bytes: 3616
/* Author: Dhruv Rastogi */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<int, int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int> 
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
const long double PI = acos(-1.0);

void solve(){  
	int n;
	cin>>n;
	vector<pair<int,int> > v;
	for(int i=2;i*i<=n;++i){
		int cnt=0;
		while(n%i==0){
			++cnt;
			n/=i;
		}
		if(cnt){
			v.pb(mp(i,cnt));
		}
	}
	if(n!=1){
		v.pb(mp(n,1));
	}
	int ans=0;
	for(auto i:v){

		int cur=0;
		int op=0;
		while(cur<=i.S){
			cur+=op+1;
			++op;
		}
		ans+=op-1;
	}
	cout<<ans<<endl;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3684
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using P = pair<ll,ll>;
using um = unordered_map<ll,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=(ll)1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll D;
    cin >> D;
    vector<ll> X(N,0);
    vector<ll> Y(N,0);
    for(ll i=0;i<N;++i)cin>>X[i]>>Y[i];
    ll ans=0;
    for(ll i=0;i<N;++i){
        if(X[i]*X[i]+Y[i]*Y[i]<=D*D)ans++;
    }
    prt(ans);

    return 0;
}



Measured memory_bytes: 6360
from functools import reduce
import math

def main():
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input().rstrip())
    f = math.factorial(N)
    print(f%(10**9+7))
    
if __name__ == '__main__':
    main()


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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int dp[200001] = {};

int dfs(int n){
    if(n == 0) return dp[0] = 0;
    else if(dp[n] != 0) return dp[n];
    int p = __builtin_popcount(n);
    return dp[n] = dfs(n%p) + 1;
}

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    string X; cin >> X;
    for(int i = 1; i <= 200000; i++){
        dfs(i);
    }
    int pow2[2][N+1];
    int k = 0;
    rep(i, N){
        if(X[i] == '1') k++;
    }
    pow2[0][0] = 1;
    pow2[1][0] = 1;
    if(k > 1) for(int i = 1; i <= N; i++) pow2[0][i] = pow2[0][i-1]*2 % (k-1);
    for(int i = 1; i <= N; i++) pow2[1][i] = pow2[1][i-1]*2 % (k+1);
    vector<int> after(N);
    int md1 = 0, md2 = 0;
    reverse(X.begin(), X.end());
    if(k > 1) rep(i, N) md1 = (md1 + pow2[0][i]*(X[i] == '1')) % (k-1);
    rep(i, N) md2 = (md2 + pow2[1][i]*(X[i] == '1')) % (k+1);
    rep(i, N){
        if(X[i] == '0'){
            after[N-1 - i] = (md2 + pow2[1][i]) % (k+1);
        }
        else if(k > 1){
            int temp = (md1 - pow2[0][i]) % (k-1);
            if(temp < 0) temp += (k-1);
            after[N-1 - i] = temp;
        }
        else after[N-1 - i] = -1;
    }
    rep(i, N){
        if(after[i] != -1) cout << dp[after[i]] + 1 << endl;
        else cout << 0 << endl;
    }
    return 0;
}

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

using namespace std;

int main() {

int a,b,s=0;
cin>>a>>b;
if(a==b)
{
    cout<<a+b;
    return 0;
}
s=s+max(a,b);
if(a>b)
{
    a--;
}
else{
    b--;
}
if(a==b)
{
    s=s+a;
    cout<<s;
    return 0;
}
s=s+max(a,b);
cout<<s;


}


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

using namespace std;
long long MOD = 1000000007LL;

int main() {
	int X;
	cin >> X;
	for (int i = 0; i <= X / 100; ++i) {
		if (i * 100 <= X && X <= i * 105) {
			cout << 1 << endl;
			return 0;
		}
	}

	cout << 0 << endl;

	return 0;
}

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

int main()
{
  int n, t; cin >> n >> t;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  ll ans = t;
  for (int i=1; i<n; i++) {
    ll d = a[i] - a[i-1];
    if (d <= t) ans += d;
    else ans += t;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FI first
#define SE second
#define PB push_back
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define co(i) cout<<(i)<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
#define all(i) i.begin(),i.end()
using namespace std;

const int INF=1e9+7;
const int MOD=1e9+7;

int main(){
    int n; cin>>n;
    string s,t;
    map<string,int> m;
    cin>>s;
    m[s]++;
    bool flag=true;
    FOR(i,1,n){
        cin>>t;
        if(m[t]>0) flag=false;
        m[t]++;
        if(s[s.size()-1]!=t[0]) flag=false;
        s=t;
    }
    Yes(flag);
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#define N 1020
using namespace std;

const int d[4][2] = 
{
    {0, 1},
    {1, 0},
    {-1, 0},
    {0, -1},
};

int n;
char a[N][N];

void Place(int x, int y, int p, int q)
{
    bool u[26] = { 0 };
    int i, s, t;

    for(i = 0; i < 4; i ++)
    {
        s = x + d[i][0];
        t = y + d[i][1];
        if(s > -1 && t > -1 && s < n && t < n && a[s][t] != '.')
            u[a[s][t] - 97] = true;

        s = p + d[i][0];
        t = q + d[i][1];
        if(s > -1 && t > -1 && s < n && t < n && a[s][t] != '.')
            u[a[s][t] - 97] = true;
    }

    for(i = 0; i < 26; i ++)
        if(!u[i])
            break;
    a[x][y] = a[p][q] = i + 97;

    return;
}

int main(void)
{
    int i, j;

    scanf("%d", &n);
    if(n == 2)
    {
        printf("-1\n");

        return 0;
    }

    for(i = 0; i < n; i ++)
        for(j = 0; j < n; j ++)
            a[i][j] = '.';
    if(n == 4)
    {
        Place(0, 0, 0, 1);
        Place(1, 0, 1, 1);
        Place(0, 2, 1, 2);
        Place(0, 3, 1, 3);
        Place(2, 2, 2, 3);
        Place(3, 2, 3, 3);
        Place(2, 0, 3, 0);
        Place(2, 1, 3, 1);
    }
    else
    {
        Place(0, 0, 0, 1);
        Place(n - 1, n - 1, n - 2, n - 1);
        for(i = 0; i < n - 2; i ++)
            Place(n - 2 - i, i, n - 2 - i - 1, i);
        for(i = 0; i < n - 3; i ++)
            Place(n - 3 - i, i + 2, n - 3 - i, i + 3);
        Place(0, n - 1, 0, n - 2);
        Place(n - 1, 0, n - 1, 1);
        Place(n - 1, 2, n - 2, 2);
    }

    for(i = 0; i < n; i ++)
        puts(a[i]);

    return 0;
}


Measured memory_bytes: 2176
S=input()
T=input()
from collections import defaultdict
ds = defaultdict(str)
dt = defaultdict(str)
for s,t in zip(S,T):
  if ds[s]=='' or ds[s]==t:
    ds[s]=t
  else:
    print('No')
    exit(0)
  if dt[t]=='' or dt[t]==s:
    dt[t]=s
  else:
    print('No')
    exit(0)
print('Yes')

Measured memory_bytes: 3772
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){ 
    string S;
    cin >>S;
    int S1[4];
    for(int i = 0;i < 4;i++){
        for(int j = 0;j < 10;j++){
            if(S[i] == '0' + j) S1[i] = j;
        }
    }
    int A = S1[0] * 10 + S1[1],B = S1[2]*10+S1[3];
    if(1 <= B && B <= 12){
        if(1 <= A && A <= 12)cout << "AMBIGUOUS" << endl;
        else cout << "YYMM" << endl;
    }else{
        if(1 <= A && A <= 12)cout << "MMYY" << endl;
        else cout << "NA" << endl;
    }

}   

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

void solve(long long N, vector<long long> p){
	vector<int> a(N), b(N);
	for(int i= 0; i < N; ++i) {
		a[i] = i * N;
		b[i] = (N - i - 1) * N;
	}
	for(int i = 0; i < N; ++i) {
		a[p[i] - 1] += i + 1;
		b[p[i] - 1] += i + 1;
	}
	for(int i = 0; i < N; ++i) {
		cout << a[i] << (i == N - 1 ? "\n" : " ");
	}
	for(int i = 0; i < N; ++i) {
		cout << b[i] << (i == N - 1 ? "\n" : " ");
	}
}

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> p(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&p[i]);
	}
	solve(N, p);
	return 0;
}



Measured memory_bytes: 1152
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <string>
#include <random>
#include <map>
#pragma warning(disable : 4996)

int abs(int a) {
	if (a < 0) return -1 * a;
	return a;
}

int main(void) {
	std::vector<int> A;
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		int a;
		scanf("%d", &a);
		A.push_back(a);
	}
	std::sort(A.begin(), A.end());
	int index = 0;
	int num = 0;
	if (n % 2 == 1) {
		if (A[index++] != num) {
			printf("0\n");
			return 0;
		}
		num += 2;
	}
	else {
		num = 1;
	}
	int c = 1;
	for (int i = 0; i < n / 2; ++i) {
		if ((A[index++] != num) || (A[index++] != num)) {
			printf("0\n");
			return 0;
		}
		num += 2;
		c = (c * 2) % 1000000007;
	}
	printf("%d\n", c);
	return 0;
}


Measured memory_bytes: 892
N, A, B = map(int, input().split())
L = [0, 0]
S = input()

for i in S:
    if i == "a":
        if sum(L) < A + B:
            print("Yes")
            L[0] += 1
        else:
            print("No")
    elif i == "b":
        if sum(L) < A + B and L[1] < B:
            print("Yes")
            L[1] += 1
        else:
            print("No")
    else:
        print("No")


Measured memory_bytes: 4016
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int m = (int) Math.sqrt(1 + 8 * N);

        if (m * m != 1 + 8 * N) {
            System.out.println("No");
            return;
        }

        if (1 + m % 2 == 1) {
            System.out.println("No");
            return;
        }

        System.out.println("Yes");

        int k = (1 + m) / 2;
        System.out.println(k);

        int[][] mattix = new int[k][k];

        int cnt = 1;
        for (int i = 0; i < k; i++) {
            for (int j = 0; j < k; j++) {
                if (i >= j) continue;
                mattix[i][j] = cnt;
                mattix[j][i] = cnt;
                cnt++;
            }
        }

        for (int i = 0; i < k; i++) {
            System.out.print(k-1);
            System.out.print(" ");
            int printedCnt = 0;

            for (int j = 0; j < k; j++) {
                if (i == j) continue;
                System.out.print(mattix[i][j]);
                printedCnt++;

                if (printedCnt != k - 1) {
                    System.out.print(" ");
                }

            }

            System.out.print("\n");
        }
    }
}

Measured memory_bytes: 68892
import java.util.Scanner;
public class Main {
 public static void main(String[] args) {
  Scanner sc=new Scanner(System.in);
  int N=sc.nextInt();
  int hm [][]=new int[200][5];
  for(int i=0;i<N;i++){
   for(int k=0;k<3;k++){
    hm[i][k]=sc.nextInt();
   }
  }
  for(int c=0;c<N;c++){
   hm[c][3]=0;
  }
  for(int j=0;j<3;j++){
   for(int a=0;a<N;a++){
	hm[a][4]=0;
    for(int b=0;b<N;b++){
     if(a!=b && hm[a][j]==hm[b][j]){
      hm[a][4]=1;
     }
    }
    if(hm[a][4]==0){
     hm[a][3]=hm[a][3]+hm[a][j];
    }
   }
  }
  for(int d=0;d<N;d++){
	  System.out.println(hm[d][3]);
  }
 }
}

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

int main() {
    int a,b;
    cin >> a >> b;
    if(a%3 == 0 || b%3 == 0 || (a+b)%3 == 0){
        cout << "Possible";
    } else {
        cout << "Impossible";
    }
}


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

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);
static const ll MOD = 1000000007;

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

ll calc_score(long long D, const std::vector<long long> &c, const std::vector<std::vector<long long>> &s,
              const std::vector<long long> &t) {
  vector<ll> last(26, 0);
  ll score = 0;
  REP(d, D) {
    ll i = t[d] - 1;
    score += s[d][i];
    last[i] = d + 1;
    REP(j, 26) {
      score -= c[j] * (d + 1 - last[j]);
    }
  }
  return score;
}

ll calc_diff(ll D, ll pre, ll next, const std::vector<long long> &c, const std::vector<std::vector<long long>> &s, ll d,
             std::vector<long long> &t) {
  ll diff = s[d - 1][next] - s[d - 1][pre];
  {
    ll l = 0;
    FOR(i, 1, d) {
      if (t[i - 1] - 1 == next) {
        l = i;
      }
    }
    ll r = D + 1;
    FOR(i, d + 1, D + 1) {
      if (t[i - 1] - 1 == next) {
        r = i;
        break;
      }
    }
    ll x = r - d;
    ll y = d - l;
    diff += c[next] * x * y;
  }
  {
    ll l = 0;
    FOR(i, 1, d) {
      if (t[i - 1] - 1 == pre) {
        l = i;
      }
    }
    ll r = D + 1;
    FOR(i, d + 1, D + 1) {
      if (t[i - 1] - 1 == pre) {
        r = i;
        break;
      }
    }
    ll x = r - d;
    ll y = d - l;
    diff -= c[pre] * x * y;
  }
  return diff;
}

void solve(long long D, std::vector<long long> c, std::vector<std::vector<long long>> s, std::vector<long long> t,
           long long M, std::vector<long long> d, std::vector<long long> q) {
  ll score = calc_score(D, c, s, t);
  REP(i, M) {
    ll pre = t[d[i] - 1] - 1;
    ll next = q[i] - 1;
    t[d[i] - 1] = next + 1;

    score += calc_diff(D, pre, next, c, s, d[i], t);
    printf("%lld\n", score);
  }
}

int main() {
  long long D;
  scanf("%lld", &D);
  std::vector<long long> c(26);
  for (int i = 0; i < 26; i++) {
    scanf("%lld", &c[i]);
  }
  std::vector<std::vector<long long>> s(D, std::vector<long long>(26));
  for (int i = 0; i < D; i++) {
    for (int j = 0; j < 26; j++) {
      scanf("%lld", &s[i][j]);
    }
  }
  std::vector<long long> t(D);
  for (int i = 0; i < D; i++) {
    scanf("%lld", &t[i]);
  }
  long long M;
  scanf("%lld", &M);
  std::vector<long long> d(M);
  std::vector<long long> q(M);
  for (int i = 0; i < M; i++) {
    scanf("%lld", &d[i]);
    scanf("%lld", &q[i]);
  }
  solve(D, std::move(c), std::move(s), std::move(t), M, std::move(d), std::move(q));
  return 0;
}

Measured memory_bytes: 4700
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int K; cin >> K;
    int A, B; cin >> A >> B;
    for (int i = A; i <= B; i++) {
        if (i % K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
typedef long long ll;
//必要な宣言
#define MAX 100000

//問題をよく読もう！
//論理的に考えよう！
//サンプルを確認しよう!
//絶対に諦めるな！
//工夫をしろ！
int main() {
  char a, b;
  cin >> a >> b;

  if(a == 'H' && b == 'H') {
    cout << 'H' << endl;
  }
  else if(a == 'H') {
    cout << 'D' << endl;
  }
  else if(b == 'H'){
    cout << 'D' << endl;
  }
  else {
    cout << 'H' << endl;
  }

  return 0;
}


Measured memory_bytes: 256
from itertools import permutations

n = int(input())
prr = list(map(int, input().split()))
qrr = list(map(int, input().split()))

arr = list(permutations(prr))
arr.sort()
for i in range(len(arr)):
    arr[i] = list(arr[i])

ans = arr.index(prr) - arr.index(qrr)
print(abs(ans))


Measured memory_bytes: 12276
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	string str;
	cin >> str;

	for(int i=0 ; i<26 ; i++)
	{
	   if(str.find(char(i+'a')) == string::npos)
	   {
	       cout << char(i+'a');
	       return 0;
	   }
	}

	cout << "None";
	return 0;
}

Measured memory_bytes: 512
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#define LL long long
using namespace std;
LL C[3010][3010],S[3010][3010];
LL n,p;
void pre()
{
	for(LL i=0;i<=3001;i++)
	{
		C[i][0]=1;
		for(LL j=1;j<=i;j++) C[i][j]=(C[i-1][j]+C[i-1][j-1])%p;
	}
	S[0][0]=1;
	for(LL i=1;i<=3001;i++)
	{
		S[i][1]=1;
		for(LL j=2;j<=i;j++) S[i][j]=(S[i-1][j]*j%p+S[i-1][j-1])%p;
	}
}
LL pow(LL a,LL b,LL mod)
{
	LL ans=1;
	while(b)
	{
		if(b&1) ans=ans*a%mod;
		a=a*a%mod;b>>=1;
	}
	return ans;
}
int main()
{
	LL ans=0;scanf("%lld %lld",&n,&p);
	pre();
	for(LL i=0;i<=n;i++)
	{
		LL s=C[n][i]*pow(2,pow(2,n-i,p-1),p)%p;
		LL tot=0;
		for(LL j=0;j<=i;j++) tot=(tot+pow(2,(n-i)*j%(p-1),p)*S[i+1][j+1]%p)%p;
		ans=(ans+(i&1?-1:1)*s%p*tot%p)%p;
	}
	printf("%lld",(ans+p)%p);
}

Measured memory_bytes: 139904
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#define int128 __int128
#else
#define int128 long long
#endif

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));

ll mod = 1e9 + 7;

namespace {
	ll mul(ll a, ll b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) val += mod;
		if (val >= mod) val -= mod;
		return val;
	}
	ll poww(ll a, ll b) {
		ll val = 1;
		a %= mod;
		while (b > 0) {
			if (b % 2) val = mul(a, val);
			a = mul(a, a);
			b >>= 1;
		}
		return val % mod;
	}
	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

ll const maxn = 3e5 + 5;


signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	ll n; cin >> n;
	unordered_set<string> st;
	for (ll i = 0; i < n; i++) {
		string s; cin >> s;
		st.insert(s);
	}
	cout << st.size() << endl;
	return 0;
}

/*

*/

Measured memory_bytes: 17716
#include <iostream>
#include <string>

using namespace std;


class B {
	string s;

public:
	void solve()
	{
		cin >> s;

		cout << s.front() << s.length() - 2 << s.back() << endl;
	}

};

int main()
{
	B solution;
	solution.solve();
	return 0;
}

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

static const int INF = 2147483647;
static const int NIL = -1;
static const int MOD = 1000000007;
typedef long long ll;
typedef pair<int,int> P;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define int ll 

static const int MAX_N = 200;

struct edge {int to,cost;};
vector<edge> G[MAX_N];
int d[MAX_N][MAX_N];
int N;

void warshall_floyd(){
    for(int k=0;k<N;k++){
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++) d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
        }
    }
}

signed main(){
    int m,r;
    scanf("%lld %lld %lld",&N,&m,&r);

    vector<int> disti;

    for(int i=0;i<r;i++){
        int tmp;
        scanf("%lld",&tmp);
        disti.pb (tmp-1);
    }

    sort(all(disti));

    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            d[i][j] = INF;
        }
    }

    for(int i=0;i<m;i++){
        int s,t,l;
        scanf("%lld %lld %lld",&s,&t,&l);
        d[s-1][t-1] = d[t-1][s-1] = l;
    }

    warshall_floyd();

    int ans=INF;

    while(np(all(disti))){
        int kyori=0;
        for(int i=0;i<disti.size()-1;i++){
            kyori += d[disti[i]][disti[i+1]];
        }
        if(kyori<ans) ans = kyori;
    }

    printf("%lld\n",ans);
}

Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func max(nums []int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func min(nums []int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	s := nextMega()
	cnt := make([]int, 3)
	for i := range s {
		cnt[s[i]-'a']++
	}

	ok := true
	if max(cnt)-min(cnt) > 1 {
		ok = false
	}
	if ok {
		puts("YES")
	} else {
		puts("NO")
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<queue>
using namespace std;

// 1度の操作で葉を選べば直径が1減り、葉以外を選べば直径が2減る
// よってmod3の世界で考えれば良く、mod3==1で自分に手番が回ってきた
// 時に確実に負けるので、初期状態で木の直径のmod3==1なら先手の負け、
// それ以外なら先手の勝ち

int main(){
    int n;
    cin >> n;
    vector<int> v[n];
    int a, b;
    for(int i = 1; i < n; i++){
        cin >> a >> b;
        a--, b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    queue<int> q;
    q.push(0);
    int x;
    vector<bool> visit(n, 0);
    while(!q.empty()){
        int i = q.front();  q.pop();
        if(visit[i])    continue;
        visit[i] = true;
        x = i;
        for(int next : v[i]){
            if(!visit[next]){
                q.push(next);
            }
        }
    }
    queue<pair<int,int>> pq;
    pq.push({x,0});
    for(int i = 0; i < n; i++)  visit[i] = 0;
    int diam;
    while(!pq.empty()){
        auto p = pq.front();    pq.pop();
        int i = p.first, j = p.second;
        if(visit[i])    continue;
        visit[i] = true;
        diam = j;
        for(int next : v[i]){
            if(!visit[next]){
                pq.push({next, j+1});
            }
        }
    }
    cout << (diam%3 == 1 ? "Second" : "First") << endl;
    return 0;
}

Measured memory_bytes: 13684
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long;
using P = pair<int, int>;
using lP = pair<ll, ll>;
using fP = pair<double, double>;
ll const mod = 998244353;
const ll MAX = 300000;

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>>a(h, vector<char>(w));
    rep(i, h)rep(j, w)cin >> a[i][j];
    vector<int>row, line;
    bool ok = true;
    rep(i, h) {
        ok = true;
        rep(j, w) {
            if (a[i][j] == '#') {
                ok = false;
                break;
            }
        }
        if (ok)row.push_back(i);
    }
    rep(j, w) {
        ok = true;
        rep(i, h) {
            if (a[i][j] == '#') {
                ok = false;
                break;
            }
        }
        if (ok)line.push_back(j);
    }
    sort(row.begin(), row.end());
    sort(line.begin(), line.end());
    int ii = 0, ij = 0;
    rep(i, h) {
        if (ii < row.size() && i == row[ii]) {
            ii++;
            continue;
        }
        ij = 0;
        rep(j, w) {
            if (ij < line.size() && j == line[ij]) {
                ij++;
                continue;
            }
            cout << a[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <unordered_map>
using namespace std;


int main(){
    int n;
    cin >> n;
    int h[n];
    for (int i = 0; i < n; i++){
        cin >> h[i];
    }
    int answer = 0;
    for (int i = 1; i <= *max_element(h, h + n); i++){
        bool start = false;
        for (int j = 0; j < n; j++){
            if (h[j] >= i){
                start = true;
            }
            else if (start){
                start = false;
                answer++;
            }
        }
       if (start){
            answer++;
        }
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
while True:
  h, w = map(int, input().split())
  if h + w == 0: break
  for i in range(h):
    if i % 2 == 0:
      print(''.join(['#' if j % 2 == 0 else '.' for j in range(w)]))
    else:
      print(''.join(['.' if j % 2 == 0 else '#' for j in range(w)]))
  print('')


Measured memory_bytes: 5624
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define Rep(i,n) for (int i = (int)(n); i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define rever(vec) reverse(all(vec));
#define cend cout << endl;
#define prique(T) priority_queue<T,vector<T>,greater<T>>
struct edge { int to, cost; };
typedef pair<int, int> P;
const int mod = 1e9 + 7, inf = 1e16;

int modpow(int x, int n) {
	if (n == 0) return 1;
	if (n % 2) return (x * modpow(x * x % mod, n / 2) % mod + mod) % mod;
	return (modpow(x * x % mod, n / 2) + mod) % mod;
}

int fact(int n) {
	int ans = 1;
	rep(i, n) {
		ans *= (i + 1);
		ans %= mod;
	}
	return (ans + mod) % mod;
}

int comb(int n, int r) {
	if (n < r) swap(n, r);
	if (n - r < r) r = n - r;
	return fact(n) * modpow(fact(n - r), mod - 2) % mod * modpow(fact(r), mod - 2) % mod;
}

int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

template <typename T>
void greater_sort(vector<T>& vec) {
	sort(all(vec), greater<T>());
	return;
}

int n;
char c[2][62];
int w;
int ans = 1;

signed main() {
	cin >> n;
	w = 0;
	rep(i, 2) {
		rep(j, n) {
			cin >> c[i][j];
		}
	}
	if (n == 1) {
		cout << 3 << endl;
		return 0;
	}
	while (w < n) {
        if (w == n - 1) {
            if(c[0][w] == c[1][w]) {
                if(c[0][w - 1] == c[1][w - 1]) {
                    ans *= 2;
                    ans %= mod;
                    break;
                }
                else break;
            }
        }
		else if (c[0][w] == c[0][w + 1]) {
			if (w == 0) {
				ans = 6;
			}
			else {
				if (c[0][w - 1] == c[1][w - 1]) {
					ans *= 2;
				}
				else {
					ans *= 3;
				}
			}
			ans %= mod;
			w += 2;
		}
		else {
			if (w == 0) {
				ans = 3;
			}
			else {
				if (c[0][w - 1] == c[1][w - 1]) {
					ans *= 2;
					ans %= mod;
				}
			}
			w++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
	bool operator<(const P &b) { return cost < b.cost; }
	bool operator>(const P &b) { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) { return cost < b.cost; }
	bool operator>(const E &b) { return cost > b.cost; }
};
struct H {
	ll x, y;
	bool operator<(const H &b) {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) { return (*this) != b; }
};
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ld mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int a[200000];
int b[200000];
signed main() {
	int n, m;
	cin >> m >> n;
	if (m >= n) {
		cout << 0 << endl;
		return 0;
	}
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	for (int i = 1; i < n; i++) {
		b[i - 1] = a[i] - a[i - 1];
	}
	sort(b, b + n - 1);
	reverse(b, b + n - 1);
	int ans = a[n - 1] - a[0];
	for (int i = 0; i < m - 1; i++) {
		ans -= b[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int GCD(int a, int b){
    int temp;
    while (b) {
        temp = b;
        b = a % b;
        a = temp;
    }
    return a;
}
int main() {
    int i,j,k;
    cin>>i>>j;
    if (i>=j){
        k=GCD(i,j);
    }else{
        k=GCD(j,i);
    }
    cout<<k<<endl;
    return 0;
}

Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define forn(i,n) for(int i=0;i<n;i++)
#define free(i,a,b) for(int i = a; i < b; i++)
#define sf(n) scanf("%lld", &n)
#define sff(a,b) scanf("%lld %lld", &a, &b)
#define sfff(a,b,c) scanf("%lld %lld %lld", &a, &b, &c)
#define pfn(n) printf("%lld\n", n)
#define pfs(n) printf("%lld ", n)
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define f find
#define ub upper_bound
#define lb lower_bound
#define ld long double
#define in insert
#define bs binary_search
#define le length()
const ll max_i=1e16+7;
#define np(s) next_permutation(s.begin(),s.end())
const int dx[]={1,0,-1,0};
const int dy[]={0,1,0,-1};
//it gives the lexicographically smallest string//

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1) res = res * a;
        a = a * a; b >>= 1;
    }
    return res;
}

void solve()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  int t=1;
  //cin>>t;
  while(t--){
    ll n,cumxor=0;
    cin>>n;
    ll arr[n];
    for(int i=0;i<n;i++)
    {
      cin>>arr[i];
      cumxor^=arr[i];
    }
    for(int i=0;i<n;i++) cout<<(cumxor^arr[i])<<" ";
 }
}

int main()
{
  #ifndef ONLINE_JUDGE
  freopen("input1.txt", "r",stdin);
  freopen("output1.txt","w",stdout);
  #endif
  solve();
  return 0;
}

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

using namespace std;

#define fore(i, s, e) for(int i = s; i < e; i++)
#define pb push_back
#define fst first
#define snd second
#define endl '\n'

typedef long long ll;

const int N = 1e5 + 10;

vector<int> g[N];

bool visited[N];

int a;

vector<int> v;

void dfs(int x) {
    if(visited[x]) return;
    visited[x] = 1;
    a = (a + v[x]) % 26;
    for(auto v : g[x]) dfs(v);
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s; cin >> s;
    fore(i, 0, s.size()) v.pb(s[i] - 'a');
    v.pb(0);
    for(int i = v.size() - 1; i >= 0; i--) v[i] = (v[i] - v[i - 1] + 26) % 26;
    fore(i, 0, v.size()) {
        g[i].pb(v.size() - 1 - i);
    }
    int n; cin >> n;
    fore(i, 0, n) {
        int l, r; cin >> l >> r; l--;
        g[l].pb(r);
        g[r].pb(l);
    }
    bool f = true;
    fore(i, 0, v.size()) if(!visited[i]) {
        dfs(i), f = f && !a;
    }
    if(f) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;}

Measured memory_bytes: 8520
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;

int main(){
    int i;
    int ans=0;
    char s[100];

    rep(i,0,3) {
        cin >> s[i];
    }

    if(s[0]==s[1]){
        if(s[0]==s[2]){
            ans =1;
        }
    }
    if(ans==0){
        cout << "Yes" << endl;
    }
    if(ans==1){
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
button = input().split()
button_1 = int(button[0]) 
button_2 = int(button[1]) 

counter = 0
#1st time
if button_1>=button_2:
  counter=button_1
  button_1-=1
else:
  counter=button_2
  button_2-=1

#2nd time
if button_1>=button_2:
  counter+=button_1
  button_1-=1
else:
  counter+=button_2
  button_2-=1

print(counter)
  
  

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

using pint=pair<int,int>;

int N;
vector<vector<pint>> v;

bool judge(int bit){
    
    for(int i=0; i<N; i++){
        
        if(!(bit & (1<<i))) continue;
        
        for(pint xy:v[i]){
            int x=xy.first;
            int y=xy.second;
            
            if(!(bit & (1<<x)) && y==1) return false;
            
            if((bit & (1<<x)) && y==0) return false;
        }
    }
    return true;
}


int main(){
    cin>>N;
    v.resize(N);
    for(int i=0; i<N; i++){
        int A;
        cin>>A;
        v[i].resize(A);
        for(int j=0; j<A; j++){
            cin>>v[i][j].first>>v[i][j].second;
            v[i][j].first--;
            
            
        }
    }
    
    int res=0; 
    for( int bit=0; bit<(1<<N); bit++){
        if(judge(bit)) {
            int counter=0; 
            for( int i=0; i<N; i++){
                if(bit &(1<<i)) counter++;            
            }
            res=max(counter,res);
        }
       
    }
    cout<<res<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;
using ll = long long;

void FastIO ()
{
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
}

inline void solve ()
{
  int a, b, c;
  cin >> a >> b >> c;
  cout << c << ' ' << a << ' ' << b;
}

int main ()
{
  FastIO();
  
  int t;
  t=1; //cin >> t;
  while(t--) solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;


void dfs(ll n, ll m,vector<vector<ll>> &children,vector<ll> &num,vector<ll> &counter){
    m+=num[n];
    counter[n]=m;
    for(ll i=0;i<children[n].size();i++){
        if(counter[children[n][i]]==-1){
            dfs(children[n][i],m,children,num,counter);
        }
    ;}
}



int main(){
    ll N;
    cin >> N;
    ll Q;
    cin >> Q;
    vector<vector<ll>> children(N+1, vector<ll>(0));
    ll A,B;
    for(ll i=0;i<N-1;i++){
        cin>>A>>B;
        children[A].emplace_back(B);
        children[B].emplace_back(A);
    ;}
    vector<ll> num(N+1,0);
    for(ll i=0;i<Q;i++){
        cin>>A>>B;
        num[A]+=B
    ;}
    vector<ll> counter(N+1,-1);

    dfs(1,0,children,num,counter);

    for(ll i=1;i<N+1;i++){
        cout<<counter[i]<<" ";
    ;}
    cout<<endl;


return 0;
}  



Measured memory_bytes: 28928
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    char c; cin >> c;
    if (c == 'A' || c == 'T') cout << (c == 'A' ? 'T' : 'A') << endl;
    if (c == 'C' || c == 'G') cout << (c == 'C' ? 'G' : 'C') << endl;
}

Measured memory_bytes: 256
s =input()
n = len(s)
def dfs(i,f):
    if i == n-1:
        return sum(list(map(int,f.split("+"))))
    return dfs(i+1,f+s[i+1]) + dfs(i+1,f+"+" + s[i+1])
print(dfs(0,s[0]))

Measured memory_bytes: 3060
from collections import Counter
from itertools import accumulate
from bisect import bisect_right
N = int(input())
As = list(map(int, input().split()))
ct = Counter(As)
ctm = [c[1] for c in ct.most_common()]
ctm.reverse()
L = len(ctm)
acc = [0] +  list(accumulate(ctm))

arr = [0]
for n in range(1, N+1):
  idx = bisect_right(ctm, n)
  arr.append(acc[idx] + n*(L-idx))

for n in range(1, N+1):
  f = 0
  t = N // n + 1
  while f + 1 < t:
    m = f + (t-f) // 2
    if arr[m] >= m*n:
      f = m
    else:
      t = m
  print(f)

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

int main()
{
    int N;
    cin >> N;
    int a = 1;
    vector<int> d(N);
    for (int i = 0; i < N; i++)
    {
        cin >> d.at(i);
    }
    sort(d.begin(), d.end());
    for (int i = 0; i < N; i++)
    {
        if (i != 0 && d.at(i) > d.at(i - 1))
        {
            a++;
        }
    }
    cout << a << endl;
}


Measured memory_bytes: 3644