akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
#define debug(x) cerr << #x << ":" << x << endl

namespace atcoder {
	void judge_outer(bool judge_exp, string ok = "Yes", string ng = "No") {
		if (judge_exp) {
			cout << ok << endl;
		}
		else {
			cout << ng << endl;
		}
	}

	template<typename T>
	T ncr(T left, T right) {
		right = min(left - right, right);
		T ans = 1;
		for (T i = 1; i <= right; i++) {
			ans = ans * (left - right + i) / i;
		}
		return ans;
	}

	const int LIMIT = 1000000007;
	const int tenfive = 100000;


}

using namespace atcoder;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a;
	cin >> a;
	if (a == 7 || a == 5 || a == 3) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>
#include <bitset>

using namespace std;

typedef pair<long long int, long long int> P;
typedef pair<long long int, P> P2;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

long long int pow_n(long long int num, long long int pow_num){
	long long int mod_num = MOD;
	long long int pow_cur = num;
	long long int ret = 1;
	while(pow_num > 0){
		if(pow_num % 2 == 1){
			ret *= pow_cur;
			ret %= mod_num;
		}
		pow_cur *= pow_cur;
		pow_cur %= mod_num;
		pow_num /= 2;
	}
	return ret;
}

int main(){
	long long int N, P;
	cin >> N >> P;
	MOD = P;
	string S;
	cin >> S;
	long long int ans = 0;
	if(P == 2 || P == 5){
		for(int i = 0; i < N; i++){
			if((S[i] - '0') % P == 0){
				ans += i + 1;
			}
		}
		cout << ans << endl;
		return 0;
	}
	map<long long int, long long int> m;
	long long int cur = 0;
	m[0] = 1;
	for(int i = N - 1; i >= 0; i--){
		cur += (S[i] - '0') * pow_n(10, N - 1 - i);
		cur %= P;
		ans += m[cur];
		m[cur] += 1;
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
    double a,b,c,y,s;

    cin >> a;
    cin >> b;
    cin >> c;

    s = (a+b+c)/2;

    y = sqrt(s*(s-a)*(s-b)*(s-c));


   
   cout << y << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
//#include<bits/extc++.h>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> set_t;
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pdd pair<double,double>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi acos(-1)
#define index Index
#define Line pll
typedef long long LL;
LL dp[405][405];
LL a[405];
LL DP(int l,int r){
    if(l==r)return 0;
    if(dp[l][r]!=-1)return dp[l][r];
    dp[l][r]=1e18;
    LL sum=0;
    for(int i=l;i<r;i++){
        sum+=a[i];
        dp[l][r]=min(dp[l][r],DP(l,i)+DP(i+1,r));
    }
    sum+=a[r];
    return dp[l][r]=dp[l][r]+sum;
}
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
    }
    MEMS(dp);
    printf("%lld\n",DP(1,n));
}


Measured memory_bytes: 1664
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney,chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun


#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")


int main() {
	
	int N;
	int R;
	cin >> N >> R;
	if (N >= 10) PRI(R);
	else PRI(R + 100 * (10 - N));
	
	return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a,b,d,r;
    double f;
    scanf("%d %d",&a,&b);
    d = a/b;
    r = a%b;
    f = (double)a/b;
    printf("%d %d %lf\n",d,r,f);
    
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

vector<ll> d;
ll n,k;

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

	cin >> n >> k;

	ll a[1005];
	ll sum[1005];

	sum[0] = 0;

	for (ll i = 1;i <= n;i++){
		cin >> a[i];
		sum[i] = sum[i-1]+a[i];
	}

	for (ll i = 1;i <= n;i++){
		for (ll j = i;j <= n;j++){
			ll tmp = sum[j] - sum[i-1];
			//cout << tmp << endl;
			d.push_back(tmp);
		}
	}

	sort(d.begin(),d.end());
	reverse(d.begin(),d.end());

	for (ll i = 50;i >= 0;i--){
		ll cnt = 0;
		vector<ll> nex;
		for (ll j = 0;j < d.size();j++){
			//cout << d[j] << "d" << i << "i" << endl; 
			if((d[j]>>i)&1){cnt++; nex.push_back(d[j]);}
		}
		if(cnt >= k) d = nex;
	}

	ll ans = d[0];

	for (int i = 1;i < k;i++){
		ans = (ans&d[i]);
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 6384
#include <bits/stdc++.h>
#include <map>
#include <algorithm> 
#include <vector> 
#include <string.h> 
#include <math.h> 
#include <stdio.h> 
#include <stdlib.h> 
#include <chrono> 
#include <thread> 
#include <iomanip>
#include <typeinfo>
 
//define
#define trav(i,v)   for(auto i: v)
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define all(v)  v.begin(), v.end()
#define itn int 

//typedef
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const long long MOD = 1000000007;
// const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;

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

void solve()
{
    int a, b, c;
    cin>>a>>b>>c;
    int k;
    cin>>k;
    int d=0;
    while(b<=a)
    {
        b*=2;
        d++;
    }
    while(c<=b)
    {
        c*=2;
        d++;
    }
    if(d<=k)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1, tt=1;
    // cin>>t;
    while(tt<=t)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
        tt++;
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}   

Measured memory_bytes: 3796
/*================================================
# ~  file:B.cpp
# ~~ date:2020-03-14
# ~~~author: SoMnus_L
#        |everybody finds love,in the end|
#   人の運命か,人の希望は悲しみにつづられているね
=================================================*/

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define ll long long
const int N=1e6+10;
using namespace std;
typedef pair<int,int>PII;

ll n,m,ans;

int main(){
 ios::sync_with_stdio(false);
   cin>>n>>m;
   if(n==1 || m==1) ans=1;
   else if(n%2==0)
     ans=((n+1)/2)*m;
   else 
     ans=((n+1)/2)*m-m/2;
    cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
s = int(input())
a = [s]
i = 2
while True:
  n = a[-1]
  ai = n // 2 if n % 2 == 0 else 3 * n + 1
  if ai in a:
    print(i)
    break
  else:
    i += 1
    a.append(ai)

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

int main(){
  int N;
  cin >> N;
  int sum = 0;
  
  for (int i = 1; i <= N; i++) {
    sum += i;
  }
  
  cout << sum << endl;
  
  
  return 0;
}
    
    
    

Measured memory_bytes: 256
using System;
class ProgramB
    {
        static void Main(string[] args)
        {
            
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            b -= 1;
            a -= 1;

            if(b % a == 0)
                Console.WriteLine(b / a);
            else
                Console.WriteLine(b / a + 1);
        }
    }

Measured memory_bytes: 13140
N = int(input())
A = list(map(int, input().split()))
judge = [0] * N
a = 0
ans = 0
count = 0
for i in A:
  if i > a:
    a = i
    count = count + 1
    continue
  else:
    ans = ans + (a - i)
print(ans)

Measured memory_bytes: 94284
lines = readlines.map{|line| line.split(' ').map(&:to_i)}
a=0
for i in 0..lines[0][0]-1
  a=a+lines[2][lines[1][i]-1]
  if lines[1][i]+1==lines[1][i+1] then
    a=a+lines[3][lines[1][i]-1]
  end
end
puts a

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<int,int>;
typedef unsigned long long ull;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF=1e18;
const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  ll n,k;
  cin >> n >> k;
  if(n==k ||n==0){
    cout << 0<< endl;
    return 0;
  }
  else if(n>k){
    ll c=(n-k+1)/k+1;
    cout << min({n,abs(n-c*k),abs(n-(c+1)*k),abs(n-(c-1)*k)}) << endl;
  }
  else{
    n=abs(n-k);
    ll c=(n-k+1)/k+1;
    cout << min({n,abs(n-c*k),abs(n-(c+1)*k),abs(n-(c-1)*k)}) << endl;
  }
  
}


Measured memory_bytes: 256
N = int(input())
n_list = list(map(int,input().split()))

n_list.sort()

new_list = []
ctr = 0

while len(n_list) > 1:
  n_list[ctr] = (n_list[ctr] + n_list[ctr+1])/2
  n_list.pop(ctr + 1)
  n_list.sort
  
print(n_list[0])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
/* #define int long long */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main(){
    int h, w, n;
    cin >> h >> w >> n;
    vector<int> hs(h), ws(w);
    set<P> s;
    rep(i, n){
        int r, c;
        cin >> r >> c;
        --r; --c;
        hs[r]++;
        ws[c]++;
        s.emplace(r, c);
    }
    int mh = 0, mw = 0;
    rep(i, h) chmax(mh, hs[i]);
    rep(i, w) chmax(mw, ws[i]);
    vector<int> is, js;
    rep(i, h) if(mh == hs[i]) is.push_back(i);
    rep(i, w) if(mw == ws[i]) js.push_back(i);
    int ans = mh+mw;
    for(int i : is) for(int j : js){
        if(s.count(P(i, j))) continue;
        cout << ans << endl;
        return 0;
    }
    --ans;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 23784
#include <bits/stdc++.h>
#define LL long long
using namespace std;

const int N = 1e5;

int n,k,cnt0 = 0;
LL a[N+10];

int main()
{
    ios::sync_with_stdio(0),cin.tie(0);
    cin >> n >> k;
    for (int i = 1;i <= n;i++){
        cin >> a[i];
        if (a[i]==0) cnt0++;
    }
    if(k==1&&cnt0){cout<<"0\n";return 0;}
    if (cnt0==0) a[++n] = 0;
    sort(a+1,a+1+n);
    int idx = 1;
    for (int i = 1;i <= n;i++) if (a[i]==0) idx = i;
    LL ans = 1e18;
    for (int i = 1;i <= n;i++){
        LL temp = 0;
        int cnt = 0;
        temp = temp + abs(a[idx]-a[i]);
        cnt+=abs(idx-i);
        if (cnt0) cnt++;
        if (cnt>k) continue;
        if (cnt==k){
            ans = min(ans,temp);
            continue;
        }
        if (i<idx){
            if (idx+k-cnt<=n){
                temp = temp + 2*abs(a[idx+k-cnt]-a[idx]);
                ans = min(ans,temp);
            }else continue;
        }else{
            if (idx-(k-cnt)>=1){
                temp = temp + 2*abs(a[idx]-a[idx-(k-cnt)]);
                ans = min(ans,temp);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>

using namespace std;

int main(){
	int x,y;
	while(cin>>x>>y){
		vector<int> v(102);
		while(x||y){
			v[x] = !v[x]; v[y] = !v[y];
			cin>>x>>y;
		}
		int a = accumulate(v.begin(),v.end(),0);
		if(a == 2 && v[1] == 1 && v[2] == 1)
			puts("OK");
		else 
			puts("NG");
	}
    return 0;
}

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

int main() {
	long long n;
	cin >> n;
	vector<long long> ans(5,0);
	vector<string> arr;
	for(long long i=0;i<n;i++){
		string a;
		cin>>a;
		if(a.at(0)=='M'){
			ans.at(0)++;
		}else if(a.at(0)=='A'){
			ans.at(1)++;
		}else if(a.at(0)=='R'){
			ans.at(2)++;
		}
		else if(a.at(0)=='C'){
			ans.at(3)++;
		}
		else if(a.at(0)=='H'){
			ans.at(4)++;
		}
		arr.push_back(a);
	}long long f=0;
	for(int i=0;i<3;i++){
		for(int j=i+1;j<4;j++){
			for(int k=j+1;k<5;k++){
					f+=ans[i]*ans[j]*ans[k];
				}
			}
	}
	cout<<f;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;

int main(void)
{
        ll n,m;
        cin >> n >> m;
        if(abs(n-m) > 1){
                cout << 0 << endl;
                return 0;
        }

        ll rn;
        ll temp = n;
        for(ll i = n-1; i >= 1; i--)
                temp = (temp*i) % 1000000007LL;
        rn = temp;

        ll rm;
        temp = m;
        for(ll i = m-1; i >= 1; i--)
                temp = (temp*i) % 1000000007LL;
        rm = temp;

        if(n == m) cout << (rn * rm * 2) % 1000000007LL << endl;
        else cout << (rn * rm) % 1000000007LL << endl;



        return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
int main() 
{
 
int n,a,b;
cin>>n>>a>>b;
if((n*a)>=(b))
cout<<b;
else
cout<<(n*a);
return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define endl              "\n"
#define pb              push_back
#define fir               first
#define sec               second
#define all(v)            ((v).begin()), ((v).end())
#define sz(v)            ((int)((v).size()))
#define ll              long long
#define ld              long double
#define lp(i, n)        for(int i = 0 ; (int)i<n ; i++)
#define loop(i, x, n)       for(int i=x ; (int)i<=n ; i++)
#define isPowerOfTwo(s) (!(s & (s-1)))
typedef vector<int> vi;
typedef deque<int> de;
void origi() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
}
void tiranga() {
    int n, arr[200000], cur = 0, del = 0;
    bool flag = false;
    cin >> n;
    lp(i, n) {
        cin >> arr[i];
        if (arr[i] == 1)
            flag = true;
    }
    if (!flag)
        cout << -1;
    else {
        lp(i, n) {
            if (arr[i] != cur + 1) del++;
            else cur++;
        }
        cout << del;
    }
}
int main() {
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
#else
#endif 
    origi();
    tiranga();
   
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

#define itn long long
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)(n);i>=0;--i)
#define debug(x) cout << #x << "=" << (x) << endl;
const ll MOD=1e9+7;

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> void fail(T v){cout << v << endl;exit(0);}
//template end

void solve(){
  const int N=(int)1e6+1;
  vector<int> sum;
  sum.push_back(1);int s=1;
  while(sum.back()<=N){
    s+=sum.size()+1;
    sum.push_back(s+sum.back());
  }
  vector<int> dp(N,1<<29);dp[0]=0;
  rep(i,sum.size()){
    for(int j=0;j+sum[i]<N;j++)
      chmin(dp[j+sum[i]],dp[j]+1);
  }
  vector<int> odd(N,1<<29);odd[0]=0;
  rep(i,sum.size()){
    if(sum[i]%2==0)continue;
    for(int j=0;j+sum[i]<N;j++)
      chmin(odd[j+sum[i]],odd[j]+1);
  }
  while(1){
    int n;
    cin>>n;
    if(!n)return;
    cout<<dp[n]<<" "<<odd[n]<<endl;
  }
}
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  solve();
  return 0;
}


Measured memory_bytes: 10568
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 

int main(void){
    ll n,L;
    cin>>n>>L;
    vector<ll>a(n);
    for(ll i=0;i<n;i++)cin>>a[i];
    bool flag = true;
    int finish = 1;
    for(ll i=0;i<n-1;i++){
        if(a[i]+a[i+1]>=L){
            flag = false;
            finish = i+1;
        }
    }
    if(flag)cout<<"Impossible"<<endl;
    else{
        cout<<"Possible"<<endl;
        for(int i=1;i<finish;i++)cout<<i<<endl;
        for(int i=n-1;i>=finish;i--)cout<<i<<endl;
    }
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

string s, t, res;
int DP[3001][3001];

void dfs(int x, int y) {
	if (DP[x][y]) {
		if (DP[x - 1][y] == DP[x][y])
			dfs(x - 1, y);
		else if (DP[x][y - 1] == DP[x][y])
			dfs(x, y - 1);
		else {
			res += s[x - 1];
			dfs(x - 1, y - 1);
		}
	}
}

int main() {
	cin >> s >> t;
	for (int i = 0; i != s.size(); ++i) {
		for (int j = 0; j != t.size(); ++j) {
			if (s[i] == t[j])
				DP[i + 1][j + 1] = max({ DP[i][j + 1],DP[i + 1][j],DP[i][j] + 1 });
			else
				DP[i + 1][j + 1] = max(DP[i][j + 1],DP[i + 1][j]);
		}
	}
	dfs(s.size(), t.size());
	reverse(res.begin(), res.end());
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 35456
#include <iostream>                                                                                                               
#include <vector>                                                                                                                 
using namespace std;                                                                                                              
                                                                                                                                  
int main(void) {                                                                                                                  
  int x;                                                                                                                          
  vector<int> Case;                                                                                                               
  while (true) {                                                                                                                  
    cin >> x;                                                                                                                     
    if (x==0) {                                                                                                                   
      break;                                                                                                                      
    }                                                                                                                             
    Case.push_back(x);                                                                                                            
  }                                                                                                                               
  for (int i=0; i<Case.size(); i++) {                                                                                             
    cout << "Case" << " " << i+1 << ":" << " " << Case[i] << endl;                                                                
  }                                                                                                                               
  return 0;                                                                                                                       
}                                                                                                                                 
                                                                                                                                  
                                                                                                                                  
                                                                                                                                  
                                                                                                                                  
                                                 

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

#pragma GCC optimize("O3")

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> most(n);
    for(int i = 0; i < n; ++i) {
		cin >> most[i];
	}
    
    sort(all(most), greater <>());
    
    most.erase(most.begin(), min(most.begin()+k, most.end()));
    
    ll sum = 0;
    
    for(auto x : most) {
		sum += x;
	}
    
    cout << sum;
    
    return 0;
}


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

int main(){
    int d,n,ans=1;cin>>d>>n;
    if(n!=100){
        ans=pow(100,d)*n;
        cout<<ans<<endl;
    }
    else{
        ans=pow(100,d)*101;
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <iomanip>
typedef long long LL;
using namespace std;
typedef pair<int, int> Pii;
typedef pair<LL, LL> PLL;
const int maxn = 2E5 + 5;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	string S, T;
	cin >> S >> T;
	int len = S.length();
	map<char, int> mp;
	for(int i = 0; i <= 25; i++){
		char b = 'a' + i;
		mp[b] = 0;     
	}
	bool ok = true;
	for(int i = 0; i <= len - 1; i++){
		if(mp[S[i]] == 0){
			mp[S[i]] = T[i];
		}else{
			if(T[i] != mp[S[i]]) ok = false;
		}
	}
	for(int i = 0; i <= 25; i++){
		char b = 'a' + i;
		mp[b] = 0;     
	}
	for(int i = 0; i <= len - 1; i++){
		if(mp[T[i]] == 0){
			mp[T[i]] = S[i];
		}else{
			if(S[i] != mp[T[i]]) ok = false;
		}
	}
	if(ok) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 916
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < int(n); ++i)
#define REPE(i, a, b) for (int i = (a); i <= int(b); ++i)
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
#define PB push_back
#define EB emplace_back
using LL = long long;
using PII = pair<int, int>;
#define F first
#define S second

int main() {
  string s;
  cin >> s;
  puts(s.size() >= 4 && s.substr(0, 4) == "YAKI" ? "Yes" : "No");
  return 0;
}



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

int main() {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if (e-d<=k && e-c<=k && e-b<=k && e-a<=k && d-c<=k && d-b<=k && d-a<=k && c-b<=k && c-a<=k && b-a<=k) {
    cout << "Yay!" << endl;
  }
  else {
    cout << ":(" << endl;
  }
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define debug(x) cout << #x << " = " << x << '\n'
#define debug_arr(a , n) for(int i = 0 ; i < n ; i++)cout << a[i] << " "
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll> 
#define inf 1000000000
#define mod 1000000007

const int max_n = 1e5 + 9;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
int main()
{
    int n , a , b;
    cin >> n >> a >> b;
    string s;
    cin >> s;

    int passed = 0 , overseas = 0;
    for(int i = 0 ; i < n ; i++){
        if(s[i] == 'c'){
            cout << "No\n";
        }
        else{
            if(s[i] == 'a'){
                if(passed < a + b){
                    cout << "Yes\n";
                    passed++;
                }
                else{
                    cout << "No\n";
                }
            }
            else{
                if(passed < a + b && overseas < b){
                    cout << "Yes\n";
                    passed++;
                    overseas++;
                }
                else{
                    cout << "No\n";
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 896
S = list(input())

MOD = 2019
S.reverse()
cnt = 1
temp = 0
ans = [0]*2019
for i in S:
    temp += int(i)*cnt % MOD
    temp %= MOD
    ans[temp] += 1
    cnt *= 10
    cnt %= MOD

ans[0] += 1

ans2 = 0
for i in ans:
    ans2 += i*(i-1)//2
print(ans2)

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

const double PI = 3.141592;

int main(){
	int n, result;
	double xa, ya, ra, xb, yb, rb;
	cin >> n;
	for ( int i = 0; i < n; ++i ){
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		
		double d = sqrt( pow( xa - xb, 2.0 ) + pow( ya - yb, 2.0 ) );

		if ( d > ra + rb ) result = 0;
		else if ( d < ra - rb ) result = 2;
		else if ( d < rb - ra ) result = -2;
		else result = 1;

		cout << result << endl;
	}

	return 0;
}

Measured memory_bytes: 0
n = int(input())
p = [int(m) for m in input().split()]

a = [i * n + (i - 1) for i in range(1, n + 1)]
b = [i * n + (i - 1) for i in range(n, 0, -1)]

for i in range(n):
    a[p[i] - 1] += i + 1

for i in range(n):
    print(a[i],"", end="")
print()
for i in range(n):
    print(b[i],"", end="")

Measured memory_bytes: 6212
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    int n, m; cin >> n >> m;
    ll ans = 0;
    ans = 1900*m + 100 * (n-m);
    ans *= pow(2, m);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#ifndef LOCAL
#pragma GCC optimize("Ofast")
#endif

#include "bits/stdc++.h"

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ld = long double;

constexpr int nax = 1000 * 1000 + 105;
constexpr int infty = 1000 * 1000 * 1000 + 5;
constexpr int mod = 1000 * 1000 * 1000 + 7;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int x = 0, y = 0, t = 0;
  while (n--) {
    int a, b, c;
    cin >> a >> b >> c;
    const int czas = a - t;
    assert(czas > 0);
    const int odl = abs(b - x) + abs(c - y);
    if (czas < odl or (czas % 2) != (odl % 2)) {
      cout << "No" << endl;
      return 0;
    }
    t = a;
    x = b;
    y = c;
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
K = int(input())
if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

tmp1 = 0
for i in range(1, 2 * K + 1):
    tmp1 += 7 * pow(10, i, K)
    if tmp1 % K == 0:
        print(i)
        exit()

print(-1)

Measured memory_bytes: 63336
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()
S = []
for i in range(N):
	S.append(rs())

import collections
h = collections.defaultdict(int)
for s in S:
	l = [0] * 26
	for c in s:
		n = ord(c)-ord('a')
		l[n] += 1
	h[tuple(l)] += 1

def comb(n, k):
	p, q = 1, 1
	for i in range(1, k+1):
		p = p * (n-i+1)
		q = q * i
	return p // q

ans = 0
for k, v in h.items():
	if v > 1:
		ans += comb(v, 2)
print(ans)


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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
#define LEN(x) ll(x.length()) //lengthをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

int main(){
    ll x;
    cin >> x;
    cout << (x + 1) % 2;
    return 0;
}

Measured memory_bytes: 3628
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
//#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end());
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)
#define sz(x) ((ll)x.size())
const int M=1000000007;
const int MM=998244353;
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";

 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(m<=1)return 0;
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=5e5+5;

ll sp[N];

void fill(){
  for(int i=1;i<N;i++)sp[i]=i;

    for(int i=2;i<N;i++){
      for(int j=i;j<N;j+=i){
        if(sp[j]==j)sp[j]=i;
      }
    }
}

bool prime(ll x){
  if(x==2)return true;

for(ll i=2;i*i<=x;i++){
  if(x%i==0)return false;
}

  return true;
}

ll fac[N];

ll inv[N];

void gg(){
  fac[0]=inv[0]=1;

  for(int i=1;i<N;i++){
    fac[i]=fac[i-1]*i%M;
    inv[i]=powM(fac[i],M-2,M);
  }
}

ll c(ll a,ll b,ll M){
  if(b>a)return 0;

  return (fac[a]*inv[a-b]%M)*(inv[b])%M;
}

ll f[N];

int main()
{ 

IOS;

ll n,x,y;

cin>>n>>x>>y;

for(ll i=1;i<=n;i++){
  for(ll j=i+1;j<=n;j++){
    ll d=min(j-i,abs(x-i)+1+abs(j-y));
    f[d]++;
  }
}

for(int i=1;i<n;i++){
  cout<<f[i]<<endl;
}


//end_routine();

return 0;
 
}


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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,N,j) for(int i = (N-1);i >= (j);i--)
#define _rec(i,N,j) for(int i = (N);i >=(j);i--)
#define ALL(x) x.begin(),x.end()
#define MEM(a,n) memset(a,n,sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

int get_int(){int x;scanf("%d",&x);return x;}
LL get_ll(){LL x;scanf("%lld",&x);return x;}
double get_db(){double x;scanf("%lf",&x);return x;}

template<typename T> int chmin(T &a,T b){if(a > b){a = b;return 1;}else return 0;}
template<typename T> int chmax(T &a,T b){if(a < b){a = b;return 1;}else return 0;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {_for(i,0,v.size()) os << v[i] << " ";return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){for(auto a:v) os << a <<" ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){os << v.fst <<" "<<v.scd << " ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& v){for(auto a:v) cout << a << endl;return os;}

static const int dx[8] = { -1,  0, 1, 0,  1, -1,  1, -1};
static const int dy[8] = {0,  1, 0,  -1,  1, -1, -1,  1};
const double pi  = acos(-1.0);
const double eps = 1e-8;
//const LL  INF  = 0x3f3f3f3f3f3f3f3f;
const int inf  = 0x3f3f3f3f;

int N;
const int maxn = 1e5+5;
LL A[maxn];
LL num[maxn];
LL L;

int main()
{
    cin >> N >> L;
    int index = -1;

    _for(i,0,N){
        cin >> A[i];
        if(i) num[i] = A[i-1] + A[i];
        if(num[i] >= L) index = i;
    }
    if(index == -1){
        cout << "Impossible" <<endl;
    }else{
        cout << "Possible"<<endl;
        _for(i,1,index){
            cout << i << endl;
        }
        _dec(i,N,index+1){
            cout << i << endl;
        }
        cout << index << endl;
    }


    return 0;
}


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



signed main(){
    int n;
    cin>>n;
    vector<P>v;
    if(n%2==0){
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                if(n-i-1==j)continue;
                v.push_back(P(i,j));
            }
        }
        cout<<v.size()<<endl;
        r(i,v.size()){
            cout<<v[i].first+1<<' '<<v[i].second+1<<endl;
        }
    }
    else{
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                if(n-i-2==j)continue;
                v.push_back(P(i,j));
            }
        }
        cout<<v.size()<<endl;
        r(i,v.size()){
            cout<<v[i].first+1<<' '<<v[i].second+1<<endl;
        }
    }
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT {
	__INIT() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}__init;

int main(void) {
    ll n;
    cin>>n;
    bool isOk = true;
    map<ll,bool> pitsu;
    rep(i,n){
        ll a;
        cin>>a;
        if(pitsu[a]) isOk = false;
        pitsu[a] = true;
    }
    if(isOk) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 16036
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int n;
vector< string > s;
vector< int > grp;
int f(int v){
    int res = 0;
    queue<int> q;
    q.push(v);
    grp[v] = 1;
    while(!q.empty()){
        int x = q.front(); q.pop();
        if(res < grp[x]) res = grp[x];
        for(int i=0;i<n;i++){
            if(s[x][i] == '1'){
                if(grp[i] == -1){
                    q.push(i);
                    grp[i] = grp[x] + 1;
                }else if(grp[i] != grp[x]-1 && grp[i] != grp[x]+1){
                    return -1;
                }
            }
        }
    }
    return res;
}
int main(void){
    cin >> n;
    s.assign(n, "");
    for(int i=0;i<n;i++) cin >> s[i];
    int ans = -1;
    for(int i=0;i<n;i++){
        grp.assign(n, -1);
        int tmp = f(i);
        if(ans < tmp) ans = tmp;
    }
    cout << ans << endl;
}


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

using namespace std;

int mat[2][110], a[2][110];

int main() {
    int n;
    //freopen("in.in", "r", stdin);
    cin >> n;
    for(int i = 0; i < 2; i++) {
        for(int j = 0; j < n; j++)
            cin >> mat[i][j];
    }
    a[0][0] = mat[0][0];
    a[1][0] = mat[0][0] + mat[1][0];
    for(int j = 1; j < n; j++) {
        a[0][j] = a[0][j - 1] + mat[0][j];
        a[1][j] = max(a[0][j] + mat[1][j], a[1][j - 1] + mat[1][j]);
    }
    cout << a[1][n - 1];
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define fr first
#define sc second
#define all(x) x.begin(), x.end()
#define skip continue
#define NAME "code"

using namespace std;

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

void faster(){
  	ios_base::sync_with_stdio(false);
  	cin.tie(NULL);
	cout.tie(NULL);
}

const int MAXN = 5e1 + 1;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

ll n, ans = INF;

ll sum_dig(int x){
	int res = 0;
	while(x){
		res += x % 10;
		x /= 10;
	}
	return res;
}

int main(){
	faster();

	cin >> n;

	for(int a = 1, b = n - 1; a < n; ++a, --b){
		ans = min(ans, sum_dig(a) + sum_dig(b));
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

res = True
cnt = 0

while res:
    for i in range(n):
        if a[i]%2 != 0:
            res = False
            break

        a[i] = a[i]/2

    if not res:
        break

    cnt += 1

print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
using namespace std;
const int mod=1e9+7;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main(){
    fast;
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes\n";
    else cout<<"No\n";
}


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

int main()
{
    string s;
    cin >> s;
    string t;
    int n = (s.size() - 1) / 2;
    rep(i, n + 1) {
        t.push_back(s[2 * i]);
    }
    cout << t << endl;
    return 0;
}

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

using namespace std;

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int main() {
  string S;
  cin >> S;
  cout << 700 + 100 * count(S.begin(), S.end(), 'o') << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

void reader(int &a) { scanf("%d", &a); }
void reader(double &a) { scanf("%lf", &a); }
void reader(char a[]) { scanf("%s", a); }
void reader(char &a) { scanf(" %c", &a); }
void reader(ll &a) { scanf("%lld", &a); }
void reader(ull &a) { scanf("%llu", &a); }
// void reader(string& a){cin >> a;};
template<class T, class U> void reader(T& t, U& u) { reader(t); reader(u); }
template<class T, class U, class V> void reader(T& t, U& u, V& v) { reader(t); reader(u); reader(v); }

void writer(const int a, char c) { printf("%d", a); putchar(c); }
void writer(const ll a, char c) { printf("%lld", a); putchar(c); }
void writer(const ull a, char c) { printf("%llu", a); putchar(c); }
void writer(const double a, char c) { printf("%.20lf", a); putchar(c); }
void writer(const char a[]) { printf("%s", a); };
void writer(const char a[], char c) { printf("%s", a); putchar(c); };
void writer(const char a, char c) { putchar(a); putchar(c); };
template<class T> void writerLn(T t) { writer(t, '\n'); }
template<class T, class U> void writerLn(T t, U u) { writer(t, ' '); writer(u, '\n'); }
template<class T, class U, class V> void writerLn(T t, U u, V v) { writer(t, ' '); writer(u, ' '); writer(v, '\n'); }
template<class T> void writerArr(T x[], int n) { int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }
template<class T> void writerVec(vector<T> x) { int n = x.size(); int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }

vector<string> split(const string &str, char sep) { vector<string> v; stringstream ss(str); string buffer; while (getline(ss, buffer, sep)) { v.push_back(buffer); }return v; }
// #define int ll
bool test = 0;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

signed main(void)
{
	int i, j, k, l;
	ull N;
	ull L[200];
	cin >> N;
	rep(i,2*N) cin >> L[i];
	sort(L, L + 2*N);
	int sum = 0;
	rep(i, N) {
		sum += min(L[i * 2], L[i * 2 + 1]);
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef long long int64;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
template<class T,class U>bool chmax(T &a, const U &b){if (a<b){a=b;return true;}return false;}
template<class T,class U>bool chmin(T &a, const U &b){if (b<a){a=b;return true;}return false;}
template<class T,class U>void vcin(T &v, U n){rep(i, n){typename T::value_type a;cin >> a;v.pb(a);}}
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cii(k);
    int64 ans=0;
    function<int64(int64, int64)> gcd = [&gcd](int64 x, int64 y){
        return !y ? x : gcd(y, x % y);
    };
    rep1(i, k){
        rep1(j, k){
            rep1(y, k){
                ans += gcd(gcd(i, j), y);
            }
        }
    }
    co(ans);

    return 0;
}

Measured memory_bytes: 3656
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
ABC=[tuple(map(int,input().split())) for i in range(n)]
dp=[[0]*3 for i in range(n+1)]
for i in range(n):
  ai,bi,ci = ABC[i]
  dp[i+1][0]=max(dp[i][1],dp[i][2])+ai
  dp[i+1][1]=max(dp[i][0],dp[i][2])+bi
  dp[i+1][2]=max(dp[i][1],dp[i][0])+ci
print(max(dp[n]))


Measured memory_bytes: 70236
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll N,K;
    cin >> N >> K;
    vector<ll> A(N);
    vector<vector<ll>> spot(2e5+1); // spot[i][0] : = iが最初に出現する場所
    vector<ll> same(N,-1); // same[i] := i 番目と同じ数字が次に出現する場所
    rep(i,N){
        cin >> A[i];
        spot[A[i]].push_back(i);
    }
    // same を作成する
    rep(i,N){
        // i番目の数字について
        int now = A[i]; // 今の値
        for(auto x:spot[now]){
            // 今の値が出現する場所が x 
            if(x>i){
                same[i] = x;
                break;
            }
        }
        if(same[i]==-1){
            same[i] = spot[now][0]; // 自分より右に出現しない場合は左に出現する1番最初の場所を入れる
            //cout << same[i] << endl;
        }
    }
    // 初期状態と同じになるようにシミュレートする
    int nowpos = 0; // 現在の場所 ここと同じ数が右側に出現するのでそれを探す
    ll dis = 0; // 初期状態に戻るための移動距離
    while(dis == 0 || nowpos != 0){
        // どれだけ移動するかを出す
        if(same[nowpos] > nowpos)dis += same[nowpos] - nowpos; // 右側に自分と同じ数値がある場合
        else {
            // 左側に自分と同じ数字がある場合は 左側にある数字に N を足すことで右側に持ってくることを考える
            dis += N + same[nowpos] - nowpos;
        }
        dis ++; // 右に1つ進む ( nowposと same[nowpos]が同じ数値なため新しい要素を入れるために進む
        nowpos = (same[nowpos]+1)%N;
    }
    // cout << dis << endl; // 元の状態に戻るための距離 dis が出てきた
    ll real = (N*K) % dis; // 実質進む距離
    vector<ll> ans;
    for(ll i = 0; i < real ; i++){
        if(same[i%N] > i%N && (i + same[i%N] - i%N) < real){
            i += same[i%N] - i%N;
        }else if(same[i%N]<= i%N && i + same[i%N] + N - i% N < real){
            i += N + same[i%N] - i%N;
        }else ans.push_back(A[i%N]);
    }
    for(auto x:ans)cout << x << " ";
}

Measured memory_bytes: 17268