akhauriyash/Code-Regression huggingface dataset:
//use itertools::Itertools;
use std::cmp;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        h: usize,
        w: usize,
        k: usize,
        board: [chars; h],
    }

    let h_p = 1 << h;
    let w_p = 1 << w;

    let mut ans = 0;

    for i in 0..h_p {
        for j in 0..w_p {
            let mut black = 0;
            for ii in 0..h {
                for jj in 0..w {
                    if i >> ii & 1 != 1 && j >> jj & 1 != 1 && board[ii][jj] == '#' {
                        black += 1;
                    }
                }
            }

            if black == k {
                ans += 1;
            }
        }
    }

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

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 2264
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
  # N本目の竹まで探索し終わったらreturnする
  if cur == N:
    # min(a, b, c)>0で、一本も選んでいない場合を棄却する
    return abs(a-A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c) #選ばない
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10 #長さAの竹の材料とする
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10 #長さBの竹の材料とする
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10 #長さCの竹の材料とする
  #minをそのときどき
  return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))

Measured memory_bytes: 3064
//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll
//take care of precedence rule of operators 
//do not forget to change the sizes of arrays and value of contants and other things after debugging  
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define ld long double
#define pi acos(-1.0)
 
#define SZ(x)  (ll)(x.size())
 
//comment the below if not required
 
/*
 
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second
*/
 
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{

    ll n,ans=0,i,k,j;

    cin>>n;

    ll a[n+1];

    rep(i,1,n+1)
        cin>>a[i];

    sort(a+1,a+1+n);

    for(i=1;i<=n;++i)
    {
        for(j=i+1;j<=n;++j)
        {
            for(k=j+1;k<=n;++k)
            {
                if(a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k])
                {
                    if((a[i]+a[j])>a[k])
                        ++ans;
                }   
            }

        }
    }

    cout<<ans<<"\n";




    return 0;
}

Measured memory_bytes: 3632
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


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


    int N; cin >> N;
    vl A(N+1, 0); REP(i, N) cin >> A[i];

    vl s(N+1, 0);

    ll ans = LINF;
    ll cnt = 0;
    // +-+-
    s[0] = A[0];
    FOR(i, 0, N) {
        if (i % 2 == 0 && s[i] <= 0) {
            cnt += abs(s[i]) + 1;
            s[i] = 1;
        }
        else if (i % 2 == 1 && s[i] >= 0) {
            cnt += abs(s[i]) + 1;
            s[i] = -1;
        }

        s[i + 1] = s[i] + A[i + 1];
    }
    ans = min(ans, cnt);

    cnt = 0;
    // -+-+
    s[0] = A[0];
    FOR(i, 0, N) {
        if (i % 2 == 0 && s[i] >= 0) {
            cnt += abs(s[i]) + 1;
            s[i] = -1;
        }
        else if (i % 2 == 1 && s[i] <= 0) {
            cnt += abs(s[i]) + 1;
            s[i] = 1;
        }

        s[i + 1] = s[i] + A[i + 1];
    }
    ans = min(ans, cnt);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
n = gets.chomp.to_i
a,b = gets.chomp.split().map(&:to_i)
points = gets.chomp.split().map(&:to_i)

a_list = []
b_list = []
c_list = []

points.each do |point|
  if point <= a
    a_list << point
  elsif point <= b
    b_list << point
  else
    c_list << point
  end
end

max_size = [a_list.size, b_list.size, c_list.size].max
count = 0

max_size.times do
  if a_list.size == 0 || b_list.size == 0 || c_list.size == 0
    break
  else
    a_list.pop
    b_list.pop
    c_list.pop
    count += 1
  end
end

puts count

Measured memory_bytes: 1788
# -*- coding: utf_8 -*-

def check(t, n, k, p):
    i = 0
    for j in range(k):
        s = 0
        while (s + t[i] <= p):
            s += t[i]
            i += 1
            if i == n:
                return n
    return i

if __name__ == "__main__":
    n, k = [int (x) for x in input().split()]
    t = []
    for i in range(n):
        t.append(int(input()))

    start, end = 0, 10000 * 100000

    while (end - start > 1):
        mid = (start + end) // 2
        v = check(t, n, k, mid)
        if v >= n:
            end = mid
        else:
            start = mid

    print(end)

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  string s;
  int ans;
  cin >> s >> ans;
  int n = s.length();
  int x,y;
  stack<int> st;
  int now=s[0]-'0';
  rep(i,(n-1)/2){
    if(s[2*i+1]=='+'){
      st.push(now);
      now=s[2*i+2]-'0';
    }else{
      now*=s[2*i+2]-'0';
    }
  }
  st.push(now);
  x=0;
  while(!st.empty()){
    x+=st.top();
    st.pop();
  }
  y=s[0]-'0';
  rep(i,(n-1)/2){
    if(s[2*i+1]=='+'){
      y+=s[2*i+2]-'0';
    }else{
      y*=s[2*i+2]-'0';
    }
  }
  if(ans==x){
    if(ans==y){
      cout << "U" << endl;
    }else{
      cout << "M" << endl;
    }
  }else{
    if(ans==y){
      cout << "L" << endl;
    }else{
      cout << "I" << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int n;
  cin >> n;
  vll t(n);
  rep(i,n) cin >> t[i];
  
  ll ans = 1;
  rep(i,n) {
    ans = lcm(ans, t[i]);
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
    int N, Q;
    std::cin >> N >> Q;

    std::string S;
    std::cin >> S;

    int have_ac[N];
    have_ac[0] = 0;
    for(int i = 1; S[i] != '\0'; i++){
        have_ac[i] = have_ac[i-1];
        if(S[i-1] == 'A' && S[i] == 'C')have_ac[i]++;
    }
    int ans[Q];
    for(int i = 1; i <= Q; i++){
        int l, r;
        std::cin >> l >> r;
        ans[i-1] = have_ac[r - 1] - have_ac[l - 1];
    }

    for(int i = 0; i < Q; i++)std::cout << ans[i] << std::endl;

    return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
    ll N;
    string s;
    map<char, ll> cnt;

    scanf("%lld", &N);
    cin >> s;

    for(char c: s)
        cnt[c]++;

    ll ans = (N * (N - 1) * (N - 2)) / 6;
    ll b = cnt['B'], r = cnt['R'], g = cnt['G'];

    for (int k = 1; k <= N / 2; k++) {
        for (int i = 0; i < N; i++) {
            if (i + 2 * k >= N)
                break;
            if (s[i] != s[i + k] && s[i] != s[i + 2 * k] && s[i + k] != s[i + 2 * k])
                ans--;
        }
    }

    ans -= (b * (b - 1) * (b - 2)) / 6;
    ans -= ((b * (b - 1)) / 2) * (r + g);

    ans -= (r * (r - 1) * (r - 2)) / 6;
    ans -= ((r * (r - 1)) / 2) * (b + g);

    ans -= (g * (g - 1) * (g - 2)) / 6;
    ans -= ((g * (g - 1)) / 2) * (b + r);

    printf("%lld\n", ans);

    return 0;
}

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

int main() {
  int n, i, j, p, q, H0, H;
  bool check = true, end = false;
  cin >> n;
  vector<int> x(n), y(n), h(n), c(2);
  for (i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> h[i];
  }

  for (p = 0; p <= 100; p++) {
    if (end == true) {
      break;
    }
    for (q = 0; q <= 100; q++) {
      check = true;
      for (i = 0; i < n; i++) {
        if (h[i] != 0) {
          H0 = abs(x[i] - p) + abs(y[i] - q) + h[i];
          break;
        }
      }
      for (i = 0; i < n; i++) {
        if (h[i] != max(H0 - abs(x[i] - p) - abs(y[i] - q), 0)) {
          check = false;
          break;
        }
      }
      if (check == true) {
        c[0] = p;
        c[1] = q;
        H = H0;
        end = true;
      }
    }
  }
  if (n == 1) {
    cout << x[0] << " " << y[0] << " " << h[0] << "\n";
  } else {
    cout << c[0] << " " << c[1] << " " << H << "\n";
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<class A,size_t N,class T>void Fill(A(&a)[N],const T&v){fill((T*)a,(T*)(a+N),v);}

const int MOD = 1e9+7; //998244353;

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m=MOD){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m=MOD){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int m=MOD){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%m;Rac[n-1]=modInv(Fac[n-1],m);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%m;}
//ll comb(int a,int b,int m=MOD){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int N = 2e5;
int k, ans;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> k;
  k++;
  FOR(a, 1, k)FOR(b, 1, k)FOR(c, 1, k) ans += __gcd(__gcd(a, b), c);
  cout << ans << endl;
}

Measured memory_bytes: 3624
#include <cmath>

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>

using namespace std;

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, (n))

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef long long ll;

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

vector<string> field;
int h, w;

void visit(int y, int x) {
	char c = field[y][x];
	field[y][x] = '.';
	if (y > 0 && field[y - 1][x] == c)
		visit(y - 1, x);
	if (x > 0 && field[y][x - 1] == c)
		visit(y, x - 1);
	if (y < h - 1 && field[y + 1][x] == c)
		visit(y + 1, x);
	if (x < w - 1 && field[y][x + 1] == c)
		visit(y, x + 1);
}

int main() {
	while (cin >> h >> w, (h | w)) {
		field.clear();
		REP(i, h) {
			string s;
			cin >> s;
			field.push_back(s);
		}
		int result = 0;
		REP(i, h) {
			REP(j, w) {
				if (field[i][j] != '.') {
					result++;
					visit(i, j);
				}
			}
		}
		cout << result << endl;
	}
}

Measured memory_bytes: 2312
#include <stdio.h>

int main(void)
{
  int a, b;

  scanf("%d %d", &a, &b);

  if(a == 1 && b != 1|| a > b && b != 1)
    {
      printf("Alice\n");
    }else if(b == 1 && a != 1|| a < b && a != 1){
    printf("Bob\n");
  }else{
    printf("Draw\n");
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int max = 0;

		for (int i = 0; i <= N; i++) {
			int count = 0;
			for (int j = 0; j < N; j++) {
				if (Math.pow(2, j) == i) {
					count = j;
				}
			}
			max = (max < count) ? count : max;
		}
		System.out.println((int)Math.pow(2, max));
	}

}

Measured memory_bytes: 21716
import sys
import heapq

n, m = map(int, sys.stdin.readline().split())

a = list(map(int, sys.stdin.readline().split()))

pq = []

for ele in a:
	heapq.heappush(pq, -ele)

while m and pq:
	ele = -(heapq.heappop(pq))
	ele = ele//2
	if ele:
		heapq.heappush(pq, -ele)
	m -= 1
print(-sum(pq))

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

int main(){
  string S,T;
  cin>>S;
  cin>>T;
  int a;
  a=S.size();
  int i;
  for(i=0;i<a;i++){
    if(S.at(i)!=T.at(i)){
    cout<<"No"<<endl;
    return 0;
    }
    else{
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <bitset>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S, T;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main(){
    cin>>S;
    N = S.size();
    ll g, p;
    g = p = 0;
    rep(i,N) (S[i] == 'g' ? ++g : ++p);
    cout<<N / 2 - p<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//BEGIN CUT HERE
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

template<typename T>
T largestrectangle(vector<T> &v){
  int n=v.size();
  T res=0;
  using P = pair<int, T>;
  stack<P> sp;
  sp.emplace(-1,T(0));
  for(int i=0;i<n;i++){
    int j=i;
    while(sp.top().second>v[i]){
      j=sp.top().first;
      chmax(res,(i-j)*sp.top().second);
      sp.pop();
    }
    if(sp.top().second<v[i]) sp.emplace(j,v[i]);
  }
  while(!sp.empty()){
    chmax(res,(n-sp.top().first)*sp.top().second);
    sp.pop();
  }
  return res;
}

//END CUT HERE
//INSERT ABOVE HERE
signed DPL_3_C(){
  Int n;
  cin>>n;
  vector<Int> v(n);
  for(Int i=0;i<n;i++) cin>>v[i];
  cout<<largestrectangle(v)<<endl;
  return 0;
}
/*
  verified on 2018/06/11
  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_3_C&lang=jp
*/

signed main(){
  DPL_3_C();
  return 0;
}



Measured memory_bytes: 5352
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ld PI=abs(acos(-1));
int a,b;

int main(){
	cin >> a >> b;
	
	cout << 2*b-a << endl;
	return 0;
}
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, m, k, num[26], tag, w, ano;
int main()
{
	scanf("%d%d", &n, &m);
	if (n & 1)
		tag += m / 2;
	if (m & 1)
		tag += n / 2;
	ano = n & m & 1;
	for (int i = 1; i <= n * m; i++)
	{
		char s = 0;
		while (!isalpha(s))
			s = getchar();
		num[s - 'a']++;
	}
	for (int i = 0; i < 26; i++)
	{
		w = num[i] & 3;
		if (w & 1 && ano)
		{
			w--;
			ano--;
		}
		if (w == 2)
		{
			if (tag)
				tag--;
			else
				return puts("No"), 0;
		}
		if (w & 1)
			return puts("No"), 0;
	}
	puts(tag & 1 ? "No" : "Yes");
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

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

using namespace std;

int n;
int a[100000];

int main(){
	scanf("%d", &n);
	rep(i, n){
		scanf("%d", &a[i]);
		--a[i];
	}
	int ans = 0;
	rep(i, n){
		if(a[a[i]] == i){
			++ans;
		}
	}
	printf("%d\n", ans / 2);
	return 0;
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }
template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

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

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int N; cin >> N;
	priority_queue<Pi> plus, minus;
	for (int i = 0; i < N; i++) {
		string S; cin >> S;
		int cnt = 0, minv = 0;
		for (int j = 0; j < (int)S.size(); j++) {
			if (S[j] == '(') {
				cnt++;
			} else {
				cnt--;
				chmin(minv, cnt);
			}
		}
		if (cnt < 0) {
			minus.emplace(minv-cnt, -cnt);
		} else {
			plus.emplace(minv, cnt);
		}
	}

	int cnt1 = 0;
	while (!plus.empty()) {
		auto data = plus.top(); plus.pop();
		if (cnt1 + data.first < 0) { cout << "No" << endl; return; }
		cnt1 += data.second;
	}

	int cnt2 = 0;
	while (!minus.empty()) {
		auto data = minus.top(); minus.pop();
		if (cnt2 + data.first < 0) { cout << "No" << endl; return; }
		cnt2 += data.second;
	}
	if (cnt1 == cnt2) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 11212
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

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

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}


int gcd(int a,int b){
  if(a%b)return gcd(b,a%b);
  else return b;
}
int main(){
  int n;cin>>n;
  int z = 111;
  while(z < n){
    z+=111;
  }
  cout << z << endl;
}


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

void solve(){
    ll n, x = 0;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) cin >> a[i];
    for(ll i = 0; i < n; i+=2) x = x^(a[i]^a[i+1]);
    for(ll i = 0; i < n; i++) cout << (x^a[i]) << " ";
}


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //int t;cin>>t;while(t--)
  solve();
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    long long int L[87] = {};
    L[0] = 2;
    L[1] = 1;
    for(int i = 0; i < 85; i++){
        L[i+2] = L[i+1] + L[i];
    }
    cout << L[n] << endl;
    return 0;
}

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

using namespace std;

long long dp[109][100009];

int main(){
  int N, W; cin >> N >> W;
  for(int i = 0; i < N; i++){
    long long w, v; cin >> w >> v;
    for(int j = 0; j <= W; j++){
      dp[i][j] = 0;
      if(i - 1 >= 0) dp[i][j] = dp[i - 1][j];
      if(j >= w){
        if(i - 1 >= 0) dp[i][j] = max(dp[i][j], v + dp[i - 1][j - w]);
        else dp[i][j] = v;
      }
    }
  }
  cout << dp[N - 1][W] << endl;
  return 0;
}


Measured memory_bytes: 80128
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <unordered_map>
using namespace std;

void solve() {
    int n;
    cin >> n;
    int count = 0;
    for(int i = 1; i <= n; i++){
        if((int)(log10(i)+1) % 2 != 0) count++;
    }
    cout << count << endl;
}

int main() {
    solve();
    return 0;
}

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

int main(){

    int n;
    cin>>n;
    vector<vector<int>> abc(n,vector<int>(3)),dp(n,vector<int>(3));
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            cin>>abc[i][j];
        }
    }

    for(int j=0;j<3;j++) dp[0][j]=abc[0][j];

    for(int i=0;i<n-1;i++){
        for(int j=0;j<3;j++){

            if(j==0) dp[i+1][j]=max(dp[i][1],dp[i][2])+abc[i+1][j];
            if(j==1) dp[i+1][j]=max(dp[i][0],dp[i][2])+abc[i+1][j];
            if(j==2) dp[i+1][j]=max(dp[i][0],dp[i][1])+abc[i+1][j];

        }
    }

    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]})<<endl;


    return 0;
}

Measured memory_bytes: 11136
mod = 10 ** 9 + 7
n = int(input())
prime = {}

# 素因数を求める
def prime_factorization(n):
    tmp = n
    for i in range(2, int(n**0.5)+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if i in prime:
                prime[i] += cnt
            else:
                prime[i] = cnt
    if tmp != 1:
        if tmp in prime:
            prime[tmp] += 1
        else:
            prime[tmp] = 1

for i in range(2, n+1):
    prime_factorization(i)

res = 1
for v in prime.values():
    res *= v + 1
    res %= mod

print(res)

Measured memory_bytes: 3064
//i
#include <stdio.h>

int main(){
	int x, a, b;
	scanf ("%d %d %d", &x, &a, &b);
	
	int selisihA = a-x;
	
	if (selisihA<0)
	{
		selisihA = selisihA*-1;
	}
	
	int selisihB = b-x;
	
	if (selisihB<0)
	{
		selisihB= selisihB*-1;
	}

	
	if (selisihA<selisihB)
	{
		printf ("A");
	}
	
	else if (selisihB<selisihA)
	{
		printf ("B");
	}
	
	
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <list>
#include <algorithm>

using namespace std;

int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);

	int N, M;
	bool s = true;
	vector<string> ID;
	string message[] = {
		"Opened by ",
		"Closed by ",
		"Unknown "
	};
	cin >> N;

	for(int i = 0; i < N; i++) {
		string tmp;
		cin >> tmp;
		ID.push_back( tmp );
	}
	cin >> M;
	for(int i = 0; i < M; i++) {
		string tmp;
		cin >> tmp;
		bool flg = false;
		for(int j = 0; j < N; j++) {
			if( tmp == ID.at(j) ) {
				flg = true;
				s = 1 - s;
				cout << message[s] << tmp << endl;
				break;
			}
		}
		if( flg == false ) {
			cout << message[2] << tmp << endl;
		}
	}

	//while(1){}
	return 0;
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }



void func(long long K, std::string S){
    if(S.size() <= K){
        cout<<S<<endl;
    }
    else{
        cout<<S.substr(0,K)<<"..."<<endl;
    }

}

int main(){
    // cout << fixed << setprecision(5);

    long long K;
    scanf("%lld",&K);
    std::string S;
    std::cin >> S;
    func(K, S);
    return 0;
}


Measured memory_bytes: 3696
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main{
	static FastScanner sc = new FastScanner();
	static PrintWriter out = new PrintWriter(System.out);
	
	public static void main(String[] args) {
		int N = sc.nextInt();
		
		out.println(N/3);
		out.flush();
	}
	
	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;
	    }

	    private void skipUnprintable() {
	      while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
	    }

	    public boolean hasNext() {
	      skipUnprintable();
	      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() {
	      return (int) nextLong();
	    }

	    public int[] nextIntArray(int N, boolean oneBased) {
	      if (oneBased) {
	        int[] array = new int[N + 1];
	        for (int i = 1; i <= N; i++) {
	          array[i] = sc.nextInt();
	        }
	        return array;
	      } else {
	        int[] array = new int[N];
	        for (int i = 0; i < N; i++) {
	          array[i] = sc.nextInt();
	        }
	        return array;
	      }
	    }

	    public long[] nextLongArray(int N, boolean oneBased) {
	      if (oneBased) {
	        long[] array = new long[N + 1];
	        for (int i = 1; i <= N; i++) {
	          array[i] = sc.nextLong();
	        }
	        return array;
	      } else {
	        long[] array = new long[N];
	        for (int i = 0; i < N; i++) {
	          array[i] = sc.nextLong();
	        }
	        return array;
	      }
	    }
	  }

	}	 		





Measured memory_bytes: 21588
N=int(input())
S=input()
data=[0 for i in range(0,N)]
for i in range(1,N):
    if S[i]!='W':
        data[0]+=1
for i in range(1,N):
    x=0
    y=0
    if S[i-1]!='E':
        x=1
    if S[i]!='W':
        y=1
    data[i]=data[i-1]+x-y
print(min(data))

Measured memory_bytes: 62300
#include <iostream>
#include <cmath>

using namespace std;

int A[100000];
int F[100000];

int main() {
    int n, k;
    cin >> n >> k;
    for (int i = 1; i < n + 1; ++i) {
        cin >> A[i];
    }
    F[1] = 0;
    F[2] = (int) abs(A[2] - A[1]);
    for (int i = 3; i < n + 1; ++i) {
        int m = (F[i - 1] + (int) abs(A[i] - A[i - 1]));
        for (int j = 2; j < k + 1; ++j) {
            if ((i - j) > 0) {
            m = min(m, F[i - j] + (int) abs(A[i] - A[i - j]));
            }
        }
        F[i] = m;
    }
    cout << F[n];
    return 0;
}

Measured memory_bytes: 1024
from math import sqrt
n, d = map(int, input().split())

vs = []
for i in range(n):
    v = list(map(int, input().split()))
    vs.append(v)


def ds(a, b):
    s = 0
    for i in range(d):
        s += (b[i] - a[i])**2
    return sqrt(s)


ans = 0
for i in range(n):
    for j in range(i+1, n):
        dist = ds(vs[i], vs[j])
        if dist == int(dist):
            ans += 1

print(ans)


Measured memory_bytes: 9188
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

string s;
int n, k, ans;

int gun(int a, int b)
{
	if (a < b) return 0;
	if (b < 0) return 0;
	int ret = 1, tmp = a;
	for (int i = 0; i < b; i++) {
		ret *= tmp;
		tmp--;
	}
	for (int i = b; i >= 1; i--) {
		ret /= i;
		ret *= 9;
	}
	return ret;
}

int fun(int i, int r)
{
	if (i == n) {
		if (r) return 0;
		else return 1;
	}
	int ret = 0;
	if (s[i] > '0') {
		int cnt = s[i] - '0';
		if (r > 1) ret += fun(i + 1, r - 1);
		else ret += 1;
		cnt--;
		if (cnt) {
			ret += cnt * gun(n - 1 - i, r - 1);
		}
	}
	if (s[i] == '0') ret += fun(i + 1, r);
	else {
		ret += gun(n - 1 - i, r);
	}
	return ret;
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> s >> k;
	n = s.length();
	ans = fun(0, k);
	cout << ans << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#if 1
  #include <bits/stdc++.h>
#else
  #include "../../../../bits/stdc++.h"
#endif

#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) RFOR(i,0,(n))

using namespace std;

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

#define pb push_back
#define mp make_pair
#define ft first
#define sd second


char c[103];
int s;


int main(){
  cin.tie(0);
  
  cin>>c;

  s = strlen(c);

  cout<<c[0]<<(s-2)<<c[s-1]<<endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
c = input()
cnt = 0
l, r = -1, n + 2

while True:
    l = c[l + 1 :].find("W") + l + 1
    r = c[:r].rfind("R")
    if l == -1 or r == -1 or r <= l:
        break
    else:
        cnt += 1
print(cnt)

Measured memory_bytes: 9412
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7;
ll dp[101][4][4][4];
/*
0 = a, 1 = g ,2= c =,3 = t
*/
int main()
{
	int n;
	cin >> n;
	for(int i = 0 ;i<4;i++)
	{
		for(int j = 0;j<4;j++)
		{
			for(int k = 0;k<4;k++)
			{
				if(i==0&&j==1&&k==2)continue;
				if(i==0&&j==2&&k==1)continue;
				if(i==1&&j==0&&k==2)continue;
				dp[0][i][j][k]++;
			}
		}
	}

	for(int ii = 0;ii<n-3;ii++)
	{
		for(int i = 0;i<4;i++)
		{
			for(int j = 0;j<4;j++)
			{
				for(int k = 0;k < 4;k++)
				{
					for(int l = 0;l<4;l++)
					{
						if(i==0&&j==1&&l==2)continue;
						if(i==0&&k==1&&l==2)continue;
						if(j==0&&k==1&&l==2)continue;
						if(j==0&&k==2&&l==1)continue;
						if(j==1&&k==0&&l==2)continue;
						if(i==0&&j==1&&k==2)continue;
						dp[ii+1][j][k][l] += dp[ii][i][j][k];
						dp[ii+1][j][k][l]%= MOD;
					}
				}
			}
		}
	}
	ll ans = 0;
	for(int i = 0;i<4;i++)
	{
		for(int j = 0;j<4;j++)
		{
			for(int k = 0 ;k<4;k++)
			{
				ans += dp[n-3][i][j][k];
				ans %=MOD;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    
    map<int, int> mp1, mp2;
    
    //input 偶奇で分ける
    rep(i, n){
        int a;
        cin >> a;
        
        if (i % 2 == 0) mp1[a]++;
        else mp2[a]++;
    }
    
    //前半mp1の方を基準に考える : 一番頻度が高い値
    int fr1 = 0;
    int key1 = 0;
    
    for(auto p : mp1){
        if (p.second > fr1){
            fr1 = p.second;
            key1 = p.first;
        }
    }
    
    //前半mp1の方を基準に考える
    //後半mp2の方 fr1と異なり, かつ頻度が高い値を選ぶ
    int fr2 = 0;
    for (auto p : mp2){
        if (p.second > fr2 && p.first != key1) fr2 = p.second;
    }
    
    //前半から得られる答え
    int ans1 = (n/2) - fr1 + n/2 - fr2;
    
    
    //後半mp2の方を基準に考える
    //mp2の方 頻度が高い値を選ぶ
    int fr3 = 0;
    int key3 = 0;
    for (auto p : mp2){
        if (p.second > fr3) {
            fr3 = p.second;
            key3 = p.first;
        }
    }

    
    //mp2の方を基準に考える
    int fr4 = 0;
    for(auto p : mp1){
        if (p.second > fr4 && p.first != key3){
            fr4 = p.second;
        }
    }
    
    //後半から得られる答え
    int ans2 = (n/2) - fr3 + n/2 - fr4;
    
    cout << min(ans1, ans2) << endl;
    
}

Measured memory_bytes: 4992
n, x, y = list(map(int, input().split()))

ans = [0] * n
for i in range(1, n):
    for j in range(i + 1, n + 1):
        ans[min(j - i, abs(i - x) + abs(j - y) + 1)] += 1
print('\n'.join(map(str, ans[1:])))


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,vec) VL vec(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t make_tuple
#define eb emplace_back
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a));reverse(all(a))
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (ll)(a.size())
#define ENDL cout<<endl
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define cont const auto
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
#define PQ priority_queue
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef tuple<ll,ll,ll> T3;
typedef tuple<ll,ll,ll,ll> T4;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

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

  ll n;
  cin>>n;
  cinv(n*3,a);
  RSORT(a);
  ll res=0;
  rep(i,2*n)if(i&1)res+=a[i];
  out(res);
  
  
  return 0;
}



Measured memory_bytes: 2560
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    var count = 0
    for (i in 1..n) {
        if (i % 2 == 0) continue
        val divs = mutableListOf<Int>()
        var d = 1
        while (d * d <= i) {
            if (i % d == 0) {
                divs.add(d)
                if (d * d != i) {
                    divs.add(i / d)
                }
            }
            d++
        }
        if (divs.count() == 8) {
            count++
        }
    }
    println(count)
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 34328
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr

using namespace std;



int main(){

    int a,b,c,d;
    cin >> a >> b >> c >> d;

    int l = a + b;
    int r = c + d;

    if(l > r){
        cout << "Left" << endl;
    }else if(l < r){
        cout << "Right" << endl;
    }else{
        cout << "Balanced" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;


public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int mountainCount = sc.nextInt();
        int high = -1;
        int count = 0;
        
        while (mountainCount-- > 0) {
            int mountainsHigh = sc.nextInt();
            if (mountainsHigh >= high) {
                count++;
                high = mountainsHigh;
            }
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int mod = 1000000007;
const int INF = 1001001001;
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(){
    int n,k;
    cin >> n >> k;
    vector<int> a(3);
    rep(i,3) cin >> a[i];
    vector<int> ctoi(256);
    ctoi['r'] = 2;
    ctoi['s'] = 0;
    ctoi['p'] = 1;
    string t;
    cin >> t;
    int ans = 0;
    rep(i,k){
        vector<int> x;
        for(int j=i;j<n;j+=k){
            x.push_back(ctoi[t[j]]);
        }
        int pre = -1;
        vector<int> dp(2);

        for(int nx:x){
            vector<int> p(2);
            swap(dp,p);
            
            dp[0] = max(p[0],p[1]);
            if(pre==nx){
                dp[1] = p[0] + a[nx];
            }else{
                dp[1] = max(p[0],p[1]) + a[nx];
            }
            pre = nx;
        }
        ans += max(dp[0],dp[1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1020
#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n,m;
    cin>>n>>m;
    int val=0;
    while(m--)
    {
        int in;
        cin>>in;
        val+=in;
    }
    if(val>n)
        cout<<-1;
    else
        cout<<n-val;
    return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

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

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

	int cho=0,ei=0,don=0;
	int e[3];
	while(true) {
		cin>>e[0]>>e[1]>>e[2];
		sort(e,e+3);
		if(e[0]+e[1]<=e[2]) {
			cout<<cho+ei+don<<' '<<cho<<' '<<ei<<' '<<don<<endl;
			return 0;
		}
		int a=e[0]*e[0],b=e[1]*e[1],c=e[2]*e[2];
		if(a+b==c) cho++;
		else if(a+b>c) ei++;
		else don++;
	}

	return 0;
}



Measured memory_bytes: 3184
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cassert>
#include <random>
#include <bitset>
using namespace std;
 

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define pb push_back
#define forn(i, n) for (int i = 0; i < n; ++i)
// #define int long long

 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

 
const int MAXN = 1e6 + 5;
const ll MOD = 998244353;
const ll INF = INT64_MAX;


random_device rd;
mt19937 rnd(rd());


ll pw(ll a, ll x) {
	ll res = 1;
	while (x > 0) {
		if (x & 1) {
			res = (res * a) % MOD;
		}
		a = (a * a) % MOD;
		x >>= 1;
	}
	return res;
}


signed main() {
	FAST_IO;
	int n;
	cin >> n;
	vector<int> a(n);
	map<int, int> cnt;
	forn(i, n) {
		cin >> a[i];
		if (cnt.find(a[i]) == cnt.end()) {
			cnt[a[i]] = 0;
		}
		cnt[a[i]]++;
	}
	sort(all(a));
	int ans = 0;
	forn(i, n) {
		int ok = 1;
		if (cnt[a[i]] > 1 || (cnt[1] >= 1 && a[i] != 1)) {
			continue;
		}
		for (int x = 2; x * x <= a[i]; x++) {
			if (a[i] % x == 0) {
				auto j = lower_bound(all(a), x);
				if (*j == x) {
					ok = 0;
					break;
				}
				j = lower_bound(all(a), a[i] / x);
				if (*j == a[i] / x) {
					ok = 0;
					break;
				}
			}
		}
		ans += ok;
	}
	cout << ans << "\n";
 	return 0;
}

Measured memory_bytes: 13496
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007

int main (){
    int n;
    cin >> n;
    cout << n*(n+1)/2 << endl;
    return 0;
    }

Measured memory_bytes: 256