akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <cmath>
#include <limits>
#include <math.h>
#include <cassert>
#include <map>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int prime_factor(int a)
{
    int ans = 1;
    for (int i = 2; i <= sqrt(a); i++)
    {
        int cnt = 0;
        while (a % i == 0)
        {
            cnt++;
            a /= i;
        }
        ans *= (cnt + 1);
        if (a == 1)
            break;
    }
    if (a != 1)
        ans *= 2;
    return ans;
}

int main()
{
    int N;
    cin >> N;
    int c = 1;
    for (int i = 2; i < N; i++)
    {
        c += prime_factor(i);
    }
    cout << c << endl;
}


Measured memory_bytes: 3676
use std::io::*;
use std::str::FromStr;
use std::cmp;


macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }
 
 

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    use std::collections::BTreeSet;
    let n = read();
    let a: BTreeSet<u32> = (0..n).map(|_| read()).collect();
    println!("{}", a.len());
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll a[3];
int main() {
	string s;
	cin>>s;
	ll ma=0;
	for(int i=0;i<s.size();i++){
		char now=s[i];
		if(now=='a'){
			a[0]++;
			ma=max(a[0],ma);
		}
		else if(now=='b'){
			a[1]++;
			ma=max(a[1],ma);
		}
		else{
			a[2]++;
			ma=max(a[2],ma);
		}
	}
	if(ma>a[0]+1||ma>a[1]+1||ma>a[2]+1){
		cout << "NO";
		return 0;
	}
	cout << "YES";
	return 0;
}

Measured memory_bytes: 764
import java.math.BigDecimal


data class CutParams(val m:Int, val n:Int) {
    val left:BigDecimal = BigDecimal(m).divide(BigDecimal(m).add(BigDecimal(n)), 30, BigDecimal.ROUND_HALF_UP)
    val right:BigDecimal = BigDecimal(n).divide(BigDecimal(m).add(BigDecimal(n)), 30, BigDecimal.ROUND_HALF_UP)
}
fun main(args:Array<String>):Unit{
    val (m, n, x) = readLine()!!.split(' ').map(String::toInt)
    val (k, l, y) = readLine()!!.split(' ').map(String::toInt)
    val vertical = CutParams(m, n)
    val horizontal = CutParams(k, l)
    var ver = BigDecimal.ONE
    repeat(x) {
        ver = with(vertical){ver * (left * left + right * right) + left * right}
    }
    var hor = BigDecimal.ONE
    repeat(y){
        hor = with(horizontal){hor * (left * left + right * right) + left * right}
    }
    println(ver * hor)
}


Measured memory_bytes: 35100
N = int(input())
S = input()

lc = [0]
for c in S:
    lc.append(lc[-1] | (1<<int(c)))
rc = [0]
for c in S[::-1]:
    rc.append(rc[-1] | (1<<int(c)))
rc.reverse()

mem = [set() for _ in range(10)]
for c,l,r in zip(S,lc,rc[1:]):
    c = int(c)
    for i in range(10):
        if l&(1<<i)==0: continue
        for j in range(10):
            if r&(1<<j)==0: continue
            mem[c].add(10*i+j)
print(sum(len(m) for m in mem))

Measured memory_bytes: 5824
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#define X first
#define Y second
using namespace std;

typedef long long ll;
ll sx, ex, sy, ey, n, si;
double pi = acos(-1.0);
vector<pair<ll, ll> > a;
vector<ll> lis;
int main()
{
	ll i, j, t = 1, tx, ty;
	cin >> sx >> sy >> ex >> ey >> n;
	if (sx > ex) swap(sx, ex), swap(sy, ey);
	if (sy > ey) t = -1, sy = -sy, ey = -ey;
	while (n--) {
		scanf("%lld %lld", &tx, &ty);
		ty *= t;
		if (tx < sx || tx > ex) continue;
		if (ty < sy || ty > ey) continue;
		a.push_back({tx, ty});
	}
	sort(a.begin(), a.end());
	lis.push_back(-1e9);
	for (i = 0; i < a.size(); i++) {
		j = lower_bound(lis.begin(), lis.end(), a[i].Y) - lis.begin();
		if (j == lis.size()) lis.push_back(0);
		lis[j] = a[i].Y;
	}
	si = lis.size() - 1;
	t = (ex - sx + ey - sy) * 100 - 20 * si;
    printf("%.15f", t * 1.0 + 5 * (si + (min(ex - sx, ey - sy) < si)) * pi);
    return 0;
}

Measured memory_bytes: 7788
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
#include <type_traits>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    int x; cin >> x;

    for(int i = 1; i <= x; i++) {
        int t = i * (i + 1) / 2;
        if(t >= x) {
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int dp[110][100010];

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K; cin >> N >> K;
    int a[110];
    rep(i, N) cin >> a[i];
    dp[0][0] = 1;
    rep(i, N) {
        rep(j, K + 1) {
            dp[i + 1][j] = dp[i + 1][j - 1] + dp[i][j];
            if (j - 1 - a[i] >= 0) {
                dp[i + 1][j] -= dp[i][j - 1 - a[i]];
            }
            dp[i + 1][j] = (dp[i + 1][j] + mod) % mod;
        }
    }
    /*
    rep(i, N + 1) {
        rep(j, K + 1) {
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    cout << dp[N][K] << endl;

    return 0;
}


Measured memory_bytes: 79360
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<stack>
#include<queue>
#include<sstream>
#include<string>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i);

using namespace std;

struct node{
	int pos;
	int prev;
	int speed;
	double cost;

	node(int t_pos,int t_prev,int t_speed,double t_cost){
		pos = t_pos; prev = t_prev; speed = t_speed; cost = t_cost;
	}

	bool operator<(const node& a) const { //キューの中身を逆転
		return cost > a.cost;
	}
};

struct root{
	int to;
	double cost;
	int speed;

	root(int t_to,double t_cost,int t_sp){
		to = t_to; cost = t_cost; speed = t_sp;
	}

};

vector< vector <root> > roots;
int n,m,s,g;

double dp[31][31][31];

const double INF = (1 << 29);

void search(){

	fill_n((double *)dp,sizeof(dp)/sizeof(double),INF);	
	
	priority_queue<node> pq;

	rep(i,roots[s].size()){
	
		root r = roots[s][i];
		
		pq.push( node(r.to,s,1,r.cost) );
		dp[r.to][s][1] = r.cost;
	}

	while(!pq.empty()){

		node tn = pq.top();
		pq.pop();

		if( dp[tn.pos][tn.prev][tn.speed] != tn.cost) continue;

		if( tn.pos == g && tn.speed ==1){
			cout << tn.cost << endl;
			return;
		}	

		rep(i,roots[tn.pos].size()){
			root r = roots[tn.pos][i];
			if(r.to == tn.prev) continue;

			for( int j = -1; j< 2; j++){
				if( tn.speed + j > 0 && tn.speed +j <= r.speed){
					double cost = tn.cost + r.cost/(tn.speed+j);
					if( dp[r.to][tn.pos][tn.speed+j] > cost){
						dp[r.to][tn.pos][tn.speed + j] = cost;
						pq.push( node( r.to,tn.pos,tn.speed + j,cost));
					}
				}
			}
		}
	}

	cout << "unreachable" << endl;
}


int main(){

	while(1){

		cin >> n >> m >> s >> g;
		s--;g--;
		if(m==0&&n==0) break;

		roots = vector< vector<root> >(n);

		rep(i,m){
			int r1,r2,cost,sp;
			cin >> r1 >> r2 >> cost >> sp;
			r1--;r2--;
			roots[r1].push_back( root(r2,cost,sp));
			roots[r2].push_back( root(r1,cost,sp));
		}
		search();
	}

}

Measured memory_bytes: 2004
#include<bits/stdc++.h>
using namespace std;
const double PI=acos(-1.0);
#define ll long long
int main()
{
	ios_base::sync_with_stdio(false);
	long double a,b;
	ll c;
	cin>>a>>b;
	b*=1000;
	c=a*b/1000;
	///ll x=15*5/3;
	//c/=100;
	cout<<c<<endl;
	///cout<<x<<endl;
	return 0;
}


Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    string s,ans="Yes";
    cin>>s;
    REP(i,a)if(s[i]=='-')ans="No";
    if(s[a]!='-')ans="No";
    for(int i=a+1;i<=a+b;i++)if(s[i]=='-')ans="No";
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
	for(int i=0; i<9; i++){
		string team;
		int am, pm;
		cin >> team >> am >> pm;
		cout << team;
		printf(" %d %d\n",am+pm, am*200 + pm*300);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h> 
using namespace std; 
int main() {
  int n, d; 
  int r = 0; 
  int x, y; 
  cin >> n >> d; 
  for (int i = 0; i < n; i ++) {
   	cin >> x >> y; 
    if (sqrt(pow(x, 2) + pow(y, 2)) <= d)
      r ++; 
  }
  cout << r; 
}

Measured memory_bytes: 3676
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 03/21/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  ll N,M; cin>>N>>M;

  vector<vector<ll>> dp(3*N+3, vector<ll>(N+2, 0));
  dp[0][0] = 1;
  for (int i = 0; i < 3*N; i++) {
    for (int j = 0; j <= N; j++) {
      dp[i+1][j] += dp[i][j];
      dp[i+1][j] %= M;
      dp[i+2][j+1] += dp[i][j]*(i+1)%M;
      dp[i+2][j+1] %= M;
      dp[i+3][j+1] += dp[i][j]*(i+2)*(i+1)%M;
      dp[i+3][j+1] %= M;
    }
  }

  ll ans = 0;
  for (int i = 0; i <= N; i++) {
    ans += dp[3*N][i];
    ans %= M;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 94464
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	double ans = 0.0;
	for (int i = 0;i < n;i++)
	{
		int x;
		cin >> x;
		ans += 1.0 / x;
	}
	printf("%.6f\n",1.0 / ans);
	return 0;
}


Measured memory_bytes: 256
/**
                 MD.Faysal Hasan
                Comilla Univesity               **/

#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<string>
#include <stdlib.h>
using namespace std;

#define         rep(i,n)       for ( i=0 ; i<n ; ++i )
#define         rep1(i,n)      for ( i=1 ; i<=n ; ++i )
#define         sajo(str)      sort(str.begin(),str.end())
#define         rev(str)       reverse(str.begin(),str.end())
#define         usajo(str)     sort(str.rbegin(),str.rend())
#define         pi             2*acos(0.0)
#define         nel            printf("\n")
#define         longmx         92233720368547758
#define         gcd(a,b)       __gcd(a,b)
#define         lcm(a,b)       (a/gcd(a,b))*b
#define         yes            cout<<"YES"<<"\n"
#define         no             cout<<"NO"<<"\n"
#define         vcl            vector<ll>
#define         pb             push_back
#define         mkp(x,y)       make_pair(x,y)
#define         ff             first
#define         sc             second
#define         spc            ' '
#define         nn             '\n'
#define         Faysal         ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef         long long int  lli;
typedef         long long      ll;

int main(){Faysal

    ll ans,sum,tot,cnt,mx,mn,idx,chk,tmp,mid,lft,rgt,pos;
    ll tc,n,m,a,b,c,d,g,h,l,r,x,y,i,j,k;

    cin>>a>>b>>c;
    cout<<c<<spc<<a<<spc<<b<<nn;
    return 0;
}


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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000000
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main(){
  string s;
  cin >> s;
  int n = s.size();
  if(s[0] != '1' || s[n-1] != '0'){
    cout << -1 << endl;
    return 0;
  }
  REP(i, n-1){
    if(s[i] == '1' && s[n-2-i] == '0'){
      cout << -1 << endl;
      return 0;
    }
  }
  int c1 = 1, c2 = 2;
  cout << c1 << " " << c2 << endl;
  REP(i, n-2){
    int nc1, nc2 = i+3;
    if('1' == s[i]) nc1 = c2;
    else nc1 = c1;
    cout << nc1 << " " << nc2 << endl;
    c1 = nc1;
    c2 = nc2;
  }
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cmath>
#include <unordered_set>
#include <algorithm>

using namespace std;
const double eps = 1e-6;
const int N = 2e5 + 5;
typedef long long ll;
int l[N];
int n, k;
bool chk(int x) {
    int cnt = 0;
    for(int i = 1; i <= n; i++) {
        cnt += (l[i] / x);
        if(l[i]%x) cnt++;
        cnt--;
        if(cnt > k) return false;
    }
    return true;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 1; i <= n; i++) cin >> l[i];
    sort(l+1, l+n+1, greater<int>());
    int ansl = 1,ansr = l[1];
    while(ansl < ansr) {
        int mid = (ansl + ansr)>>1;
        if(chk(mid)) ansr = mid;
        else ansl = mid+1;
    }
    printf("%d\n", ansl);
    return 0;
}

Measured memory_bytes: 3928
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		sc.close();

		long cnt =  S.chars().filter(ch -> ch == '.').count();
		long wcnt = cnt;
		for(int i = 0;i < N;i++) {
			if(S.charAt(i)=='.') {
				wcnt--;
			}else{
				wcnt++;
			}
			cnt = Math.min(cnt, wcnt);
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 31320
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::io::{self, Write};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, char) => {
        read_value!($next, String).chars().collect::<Vec<char>>()[0]
     };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
     };
    ($next:expr, isize1) => {
        read_value!($next, isize) - 1
    };
     ($next:expr, $t:ty) => {
         $next().parse::<$t>().expect("Parse error")
    };
}
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}
#[allow(dead_code)]
const MOD: usize = 1000000007;
#[allow(dead_code)]
fn to_num(c: char) -> i64 {
    c as i64 - 48
}


fn main() {
    input!{
        N: usize,
        A: [usize; N],
    }
    let mut hash: HashMap<usize, usize> = HashMap::new();
    for a in A {
        *hash.entry(a).or_insert(0) += 1;
    }
    let mut res = 0;
    let mut evencnt = 0;
    for (_, v) in hash.into_iter() {
        res += 1;
        evencnt += if v % 2 == 0 { 1 } else { 0 };
    }
    println!("{}", res - if evencnt % 2 == 0 { 0 } else { 1 });
}

Measured memory_bytes: 12540
#include <cstdio>
#include <math.h>

bool isPrime(int *a) {
    if (*a <= 2) {
        return true;
    }
    if (*a % 2 == 0) {
        return false;
    }
    int b = sqrt(*a);
    for (int i = 3; i <= b; i += 2) {
        if (*a % i == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    int n;
    scanf("%d", &n);
    int a;
    int c = 0;
    for (int i = 0;i < n; i++) {
        scanf("%d", &a);
        if (isPrime(&a)) {
            c++;
        }
    }
    printf("%d\n", c);

    return 0;
}


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

int main() {
  string s, t;
  cin >> s >> t;
  
  int n = s.size();
  bool ok = false;
  
  rep(i,n) {
    s = s.back() + s.substr(0,n-1);
    if (s == t) {
      ok = true;
      break;
    }
  }
  
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
s = gets.chomp.split('')

x = 0
max_num = 0

s.each do |i|
  case i
  when 'I'
    x += 1
    max_num = x if x > max_num
  when 'D'
    x -= 1
  end
end

puts max_num


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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
//int in() { int x; scanf("%d", &x); return x; }
//ll lin() { ll x; scanf("%lld", &x); return x; }
void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }

int main(void){

	string s; 
	cin >> s;

	char str = '\0';
	for(char& c:s){
		if(str == c){
			cout << "Bad";
			return 0;
		}

		str = c;
	}

	cout << "Good";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = (int)(a);i < (int)(b);i++)

int main() {
  int n;
  cin >> n;
  double s = 0;
  vector<int> x(n), y(n);
  rep(i, 0, n) cin >> x[i] >> y[i];
  rep(i, 0, n) {
    rep(j, i+1, n) {
      s += sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
    }
  }
  cout << fixed << setprecision(8) << s*2/n << endl;
}

Measured memory_bytes: 3812
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n, = map(int,readline().split())
s = input()

"""
0: 羊
1: 狼
"""
ans = [0]*(n+2)
for I in range(2):
    for J in range(2):
        ans[0] = I
        ans[1] = J
        for i in range(n):
            if s[i]=="o":
                ans[i+2] = ans[i+1]^ans[i]
            else:
                ans[i+2] = ans[i+1]^ans[i]^1
        if ans[n] != ans[0]:
            continue
        if ans[n+1] != ans[1]:
            continue
        s = "".join("S" if ai==0 else "W" for ai in ans[1:n+1])
        print(s)
        exit()        
        

print(-1)

        






Measured memory_bytes: 11360
# a,b=map(int,input().split(" "))

# c=0

# ans=0

# while(c<b):
# 	c+=a
# 	ans+=1

# print(ans)


n=int(input())
a=list(map(int,input().split(" ")))

ans=0

i=0


while(i<n):
	j=i
	now=a[i]
	tmp=0

	while(j<n and a[j]<=now):
		tmp+=1
		now=a[j]
		j+=1

	i=j

	ans=max(ans,tmp)

print(ans-1)

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1e9+7;


void solve()
{
	ll n,m;
	cin>>n>>m;
	vector<string> s(n);
	for(ll i=0;i<n;i++)
		cin>>s[i];
	
	vector<vector<ll>> l(n,vector<ll> (m,0));
	vector<vector<ll>> r(n,vector<ll> (m,0));
	vector<vector<ll>> u(n,vector<ll> (m,0));
	vector<vector<ll>> d(n,vector<ll> (m,0));
	// cout<<1;
	ll c=0;
	for(ll i=0;i<n;i++)
	{
		c=0;
		for(ll j=0;j<m;j++)
		{
			if(s[i][j]=='.')
			{
				c++;
				l[i][j]=c-1;
			}
			else
				c=0;
		}
	}
	for(ll i=0;i<n;i++)
	{
		c=0;
		for(ll j=m-1;j>=0;j--)
		{
			if(s[i][j]=='.')
			{
				c++;
				r[i][j]=c-1;
			}
			else
				c=0;
		}
	}
	for(ll i=0;i<m;i++)
	{
		c=0;
		for(ll j=0;j<n;j++)
		{
			if(s[j][i]=='.')
			{
				c++;
				u[j][i]=c-1;
			}
			else
				c=0;
		}
	}
	for(ll i=0;i<m;i++)
	{
		c=0;
		for(ll j=n-1;j>=0;j--)
		{
			if(s[j][i]=='.')
			{
				c++;
				d[j][i]=c-1;
			}
			else
				c=0;
		}
	}
	ll ans=0;
	for(ll i=0;i<n;i++)
		for(ll j=0;j<m;j++)
			ans=max(ans,l[i][j]+r[i][j]+u[i][j]+d[i][j]+1);
	cout<<ans;
	return;
}

int main()
{
        fast;
        ll q;
        q=1;
        // cin>>q;
        while(q--)
        	solve();
        
        return 0;
}


Measured memory_bytes: 132796
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
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;
}
signed main() {
    int X;
    cin >> X;
    for(int b = 0; b <= 200; b++) {
        int xx = b * b * b * b * b + X;
        int x = X - b * b * b * b * b;
        rep(a, 200) {
            if(a * a * a * a * a == xx) {
                cout << a << ' ' << b << endl;
                return 0;
            }
            if(a * a * a * a * a == x) {
                cout << a << ' ' << -b << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3592
#include <stdio.h>

int main(int argc, char *argv[])
{
	long long n,k,d,ans;
	scanf("%lld%lld%lld",&n,&k,&d);
	if(n<0)
		n=n*(-1);
	if(n/d<k){
		if(((n/d)-k)%2==0)
			ans=n%d;
		else ans=(n%d)-d;
	}
	if(n/d>k)
		ans=n-k*d;
	if(ans<0)ans=ans*(-1);
	printf("%lld\n",ans);
}

Measured memory_bytes: 2152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-5;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    ld a, b, c; cin >> a >> b >> c;
    a *= 1000000000000000000;
    b *= 1000000000000000000;
    c *= 1000000000000000000;
    ld x = sqrtl(a), y = sqrtl(b), z = sqrtl(c);
    if (abs(z - (x + y)) <= eps)cout << "No\n";
    else if (x + y < z)cout << "Yes\n";
    else cout << "No\n";
}


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

class Program {
    static void Main(string[] args) {
        int n = Cin.Ni();
        int[] list = new int[n];
        int total = 0;
        for (int i = 0; i < n; i++) {
            list[i] = Cin.Ni();
            total += list[i];
        }

        if (total % 10 != 0) {
            Console.WriteLine(total);
        } else {
            Array.Sort(list);
            foreach (var item in list) {
                if ((total - item) % 10 != 0) {
                    Console.WriteLine(total - item);
                    return;
                }
            }
            Console.WriteLine(0);
        }

    }
}


public class Cin {
    private static string[] s = new string[0];
    private static int i = 0;

    private static char[] cs = new char[] { ' ' };

    public static string Next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return Next();
    }

    public static int Ni() {
        return int.Parse(Next());
    }

    public static long NextLong() {
        return long.Parse(Next());
    }

    public static double NextDouble() {
        return double.Parse(Next());
    }

}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int N; cin >> N;
    set<int> S;
    REP(i,N){
        int d; cin >> d;
        S.insert(d);
    }
    cout << S.size() << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;

    long long ans = 0;

    if (K % 2 == 1) {
        ans = pow(N / K, 3);
    } else if (K <= 2 * N){
        ans = pow(N / K, 3) + pow((N - K/2) / K + 1, 3);
    } else {
        ans = 0;
    }
    
    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);
		
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();
		
		int x[] = new int[N];
		int y[] = new int[M];
		
		for (int i = 0; i < N; i++) {
			x[i] = sc.nextInt();
		}
		
		for (int i = 0; i < M; i++) {
			y[i] = sc.nextInt();
		}
		
		int maxX = x[0];
		int minY = y[0];
		
		for (int i = 0; i < N; i++) {
			if (x[i] > maxX) {
				maxX = x[i];
			}
		}
		
		for (int i = 0; i < M; i++) {
			if (y[i] < minY) {
				minY = y[i];
			}
		}
		
		int maxXX = Math.max(maxX, X);
		int minYY = Math.min(minY, Y);
		
		if (minYY > maxXX) {
			System.out.println("No War");
		} else {
			System.out.println("War");
		}
		
	}
}

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vvll = vector<vll>;
using vst = vector<st>;
using vch = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b;return true;} return false;}
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b;return true;} return false;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;

int main(){
	ll s, w;
	cin >> s >> w;
	cout << (s <= w ? "unsafe" : "safe") << endl;
}

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

using i64 = int64_t;

template <typename T, typename E> class SegmentTree {
  private:
    int n;
    vector<T> node;
    const function<T(T, T)> query_func;
    const function<T(T, E)> update_func;
    const T identity;

  public:
    SegmentTree() = default;

    SegmentTree(int size, function<T(T, T)> query_func,
                function<T(T, E)> update_func, T identity,
                vector<T> v = vector<T>())
        : query_func(query_func), update_func(update_func), identity(identity) {
        n = 1;
        while (n < size)
            n *= 2;
        node.resize(2 * n - 1, identity);
        if (size == v.size())
            build(size, v);
    }

    void build(int size, vector<T> v) {
        for (int i = 0; i < size; ++i)
            node[i + n - 1] = v[i];
        for (int i = n - 2; i >= 0; --i)
            node[i] = query_func(node[2 * i + 1], node[2 * i + 2]);
    }

    void update(int x, E val) {
        x += n - 1;

        node[x] = update_func(node[x], val);
        while (x > 0) {
            x = (x - 1) / 2;
            node[x] = query_func(node[2 * x + 1], node[2 * x + 2]);
        }
    }

    T query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0)
            r = n;

        if (r <= a || b <= l)
            return identity;

        if (a <= l && r <= b)
            return node[k];

        int vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
        int vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return query_func(vl, vr);
    }
};

i64 gcd(i64 m, i64 n) {
    return (n == 0 ? m : gcd(n, m % n));
}

int main(){
    int n;
    cin >> n;
    vector<i64> v;
    for(int i=0;i<n;++i){
        i64 a;
        cin >> a;
        v.push_back(a);
    }

    auto st = SegmentTree<i64, i64>(
        n,
        gcd,
        [](i64 a, i64 b){return b;},
        0,
        v
    );

    i64 ans = 0;
    for(int i=0;i<n;++i){
        ans = max(ans, gcd(st.query(0, i), st.query(i+1, n+1)));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4724
#include <bits/stdc++.h>
#define MAX 1000005
using namespace std;

char s[MAX];
int n;
int a[MAX];

int main()
{
    scanf("%s", s);
    n = strlen(s);
    for(int i = 0; i < n; i++){
        a[n-i] = s[i]-'0';
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        if(a[i] != 5){
            if(10-a[i] < a[i]) a[i+1]++;
            ans += min(a[i], 10-a[i]);
            continue;
        }
        if(a[i+1] >= 5) a[i+1]++;
        ans += 5;
    }
    if(a[n+1] > 0) ans += a[n+1];
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h> 
using namespace std;
int ans;
int main(){
    std::ios::sync_with_stdio(false); 
    int a,b,c;
    cin>>a>>b>>c;
    int d[10001];
    for(int i=1;i<=a;++i){
    cin>>d[i];
    if(d[i]<b||d[i]>=c){
        ans++;  
    }
}
    cout<<ans<<endl; 
    return 0;   
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <cstring>
#include <algorithm>
#include <ctime>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <list>
#include <limits.h>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>

using namespace std;
typedef long long ll;
const int INF = 1e5 + 10;

int main() {
    int N, a; cin >> N;

    string ans = "APPROVED";
    for(int i = 0; i < N; i++) {
        cin >> a;
        if(a % 2 == 0 && !(a % 3 == 0 || a % 5 == 0)) {
            ans = "DENIED";
        }
    }
    cout << ans << endl;
    return 0;
}





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

long long n, k, a[105], arr[100005], dp[105][100005];

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for (int i = 1; i <= n; i++) cin >> a[i];
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++){
        long long sum = 0;
        for (int j = 0; j <= k; j++){
            sum += dp[i - 1][j];
            arr[j] = sum;
        }
        for (int j = 0; j <= k; j++){
            if (j - a[i] - 1 < 0){
                dp[i][j] = arr[j] % MOD;
            }
            else{
                dp[i][j] = (arr[j] - arr[j - a[i] - 1]) % MOD;
            }
        }
    }
    cout << dp[n][k] % MOD;
    return 0;
}

Measured memory_bytes: 80128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main(){
  int n;
  std::cin >> n;
  std::vector<int>a(n),dp(n,INF);
  rep(i,n)std::cin >> a[i];
  dp[0]=0;
  dp[1]=abs(a[1]-a[0]);
  for (int i = 2; i < n; i++) {
    /* code */
    dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
  }
  std::cout << dp[n-1] << std::endl;
}

Measured memory_bytes: 1024
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b' ');
    let t: i32 = read(&mut stdin_lock, &mut buf, b'\n');
    let mut ctv = vec![(0, 0); n];
    for i in 0..n {
        ctv[i].0 = read(&mut stdin_lock, &mut buf, b' ');
        ctv[i].1 = read(&mut stdin_lock, &mut buf, b'\n');
    }

    ctv.sort();
    ctv.iter()
        .filter(|&&(_, t1)| t1 <= t)
        .nth(0)
        .map_or_else(|| println!("TLE"), |&(c, _)| println!("{}", c));
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;

map<int,int> prime_factor(int n){
  map<int,int> mp;
  for(int i=2;i*i<=n;i+=2){
    while(n%i==0){
      mp[i]++;
      n/=i;
    }
    if(i==2) i--;
  }
  if(n!=1) mp[n]=1;
  return mp;
}


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  map<int,int> fac;
  repi(i,1,n){
    map<int,int> mp=prime_factor(i+1);
    for(auto itr=mp.begin();itr!=mp.end();itr++){
      fac[itr->F]+=itr->S;
    }
  }
  int two=0,four=0,fourteen=0,twofour=0,sevenfour=0;
  for(auto itr=fac.begin();itr!=fac.end();itr++){
    int num=itr->S;
    if(num>=2) two++;
    if(num>=4) four++;
    if(num>=14) fourteen++;
    if(num>=24) twofour++;
    if(num>=74) sevenfour++;
  }
  //cout<<two<<" "<<four<<endl;
  int ans=0;
  ans+=sevenfour;
  if(twofour!=0) ans+=twofour*(two-1);
  if(fourteen!=0) ans+=fourteen*(four-1);
  ans+=four*(four-1)*(two-2)/2;
  cout<<ans<<endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);


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

  ll N;
  cin >> N;

  for (int h = 1; h <= 3500; h++) {
    for (int n = h; n <= 3500; n++) {
      if ((4 * h * n - N * n - N * h) <= 0) continue;
      if ((N * h * n) % (4 * h * n - N * n - N * h) == 0) {
        int w = (N * h * n) / (4 * h * n - N * n - N * h);
        printf("%d %d %d\n", h, n, w);
        return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3728
def area(a,b):
    return a * b

def perimetro(a,b):
    return 2 * (a + b)

def main():
    a,b = map(int,input().split())
    ar = area(a,b)
    pe = perimetro(a,b)
    return ar, pe

ar, pe = main()

print(ar, pe)



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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int h,a; cin>>h>>a;
  int ans =(h+a-1)/a;
  cout<<ans;
  

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define ll long long

using namespace std;
int mod = 1000000007;

int N, M;
int main() {
  cin >> N >> M;
  vector<int> a(M);
  vector<int> b(M);
  vector<P> c;
  rep(i, M) {
    cin >> a.at(i) >> b.at(i);
    c.emplace_back(b.at(i), a.at(i));
  }
  sort(c.begin(), c.end());

  int ans = 0;
  int cut = -1;
  rep(i, M) {
    int now = c.at(i).first;
    if (now > cut && c.at(i).second >= cut) {
      ans++;
      cut = now;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 2168
N = int(input())
A = [int(i) for i in input().split()]

A_uni = set(A)
dup = len(A) - len(A_uni)
ans = 0

if dup % 2 == 0:
    ans = len(A) - dup
else:
    ans = len(A) - dup - 1

print(ans)


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

using namespace std;

#define nl '\n'

int main() {
  long long vMax = 1e5; // value max
  long long n, w;
  cin >> n >> w;

  vector<vector<long long>> data(n+1, vector<long long>(2, 0)); // 0 is weight, 1 is value
  for (long long i = 1; i <= n; i++) {
    cin >> data[i][0] >> data[i][1];
  }
  vector<vector<long long>> dp(n+1, vector<long long>(vMax+1, 1e9+1));
  for (long long i = 0; i <= n; i++) {
    dp[i][0] = 0;
  }

  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= vMax; j++) {
      if (j < data[i][1]) {
        dp[i][j] = dp[i-1][j];
      } else {
        dp[i][j] = min(dp[i-1][j], dp[i-1][j-data[i][1]] + data[i][0]);
      }
    }
  }

  for (long long j = vMax; j >= 0; j--) {
    for (long long i = 1; i <= n; i++) {
      if (dp[i][j] <= w) {
        cout << j << nl;
        return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 80256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n = I()
A = LI()
s = len(set(A))
if not (n - s) % 2:
    print(s)
else:
    print(s - 1)

Measured memory_bytes: 59556
n = int(input())
ans = 10**5
for i in range(n//2):
    a = i+1
    b = n-a
    tmp = 0
    for i in str(a):
        tmp += int(i)
    for i in str(b):
        tmp += int(i)
    ans = min(ans, tmp)
print(ans)

Measured memory_bytes: 9104
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
int abs(int x){
    if(x<0) return -x;
    else return x;
}
int main() {
    int a,b,c,x;
    cin>>a>>b>>c>>x;
    int ans=0;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                int sum=i*500+j*100+50*k;
                if(sum==x) ans++;
            }
        }
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 1000000000000000007LL
#define ll long long
using namespace std;
vector<int> nex[214];
int fd[201][201];
int col[201];
int dis[201][201];
ll par[114514];
ll rankk[114514];
void init(int n){
	for(int i=0;i<n;i++){
		par[i] = i;
		rankk[i]=0;
	}
}
ll find(ll x){
	if(par[x] == x){
		return x;
	}else{
		return par[x] = find(par[x]);
	}
}
void unite(ll x, ll y){
	x = find(x);
	y = find(y);
	if(x==y)return;
	if(rankk[x]<rankk[y]){
		par[x]=y;
	}else{
		par[y]=x;
		if(rankk[x]==rankk[y])rankk[x]++;
	}
}
signed main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		string s;
		cin>>s;
		for(int j=1;j<=n;j++){
			if(s[j-1]=='1'){
				fd[i][j] = 1;
				nex[i].pb(j);
			}
		}
	}
	queue<int> que;
	que.push(1);
	col[1] = 1;
	bool nib = true;
	while(!que.empty() ){
		int cur = que.front(); que.pop();
		for(int i=0;i<nex[cur].size();i++){
			int nx = nex[cur][i];
			if( col[nx] == 0 ){
				col[nx] = 3 - col[cur];
				que.push(nx);
			}
			else if( col[cur] + col[nx] != 3 ){
				nib = false;
			}
		}
	}
	if( nib == false ){
		cout<<-1<<endl;
		return 0;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if( i == j )dis[i][j] = 0;
			else if(fd[i][j]==1)dis[i][j] = 1;
			else dis[i][j] = inf;
		}
	}
	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				if( dis[i][j] > dis[i][k] + dis[k][j] ) dis[i][j] = dis[i][k] + dis[k][j];
			}
		}
	}
	int ans = 0;
	for(int k=1;k<=n;k++){
		init(n);
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				if( i != k && j != k && fd[i][j] == 1 )unite(i,j);
			}
		}
		vector<int> lar;
		for(int i=0;i<=n;i++){
			lar.pb(0);
		}
		for(int i=1;i<=n;i++){
			//cout<<i<<" "<<find(i)<<" "<<" "<<dis[1][i]<<endl;
			if( i != k ) lar[ find(i) ] = max( lar[find(i)], dis[k][i] );
		}
		sort( lar.begin(), lar.end(), greater<int>() );
		int tmp = lar[0]+lar[1]+1;
		if( ans < tmp ) ans = tmp;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    int k;
    cin >> k;
    int n = s.length();
    
    long long dp[n+10][2][5] = {0};
    for (int i = 0; i < n+10; i++) {
        for (int j = 0; j < 2; j++) {
            for (int l = 0; l < 5; l++) {
                dp[i][j][l] = 0;
            }
        }
    }
    
    dp[0][0][0] = 1;
    for (int i = 0; i < n; i++) {
        const int d = s[i] - '0';
        for (int j = 0; j < 2; j++) {
            for (int l = 0; l <= k; l++) {
                for (int m = 0; m <= (j ? 9 : d); m++) {
                    if (m == 0) dp[i+1][j || (m < d)][l] += dp[i][j][l];
                    else dp[i+1][j || (m < d)][l+1] += dp[i][j][l];
                }
            }
        }
    }
    
    long long ans = dp[n][0][k] + dp[n][1][k];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256