akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <deque>
#include <bitset>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) v.erase(remove(v.begin(), v.end(), a), v.end())
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i) = 0; (i) <= (n); (i)++)
using namespace std;

double Snuke(int n)
{
	int a = n;
	int b = 0;
	while (n > 0)
	{
		b += n % 10;
		n /= 10;
	}
	return a / (double)b;
}

signed main()
{
	int K;
	cin >> K;

	int a = 0;
	int nine = 0;
	int k = 1;
	for (int i = 0; i < K; i++)
	{
		while (true)
		{
			a++;
			if (a == 1000)
			{
				a = 100;
				nine = (nine * 10) + 9;
				k *= 10;
			}
			int s = a * k + nine;

			bool flg = false;
			double sn = Snuke(s);
			for (int j = a + 1; j < 1000; j++)
			{
				int ss = j * k + nine;
				if (sn > Snuke(ss))
				{
					flg = true;
					break;
				}
			}
			if (!flg)
			{
				cout << s << endl;
				break;
			}
		}
	}
}


//double S(int n)
//{
//	int a = n;
//	int b = 0;
//	while (n > 0)
//	{
//		b += n % 10;
//		n /= 10;
//	}
//	return a / (double)b;
//}
//
//signed main()
//{
//	for (int i = 1; i < 1000000; i++)
//	{
//		double s1 = S(i);
//
//		bool flg = false;
//		for (int j = i + 1; j < 1000000; j++)
//		{
//			double s2 = S(j);
//			if (s1 > s2)
//			{
//				flg = true;
//				break;
//			}
//		}
//		if (!flg)
//		{
//			cout << i << endl;
//		}
//	}
//}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e6+5,mod=998244353;
vector<int>v[N];
int n,a[N];
ll sum[N],f[N],inv[N];
int main()
{
    inv[1]=1;
    for(int i=2;i<=1000000;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
    int tot=0;
    for(int i=1;i<=1000000;i++)
        for(int j=i;j<=1000000;j+=i)
            v[j].push_back(i),tot++;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        for(int j=0;j<v[a[i]].size();j++)
            sum[v[a[i]][j]]=(sum[v[a[i]][j]]+a[i])%mod;
    }
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<v[a[i]].size();j++)
        {
            int x=v[a[i]][j];
            sum[x]=(sum[x]-a[i])%mod,f[x]=sum[x];
        }
        for(int j=v[a[i]].size()-1;j>=0;j--)
        {
            int x=v[a[i]][j];
            ans=(ans+f[x]*a[i]%mod*inv[x])%mod;
            for(int k=0;k<v[x].size()-1;k++)
                f[v[x][k]]=(f[v[x][k]]-f[x])%mod;
        }
    }
    ans=(ans+mod)%mod;
    printf("%lld\n",ans);
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;

typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef pair<P, P> PPP;

const ll MOD = 1e9 + 7;
const ll INF = 9e18;
const double DINF = 5e14;
const double eps = 1e-10;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second

string s;
ll k, it=-1;

int main() {
	cin >> s >> k;
	for (int i = 0;i < s.size();i++) {
		if (s[i] != '1') {
			it = i;
			break;
		}
	}
	if (k <= it) {
		cout << 1 << endl;
	}
	else if(it==-1) {
		cout << 1 << endl;
	}
	else {
		cout << s[it] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
while 1:
  n,m,q=map(int,input().split())
  if (n|m|q)==0: break
  
  p=[]
  res=[{_ for _ in range(n)} for _ in range(m)]
  for i in range(q):
    s,b=[[int(c) for c in s] for s in input().split()]
    if i>0:
      for j in range(n):
        s[j]^=p[j]
    zero={i for i in range(n) if s[i]==0}
    one={i for i in range(n) if s[i]==1}
    for j in range(m):
      if(b[j]==0): res[j]-=one
      if(b[j]==1): res[j]-=zero
    p=s
  
  table="".join([str(i) for i in range(10)]+[chr(ord("A")+i) for i in range(26)])
  for i in range(m):
    if len(res[i])==1:
      print(table[res[i].pop()],sep="",end="")
    else:
      print("?",sep="",end="")
  print()

Measured memory_bytes: 10088
import sys
import numpy as np

reatInt = lambda: int(sys.stdin.readline())
reatIntN = lambda: [int(v) for v in sys.stdin.readline().split(' ')]

a, b = reatIntN()
b += 1
a = ((a // 2) % 2) ^ ((a-1) * (a % 2))
b = ((b // 2) % 2) ^ ((b-1) * (b % 2))
ret = a ^ b
print(ret)

Measured memory_bytes: 12452
/*
ID: barish21
LANG: C++14
TASK: test
*/

/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define intt long long

#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define IO ios_base::sync_with_stdio(false);cin.tie();

const intt max1 = 11;
const intt max2 = 102;
const intt max3 = 1003;
const intt max4 = 10004;
const intt maxx = 100005;
const intt max6 = 1000006;
const intt max7 = 10000007;
const intt lg2 = 7;
const intt lg3 = 10;
const intt lg4 = 13;
const intt lg5 = 17;
const intt lg6 = 20;
const intt lg7 = 24;
const intt lg8 = 27;
const intt lg9 = 30;
const intt lg18 = 60;
const intt INF = 2LL * 1000000000;
/***************/

/***Additional Functions***/
intt powmod(intt a,intt b,intt mod){intt res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
intt gcd(intt a, intt b) { while(b) b ^= a ^= b ^= a %= b; return a;}
intt lcm(intt a,intt b){return a*b/gcd(a,b);}
intt is_prime(intt n){if(n==1)return 0;if(n==2)return 1;if(n%2==0)return 0;for(intt i=3;i<=sqrt(n);i+=2)if(n%i==0)return 0;return 1;}
intt is_integer(double n){if(floor(n)==ceil(n))return 1;return 0;}

intt sto_int(string s){stringstream ss(s);intt n;ss>>n;return n;}
string to_string(intt n){stringstream ss;ss<<n;string s=ss.str();return s;}
/**************************/
intt arr[maxx];
int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    IO;
    intt n;
    cin >> n;
    for (intt i= 1; i <= n; i++)
        cin >> arr[i];
    sort (arr + 1, arr + n + 1);
    intt ans = 0;
    for (intt i = 2; i <= n; i++)
        ans += arr[i] - arr[i - 1];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        n: isize,
        m: isize,
        c: isize,
        b_vec: [isize; m],
        a_vec_vec: [[isize; m]; n],
    };
    let mut ans = 0;
    for a_vec in a_vec_vec {
        let sum = a_vec
            .into_iter()
            .enumerate()
            .fold(0, |sum, (i, a)| sum + b_vec[i] * a);
        if sum + c >0 {
            ans += 1;
        };
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ST first
#define ND second
#define ll long long
#define ld long double
using namespace std;
using namespace __gnu_pbds;

// replace int with pair if multiset needed
typedef tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ordered_set secik;

const int INF = 1e9 + 9;
const int MOD = 1e9 + 7;
const long long LINF = (ll)1e18 + 3;

// secik.insert({x, t++});
// secik.erase(secik.lower_bound({x,-1}));
// *secik.find_by_order(x)).first << "\n";
// secik.order_of_key(x)

//random_device device;
//mt19937 gener(device());
//uniform_int_distribution<int> gen(0,n-1);
//gen(gener); // generate random number

ll dp[600][600];
// dp[i][j] - the minimum total cost of combining interval [i,j] into one vertex

int main() {
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    for(int& x : a) {
        scanf("%d", &x);
    }
    auto sum = [&](int L, int R) {
        ll s = 0;
        for(int i = L; i <= R; ++i) {
            s += a[i];
        }
        return s;
    };
    for(int L = n - 1; L >= 0; --L) {
        for(int R = L; R < n; ++R) {
            if(L == R) {
                dp[L][R] = 0;
            }
            else {
                dp[L][R] = LINF;
                ll s = sum(L, R);
                for(int i = L; i <= R - 1; ++i) {
                    dp[L][R] = min(dp[L][R], dp[L][i] + dp[i+1][R] + s);
                }
            }
        }
    }

    printf("%lld\n", dp[0][n-1]);
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<ll, ll>
using namespace std;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  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;
  }
};
// 出力は.xで！！！！

mint dp[2011][2011];

int main(){
   int n,b; cin >> n >> b;
   int r=n-b;
   int num=min(b,r+1);
   rep(i,2011){
     dp[1][i]=1;
     dp[i][0]=1;
   }
   for(int i=2; i<=2010; i++){
     for(int j=1; j<=2010; j++){
       dp[i][j]=dp[i-1][j]+dp[i][j-1];
       //cout << i << j << ' ' << dp[i][j].x << endl;
     }
   }
   cout << dp[2][r].x << endl;
   for(int i=2; i<=b; i++){
     if(i>num){
       cout << 0 << endl;
       continue;
     }
     int bn=b-i; int rn=r-i+1;
     cout << (dp[i][bn]*dp[i+1][rn]).x << endl;
   }
return 0;
}
/*
2 1 2 3 1 3   4 1 4
2 2 3 3 2 6   4 2 10
2 3 4 3 3 10  4 3 20
2 4 5 3 4 15  */

Measured memory_bytes: 31872
#include <iostream>

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

  int res;
  for (int i = 0; i <= a; ++i) {
    for (int j = 0; j <= b; ++j) {
      for (int k = 0; k <= c; ++k) {
        int total = 500 * i + 100 * j + 50 * k;
        if (total == x)
          ++res;
      }
    }
  }
  std::cout << res << std::endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public int[] Sarray() { return ReadLine().Split().Select(int.Parse).ToArray(); }
        static public List<int> Slist() { return ReadLine().Split().Select(int.Parse).ToList(); }

        static int N;
        static int[,] Move;
        static int[,] dp;
        static void Main(string[] args)
        {
            var NW = Sarray();
            var N = NW[0];
            var W = NW[1];
            var v = new long[N];
            var w = new long[N];
            for(var i=0;i<N;++i)
            {
                var t = Sarray();
                w[i] = t[0];
                v[i] = t[1];
            }
            var nw = new Dictionary<long, long>();
            nw[w[0]] = v[0];
            for (var i = 1; i < N; ++i)
            {
                var next = new Dictionary<long, long>();
                foreach (var wv in nw)
                {
                    chmax(next, wv.Key, wv.Value);
                    if (wv.Key + w[i] <= W)
                        chmax(next, wv.Key + w[i], wv.Value + v[i]);
                }
                chmax(next, w[i], v[i]);
                nw = next;
            }
            WriteLine(nw.Values.Max());
        }
        static void chmax(Dictionary<long,long> dic, long key, long val)
        {
            if (dic.ContainsKey(key))
                dic[key] = Max(dic[key], val);
            else
                dic[key] = val;
        }
    }
}


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

const int MAX = 200000;
int main() {
	int N;
	static int A[MAX], tmp[MAX];
	cin >> N;
	for (int i = 0;i < N;i ++) {
		cin >> A[i];
		tmp[i] = A[i];
	}
	sort(tmp, tmp+N);
	for (int i = 0;i < N;i ++) {
		if (A[i] <= tmp[N / 2 - 1]) cout << tmp[N / 2];
		else cout << tmp[N / 2 - 1];
		if (i < N - 1) cout << endl;
	}
	
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

まず、全体をソートしたと仮定し、これを{X}とします
この時、中央値はX_(N/2)かX_(N/2+1)にしかなりません

後は、各A_iについてX_(N/2)以下ならX_(N/2+1)、そうでないならX_(N/2)が答えになります
*/

Measured memory_bytes: 3712
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>

using namespace std;
#define ALL(x)			(x).begin(),(x).end()
#define REP(i, n)		for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)	for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF				(int)2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)		(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)		(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)	((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)		(!IsOdd((x)))						
#define M_PI			3.14159265358979323846
typedef long long			ll;
typedef unsigned long long	ull;
typedef pair<ll, ll>		P;
typedef vector<ll>			VLL;
typedef vector<VLL>			VVLL;
typedef vector<VVLL>		VVVLL;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int N, K;
vector<ll> X, Y;

bool checkOne(ll x1, ll x2, ll y1, ll y2)
{
	if (x1 > x2) {
		swap(x1, x2);
	}
	if (y1 > y2) {
		swap(y1, y2);
	}

	int incCnt = 0;
	REP(i, N) {
		if ((x1 <= X[i])&&(X[i] <= x2)) {
			if ((y1 <= Y[i])&&(Y[i] <= y2)){
				incCnt++;
			}
		}
	}

	return (K <= incCnt);
}

ull compExec()
{
	ull area = (ull)1e18 * 5;

	REP(xi, N) {
		REPN(xj, xi + 1, N) {
			REP(yi, N) {
				REPN(yj, yi + 1, N) {
					ull areaOne = abs((X[xi] - X[xj]) * (Y[yi] - Y[yj]));
					if (checkOne(X[xi], X[xj], Y[yi], Y[yj])) {
						area = min(areaOne, area);
					}
				}
			}
		}
	}
	return area;
}

int main()
{
	cin  >> N >> K;
	X.resize(N);
	Y.resize(N);
	REP(i, N) cin >> X[i] >> Y[i];
	cout <<  compExec() << endl;
	return 0;
}


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

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

using namespace std;

int card[3][20];

bool check(){
	rep(i, 3){
		rep(j, 10){
			while(card[i][j] > 0){
				if(card[i][j] >= 3) card[i][j] -= 3;
				else{
					rep(k, 3){
						card[i][j+k]--;
					}
				}
			}
			if(card[i][j] < 0) return false;
		}
	}
	return true;
}

int main(){
	int sets;
	cin >> sets;
	while(sets--){
		memset(card, 0, sizeof(card));
		int hand[9];
		rep(i, 9) cin >> hand[i];
		rep(i, 9){
			char c;
			cin >> c;
			rep(j, 3){
				if(c == "RGB"[j]) card[j][hand[i]]++;
			}
		}
		cout << check() << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
N = readline.to_i
last_a = 0
first_b = 0
la_fb = 0
count = 0
N.times do
  s = readline.chomp
  first_b += 1 if s[0] == 'B'
  last_a += 1 if s[-1] == 'A'
  la_fb += 1 if s[-1] == 'A' and s[0] == 'B'
  s.each_char.with_index do |c,i|
    count += 1 if c == 'A' and s[i+1] == 'B'
  end
end

n = [last_a,first_b].min
n -= 1 if last_a == la_fb and first_b == la_fb
n = 0 if n < 0
# p count, first_b, last_a, n
puts count + n



Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
using namespace std;
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
typedef long long ll;
int main(){

    vector<vector<int> > c;
    c.resize(3);

    REP(i, 3) c[i].resize(3);

    REP(i, 3)
        REP(j, 3)
            cin >> c[i][j];
    
    int b[] = {c[0][0] - 0, c[0][1] - 0, c[0][2] - 0};
    int a[] = {0, c[1][0] - b[0], c[2][0] - b[0]};

    REP(i, 3)
        REP(j, 3)
            if(c[i][j] != a[i] + b[j]){
                cout << "No" << endl;
                return 0;
            }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,q,s[10010],t,cnt;
int srch(int t){
  s[n]=t;
  int i=0;
  while(s[i]!=t) ++i;
  return i!=n;
}
int main(){
  cin>>n;
  for(int i=0;i<n;++i) cin>>s[i];
  cin>>q;
  for(int i=0;i<q;++i){
    cin>>t;
    if(srch(t)) ++cnt;
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 3080
N = int(input())
A = []
for i in range(N):
    a = int(input())
    A.append(a)

A.sort()
sa = sorted(set(A))

ans_dict = {}
for num in sa:
    ans_dict[num] = -1

for num in A:
    ans_dict[num] *= -1

ans = []
for num, value in ans_dict.items():
    if value == 1:
        ans.append(num)

print(len(ans))

Measured memory_bytes: 20032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;

int main(){
	int n,W;cin>>n>>W;
	int v[n],w[n];
	for(int i=0;i<n;i++) cin>>v[i]>>w[i];

	int dp[n+1][W+1];for(int i=0;i<=W;i++) dp[0][i]=0;

	for(int i=0;i<n;i++){
		for(int sum=0;sum<=W;sum++){
			if(w[i]<=sum) dp[i+1][sum]=max(dp[i][sum],dp[i+1][sum-w[i]]+v[i]);
			else dp[i+1][sum]=dp[i][sum];
		}
	}
/*
	for(int i=0;i<=n;i++){
		for(int sum=0;sum<=W;sum++){
			cout<<dp[i][sum]<<", ";
		}
		cout<<"\n";
	}
	*/
	cout<<dp[n][W]<<"\n";
}


Measured memory_bytes: 7048
#include <stdio.h>

int main(){
  
  int n;
  scanf("%d",&n);
  
  int v[n];
  int i,j,k;
  int ans = 0;
  for(i=0;i<n;i++){
    scanf("%d ",&v[i]);
  }

  for(i=0;i<n;i++) for(j=0;j<n-1;j++){
    int a = v[j], b = v[j+1];
    if(a>b){
      v[j+1]=a; v[j]=b;
    }
  }

  
  
  
  for(i=0;i<n-2;i++){
      for(j=1;j<n-1;j++){
          for(k=2;k<n;k++){
              if(v[i] != v[j] && v[i] != v[k] && v[k]  != v[j]){
                    if(v[i] < v[j] && v[i] < v[k] && v[j] < v[k]){
                        if(v[i]+v[j]>v[k]){
                            ans++;
                        }
                    }
                }
            }
        }
    }
  printf("%d",ans);
    
}

Measured memory_bytes: 1712
#include<bits/stdc++.h>
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y)   for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y)   for (__typeof(x) i = x; i > y; i--)
#define vdp(n,x) vector<vector<ll>>dp(n+1,vector<ll>(x+1));
const ll mod=1000000007;
const ll AM=2e5+5;
using namespace std;
int main()
{
    fast;
    ll n; cin>>n;
    ll a[n+1];
    fo(i,1,n+1) cin>>a[i];
    vector<ll>dp(n+1);
    dp[1]=0;
    fo(i,2,n+1)
    {
    	dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
    	if(i>2)
    		dp[i]=min(dp[i],dp[i-2]+abs(a[i]-a[i-2]));
    	//dp[i]+=dp[i-1];
    }
    //fo(i,1,n+1) cout<<dp[i]<<" ";
    cout<<dp[n];
}

Measured memory_bytes: 1792
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

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

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

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

    for(int i=n-1; i>0; i--){
        if(h[i-1] > h[i]) h[i-1]--;
    }

    bool inc = true;
    for(int i=0; i<n-1; i++){
        if(h[i] > h[i+1]) inc = false;
    }

    cout << (inc ? "Yes" : "No") << endl;
}

Measured memory_bytes: 640
#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#else
#define VS_ENDPAUSE()
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;

#if 0
#define INT8_MIN	(-127)
#define INT8_MAX	( 128)
#define UINT8_MAX	( 255)
#define INT16_MIN	(-32768)
#define INT16_MAX	( 32767)
#define UINT16_MAX	( 65535)
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int main(void)
{
	func();

	VS_ENDPAUSE();
	return 0;
}



void func(void)
{
	uint64 N, A, B;

	cin >> N >> A >> B;

	if(A>B){
		cout << 0 << endl;
		return;
	}
	if(A==B){
		cout << 1 << endl;
		return;
	}
	if(N==1){
		cout << 0 << endl;
		return;
	}

	uint64 a = (B*(N-1) + A) - (A*(N-1) + B) + 1;
	cout << a << endl;

	return;
}




Measured memory_bytes: 256
import collections
import itertools as it
import math
import numpy as np

# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()
N, K = map(int, input().split())
H = list(map(int, input().split()))

H.sort()

rest = sum(H[::-1][K:])

print(rest)



Measured memory_bytes: 42312
$<.each_line do |line|
  src = line.split(",").map(&:to_i)

  lens   = src[0...10]
  v1, v2 = src[10, 11]

  total_len    = lens.inject(:+).to_f
  meet_time    = total_len / (v1+v2)
  meet_spot    = meet_time * v1

  advanced     = 0
  meet_section = lens.index{|l| advanced += l; advanced >= meet_spot}+1
  puts meet_section
end

Measured memory_bytes: 8660
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;


using Real = double;
using Point = complex<Real>;
const Real EPS = 1e-8;

struct Circle {
    Point p;
    Real r;
    Circle() :p(Point(0, 0)), r(0) {}
    Circle(Point _p, Real _r) :p(_p), r(_r) {}
};

using Points = vector<Point>;
using Circles = vector<Circle>;

bool eq(Real a, Real b) { return abs(a - b) < EPS; }

int intersect(Circle c1, Circle c2) {
    if (c1.r < c2.r) swap(c1, c2);
    Real d = abs(c1.p - c2.p);
    if (c1.r + c2.r < d) return 4;
    if (eq(c1.r + c2.r, d)) return 3;
    if (c1.r - c2.r < d) return 2;
    if (eq(c1.r - c2.r, d)) return 1;
    return 0;
}

pair<Point, Point> crosspoint(Circle& c1, Circle& c2) {
    Real d = abs(c1.p - c2.p);
    Real a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
    Real t = arg(c2.p - c1.p);
    Point p1 = c1.p + polar(c1.r, t + a);
    Point p2 = c1.p + polar(c1.r, t - a);
    return { p1, p2 };
}


Real scan() {
    int x; scanf("%d", &x);
    return (Real)x;
}
void solve() {
    int n; scanf("%d", &n);
    vector<Real> r(n); for (int i = 0; i < n; i++) r[i] = scan();
    Circles c(n); c[0] = Circle(Point(r[0], r[0]), r[0]);
    Real mx = r[0];
    for (int i = 1; i < n; i++) {
        Real lf = max(r[i], mx);
        Real rg = inf;
        for (int kkt = 0; kkt <= 89; kkt++) {
            Real mid = (lf + rg) / 2.0;
            bool ok = true;
            Circle t(Point(mid, r[i]), r[i]);
            for (int j = 0; j < i; j++) {
                int f = intersect(c[j], t);
                if (f < 3) { ok = false; break; }
            }
            if (ok) rg = mid;
            else lf = mid;
        }
        chmax(mx, lf);
        c[i] = Circle(Point(lf, r[i]), r[i]);
    }
    Real res = 0;
    for (int i = 0; i < n; i++) chmax(res, c[i].p.real() + c[i].r);
    cout << fixed << setprecision(12) << res << "\n";
}

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

	int kkt = 89;
	while (kkt) {
		solve();
        break;
	}
    return 0;
}


Measured memory_bytes: 3392
// C - Good Sequence
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; cin>>N;
	map<int,int> M;
	rp(i, 0, N){ int a; cin>>a; M[a]++; }
	int ans = 0;
	for(auto m:M){
		int a,c; tie(a,c) = m;
		if(c<a) ans += c;
		else ans += c - a;
	}
	cout<< ans <<endl;
}

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

using namespace std;

const int N = 1e5+5;

int n;
int a[N];
int b[N];

int main(){
    scanf("%d " , &n);
    for(int i = 1; i <= n + 1; i++){
        scanf("%d" , &a[i]);
    }
    long long ans = 0;
    for(int i = 1; i <= n; i++){
        scanf(" %d" , &b[i]);

        long long dec = min(b[i] , a[i]);
        ans += dec;
        b[i] -= dec;
        dec = min(b[i] , a[i + 1]);
        a[i + 1] -= dec;
        ans += dec;
    }
    printf("%lld\n" , ans);
}


Measured memory_bytes: 4604
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
	return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
	return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
	return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
	return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
	a += rhs.a;
	if (a >= Modulus) {
	  a -= Modulus;
	}
	return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
	if (a < rhs.a) {
	  a += Modulus;
	}
	a -= rhs.a;
	return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
	a = a * rhs.a % Modulus;
	return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
	u64 exp = Modulus - 2;
	while (exp) {
	  if (exp % 2) {
		*this *= rhs;
	  }
	  rhs *= rhs;
	  exp /= 2;
	}
	return *this;
  }
};

using mint = modint<MOD>;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	int N; cin >> N;
	vector<int> x(N);
	rep(i,N) cin >> x[i];

	mint ans = 1;
	int cnt = 0;
	rep(i,N) {
		ans *= (i+1-cnt);
		chmax(cnt,i-(x[i]-1)/2);
	}

	cout << ans.a << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
int main(){
  int i,h,H[251],n,I[251];

  for(i=1;i<=250;i++){
    I[i]=-1;
  }

  scanf("%d",&h);

  for(i=1;i<=h;i++){
    scanf("%d",&H[i]);
    I[i]=1;
  }

  /* output */
  for(i=1;i<=h;i++){
    printf("node %d: key = %d, ",i,H[i]);
    if(i!=1) printf("parent key = %d, ",H[i/2]);
     if(2*i<=h) printf("left key = %d, ",H[2*i]);
     if(2*i+1<=h) printf("right key = %d, ",H[2*i+1]);
    printf("\n");
  }

  return 0;
}

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

using namespace std;

int main(){
   int n;
   int* array;
   
   cin >> n;
   array = new int[n];
   
   for(int i=0;i<n;i++){
     scanf("%d", &array[i]);
   }
   
   cout << array[n-1];
   for(int j=2;j<=n;j++){
     cout << " " << array[n-j];
   }
   
   cout << endl;
   delete[] array;
   
   return 0;
}


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

int S = 0;
int T = 0;
string s, t;

bool match(int k) {
  rep(i, T) if (t[i] != s[i + k] && s[i + k] != '?') return false;
  return true;
}

string construct(int k) {
  string ans = s;
  rep(i, T) ans[k + i] = t[i];
  replace(ans.begin(), ans.end(), '?', 'a');
  return ans;
}

int main() {
  cin >> s >> t;
  S = s.size(), T = t.size();
  if (S < T) {
    cout << "UNRESTORABLE" << endl;
    return 0;
  }

  string ans = s;
  int k = 0;
  for (k = S - T; k >= 0; k--)
    if (match(k)) break;

  if (k >= 0)
    cout << construct(k) << endl;
  else
    cout << "UNRESTORABLE" << endl;

  return 0;
}


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

int main(void) {
    int a, b, k;
    cin >> a >> b >> k;
    for (int i = 0; i < k; i++){
        if (i % 2 == 0){
            if (a % 2 == 1) 
                a--;
            b += a / 2;
            a /= 2;
        }
        else {
            if (b % 2 == 1) 
                b--;
            a += b / 2;
            b /= 2;
        }
        //cout << a << " " << b << endl;
    }
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
  double x1,x2,x3,y1,y2,y3;
  double s,S;
  double a,b,c;
  double R;
  int i,n;
  double x,y;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
    a=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
    b=(x3-x2)*(x3-x2)+(y3-y2)*(y3-y2);
    c=(x1-x3)*(x1-x3)+(y1-y3)*(y1-y3);
    a=sqrt(a);
    b=sqrt(b);
    c=sqrt(c);
    R=a*b*c/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
   
    x=(y1-y3)*(y1*y1-y2*y2+x1*x1-x2*x2)-(y1-y2)*(y1*y1-y3*y3+x1*x1-x3*x3);
    x/=(2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3));

    y=(x1-x3)*(x1*x1-x2*x2+y1*y1-y2*y2)-(x1-x2)*(x1*x1-x3*x3+y1*y1-y3*y3);
    y/=(2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3));
    
    printf("%.3f %.3f %.3f\n",x,y,R);
  }
  return 0;
}

Measured memory_bytes: 664
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}


ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}
int n;
vi a(0);
bool isOK(int index,int key) {
    if ( a[index]>key )return true;
    else return false;
}
int binary_search(vector<int> l ,int i,int j){
  ll ng =-1; //「index = 0」が条件を満たすこともあるので、初期値は -1
  ll ok = j;
  while(abs(ok - ng) > 1) {
    ll mid = (ok + ng) / 2;
    
    if (isOK(mid, abs(a[i]-a[j]))) ok = mid;
    else ng = mid;
  }
  return ok ;
}

int main(){
  int a,b;
  cin>>a>>b;
  if((a==1 &&b==2)||(b==1 &&a==2))cout<<3<<endl;
  else if((a==1 &&b==3)||(b==1 &&a==3))cout<<2<<endl;
  else cout<<1<<endl;
}
  


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
inline void myassert(bool a,string s){ if(!a)cerr<<s<<endl,exit(0);}
inline int read()
{
	int s=0,f=1;char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int maxn=1e5+20;

vector<int>ed[maxn];
int rd[maxn];

int n;
int col[maxn];

int vis[maxn];

inline void bfs()
{
	REP(i,1,n)rd[i]=SZ(ed[i]);
	queue<int>q;
	REP(i,1,n)if(rd[i]==1 && col[i])q.push(i);
	int num=0;
	while(!q.empty())
	{
		int u=q.front();vis[u]=1; q.pop();
		++num;
		for(int v:ed[u])
			if(!vis[v] && (--rd[v])==1 && col[v])q.push(v);
	}
	if(num==n)puts("0"),exit(0);
}

inline void init()
{
	n=read();
	REP(i,1,n-1)
	{
		int u=read(),v=read();
		ed[u].push_back(v);
		ed[v].push_back(u);
	}
	static char str[maxn];
	scanf("%s",str+1); n=strlen(str+1);
	REP(i,1,n)if(str[i]=='B')col[i]=1;
	bfs();
}

int f[maxn],g[maxn];
int Ans,ans;

void dfs(int u,int fa)
{
	f[u]=g[u]=0;
	for(int v:ed[u])
	{
		if(v==fa || vis[v])continue;
		dfs(v,u);
		int nf=f[v]+2-(col[v]<<1),ng=g[v]+2-(col[u]<<1);
		chkmax(Ans,nf+g[u]);
		chkmax(Ans,ng+f[u]);
		chkmax(g[u],ng);
		chkmax(f[u],nf);
	}
}

inline void doing()
{
	REP(i,1,n)col[i]^=rd[i]&1;
	REP(i,1,n)if(!vis[i])ans+=(!col[i])+2;ans-=2;
	REP(i,1,n)if(!vis[i]){ dfs(i,0);break;}
	printf("%d\n",ans-Ans);
}

int main()
{
	init();
	doing();
	return 0;
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if (a == 5) {
    if (b == 5 && c == 7) {
      cout << "YES" << endl;
      return 0;
    } else if (b == 7 && c == 5) {
      cout << "YES" << endl;
      return 0;
    } else {
      cout << "NO" << endl;
    }
  } else if (a == 7) {
    if (b == 5 && c == 5) {
      cout << "YES" << endl;
      return 0;
    } else {
      cout << "NO" << endl;
    }
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int l,r;
    int d;
    int x,y;
    cin >> l >> r >> d;
    x = (l-1)/d;
    y = (r)/d;
    cout << y -x <<endl;


    return 0;
}

Measured memory_bytes: 3632
function Main(_input) {
    var input = _input.split("\n");
    var firstLine = input[0].split(" ");
    var num_N = parseInt(firstLine[0]);
    var num_K = parseInt(firstLine[1]);
    var arr_S = new Array(num_N).fill(true);
    var ans = 0;
    for( var i = 0; i < num_K; i++ ) {
        var num_snack = parseInt(input[2 *  i  + 1]);
        var arr_s_has_snack = input[ 2 * ( i + 1) ].split(" ");
        for( var j = 0; j < num_snack; j++ ){
            arr_S[parseInt(arr_s_has_snack[j] - 1)] = false;
        }
    }
    for( var m = 0; m < arr_S.length; m++ ) {
        if( arr_S[m] == true ) ans++;
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)

template<typename T,typename U>
void Inparray(T &f,U n){
  for(int i=0;i<n;i++) cin>>f[i];
}

template<typename T,typename U>
void Printarray(T f,U n){
  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];
}

void flagfunc(bool flag,string A,string B){
  flag ? cout<<A<<endl : cout<<B<<endl;
}

void flag2func(bool flag){
  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

void flag3func(bool flag){
  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  std::vector<int> v(3);Inparray(v,3);
  sort(All(v));
  cout<<v[0]+v[1]<<endl;
}


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

int main(){
  string S;
  cin >> S;
  int Ans=0;
  int k=S.size();
  for(int i=0; i<k; i++){
    if(S.at(i)=='o'){
      Ans++;
    }
  }
  if(Ans+15-k>=8){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
const int MAX_N = 1010;
const int MAX_X = 5010;
int N;
vector<int> edges[MAX_N];
vector<int> X;
bool dp[MAX_N][MAX_X];
int dfs(int pos){
  if (edges[pos].empty()){
    return 0;
  }
  vector<int> x,y;
  int result = 0;
  for (const auto &next : edges[pos]){
    int tmpx = X[next];
    int tmpy = dfs(next);
    if (tmpy == -1){
      return -1;
    }
    x.push_back(tmpx);
    y.push_back(tmpy);
    result += tmpx + tmpy;
  }

  int M = x.size();
  int W = X[pos];
  memset(dp, false, sizeof(dp));
  dp[0][0] = true;

  for (int i = 0; i < M; i++){
    for (int j = 0; j <= W; j++){
      if (not dp[i][j])continue;
      if (j + x[i] <= W){
        dp[i + 1][j + x[i]] = true;
      }
      if (j + y[i] <= W){
        dp[i + 1][j + y[i]] = true;
      }
    }
  }
  int tmp = -1;
  for (int j = 0; j <= W; j++){
    if (dp[M][j]){
      tmp = j;
    }
  }

  if (tmp == -1){
    return -1;
  }

  return result - tmp;
}

int main() {
  cin >> N;
  for (int i = 0; i < N-1; i++){
    int x;
    cin >> x;
    x--;
    edges[x].push_back(i + 1);
  }
  X.resize(N);
  // cerr << "N = " << N << endl;
  for (auto &val : X){
    cin >> val;

  }
  // cerr << "X.size() = " << X.size() << endl;
  if (dfs(0) != -1){// root is white
    cout << "POSSIBLE" << endl;
  }else{
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
#define MOD 1000000007
#define pb push_back
#define ll long long
using namespace std;
const int nmax=201234;

int n,nw,nw2,nx=1,nx2=1;
ll k,res,a[2][51][51],b[2][51][51];

void ksm(ll k)
{
    ll c;
    while(k)
    {
        if(k&1)
        {
            for(int i=1; i<=n; ++i)
            {
                for(int j=1; j<=n; ++j)
                {
                    c=0;
                    for(int k=1; k<=n; ++k)
                    {
                        c+=b[nw2][i][k]*a[nx][k][j];
                        c%=MOD;
                    }
                    b[nx2][i][j]=c;
                }
            }
            swap(nw2,nx2);
        }
        k>>=1;
        swap(nw,nx);
        for(int i=1; i<=n; ++i)
        {
            for(int j=1; j<=n; ++j)
            {
                c=0;
                for(int k=1; k<=n; ++k)
                {
                    c+=a[nw][i][k]*a[nw][k][j];
                    c%=MOD;
                }
                a[nx][i][j]=c;
            }
        }
    }
}

int main()
{
    scanf("%d %lld",&n,&k);
    for(int i=1; i<=n; ++i)
    {
        for(int j=1; j<=n; ++j)
        {
            scanf("%lld",&a[nx][i][j]);
        }
        b[nw2][i][i]=1;
    }
    ksm(k);
    for(int i=1; i<=n; ++i)
    {
        for(int j=1; j<=n; ++j)
        {
            res=(res+b[nw2][i][j])%MOD;
        }
    }
    printf("%lld",res);
    return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<algorithm>
#include <cmath>
using namespace std;

int main()
{
    int a;
    int b[100001];
    int c;
    scanf("%d",&a);
    for (int i = 0; i < a; ++i)
    {
        scanf("%d",&c);
        b[c-1]=i+1;
    }
    for (int j = 0; j < a; ++j)
    {
        if(j==a-1)printf("%d",b[j]);
        else printf("%d ",b[j]);
    }

}

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

int main(){
	int n;
	cin>>n;
	int a=0,b=0,c=0,d=0;
	while(n--){
		char s[10];
		scanf("%s",s);
		// printf("%s",s);
		if(strcmp(s,"AC")==0){
			// printf("#\n");
			a++;
		}
		else if(strcmp(s,"WA")==0){
			b++;
		}
		else if(strcmp(s,"TLE")==0){
			c++;
		}
		else if(strcmp(s,"RE")==0){
			d++;
		}
	}
	printf("AC x %d\n",a);
	printf("WA x %d\n",b);
	printf("TLE x %d\n",c);
	printf("RE x %d\n",d);
}

Measured memory_bytes: 3820
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    ll x;cin >> x;
    for(ll b = -1000;b <= 1000;b++){
        for(ll a = b+1;a <=1001;a++){
            if(a*a*a*a*a-b*b*b*b*b==x) {
                cout << a << " " << b << endl;
                return 0 ;
            }
        }
    }
}


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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937_64 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int N;
    cin >> N;

    vi a(1 << N);
    for (int i = 0; i < a.size(); i++) {
        cin >> a[i];
    }

    vi m1(1 << N, -1), m2(1 << N, -1);
    m1[0] = 0;

    vi c(1 << N);

    for (int i = 1; i < a.size(); i++) {
        m1[i] = i;
        for (int j = 0; j < N; j++) if (i & (1 << j)) {
            for (int cinx : { m1[i ^ (1 << j)], m2[i ^ (1 << j)] }) {
                if (cinx == -1) continue;
                if (cinx == m1[i] || cinx == m2[i]) continue;

                if (a[cinx] >= a[m1[i]]) {
                    m2[i] = m1[i];
                    m1[i] = cinx;
                }
                else if (m2[i] == -1 || a[cinx] > a[m2[i]]) {
                    m2[i] = cinx;
                }
            }
        }
        c[i] = a[m1[i]] + a[m2[i]];
    }

    for (int i = 1; i < c.size(); i++) {
        c[i] = max(c[i], c[i-1]);
        cout << c[i] << "\n";
    }

    return 0;
}



Measured memory_bytes: 7168
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

// #define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
// #define SIZE_OF_ARRAY(pro2) (sizeof(pro2)/sizeof(pro2[0]))




int main(){

    int d;
    cin >> d;
    if(d == 25) {
        printf("Christmas");
    }
    else if(d == 24) {
        printf("Christmas Eve");
    }
    else if(d == 23) {
        printf("Christmas Eve Eve");
    }
    else if(d == 22) {
        printf("Christmas Eve Eve Eve");
    }
    else {
        printf("");
    }

    // sort(pro1, pro1 + SIZE_OF_ARRAY(pro1));
    // sort(pro2, pro2 + SIZE_OF_ARRAY(pro2));

}


Measured memory_bytes: 256