akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head
 
void solve(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << a*b/2 << '\n';
}

int main(void){ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    //int t; cin >> t; while (t--)
        solve();
}

Measured memory_bytes: 3608
"use strict";
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);
function main(){
  var n = o.a();
  var k = o.a();
  var h = o.l().sort((a,b)=>b-a);
  var ans = 0;
  for(var i = k; i < n; i++){
    ans += h[i];
  }
  return ans;
}

Measured memory_bytes: 48412
import sys

N = int(sys.stdin.readline().rstrip())

A = []
for _ in range(N):
    A.append(int(sys.stdin.readline().rstrip()))

odd_set = set()
for i in range(N):
    if i % 2 == 0:
        odd_set.add(A[i])

A.sort()
even_set = set()
for i in range(1, N, 2):
    even_set.add(A[i])
# print(odd_set)
# print(even_set)

print(len(odd_set & even_set))

Measured memory_bytes: 51420
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}


int n;
int a,b;

int main(){
  cin>>n;
  rep(i,n){
    char c;
    cin>>c;
    if(c=='R')
      a++;
    else
      b++;
  }

  if(a>b){
    cout<<"Yes"<<endl;
  }
  else
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  string s;
  cin>>s;
  int a=0;
  int b=0;

  for(int i=0; i<s.size(); i++){
    if(i%2==0){
      if(s[i]!='1'){
        a++;
      }
      if(s[i]!='0'){
        b++;
      }
    }else{
      if(s[i]!='0'){
        a++;
      }
      if(s[i]!='1'){
        b++;
      }
    }
  }
  if(a>=b){
    cout<<b<<endl;
  }else{
    cout<<a<<endl;
  }
  return 0;
}


Measured memory_bytes: 512
import math

def main():
    N = int(input())
    As = list(map(int, input().split()))
    pairwise_flag = True
    setwise_flag = True
    cnt_not1 = 0
    for a in As:
        if a > 1:
            cnt_not1 += 1
    if cnt_not1 > 78498:
        pairwise_flag = False
    
    L = 1000 + 1
    isPrime = [True] * L
    isPrime[0] = isPrime[1] = False
    primes = []
    for n in range(2, L):
        if isPrime[n]:
            primes.append(n)
            isPrime[2*n::n] = [False] * ((L-n-1) // n)

    or_factor = 0
    or_factor_over1000 = set()
    all_gcd = None
    for i, a in enumerate(As):
        digit = 1
        factor = 0
        x = a
        if pairwise_flag:
            for p in primes:
                if p > x:
                    break
                if x % p == 0:
                    factor += digit
                    x //= p

                while x % p == 0:
                    x //= p
                digit <<= 1

        if i > 0:
            all_gcd = math.gcd(all_gcd, a)
            if pairwise_flag:
                if or_factor & factor:
                    pairwise_flag = False
                or_factor |= factor
                if x > 1:
                    if x in or_factor_over1000:
                        pairwise_flag = False
                    or_factor_over1000.add(x)
        else:
            all_gcd = a
            or_factor |= factor
            if x > 1:
                or_factor_over1000.add(x)
    if pairwise_flag:
        print('pairwise coprime')
    elif all_gcd > 1:
        print('not coprime')
    else:
        print('setwise coprime')

main()


Measured memory_bytes: 197544
N, K = gets.split.map(&:to_i)
LR = Array.new K
K.times do |i|
    LR[i] = gets.split.map(&:to_i)
end
LRS = LR.sort_by{|x| x[0]}
MOD=998244353


dp = Array.new N+1
dpSum = Array.new N+1
dp[0] = 0
dp[1] = 1
dpSum[0] = 0
dpSum[1] = 1
2.upto(N) do |n|
    cnt = 0
    LRS.each do |lr|
        l = lr[0]
        break if l > n
        r = lr[1]
        if r > n - 1
            r = n - 1
        end
        if l == r
            cnt += dp[n-l]
        else
            cnt += dpSum[n-l] - dpSum[n-r-1]
        end
    end
    dp[n] = cnt % MOD
    dpSum[n] = (dpSum[n-1] + cnt) % MOD
end

puts dp[N] % MOD

Measured memory_bytes: 17484
var getPools = function(geo) {
  var downside = [];
  var pools = [];
  for (var i = 0; i < geo.length; i += 1) {
    if (geo[i] === '\\') {
      downside.push(i);
    } else if (geo[i] === '/' && downside.length > 0) {
      var d = downside.pop();
      var pool = i - d;
      while (pools.length > 0 && pools[pools.length - 1][0] > d) {
        pool += pools.pop()[1];
      }
      pools.push([d, pool]);
    }
  }
  return pools.length > 0 ? pools.map(function(p) {
    return p[1];
  }) : [];
};

var stdin = require('fs').readFileSync('/dev/stdin', 'utf8');
stdin.split('\n').forEach(function(line) {
  if (line !== '') {
    var geo = line.trim();
    var pools = getPools(geo);
    var total = pools.length > 0 ?
        pools.reduce(function(a, b) { return a + b; }) : 0;
    console.log(total);
    pools.unshift(pools.length);
    console.log(pools.join(' '));
  }
});

Measured memory_bytes: 17336
A, B, K = map(int, input().split())
if K>(B-A)//2:
  for i in range(A, B+1):
    if i-A<K or B-i<K:
      print(i)
else:
  for i in range(A, A+K):
    print(i)
  for i in range(B-K+1, B+1):
    print(i)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(2)<<(x)
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inf std::numeric_limits<int>::max();
#define highest_2_pow(n)  __builtin_clzll((long long)0)- __builtin_clzll((long long)n) - 1
//-----------------------------------------------------------------------------------------------------
#define lli long long int 
#define int long long
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define vi vector<int>
#define vlli vector<long long int>
#define si set<int>
#define slli set<long long int>
#define mt make_tuple
#define mp make_pair
#define eb emplace_back
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
//---------------------------------------------------
using namespace std;
// GCD and LCM are available
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}

void faster(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
void solve(){
    int n,m;
    cin>>n>>m;
    vector<string> A(n);
    vector<string> B(m);
    rep(i,0,n) cin>>A[i];
    rep(i,0,m) cin>>B[i];
    int flag;
    rep(i,0,n-m+1){
        rep(j,0,n-m+1){
            flag=1;
            rep(x,0,m){
                rep(y,0,m){
                    if(A[i+x][j+y]!=B[x][y]){
                        flag=0;
                        break;
                    }
                }
                if(flag==0) break;
            }
            if(flag==1) break;
        }
        if(flag==1) break;
    }
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
signed main()
{
    faster();
    int t=1;
    //cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int[] num = new int[6];
			int t = 0;
			for(int i = 0;i < 6;i++){
				num[i] = scan.nextInt();
				t += num[i];
			}
			if(t == 0){
				break;
			}
			long[] count = new long[3];
			for(int i = 0;i < 6;i+=2){
				t = num[i];
				while(true){
					t %= num[i+1];
					count[i/2]++;
					if(t == 1){
						break;
					}
					t *= num[i];
				}
			}
			long a = count[0]*count[1]/GCD(count[0],count[1]);
			System.out.println(a*count[2]/GCD(a,count[2]));
		}
	}
	
	public static long GCD(long a,long b){
		while(a != 0 && b != 0){
			long t = b;
			b = a;
			a = t % a;
		}
		return (a == 0)?b:a;
	}
}

Measured memory_bytes: 20864
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define ll long long
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
using namespace std;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*(b/gcd(a, b)); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], ll n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
ll keta(ll num){ ll k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    string s, t = "";
    cin >> s;

    int i = 0;
    while(i < s.length()){
        //cout << i << endl;
        if(s[i] == 'A'){
            t += s[i];
        }else if(i > 0 && s[i] == 'B' && s[i+1] == 'C'){
            t += 'X';
            i++;
        }else{
            t += s[i];
        }
        i++;
    }

    ll cnt = 0;
    ll res = 0;
    rep(i, t.length()){
        if(t[i] == 'A'){
            cnt++;
            continue;
        }
        if(t[i] == 'X') res += cnt;
        else cnt = 0;
    }

    //cout << t << endl;
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 916
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>


typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

ll lcm(ll a, ll b) {
	ll c;
	c = a * b / gcd(a, b);
	return c;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const int mod = 1000000007;
struct mint {
	ll x;
	mint(ll x = 0):x(x%mod){}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		res -= a;
	}
	mint operator*(const mint a)const {
		mint res(*this);
		return res *= a;
	}
};

map<string, int> memo;

using P=pair<int, int>;

struct Clock {
	int hour, minute, second;
	void set(int h, int m, int s) {
		hour = h; minute = m; second = s;
	}
	string to_str() {
		string h, m, s;
		h = to_string(hour);
		m= to_string(minute);
		s= to_string(second);
		if (h.size() < 2) h = "0" + h;
		if (m.size() < 2) m = "0" + m;
		if (s.size() < 2) s = "0" + s;
		return h + ":" + m + ":" + s;
	}
	void shift(int diff_second) {
		int h, m;
		h = diff_second / 3600;
		m = diff_second / 60;
		diff_second %= 60;
		second += diff_second;
		
	}
};


/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	rep(i, n)cin >> a[i];
	int ans = 0;
	bool b = true;
	while (b) {
		rep(i, n) {
			if (a[i] % 2 != 0) {
				b = false;
			}
		}
		rep(i, n) {
			a[i] = a[i] / 2;

		}
		if (b)ans++;
	}
	cout << ans;
	return 0;
}










Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

ll f(ll n) {
  vector<ll> ret;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      ret.push_back(i);
      if(i*i != n) {
        ret.push_back(n/i);
      }
    }
  }
  sort(ret.begin(), ret.end());
  ll m = ret.size();
  return m;
}

int main() {
  ll n;
  cin >> n;
  vll v(10000001);
  ll ans = 0LL;
  for(ll i = 1; i<=n; i++) {
    for(ll j = i; j<=n; j+=i) v[j]++;
  }
  for(ll i = 1; i<=n; i++) ans += i*v[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 81400
a, b, h, m = map(int, input().split())

t = h % 12
import math
ts = m / 60
xs = b * math.sin(math.pi*2*ts)
ys = b * math.cos(math.pi*2*ts)
tl = (t*60+m) / (12*60)
xl = a * math.sin(math.pi*2*tl)
yl = a * math.cos(math.pi*2*tl)
print(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.pi*2*(ts-tl))))


Measured memory_bytes: 9580
n, m = map(int, input().split())

h = list(map(int, input().split()))

ans = []

for i in range(m):
    a, b = map(int, input().split())
    if h[a-1] < h[b-1]:
        ans.append(a)
    elif h[b-1] < h[a-1]:
        ans.append(b)
    elif h[a-1] == h[b-1]:
        ans.append(a)
        ans.append(b)
x = set(ans)

print(n-len(x))


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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define FORR(i, a, b) for(int i=(b-1);i>=(a);--i)
#define FORRE(i, a, b) for(int i=(b);i>=(a);--i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define repr(i, n) for(int i=(n-1);i>=0;--i)
#define repre(i, n) for(int i=(n);i>=0;--i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

bool cmp(const pair<string, int> &a, const pair<string, int> &b) {
	if (a.first == b.first) {
		return a.second > b.second;
	} else {
		return a.first < b.first;
	}
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	string s[n];
	int p[n];
	rep(i, n) cin >> s[i] >> p[i];
	
	vector<pair<string, int>> vp;
	rep(i, n) {
		vp.push_back(make_pair(s[i], p[i]));
	}
	
	sort(ALL(vp), cmp);
	
	for (auto &evp: vp) {
		rep(i, n) {
			if (evp.first == s[i] and evp.second == p[i]) {
				cout << i + 1 << endl;
				continue;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace AIPC2020
{
    class A
    {
        static void Main(string[] args)
        {
            //var CA = Enumerable.Repeat(0, (int)N).Select(_ => Console.ReadLine().Split().Select(long.Parse).ToArray()).ToArray();
            var LRd = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //var N = long.Parse(Console.ReadLine());

            var ans = 0;
            for (int i = LRd[0]; i <= LRd[1]; i++)
            {
                if (i % LRd[2] == 0) ans++;
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 28228
#include <bits/stdc++.h>
#define pq priority_queue
using namespace std; typedef pair<int, int> P; typedef pair<int, P> P2; typedef pair<int, P2> P3;
constexpr long long gcd(long long a, long long b){return b ? gcd(b, a % b) : a;}
constexpr long long lcm(long long a, long long b){return a / gcd(a, b) * b;}
constexpr int INF = 1e9, MOD = INF + 7, around[] = {0, 1, 1, -1, -1, 0, -1, 1, 0, 0};
constexpr int mod_pow(long long x, long long n, const int mod){long long ret=1;while(n){if(n&1)(ret*=x)%=mod;(x*=x)%=mod;n>>=1;}return ret;}
template<int n> struct Prime{bool arr[n+1];constexpr bool operator[](int k){return arr[k];}constexpr Prime():arr(){for(int i=2;i<n;i++){arr[i]=true;for(int j=2;j*j<=i;j++){if(!(i%j))arr[i]=false;}}}};
template<int n> struct Factorial{long long arr[n+1],ary[n+1];constexpr Factorial():arr(),ary(){arr[0]=1;ary[0]=1;for(int i=0;i<n;i++){arr[i+1]=arr[i]*(i+1)%MOD;ary[i+1]=mod_pow(arr[i+1],MOD-2,MOD);}}};
constexpr Factorial<1010> fact; constexpr Prime<10> prime;
constexpr long long comb(int a, int b){if(a < b) return 0LL;if(!a or !b) return 1LL; long long pos = fact.arr[a], pot = fact.ary[a - b], por = fact.ary[b]; return pos * pot % MOD * por % MOD;}
template<int n> struct Bernoulli{long long arr[n+1];constexpr Bernoulli():arr(){arr[0]=1;for(int i=1;i<=n;i++){long long sum=0;for(int j=0;j<i;j++){(sum+=comb(i+1,j)*arr[j]%MOD)%=MOD;}arr[i]=(MOD-mod_pow(i+1,MOD-2,MOD))%MOD*sum%MOD;}}};
constexpr int vx[] = {1, 0, -1, 0}, vy[] = {0, 1, 0, -1};
constexpr long double PI = abs(acos(-1));
constexpr int sqrtN = 512, logN = 32;
constexpr long long LINF=1e18;

int main(){
	int n; cin >> n; set<int> st;
	
	for(int i = 0; i < n; i++){
		int a; cin >> a;
		
		if(st.count(a)) st.erase(a);
		else st.insert(a);
	}
	
	cout << st.size() << endl;
	return 0;
}


Measured memory_bytes: 4864
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n;
ll M=(1e5)+1;

//bit全探索
vi bt;
void setbit(ll i){
  bt.clear();
  for(ll tmp=0;i>0;i/=2){
    if (i%2==1) bt.push_back(tmp);
    tmp++;
  }
}




int main(){
  ll ans=0,q;
  cin >>n;
  n++;
  ll nlg=ceil(log2(n));
  vi V(n),W(n);
  REP(i,n-1) cin>>V[i+1]>>W[i+1];

  cin >>q;
  vi u(q),L(q);
  REP(i,q) cin>>u[i]>>L[i];

  //上半分
  ll nhi=nlg-(nlg/2);
  if (nhi==9)nhi=10;
  vvi data(1LL<<nhi, vi(M));  // N * M の2次元配列

  for(ll i=1;i<(1LL<<nhi);i++){
    for(ll j=0;j<M;j++){
      if ((j-W[i])>=0)
      {
        data[i][j]=max(data[i/2][j-W[i]]+V[i],data[i/2][j]);
      }
      else
      {
        data[i][j]=data[i/2][j];
      }
    }
  }


int uiv[10];
int wuiv=0;


//下半分
for(ll loop=0;loop<q;loop++){
  ll uidx=u[loop];
  if (uidx<(1LL<<nhi)){
    cout<<data[uidx][L[loop]]<<endl;
  }else{//上＋下
    ll maxval=0;
    //vi uiv;
    int nn=0;
    wuiv=0;
    for(;;uidx/=2){
      if (uidx<(1LL<<nhi))break;
      uiv[wuiv]=uidx;
      wuiv++;
      nn++;
    }

    int bn=1<<nn;
    for(int i=0;i<bn;i++){
      //setbit(i);
      ll tmpw=0;
      ll tmpv=0;
      for(int j=0;j<nn;j++){
        if (i&(1<<j)){
          tmpv+=V[uiv[j]];
          tmpw+=W[uiv[j]];
        }
      }
      //for (auto j : bt) {
        //tmpv+=V[uiv[j]];
        //tmpw+=W[uiv[j]];
      //}
      if (tmpw<=L[loop]){
        maxval=max(data[uidx][L[loop]-tmpw]+tmpv,maxval);
      }
    }

    cout<<maxval<<endl;
  }












}


  return 0;
}

Measured memory_bytes: 408084
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
	int n, m;
	cin >> n;
	int* A = new int[n];
	
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}

	cin >> m;
	int* B = new int[m];

	for (int i = 0; i < m; i++) {
		cin >> B[i];
	}

	cout << includes(A, A + n, B, B + m) << endl;
   
}


Measured memory_bytes: 4652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

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

  if(n == 100) n++;
  int ans = n * pow(100, d);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
//...Bismillahir Rahmanir Rahim...
// Code by    Asad Bin Saber

#include <bits/stdc++.h>

using namespace std;

// typedefs...
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;

// constants...
const double PI = acos(-1);

// defines...
#define MP make_pair
#define PB push_back
#define fi first
#define se second
#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sl(a) scanf("%lld", &a)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)

// chess moves...
// int dx[] = {+0, +0, -1, +1}; ///Up-down, Left-Right
// int dy[] = {+1, -1, +0, +0};
// int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's Move
// int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1};
// int dx[] = {-2, -2, -1, -1,  1,  1,  2,  2}; ///Knight's Move
// int dy[] = {-1,  1, -2,  2, -2,  2, -1,  1};

// structs...
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
}; 

// functions...
ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
ll lcm(ll a, ll b)
{
    return (a/gcd(a, b)*b);
}
ll comb(ll a, ll b)
{
    ll x = max(a-b, b), ans=1;

    for(ll K=a, L=1; K>=x+1; K--, L++){
        ans *= K;
        ans /= L;
    }

    return ans;
}


int n, m, ara[11], ans=0;
vector<pair<pii, pii> > save;
void calc(int i, int k)
{
	if(i==n+1){
		int tot, mid = 0;
		for(int K=0; K<(int)save.size(); K++){
			tot = ara[save[K].fi.se] - ara[save[K].fi.fi];
			if(tot==save[K].se.fi) mid += save[K].se.se;
		}
		
		ans = max(ans, mid);
		return;
	}
	
	for(int K=k; K<=m; K++){
		ara[i] = K;
		calc(i+1, K);
	}
}
void task()
{
    //code here...
    
    int q, a, b, c, d;
    
    cin >> n >> m >> q;
    
    while(q--){
		cin >> a >> b >> c >> d;
		save.PB(MP(MP(a, b), MP(c, d)));
	}
    
    calc(0, 1);
    
    cout << ans << "\n";
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    task();

    return 0;
}



Measured memory_bytes: 3624
N = int(input())
t0, x0, y0 = 0, 0, 0
flg = True
for i in range(N):
  t, x, y = input().split()
  t, x, y = int(t),int(x),int(y)
  dt = t - t0
  dx = abs(x - x0)
  dy = abs(y - y0)
  if dx + dy > dt or (dt + dx + dy) % 2 != 0:
    flg = False
    break
print("Yes" if flg else "No")


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)

int x, y, z;
int main()
{
	cin >> x >> y >> z;
	
	int cnt = 0;
	x -= z;
	while (x - y - z >= 0) {
		x -= y;
		x -= z;
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
 
#define coutv(v) for (int i = 0; i < (v).size(); ++i) cout << v[i] << ' '; cout << endl;
#define coutvv(v) for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cout << v[i][j] << ' '; cout << endl;}
#define debugv(v) {for (int i = 0; i < (v).size(); ++i) cerr << v[i] << ' '; cerr << endl;}
#define debugvv(v) {for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cerr << v[i][j] << ' '; cerr << endl;}}
#define TC int TESTCASE; cin >> TESTCASE; while (TESTCASE--)
typedef long long ll;






int main() {
	int l,r,n;
	cin >> l >> r >> n;
	int cnt = 0;
	for (int i = l; i <= r; ++i)
	{
		if (i % n == 0) {
			cnt += 1;
		}
	}
	cout << cnt;
}
 


Measured memory_bytes: 3552
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>
#include <iomanip>
#include <map>
#include <set>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(nullptr);
#define fix(n) fixed << setprecision(n)
#define ALL(v) v.begin(),v.end()

#define PI 3.14159265358979323846;

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;


int main(void){
    FAST_IO
    ll k,x;
    cin >> k >> x;
    if(k * 500 >= x){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3136
#include <iostream>
#include<math.h>
using namespace std;

int main() {
	int n,i,j;
	bool flag=false;
	char a;
	cin>>n;
	int s[n];
	int ord[4][n];
	for(i=0;i<4;i++){
		ord[i][0]=i/2;
		ord[i][1]=i%2;
	}
	
	for(i=0;i<n;i++){
		cin>>a;
		if(a=='o'){
			s[i]=0;
		}
		else{
			s[i]=1;
		}
	}
	
	for(i=0;i<4;i++){
		for(j=1;j<n-1;j++){
			ord[i][j+1]=(ord[i][j-1]+ord[i][j]+s[j])%2;
		}
	}
	
	
	for(i=0;i<4;i++){
		if((ord[i][0]+ord[i][n-2]+ord[i][n-1]+s[n-1])%2+(ord[i][1]+ord[i][n-1]+ord[i][0]+s[0])%2==0){
			flag=true;
			goto next;
		}
	}
	
	next:
	
	if(flag){
		for(j=0;j<n;j++){
			if(ord[i][j])cout<<"W";
			else{
				cout<<"S";
			}
		}
	}
	else{
		cout<<-1;
	}
}

Measured memory_bytes: 2304
//# define FLAG
///delet....................................
# include   <bits/stdc++.h>
using namespace std;
# define    pb                      push_back
# define    mp                      make_pair
# define    IOS                     ios::sync_with_stdio(false)
# define    mem(a,b)                memset(a,b,sizeof(a))
# define    FO(i,n,a)               for(int i=n; i>=a; --i)
# define    FOR(i,a,n)              for(int i=a; i<=n; ++i)
# define    MAX(a,b)                (a)>(b)?(a):(b)
# define    MIN(a,b)                (a)<(b)?(a):(b)
# define    LINF                    0xfcfcfcfcfcfcfcf
# define    INF                     0x3f3f3f3f
# define    MOD                     1000000007
# define    eps                     0.00000001
# define    pi                      3.141592653
# define    ee                      2.718281828459
# define    hr                      putchar('\n')
# define    kb                      putchar(' ')
# define    bug                     puts("H");
# pragma    comment(linker,"/STACK:1024000000,1024000000")
typedef     vector<int>             VI;
typedef     long long               LL;
typedef     unsigned long long      ULL;
inline char gtc() {
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
# define    Template                int
inline Template read() {
    int flag=1;
    char ch=gtc();
    if(ch==EOF)return EOF;
    Template sum=0;
    while(!((ch>='0'&&ch<='9')||ch=='-'))ch=gtc();
    if(ch=='-')flag=-1,ch=gtc();
    while(ch>='0'&&ch<='9')sum=sum*10+ch-'0',ch=gtc();
    return sum*flag;
}
inline void out(Template x) {
    if(x<0)putchar('-'),x=-x;
    if(x>9)out(x/10);
    putchar(x%10+'0');
}
///coding...................................

int main() {
    IOS;
#ifdef FLAG
    //freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif
    string a;
    cin>>a;
    if(a[0]=='Y'&&a[1]=='A'&&a[2]=='K'&&a[3]=='I')puts("Yes");
    else puts("No");
    return 0;
}










///delete FLAG..............................




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include<bits/stdc++.h>
using namespace std;
typedef     long long    ll;
typedef     vector<int> vi;
typedef     vector<long long> vl;
typedef     pair<int, int>pi;
typedef     pair<long long, long long>pl;
#define F   first
#define S   second
#define pb  push_back
#define     all(x)      x.begin() , x.end()
#define mp  make_pair
#define       FOR(i,a,b) for(i=a;i<=b;i++)
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)
int main()
{

  int t;
  t = 1;
  //cin >> t;
  while (t--)
  {
     ll l,n,x,t,ans=0;
     cin>>n>>x>>t;
    l=ceil(double((n*1.00)/x));
    ans=l*t;
    cout<<ans<<endl;

  }
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;

int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int a,b,t; cin>>a>>b>>t;
	int ans=(t+0.5)/(a);
	ans=ans*b;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int y, m, d;
  char a, b;
  cin >> y >> a >> m >> b >> d;
  if(m<=4) {
    cout << "Heisei";
  }
  else {
    cout << "TBD";
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll dp[3010][6010][2];

int main(){
  clr(dp,-1);
  ll n,T;
  cin>>n>>T;
  vector<ll> va,vb;
  rep(i,0,n){
    ll a,b;
    cin>>a>>b;
    va.pb(a);
    vb.pb(b);
  }
  dp[0][0][0] = 0;
  rep(i,0,va.sz){
    ll a = va[i];
    ll b = vb[i];
    rep(j,0,6010){
      if(dp[i][j][0]!=-1)dp[i+1][j][0] = max(dp[i+1][j][0],dp[i][j][0]);
      if(dp[i][j][1]!=-1)dp[i+1][j][1] = max(dp[i+1][j][1],dp[i][j][1]);
      if(j<T){
        if(dp[i][j][0]!=-1){
          dp[i+1][j+a][0] = max(dp[i+1][j+a][0],dp[i][j][0]+b);
        }
      }
      if(j<T){
         if(dp[i][j][0]!=-1){
          dp[i+1][j][1] = max(dp[i+1][j][1],dp[i][j][0]+b);
        }
      }
      if(j+a<T){
        if(dp[i][j][1]!=-1){
          dp[i+1][j+a][1] = max(dp[i+1][j+a][1],dp[i][j][1]+b);
        }
      }
    }
  }
  ll mx = 0;
  rep(i,0,6010){
    mx = max(mx,dp[n][i][0]);
    mx = max(mx,dp[n][i][1]);
  }
  cout << mx << endl;
  return 0;
}

Measured memory_bytes: 283008
#include<bits/stdc++.h>
using namespace std;
int dp[2005][2005];
void solve(int n,int x,int y)
{
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++)
				dp[i][j]=abs(i-j);

}
int main()
{
	int n,x,y;
	cin>>n>>x>>y;
	solve(n,x,y);
	int ar[n]={0};
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
			dp[i][j]=min(dp[i][j],min(dp[i][x]+dp[y][j],dp[i][y]+dp[x][j])+1);
			ar[dp[i][j]]++;
		}
	for(int i=1;i<n;i++)
		cout<<ar[i]/2<<endl;
	
}

Measured memory_bytes: 15872
#include<stdio.h>
#include<math.h>
 
 
int main(){
 
  int n, i;
  double x[100], y[100],s[100], max=0, d1=0, d2=0, d3=0,d22,d33;
  scanf("%d", &n);
  for(i=0;i<n;i++) scanf("%lf", &x[i]);
  for(i=0;i<n;i++) scanf("%lf", &y[i]);
 
  for(i=0;i<n;i++){
    s[i]=fabs(x[i]-y[i]);

    d1+=s[i];
    d2+=pow(s[i], 2);
    d3+=pow(s[i], 3);
    if(max<s[i]) max=s[i];
  }
  d22=pow(d2,0.5);
 d33=cbrt(d3);

  printf("%f\n%f\n%f\n%f\n", d1, d22, d33, max);
 
  return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define rrep(n,i) for(int i = n-1; i>=0; --i)
#define PI 3.14159265
#define INF 1e9
using namespace std;
using ll = long long;
void self_max(int &a,int b){
	a = max(a,b);
}
void self_min(int &a,int b){
	a = min(a,b);
}

int main(){
	int n; cin >>n;
	vector<vector<int>> arr(n,vector<int> (3));
	rep(i,n) rep(j,3){
		cin >> arr[i][j];
	}

	vector<vector<ll>> dp(n,vector<ll> (3));
	rep(i,n){
		rep(j,3){
			if(i==0) dp[i][j] = arr[i][j];
			else{
				ll pre = INT_MIN;
				for(int k = 0; k<3;k++){
					if(k==j) continue;
					pre = max(pre,dp[i-1][k]);
				} 
				dp[i][j] = pre+ arr[i][j];
			}
		}
	}

	ll ans = INT_MIN;
	rep(j,3) ans = max(ans,dp[n-1][j]);
	cout << ans << endl;

	return 0;
}

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

using namespace std;

long long l,t,a[200000],dir[200000];

int main(){
  //printf("%d",-1/5);
  int n;
  scanf("%d%lld%lld",&n,&l,&t);
  for(int i=0;i<n;i++){
    scanf("%lld%lld",&a[i],&dir[i]);
    if(dir[i]==2)
      dir[i]=-1;
  }
  long long shift = 0;
  for(int i=0;i<n;i++){
    a[i]+=t*(dir[i]);
    shift+=(a[i]/l)-(a[i]%l<0);
    a[i]%=l;
    a[i]+=l;
    a[i]%=l;
    shift%=n;
    shift+=n;
    shift%=n;
  }
  shift%=n;
  shift+=n;
  shift%=n;
  sort(a,a+n);
  for(int i=0;i<n;i++){
      printf("%lld\n",a[(shift+i)%n]);
  }
}

Measured memory_bytes: 2688
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int dp[110][100020];
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, W;
    cin >> N >> W;
    int w[110], v[110];
    rep(i, N) cin >> w[i] >> v[i];
    rep(i, 110) rep(j, 100010) dp[i][j] = INF;
    dp[0][0] = 0;
    rep(i, N) {
        RREP(j, 100000, 0) {
            dp[i + 1][j] = dp[i][j];
            if(j - v[i] >= 0)
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
        }
    }
    int ans = 0;
    rep(i, N + 1) {
        rep(j, 100010) {
            if(dp[i][j] <= W) ans = max(ans, j);
        }
    }
    cout << ans << endl;


    return 0;
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll K, N;
  IN(N,K);
  vll p(N);
  REP(i,N) IN(p[i]);
  sort(ALL(p));
  ll ans = 0;
  REP(i,K) ans+=p[i];
  OUT(ans);

  return 0;
}


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

public class Main {
    static final String YES = "YES";
    static final String NO = "NO";

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        long[] A = new long[(int)(N)];
        for(int i = 0 ; i < N ; i++){
                A[i] = sc.nextLong();
        }

        final Solver solver = new Solver();
        solver.solve(N, A);
    }
}

class Solver {
    public void solve(long N, long[] A) {
        TreeSet set = new TreeSet<>();
        for (int i = 0; i < N; i++) {
            set.add(A[i]);
        }
        System.out.println(set.size() == A.length ? "YES" : "NO");
    }
}



Measured memory_bytes: 97776
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

using Edge = tuple<int, int>;
using Elem = tuple<ll, int>;

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

    int n; cin >> n;
    vector<vector<Edge>> G(n);
    rep(loop, n - 1){
        int a, b, c; cin >> a >> b >> c;
        a--, b--;
        G[a].emplace_back(Edge(b, c));
        G[b].emplace_back(Edge(a, c));
    }

    int Q, K; cin >> Q >> K; K--;
    queue<int> q; q.push(K);
    vll dist(n, inf); dist[K] = 0;
    while(q.size()){
        int v = q.front();
        q.pop();
        for(auto& e : G[v]){
            int nv, c; tie(nv, c) = e;
            if(dist[nv] != inf) continue;
            dist[nv] = dist[v] + c;
            q.push(nv);
        }
    }

    rep(i, Q){
        int a, b; cin >> a >> b; a--, b--;
        cout << dist[a] + dist[b] << endl;
    }

    return 0;
}


Measured memory_bytes: 9856
while 1:
    X,Y = map(int,raw_input().split())
    if X == 0: break
    A = [[0]+map(int,raw_input().split())+[0] for i in range(Y)]
    S = [[0]*(X+2) for i in range(Y)]
    for x in range(1,X+1): S[0][x] = 1 if A[0][x] == 0 else 0
    for y in range(1,Y):
        for x in range(1,X+1):
            if A[y][x] == 0:
                for i in range(-1,2):
                    S[y][x] += S[y-1][x-i] if A[y-1][x-i] == 0 else 0
            if A[y][x] == 2:
                S[y][x] += S[y-1][x] if A[y-1][x] == 0 else 0
                if y+2 < Y and A[y+2][x] != 1:
                    S[y+2][x] = S[y][x]
    ans = 0
    for x in range(1,X+1):
        ans += S[Y-1][x] + (S[Y-2][x] if A[Y-2][x] == 2 else 0)
    print ans

Measured memory_bytes: 6492
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

ll dp[110][4][2];

int main() {
  string s; cin >> s;
  int K; cin >> K;
  int n=s.size();
  dp[0][0][0]=1ll;
  rep(i,n)rep(j,K+1)rep(k,2){
    int nd=s[i]-'0';
    rep(d,10){
      int ni=i+1,nj=j,nk=k;
      if(d!=0) nj++;
      if(nj>K) continue;
      if(k==0){
        if(d>nd) continue;
        if(d<nd) nk=1;
      }
      dp[ni][nj][nk]+=dp[i][j][k];
    }
  }
  ll ans=dp[n][K][0]+dp[n][K][1];
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

int main(){
	int n,p;
	int have[50];
	while(true){
		cin >> n >> p;
		if(n==0 && p==0) break;
		for(int i=0;i<n;i++) have[i]=0;
		int turn=0;
	    int cnt=p;
		while(true){
			if(cnt>0){
				cnt--;
				have[turn%n]++;
				if(have[turn%n]==p){
					cout << turn%n << endl;
					break;
				}

			}
			else{
					cnt =have[turn%n];
					have[turn%n]=0;
				}
			turn++;

		}

	}
}


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

int main() {
    int n, m;
    while(~scanf("%d %d", &n, &m)) {
        if(n <= m) cout << n << endl;
        else cout << n - 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
 
int main(){
    double N,M,A=0,b,c=0;
    cin >> N >>M;
   
 for(int i=1;i<=N;i++){
     A=1/N;
     b=i;
    while(b<M){
        b*=2;
        A/=2;
    }
    c+=A;
 }

printf("%.12f",c);
}

Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

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

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInt2() (int, int) {
	return nextInt(), nextInt()
}

func nextInt3() (int, int, int) {
	return nextInt(), nextInt(), nextInt()
}

func nextInt4() (int, int, int, int) {
	return nextInt(), nextInt(), nextInt(), nextInt()
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()
	var s string
	switch n % 10 {
	case 2, 4, 5, 7, 9:
		s = "hon"
	case 0, 1, 6, 8:
		s = "pon"
	case 3:
		s = "bon"
	}
	puts(s)
}


Measured memory_bytes: 1764