akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const double EPS = 1E-10;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}



int main(){
    int H, W; std::cin >> H >> W;
    std::vector<int> cnt(26, 0);
    {
        std::string a;
        for(int i(0); i < H; ++i){
            std::cin >> a;
            for(int j(0); j < W; ++j){
                ++cnt[a[j]-'a'];
            }
        }
    }
    int cnt1(0), cnt2(0);
    for(int i(0); i < 26; ++i){
        if(cnt[i] % 2) ++cnt1;
        else if(cnt[i] % 4) ++cnt2;
    }
    int lim1((H % 2) & (W % 2)), lim2(0);
    if(H % 2) lim2 += W / 2;
    if(W % 2) lim2 += H / 2;
    if(cnt1 > lim1){
        std::cout << "No" << std::endl;
        return 0;
    }
    if(cnt2 > lim2){
        std::cout << "No" << std::endl;
        return 0;
    }
    std::cout << "Yes" << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define lc 2 * v
#define rc 2 * v + 1
#define mid (s + e) / 2
#define ll long long
#define int long long
#define ld long double
#define pii pair <int , int>
#define pll pair <long long , long long>
#define FAST ios::sync_with_stdio(false);cin.tie(0);
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

const int maxn = 2e5 + 10 , N = 2e6 + 10 , SQ = 320 , base = 1999 , mod = 1e9 + 7 , INF = -1e18 , lg = 33;

int32_t main() {
    FAST
    int a[4];
    for (int i = 0; i < 4; ++i) {
        cin >> a[i];
    }
    int ans = INF;
    for (int j = 0; j < 2; ++j) {
        for (int i = 2; i < 4; ++i) {
            ans = max(ans , a[i] * a[j]);
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
string S;
int ans = 700;

int main(){
    cin >> S;
    rep(i,3) if(S[i] == 'o') ans += 100;
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0) {
				break;
			}
			for (int i = 0; i < H; i++) {
				for (int d = 0; d < W; d++) {
					if (i % 2 == 0) {
						if (d % 2 == 0) {
							System.out.print("#");
						} else {
							System.out.print(".");
						}
					} else if (i % 2 != 0) {
						if (d % 2 == 0) {
							System.out.print(".");
						} else {
							System.out.print("#");
						}
					}
				}
				System.out.println("");
			}System.out.println("");
		}
		sc.close();
	}
}


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

int main(){

string s;
cin >> s;
bool a,b;
a = (s[0]==s[1]&&s[1]==s[2]);
b = (s[1]==s[2]&&s[2]==s[3]);

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

  return 0;
    }

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

mod=10**9+7
ans=0

for i in range(61):
    x=0
    for j in range(N):
        if A[j]>>i&0b1:
            x+=1
    now=x*(N-x)%mod
    for j in range(i):
        now=now*2%mod
    ans+=now
    ans%=mod

print(ans)

Measured memory_bytes: 124600
import java.util.*;
fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    println(ans(n))
}
 
fun ans(n:Int):String{
    for(i in 1..9){
        for(j in 1..9){
            if(i*j==n){
                return "Yes"
            }
        }
    }
    return "No"
}

Measured memory_bytes: 31384
#pragma region Macros
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

template<class T>bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;
constexpr double EPS = 1e-10;
#pragma endregion

void solve() {
    int a, b;
    cin >> a >> b;
    for (int i=0; i<max(a, b); i++) {
        cout << min(a, b);
    }
    cout << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


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

int search(int A[],int n,int key){
	int i=0;
	A[n]=key;
	while(A[i]!=key)i++;
	return i!=n;
}

int main() {
int i,n,A[10000+1],q,key,sum=0;
scanf("%d",&n);
for (int i = 0; i < n; ++i) {scanf("%d",&A[i]);}
scanf("%d",&q);
for (int i = 0; i < q; ++i) {
	scanf("%d",&key);
	if(search(A,n,key))sum++;
}
printf("%d\n",sum);
return 0;
}

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

int main() {
  int n;
  std::cin >> n;
  std::vector<int> l(n);
  int sum = 0;
  for (auto &i : l) {
    std::cin >> i;
    sum += i;
  }

  const int max_l = *std::max_element(l.cbegin(), l.cend());

  if (max_l < sum - max_l) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stdio.h>

using namespace std;

int main() {
    // 入力
    int N, K;
    while (cin >> N >> K) {
        if (N == 0) break;
        vector<long long> a(N);
        for (int i = 0; i < N; ++i) cin >> a[i];

        // 累積和を前計算
        vector<double> s(N+1, 0);
        //for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i];
        for (int i = 0; i < N; ++i){
            s[i+1] = s[i] + (a[i]+1.0)/2.0;
            //cout << s[i+1] << endl;
        }
        //cout << "---" << endl;

        // 答えを求める
        double res = 0.0; // 最初は無限小の値に初期化しておく
        for (int i = 0; i <= N-K; ++i) {
            double val = s[K+i] - s[i];
            //cout << val << endl;
            if (res < val) res = val;
        }
        printf("%.7f\n", res);
        //cout << res << endl;
    }
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

int main()
{


    lint n,ans;
    cin >> n;

    ans = 3 * n * n;

    cout << ans <<"\n";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,m,a[101];
bool nibun(int x){
	int s=0,q=0,t=0;
	r(i,n){
		if(s+a[i]<=x)s+=a[i];
		else s=0,q++,i--,t++;
		if(t>1000)return 0;
	}
	return m>=q+1;
}
main(){
	while(cin>>m>>n,m){
	  r(i,n)cin>>a[i];
	  int l=0,r=1500001;
	  while(l<r){
    	int mid=(l+r)/2;
		if(nibun(mid))r=mid;
		else l=mid+1;
	  }
	  cout<<l<<endl;
    }
}

Measured memory_bytes: 2984
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:input()

"""========main code==============="""

x,y=ml()
a=ll()
b=sum(a)
c=b/(4*y)
ans=0
f=0
for i in a:
    if(i>=c):
        ans+=1
    if(ans>=y):
        f=1
        break
if f:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38592
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n,k = map(int,input().split())
# 配列入力の受け取り
arrP = list(map(int,input().split()))

sumlist = [0]
meansum = 0
for num in arrP:
    heikin = (1 + num)/2
    meansum += heikin
    sumlist.append(meansum)

ans = 0
for i in range(k,n+1):
    temp = sumlist[i] - sumlist[i-k]
    ans = max(ans,temp)

print(ans)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する



Measured memory_bytes: 25060
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int N = sc.nextInt(), W = sc.nextInt();
			int[] v = new int[N], w = new int[N];
			for(int i = 0; i < N; i++) {
				w[i] = sc.nextInt();
				v[i] = sc.nextInt();
			}
			long[][] dp = new long[N + 1][W + 1];
			for(int i = 0; i <= N; i++) {
				for(int j = 0; j <= W; j++) {
					dp[i][j] = -1;
				}
			}
			dp[0][0] = 0;
			for(int i = 0; i < N; i++) {
				for(int j = 0; j <= W; j++) {
					if(dp[i][j] != -1) {
						dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][j]);
						if(j + w[i] <= W) {
							dp[i + 1][j + w[i]] = Math.max(dp[i][j] + (long)v[i], dp[i + 1][j + w[i]]);
						}
					}
				}
			}
			long ans = 0;
			for(int i = 0; i <= W; i++) ans = Math.max(ans, dp[N][i]);
			System.out.println(ans);
		}
	}
}


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

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	ll tmp;
	ll x, y;
	int a, b, c, d, e, f;
	cin >> a>> b>> c>> d>> e>>f;
	bool ch[31][3001] = {}; //water, suger
	ch[0][0] = true;
	REP(i, 31){
		REP(j, 3001){
			if(ch[i][j]){
				if(i+a <= 30) ch[i+a][j] = true;
				if(i+b <= 30) ch[i+b][j] = true;
				if(j+c <= 3000) ch[i][j+c] = true;
				if(j+d <= 3000) ch[i][j+d] = true;
			}
		}
	}
	double nd = -1;
	int sw, su;
	REP(i, 31){
		REP(j, 3001){
			if(ch[i][j] && i * 100 + j <= f && i * e >= j
			&& (double)(j*100)/(i * 100 + j) > nd){
				nd = (double)(j*100)/(i * 100 + j);
				sw = (i * 100 + j);
				su = j;
			}
		}
	}
	cout << sw << " " << su << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
typedef long long ll;
const int INF=1000000000;
const int MOD=1000000007;

int main()
{
 int a;
 cin >> a;
 cout<< a+a*a+a*a*a;
  return 0;
}

Measured memory_bytes: 3632
n, k = map(int, input().split())
A = list(map(int, input().split()))

max_a = max(A)
min_a = 0

while abs(max_a - min_a) > 1:
    cnt = 0
    target_length = (max_a + min_a)//2
    for a in A:
        cut_num = (a + target_length - 1)//target_length
        cnt += cut_num - 1
    if cnt > k:
        min_a = target_length
    else:
        if target_length - min_a == 1:
            print(target_length)
            exit()
        max_a = target_length

print(max_a)

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

int main() {
  int a, b;
  cin >> a >> b;
  int n = 1;
  int cnt = 0;
  while(n < b) {
    n += a-1;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3572
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ADodecagon {
public:
    static constexpr int kStressIterations = 0;
    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int r;
        cin >> r;
        cout << 3 * r * r << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ADodecagon solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <set>

int a[100001];

int main()
{
  int n, m;
  scanf("%d %d", &n, &m);
  std::set<int> b;
  for (int i = 0; i < m; ++i)
  {
    int d;
    scanf("%d", &d);
    b.insert(d);
  }
  a[0] = 1;
  if (b.count(1) == 0) a[1] = 1;
  for (int i = 2; i <= n; ++i)
  {
    if (b.count(i) == 0)
    {
      a[i] = (a[i - 1] + a[i - 2]) % 1000000007;
    }
  }
  printf("%d\n", a[n]);
  return 0;
}

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

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b - 1); i >= (int)(a); --i)
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(a) ((int)(a).size())
#define BIT(x, i) (((x) >> (i)) & 1)
#define SQ(x) ((x) * (x))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


int main() {
    int h, w;
    while (cin >> h >> w, h|w) {
        pair<int, pii> a = {SQ(h) + SQ(w), {h, w}};
        pair<int, pii> mi = {100000, {0, 0}};
        FOR(i, 1, 151) {
            FOR(j, i+1, 151) {
                pair<int, pii> b = {SQ(i) + SQ(j), {i, j}};
                if (a < b && mi > b) {
                    mi = b;
                }
            }
        }
        cout << mi.second.first << " " << mi.second.second << endl;
    }
}

Measured memory_bytes: 3080
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    int n;
    cin >> n;
    vector<vector<int>> graph(n);
    for(int i = 0; i < n - 1; ++i){
        int a, b;
        cin >> a >> b;
        --a, --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    vector<int> dist(n, INF);
    dist[0] = 0;
    queue<int> que;
    que.push(0);
    while(!que.empty()){
        int from = que.front();
        que.pop();
        for(int to : graph[from]){
            if(dist[to] > dist[from] + 1){
                dist[to] = dist[from] + 1;
                que.push(to);
            }
        }
    }

    int st = max_element(dist.begin(), dist.end()) - dist.begin();
    dist.assign(n, INF);
    dist[st] = 0;
    que.push(st);
    while(!que.empty()){
        int from = que.front();
        que.pop();
        for(int to : graph[from]){
            if(dist[to] > dist[from] + 1){
                dist[to] = dist[from] + 1;
                que.push(to);
            }
        }
    }

    int diameter = *max_element(dist.begin(), dist.end());
    if(diameter % 3 == 1)   cout << "Second\n";
    else    cout << "First\n";
}

Measured memory_bytes: 16420
#include <stdio.h>
#include <stdlib.h>

struct stack {
	int car_number;
	struct stack *down;
};

struct stack *push(int, struct stack *);
struct stack *pop(struct stack *);

int main(void) 
{
	struct stack bottom = {0, NULL};
	struct stack *top   = &bottom;
	int car_number;

	while (scanf("%d", &car_number) != EOF) {
		if (car_number == 0) {
			top = pop(top);
		} else {
			top = push(car_number, top);
		}
	}

	return 0;
}

struct stack *push(int car_number, struct stack *top) 
{
	struct stack *new;

	new = (struct stack *) malloc(sizeof(struct stack));

	new->car_number = car_number;
	new->down       = top;

	return new;
}

struct stack *pop(struct stack *top) 
{
	struct stack *p;

	printf("%d\n", top->car_number);

	p = top->down;

	free(top);

	return p;
}

Measured memory_bytes: 596
# -*- coding: utf-8 -*-
N = int(input())
S = input()

moji_list = []

q, mod = divmod(N, 26)
for i in range(len(S)):
  if (ord(S[i])+mod) <= 90:
    moji_list.append(chr(ord(S[i]) + mod))
  else:
    moji_list.append(chr(ord(S[i]) + mod - 26))
    
  
print("".join(moji_list))

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

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

    int n;
    cin >> n;
    string s;
    cin >> s;


    char bef = '0';
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(bef == s[i]){
            continue;
        }else{
            ans++;
            bef = s[i];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#define N 44
void fibonacci(int);
int F[N];

int main(){
  int n,i;
  scanf("%d",&n);
  fibonacci(n);
  printf("%d\n",F[n]);
  return 0;
}

void fibonacci(int n){
  int i;
  F[0]=F[1]=1;
  for(i=2;i<=n;i++){
    F[i]=F[i-2]+F[i-1];
  }
}



Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
 
 
#define EPS (1e-10)
#define equal(a,b) (fabs((a)-(b)) < EPS)
 
class Point {
  public:
 
  double x,y;
   
  Point (double x = 0, double y = 0) : x(x),y(y) {}
  
  Point operator + (Point p) {
    return Point( x+p.x , y+p.y );
  }
  Point operator - (Point p) {
    return Point( x-p.x , y-p.y );
  }
  Point operator * (double a) {
    return Point( a*x , a*y );
  }
  
  double abs() {
    return sqrt(norm());
  }
  double norm() {
    return x*x+y*y;
  }
  
  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }
  
  bool operator == (const Point &p) const {
    return equal( x,p.x )&& equal( y,p.y );
  }
};
 
typedef Point Vector;
  
double dot(Vector a,Vector b) {
  return a.x*b.x + a.y*b.y;
}
  
double cross(Vector a,Vector b) {
  return a.x*b.y - b.x*a.y;
}
 
Vector rotation(Vector vec,double si,double co){
  Vector res;
  res.x = vec.x*co - vec.y*si;
  res.y = vec.x*si + vec.y*co;
  return res;
}
 
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;
  
int ccw( Point p0 , Point p1 , Point p2 ) {
  Vector a = p1 - p0;
  Vector b = p2 - p0;
  if( cross(a,b) > EPS ) return COUNTER_CLOCKWISE;
  if( cross(a,b) < -EPS ) return CLOCKWISE;
  if( dot(a,b) < -EPS ) return ONLINE_BACK;
  if( a.norm() < b.norm() ) return ONLINE_FRONT;
  return ON_SEGMENT;
}
 
class Segment{
    public:
    Point p1, p2;
    Segment(Point s = Point(), Point t = Point()): p1(s), p2(t){}
};
typedef Segment Line;
 
Point getCrossPointLL(Line l1,Line l2){
  Point p1=l1.p1,p2=l1.p2;
  Point q1=l2.p1,q2=l2.p2;
  Point res;
  res= p1+(p2-p1)*( cross(q2-q1,q1-p1)/cross(q2-q1,p2-p1) );
  return res;
}
 
vector<Point> cutC(vector<Point> t,Line li){
  int n=t.size();
  vector<Point> u;
  int A[200];
  
  for(int i=0;i<n;i++)A[i]=ccw(li.p1,li.p2,t[i]);
  
  for(int i=0;i<n;i++){
    if(A[i]!=CLOCKWISE)u.push_back(t[i]);
    int j=(i+1)%n;
    if(A[i]==COUNTER_CLOCKWISE
       &&A[j]==CLOCKWISE)
      u.push_back( getCrossPointLL(Line(t[i],t[j]),li));
    else if(A[j]==COUNTER_CLOCKWISE
            &&A[i]==CLOCKWISE)
      u.push_back( getCrossPointLL(Line(t[i],t[j]),li));
  }
   
  return u;
}
 
 
int n,m;
double d,V;
vector<Point> G,G2;
vector< Segment > g;

bool check(double M){
  G2 = G;
  for(int i=0;i<n;i++){
    Segment s=g[i];
    Vector v = rotation(s.p2-s.p1,1.0,0.0);
    double k=v.abs();
    v = v*(1.0/k);
    v = v*M;
    s.p1 = s.p1 + v;
    s.p2 = s.p2 + v;
    G2 = cutC(G2,s);
    if(G2.size()<3)return false;
  }
  return true;
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    G.resize(n);
    for(int i=0;i<n;i++)cin>>G[i].x>>G[i].y;
    g.resize(n);
    for(int i=0;i<n;i++)g[i]=(Segment){ G[i] , G[(i+1)%n] };
    
    double L=0.0,R=1e5,M;
    for(int i=0;i<100;i++){
      M=(L+R)/2.0;
      if(check(M))L=M;
      else R=M;
    }
    printf("%.8f\n",L);
  }
  return 0;
}

Measured memory_bytes: 1272
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;
ll N,X;
ll height[51];
ll paty[51];
ll Func(ll eatNum,ll level){
    if(level==0){
        return 1;
    }
    eatNum--;
    if(eatNum==0)return 0;
    ll ret=0;
    if(eatNum<=height[level-1]){
        return ret+Func(eatNum,level-1);
    }else{
        eatNum-=height[level-1];
        ret+=paty[level-1];
    }
    eatNum--;
    ret++;
    if(eatNum==0)return ret;
    if(eatNum<=height[level-1]){
        return ret+Func(eatNum,level-1);
    }else{
        eatNum-=height[level-1];
        ret+=paty[level-1];
    }
    return ret;
}
int main(){
    cin>>N>>X;
    height[0]=1;
    paty[0]=1;
    for(ll i=1;i<=N;i++){
        height[i]=height[i-1]*2+3;
        paty[i]=paty[i-1]*2+1;
    }
    cout<<Func(X,N)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    map<int, int> m;
    int pos = 1;
    m[pos] = 0;
    for (int i = 0; i < k; i++) {
        pos = a[pos - 1];
        if (m.count(pos)) {
            const int onepos = m[pos];          // 1からposまでの回数
            const int pospos = i + 1 - onepos;  // posからposまでの回数
            const int posgoal = (k - onepos) % pospos;

            pos = 1;
            for (int j = 0; j < posgoal + onepos; j++) {
                pos = a[pos - 1];
            }
            cout << pos << endl;
            return 0;
        }
        m[pos] = i + 1;
    }

    cout << pos << endl;
}


Measured memory_bytes: 14760
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String input = null;
		try {
			input = br.readLine();
			br.close();
		} catch (IOException e) {
		}

		int s = Integer.parseInt(input);

		int h = s / 3600;
		s = s % 3600;

		int m = s / 60;
		s = s % 60;

		System.out.println(h + ":" + m + ":" + s);
	}
}


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

using namespace std;

using ll = long long;

void FindPath(int cur, int p, int dst, auto &pre, auto &adj) {
    pre[cur] = p;
    if (cur == dst) return ;

    for (int u : adj[cur])
        if (u != p && pre[u] == -1) FindPath(u, cur, dst, pre, adj);
}

void Paint(int cur, int p, int c, auto &paint, auto &adj) {
    paint[cur] = c;
    for (auto u : adj[cur])
        if (u != p && paint[u] == -1) Paint(u, cur, c, paint, adj);
}

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

    int n;
    cin >> n;
    vector<vector<int>> adj(n);
    for (int i = 0; i < n - 1; ++i) {
        int a, b;
        cin >> a >> b;
        adj[a - 1].push_back(b - 1);
        adj[b - 1].push_back(a - 1);
    }

    vector<int> pre(n, -1);
    FindPath(0, n, n - 1, pre, adj);

    vector<int> path;
    for (int cur = n - 1; pre[cur] != n; cur = pre[cur])
        path.push_back(cur);
    path.push_back(0);

    int size = path.size();
    vector<int> c(n, -1); // 0: black, 1: white
    for (int i = 0; i < size / 2; ++i) c[path[i]] = 1;

    // cout << endl;
    // for (auto v : path) cout << v << " ";
    // cout << endl;
    // for (int v = 0; v < n; ++v)
    //     cout << v << " " << c[v] << endl;
    // cout << endl;

    Paint(0, -1, 0, c, adj);

    // for (int v = 0; v < n; ++v)
    //     cout << v << " " << c[v] << endl;

    int black = 0, white = 0;
    for (int v = 0; v < n; ++v) {
        if (c[v] == 0) ++black;
        else ++white;
    }

    if (white < black) cout << "Fennec\n";
    else cout << "Snuke\n";

    return 0;
}


Measured memory_bytes: 14840
import java.util.*;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    
    if(n > 999){
      System.out.println("ABD");
    }else{
      System.out.println("ABC");
    }
  }
}


Measured memory_bytes: 22356
while input_lines = gets.chomp
    break if input_lines == "0 0"
    tiles_depth, tiles_width = input_lines.split(' ').map!(&:to_i)

    tiles_arr = []
    tiles_move_cache = []
    tiles_depth.times do
        tiles_arr << gets.chomp.split('')

        tiles_cache_temp = []
        tiles_width.times do
            tiles_cache_temp << 0
        end
        tiles_move_cache << tiles_cache_temp
    end

    x_point = 0
    y_point = 0
    loop do
        if tiles_move_cache[y_point][x_point] == 0
            tiles_move_cache[y_point][x_point] = 1
        else
            puts "LOOP"
            break
        end

        case tiles_arr[y_point][x_point]
        when ">"
            x_point += 1
        when "<"
            x_point -= 1
        when "^"
            y_point -= 1
        when "v"
            y_point += 1
        when "."
            puts "#{x_point} #{y_point}"
            break
        end
    end
end

Measured memory_bytes: 6884
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, M, *SC = map(int, read().split())

    A = [-1] * N
    for s, c in zip(*[iter(SC)] * 2):
        s -= 1
        if A[s] != -1 and A[s] != c:
            print(-1)
            return
        else:
            A[s] = c

    if N > 1 and A[0] == 0:
        print(-1)
        return
    elif A[0] == -1:
        if N == 1:
            A[0] = 0
        else:
            A[0] = 1

    for i in range(1, N):
        if A[i] == -1:
            A[i] = 0

    ans = ''.join(map(str, A))

    print(ans)
    return


if __name__ == '__main__':
    main()


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

#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main() {
  int n; cin>>n;
  vector<int> a(n);
  rep(i,n){cin>>a.at(i);a.at(i)--;}
  vector<int> b(n);
  rep(i,n){cin>>b.at(i);} 
  vector<int> c(n-1);
  rep(i,n-1){cin>>c.at(i);}
  
  int ans=0;
  rep(i,n){
    ans+=b.at(a.at(i));
    if(i<n-1){//iの範囲指定
      if((a.at(i)+1==a.at(i+1))){
        ans+=c.at(a.at(i));
      }
    }
  }
  cout<<ans;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

using ll = long long;
using pii = pair<int, int>;

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

	vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int n;
	cin >> n;
	cout << a[n - 1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
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;}
template<class T>
void dump(vector<T> &vec){
	for(int i=0;i<vec.size();i++){
		cout << vec[i];
		if(i+1<vec.size())cout << ' ';
		else cout << endl;
	}
	return;
}
int N,K;
ll a[100100];
ll rui[100100];
ll L[100100];
ll R[100100];
ll dp[100100][2];
ll sum(int l,int r){
	if(l==0)return rui[r];
	else return rui[r]-rui[l-1];
}
ll f(int l,int r){
	ll res = 0ll;
	if(l>0)res += L[l-1];
	if(r<N-1)res += R[r+1];
	return res;
}
int main(){
	cin >> N >> K;
	for(int i=0;i<N;i++){
		cin >> a[i];
	}
	for(int i=0;i<N;i++){
		rui[i] = a[i];
		if(i>0)rui[i] += rui[i-1];
	}
	for(int i=0;i<N;i++){
		if(i>0)L[i] += L[i-1];
		L[i] += max(a[i],0ll);
	}
	for(int i=N-1;i>=0;i--){
		if(i<N-1)R[i] = R[i+1];
		R[i] += max(a[i],0ll);
	}
	ll ans = 0ll;
	for(int i=0;i<N-K+1;i++){
		chmax(ans,sum(i,i+K-1)+f(i,i+K-1));
		chmax(ans,f(i,i+K-1));
	}
	cout << ans << endl;	
	return 0;
}


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

int main() {
    string s;
    cin >> s;

    if (s == "Sunny") {
        cout << "Cloudy" << endl;
    }
    else if (s == "Cloudy") {
        cout << "Rainy" << endl;
    }
    else {
        cout << "Sunny" << endl;
    }

    return 0;
}


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

namespace ConsoleApplication1
{
    struct Edge
    {
        internal int u, v, cost;
    }
    
    class Union_Find
    {
        internal List<int> parents, rank;

        public Union_Find(int n)
        {
            parents = new List<int>();
            rank = new List<int>();

            for(int i = 0; i < n; i++)
            {
                parents.Add(i);
                rank.Add(0);
            }
        }

        public int Find(int x)
        {
            if (parents[x] == x) return x;
            else return parents[x] = Find(parents[x]);
        }

        public void Unite(int x,int y)
        {
            x = Find(x);
            y = Find(y);

            if (x == y) return;

            if (rank[x] < rank[y])
            {
                parents[x] = y;
            }
            else
            {
                parents[y] = x;
                if (rank[x] == rank[y]) rank[x]++;
            }
        }

        public bool Same(int x,int y)
        {
            return Find(x) == Find(y);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            List<Edge> es = new List<Edge>();

            for(int i = 0; i < n; i++)
            {
                int[] input = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), int.Parse);

                for(int j = 0; j < n; j++)
                {
                    if (input[j] != -1)
                    {
                        Edge temp;
                        temp.u = i;
                        temp.v = j;
                        temp.cost = input[j];
                        es.Add(temp);
                    }
                }
            }
            Console.WriteLine(Kruskal(es, n));
        }

        static bool Comp(Edge e1,Edge e2)
        {
            return e1.cost < e2.cost;
        }

        static int Kruskal(List<Edge> es,int n)
        {
            es.Sort((a, b) => a.cost - b.cost);
            Union_Find uf = new Union_Find(n);

            int res = 0;

            for(int i = 0; i < es.Count; i++)
            {
                Edge e = es[i];

                if (!uf.Same(e.u, e.v))
                {
                    uf.Unite(e.u, e.v);
                    res += e.cost;
                }
            }
            return res;
        }
    }
}

Measured memory_bytes: 9504
#include <bits/stdc++.h>
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) (UB(c,x)-LB(c,x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
using namespace std;
template<typename T1, typename T2> using P = pair<T1,T2>;
template<typename T> using V = vector<T>;
struct edge { int from, to; int cost; };
bool operator< (const edge &edge1, const edge &edge2) { return edge1.cost < edge2.cost; };
const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const V<T>& v) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}

signed main()
{
   int N, K; cin >> N >> K;
   if (K == 0) {
      cout << N*N << endl;
      return 0;
   }

   int ans = 0;
   FORE(b, K+1, N) {
      ans += (b - K) * (N / b);
      ans += max(0LL, (N % b) - K + 1);
   }
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ipair = pair<int, int>;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

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

const ll INF = 1LL<<58;

template<class T> int former(const deque<T> &v, T x){
    return upper_bound(v.begin(), v.end(), x) - v.begin() -1;
}

template<class T> int latter(const deque<T> &v, T x){
    return lower_bound(v.begin(), v.end(), x) - v.begin();
}


int main(){
    int A, B, Q;
    cin >> A >> B >> Q;

    deque<ll> s(A);
    deque<ll> t(B);

    rep(i, A) cin >> s[i];
    rep(i, B) cin >> t[i];

    s.push_front(-INF);
    s.push_back(INF);
    t.push_front(-INF);
    t.push_back(INF);

    rep(_, Q){
        ll x;
        cin >> x;

        ll res = INF;

        // 最初にs, 次にt
        rep(i, 2){
            ll visited_first = i ? s[former(s, x)]: s[latter(s, x)];
            rep(j, 2){
                ll visited_second = j? t[former(t, visited_first)]: t[latter(t, visited_first)];
                chmin(res, abs(visited_first - x) + abs(visited_second - visited_first));
            }
        }
        // 最初にt, 次にs
        rep(i, 2){
            ll visited_first = i ? t[former(t, x)]: t[latter(t, x)];
            rep(j, 2){
                ll visited_second = j? s[former(s, visited_first)]: s[latter(s, visited_first)];
                chmin(res, abs(visited_first - x) + abs(visited_second - visited_first));
            }
        }
        cout << res << endl;
    }

    return 0;
}

Measured memory_bytes: 2944
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n;
    cin >> n;
    set<string> ban = {"AGCA", "AGCC", "AGCG", "AGCT",
                       "AAGC", "CAGC", "GAGC", "TAGC",
                       "AAGC", "ACGC", "AGGC", "ATGC",
                       "AGAC", "AGCC", "AGGC", "AGTC",
                       "AGC", "ACG", "GAC"};
    vector<map<string, ll>> dp(n + 1);
    string acgt = "ACGT";
    for (int i = 0; i < 64; i++)
    {
        int mask = i;
        string s = "";
        for (int j = 0; j < 3; j++)
        {
            s += acgt[mask % 4];
            mask /= 4;
        }
        if (ban.find(s) != ban.end())
            continue;
        dp[3][s] = 1;
    }
    for (int i = 3; i < n; i++)
    {
        for (const auto &p : dp[i])
        {
            for (int j = 0; j < 4; j++)
            {
                string s = p.first + acgt[j];
                string t = s.substr(1, 3);
                if (ban.find(s) != ban.end() || ban.find(t) != ban.end())
                    continue;
                dp[i + 1][t] = (dp[i + 1][t] + p.second) % MOD;
            }
        }
    }
    ll ret = 0;
    for (const auto &p : dp[n])
    {
        ret = (ret + p.second) % MOD;
    }
    cout << ret << endl;
}


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


int main() {
        int n;
        cin >> n;
        string s;
        cin >> s;
        vector<int> a(n);
        rep(i,n){
                a[i] = s[i] - '0' - 1;
        }
        int one = 0;
        bool in_one = false;
        rep(i,n){
                if((a[i] % 2 == 1) && (((n-1) & i) == i)) one ++;
                if(a[i] == 1) in_one = true;
        }
        one %= 2;
        if(one == 1) {cout << 1 << endl; return 0;}
        if(in_one) {cout << 0 << endl; return 0;}

        int two = 0;
        rep(i,n){
                if((a[i] == 2) && (((n-1) & i) == i)) two ++;
        }
        two %= 2;
        if(two == 1) cout << 2 << endl;
        else cout << 0 << endl;


        return 0;
}

Measured memory_bytes: 5252
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

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

  int s = 0;
  for (int i = 0; i < n; ++i) {
    if (i == n - 1) {
      s += t;
    } else {
      const int a = v[i + 1] - v[i];
      if (a > t) {
        s += t;
      } else {
        s += a;
      }
    }
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 1024
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int t = 1; 
    // cin >> t; 
    while (t--) {
        int a;
        double b;
        cin >> a >> b;

        int bc = round(b * 100);
        bc = bc * a / 100;
        cout << bc << '\n';
    }
    
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}



Measured memory_bytes: 3844
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

ll n, m;
vector<vector<ll>> G;

ll dp[100100];
ll rec(ll v) {
    if (dp[v] != -1) return dp[v];

    ll res = 0;
    for (auto nv : G[v]) {
        chmax(res, rec(nv) + 1);
    }
    return dp[v] = res;
}

int main() {
    cin >> n >> m;
    G.assign(n, vector<ll>());
    rep(i, m) {
        ll x, y;
        cin >> x >> y;
        x--;
        y--;
        G[x].push_back(y);
    }

    rep(v, n) dp[v] = -1;

    ll res = 0;
    rep(v, n) chmax(res, rec(v));
    cout << res << endl;
}

Measured memory_bytes: 8576
// Problem : A - BBQ Easy
// Contest : AtCoder - AtCoder Grand Contest 001
// URL : https://atcoder.jp/contests/agc001/tasks/agc001_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
const long long int  modu=1e9+7;
#define endl '\n'
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define inp(x)  for(auto &t:x) cin>>t;
#define itr     vector<int>::iterator
#define debug(a) cout << #a << "=" << a << ' '<<endl;
#define out(x)  for(auto &t:x) cout<<t<<" "; cout<<endl;
#define ff first
#define ss second
#define pb push_back
#define initialize(a,v)  for(int i=0;i<a.size();++i) a[i]=v;
#define all(x) x.begin(),x.end()
#define mpt(mp) for(auto it=mp.begin();it!=mp.end();it++)
#define trav(x) for(int i=0;i<(int)x.size();++i)
#define mkp(a,b) make_pair(a,b)
#define sz(x)  (int)x.size()

int noofdig(int N)
{
	return floor(log10(N))+1;
}


ll f(ll a)
{

return 0;

}



void pre()
{

}



void solve()
{
	int n;
	cin>>n;
	ll ans=0;
	vi a(2*n);
	inp(a)
	sort(all(a));
	
	for(int i=0;i<2*n;i+=2)
	{
		ans+=min(a[i],a[i+1]);
		
	}
	
	cout<<ans<<endl;
	







}



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

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


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

int main()
{
    int N;
    cin >> N;
    int A[N];
    for(int i = 0; i < N; ++i) cin >> A[i];
    sort(A, A + N);
    int B[N], C[N];
    fill(B, B + N, 0);
    fill(C, C + N, 0);
    int cur = 0;
    for(int i = 0; i < N; ++i) {
        if(i == 0) { B[cur] = A[i]; C[cur] = 1; continue; }
        if(B[cur] == A[i]) { ++C[cur]; continue; }
        B[++cur] = A[i]; C[cur] = 1;
    }
    int res = 0;
    for(int i = 0; i <= cur; ++i)
        if(C[i]%2) ++res;
    
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define F first
#define S second
using namespace std;
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(a > b){ a = b; return 1; } return 0; }
using ll = long long;
using pi = pair<int,int>;
using vl = vector<ll>;
vector<ll> compress(vector<ll> a) {
  ll n = a.size();
  vector<ll> vals;
  rep(i,n) vals.push_back(a[i]);

  sort(vals.begin(), vals.end());
  vals.erase(unique(vals.begin(), vals.end()), vals.end());

  vector<ll> res;
  rep(i,n) {
    ll id = lower_bound(vals.begin(), vals.end(), a[i]) - vals.begin();
    res.push_back(id);
  }

  return res;
}

int main()
{
  ll n,k; cin >> n >> k;
  vector<ll> h(n+1);
  h[0] = 0;
  rep1(i,n) cin >> h[i];

  vector<ll> com = compress(h);
  map<ll,ll> mp, mp2;
  ll lmax = 0;
  rep(i,n+1) {
    mp[com[i]] = h[i];
    chmax(lmax, com[i]);
  }
  
  using vll = vector<vl>;
  using vlll = vector<vll>;
  ll inf = 1e+15;
  vlll dp(n+2, vll(k+1, vl(lmax+1, inf)));
  dp[0][0][0] = 0;
  rep(i,n+1) {
    rep(j,k+1) {
      rep(l,lmax+1) {
	if(j != k) chmin(dp[i+1][j+1][l], dp[i][j][l]);
	chmin(dp[i+1][j][com[i]], dp[i][j][l] + max((ll)0, h[i] - mp[l]));
      }
    }
  }
  
  ll res = inf;
  rep(j,k+1) {
    rep(l,lmax+1) {
      chmin(res, dp[n+1][j][l]);
    }
  }
  cout << res << "\n";
  
  return 0;
}


Measured memory_bytes: 220472
n = int(input())
sum = 0
for i in range(n):
    tmp_inputs = input().split()
    tmp_value = float(tmp_inputs[0])
    money_type = str(tmp_inputs[1])
    if money_type == 'JPY':
        sum += tmp_value
    elif money_type == 'BTC':
        sum += tmp_value * 380000
    else:
        raise
print(sum)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define con continue
#define bk break
#define LL long long
#define db double
#define pt cout<<'\n'
#define ms(a, b) memset((a), (b), sizeof(a))
#define mp make_pair
#define endl '\n'
int inf=2147483647;const long long ll =9223372036854775807,ninf=1000000000;const double eps = 1e-6; const long long nll =223372036854775807;
#define sz size()
#define len(X) strlen(X)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ULL unsigned long long
#define de cout<<"test"<<endl;
#define st system("pause");
#define M_PI 3.1415926
struct data {
int x,y,z;
};
data A[100005]={};
int fa[100005]={};
int find(int now){
	if(fa[now]!=now)fa[now]=find(fa[now]);
	return fa[now];
}

bool cmp1(data a,data b){
return a.x<b.x;
}
bool cmp2(data a,data b){
return a.y<b.y;
}
int main()
{
 int a;
 while(cin>>a){
        for(int i=0;i<=a;i++){
            fa[i]=i;
        }
        vector<data>ans;
    for(int i=0;i<a;i++){
        cin>>A[i].x>>A[i].y;
        A[i].z=i+1;
    }
    sort(A,A+a,cmp1);
    for(int i=0;i<a-1;i++){
        data tmp;
        tmp.x=A[i+1].x-A[i].x,tmp.y=A[i].z,tmp.z=A[i+1].z;
        ans.push_back(tmp);
    }
    sort(A,A+a,cmp2);
      for(int i=0;i<a-1;i++){
        data tmp;
        tmp.x=A[i+1].y-A[i].y,tmp.y=A[i].z,tmp.z=A[i+1].z;
        ans.push_back(tmp);
    }
    sort(ans.begin(),ans.end(),cmp1);
    int sum=0;
    for(int i=0;i<ans.sz;i++){
        int l=ans[i].y,r=ans[i].z;
        int t1=find(l),t2=find(r);
        if( t1!=t2 ){
            fa[t1]=t2;
            sum+=ans[i].x;
        }
    }
    cout<<sum<<endl;
 }

    return 0;
}


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

int main(){
    
    ll N;
    cin >> N;
    ll T = 0, X = 0, Y = 0;
    ll ans = 1;
    for(ll i = 0; i < N; i++){
        ll t, x, y;
        cin >> t >> x >> y;
        if(abs(x - X) + abs(y - Y) > t - T)ans = 0;
        if((abs(x - X) + abs(y - Y)) % 2 != (t - T) % 2)ans = 0;
        T = t;
        X = x;
        Y = y;
    }
    if(ans)cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
using System;


public class Program{


	public static void Main(){
	
	
		var input = Console.ReadLine();
		
		var monthAble = new Boolean[2]{false,false};
		
		if(0 == input.IndexOf('1')){
			
			if(1 == input.IndexOf('0',1) || 1 == input.IndexOf('2',1) || 1 == input.IndexOf('1',1)){
				monthAble[0] = true;
			}
		
		}
		
		if(0 == input.IndexOf('0')){
		
			if(1 == input.IndexOf('0',1)){
			
			}else{
				monthAble[0] = true;
			}
		
		}
		
		if(2 == input.IndexOf('1',2)){
			
			if(3 == input.IndexOf('0',3) || 3 == input.IndexOf('2',3) || 3 == input.IndexOf('1',3)){
				monthAble[1] = true;
			}
		
		}
		
		if(2 == input.IndexOf('0',2)){
		
			if(3 == input.IndexOf('0',3)){
				
			}else{
				monthAble[1] = true;
			}
		
		}
		
		if(monthAble[1] && monthAble[0]){
			Console.WriteLine("AMBIGUOUS");
		}else if(monthAble[0]){
			Console.WriteLine("MMYY");
		}else if(monthAble[1]){
			Console.WriteLine("YYMM");
		}else{
			Console.WriteLine("NA");
		}
	
	
	}

}

Measured memory_bytes: 11092