akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

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

const int MOD = 1e9+7;
const int INF = 1e9;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin>>N;
    vector<ll> d(N);
    rep(i,N)cin>>d[i];
    ll ans = 0;
    for(int i = 0; i < N; ++i){
        for(int j = i+1; j < N; ++j){
            ans += d[i]*d[j];
        }
    }
    
    cout<<ans<<endl;

}

Measured memory_bytes: 256
#pragma once
#include <stdio.h>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string & S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}
// mod 1000000007 の世界で a += b する関数
void add(long long& a, long long b) {
	a += b;
	if (a >= MOD) a -= MOD;
}

void solv() {
	string v;
	cin >> v;
	int n = v.size();
	ll res = 0;
	ll p = 1;
	char bef = '0';
	ll rv[100010];
	rv[0] = 1;
	for (size_t i = 1; i <= n; i++)
	{
		rv[i] = rv[i - 1];
		if (v[i - 1] == '1') {
			rv[i] *= 2;
			rv[i] %= INF;
		}

	}
	for (ll i = n - 1; i >= 0 ; i--)
	{
		if (v[i] == '1') {
			res += (p * rv[i]) % INF;
			res %= INF;
		}
		//if (v[i] == '1') {
		//	res *= 3;
		//	res %= INF;
		//}

		p *= 3;
		p %= INF;
	}
	res += rv[n];
	res %= INF;
	cout << res << endl;
}

int main() {
//	COMinit();
	solv();

	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int, int> ii;
typedef pair<int, bool> ib;

#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define RFOR(a, b, c) for(int a = b; a >= c; --a)
#define mp(a, b) make_pair(a, b)
#define all(v) v.begin(), v.end()

#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define vvi vector<vi>
#define vb vector<bool>
#define fst first
#define snd second
#define MAXN 310
#define MAXM 44100
#define LOGMAXN 20
#define INF 1e9+7
#define INFLL 1000000000000000000LL
#define EPS 1e-9
#define MOD 1000000007LL

int n, k;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	while(cin >> n)
	{
		vii v(n);
		FOR(i, 0, n)
		{
			cin >> v[i].fst;
			v[i].snd = i+1;
		}
		sort(v.begin(), v.end());
		FOR(i, 0, n)
		{
			if(i > 0) putchar(' ');
			printf("%d", v[i].snd);
		}
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 1664
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>

using namespace std;

int max (int a, int b){
    if(a>b){
        return a;
    }
    else{
        return b;
    }
}

int main() {
    int h,w;
    while(scanf("%d%d",&h,&w)==2){
        if(h==0 && w==0){
            break;
        }
        else
        {
            int count1=0;
            int count2 = 0;
            int len = h*h + w*w;
            
            int min = 1000000;
            
            for(int i=1;i<=150;i++){
                for(int j=i+1;j<=150;j++){
                   
                    if(i*i + j*j > len && i*i + j*j<min){
                        count1 = i;
                        count2 = j;
                        min = i*i + j*j ;
                        
                    }
                }
               
            }
            
            int ok = 0;
            for(int i=1;i<=max(h,w);i++){
                for(int j=i+1;j<=max(h,w);j++){
                    
                    if(i*i + j*j == len && ((i!=h)||(j!=w))){
                        count1 = i;
                        count2 = j;
                        ok = 1;
                        break;
                    }
                }
                if(ok == 1){
                    break;
                }
            }
            printf("%d %d\n",count1,count2);
            
            
            
        }
    }
    
    return 0;
}



Measured memory_bytes: 2576
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n,*a = map(int,read().split())

v = 0
for i in a[2:]:
    v ^= i

w = a[0]+a[1]

z = w-v
if z&1==1 or z<0:
    print(-1)
else:
    z //= 2
    """
    z = p&q
    v = p^q
    """
    if z&v:
        print(-1)
        exit()

    ans = z
    for i in range(60,-1,-1):
        m = 1<<i
        if v&m:
            if ans+m <= a[0]:
                ans += m
                #print(ans,i)

    if ans > a[0] or ans==0: print(-1)
    else: print(a[0]-ans)        
        
        
        
        
            






Measured memory_bytes: 9212
import sys

while True:
	n, x = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	if 0 == n and 0 == x:
		break
		
	cnt = 0
	ave = x // 3
	for i in range( 1, ave ):
		for j in range( i+1, n ):
			if  x <= ( i+j ):
				break
			for k in range( j+1, n+1 ):
				s = ( i + j + k )
				if x == s:
					cnt += 1
					break
				elif   x < s:
					break
	
	print( cnt )

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

using namespace std;

typedef long long int ll;
#define f first
#define s second
#define Mp make_pair
#define pb push_back
#define Lb lower_bound
#define Ub upper_bound
#define all(x) x.begin(), x.end()
#define fast_io ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

const int Maxn = 100000+5, N = 100+5, Mod = 1000*1000*1000 + 7, inf = 1000*1000*1000;
int n, k, h[Maxn], dp[Maxn];
int main(){
    fast_io
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> h[i];
    for (int i = 1; i < k; i++){
        dp[i] = abs(h[i] - h[0]);
    }
    for (int i = k; i < n; i++){
        dp[i] = inf;
        for (int j = i-k; j <= i-1; j++){
            dp[i] = min(dp[i], dp[j]+abs(h[i]-h[j]));
        }
    }


    cout << dp[n-1];
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
  char x; cin >>x;
  switch(x){
    case 'a': cout << "vowel\n";
    break;
    case 'e': cout << "vowel\n";
    break;
    case 'i': cout << "vowel\n";
    break;
    case 'o': cout << "vowel\n";
    break;
    case 'u': cout << "vowel\n";
    break;
    default: cout << "consonant\n";
  }
}

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

int main(){

 int x,y;
 cin >> x >> y;
 
 vector<int> A, B;
 A = {1,3,5,7,8,10,12};
 B = {4,6,9,11};

 bool checkx = false;
 bool checky = false;
  bool ga = false;
 for(int i = 0; i < 7;i++){
   if(A.at(i) == x ){
   checkx = true;
   }
   if(A.at(i) == y ){
   checky = true;
   }
  if(checkx&&checky)
    ga = true;
 }
   
 checkx = false;
 checky = false;
 bool gb = false;
   
 for(int i = 0; i < 4;i++){
   if(B.at(i) == x){
   checkx = true;
   }
   if(B.at(i) == y){
   checky = true;
   }
 if(checkx && checky)
   gb = true;
 }
  
 if(gb||ga)
   cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3548
n, sum = map(int, input().split())

for x in range(n+1):
    for y in range(n+1): 
        z = n - x - y
        if 10000 * x + 5000 * y + 1000 * z  == sum and z >= 0:
                print(x, y, z)
                exit()

print(-1, -1, -1)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

using P = pair<int, int>;
#define INF 1e+9
#define MAX_V 100000

struct edge {
    int to;
    int cost;
};

int V;
vector<edge> G[MAX_V];
int d[MAX_V], d2[MAX_V];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while(!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;

        for(int i = 0; i < G[v].size(); ++i) {
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

void dijkstra2(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d2, d2 + V, INF);
    d2[s] = 0;
    que.push(P(0, s));

    while(!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if(d2[v] < p.first) continue;

        for(int i = 0; i < G[v].size(); ++i) {
            edge e = G[v][i];
            if(d2[e.to] > d2[v] + e.cost) {
                d2[e.to] = d2[v] + e.cost;
                que.push(P(d2[e.to], e.to));
            }
        }
    }
}

int main() {
    int u, v;
    cin >> V >> u >> v;
    u--;
    v--;
    for(int i = 0; i < V - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(edge{b, 1});
        G[b].push_back(edge{a, 1});
    }

    dijkstra(u);
    dijkstra2(v);
    int ans = 0;
    for(int i = 0; i < V; i++)
        if(d[i] <= d2[i]) ans = max(ans, d2[i] - 1);
    cout << ans;
    return 0;
}


Measured memory_bytes: 7948
//2016/11/3
//selection sort

#include <stdio.h>

int main(void)
{
	int i,j;
	int n,min,temp,count = 0,a[100] = {0};

	scanf("%d", &n);

	for(i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}

	for(i = 0; i < n; i++)
	{
		min = i;

		for(j = i; j < n; j++)
		{
			if (a[min] > a[j])
			{
				min = j;
			}
		}

		if (i != min)
		{
			temp = a[i];
			a[i] = a[min];
			a[min] = temp;

			count++;
		}

	}

	for(i = 0; i < n; i++)
	{
		if (i == n-1)
		{
			printf("%d\n", a[i]);
			printf("%d\n", count);
		}else
		{
			printf("%d ", a[i]);
		}
	}



	return 0;
}

Measured memory_bytes: 600
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 5;

int n;

int tree[MAXN];
#define lowbit(x) ((x)&-(x))

inline void update(int x,int k)
{
	while(x<=n)
		tree[x] += k,
		x += lowbit(x);
}

inline void update(int l,int r,int k){ update(max(l,1),k); update(min(r,n)+1,-k);}

inline int query(int x)
{
	int res = 0;
	while(x)
		res += tree[x],
		x ^= lowbit(x);
	return res;
}

int a[MAXN];

int main(void)
{
	int n,d;
	scanf("%d%d",&n,&d);
	vector<int> a(n+1);
	for(int i=1; i<=n; ++i) scanf("%d",&a[i]);
	
	while(d--)
	{
		bool flag = 0;
		for(int i=1; i<=n; ++i)
			if(a[i] < n){ flag=1; break;}
		if(!flag) break;
		
		static int b[MAXN];
		
		for(int i=1; i<=n; ++i) b[i] = 0;
		for(int i=1; i<=n; ++i)
		{
			++b[max(1, i-a[i])];
			if(i+a[i]+1 <= n)
				--b[i+a[i] + 1];
		}
		for(int i=1; i<=n; ++i)
		{
			b[i] += b[i-1];
			a[i] = b[i];
		}
	}
	for(int i=1; i<=n; ++i) printf("%d ",a[i]);
	return 0;
}

Measured memory_bytes: 4408
#include<bits/stdc++.h>
using namespace std;
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
#define int long long int 
#define F first
#define S second
#define boost ios_base::sync_with_stdio(false),cin.tie(NULL);
const int MOD = 998244353;
//#include <ext/pb_ds/assoc_container.hpp> // Common file 
//#include <ext/pb_ds/tree_policy.hpp>  
//using namespace __gnu_pbds; 
//stringstream ss; string temp; ss<<str(original string) ss>>temp;


int32_t main()
{	
	
  	
  	int l,r; cin>>l>>r;

  	if((r-l+1) > 2019)
  	{
  		cout<<"0"<<endl;
  		return 0;
  	}
  	int ans = INT_MAX;

  	for(int i=l;i<=r;i++)
  	{
  		for(int j=i+1;j<=r;j++)
  		{
  			ans = min(ans, (i%2019*j%2019)%2019);
  		}
  	}
  	cout<<ans<<endl;
	return 0;
} 


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int hour,minute,second,input;
    scanf("%d",&input);
    hour = input/3600;
    minute = (input - hour*3600) / 60;
    second = input - hour*3600 - minute*60;
    printf("%d:%d:%d\n",hour,minute,second);
    return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <climits>

#include <unordered_map>
#include <vector>
#include <cmath>

using ll = long long;

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<template<class...> class ContT, class ValueT, size_t Dim>
struct vec_type
{
    using type = ContT<typename vec_type<ContT, ValueT, Dim-1>::type>;
};

template<template<class...> class ContT, class ValueT>
struct vec_type<ContT, ValueT, 0>
{
    using type = ValueT;
};

template<class ValueT, size_t Dim = 1>
using vec_t = typename vec_type<std::vector, ValueT, Dim>::type;


template<class ValueT, size_t Dim, class = typename std::enable_if<Dim == 0>::type>
auto make_vec(ValueT value = ValueT()) -> ValueT
{
    return value;
}

template<class ValueT, size_t Dim, class... Rest>
auto make_vec(size_t size0, Rest... rest)
{
    auto vec = make_vec<ValueT, Dim-1>(rest...);
    return std::vector(size0, vec);
}

int diffabs(int l, int r)
{
    if (l < r) return r-l;
    else return l-r;    
}


///////////////////////////////////////////////////
unordered_map<ll,int> Factorise(ll M)
{
    unordered_map<ll,int> P;
    ll mm = M;

    ll sqrM = static_cast<ll>(std::sqrt(M));
    int i = 2;
    while (i <= sqrM)
    {
        if (mm % i == 0)
        {
            ++P[i];
            mm /= i;
        }
        else
        {
            ++i;
        }
    }

    if (mm >= 2) ++P[mm];
    return P;
}

int main()
{
    ll N;
    cin >> N;
    auto prime_map = Factorise(N);

    int ans = 0;
    for (auto [p, i] : prime_map)
    {
        int j = 1;
        while(j <= i)
        {
            i -= j;
            ++j;
        }
        ans += j - 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3728
N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7

b = [0] * 65

for i in range(N):
    bb = format(A[i], "060b")
    for j in range(60):
        if bb[j] == "1":
            b[j] += 1

ans = 0

for j in range(60):
    ans = (ans + b[j] * (N - b[j]) * pow(2, 59 - j, mod)) % mod

print(ans)

Measured memory_bytes: 124568
n=int(input())
a=sorted([int(i) for i in input().split()])

def groupby(a):
    a2=[[a[0],1]]
    for i in range(1,len(a)):
        if a2[-1][0]==a[i]:
            a2[-1][1]+=1
        else:
            a2.append([a[i],1])
    return a2
a=groupby(a)
#print(a)
l=len(a)
for i in range(l):
    if a[i][1]%2==0:
        a[i][1]=2
    else:
        a[i][1]=1
c=0
for i in range(l):
    if a[i][1]==2:
        c+=1
if c%2==0:
    print(l)
else:
    print(l-1)


Measured memory_bytes: 17304
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M):
    return ((N) * (N-1) + (M) * (M-1)) // 2


def main():
    N, M = read_int_n()
    print(slv(N, M))


if __name__ == '__main__':
    main()


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

int main(){
 long long a,b; cin>>a>>b;
  
  long long k = (a+b)/2;
  
  if(abs(a-k) == abs(b-k))
    cout<<k;
  else cout<<"IMPOSSIBLE";
  
  
  
  return 0;
  
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define INF 1000000007
using namespace std;

int main(void) {
	int n,x;
	cin >> n >> x;
	vector<int> a(n);
	int ans=n;
	for(int i=0; i<n; i++){
		cin >> a[i];
		x-=a[i];
	}
	sort(a.begin(),a.end());
	while(x-a[0]>=0){
		x-=a[0];
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
struct HashPair {

    static size_t m_hash_pair_random;

    template<class T1, class T2>
    size_t operator()(const pair<T1, T2> &p) const {

        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);

        size_t seed = 0;
        seed ^= hash1 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
        seed ^= hash2 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
        seed ^= m_hash_pair_random + 0x9e3779b9 + (seed << 6) + (seed >> 2);
        return seed;
    }
};
size_t HashPair::m_hash_pair_random = (size_t) random_device()();

// 前後で数え上げ
ll N, N2;
void check(string S, unordered_map < pair<string, string>, ll, HashPair >& P){
    string s1, s2;
    rep(bit,1<<N){
        s1.clear(), s2.clear();
        rep(i,N){
            if(bit & 1<<i)
                s1 += S[i];
            else
                s2 += S[i];
        }
        P[{s1, s2}]++;
    }
    
}
int main() {
    init();
    cin >> N;
    N2 = 2 * N;
    string S;
    cin >> S;
    string s1 = S.substr(0, N), s2 = S.substr(N, N);
    reverse(all(s2));

    // ペアがいなければ0
    map<char, ll> mp;
    rep(i, N2) mp[S[i]]++;
    bool isok = true;
    repa(p, mp) if (p.second & 1) isok = false;
    if(!isok){
        cout << 0 << endl;
        return 0;
    }

    unordered_map<pair<string, string>, ll, HashPair> mp1, mp2;
    check(s1, mp1), check(s2, mp2);
    ll ans = 0;
    for(auto p:mp1){
        ans += p.second * mp2[p.first];
    }
    cout << ans << endl;
}


Measured memory_bytes: 112244
package main

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

func solve() {
	n := getInt()
	bs := make([]int, n)
	for i := range bs {
		bs[i] = getInt() - 1
	}
	as := make([]int, n)

	for j := n - 1; j >= 0; j-- {
		x := -1
		for i := n - 1; i >= 0; i-- {
			if bs[i] == i {
				x = i
				break
			}
		}

		if x == -1 {
			fmt.Fprintln(wr, -1)
			return
		}

		as[j] = x + 1
		bs = remove(bs, x)
		n--
	}

	for _, a := range as {
		fmt.Fprintln(wr, a)
	}
}

func remove(s []int, i int) []int {
	return append(s[:i], s[i+1:]...)
}

// -----------------------------------------

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 640
X, K, D = map(int, input().split())
mi = min(abs(X - K * D), abs(X + K * D))
for a in (X - K * D) % (2 * D), (X - K * D) % (2 * D) - 2 * D:
    b = (X - a) // D
    if abs(b) <= K:
        mi = min(mi, abs(a))
print(mi)

Measured memory_bytes: 9208
N,S = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 998244353

dp = [[0 for i in range(S+1)] for _ in range(N+1)]
# dp[i][j] Aiまでを使って、合計jを作る作り方
dp[0][0] = 1

for i in range(1,N+1):
  a = A[i-1]
  for j in range(S+1):
    dp[i][j] += dp[i-1][j] * 2
    dp[i][j] %= mod
    if j+a <= S :
      dp[i][j+a] += dp[i-1][j]
      dp[i][j+a] %= mod
print(dp[N][S])

Measured memory_bytes: 147200
#include <stdio.h>

int main(){
  int w,h;

  while(1) {
    scanf("%d %d", &w, &h);

    if(w == 0 && h == 0) break;

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



Measured memory_bytes: 2132
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "

int main(void){
    int n;cin>>n;
    string s;cin>>s;
    rep(i, s.size()){
        char(s[i]+n)>'Z'?s[i]='A'+char(s[i]+n-'Z'-1):s[i]=char(s[i]+n);
    }
    cout<<s<<endl;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> L(N);
  rep(i,0,N) cin >> L[i];
  sort(L.begin(), L.end());
  int ans=0;
  rep(a,0,N) rep(b,a+1,N){
    int left = b+1;
    int right = lower_bound(L.begin(),L.end(),L[a]+L[b]) - L.begin();
    ans += right-left;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n, m, a[110], b[100005], cnt = 0;
int pla1, pla2;
int main() {
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= m; i ++) {
        scanf("%d", &a[i]);
        if (a[i] & 1) {
            cnt ++;
            if (pla1) pla2 = i;
            else pla1 = i;
        }
    }
    if (m == 1) {
        printf("%d\n", a[1]);
        if (a[1] == 1) {
            printf("1\n1");
            return 0;
        }
        printf("2\n");
        printf("%d 1\n", a[1] - 1);
        return 0;
    }
    if (cnt > 2) {
        puts("Impossible"); return 0;
    }
    if (cnt >= 1) swap(a[1], a[pla1]);
    if (cnt == 2) swap(a[m], a[pla2]);
    for (int i = 1; i <= m; i ++) printf("%d ", a[i]);
    if (a[1] == 1) m --;
    printf("\n%d\n", m);
    if (a[1] == 1) m ++;
    if (a[1] != 1) printf("%d ", a[1] - 1);
    for (int i = 2; i < m; i ++) {
        printf("%d ", a[i]);
    }
    printf("%d\n", a[m] + 1);
    return 0;
}


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

int main(){
  
  ll N,W,m,k=0;
  cin >> N >> W;
  
 vector<ll> w(N);
 vector<ll> v(N);
  
 rep(i,N)
   cin >> w.at(i) >> v.at(i);
  
  vector<vector<ll>> dp(N+1,vector<ll>(100100,INF));
  

    dp.at(0).at(0)=0;
  
  for(int i=1;i<N+1;i++){
    rep(j,100100){
      if(j-v.at(i-1)>=0)
        dp.at(i).at(j)=min(dp.at(i-1).at(j),dp.at(i-1).at(j-v.at(i-1))+w.at(i-1));
      else
        dp.at(i).at(j)=dp.at(i-1).at(j);
        
    /*  if(dp.at(i).at(j)!=INF)
        cout << i << ' ' << j << ' ' << dp.at(i).at(j) << endl;*/
      
    }
  }
 /* cout << dp.at(2).at(0) << endl;
  cout << dp.at(2).at(30) << endl;
  cout << dp.at(2).at(50) << endl;*/
  
  
  
  
   long long res = 0;
    for (int sum_v = 0; sum_v < 100100; ++sum_v) {
        if (dp[N][sum_v] <= W) {
          res = sum_v;
          //cout << res << endl;        
                               }
    }
    cout << res << endl;
  
  
 /* while(k<100001 && dp.at(N).at(k)<=W){
    k++;
  }
    
  cout << k << endl;*/
  
  
 // cout << "22" << endl;
  
/*  for(int i=1;i<N+1;i++){
    rep(j,100001){
      if(j<w.at(i-1))
        dp.at(i).at(j)=dp.at(i-1).at(j);
      else
        dp.at(i).at(j)=max(dp.at(i-1).at(j),dp.at(i-1).at(j-w.at(i-1))+v.at(i-1));
     // cout << j << ' ' << dp.at(i).at(j) << endl;
    }
  }
  
 
  cout << dp.at(N).at(W) << endl;*/
 
}






Measured memory_bytes: 80256
#include <iostream>
#include <array>
#include <string>

using namespace std;

constexpr int SURFACE_NUM = 6;
enum {TOP, FRONT, RIGHT, LEFT, BACK, BOTTOM};

class Dice {
private:
    array<int, SURFACE_NUM> m_surface;

public:
    // constructor
    Dice(array<int, SURFACE_NUM> surface)
        : m_surface(surface) {}

    // getter
    int surface(int i) const
    {
        return m_surface.at(i);
    }

    // roll and spin
    void roll(char direction)
    {
        switch (direction) {
        case 'N':
            roll(TOP, FRONT, BOTTOM, BACK);
            break;
        case 'S':
            roll(TOP, BACK, BOTTOM, FRONT);
            break;
        case 'E':
            roll(TOP, LEFT, BOTTOM, RIGHT);
            break;
        case 'W':
            roll(TOP, RIGHT, BOTTOM, LEFT);
            break;
        }
    }

    void roll(int i, int j, int k, int l)
    {
        int tmp = m_surface.at(i);
        m_surface.at(i) = m_surface.at(j);
        m_surface.at(j) = m_surface.at(k);
        m_surface.at(k) = m_surface.at(l);
        m_surface.at(l) = tmp;
    }

    void spin()
    {
        int tmp = m_surface.at(FRONT);
        m_surface.at(FRONT) = m_surface.at(LEFT);
        m_surface.at(LEFT) = m_surface.at(BACK);
        m_surface.at(BACK) = m_surface.at(RIGHT);
        m_surface.at(RIGHT) = tmp;
    }

    // is equal
    bool isEqual(const Dice& one)
    {
        for (int i = 0; i < 6; i++) {
            (i % 2)? (*this).roll('N'): (*this).roll('E');
            for (int j = 0; j < 4; j++) {
                (*this).spin();
                if (*this == one) {
                    return true;
                }
            }
        }

        return false;
    }

    bool operator==(const Dice& one)
    {
        bool is_equal = true;
        for (int i = 0; i < SURFACE_NUM; i++) {
            if (m_surface.at(i) != one.surface(i)) {
                is_equal = false;
                break;
            }
        }

        return is_equal;
    }

    // debug
    void printDice() const
    {
        cout << surface(TOP) << surface(FRONT)
             << surface(RIGHT) << surface(LEFT)
             << surface(BACK) << surface(BOTTOM) << endl;
    }
};

array<int, SURFACE_NUM> inputDice();

int main()
{
    Dice one(inputDice());
    Dice anothor(inputDice());

    cout << ((one.isEqual(anothor))? "Yes": "No") << endl;
}

array<int, SURFACE_NUM> inputDice()
{
    array<int, SURFACE_NUM> init;
    for (auto i = 0; i < SURFACE_NUM; i++) {
        cin >> init.at(i);
    }
    return init;
}

Measured memory_bytes: 1160
using System;

namespace ABC107_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var H = int.Parse(input[0]);
            var W = int.Parse(input[1]);

            var heightFlag = new bool[H];
            var widthFlag = new bool[W];

            var map = new string[H];
            for(var i = 0;i < H;i++){
                map[i] = Console.ReadLine();
            }

            for(var h = 0;h < H;h++){
                for(var w = 0;w < W;w++){
                    if(map[h][w] == '#'){
                        heightFlag[h] = true;
                        widthFlag[w] = true;
                    }
                }
            }

            for(var h = 0;h < H;h++){
                if(heightFlag[h]){
                    for(var w = 0;w < W;w++){
                        if(widthFlag[w]){
                            Console.Write(map[h][w]);
                        }   
                    }
                    Console.WriteLine();
                }
            }
        }
    }
}


Measured memory_bytes: 13140
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n, m = MAP()
ks = [LIST() for _ in range(m)]
p = LIST()
ans = 0
for i in range(2 ** n):
    bit = format(i, 'b').zfill(n)
    flag = True
    for j in range(m):
        k = ks[j][0]
        s = ks[j][1:]
        tmp = 0
        for l in s:
            tmp += int(bit[l - 1])
        if tmp % 2 != p[j]:
            flag = False
            break
    if flag:
        ans += 1
print(ans)

Measured memory_bytes: 5320
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j,v;
  int A[N+1];
  scanf("%d", &n);
  
  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  for(i=1;i<=n;i++){
    v=A[i];
    j=i-1;
    while((j>=0)&&A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
 trace(A, n);
  }
    
    
    return 0;
  }

Measured memory_bytes: 608
import collections

n,m = map(int,input().split())

## 素因数を並べる関数。collections.counterで受ける。
def prime_factorize(K):
    ans = []
    i = 2
    while i ** 2 <= K:
        if K % i == 0:
            K = K//i
            ans.append(i)
        else:
            i += 1
    if K != 1:
        ans.append(K)

    return ans

def combination(N, r):
    ans = N
    mod = pow(10, 9) + 7
    for i in range(1, r):
        ans = ans * ((N - i) % mod) * pow(i + 1, mod - 2, mod)
        ans = ans % mod
    
    return ans
 
prime_nums = dict(collections.Counter(prime_factorize(m)))

ans = 1
mod = pow(10, 9) + 7
for num in prime_nums.values():
    ans = ans * combination(n - 1 + num, num)
    ans = ans % mod

print(ans)



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

using namespace std;

#define pii pair<int,int>
#define ll long long
#define s second
#define f first

ll n,ans=LLONG_MAX;

int main(){
  cin >> n;
  for(ll i=1;i*i<=n;++i){
    if(n%i==0){
        ans=min(n/i+i,ans);
    }
  }
  cout << ans-2;
  return 0;
}


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

using namespace std;
int main() {
  long a[3];
  cin >> a[0] >> a[1] >> a[2];
  bool ok = !((a[0] % 2) * (a[1] % 2) * (a[2] % 2));
  sort(a, a + 3);
  cout << (ok ? 0ll : a[0] * a[1]) << std::endl;
}

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

int main() {
    int x;
    cin >> x;
    int ans = 0;
    if (x/500 > 0) {
        ans += x/500 * 1000;
        x = x - x/500*500;
    }
    if (x/5) {
        ans += x/5 * 5;
    }
    cout << ans << endl;
    return 0;
}

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

 int main(){
int a, b, c;
cin >> a >> b >> c;
if(b - a == c - b) {
  YES;
  return 0;
}
NO;
 }

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>

typedef long long ll;

#define debug(x) cerr << #x << ": " << x << "\n";
#define rep(i,n) for(int i=0; i<n; i++)

using namespace std;

int main(){
  string T, ans="";
  cin >> T;

  for(int i=0; i<T.size(); i++){
    if(T[i] != '?'){
      ans += T[i];
    }
    else if(T[i] == '?' && T[i-1] == 'P'){
      ans += "D";
    }    
    else if(T[i] == '?' && T[i+1] == 'D'){
      ans += "P";
    }    
    else{
      ans += "D";
    }
  }
  cout << ans << endl;
}

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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) { cin1(x[i]); }
#define ncin2(n, x, y)      REP(i, 0, n) { cin2(x[i], y[i]); }
#define ncin3(n, x, y, z)   REP(i, 0, n) { cin3(x[i], y[i], z[i]); }
#define ncinp(n, p)         REP(i, 0, n) { lli p1,p2; cin >> p1 >> p2; p[i] = P(p1, p2); }
#define ncin1_1(n, x)       REPE(i, 1, n) { cin1(x[i]); }
#define ncin2_1(n, x, y)    REPE(i, 1, n) { cin2(x[i], y[i]); }
#define ncin3_1(n, x, y, z) REPE(i, 1, n) { cin3(x[i], y[i], z[i]); }
#define ncinp_1(n, p)       REPE(i, 1, n) { lli p1,p2; cin >> p1 >> p2; p[i] = P(p1, p2); }

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef unsigned long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;
typedef vector<lli> vlli;


lli x[3];
lli mod = 1000000007;

lli mul(lli x, lli y) {
    return (x * y) % 1000000007;
}
int main() {
    lli n;
    cin1(n);
    lli a[n];
    ncin1(n,a);
    if (a[0] != 0) {
        cout << 0 << endl;
        return 0;
    }

    lli ans = 3;
    x[0] = 1;
    REP(i,1,n) {
        lli count = 0;
        REP(j,0,3) {
            if (x[j] == a[i])
                count++;
        }
        if (count == 0) {
            cout << 0 << endl;
            return 0;
        }
        ans = mul(ans, count);
        REP(j,0,3) {
            if (x[j] == a[i]) {
                x[j]++;
                break;
            }
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
typedef unsigned u32;
typedef long long s64;
typedef unsigned long long u64;
template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}
template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}
template<class Type> Type read() {
	Type a;
	bool b;
	unsigned char c;
	while(c=getchar()-48, (c>9)&(c!=253));
	for(a=(b=c==253)?0:c; (c=getchar()-48)<=9; a=a*10+c);
	return b?-a:a;
}
int (*rd)()=read<int>;
const int N=50000, M=1e6;
int a[N], b[N], c[N], f[M], pa[6*N];
int gcd(int x, int y) {return y?gcd(y, x%y):x;}
int find(int x) {return x==pa[x]?x:(pa[x]=find(pa[x]));}
int main() {
	int n=rd(), m=rd(), q=rd(), mod=rd(), g=mod;
	for(int i=0; i<m; ++i) a[i]=rd()-1, b[i]=rd()-1, c[i]=rd();
	for(int i=1; i<m; ++i) g=gcd(g, abs(c[i]-c[0]));
	mod=gcd(mod, 3*g);
	for(int i=1; i<mod; ++i)
		if(f[i]==0) {
			f[i]=i;
			for(int j=i; (j=j*4%mod)!=i; ) f[j]=i;
		}
	int x0=c[0]%mod;
	for(int i=0; i<m; ++i) c[i]=(c[i]-x0+mod)%mod/g;
	int mg=mod/g;
	for(int i=0; i<2*mg*n; ++i) pa[i]=i;
	for(int i=0; i<m; ++i)
		for(int j=0; j<2; ++j)
			for(int k=0; k<mg; ++k) {
				pa[find((a[i]*2+!j)*mg+(2*k+c[i])%mg)]=find((b[i]*2+j)*mg+k);
				pa[find((b[i]*2+!j)*mg+(2*k+c[i])%mg)]=find((a[i]*2+j)*mg+k);
			}
	while(q--) {
		int s=rd()-1, t=rd()-1, r=(rd()+x0)%mod;
		bool ok=false;
		for(int j=0; j<2&&!ok; ++j)
			for(int k=0; k<mg&&!ok; ++k)
				ok|=f[((j+1)*x0+k*g)%mod]==f[r]&&find((s*2+j)*mg+k)==find(t*2*mg);
		puts(ok?"YES":"NO");
	}
	return 0;
}


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

using namespace std;
using ll = long long;

int main() {

    int n;
	cin>>n;
	vector<int> A(n);
	for (auto &x : A) {
		cin>>x;
	}
	
	int ans = 0;
	for (int i = 0;i < n;++i) {
		if (A[i] == 1) {
			ans = 1;
			int l = 2;
			for (int j = i+ 1;j < n;++j) {
				if (A[j] == l) {
					ans += 1;
					l += 1;
				}    
			}
			
			break;
		}
	}

    printf("%d\n", ans == 0 ? -1 : n - ans);
    return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream &operator << (ostream& out,const pair<S,T>& o){
    out << "(" << o.first << "," << o.second << ")"; return out;
}

/*
<url:https://arc092.contest.atcoder.jp/tasks/arc092_b>
問題文============================================================
 2 つの長さ N の非負整数列 a1,…,aN,b1,…,bN が与えられます。
 
 1≤i,j≤N となるように整数 i,j を選ぶ方法は N2 通りありますが，
 この N^2 通りの i,j それぞれについて，ai+bj を計算し，紙に書き出します。
 つまり，紙に N^2 個の整数を書きます。
 
 この N^2 個の整数のxorを計算してください。
=================================================================

解説=============================================================

================================================================
*/
ll solve(){
    ll res = 0;
    ll N; cin >> N;
    vector<ll> a(N),b(N),A(N),B(N);
    for(auto &in:a) cin >> in; for(auto &in:b) cin >> in;
    for(int k = 28; k >= 0; k--){
        ll T = (1<<k);
        for(int i = 0; i < N;i++){ A[i] = a[i]%(2*T); B[i] = b[i]%(2*T); }
        sort(A.begin(),A.end()); sort(B.begin(),B.end());
        ll cnt = 0,cnt2 = 0; // cnt : 0 cnt2 : 1
        for(int i = 0; i < N;i++){
            
            // [0,T) : 0
            if(A[i] < T) cnt += (lower_bound(B.begin(), B.end(),T-A[i]) - B.begin());
            
            // [2T,3T) : 0
            cnt += (lower_bound(B.begin(),B.end(),3*T-A[i]) - lower_bound(B.begin(),B.end(),2*T-A[i]));
        }
        cnt2 = N*N - cnt;
        cnt2 %= 2;
        res += (cnt2)*T;
    }
    return res;
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    cout << solve() << endl;
	return 0;
}


Measured memory_bytes: 8576
#084-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n=I()
D=[]
for i in range(n-1):
    D.append(IL())
for i in range(n):
    t=0
    for j in range(i,n-1):
        if t<D[j][1]:
            t=D[j][1]+D[j][0]
        else:
            for k in range(100):
                if (t+k)%D[j][2]==0:
                    t+=k+D[j][0]
                    break
    print(t)

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

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

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
  
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
 
const int MAX=510000;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  int n,k;
  cin >> n >> k;
  int ans = 0;
  rep(i,n){
    int a;
    cin >> a;
    if(a>=k)ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>

const long long int MOD = 1000000007;

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

    std::vector<long long int> a(n);
    long long int sum = 0;
        for (int i = 0; i < n; i++)
    {
        std::cin >> a[i];
        sum += a[i];
        sum %= MOD;
    }
    
    long long int ans = 0;
    for (int i = 0; i < n - 1; i++)
    {
        sum -= a[i];
        if (sum < 0)
        {
            sum += MOD;
        }
        ans += (a[i] * sum) % MOD;
        ans = (ans % MOD + MOD) % MOD;
    }
    
    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 4796
#include <bits/stdc++.h>
#define ll long long
#define uint unsigned int
#define inf 0x3f3f3f3f
#define db double
using namespace std;
const int maxn=1e6+10;
int d[2][6], cnt1=0,cnt2=0;

int main() {
	string s1,s2;
	cin>>s1>>s2;
	int ans=0,len=s1.length();
	for(int i=0;i<len;i++) if(s1[i]!=s2[i]) ans++;
	cout<<ans<<endl;
}

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

int main(){
	int ans = 0, k, s;
	cin >> k >> s;
	for(int x = 0; x <= k; x++) for(int y = 0; y <= k; y++) if(0 <= s - x - y && s - x - y <= k) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ld long double
using namespace std;
const ld pi=3.14159265359;
int main()
{
    int n,x;
    cin>>n>>x;
    int h[n];
    for(int i=0; i<n; ++i)
        cin>>h[i];
    int ans[n];
    fill(ans,ans+n,INT_MAX);
    ans[0]=0;
    ans[1]=abs(h[1]-h[0]);
    for(int i=2; i<n; ++i)
    {
        for(int j=i-1;j>=max(0,i-x); --j)
        {
         ans[i]=min(ans[j]+abs(h[j]-h[i]),ans[i]);
        }
    }
    cout<<ans[n-1];
    return 0;
}


Measured memory_bytes: 1024
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import bisect as bi


def solve():
    N = int(input())
    A = []
    heads = []
    for _ in range(N):
        A.append(int(input()))
    a = A.pop()
    bi.insort(heads, a)
    while A:
        a = A.pop()
        if a < heads[-1]:
            j = bi.bisect(heads, a)
            del heads[j]
        bi.insort(heads, a)
    return len(heads)
  

def main():
    print(solve())


if __name__ == "__main__":
    main()


Measured memory_bytes: 57816
N,K = map(int,input().split(" "))
A = [int(i)-1 for i in input().split(" ")]
check = [0]*N
here = 0
for _ in range(2*N):
    check[here] += 1
    here = A[here]
c = sum([1 for i in check if i>1])
c_s = sum([1 for i in check if i==1])
if c_s>=1 and K<=c_s:
    here = 0
    for _ in range(K):
        here = A[here]
    print(here+1)
else:
    K -= c_s
    here = 0
    for _ in range(c_s + K%c):
        here = A[here]
    print(here+1)

Measured memory_bytes: 32328
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
using P = pair<long long, long long>;
const int N = 1e+4+7;
const long long INF = 1e+15+7;
int T[N];
int A[N];

P minimum_larger(P target, int t, int a){
// 	cout << target.first << ":" << target.second << ":" << t << ":" << a << endl;
//     long long lb = 0;
//     long long ub = INF;
// 	while(lb < ub){
// // 		cout << "lb:" << lb << "," << "ub:" << ub << endl;
// 		long long m = (lb+ub)/2;
// 		if(t*m >= target.first && a*m >= target.second){
// 			ub = m;
// 		}else{
// 			lb = m + 1;
// 		}
// 	}
	long long n = max((target.first + t - 1)/ t, (target.second + a - 1)/a);
	return P(t*n,a*n);
}

long long solve(int n){
	P sofar(1,1);
	for(int i = 0; i < n; i++){
		sofar = minimum_larger(sofar,T[i],A[i]);
	}
	return sofar.first + sofar.second;
}

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> T[i] >> A[i];
	}
	cout << solve(n) << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld long double
#define dd double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef vector<pll> vplll;
ll mod = 1e9+7;
const ld PI = 2 * acos(0.0);
const vector<ll> dx = {1, -1, 0, 0};
const vector<ll> dy = {0, 0, 1, -1};
#define round(x, y) ((x + y - 1) / y)
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define len(x) (ll) x.length()
#define sq(x) ((x) * (x))
#define cb(x) ((x) * (x) * (x))
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,t,n,m,k,q; 
    t = 1;
    // cin>>t;
    while(t--)
    {
    cin>>n>>k;
    ll ar[n];
    for(int i=0;i<n;i++)
    ar[i] = 0;
    for(int i=0;i<k;i++)
    {
    int x;
    cin>>x;
    for(int j=0;j<x;j++)
    {
    cin>>c;
    ar[c-1]++;
    }
    }
    int cnt = 0;
    for(int i=0;i<n;i++)
    {
    if(!ar[i])
    cnt++;
    }
    cout<<cnt<<endl;
    }
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<math.h>
#include<map>
#include<set>
#include<vector>
using namespace std;
#define mod 1000000007
#define ll long long 


double a[100000];

int main() {
	// int n;
	// cin>>n;
	// ll ans = -1;
	// for(int i = 0; i < n ; i++) {
	// 	cin>>a[i];
	// 	if(a[i] == 0)
	// 		ans = 0;
	// }

	// if(ans == 0)
	// 	cout<<ans<<endl;
	// else {
	// 	bool flag = true;
	// 	double l = 0.0;
	// 	for(int i = 0; i < n; i++) {
	// 		double val = a[i]*1.0;
	// 		l += log10(val);
	// 		if(l > 18.0) {
	// 			cout<<"-1\n";
	// 			flag = false;
	// 			break;
	// 		}cout<<l<<endl;
	// 	}
	// 	if(flag)cout<<pow(10.0,l)<<endl;
	// }

	 long double a, b;

	cin>>a>>b;
	long long int x = a*b;
	cout<<x<<endl;

}

Measured memory_bytes: 3732