akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<endl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<a.size();zz++) cerr<<a[zz]<<" ";cerr<<endl
#define trii(x) cerr<<#x<<": ("<<x.F<<","<<x.S<<")\n";
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<"\n"
#define mod 1000000007ll
#define inf 9999999999999999ll
#define nl endl
#define sz(x) (ll)(x).size()
#define all(x) x.begin(), x.end()
#define modulo 998244353ll

ll power(ll a,ll b)
{
    if(b==0)
        return 1;
    ll x=power(a,b/2);
    x=(x*x)%mod;
    if(b%2)
        x=(x*a)%mod;
    return x;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    vi count(k+1,0);
    //count[i]=number of sequences in which gcd is i
    for(ll i=k;i>=1;i--)
    {
        count[i]=power(k/i,n);
        for(ll j=2*i;j<=k;j+=i)
        {
            count[i]=(count[i]+mod-count[j])%mod;;
        }
    }
    ll ans=0;
    for(ll i=1;i<=k;i++)
    {
        ans=(ans+(i*count[i])%mod)%mod;
    }
    cout<<ans<<nl;
}


Measured memory_bytes: 3992
import java.io.*;
import java.util.*;
import java.math.*;
public class Main{

    static long M=(long)1e9+7;
    
    public static void main(String[] args) {
        FastReader fs=new FastReader();
        long x=fs.nextLong();
        long ans=0;
        long f=x/500;
        long r=x%500;
        long v=r/5;
        ans=(f*1000)+(v*5);
        System.out.println(ans);
    }
    
    public static long min(long a, long mod){
        return pow(a, mod-2,mod);
    }
    public static long mul(long a,long b,long mod){
        long res=0;
        while(b!=0){
            if ((b & 1) == 1){ res = (res + a) % mod;}
            a = (a + a) % mod;
            b >>= 1;
        }
        return res;
    }
    
    public static long pow(long a, long n, long mod){
        long res=1;
        while(n != 0){
            if ((n & 1) == 1) res = mul(res, a, mod)%mod;
            a = mul(a , a, mod)%mod;
            n >>= 1;
        }
        return res;
    }
    
    public static long gcd(long a, long b){
        if(a == 0) return b;
        return b == 0 ? a: gcd(b, a % b);
    }

    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }
}

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

typedef long long ll;

int main() {
  ll a,b;
  cin >> a >> b;
  
  ll ab = a * b;
  
  ll small, big;
  if(a < b){
    small = a;
    big = b;
  } else {
    small = b;
    big = a;
  }
  
  ll r = big % small;
  while(r != 0){
    big = small;
    small = r;
    r = big % small;
  }
  cout << ab / small;
}

Measured memory_bytes: 256
from collections import defaultdict

p = 10 ** 9 + 7
n = int(input())
a = [int(x) for x in input().split()]

num = defaultdict(int)
num[-1] = 3
col = [None] * n
for i in range(n):
    col[i] = num[a[i] - 1]
    num[a[i]] += 1
    num[a[i] - 1] -= 1

ans = 1
for i in range(n):
    ans = ans * col[i] % p

print(ans)

Measured memory_bytes: 22672
#include <bits/stdc++.h>
using namespace std;
typedef bool boool;
typedef long long ll;
#define vl vector<ll>
#define vb vector<boool>
#define vs vector<string>
#define vp vector<pair<ll, ll>>
#define vvl vector<vector<ll>>
#define vvp vector<vector<pair<ll, ll>>>
#define mod 1000000007
#define all(x) x.begin(), x.end()
#define rep1(i, n) for (long long i=0; i<(long long)(n); i++)
#define rep2(i, s, e) for (long long i=(s); i<(long long)(e); i++)
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

int main() {
    int n;
    cin >> n;
    string str;
    cin >> str;
    int cnt = 0;
    rep(i, str.length()){
        if(str[i] == 'R') cnt++;
    }
    int ans = 0;
    rep(i, cnt){
        if(str[i] == 'W') ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3732
import bisect
from collections import deque
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
# mod = 10 ** 9 + 7
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]



def main():
    N = int(input())
    res = 0
    for a in range(1, N):
        for b in range(1, N // a + 1):
            if a * b == N:
                continue
            res += 1

    print(res)

if __name__ == "__main__":
    main()

Measured memory_bytes: 69992
main :: IO ()
main = do
    n <- readLn :: IO Int
    a1 <- map read . words <$> getLine :: IO [Int]
    a2 <- map read . words <$> getLine :: IO [Int]
    let s1 = scanl1 (+) a1
        s2 = reverse . scanr1 (+) $ a2
    print $ maximum [ (s1!!i) + s2!!(n-i-1) | i <- [0..n-1] ]


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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(6);
    /*start*/
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    set<int> f;
    int god = 0;
    for (int b : a)
    {
        if (0 < b && b < 400)
            f.insert(0);
        else if (400 <= b && b < 800)
            f.insert(1);
        else if (800 <= b && b < 1200)
            f.insert(2);
        else if (1200 <= b && b < 1600)
            f.insert(3);
        else if (1600 <= b && b < 2000)
            f.insert(4);
        else if (2000 <= b && b < 2400)
            f.insert(5);
        else if (2400 <= b && b < 2800)
            f.insert(6);
        else if (2800 <= b && b < 3200)
            f.insert(7);
        else if (3200 <= b)
            god++;
    }
    int ans = f.size() + god;
    int ans2 = f.size();
    if (ans2 == 0)
        ans2 = 1;
    cout << ans2 << " " << ans;
    ed;
    return 0;
}

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

int main() {
	int i, j;
	int n;
	cin >> n;
	int min = 111;
	for (i = 2; i < 10; i++) {
		if (min < n) {
			min = 111 * i;
		}
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define FORD(i, a, b) for (int i=a; i>(int)(b); i--)
#define PPC(x) __builtin_popcount(x)
#define MSB(x) (31 - __builtin_clz(x))
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;

const int maxN = 1 << 19, mod = 1000000007;

template <class T1, class T2> inline void addMod(T1& a, T2 b)	{   a = (a + b) % mod;  }
template <class T1, class T2> inline void multMod(T1& a, T2 b)	{   a = a * b % mod;    }

long long qpow(long long a, long long b)
{
    long long res0 = 1;
    for (; b!=0; b>>=1)
    {
        if (b & 1)  multMod(res0, a);
        multMod(a, a);
    }
    return res0;
}

int a[maxN], b[maxN];

void solve()
{
	int n, m, k;
	scanf ("%d%d%d", &n, &m,&k);
	FOR(i, 0, n)
		scanf ("%d", a+i);
	FOR(i, 0, m)
		scanf ("%d", b+i);
	int res = 1 << 20;
	while (k--)
	{
		int x, y, z;
		scanf ("%d%d%d", &x, &y, &z);
		x--, y--;
		res = min(res, a[x] + b[y] - z);
	}
	
	sort(a, a+n);
	sort(b, b+m);
	res = min(res, a[0] + b[0]);
	
	printf("%d\n", res);
} 

 
int main()
{
    int t;
    t=1;//scanf ("%d", &t);
    while (t--)
    	solve();
    return 0;    
}


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


void solve(long long N, long long K, long long X, long long Y){
	if(N<K){
		cout << N*X << endl;
	}else{
		cout << (K*X)+((N-K)*Y) << endl;
	}

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    solve(N, K, X, Y);
    return 0;
}


Measured memory_bytes: 256
import sys


DEBUG = False


def solv(nums):
    r = []
    for i in range(1, 10):
        if DEBUG:
            print 'i:     ', i
        if judge(list(nums), i):
            r.append(i)
        if DEBUG:
            print '===='
    if len(r) == 0:
        r.append(0)
    return r


def judge(nums, n):
    if nums.count(n) >= 4:
        return False
    else:
        nums.append(n)
        nums.sort()
        heads = overlup(nums)
        r = []
        for h in heads:
            if DEBUG:
                print 'nums:  ', nums
            nums2 = list(nums)
            nums2.pop(nums2.index(h))
            nums2.pop(nums2.index(h))
            if DEBUG:
                print 'head:  ', h
                print 'nums2: ', nums2
            if judge2(nums2):
                r.append(h)
        if r:
            return True
        else:
            return False


def judge2(nums):
    if not nums:
        if DEBUG:
            print '---'
        return True
    nums2 = list(nums)
    h3 = []
    h3.append(nums.pop(0))
    try:
        j = nums.index(h3[0] + 1)
        h3.append(nums.pop(j))
        k = nums.index(h3[0] + 2)
        h3.append(nums.pop(k))
        if DEBUG:
            print h3
        if judge2(nums):
            return True
    except ValueError:
        for i in range(1, len(h3)):
            nums.append(h3.pop(i))
        nums.sort()
        
    h3 = []
    h3.append(nums2.pop(0))
    h3.append(nums2.pop(0))
    if h3[0] == h3[1]:
        h3.append(nums2.pop(0))
        if DEBUG:
            print h3
        if h3[1] == h3[2]:
            return judge2(nums2)
        else:
            return False
    else:
        return False




def overlup(lis):
    r = []
    def func(x, y):
        if x == y and x not in r:
            r.append(x)
        return y
    reduce(func, lis)
    return r


def difference(lis):
    return [y - x for x, y in zip(lis, lis[1:])]


c = 0

for line in sys.stdin:
    c += 1
    if DEBUG:
        print 'CASE:', str(c)
    numbers = map(int, line.rstrip('\n'))
    print ' '.join(map(str, solv(numbers)))

Measured memory_bytes: 4392
// AOJ 2039: Space Coconut Crab II
// 2017.11.6 bal4u@uu

#include <stdio.h>
#define TM 0
#if TM
#include <time.h>
#endif

#define MAX  30000
char tbl[MAX+1] = {1,1,0,0};		// zero: if prime
int p[3250] = {						// p[39] = 173 = sqrt(MAX), max sz = 3245
 2,   3,  5,  7, 11, 13, 17, 19, 23, 29, 
 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 
 73, 79, 83, 89, 97,101,103,107,109,113, 
127,131,137,139,149,151,157,163,167,173 }; int sz;

int T;

void mkprime()
{
	int i, j, k;
	for (i = 0; i <= 39; i++) {
		k = p[i];
		for (j = k<<1; j < MAX; j += k) tbl[j] = 1;
	}
	for (sz = 39, i = 173; i <= MAX; i += 2) if (!tbl[i]) p[sz++] = i;
}

int bsch(int x)
{
	int m, l = 0, r = sz;

    while (l < r) {
        m = (l + r) >> 1;
//		if (p[m] == x) return m;
        if (p[m] <= x) l = m + 1; else r = m;
    }
	return l-1;
}

int main()
{
	int i, j, k, m, ans;
#if TM
	clock_t start, end;
	start = clock();
#endif
	mkprime();
	while (scanf("%d", &T) && T > 0) {
		if (!(T & 1)) {
			k = (T>>1)-1;
			if (k > 2 && !(k & 1)) putchar('0');
			else                   putchar('1' - tbl[k]);
			putchar('\n');
		} else {
			ans = 0;
			for (i = 0; ; i++) {
				m = bsch((T-p[i]) >> 1);
				if (m < i) break;
				for (j = i; j <= m; j++) {
					k = p[i] + p[j];
					if (T-k < p[j]) break;
					if (k < T && (k<<1) > T && !tbl[T-k]) ans++;
				}
			}
			printf("%d\n", ans);
		}
	}
#if TM
	end = clock();
	printf("time %lf\n", (double)(end-start)/CLOCKS_PER_SEC);
#endif
	return 0;
}

Measured memory_bytes: 1756
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

#define ll long long
#define pb push_back

int main(){

    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    for(int i = 0; i < H; i ++){
        cin >> S[i];
    }
    vector<vector<ll>> L(H, vector<ll>(W)), R(H, vector<ll>(W)), U(H, vector<ll>(W)), D(H, vector<ll>(W));
    //L, U
    for(int i = 0; i < H; i ++){
        for(int j = 0; j < W; j ++){
            if(S[i][j] == '#'){
                L[i][j] = 0;
                U[i][j] = 0;
            }
            else{
                if(j == 0)L[i][j] = 1;
                else L[i][j] = L[i][j - 1] + 1;
                if(i == 0)U[i][j] = 1;
                else U[i][j] = U[i - 1][j] + 1;
            }
        }
    }
    //R, D
    for(int i = H - 1; i >= 0; i --){
        for(int j = W - 1; j >= 0; j --){
            if(S[i][j] == '#'){
                R[i][j] = 0;
                D[i][j] = 0;
            }
            else{
                if(j == W - 1)R[i][j] = 1;
                else R[i][j] = R[i][j + 1] + 1;
                if(i == H - 1)D[i][j] = 1;
                else D[i][j] = D[i + 1][j] + 1;
            }
        }
    }
    ll ans = 0;
    for(int i = 0; i < H; i ++){
        for(int j = 0; j < W; j ++){
            ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3);
        }
    }
    cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 129664
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>
#include<cstdio>

using namespace std;

typedef double Real;

Real EPS = 1e-8;
const Real PI = acos(-1);

int sgn(Real a, Real b=0){return a<b-EPS?-1:a>b+EPS?1:0;}
Real sqr(Real a){return sqrt(max(a,(Real)0));}

struct Point{  
  Real add(Real a, Real b){
    if(abs(a+b) < EPS*(abs(a)+abs(b)))return 0;
    return a+b;
  }

  Real x, y;
  Point(){}
  Point(Real x,Real y) : x(x) , y(y){}

  Point operator + (Point p){return Point(add(x,p.x), add(y,p.y));}
  Point operator - (Point p){return Point(add(x,-p.x), add(y,-p.y));}
  Point operator * (Real d){return Point(x*d,y*d);}
  Point operator / (Real d){return Point(x/d,y/d);}
  bool operator == (Point p){return !sgn(dist(p));}
  //昇順
  bool operator < (Point p)const{return (p.x!=x)?x<p.x:y<p.y;}
  Real norm(){return sqr(x*x+y*y);}
  Real dist(Point a){return (*this-a).norm();}
  Real dot(Point a){return x*a.x+y*a.y;}
  Real cross(Point a){return x*a.y-y*a.x;}
};

struct Circle{
  Point p;
  Real r;
  Circle(){}
  Circle(Point p, Real r) : p(p) , r(r){}
  
  bool contain(Point a){
    return sgn((a-p).norm(),r)<=0;
  }
  
  Circle circumCircle(Point a,Point b){
    Point q=(a+b)/2;
    return Circle(q,(a-q).norm());
  }
  
  Circle circumscribedCircle(Point p, Point q, Point r){
    Point a=(q-p)*2,b=(r-p)*2;
    Point c(p.dot(p)-q.dot(q),p.dot(p)-r.dot(r));
    Circle res;
    res.p.x=a.y*c.y-b.y*c.x;
    res.p.y=b.x*c.x-a.x*c.y;
    res.p=res.p/a.cross(b);
    return Circle(res.p, p.dist(res.p));
  }

  Circle minEnclosingCircle(vector<Point>ps){
    if(ps.size()==0)return Circle(Point(0,0),0);
    if(ps.size()==1)return Circle(ps[0],0);

    Circle circle=circumCircle(ps[0],ps[1]);
    for(int i=2;i<ps.size();i++){
      if(!circle.contain(ps[i])){
	circle=circumCircle(ps[0],ps[i]);
	for(int j=1;j<i;j++){
	  if(!circle.contain(ps[j])){
	    circle=circumCircle(ps[j],ps[i]);
	    for(int k=0;k<j;k++){
	      if(!circle.contain(ps[k])){
		circle=circumscribedCircle(ps[i],ps[j],ps[k]);
	      }
	    }
	  }
	}
      }
    }
    return circle;
  }

};

int main(void){

  int n;
  cin >> n;
  vector<Point>ps(n);

  for(int i=0;i<n;i++)cin >> ps[i].x >> ps[i].y;
  Circle c;
  printf("%.10f",c.minEnclosingCircle(ps).r);
  cout << endl;

  return 0;
}


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

int main(){
    int X;
    cin >> X;
    while (true) {
        int r = sqrt(X);
        bool check = true;
        for (int i = 2; i <= r; i++) {
            if (X%i==0) {
                check = false;
                break;
            }
        }
        if (check)break;
        else X++;
    }
    cout << X << endl;
    return 0;
}


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

typedef int in;
#define int long long
int MAX=1e9;
int MAXEST=1e18;
int MOD=1e9+7;

int n,m;
int a[1005],b[1005],ors[1005];
int dp[1005][(1<<12)+5];

int f(int idx,int mask)
{
    if(mask==(1<<n)-1)
        return 0;
    if(idx==m)
        return 1e9;
    int &ret=dp[idx][mask];
    if(ret!=-1)
        return ret;
    ret=f(idx+1,mask);
    ret=min(f(idx+1,mask|ors[idx])+a[idx],ret);
    return ret;
}

in main()
{
    int tc=1;
//    cin>>tc>>st;
    while(tc--)
    {
        cin>>n>>m;
        for(int i=0; i<m; i++)
        {
            cin>>a[i]>>b[i];
            for(int j=0; j<b[i]; j++)
            {
                int x;
                cin>>x;
                ors[i]|=(1<<(x-1));
            }
        }
        memset(dp,-1,sizeof dp);
        int ans=f(0,0);
        cout<<(ans<MAX?ans:-1)<<endl;
    }
    return 0;
}


Measured memory_bytes: 35904
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP_ll(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VREP_int(v) for(std::vector<int>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

#define EPS 1000000007

int main(int argc, const char * argv[]) {
	int n,m;
	cin >> n >> m;

	set<int> a;
	int buf;
	REP(i,m){
		cin >> buf;
		a.insert(buf);
	}

	int dp[n+2];
	REP(i,n+2) dp[i]=0;
	dp[0]=1;
	REP(i,n){
		if(a.find(i+1) == a.end()){
			dp[i+1] = (dp[i]+dp[i+1])%EPS;
//			printf("%d -> %d (%d)\n",i,i+1,dp[i]);
		}
		if(a.find(i+2) == a.end()){
			dp[i+2] = (dp[i]+dp[i+2])%EPS;
//			printf("%d -> %d (%d)\n",i,i+2,dp[i]);
		}
	}
	println(dp[n]);

	return 0;
}


Measured memory_bytes: 5376
#include<iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define rep(i,m,n) for(int (i)=(int)(m);(i)<(int)(n);(i)++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;(i)>=(int)(m);(i)--)
#define REP(i,n) rep(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;


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;
}

struct Edge {
	int to, cap, rev;
	Edge(int _to, int _cap, int _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, int from, int to, int cap, bool revFlag, int revCap) {
	G[from].push_back(Edge(to, cap, G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, G[from].size() - 1));
}

void solve() {
	ll n;
	cin >> n;
	Array l(2*n);
	REP(i, 2*n)cin >> l[i];
	sort(all(l));

	ll sum = 0;
	for (int i = 0; i < 2*n; i += 2) sum += l[i];
	cout << sum << en;
}

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

	solve();
	//int t; cin >> t; REP(i, t) solve();

	return 0;
}


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



int main(){
    int r;
    cin >> r;
    cout << r*r << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N, A[201010];
ll xo[201010], sm[201010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i];

    rep(i, 0, N) xo[i] = sm[i] = A[i];
    rep(i, 1, N) xo[i] ^= xo[i - 1];
    rep(i, 1, N) sm[i] += sm[i - 1];

    ll ans = 0;
    rep(l, 0, N) {
        int ok = l, ng = N;
        while (ok + 1 != ng) {
            int md = (ok + ng) / 2;

            ll x = xo[md];
            if (l) x ^= xo[l - 1];

            ll s = sm[md];
            if (l) s -= sm[l - 1];

            if (x == s) ok = md;
            else ng = md;
        }

        ans += ok - l + 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4224
n,m,c=map(int,input().split())
listb = [int(i) for i in input().split()]
lista= []
for i in range(n):
  a = list(map(int,input().split()))
  lista.append(a)
  
ans1=0
ans2=c
for i in range(n):
	for j in range(m):
		ans2=ans2+listb[j]*lista[i][j]
	if ans2>0:
		ans1=ans1+1
	ans2=c
		
print(ans1)
		

Measured memory_bytes: 38384
package main

import (
	"fmt"
)

func main() {
	var A,B,ans int
	fmt.Scan(&A,&B)
	
	switch A+B {
		case 3:
			ans = 3
		case 4:
			ans = 2
		case 5:
			ans = 1
	}
	fmt.Println(ans)
}

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

int main() {
int n;
cin>>n;
int a[101]={0};
for(int i=1;i<=9;i++)
{
    for(int j=i;j<=9;j++)
    {
        a[i*j]=1;
    }
}
if(a[n]==1)
{
    cout<<"Yes"<<endl;
}
else{
  cout<<"No"<<endl;  
}

	return 0;
}


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

int main(){
    string s;
    cin >> s;
    bool can1 = false;
    bool can2 = false;
    if(s[2] == s[3]) can1 = true;
    if(s[4] == s[5]) can2 = true;
    if(can1 && can2) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int min, max;
	scanf("%d", &min);
	max = min;

	for (int i = 0; i < 2; i++) {
		int t;
		scanf("%d", &t);
		if (t > max) max = t;
		if (t < min) min = t;
	}
	printf("%d %d\n", min, max);
	return 0;
}


Measured memory_bytes: 2140
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool int_ceil(T a, T b) { T res = a / b; if(a % b != 0) res++; return res; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	string s; cin >> s;
	ll ans = 0;
	rep(i, s.size()){
		if(i % 2 == 0){
			if(s[i] == 'p') ans--;
		}
		else{
			if(s[i] == 'g') ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3732
// #include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
// #include <algorithm>
#define pb push_back
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define f first
#define s second
// #define cerr if(0)cerr
using namespace std;
typedef long long LL;
typedef pair<int,LL> PILL;

const int N=100010;
const LL  I=1e18;

int n,m,x,y;
vector <int> V[N],T;
int S[N];
LL DP[N];
LL res;
queue <int> Q;

LL maxi(LL x, LL y){if(y>x)return y;return x;}

int main()
{
  // boost;
  scanf("%d%d",&n,&m);
  for(int i=1; i<=m; i++)
  {
    scanf("%d%d",&x,&y);
    V[x].pb(y);
    S[y]++;
  }

  for(int i=1; i<=n; i++)
    if(!S[i])Q.push(i);

  while(!Q.empty())
  {
    int H=Q.front();
    Q.pop();
    T.pb(H);
    for(auto p : V[H])
    {
      S[p]--;
      if(S[p]==0)Q.push(p);
    }
  }
  for(int i=0,d=T.size(); i<d; i++)
  {
    int x=T[i];
    for(int j=0, dx=V[x].size(); j<dx; j++)
    {
      int s=V[x][j];
      DP[s]=maxi(DP[s],DP[x]+1);
    }
  }
  for(int i=1; i<=n; i++)
  {
    res=maxi(res,DP[i]);
  }
  printf("%lld",res);


  return 0;
}


Measured memory_bytes: 7416
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long LL;

int read()
{
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)) f=ch=='-'?-1:f,ch=getchar();
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*f;
}

const int N=131072;
const int S=2000050;

struct data
{
	LL dis,len;

	data (LL dis_=0,LL len_=0){dis=dis_,len=len_;}
}f[S],tmp[N][2];

int st[N],fa[N],a[N],cnt[N];
int son[N][2];
LL lim;
int n,idx;

void dp(int x,LL upp)
{
	if (!son[x][0])
	{
		f[st[x]=++idx]=data(0,0),cnt[x]=1;
		return;
	}
	dp(son[x][0],upp),dp(son[x][1],upp);
	if (!cnt[son[x][0]]||!cnt[son[x][1]]) return;
	st[x]=idx+1;
	int tot[2]={0,0},u=son[x][0],v=son[x][1];
	for (int i=1;i<=cnt[u];++i) f[st[u]+i-1].dis+=a[u],f[st[u]+i-1].len+=a[u];
	for (int i=1;i<=cnt[v];++i) f[st[v]+i-1].dis+=a[v],f[st[v]+i-1].len+=a[v];
	for (int cur=cnt[v],i=cnt[u];i>=1;--i)
	{
		for (;cur&&f[st[v]+cur-1].dis+f[st[u]+i-1].len>upp;--cur);
		if (cur) tmp[++tot[0]][0]=data(f[st[u]+i-1].dis,f[st[v]+cur-1].len);
	}
	for (int cur=cnt[u],i=cnt[v];i>=1;--i)
	{
		for (;cur&&f[st[u]+cur-1].dis+f[st[v]+i-1].len>upp;--cur);
		if (cur) tmp[++tot[1]][1]=data(f[st[v]+i-1].dis,f[st[u]+cur-1].len);
	}
	int ptr[2]={tot[0],tot[1]};
	for (;ptr[0]||ptr[1];)
	{
		data ret;
		if (!ptr[0]||(ptr[1]&&tmp[ptr[0]][0].dis>tmp[ptr[1]][1].dis||tmp[ptr[0]][0].dis==tmp[ptr[1]][1].dis&&tmp[ptr[0]][0].len>tmp[ptr[1]][1].len)) ret=tmp[ptr[1]--][1];
		else ret=tmp[ptr[0]--][0];
		if (!cnt[x]||f[st[x]+cnt[x]-1].len>ret.len) f[st[x]+(cnt[x]++)]=ret;
	}
	idx+=cnt[x];
}

bool judge(LL upp)
{
	idx=0;
	for (int i=1;i<=n;++i) st[i]=cnt[i]=0;
	dp(1,upp);
	return cnt[1];
}

LL binary_search()
{
	LL l=0,r=lim,ret=-1;
	for (LL mid;l<=r;)
	{
		mid=l+r>>1;
		if (judge(mid)) r=(ret=mid)-1;
		else l=mid+1;
	}
	return ret;
}

int main()
{
	n=read();
	for (int i=2;i<=n;++i)
	{
		fa[i]=read(),lim+=a[i]=read();
		if (son[fa[i]][0]) son[fa[i]][1]=i;
		else son[fa[i]][0]=i;
	}
	printf("%lld\n",binary_search());
	return 0;
}

Measured memory_bytes: 43776
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int a[N],dp[N];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=2;i<=n;i++)
		dp[i]=INT_MAX;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=2;i<=n;i++)
		for(int j=1;j<=k&&j<i;j++)
			dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
	printf("%d\n",dp[n]);
	return 0;
}


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

int N;
string s;
string t1 = "maerd", t2 = "remaerd", t3 = "esare", t4 = "resare";


bool chk(){
	reverse(s.begin(), s.end());
	int N = s.length();
	
	for(int i=0;i<N;){
		
		if(s[i]=='m'){
			if(i+5<=N && s.substr(i,5)==t1) i += 5;
			else return 0;
		}
		else if(s[i]=='r'){
			if(i+7<=N && s.substr(i,7)==t2) i += 7;
			else if(i+6<=N && s.substr(i,6)==t4) i += 6;
			else return 0;
		}
		else if(s[i]=='e'){
			if(i+5<=N && s.substr(i,5)==t3) i += 5; 
			else return 0;
		}
		
		else return 0;
	}
	
	return 1;
}

int main(){
//	freopen("5.in", "r", stdin);
//	freopen("5.ans", "w", stdout);
	
	int T;
	//cin>>T;
	
	T = 1;
	while(T--){
		cin>>s;
		if(chk()) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cmath>

int main(void) {
  int a = 0;
  int b = 0;
  int C = 0;

  std::cin >> a >> b >> C;

  double h = b * std::sin(C * (M_PI / 180.0));
  double S = (a * h) / 2.0;
  
  double x = std::sqrt(std::pow(a, 2.0) + std::pow(b, 2.0) - 2.0 * a * b * std::cos(C * (M_PI / 180.0)));

  double L = a + b + x;

  std::printf("%f %f %f\n", S, L, h);
  
  return 0;
}

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

const int MAX_N = 2e5 + 1;
const int INF = 1e6;

int n, p[MAX_N];
set<pair<int, pair<int, int> > > s;
int segtree[2][MAX_N * 4];

inline int min_i(int x, int y) {
	return(p[x] < p[y] ? x : y);
}	

	int N = 1;
int get_min(int x, int l, int r, int L, int R, int v) {
	/*
	cout << "   " << x << " "<< l << " " << r << "   " << L << " " << R << "\n";
	*/
	if(L >= l && R <= r) return segtree[x][v];
	if(L > r || R < l) return 0;
	return min_i(get_min(x, l, r,  L,          (L+R)/2, 2*v),
		         get_min(x, l, r, (L+R)/2 + 1,  R,      2*v + 1));
}

int find_min(int l, int r) {
	return get_min(l&1, l, r, 1, N, 1);
}

void add(int l, int r) {
	int m = find_min(l ,r);
	s.insert(
		make_pair(p[m], make_pair(l, r))
	);
}	

int main() {
	ios_base::sync_with_stdio(0);

	cin >> n;
	for(int i = 1; i <= n; i++) cin >> p[i];
	p[0] = INF;
	
	while(N < n) N <<= 1;
	for(int x = 0; x < 2; x++) {
		for(int i = 0; i < n; i++) {
			if((i&1) != x) segtree[x][i+N] = i+1;
		}	
		for(int t = N-1; t; t--) {
			segtree[x][t] = min_i(segtree[x][2*t],
			                      segtree[x][2*t+1]);
		}	
		/*
		for(int i = 1; i < 2*N; i++) {
			cout << segtree[x][i] << ' ';
		}
		cout << '\n';
		*/
	}
	
	add(1, n);
	vector<int> q;
	for(int _ = 0; _ < n; _ += 2) {
		/*
		cout << "============\n";
		for(auto __ : s) {
			cout << __.first << " (" << __.second.first << ", " << __.second.second << ")\n";
		}
		*/
		auto nxt = *(s.begin());
		
		int l = nxt.second.first;
		int r = nxt.second.second;
		s.erase(s.begin());
		
		int m = find_min(l, r);
		/*
		cout << l << " " << r << " " << 	m << '\n';
		*/
		q.push_back(p[m]);
		
		if(l < m) add(l, m-1);
		
		l = m+1;
		
		m = find_min(m+1, r);
		q.push_back(p[m]);
		
		if(l < m) add(l, m-1);
		if(m < r) add(m+1, r);
	}
	
	for(int x : q) cout << x << ' ';
	cout << '\n';
	
	return 0;
}

Measured memory_bytes: 11508
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
//const LL LINF = 100100200300400500600ll;
const LL LINF = 9223372036854775807ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K; cin >> N >> K;
    VL x(N), y(N);
    REP(i,N) cin >> x[i] >> y[i];

    LL ans = LINF;
    REP(xl,N)
    {
        REP(xs,N)
        {
            REP(yl,N)
            {
                REP(ys,N)
                {
                    if(x[xl] < x[xs] || y[yl] < y[ys]) continue;
                    int cnt = 0;
                    REP(i,N){
                        if(x[xs] <= x[i] && x[i] <= x[xl] && y[ys] <= y[i] && y[i] <= y[yl]) cnt++;
                    }
                    if(cnt >= K){
                        ans = min(abs(x[xl]-x[xs])*abs(y[yl]-y[ys]), ans);
                    }
                }
            }
        }
    }
    cout << ans << endl;



}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

// 最上位ビットを残してあとは 0 にする
int highestOneBit(unsigned int i) {
  i |= (i >>  1);
  i |= (i >>  2);
  i |= (i >>  4);
  i |= (i >>  8);
  i |= (i >> 16);
  return i - (i >> 1);
}
struct BIT {
  int n;
  vector<ll> tree;
  BIT(int n):n(n),tree(n+1) {} 
  void fill(ll val) {
    REP(i, n+1) tree[i] = (i&-i) * val;
  }
  void add(int idx, ll val) {
    for (int x=idx+1; x<=n; x+=x&-x) tree[x] += val;
  }
  // sum[0, idx]
  ll range(int idx) {
    ll sum=0;
    for (int x=idx+1; x>0; x-=x&-x) sum += tree[x];
    return sum;
  }
  // sum[a, b]
  ll range(int a, int b) {
    return range(b) - range(a - 1);
  }
};

const int MAX_N = 112345;
int a[MAX_N];
int b[MAX_N];
int s[MAX_N];

BIT bit(MAX_N * 2);
  
// 数列 m の中で X 以下の要素の個数を返す
ll f0(const int N, int X) {
  vector<int> m;
  ll res = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      vector<int> v;
      for (int k = i; k <= j; k++) {
        v.push_back(a[k]);
      }
      sort(ALL(v));
      m.push_back(v[v.size()/2]);
      if (v[v.size() / 2] <= X)
        res++;
    }
  }
  sort(ALL(m));
  for (int i = 0; i < (int)m.size(); i++) {
    if (i == (int)m.size() / 2) cout << endl;
    cout << m[i] << " ";
  }
  cout << endl;
  return res;
}


// 数列 m の中で X 以下の要素の個数を返す
ll f(const int N, int X) {
  ll res = 0;
  REP(i, N) b[i] = a[i] <= X ? -1 : +1;
  s[0] = 0;
  REP(i, N) s[i+1] = s[i] + b[i];
  // pv(a, a+N);
  // pv(b, b+N);
  // pv(s, s+N+1);
  bit.fill(0);
  const int O = MAX_N;
  bit.add(O + s[0], 1);
  for (int i = 1; i <= N; i++) {
    res += i - bit.range(O + s[i]);
    bit.add(O + s[i], 1);
  }
  return res;
}

int main2() {
  int N = nextInt();
  REP(i, N) a[i] = nextInt();

  vector<int> cand(N);
  REP(i, N) cand[i] = a[i];
  sort(ALL(cand));
  cand.erase(unique(ALL(cand)), cand.end());
  const ll M = (ll)N*(N+1)/2;
  int lo = -1;
  int hi = cand.size();
  while (hi - lo > 1) {
    int mid = (lo + hi) / 2;
    if (f(N, cand[mid]) <= M/2) {
      lo = mid;
    } else {
      hi = mid;
    }
  }
  ll ans = cand[hi];
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
int cntDiv(int n){
	int ans = 0;
	for (int i= 1;i*i<=n;i+=2){
		if(n%i==0){
			if(i*i==n)ans++;
			else ans +=2;
		}
	}
	return ans;
}
string w[110];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	string n;
	cin >> n;
	REP(i,3){
		if(n[i]=='9')cout << '1';
		else cout << '9';
	}
	return 0;
}


Measured memory_bytes: 256
N = int(input())
S = []
for _ in range(N):
  S.append(input())

C = {
  'AC': 0,
  'WA': 0,
  'TLE': 0, 
  'RE': 0
}
for s in S:
  C[s] += 1

for k, v in C.items():
  print(k + " x " + str(v))

Measured memory_bytes: 16184
/**
 *
 * AtCoder Beginner Contest 101 - Problem D: Snuke Numbers (https://arc099.contest.atcoder.jp/tasks/arc099_b)
 *
 * Process a string of symbols '+' and '-' and find the result.
 *
 * Ad-Hoc solution: sum +1 for each '+', subtract one for each '-', starting from zero.
 */
#include <iostream>
#include <vector>

#define LOG(var, sep) (cerr << #var << " = " << (var) << (sep))
#define LOGM(msg) (cerr << (msg))
#define LOGV(vec, sep) { cerr << #vec << " ="; for (const auto& v : vec) cerr << " " << v; cerr << (sep); }
#define LOGA(arr, N, sep) { cerr << #arr << " ="; for (int i = 0; i < N; ++i) cerr << " " << (arr)[i]; cerr << (sep); }
#define LOGA2(arr, N, M, sep) { cerr << #arr << " =\n"; for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) cerr << (arr)[i][j] << " "; cerr << endl; } cerr << (sep); }


using namespace std;
using ll = long long;

ll S(ll N)
{
    ll ans = 0;

    while (N)
    {
        ans += (N % 10);
        N /= 10;
    }

    return ans;
}

ll f(ll N)
{
    if (N == 1)
        return 1;

    vector<ll> cs;
    cs.push_back(N);
 
    ll x = N, y = N, base = 1;

    while (y)
    {
        auto d = y % 10;
        y /= 10;

        for (int i = d + 1; i <= 9; ++i)
        {
            x += base;
            cs.push_back(x);
        }

        base *= 10;
    }

    auto ans = N, s = S(N);

    for (const auto& c : cs)
    {
/*if (N == 10)
{
    auto a = 1.0 * N/S(N);
    auto b = 1.0 * c/S(c);
    LOG(c, ' '); LOG(S(c), ' '); LOG(a
}*/
        if (c * s < ans * S(c))
        {
            ans = c;
            s = S(c);
        }
    }
    
    return ans;
}

void solve(ll K)
{
    ll x = 1;

    while (K--)
    {
        cout << x << endl;
        x = f(x + 1);
    }
}

int main()
{
    ios::sync_with_stdio(false);

    ll K;
    cin >> K;

    solve(K);

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<class T>//ex) auto dp = make_vec(4,4,4,INF);
vector<T> make_vec(size_t s, T val) { return vector<T>(s, val); }
template<class... Size>
auto make_vec(size_t s, Size... tail) {
	return vector<decltype(make_vec(tail...))>(s, make_vec(tail...));
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
	for (const auto& e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& st) {
	for (const auto& e : st) os << e << " ";
	return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const map<T1, T2>& mp) {
	for (const auto& e : mp) os << e << " ";
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T&& h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head&& h, Tail&&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	string S;
	cin >> S;

	auto dp = make_vec(N + 1, 4, 1000, 0);//dp[i+1][j][k]:i文字目まで見てj文字確定したときの文字列kが実現できるなら1
	dp[0][0][0] = 1;

	for (Int i = 0; i < N; i++) {
		for (Int j = 0; j < 3; j++) {
			for (Int k = 0; k < 100; k++) {
				if (dp[i][j][k]==0) {
					continue;
				}
				//i文字目を選択する場合
				dp[i + 1][j + 1][10 * k + (S[i] - '0')] = 1;
			
				//i文字目を選択しない場合
				dp[i + 1][j][k] = 1;
			}

			//DMP(dp);
		}
	}

	Int ans = 0;
	vector<Int> seen(1000);
	for (Int i = 1; i <= N; i++) {
		for (Int k = 0; k < 1000; k++) {
			if (dp[i][3][k]) {
				if (seen[k]) {
					continue;
				}
				ans++;
				seen[k] = 1;
			}
		}
	}
	cout << ans << "\n";

}


Measured memory_bytes: 474880
def solve(n,d):
    if n == 1:
        return d[0]

    dp = [0] * n
    dp[0] = 0
    dp[1] = abs(d[0] - d[1])

    for i in range(2,n):
        dp[i] += min(abs(d[i] - d[i - 1]) + dp[i - 1],abs(d[i] - d[i - 2]) + dp[i - 2])
    
    # print(dp)
    return dp[-1]

def main():    
    n = int(input())
    d = input()
    d = [int(i) for i in d.split()]
    ans = solve(n,d) 
    print(ans)             
main()

Measured memory_bytes: 14524
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll n, numP=1, numQ=1, maxNum = 1;
	cin >> n;
	repeq(i, 1, n) {
		maxNum *= i;
	}
	vll p(n), q(n);
	rep(i, 0, n) {
		cin >> p[i];
	}
	rep(i, 0, n) {
		cin >> q[i];
	}


	ll tmpNum = maxNum;
	rep(i, 0, n) {
		tmpNum = tmpNum / (n - i);
		numP += (p[i] - 1) * tmpNum;
		numQ += (q[i] - 1) * tmpNum;
		rep(j, i + 1, n) {
			if (p[j] > p[i]) {
				p[j]--;
			}
			if (q[j] > q[i]) {
				q[j]--;
			}
		}
	}
	outn(abs(numP - numQ));


	return 0;
}


Measured memory_bytes: 256
#include<set>
#include<map>
#include<cmath>
#include<deque>
#include<stack>
#include<ctime>
#include<queue>
#include<vector>
#include<cstdio>
#include<cstring>
#include<climits>
#include<iostream>
#include<algorithm>
#define LL long long
#define ULL unsigned long long
using namespace std;
int read(){
	int f=1,x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f*x;
}
#define MAXN 100000
#define INF 0x3f3f3f3f
int main(){
	int a=read(),b=read();
	printf("%d\n",max(0,a-2*b));
	return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let (h, w) = get!(usize, usize);
    if 2 <= h && 2 <= w {
        println!("{}", (w - 2) * (h - 2));
    } else {
        if h == 1 && w == 1 {
            println!("1");
        } else {
            if h == 1 {
                println!("{}", w - 2);
            } else {
                println!("{}", h - 2);
            }
        }
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
#define MOD 1000000007;

using namespace std;
using namespace __gnu_pbds;
//typedef tree<TYPE, null_type, less<TYPE>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//typedef tree<TYPE, null_type, less_equal<TYPE>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;

long long a, b;

int gcd(long long a, long long b){
	if(!b) return a;
	else return gcd(b, a % b);
}

int main(){
	//IO("input.txt", "output.txt");
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> a >> b;
	cout << a * b / gcd(a, b) << "\n";
 	return 0;
}

Measured memory_bytes: 256