akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
 
#include <iostream>
#include <algorithm>
 
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <cstring>
#include <string>
#include <utility>
#include <array>
#include <complex>
#include <valarray>
 
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>
 
 
using namespace std;
#define int long long
 
typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;
 
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
 
const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll INFLL = 1LL<<62;
const double EPS = 1e-12;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;
 
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod
#define inside(y, x, h, w) (0 <= (y) && (y) < (h) && 0 <= (x) && (x) < (w)) ? true : false

int n, p;
int w[100000 + 5], b[100000 + 5];
pair<int, int> pr[100000 + 5];

signed main() {	
    cin.tie(0);
    ios::sync_with_stdio(false);
	cin >> n >> p;
	rep(i, n) {
		cin >> w[i] >> b[i];
		pr[i] = make_pair((100-p) * w[i] + p * b[i], i);  
	}
	sort(pr, pr + n);
	reverse(pr, pr + n);
	int l = 0, r = n;
	while (r - l > 1) {
		int m = (r + l) / 2;
		int w_cnt = 0;
		rep(i, m) {
			int idx = pr[i].se;
			w_cnt += w[idx];
		}
		int b_cnt = 0;
		rep2(i, m, n) {
			int idx = pr[i].se;
			b_cnt += b[idx];
		}
		if ((100 - p) * w_cnt - p * b_cnt >= 0) r = m;
		else l = m; 
	}
	cout << r << endl;
}


Measured memory_bytes: 3328
#include <iostream>
#include<bits/stdc++.h>
#define int long long
using namespace std;

int32_t main() {
	// your code goes here
	string s;
	cin>>s;
	reverse(s.begin(),s.end());
	int ans = 0 ;
	int n = s.size();
	for(int i=0;i<n;i++){
		ans+=(s[i]-'0')%9;
		ans%=9;
	}
	if(ans%9==0){
		cout<<"Yes\n";
	}
	else{
		cout<<"No\n";
	}
	return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define all(v) v.begin(), v.end()
#define lint long long
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#define debug(...)\
  std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;

template <typename T>
std::istream& operator>> (std::istream& is, std::vector<T>& v) {
  for (auto & x : v) is >> x;
  return is;
}

template <typename T>
std::ostream& operator<< (std::ostream& os, const std::vector<T>& v) {
  auto n = v.size();
  os << "{";
  for (size_t i = 0; i < n; i++)
    {os << (i > 0 ? "," : "") << v.at(i);}
  return os << "}";
}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  std::vector< int > a(n); std::cin >> a;
  auto now = 2;
  auto ret = (lint)(a.front() - 1);
  a.erase(a.begin());
  for (auto x : a) {
    if (x < now) continue;
    if (x == now)
      { now++; continue;}
    ret += (x - 1) / now;
  }
  std::cout << ret << std::endl;
  return 0;
}


Measured memory_bytes: 640
import numpy as np


def main():
    n = int(input())
    a = [int(x) for x in input().split()]

    best, solution = int(-1e10), []
    for p in range(2):
        c = a.copy()

        indexes = list(range(p, n, 2))
        if len(indexes) == 0:
            continue

        maks = max([c[i] for i in indexes])
        pick = next((i for i in indexes if c[i] == maks))
        chosen = set([pick] if maks <= 0 else [i for i in indexes if c[i] > 0])
        is_chosen = [(i in chosen) for i in range(n)]

        tot, res = sum([c[i] for i in chosen]), []
        for i in reversed(range(n)):
            if not is_chosen[i]:
                if i == 0 or i + 1 == len(c):
                    res += [i]
                    del c[i], is_chosen[i]
                elif is_chosen[i - 1] == is_chosen[i + 1]:
                    res += [i]
                    c[i - 1] += c[i + 1]
                    del c[i + 1], c[i], is_chosen[i + 1], is_chosen[i]

        for end in (-1, 0):
            while len(c) > 1 and not is_chosen[end]:
                res += [end]
                del c[end], is_chosen[end]

        if tot > best:
            best, solution = tot, np.array(res) + 1

    print(best, len(solution), *solution, sep='\n')


if __name__ == '__main__':
    main()


Measured memory_bytes: 12388
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    for(int x = 1; x <= 50000; x++) {
        int y = x*1.08;
        if(y == n) {
            cout << x << endl;
            return 0;
        }
    }

    cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
//DEFINE and TYPEDEF--------------------------------------------------------------
 
#define timeKyaHorhaH 1.0 * clock() / CLOCKS_PER_SEC

#define FORG(i,a,n) for(lld i=a;i<n;i++) //for - general
#define FORZ(i,n) for(lld i=0;i<n;i++) //for - zero
#define FORGI(i,a,n,inc) for(lld i=a;i<n;i+=inc) //for - general incremental
#define FORZI(i,n,inc) for(lld i=0;i<n;i+=inc) //for - zero incremental
#define SPEEDUP ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define MEM(a,val) memset(a,val,sizeof(a));
 
#define SORTall(m) sort(m.begin(),m.end());
 
#define st first
#define nd second
#define pb push_back
 
typedef long long int lld;
typedef unsigned long long int ulld;
 
//DEBUGGER------------------------------------------------------------------------
// #define DEBUG(x) cerr<<(#x)<<" is "<<(x)<<"\n" //to debug values of variables
#define DEBUGON
#define ZINDA cerr<<"\nIdhar-ich hai apun!!\n"; //to debug if code reached that point

vector<string> vec_splitter(string s) {
	for(char& c: s) c = c == ',' ?  ' ': c;
	stringstream ss; ss << s;
	vector<string> res;
	for(string z; ss >> z; res.push_back(z));
	return res;
}

void debug_out(vector<string> args, int idx) { cerr << endl; }
template <typename Head, typename... Tail>
	void debug_out(vector<string> args, int idx, Head H, Tail... T) {
		if(idx > 0) cerr << ", ";
		stringstream ss; ss << H;
		cerr << args[idx] << " = " << ss.str();
		debug_out(args, idx + 1, T...);
	}

#ifdef DEBUGON
	#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__);
	#define DEBUG(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__);	
#else
	#define debug(...) 320;
	#define DEBUG(...) 320;
#endif

lld power(lld b, lld e)
{
    if(e==0)
        return 1;
    if(e%2==1)
        return b*power(b*b,(e-1)/2);
    else
        return power(b*b,e/2);
}
 
lld power(lld b, lld e, lld m)
{
	if(e==0)
		return 1;
	if(e%2==1)
		return b*power(((b%m)*(b%m))%m,(e-1)/2,m)%m;
	else
		return power(((b%m)*(b%m))%m,e/2,m)%m;
}
 
int nDig(lld n)
{
	if(n<0) 
		n*=-1;
	if(n==0)
		return 1;

    return floor(log10(n) + 1);
}

#define pi 3.1415926536
#define endl '\n'
#define mod 1000000007

//endl : changed to '\n', to flush comment that definition
//--------------------------------------------------------------------------------

void swagWaalaFunction()
{
  	string s;
  	cin>>s;
  
  	if(s[1]=='R')
      cout<<"ABC";
  	else
      cout<<"ARC";
	return;
}

int main()
{
    SPEEDUP;
 	lld t=1;
 	// cin>>t;

 	#ifdef PRIMES
 		sieve();
 	#endif

 	#ifdef CHOOSE
 		nCrModInit();
 	#endif

 	while(t--)
 		swagWaalaFunction();
	
	// cerr<<"\n"<<timeKyaHorhaH; 	
 	return 0;
}


Measured memory_bytes: 3612
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define FOR0(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define FOR(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define FORD(i,l,r) for(int i=(r), _##i=(l); --i>=_##i; )
#define repi(i,a) for(__typeof((a).begin()) i=(a).begin(), _##i=(a).end(); i!=_##i; ++i)
#define dwni(i,a) for(__typeof((a).rbegin()) i=(a).rbegin(), _##i=(a).rend(); i!=_##i; ++i)
#define SZ(a) ((int)((a).size()))
#define printCase() "Case #" << caseNum << ": "
#define pb push_back
#define mp make_pair
#define INF ((int)1e9)
#define SYNC std::ios::sync_with_stdio(false);  cin.tie(NULL);
#define ff first
#define ss second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll p[20];
bool check(ll x) {
    char ans;
    cout << "? " << x << endl;
    fflush(stdout);
    cin >> ans;
    return (ans == 'Y');
}
ll actual = 100001;
bool check1(ll x) {
    if(actual <= x) return to_string(actual) <= to_string(x);
    if(actual > x) return to_string(actual) > to_string(x);
}
int main() {
    SYNC
    p[0] = 1; FOR(i,1,18) p[i] = p[i-1] * 10;
    int digits = 0;
    while(1) {
        if(!check(p[digits])) break;
        digits++;
        if(digits > 11) {
            ll z = 1;
            FOR0(i, 11) if(!check(p[i] + 1)) {z = p[i+1];}
            cout << "! " << z << endl; fflush(stdout);
            return 0;
        }
    }
    ll n = p[digits], x;
    FORD(i, 1, digits+1) {
        int l = (i == digits), r = 9; bool changed = false;
        while(l <= r) {
            int d = (l + r) >> 1;
            x = n + (d - ((n/p[i])%10))*p[i];
            if(!check(x)) { l = d+1; n = x; changed = true;}
            else r=d-1;
        }
        if(!changed) n = n + (1 - ((n/p[i])%10))*p[i];
    }
    cout << "! " << n/10 + 1<< endl;
    fflush(stdout);
    return 0;
}

Measured memory_bytes: 716
//By Vlgd
#include<bits/stdc++.h>
using namespace std;
string s1,s2;
int dp[1001][1001];
void solve(){
	int m=0;
	int n1=s1.size(),n2=s2.size();
	s1=' '+s1;s2=' '+s2;
	for (int i=0;i<=n1;i++) dp[i][0]=0;
	for (int i=0;i<=n2;i++) dp[0][i]=0;
	for (int i=1;i<=n1;i++)
		for (int j=1;j<=n2;j++){
			if (s1[i]==s2[j]) dp[i][j]=dp[i-1][j-1]+1;
			else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
	}
	printf("%d\n",dp[n1][n2]);
}
main(){
	int q;scanf("%d",&q);
	for (int i=0;i<q;i++){
		cin>>s1>>s2;
		solve();
	}
}


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

int main(){
    int N;
    cin >> N;
    int A[N];
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    map<int ,int >mp;
    for(int x:A){
        mp[x]++;
    }
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        if(itr->second>1){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

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

int main(){
    using namespace std;
    string s, t;
    cin >> s >> t;
    unsigned long N = s.size();
    vector<array<long, 26>> next(N);
    for(auto& i : next)fill(i.begin(), i.end(), -1);
    for(unsigned long i = 1; i < N; ++i)next[i - 1][s[i] - 97] = i;
    next.back()[s[0] - 97] = N;
    for(unsigned long i = N - 1; i--; )for(unsigned long j = 0; j < 26; ++j)if(next[i][j] < 0)next[i][j] = next[i + 1][j];
    for(unsigned long j = 0; j < 26; ++j)if(next[0][j] >= 0 && next.back()[j] < 0)next.back()[j] = N + next[0][j];
    for(unsigned long i = N - 1; i--; )for(unsigned long j = 0; j < 26; ++j)if(next[i][j] < 0)next[i][j] = next[i + 1][j];
    unsigned long ans{0}, now{N - 1};
    for(const auto& c : t){
        if(next[now][c - 97] < 0)return 0 & puts("-1");
        now = next[now][c - 97];
        if(now >= N){
            now -= N;
            ++ans;
        }
    }
    cout << (ans - 1) * N + now + 1 << endl;
    return 0;
}

Measured memory_bytes: 20864
#include<iostream>
using namespace std;
int main() {
	int n;
	cin>>n;
	switch(n)
	{
	case 1:
		cout<<"Hello World";
		break;
	case 2:
		int a, b;
		cin>>a>>b;
		cout<<a+b;
		break;
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
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;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

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

    // 計算例
    cout << COM(100000, 50000) << endl;
}*/

//printf("%.10f\n", N);
/*
ll fibo(ll n){
    if(memo[n] != 0)return memo[n];
    if(n <= 1)return n;
    else return memo[n] = fibo(n - 1)+ fibo(n - 2);
}*/
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/
/*
    cout << fixed << setprecision(15);
    */
int main(){
  ll N,M;
  cin >> N >> M;
  cout << max(max(N + M,N - M),N * M) << endl;
}


Measured memory_bytes: 256
import java.io.PrintWriter

val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    nextInt()
    val a = listOfLong()

    var sum:Long = 0
    var min = a[0]*a[0]
    var count = 0
    for (i in a){
        var abs = i
        if (i < 0) {
            count++
            abs *= -1
        }
        sum += abs

        if (abs < min) min = abs

    }

    if (count%2 == 0){
        println(sum)
    }else{
        println(sum - min*2)
    }
}

// 入力取得
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfLong() =listOfString().map { it.toLong() }


Measured memory_bytes: 59684
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

int main() {
	vi prime(1000001, 1);
	prime[0] = prime[1] = 0;
	FOR(i, 2, 1000) {
		if(prime[i]) {
			for(int j = i*2; j <= 1000000; j += i) {
				prime[j] = 0;
			}
		}
	}

	int n;
	while(cin >> n) {
		int ans = 0;
		REP(i, n+1) {
			ans += prime[i];
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 4900
#include<stdio.h>

int cb(int x){
  return x*x*x;
}

void doit(int n){
  int i,j;
  int max=0;
  int z3=cb(n);
  for(i=1;i<=n;i++){
    for(j=i;j<=n;j++){
      int tmp=cb(i)+cb(j);
      if((tmp>max)&&(z3>=tmp)){
	max=tmp;
      }
    }
  }
  printf("%d\n",cb(n)-max);
}

int main(){
  int n;
  scanf("%d",&n);
  while(n!=0){
    doit(n);
    scanf("%d",&n);
  }
  return 0;
}

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

#define ll long long int
#define str string
#define ALL(a)  (a).begin(),(a).end()
#define P pair<ll,ll>

using Graph = vector<vector<int>>;

const int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Min = INFL, Max = -1;
ll a, b, c, d, n, sum, A[500010], B[500000], rui[500000], dp[5000];
str S, T, U; bool check = true;	vector<ll> v;



int main() {
	//Code Line
	cin >> a >> b;
	if (a == 1 || b == 1)cout << 1 << endl;
	else {
		if (a % 2 == 0) {
			c = a / 2;
			d = b / 2;
			cout << c * b << endl;
		}
		else {
			c = a / 2;
			d = b / 2;
			if (b % 2 == 0) { cout << (c + 1) * d + c * d << endl; }
			else cout << (c + 1) * (d + 1) + c * d << endl;
		}
	}


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	int n;cin>>n;
	int x,y;cin>>x>>y;
	x--;y--;
	int ans[n+1]={};
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			int sum=abs(x-i)+abs(y-j)+1;
			ans[min(sum,j-i)]++;
			//cout<<i+1<<" "<<j+1<<" : "<<min(sum,j-i)<<"\n";
		}
	}

	for(int i=1;i<n;i++) cout<<ans[i]<<"\n";
}

Measured memory_bytes: 256
H, W = map(int, input().split())
a = []
for i in range(H):
    a.append(input())
row = [False]*H
col = [False]*W
for i in range(H):
    for j in range(W):
        if a[i][j] == '#':
            row[i] = True
            col[j] = True
for i in range(H):
    if row[i]:
        for j in range(W):
            if col[j]:
                print(a[i][j], end='')
        print()

Measured memory_bytes: 4468
import java.util.*;
import java.lang.*;


	 class Main {
    public static void main(String args[]){
      Scanner input = new Scanner(System.in);
      int x = 0;if(input.hasNextInt())x = input.nextInt();
      if(x==0)System.out.println("1");
      else System.out.println("0");




    }
}


Measured memory_bytes: 35624
input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n')
line = lines.shift().split(' ')
a = line[0] * 1
b = line[1] * 1 
c = line[2] * 1
console.log(a * b * c / 2 / Math.max(a,b,c))

Measured memory_bytes: 7372
#include <stdio.h>

int main(void)
{
    int a,b,m=-1000;
    scanf("%d%d",&a,&b);
    if(a+b>m)m=a+b;
    if(a-b>m)m=a-b;
    if(a*b>m)m=a*b;
    printf("%d",m);
    return 0;
}

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

int main() {
long long n,m,x[1000],y[1000],z[1000];
long long t[1000],p=0;
cin>>n>>m;
for(int i=0;i<n;i++){
    cin>>x[i]>>y[i]>>z[i];
}

for(int i=0;i<(1<<3);i++){
    int s[3];
    long long q=0;
    for(int j=0;j<3;j++){
        if((1&(i>>j))==1){
            s[j]=1;
        }else{
            s[j]=-1;
        }
    }
    for(int j=0;j<n;j++){
        t[j]=x[j]*s[0]+y[j]*s[1]+z[j]*s[2];
    }
    sort(t,t+n);
    for(int j=n-1;j>=n-m;j--){
        q+=t[j];
    }
    p=max(p,q);
    //cout<<i<<":"<<q<<endl;
}
cout<<p<<endl;
	return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE OverloadedLists     #-}
{-# LANGUAGE OverloadedStrings   #-}
{-# LANGUAGE ScopedTypeVariables #-}

import           Control.Monad
--import           Control.Monad.Loops
import           Data.IORef
import           Data.Maybe
import qualified Data.Text     as T
import qualified Data.Text.IO  as T
import           GHC.Base
import           System.IO

import qualified Data.Array    as A
import           Data.Char
import qualified Data.IntMap   as I
import           Data.List
import qualified Data.Map      as M
import qualified Data.Set      as S
import qualified Data.Vector   as V

-- for Text
(+.+) = T.append
(!.!) = T.index

-- for Vector
count :: (a -> Bool) -> V.Vector a -> Int
count p = V.length . V.filter p

-- for IO
readT :: Read a => T.Text -> a
readT = read . T.unpack

getLineSpc :: Read a => IO [a]
getLineSpc = do
  t <- T.getLine
  let xs = map readT $ T.split (== ' ') t
  return xs

getLineSpcVec :: Read a => IO (V.Vector a)
getLineSpcVec = do
  t <- T.getLine
  let xs = V.fromList $ map readT $ T.split (== ' ') t
  return xs

----------
-- main --
----------
main :: IO ()
main = roundUptheMean

twoAnagrams :: IO ()
twoAnagrams = do
  s <- getLine
  t <- getLine
  let s' = sort s
      t' = sortBy (flip compare) t
  if s' < t'
    then
    putStrLn "Yes"
    else
    putStrLn "No"

roundUptheMean :: IO ()
roundUptheMean = do
  ab' :: [Int] <- getLineSpc
  let ab     = sum ab'
      (q, r) = ab `divMod` 2
  if r == 0
    then
    print q
    else
    print $ q + 1

Measured memory_bytes: 508
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

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

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};
/* -- template -- */
void solve(vector<int> X, const int N, vector<int> pivot) {
    rep(i, N) {
        cout << ((X[i] < pivot[N / 2]) ? pivot[N / 2] : pivot[N / 2 - 1]) << endl;
    }
}
int main() {
    int N; cin >> N;
    vector<int>X(N);rep(i, N) cin >> X[i];
    vector<int>tmp(N);
    tmp = X;
    sort(tmp.begin(), tmp.end());
    solve(X, N, tmp);
}


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

using ll = long long int;

ll arr[100010] = {};

int main(void){
    
    ll n ,m , mod = (10e8)+7,res = 1;
    cin >> n >> m;
    
    if(abs(n-m) <= 1){
        
        arr[0] = 1;
        
        for(int i = 1; i < 100010; i++){
            arr[i] = arr[i-1]*i;
            arr[i] %= mod;
        }
        
        res *= arr[n];
        res %= mod;
        res *= arr[m];
        res %= mod;
        
        if(n == m){
            res *= 2;
        }
        res %= mod;
        
        cout << res << endl;
        
    }else{
        cout << 0 << endl;
    }
    
    
    
    
}


Measured memory_bytes: 1024
#define NDEBUG
#include <cassert>
#include <iostream>
#include <string>
#include <vector>

int main(void) {
  int N, M;
  std::cin >> N >> M;
  assert(N >= M);
  std::vector<std::string> A(N), B(M);
  for (int i = 0; i < N; i++) {
    std::cin >> A[i];
    assert(A[i].length() == N);
  }
  for (int i = 0; i < M; i++) {
    std::cin >> B[i];
    assert(B[i].length() == M);
  }
  for (int i = 0; i <= N - M; i++) {
    for (int j = 0; j <= N - M; j++) {
      for (int k = 0; k < M; k++) {
        for (int l = 0; l < M; l++) {
          if (A[i + k][j + l] != B[k][l])
            goto nomatch;
        }
      }
      std::cout << "Yes" << std::endl;
      return 0;
    nomatch:
      continue;
    }
  }
  std::cout << "No" << std::endl;
  return 0;
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;
}

Node treeSearch(Node u, int k){
  if(u == NIL || k == u ->key) return u;
  if(k < u->key) return treeSearch(u->left,k);
  else return treeSearch(u->right,k);

  while(u != NIL && k != u->key){
    if(k < u->key) u = u->left;
    else if(k > u->key) u = u->right;
  }
  return u;
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right !=NIL) return treeMinimum(x->right);

  while(y != NIL && x == y ->right){
    x = y;
    y = y->parent;
}
return y;
}

void treeDelete(Node z){
  Node y;
  Node x;
  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);
  if(y->left != NIL)x = y->left;
  else x = y->right;
  if(x != NIL) x->parent = y->parent;
  if(y-> parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y ->parent->right = x;
  if(y != z) z ->key = y->key;
}
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key)  x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if(y == NIL)   root = z;
  else if(z->key < y->key) y->left = z;
  else y ->right = z;
}


void inorder(Node u){
  if(u != NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}
void preorder(Node u){
  printf(" %d",u->key);
  if(u->left != NIL) preorder(u->left);
  if(u->right != NIL) preorder(u->right);
}



int main(){
  int n, i, x;
  char com[20];
  Node t;
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      t = treeSearch(root,x);
      if( t != NIL) printf("yes\n");
      else printf("no\n");
    }
if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } 
     else if( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
     } else if(com[0] == 'd'){
       scanf("%d",&x);
       treeDelete(treeSearch(root,x));
     }   
  }

  return 0;
}

Measured memory_bytes: 19364
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    v = list(map(int, input().rstrip('\n').split()))
    c = list(map(int, input().rstrip('\n').split()))
    t = 0
    for i in range(n):
        if v[i] - c[i] > 0:
            t += (v[i] - c[i])
    print(t)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38384
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    a=parseMap(split(readline()))
    l=[0 for i in 1:n+1]
    r=[0 for i in 1:n+1]
    for i in 2:n+1
        l[i]=l[i-1]+a[i-1]
    end
    for i in 2:n+1
        r[i]=r[i-1]+a[n-i+2]
    end
    ans=10^10
    for i in 2:n
        ans=min(ans,abs(l[i]-r[n-i+2]))
    end
    println(ans)
end
main()

Measured memory_bytes: 130336
n,k = map(int,input().split())
s = input()
comp = []

bef = s[0]
temp = 0

# if s[0] != "L":
#     comp.append(0)
#
# if s[-1] != "L":
#     comp.append(0)

for c in s:
    if c == bef:
        temp += 1
    else:
        comp.append(temp)
        temp = 1
        bef = c
comp.append(temp)

init = 0
n = len(comp)
for c in comp:
    init += c-1

inside = 0
if n%2 == 0:
    inside = n//2-1
else:
    inside = n//2

outside = 0

if n%2 == 0:
    outside = 1
else:
    outside = 0

tot = inside+outside

if k >= tot:
    print(sum(comp)-1)
elif k > inside:
    print(init+2*inside+outside)
else:
    print(init+2*k)

Measured memory_bytes: 4092
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    int solve(vector<int>& A, vector<int>& B) {
        const long long MOD = 1e9 + 7;
        int n = A.size();
        int m = B.size();

        vector<vector<long long>> dp(n + 1, vector<long long>(m + 1, 0));
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < m; ++j) {
                if (A[i] == B[j]) {
                    (dp[i + 1][j + 1] += (dp[i][j] + 1)) %= MOD;
                }
                (dp[i + 1][j + 1] += dp[i + 1][j] + dp[i][j + 1] + MOD - dp[i][j]) %= MOD;
            }
        }

        long long res = dp[n][m];
        res += 1;
        res %= MOD;
        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    cin >> n >> m;
    vector<int> A(n);
    vector<int> B(m);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> B[i];
    }

    Solution sol;
    cout << sol.solve(A, B) << "\n";

    return 0;
}

Measured memory_bytes: 31616
def list_sum(ls):
    ans = 0
    for i in range(len(ls)):
        ans += ls[i]
    return ans
n = int(input())
a = []
for i in range(2):
    a.append(list(map(int,input().split())))
ans = 0
for i in range(n):
    ans = max(ans,list_sum(a[0][0:i])+list_sum(a[1][i:n+1])+a[0][i])
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
#define rep1(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;
ll func(ll x, ll y, ll z){
  return x*x+y*y+z*z+x*y+y*z+z*x;
}
int main(){
  ll n; cin >> n;
  map<ll,ll> m;
  for(ll x=1;x<100;x++){
    for(ll y=1; y<100; y++){
      for(ll z=1; z<100; z++){
        m[func(x,y,z)]++;
      }
    }
  }
  rep1(i,n){
    cout << m[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 5920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (110)
#define pii pair<int, int>

/////////////////////////////////////////////////////////

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
T1 mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  T1 tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

bool isPrime(int n){
  if(n == 1) return false;
  rep(i, 2, min((int)(pow(n, 0.5) + 1), n)){
    if(n % i == 0) return false;
  }
  return true;
}

/////////////////////////////////////////////////////////

void Main() {
  ll N, A, B; cin >> N >> A >> B;
  string res = "Draw";
  if((B - A) % 2) res = "Borys";
  else res = "Alice"; 
  cout << res << endl;
}

/////////////////////////////////////////////////////////

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

  Main();
}


Measured memory_bytes: 256
N, M = map(int, input().split())
start = set()
goal = set()

for i in range(M):
    a, b = map(int, input().split())
    if(a == 1):
        start.add(b)
    elif(b == N):
        goal.add(a)
print("IMPOSSIBLE" if(len(start & goal) == 0) else "POSSIBLE")


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

/* int main(){
    int r,g,b;cin>>r>>g>>b;
    char rgb[3]={(char)r,(char)g,(char)b};
    cout<<rgb<<endl;
    int RGB=(int)rgb;
    cout<<RGB<<endl;
    if(RGB%4==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
    
} */

int main(){
    int r,g,b;
    cin>>r>>g>>b;
    if( (100*r+10*g+b)%4 == 0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0;
}

Measured memory_bytes: 256
/*
I just got lost in thought. It was unfamiliar territory.
- Steven Wright
*/

#include <algorithm>
#include <bitset>
#include <complex>
#include <cstring>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <vector>
//#include <boost/math/common_factor.hpp>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A,value) memset(A,value,sizeof(A))

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second

typedef long long ll;
typedef vector <int> vi;
typedef vector<ll> vl;
typedef pair <int, int> pi;
typedef pair <ll, int> pl;
typedef pair <double, double> pd;

//change these according to prob constraints
const int INF = 1000000000;
const int MAX = 100005;
const int MAX1 = 2007;
const int MAX2 = 4007;
const int LEN = 21;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1234567891;
//g++ -std=c++11 your_file.cpp -o your_program

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ifstream in("");
    ofstream out("");
    int a, b;
    cin >> a >> b;
    if ((a & 1) && (b & 1)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main()
{
  int N;
  cin>>N;
  float count;
 
  
    count = 0;
    for(int i=1;i<=N;i++)
    {
      if(i%2 != 0)
        count++;
    }
    
  

cout<<count/N;
  return 0;


}


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

int num,cnt,sum,ans;

void func(int n,int i,int s){
  if(i==cnt && s==sum) ans++;
  if(i==cnt || n>num) return;
  func(n+1,i+1,s+n);
  func(n+1,i,s);
}

int main(void){
  while(cin >> num >> cnt >> sum,num!=0){
    ans=0;
    func(1,0,0);
    cout << ans << endl;
  }
}

Measured memory_bytes: 3012
#include<bits/stdc++.h>
#include<vector>
#define N 400005
#define LL long long
#define PAIR pair<int,int>
using namespace std;
int n,lw,a[N],g[N],f[N]; PAIR w[N]; LL ans; vector<int> G[N];
void dfs(int t,int fa)
{
	int i; g[t]=a[t];
	for(i=0;i<G[t].size();i++)
		if(G[t][i]!=fa){
			dfs(G[t][i],t);
			f[t]=max(f[t],f[G[t][i]]+1);
			g[t]+=g[G[t][i]];
		  }
}
void DFS(int t,int fa)
{
	int i,sp=0,sq=0,p,q,r,s;
	w[lw=1]=PAIR(0,a[t]);
	for(i=0;i<G[t].size();i++)
		w[++lw]=PAIR(f[G[t][i]]+1,g[G[t][i]]);
	sort(w+1,w+lw+1),p=0;
	for(i=1;i<lw;i++)
		if(p+=w[i].second){
			if(i==lw-1){
				if(w[i+1].first>w[i].first) ans++;
				if(w[i+1].first>w[i].first+1) ans++;
			  }
			else ans+=w[i+1].first-w[i].first;
		  }
	for(i=0;i<G[t].size();i++)
		if(f[G[t][i]]>f[sp]) sq=sp,sp=G[t][i];
		else if(f[G[t][i]]>f[sq]) sq=G[t][i];
	for(i=0;i<G[t].size();i++)
		if(G[t][i]!=fa){
			p=f[t],q=g[t],r=f[G[t][i]],s=g[G[t][i]];
			f[t]=(sp==G[t][i] ? f[sq]+1 : f[t]);
			f[G[t][i]]=max(f[G[t][i]],f[t]+1);
			g[t]-=g[G[t][i]],g[G[t][i]]+=g[t];
			DFS(G[t][i],t);
			f[t]=p,g[t]=q,f[G[t][i]]=r,g[G[t][i]]=s;
		  }
}
int main()
{
	int i,x,y; f[0]=-1;
	scanf("%d",&n);
	for(i=1;i<n;i++){
		scanf("%d %d\n",&x,&y);
		G[x].push_back(y);
		G[y].push_back(x);
	  }
	x=0,y=0;
	for(i=1;i<=n;i++) a[i]=getchar()-'0';
	dfs(1,0);
	DFS(1,0);
	cout<<ans+1;
	return 0;
}


Measured memory_bytes: 35200
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>

#ifdef _MSC_VER
#include <Windows.h>
#else
#include <unistd.h>
#endif

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD=(double)1e9+7;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

LL N,A,B;
LL h[100003];
bool f(LL T){
    LL cnt=0;
    REP(i,N){
        if(h[i]<=T*B)continue;
        cnt+=((h[i]-T*B)/(A-B))+((h[i]-T*B)%(A-B)!=0);
    }
    return cnt<=T;
}

int main(){    
    cin>>N>>A>>B;
    LL maxi=0;
    REP(i,N){
        cin>>h[i];
        maxi=max(maxi,h[i]);
    }
    LL ld=0,rd=maxi/B+1;
    while(rd-ld>1){
        LL md=(ld+rd)/2;
        if(f(md)){
            rd=md;
        }else{
            ld=md;
        }
    }
    cout<<rd<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
    int n,cnt;
    ll k,a[100000],x[40],b[40]={},two[40],ans=0,c;
    scanf("%d %lld",&n,&k);
    for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);
    }
    two[0]=1;
    for(int i=1;i<40;i++){
        two[i]=2*two[i-1];
    }
    for(int i=39;i>=0;i--){
        cnt=0;
        for(int j=0;j<n;j++){
            if((two[i]&a[j])){
                cnt++;
            }
        }
        if(2*cnt<n){
            x[i]=two[i];
        }
    }
    for(int i=39;i>=0;i--){
        if((k&two[i])){
            for(int j=39;j>i;j--){
                b[i]+=(k&two[j]);
            }
            for(int j=0;j<i;j++){
                b[i]+=x[j];
            }
        }
    }
    for(int i=0;i<n;i++){
        ans+=(a[i]^k);
    }
    for(int i=0;i<40;i++){
        c=0;
        for(int j=0;j<n;j++){
            c+=(b[i]^a[j]);
        }
        ans=max(ans,c);
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 896
n = int(input())
s = []
for i in range(n):
    s.append(str(input()))
m = int(input())
t = []
for i in range(m):
    t.append(str(input()))
all_card = []
card_point = []
for i in range(n):
    if s[i] in all_card:
        card_point[all_card.index(s[i])] += 1
    else:
        all_card.append(s[i])
        card_point.append(1)

for i in range(m):
    if t[i] in all_card:
        card_point[all_card.index(t[i])] -= 1
    else:
        all_card.append(t[i])
        card_point.append(-1)

print(max(0,max(card_point)))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
typedef unsigned long long ULL;

int main() {

	std::string str;
	std::cin >> str;
	long long ans = 0;
	for (int bit = 0; bit < (1 << ((int)str.size() - 1)); bit++) {
		long long num = str[0] - '0';
		long long sum = 0;
		for (int i = 0; i < (int)str.size() - 1; ++i) {
			if (bit & (1 << i)) {
				sum += num;
				num = 0;
			}
			num = num * 10 + str[i + 1] - '0';
		}
		sum += num;
		ans += sum;
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int  main (){
  int  a ,  b ,  c ,  d ;
  scanf ("%d%d%d%d" , &a , &b , &c , &d ) ;
  if  ( a + b>c + d) 
    printf(" Left\n " ) ;
  else if  ( a + b == c + d) 
    printf(" Balanced\n " );
  else printf (" Right\n " );
  return  0;
}

Measured memory_bytes: 1712
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#define bogo_sort std::sort
#define bozo_sort std::stable_sort
#define alles(obj) obj.begin(), obj.end()
#define elif else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo std::cout <<
#define read std::cin >>
#define endl std::endl
#define fin << '\n'
#define bash push_back
#define makePair std::make_pair
#define _ << ' ' <<
// type-define
#define Stack std::stack
#define Queue std::queue
#define Set std::set
#define PQueue std::priority_queue
#define Vector std::vector
#define Pair std::pair
#define Map std::map
#define HashMap std::unordered_map
#define Greater std::greater
using String = std::string;
using llong = long long;
using boolean = bool;
using Pii = Pair<int, int>;
using Vi = Vector<int>;
using Vii = Vector<Pii>;
// utils
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A, class B> A lcm ( A x, B y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A, class B> inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B> inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    double ans;

    signed call_of_Cthulhu( signed datum ) {

        int n;
        read n;
        for ( int i = 0; i < n; i++ ) {
            double x;
            String u;
            read x >> u;
            if ( u[0] == 'J' ) {
                ans += x;
            }
            else {
                ans += x * 380000.0f;
            }
        }

        echo ans fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	int s = 0;
	rep(i,3){
		int a;cin >> a;
		s += a;
	}
	cout << (s >= 22?"bust":"win") << endl;
	return 0;
}

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

using namespace std;

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

    for (int i = 0; i < s.length(); ++i) {
        char c;
        c = s.at(i);
        if (i == k - 1) {
            c = tolower(c);
        }
        ans += c;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3604