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

#define select(_1, _2, x, ...) x

#define repn(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (int i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define rrep(i, ...) select(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define umax(m, x) (m = max(m, x));
#define umin(m, x) (m = min(m, x));

#define rng(v) v.begin(), v.end()
#define rrng(v) v.rbegin(), v.rend()

#define debug(x) cerr << #x << " = " << x << endl

using namespace std;

using ll = long long int;

using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;

using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;

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

inline void yn(bool f) { cout << (f ? "Yes" : "No") << endl; }


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

    string s;
    cin >> s;

    ll cnt = 0;

    vl ccnt(3, 0);

    rep(i, n) {
        if (s[i] == 'R') ccnt[0]++;        
        if (s[i] == 'G') ccnt[1]++;        
        if (s[i] == 'B') ccnt[2]++;        
    }

    cnt = ccnt[0] * ccnt[1] * ccnt[2];

    rep(i, n) {
        int in = 1;
        while(true) {
            if (i + in * 2 >= n) break;
            if (s[i] != s[i + in] && s[i] != s[i + in * 2] && s[i + in] != s[i + in * 2]) {
                cnt--;
            }
            in++;
        }
    }

    cout << cnt << endl;

    return 0;
}


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

using namespace std;

#define LL long long
#define Re register
#define U unsigned
#define forn(i,a,b) for(Re int i = a;i <= b;++i)
#define nfor(i,a,b) for(Re int i = a;i >= b;--i)
#define CLR(i,a) memset(i,a,sizeof(i))
#define BR printf("--------------------\n")
#define pb push_back
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
const double PI=atan(1.)*4.;
const int maxn=1e6+5;
const int inf = 0x3f3f3f3f;
const int mod=1e9+7;
const double e=2.71828182845904523536;
int dir[4][2]={1,0,0,1,-1,0,0,-1};
int a[maxn];
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
   	cout.tie(0);
    int n,x;
    int ans=1;
    cin>>n>>x;
    a[0]=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        a[i]=a[i]+a[i-1];
        if(a[i]<=x)
            ans++;
    }
    cout<<ans;
	return 0;
}


Measured memory_bytes: 256
import qualified Control.Arrow         as Arrow
import qualified Data.ByteString.Char8 as BSC8
import qualified Data.Char             as Char
import qualified Data.Vector           as V
import qualified Data.Vector.Unboxed   as VU

type Parser a = BSC8.ByteString -> Maybe (a, BSC8.ByteString)
parseInt :: Parser Int
parseInt = fmap (Arrow.second BSC8.tail) . BSC8.readInt
parse1 :: IO Int
parse1 = readLn
parseNM :: Int -> Int -> IO (V.Vector (VU.Vector Int))
parseNM n m = V.replicateM n $ VU.unfoldrN m parseInt <$> BSC8.getLine

main :: IO ()
main = do
  t    <- parse1
  nmab <- parseNM t 4
  putStr . unlines . map show . V.toList $ V.map sumOfFloorLinear nmab

sumOfFloorLinear :: VU.Vector Int -> Int
sumOfFloorLinear nmab = floorSum n m a b
  where
    n = nmab VU.! 0
    m = nmab VU.! 1
    a = nmab VU.! 2
    b = nmab VU.! 3

floorSum :: Int -> Int -> Int -> Int -> Int
floorSum n m a b
  | a >= m && b >= m = if y1 == 0 then ret1 else ret1' + floorSum y1 a1 m ((a1 - x1 `mod` a1) `mod` a1)
  | a >= m && b <  m = if y2 == 0 then ret2 else ret2' + floorSum y2 a2 m ((a2 - x2 `mod` a2) `mod` a2)
  | a <  m && b >= m = if y3 == 0 then ret3 else ret3' + floorSum y3 a3 m ((a3 - x3 `mod` a3) `mod` a3)
  | otherwise        = if y4 == 0 then ret4 else ret4' + floorSum y4 a4 m ((a4 - x4 `mod` a4) `mod` a4)
  where
    ret1  = ((n - 1) * n * (a `div` m) `div` 2) + n * (b `div` m)
    a1    = a `mod` m
    b1    = b `mod` m
    y1    = (a1 * n + b1) `div` m
    x1    = y1 * m - b1
    ret1' = ret1 + (n - (x1 + a1 - 1) `div` a1) * y1

    ret2  = (n - 1) * n * (a `div` m) `div` 2
    a2    = a `mod` m
    b2    = b
    y2    = (a2 * n + b2) `div` m
    x2    = y2 * m - b2
    ret2' = ret2 + (n - (x2 + a2 - 1) `div` a2) * y2

    ret3  = n * (b `div` m)
    a3    = a
    b3    = b `mod` m
    y3    = (a3 * n + b3) `div` m
    x3    = y3 * m - b3
    ret3' = ret3 + (n - (x3 + a3 - 1) `div` a3) * y3

    ret4  = 0
    a4    = a
    b4    = b
    y4    = (a4 * n + b4) `div` m
    x4    = y4 * m - b4
    ret4' = ret4 + (n - (x4 + a4 - 1) `div` a4) * y4

Measured memory_bytes: 24956
#include<iostream>
#include<math.h>
int main() {
	int n = 0, m = 0;
	int ans = 1900;
	std::cin >> n >> m;
	ans = ans*m;
	ans = ans + (n - m) * 100;
	std::cout << ans*pow(2, m) << std::endl;

	

}

Measured memory_bytes: 256
#include<iostream> //cinなど
#include<string> //文字列
#include<algorithm> //sort など
#include<math.h> //paw(冪乗など)
#include<set> // 集合
#include<map> //写像
#include<stdio.h> //printf
#include<stack>

using namespace std;
int abs(int x){
  int k;
  if(x>=0){
    k = x;
  }else{
    k = -x;
  }
  return k;
}

int main(){
   int x,a,b;
   int p,q;
   cin>> x >> a >> b;
   p = abs(x-a); q = abs(x-b);
   if(p<q){
     cout<< "A" <<endl;
   }else{
     cout<< "B"<<endl;
   }
   return 0;
}


Measured memory_bytes: 256
//#include "pch.h"
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };





signed main() {
	int aa[3]={ 0,0,0 };
	int a, b;

	cin >> a >> b;

	aa[a - 1] = 8;
	aa[b - 1] = 8;

	for (int i = 0; i < 3; i++) {
		if (aa[i] == 0) {
			cout << i + 1 << endl;
			break;
		}
	}

	return 0;
}


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

#define ll long long
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back;

/** Dateloper */


using namespace std;
int main()
{
    int n,d;
    cin>>n>>d;
    int k=d*2+1;
    cout<<(n+k-1)/k;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
  int x, max = 3000;
  cin >> x;
  for (int i = 1; i < 1001; ++i) {
    for (int j = 2; j < 1001; ++j) {
      int p = pow(i, j);
      if (p > x) break;
      if ((x - p) <= abs(x - max)) max = p;
    }
  }
  cout << max << endl;
  return 0;
}


Measured memory_bytes: 384
gt::(Int, Int)->(Int, Int)->Bool
gt (x1, x2) (y1, y2) = x2 > y2
inc::(Int,  Int)->(Int, Int)
inc (x1, x2) = (x1+1, x2)
swap::[(Int, Int)]->[(Int, Int)]
swap [x] = [x]
swap (x:xs)
  | gt x y = inc y : x : ys
  | otherwise = x:y:ys
    where
      (y:ys) = swap xs
bsort::[(Int, Int)]->[(Int, Int)]
bsort [] = []
bsort xs = y : bsort ys
  where
    (y:ys) = swap xs
format (xs, ys) = unwords (map show ys) ++ "\n" ++ show (sum xs)
pair::a->b->(a, b)
pair x y = (x, y)
toInt::String->Int
toInt = read
main = do
  getLine
  getLine >>=
    putStrLn.format.unzip.bsort.(map ((pair 0).toInt)).words


Measured memory_bytes: 4088
#include <iostream>
using namespace std;
 
int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
 
	while ((b != 0) && (d != 0))
	{
		c -= b;
		if (c <= 0)
		{
			cout << "Yes" << endl;
			return 0;
		}
 
		a -= d;
		if (a <= 0)
		{
			cout << "No" << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3556
def main():
    N, Y = map(int, input().split())
    
    num10000, num5000, num1000 = 0, 0, 0
    flag = False

    for i in range(N+1):
        for j in range(N+1-i):
            k = N - i - j
            total = 10000*i + 5000*j + 1000*k
            if total == Y and i+j+k == N :
                num10000, num5000, num1000 = i, j, k
                flag = True
                break

    if(not flag):
        num10000, num5000, num1000 = -1, -1, -1

    print('{} {} {}'.format(num10000, num5000, num1000))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38896
// Created by Nandu Vinodan
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define pi pair<int, int>
#define INF INT_MAX
#define _INF INT_MIN
#define TC 0

using namespace std;
using ll = long long;

void testcase() {
	vector<pair<ll, int> > v;
	unordered_map<ll, ll> mp;
	for (ll i = 0; i<=1000; i++) {
		ll val = i * i * i * i * i;
		v.push_back({val, i});	
		mp[val] = i;
	}
	
	ll x; cin >> x;
	int sz = v.size();
	rep (i, 0, sz-1) {
		ll val = v[i].first;
		ll num = v[i].second;

		ll f = x + val, g = x - val;
		if (mp.find(f) != mp.end()) {
			cout << mp[f] <<" " << num;
			return;
		}
		if (mp.find(g) != mp.end()) {
			cout << mp[g] << " " << -num;
			return;
		}
	}
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    if (TC)
        cin>>t;
    while(t--) {
        testcase();
    }
    return 0;
}

Measured memory_bytes: 3708
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> as(n), bs(n), ds(n);
    cin >> as >> bs;
    for(int i = 0; i < n; i++){
        ds[i] = as[i] - bs[i];
    }
    ll times = -accumulate(ds.begin(), ds.end(), 0ll);
    printd(times);
    ll a2 = times, b2 = times;
    for(int i = 0; i < n; i++){
        if(ds[i] < 0){
            a2 -= -ds[i] / 2;
            if(ds[i] % 2){
                a2--;
                b2--;
            }
        }else if(ds[i] > 0){
            b2 -= ds[i];
        }
    }
    printd(a2, b2);
    cout << (a2 >= 0 && b2 >= 0 && a2 * 2 == b2 ? "Yes" : "No") << '\n';
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
int main()
{
  string S;
  cin >> S;

  deque<char> s;

  for (char c : S)
  {
    s.push_back(c);
  }

  int q;
  cin >> q;

  bool reverse = false;
  rep(_, q)
  {
    int t;
    cin >> t;

    if (t == 1)
    {
      reverse = !reverse;
    }
    if (t == 2)
    {
      int f;
      char c;
      cin >> f >> c;

      if ((f == 1) ^ reverse)
      {
        s.push_front(c);
      }
      else
      {
        s.push_back(c);
      }
    }

    // for(char c:s)
    //   cout << c;
    // cout << endl;
  }
  if (reverse)
  {
    while (!s.empty())
    {
      cout << s.back();
      s.pop_back();
    }
    cout << endl;
  }
  else
  {
    for (char c : s)
    {
      cout << c;
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 896
#include <stdio.h>

int main() 
{
  long long int a, b, c;
  int i;
  scanf("%lld %lld %lld",&a,&b,&c);
  for(i=1;i<=10;i++)
  {
    c=c*a-b;
    printf("%lld\n",c);
  }
  return 0;
}

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

using namespace std;

int buf = 0;

int Parent(int n, vector<int> &p, vector<int> &d) {
	if (p[n] == n) {
		buf = 0;
		return n;
	}
	p[n] = Parent(p[n], p, d);
	d[n] += buf;
	buf = d[n];
	return p[n];
}

int main(void) {
	int num, m, i, ok = true, a, l, r, lp, rp;
	cin >> num >> m;
	vector<int> p(num + 1), d(num + 1, 0);
	for (i = 1; i <= num; i++)
		p[i] = i;
	for (i = 0; i < m; i++) {
		scanf("%d%d%d", &l, &r, &a);
		lp = Parent(l, p, d);
		rp = Parent(r, p, d);
		if (lp == rp) {
			if (d[r] - d[l] != a) {
				ok = false;
				break;
			}
			continue;
		}
		a = d[l] + a - d[r];
		if (a >= 0) {
			p[rp] = p[lp];
			d[rp] = a;
		}
		else {
			p[lp] = p[rp];
			d[lp] = -a;
		}
	}
	if (ok)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 1024
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

ll Xor(ll N){
    int m = N % 4;
    if(m == 0) return N;
    if(m == 1) return 1LL;
    if(m == 2) return N ^ (1LL);
    if(m == 3) return 0;
}

int main(){
    ll A, B;
    cin >> A >> B;
    if(A == 0) cout << B << endl;
    else cout << (Xor(A - 1) ^ Xor(B)) << endl;
}

Measured memory_bytes: 256
local mmi, mma = math.min, math.max
local n, m = io.read("*n", "*n")
local player = {}
local playerpos = {}
local removecnt = 0
local removed = {}
for i = 1, m do
  removed[i] = false
end
local mcnt = {}
for i = 1, n do
  player[i] = {}
  playerpos[i] = 1
  for j = 1, m do
    local v = io.read("*n")
    player[i][j] = v
  end
end
local maxscore = 0
local ret = n
local function calc()
  maxscore = 0
  for i = 1, m do
    mcnt[i] = 0
  end
  for i = 1, n do
    local v = player[i][playerpos[i]]
    mcnt[v] = mcnt[v] + 1
  end
  for i = 1, m do
    maxscore = mma(maxscore, mcnt[i])
  end
  ret = mmi(ret, maxscore)
end

local function remove()
  for i = 1, m do
    if mcnt[i] == maxscore then
      removed[i] = true
      removecnt = removecnt + 1
    end
  end
  if removecnt == m then
    print(ret)
    os.exit()
  end
  for i = 1, n do
    local pi = player[i]
    while removed[pi[playerpos[i]]] do
      playerpos[i] = playerpos[i] + 1
    end
  end
end
while true do
  calc()
  remove()
end


Measured memory_bytes: 2680
#include <bits/stdc++.h>
//#include <ext/numeric>
#define oo 0x3f3f3f3f
#define long long long

using namespace std;
//using namespace __gnu_cxx;

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(9), cout << fixed;

    int n, x;
    cin >> n >> x;
    int cur;
    cin >> cur;
    long ans = max(0, cur - x);
    cur = min(cur, x);
    for (int i = 1; i < n; ++i) {
        int a;
        cin >> a;
        int tmp = cur + a - x;
        if (tmp > 0) {
            ans += tmp;
            a -= tmp;
        }
        cur = a;
    }

    cout << ans << '\n';

    return 0;
}
		

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <ext/numeric>
/**
    PROGRESS IS PROGRESS
    NO MATTER HOW SMALL
*/
using namespace std;
using namespace __gnu_cxx;

#define all(v)   v.begin(), v.end()
#define sz(x)    (int) x.size()
#define Unique(x) x.erase(unique(all(x)), x.end())
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define START cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define isOdd(n)    (n&1)
#define LLMAX LLONG_MAX
#define LLMIN LLONG_MIN
#define IMN INT_MIN
#define IMX INT_MAX
#define pow(n, m) power((ll)n, (ll)m)
#define numOfDigits(n)  ((n)? (ll)(log10(n))+1 : 1)
#define mem(x, val)    memset(x, val, sizeof(x)) //be careful
#define MOD 1000000007

typedef long long ll;
typedef long double ld;
typedef double dd;
typedef pair<int, int> pii;
typedef vector<ll> vi;


int main()
{
    START
    //freopen("test cases\\in.txt", "r", stdin) ;
    //freopen("test cases\\out.txt", "w", stdout) ;
    string s, t; cin>>s>>t;
    t.erase(t.size()-1, 1);
    cout<<(s==t?"Yes":"No");
	return 0;
}


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

using namespace std;

const int MAX = 210;

int solve (string const& s, vector<long long> a) {
  vector<bitset<MAX>> mat(64);
  int n = a.size();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 64; j++) {
      if (a[i] & (1ll << j)) {
        mat[j][i] = 1;
      }
    }
  }
  for (int i = 0, cur = 0; i < n; i++) {
    for (int j = cur; j < 64; j++) {
      if (mat[j][i]) {
        if (s[i] == '0') {
          swap(mat[j], mat[cur]);
          break;
        }
        else {
          return 1;
        }
      }
    }
    if (mat[cur][i]) {
      for (int j = cur + 1; j < 64; j++) {
        if (mat[j][i]) mat[j] ^= mat[cur];
      }
      cur++;
    }
  }
  return 0;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<long long> a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    string s;
    cin >> s;
    reverse(a.begin(), a.end());
    reverse(s.begin(), s.end());
    int ans = solve(s, a);
    cout << ans << '\n';
  }
  return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define TR(X) ({ if(1) cerr << "Trace: " << (#X) << " = " << (X) << endl; })

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n; cin >> n;
	vector<vector<ll> > a(n, vector<ll>(n));
	for(ll i = 0; i < n; i++) for(ll j = 0; j < n; j++) cin >> a[i][j];
	vector<ll> sum(1 << n);
	for(ll mask = 0; mask < (1 << n); mask++) {
		for(ll i = 0; i < n; i++) if((1 << i) & mask){
			for(ll j = i; j < n; j++) if(((1 << j) & mask)) sum[mask] += a[i][j];
		}
	}
	vector<ll> dp(1 << n);
	for(ll mask = 0; mask < (1 << n); mask++) {
		for(ll smask = mask; smask; smask = (smask - 1) & mask) {
			dp[mask] = max(dp[mask], dp[mask ^ smask] + sum[smask]);
		}
	}
	cout << dp[(1 << n) - 1] << '\n';
}


Measured memory_bytes: 1280
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <climits>
#include <memory>
#include <sstream>
#include <iomanip>
#include <cstdio>

using namespace std;

int f(int n) {
	int ans = 0;
	for (int i = 100000; i > 0; i /= 10) {
		int tmp = n / i;
		ans += tmp;
		n -= tmp*i;
	}
	return ans;
}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	int ans = INT_MAX;
	for (int i = 1; i <= n / 2; i++) {
		ans = min(ans, f(i)+f(n-i));
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
N=int(input())
if N==0:
    print(2)
    exit()
elif N==1:
    print(1)
    exit()
else:
    L=[0 for i in range(N+1)]
    L[0]=2
    L[1]=1
    for i in range(2,N+1):
        L[i]=L[i-1]+L[i-2]
    print(L[N])


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,n) for(int i=1;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define Rrep(i,n) for(int i=n-1;i>0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
#define P pair<int,int>
#define Pll pair<ll,ll>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main(){
    int n,h; cin >> n >> h;
    priority_queue<P> pq;
    rep(i,n){
        int x,y; cin >> x >> y;
        pq.push({x,0});
        pq.push({y,1});
    }
    int ans=0;
    while(!pq.empty()&&h>0){
        P p=pq.top(); pq.pop();
        if(p.se==1){
            h-=p.fi; ans++;
        }else{
            ans+=(h+p.fi-1)/p.fi;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 2420
if __name__ == '__main__':
    N, M = map(int, input().split())

    KA = list(map(int, input().split()))

    items = set(KA[1:])

    for i in range(1, N):
        KA = list(map(int, input().split()))
        items = items & set(KA[1:])

    answer = len(items)
    print(answer)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const string temp = "UDLR";
const int vy[] = {-1, 1, 0, 0}, vx[] = {0, 0, -1, 1};
const int INF = 1 << 30;
typedef pair< int, pair< int, int > > State;

int W, H, N;
int sx, sy, gx, gy;
int edge[2][501][501];
int min_cost[501][501];

int main()
{
  cin >> W >> H >> N;
  cin >> sx >> sy >> gx >> gy;
  while(N--) {
    int x, y, T;
    string S;
    cin >> x >> y;
    cin >> T >> S;
    while(T--) {
      for(char c : S) {
        int delta = temp.find(c);
        int nx = x + vx[delta], ny = y + vy[delta];
        if(nx < 0 || ny < 0 || nx >= W || ny >= H) continue;
        ++edge[delta < 2][max(x, nx)][max(y, ny)];
        x = nx, y = ny;
      }
    }
  }
  priority_queue< State, vector< State >, greater< State > > que;
  fill_n(*min_cost, 501 * 501, INF);
  que.push({0, {sx, sy}});
  min_cost[sx][sy] = 0;
  for(;;) {
    pair< int, int > p;
    int cost;
    tie(cost, p) = que.top(); que.pop();
    if(cost > min_cost[p.first][p.second]) continue;
    if(p == make_pair(gx, gy)) {
      cout << cost << endl; exit(0);
    }
    for(int i = 0; i < 4; i++) {
      int nx = p.first + vx[i], ny = p.second + vy[i];
      if(nx < 0 || ny < 0 || nx > W || ny > H) continue;
      int next_cost = cost + edge[i >= 2][min(p.first, nx)][min(p.second, ny)];
      if(next_cost >= min_cost[nx][ny]) continue;
      min_cost[nx][ny] = next_cost;
      que.push({next_cost, {nx, ny}});
    }
  }
}

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

using namespace std;

double const PI = 3.141592653589793238462643383279502884197169399375105820974;

int r;

int main() {
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	cin >> r;

	cout << setprecision(10) << 2 * PI * r << endl;
}


Measured memory_bytes: 3776
N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
V = sum([v for _, v in wv])

inf = float("inf")
dp = [[inf for _ in range(V+1)] for _ in range(N+1)]
dp[0][0] = 0

for i in range(N):
    weight = wv[i][0]
    value = wv[i][1]
    for v in range(V+1):
        if v-value >= 0:
            dp[i+1][v] = min(dp[i][v], dp[i][v-value] + weight)
        else:
            dp[i+1][v] = dp[i][v]
ans = 0
for i in range(V+1):
    if dp[-1][i] <= W:
        ans = i
print(ans)


Measured memory_bytes: 315704
import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    h, w = list(map(int, input().rstrip('\n').split()))
    a = [list(str(input().rstrip('\n'))) for _ in range(h)]
    for i in range(h):
        for j in range(w):
            if a[i][j] == ".":
                a[i][j] = 0
            else:
                a[i][j] = -1

    a[0][0] = 1
    ql = [[0, 0, 0]]
    ql = collections.deque(ql)
    while True:
        if len(ql) != 0:
            cost, x, y = ql.popleft()
            for xv, yv in [[x + 1, y], [x, y + 1]]:
                if 0 <= xv < h and 0 <= yv < w:
                    if a[xv][yv] == 0:
                        ql.append([cost + 1, xv, yv])
                        a[xv][yv] += a[x][y]
                    elif a[xv][yv] != -1:
                        a[xv][yv] += a[x][y]
        else:
            break
    print(a[-1][-1] % mod)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 214492
N=int(input())
list1=[1 for i in range(N+1)]

for i in range(1,N+1):
    X=i
    for j in range(2,N+1):
        while X%j==0:
            if X==0:
                pass
            elif X%j==0:
                list1[j]+=1
                X=X/j
ans=1   
for k in range(len(list1)):
    ans*=list1[k]
    #ans=ans%1000000007
print(ans%1000000007)


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

using namespace std;

long long int solve() {
  int N;
  string S;

  cin >> N;
  cin >> S;

  long long int ans = 0;

  int pos_left[10] = {};
  int pos_right[10] = {};
  for (int i = 0; i < 10; i++) {
    pos_left[i] = -1;
    pos_right[i] = -1;
  }

  for (int i = 0; i < N; i++) {
    int c = S[i] - '0';
    if (i < N - 2 && pos_left[c] < 0) {
      pos_left[c] = i;
    }
    if (i > 1) {
      pos_right[c] = i;
    }
  }

  for (int left = 0; left < 10; left++) {
    for (int right = 0; right < 10; right++) {
      if (pos_left[left] < 0 || pos_right[right] < 0 || pos_left[left] + 1 >= pos_right[right]) {
        continue;
      }

      bool visited[10] = {};
      for (int i = 0; i < 10; i++) {
        visited[i] = false;
      }
      for (int i = pos_left[left] + 1; i < pos_right[right]; i++) {
        int c = S[i] - '0';
        if (!visited[c]) {
          ++ans;
          visited[c] = true;
        }
      }
    }
  }

  return ans;
}

int main() {
  cout << solve() << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////
ll pow(ll x,ll y,ll mod){
    if(y==0) return 1;
    if(y&1) return x*pow(x,y-1,mod)%mod;
    ll p=pow(x,y/2,mod);
    return p*p%mod;
}
const ll MAX = 5000001;//10^7が限界
const ll MOD = Mod;
//const ll MOD = INT64_MAX;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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;
    }
}

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

ll dp[100050][4];
void solve(){
    string s;
    cin >> s;
    int n=s.size();
    ll q=0;
    rp(i,n){
        if(s[i]=='?') q++;
    }
    COMinit();
    rp(i,n){
        if(s[i]=='A'){
            dp[i+1][1]=dp[i][1]+pow(3,q,Mod);
            dp[i+1][2]=dp[i][2];
            dp[i+1][3]=dp[i][3];
        }
        if(s[i]=='B'){
            dp[i+1][1]=dp[i][1];
            dp[i+1][2]=dp[i][1]+dp[i][2];
            dp[i+1][3]=dp[i][3];
        }
        if(s[i]=='C'){
            dp[i+1][1]=dp[i][1];
            dp[i+1][2]=dp[i][2];
            dp[i+1][3]=dp[i][2]+dp[i][3];
        }
        if(s[i]=='?'){
            dp[i+1][1]=dp[i][1]+pow(3,q-1,Mod);
            dp[i+1][2]=dp[i][1]*inv[3]+dp[i][2];
            dp[i+1][3]=dp[i][2]*inv[3]+dp[i][3];
        }
        dp[i+1][1]%=Mod;
        dp[i+1][2]%=Mod;
        dp[i+1][3]%=Mod;
    }
    print(dp[n][3]);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

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

int n;

int main()
{
    while (cin >> n) {
        int count = 0;
        for (int a = 0; a <= 9; ++a) {
            for (int b = 0; b <= 9; ++b) {
                for (int c = 0; c <= 9; ++c) {
                    int d = n - a - b - c;
                    if (0 <= d && d <= 9) ++count;
                }
            }
        }
        cout << count << endl;
    }
    return 0;
}


Measured memory_bytes: 3020
#include<stdio.h>
int main(void){
  int n;
  scanf("%d",&n);
  char s[n+1];
  scanf("%s",&s);
  int ans=n;
  for(int i=0;i<n-1;i++){
    if(s[i]==s[i+1]){
      while(s[i]==s[i+1]){
        ans--;
        i++;
      }
    }
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m = inpl()
x = [-1] * n
for i in range(m):
    s,c = inpl()
    if x[s-1] == -1 or x[s-1] == c: 
        x[s-1] = c
    else:
        print(-1)
        quit()
# print(x)
# if n == 1 and m == 0:
#     print(0)
#     quit()
res = -1
for i in range(1001):
    if len(str(i)) != n:
        continue
    ok = True
    for j,t in enumerate(str(i)):
        if x[j] == -1 or x[j] == int(t):
            continue
        ok = False
    if ok:
        res = i
        break
print(res)

Measured memory_bytes: 64876
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int maxn = 1010;
ll a[maxn], x;
ll sum[maxn];
int main(){
    int cnt = 0, n;
    scanf("%d%lld", &n, &x);
    for(int i = 1; i <= n; i ++){
        scanf("%lld", &a[i]);
    }
    sort(a+1, a+1+n);
    for(int i = 1; i <= n; i ++){
        sum[i] = sum[i-1] + a[i];
        if(sum[i] <= x) cnt ++;
    }
    int ans;
    if(cnt < n)
        ans = cnt;
    else if(x > sum[n])
        ans = n - 1;
    else
        ans = n;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main(){
    int X;
    //X
    int A;
    //A
    cin >> X >> A;
    //X,Aの順で標準入力
    if (X < A){
        cout << 0 << endl;
        //XがA未満の場合0と出力する処理
    } else if (A <= X){
        cout << 10 << endl;
        //XがA以上の場合出力する処理
    }
}


Measured memory_bytes: 256
// {{{ by shik
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

#ifdef SHIK
template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) do { \
    fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); \
    _dump(#__VA_ARGS__, __VA_ARGS__); \
} while (0)

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T, size_t N>
ostream& operator <<( ostream &s, const array<T,N> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
#else
#define dump(...)
#endif

template<typename T>
void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( long long &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }

void R() {}
template<typename T, typename... U>
void R( T& head, U&... tail ) {
    _R(head);
    R(tail...);
}

template<typename T>
void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
template<typename T>
void _W( const vector<T> &x ) {
    for ( auto i=x.cbegin(); i!=x.cend(); i++ ) {
        if ( i!=x.cbegin() ) putchar(' ');
        _W(*i);
    }
}

void W() {}
template<typename T, typename... U>
void W( const T& head, const U&... tail ) {
    _W(head);
    putchar(sizeof...(tail)?' ':'\n');
    W(tail...);
}

#ifdef SHIK
#define FILEIO(...)
#else
#define FILEIO(name) do {\
    freopen(name ".in","r",stdin); \
    freopen(name ".out","w",stdout); \
} while (0)
#endif

// }}}

const int N=1e5+10;
int n,a[N];
int main() {
    R(n);
    REP1(i,1,n) R(a[i]);
    int ans=0;
    REP1(i,1,n) if ( a[a[i]]==i ) ans++;
    W(ans/2);
    return 0;
}


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

using namespace std;

int ngcd(int *a, int n){
    if(n == 1)   return __gcd(a[0], a[1]);

    return(__gcd(ngcd(a, n-1), a[n]));
}

int main(void){
    int n, ans;

    cin >> n;
    vector<int> a(n), l(n), r(n), m(n);
    for(int i = 0;i < n;i++)    cin >> a[i];

    l[0] = a[0];
    r[n-1] = a[n-1];
    for(int i = 1;i < n;i++){
        l[i] = __gcd(l[i-1], a[i]);
        r[n-i-1] = __gcd(r[n-i], a[n-i-1]);
    }

    m[0] = r[1];
    for(int i = 1;i < n - 1;i++){
        m[i] = __gcd(l[i-1], r[i+1]);
    }
    m[n - 1] = l[n-2];

    ans = 1;
    for(int i = 0;i < n;i++){
        if(ans < m[i])  ans = m[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
program mod 
  implicit none
  integer(8) :: n, ans, i
  integer(8), allocatable :: a(:) 

  read *, n 
  allocate(a(n))
  read *, a 
  ans = 0
  do i = 1, n 
    ans = ans + a(i) - 1
  end do
  print '(i0)', ans
  stop
end program mod


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

int main()
{
	int N;

	cin >> N;
	vector<int> d( N );
	for( int i = 0; i < N; i++ ) {
		cin >> d[i];
	}

	sort( d.begin(), d.end() );
	int h = d[N / 2];
	int l = d[N / 2 - 1];
	int ans = h - l;

	cout << ans << endl;
}


Measured memory_bytes: 640
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
	
    public static void main(String[] args) {
    	FastScanner sc = new FastScanner();
    	
    	int a = sc.nextInt();
    	int b = sc.nextInt();
    	
    	if(a%2 == 1 && b%2 == 1){
    		System.out.println("Odd");
    	}
    	else{
    		System.out.println("Even");
    	}

    }
    
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 20948
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
    int N, T;
    cin >> N >> T;
    vector<i64> A(N), MAX(N); 
    rep(i,N) cin >> A[i];

    MAX[N-1] = A[N-1];
    for(int i = N-2; i >= 0; i--) MAX[i] = max(A[i], MAX[i+1]);

    map<i64, i64> profits;
    rep(i, N) profits[-(MAX[i] * (T / 2)  - A[i] * (T / 2))]++;
    auto ans = *profits.begin();
    cout << ans.second << endl;
    
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

typedef tuple<ll, ll, ll> T;

const ll inf = 1LL<<50;


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

    int n; cin >> n;
    vector<int> a(n), b(n);
    for(int i=0; i<n; ++i) cin >> a[i];
    for(int i=0; i<n; ++i) cin >> b[i];

    int ans = 0;
    for(int k=28; k>=0; --k){
        int T = 1<<k;
        for(int i=0; i<n; ++i) { a[i]%=2*T, b[i]%=2*T; }
        sort(b.begin(), b.end());
        ll cnt = 0;
        for(int i=0; i<n; ++i){
            cnt += lower_bound(b.begin(), b.end(), 2*T-a[i]) - lower_bound(b.begin(), b.end(), T-a[i]);
            cnt += lower_bound(b.begin(), b.end(), 4*T-a[i]) - lower_bound(b.begin(), b.end(), 3*T-a[i]);
        }
        if(cnt%2 == 1) ans += T;
    }

    cout << ans << '\n';
    
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using namespace atcoder;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

using mint = modint998244353;

// operate from left
using S = pair<mint,int>;
using F = pair<mint,mint>;
S op(S a,S b) {return S{a.first + b.first,a.second + b.second};}
S e() {return S{0,0};}
S mapping(F a,S b){return S{a.first*b.first + b.second*a.second,b.second};}
F composition(F a,F b){return F{a.first*b.first,b.second*a.first + a.second};}
F id() {return F{1,0};}

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

    int N,Q; cin >> N >> Q;
    vector<S> A(N);
    rep(i,N) {
        ll a; cin >> a;
        A[i] = S{a,1};
    }
    lazy_segtree<S,op,e,F,mapping,composition,id> st(A);
    rep(i,Q) {
        int t; cin >> t;
        if (t == 0) {
            int l,r; cin >> l >> r;
            ll b,c; cin  >> b >> c;
            st.apply(l,r,F{b,c});
        } else {
            int l,r; cin >> l >> r;
            cout << st.prod(l,r).first.val() << '\n';
        }
    }
    return 0;
}

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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

typedef pair<int,int> T_CC;
const int CC_MAX = 4e5 + 3;

class CC{
	T_CC unzip[CC_MAX];
	map<T_CC , int> zip;
	int size;
	
public:
	
	CC(){
		size = 0;
		zip.clear();
	}
	
	int insert(T_CC a){
		if(size == CC_MAX) return -1;
		zip[a] = size;
		unzip[size] = a;
		return ++size;
	}
	
	int arrange(){
		int a = 0;
		for(map<T_CC , int>::iterator it = zip.begin() ; it != zip.end() ; ++it){
			(*it).second = a;
			unzip[a] = (*it).first;
			++a;
		}
		size = a;
		return size;
	}
	
	int get_size(){
		return size;
	}
	
	int code(T_CC a){
		map<T_CC , int>::iterator it = zip.find(a);
		return it != zip.end() ? (*it).second : -1;
	}
	
	T_CC decode(int a){
		if(a >= size) return pair<int,int>(-1,-1);
		return unzip[a];
	}
} solve;

int main(){
	int N,M; cin >> N >> M;
	vector<tuple<int,int,int>> E;
	repp(i,0,M){
		int p,q,c; cin >> p >> q >> c;
		solve.insert(make_pair(p,c));
		solve.insert(make_pair(q,c));
		E.push_back(make_tuple(p,q,c));
	}
	int S = solve.arrange();
	int r = solve.code(make_pair(1,0));
	vector<vector<int>> V(S),W(N+1);
	for(auto u : E){
		int a = solve.code(make_pair(get<0>(u),get<2>(u)));
		int b = solve.code(make_pair(get<1>(u),get<2>(u)));
		V[a].push_back(b);
		V[b].push_back(a);
		W[get<0>(u)].push_back(a);
		W[get<1>(u)].push_back(b);
	}
	const int INF = 1e9;
	vector<int> d(S,INF),ans(N+1,INF);
	ans[1] = 0;
	deque<int> Q;
	for(auto u : W[1]){
		Q.push_back(u);
		d[u] = 1;
	}
	while(!Q.empty()){
		int z = Q.front(); Q.pop_front();
		if(d[z] < 0) continue;
		for(auto u : V[z]) if(d[u] > d[z]){
			Q.push_front(u);
			d[u] = d[z];
		}
		int a = solve.decode(z).first;
		if(ans[a] == INF){
			ans[a] = d[z];
			for(auto u : W[a]) if(d[u] == INF){
				Q.push_back(u);
				d[u] = ans[a]+1;
			}
		}
		d[z] = -1;
	}
	cout << (ans[N]==INF?-1:ans[N]) << endl;
	return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;

#define INF INT_MAX
#define MOD 1000000007
#define all(x) x.begin(), x.end()

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

    int N; cin >> N;
    cout << (N+1) / 2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a,b,c;
int main() {
	cin >> a >> b >> c;
       if (a == b) {
		   cout << c << endl;
	   }else if (b == c) {
		   cout << a << endl;
	   }else if (c == a) {
		   cout << b << endl;
	   }
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))

x = 0
for l in range(N - 1):
  for r in range(l + 1, N):
    if A[l] > A[r]:
      x += 1
# print(x)
      
AA = A + A
y = 0
for l in range(N):
  for r in range(N):
    if AA[l] > AA[r]:
      y += 1
# print(y)
  
print(int((K * x + K * (K - 1) * y // 2) % (10 ** 9 + 7)))


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

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (ll i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (ll i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int n, a; cin >> n >> a;

    print(n * n - a);

}

Measured memory_bytes: 3628
N = int(input())
H = list(map(int, input().split()))
ans = 'Yes'
for i in range(N - 1, 0, -1):
    if H[i] + 1 == H[i - 1]:
        H[i - 1] -= 1
    elif H[i] < H[i - 1]:
        ans = 'No'
print(ans)


Measured memory_bytes: 14396
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	sorted := make([]int, n)
	copy(sorted, a)
	sort.Sort(sort.Reverse(sort.IntSlice(sorted)))
	w := bufio.NewWriter(os.Stdout)
	for _, e := range a {
		ans := sorted[0]
		if e == ans {
			ans = sorted[1]
		}
		fmt.Fprintln(w, ans)
	}
	w.Flush()
}


Measured memory_bytes: 8064
N=int(input())
t,a=map(int,input().split())
H=list(map(int,input().split()))
judge=10**18
for i,h in enumerate(H):
  if abs(a-(t-0.006*h)) < judge:
    ans=i+1
    judge=abs(a-(t-0.006*h))

print(ans)

Measured memory_bytes: 3060
#include <stdio.h>

int main(void) {
	int num[3];
	int five=0,seven=0;
	scanf("%d%d%d",&num[0],&num[1],&num[2]);
	for(int i=0;i<3;i++){
		if(num[i]==5){five++;}
		if(num[i]==7){seven++;}
	}
	if(five==2&&seven==1)printf("YES");
	else{printf("NO");}
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
int H,W;
cin>>H>>W;
for(int i=0;i<W+2;i++){
    cout<<'#';
}
cout<<endl;
for(int i=0;i<H;i++){
    string A;
    cin>>A;
    cout<<'#'<<A<<'#'<<endl;
}
for(int i=0;i<W+2;i++){
    cout<<'#';
}
cout<<endl;
}

Measured memory_bytes: 256