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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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;}

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

ll n;

void dfs(string s,char m){
	if((ll)s.size()==n) cout << s << endl;
	else{
		for(char c='a';c<=m;c++){
			if(c==m) dfs(s+c,(char)(m+1));
			else dfs(s+c,m);
		}
	}
}

int main()
{
	cin >> n;
	dfs("",'a');
	return 0;
}

Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder_CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var readLine = Console.ReadLine().Split();
            var x = int.Parse(readLine[0]);
            var y = int.Parse(readLine[1]);
            var fare = x + y / 2;
            Console.WriteLine(fare);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=100005,INF=1<<28;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int A,B,C,D;cin>>A>>B>>C>>D;
        if(A+B+C+D==0) break;
        int cnt=0;
        
        while(A<B*C){
            A+=D;
            cnt++;
        }
        
        cout<<cnt<<endl;
    }
}



Measured memory_bytes: 3136
#プログラムの例:
n=int(input())
listsT=list(map(int,input().split()))
from fractions import gcd
lists_left=[]
lists_right=[]
number1=0
number2=0
for i in range(n):
    if i==0:
        lists_left.append(0)
    if i==1:
        lists_left.append(listsT[0])
        number1=listsT[0]
    if i>=2:
        number1=gcd(number1,listsT[i-1])
        lists_left.append(number1)

number2=listsT[-1]
for j in range(n,0,-1):
    if j==n:
        lists_right.append(0)
    if j==n-1:
        lists_right.append(listsT[-1])
    if j<n-1:      
        number2=gcd(number2,listsT[j])  
        lists_right.append(number2)
ans=0
for x in range(n):
    if ans<= gcd(lists_right[x],lists_left[n-1-x]):
        ans=gcd(lists_right[x],lists_left[n-1-x])   
print(ans)

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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

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

  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    a[i] -= (i + 1);
  }
  sort(a.begin(), a.end());
  dumpv(a);
  ll ans = LINF;
  for (ll b = a[N / 2] - 5; b <= a[N / 2] + 5; b++) {
    ll sum = 0;
    for (int i = 0; i < N; i++) {
      sum += abs(a[i] - b);
    }
    dump(b, ans, sum);
    ans = min(ans, sum);
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

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

  vector<int> a(n);
  long long t = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    t += a[i];
  }
  sort(a.begin(), a.end());

  if (t < x) {
    cout << n - 1 << '\n';
    return 0;
  }
  while (n >= 0) {
    if (t <= x) {
      cout << n << '\n';
      return 0;
    }
    t -= a[--n];
  }
  
  return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns               #-}
{-# LANGUAGE DerivingStrategies         #-}
{-# LANGUAGE FlexibleContexts           #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiWayIf                 #-}
{-# LANGUAGE RankNTypes                 #-}
{-# LANGUAGE ScopedTypeVariables        #-}
{-# LANGUAGE TypeApplications           #-}
{-# LANGUAGE UndecidableInstances       #-}
import           Control.Monad.State.Strict
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.List
import qualified Data.Vector                 as V
import qualified Data.Vector.Algorithms.Heap as VH

main :: IO ()
main = do
  n <- readLn @Int
  ps <- concatMap show <$> readLnAsListWith unconsInt
  qs <- concatMap show <$> readLnAsListWith unconsInt

  let rs' = V.fromList $ permutations $ concatMap show [1..n]
  rs'' <- V.thaw rs'
  VH.sort rs''
  rs <- V.freeze rs''

  let a = meguruBSearch (condLE rs ps) (-1) (V.length rs)
      b = meguruBSearch (condLE rs qs) (-1) (V.length rs)

  print $ abs $ a - b


meguruBSearch :: (Int -> Bool) -> Int -> Int -> Int
meguruBSearch isOk = go
  where go ok ng | abs (ok - ng) > 1 = let mid = (ok + ng) `div` 2
                                       in if isOk mid
                                          then go mid ng
                                          else go ok mid
                 | otherwise = ok

condLE :: Ord a => V.Vector a -> a -> Int -> Bool
condLE vec key idx = key >= vec V.! idx


-- converter
unconsInt :: StateT BS.ByteString Maybe Int
unconsInt = StateT $ BS.readInt . BS.dropWhile isSpace

-- 1D Data
-- for list
readLnAsListWith :: StateT BS.ByteString Maybe a -> IO [a]
readLnAsListWith !st = unfoldr (runStateT st) <$> BS.getLine


Measured memory_bytes: 17304
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e5+5;
int n,sum,a[N],b[N],c[N];
signed main()
{
	cin>>n;
	for(int i=1;i<=n;i++)scanf("%lld",&b[i]);
	for(int i=1;i<n;i++)c[i]=2*(b[i]-b[i+1]);
	for(int i=1;i<n;i+=2)sum+=c[i];
	sum+=2*b[n];
	a[1]=sum/2;
	for(int i=2;i<=n;i++)a[i]=2*b[i-1]-a[i-1];
	for(int i=1;i<=n;i++)printf("%lld ",a[i]);
}

Measured memory_bytes: 3712
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

int main()
{
  string s, t;
  cin >> s >> t;
  int result = 0;
  for (int i = 0; i < s.size(); ++i) if (s[i] != t[i]) result++;
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3920
//
// Created by tac on 2016/10/16.
//

#include <cstdlib>
#include <utility>
#include <string>
#include <iostream>

namespace {

std::pair<int, int> calc_point(const std::string& s1, const std::string& s2) {
    std::pair<int, int> point;
    if (s1 > s2) {
        point.first = 3;
        point.second = 0;
    } else if (s1 < s2) {
        point.first = 0;
        point.second = 3;
    } else {
        point.first = 1;
        point.second = 1;
    }

    return point;
}

}

int main() {
    int n;
    std::string s1, s2;
    int p1 = 0;
    int p2 = 0;
    std::pair<int, int> point;
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        std::cin >> s1 >> s2;
        point = calc_point(s1, s2);
        p1 += point.first;
        p2 += point.second;
    }
    std::cout << p1 << " " << p2 << std::endl;
    return EXIT_SUCCESS;
}

Measured memory_bytes: 3172
n = int(input())

for i in range(1,3501):
    for j in range(1,3501):
        if 4*i*j-n*(i+j) != 0:
            w = (n*i*j)/(4*i*j-n*(i+j))
            if w > 0 and int(w)==w:
                print(i,end=' ')
                print(j,end=' ')
                print(int(w))
                exit()


Measured memory_bytes: 40684
#include<stdio.h>
#include<string.h>
int main(){
char s[20];
char s2[20]="CODEFESTIVAL2016";
int ans=0;
scanf("%s",s);
for (int i=0;i<16;i++)
   if (s[i]!=s2[i]) ans++;
printf("%d",ans);
return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair < int, int >;

int main() {
	ios_base::sync_with_stdio (false);
	cin.tie (0); cout.tie (0);
	int k; cin >> k;
	ll sum = 0;
	for (int a = 1; a <= k; a++) {
		for (int b = 1; b <= k; b++) {
			for (int c = 1; c <= k; c++) {
				sum += __gcd (__gcd (a, b), c);
			}
		}
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

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

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int N;
    cin >> N;
    auto F = make_vec<int>(N, 10);
    auto P = make_vec<int>(N, 11);
    vector<int> C(N);
    REP(i, N) {
        REP(j, 10) {
            cin >> F[i][j];
            C[i] += F[i][j];
        }
    }
    REP(i, N) {
        REP(j, 11) { cin >> P[i][j]; }
    }

    ll ans = -INF;
    FOR(bit, 1, 1 << 10) {
        ll tmp = 0;
        REP(i, N) {
            int c = 0;
            REP(j, 10) {
                int mask = 1 << j;
                if (bit & mask)
                    if (F[i][j]) c++;
            }
            tmp += P[i][c];
        }
        chmax(ans, tmp);
    }
    cout << ans << endl;

    return 0;
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, tmp, sum, a, b, c, d, k, m, h, w, q, x, y;
string s, t;

int main() {
    cin >> s;
    MSG(700 + 100 * (s.at(0) == 'o') + 100 * (s.at(1) == 'o') + 100 * (s.at(2) == 'o'))
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
pair<int,int> operator+(pair<int,int> &l, pair<int,int> &r) {
  return {l.first+r.first, l.second+r.second}; }

int main() {
  int n, x;
  cin>>n>>x;
  int count=0;
  int total=0;
  int minM = 0x3f3f3f;
  for(int i=0; i<n; i++) {
    int m;
    cin>>m;
    total+=m;
    minM = min(minM, m);
    count++;
  }
  count+= (x-total)/minM;
  cout<<count<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <string>
#include <random>
typedef long long ll;
#define pb push_back
#define pf push_front
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vll vector <ll>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define sz(x) (int)x.size()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 3e5;
const ll INF = 1e9;
const ll kek=998244353;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
  cin>>n;
    vector <int> c(401,0);
    for (int i=1;i<10;i++)
    {
        for    (int j=1;j<10;j++)
        c[i*j]=1;
    }
    if (c[n]==1)
        cout<<"Yes";
    else
        cout<<"No";
}






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

#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<"\n";
#define debug3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define debug2(a,b) cout<<a<<" "<<b<<"\n";
#define debug4(a,b,c,d) cout<<a<<" "<< b <<" "<<c<<" "<<d<<"\n";

ll mod = 1000000007;

using namespace std;

int main()
{
	/*#ifndef ONLINE_JUDGE
	 freopen("input.txt", "r", stdin);
	 freopen("output.txt", "w", stdout);
	#endif*/
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	int a,b;
	cin>>a>>b;
	if(a == 2 ||b == 2 )
	{
		cout<<"No\n";
	}
	else 
	{
		cout<<"Yes\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std; 
int main () { 
double a,b; 
scanf("%lf %lf", &a ,&b) ;

if (a>b) 
printf("GREATER" ) ;
else if (a==b)
printf("EQUAL" ) ;
else
printf("LESS");


return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <bitset>
#include <stack>
#include <queue>
#include <cmath>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
using namespace std;
typedef long long ll;
const int maxn=200050;
vector<int> v[maxn];
int a[maxn],b[maxn];
int sum1[maxn],sum2[maxn];
bool mark[maxn];
int n;

void solve(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		sum1[a[i]]++;
	}
	for(int i=1;i<=n;i++){
		scanf("%d",&b[i]);
		sum2[b[i]]++;
	}
	for(int i=1;i<=n;i++){
		if(sum1[i]+sum2[i]>n){
			printf("No\n");return;
		}
	}
	for(int i=1;i<=n;i++){
		if(a[i]==b[i]){
			v[a[i]].push_back(i);
		}
	}
	int l=1,r=n;
	while(1){
		while(l<=n&&!v[l].size())	l++;
		while(r>=1&&!v[r].size())	r--;
		if(l>n||r<1||l==r)	break;
		int pos1=v[l].back();
		int pos2=v[r].back();
		v[l].pop_back();
		v[r].pop_back();
		swap(b[pos1],b[pos2]);
	}
	if(l==r){
		for(int i=1;i<=n;i++){
			if(a[i]!=l&&b[i]!=l){
				int pos=v[l].back();
				v[l].pop_back();
				swap(b[pos],b[i]);
				if(!v[l].size())	break;
			}
		}
	}
	if(v[l].size()){
		printf("No\n");return;
	}
	printf("Yes\n");
	for(int i=1;i<=n;i++)	printf("%d ",b[i]);
	printf("\n");
}
int main(){
	solve();
	return 0;
}

Measured memory_bytes: 17260
N = int(input())

num_list = []

for i in range(1,int(N**0.5)+1):
    if N % i == 0:
        num_list.append([i,N//i])

ans = 10**9+7

for i in range(len(num_list)):
    tmp = max(len(str(num_list[i][0])),len(str(num_list[i][1])))
    ans = min(ans,tmp)
    
print(ans)

Measured memory_bytes: 3188
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {

    let c1:Vec<char> = read::<String>().chars().collect();
    let c2:Vec<char> = read::<String>().chars().collect();
    let c3:Vec<char> = read::<String>().chars().collect();
    let ans = format!("{}{}{}",c1[0],c2[1],c3[2]);
    println!("{}",ans);
}


Measured memory_bytes: 4352
from collections import deque

H, W = map(int, input().split())
S = [input() for _ in range(H)]

T = [[None] * W for _ in range(H)]
T[0][0] = 1
D = deque([(0, 0)])
while D:
    h, w = D.popleft()
    for dh, dw in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        if 0 <= h + dh < H and 0 <= w + dw < W and S[h + dh][w + dw] == '.' and T[h + dh][w + dw] is None:
            T[h + dh][w + dw] = T[h][w] + 1
            D.append((h + dh, w + dw))

if T[H - 1][W - 1] is None:
    print(-1)
else:
    print(sum(s.count('.') for s in S) - T[H - 1][W - 1])


Measured memory_bytes: 3316
import collections
N = int(input())
V = [int(X) for X in input().split()]

if len(set(V))==1:
    print(N//2)
else:
    OddV  = V[::2]
    EvenV = V[1::2]
    LenOddV  = len(set(OddV))
    LenEvenV = len(set(EvenV))
    if LenOddV==1 and LenEvenV==1:
        NOddV  = OddV[0]
        NEvenV = EvenV[0]
        print(0)
    elif LenOddV!=1 and LenEvenV==1:
        OddCount = collections.Counter(OddV)
        NEvenV   = EvenV[0]
        if OddCount.most_common()[0][0]==NEvenV:
            NOddV = OddCount.most_common()[1][0]
            print(N//2-OddCount.most_common()[1][1])
        else:
            NOddV = OddCount.most_common()[0][0]
            print(N//2-OddCount.most_common()[0][1])
    elif LenOddV==1 and LenEvenV!=1:
        NOddV     = OddV[0]
        EvenCount = collections.Counter(EvenV)
        if EvenCount.most_common()[0][0]==NOddV:
            NEvenV = EvenCount.most_common()[1][0]
            print(N//2-EvenCount.most_common()[1][1])
        else:
            NEvenV = EvenCount.most_common()[0][0]
            print(N//2-EvenCount.most_common()[0][1])
    elif LenOddV!=1 and LenEvenV!=1:
        OddCount  = collections.Counter(OddV)
        EvenCount = collections.Counter(EvenV)
        if OddCount.most_common()[0][0]!=EvenCount.most_common()[0][0]:
            NOddV  = OddCount.most_common()[0][0]
            NEvenV = EvenCount.most_common()[0][0]
            print(N-OddCount.most_common()[0][1]-EvenCount.most_common()[0][1])
        else:
            if OddCount.most_common()[0][1]>EvenCount.most_common()[0][1]:
                NOddV  = OddCount.most_common()[0][0]
                NEvenV = EvenCount.most_common()[1][0]
                print(N-OddCount.most_common()[0][1]-EvenCount.most_common()[1][1])
            elif OddCount.most_common()[0][1]<EvenCount.most_common()[0][1]:
                NOddV  = OddCount.most_common()[1][0]
                NEvenV = EvenCount.most_common()[0][0]
                print(N-OddCount.most_common()[1][1]-EvenCount.most_common()[0][1])
            else:
                if OddCount.most_common()[1][1]>=EvenCount.most_common()[1][1]:
                    NOddV  = OddCount.most_common()[1][0]
                    NEvenV = EvenCount.most_common()[0][0]
                    print(N-OddCount.most_common()[1][1]-EvenCount.most_common()[0][1])
                elif OddCount.most_common()[1][1]<EvenCount.most_common()[1][1]:
                    NOddV  = OddCount.most_common()[0][0]
                    NEvenV = EvenCount.most_common()[1][0]
                    print(N-OddCount.most_common()[0][1]-EvenCount.most_common()[1][1])

Measured memory_bytes: 24900
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <climits>
#include <cstdio>
 
#define nl '\n'
 
using namespace std;
 
long long n, a;

int main(){

    cin >> n;

    vector<long long> v;

    long long arr[n+5];

    for(long long i = 0; i < n; i++){
        cin >> a;
        v.push_back(a);
    }

    arr[n-1] = v[n-1];

    for(long long i = 0 ; i < n-1; i++){
        if(i%2 == 0){
            arr[n-1] -= v[i];
        } else{
            arr[n-1] += v[i];
        }
    }

    for(long long i = 0; i < n-1; i++){
        if(i == 0){
            arr[i] = 2*(v[n-1] - (arr[n-1]/2));
        } else {
            arr[i] = 2*(v[i-1] - (arr[i-1]/2));
        }
    }

    for(long long i = 0; i < n; i++){
        cout << arr[i] << " ";
    }






}
 
//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out
 
//Surely this will AC

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define mid (l+r)/2
#define ll long long
#define ii pair < int , ll >
#define fi first
#define se second


using namespace std;
const int N=2e5+55;
vector < ii > vec[N];
ll tree[N*4];
ll lazy[N*4];
int n,m;

void propa(int l , int r , int node)
{
	if(l!=r)
	{
		lazy[node*2]+=lazy[node];
		lazy[node*2+1]+=lazy[node];
	}
	tree[node]+=lazy[node];
	lazy[node]=0;
}

void update(int l , int r , int node , int x , int y , ll val)
{
	propa(l,r,node);
	if(l>y||r<x)
		return ;
	if(x<=l&&r<=y)
	{
		lazy[node]+=val;
		propa(l,r,node);
		return ;
	}
	update(l,mid,node*2,x,y,val);
	update(mid+1,r,node*2+1,x,y,val);
	tree[node]=min(tree[node*2],tree[node*2+1]);
}

ll query(int l , int r , int node , int x , int y )
{
	propa(l,r,node);
	if(l>y||r<x)
		return 1e9;
	if(x<=l&&r<=y)
		return tree[node];
	propa(l,mid,node*2);
	propa(mid+1,r,node*2+1);
	return min(
			query(l,mid,node*2,x,y),
			query(mid+1,r,node*2+1,x,y));
}

int main()
{
	scanf("%d %d",&n,&m);
	int l,r;
	ll d;
	ll sum=0;
	for(int i=0;i<m;i++)
	{
		scanf("%d %d %lld",&l,&r,&d);
		vec[r].push_back({l,d});
			sum+=d;
	}
	ll best;
	update(0,n,1,1,n,+1e9);
	for(int i=1;i<=n+1;i++)
	{
		best=query(0,n,1,0,n);
		for(auto q:vec[i])
		{
			update(0,n,1,0,q.fi-1,q.se);
		}
		update(0,n,1,i,i,best-1e9);
	}
	printf("%lld\n",sum-best);
	return 0;
}


Measured memory_bytes: 23680
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class c{
    public static void Main(){
        string[] strs = Console.ReadLine().Split(' ');
        int H = int.Parse(strs[0]);
        int W = int.Parse(strs[1]);
        int K = int.Parse(strs[2]);
        int ans = 0;
        char[,] field = new char[H,W];
        char[,] temp = new char[H,W];
        for(int i=0; i<H; i++){
            string str = Console.ReadLine();
            for(int j=0; j<W; j++){
                field[i,j] = str[j];
            }
        }
        int Max = (int)Math.Pow(2,H+W);
        for(int i=0; i<Max; i++){
            copy(temp,field,H,W);
            string bit = Convert.ToString(i,2);
            while(bit.Length < H+W){
                bit = "0"+bit;
            }
            //Console.WriteLine(bit);
            for(int j=0; (j<H && j<bit.Length); j++){
                if(bit[j] == '1'){
                    for(int x=0; x<W; x++){
                        temp[j,x] = 'R';
                    }
                }
            }
            for(int j=H; (j<H+W && j<bit.Length); j++){
                if(bit[j] == '1'){
                    for(int x=0; x<H; x++){
                        temp[x,j-H] = 'R';
                    }
                }
            }
            int count = 0;
            for(int h=0; h<H; h++){
                for(int w=0; w<W; w++){
                    if(temp[h,w] == '#'){
                        count++;
                    }
                }
            }
            if(count == K){
                ans++;
            }
        }
        Console.WriteLine(ans);
    }
    public static void copy(char[,] ret, char[,] arr, int h, int w){
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                ret[i,j] = arr[i,j];
            }
        }
    }
}


Measured memory_bytes: 18808
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
map<long long,long long> f;
int T;
long long n,a,b,c,d;
long long mo(long long x,long long y){return y-((x-1)%y+1);}
long long om(long long x,long long y){return -((x-1)%y+1);}
long long getf(long long x){
	if(f.count(x)) return f[x];
  	if(x==1){
      return f[x]=d;
    }
    f[x]=getf((x+mo(x,2))/2)+a+mo(x,2)*d;
	if(x<=1e16/d) f[x]=min(f[x],x*d);
	f[x]=min(f[x],getf((x+mo(x,3))/3)+b+mo(x,3)*d);
	f[x]=min(f[x],getf((x+mo(x,5))/5)+c+mo(x,5)*d);
	f[x]=min(f[x],getf((x+om(x,2))/2)+a-om(x,2)*d);
	f[x]=min(f[x],getf((x+om(x,3))/3)+b-om(x,3)*d);
	f[x]=min(f[x],getf((x+om(x,5))/5)+c-om(x,5)*d);
	return f[x];
}
void solve(){
	cin>>n>>a>>b>>c>>d;
	f.clear();
	f[0]=0;
	cout<<getf(n)<<endl;
}
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>T;
	while(T--) solve();
	return 0;
}


Measured memory_bytes: 4772
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

class UnionFind {
  public:
    vi Parent;
    UnionFind(int N) {
      Parent = vi(N,-1);
    }
  
    int root(int A) {
      if(Parent[A] < 0) return A;
      return Parent[A] = root(Parent[A]);
    }
  
    int size(int A) {
      return -Parent[root(A)];
    }
  
    bool connect(int A,int B) {
      A = root(A);
      B = root(B);
      if(A == B) return false;
      if(size(A) < size(B)) swap(A,B);
      Parent[A] += Parent[B];
      Parent[B] = A;
      return true;
    }
};
  
int main() {
  int n,m;
  cin >> n >> m;
  UnionFind uf(n);
  rep(i,m) {
    int a,b;
    cin >> a >> b;
    a--;b--;
    uf.connect(a,b);
  }
  int ans = 0;
  rep(i,n) {
    chmax(ans,uf.size(i));
  }
  cout << ans << endl;
  return 0;
}

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

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

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

  ll ans = 1;
  if (m%n == 0) {
    ans = m/n;
  } else {
    for (ll i = 1; i*i <= m; ++i) {
      if (m%i == 0) {
        if (i*n <= m) ans = max(ans, i);
        if (m/i != i) {
          if ((m/i)*n <= m) ans = max(ans, m/i);
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;}


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

int A, B, C, D; cin >> A  >> B >> C >> D;

if ((C + B -1) / B <= (A + D - 1) / D) cout << "Yes\n";
else cout << "No\n";



return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 問題文から考える。自分ができることから考える。
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索。逆から考える。
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 3640
use whiteread::parse_line;

fn main() {
    let n: usize = parse_line().unwrap();
    let (mut tp, mut xp, mut yp): (i32, i32, i32) = (0, 0, 0);
    let mut ans = "Yes";

    for _ in 0..n {
        let (tn, xn, yn): (i32, i32, i32) = parse_line().unwrap();
        let rem = (tn - tp).rem_euclid(2);
        if tn - tp < (xp - xn).abs() + (yp - yn).abs() {
            ans = "No";
            break;
        }
        if ((xp + yp) - (xn + yn)).rem_euclid(2) != rem {
            ans = "No";
            break;
        }
        tp = tn;
        xp = xn;
        yp = yn;
    }
    println!("{}", ans);
}


Measured memory_bytes: 2116
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

typedef long long ll;

using namespace std;

int main(int argc, const char * argv[]) {
  string S;
  cin >> S;
  int flag;
  for(flag=0;flag<1<<3;flag++){
    int t = S[0] - '0';
    int checker = 1;
    for(int i=0;i<3;i++){
      if(flag&checker) t += S[i+1] - '0';
      else t -= S[i+1] - '0';
      checker = checker << 1;
    }
    if(t==7) break;
  }
  cout << S[0];
  int checker = 1;
  for(int i=0;i<3;i++){
    if(checker&flag) cout << '+';
    else cout << '-';
    cout << S[i+1];
    checker = checker << 1;
  }
  cout << "=7";
}

Measured memory_bytes: 256
#define A for(i=0;i<k;i++)t*=2
#include <stdio.h>

int main(void)
{
	int a, b, c, k, i, t, s;
	scanf("%d%d%d%d", &a, &b, &c, &k);
	t = a;
	A;
	s = t + b + c;
	t = b;
	A;
	s < t + a + c ? s = t + a + c : 0;
	t = c;
	A;
	s < t + a + b ? s = t + a + b : 0;
	printf("%d", s);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  int i;
  for (i = 0; i < n; i++) {
    cin >> d.at(i);
  }
  sort(d.begin(), d.end());
  int count = n;
  for (i = 0; i < n - 1; i++) {
    if (d[i] == d[i + 1]) {
      count--;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
/*ダイスゲーム：上面、前面が指定されたダイスは同一か？
*/
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
       Scanner sc = new Scanner(System.in);
//１つめのｃｕｂｅを基準にする
        int upper = sc.nextInt();// = [0];
        int front = sc.nextInt();// = [1];
        int right = sc.nextInt();// = [2];
        int left = sc.nextInt();// = [3];
        int back = sc.nextInt();// = [4];
        int downSide = sc.nextInt();// = [5];
       
//配列に２つめのｃｕｂｅの数字を受取る 
        int [] cubeNum = new int [6];     
        for(int i=0; i<6; i++){
            cubeNum[i] = sc.nextInt();
//            System.out.println(cubeNum[i]);
        }
/* //検証用 
    System.out.print("@" + upper + "#" + cubeNum[0]);
    System.out.print("@" + front + "#" + cubeNum[1]);
    System.out.print("@" + right + "#" + cubeNum[2]);
*/
// while(front != cubeNum[1] && upper != cubeNum[0]){
//転がして調べる方向
         String direction = "N N N N W N N N W N N N E N N N E N N N W N N N";
         String[] compass =direction.split(" ");   
         String yesNo ="No";


        for(int i = 0; i < compass.length; i++){
             if(("S").equals(compass[i])){
                 int forNow = cubeNum[0];//１つ回避
                 cubeNum[0]= cubeNum[4];
                 cubeNum[4]= cubeNum[5];
                 cubeNum[5]= cubeNum[1];
                 cubeNum[1]= forNow;
             }else if(("N").equals(compass[i])){
                 int forNow = cubeNum[0];
                 cubeNum[0]= cubeNum[1];
                 cubeNum[1]= cubeNum[5];
                 cubeNum[5]= cubeNum[4];
                 cubeNum[4]= forNow;
             }else if(("E").equals(compass[i])){
                 int forNow = cubeNum[0];
                 cubeNum[0]= cubeNum[3];
                 cubeNum[3]= cubeNum[5];
                 cubeNum[5]= cubeNum[2];
                 cubeNum[2]= forNow;
             }else if(("W").equals(compass[i])){
                 int forNow = cubeNum[0];
                 cubeNum[0]= cubeNum[2];
                 cubeNum[2]= cubeNum[5];
                 cubeNum[5]= cubeNum[3];
                 cubeNum[3]= forNow;
             }

            if(upper == cubeNum[0] && front == cubeNum[1] && right == cubeNum[2] && left == cubeNum[3] && back == cubeNum[4] && downSide == cubeNum[5]){
                yesNo ="Yes";
                break;
            }
        }
           System.out.println(yesNo);
    }
}



Measured memory_bytes: 26388
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
#include <set> 
using namespace std;

typedef long long ll;
typedef pair<ll, int> P;
typedef pair<pair<int, int>, int> PP;

const ll INF = 1e15;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

const int MAX = 510000;
const int MOD = 1000000007;

int main(void) {
	ll L, R; cin >> L >> R;

	int ans = 10000;
	if (R - L >= 2019) {
		ans = 0;
	}
	else {
		for (int i = L; i < R; i++) {
			for (int j = i + 1; j <= R; j++) {
			    int r=((i%2019)*(j%2019))%2019; 
			    //int r2=j%2019;
				ans = min(ans, r);
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
N, M, C = map(int, input().split())
Bs = list(map(int, input().split()))
num = 0
for i in range(N):
  As = list(map(int, input().split()))
  r = C
  for j in range(M):
    r += As[j]*Bs[j]
  if r > 0:
    num += 1
print(num)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int n; cin >> n;
	double ans = (n + 1) / 2;
	printf("%.10f\n", ans / (double)n);
	// cout << ans / (double)n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;

template <typename T> void output(T, int);
template <typename T> T max(T, T);
int gcd(int a, int b);

int main() {
    // source
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> p;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        p.push_back(make_pair(a, b));
    }
    sort(p.begin(), p.end());

    int ans = 0;
    int last = pow(10, 9);
    for (int i = m - 1; i >= 0; i--) {
        if (p[i].second <= last) {
            ans++;
            last = p[i].first;
        } else {
            continue;
        }
    }

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

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T max(T a, T b) {

    if (a > b) {
        return a;
    } else {
        return b;
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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


Measured memory_bytes: 1400
//Robs Code
#include<bits/stdc++.h>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define all(x) x.begin(),x.end()
#define ed cout<<"\n";
#define pb push_back
#define pii pair<ll,ll>
#define _1 first
#define _2 second
#define maxi 100000007
/**********************************************************/
using namespace std;
ll i,j,k,n,m,q,t,a,b,c,cnt,sum,tot;
int main() 
{
    speed;
    cin>>a>>b>>k;
    for(i=100;i>=1;i--){
        if(a%i==0&&b%i==0){
            k--;
            if(k==0){
                return cout<<i,0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define F first
#define S second
#define f(i,s,n) for(int i=(int)s;i<=(int)n;++i)
#define Fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
void solve()
{
	string s;cin>>s;
	ll sum=0;
	f(i,0,s.size()-1){
		sum+=s[i]-'0';
	}
	if(sum%9){
		cout<<"No\n";
	}
	else{
		cout<<"Yes\n";
	}
}
int main()
{	Fast;
//	int t;cin>>t;
//	while(t--)
	solve();
}

Measured memory_bytes: 3772
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();

    let n : i32 = iter.next().unwrap().parse().unwrap();
    let a : Vec<i32> = (0..n)
        .map(|_| { iter.next().unwrap().parse().unwrap() })
        .collect();
    let b : Vec<i32> = (0..n)
        .map(|_| { iter.next().unwrap().parse().unwrap() })
        .collect();
    let c : Vec<i32> = (0..n-1)
        .map(|_| { iter.next().unwrap().parse().unwrap() })
        .collect();
    let mut ans:i64 = 0 ;
    let mut prev = -999 ;
    for x in a {
        ans += b[(x-1) as usize] as i64;
        if prev + 1 == x - 1 { 
            ans += c[prev as usize] as i64;
        }
        prev = x - 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
n,k=map(int,input().split())
c=list(map(int,input().split()))
ans=10**100
for i in range(n-k+1):
  l,r=i,i+k-1
  d=min(abs(c[l]),abs(c[r]))+abs(c[l]-c[r])
  if d<ans:
    ans=d
print(ans)

Measured memory_bytes: 14224
#include <bits/stdc++.h>
#define foi(i,k,n) for(int i = (int)k; i < (int)n; ++i)
using namespace std;
using ll = long long;
using ii = pair<int,int>;

constexpr int MAXN = 55;
vector<int> newone;

void go(const vector<int>& v) {
  const int n = (int)v.size();
  newone.resize(n);
  foi (i,0,n) newone[i] = 0;
  foi (i,0,n) {
    int l = max(0, i-v[i]);
    int r = min(n, i+v[i]+1);
    ++newone[l];
    if (r < n) {
      --newone[r];
    }
  }
  foi (i,1,n) newone[i] += newone[i-1];
}

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  int n,k;
  cin >> n >> k;
  vector<int> v(n,0);
  for (int& x : v) cin >> x;
  while (k--) {
    go(v);
    if (newone == v) {
      break;
    }
    newone.swap(v);
  }
  for (auto x : v) cout << x << ' ';
  cout << '\n';
  return 0;
}


Measured memory_bytes: 4784
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

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

  int a,b,c;
  cin >> a >> b >> c;
  if(b - a == c - b){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

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

int main(int argc, char const* argv[]) {
    int a, b, c;
    std::cin >> a >> b >> c;

    if (a == b && a == c) {
        std::cout << 1 << '\n';
    } else if (a == b || a == c || b == c) {
        std::cout << 2 << '\n';
    } else {
        std::cout << 3 << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 200005;

bool cmp(int a, int b) {
	return a > b;
}

int x, y, a, b, c, i, tab1[N], tab2[N], tab3[N];
multiset<int> s;
LL res;

int main() {
scanf("%d %d %d %d %d", &x, &y, &a, &b, &c);
for (i=0;i<a;i++) scanf("%d", &tab1[i]);
for (i=0;i<b;i++) scanf("%d", &tab2[i]);
for (i=0;i<c;i++) scanf("%d", &tab3[i]);
sort(tab1, tab1 + a, cmp);
sort(tab2, tab2 + b, cmp);
sort(tab3, tab3 + c, cmp);
for (i=0;i<x;i++) {
	res += tab1[i];
	s.insert(tab1[i]);
}
for (i=0;i<y;i++) {
	res += tab2[i];
	s.insert(tab2[i]);
}
for (i=0;i<c;i++) if (s.size() == 0 || *(s.begin()) >= tab3[i]) break; else {
	res += (tab3[i] - *(s.begin()));
	s.erase(s.begin());
}
printf("%lld\n", res);
return 0;
}

Measured memory_bytes: 9856
#include<stdio.h>

int main(void)
{
	int i,n,a=100000,b,sum=0;
	
	scanf("%d",&n);
	
	for(i=0;i<n-1;i++){
		scanf("%d",&b);
		if(a>=b)
			sum+=b;
		else
			sum+=a;
		a=b;
	}
	printf("%d",sum+b);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    int r;
    cin >>  r;
    int a = 1;
    int v[r];
    for(int i=0  ; i<r ;  i++){
    	cin >> v[i];
    }
    for(int i =0; i<r; i++){
        if(a != 2){
            a = v[a-1];
        }else{
            cout << i <<endl;
            break;
        }
        if(a !=2 && i ==r-1){
            cout << -1 << endl;
        }
    }

}


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

int main(){
    int N, M;
    std::cin >> N >> M;
    
    int sum = 0;
    for(int i=0; i<M; i++){
        int tmp;
        std::cin >> tmp;
        sum += tmp;
    }
    if(N < sum){
        std::cout << -1 << std::endl;
    }else{
        std::cout << N - sum << std::endl;
    }
    
    return 0;
}



Measured memory_bytes: 3596
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>

using namespace std;

constexpr long double EPS = 1e-10;

class Point{
    public: 
    long double x,y;
    Point(long double x = 0.0, long double y = 0.0): x(x), y(y) {}
    Point operator + (const Point &p) const { return Point(x+p.x, y+p.y); }
    Point operator - (const Point &p) const { return Point(x-p.x, y-p.y); }
    Point operator * (const long double &a) const { return Point(x*a, y*a); }
    Point operator / (const long double &a) const { return Point(x/a, y/a); }
    Point operator += (const Point &p) {
        x += p.x;
        y += p.y;
        return *this;
    }
    Point operator /= (const long double &a) {
        x /= a;
        y /= a;
        return *this;
    }
    bool operator < (const Point &p) const { return (x != p.x ? x < p.x : y < p.y); }
    bool operator == (const Point &p) const { return fabsl(x - p.x) < EPS && fabsl(y - p.y) < EPS; }
    bool operator != (const Point &p) const { return !(*this == p);}
    long double abs() const { return sqrt(norm()); }
    long double norm() const { return x*x + y*y; }
    long double dot(Point &p) const { return x*p.x + y*p.y; }
    long double cross(Point &p) const { return x*p.y - y*p.x; }   
};

typedef Point Vector;
typedef vector<Point> Polygon;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    Polygon poly(n);
    Point center;
    for(int i=0;i<n;++i){
        cin >> poly[i].x >> poly[i].y;
        center.x += poly[i].x;
        center.y += poly[i].y;
    }
    center.x /= n;
    center.y /= n;

    if(n % 2) {
        cout << "NA" << endl;
        return 0;
    }

    for(int i=0;i<n/2;++i) {
        int j = i + n/2;
        if((poly[i]-center) != (center - poly[j])) {
            cout << "NA" << endl;
            return 0;
        }
    }

    cout << setprecision(10) << fixed << center.x << " " << center.y << endl;
}



Measured memory_bytes: 3308
#include <iostream>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n,m;
    cin>>n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin>>a[i];
    }
    cin>>m;
    int temp;
    int count = 0;
    for(int i = 0; i < m; i++){
        cin>>temp;
        for(int j = 0; j < n; j++){
           if(a[j] == temp){
               count++;
               break;
           }
        }
    }
    cout<<count<<endl;
    return 0;





}

Measured memory_bytes: 3084
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Point{
	double x,y;
};

typedef Point Vector;

struct Segment{
	void set(double x1,double y1,double x2,double y2){
		p1.x = x1;
		p1.y = y1;
		p2.x = x2;
		p2.y = y2;
	}
	Point p1,p2;
};

typedef Segment Line;

int func(double x1,double y1,double x2, double y2, double xp, double yp){
	double naiseki,norm1,norm2,gaiseki;
	norm1 = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
	norm2 = sqrt((xp-x1)*(xp-x1)+(yp-y1)*(yp-y1));
	naiseki = (xp-x1)*(x2-x1)+(yp-y1)*(y2-y1);
	gaiseki = (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1);
	if(gaiseki > EPS){
		return 1;
	}else if(gaiseki < -EPS){
		return -1;
	}
	if(naiseki < -EPS){
		return 2;
	}

	if(norm1 < norm2){
		return -2;
	}
	return 0;
}

double cross(Vector a,Vector b){
	return a.x*b.y-a.y*b.x;
}

double dot(Vector a,Vector b){
	return a.x*b.x + a.y*b.y;
}

Point calc_minus(Point a,Point b){
	Point ret;

	ret.x = a.x-b.x;
	ret.y = a.y-b.y;

	return ret;
}

double calc_len(Vector a){
	return sqrt(a.x*a.x+a.y*a.y);
}

double getDistanceLP(Line l,Point p){
	return fabs(cross(calc_minus(l.p2,l.p1),calc_minus(p,l.p1))/calc_len(calc_minus(l.p2,l.p1)));
}

double getDistanceSP(Segment s,Point p){
	if(dot(calc_minus(s.p2,s.p1),calc_minus(p,s.p1)) < 0.0)return calc_len(calc_minus(p,s.p1));
	if(dot(calc_minus(s.p1,s.p2),calc_minus(p,s.p2)) < 0.0)return calc_len(calc_minus(p,s.p2));
	return getDistanceLP(s,p);
}

double getDistance(Segment s1,Segment s2){
	return min(min(getDistanceSP(s1,s2.p1),getDistanceSP(s1,s2.p2)),
			min(getDistanceSP(s2,s1.p1),getDistanceSP(s2,s1.p2)));
}

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int q;
	scanf("%d",&q);

	for(int i=0;i<q;i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);

		if(func(x1,y1,x2,y2,x3,y3)*func(x1,y1,x2,y2,x4,y4) <= 0 &&
				func(x3,y3,x4,y4,x1,y1) * func(x3,y3,x4,y4,x2,y2) <= 0){
			printf("0.0000000000\n");
			continue;
		}

		Segment s1,s2;
		s1.set(x1,y1,x2,y2);
		s2.set(x3,y3,x4,y4);

		printf("%.10lf\n",getDistance(s1,s2));
	}

    return 0;
}



Measured memory_bytes: 3216