akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C, long long D){

    long long curr_A = A;
    long long curr_C = C;

    while( true ){

        curr_C -= B;
        if(curr_C <= 0){
            cout << YES << endl;
            break;
        }

        curr_A -= D;
        if(curr_A <= 0){
            cout << NO << endl;
            break;
        }
    }

    return;

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long D;
    scanf("%lld",&D);
    solve(A, B, C, D);
    return 0;
}


Measured memory_bytes: 3688
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define FI first
#define SE second
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
using namespace std;
//
int main(){
  long long A[7];
  FOR(i,0,7){
    cin>>A[i];
  }
  long long i=0,K=0;
  if(A[0]%2){
    i++;
  }
  if(A[3]%2){
    i++;
  }
  if(A[4]%2){
    i++;
  }
  if(i>=2&&A[0]&&A[3]&&A[4]){
    K=3;
    A[0]--;
    A[3]--;
    A[4]--;
  }
  K+=A[0]/2*2;
  K+=A[3]/2*2;
  K+=A[4]/2*2;
  cout<<K+A[1]<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
    int a, b, c, x;
    int s = 0;
    cin >> a >> b >> c >> x;
    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= c; k++) {
                if (i * 500 + j * 100 + k * 50 == x)
                    s++;
            }
        }
    }

    cout << s << endl;
    return 0;
}

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

using namespace std;

#define mod 1e9+7

int main()

{

    int a[5],ans=0;

    for(int i=0;i<5;i++)

    {

        cin>>a[i];

        if(a[i]==0)

        {

            ans=i+1;

        }

    }

    cout<<ans;

    return 0;

}

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

int main() {
	int a, b, c = 1, d = 1;
	cin >> a >> b;
	if (a == b) {
	    cout << a << endl;
	    return 0;
	}
	if (a >= b) {
	    a = a % b;
	}
	while (a > 10 && b > 10 && a % 10 == 0 && b % 10 == 0) {
	    a = a / 10;
	    b = b / 10;
	    d = d * 10;
	}
	for (int i = 1; i < a; i++) {
	    if (a % i == 0 && b % i == 0) {
	        if (i > c) c = i;
	    }
	}
	cout << c * d << endl;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
typedef vector<vector<ll> > Graph;
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; }
const ll INF = 1e18;

//入力
ll k;


int main(){
    cin >> k;
    ll amari = 0;
    ll now = 0;
    for(int i=1;i<=1e7;i++){
        now = now * 10 + 7;
        now %= k;
        if(now == 0){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 9e18;
constexpr int inf = 1e9;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

int main(){
  vector<vector<int>> G(3, vector<int> (3));
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      cin >> G[i][j];
    }
  }
  int N;
  cin >> N;
  for(int i=0; i<N; i++){
    int a;
    cin >> a;
    for(int j=0; j<3; j++){
      for(int k=0; k<3; k++){
        if(G[j][k] == a){
          G[j][k] = -1;
        }
      }
    }
  }
  for(int i=0; i<3; i++){
      if(G[i][0] == G[i][1] && G[i][1] == G[i][2]){
        cout << "Yes" << endl;
        return 0;
      }
      if(G[0][i] == G[1][i] && G[1][i] == G[2][i]){
        cout << "Yes" << endl;
        return 0;
      }
  }
  if(G[0][0] == G[1][1] && G[1][1] == G[2][2]){
    cout << "Yes" << endl;
    return 0;
  }
  if(G[2][0] == G[1][1] && G[1][1] == G[0][2]){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int k;
    cin>>k;
    int a[33]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout<<a[k-1]<<endl;
}


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

int main() {
	string S;
  	cin>>S;
	string ans="Yes";
   	
  	for(int i=0;i<=(S.size()-1)/2-1;i++){
      	if(S[i]!=S[(S.size()-1)/2-1-i]) ans="No";
    }
  	for(int i=(S.size()-1)/2;i<S.size();i++){
     	if(S[i]!=S[S.size()-1-i]) ans="No"; 
    }
  	for(int i=0;i<S.size();i++){
     	if(S[i]!=S[S.size()-1-i]) ans="No";
    }
  
  	cout<<ans<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=105;
struct node{
    int x,y;
    bool operator<(const node&o)const{
        return atan2(y,x)<atan2(o.y,o.x);
    }
}a[N<<1];
int n;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i].x,&a[i].y);
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++) a[i+n]=a[i];
    double ans=0;
    for(int i=1;i<=n;i++){
        ll x=0,y=0;
        for(int j=i;j<i+n;j++){
            x+=a[j].x;y+=a[j].y;
            ans=max(ans,sqrt(x*x+y*y));
        }
    }
    printf("%.15f\n",ans);
}


Measured memory_bytes: 256
#!/usr/bin/env python

l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

n = int(input()) - 1
print(l[n])


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

const int mxN = 55;
double a[mxN];

int main() {
	int n;
	cin >> n;
	for(int i = 1; i <= n; ++i)
		cin >> a[i];
	sort(a + 1, a + n + 1);
	double res = (a[1] + a[2]) / 2;
	for(int i = 3; i <= n; ++i)
		res = (res + a[i]) / 2;
	cout << setprecision(10) << fixed << res;
}


Measured memory_bytes: 3764
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
    public static void main(String[] args){
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        String firstPlaceStr = Integer.toString(n);
        int firstPlace = Character.getNumericValue(firstPlaceStr.charAt(firstPlaceStr.length() - 1));
        if( firstPlace == 3){
            System.out.println("bon");
        }else if(firstPlace == 0 || firstPlace == 1 || firstPlace == 6 || firstPlace == 8){
            System.out.println("pon");
        }else{
            System.out.println("hon");
        }

    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            }else{
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }else if(b == -1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
    }
}

Measured memory_bytes: 32472
#include <bits/stdc++.h>
using namespace std;
 
char str[100];
int main()
{
    scanf("%s", str);
    long long ans = 0;
    long long len = strlen(str) - 1;
    for(long long i = 0;i < (1 << len);++i)
    {
        long long t = 0;
        long long x = 0;
        for(long long j = 0;j <= len;++j)
        {
            if(1 << j & i)
            {
                x = x * 10 + str[j] - '0';
                t += x;
                x = 0;
            }
            else
                x = x * 10 + str[j] - '0';
        }
        t += x;
        ans += t;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 768
import scala.io.StdIn.readLine

object Main extends App {
  val MOD = 1000000007

  val Array(n, m) = readLine.split(" ").map(_.toLong)

  val ans = (if(math.abs(n - m) > 1L) 0
    else {
    val d = 1L.to(n).foldLeft(1L){case (s, i) => s * i % MOD} * 1L.to(m).foldLeft(1L){case (s, i) => s * i % MOD}
    if(n == m) d * 2
    else d
  }) % MOD

  println(ans)

}

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

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 ***/

int main(){
    double pai=3.141592653589;
    int n,memo=1000000001,r[200000],ans=-1000000001;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&r[i]);
    }
    for(int i=0;i<n-1;i++){
        if(memo<r[i]){
            continue;
        }else{
            memo=r[i];
        }
        for(int j=i+1;j<n;j++){
            if(r[j]-r[i]>ans){
                ans=r[j]-r[i];
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1952
def m(L,R):
 global c
 i=j=0
 for _ in L[:-1]+R[:-1]:
  if L[i]<R[j]:yield L[i];i+=1
  else:yield R[j];j+=1
  c+=1
def d(A):
 s=len(A)//2
 if len(A)>1:A[:]=m(d(A[:s])+[1e9],d(A[s:])+[1e9])
 return A
c=0
input()
print(*d(list(map(int,input().split()))))
print(c)


Measured memory_bytes: 61884
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

#define N 4000000
#define NIL -1

//array
int key[N];
int parent[N];
int leftc[N];
int rightc[N];

//root
int root=NIL;

//function insert
void insert(int z){
  int x,y;
  
  y=NIL;
  x=root;

  while(x!=NIL){
    y=x;
    if(key[z]<key[x]) x=leftc[x];
    else x=rightc[x];
  }  
  
  parent[z]=y;

  if(y==NIL) root=z;
    
  else if(key[z]<key[y]) leftc[y]=z;
 
  else rightc[y]=z;
  
  
}

//print
void inorderprint(int now){
  if(now!=NIL){
    inorderprint(leftc[now]);
    printf(" %d",key[now]);
    inorderprint(rightc[now]);
  }
}

void preorderprint(int now){
  if(now!=NIL){
    printf(" %d",key[now]);
    preorderprint(leftc[now]);
    preorderprint(rightc[now]);
  }
}



int main(){

  int n,i,j,data;
  int z=0;
  char str[10];
  //initialize array
  for(i=0;i<N;i++){
    parent[i]=NIL;
    key[i]=NIL;
    rightc[i]=NIL;
    leftc[i]=NIL;
  }
  //load numbaer
  scanf("%d",&n);

  //load command
  for(i=0;i<n;i++){
    scanf("%s",str);
    if(strcmp(str,"insert")==0) {
      scanf("%d",&data);
      key[z]=data;
      insert(z);
      z++;
    }
    else if(strcmp(str,"print")==0){
      inorderprint(root);
      cout <<endl;
      preorderprint(root);
      cout <<endl;
    }
  }

  return 0;
}

Measured memory_bytes: 61000
#include <iostream>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <unordered_set>
#include <deque>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1ll << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


ll mod = 998244353;
//セグ木
ll dat[510000], sz;

void init(ll n) {
	sz = 1;
	while (sz < n)sz *= 2;
}

void update(ll k, ll a) { //場所(0-indexed), 値
	k += sz - 1;
	dat[k] = a;
	while (k > 0) {
		k = (k - 1) / 2;
		dat[k] = (dat[k * 2 + 1] + dat[k * 2 + 2]) % mod; //更新
	}
}

ll query(ll a, ll b, ll k = 0, ll l = 0, ll r = sz) { //[a, b) 呼ぶとき (a, b, 0, 0, sz)
	if (r <= a or b <= l)return 0;
	if (a <= l and r <= b)return dat[k];
	ll v1 = query(a, b, k * 2 + 1, l, (l + r) / 2);
	ll v2 = query(a, b, k * 2 + 2, (l + r) / 2, r);
	return (v1 + v2) % mod; //戻り値
}

ll dat2[1510000], sz2;

void init2(ll n) {
	sz2 = 1;
	while (sz2 < n)sz2 *= 2;
}

void update2(ll k, ll a) { //場所(0-indexed), 値
	k += sz2 - 1;
	dat2[k] = a;
	while (k > 0) {
		k = (k - 1) / 2;
		dat2[k] = dat2[k * 2 + 1] + dat2[k * 2 + 2]; //更新
	}
}

ll query2(ll a, ll b, ll k = 0, ll l = 0, ll r = sz) { //[a, b) 呼ぶとき (a, b, 0, 0, sz)
	if (r <= a or b <= l)return 0;
	if (a <= l and r <= b)return dat2[k];
	ll v1 = query2(a, b, k * 2 + 1, l, (l + r) / 2);
	ll v2 = query2(a, b, k * 2 + 2, (l + r) / 2, r);
	return v1 + v2; //戻り値
}

ll n, now;

bool solve(ll index) { //条件判定
	if (query2(index, n + 1) == 0) return true; //ここに条件を入れる
	else return false;
}


ll nibutan() { //めぐる式

	ll ng = -1; //最大値ならs.size()
	ll ok = n + 1; // 最大値なら0

	while (abs(ok - ng) > 1) {
		ll mid = (ok + ng) / 2;

		if (solve(mid)) ok = mid;
		else ng = mid;
	}
	return ok; //満たさない最大ならng
}

bool used[1510000];
vector<P> s;
priority_queue<P, vector<P>, greater<P>> q;
int main() {
	cin >> n;
	init(n + 1);
	init2(n + 1);
	update(0, 1);
	now = 1;
	REP(i, n) {
		ll a, b;
		cin >> a >> b;
		s.push_back(P(a, b));
	}
	s.push_back(P(INF, 0));
	sort(ALL(s));
	REP(i, n) {
		while (!q.empty() and q.top().first <= s[i].first) {
			update2(q.top().second, 0);
			q.pop();
		}
		ll t = nibutan();
		ll ans = query(t - 1, n + 1);
		//cout << i << " " << t << "  " << ans << endl;
		update(i + 1, ans);
		q.push(P(s[i].first + s[i].second, i + 1));
		update2(i + 1, 1);
	}

	cout << query(0, n + 1) << endl;
}



Measured memory_bytes: 15852
N, M, Q = [int(_) for _ in input().split()]
T = [[int(_) for _ in input().split()] for i in range(M)]
Q = [[int(_) for _ in input().split()] for i in range(Q)]

train_map = [[0] * (N + 1) for i in range(N + 1)]
for l, r in T:
    train_map[l][r] += 1

cumsum = [[0] * (N + 1) for i in range(N + 1)]
for i in range(1, N + 1):
    for j in range(1, N + 1):
        cumsum[i][j] = train_map[i][j] + cumsum[i][j - 1] + cumsum[i - 1][j] - cumsum[i - 1][j - 1]


for p, q in Q:
    print(cumsum[q][q] - cumsum[p-1][q])


Measured memory_bytes: 60456
while True:
    try:
        s1 = input()
    except EOFError:
        break
    s2 = input()
    BASE = 27
    MOD = 1000000007


    def rolling_hash(s):
        h_lst = [0]
        for c in s:
            h_lst.append((h_lst[-1] * BASE + ord(c)) % MOD)
        return h_lst


    h_lst1 = rolling_hash(s1)
    h_lst2 = rolling_hash(s2)
    length1 = len(s1)
    length2 = len(s2)

    pow_mem = [pow(BASE, i, MOD) for i in range(min(length1, length2) + 1)]


    def check(center):
        hash_set = {(h_lst1[i + center] - h_lst1[i] * pow_mem[center]) % MOD for i in range(length1 - center + 1)}
        for i in range(length2 - center + 1):
            h2 = (h_lst2[i + center] - h_lst2[i] * pow_mem[center]) % MOD
            if h2 in hash_set:return True
        return False


    left = 0
    right = min(length1, length2)
    while right > left + 1:
        center = (left + right) // 2
        if check(center):
            left = center
        else:
            right = center
    print(right if check(right) else left)



Measured memory_bytes: 6360
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using dd = double;
using vdd = std::vector<dd>;
using vvdd = std::vector<vdd>;
using vvvdd = std::vector<vvdd>;

constexpr ll INF = 1LL << 60;
constexpr dd EPS = 1e-11;

typedef std::numeric_limits< double > dbl;

//cin,cout高速化のおまじない＋桁数指定
struct Fast{
	Fast(){
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(std::numeric_limits<double>::max_digits10);
	}
} fast;

#define REPS(i, S, E) for (ll i = (S); i <= (E); i++)
#define REP(i, N) REPS(i, 0, N-1)
#define DEPS(i, E, S) for (ll i = (E); i >= (S); i--)
#define DEP(i, N) DEPS(i, N-1, 0)
#define EACH(e, v) for (auto&& e : v)

template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; }return false; }
template<class T> inline T MaxE(vector<T> &v, ll S, ll E){ T m=v[S]; REPS(i, S, E)chmax(m, v[i]); return m; }//v[S]～v[E]の最大値
template<class T> inline T MinE(vector<T> &v, ll S, ll E){ T m=v[S]; REPS(i, S, E)chmin(m, v[i]); return m; }//v[S]～v[E]の最小値
template<class T> inline T MaxE(vector<T> &v, ll N) { return MaxE(v, 0, N - 1); } //先頭N個中の最大値
template<class T> inline T MinE(vector<T> &v, ll N) { return MinE(v, 0, N - 1); }
template<class T> inline T MaxE(vector<T> &v) { return MaxE(v, (ll)v.size()); }
template<class T> inline T MinE(vector<T> &v) { return MinE(v, (ll)v.size()); }
template<class T> inline ll MaxI(vector<T> &v, ll S, ll E){ ll m=S; REPS(i, S, E){ if (v[i]>v[m])m=i; }return m; }
template<class T> inline ll MinI(vector<T> &v, ll S, ll E){ ll m=S; REPS(i, S, E){ if (v[i]<v[m])m=i; }return m; }
template<class T> inline ll MaxI(vector<T> &v, ll N) { return MaxI(v, 0, N - 1); }
template<class T> inline ll MinI(vector<T> &v, ll N) { return MinI(v, 0, N - 1); }
template<class T> inline ll MaxI(vector<T> &v) { return MaxI(v, (ll)v.size()); }
template<class T> inline ll MinI(vector<T> &v) { return MinI(v, (ll)v.size()); }
template<class T> inline T Sum(vector<T> &v, ll S, ll E){ T s=v[S]; REPS(i, S+1, E)s+=v[i]; return s; }
template<class T> inline T Sum(vector<T> &v, ll N) { return Sum(v, 0, N - 1); }
template<class T> inline T Sum(vector<T> &v) { return Sum(v, v.size()); }

inline ll in() { ll x; cin >> x; return x; }
inline double inD() { double x; cin >> x; return x; }
inline string inS() { string x; cin >> x; return std::move(x); }
template<class T=ll> inline vector<T> in_v(ll N){ vector<T> v(N); REP(i, N)cin>>v[i]; return move(v); }
inline void To0origin(vll &v) { EACH(e, v) e--; }

ll N;
vll d;

int main()
{
	cin >> N;
	d = in_v(N);
	if (N%2 == 1) {
		cout << 0 << '\n';
		return 0;
	}

	std::sort(d.begin(), d.end());
	cout << d[N/2] - d[N/2-1] << '\n';
	return 0;
}

Measured memory_bytes: 1024
# pragma GCC optimize("Ofast")
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size)
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
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(){
    

    string s; cin >> s;
    if(s[0] != 'A'|| s[1]-'0'>74 || s[1]-'0'<49){
        cout << "WA" <<endl;
        return 0;
    }
    int Big_count = 0;
    for(int i = 2;i<s.length()-1;i++){
        if(s[i]-'0'>48 && s[i]-'0'<75) continue;
        else if(s[i]-'0'==19) Big_count++;
        else {
            cout << "WA" << endl;
            return 0;
        }
    }
    if(s[s.length()-1]-'0'<48 || s[s.length()-1]-'0'>75){
        cout << "WA" << endl;
        return 0;
    }
    if(Big_count != 1){
        cout << "WA" << endl;
        return 0;
    }
    cout << "AC" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>  // ver2.1.8
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define Pii pair<int,int>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int, vector<int>, greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vout(a) rep(Z,0,a.size()-1)cout<<a[Z]+1<<' ';cout<<a.back()+1<<endl
#define VVout(a) rep(lW,0,a.size()){Vout(a[lW]);}
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;
 
int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
 
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}

vector<pair<int,int>> fac(int n) {  //  素因数分解
vector<Pii>r;for(int i=2;i*i<=n;++i){if(n%i)continue;r.emplace_back(i,0);while(n%i==0){
n/=i;r.back().second++;}}if(n!=1)r.emplace_back(n,1);return r;}

int comb(int n, int r){  //  nCr (MOD環境下)
int a=1;for(int i=n;i>n-r;--i){a=a*i%MOD;}for(int i=1;
i<r+1;++i){a=a*mypow(i,MOD-2,MOD)%MOD;}return a%MOD;}
 
signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int h,w,qw;
  cin >> h >> w;
  vector<Vi> a(h,Vi(w));
  
  rep(i,0,h){
    rep(j,0,w){
      cin >> a[i][j];
      a[i][j] %= 2;
    }
  }
  
  int ev=0;
  vector<Vi> ans(0,Vi(0));
  
  rep(i,0,h){
    rep(j,0,w-1){
      if(a[i][j]==1) {
        a[i][j+1] = (a[i][j+1]+1)%2;
        ans.pb({i,j,i,j+1});
      }
    }
  }
  
  repeq(i,w-1,w-1){
    rep(j,0,h-1){
      if(a[j][i]==1) {
        a[j+1][i] = (a[j+1][i]+1)%2;
        ans.pb({j,i,j+1,i});
      }
    }
  }
  cout << ans.size() << endl;
  VVout(ans);
  return 0;
}

Measured memory_bytes: 12976
using System;
using System.Linq;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC138.ResistorsInParallel();
        }
    }

    class ABC138
    {
        public static void ResistorsInParallel()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Input.getIntArray();

            double result = 1/a.Select(x=>(double)1/x).Sum();
            Console.WriteLine(result);
            
        }
    }
 

    class Input
    {
        public static int getInt()
        {
            int i = int.Parse(Console.ReadLine());
            return i;
        }

        public static string getString()
        {
            string s = Console.ReadLine();
            return s;
        }
        public static int[] getIntArray()
        {
            string[] s = Console.ReadLine().Split(' ');
            int[] num = s.Select(x=>int.Parse(x)).ToArray();
            return num;
        }
        public static long[] getLongArray()
        {
            string[] s = Console.ReadLine().Split(' ');
            long[] num = s.Select(x=>long.Parse(x)).ToArray();
            return num;
        }
        public static string[] getStringArray(int n)
        {
            var s = new string[n];
            for(int i=0; i<n; i++)
            {
                s[i] = Console.ReadLine();
            }
            return s;
        }
    }
}


Measured memory_bytes: 11348
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (n, m) = Slice2<long>();
            WriteLine((n - 1) * (m - 1));
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 27384
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;



int main(){
    ll x,y;cin>>x>>y;
    ll res;
    if(x<y){
        if(x<0 && y>0)res = 1+abs(abs(x)-abs(y));
        else res = y-x;
    }
    else if(y<x){
        if(y<=0 && x>=0)res = 1+abs(abs(x)-abs(y));
        else res = 2+abs(abs(x)-abs(y));
    }
    cout<<res;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String[] tokens = in.nextLine().split(" ");
		int value = Integer.parseInt(tokens[1]) * 10 + Integer.parseInt(tokens[2]);
		if (value % 4 == 0) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		in.close();
	}
}

Measured memory_bytes: 21844
import collections
while 1:
    cnt1=collections.Counter()
    cnt2=collections.Counter()
    n,m=map(int, input().split())
    if n+m==0:
        break
    ll=[0]*1500
    for i in range(n):
        x=int(input())
        for j in range(i+1):
            ll[j]+=x
            cnt1[ll[j]]+=1
    ll=[0]*1500
    for i in range(m):
        x=int(input())
        for j in range(i+1):
           ll[j]+=x
           cnt2[ll[j]]+=1
    sets=set(cnt1.keys()&(cnt2.keys()))
    ans=0
    for s in sets:
        ans+=cnt1[s]*cnt2[s]
    print(ans)

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

int main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	unsigned int n;
	cin>>n;
	string s;
	int ac,re,tle,wa;
	ac=re=tle=wa=0;
	for(int i=0;i<n;++i)
	{
		cin>>s;
		if(s=="AC")
			ac++;
		if(s=="RE")
			re++;
		if(s=="TLE")
			tle++;
		if(s=="WA")
			wa++;
	}
	cout<<"AC x "<<ac<<"\n";
	cout<<"WA x "<<wa<<"\n";
	cout<<"TLE x "<<tle<<"\n";
	cout<<"RE x "<<re<<"\n";
}

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

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7





class UnionFind {
public:
	vector<int>rank, parent;
	//初期化
	UnionFind(int size) {
		rank.resize(size, 0);
		parent.resize(size, 0);
		REP(i, size)parent[i] = i;
	}
	//木の根を求める
	int find(int x) {
		if (parent[x] == x)return x;
		else return parent[x] = find(parent[x]);
	}
	//xとyの属する集合を併合
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return;
		if (rank[x] < rank[y])
			parent[x] = y;
		else {
			parent[y] = x;
			if (rank[x] == rank[y])rank[x]++;
		}
	}
	//xとyが同じ集合に属するか否か
	bool same(int x, int y) {
		return (find(x) == find(y));
	}
};

int main()
{
	int N, M;
	cin >> N >> M;
	UnionFind uf(N);
	REP(i, M) {
		int x, y, z;
		cin >> x >> y >> z;
		x--; y--;
		uf.unite(x, y);
	}

	set<int> st;
	REP(i, N)st.insert(uf.find(i));
	cout << st.size() << endl;
	return 0;
}


Measured memory_bytes: 5760
# coding: utf-8

# In[23]:


#ｎは戸数
#ｋは発電機の個数
#ｘは家の座標

t = int(input()) 
for t in range(t):
    N,K = map(int, input().strip().split(" "))
    X = list(map(int,input().strip().split(" ")))
    L = [X[i+1] - X[i] for i in range(0,N-1)]
    L.sort()
    s = 0
    for i in range(0,N-K):
        s = s + L[i]
    print(s)
    
#Country Road
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2104&lang=jp
#右中央




Measured memory_bytes: 21768
#include<iostream>
#include<queue>
#include<algorithm>

using namespace std;

#define inf 1000000000

int n,m;
int C[101][101];
int T[101][101];

int main(){
	while(1){
		cin>>n>>m;
		if(n==0)break;
		for(int i=0;i<101;i++){
			for(int j=0;j<101;j++){
				C[i][j]=inf;
				T[i][j]=inf;
			}
		}
		for(int i=0;i<n;i++){
			int a,b,c,d;
			cin>>a>>b>>c>>d;
			C[a][b]=C[b][a]=c;
			T[a][b]=T[b][a]=d;
		}
		
		for(int k=1;k<=m;k++){
			for(int i=1;i<=m;i++){
				for(int j=1;j<=m;j++){
					C[i][j]=min(C[i][j],C[i][k]+C[k][j]);
					T[i][j]=min(T[i][j],T[i][k]+T[k][j]);
				}
			}
		}
		
		int l;
		cin>>l;
		for(int i=0;i<l;i++){
			int a,b,c;
			cin>>a>>b>>c;
			if(c==0){
			printf("%d\n",C[a][b]);
			}else{
			printf("%d\n",T[a][b]);
			}
		}
	}
}

Measured memory_bytes: 952
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;

typedef pair<ll, ll> P;
map<P, int> mp;
int dy[] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
int dx[] = {0, 1, 0, -1, 0, 1, 1, -1, -1};
ll h, w, n;

bool check(ll A, ll B) {
    REP(k, 9) {
        ll AA = A + dy[k];
        ll BB = B + dx[k];
        if (min(AA, BB) <= 0 || AA > h || BB > w) return true;
    }
    return false;
}

int main(int argc, char const *argv[]) {
    cin >> h >> w >> n;
    REP(i,n) {
        ll a, b;
        cin >> a >> b;
        REP(j,9) {
            ll A = a+dy[j]; ll B = b+dx[j];
            P p = make_pair(A, B);
            if (check(A, B)) continue;
            mp[p]++;
        }
    }
    vector<ll> cnt(10, 0);
    for (auto &x: mp) cnt[x.second]++;
    ll sum = accumulate(cnt.begin(), cnt.end(), 0);
    cnt[0] = (h-2)*(w-2)-sum;
    REP(i,10) cout << cnt[i] << endl;
    return 0;
}

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

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
	}

	int cnt = 0;
	while (1) {
		int flag = 0;
		for (int i = 0; i < N; i++) {
			if (A.at(i) % 2 == 1) {
				flag = 1;
				break;
			} else {
				A.at(i) /= 2;
			}
		}
		if (flag == 1) {
			break;
		}
		cnt++;
	}

	cout << cnt << endl;
}

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

using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, a, b) for (int64_t i = (a); i < (b); ++i)
const int MOD = 1e9 + 7;
typedef long long ll;
// const long long INF = 1LL << 60;
const int INF = 1000000000;
using Graph = vector<vector<int>>;
// typedef pair<int, int> pair;

int main() {
  int n, m;
  cin >> n >> m;
  if (n == m)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  
  int dist = 0;
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    if (x < K - x) {
      dist += x * 2;
    }
    else {
      dist += (K - x) * 2;
    }
  }
  cout << dist << endl;
}

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

class Main{
		private static ArrayList<String> check_point(ArrayList<Double> a){
			ArrayList<String> b = new ArrayList<String>();
			for(int i=0;i<a.size()/8;i++){
				String ch = "YES";
				double x1,y1,x2,y2,x3,y3,xp,yp;
				x1 = a.get(i*8);
				y1 = a.get(i*8+1);
				x2 = a.get(i*8+2);
				y2 = a.get(i*8+3);
				x3 = a.get(i*8+4);
				y3 = a.get(i*8+5);
				xp = a.get(i*8+6);
				yp = a.get(i*8+7);
				if(((x3 * (y1-y2) + y3 * (x2 - x1) +x1 * y2 - x2 * y1) * (xp * (y1-y2) + yp * (x2 - x1) +x1 * y2 - x2 * y1)) < 0) ch = "NO";
				else if (((x3 * (y1-y2) + y3 * (x2 - x1) +x1 * y2 - x2 * y1) * (xp * (y1-y2) + yp * (x2 - x1) +x1 * y2 - x2 * y1)) < 0) ch = "NO";
				else if (((x1 * (y2-y3) + y1 * (x3 - x2) +x2 * y3 - x3 * y2) * (xp * (y2-y3) + yp * (x3 - x2) +x2 * y3 - x3 * y2)) < 0 )ch = "NO";
				else if (((x2 * (y3-y1) + y2 * (x1 - x3) +x3 * y1 - x1 * y3) * (xp * (y3-y1) + yp * (x1 - x3) +x3 * y1 - x1 * y3)) < 0) ch = "NO";
				b.add(ch);
			}
			return b;
		}
		
		public static void main(String args[]) throws IOException{
			ArrayList<Double> tri = new ArrayList<Double>();
			ArrayList<String> res = new ArrayList<String>();
			Scanner scan = new Scanner(System.in);
			
			while(scan.hasNext()){
				String str1 = scan.next();
				tri.add(Double.parseDouble(str1));
			}
			
			res = check_point(tri);
			for(int i=0;i<res.size();i++){
				System.out.println(res.get(i));
			}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

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

  vector<int> vec(1000 + 1, 0);
  vec[1] = 1;

  for (int i = 2; i <= x; i++)
  {
    int res = i * i;
    if (x >= res)
    {
      while (x >= res)
      {
        res *= i;
      }
      vec[i] = res / i;
    }
  }

  auto ret = max_element(vec.begin(), vec.end());
  cout << *ret << endl;
  // for (auto v : vec)
  // {
  //   cout << v << ",";
  // }
}

Measured memory_bytes: 256
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    ll a, b, k;
    cin >> a >> b >> k;
    ll tmp = 0;
    ll ans_a = max(a-k,tmp);
    ll ans_b = b;
    if(ans_a==0) {
        ans_b = max(tmp, b-k+a);
    }
    cout << ans_a << " " << ans_b << endl;
    return 0;
}

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

int main(){
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y ;
  
  int res = 0;
  long long ans = a * x + b * y;
  for (int i = 0; i < 100001 ;i++){
    res = i * c * 2 + a * max(0, x - i) + b * max(0, y - i);
    if( res < ans ) ans = res;
  }
  cout << ans << endl;
    
}
  

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] HW = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            string[] keep = new string[HW[0]];
            for(int i = 0; i < HW[0]; i++)
            {
                keep[i] = Console.ReadLine(); ;
            }
            for(int j = 0; j < HW[0]; j++)
            {
                Console.WriteLine(keep[j]);
                Console.WriteLine(keep[j]);
            }
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


//Console.WriteLine(ans);


Measured memory_bytes: 27924
import java.util.Arrays;
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      int i=1;
      int n = b-a;
      int hi=0;
      while(i<=n){
        hi = hi += i;
        i++;
      }
      System.out.println(hi-b);
  }
}


Measured memory_bytes: 21460
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>


int main() {
	int n, m; std::cin >> n >> m;
	std::vector<int> cards(n); for (auto& a : cards) std::cin >> a;
	std::sort(cards.begin(), cards.end());
	std::vector<std::pair<int, int>> operations(m); for (auto& p : operations) std::cin >> p.first >> p.second;
	std::sort(operations.begin(), operations.end(), [](const std::pair<int, int> a, const std::pair<int, int> b) {return a.second > b.second; });
	auto current = cards.begin();
	for (const auto op : operations) {
		auto last = std::upper_bound(current, cards.end(), op.second);
		for (auto count = 0; count < op.first && current != last; ++count) {
			*current++ = op.second;
		}
	}
	std::cout << std::accumulate(cards.begin(), cards.end(), 0LL) << '\n';
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int N = S.size();
  vector<int> count(26, 0); 
  for(int i = 0; i < N; i++) {
    int n = S[i] - 'a';
    count[n]++;
  }
  bool finished = false;
  for(int i = 0; i < 26; i++) {
    if(count[i] % 2 == 1) {
      finished = true;
      break;
    }
  }
  if(finished) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

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

int main(){
    int n;
    cin >> n;
    int taro = 0;
    int hanako = 0;
    for(int i = 0; i < n; i++){
        string taro_str, hanako_str;
        cin >> taro_str >> hanako_str;
        if(taro_str < hanako_str){
            hanako += 3;
        }else if(taro_str > hanako_str){
            taro += 3;
        }else{
            taro++;
            hanako++;
        }
    }
    
    cout << taro << " " << hanako << endl;
    return 0;
}


Measured memory_bytes: 3204
#include <iostream>
#include <string>
using namespace std;
int main() {
  string nums;
  cin>>nums;
  while ( cin>>nums ) {
    int s=0;
    for ( char c: nums ) {
      s+=c-'0';
    }
    int x=nums.size()+(s-1)/9;
    cout << ( x%2==0?"Fabre":"Audrey" ) << " wins." << endl;
  }
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
//#define int long long
typedef pair<int,int> ii;
typedef tuple<int,int,int> iii;
#define ll long long
#define iiMPQ priority_queue<ii,vector<ii>,greater<ii> >
#define MPQ priority_queue<int,vector<int>,greater<int> >
#define PQ priority_queue<int>
#define iiPQ priority_queue<ii>
#define US unordered_set<int>
#define UMS unordered_multiset<int>
#define UM unordered_map<int>
#define iiUS unordered_set<ii>
#define ST stack<int>
#define MS multiset<int>
#define scan1(n) cin>>n
#define scan2(a,b) cin>>a>>b
#define scan3(a,b,c) cin>>a>>b>>c
#define print(n) cout<<n
#define println(n) cout<<n<<"\n"
#define vi vector<int>
#define vii vector<ii>
#define viii vector<iii>
#define fi first
#define se second
#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,s,e) for(int i=s;i<e;++i)
#define REPS(i,s,e,st) for(int i=s;i<e;i+=st)
#define rep(i,n) for(int i=n-1;i>=0;--i)
#define repr(i,s,e) for(int i=s;i>=e;--i)
#define reps(i,s,e,st) for(int i=s;i>=e;i-=st)
#define SET(arr,k) memset(arr,k,sizeof arr)
#define speed ios::sync_with_stdio(0); cin.tie(0);
#define mp make_pair
#define pb push_back
#define Qu queue
#define Vt vector
#define Dq deque
#define prints(n) cout << n << " ";

void m1(){
  int n; cin >> n;
  int k, res = 0;
  REP(i,n){
    cin >> k;
    if(k%2 == 1 && i%2 == 0) ++res;
}
  print(res);
}
/* 
void m2(){
  int t; scan1(t);
  while(t--) m1();
}
*/
 
signed main(){
  speed;
  //freopen("in.txt","r",stdin);
  m1();
  //m2();
}


Measured memory_bytes: 3608
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

# define INF 0x3f3f3f3f

template <typename T>
struct Edge {
  int src, dst;
  T weight;
  Edge(int src, int dst, T weight) :
    src(src), dst(dst), weight(weight) { }
};
template <typename T>
bool operator < (const Edge<T> &e, const Edge<T> &f) {
  return e.weight != f.weight ? e.weight > f.weight :
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

template <typename T>
struct Graph {
  int V;    // 頂点数
  vector<Edge<T>> *adj;

  explicit Graph(int V) {
    this->V = V;
    adj = new vector<Edge<T>> [V];
  }
  void add_edge(int src, int dst, T weight) {
    assert(src >= 0 && src < V);
    assert(dst >= 0 && dst < V);
    adj[src].push_back(Edge<T>(src, dst, weight));
  }
  vector<T> shortest_path(int s);
  // vector<vector<T>> shortest_paths();
  // Graph<T> spanning_tree();
};

template <typename T>
vector<T> Graph<T>::shortest_path(int src) {
  priority_queue<Edge<T>> pq;
  vector<T> dist(V, INF);
  pq.push(Edge<T>(src, src, 0));
  dist[src] = 0;

  while (!pq.empty()) {
    int u = pq.top().dst;
    pq.pop();

    for (const auto& e : adj[u]) {
        int v = e.dst;
        T weight = e.weight;

        if (dist[v] > dist[u] + weight) {
          dist[v] = dist[u] + weight;
          pq.push(Edge<T>(src, e.dst, dist[v]));
        }
    }
  }
  return dist;
}

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

  ll N;
  cin >> N;

  Graph<int> g(N);

  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    g.add_edge(a - 1, b - 1, 1);
    g.add_edge(b - 1, a - 1, 1);
  }

  vector<int> dist1 = g.shortest_path(0);
  vector<int> dist2 = g.shortest_path(N - 1);

  int cnt1 = 0;
  int cnt2 = 0;
  for (int i = 0; i < N; i++) {
    if (dist1[i] <= dist2[i]) {
      cnt1++;
    } else {
      cnt2++;
    }
  }
  if (cnt1 > cnt2) {
    cout << "Fennec" << endl;
  } else {
    cout << "Snuke" << endl;
  }
  return 0;
}


Measured memory_bytes: 8104
#include<bits/stdc++.h>
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
using namespace std;

typedef long long ll;
ll INF = 1LL << 60;

int
main() 
{
  ll N, K; cin >> N >> K;
  
  if(K % 2 == 1){
    ll mul_num = N / K;
    cout << mul_num * mul_num * mul_num << endl;
    return 0;
  }

  ll ans = 0;
  ll mul_num = N / K;
  repe(i, 0, N){
    if(i % K == K / 2) ans++;
  }
  cout << mul_num * mul_num * mul_num + ans * ans * ans << endl;

}




Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);

    	String a=sc.next().substring(0,1);
    	String b=sc.next().substring(0,1);
    	String c=sc.next().substring(0,1);
    	
    	String result=a.toUpperCase()+b.toUpperCase()+c.toUpperCase();
    	
    	System.out.println(result);
    	
    }
}


Measured memory_bytes: 21844
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

# print(int(N*(N - 1)/2))
if N%2 == 0:
	print((ceil(N/2) - 1)*N + N//2)
else:
	print((ceil(N/2) - 1)*N)

Measured memory_bytes: 5148
package main

import (
	"fmt"
)

func dfs(in, x, a, b, c int, count *int) {
	if x > in {
		return
	}
	if a > 0 && b > 0 && c > 0 {
		*count++
	}
	dfs(in, x*10+3, 1, b, c, count)
	dfs(in, x*10+5, a, 1, c, count)
	dfs(in, x*10+7, a, b, 1, count)
}

func target(in int) int {
	var count int
	dfs(in, 0, 0, 0, 0, &count)
	return count
}

func main() {
	var in int
	fmt.Scan(&in)
	fmt.Println(target(in))
}


Measured memory_bytes: 512