akhauriyash/Code-Regression huggingface dataset:
fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.read();
    let a: Vec<usize> = (0..n).map(|_| sc.read()).collect();
    let mut b: Vec<usize> = (0..n).map(|_| sc.read()).collect();

    let mut ans = 0;
    for k in 0..30 {
        let t = 1 << k;
        let t2 = t * 2;
        let t2m = t2 - 1;

        b.sort_by_key(|x| x & t2m);

        let mut count = 0;
        for i in 0..n {
            let ai = a[i] & t2m;
            let pos2 = b.binary_search_by_key(&(2 * t * 2 - 1), |bi| (ai + (bi & t2m)) * 2)
                .err()
                .unwrap();
            let pos1 = b.binary_search_by_key(&(1 * t * 2 - 1), |bi| (ai + (bi & t2m)) * 2)
                .err()
                .unwrap();
            let pos3 = b.binary_search_by_key(&(3 * t * 2 - 1), |bi| (ai + (bi & t2m)) * 2)
                .err()
                .unwrap();
            count += n - pos3 + pos2 - pos1;
        }
        ans |= (count & 1) << k;
    }

    println!("{}", ans);
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner { ptr: 0, length: 0, buf: vec![0; 1024], small_cache: vec![0; 1024] }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool { b == b'\n' || b == b'\r' || b == b'\t' || b == b' ' }

    fn read<T>(&mut self) -> T where T: std::str::FromStr, T::Err: std::fmt::Debug, {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)]).parse().unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}



Measured memory_bytes: 10492
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<P>edge[1005];
int cnt[1005],n;
P D;
void dfs(int v,int u,int d){
	if(D.fi < d){
		D = mp(d,v);
	}
	for(int i=0;i<edge[v].size();i++){
		if(edge[v][i].fi == u) continue;
		dfs(edge[v][i].fi,v,d+edge[v][i].sc);
	}
}
int main(){
	while(1){
		for(int i=0;i<1005;i++){
			edge[i].clear(); cnt[i] = 0;
		}
		cin >> n; if(!n) return 0;
		vector<P1>vec;
		int ret = 0;
		for(int i=2;i<=n;i++){
			int a; cin >> a;
			cnt[a]++; cnt[i]++;
			vec.pb(mp(-1,mp(a,i)));
		}
		int t = -1;
		for(int i=2;i<=n;i++){
			int a; cin >> a;
			if(cnt[vec[i-2].sc.fi] >= 2 && cnt[vec[i-2].sc.sc] >= 2){
				ret += 3*a;
				int x = vec[i-2].sc.fi; int y = vec[i-2].sc.sc;
				edge[x].pb(mp(y,a));
				edge[y].pb(mp(x,a));
				t = x;
			}
			else{
				ret += a;
			}
		}
		D = mp(-1,-1);
		dfs(t,-1,0);
		int v2 = D.sc;
		D = mp(-1,-1);
		dfs(v2,-1,0);
		ret -= D.fi;
		cout << ret << endl;
	}
}

Measured memory_bytes: 3200
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

class BCanYouSolveThis {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll n,m,c;
        in>>n>>m>>c;
        vector<ll> b(m);
        ll ans=0;
        rep(i,m){
            in>>b[i];
        }
        rep(i,n){
            ll a=0;
            rep(j,m){
                ll tmp;
                in>>tmp;
                a+=tmp*b[j];
            }
            a+=c;
            if(a>0) ans++;


        }
        out<<ans<<endl;
	}
};


int main() {
	BCanYouSolveThis solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 888
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <math.h>
#include <algorithm>
#include <string>

using namespace std;

void hoge(int x, int y) // x: height y: width
{
    int counter = 0;
    while (counter < x) {
        if (counter % 2 == 0){
            for (int i=0; i< y; ++i){
                if (i % 2 == 0){
                    cout << "#";
                } else {
                    cout << ".";
                }
            }
        } else {
            for (int i=0; i< y; ++i){
                if (i % 2 == 0){
                    cout << ".";
                } else {
                    cout << "#";
                }
            }
        }
        cout << endl;
        ++counter;
        
    }
    cout << endl;
}

int main()
{
    int H, W;
    while(cin >> H >> W, H+W != 0) {
        hoge(H,W);
    }
}




Measured memory_bytes: 3112
#include <bits/stdc++.h>
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; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


int main() {
    string S;
    while (cin >> S) {
        if (S == "AAA" || S == "BBB") cout << "No" << endl;
        else cout << "Yes" << endl;
    }
}









Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin>>H>>W;
  vector<string> S(H);
  int i;
  for(i=0;i<H;i++){
  cin>>S.at(i);
  }
  int j;
  int count,k,l;
  for(i=0;i<H;i++){
    for(j=0;j<W;j++){
      if(S.at(i).at(j)=='.'){
        count=0;  
        for(k=-1;k<2;k++){
          for(l=-1;l<2;l++){
            if(k==0 && l==0) continue;
             if(i+k>=H || i+k<0 || j+l>=W || j+l<0) continue;
             if(S.at(i+k).at(j+l)=='#') count++;  
          }
        }
        char c='0'+count;
        S.at(i).at(j)=c;
      }
    }
  }
   for(i=0;i<H;i++) cout<<S.at(i)<<endl; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const bool debug =0;

inline void read(int &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void write(int x){
    static const int maxlen=100;
    static char s[maxlen];
    if (x<0) {   putchar('-'); x=-x;}
    if(!x){ putchar('0'); return; }
    int len=0; for(;x;x/=10) s[len++]=x % 10+'0';
    for(int i=len-1;i>=0;--i) putchar(s[i]);
}

const int MAXN = 610000;

char s[ MAXN ];
int n;

int main(){
    scanf("%s",s);
    n=strlen(s);
    int last=-1;
    int cnt=0;
    for (int i=0;i<n;i++)
    if ( s[i] == last )
    {
        if ( i!=n-1 )
            cnt++;
        i++;
        last=-1;
    }
    else
    {
        cnt++;
        last=s[i];
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define int long long
signed main(){
    int N, K;
    cin >> N >> K;
    int H[N+1];
    int  sum = 0;
    for(int  i = 0;i < N;i++){
        cin >> H[i];
    }
    sort(H, H+N, greater<int>());
    int  ans = 0;
    for(int  i = K;i < N;i++){
        ans += H[i];
    }
    cout << ans;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define MAXN 505
typedef long long ll;

using namespace std;

ll n, a[MAXN];

int main(){
	ios_base::sync_with_stdio(false);
    for(int i = 0; i < 3; i++){
    	cin >> a[i];
    }
    cin >> n;
    ll ans;
    if(n % 2 == 0){
    	ans = a[0] - a[1];
    } else{
    	ans = a[1] - a[0];
    }
    cout << ans;
}


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


using namespace std;

long long lmax( long long a[]){
    long long m = 0;
    for (int i=0;i<55;++i)
    {
        m = a[i]>m?a[i]:m;
    }
    return m;
}
int main(){


    int n;
    long long a[55]={};
    cin >> n;
    for(int i=0;i<n;++i)cin >> a[i];
    long long c = 0;
    long long cnt = 0;
    while(lmax(a)>n-1){
        long long k = lmax(a);
        c = k/n;
        cnt += c;
        int f=1;
        for(int i=0;i<n;++i){
            if(f==1 && a[i]==k){
                f=0;
                a[i]-=c*n;
            }else{
                a[i]+=c;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF INT_MAX
typedef pair<int, int> P;
vector<pair<int, int> > g[100000];
int main(void){
	int v, e, r;
	cin >> v >> e >> r;
	for(int i = 0; i < e; i++){
		int s, t, d;
		cin >> s >> t >> d;
		g[s].push_back(P(t, d));
	}
	priority_queue<P, vector<P>, greater<P> > que;
	int leng[v];
	fill(leng, leng + v, INF);
	leng[r] = 0; que.push(P(0, r));
	while(!que.empty()){
		P a = que.top(); que.pop();
		int cost = a.first, p = a.second;
		if(leng[p] < cost) continue;
		for(int i = 0; i < g[p].size(); i++){
			int to = g[p][i].first, to_cost = cost + g[p][i].second;
			if(leng[to] > to_cost) leng[to] = to_cost, que.push(P(leng[to], to));
		}
	}
	for(int i = 0; i < v; i++){
		if(leng[i] == INF) cout << "INF" << endl;
		else cout << leng[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 13000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b)
{
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
//cout << 'H' << endl;
/*--------------------------------------------*/
ll modpow(ll x, ll n, ll mod)
{
    if (n == 0)
        return 1;
    ll res = modpow(x * x % mod, n / 2, mod);
    if (n & 1)
        res = res * x % mod;
    return res;
}

int main()
{
    //cout << fixed << setprecision(10)
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    vector<ll> a(N), b(N);

    map<pll, ll> mp;

    ll tmp = 0;

    rep(i, N)
    {
        cin >> a[i] >> b[i];

        if (a[i] * b[i]) {
            ll g = gcd(a[i], b[i]);

            a[i] /= g;
            b[i] /= g;

            if (a[i] < 0) {
                a[i] *= -1;
                b[i] *= -1;
            }
            //これで(+,+)or(+,-)のみ

            mp[make_pair(a[i], b[i])]++;

        } else {
            if (a[i]) {
                mp[pll(1, 0LL)]++;

            } else {
                if (b[i]) {
                    mp[pll(0LL, -1)]++;
                } else {
                    tmp++;
                }
            }
        }
    }

    ll ans = 1;
    for (auto [k, v] : mp) {
        //cout << k.first << ' ' << k.second << endl;
        ll t;
        pll tm;

        if (k.second >= 0) {
            tm = pll(k.second, -k.first);
        } else {
            tm = pll(-k.second, k.first);
        }

        t = mp[tm];

        ll p = modpow(2, v, MOD);

        if (t) {
            p += modpow(2, t, MOD) - 1;
            mp[tm] = 0;
        }

        if (v) {
            ans *= p;
            ans %= MOD;
        }
    }


    cout << (ans + tmp - 1 + MOD) % MOD << endl;
}


Measured memory_bytes: 31356
#include <bits/stdc++.h>
using namespace std;
 
int bubbleSort(int A[], int N){
    int sw = 0;
    bool flag = 1;
    for(int i = 0; flag; i++){
        flag = 0;
        for(int j = N-1; j >=i+1;  j--){
            if(A[j] < A[j-1]){
                swap(A[j], A[j-1]);
                flag = 1;
                sw++;
            }
        }
    }
    return sw;
} 
 
int main() {
    int N, A[100], sw;
    cin >> N;
    for(int i = 0; i < N; i++)  cin >> A[i];
    sw = bubbleSort(A, N);
    for(int i = 0; i < N; i++){
        if(i > 0) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;
}



Measured memory_bytes: 3116
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class ABC
{
    //          int[] split = Console.ReadLine().Split().Select(int.Parse).ToArray();

    public static void Main()
    {
        int[] split = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int N = split[0];
        int K = split[1];
        int MAX_Edges = N * (N - 1) / 2;
        int n_delete_edges = K;
        int min_Edges = N - 1;
        int Max_K = MAX_Edges - min_Edges;
        List<Edge> deletable_edges = new List<Edge>();
        List<Edge> UNDELETABLE_edges = new List<Edge>();
        List<Edge> USE_Edges = new List<Edge>();
        if (Max_K >= K)
        {
            int deleted_edges = 0;
            int first_edges = MAX_Edges;
            for (int bigger = N; bigger != 1; bigger--)
            {
                for (int smaller = bigger - 1; smaller != 0; smaller--)
                {
                    if (smaller == 1)
                    {

                        UNDELETABLE_edges.Add(new Edge(bigger, smaller));
                    }
                    else
                    {
                        if (deleted_edges < K)
                        {

                            deleted_edges++;

                        }
                        else
                        {
                            deletable_edges.Add(new Edge(bigger, smaller));
                        }
                    }
                }
            }
            int M = deletable_edges.Count + UNDELETABLE_edges.Count;
            Console.WriteLine(M);
            for (int i = 0; i < deletable_edges.Count; i++)
            {
                Console.WriteLine(deletable_edges[i].makeOutput());
            }
            for (int i = 0; i < UNDELETABLE_edges.Count; i++)
            {
                Console.WriteLine(UNDELETABLE_edges[i].makeOutput());
            }

        }
        else
        {
            Console.WriteLine(-1);
        }


    }
   

    

}

public class Edge
{
    public int a;
    public int b;
    public Edge() { }
    public Edge(int a, int b)
    {
        this.a = a;
        this.b = b;
    }
    public string makeOutput()
    {
        return a + " " + b;
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <cmath>
using namespace std;
int main(){
	int n;
	cin >> n;
	bool check = true;
	while(check){
		
	int Max = (int)sqrt((double)n);
	if(n >= 2){
		check = false;
	}else{
		check = true;
		continue;
	}
	for(int j = 2; j <= Max; j++){
		if(n % j == 0){
			check = true;
			break;
		}
	}
	n++;
	}
	cout << n-1<< endl;
	return 0;
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long N, std::string S, std::string T){
    REP(i, N) {
        cout << S[i];
        cout << T[i];
    }
    cout << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(N, S, T);
    return 0;
}


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


int main()
{
	ll n;
	cin >> n;
	ll a[n];
	for(int i =0;i<n;i++)cin >> a[i];
	sort(a,a+n);
	for(int i =0;i<n-1;i++){
		if(a[i] == a[i+1]){
			cout << "NO";
			exit(0);
			}
		}
		cout << "YES";
		
			
	return 0;
}



Measured memory_bytes: 1792
#include<stdio.h>
#include <bits/stdc++.h> 
using namespace std; 
int main (){
	int a[3];
	int b;
	scanf("%d %d %d",&a[0],&a[1],&a[2]);
	sort(a,a+3);
	b=a[2]-a[0];
	printf("%d\n",b);
	return 0;
}


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

int D;

int main(){

    cin >> D;

    if(D==25) cout << "Christmas" << endl;
    if(D==24) cout << "Christmas Eve" << endl;
    if(D==23) cout << "Christmas Eve Eve" << endl;
    if(D==22) cout << "Christmas Eve Eve Eve" << endl;

    
    
    return 0;
}


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

int main( void ) {
    ios::sync_with_stdio( false );
    long long n, num, sum = 0, k = 0, minn = 0x3f3f3f3f;
    cin >> n;
    for( int i = 0; i < n; ++i ) {
        cin >> num;
        sum += abs( num );
        if( num < 0 ) ++k;
        minn = min( abs( num ), minn );
    }
    if( k & 1 ) sum -= minn * 2;
    cout << sum << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
 
 int n;
 cin>>n;
 int ar[n];
 for(int i=0;i<n;++i)
 {
   cin>>ar[i];
 }
 int ans[n];
 ans[0]=0;
 ans[1]=abs(ar[1]-ar[0]);
 for(int i=2;i<n;++i)
 {
   ans[i]=min(ans[i-2]+abs(ar[i]-ar[i-2]),ans[i-1]+abs(ar[i]-ar[i-1]));
 }
 
 cout << ans[n-1]<<'\n';

 }
    
  





  



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

//def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

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

    int n, m;
    cin >> n >> m;
    vi a(n);
    rep(i, n) {
        cin >> a[i];
    }

    int sum = accumulate(all(a), 0);
    sort(all(a), greater<int>());

    int cnt = 0;
    rep(i, n) {
        if (a[i] < (sum + 4 * m - 1) / (4 * m)) {
            break;
        }
        cnt++;
    }
    if (cnt >= m) {
        CYES;
    } else {
        CNO;
    }

    return 0;
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL n, m, x[100001];
const LL MOD = 1000000007;

void mat_prod(LL a[3][3], LL b[3][3], LL c[3][3]) { // a = b * c;
	LL d[3][3];
	inc(i, 3) {
	inc(j, 3) {
		d[i][j] = 0;
	}
	}
	
	inc(i, 3) {
	inc(j, 3) {
	inc(k, 3) {
		(d[i][j] += b[i][k] * c[k][j]) %= MOD;
	}
	}
	}
	
	inc(i, 3) {
	inc(j, 3) {
		a[i][j] = d[i][j];
	}
	}
	
	return;
}

void mat_exp(LL a[3][3], LL b[3][3], LL c) { // a = b ^ c;
	LL t[30][3][3];
	inc(i, 3) {
	inc(j, 3) {
		t[0][i][j] = b[i][j];
	}
	}
	inc(i, 30 - 1) {
		mat_prod(t[i + 1], t[i], t[i]);
	}
	
	inc(i, 3) {
	inc(j, 3) {
		a[i][j] = 0;
	}
	}
	inc(i, 3) { a[i][i] = 1; }
	inc(i, 30) {
		if(c & (1 << i)) {
			mat_prod(a, a, t[i]);
		}
	}
	
	return;
}

int main() {
	cin >> n >> m;
	inc(i, m) { cin >> x[i]; }
	x[m] = n;
	
	LL a[3][3] = { { 4, MOD - 3, 1 }, { 1, 0, 0 }, { 1, 1, 0 } };
	LL b[3][3] = { { 3, MOD - 3, 1 }, { 1, 0, 0 }, { 0, 1, 0 } };
	LL c[3][3];
	LL d[3][3];
	
	mat_exp(c, a, x[0]);
	inc(i, m) {
		mat_prod(c, b, c);
		mat_exp(d, a, x[i + 1] - x[i] - 1);
		mat_prod(c, d, c);
	}
	
	cout << (c[0][1] + c[0][2] * 4) % MOD << endl;
	
	return 0;
}


Measured memory_bytes: 1024
use std::vec::Vec;

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let r: usize = read();
    let ans = r*r;
    println!("{}", ans);
}


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

int main(){
  ll w,h,x,y;
  cin>>w>>h>>x>>y;
  cout<<(double)w*h/2<<endl;
  if(x==(double)w/2 && y==(double)h/2){
    cout<<1<<endl;
  }
  else{
    cout<<0<<endl;
  }
  
  
}



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

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

    int fn = 0;
    int m = n;
    while (m > 0) {
        fn += m % 10;
        m /= 10;
    }
    cout << (n % fn == 0 ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
 	int a;
  	cin>>a;
  	switch(a%10){
      case 2:case 4:case 5:case 7:case 9:{
        puts("hon");
      break; 
      }
      case 0:case 1:case 6:case 8:{
        puts("pon");
       	break; 
      }
      case 3:{
       puts("bon");
        break;
      }
    }
  return 0;
}

Measured memory_bytes: 3628
s = int(input())
an = []
an.append(s)
n = s
while an.count(4) != 2:
    if n % 2 == 0:
        n /= 2
        an.append(int(n))
    else:
        n = 3 * n + 1
        an.append(int(n))
if an.index(1) == 0:
            print(4)
elif an.index(2) == 0:
            print(4)
else:
    print(an.index(4) + 4)


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

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

    vl a(m), b(m), c(m);
    rep(i, m) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;  b[i]--;
        c[i] *= -1;
    }
    
    // ベルマンフォード法。計算量はO(V*E)
    vl dist(n, INF);  // dist[v] : 頂点svから頂点vへの最短距離
    const ll sv = 0;  // 始点となる頂点。デフォルトでは0
    dist[sv] = 0;
    rep(loop, n-1) {
        rep(i, m) {
            if(dist[a[i]] == INF) {
                continue;
            }
            if(dist[b[i]] > dist[a[i]] + c[i]) {
                dist[b[i]] = dist[a[i]] + c[i];
            }
        }
    }

    vl negativeCycle(n);  // negativeCycle[v] : 頂点vを含む負閉路があるとき1
    rep(loop, n) {
        rep(i, m) {
            if(dist[a[i]] == INF) {
                continue;
            }
            if(dist[b[i]] > dist[a[i]] + c[i]) {
                dist[b[i]] = dist[a[i]] + c[i];
                negativeCycle[b[i]] = 1;
            }
            if(negativeCycle[a[i]]) {
                negativeCycle[b[i]] = 1;
            }
        }
    }

    if(negativeCycle[n-1]) {
        out("inf");
    }
    else {
        out(-dist[n-1]);   
    }

    re0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr auto INF = INT_MAX >> 1;
constexpr auto LINF = 5000000000000000;
constexpr auto MOD = 1000000007;

int main() {

	int n;
	cin >> n;
	vi a(n);
	rep(i, n) {
		cin >> a[i];
		a[i]--;
	}
	int cnt = 0;
	rep(i, n)if (a[a[i]] == i)cnt++;

	cout << cnt / 2 << endl;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int a1[2005];
int main()
{
	int n,x,y,a=0,b=0,c=0,i,j;
	cin>>n>>x>>y;
	for(i=1; i<=n; i++)	
		for(j=1; j<=n; j++)
		{
			a=abs(i-x)+1+abs(j-y);
			b=abs(i-y)+1+abs(j-x);
			c=abs(i-j);
			int k=min(a,b);
			a1[min(k,c)]++;
			a=0;
			b=0;
			c=0; 
		}
	for(i=1; i<n; i++)
		cout<<a1[i]/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
 
#define pb push_back
#define mk make_pair
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define sf(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pf(a) printf("%d\n",a);
#define pfl(a) printf("%lld\n",a);
#define TEST int test; cin >> test;while(test--)
#define ii pair<int,int>
#define iil pair<ll,ll>
#define loop(i,a,b) for(int i = a ; i < b ; i++)
#define INF 2147483647
 
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const double pi = acos(-1.0);
 
ll power(ll x, unsigned long long y)
{
    ll res = 1;     // Initialize result
 
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x);
 
        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x);  // Change x to x^2
    }
    return res;
}
 
void solve()
{
    ll n;
    cin >> n;
    for(ll i = -1000 ; i <= 1000; i++)
    {
        for(ll j = -1000 ; j <= 1000; j++)
        {
            if(power(i,5) - power(j,5) == n)
            {
                cout << i << " " << j << endl;
                return;
            }
//            else if(power(i,5) - power(-j,5) == n)
//            {
//                cout << i << " -" << j << endl;
//                return;
//            }
//            else if(power(-i,5) - power(j,5) == n)
//            {
//                cout << "-" << i << " " << j << endl;
//                return;
//            }
//            else if(power(-i,5) - power(-j,5) == n)
//            {
//                cout << "-" << i << " -" << j << endl;
//                return;
//            }
        }
    }
}
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //TEST
    solve();
    return 0;
}

Measured memory_bytes: 3632
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main
{
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	void solve()
	{
		long x=nl(),y=nl();
		int ans=0;
		for(long i=x;i<=y;i=i*2) {
			ans++;
		}
		out.println(ans);

	}
	
	
		
	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception 
	{ new Main().run(); }
	
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	
	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf)
		{
			ptrbuf = 0;
			try 
			{ lenbuf = is.read(inbuf); } 
			catch (IOException e) 
			{ throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean isSpaceChar(int c)
	{ return !(c >= 33 && c <= 126); }
	private int skip() 
	{ int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private double nd() 
	{ return Double.parseDouble(ns()); }
	private char nc()
	{ return (char)skip(); }
	
	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b)))
		{ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b)))
		{
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	
	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}
		
		while(true)
		{
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private static void tr(Object... o) 
	{ System.out.println(Arrays.deepToString(o)); }
}


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

int main(){
	int n,k;
	int num[11] = {};
	int field[] = {4,2,0,9,7};
	cin >> n >> k;
	n -= 2;
	for(int i = 0;i < 10;i++){
		bool flag = false;
		for(int j = 0;j < 5;j++){
			if(field[j] == k){
				num[i + 1] = num[i] + 1;
				flag = true;
			} 
			field[j] = (field[j] + 8) % 11;
		}
		if(!flag) num[i + 1] = num[i];
	}
	cout << (n / 11) * 5 + num[n % 11] << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

type Card struct {
	mark string
	num  int
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	A := make([]Card, n)
	for i := 0; i < n; i++ {
		tm, tn := nextStr(), nextInt()
		A[i].mark = tm
		A[i].num = tn
	}

	B := make([]Card, n)
	copy(B, A)
	//fmt.Println(A, B)

	quickSort(A, 0, n-1)
	mergeSort(B, 0, n)

	isStable := true
	for j := 0; j < n; j++ {
		if A[j] != B[j] {
			isStable = false
			break
		}
	}

	if isStable {
		fmt.Println("Stable")
	} else {
		fmt.Println("Not stable")
	}

	for l := 0; l < n; l++ {
		fmt.Printf("%s ", A[l].mark)
		fmt.Printf("%d\n", A[l].num)
	}
	//fmt.Println(A, B)
}

func quickSort(A []Card, p int, r int) {
	if p < r {
		q := partition(A, p, r)
		quickSort(A, p, q-1)
		quickSort(A, q+1, r)
	}
}

func partition(A []Card, p int, r int) int {
	x := A[r]
	i := p - 1
	for j := p; j < r; j++ {
		if A[j].num <= x.num {
			i++
			t := A[i]
			A[i] = A[j]
			A[j] = t
		}
	}
	t := A[i+1]
	A[i+1] = A[r]
	A[r] = t
	//i+1がパーティションになっている
	return i + 1
}

func mergeSort(A []Card, left int, right int) int {
	if left+1 < right {
		//fmt.Println(A[left:right])
		mid := (left + right) / 2
		//左半分に対して、マージソート
		a := mergeSort(A, left, mid)
		//右半分に対して、マージソート
		b := mergeSort(A, mid, right)
		//↑をマージ
		c := merge(A, left, mid, right)
		return a + b + c
	} else {
		return 0
	}
}

func merge(A []Card, left int, mid int, right int) int {
	//A[left:right]を、midで2つに分ける
	n1 := mid - left
	n2 := right - mid
	L := make([]Card, n1)
	R := make([]Card, n2)

	for i := 0; i < n1; i++ {
		L[i] = A[left+i]
	}
	for i := 0; i < n2; i++ {
		R[i] = A[mid+i]
	}
	L = append(L, Card{"", 1000000000})
	R = append(R, Card{"", 1000000000})
	i := 0
	j := 0

	for k := left; k < right; k++ {
		if L[i].num <= R[j].num {
			A[k] = L[i]
			i++
		} else {
			A[k] = R[j]
			j++
		}
	}

	return right - left
}



Measured memory_bytes: 18028
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  char c = ' ';
  for (int i=0; i<n; i++) {
    if (c != s[i]) c=s[i],ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/
int popcnt(int x){return __builtin_popcount(x);}
int popcnt(ll x){return __builtin_popcountll(x);}
int bitdig(int x){return 32 - __builtin_clz(x);}
int bitdig(ll x){return 64 - __builtin_clzll(x);}
int bitffs(int x){return __builtin_ffs(x);}
int bitffs(ll x){return __builtin_ffsll(x);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vl t(3),a(n);
	cin>>t>>a;

	vvl ans(3,vl(1<<n,0));
	rep(i,3){
		range(s,1,1<<n){
			ll tmp=0;
			rep(j,n)if(s&(1<<j))tmp+=a[j];
			ans[i][s]=abs(t[i]-tmp)+(popcnt(s)-1)*10;
		}
	}

	ll v=LINF;
	range(i,1,1<<n)range(j,1,1<<n)range(k,1,1<<n){
		if((i&j) or (j&k) or (k&i))continue;
		chmin(v,ans[0][i]+ans[1][j]+ans[2][k]);
	}
	puta(v);
	return 0;
}

Measured memory_bytes: 256
from sys import stdin

N = int(stdin.readline().rstrip())
B = [int(x) for x in stdin.readline().rstrip().split()]
A = [B[0]]

for i in range(N - 2):
    A.append(min(B[i], B[i + 1]))

A.append(B[N - 2])

print(sum(A))


Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
typedef long long ll;
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0;
#define HERE cout<<"         here"
#define out(value) cout<<value<<en

int main(){
  int a,b;
  cin>>a>>b;
  if(abs(a-b)>=2) cout<<":("<<en
  else cout<<"Yay!"<<en
    RE
}



















































































































































































































































































































































































































































































































































































































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

int main(){
  int dif[] = {10,20,30,40,50,60};
  while(1){
    int n;
    int cnt[7] = {0};
    scanf("%d",&n);
    if(n == 0) break;
    for(int i=0;i<n;i++){
      int num;
      scanf("%d",&num);
      for(int i=0;i<7;i++){
	if(i+1 == 7) cnt[i]++;
	else if(num < dif[i]) {
	  cnt[i]++;
	  break;
	}
      }
    }
    for(int i=0;i<7;i++){
      cout << cnt[i] << endl;
    }
  }
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define llu unsigned long long
#define U unsigned int
#define SIZE 1000002
#define pie 3.14159265358979323
#define minuss 1e-6
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int main()
{
    ll a[4];
    for(int i=0;i<3;i++)
        cin>>a[i];

    sort(a,a+3);
    if(a[0]==a[2])
        pf("No\n");
    else if(a[0]==a[1] && a[0]!=a[2])
        pf("Yes\n");
    else if(a[1]==a[2] && a[0]!=a[2])
        pf("Yes\n");
    else
        pf("No\n");

}


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

#define fi first
#define se second
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

template<class T, class U> void chmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> void chmin(T &a, U b) { if (b < a) a = b; }

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  ll x, k, d; cin >> x >> k >> d;

  x = abs(x);

  ll plus = x % d;
  ll minus = x - (x / d) * d - d;

  if ((x / d) >= k) {
    cout << x - (k * d) << endl;
    return (0);
  }

  ll plus_cnt = (x / d);
  ll minus_cnt = (x / d) + 1;

  ll plus_amari = k - plus_cnt;
  ll minus_amari = k - minus_cnt;

  if (plus_amari % 2) cout << abs(minus) << endl;
  else cout << plus << endl;
  
  return (0);
}

Measured memory_bytes: 3672
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<int, int>
#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()
/* -- template -- */

int main() {
    ll N, Pi; cin >> N >> Pi;
    string S; cin >> S;
    reverse(S.begin(), S.end());
    ll ans = 0;
    if(Pi == 5 || Pi == 2) {
        rep(i, N) {
            if((S[i] - '0') % Pi == 0) {
                ans += N - i;
            }
        }
    }else {
        ll mult10 = 1;
        ll dp[S.size() + 1]; // 後ろからi桁を見たときのPで割った剰余
        map<ll, ll> m;
        m[0]++;
        dp[0] = 0;
        rep(i, S.size()) {
            dp[i + 1] = (dp[i] + (S[i] - '0') * mult10) % Pi;
            m[dp[i + 1]]++;
            mult10 = mult10 * 10 % Pi;
        }
        for(auto i = m.begin(); i != m.end(); ++i) ans += (i->second)*(i->second - 1)/2;
        rep(i, S.size()) {
            if(S[i] == '0') {

            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 2564
#include <iostream>
using namespace std;
int main(){
  int n,y,i,j,k;
  cin >> n >> y;
  for(i=0;i<=n;i++){
    for(j=0;j<=n;j++){
      k=n-i-j;
        if(k>=0 && i+j+k==n && 10000*i+5000*j+1000*k==y){
          printf("%d %d %d\n",i,j,k);
          return 0;
      }
    }
  }
printf("-1 -1 -1\n");
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include <string.h>
 
int main(){
 int a,b,p=0;
 scanf("%d",&a);
 scanf("%d",&b);

  if(a>b){
    p = p + a + a - 1;
  }
  else if(a<b){
    p = p + b + b - 1;
  }
  else
    p = p + a + b;
  
 printf("%d",p);
    return 0;}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, n) for(int i = 0; i < n; i = i + 2)
#define repv(i, n, v) for(int i = 0; i < n; i = i + v)
#define rrep(i, n) for(int i = n; i >= 0; i--)
#define sortI(a, b, c) c == 0 ? sort(a, a + b) : sort(a, a + b, greater<int>())
#define sortS(s, a) a == 0 ? sort(s.begin(), s.end()) : sort(s.begin(), end(), greater<char>)
#define vi vector<int>
#define vf vector<float>
#define vc vector<char>
#define vs vector<string>
#define ll long long
#define lint long int
#define llint long long int
#define atoz abcdefghijklmnopqrstuvwxyz
#define atoZ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
#define AtoZ ABCDEFGHIJKLMNOPQRSTUVWXYZ

int digit(int n){
  int res = 0;
  while(n > 0){
    res += n%10;
    n /= 10;
  }
 
  return res;
}

int main(void){

  //入力
  int N;
  cin >> N;
  string s[N];
  map<string, int> item;
  rep(i, N){
    cin >> s[i];
    if(item.find(s[i]) != item.end()){
      item[ s[i] ]++;
    }else{
      item[ s[i] ] = 1;
    }
  }
  int M;
  cin >> M;
  string t[M];
  rep(i, M){ 
    cin >> t[i];
    if( item.find( t[i] ) != item.end() ){
      item[ t[i] ]--;
    }
  }
  
  //itemの値で一番大きいのを探す
  int ans = 0;
  for(auto i = item.begin(); i != item.end(); i++){
    ans = max(i->second, ans);
  }
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256