akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;

typedef pair<int,int> P;
struct edge{int to,cost;};
const int INF = 1000000000;

vector<edge> G[100000];
priority_queue<P,vector<P>,greater<P> > q;
int v,e,r;

int main(){
  scanf("%d %d %d",&v,&e,&r);
  for(int i=0;i<e;i++){
    int s,t,d;
    scanf("%d %d %d",&s,&t,&d);
    edge tmp;
    tmp.to = t;
    tmp.cost = d;
    G[s].push_back(tmp);
  }
  int d[v];
  fill(d,d+v,INF);
  d[r] = 0;
  q.push(P(0,r));
  while(!q.empty()){
    P p = q.top();
    q.pop();
    int nv = p.second;
    for(int i=0;i<G[nv].size();i++){
      if(d[nv]+G[nv][i].cost<d[G[nv][i].to]){
        d[G[nv][i].to] = d[nv] + G[nv][i].cost;
        q.push(P(d[G[nv][i].to],G[nv][i].to));
      }
    }
  }
  for(int i=0;i<v;i++){
    if(d[i]==INF) printf("INF\n");
    else printf("%d\n",d[i]);
  }
  return 0;
}

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

using namespace std;

int main()
{
  int n;
  double ans = 0.0;
  cin >> n;
  
  vector<double> x(n);
  vector<string> u(n);
  for(int i = 0; i < n; i++)
  {
    cin >> x[i] >> u[i];
    
    if(u[i] == "JPY")
    {
      ans += x[i];
    }
    else if(u[i] == "BTC")
    {
      ans += (x[i] * 380000.0);
    }
  }
  
  cout << ans;
}

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


#define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define dforn(i,n) dforsn(i,0,n)
#define forn(i,n) forsn(i,0,n)
#define all(a) a.begin(),a.end()
#define si(a) int((a).size())
#define pb emplace_back
#define mp make_pair
#define snd second
#define fst first
#define endl '\n'
using pii = pair<int,int>;
using vi = vector<int>;
using ll = long long;
using vii = vector<pii>;

const int N = 300+1, M = 1e9+7, C = 3;
int n, m, memo[N][N][N]; 
vii conditions[N];

int add(int a, int b) {
    return a + b >= M ? a + b - M : a + b;
}

bool valid(int pos, int last0, int last1, int last2) {
    for (auto lx : conditions[pos]) {
        int l, x; tie(l, x) = lx;
        int cant = (last0 >= l) + (last1 >= l) + (last2 >= l);
        if (cant != x) return false;
    }

    return true;
}

int dp(int last0 = 0, int last1 = 0, int last2 = 0) {
    int pos = max({last0, last1, last2})+1;
    if (pos == n+1) return 1;

    int &res = memo[last0][last1][last2];
    if (res != -1) return res;
    res = 0;

    if (valid(pos, pos, last1, last2))
        res = add(res, dp(pos, last1, last2));
    if (valid(pos, last0, pos, last2))
        res = add(res, dp(last0, pos, last2));
    if (valid(pos, last0, last1, pos))
        res = add(res, dp(last0, last1, pos));

    return res;
}

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

    cin >> n >> m;    
    while (m--) {
        int l, r, x; cin >> l >> r >> x;
        conditions[r].pb(l, x);
    }

    fill(memo[0][0], memo[N][0], -1);
    cout << dp() << endl;
	
}

Measured memory_bytes: 106880
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
  long long int n,p;
  scanf("%lld",&n);
  scanf("%lld",&p);
  //printf("CHECKED\n");
  long long int ptemp = p;
  long long int prime = 2;
  long long int ans = 1;
  long long int anstemp = 0;
  while(ptemp > 1) {
    anstemp = 0;
    while(ptemp%prime == 0) {
      ptemp = ptemp/prime;
      //printf("%lld\n",ptemp);
      anstemp++;
    }
    while(anstemp >= n) {
      ans = ans * prime;
      anstemp -= n;
    }
    if(prime==2) {
      prime = 3;
    } else {
      if(prime * prime > ptemp) {
        prime = ptemp;
      } else {
        prime += 2;
      }
    }
    //printf("prime = %lld\n",prime);
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 128
while 1:
    n,m,p = map(int,input().split())
    if n == 0 and m == 0 and p == 0:
        break
    x = [int(input()) for i in range(n)]
    Sum_kingaku = sum(x)*100
    p = p / 100
    koujyo = Sum_kingaku * p
    kakekin = Sum_kingaku - koujyo
    if x[m-1] == 0:
        ans = 0
    else:
        ans = kakekin // x[m-1]
    print(int(ans))




Measured memory_bytes: 5624
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<cmath>
#include<string>

#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back

#define N 100005
#define M 200005
#define seed 23333
#define Mo 998244353

using namespace std;
int i,j,m,n,p,k,tot,ans;
char c[M];
int main()
{
		scanf("%s",c);
		n=strlen(c);
		for (i=0;i<n;++i)
		{
		 	if (c[i]=='S') 	++tot;	
			else if (c[i]=='T')
			{
					if (!tot) ++ans;
					else --tot; 
			}
		}
		for (i=1;i<=tot;++i) ++ans;
		printf("%d\n",ans);
}


Measured memory_bytes: 384
n=int(input())
ans=[]
for i in range(n):
    qw=input()
    ans.append([0,0,0,0,0,0,0,0,0,0])
    for j in range(10):
        ans[i][j]=qw[j]
    ans[i].sort()

lis=[]
for i in range(n):
    lis.append(ans[i][0])
    for j in range(9):
        lis[i]+=ans[i][j+1]

a=0
#print(lis)

dic={lis[0]:1}
for i in range(n-1):
    if lis[i+1] in dic.keys():
        a+=dic[lis[i+1]]
        dic[lis[i+1]]+=1
    else:
        dic[lis[i+1]]=1

print(int(a))


Measured memory_bytes: 35952
#include <stdio.h>
int main(void)
{
    int i;
	char s[12]; 
	scanf("%s",s);
    for(i=0;i<4;i++)printf("%c",s[i]);
    printf(" ");
    for(i=4;i<12;i++)printf("%c",s[i]);
    printf("\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<math.h>
#include <algorithm>
#include<string>
using namespace std;


int main() {
        int N;
        int ans=0;

        cin >> N;
        for(int i=1; i<=N; i+=2){
                int count=1;
                for(int j=2; j<=i; j++){
                        if(i%j==0)count++;
                }
                if(count==8)ans++;
        }

        cout << ans <<endl;

        return 0;
}

Measured memory_bytes: 256
// ABC144_C
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::prev(iter, n) n 個分デクリメントしたイテレータ
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <cstring>  // std::memset 初期化
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> pll;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define F first
#define S second
const ll INF = 1LL<<60;  // 10^18（const int inf   = 1<<29;）

template <typename T>
vector<T> divisor(T n) {
    // 約数列挙(n 自身は含まない，必要に応じて vec.push_back())
    vector<T> vec;
    for(T i = 1; i*i <= n ; ++i) {
        if (n%i == 0) {
            vec.push_back(i);
            if (i != 1 && i*i != n) {
                vec.push_back(n / i);
            }
        }
    }
    sort(vec.begin(), vec.end());
    return vec;
}
//CUT HERE END

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll N;
    cin >> N;
    
    // calculation
    ll res = INF;
    vl div = divisor(N);
    
    REP(i, div.size()) {
        res = min(res, (N/div[i]-1)+(div[i]-1));
    }
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;

int main(){
	int n, m;
	cin >> n >> m;
	using ll = long long;
	map<ll, vector<pair<ll, ll>>> mp;
	for(int i = 0; i < m; i++){
		ll l, r, x;
		cin >> l >> r >> x;
		mp[r].emplace_back(l, x);
	}
	ll ans = 0, dp[n + 1][n + 1][n + 1]{};
	dp[0][0][0] = 1;
	for(int i = 0; i <= n; i++) for(int j = 0; j <= n; j++) for(int k = 0; k <= n; k++){
		if(dp[i][j][k] == 0) continue;
		ll puni = max({i, j, k});
		for(auto& p:mp[puni]){
			int cnt = 0;
			if(p.first <= i) cnt++;
			if(p.first <= j) cnt++;
			if(p.first <= k) cnt++;
			if(cnt != p.second) goto next;
		}
		dp[i][j][k] %= ll(1e9 + 7);
		if(puni == n){
			(ans += dp[i][j][k]) %= ll(1e9 + 7);
			goto next;
		}
		dp[puni + 1][j][k] += dp[i][j][k];
		dp[i][puni + 1][k] += dp[i][j][k];
		dp[i][j][puni + 1] += dp[i][j][k];
		next:;
	}
	cout << ans << endl;
}

Measured memory_bytes: 213376
#include <math.h>
#include <stdio.h>
int main() {
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    if ((abs(b - a) <= d && abs(c - b) <= d) || abs(a - c) <= d) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
# vim: set fileencoding=utf-8 :
k, s = map(int, raw_input().split())
patterns = []
ct = 0

for x in range(k + 1):
    nokori = s - x
    for y in range(k + 1):
        if 0 <= nokori - y <= k:
            ct += 1

print(ct)


Measured memory_bytes: 2692
#include <iostream>

using namespace std;

int main(void){
    int n, five = 0, seven = 0;
    for(int i = 0; i < 3; i++){
        cin >> n;
        if(n == 5)  five++;
        else if(n == 7)    seven++;
    }
    if(five == 2 && seven == 1)     cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
using ld = long double;
ll mod = 1000000007;

int main() {
    ll n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    ll now = n;
    stack<ll> ans;
    while (now != 0) {
        if (now < m) {
            ans.push(now);
            now = 0;
            continue;
        }
        bool move = false;
        for (int dice = m; dice > 0; dice--) {
            if (s[now - dice] == '0') {
                now -= dice;
                ans.push(dice);
                move = true;
                break;
            }
        }
        if (!move) {
            cout << -1 << endl;
            return 0;
        }
    }

    while (!ans.empty()) {
        cout << ans.top() << " ";
        ans.pop();
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 4540
//Daniel Grzegorzewski
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define int long long

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

const int N = 405;

int n, a[N], dp[N][N], sum[N];

int suma(int i, int j) {
  return sum[j] - sum[i-1];
}

signed main() {
  init_ios();
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    sum[i] = sum[i-1]+a[i];
  }
  for (int len = 2; len <= n; ++len)
    for (int i = 1; i+len-1 <= n; ++i) {
      int j = i+len-1;
      dp[i][j] = a[i]+dp[i+1][j]+suma(i+1, j);
      for (int k = i+1; k < j; ++k)
        dp[i][j] = min(dp[i][j], suma(i, k)+dp[i][k]+suma(k+1, j)+dp[k+1][j]);
    }
  cout<<dp[1][n]<<"\n";
}

Measured memory_bytes: 1536
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
#include <queue>

using namespace std;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)
#define INF (1001001001)
#define EPS (1e-15)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define pra(x,n) rep(__i,n) pri(x,__i);
#define prar(x,b,e) repr(__i,b,e) pri(x,__i);

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;

ll MOD = 1000000007;

int in() {
	int a;
	scanf("%d ", &a);
	return a;
}

int main() {
	int N, M, K;
	cin >> N >> M >> K;
	bool ok = false;
	repr(n, 0, N) repr(m, 0, M) {
		if ((M - m) * n + (N - n) * m == K) {
			pr(m);
			pr(n);
			pr(K);
			ok = true;
			break;
		}
	}
	cout << (ok ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int main(void){
  int n,t,c;
  long double a[15];
  a[10] = pow(8.0,10.0);
  a[9]  = pow(8.0,9.0);
  a[8]  = pow(8.0,8.0);
  a[7]  = pow(8.0,7.0);
  a[6]  = pow(8.0,6.0);
  a[5]  = pow(8.0,5.0);
  a[4]  = pow(8.0,4.0);
  a[3]  = pow(8.0,3.0);
  a[2]  = pow(8.0,2.0);
  a[1]  = pow(8.0,1.0);
  a[0]  = pow(8.0,0);
  while(cin >> n,n){
    string ans;
    for(int i = 10;i >= 0; i--){
      if((int)a[i] <= n){
	t = i;
	break;
      }
    }
    for(int i = t;i >= 0; i--){
      c = n / (int)a[i];
      n -= c * (int)a[i];
      if(c == 0) ans += "0";
      else if(c == 1) ans += "1";
      else if(c == 2) ans += "2";
      else if(c == 3) ans += "3";
      else if(c == 4) ans += "5";
      else if(c == 5) ans += "7";
      else if(c == 6) ans += "8";
      else if(c == 7) ans += "9";
      else ans += "F";
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 1196
#include <cstdio>
#include <iostream>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iomanip>
#include<string>
#include <numeric>
using namespace std;
int a[810];
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
	int iwa = 0;
	int n;
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		if (a[i] % 2 == 0) {
			iwa++;
		}
	}
	cout << iwa << endl;
}



Measured memory_bytes: 3092
from bisect import bisect_right
a = int(input())

l = [1]
def fctr1(n): 
    f=[]
    c=0
    r=int(n**0.5)
    for i in range(2,r+2):
        while n%i==0:
            c+=1
            n=n//i
        if c!=0:
            f.append([i,c])
            c=0
    if n!=1:
        f.append([n,1])
    return f


f = fctr1(a)
ans = 0
# for i,j in f:
#     if 

for i in range(2,45):
    l.append(i+l[-1])
# print(l)
for i,j in f:
    a = bisect_right(l,j)
    # print(a)
    ans +=a

print(ans)


Measured memory_bytes: 9480
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
ll inf=1000000000000000000,mod=1000000007,BS,k;

int main(){
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
        ll n,d;cin>>n>>d;
        ll sum=0,x,y;
        for(ll i=0;i<n;i++){
            cin>>x>>y;
            if(x*x+y*y<=d*d)sum++;
        }cout<<sum;

}


Measured memory_bytes: 3644
num = gets.to_i
num.times do
  b, c = [], []
  a = gets.chomp.split(' ').map(&:to_i)
  a.each do |i|
    if (b.last||0) < i
      b << i
    elsif (c.last||0) < i
      c << i
    else
      break
    end
  end
  puts (a.size==b.size+c.size) ? 'YES' : 'NO'
end

Measured memory_bytes: 6104
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}


fn main() {
    input!{
        n: i32,
    }
    let mut flag = false;
    let m = n / 4;
    for i in 0..m+1 {
        let remain = n - i * 4;
        if remain % 7 == 0 {
            flag = true;
            break
        }
    }

    if flag {
        println!("Yes");
    } else {
        println!("No");
    }
}



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

#define rep(i,a,n) for(int i=a;i<n;i++)
#define all(x) (x).begin(),x.end()
#define watch(x) cout<<#x<<" = "<<x<<endl;
#define V(x) vector<x>
#define P(x,y) pair<x,y>
#define UMP(x,y) unordered_map<x,y>
#define MP(x,y) map<x,y>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
typedef double db;
const ll mod = 1000000007;

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
		int n;
		string result = "No";
		cin>>n;
		while(n){
			if(n%10 == 7){
				result = "Yes";
				break;
			}
			n/=10;
		}
		cout<<result<<endl;
	return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>

int main(int argc, char *argv[]) {
  long a, b, k;
  
  scanf("%ld %ld %ld", &a, &b, &k);
  if (k >= a) {
    k -= a;
    a = 0;
  } else {
    a -= k;
    k = 0;
  }
  if (k >= b) {
    k -= b;
    b = 0;
  } else {
    b -= k;
    k = 0;
  }
  printf("%ld %ld\n", a, b);
    
  return 0;
}


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

int gcd(int a,int b)
{
	if (a % b == 0) return(b);
  else return(gcd(b, a % b));
}

int main(){
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }
  int ans = a[0];
  for (int i = 1; i < n; i++){
    ans = gcd(ans, a[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long  int N,K,ans,reans;
  cin >>N >> K;
  vector<long long int>monsters(N);
  for(int i=0; i<N ;i++){
  cin >> monsters.at(i);
  }
  sort(monsters.begin(), monsters.end());
  if(N<=K){ans=0; cout <<ans <<endl;
  }
  else{
  	for(int i=0;i<N-K;i++){
	ans+= monsters.at(i);
    } cout <<ans <<endl;
  }
 
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

int main(void) {
  int n;
  cin >> n;
  ll T = 1, A = 1;
  rep(i, 0, n) {
    ll t, a;
    cin >> t >> a;
    ll x = (T+t-1)/t, y = (A+a-1)/a;
    ll r = max(x, y);
    T = r*t;
    A = r*a;
  }
  
  ll ans = A+T;
  
  cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3632
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, a, b) for (int i = a; i < (b); i++)
#define FOR(i, n) for (int i = n; i >= 0; i--)
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <vector>
#define ll long long
using namespace std;

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

    int n;
    cin >> n;

    int a[100001];
    REP(i,n){
        cin >> a[i];
    }

    sort(a, a+n);

    int ans = 0;
    int cnt = 1;
    RREP(i,1,n){
        
        if(a[i-1] == a[i]){
            cnt++;
        }
        else if(a[i-1] != a[i]){
            if(cnt%2 != 0) ans++;
            cnt = 1;        
        }
    }

    if(cnt % 2 != 0) ans++;

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <stack>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
#define ll long long
static const int MAX = 100010;
static const ll INFTY = 1e12;
static const int NUMMAX = 300;



int main() {

  string S, T;
  int ans = 0;

  cin >> S;
  cin >> T;

  REP(i, S.length()){
    if(S[i] == T[i]){
      ans++;
    }
  }

  cout << ans << endl;
 
  return 0;

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 256
a=(1..3).map{gets.split}.flatten
gets.to_i.times { (i=a.index(gets.chomp)) && a[i]=?* }
res=:No
res=:Yes if a[0]+a[4]+a[8]=='***'
res=:Yes if a[2]+a[4]+a[6]=='***'
a=a.each_slice(3).to_a
res=:Yes if a.any?{|v|v.all?{|e|e==?*}}
res=:Yes if a.transpose.any?{|v|v.all?{|e|e==?*}}
puts res


Measured memory_bytes: 1916
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
using namespace std;

int main(int argc, char *argv[])
{
	int i, j, l;
	int n, m;
	int tmp;
	cin >> n >> m;
	vector<vector<int> > sw(m);
	vector<int> p;
	int mask[n];
	int pattern = pow(2, n);
	int tmp_on_num;
	vector<int> k(m);
	bool ok;
	int answer = 0;
	
	for (i = 0; i < n; i++) 
		mask[i] = pow(2, i);

	for (i = 0; i < m; i++) {
		cin >> k[i];
		for (j = 0; j < k[i]; j++) {
			cin >> tmp;
			sw.at(i).push_back(tmp);
		}
	}
	for (i = 0; i < m; i++) {
		cin >> tmp;
		p.push_back(tmp);
	}

	// cout << "OK input is : " << endl;
	// cout << n << " " << m << endl;
	// for (i = 0; i < m; i++) {
	// 	cout << k[i] << " ";
	// 	for (j = 0; j < k[i]; j++)
	// 		cout << sw[i][j] << " ";
	// 	cout << endl;
	// }
	// for (i = 0; i < m; i++) 
	// 	cout << p[i] << " ";
	// cout << endl;

	for (i = 0; i < pattern; i++) {
		bool ok = true;
		for (j = 0; j < m; j++) {
			tmp_on_num = 0;
			for (l = 0; l < k[j]; l++) {
				if ((i & mask[sw.at(j).at(l) - 1]) != 0)
					tmp_on_num++;
			}
			if (tmp_on_num % 2 != p[j]) {
				ok = false;
				break;
			}
		}
		if (ok) 
			answer++;
	}

	cout << answer << endl;
	   
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <map>
#include <vector>
//#include <unordered_map>
//#include <unordered_set>
#include <stack>
#include <set>
#include <queue>
#include <list>
#define LL long long
#define N 100100
#define M 110
#define MOD 1000000007
#define FOR(i,l,r) for (int i = (l); i <= (r); i ++)
#define CLR(a,x) memset(a,x,sizeof(a))
#define INF 0x3f3f3f3f
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define X first
#define Y second
using namespace std;
int main()
{
    int n,k;
    scanf("%d",&n);
    int co=0,ans=0;
    for(int i=1;i<=n;++i)
    {
        scanf("%d",&k);
        if(k!=i)
        {
            ans+=(co+1)/2;
            co=0;
        }else ++co;
    }
    ans+=(co+1)/2;
    printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;
int  h, w, iy[100], jx[100];
#define rep(i,n) for(int i =0;i < n;i++)
int main() {
	cin >> h >> w;vector<vector<char>> a(h, vector<char>(w));
	rep(i, h) {
		rep(j, w) {
			cin >> a[i][j];
		}
	}
	rep(i, h) {
		rep(j, w) {
			if (a[i][j] != '.') break;
			if (j == w - 1) {
				iy[i] = 1;
			}
		}
	}
	rep(i, w) {
		rep(j, h) {
			if (a[j][i] != '.') break;
			if (j == h - 1) {
				jx[i] = 1;
			}
		}
	}
	rep(i, h) {
		if (!iy[i]) {
			rep(j, w) {
				if (!jx[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
const int inf = 1000000000; //10^9
using ll = long long;
using P = pair<int,int>;
//加算代入演算子は+=！！！！！
int main() {
    int a, b;
    scanf("%d%d", &a, &b);
    bool ans = false;

    rep (i, 10000) { //消費税が最大でも100円。ということは最大でも税別10,000円の商品。
        if((i * 8) / 100 == a && (i * 10) / 100 == b) { //総当りでaとbが一緒の場合を試す
            printf("%d\n", i);
            ans = true;
            break;
        }
    }
    if (!ans) {
        printf("-1\n");
    }
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll ret=pow(x,y/2);
  ret*=ret;
  if(y%2==1) ret*=x;
  return ret;
}
int main(){
  bool f=false;
  int kt=-1;
  for(int i=0;i<12;i++){
    cout<<"? "<<pow(10,i)<<endl;
    char c;
    cin>>c;
    if(!f&&c=='N'){
      f=true;
      kt=i;
      break;
    }
  }
  if(kt==-1){
    bool f2=false;
    for(int i=1;i<12;i++){
      cout<<"? "<<pow(10,i)-1<<endl;
      char c;
      cin>>c;
      if(!f2&&c=='Y'){
        f=true;
        cout<<"! "<<pow(10,i-1)<<endl;
        return 0;
      }
    }
  }
  ll lb=pow(10,kt),rb=pow(10,kt+1);
  while(rb-lb>1){
    ll mid=(lb+rb)/2;
    cout<<"? "<<mid<<endl;
    char c;
    cin>>c;
    if(c=='Y') rb=mid;
    else lb=mid;
  }
  cout<<"! "<<rb/10<<endl;
  return 0;
}


Measured memory_bytes: 644
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define FOR(i, first, last) for (int i = (first); i < (last); ++i)
#define REP(i, n) FOR(i, 0, n)
#define CLR(a) memset((a), 0, sizeof(a))
#define DUMP(x) std::cerr << #x << " = " << (x) << std::endl;

inline int to_int(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string to_string(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

typedef unsigned long long ull;
typedef unsigned long ul;

int main() {
  int N;
  cin >> N;
  vector<long long> v(N);
  vector<long long> s(N);
  REP(i, N) cin >> v[i];

  s[0] = v[0];
  for (int i = 1; i < N; i++)
    s[i] = s[i - 1] + v[i];

  long long S = accumulate(v.begin(), v.end(), 0ll);
  long long ans = LLONG_MAX;
  for (int i = 0; i < N - 1; i++) {
    long long x = s[i];
    long long y = S - x;
    ans = min(ans, abs(x - y));
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<cstdio>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<deque>
#include<utility>
#include<cctype>
#include<bitset>
#include<stdio.h>
#include<time.h>
#define ll long long
#define mp make_pair
using namespace std;
const ll INF=1e9;
/*--------main part---------*/
inline ll read(){
    ll X = 0,w = 0 ;
	char ch = 0;
    while(!isdigit(ch)) {w |= ch == '-';ch = getchar();}
    while(isdigit(ch)) X = (X<<3) + (X<<1) + (ch ^ 48),ch = getchar();
    return w ? -X : X;
}
ll ans;
ll n;
ll dat[100005];
ll tmp[100005];
ll pre[100005];
void merge(ll a[],ll l,ll r)
{
	if(l==r)
	{
		return;
	}
	ll mid=(l+r)/2;
	merge(a,l,mid);
	merge(a,mid+1,r);
	ll x=l;
	ll y=mid+1;
	ll id=l;
	while(x<=mid and y<=r)
	{
		if(a[x]>a[y])
		{
			tmp[id++]=a[y];
			ans+=mid-x+1;
			y++;
		}
		else
		{
			tmp[id++]=a[x];
			x++;
		}
	}
	while(x<=mid)
	{
		tmp[id++]=a[x++];
	}
	while(y<=r)
	{
		tmp[id++]=a[y++];
	}
	for(ll i=l;i<=r;i++)
	{
		a[i]=tmp[i];
	}
}
bool check(ll mid)
{
	ans=0;
	for(ll i=1;i<=n;i++)
	{
		if(dat[i]<mid)
		{
			pre[i]=pre[i-1]-1;
		}
		else
		{
			pre[i]=pre[i-1]+1;
		}
		if(pre[i]<0)
		{
			ans++;
		}
	}
	merge(pre,1,n);
	return (n*(n+1))/2>=2*ans;
}
int main()
{
	cin>>n;
	for(ll i=1;i<=n;i++)
	{
		cin>>dat[i];
	}
	ll l=1;
	ll r=INF;
	while(l+1<r)
	{
		ll mid=(l+r)/2;
		if(check(mid))
		{
			l=mid;
		}
		else
		{
			r=mid;
		}
	}
	if(check(l+1))
	{
		l++;
	}
	cout<<l<<endl;
	return 0;
}


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

using namespace std;

struct UnionFind {
  vector< int > data;

  UnionFind(int sz) {
    data.assign(sz, -1);
  }

  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }

  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k) {
    return (-data[find(k)]);
  }
};


int main() {
  int N, Q;
  scanf("%d %d", &N, &Q);
  UnionFind uf(N);
  while(Q--) {
    int t, x, y;
    scanf("%d %d %d", &t, &x, &y);
    if(t == 0) uf.unite(x, y);
    else printf("%d\n", uf.find(x) == uf.find(y));
  }
}


Measured memory_bytes: 3252
K, A, B = map(int, input().split())

ans = 1
if B > A + 2:
    # まずB枚生成
    ans += B - 1
    K -= A + 1
    # 2動作ごとにB-A増える
    n = K // 2
    ans += n * (B - A)
    # 1回操作余ってたら足す
    ans += K % 2
else:
    ans += K

print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ll MOD = 998244353;
const ld pi = 3.141592653589793238;

bool isprime(int p) {
	if (p == 1) return false;
	for (int i = 2; i < p; i++) {
		if (p % i == 0) return false;
	}
	return true;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}
ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}
ll nCk(ll n, ll k) {
	ll a = 1, b = 1;
	for (int h = n - k + 1; h <= n; h++) { a *= h; a %= mod; }
	for (int h = 1; h <= k; h++) { b *= h; b %= mod; }
	return a * modpow(b, mod - 2) % mod;
}
//printf("%.10f\n", n);


signed main() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	
	string s, t;
	ll n, m, a = 0, b = 0, c = 0, cnt = 0, ans = 0;
	cin >> n >> m;
	vector<ll> l(m), r(m);
	rep(i, m) {
		cin >> l[i] >> r[i]; r[i]++;
	}
	map<ll, ll> dp, rui;
	dp[1] = 1; rui[1] = 1;
	for (int h = 2; h <= n; h++) {
		rep(i, m) {
			dp[h] += rui[h - l[i]] - rui[h - r[i]];
		}
		dp[h] %= MOD;
		rui[h] = rui[h - 1] + dp[h];
	}
	cout << dp[n] << endl;
	return 0;
}

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

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

template <typename T>
inline void chkmax(T &x, T y) { if (x < y) x = y; }

template <typename T>
inline void chkmin(T &x, T y) { if (x > y) x = y; }

inline int read() {
  #define nc getchar()
  int x = 0;
  char c = nc;
  while (c < 48) c = nc;
  while (c > 47) x = (x << 3) + (x << 1) + (c ^ 48), c = nc;
  return x;
  #undef nc
}

typedef long long ll;
int n, m, k,a[11][1010], sum[11][1010];

int main() {
  cin >> n >> m >> k;
  rep(i, 1 , n) rep(j, 1, m) scanf("%1d", &a[i][j]), sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+a[i][j];
  int res=1e9;
  rep(S, 0, (1 << (n - 1)) - 1) {
    vector <int> vec;
    rep(i, 0, n - 2) {
      if (S >> i & 1) vec.push_back(i+1);
    }
    vec.push_back(n);
    int val=__builtin_popcount(S);
    int pos=1;
    rep(i,1,m){
      bool flg=0;
      int lst = 1;
      bool endflg = 0;
      for (int x : vec) {
        if (sum[x][i] - sum[x][pos - 1] - sum[lst - 1][i] + sum[lst - 1][pos - 1] > k) {
          flg = 1;
        }
        if (sum[x][i] - sum[x][i - 1] - sum[lst - 1][i] + sum[lst - 1][i - 1] > k) {
          endflg = 1;
        }
        lst = x + 1;
      }
      if(flg) {
        val++;
        pos=i;
      }
      if (endflg) val = 1e9;
    }
    chkmin(res,val);
  }
  cout<<res;
  return 0;
}

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

ll a, b, c, d;

int main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        cin >> a>> b>> c>> d;
        ll l = b / c - (a - 1) / c;
        ll r = b / d - (a - 1) / d;
        ll m = d * c / __gcd(d, c);
        ll p = b / m - (a - 1) / m;
        cout << b - a + 1 - l - r + p;
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N_MAX 500000
#define S_MAX 1000000000
#define INFTY S_MAX+1

int L[N_MAX/2+2];
int R[N_MAX/2+2];

long count;  // 反転数

void merge(int *A, int left, int mid, int right)
{
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;

  // L[0...n1], R[0...n2] を生成
  for (i = 0; i < n1; i++)
    L[i] = A[left + i];
  for (i = 0; i < n2; i++)
    R[i] = A[mid + i];
  
  L[n1] = INFTY; // 番兵を入れる
  R[n2] = INFTY; // 番兵を入れる
  i = 0;
  j = 0;
  for (k = left; k < right; k++) {
    if (L[i] <= R[j]) { // 小さいほうを A にコピー
      A[k] = L[i];
      i = i + 1;
    } else {
      A[k] = R[j];
      j = j + 1;
      count += n1 - i;
    }
  }
}
                
void mergeSort(int *A, int left, int right)
{
  int mid;
  
  if (left+1 < right) {
    mid = (left + right)/2;

    mergeSort(A, left, mid);
    mergeSort(A, mid, right);

    merge(A, left, mid, right);
  }
}

int main(void)
{
  int n;
  int A[N_MAX];
  int i;
  
  scanf("%d", &n);
  for (i = 0; i < n; i++)
    scanf("%d", &A[i]);

  mergeSort(A, 0, n);

  printf("%ld\n", count);
  
  return 0;
}



Measured memory_bytes: 3360
use std::io::Write;

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let n: usize = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.parse().unwrap()
    };

    let range = 55555;
    let primes = prime_sieve(range);

    let mut v = vec![];
    for &p in primes.iter() {
        if p % 5 == 1 {
            v.push(p);
        }
    }

    println!("{}", v[0..n].iter().map(|x| x.to_string()).collect::<Vec<_>>().join(" "));
}

fn prime_sieve(n: usize) -> Vec<usize> {
    let mut table: Vec<usize> = vec![0; (n + 1) as usize];
    let mut primes: Vec<usize> = Vec::new();

    for i in 2..(n+1) {
        if table[i as usize] == 0 {
            primes.push(i);
            for j in 2..n {
                if i * j > n {
                    break
                }
                table[(i * j) as usize] = 1
            }
        }
    }

    primes
}


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

int main(void) {

	std::string s;
	int A = 0, Z = 0, X = 0;
	std::cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A') {
			A = i + 1;
			break;
		}
	}
	for (int j = s.size() - 1; j > 0; j--) {
		if (s[j] == 'Z') {
			Z = j + 1;
			break;
		}
	}
	X = Z - A + 1;
	std::cout << X << std::endl;

}


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

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

	int alice = 0;
	int bob = 0;
	sort(a, a+n);
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			alice += a[n-i-1];
		} else {
			bob += a[n-i-1];
		}
	}
	int ans = alice - bob;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
numList  = [int(input()) for i in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
  if num != maxVal:
    print(maxVal)
  else:
    print(secondVal)

Measured memory_bytes: 14068
#include <iostream>
#include <cstdio>
#include <algorithm>

using std::max;

#define MAXN 100003
int d[MAXN][3],a[MAXN][3];
int main(){
    int N,i;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);
    }
    d[0][0]=a[0][0];
    d[0][1]=a[0][1];
    d[0][2]=a[0][2];
    for(i=1;i<N;i++){
        d[i][0]=a[i][0]+max(d[i-1][1],d[i-1][2]);
        d[i][1]=a[i][1]+max(d[i-1][0],d[i-1][2]);
        d[i][2]=a[i][2]+max(d[i-1][1],d[i-1][0]);
    }
    printf("%d\n",max(d[N-1][0],max(d[N-1][1],d[N-1][2])));
    
    return 0;
}

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

#define read(num) scanf("%d", &num)
#define readll(num) scanf("%lld", &num)
#define read2(num1, num2) scanf("%d%d", &num1, &num2)
#define read3(num1, num2, num3) scanf("%d%d%d", &num1, &num2, &num3)
#define reads(str) scanf("%s", str)
#define readc(ch) scanf("%c", &ch)

#define M 1000000007
#define pb push_back
#define mp make_pair

#define pii pair<int, int>
#define vi vector<int>
#define ll long long

#define con 998244353

int main()
{
  int a;
  string sl;
  cin>>a>>sl;
  if(a>=3200){
      cout<<sl;
  }else {
      cout<<"red";
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int main() {
  vector<int> v;
  int n;
  cin >> n;
  n *= 2;
  while (n--) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end(), greater<int>());
  int sum = 0;
  for (int i = 1; i < v.size(); i += 2) {
    sum += v[i];
  }
  cout << sum << endl;
  return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define ALL(A) (A).begin(), (A).end()
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main()
{
    ll N, M, K;
    cin >> N >> M >> K;
    vector<ll> A(N), B(M);
    rep(i, N) cin >> A.at(i);
    rep(i, M) cin >> B.at(i);
    vector<ll> SA(N), SB(M);
    rep(i, N)
    {
        if (i == 0)
            SA[0] = A[0];
        else
        {
            SA[i] = A[i] + SA[i - 1];
        }
    }
    rep(i, M)
    {
        if (i == 0)
            SB[0] = B[0];
        else
        {
            SB[i] = B[i] + SB[i - 1];
        }
    }

    ll res = 0;
    auto iter1 = upper_bound(ALL(SA), K);
    ll tmp1 = iter1-1 - SA.begin();//return index
    ll tmpres = 0;

    for (int i = tmp1; i >= -1; i--)
    {
        tmpres = 0;
        ll tmpK = K;
        if(i>=0){
            tmpK = K - SA[i];
            tmpres = i+1;
        }

        auto iter2 = upper_bound(ALL(SB), tmpK);
        int tmp2 = iter2 - SB.begin();
        tmpres += max(0,tmp2);
        res = max(res,tmpres);
        
    }
    cout << res << endl;
}


Measured memory_bytes: 9576
#include <stdio.h>

int get_uint() {
    int n = 0;
    int c = getchar_unlocked();
    if(c < 48 || 57 < c) return c;
    while(47 < c && c < 58) n = 10 * n + (c & 0xf), c = getchar_unlocked();
    return n;
}
void put_uint(int n) {
    if(!n) {
        putchar_unlocked('0');
        return;
    }
    char buf[11];
    int i = 0;
    while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10;
    while(i--)putchar_unlocked(buf[i]);
}

typedef struct Node {
    int edge_to[100];
    int edge_cost[100];
    int edge_size;
    int cost;
    int visited;
} Node;
void dijkstra_noheap(Node *node, const int n) {
    for(int i = 0; i < n; ++i) node[i].cost = -1, node[i].visited = 0;
    node[0].cost = 0;
    while(1) {
        Node *next = NULL;
        for(Node *it = node; it != node + n; ++it) {
            if(it->visited || it->cost < 0) continue;
            if(next == NULL || it->cost < next->cost) next = it;
        }
        if(next == NULL) break;
        next->visited = 1;
        Node u = *next;
        for(int i = 0; i < u.edge_size; ++i) {
            int to = u.edge_to[i];
            int cost = u.cost + u.edge_cost[i];
            if(node[to].cost < 0 || cost < node[to].cost) node[to].cost = cost;
        }
    }
}
int main(int argc, char **argv) {
    int n = get_uint();
    Node node[n];
    for(int i = 0; i < n; ++i) {
        int u = get_uint();
        int k = node[u].edge_size = get_uint();
        for(int j = 0; j < k; ++j) {
            node[u].edge_to[j] = get_uint();
            node[u].edge_cost[j] = get_uint();
        }
    }
    dijkstra_noheap(node, n);
    for(int i = 0; i < n; ++i) put_uint(i), putchar_unlocked(' '), put_uint(node[i].cost), putchar_unlocked('\n');
    return 0;
}



Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll

int t, n, m, k;
char s[1010][1010];
pii src, fin;
bool v[1010][1010];
int d[1010][1010];
vector<int> X={0, 0, 1, -1};
vector<int> Y={1, -1, 0, 0};



int32_t main(){
INIT
cin>>n>>m>>src.ft>>src.sc>>fin.ft>>fin.sc;
for(int i=1; i<=n; i++){
    for(int j=1; j<=m; j++){
        cin>>s[i][j];
    }
}
queue<pii> ac;
ac.push(mp(src.ft, src.sc));
v[src.ft][src.sc]=true;

while( (!ac.empty()) ){
    //while(!fut.empty()){ac.push(fut.front()); fut.pop();}
    queue<pii> r;
    while(!ac.empty()){
        pii f=ac.front();r.push(f); ac.pop(); v[f.ft][f.sc]=true;
        for(int i=0; i<4; i++){
            int y=max(min(f.ft+Y[i], n), (int)1), x=max(min(f.sc+X[i], m), (int)1);
            if( (!v[y][x]) && (s[y][x]=='.' ) ){
                v[y][x]=true;
                d[y][x]=d[f.ft][f.sc];
                ac.push(mp(y, x));
            }
        }
    }

    while(!r.empty()){
        pii f=r.front(); r.pop();
        for(int i=-2; i<=2; i++){
            for(int j=-2; j<=2; j++){
            int y=max(min(f.ft+i, n), (int)1), x=max(min(f.sc+j, m), (int)1);
            if( (!v[y][x]) && (s[y][x]=='.' )  ){
                v[y][x]=true;
                d[y][x]=d[f.ft][f.sc]+1;
                ac.push(mp(y, x));
            }
            }
        }
    }

}
if(!v[fin.ft][fin.sc]){cout<<-1; return 0;}
cout<<d[fin.ft][fin.sc];


return 0;
}





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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

int N,u,v;
vint G[111111];
void dfs(int v,int p,int d,vint &dist){
	dist[v]=d;
	for(auto u:G[v]){
		if(u==p)continue;
		dfs(u,v,d+1,dist);
	}
}
vint distU;
int ans;
void solve(int v,int p,int d){
	int ch=G[v].size();
	if(p!=-1)ch--;

	if(distU[v]<d){
		chmax(ans,d-1);
	}

	for(auto x:G[v]){
		if(x==p)continue;
		solve(x,v,d+1);
	}
}
signed main(){
	scanf("%lld%lld%lld",&N,&u,&v);
	u--;v--;
	rep(i,N-1){
		int a,b;
		scanf("%lld%lld",&a,&b);
		a--;b--;
		G[a].pb(b);G[b].pb(a);
	}

	if(G[u].size()==1&&G[u][0]==v){
		cout<<0<<endl;
		return 0;
	}


	distU.resize(N);
	dfs(u,-1,0,distU);
	solve(v,-1,0);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 11008
#include <iostream>
#include <vector>

using namespace std;

const long long mod = 998244353;

int main() {
  int n = 0;
  cin >> n;
  vector<long long> d(n);
  for (int i=0; i<n; i++) {
    cin >> d.at(i);
  }
  
  if (d.at(0) != 0) {
    cout << 0 << endl;
    return 0;
  }
  
  vector<long long> cnt(n);
  for (int i=0; i<n; i++) {
    cnt.at(d.at(i))++;
  }
  
  long long ans = 1;
  for (int i=1; i<n; i++) {
    if (d.at(i) == 0) {
      ans = 0;
      break;
    } else {
      ans *= cnt.at(d.at(i)-1) % mod;
      ans %= mod;
    }
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;
int aray[10004], gcdForw[10004], gcdBack[10004];
int qpow(int base, int expo) {
    if(expo == 0) return 1;
    if(expo == 1) return base;
    ll v = qpow(base, expo>>1);
    v = (v * v % MOD);
    if(expo&1) v = (v * base % MOD);
    return v;
}
int modinv(ll val) {
    return qpow(val%MOD, MOD-2);
}
int mx[1000006];
signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int N; cin >> N;
    ll lcm = 1;
    rep(i, N) {
        cin >> aray[i];
        int x = aray[i];
        for(int v=2; v*v<=x; v++) {
            if(x%v) continue;
            int cur = 0;
            while(x%v == 0) {
                cur++;
                x /= v;
            }
            mx[v] = max(mx[v], cur);
        }
        if(x != 1) mx[x] = max(mx[x], 1);
    }
    rep(i, 1000006) {
        if(mx[i]) lcm = (lcm * qpow(i, mx[i])) % MOD;
    }
    log(lcm);
    ll su = 0;
    rep(i, N) su = (su + lcm * modinv(aray[i])) % MOD;
    cout << su << endl;
}

Measured memory_bytes: 2944
open Batteries
(* charのカウント *)
let count_char target str =
  let rec count lst =
    match lst with
    | [] -> 0
    | first :: rest -> if first = target then 1 + count rest else count rest
  in let explode s = List.init (String.length s) (String.get s)
  in count @@ explode str

let _ = 
  let d =read_line () |> count_char '9'
  in (if d != 0 then "Yes" else "No") |> print_endline

Measured memory_bytes: 3200
K,A,B = map(int,input().split( ))

#お金に変えてからビスケットに変えるメリットがある場合
if B-A>2:
	b = 1
	K-=A-b
	b = A
	b+=(K//2)*(B-A)
	b+=K-K//2*2




else:
	b = 1+K

print(b)

Measured memory_bytes: 2940