akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.C
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var N = ReadLong();
            var a = ReadLongs();
            var total = 0;
            foreach (var i in a)
            {
                var j = i;
                while(j % 2 == 0)
                {
                    total++;
                    j = j / 2;
                }
            }
            return total;
        }
        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 29556
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

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

int main() {
	
	int N,M;
	cin>>N>>M;
	vec(X)
	vec(A)
	fx(M){
		vecp(X)
	}

	if(N>=M){
		ce("0")
	}else{
	sorts(X)
	ll ans=0;
	fx(M-1){
		pb(A,X.at(x+1)-X.at(x))
		ans+=A.at(x);
	}

	sorts(A)
	reverses(A)
	fx(N-1){
		ans-=A.at(x);
	}
	ce(ans)
	}
}

Measured memory_bytes: 1400
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = a + b + c + d + e
l = []
for i in a,b,c,d,e:
    k = 10-i%10
    if k != 10:
        l.append(k)
if len(l) != 0:
    l.pop(l.index(max(l)))
    ans += sum(l)

print(ans)

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

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pi;
typedef long double ld;
typedef pair<long double, long double> pld;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll i, j, k, l;

    ll D, T, S;
    cin >> D >> T >> S;
    if(S * T >= D) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3608
#include <iostream>

using namespace std;

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

    int a, b;
    cin >> a >> b;

    if (a * b % 2) {
        cout << "Odd" << endl;
    } else {
        cout << "Even" << endl;
    }
}

Measured memory_bytes: 256
fn main() {
  let mut mansions = &mut [0; 3 * 4 * 10];

  let stdin = std::io::stdin();
  let mut buf = String::new();
  stdin.read_line(&mut buf).unwrap();
  let n = buf.trim().parse::<usize>().unwrap();

  for _ in 0..n {
    buf.clear();
    stdin.read_line(&mut buf).unwrap();
    let mut iter = buf.trim()
      .split_whitespace()
      .map(|x| x.parse::<i32>().unwrap());
    let b = iter.next().unwrap();
    let f = iter.next().unwrap();
    let r = iter.next().unwrap();
    let v = iter.next().unwrap();

    let idx = (b - 1) * 30 + (f - 1) * 10 + (r - 1);
    mansions[idx as usize] += v;
  }

  let sep = "\n".to_owned() + &"#".repeat(20) + "\n";

  let out = mansions.chunks(30)
    .map(|b| b.chunks(10).map(|f| {
      " ".to_string() + &f.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(" ")
    }).collect::<Vec<_>>().join("\n"))
    .collect::<Vec<_>>()
    .join(&sep);

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


Measured memory_bytes: 5040
class in{struct myIterator{int it;const bool rev;explicit constexpr myIterator(int it_, bool rev=false):it(it_),rev(rev){}int operator*(){return it;}bool operator!=(myIterator& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const myIterator i,n;public:explicit constexpr in(int n):i(0),n(n){}explicit constexpr in(int i,int n):i(i,n<i),n(n){}const myIterator& begin(){return i;}const myIterator& end(){return n;}};

#include <bits/stdc++.h>
using namespace std;

using i64 = long long;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int c = 1000, f = -1;
    for(int i : in(s.size())) {
        if(s[i] == 'C')
          c = min(c, i);
        if(s[i] == 'F')
          f = max(f, i);
    }
    if(c != 1000 && f != -1 && c < f)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
void chmin(int &a, int b) {if(a > b) a = b;}
void chmax(int &a, int b) {if(a < b) a = b;}

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};


int main(){
    string s;
    cin >> s;
    int ans = inf;
    for(char c = 'a' ; c <= 'z' ; c++){
        int cnt = 0;
        string w = s;
        while(1){
            if(w.empty()) break;
            if(w == string(w.length(), c)){
                break;
            }
            string nw = "";
            for(int i = 0 ; i < w.size() - 1 ; i++){
                if(w[i] == c || w[i+1] == c){
                    nw += c;
                }else{
                    nw += w[i];
                }
            }
            cnt++;
            w = nw; 
        }
        ans = min(ans, cnt);
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Set(n,pos) (n|(1<<pos))
#define reset(n,pos) (n&~(1<<pos))
#define check(n,pos) (bool)(n&(1<<pos))
inline int val(int p)
{
	int c=0;
	for(int i=14;i>=0;i--)
	{
		c*=3;
		if(check(p,i+15))c+=(1+check(p,i));
	}
	return c;
}
inline int cnt(int p)
{
	int c=0;
	for(int i=0;i<15;i++)if(check(p,i))c++;
	return c;
}
int n;
vector<pair<int,bool> > v[16];
int dp[16][14348906];
int f(int pos,int mask)
{
	if(pos==n)return cnt(mask);
	int ret=dp[pos][val(mask)];
	if(ret!=-1)return ret;
	int a=0,b=0,ff=1;
	int temp=check(mask,pos+15);
	if(!check(mask,pos))
	{
		mask=Set(mask,pos+15);
		a=f(pos+1,mask);
		if(!temp)mask=reset(mask,pos+15);
	}
	if(check(mask,pos+15)&&!check(mask,pos))
	{
		ret=a;
		return a;
	}
	else
	{
		temp=check(mask,pos+15);
		mask=Set(mask,pos+15);
		mask=Set(mask,pos);
		for(int i=0;i<v[pos].size();i++)
		{
			int x=v[pos][i].first;
			if(v[pos][i].second)
			{
				if(check(mask,x+15)&&!check(mask,x))
				{
					ff=0;
					break;
				}
				mask=Set(mask,x);
				mask=Set(mask,x+15);
			}
			else
			{
				if(check(mask,x+15)&&check(mask,x))
				{
					ff=0;
					break;
				}
				mask=reset(mask,x);
				mask=Set(mask,x+15);
			}
		}
		if(!temp)
		{
			if(ff)b=f(pos+1,mask);
			ret=max(a,b);
			return ret;
		}
		else
		{
			if(ff)
			{
				b=f(pos+1,mask);
				ret=b;
				return ret;
			}
			ret=0;
			return ret;
		}
	}
}
int main(int argc, char const *argv[])
{
	memset(dp,-1,sizeof dp);
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		int a,x,y;
		scanf("%d",&a);
		for(int j=0;j<a;j++)
		{
			scanf("%d %d",&x,&y);
			v[i].emplace_back(x-1,(bool)y);
		}
	}
	printf("%d\n",f(0,0));
	return 0;
}


Measured memory_bytes: 897024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
int main() {
	int n;
	cin >> n;
	cout << "ABC" << n;
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);

		if (in.hasNext()) {
			int a = in.nextInt();
			int b = in.nextInt();

			int result = (int)((long) a % 2 * b % 2) % 2;
			if (result == 0) {
				System.out.println("Even");
			} else {
				System.out.println("Odd");
			}
		}
	}
}


Measured memory_bytes: 21588
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define INF 1e9
#define MAXN 100005
#define MAXM 100005
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>

int cnt=0;
string S;

void solve(){
    rep(i,3){
        if(S[i]=='A'){
            cnt++;
        }
    }
    if(cnt==3 || cnt==0){
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}

int main(){
    cin >> S;

    solve();
}


Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <math.h>
#include <vector>
//#include <string>
//typedef long long LL;
using namespace std;
 
int main(){
    int n;
    vector<int> l;
    int tmp_l;
    int ans=0;
    int idx;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> tmp_l;
        l.push_back(tmp_l);
    }
    sort(l.begin(),l.end());
    for(int i=n-1; i>=2; i--){
        for(int j=i-1; j>=1; j--){
            auto pos = upper_bound(l.begin(),l.begin()+j, l[i]-l[j]);
            auto pos_begin = l.begin();
            idx = distance(pos_begin,pos);
            ans += j-idx;
        }
    }
    cout << ans << endl;
}

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

#define rep_(v, f, l) for (int v = (f); v < (l); ++v)
#define rep(v, n) rep_(v, 0, n)
#define lep(v, n) rep_(v, 1, n + 1)

using namespace std;

typedef long long int lint;
typedef pair<int, int> pii;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }

int field[500][500];
int h, w;

int main()
{
    while (h = in(), w = in(), h || w){
        memset(field, 0, sizeof(field));
        rep(i, h){
            char line[512];
            scanf("%s", line);
            rep(j, w){
            	if (line[j] == '.') field[i][j] = (j == 0 ? 0 : field[i][j - 1]) + 1;
            }
        }
        int maxi = 0;
        rep(i, h){
        	for (int j = w - 1; j >= 0; j--){
        		int range = 512;
        		for (int k = 0; i + k < h && range > 0; ++k){
        			range = min(range, field[i + k][j]);
        			maxi = max(maxi, (k + 1) * range);
        		}
        	}
        }
        printf("%d\n", maxi);
    }
	return (0);
}

Measured memory_bytes: 2176
#include<iostream>
#include<cmath>
#include<cstring>

using namespace std;

int main()
{
	char c;
	cin>>c;
	if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')cout<<"vowel\n";
	else cout<<"consonant\n";
	return 0;
}

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

long long int GCD(long long int a, long long int b)
{
    if(a == 0){
        return b;
    }

    return  GCD(b % a,a);
}

int main()
{
    long long int n, k;
    cin >> n >> k;
    vector<long long int> a(n);
    for(long long int i = 0;i < n;i++){
        cin >> a[i];
    }

    sort(a.begin(),a.end());
    long long int gcd = a[0];
    for(long long int i = 1;i < n;i++){
        gcd = GCD(gcd,a[i]);
    }

    if(a[n - 1] >= k && k % gcd == 0){
        cout << "POSSIBLE";
    }
    else{
        cout << "IMPOSSIBLE";
    }
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
ll inv(ll a){
	return powmod(a, MOD-2);
}
ll f[1500001], invf[1500001];
void fac(int n){
    f[0]=1;
    for(ll i=1; i<=n; i++) f[i]=f[i-1]*i%MOD;
    invf[n]=inv(f[n]);
    for(ll i=n-1; i>=0; i--) invf[i]=invf[i+1]*(i+1)%MOD;
}
ll comb(int x, int y){
    if(x<y) return 0;
    return f[x]*invf[y]%MOD*invf[x-y]%MOD;
}
int main()
{
    int n, a, b, c; cin>>n>>a>>b>>c;
    fac(2*n);
    ll x=100*inv(a+b)%MOD;
    a=a*inv(100)%MOD*x%MOD;
    b=b*inv(100)%MOD*x%MOD;
    ll an=powmod(a, n), bn=powmod(b, n);
    ll ap=1, bp=1;
    ll ans=0;
    for(ll i=0; i<n; i++){
        ans+=(n+i)*comb(n-1+i, n-1)%MOD*(an*bp%MOD+bn*ap%MOD)%MOD;
        ans%=MOD;
        ap*=a;
        bp*=b;
        ap%=MOD;
        bp%=MOD;
    }
    cout<<ans*x%MOD<<endl;
    return 0;
}

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

using ll = long long int;
using P = pair<int, int>;
using P3 = pair<int,P>;
using PP = pair<P, P>;
constexpr int INF = 1<<29;
constexpr ll MOD = ll(1e9)+7;
constexpr int di[] = {0,1,0,-1};
constexpr int dj[] = {1,0,-1,0};

void chmin(int &a, int b){
    a = min(a, b);
}

string s;
int n;

int match(int x){
    int m = n/x;
    int l;
    for(l=0;l<x;l++){
        for(int j=0;j<m;j++){
            if(s[l] != s[x*j+l]){
                return l;
            }
        }
    }
    return x;
}

int solve(int x){
    int l = match(x);
    if(x-l >= 3) return INF;
    if(x==l) return 0;
    int mi = INF, ma = 0;
    for(int i=0;i<n/x;i++){
        int tmp = stoi(s.substr(x*i+l,x-l));
        mi = min(mi, tmp);
        ma = max(ma, tmp);
    }
    return ma-mi;
}

int main(){
    cin >> s;
    n = s.size();
    if(n == 2){
        cout << abs(s[0]-s[1]) << endl;
        return 0;
    }
    int ans = INF;
    for(int i=2;i*i<=n;i++){
        if(n%i == 0){
            chmin(ans, solve(i));
            if(n/i != i) chmin(ans, solve(n/i));
        }
    }
    vector<vector<int> > dp(n+2, vector<int>(101, INF));
    dp[0][99] = 0;
    for(int i=0;i<n;i++){
        int d = s[i]-'0', dd = (i<n-1 ? stoi(s.substr(i,2)) : INF);
        for(int j=0;j<100;j++){
            chmin(dp[i+1][min(j,d)], max(dp[i][j], d));
            chmin(dp[i+2][min(j,dd)], max(dp[i][j], dd));
        }
    }
    for(int i=1;i<100;i++){
        chmin(ans, dp[n][i]-i);
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 45980
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
template<typename T>
void print(T x) {
    cout << x << endl;
}
int main(void) {
    int a,b,c; cin >> a >> b >> c;
    if(b<a) swap(a,b);
    if(a<c && c<b) print("Yes");
    else print("No");
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
 
#define fi first
#define se second
#define endl '\n'
#define MOD(n,k) ( (n % k) + k ) % k
#define isOn(S, j) (S & (1 << j) )
#define setBit(S, j) (S | (1 << j ) )
#define LSB(S) (S & (-S))
 
ll n, M = 1e9+7, mov[] = {1, 0, -1, 0, 0, 1, 0, -1};
string s[2];
vector<vvi> dp(55, vvi(4, vi(4, -1)));

int pintar (int i, int a1, int a2) {
    if (i == n)
        return 1;

    if (dp[i][a1][a2] > -1)
        return dp[i][a1][a2];

    ll res = 0;
    
    //Siguiente vertical
    if (s[0][i] == s[1][i]) {
        for (int l = 0; l < 3; l++) {
            if (l != a1 && l != a2) {
                res = (res + pintar(i+1, l, l)) % M;
            }
        }
    }

    //Siguientes horizontales
    if (s[0][i] != s[1][i]) {
        for (int l = 0; l < 3; l++) {
            if (l != a1) {
                for (int k = 0; k < 3; k++) {
                    if (k != l && k != a2) {
                        res = (res +pintar(i+2, l, k)) % M;
                    }
                }
            }
        }
    }

    return dp[i][a1][a2] = res;
}

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

    cin >> n >> s[0] >> s[1];

    cout << pintar(0, 3, 3) << endl;

    return 0;
}  

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16

ll query(ll i){ // -1:v 0:f 1:m
  cout<<i<<endl;
  fflush(stdout);
  string res;
  cin>>res;
  if(res=="Vacant")return -1;
  if(res=="Female")return 0;
  if(res=="Male")return 1;
  return -1;
}

ll n;
ll l,r,sl,sr;

int main(){
	cin>>n;
  l=0,r=n-1;
  sl=query(0); sr=query(n-1);
  if(sl==-1||sr==-1){
    return 0;
  }
  while(1){
    ll m=(l+r)/2;
    ll sm=query(m);
    if(sm==-1)return 0;
    ll d1=m-l+1;
    if((d1%2==0&&sl==sm)||(d1%2==1&&sl!=sm)){
      r=m;
      sr=sm;
      continue;
    }
    ll d2=r-m+1;
    if((d2%2==0&&sm==sr)||(d2%2==1&&sm!=sr)){
      l=m;
      sl=sm;
      continue;
    }
    l=m;
    sl=sm;
  }
	return 0;
}


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

int main(){
  int n, k, q; cin >> n >> k >> q;
  vector<int> score(100000, 0);
  for (int i = 0; i < q; i++){
    int a; cin >> a; a--;
    score.at(a)++;
  }
  for (int i = 0; i < n; i++){
    if (k + score.at(i) - q > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    vector<int> ans;
    bool res = true;
    vector<int> B(N); rep(i, N) {cin >> B[i]; if(B[i] > i+1) res = false;}
    vector<int> A(N); rep(i, N) A[i] = B[i];
    if(!res) cout << -1 << endl;
    else{
        vector<bool> used(N, false);
        rep(i, N){
            for(int j = N-1; j >= 0; j--){
                if(!used[j] && B[j] == 1){
                    used[j] = true;
                    for(int k = N-1; k >= j; k--) B[k]--;
                    ans.push_back(A[j]);
                    break;
                }
            }
        }
        rep(i, N) cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
         
typedef long long ll;
using namespace std;
        
#define F first
#define S second
#define sqr(x) x*x
#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define repit(i, n) for(auto it = n.begin(); it != n.end(); ++it)
       
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){if(b==0)return a;else return gcd(b,a%b);}
int lcm(int a,int b){return abs(a*b)/gcd(a,b);}
     
int main(){ios_base::sync_with_stdio(0);cin.tie(0);
    double n;
    cin >> n;  
    cout << (n / 2) * (n + 1);

}

Measured memory_bytes: 256
package main

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

func solve() {
	n := getInt()
	as := getIntSlice(n)

	ans := make([]int, n)
	for i := n; i >= 1; i-- {
		s := 0
		for j := i * 2; j <= n; j += i {
			s += ans[j-1]
		}
		ans[i-1] = ((s % 2) ^ as[i-1])
	}

	fmt.Fprintln(wr, sum(ans...))
	for i, a := range ans {
		if a == 1 {
			fmt.Fprintln(wr, i+1)
		}
	}
}

func sum(ns ...int) int {
	var sum int
	for _, n := range ns {
		sum += n
	}
	return sum
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 5504
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <vector>

using namespace std;

int main() {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> l(N);
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  std::function<int(int, int, int, int)> dfs = [&](int n, int a, int b, int c) {
    if (n == N) {
      if (min({a, b, c}) == 0) return 1000000000;
      return abs(a - A) + abs(b - B) + abs(c - C) - 30;
    }
    int v1 = dfs(n + 1, a, b, c);
    int v2 = dfs(n + 1, a + l[n], b, c) + 10;
    int v3 = dfs(n + 1, a, b + l[n], c) + 10;
    int v4 = dfs(n + 1, a, b, c + l[n]) + 10;
    return min({v1, v2, v3, v4});
  };
  cout << dfs(0, 0, 0, 0) << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline

a,b,c,k=map(int,input().split())
ans=0
if a<=k:
    ans+=a
else:
    ans+=k

k-=a

if k<=0:
    print(ans)
    sys.exit()

if b<=k:
    k-=b
else:
    print(ans)
    sys.exit()

if c<=k:
    ans-=c
else:
    ans-=k
print(ans)
    

Measured memory_bytes: 9192
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<complex>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
#define N 100010
ll n,a[N];
int main(){
    cin>>n;
    lol(i,n)cin>>a[i];
    sort(a,a+n);
    if(n%2==0){
	ll p=a[n/2];
	ll sum=0;
	lol(i,n){
	    if(i==n/2-1)sum+=abs(a[i]-p);
	    else sum+=abs(a[i]-p)*2;
	}
	cout<<sum<<endl;
    }
    else{
	ll p=a[n/2];
	ll sum=0;
	lol(i,n){
	    sum+=abs(a[i]-p)*2;
	}
	sum-=min(abs(a[n/2+1]-p),abs(a[n/2-1]-p));
	cout<<sum<<endl;
    }
    return 0;
}


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

using namespace std;

int main(void)
{
    int x, y, n, m; cin >> n >> m;

    // Tail, Edge Number
    vector<pair<int, int>> adj[n + 1];

    for(int i = 1; i <= m; i++)
    {
        cin >> x >> y;
        adj[x].push_back(make_pair(y, i));
        adj[y].push_back(make_pair(x, i));
    }

    int ans = 0;

    for(int i = 1; i <= m; i++)
    {
        queue<int> q;
        int vis[n + 1] = {};

        q.push(1);
        vis[1] = 1;

        while(!q.empty())
        {
            int t = q.front(); q.pop();

            for(auto u : adj[t])
            {
                if(!vis[u.first] && u.second != i)
                {
                    q.push(u.first);
                    vis[u.first] = 1;
                }
            }
        }

        for(int j = 1; j <= n; j++)
        {
            if(!vis[j])
            {
                ans++;
                break;
            }
        }
    }

    cout << ans << endl;
}


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

int main(){
    string S;   cin>>S;
    int size=S.size();
    vector<int> ans(size+1,0);
    int count=1;
    int tmp=0;
    S=S+'a';
    for(int i=1;i<=size;i++){
        if(S[i-1]!=S[i]||i==size){
            if(S[i]=='L') {
                if (count % 2 == 0) {
                    ans[i-1]=ans[i-1]+count/2;
                    ans[i]=ans[i]+count/2;
                } else {
                    ans[i-1]=ans[i-1]+(count+1)/2;
                    ans[i]=ans[i]+(count-1)/2;
                }
            }
            else{   //S[i]=='R'
                if (count % 2 == 0) {
                    ans[tmp-1]=ans[tmp-1]+count/2;
                    ans[tmp]=ans[tmp]+count/2;
                } else {
                    ans[tmp-1]=ans[tmp-1]+(count-1)/2;
                    ans[tmp]=ans[tmp]+(count+1)/2;
                }
            }
            count=1;
            tmp=i;  //tmpに記号が変わる時のインデックス代入
        }
        else{   //S[i-1]==S[i]
            count++;
        }
    }
    for(int i=0;i<size;i++){
        cout<<ans[i]<<' ';
    }
    return 0;
}

Measured memory_bytes: 1020
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  string A, B;
  while(cin >>A >>B && A != "0"){
    int hit = 0, blow = 0;
    REP(i, A.length()){
      REP(j, B.length()){
        if(A[i] == B[j] && i == j) ++hit;
        if(A[i] == B[j] && i != j) ++blow;
      }
    }
    cout <<hit <<" " <<blow <<endl;
  }
  return 0;
}

Measured memory_bytes: 1184
//
//  main.cpp
//  DoublyLinkedList
//
//  Created by Shimaya Wataru on 2017/05/11.
//  Copyright ?? 2017??´ Wataru Shimaya. All rights reserved.
//

#include <iostream>
using namespace std;

template <class T> class Node{
    
public:
    T key;
    Node* prev  = nullptr;
    Node* next = nullptr;
    
    Node(T key, Node* prev, Node* next){
        this->key = key;
        this->prev = prev;
        this->next = next;
    }
};

template <class T> class WLL{
public:
    Node <T>*  dummy = nullptr;
    
    WLL(){
        dummy = new Node <T> (T(), nullptr, nullptr);
        this->dummy->next = dummy;
        this->dummy->prev = dummy;
    }
    
    void insertKey(T key){
        Node <T> * newnode = new Node <T> (key, dummy, dummy->next);
        dummy->next->prev = newnode;
        dummy->next = newnode;
    }
    
    void deleteKey(T key){
        Node <T> * n = dummy->next;
        while(n != dummy){
            if(n->key == key){
                n->prev->next = n->next;
                n->next->prev = n->prev;
                delete n;
                return;
            }
            n = n->next;
        }
    }
    
    void deleteFirst(){
        Node <T>* newTop = dummy->next->next;
        delete dummy->next;
        newTop->prev = dummy;
        dummy->next = newTop;
    }
    
    void deleteLast(){
        Node <T> * newlast = dummy->prev->prev;
        delete dummy->prev;
        newlast->next = dummy;
        dummy->prev = newlast;
    }
};

int main(int argc, const char * argv[]) {
    // insert code here...
    WLL <int> wll;
    
    int N;
    cin >> N;
    
    string com;
    int val;
    for(int i = 0; i < N; ++i){
        cin >> com;
        if(com == "insert"){
            cin >> val;
            wll.insertKey(val);
        }else if(com == "delete"){
            cin >> val;
            wll.deleteKey(val);
        }else if(com == "deleteFirst"){
            wll.deleteFirst();
        }else{
            wll.deleteLast();
        }
    }
    
    Node <int>* n = wll.dummy->next;
    while(n != wll.dummy->prev){
        cout << n->key << " ";
        n = n->next;
    }
    cout << n->key << endl;
    return 0;
}

Measured memory_bytes: 34256
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>

using namespace std;
using ll = long long;

int main(){
    int N,M;cin >> N >> M;
    priority_queue<int> que;
    for(int i = 0;i < N;i++){
        int b;cin >> b;
        que.push(b);
    }
    for(int i = 0;i < M;i++){
        int b = que.top();
        que.pop();
        que.push(b / 2);
    }
    ll sum = 0;
    while(!que.empty()){
        sum += que.top();
        que.pop();
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const ll MOD=998244353,INF=1ll<<60;
int dx[]={0,0,1,-1};
int dy[]={-1,1,0,0};
typedef pair<int,pint>P2;
typedef vector<vint>vvint;

int N,K;
int a[100010],b[100010];

signed main() {
    IOS();
    cin>>N>>K;
    rep(i,0,N){
        cin>>a[i]>>b[i];
    }
    
    int ans=0;
    rep(i,0,N)if((K|a[i])==K)ans+=b[i];
    rrep(i,0,33){
        int tmp=0,sum=0;
        if(K&(1ll<<i)){
            tmp=(K^(1ll<<i));
            rep(j,0,i)tmp|=(1ll<<j);
        }
        rep(j,0,N){
            if((tmp|a[j])==tmp){
                sum+=b[j];
            }
        }
        chmax(ans,sum);
    }
    cout<<ans<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<vector>


#define MOD 1000000007

using namespace std;
using ll=long long;
using vll=vector<ll>;
using vi=vector<int>;


int main(void)
{
	int h, w, k;

	while(scanf("%d%d%d", &h, &w, &k)==3)
	{
		vi p;

		for(int i=0;i<(1<<(w-1));i++)
		{
			int j;
			for(j=0;j<w-1;j++)
			{
				if(((i>>j)&3)==3) break;
			}
			if(j>=w-1) p.push_back(i);
		}

//for(int mp:p) printf("%d ",mp);printf("\n");

		vll c(w), n(w);

		n[0]=1;
		for(int i=0;i<h;i++)
		{
			c=n;
			n.assign(w, 0);
			for(int mp:p)
			{
				for(int j=0;j<w;j++)
				{
					if((mp>>j)&1)
					{
						n[j]=(n[j]+c[j+1])%MOD;
						n[j+1]=(n[j+1]+c[j])%MOD;
						j++;
					}
					else
					{
						n[j]=(n[j]+c[j])%MOD;
					}
				}
			}
		}
		printf("%lld\n", n[k-1]);
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef vector<ll> vi;
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
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; }

int main(){
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  if(a+b>c+d){
    print("Left");
  }
  else if(a+b==c+d){
    print("Balanced");
  }
  else{
    print("Right");
  }
}

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

int main(){
    int n;
    cin >> n;
    if(n == 105){
        cout << 1 << endl;
        return 0;
    } else if(n < 105){
        cout << 0 << endl;
        return 0;
    }
    int ans = 1;
    int hozon;
    for(int i = 106; i <= n; i++){
        hozon = 0;
        for(int j = 1; j <= i; j++){
            if(i % j == 0) hozon++;
        }
        if(hozon == 8 && i % 2 != 0) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

AB = []
for a in A:
  for b in B:
    AB.append(a + b)

AB.sort(reverse=True)
AB = AB[:min(3001, X * Y * Z + 1)]
ABC = []
for c in C:
  for ab in AB:
    ABC.append(ab + c)
ABC.sort(reverse=True)

for i in range(K):
  print(ABC[i])


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

int main() {
  int n, m, d;
  cin >> n >> m >> d;
  int space[n][m] = {};
  char input;
  int i, j, k;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> input;
      space[i][j] = (input == '#' ? 1 : 0);
    }
  }

  int res = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m - (d - 1); j++) {
      int temp = 0;
      for (k = 0; k < d; k++) {
        temp += space[i][j + k];
        if (k == d - 1) {
          res += (temp == 0 ? 1 : 0);
        }
      }
    }
  }

  for (i = 0; i < n - (d - 1); i++) {
    for (j = 0; j < m; j++) {
      int temp = 0;
      for (k = 0; k < d; k++) {
        temp += space[i + k][j];
        if (k == d - 1) {
          res += (temp == 0 ? 1 : 0);
        }
      }
    }
  }

  cout << res << endl;
  return 0;
}



Measured memory_bytes: 3104
import java.util.Scanner;
import java.util.Comparator;
import java.util.Arrays;
import java.util.ArrayList;



public class Main {

	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		if (M == 0) {
			if(N == 1) {
				System.out.println(1);
			}
			else {
				long [] ans = new long[N+1];
				ans[0] = 1;
				ans[1] = 1;

				for (int i = 2; i<N+1;i++) {
						ans[i]=(ans[i-1]+ans[i-2])%1000000007;
				}
				System.out.println(ans[N]);
			}
		}
		else {
			int [] a = new int[M];
			for (int i = 0; i< M; i++) {
				a[i] = sc.nextInt();
			}
			if(N == 1) {
				System.out.println(1);
			}
			else {
				long [] ans = new long[N+1];
				ans[0] = 1;
				int tmp = 0;
				if(a[tmp]==1) {
					ans[1] = 0;
					if(M-1 != 0) {
						tmp++;
					}
					
				}
				else {
					ans[1] = 1;
				}
				for (int i = 2; i<N+1;i++) {
					if(a[tmp]==i) {
						ans[i] = 0;
						if(tmp<M-1) {
							tmp++;
						}
					}
					else {
						ans[i]=(ans[i-1]+ans[i-2])%1000000007;
					}
				}
				System.out.println(ans[N]);
			}
		}
		
	}
}


Measured memory_bytes: 48596
import math
num = int(input())

def function(a):
    if a%2 == 0:
        return math.floor(a/2)
    else:
        return 3*a + 1

list = [num]
while True:
    if function(list[-1]) in list:
        print(len(list)+1)
        break
    else:
        list.append(function(list[-1]))


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

using namespace std;

int main() {
  int n, a, b;
  scanf("%d %d %d", &n, &a, &b);

  int mid = max(a, b) - min(a, b) - 1;
  if (mid % 2 == 0) {
    puts("Borys");
  } else {
    puts("Alice");
  }
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    cin>>a;
    string b=a;
    reverse(a.begin(),a.end());
    for(int i=0;i<a.size();++i)
        if(a[i]=='b') a[i]='d';
        else if(a[i]=='d') a[i]='b';
        else if(a[i]=='p') a[i]='q';
        else if(a[i]=='q') a[i]='p';
    puts(a==b?"Yes":"No");
}

Measured memory_bytes: 512
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const long long INF = 1e18+5;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	int n;
	while(cin >> n) {
		vector<LL> x(n),y(n);
		REP(i,n) cin >> x[i] >> y[i];
		
		REP(i,n) if(x[i] > y[i]) swap(x[i],y[i]);

		using P = pair<LL,LL>;
		vector<P> xy(n);
		
		LL mi = *min_element(ALL(x));
		LL ma = *max_element(ALL(y));
		
		bool f = false;
		bool f1 = false, f2 = false;
		REP(i,n){
			if(x[i] == mi and y[i] != ma) f1 = true;
			if(y[i] == ma and x[i] != mi) f2 = true;
		}
		f = (f1 and f2);
		DEBUG(f);
		REP(i,n) xy[i] = {x[i],y[i]};

		sort(ALL(x)); sort(ALL(y));
		LL ans = (x.back()-x[0])*(y.back()-y[0]);
		
		sort(ALL(xy));
		if(f){
			multiset<LL> s;
			REP(i,n){
				s.insert(xy[i].F);
			}
			REP(i,n){
				s.erase(s.find(xy[i].F));
				s.insert(xy[i].S);
				chmin(ans,(ma-mi)*-(*s.begin()-*(--s.end())));
			}
		}
		cout << ans << endl;


		// LL mir = xy[0].F;
		// LL mar = INF;
		// LL mib = INF;
		// REP(i,n){
		// 	if(xy[i].F ){

		// 	}
		// }
	}
	return 0;
}


Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=10000;


int main(){
    int N;
    cin >> N;
    int a[100000];
    memset(a,0,sizeof(a));
    for(int i=0;i<N;i++){
        int t;
        cin >> t;
        a[t-1]++;
    }
    int ans=0,count=0;;
    for(int i=0;i<100000;i++){
        if(a[i]>1){
            if(a[i]%2==0){
                count++;
            }
            ans+=(a[i]-1)/2*2;
        }
    }
    cout << N-(ans+(count+1)/2*2) << endl;
    return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <string>

using namespace std;

int main(void){
	string a, b, c;
	
	cin >> a >> b >> c;
	
	if(*(a.end() - 1) == b[0] && *(b.end() - 1) == c[0]){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
const int maxn=1e5+10;
int dp[maxn];
int n,h;
int A[maxn],B[maxn];
int main()
{
	memset(dp,0x3f,sizeof(dp));
	scanf("%d%d",&h,&n);
	dp[0]=0;
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",&A[i],&B[i]);
		for(int j=0;j<h;j++)
		{
			if(dp[j]==inf)continue;
			dp[j+A[i]]=min(dp[j+A[i]],dp[j]+B[i]);
		}
	}
	int ans=dp[h];
	for(int i=h+1;i<maxn;i++)ans=min(ans,dp[i]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
package main

import "fmt"

func main() {
	var A, B, C string
	fmt.Scan(&A, &B, &C)
	if A[len(A)-1] == B[0] && B[len(B)-1] == C[0] {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <unordered_set>

using namespace std;
using ll = long long;

int main() {
    int t=1;
    //cin >> t;
    while(t--) {
        int n;
        cin >> n;
        int cost[n], dp[n];
        for(int i=0; i<n; i++) {
            cin >> cost[i];
        }
        dp[0] = 0;
        for(int i=1; i<n; i++) {
            dp[i] = dp[i-1] + abs(cost[i] - cost[i-1]);
            if(i-2 >= 0) dp[i] = min(dp[i], dp[i-2] + abs(cost[i]-cost[i-2]));
        }
        cout << dp[n-1];

    }
    return 0;

}


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

int main() {
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    if (x-r >= 0 && x+r <= W && y-r >= 0 && y+r <= H) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
}


Measured memory_bytes: 3096
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int n, ni, di, i, j, k, l, r, t, b;
    int[][] f;

    for(;;){
      n = sc.nextInt();
      if(n == 0)break;
      f = new int[2 * n + 1][2 * n + 1];
      for(i = 0;i < 2 * n + 1;i++)for(j = 0;j < 2 * n + 1;j++)f[i][j] = -1;
      f[n][n] = 0; l = n; r = n; t = n; b = n;

      for(k = 0;k < n - 1;k++){
        ni = sc.nextInt(); di = sc.nextInt();
        for(i = 0;i < 2 * n + 1;i++)for(j = 0;j < 2 * n + 1;j++){
          if(f[i][j] == ni){
            if(di == 0)f[i][j - 1] = k + 1;
            else if(di == 1)f[i + 1][j] = k + 1;
            else if(di == 2)f[i][j + 1] = k + 1;
            else  f[i - 1][j] = k + 1;
            break;
          }
        }
      }

      for(i = 0;i < 2 * n + 1;i++){
        for(j = 0;j < 2 * n + 1;j++){
          if(f[i][j] >= 0){
            if(l > j)l = j;
            if(r < j)r = j;
            if(t < i)t = i;
            if(b > i)b = i;
          }
        }
      }

      out.println((r - l + 1) + " " + (t - b + 1));
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 51116
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)

signed main(){
    int N,M,X;
    int C[20];
    int A[20][20];

    cin>>N>>M>>X;

    for(int i=0;i<N;i++){
        cin>>C[i];
        for(int j=0;j<M;j++){
            cin>>A[i][j];
        }
    }

    int ans=LLONG_MAX;
    for(int i=0;i<(1<<N);i++){
        int sum=0;
        int rikai[20]={0};
        for(int j=0;j<N;j++){
            int n=(i>>(j))%2;
            if(n==1){
                sum+=C[j];
                for(int k=0;k<M;k++){
                    rikai[k]+=A[j][k];
                }
            }
        }
        bool f=true;

        //cout<<sum<<endl;
        for(int j=0;j<M;j++){
            //cout<<rikai[j]<<",";
            if(rikai[j]<X) f=false;
        }
        //cout<<endl;
        if(f){
            ans=min(ans,sum);
        }
    }
    if(ans==LLONG_MAX) cout<<"-1"<<endl;
    else cout<<ans<<endl;
}



Measured memory_bytes: 3164
n, m = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
K = (0, 2, 5, 5, 4, 5, 6, 3, 7, 6)

A.sort()
DP = [0] * (n+1)

for i in range(n):
    for a in A:
        if i + 1 - K[a] < 0:
            continue
        DP[i+1] = max(DP[i+1], DP[i + 1 - K[a]] * 10 + a)
    if DP[i+1] == 0:
        DP[i+1] = -1

print(DP[n])

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

limit = 1
while limit * limit < n:
    limit += 1

results = [0] * n

for x in range(1, limit + 1):
    for y in range(1, limit + 1):
        for z in range(1, limit + 1):
            val = x * x + y * y + z * z + x * y + y * z + x * z
            if val <= n:
                results[val - 1] += 1

for v in results:
    print(v)


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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef long long ll; typedef vector<int> VI; typedef pair<ll,int> pii;
const ll mod = 1e9+7;


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

	int r,g,b;
	cin >>r >>g >>b;
	ll su = r*100+g*10+b;
	if(su%4==0) puts("YES");
	else puts("NO");
	return 0;
}




Measured memory_bytes: 256
def resolve():
    n = int(input())
    s = list(input() for _ in range(n))
    m = int(input())
    t = list(input() for _ in range(m))

    ans = 0
    temp = 0
    for i in s:
        temp += s.count(i)
        temp -= t.count(i)
        ans = max(ans, temp)
        temp = 0

    print(ans if ans > 0 else 0)

resolve()

Measured memory_bytes: 38256
/*  -*- coding: utf-8 -*-
 *
 * b.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 10;

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);

  int cnt = 1, all = 1;
  for (int i = 0; i < n; i++) {
    int ai;
    scanf("%d", &ai);
    cnt *= (ai & 1) ? 1 : 2;
    all *= 3;
  }

  printf("%d\n", all - cnt);
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	boolean balance = true;
	ArrayList <Boolean>output = new ArrayList <Boolean>(0);
	String input = "";
	BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
	ArrayList <Integer> Flag= new ArrayList<Integer>(0);
	public static void main(String []args){
		Main run = new Main();
		run.Run();
	}
	public void Run(){
		while(true){
			try{
				input = read.readLine();
				char inputget[] = input.toCharArray();
				if(input.equals(".")){
					break;
				}
				balance = true;
				profile(inputget);
				output.add(balance);
				Flag.removeAll(Flag);
			}catch(Exception e){
				
			}
		}
		for(int z = 0;z < output.size() ;z++){
			if(output.get(z))System.out.println("yes");
			else System.out.println("no");
		}
	}

	public int profile(char inputget[]){
		for(int z = 0;z < inputget.length;z++){
			if(inputget[z] == '('){
				Flag.add(1);
			}if(inputget[z] == '['){
				Flag.add(2);
			}if(inputget[z] == ')'){
				if(Flag.contains(1) && Flag.lastIndexOf(2) < Flag.lastIndexOf(1)){
					Flag.remove(Flag.lastIndexOf(1));
				}else{
					balance = false;
					return 0;
				}
			}if(inputget[z] == ']'){
				if(Flag.contains(2) && Flag.lastIndexOf(1) < Flag.lastIndexOf(2)){
					Flag.remove(Flag.lastIndexOf(2));
				}else{
					balance = false;
					return 0;
				}
			}
		}
		if(Flag.size() != 0)balance = false;
		return 0;
	}
}

Measured memory_bytes: 27784