akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc060/tasks/abc060_b

int main() {
    int a, b, c; cin >> a >> b >> c;

    for (int i = 1; i <= a*b; i++) if (a*i%b==c){
            cout << "YES" << "\n";
            return 0;
    }

    cout << "NO" << "\n";



    return 0;
}


Measured memory_bytes: 256
def factorial2(n)
  arr = [*1..n]
    return 1 if n== 0
  loop do
    return arr[0] if arr.length == 1
    arr = arr.each_slice(2).map { |a, b| b ? a * b : a }
  end
end
 
n, k =gets.strip.split.map(&:to_i)
c=a=factorial2(k-1)
k.times do |i|
  i += 1
  combi=1
    i.times{|f|combi=combi*((n-k+1)-f)/(f+1) }
  a=factorial2(k-i)
  b=factorial2(i-1)
  puts combi*c/(a*b)%1000000007
end


Measured memory_bytes: 2044
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 30);
const double PI = acos(-1);

typedef pair<int, int> P;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vll A(N),B(N);
	REP(i, N) cin >> A[i] >> B[i];
	ll ans = 0;
	REPR(i, N) {
		A[i] += ans;
		ans += (B[i] - (A[i] % B[i])) % B[i];
	}
	cout << ans << endl;
	PAU;
	return 0;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;

int main(void){
  int a, b;
  cin >> a >> b;
  if(b%a) cout << b-a << endl;
  else cout << a+b << endl;
  return 0;
}

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

using namespace std;

int n, m;
string s, t;

int main(void) {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m >> s >> t;
    int d = __gcd(n, m);
    long long ans = 1ll * n / d * m;
    int k = n / d, q = m / d;
    for (int i = 0; i < n; ++i) if (i % k == 0) if (s[i] != t[1LL * i * q / k]) ans = -1;
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
int main() {
    string s;
    cin >> s;

    FOR(i,0,3){
        if(s[i]=='1')s[i]='9';
        else if(s[i]=='9')s[i]='1';
    }

    PRINT(s);
}



Measured memory_bytes: 384
<?php

list($n, $m) = explode(" ", trim(fgets(STDIN)));
$aList = explode(" ", trim(fgets(STDIN)));
$length = count($aList);
$ans = 0;
foreach($aList as $a) {
    if ($a > $length) {
        $ans++;
    }
}
echo $ans . "\n";




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

int main(){
    
    vector<int> v(3);
    for(int i=0; i<3; ++i) cin>>v[i];
    
    sort(v.begin(), v.end());
    
    cout<<v[0]<<" "<<v[1]<<" "<<v[2]<<endl;
    
    return 0;
}


Measured memory_bytes: 3144
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int a; cin >> a;
	cout << a + a * a + a * a*a << endl;
	return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		String s = sc.next();
		
		if(a < 3200){
		    System.out.println("red");
		}else{
    		System.out.println(s);
		}
    }
}

Measured memory_bytes: 35844
Q, H, S, D = map(int, input().split())
N = int(input())

most_bargain = min(8 * Q, 4 * H, 2 * S, D)
if most_bargain != D:
    print((most_bargain // 2) * N)
else:
    if N % 2 == 0:
        print((N // 2) * D)
    else:
        print((N // 2) * D + min(4 * Q, 2 * H, S))

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class ConnectNodeInfo{
	vector<vector<pair<ll,ll>>> graph;
public:
	ConnectNodeInfo(int node_num){
		graph.resize(node_num);
	}
	void AddNonDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
		graph[v].emplace_back(u,w);
	}
	void AddDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
	}
	vector<pair<ll,ll>>& operator[](ll index){
		return graph[index];
	}
	size_t size(){return graph.size();}
};

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

	string S;
	while(cin>>S){
		string T;
		for(int i=0,ei=S.size();i<ei;){
			if(S[i]=='@'){
				int num = S[i+1]-'0';
				REP(j,num){
					T.push_back(S[i+2]);
				}
				i+=3;
			}
			else{
				T.push_back(S[i]);
				i++;
			}
		}
		out(T);
	}
	return 0;
}


Measured memory_bytes: 2980
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    string s; cin >> s;
    ll q; cin >> q;
    ll count = 0;
    rep(i, q) {
        ll t; cin >> t;
        if (t == 1) {
            count++;
        } else {
            ll f; char c; cin >> f >> c;
            if ((f + count) % 2 == 1) s.insert(s.begin(), c);
            else s.push_back(c);
        }
    }
    if (count % 2 == 1) reverse(all(s));
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 900
import sys
input = sys.stdin.readline
 
MOD = 10**9 + 7
U = 2 ** 20
 
N = int(input())
A = [int(x) for x in input().split()]
 
arr_0 = [1] * U
arr_1 = [0] * U
 
zero_update = [0] * U #0が出てきて更新した回数
zero_cnt = 0
 
c = 0
for a in A:
  c ^= a
  if c == 0:
    zero_cnt += 1
    continue
  n = zero_cnt - zero_update[c]
  zero_update[c] = zero_cnt
  a = arr_0[c]
  b = arr_1[c]
  a,b = a+n*b,b
  a,b = a,a+b
  a %= MOD
  b %= MOD
  arr_0[c] = a
  arr_1[c] = b
 
answer = 0
if c != 0:
  answer = arr_0[c]
else:
  answer = sum(arr_1[1:])
  answer += pow(2,zero_cnt-1,MOD)
  answer %= MOD
print(answer)


Measured memory_bytes: 64160
N = int(input())
A = [int(input()) for _ in range(N)]

ret = A[0] - 1
M = 2
for i in range(1, N) :
    if A[i] < M :
        continue
        
    if A[i] == M :
        M += 1
    else :
        ret += (A[i] - 1) // M
        
print(ret)

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

string s;

signed main()
{
	cin >> s;
	int win = 0, lose = 0;
	int gu = 0;		//先行しているグーの数
	rep(i,s.length()) {
		if (gu > 0) {
			//グーが先行している場合、パーを出す
			if (s[i] == 'g') {
				win++;
			}
			gu--;
		} else {
			//グーが先行していない場合、グーを出す
			if (s[i] == 'p') {
				lose++;
			}
			gu++;
		}
	}
	cout << win - lose << endl;
}


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


int main() {
  vector<char> S(4);
  int ans = 0;
  rep(i,4) cin >> S[i];
  rep(i,4) {
    if(S[i] == '+'){
      ans++;
    } else {
      ans--;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int A, B, b;
  int a = 0;
  cin >> A >> B;
  for (int i = 0; i < 2; i++)
  {
    a += max(A, B);
    b = max(A, B);
    if (b == A)
    {
      A--;
    }
    else
    {
      B--;
    }
  }
  cout << a << endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int a, b;
  cin >> a >> b;

  int diff = b - a;
  cout << (int)(diff * (diff + 1) / 2 - b) << endl;

  return 0;
}


Measured memory_bytes: 256
X, N = map(int,input().split())
p = list(map(int, input().split()))

# <要素> in <要素>
# <要素> not in <集合>
p = set(p)
for i in range(101):
    if X - i not in p:
        print(X - i)
        break
    if X + i not in p:
        print(X + i)
        break


Measured memory_bytes: 9172
public class Main{
  static int head, tail;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int h, w, i, j, k;
    int[][] wallw, wallh, d;
    int[] nowx, nowy;

    for(;;){
      w = sc.nextInt(); h = sc.nextInt();
      if(h == 0 && w == 0)break;
      wallw = new int[h][w]; wallh = new int[h][w]; d = new int[h][w];
      nowx = new int[h * w + 1]; nowy = new int[h * w + 1];

      for(i = 0;i < 2 * h - 1;i++){
        for(j = 0;j < w - 1;j++)wallw[i / 2][j] = sc.nextInt();
        wallw[i / 2][j] = 1;
        if(++i == 2 * h - 1)break;
        for(j = 0;j < w;j++)wallh[i / 2][j] = sc.nextInt();
      }

      head = 0; tail = 0;
      for(i = 0;i < h;i++)for(j = 0;j < w;j++)d[i][j] = 0;

      enqueuexy(nowx, nowy, h * w, 0, 0); d[0][0] = 1;
      for(;isnotEmpty();){
        i = dequeuex(nowx, h * w); j = dequeuey(nowy, h * w);
        if(i != h - 1 && d[i + 1][j] == 0 && wallh[i][j] == 0){
          d[i + 1][j] = d[i][j] + 1; enqueuexy(nowx, nowy, h * w, i + 1, j);
        }
        if(i != 0 && d[i - 1][j] == 0 && wallh[i - 1][j] == 0){
          d[i - 1][j] = d[i][j] + 1; enqueuexy(nowx, nowy, h * w, i - 1, j);
        }
        if(j != w - 1 && d[i][j + 1] == 0 && wallw[i][j] == 0){
          d[i][j + 1] = d[i][j] + 1; enqueuexy(nowx, nowy, h * w, i, j + 1);
        }
        if(j != 0 && d[i][j - 1] == 0 && wallw[i][j - 1] == 0){
          d[i][j - 1] = d[i][j] + 1; enqueuexy(nowx, nowy, h * w, i, j - 1);
        }
      }
      out.println(d[h - 1][w - 1]);
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
  private static void enqueuexy(int[] nowx, int[] nowy, int n, int x, int y){
    nowx[tail] = x; nowy[tail] = y;
    tail = (tail + 1) % (n + 1);
  }

  private static int dequeuex(int[] nowx, int n){
    return nowx[head % (n + 1)];
  }
  private static int dequeuey(int[] nowy, int n){
    head = (head + 1) % (n + 1);
    return nowy[(n + head) % (n + 1)];
  }

  private static boolean isnotEmpty(){
    if(head == tail)return false;
    else return true;
  }

}

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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
typedef long long ll;
typedef pair<int, int> pii;



int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int n;
    cin >> n;
    bool flag = true;
    loop(i,n){
        int x;
        cin >> x;
        if(x % 2 == 1)continue;
        if(x % 3 == 0 || x % 5 == 0)continue;
        flag = false;
    }

    if(flag)
        cout << "APPROVED" << endl;
    else
        cout << "DENIED" << endl;

    return 0;
}


Measured memory_bytes: 256
#include"iostream"
#include"cmath"
#include"vector"
#include"algorithm"
#include"set"
#include"unordered_set"
#include"map"
#include"unordered_map"
#include"string"
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int h,w;cin>>h>>w;
    vector<vector<char> >tab(h+2,vector<char>(w+2,'#'));
    for(int i=1;i<=h;++i)
        for(int j=1;j<=w;++j)
            cin>>tab[i][j];
    for(int i=0;i<h+2;++i)
    {
        for(int j=0;j<w+2;++j)
            cout<<tab[i][j];
        cout<<'\n';
    }
}




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

int main(void){
    int X,max=1;
    cin>>X;

    if(X>=1&&X<=3){
        cout<<1<<endl;
        return 0;
    }
    for(int i=2;i<=sqrt(X);i++){
        int m=i;
        while(m<=X){
            if(max<=m)
                max=m;
            m*=i;
        }
    }
    cout<<max<<endl;
    return 0;
}


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

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} Accelerate_Cin;

signed main() {
  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, x = 1;
  for (int j = 0; j < 30; j++) {
    vector<int> aa(N), bb(N);
    for (int i = 0; i < N; i++) {
      aa[i] = a[i] % (x * 2);
      bb[i] = b[i] % (x * 2);
    }

    sort(ALL(aa));

    int s = 0;
    for (int i = 0; i < N; i++) {
      s += lower_bound(ALL(aa), x * 2 - bb[i]) - lower_bound(ALL(aa), x - bb[i]);
      s += lower_bound(ALL(aa), x * 4 - bb[i]) - lower_bound(ALL(aa), x * 3 - bb[i]);
    }
    ans += (1 << j) * (s % 2);
    x *= 2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 8596
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include <algorithm>

using namespace std;

int main(){

  long long N;
  cin >> N;
  long double x;
  long int y;
  
  for(long i = N;i > 0;i--){
    x = sqrt(i);
    y = x;

    if(x == y){
      cout.precision(10);
      cout << x * x <<endl;
      return 0;
    }
    
  }

  return 0;
}


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

#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vpii        vector< pii >
#define vi          vector<ll>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			1'010'000'000'000'000'017LL
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define sz(x)       (ll)x.size()
#define rep(i,a,b)	for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )

using namespace std;

template<class T>
bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>
bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
ll DivisorCount(ll x) {
	ll ans = 1;
	for (int i = 2; i <= sqrt(x); i++) {
		int cnt = 0;
		while (x % i == 0) {
			cnt++;
			x /= i;
		}
		ans *= (cnt + 1);
		if (x == 1) break;
	}
	if (x != 1) ans *= 2;
	return ans;
}

void Main() {
	ll N;
	cin >> N;

	ll result = 0;
	rep(i, 1, N + 1) {
		ll X = N / i;
		result += i*X*(X + 1) / 2;
	}

	cout << result << endl;
}


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

	Main();
	return 0;
}


Measured memory_bytes: 3620
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10, mod = 998244353;
const ll base = ll(1e18) % mod;

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

int mul(ll a, int b) {
	a *= b;
	return a % mod;
}

int pbase[N];

vector<pii> get(int n);

int main() {
	fast_cin();
	int n; cin >> n;
	pbase[0] = 1;
	for (int i = 1; i <= n; ++i) {
		pbase[i] = mul(pbase[i - 1], base);
	}
	vector<vector<pii>> g(3);
	for (auto& v : g) {
		v = get(n);
	}
	vector<int> sum(2 * n + 1, 0);
	for (auto& p1 : g[0]) {
		for (auto& p2 : g[1]) {
			sum[p1.first ^ p2.first] = add(sum[p1.first ^ p2.first], mul(p1.second, p2.second));
		}
	}
	int ans = 0;
	for (auto& p : g[2]) {
		ans = add(ans, mul(p.second, sum[p.first]));
	}
	cout << ans << endl;
}

vector<pii> get(int n) {
	vector<vector<int>> g(n + 1);
	int m; cin >> m;
	while (m--) {
		int u, v;
		cin >> u >> v;
		g[min(u, v)].pb(max(u, v));
	}
	vector<int> v(n + 1, 0);
	map<int, int> temp;
	for (int i = n; i >= 1; --i) {
		set<int> seen;
		for (auto& j : g[i]) {
			seen.insert(v[j]);
		}
		while (seen.count(v[i])) {
			++v[i];
		}
		temp[v[i]] = add(temp[v[i]], pbase[i]);
	}
	vector<pii> ans(temp.begin(), temp.end());
	return ans;
}

Measured memory_bytes: 5200
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
    int n[1000], i;
    for (i = 0; i < 3; i++)
    {
        cin >> n[i];
    }
    for (i = 0; i <= 2; i++)
    {
        sort(n, n + 3);
        if (i != 2)
            cout << n[i] << ' ';
        else
            cout << n[i] << endl;
    }
    return 0;
}

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

int main()

{
    string s;
    cin>>s;
    for(int i=0; i<s.size(); i++){
        if(s[2]==s[3] && s[4]==s[5]){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;

}




Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  if(a == b){
    cout << "Draw" << endl;
    return 0;
  }
  if(a == 1) a += 13;
  if(b == 1) b += 13;
  if(a < b)
    cout << "Bob" << endl;
  else
    cout << "Alice" << endl;
  return 0;
}

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


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

    int res = 0;
    rep(i, n-1) {
        if (s[i] == s[i+1]) ++res;
    }

    cout << min(res + 2 * k, n - 1) << endl;
}

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

#define lli long long int
#define REP(i,s,n) for(lli i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(xx) if(DEBUG)cout<<TO_STRING(xx)<<"="<<xx<<" "<<endl;
#define LOG2(xx,yy) if(DEBUG)cout<<TO_STRING(xx)<<"="<<xx<<" "<<TO_STRING(yy)<<"="<<yy<<endl;
#define LOG3(xx,yy,z) if(DEBUG)cout<<TO_STRING(xx)<<"="<<xx<<" "<<TO_STRING(yy)<<"="<<yy<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,xx,yy,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(xx)<<"="<<xx<<" "<<TO_STRING(yy)<<"="<<yy<<" "<<TO_STRING(z)<<"="<<z<<endl;

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

void solve(){

	string s;
	string t;
	cin>>s>>t;

	lli ans = INF;
	REP(i,0,s.size()-t.size()+1){
		lli cnt = 0;
		REP(j,0,t.size()){
			if(s[i+j] != t[j])cnt++;
		}
		chmin(ans,cnt);
	}

	cout<<ans<<endl;


}

int main(){
	
    // cout << fixxed << setprecision(5);
    lli t=1;
    //cin>>t;
    while(t--)solve();

    return 0;
}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    int n,k;
    cin>>n>>k;
    int arr[n] = {0};
    while(k--)
    {
        int d;
        cin>>d;
        while(d--)
        {
            int x;
            cin>>x;
            arr[x-1]++;
        }
    }
    int ans = 0;
    for(int i = 0;i<n;i++)
    {
        if(arr[i]==0)
        {
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

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

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

    priority_queue<int> d;
    for(int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        d.push(tmp);
    }

    int ans = 1;
    for(int i = 1; i < n; i++) {
        int tmp = d.top();
        d.pop();

        if(tmp != d.top()) {
            ans++;
        }
    }

    cout << ans << endl;
    
    return 0;
}

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

#define ll long long int
#define f(i,x,n)  for(int i=x;i<n;i++)
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define sz(a) int((a).size())
#define mod 1000000007
#define inf LLONG_MAX
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
template <typename T>
inline T gcd(T a, T b)
{
    while (b != 0) swap(b, a %= b);
    return a;
}

template <typename T>
inline void seethis(vector<T>vect)
{
    for(T x : vect)
        cout << x << " ";
    cout << "\n";
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
//LCM
int lcm(int a, int b)
{
    return a * (b / gcd(a, b));
}

//For sort by second
bool cmp(const pair<int, int> &a)
{
    return a.first < a.second;
}

//Tree
/* const int MAXN = 1e5 + 5;
vector<ll> adj[MAXN];*/

//ModPower
ll modpower(ll a, ll b, ll c)
{
    ll res = 1;
    while(b)
    {
        if(b & 1LL)
            res = (res * a) % c;
        a = (a * a) % c;
        b >>= 1;
    }
    return res;
}
ll dp[10001][101][2];

void add_self(ll &a, ll b)
{
    a += b;
    if(a >= mod)
        a -= mod;
}

ll solve(string &s, int D, int pos, int d, int tight)
{


    if(dp[pos][d][tight] != -1)
        return dp[pos][d][tight];

    int choices = (tight) ? (s[pos] - '0') : 9;

    if(pos == (int(s.length())-1))
    {
        ll res = 0;
        for(int x = 0; x <= choices; x++)
            if((x % D) == d)
                res++;
        return res;
    }


    ll res = 0;
    for(int x = 0; x <= choices; x++)
    {
        add_self(res, solve(s, D, pos + 1, (D + d - x % D) % D, tight and (x == choices)));
    }

    return dp[pos][d][tight] = res;

}


int main()
{
    FASTIO;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    string k;
    cin >> k;
    int d;
    cin >> d;
     memset(dp, -1, sizeof dp);
    ll ans = solve(k, d, 0, 0, 1);
   
    cout << (ans-1+mod)%mod << "\n";



    return 0;
}

Measured memory_bytes: 20368
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

ll gcd(ll x, ll y) {
    if(y == 0) {
        return x;
    }
    return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
    return x/gcd(x, y)*y;
}

ll LCM(vl &v) {  // vの全要素のlcm
    ll res = 1;
    rep(i, v.size()) {
        res = lcm(res, v[i]);
    }
    return res;
}

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

    vl t(n);
    rep(i, n) {
        cin >> t[i];
    }

    out(LCM(t));
    re0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

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

    vector<int> v(n);
    rep(i,n) cin >> v[i];
    sort(v.rbegin(), v.rend());

    int sum = 0;
    rep(i,k) sum += v[i];
    cout << sum << endl;
}


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

ll N, A, B, C;
ll l[9];

ll dfs(ll x, ll a, ll b, ll c) {
	if (x == N) {
		if (min({ a,b,c }) > 0) {
			return abs(a - A) + abs(b - B) + abs(c - C) - 30;
		}
		return INF;
	}
	int cost0 = dfs(x + 1, a, b, c);
	int cost1 = dfs(x + 1, a + l[x], b, c) + 10;
	int cost2 = dfs(x + 1, a, b + l[x], c) + 10;
	int cost3 = dfs(x + 1, a, b, c + l[x]) + 10;
	return min({ cost0, cost1, cost2, cost3 });
}

int main() {
	cin >> N >> A >> B >> C;
	rep(i, 0, N) cin >> l[i];

	cout << dfs(0, 0, 0, 0) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long a,b,i,c=0;
string s;
cin>>s;
for(i=0;i<s.size();i++)
{
	if(s[i]=='g') c++;
	else c--;
}
cout<<c/2<<endl;
return 0;
}


Measured memory_bytes: 3768
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <cstdio>
#include <iomanip>

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;(i)>=0;(i)--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())

typedef long long ll;

int dp[1000];

int main(){
    
    REP(i,1000)dp[i]=1;
    for(int i=2;i<=17;i++){
        REP(j,1000){
            dp[j+i*i]+=dp[j];
        }
    }
    
    while(true){
        int n; cin>>n;
        if(n==0)break;
        cout<<dp[n]<<endl;
    }
    
    return 0;
}

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

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)

#define ll long long
#define ull unsigned ll

void reader(int *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
void reader(ll *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
void reader(double *x){scanf("%lf",x);}
int reader(char c[]){int i,s=0;for(;;){mygc(i);if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF) break;}c[s++]=i;for(;;){mygc(i);if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF) break;c[s++]=i;}c[s]='\0';return s;}
template <class T, class S> void reader(T *x, S *y){reader(x);reader(y);}
template <class T, class S, class U> void reader(T *x, S *y, U *z){reader(x);reader(y);reader(z);}
template <class T, class S, class U, class V> void reader(T *x, S *y, U *z, V *w){reader(x);reader(y);reader(z);reader(w);}

void writer(int x, char c){int s=0,m=0;char f[10];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);}
void writer(ll x, char c){int s=0,m=0;char f[20];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);}
void writer(double x, char c){printf("%.15f",x);mypc(c);}
void writer(const char c[]){int i;for(i=0;c[i]!='\0';i++)mypc(c[i]);}
void writer(const char x[], char c){int i;for(i=0;x[i]!='\0';i++)mypc(x[i]);mypc(c);}
template<class T> void writerLn(T x){writer(x,'\n');}
template<class T, class S> void writerLn(T x, S y){writer(x,' ');writer(y,'\n');}
template<class T, class S, class U> void writerLn(T x, S y, U z){writer(x,' ');writer(y,' ');writer(z,'\n');}
template<class T> void writerArr(T x[], int n){int i;if(!n){mypc('\n');return;}rep(i,n-1)writer(x[i],' ');writer(x[n-1],'\n');}

char memarr[17000000]; void *mem = memarr;
#define MD 1000000007

int N;
char S[10000];

int main(){
  int i, j, k;
  int fg1 = 0, fg2 = 0;

  N = reader(S);
  rep(i,N){
    if(S[i]=='N') fg1 |= 1;
    if(S[i]=='S') fg1 |= 2;
    if(S[i]=='W') fg2 |= 1;
    if(S[i]=='E') fg2 |= 2;
  }

  if(fg1 == 3) fg1 = 0;
  if(fg2 == 3) fg2 = 0;
  if(fg1 || fg2) writerLn("No");
  else writerLn("Yes");

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int h,a;
    cin>>h>>a;
    if(h%a==0)
    {
        cout<<h/a<<"\n";
    }
    else
    {
        cout<<(h/a)+1<<"\n";
    }
    

    return 0;
}


Measured memory_bytes: 256
N,K = map(int,input().split())
odd = []
even1 = []
even2 = []
if K % 2 == 1:
    for i in range(1,N+1):
        if i % K == 0:
            odd += [i]
    ans = len(odd) ** 3
else:
    for i in range(1,N+1):
        if i % K == 0:
            even1 += [i]
        elif i % (K/2) == 0:
            even2 += [i]
    ans = len(even1) ** 3 + len(even2) ** 3
print(ans)

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

#define int long long
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(i, l, r) for(int i=(int)(l);i<=(int)(r);i++)
int inf = 1000000000000000000;

using namespace std;

void solve(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;

    int r[4];
    r[0]=a*c;
    r[1]=a*d;
    r[2]=b*c;
    r[3]=b*d;

    sort(r, r+4);

    cout << r[3] << endl;




}

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

    return 0;
}


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

using namespace std;

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

	int a, b;
	cin >> a >> b;
	cout << max({a + b,a - b,a*b}) << endl;
	
	return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	string s;
	cin>>s;
	int n = s.size();
	int ans = 0, count = 0;
	for(int i=0;i<s.size();i++){
		if(i != n-1 && s[i] == 'R'){
			count++;
		}
		else if(i == n-1 && s[i] == 'R'){
			count++;
			ans = max(ans, count);
		}
		else{
			ans = max(count, ans);
			count = 0;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

//map<string>a
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)


int main() {
	int a[3];
	int k;
	rep(i, 3) {
		cin >> a[i];
	}
	cin >>k;
	int ans=0;
	for (int i = 0; i < 2; i++) {
		while (a[i] >= a[i+1]) {
			a[i+1] *= 2;
			ans++;
		}
	}
	if (ans <= k) {
		cout << "Yes";

	}
	else {
		cout << "No";
	}
}
	



Measured memory_bytes: 3624
#include<iostream>
#include<math.h>
using namespace std;
main(){
    char s[110000][20];
    int long long n;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>s[i];
    char march[6]="MARCH";
    int long long count[5]={};
    for(int i=0;i<n;i++){
        for(int j=0;j<5;j++)
        if(march[j]==s[i][0]) count[j]++;
    }
    int long long ans=0;
    for(int i=0;i<3;i++){
        for(int j=(i+1);j<4;j++){
            for(int k=(j+1);k<5;k++){
                ans+=count[i]*count[j]*count[k];
            }
        }
    }
    cout<<ans;
    return 0;
}

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

using namespace std;

int main()
{
    int n, k;   cin >> n >> k;
    vector <int> v(n);
    for (int &x : v)
        cin >> x;
    
    sort(v.begin(), v.end());
    int sum = 0;
    for (int i = 0; i < k; i++)
        sum += v[i];
    cout << sum << "\n";
}

Measured memory_bytes: 3640
#[allow(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
   input! {
      n: usize,
      _a: [usize; n]
   }
   let mut s = std::collections::BTreeMap::new();
   for a in _a {
      s.entry(a).and_modify(|v| *v += 1).or_insert(1);
   }
   let s2 = s.clone();
   for (&a, v) in s2.iter() {
      if *v > 1 {
         if let Some(v) = s.get_mut(&a) {
            *v = 0;
         }
      }
      let mut i = 2;
      while i * a <= 1000000 {
         if let Some(v) = s.get_mut(&(a * i)) {
            *v = 0;
         }
         i += 1;
      }
   }
   let mut ans = 0;
   for k in s.values() {
      ans += k;
   }
   println!("{}", ans);
}


Measured memory_bytes: 12532
#include <stdio.h>

int ord(const void *x, const void *y){
    const int a = *((int *)x);
    const int b = *((int *)y);
    
    if (a>b)
        return 1;
    if (a<b)
        return -1;
    
    return 0;
}

int main(){
    int x;
    scanf("%d", &x);
    long long int vet[x+10];
    
    for(int i=0;i<x;i++){
        scanf("%lli", &vet[i]);
    }
    
    qsort(vet,x,sizeof(vet[0]), ord);
    
    printf("%lli\n", vet[x-1]-vet[0]);
    
    return 0;
}


Measured memory_bytes: 128
// failed to generate code

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 100000000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())

vector<vector<ll>> dp(3001, vector<ll>(3001, -1));
vector<vector<ll>> sum(3001, vector<ll>(3001, -1));

ll n;
vector<ll> a(3001);

ll rec(ll i, ll j) {
    if (dp[i][j] != -1) return dp[i][j];
    if (i == j) return dp[i][j] = 0;
    ll res = INF;

    for (int k = i; k < j; k++) {
        res = min(res, rec(i, k) + rec(k + 1, j) + sum[i][j]);
    }
    return dp[i][j] = res;
}

int main() {
    cin >> n;
    rep(i, n) cin >> a[i];
    for (int i = 0; i < n; i++) {
        sum[i][i] = a[i];
        for (int j = i + 1; j < n; j++) {
            sum[i][j] = sum[i][j - 1] + a[j];
        }
    }
    cout << rec(0, n - 1) << endl;
}


Measured memory_bytes: 141184
#include <bits/stdc++.h>
using namespace std;
int l[9];
int n,a,b,c;
int ans;
int dfs(int number,int A,int B,int C){
    if(number==n){
        if(A>0 && B>0 && C>0)ans=abs(A-a)+abs(B-b)+abs(C-c)-30;
        else ans=1e9;
        return ans;
    }
    else{
        if(number==0)ans=1e9;
        int ans1=dfs(number+1,A+l[number],B,C)+10;
        int ans2=dfs(number+1,A,B+l[number],C)+10;
        int ans3=dfs(number+1,A,B,C+l[number])+10;
        int ans4=dfs(number+1,A,B,C);
        return min(min(min(ans1,ans2),ans3),ans4);
    }
}

int main(){
    cin >> n >> a >> b >> c;
    for(int i=0;i<n;i++)cin >> l[i];
    cout << dfs(0,0,0,0) << endl;
}

Measured memory_bytes: 256
N,M = map(int, input().split())
a,b = [0]*N,[0]*N
c,d = [0]*M,[0]*M
for i in range(N):
    a[i],b[i] = map(int, input().split())

for i in range(M):
    c[i],d[i] = map(int, input().split())

for i in range(N):
    index = float('inf')
    mini = float('inf')
    for j in range(M):
        if mini > abs(a[i]-c[j])+abs(b[i]-d[j]):
            index = j
            mini = min(mini, abs(a[i]-c[j])+abs(b[i]-d[j]))
    print(index+1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

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

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
string S;

void solve(){
	cout << S[0] << S.size() - 2 << *S.rbegin() << endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> S;
		solve();
	return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;

#ifndef LOCAL
#pragma GCC optimize ("O2")
#define endl '\n'
#endif

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

ll pwr(ll a,ll b, ll mod){
    a %= mod;
    int ans = 1;
    while(b){
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

const int N = 2e5 + 5;
int a[N];
void solve(){
	int n, k;
	cin >> n >> k;
	fr(i, 1, n){
		cin >> a[i];
	}
	k--;
	int ans = 1e18;
	fr(i, 1, n - k){
		ans = min(ans, a[i + k] - a[i] + min(abs(a[i]), abs(a[i + k])));
	}
	cout << ans;
}
signed main(){
    IO;
    #ifdef LOCAL
        freopen("inp.txt","r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    cout << setprecision(10) << fixed;
    int t = 1;
    // cin >> t;
    fr(tt, 1, t){
        solve();
    }
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 1; i < (int)(n); i++)
using ll = long long;
using pll = pair<ll,ll>;
using vvll = vector<vector<ll>>;
using vll = vector<ll>;
using vstr = vector<string>;
const ll MOD=1000000007;
vll dx{0,1,0,-1};
vll dy{1,0,-1,0};

int main()
{
    ll N;
    cin>>N;
    ll res=0;
    for(ll i=1;i<N;i++)res+=floor((N-1)/i);
    cout<<res;
    return 0;
}

Measured memory_bytes: 3592