akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
int compare_int(const void *a, const void *b){
  return *(long int*)b - *(long int*)a; // 大きい順
}
int compare_int_small(const void *a, const void *b){
  return *(long int*)a - *(long int*)b; // 小さい順
}
// 公約数
long long int gcd(long long int a, long long int b){
  if(b == 0){
    return a;
  }else{
    return gcd(b, a % b);
  }
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long long int lcm(long long int a, long long int b){
  return a * b / gcd(a, b);
}

#define TRUE 1
#define FALSE 0
#define LEN 100005

typedef struct q{
  int y;
  int x;
}QUEUE;

//int x = 0;
QUEUE *Q;
//P Q[LEN + 1];
int head = 0;
int tail = 0;
int n;

void initialize(int a){
  head = 0;
  tail = 0;
  Q = (QUEUE *)calloc(a, sizeof(QUEUE));
  if(Q == NULL){
    printf("メモリが確保できません\n");
    exit(EXIT_FAILURE);
  }
}

void finalize(){
  if(Q != NULL){
    free(Q);
    Q = NULL;
  }
}

int isEmpty(){
  if(head == tail){
    return TRUE;
  }else{
    return FALSE;
  }
}

int isFull(){
  if(head == (tail + 1) % LEN){
    return TRUE;
  }else{
    return FALSE;
  }
}

void enqueue(QUEUE x){
  fprintf(stderr, "enqueue() point.y:%d point.x:%d\n", x.y, x.x);
  if(isFull() != FALSE){
      printf("Overfllow\n");
  }else{
    Q[tail] = x;
    if((tail + 1) == LEN){
      tail = 0;
    }else{
      tail++;
    }
  }
}

QUEUE dequeue(){
  QUEUE x;
  //  fprintf(stderr, "-> dequeue\n");
  if(isEmpty() != FALSE){
    printf("Undrtfllow\n");
  }else{
    x = Q[head];
    if((head + 1 == LEN)){
      head = 0;
    }else{
      head++;
    }
  }
  return x;
}


// min
int main(void){
  char s[4];
  int ans = 0;
  
  scanf("%s", s);
  
  //printf("%s", s);
  
  if(s[0] == 'S' && s[1] == 'U')
  {
  	ans = 7;
  }else if(s[0] == 'M'){
   	ans = 6;
  }else if(s[2] == 'E'){
  	ans = 5;
  }else if(s[0] == 'W'){
  	ans = 4;
  }else if(s[1] == 'H')
  {
   	ans = 3;
  }else if(s[0] == 'F'){
  	ans = 2;
  }else if(s[1] == 'A')
  {
  	ans = 1;
  }
  
  printf("%d\n", ans);
  return 0;

}


Measured memory_bytes: 128
N = int(input())
ab = sorted([list(map(int,input().split())) for _ in range(N)],key=lambda x:x[1], reverse=True)
cd = sorted([list(map(int,input().split())) for _ in range(N)])
cnt = 0
for a, b in ab:
  for c, d in cd:
    if a<c and b<d:
      cd.remove([c,d])
      cnt+=1
      break

print(cnt)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0045
{
    public class Program

    {
        public static void Main(string[] args)
        {

            List<Tuple<int, int>> salesInformation = new List<Tuple<int, int>>();
            while (true)
            {
                string line = Console.ReadLine();
                if (string.IsNullOrEmpty(line)) break;

                int[] items = Array.ConvertAll(line.Trim().Split(','), e => int.Parse(e));
                salesInformation.Add(new Tuple<int, int>(items[0], items[1]));
            }

            Console.WriteLine(salesInformation.Select(x => x.Item1 * x.Item2).Sum());
            Console.WriteLine(Math.Round(salesInformation.Select(x => x.Item2).Average(),0,MidpointRounding.AwayFromZero));
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 16284
using System;
using System.Linq;
using System.Numerics;
using System.Collections;
using System.Collections.Generic;

public class Program {
    static void Main (string[] args) {
        var n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
        
        var aa = new List<int>();
        aa.Add(a[0]);
        for (int i = 1; i < n; ++i) {
            if (a[i - 1] != a[i]) { aa.Add(a[i]); }
        }
        
        if (aa.Count == 1) {
            Console.WriteLine(1);
            return;
        }
        
        var cnt = 1;
        var b = aa[1] - aa[0] < 0 ? -1 : 1;
        for (int i = 1; i < aa.Count; ++i) {
            var d = aa[i] - aa[i - 1] < 0 ? -1 : 1;
            if (!(d == b)) {
                cnt += 1;
                if (i < aa.Count-1) { b = aa[i + 1] - aa[i] < 0 ? -1 : 1; }
            } else {
                b = d;
            }
        }
        Console.WriteLine(cnt);
    }
}


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

int main (){
	int n,i,j=0;
  	cin >> n;
 	for(i=1;i<=9;i++)
    {	if((n%i == 0) && (n/i<10))
      		j =1;
    }
  	if (j==1)
      cout << "Yes";
  	else 
      cout << "No";
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <regex>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
const long long INF =  999999999;

int main(){
  string s,t,u;
  int a,b;
  cin>>s>>t;
  cin>>a>>b;
  cin>>u;
  if(s==u)a--;
  else b--;

  cout<<a<<" "<<b<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N, M; 
	cin>>N>>M;
	vector<vector<int> >vec(M);
	for(int i=0;i<M;++i){
		int k;
		cin>>k;
		vec[i].resize(k);
		for(int j=0;j<k;++j){
			cin>>vec[i][j];
			--vec[i][j];
		}
	}
	vector<int>p(M);
	for(int i=0;i<M;++i)cin>>p[i];
	int ans=0;
	for(int i=0;i<(1<<N);++i){
		bool ok=true;
		for(int j=0;j<M;++j){
			int c=0;
			for(int id : vec[j]){
				if ((i>>id)&1){
					++c;
				}
			}
			c%=2;
			if (c!=p[j]){
				ok=false;
			}
		}
		if(ok){
			++ans;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ios()                \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0)


signed main()
{
    ios();
    string s;
    cin >> s;

    int num = 0;
    for (int i = 0; i < 4;i ++) {
        if (s[i] == '+') {
            num ++;
        } else {
            num --;
        }
    }
    cout << num << endl;;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<62)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/
constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a/gcd(a,b)*b;}


ll mul(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}

ll power(ll x,ll y){
    if(y==0) return 1;
    else if(y==1) return x%MOD;
    else if(y%2==0) return power(x,y/2)*power(x,y/2)%MOD;
    else return (power(x,y/2)*power(x,y/2))%MOD*x%MOD;
}

ll divi(ll a,ll b){
    return mul(a,power(b,MOD-2));
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,k,sum=0;
    cin>>n>>k;
    vl h(n);
    cin>>h;
    sort(rall(h));
    range(i,k,n){
        sum+=h[i];
    }
    puta(sum);
}


Measured memory_bytes: 1792
#include <cstdint>
#include <vector>

using namespace std;
#define GRAPH_SIZE 100

static vector<uint32_t> graph[GRAPH_SIZE];

void graph_to_matrix(vector<uint32_t> graph[], uint32_t matrix[][GRAPH_SIZE])
{
  for(uint32_t i = 0; i < GRAPH_SIZE; i++){
    for(uint32_t j = 0; j < GRAPH_SIZE; j++){
      matrix[i][j] = 0;
    }
  }

  for(uint32_t i = 0; i < GRAPH_SIZE; i ++){
    for(uint32_t j = 0; j < graph[i].size(); j++){
      uint32_t val = graph[i][j];
      matrix[i][val] = 1;
    }
  }
}

#include <iostream>

static uint32_t matrix[GRAPH_SIZE][GRAPH_SIZE];

int32_t main(void)
{
  uint32_t num;
  cin >> num;
  for(uint32_t i = 0; i < num; i++){
    uint32_t index, len;
    cin >> index >> len;
    for(uint32_t j = 0; j < len; j++){
      uint32_t val;
      cin >> val;
      graph[index - 1].push_back(val - 1);
    }
  }
  graph_to_matrix(graph, matrix);

  for(uint32_t i = 0; i < num; i++){
    for(uint32_t j = 0; j < num; j++){
      if(j != 0) cout << " ";
      cout << matrix[i][j];
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 3180
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <map>
#include <cmath>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(v) v.begin(),v.end()
#define mod 1000000007

ll n;
string s;
ll p;

pair<string, ll>pairs[1000];
pair<string, ll>pairs2[1000];
pair<ll, ll>res[1000];


int main(){
  cin >> n;
  rep(i,n){
    cin >> s;
    cin >> p;
    p=-p;
    pairs[i]=make_pair(s,p);
    pairs2[i]=make_pair(s,p);
  }
  sort(pairs,pairs+n);
  rep(i,n){
    ll cc=pairs2[i].second;
    res[i]=make_pair(cc,i+1);
  }
  rep(i,n){
    rep(j,n){
      if(pairs[i].second==res[j].first){
        cout << res[j].second << endl;
      }
    }
  }

}


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

long long dp[3002][3002], a[3002];

int n ;
long long solve(int i, int j) {
    if(i>j) return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    int l = j -i  + 1;
    if(l%2==n%2) { //taro
        return dp[i][j]=max(solve(i+1, j) + a[i], a[j] + solve(i, j-1));
    } else { // jiro
        return dp[i][j]=min(solve(i+1, j) - a[i], -a[j] + solve(i, j-1));
    }
}
int main() {
	int i, j;
	cin>>n;
	for(i=1;i<=n;i++) cin>>a[i];
	
	for(i=1;i<=n;i++) 
	    for(j=1;j<=n;j++)
	        dp[i][j] = -1;
	long long ans = solve(1, n);
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  int n;
  cin>>n;
  vector<int> A(n);
  vector<int> L(n);
  vector<int> R(n);
  rep(i,n)cin>>A[i];
  L[0]=A[0];
  repeat(i,1,n)
    L[i]=gcd(L[i-1],A[i]);
  R[n-1]=A[n-1];
  for(int i=n-2; i>=0; i--) {
    R[i]=gcd(R[i+1],A[i]);
  }
  int ans=R[1];
  for(int i=1; i<n-1; i++) {
    ans=max(ans,gcd(L[i-1],R[i+1]));
  }
  ans=max(ans,L[n-2]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){
    long long int a;
    cin>>a;
    vector<long long int>v(a);
    long long int sum=0;
    REP(i,a){
        scanf("%lld",&v[i]);
        sum += v[i];
    }
    long long int result = linf,tmp=0;
    
    REP(i,a){
        tmp += v[i];
        result = min(result, abs(sum - tmp * 2));
    }
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.nextLine();
		if(S.charAt(2) == S.charAt(3) && S.charAt(4) == S.charAt(5)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and typedef Constants *******/
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define Dcout(a) cout << setprecision(20) << a << endl
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
using ll = long long;
using PAIR = pair<int, int>;
using Graph = vector<vector<int>>;
const ll INF = (1LL << 60);
const double pi=acos(-1.0);
#define debug cout << "line : " << __LINE__ << " debug" << endl
/****** Template of some basic operations *****/
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; }
/**************************************/
/******** User-defined Function *******/

/**************************************/
/********** Main()  function **********/
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    ll m = 1000;
    ll kabu = 0;

    bool flag = true;

    rep(i,n){
        if(i==n-1){
            if(kabu>0){
                m += kabu*a[i];
            }

            break;
        }

        if(flag==true){
            if(a[i]<a[i+1]){
                ll tmp = m / a[i];
                kabu += tmp;
                m -= a[i] * tmp;
                flag = false;
            }
        }else{
            if(a[i]>a[i+1]){
                ll val = kabu * a[i];
                m += val;
                kabu = 0;
                flag = true;
            }
        }
    }

    cout << m << endl;

    return 0;
}
/********  Main() Ends Here *************/


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
ll N, K, ans, minn, maxx;
int main(){
	cin.tie(0);
	cin.sync_with_stdio(0);
	cin >> N >> K;
	for(int i = K;i<=N+1;i++){
		minn = (1LL)*(i-1)*i/2;
		maxx = (1LL)*(N+N-i+1)*i/2;
		ans+=(maxx-minn+1)%MOD;
	}
	cout << ans%MOD << '\n';
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> d(N+1);
    for(int i = 1; i <= N; ++i) cin >> d[i];
    sort(d.begin(), d.end());
    cout << d[N/2+1] - d[N/2] << endl;
    return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
#define DEBUG
#define F first
#define S second
typedef long long ll;
const int N = 1e6 +10;
const int M = 1e9 + 7;
const int inf = 1e9+7;
const ll INF = 1e18;


int n, k;
int clr[N];
vector<int> g[N];
void dfs(int u, int p){
	int z=p>0;
	for(auto v:g[u]){
		if(v!=p){
			clr[v]=max(0, k-1-z);
			z++;
			dfs(v, u);
		}
	}
}
int main(){


	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	cin>>n>>k;
	int u, v;
	for(int i=1;i<n;i++){
		cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	clr[1]=k;
	dfs(1, 0);
	ll ans=1;
	for(int i=1;i<=n;i++){
		ans=ans*clr[i]%M;
	}
	cout<<ans<<endl;
}
/*
#ifdef DEBUG
#endif
*/



Measured memory_bytes: 32640
#include <iostream>
using namespace std;
int main(void){
    int N;
    
    cin >> N;
    int W[N];
    int balance2=0; 
    for(int i = 0; i < N ; i++){
        cin >> W[i];
        balance2 += W[i];
    }
    
    int ans = balance2;
    int balance1 = 0;
    for(int i =0;i < N ;i++){
        balance1 += W[i];
        balance2 -= W[i];
        ans = min(abs(balance1-balance2),ans);
         
        
    }
    
    cout <<ans<<endl;
    
    
}


Measured memory_bytes: 256
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<utility>
#include<functional>
#include<iomanip>
#include<sstream>
#include<ctime>
#include<cassert>
using namespace std;
#define y0 y0z
#define y1 y1z
#define yn ynz
#define j0 j0z
#define j1 j1z
#define jn jnz
#define tm tmz
#define buli(x) (__builtin_popcountll(x))
#define bur0(x) (__builtin_ctzll(x))
#define bul2(x) (63-__builtin_clzll(x))
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define fil(a,b) memset((a),(b),sizeof(a))
#define cl(a) fil(a,0)
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define foreach(it,a) for(__typeof((a).begin()) it=(a).begin();it!=(a).end();it++)
#define rep(i,a,b) for (int i=(a),_ed=(b);i<_ed;i++)
#define per(i,a,b) for (int i=(b)-1,_ed=(a);i>=_ed;i--)
#define pw(x) ((ll(1))<<(x))
#define upmo(a,b) (((a)=((a)+(b))%mo)<0?(a)+=mo:(a))
#define mmo(a,b) (((a)=1ll*(a)*(b)%mo)<0?(a)+=mo:(a))
void getre(){int x=0;printf("%d\n",1/x);}
void gettle(){int res=1;while(1)res<<=1;printf("%d\n",res);}
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
template<typename T,typename S>inline bool upmin(T&a,const S&b){return a>b?a=b,1:0;}
template<typename T,typename S>inline bool upmax(T&a,const S&b){return a<b?a=b,1:0;}
template<typename N,typename PN>inline N flo(N a,PN b){return a>=0?a/b:-((-a-1)/b)-1;}
template<typename N,typename PN>inline N cei(N a,PN b){return a>0?(a-1)/b+1:-(-a/b);}
template<typename N>N gcd(N a,N b){return b?gcd(b,a%b):a;}
template<typename N>inline int sgn(N a){return a>0?1:(a<0?-1:0);}
#if ( ( _WIN32 || __WIN32__ ) && __cplusplus < 201103L)
    #define lld "%I64d"
#else
    #define lld "%lld"
#endif
inline void gn(long long&x){
	int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-');c=='-'?(sg=-1,x=0):(x=c-'0');
	while((c=getchar())>='0'&&c<='9')x=x*10+c-'0';x*=sg;
}
inline void gn(int&x){long long t;gn(t);x=t;}
inline void gn(unsigned long long&x){long long t;gn(t);x=t;}
inline void gn(double&x){double t;scanf("%lf",&t);x=t;}
inline void gn(long double&x){double t;scanf("%lf",&t);x=t;}
inline void gs(char *s){scanf("%s",s);}
inline void gc(char &c){while((c=getchar())>126 || c<33);}
inline void pc(char c){putchar(c);}
#ifdef JCVB
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...) 
#endif
typedef long long ll;
typedef double db;
inline ll sqr(ll a){return a*a;}
inline db sqrf(db a){return a*a;}
const int inf=0x3f3f3f3f;
const db pi=3.14159265358979323846264338327950288L;
const db eps=1e-6;
//const int mo=0;
//int qp(int a,ll b){int n=1;do{if(b&1)n=1ll*n*a%mo;a=1ll*a*a%mo;}while(b>>=1);return n;}

int n;
int a[222];
int main()
{
#ifdef JCVB
	//freopen("1.in","r",stdin);
	//freopen("1.out","w",stdout);
	int _time_jc=clock();
#endif
	gn(n);
	rep(i,1,n*2+1){
		gn(a[i]);
	}
	sort(a+1,a+1+n*2);
	int su=0;
	for (int i=1;i<=2*n;i+=2)su+=a[i];
	printf("%d\n",su);
#ifdef JCVB
	debug("time: %d\n",int(clock()-_time_jc));
#endif
	return 0;
}




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

long long mod = 998244353;
long long dp[3009][6009];
long long nr[3009][3009];

void init() {
	for (int i = 0; i <= 3000; i++) {
		for (int j = 0; j <= 3000; j++) {
			if (i == 0 || j == 0) nr[i][j] = 1;
			else nr[i][j] = (nr[i - 1][j] + nr[i][j - 1]) % mod;
		}
	}
	dp[0][0] = 1;
	for (int i = 0; i <= 3000; i++) {
		for (int j = 0; j <= 6000; j++) {
			dp[i + 1][j + 0] += dp[i][j]; dp[i + 1][j + 0] %= mod;
			dp[i + 1][j + 1] += dp[i][j]; dp[i + 1][j + 1] %= mod;
			dp[i + 1][j + 2] += dp[i][j]; dp[i + 1][j + 2] %= mod;
		}
	}
}

long long ncr(int a, int b) {
	if (a < b || b < 0) return 0;
	return nr[a - b][b];
}

long long solve(int N, int X) {
	// パターン A : 合計が X 以下の場合
	long long sum1 = 0;
	for (int i = 0; i < X; i++) { sum1 += dp[N][i]; sum1 %= mod; }

	// パターン B : 合計が X 以上の場合
	long long sum2 = 0;
	for (int i = 0; i <= N; i++) {
		for (int j = 1; j <= N - i; j++) {
			// i : 2 の個数, j : 1 の個数
			if (j >= X || i * 2 + j < X) continue;
			if ((i * 2 + j) % 2 == X % 2) continue;
			long long d = i - (1LL * ((X - 1) - j) / 2); // 左右に入るべき最小の数
			long long val = ncr(j + i - 2 * d, j);
			long long cost = ncr(N, i + j);
			//cout << "(i, j) = (" << i << ", " << j << ") -> val = " << val << ", cost = " << cost << ", mul = " << val * cost << endl;
			sum2 += val * cost;
			sum2 %= mod;
		}
	}

	// パターン C : 合計が X 以上の場合（全て 0 か 2）
	long long sum3 = 0;
	if (X % 2 == 1) {
		for (int i = 0; i <= N; i++) {
			// i : 2 の個数
			if (i * 2 < X) continue;
			long long cost = ncr(N, i);
			sum3 += cost;
			sum3 %= mod;
		}
	}
	return (sum1 + sum2 + sum3) % mod;
}

int main() {
	init();
	long long N, X; cin >> N >> X;
	cout << solve(N, X) << endl;
	return 0;
}

Measured memory_bytes: 211968
#define ab(a, b) (a<b?b-a:a-b)
#define mi(a, b) (a<b?a:b)
unsigned long c[100001];
main(){
  int N,K,h[100000],i,j;
  scanf("%d%d", &N, &K);
  for(i = 0; i < N; i++){
  	scanf("%d", h+i);
  }
  c[0] = 0;
  for(i = 1; i < N; i++){
  	c[i] = c[i-1] + ab(h[i], h[i-1]);
    for(j=2;j<=K&&j<=i;j++){
	    c[i] = mi(c[i], (c[i-j] + ab(h[i], h[i-j])));
    }
  }
  
  printf("%ld\n",c[N-1]);
}

Measured memory_bytes: 1280
#pragma once

#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
using namespace std;
string S[1001];
long result=0;
int H,W,N;
long minmytime[1000][1000];
queue<int> qx,qy,mytime;
int sx,sy,gx,gy;
int step = 0;

int main(){
	scanf("%d%d%d",&H,&W,&N);

	for(int i=0;i<H;i++){
		cin>>S[i];
		for(int j=0;j<W;j++){
			minmytime[i][j]=1000000;
			if(S[i][j]=='S'){
				sx=j;
				sy=i;
				qx.push(j);
				qy.push(i);
				mytime.push(0);
			}

			if(S[i][j]-'0'==N){
				gx=j;
				gy=i;
			}

		}
	}



for(int acc=0;acc<N;acc++){
	step++;
	while(step<=N){
		
		if(qx.front()>0){
		if(mytime.front()<minmytime[qy.front()][qx.front()-1]-1  && S[qy.front()][qx.front()-1] !='X'){
			if(S[qy.front()][qx.front()-1]-'0' ==step){
			result += mytime.front()+1;
			sx=qx.front()-1;
			sy=qy.front();
			while(qx.empty()== false){
				qx.pop();
				qy.pop();
				mytime.pop();
			}
			
			qx.push(sx);
			qy.push(sy);
			mytime.push(0);
			break;
		}
				qx.push(qx.front()-1);
				qy.push(qy.front());
				mytime.push(mytime.front()+1);
				minmytime[qy.front()][qx.front()-1]=mytime.front()+1;
		}

	}
		//

	if( qx.front()<W-1 ){
		if(mytime.front()<minmytime[qy.front()][qx.front()+1]-1 && S[qy.front()][qx.front()+1] !='X'){

		if(S[qy.front()][qx.front()+1]-'0' ==step){
			result += mytime.front()+1;
			sx=qx.front()+1;
			sy=qy.front();
			while(qx.empty()== false){
				qx.pop();
				qy.pop();
				mytime.pop();
			}
			
			qx.push(sx);
			qy.push(sy);
			mytime.push(0);
			break;
		}

				qx.push(qx.front()+1);
				qy.push(qy.front());
				mytime.push(mytime.front()+1);
				minmytime[qy.front()][qx.front()+1]=mytime.front()+1;
		}
	}

		//

	if( qy.front()>0){
		if(mytime.front()<minmytime[qy.front()-1][qx.front()]-1  && S[qy.front()-1][qx.front()] !='X'){

			if(S[qy.front()-1][qx.front()]-'0' ==step){
			result += mytime.front()+1;
			sx=qx.front();
			sy=qy.front()-1;
			while(qx.empty()== false){
				qx.pop();
				qy.pop();
				mytime.pop();
			}
			
			qx.push(sx);
			qy.push(sy);
			mytime.push(0);
			break;
		}

				qx.push(qx.front());
				qy.push(qy.front()-1);
				mytime.push(mytime.front()+1);
				minmytime[qy.front()-1][qx.front()]=mytime.front()+1;
		}
	}

		//

	if(qy.front()<H-1){
		if(mytime.front()<minmytime[qy.front()+1][qx.front()]-1  && S[qy.front()+1][qx.front()] !='X'){

				if(S[qy.front()+1][qx.front()]-'0' ==step){
			result += mytime.front()+1;
			sx=qx.front();
			sy=qy.front()+1;
			while(qx.empty()== false){
				qx.pop();
				qy.pop();
				mytime.pop();
			}
			
			qx.push(sx);
			qy.push(sy);
			mytime.push(0);
			break;
		}

				qx.push(qx.front());
				qy.push(qy.front()+1);
				mytime.push(mytime.front()+1);
				minmytime[qy.front()+1][qx.front()]=mytime.front()+1;
		}
	}


		qx.pop();
		qy.pop();
		mytime.pop();
	



	}

	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			minmytime[i][j]=1000000;
		}
	}

}

printf("%d\n",result);
return 0;

}

Measured memory_bytes: 11920
#include<bits/stdc++.h>
using namespace std;
string s;
int l;
int main()
{
    cin>>s;
    l=s.size();
    for(int i=0;i<l;i++)
    {
        if(s[i]=='C')
        {
            for(int j = i+1 ; j<l ; j++)
            {
                if(s[j]=='F')
                {
                    cout << "Yes" << endl ;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl ;
    return 0;
}

Measured memory_bytes: 256
using System;

namespace ABC129A
{
    class Program
    {
        static void Main(string[] args)
        {
            int p, q, r;

            string[] ss = Console.ReadLine().Split(' ');
            p = int.Parse(ss[0]);
            q = int.Parse(ss[1]);
            r = int.Parse(ss[2]);
            if (p > q && q > r)
                Console.WriteLine(q + r);
            else if (p > r && r > q)
                Console.WriteLine(r + q);
            else if (q > p && p > r)
                Console.WriteLine(p + r);
            else if (q > r && r > p)
                Console.WriteLine(r + p);
            else if (r > p && p > q)
                Console.WriteLine(p + q);
            else if (r > q && q > p)
                Console.WriteLine(q + p);
            if (p == q && p > r)
                Console.WriteLine(p + r);
            else if (p == q && p < r)
                Console.WriteLine(p + q);
            else if (q == r && q > p)
                Console.WriteLine(q + p);
            else if (q == r && q < p)
                Console.WriteLine(q + r);
            else if (p == r && p > q)
                Console.WriteLine(p + q);
            else if (p == r && p < q) 
                Console.WriteLine(p + r);
            if (p == q && q == r)
                Console.WriteLine(p + q);
            Console.ReadKey();
                    
                   
        }
    }
}


Measured memory_bytes: 11476
#include <string>
#include <queue>
#include <utility>
#include <iostream>
using namespace std;

int main(){
    int n,q;
    pair<string,int> pros[100000+10];
    cin >> n >> q;
    queue<pair<string,int> > Q;
    for(int i=0;i<n;i++){
        cin >> pros[i].first >> pros[i].second;
        Q.push(pros[i]);
    }
    int time=0,mul=1;
    while(!Q.empty()){
        pair<string,int> calc = Q.front();
        Q.pop();
        if(calc.second<=q){
            time += calc.second;
            cout << calc.first << ' ' << time << endl;
        }
        else{
            time += q;
            calc.second -= q;
            Q.push(calc);
        }
    }
    
}

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

int main(){
    int X; cin >> X;
    int ans = 1;
    int rating = 2000;
    for(int i = 1; i<=8; ++i){
        if(rating - 200 <= X && X < rating) ans = i;
        rating -= 200;
    }
    cout << ans << endl;
}


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


int main() {
    const int inf = 100000000;
    
    int n,m;
    cin >> n >> m;
    
    //入力データ用の変数
    int a[1000],b[1000],c[1000];
    
    //データの入力
    for(int i = 0; i < m; ++i){
        cin >> a[i] >> b[i] >> c[i];
        a[i]--,b[i]--; //配列のインデックスと合わせるため
    }
    
    //アルゴリズム用の変数
    int dist[100][100];
    
    //アルゴリズム用の初期化１
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            if(i==j)
                dist[i][j]=0;
            else
                dist[i][j]=inf;
        }
    }
    
    //アルゴリズム用の初期化２（辺のある場合は更新）
    for(int i = 0; i < m; ++i){
        dist[a[i]][b[i]]=min(dist[a[i]][b[i]],c[i]);
        dist[b[i]][a[i]]=min(dist[b[i]][a[i]],c[i]);
    }
    
    //ワーシャル・フロイド・アルゴリズム
    for(int k = 0; k < n; ++k){
        for(int i = 0; i < n; ++i){
            for(int j = 0; j < n; ++j){
                dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
            }
        }
    }
    
    //最短経路でない辺を数え上げ（最短経路辺のユニオンを数え上げ）
    int ans=m;
    for(int i = 0; i < m; ++i){
        bool shortest=false;
        for(int j = 0; j < n; ++j){
            for (int k = 0; k < n; ++k) {
                if(dist[j][a[i]]+c[i]+dist[b[i]][k]==dist[j][k]) shortest=true;
            }
        }
        if(shortest==true){
            ans=ans-1;
        }
    }
    
    cout << ans << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#define M 99999
T[M+1],t[M/2];main(i,j,m,a,b,p,q){
for(i=2;i<=M;i++)if(!T[i])for(j=i*2;j<=M;j+=i)T[j]=1;
for(i=2,j=0;i<=M;i++)if(!T[i])t[j++]=i;
for(;scanf("%d%d%d",&m,&a,&b),m;printf("%d %d\n",p,q)){
for(;;m--)for(i=0;t[i]*t[i]<=m;i++)if(p=t[i],q=m/t[i],p*q==m&&!T[q]&&/*p<=q&&*/a*q<=b*p)goto E;
E:;}
exit(0);}

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

int main(){
  double x1,x2,y1,y2;
  double l;
  cin >> x1 >> y1 >> x2 >> y2;

  l = sqrt(pow(x1-x2,2) + pow(y1-y2,2));

  printf("%lf\n", l);

  return 0;
}

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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int X[110000], L[110000];
pint p[110000];
signed main() {
    cin >> N;
    rep(i, N) {
        cin >> X[i] >> L[i];
        p[i] = {X[i] + L[i], X[i] - L[i]};
    }
    int cur = LLONG_MIN;
    sort(p, p + N);
    int ans = 0;
    rep(i, N) {
        if (p[i].second >= cur) { ans++, cur = p[i].first; }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main().solve();
    }

    int n, m;
    List<Integer>[] edge;
    int[] ok;

    void solve() {
        try (Scanner in = new Scanner(System.in)) {
            n = in.nextInt();
            m = in.nextInt();
            edge = new List[n];
            for (int i = 0; i < n; ++i) {
                edge[i] = new ArrayList<>();
            }
            for (int i = 0; i < m; ++i) {
                int u = in.nextInt() - 1;
                int v = in.nextInt() - 1;
                edge[u].add(v);
                edge[v].add(u);
            }
            ok = new int[n];
            Arrays.fill(ok, -1);
            long c1 = 0, c2 = 0, c3 = 0;
            for (int i = 0; i < n; ++i) {
                if (ok[i] != -1) continue;
                Pair x = dfs(i, 0);
                if (x.c == 1) ++c1;
                else if (!x.b) ++c2;
                else ++c3;
            }
            System.out.println(c1 * c1 + 2 * c1 * (n - c1) + 2 * c2 * c2 + 2 * c2 * c3 + c3 * c3);
        }
    }

    Pair dfs(int p, int b) {
        ok[p] = b;
        Pair x = new Pair(1, false);
        for (int n : edge[p]) {
            if (ok[n] == -1) {
                Pair t = dfs(n, 1 - b);
                x.c += t.c;
                x.b |= t.b;
            } else {
                x.b |= b == ok[n];
            }
        }
        return x;
    }

    class Pair {
        int c;
        boolean b;

        Pair(int c, boolean b) {
            this.c = c;
            this.b = b;
        }
    }

    void tr(Object... o) {
        System.err.println(Arrays.deepToString(o));
    }
}


Measured memory_bytes: 133128
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,ans,a,aa[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

//------ 自分を天才だと信じる ------

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

    cin>>n>>a>>b;
    rep(i,n)cin>>aa[i];
    rep(i,n){
        if(aa[i]<=a)c++;
        else if(a+1<=aa[i]&&aa[i]<=b)d++;
        else tmp++;
    }
    Cout(min({tmp,c,d}));
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<limits>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	scan(N);
	int kazu[3]={3,5,7};
	int keta=(int)(log10(N)+1+eps);
	int ans=0;
	rep(i,keta+1){
		int pow3=(int)(pow(3,i)+eps);
		rep(bit,pow3){
			int count[3]={};
			ll num=0;
			int tmp=bit;
			rep(pos,i){
				num+=(ll)(pow(10,pos)*(kazu[tmp%3])+eps);
				count[tmp%3]++;
				tmp/=3;
			}
			if(count[0]*count[1]*count[2]>0&&num<=N){
				ans++;
			}
		}
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		while(true){
			String s="";
			while(String.IsNullOrEmpty(s))s=Console.ReadLine();
			var d=int.Parse(s);
			if(d==0)break;
			mySol.Solve(d);
		}
	}
}

class Sol{
	public void Solve(int d_){
		
		
		double ans=0.0;
		for(int i=0;i<Tmax;i++)ans+=dpE[d_][i];
		
		Console.WriteLine("{0}",ans);
	}

	int N;
	int Tmax;
	double[][] dpE;
	
	public Sol(){
		N=100001;
		Tmax=20;
		
		dpE=new double[N+1][];
		double[][] dpP=new double[N+1][];
		for(int i=0;i<=N;i++){
			dpE[i]=new double[Tmax];
			dpP[i]=new double[Tmax];
		}
		
		dpP[0][0]=1.0;
		dpE[0][0]=0.0;
		
		for(int i=0;i<N;i++){
			for(int j=0;j<Tmax;j++){
				if(dpP[i][j]!=0.0){
					if(j+1<Tmax){
						dpP[i+1][j+1]=dpP[i][j]*(1.0/Math.Pow(2.0,(double)j));
						dpE[i+1][j+1]=(dpE[i][j]+dpP[i][j])*(1.0/Math.Pow(2.0,(double)j));
						
					}
					if(j-1>=0){
						dpP[i+1][0]+=dpP[i][j]*(1.0-1.0/Math.Pow(2.0,(double)j));
						dpE[i+1][0]+=dpE[i][j]*(1.0-1.0/Math.Pow(2.0,(double)j));
					}
				}
			}
		}


		
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}

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

int main(){
    cin >> s;
    int ans = 0;
    for(int i=0; i<s.length(); i++){
        ans+=(s[i]-'0')%9;
    }
    if(ans%9==0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


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

int main(){
	string s; cin >> s;
	while(1){
		if(s.size() >= 7 && s.substr(s.size() - 7, 7) == "dreamer"){
			s.erase(s.size() - 7, 7);
		}else if(s.size() >= 6 && s.substr(s.size() - 6, 6) == "eraser"){
			s.erase(s.size() - 6, 6);
		}else if(s.size() >= 5 && s.substr(s.size() - 5, 5) == "dream"){
			s.erase(s.size() - 5, 5);
		}else if(s.size() >= 5 && s.substr(s.size() - 5, 5) == "erase"){
			s.erase(s.size() - 5, 5);
		}else{
			break;
		}
	}
	cout << (s.empty() ? "YES\n" : "NO\n");
	return 0;
}

Measured memory_bytes: 512
a,b,h,m = map(int, input().split())
import math
a_x = a * math.cos(math.radians(30*h + 0.5*m))
a_y = a * math.sin(math.radians(30*h + 0.5*m))
b_x = b * math.cos(math.radians(6*m))
b_y = b * math.sin(math.radians(6*m))

ans = math.sqrt(abs(a_x - b_x)**2 + abs(a_y - b_y)**2)
print(ans)

Measured memory_bytes: 9556
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
using namespace std;


void B() {
    int N, K; cin >> N >> K;
    vi vec(N);
    rep(i, N) cin >> vec[i];
    sort(ALL(vec));

    int ans = 0; rep(i, K) ans += vec[i];

    cout << ans << endl;
}

int main() {
    B();
}

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

using namespace std;

int main() {
    int a;
    int b;
    int c;
    int n;
    int res = 0;

    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        a = b;
        b = c;
        scanf("%d", &c);

        if (i <= 1) {
            continue;
        }

        if (
            (a < b && b < c)
            || (a > b && b > c)
        ) {
            res++;
        }
    }

    printf("%d", res);
}


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

int choice(int A, int B, int X, int Y) {
    if (X > Y) return A;
    if (X < Y) return B;
}

int main() {

    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    if (2*C - A - B >= 0) cout << A * X + B * Y << endl;
    else {
        int n = min(X, Y);
        int N = max(X, Y);
        int aorb = choice(A, B, X, Y);
        cout << min(2 * C * N, 2 * C * n + (N - n) * aorb) << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<string>
#include<map>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define vii         vector<pair<ll,ll> >
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define rep1(i,a,b) for(ll i=a;i<= b;i++)
#define PI          3.14159
#define MAX         100000001
#define fast_io      ios_base::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
#define scan(var)    scanf("%lld",&var)
#define print(var)   printf("%lld\n", var);
#define BLOCK 317
#define double       long double
#define mod          998244353
using namespace std;
ll arr[21];
ll arr1[21];
ll arr2[21];
int main()
{
  fast_io
  ll n;
  cin >> n;
  rep(i,1,n + 1)
  {
    cin >> arr[i];
  }
  rep(i,1,n + 1)
  {
    cin >> arr1[i];
  }
  rep(i,1,n)
  {
    cin >> arr2[i];
  }
  ll prev = -1;
  ll ans = 0;
  rep(i,1,n + 1)
  {
    ans += arr1[arr[i]];
    if(prev != -1)
    {
      if(prev == arr[i] - 1)
      {
        ans += arr2[prev];
      }
    }
    prev = arr[i];
  }
  cout << ans;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define le 100005
using namespace std;
int dp[le], n[le];
int main(){
    //freopen("input.txt", "r", stdin);
    int len, k;
    scanf("%d %d", &len, &k);
    for(int i = 0; i < len; i++){
        scanf("%d", &n[i]);
        dp[i] = INT_MAX;
    }
    dp[0] = 0;
    for(int i = 0; i < len; i++){
        for(int j = i + 1; j < k + i + 1; j++){
            if(j == len) break;
            dp[j] = min(dp[j], (dp[i] + abs(n[j] - n[i])));
        }
    }
    cout << dp[len - 1] << endl;
    return 0;
}


Measured memory_bytes: 4476
n = gets.to_i
prices = gets.split.map(&:to_i)
nums = gets.split.map(&:to_i)
table = Array.new(n + 1, Float::INFINITY)
table[0] = 0
(0..3).each do |i|
  new_table = Array.new(n + 1)
  (0..n).each do |x|
    new_table[x] = (0..[(x.to_f/nums[i]).ceil, 1].max).map {|k| table[[x - k * nums[i], 0].max] + k * prices[i] }.min
  end
  table = new_table
end
p table[n]



Measured memory_bytes: 7024
#include<stdio.h>
#include<limits.h>

int H,A[2000000];

void maxH(int);
int extract(void);
void increaseK(int,int);
void insert(int);

int main(){
	int key;
	char C[10];
	while(1){
		scanf("%s",&C);
		if(C[0]=='e' && C[1]=='n')break;
		if(C[0]=='i'){
			scanf("%d",&key);
			insert(key);
		}
		else{
			printf("%d\n",extract());
		}
	}
	return 0;
}

void maxH(int i){
  int l,r,a,largest;
  l=2*i;
  r=2*i+1;
  if(l<=H && A[l]>A[i])largest=l;
  else largest=i;
  if(r<=H && A[r]>A[largest])largest=r;
  if(largest!=i){
    a=A[largest];
    A[largest]=A[i];
    A[i]=a;
    maxH(largest);
  }
}

int extract(void){
	int max;
	if(H<1)return -INT_MAX;
	max=A[1];
	A[1]=A[H--];
	maxH(1);
	return max;
}

void increaseK(int i,int key){
	int a;
	if(key<A[i])return ;
	A[i]=key;
	while(i>1&&A[i/2]<A[i]){
		a=A[i];
		A[i]=A[i/2];
		A[i/2]=a;
		i=i/2;
	}
}

void insert(int key){
	H++;
	A[H]=-INT_MAX;
	increaseK(H,key);
}



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

int main(){
  int n; cin >> n;
  vector<pair<int,int>> node(n-1);
  vector<vector<int>> con(n);
  for (int i = 0; i < n-1; i++){
    int a,b; cin >> a >> b; a--; b--;
    node.at(i) = make_pair(a,b);
    con.at(a).push_back(i);
    con.at(b).push_back(i);
  }
  vector<int> ans(n-1, -1);
  ans.at(0) = 1;
  int k = 0;
  vector<int> checked(n, 0);
  queue<pair<int,int>> q;
  q.push(make_pair(0, -1));
  checked.at(0) = 1;
  while (q.size()){
    pair<int,int> p = q.front();
    q.pop();
    int par = p.first, col = p.second;
    int c = 1;
    for (int i : con.at(par)){
      int chil = (node.at(i).first == par ? node.at(i).second : node.at(i).first);
      if (checked.at(chil)) continue;
      if (c == col) c++;
      q.push(make_pair(chil, c));
      checked.at(chil) = 1;
      ans.at(i) = c;
      k = max(k, c);
      c++;
    }
  }
  cout << k << endl;
  for (int i = 0; i < n-1; i++){
    cout << ans.at(i) << endl;
  }
}

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;

int main() {
	cin.sync_with_stdio(false);
	int N, A, B;
	cin >> N >> A >> B;
	string S;
	int na = 0, nona = 0;
	cin >> S;
	rep(i, S.size()) {
		if (S[i] == 'a') {
			if (na + nona < A + B) {
				na++;
				cout << "Yes" << endl;
			}
			else cout << "No" << endl;
		}
		else if (S[i] == 'b') {
			if (na + nona < A + B&&nona < B) {
				nona++;
				cout << "Yes" << endl;
			}
			else cout << "No" << endl;
		}
		else cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 848