akhauriyash/Code-Regression huggingface dataset:
import Control.Monad
import Text.Printf

solveCenter1 :: (Double, Double, Double, Double, Double, Double) -> (Double, Double)
solveCenter1 (_, b, c, d, e, f) = (x, y)
    where y = c / b
          x = (f - e * y) / d

solveCenter2 :: (Double, Double, Double, Double, Double, Double) -> (Double, Double)
solveCenter2 (a, b, c, d, e, f) = (x, y)
    where y = (a * f - c * d) / (a * e - b * d)
          x = (c - b * y) / a

solveCenter :: (Double, Double, Double, Double, Double, Double) -> (Double, Double)
solveCenter (a, b, c, d, e, f)
    | a == 0    = solveCenter1 (a, b, c, d, e, f)
    | otherwise = solveCenter2 (a, b, c, d, e, f)

solve :: [Double]-> (Double, Double, Double)
solve xs = (x, y, r)
    where x1     = xs !! 0
          y1     = xs !! 1
          x2     = xs !! 2
          y2     = xs !! 3
          x3     = xs !! 4
          y3     = xs !! 5
          a      = 2 * (x1 - x2)
          b      = 2 * (y1 - y2)
          c      = x1 ^ 2 - x2 ^ 2 + y1 ^ 2 - y2 ^ 2
          d      = 2 * (x1 - x3)
          e      = 2 * (y1 - y3)
          f      = x1 ^ 2 - x3 ^ 2 + y1 ^ 2 - y3 ^ 2
          (x, y) = solveCenter (a, b, c, d, e, f)
          r      = sqrt ((x1 - x) ^ 2 + (y1 - y) ^ 2)

format :: (Double, Double, Double) -> String
format (x, y, r) = printf "%.3f %.3f %.3f" x y r

main :: IO ()
main = do
    n     <- readLn
    lines <- replicateM n getLine
    mapM_ (putStrLn . format . solve . map read . words) lines

Measured memory_bytes: 4488
#include <stdio.h>

int main(void){

	long long int X;
	scanf("%lld", &X);

	long long int i;
	long long kake = 0;

	for(i = 0; i < 1000000000; i++){
		
		kake  = i * (i + 1);

		if(2 * X <= kake){
			break;
		}

	}

	printf("%lld\n", i);

	return 0;

}


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

int main()
{
   int n, a = 0;
   cin >> n;
   vector<vector<int>> d(n, vector<int>(2));

   for (int i = 0; i < n; i++)
   {
      for (int j = 0; j < 2; j++)
      {
         cin >> d.at(i).at(j);
      }
   }

   for (int i = 0; i < n - 2; i++)
   {
      if (d[i][0] == d[i][1] && d[i + 1][0] == d[i + 1][1] && d[i + 2][0] == d[i + 2][1])
      {
         a = 1;
      }
   }

   if (a == 0)
   {
 cout << "No" << endl;
   }
   else
   {
 cout << "Yes" << endl;
   }
}

Measured memory_bytes: 3628
#!/usr/bin/env perl
use 5.10.0;
use utf8;
use strict;
use warnings;
use open qw( :utf8 :std );
use Data::Dumper;

chomp( my $line = readline );

my $is_alike = $line =~ m{\A \w\w (\w) \1 (\w) \2 \z}msx;

say $is_alike ? "Yes" : "No";

exit;



Measured memory_bytes: 2048
#include<cstdio>
#include<iostream>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<stack>
#include<set>
using namespace std;
#define pb push_back
#define POP pop_back()
#define ll long long
#define db double
#define POP pop_back()
#define endl '\n'
#define PII pair<int,int>
#define FI first
#define SE second
#define VI vector<int>
#define QI queue<int>
#define SI stack<int>
#define debug cout<<"debug"<<endl;
#define PLL pair<ll,ll>
#define PDD pair<double,double>
#define ULL unsigned long long
#define fo(i,a,b) for (int i=a;i<=b;++i)
#define fd(i,a,b) for (int i=a;i>=b;--i)
#define mem(x,a) memset(x,a,sizeof(x))
const int maxn = 2e5 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int a[maxn];
int main(){
	int n , k;cin >> k >> n;
	fo(i,1,n)scanf("%d",a+i);
	int ans = 0;
	fo(i,2,n){
		ans = max(a[i] - a[i-1] , ans);
	}
	ans = max(k-a[n]+a[1] , ans);
	cout << k - ans << endl;
	return 0;
}

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

int main(){
    string s;
    cin>>s;
    int n=s.size();
    int cnt=0;
    for(int i=0; i<n/2; i++)
    {
        if(s[i]== s[n-i-1])
            continue;
        else
            cnt++;
    }
    cout<<cnt<<endl;
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


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

    int N; cin >> N;
    vector<ll> A(N), B(N);
    rep(i, N) cin >> A[i];
    rep(i, N) B[i] = A[i] - (i + 1);
    sort(all(B));
    ll ans = 0;
    rep(i, N) ans += abs(B[i] - B[N/2]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3456
#include<iostream>
using namespace std;
enum day{
	SUN=1,MON,TUE,WED,THU,FRI,SAT
};
int main(){
	string s;
	int n;
	cin>>n>>s;
	int t;
	for(int i=0;i<s.size();i++){
		t=(s[i]-'A'+n)%26;
		s[i]='A'+t;
		cout<<s[i];
	}
	return 0;
}

Measured memory_bytes: 256
def main():
    button = [-1]
    n = int(input())
    for i in range(n):
        button.append(int(input()))
    count = 0
    push = 1
    while count <= n:
        push = button[push]
        count += 1
        if push == 2:
            break
    print(count) if count < n else print(button[0])

if __name__ == '__main__':
    main()

Measured memory_bytes: 49720
var x = require('fs').readFileSync('/dev/stdin', 'utf8');
input = x.split(/ /);
a = parseInt(input[0]);
b = parseInt(input[1]);
c = parseInt(input[2]);
arr = [a, b, c];
arr.sort(function(a, b){return a- b});
console.log(arr[0]+' '+arr[1]+' '+arr[2]);



Measured memory_bytes: 15416
def shellsort(L, g):
    cnt = 0
    num = len(L)
    for i in range(g, num):
        v = L[i]
        j = i-g
        while j>= 0 and L[j] > v:
            L[j+g] = L[j]
            j = j -g
            cnt += 1
        L[j+g] =v
    return cnt

if __name__ == "__main__":
    num = int(input())
    l = []
    for i in range(num):
        t = int(input())
        l.append(t)
    #print(l)

    g = []
    i = 1
    while i <= len(l):
        g.append(i)
        i = i*3 +1
    g.reverse()
    count = 0
    for i in g:
        count += shellsort(l,i)
    print(len(g))
    print(*g)
    print(count)
    for i in l:
        print(i)



Measured memory_bytes: 45512
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
const int INF = 1001001001;

int main()
{
    int n,k,ans=0;
    in n>>k;
    vector<int> l(n);
    rep(i,n)in l[i];
    sort(l.begin(), l.end(), greater<int>());
    rep(i,k)ans+=l[i];
    cout<<ans<<endl;

}


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

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) break;
		vector<string> field;
		for (int i = 0; i < n; i++) {
			string s; cin >> s;
			field.push_back(s);
		}

		// 横 
		int max_len = 0;
		for (int i = 0; i < n; i++) {
			int cur_len = 0;
			for (int j = 0; j < n; j++) {
				if (field[i][j] == '1') {
					cur_len++;
				} else {
					max_len = max(cur_len, max_len);
					cur_len = 0;
				}
			}
			max_len = max(cur_len, max_len);
		}

		// 縦
		for (int i = 0; i < n; i++) {
			int cur_len = 0;
			for (int j = 0; j < n; j++) {
				if (field[j][i] == '1') {
					cur_len++;
				} else {
					max_len = max(cur_len, max_len);
					cur_len = 0;
				}
			}
			max_len = max(cur_len, max_len);
		}

		// 斜め, 右上->左下
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				int cur_len = 0;
				for (int k = i, l = j; k < n && l < n; k++, l++) {
					if (field[k][l] == '1') {
						cur_len++;
					} else {
						max_len = max(cur_len, max_len);
						cur_len = 0;
					}
				}
				max_len = max(cur_len, max_len);
			}
		}

		// 斜め, 左上->右下
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				int cur_len = 0;
				for (int k = i, l = j; k < n && 0 <= l; k++, l--) {
					if (field[k][l] == '1') {
						cur_len++;
					} else {
						max_len = max(cur_len, max_len);
						cur_len = 0;
					}
				}
				max_len = max(cur_len, max_len);
			}
		}

		cout << max_len << endl;
	}
	return 0;
}

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

int main(){
  int N;
  cin>> N;
  if(N/10 == 9){
    cout<< "Yes"<<endl;
  }
  else if((N + 1)%10 == 0){
    cout << "Yes"<<endl;
  }
  else{
    cout<< "No"<<endl;
  }
}

Measured memory_bytes: 256
n = int(input())
dishes = [int(x) - 1 for x in input().split()]
scores = [int(x) for x in input().split()]
plusscores = [int(x) for x in input().split()]

result = 0
prev_d = -100
for d in dishes:
  result += scores[d]
  if prev_d + 1 == d:
    result += plusscores[prev_d]
  prev_d = d

print(result)

Measured memory_bytes: 3060
import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner (System.in);
	int n = Integer.parseInt(scan.nextLine());
	double x1, y1, x2, y2, x3, y3, a1, b1, c1, a2, b2, c2;
	double px, py, r;
	String[] input;
	for (int i = 0; i < n; i ++) {
	    input = scan.nextLine().split(" ");
	    x1 = Double.parseDouble(input[0]);
	    y1 = Double.parseDouble(input[1]);
	    x2 = Double.parseDouble(input[2]);
	    y2 = Double.parseDouble(input[3]);
	    x3 = Double.parseDouble(input[4]);
	    y3 = Double.parseDouble(input[5]);
	    a1 = 2 * (x2 - x1);
	    b1 = 2 * (y2 - y1);
	    c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
	    a2 = 2 * (x3 - x1);
	    b2 = 2 * (y3 - y1);
	    c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
	    px = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
	    py = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
	    r = Math.sqrt((px - x1) * (px - x1) + (py - y1) * (py - y1));
	    System.out.print(String.format("%.3f", px) + " ");
	    System.out.print(String.format("%.3f", py) + " ");
	    System.out.println(String.format("%.3f", r));
	}
    }
}

Measured memory_bytes: 26384
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,m,cnt=0;
    cin>>m>>n;
    for(int i=0; i<=m; i++)
    {
        for(int j=0; j<=m; j++)
        {
            int rem=(n-(i+j));
            if(i+j==n)
                cnt++;
            else if(rem<=m && rem>=0){
                cnt++;
            }
        }

    }
    cout<<cnt<<endl;

    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<cstdio>
using namespace std;

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

    if(a[0]>=a[1]){
        m1=0;m2=1;
    }else{
        m1=1;m2=0;
    }

    for(int i=2;i<n;i++){
        if(a[i]>a[m1]){
            m2=m1;
            m1=i;
        }else if(a[i]<=a[m1]&&a[i]>a[m2]){
            m2=i;
        }
    }

    for(int i=0;i<n;i++){
        if(i!=m1) cout<<a[m1]<<endl;
        else cout<<a[m2]<<endl;
    }
}



Measured memory_bytes: 2432
#include <stdio.h>
 
#define N 100
 
int main(void){
  int n, m, l, a[N][N], b[N][N];
  long int c[N][N];
  int i, j, k;
 
  scanf("%d%d%d", &n, &m, &l);
  for(i = 0; i < n; i++){
    for(j = 0; j < m; j++){
      scanf("%d", &a[i][j]);
    }
  }
  for(i = 0; i < m; i++){
    for(j = 0; j < l; j++){
      scanf("%d", &b[i][j]);
    }
  }
 
  for(i = 0; i < n; i++){
    for(j = 0; j < l; j++){
      c[i][j] = 0;
      for(k = 0; k < m; k++){
    c[i][j] += a[i][k] * b[k][j];
      }
      printf("%ld", c[i][j]);
      if(j != l-1){
    printf(" ");
      }else{
    printf("\n");
      }
    }
  }
  return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n;
    cin >> n;
    
    vvpll G(n);
    rep(i, n-1) {
        ll a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].pb(make_pair(b, 1));
        G[b].pb(make_pair(a, 1));
    }
    
    vl dist1(n, -1);  // dist1[i] : 頂点iの頂点0からの距離
    queue<ll> Q1;

    dist1[0] = 0;
    Q1.push(0);
    while(!Q1.empty()) {
        ll v = Q1.front();
        Q1.pop();
        for(auto p : G[v]) {
            ll u = p.first;
            ll cost = p.second; 
            if(dist1[u] != -1) {
                continue;
            }
            dist1[u] = dist1[v] + cost;
            Q1.push(u);
        }
    }
    
    ll vertex1 = 0;  // 頂点0からの距離が最大の頂点
    rep(v, n) {
        if(dist1[vertex1] < dist1[v]) {
            vertex1 = v;
        }
    }

    vl dist2(n, -1);  // dist2[i] : 頂点iの頂点vertex1からの距離
    queue<ll> Q2;

    dist2[vertex1] = 0;
    Q2.push(vertex1);
    while(!Q2.empty()) {
        ll v = Q2.front();
        Q2.pop();
        for(auto p : G[v]) {
            ll u = p.first;
            ll cost = p.second; 
            if(dist2[u] != -1) {
                continue;
            }
            dist2[u] = dist2[v] + cost;
            Q2.push(u);
        }
    }

    ll vertex2 = vertex1;  // 頂点vertex1からの距離が最大の頂点
    ll TreeDiameter = 0;  // 木の直径
    rep(v, n) {
        if(dist2[vertex2] < dist2[v]) {
            vertex2 = v;
            TreeDiameter = dist2[v];
        }
    }

    if(TreeDiameter%3 == 1) {
        out("Second");
    }
    else {
        out("First");
    }

    re0;
}

Measured memory_bytes: 19180
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string s;
    cin >> s;
    set<char>st;
    for(int i=0;i<s.size();i++){
       st.insert(s[i]);
    }
    if(st.size()==2){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}


Measured memory_bytes: 256
fn main() {
    let xy = read_vec::<i32>();
    let x = xy[0];
    let y = xy[1];

    let a = (4 * x - y) / 2;
    let b = (y - 2 * x) / 2;

    if a >= 0 && b >= 0 && a + b == x && 2 * a + 4 * b == y {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}


Measured memory_bytes: 2132
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <istream>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) //aからbまで繰り替えす
#define vec vector<int>a(n)
#define soot(a) sort(a.begin(),a.end())
/*int n;
cin >> n;
vector<int>a(n);
rep0(i, n - 1)cin >> a[i];*/
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	cout << max({ a + b,a - b,a * b })<<endl;
	return 0;
}

Measured memory_bytes: 256
c = [list(map(int,input().split())) for  _ in range(3)]
OK = False
for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            a = [a1,a2,a3]
            ok = True
            for j in range(3):
                v = c[0][j]-a[0]
                for i in range(2):
                    if c[i+1][j] - a[i+1] != v:ok = False
            if ok :OK = True
                    
if OK:print('Yes')
else:print('No')

Measured memory_bytes: 45292
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
v = LIST()

v.sort()
ans = (v[0]+v[1])/2
for i in range(N):
	if i==0 or i==1:
		continue
	else:
		ans = (ans + v[i])/2
print(ans)


Measured memory_bytes: 5712
#include<bits/stdc++.h>
#define inf 1000000000000
#define int long long int
#define hell (int)(1e9+7)

using namespace std;

void solve(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int ans=0;
    ans+=min(k,a);
    k=max((int)0,k-a);
    k=max((int)0,k-b);
    ans-=min(k,c);
    cout<<ans;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3640
// --https://kenkoooo.com/atcoder/#/table/soma62jp
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {

	string A, B, ans = "EQUAL";
	int lengthA, lengthB;

	cin >> A >> B;

	lengthA = A.length();
	lengthB = B.length();

	if (lengthA > lengthB) {
		for (int i = 0; i < lengthA - lengthB; i++) {
			B = "0" + B;
		}
	}
	else {
		for (int i = 0; i < lengthB - lengthA; i++) {
			A = "0" + A;
		}
	}

	for (int i = 0; i < A.length(); i++) {
		if (A[i] > B[i]) {
			ans = "GREATER";
			break;
		}
		if (A[i] < B[i]) {
			ans = "LESS";
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M; cin >> N >> M;
  vector<ll> D = Divisor(M);
  int n = D.size();
  REP(i, n){
    if(D[n-i-1] <= M/N){
      cout << D[n-i-1] << endl;
      return 0;
    }
  }
}

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


int main(){
    int n; cin >> n;
    vector<vector<ll> > lis(n, vector<ll>(2, 0));
    for(int i = 0; i < n; i++){
        ll a, b; cin >> a >> b;
        lis[i][0] = a - b;
        lis[i][1] = a + b;
    }
    int count = 0;
    sort(lis.begin(), lis.end(), [](auto& x, auto& y){return x[1] < y[1];});
    for(int i = 0; i < n-1; i++){
        int d = 1;
        while(i+d < n && lis[i][1] > lis[i+d][0]){
            d++;
            count++;
        }
        i += d-1;
    }
    cout << n - count << endl;
}

Measured memory_bytes: 5760
# -*- coding: utf-8 -*-
import math

A,B,H,M = map(int, input().split())

deg_A = 30*H+M/2
deg_B = 6*M
deg = deg_A-deg_B

print(math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(deg))))

Measured memory_bytes: 9488
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


n, k = inpl()
p = inpl()
p = [(i + 1) / 2.0 for i in p]

tmp = sum(p[:k])
ans = tmp
for i in range(n - k):
    tmp += p[k + i] - p[i]
    ans = max(ans, tmp)
print(ans)


Measured memory_bytes: 73480
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <stack>
#include <vector>
#include <stdio.h>
using namespace std;

int h[6], m[6], s[6];



int main() {

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

	for (int i = 0; i < 6; i += 2) {
		h[i + 1] -= h[i];
		m[i + 1] -= m[i];
		s[i + 1] -= s[i];
		if (s[i + 1] < 0) {
			s[i + 1] = 60 + s[i + 1];
			m[i + 1]--;
		}
		if (m[i + 1] < 0) {
			m[i + 1] = 60 + m[i + 1];
			h[i + 1]--;
		}
		cout << h[i + 1] << " " << m[i + 1] << " " << s[i + 1] << endl;
	}
	


	return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
ll mx(ll a,ll b){if(a>=b) return a;return b;}
ll mn(ll a,ll b){if(a<b) return a;return b;}
#define pb push_back
#define mp make_pair
//#define M (ll) (1e9+7)
#define INF (3e18)

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
//    freopen("xorr.gir","r",stdin);
//    freopen("xorr.cik","w",stdout);
    ll n;cin>>n;
    vector<double> v;
    for(ll i=0;i<n;i++){
        double a;cin>>a;
        v.pb(a);
    }
    sort(v.begin(),v.end());
    double x=(v[0]+v[1])/2;
    for(ll i=2;i<n;i++)
        x=(x+v[i])/2;
    cout<<x<<endl;
    return 0;
}













Measured memory_bytes: 256
#include<bits/stdc++.h>
#define st first
#define nd second


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

int a[(int)2e5 + 10];
int main(){
	int k, n, ma = 0;
	scanf("%d %d", &k, &n);
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
		ma = max(ma, a[i] - a[i-1]);
	}
	ma = max(ma, abs(k - a[n-1]  +a[0]));
	printf("%d", k - ma);
}

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

using namespace std;

#define FOR(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
#define FORR(i, b) for (int (i) = 0; (i) < (b); (i)++)
#define CLR(a, b) memset((a), (b), sizeof (a))
#define sz(x) ((int)(x).size())
typedef vector <int> vi;
const int INF = 1e9 + 8;
#define prev preev
const int N = 3200; // o máximo de vértices no grafo
int cap[N][N];  // matriz de capacidade: adjacencia caso cap[u][v] > 0
int adj[N][N], deg[N];  // cria a lista de adjacencia usando cap (u->v e v->u)
 
// Se prev[v] == -1, então v não é alcançavel a partir de s; c.c., é alcançável.
// IMPORTANTE: prev irá conter o minimum cut
int q[N], prev[N]; // usado na BFS
 
int dinic(int n, int s, int t) {
    // cria a lista de adjacência
    FORR(i, n) {
        deg[i] = 0;
        FORR(j, n)
            if(cap[i][j] > 0 || cap[j][i] > 0)
                adj[i][deg[i]++] = j;
    }
 
    int flow = 0;
    while(true) {
        // encontra um caminho aumentante
        CLR(prev, -1);
        int qf = 0, qb = 0; // queue front e queue back
        prev[s] = -2; q[qb++] = s;
         
        while(qb > qf && prev[t] == -1)
            for(int u = q[qf++], i = 0, v; i < deg[u]; i++)
                if(prev[v = adj[u][i]] == -1 && cap[u][v])
                    prev[q[qb++] = v] = u;
 
        if(prev[t] == -1) break; // testa se não dá mais para aumentar
 
        FORR(z, n) {    // tenta encontrar mais caminhos
            if(cap[z][t] && prev[z] != -1) {
                int bot = cap[z][t];
                for( int v = z, u = prev[v]; u >= 0; v = u, u = prev[v] )
                    bot = min(bot, cap[u][v]);
 
                if(!bot) continue;  // bot = 0
 
                cap[z][t] -= bot;
                cap[t][z] += bot;
                // aumenta o fluxo no caminho
                for(int v = z, u = prev[v]; u >= 0; v = u, u = prev[v]) {
                    cap[u][v] -= bot;
                    cap[v][u] += bot;
                }
                flow += bot;
            }
        }
    }
     
    return flow;
}
vector <pair <int, int> > va, vb;


int main() {
	int n;
	scanf("%d", &n);
	FORR(i, n) {
		int a, b;
		scanf("%d%d", &a, &b);
		va.push_back({a, b});
	}
	FORR(i, n) {
		int a, b;
		scanf("%d%d", &a, &b);
		vb.push_back({a, b});
	}
	FORR(i, n) {
		cap[2 *n][i] = 1;
		FORR(j, n) {
			if(va[i].first < vb[j].first && va[i].second < vb[j].second) {
				cap[i][j + n] = 1;
			//	adj[j + n].push_back(i);
			}
			cap[j + n][2*n+1]=1;
		}
	}
	cout << dinic(2 * n + 2, 2 * n, 2 * n + 1) << endl;
}

Measured memory_bytes: 7168
package main

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

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	n := nextInt()
	d := make([]int, n)

	for i := 0; i < n; i++ {
		d[i] = nextInt()
	}

	sort.Ints(d)
	fmt.Println(d[n/2] - d[n/2-1])
}


Measured memory_bytes: 2688
#include <stdio.h>

int main(void)
{
	int W,H,i,j;
	
	
	scanf("%d %d",&H,&W);
	while(H != 0 && W != 0)
	{
		for(i=0;i<H;i++)
		{
			for(j=0;j<W;j++)
			{
				printf("#");
			}
			printf("\n");
		}
		scanf("%d %d",&H,&W);
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 572
N = list(input())
N = list(map(int, N))
N = [0] + N
n = len(N)

answer = 0
for i in range(n - 1, -1, -1):
    if N[i] == 10:
        N[i - 1] += 1
        continue
    if N[i] == 5 and N[i - 1] >= 5:
        N[i - 1] += 1
        answer += 5
    elif N[i] <= 5:
        answer += N[i]
    else:
        N[i - 1] += 1
        answer += 10 - N[i]

print(answer)


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

using namespace std; 

#define nl "\n"
#define sp " "
#define pb push_back
#define int long long
#define hashset unordered_set
#define llMin LLONG_MIN
#define llMax LLONG_MAX

signed main(){
    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);
    int n; cin >> n; vector<int> v;
    for (int i = 0; i < n; i++){
        int inp; cin >> inp; v.pb(inp);
    }
    if (n == 1 || n == 2){
        cout << 0;
    }
    else {
        int counter = 0;
        for (int i = 0; i < n - 2; i++){
            for (int j = i + 1; j < n - 1; j++){
                for (int k = j + 1; k < n; k++){
                    if (v[i] + v[j] > v[k] && v[j] + v[k] > v[i] && v[i] + v[k] > v[j] && abs(v[j] - v[i]) < v[k] && abs(v[k] - v[j]) < v[i] && abs(v[k] - v[i]) < v[j] && v[j] != v[i] && v[j] != v[k] && v[i] != v[k] && i != j && j != k && i != k){
                        counter++;
                    }
                }
            }    
        }
        cout << counter;
    }
}

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

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

int main(){
	int N;
	cin >> N;
	
	if(N%10==7 || (N/10)%10==7 || (N/100)%10==7) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3628
N = int(input())
A = [int(i) for i in input().split()] 
mod = 10**9 + 7

b = [0]*N 
b[0] = A[0]
for n in range(1,N):
    b[n] = A[n] ^ b[n-1]
#print('累積論理和',b)
m = max(b)
dp = [[0]*(m+1) for j in range(2)]
dp[0] = [1]*(m+1)
cnt = [0]*(m+1)
z = 0

for i in range(N):
    if b[i] == 0:
        z +=1
    dp[0][b[i]] += dp[1][b[i]]*(z-cnt[b[i]])
    dp[0][b[i]] %= mod
    dp[1][b[i]] += dp[0][b[i]]
    dp[1][b[i]] %= mod
    cnt[b[i]] = z


if b[N-1]:
    print(dp[0][b[N-1]])
else:
    ans = pow(2, z-1, mod)
    for i in range(1,m+1):
        ans += dp[1][i]
        ans %= mod
    print(ans)

Measured memory_bytes: 128848
from sys import exit, stderr, stdin
input = stdin.readline
import heapq
# from collections import defaultdict
# setrecursionlimit(10**7)

def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    N,M = [int(n) for n in input().split()]
    # {期限:価値}
    jobs = [[]]*N
    v = 0
    for i in range(N):
        jobs[i] = [int(n) for n in input().split()]
    # 価値降順→期間昇順
    jobs = sorted(jobs,key=lambda x:-x[1])
    jobs = sorted(jobs,key=lambda x:x[0])
    cur = 0
    ans = 0
    cand = []
    for i in range(1,M+1):
        while(cur < N and i >= jobs[cur][0]):
            heapq.heappush(cand,-jobs[cur][1])
            cur += 1
        if len(cand) != 0:
            ans -= cand[0]
            heapq.heappop(cand)
    print(ans)



if __name__ == "__main__":
    main()


Measured memory_bytes: 76508
N = int(input())
A = list(map(int,input().split()))
def gcd(x,y):
  while y != 0:
    k = x
    x = y
    y = k%y
  return  x
L = [0]*(N+2)
R = [0]*(N+2)
for i in range(N):
  if L[i] == 0:
    L[i+1] = A[i]
  else:
    L[i+1] = gcd(max(L[i],A[i]),min(L[i],A[i]))
for i in range(N,-1,-1):
  if i == N:
    R[i+1] = 0
  elif i == N-1:
    R[i+1] = A[N-1] 
  else:
    R[i+1] = gcd(max(R[i+2],A[i]),min(R[i+2],A[i]))
ans = 1
for i in range(N):
  if L[i] == 0 or R[i+2] == 0:
    k = max(L[i],R[i+2])
    ans = max(ans,k)
  else:
    ans = max(ans,gcd(max(L[i],R[i+2]),min(L[i],R[i+2])))
print(ans)

Measured memory_bytes: 14076
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    const int mod = 998244353;
    int n, k;
    cin >> n >> k;
    vector<pair<long long int, long long int>> vp;
    vector<long long int> change(n, 0);
    change[0] = 1;
    for (int i = 0; i < k; i++) {
        long long int a, b;
        cin >> a >> b;
        vp.emplace_back(a, b);
    }
    long long int c = 0;
    for (int i = 0; i < n; i++) {
        c += change[i];
        c %= mod;
        c += mod;
        c %= mod;
        for (auto p : vp) {
            int l = i + p.first, r = i + p.second + 1;
            if (l < n) {
                change[l] += c;
                change[l] %= mod;
                if (r < n) {
                    change[r] -= c;
                    change[r] %= mod;
                    change[r] += mod;
                    change[r] %= mod;
                }
            }
        }
    }
    cout << change.back() << endl;
}






Measured memory_bytes: 4848
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int N;
    io.read(N);
    vector<int> L(N);
    for(int i = 0; i < N; i++){
        io.read(L[i]);
    }
    string ans = "Yes";
    for(int i = 0; i < N; i++){
        int sum = 0;
        for(int j = 0; j < N; j++){
            if(i != j) sum += L[j];
        }
        if(L[i] >= sum) ans = "No";
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int h,w,k;

int main() {

    std::cin>>h>>w>>k;

    for(int i=0;i<=h;++i){
        for(int j=0;j<=w;++j){
            if(i*w+j*h-2*i*j==k){
                std::cout<<"Yes"<<std::endl;
                return 0;
            }
        }
    }

    std::cout<<"No"<<std::endl;

    return 0;
}

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

int main(void)
{
  int x,y;
  while(1){
    cin >> x >> y;
    if(x == 0 && y == 0) break;
    if(y > x) cout << x << ' ' << y <<endl;
    else  cout << y << ' ' << x << endl;
  }
  return 0;

}

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

int N, M;
vector<int> C;

void input_init(void) {
	cin >> N >> M;
	C.resize(M + 1, 0);
	for (int i = 0; i < N; ++i) {
		int K;
		cin >> K;
		for (int j = 0; j < K; ++j) {
			int A;
			cin >> A;
			++C[A];
		}
	}
}

int solve(void) {
	int cnt = 0;
	for (int i = 1; i <= M; ++i) {
		if (C[i] == N)
			++cnt;
	}
	return cnt;
}

int main(void) {
	input_init();
	int ans = solve();
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,M;
  cin>>N;
  
  vector<int> T(N);
  for(int i=0;i<N;i++){
    cin>>T[i];
  }
  
  cin>>M;
  
  vector<int> P(M),X(M);
  for(int i=0;i<M;i++){
    cin>>P[i]>>X[i];
  }
  
  int sum=0;
  int a;
  for(int i=0;i<M;i++){
    for(int n:T) sum+=n;
    sum-=(T[P[i]-1]-X[i]);
    cout<<sum<<endl;
    sum=0;
  }
}


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

int main(){
  int N; cin >> N;
  pair<string,int> playlist[50];
  for(int i=0; i<N; i++){
    string s; int t; cin >> s >> t;
    playlist[i]=make_pair(s,t);
  }
  
  string X; cin >> X;
  
  int sum=0;
  bool slp=false;
  
  for(int i=0; i<N; i++){
    if(slp) sum+=playlist[i].second;
    if(playlist[i].first==X) slp=true;
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
ll Max(ll a, ll b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}void hSwap(int x[], int i, int j)
{
	int temp;

	temp = x[i];
	x[i] = x[j];
	x[j] = temp;
}

void ShowData(int x[], int left, int right)
{
	int i;
	for (i = left; i <= right; i++)printf("%d  ", x[i]);
	printf("\n");
}
void QSort(int x[], int left, int right, int n) {
	int i, j;	//左端,右端
	int pivot;	//軸

	i = left;
	j = right;
	pivot = x[(left + right) / 2];

	while (1) {
		if (n > 0) {				//n>0なら昇順、n<=0なら降順
			while ((x[i] < pivot) && (i <= right))i++;	//軸値より大きい要素
			while ((pivot < x[j]) && (i <= right))j--;	//軸値より小さい要素
		}
		else {
			while ((x[i] > pivot) && (i <= right))i++;	//軸値より小さい要素
			while ((pivot > x[j]) && (i <= right))j--;	//軸値より大きい要素
		}
		if (i >= j)	break;
		hSwap(x, i, j);
		i++; j--;
	}
	//ShowData(x, left, right);

	if (left < i - 1)QSort(x, left, i - 1, n);
	if (j + 1 <  right)QSort(x, j + 1, right, n);
}

int main() {
	int a,b,c;
	scanf("%d%d%d", &a, &b,&c);
	int tmp;
	if (b < c) {
		tmp = b;
		b = c;
		c = tmp;
	}
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}
	PRINTD(a * 10 + b + c);
}

Measured memory_bytes: 128
#! /usr/bin/ruby

$stdin.each_line do |line|
	a, op, b = line.split(/\s+/)
	break if op == "?"
	a = a.to_i
	b = b.to_i

	x = case op
	    when "+"
		    a + b
	    when "-"
		    a - b
	    when "*"
		    a * b
	    when "/"
		    a / b
	    end
	puts x
end

Measured memory_bytes: 8660
local n = io.read("*n", "*l")
local s = io.read()
local t1, t2, t3 = {}, {}, {}
for i = 1, 10 do
  t1[i] = false
end
for i = 1, 100 do
  t2[i] = false
end
for i = 1, 1000 do
  t3[i] = false
end
for i = 1, n do
  local k = tonumber(s:sub(i, i))
  if k == 0 then k = 10 end
  for j = 1, 100 do
    if t2[j] then
      t3[(j - 1) * 10 + k] = true
    end
  end
  for j = 1, 10 do
    if t1[j] then
      t2[(j - 1) * 10 + k] = true
    end
  end
  t1[k] = true
end
local ret = 0
for i = 1, 1000 do
  if t3[i] then ret = ret + 1 end
end
print(ret)


Measured memory_bytes: 260
#16D8101012J 伊藤惇 dj Python3

def Maximum_Profit(n,A):
    Max=A[1]-A[0]
    Min=A[0]
    for j in range(1,n):
        Max=max(Max,A[j]-Min)
        Min=min(Min,A[j])
    return Max

if __name__ == "__main__":
    n=int(input())
    A=[]
    for i in range(n):
        A.append(int(input()))
    Max=Maximum_Profit(n,A)
    print(Max)


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

int main(){
  string s;
  cin >> s;
  if((s.at(0)==s.at(1))&&(s.at(1)==s.at(2))){
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;

int main(){ 
  int N,M;
cin>>N>>M;
vector<int>ans(N+1,true); 
  vector<int>a(N);
  for(int i=0;i<M;++i){
cin>>a.at(i);
ans.at(a.at(i))=false;
  }
vector<long long int>dp(N+1); dp.at(0)=1;
for(int now=0;now<N;++now){
for(int next=now+1;next<=min(N,now+2);next++){ 
  if(ans.at(next)){
  dp.at(next)+=dp.at(now);
dp.at(next)%=mod; 
  }
}
}
cout<<dp.at(N)<<endl;
return 0; 
}


Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807;
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }



int main() {
	int N;
	scanf("%d", &N);
	int *L = (int *)malloc(sizeof(int) * 2 * N);
	for (int i = 0; i < 2 * N; i++) {
		scanf("%d", &L[i]);
	}

	int tmp = 0;
	qsort(L, 2 * N, sizeof(int), cmp);
	for (int i = 0; i < 2 * N; i = i + 2) {
		tmp += L[i];
		//printf("%d:%d\n", i, tmp);
	}
	int ans = 0;
	ans = tmp;
	printf("%d\n", ans);



#ifdef DEBUGF
	getch();
#endif
	return 0;
	}


Measured memory_bytes: 128
MOD = 10 ** 9 + 7

def inverse(a, p):
    return pow(a, p-2, p)

def nCr(n, r, p = MOD):
    x, y = 1, 1
    for i in range(r):
        x = (x * (n - i)) % p
        y = (y * (i + 1)) % p
    return x * inverse(y, p) % p

n, a, b = map(int, input().split())
ans = pow(2, n, MOD) - 1

print(((ans - nCr(n, a) - nCr(n, b)) % MOD))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define intt long long int
#define intu unsigned long long int
#define vi vector<intt>
#define ii pair<int,int>
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL);
# define PI           3.14159265358979323846 
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
int mod = 1000000007;
intt gcd(intt a, intt b) {return b ? gcd(b, a % b) : a;}
int lcm(int a, int b) {return a * b / gcd(a, b); }
intt bpow(intt a,intt b) 
{
  intt res = 1;
  while (b > 0) {
    if (b & 1)res = res * a;
      a = a * a;
      b >>= 1;
  }
  return res;
}
intt fact(intt n) { 
   if ((n==0)||(n==1))
      return 1; 
   else
      return n*fact(n-1);
}

void go()
{
#ifndef ONLINE_JUDGE
  freopen("IN.txt","r",stdin);
  freopen("OUT.txt","w",stdout);
  #endif
}
struct Node{
        int par;
        int rank;
    };
vector<Node> dsu;
int find(int a){
        if(dsu[a].par==a)
            return a;
        return dsu[a].par=find(dsu[a].par);
}

void dsu_union(int a,int b){
        if(dsu[a].rank>dsu[b].rank){
            dsu[b].par=a;
            dsu[a].rank+=dsu[b].rank;
        }
        else if(dsu[b].rank>dsu[a].rank){
            dsu[a].par=b;
            dsu[b].rank+=dsu[a].rank;
        }
        else{
            dsu[a].par=b;
            dsu[b].rank+=dsu[a].rank;
        }
}


int main(){
	go();
	fast_io
	int x;cin>>x;
	if(x)
		cout <<"0" <<"\n";
	else
		cout << "1" <<"\n";
}


/*
*/


















Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


class Program
{
    static void Main(string[] args)
    { 
        string str_1 = Console.ReadLine();
        string str_2 = Console.ReadLine();

        long ans = 0;

        for(int i=0; i<str_1.Length; i++)
        {
            if (str_1[i] != str_2[i])
            {
                ans++;
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 27304
import sys
s = input()
N = len(s)

for i in range(N-1):
    if s[i] == s[i+1]:
        print(i+1,i+2)
        sys.exit()
    if i+2 < N and s[i] == s[i+2]:
        print(i+1,i+3)
        sys.exit()
print(-1,-1)

Measured memory_bytes: 9156
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)

	//fmt.Print(strings.Count(s, "R"))

	if s == "RRR" {
		fmt.Println("3")
	} else if strings.Contains(s, "RR") {
		fmt.Println("2")
	} else if strings.Contains(s, "R") {
		fmt.Println("1")
	} else {
		fmt.Println("0")
	}
}

Measured memory_bytes: 1840
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int N;
string S;
vector<int> a;

int dfs(int i) {
    if (a[i] != -1) return a[i];
    a[i] = 0;
    if (i && S[i-1] == '<') {
        chmax(a[i], dfs(i-1)+1);
    }
    if (i+1 < N && S[i] == '>') {
        chmax(a[i], dfs(i+1)+1);
    }
    return a[i];
}

int main() {
	cin >> S;
    N = S.size() + 1;
    a = vector<int>(N, -1);
    rep(i,N) dfs(i);
    ll ans = 0;
    for (ll x: a) ans += x;
	cout << ans << endl;
	return 0;
}


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

int main(){
    int a, b;
    cin >> a >> b;
    if (a + b == 15) {
        cout << "+" << endl;
    } else if (a * b == 15) {
        cout << "*" << endl;
    } else {
        cout << "x" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<queue>
using namespace std;

int n,g;
int w[105],v[105];
long long dp[105][100005];

int main(){

    cin>>n>>g;
    for(int i=1;i<=n;i++)
        cin>>w[i]>>v[i];

    for(int i=0;i<=g;i++)
        if(i>=w[1])
            dp[1][i-w[1]]=v[1];

    for(int i=2;i<=n;i++)
        for(int j=0;j<=g;j++){

            dp[i][j]=dp[i-1][j];
            if(j+w[i]<=g)
                dp[i][j]=max(dp[i][j],dp[i-1][j+w[i]]+v[i]);

        }

    long long sol=dp[n][0];
    for(int i=1;i<=g;i++)
        sol=max(sol,dp[n][i]);

    cout<<sol;

}


Measured memory_bytes: 79360
#include<iostream>

int main()
{
    int x[100],y[100],i=0,j=0,k,imax;
    
    
    for (;;)
    {
        std::cin >> x[i] >> y[i];

        if ((x[i] == 0) && (y[i] == 0)) break;

        i++;
    }
    imax = i;
    char c;


        for (i = 0; i < imax; i++)
        {
            for (j = 0; j < x[i]; j++)
            {
                for (k = 0; k < y[i]; k++)
                {
                    if (j % 2 == 0) {
                        if (k % 2 == 0) {
                            c = '#';
                        }
                        else {
                            c = '.';
                        }
                    }
                    else {
                        if (k % 2 == 0) {
                            c = '.';
                        }
                        else {
                            c = '#';
                        }
                    }
                    std::cout << c;
                }
                std::cout << std::endl;
            }
            std::cout << std::endl;


        }
    return 0;
}


Measured memory_bytes: 3116