akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

template <typename ... Args>
std::string format(const std::string& fmt, Args ... args ) {
    size_t len = std::snprintf( nullptr, 0, fmt.c_str(), args ... );
    std::vector<char> buf(len + 1);
    std::snprintf(&buf[0], len + 1, fmt.c_str(), args ... );
    return std::string(&buf[0], &buf[0] + len);
}

int n, m;

int main() {
    cin >> n >> m;

    Vs v(m);
    Vi u(n, 1);
    V<P<Pii, int>> x(m);
    REP(i, m) {
        int p, y; cin >> p >> y;
        p--;
        x[i] = {{y, p}, i};
    }
    sort(ALL(x));
    REP(i, m) {
        int p = x[i].first.second;
        int idx = x[i].second;
        v[idx] = format("%06d%06d", p+1, u[p]);
        u[p]++;
    }
    for (auto x: v) {
        cout << x << '\n';
    }

    return 0;
}


Measured memory_bytes: 9084
n,m,c = map(int,input().split())
count = 0
b = list(map(int,input().split()))
for i in range(n):
    kei = c
    a = list(map(int,input().split()))
    for j in range(m): kei += a[j] * b[j]
    if kei > 0 : count += 1
print(count)

Measured memory_bytes: 3064
package main

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

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

const yes = "Yes"
const no = "No"

func solve(n int64, m int64, k int64) bool {
	for r := int64(0); r < n + 1; r ++ {
		for c := int64(0); c < m + 1; c ++ {
			if r * m + c * n - 2 * r * c == k {
				return true
			}
		}
	}
	return false
}

func main() {
	defer out.Flush()

	n := nextInt()
	m := nextInt()
	k := nextInt()
	if solve(n, m, k) {
		fmt.Fprintln(out, yes)
	} else {
		fmt.Fprintln(out, no)
	}
}

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

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1e5+5;

int a[sz];

int main()
{
    int n,m,tot=0;
    cin >> n >> m;
    for(int i=0; i<n; i++) scanf("%d", &a[i]), tot+=a[i];
    sort(a,a+n, greater <int>());

    if(tot > 4*m*a[m-1]) puts("No");
    else puts("Yes");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define INF 1000000000000
#define MOD 10000007
#define PI 3.14159265359
#define dij priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>
typedef long long ll;
//
int main(){
    int n;cin>>n;
    vector<int> v(n);
    rep(i,n)cin>>v[i];
    int ans=0;
    FOR(i,0,n-1){
        FOR(j,i+1,n-1){
            FOR(k,j+1,n-1){
                if(v[i]>=v[j]+v[k]||v[j]>=v[i]+v[k]||v[k]>=v[i]+v[j])continue;
                else if(v[i]==v[j]||v[j]==v[k]||v[i]==v[k])continue;
                else {
//                    cout<<i<<j<<k<<endl;
                    ans++;
                }
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3628
#!/usr/bin/env python3
# 色が変わっている個数を数える
s = input()
cnt = 0
for i in range(len(s)-1):
    if s[i] != s[i+1]: cnt += 1
print(cnt)
"""
for i in range(len(s)-1):
    if s[i] != s[i+1]: cnt += 1
print(cnt)"""


Measured memory_bytes: 39408
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;
mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;
#[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
#[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
        where
        <T as FromStr>::Err: Debug,
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse().unwrap())
                .collect()
        }
}
#[allow(unused_macros)]
macro_rules ! get { ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ;; ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { println ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }

fn main() {
    let mut line: Vec<char> = util::line().chars().collect();

    line[3] = '8';

    println!("{}", line.iter().cloned().collect::<String>());
}


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

using namespace std;

typedef long long ll;

const int N = 4e2 + 10;
const ll oo = 1ll << 60;

ll dp[N][N];
ll a[N];

ll solve(int l, int r)
{
	if(l > r)
		return oo;

	if(l == r)
		return 0;

	if(l + 1 == r)
		return a[l] + a[r];

	ll &ans = dp[l][r];

	if(ans != -1)
		return ans;

	ans = oo;

	ll s = 0;
	for(int i = l; i <= r; i++)
		s += a[i];

	for(int i = l; i <= r; i++)
	{
		ll cur = solve(l, i) + solve(i + 1, r) + s;

		ans = min(ans, cur);
	}

	return ans;
}

int main()
{

	memset(dp, -1, sizeof(dp));

	int n;
	cin >> n;

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

	cout << solve(0, n - 1) << endl;

	return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
ll choice[4005][4005];
ll sum[4005][4005];
ll combi[4005][4005];
const long long mod = 998244353;
ll beki2[4005];
ll inv[4005];
long long beki(long long a, long long b){
    if(b == 0){
        return 1;
    }
    long long ans = beki(a, b / 2);
    ans = ans * ans;
    ans = ans % mod;
    if(b % 2 == 1){
        ans = ans * a;
        ans = ans % mod;
    }
    return ans;
}

int main() {
    //cout.precision(10);
    ll n, k;
    cin >> k >> n;
    beki2[0] = 1;
    for(int i =1; i <= 4003; i++){
        beki2[i] = (beki2[i - 1] * 2) % mod;
    }
    for(int i = 1; i <= 4004; i++){
        inv[i] = beki(i, mod - 2);
    }
    for(int i = 0; i <= 4003; i++){
        combi[0][i] = 0;
        combi[i][0] = 1;
    }
    for(int i = 1; i <= 4003; i++){
        for(int k = 1; k <= 4003; k++){
            combi[i][k] = combi[i -1][k] + combi[i - 1][k - 1];
            combi[i][k] = combi[i][k] % mod;
            if(k > i){
                combi[i][k] = 0;
            }
        }
    }
    for(int i = 0; i <= 4000; i++){
        choice[0][i] = 0;
        choice[i][0] = 1;
        sum[0][i] = 1;
        sum[i][0] = 1;
    }
    for(int i = 1; i <= 4000; i++){
        for(int j = 1; j <= 4000; j++){
            choice[i][j] = sum[i - 1][j - 1] * 2;
            choice[i][j] += choice[i - 1][j];
            choice[i][j] = choice[i][j] % mod;
            sum[i][j] = sum[i][j - 1] + choice[i][j];
            sum[i][j] = sum[i][j] % mod;
        }
    }
    for(ll i = 2; i <= k; i++){
        if(i % 2 == 1){
            ll ans = 0;
            for(int j = 0; j <= n; j++){
                ans += choice[i / 2][n - j] * combi[k - i + j][j];
                ans = ans % mod;
            }
            cout << ans << endl;
            continue ;
        }
        ll ans = 0;
        for(int j = 0; j <= n; j++){
            ans += choice[i / 2 - 1][n - j] * combi[k - i + j][j];
            ans = ans % mod;
        }
        for(int j = 0; j <= (n - 1); j++){
            ans += choice[i / 2 - 1][n - j - 1] * combi[k - i + j][j];
            ans = ans % mod;
        }
        cout << ans << endl;
    }
    if((k + 1) % 2 == 1){
        cout << choice[k / 2][n] << endl;
    } else {
        cout << (choice[k / 2][n] + choice[k / 2][n - 1]) % mod << endl;
    }
    for(ll p = (k + 2); p <= (2 * k); p++){
        ll i = 2 * k + 2 - p;
        if(i % 2 == 1){
            ll ans = 0;
            for(int j = 0; j <= n; j++){
                ans += choice[i / 2][n - j] * combi[k - i + j][j];
                ans = ans % mod;
            }
            cout << ans << endl;
            continue ;
        }
        ll ans = 0;
        for(int j = 0; j <= n; j++){
            ans += choice[i / 2 - 1][n - j] * combi[k - i + j][j];
            ans = ans % mod;
        }
        for(int j = 0; j <= (n - 1); j++){
            ans += choice[i / 2 - 1][n - j - 1] * combi[k - i + j][j];
            ans = ans % mod;
        }
        cout << ans << endl;
    }
    //cout << choice[3][5] << endl;
    return 0;
}


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

int main()
{
        int n;
        double x1, x2, x3, y1, y2, y3, a, b, c, r;
        std::cin >> n;
        std::cout.precision(3);
        std::cout.setf(std::ios::fixed);
        while(n--)
        {
                std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
                a = (x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2);
                b = (x1 - x3)*(x1 - x3) + (y1 - y3)*(y1 - y3);
                c = (x2 - x3)*(x2 - x3) + (y2 - y3)*(y2 - y3);
                r = -(a*a + b*b + c*c - 2*a*b - 2*b*c - 2*c*a);
                std::cout << (a*(-a+b+c)*x3 + b*(a-b+c)*x2 + c*(a+b-c)*x1)/r << " " << (a*(-a+b+c)*y3 + b*(a-b+c)*y2 + c*(a+b-c)*y1)/r << " " << sqrt(a*b*c/r) << std::endl;
        }
        return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    ll N; cin >> N;
    ll a[200005];
    ll sum = 0;

    for (int i = 0;i < N;i++){
        cin >> a[i];
        sum += a[i];
    } 

    ll sum2 = 0;
    ll min_abs = LLONG_MAX;

    for (int i = 0;i < N-1;i++){
        sum2 += a[i];
        min_abs = min(min_abs,abs(sum - sum2*2));
    }

    cout << min_abs << endl;

    return 0;

}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include <stdlib.h>
using namespace std;
#define         rep(i, n)       for (int i = 0; i < (int)(n); i++)
#define         pi              3.14159265359
#define         nl              printf("\n")
#define         gcd(a,b)        __gcd(a,b)
#define         yes             cout<<"Yes"<<"\n"
#define         no              cout<<"No"<<"\n"
#define         pf              printf
#define         sf              scanf
const int N = 2e5+5;
typedef long long int ll;
int i,j,temp,f=0;
int main()
{
   int a,b;cin>>a>>b;
   puts(min(a,b)>=(max(a,b)-1)?"Yay!":":(");
   return 0;
}


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

using namespace std;

int main()
{
    int n;
    string s;
    cin>>n>>s;
    if(n%2)
    {
        cout<<"No";
    }
    else
    {
        int flag=0,len=s.length();
        len=len/2;
        for(int i=0; i<len; i++)
        {
            if(s[i]!=s[len+i])
            {
                flag=1;
                break;
            }
        }
        if(flag)
        cout<<"No";
        else
        cout<<"Yes";
    }
    return 0;
}


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

const int dx[4] = {+1, 0, -1, 0};
const int dy[4] = {0, -1, 0, +1};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n; cin >> n;
    ll a[n], b[n];
    for(int i=0;i<n;i++) cin >> a[i] >> b[i];
    vector<pair<ll, int> > ab(n);
    for(int i=0;i<n;i++){
        ab[i] = make_pair(a[i] + b[i], i);
    }
    sort(ab.rbegin(), ab.rend());
    ll sumt = 0, suma = 0;
    for(int i=0;i<n;i++){
        int idx = ab[i].second;
        if(i %2 == 0) sumt += a[idx];
        else suma += b[idx];
    }
    cout << sumt - suma << endl;
}

Measured memory_bytes: 3456
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>

using namespace std;

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

int main(){
    int n;
    cin >> n;
    int x[n];
    rep(i, n) cin >> x[i];
    sort(x, x + n);
    int ans = 10000000;
    rep(i, 101){
        int sm = 0;
        rep(j, n){
            sm += (x[j] - i) * (x[j] - i); 
        }
        if (sm < ans) {
            ans = sm;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;


    public static class Program
    {
        static void Main()
        {
        var data1 = Console.ReadLine();
        var data2 = data1.Split(' ');
        var a = int.Parse(data2[0]);
        var b = int.Parse(data2[1]);

        if (a == b)
        {
            Console.WriteLine("a == b");
        }
        else if (a > b)
        {
            Console.WriteLine("a > b");
        }
        else if (a < b)
        {
            Console.WriteLine("a < b");
        }
    }
    }





Measured memory_bytes: 17908
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, ll> P;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int n,db[100100][20],cnt=0,dp[100100],id[100100];
bool visited[100100];
vector<P> path[225816];

struct edge{
	int to,c;
	ll d;
};

vector<edge> g[100100];

void dfs(int v, int p=0){
	int i;
	edge e;
	visited[v] = true;
	dp[v] = dp[p]+1;
	db[v][0] = p;
	id[v] = cnt; ++cnt;
	// cout << v << " ";
	for(i=(g[v].l_ength()-1); i>=0; --i){
		e = g[v][i];
		if(visited[e.to]){
			continue;
		}
		path[0].push_back(P(cnt,e.d));
		path[e.c].push_back(P(cnt,e.d));
		path[e.c+n].push_back(P(cnt,1ll));
		// cout << "( " << v << "->" << e.to << ") ";
		dfs(e.to,v);
		path[0].push_back(P(cnt,-e.d));
		path[e.c].push_back(P(cnt,-e.d));
		path[e.c+n].push_back(P(cnt,-1ll));
		// cout << "( " << e.to << "->" << v << ") ";
	}
}

int lca(int u, int v){
	int d = 0,i;
	d = dp[u] - dp[v];
	if(d < 0){
		swap(u,v);
		d = (-d);
	}
	for(i=0; i<20; ++i){
		if(d&(1<<i)){
			u = db[u][i];
		}
	}
	if(u==v){
		return u;
	}
	for(i=19; i>=0; --i){
		if(db[u][i] == db[v][i]){
			continue;
		}
		return lca(db[u][i],db[v][i]);
	}
	return db[u][0];
}

ll query(int c, int v){
	int l,r,m;
	v = id[v];
	l = 0; r = path[c].l_ength();
	while(r-l>1){
		m = ((l+r)>>1);
		if(path[c][m].first > v){
			r = m;
		}else{
			l = m;
		}
	}
	return path[c][l].second;
}

int main(void){
	int q,i,j,x,a,b,c;
	ll d,y,ans;
	edge e;
	cin >> n >> q;
	for(i=1; i<n; ++i){
		cin >> a >> b >> e.c >> e.d; --a; --b;
		e.to = b; g[a].push_back(e);
		e.to = a; g[b].push_back(e);
	}
	for(j=0; j<n*2; ++j){
		path[j].push_back(P(-1,0ll));
	}
	dp[0] = -1; dfs(0); // cout << endl;
	for(j=1; j<20; ++j){
		for(i=0; i<n; ++i){
			db[i][j] = db[db[i][j-1]][j-1];
		}
	}
	for(j=0; j<n*2; ++j){
		for(i=1; i<path[j].l_ength(); ++i){
			path[j][i].second += path[j][i-1].second;
		}
	}
	for(i=0; i<q; ++i){
		cin >> x >> y >> a >> b; --a; --b;
		c = lca(a,b);
		ans = query(x+n,a)+query(x+n,b)-query(x+n,c)*2;
		ans *= y;
		ans -= query(x,a)+query(x,b)-query(x,c)*2;
		ans += query(0,a)+query(0,b)-query(0,c)*2;
		cout << ans << endl;
	}
	return 0;
}


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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,k;
	cin>>n>>k;
	int arr[n];
	for(int i = 0;i < n; i++ ) cin>>arr[i];
	sort(arr,arr+n);
	int ans = 0;
	for(int i = 0;i < k; i++){
		ans+=arr[i];
	}
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 3648
t1, t2 = map(int, input().split())
a1, a2 = map(int, input().split())
b1, b2 = map(int, input().split())
if t1 * a1 + t2 * a2 == t1 * b1 + t2 * b2:
    print("infinity")
else:
    dis1 = t1 * (a1 - b1)
    dis2 = t1 * (a1 - b1) + t2 * (a2 - b2)
    if dis1 * dis2 > 0:
        print(0)
    else:
        if dis1 % dis2 == 0:
            print((-dis1 // dis2) * 2)
        else:
            print((-dis1 // dis2 + 1) * 2 - 1)

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

int combination(int x){
  int a;  
  a = x*(x-1)/2;
  return a;
}

int main(){
  
  int N;
  int M;
  int j;
  int k;

  cin >> N >> M;
  
  if(N==0||N==1){
    j = 0;
  }else{
    j = combination(N);
  }
  
  if(M==0||M==1){
    k = 0;
  }else{
    k = combination(M);
  }
  
  cout << j + k << endl;
  

}

Measured memory_bytes: 256
N=int(input())
a = []
for i in range(1, int(N**0.5)+1):
    if N % i == 0:
        a.append(i)
        if i != N // i:
            a.append(N//i)
if len(a)%2==1:
    print(a[-1]*2-2)
else:
    print(a[-2]+a[-1]-2)

Measured memory_bytes: 3268
import java.util.Arrays;
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    // 整数の数
    int n = sc.nextInt();

    // 整数のリスト
    int[] list = new int[n];
    for (int i = 0; i < n; i++) {
      list[i] = sc.nextInt();
    }
    // リストをソート
    Arrays.sort(list);
    // 始めの4つの要素だけ考えればいい
    int n2 = 4;
    if (n < 4){
        n2 = n;
    }
    int n3 = n2 * (n2 - 1);
    int[] list2 = new int[n3];
    int i = 0;
    for(int i1 = 0; i1 < n2; i1++){
      for(int i2 = 0; i2 < n2; i2++){
    	  if (i1 != i2) {
    		  String x1 = String.valueOf(list[i1]);
    		  String x2 = String.valueOf(list[i2]);
    		  String newX = x1 + x2;
    		  list2[i] = Integer.parseInt(newX);
    		  i ++;
    	  }
      }
    }
    sc.close();
    // 新たなリストをソート
    Arrays.sort(list2);
    System.out.println(list2[2]);
  }
}


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

int main()
{
	int k;cin>>k;
	string a;cin>>a;
	if(a.length()<=k)cout<<a<<endl;
	else{
		for(int i=0;i<k;i++)
		cout<<a[i];
		cout<<"..."<<endl;
	}
	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define  maxn 200005
#define pb push_back
#define forup(i,a,b) for(int i=(a);i<=(b);i++)  
#define fordown(i,a,b) for(int i=(a);i>=(b);i--)
int dis[maxn][15],ci[maxn],inq[maxn];
queue<int> Q;
vector<int> bi[maxn];
int n,m,q;
int main()
{ cin>>n>>m;
   forup(i,1,m)
    { int a,b; scanf("%d%d",&a,&b); 
     bi[a].pb(b);bi[b].pb(a);
    }
  cin>>q;
  forup(i,1,q)
  { int v,d,c; scanf("%d%d%d",&v,&d,&ci[i]); 
    dis[v][d]=i;
  }
  forup(i,1,n)
  {  fordown(j,10,1)
      { if(dis[i][j]>dis[i][j-1])
           {dis[i][j-1]=dis[i][j]; } 
      }
   Q.push(i);inq[i]=1;
  }
  while(!Q.empty())
     {  int t=Q.front();Q.pop();inq[t]=0;
       for(int i=0;i<bi[t].size();i++)
        { int cg=0;
         fordown(j,10,1)
           { if(max(dis[t][j],dis[bi[t][i]][j])>dis[bi[t][i]][j-1])
               { dis[bi[t][i]][j-1]=max(dis[t][j],dis[bi[t][i]][j]); 
                 cg=1;
               } 
           } 
         if(cg&&!inq[bi[t][i]])
           { Q.push(bi[t][i]);
             inq[bi[t][i]]=i; 
           }
        } 
     }

  forup(i,1,n)  cout<<ci[dis[i][0]]<<endl;
  return 0;
}

Measured memory_bytes: 16888
let format s =
  Str.split (Str.regexp " ") s |>
  List.map int_of_string |>
  List.sort (-) |>
  List.map string_of_int |>
  String.concat " "

let rec loop () =
  match read_line () with
  | "0 0" -> ()
  | line -> loop (print_endline (format line))

let () = loop ()

Measured memory_bytes: 4284
#include <bits/stdc++.h>
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) x.begin(),x.end()
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep (i, n) cin >> a[i];
    vector<int> l(n+1, 0);
    vector<int> r(n+1, 0);
    rep (i, n) l[i+1] = gcd(l[i], a[i]);
    for (int i=n-1; i>=0; --i) r[i] = gcd(r[i+1], a[i]);
    int ans=0;
    rep (i, n) {
        int le = l[i];
        int ri = r[i+1];
        chmax(ans, gcd(le, ri));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4492
N, K = map(int, input().split())
X = list(map(int, input().split()))
t = []
for i in range(N - K + 1):
  start = X[i]
  end = X[i + K - 1]
  if start * end >= 0:
    t.append(max(abs(start), abs(end)))
  else:
    t.append(end - start + min(abs(end), abs(start)))
print(min(t))

Measured memory_bytes: 14384
import math
abhm = list(map(int, input().split()))

Htheta=360/720*(abhm[2]*60+abhm[3])
Mtheta=360/60*(abhm[3])

if abs(Htheta-Mtheta)>180:
    angle=360-abs(Htheta-Mtheta)
else:
    angle=abs(Htheta-Mtheta)

print(math.sqrt(abhm[0]**2+abhm[1]**2-2*abhm[0]*abhm[1]*math.cos(angle*math.pi/180)))




Measured memory_bytes: 9456
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

Int n, ans;
vector<Int> a, b, c;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	a.resize(n);
	b.resize(n);
	c.resize(n-1);
	for(auto &i:a) cin >> i;
	for(auto &i:b) cin >> i;
	for(auto &i:c) cin >> i;
	for(Int i=0; i<n; ++i)
		ans += b[a[i]-1];
	for(Int i=0; i<n-1; ++i)
		if(a[i]+1 == a[i+1])
			ans += c[a[i]-1];
	cout << ans << "\n";
}

Measured memory_bytes: 256
N = gets.to_i
abcs = (N - 1).times.map { gets.split.map(&:to_i) }
Q, K = gets.split.map(&:to_i)
xys = Q.times.map { gets.split.map(&:to_i) }

graph = Array.new(N) { [] }
abcs.each do |(a, b, c)|
  a -= 1
  b -= 1
  graph[a].push([b, c])
  graph[b].push([a, c])
end

def bfs(s, graph)
  w_list = Array.new(graph.size, 1 << 60)
  w_list[s] = 0
  queue = [[s, 0, -1]]
  while !queue.empty?
    v, w, parent = queue.shift
    w_list[v] = w
    graph[v].each do |(u, w2)|
      next if u == parent
      queue.push([u, w + w2, v])
    end
  end
  w_list
end

w_list = bfs(K - 1, graph)
xys.each do |(x, y)|
  x -= 1
  y -= 1
  ans = w_list[x] + w_list[y]
  puts ans
end


Measured memory_bytes: 40444
import java.util.*;
import java.io.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		
		for(int i=0; i<n; i++){
			arr[i] = sc.nextInt();
		}
		
		int i=0;
		for(i=n-1; i>=0; i-=2){
			System.out.print(arr[i] + " ");
		}
		if(n != 1){
			if(n%2 == 0) i=0;
			else i = 1;
		
			for(; i<n; i+=2){
				System.out.print(arr[i] + " ");
			}
		}
		
		
		/*ArrayList<String> arrayList = new ArrayList<String>();
		arrayList.add(arr[0] + "");
		for(int i=1; i<n; i++){
			arrayList.add(arr[i] + "");
			Collections.reverse(arrayList);
		}
		
		for(int i=0; i<arrayList.size(); i++){
			System.out.print(arrayList.get(i) + " ");
		}
		System.out.println("");*/
	}
}

Measured memory_bytes: 92096
def main():
    N, K = map(int, input().split())
    H = list(map(int, input().split()))
    dp = [0] * N
    dp[0] = 0
    for i in range(1, N):
        vals = []
        for j in range(1, K+1):
            if i - j < 0:
                break
            vals.append(dp[i-j] + abs(H[i] - H[i-j]))
        dp[i] = min(vals)
    print(dp[-1])


if __name__ == '__main__':
    main()


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            double area = a * b;

            Console.WriteLine(area / 3.305785);
        }
    }
}

Measured memory_bytes: 9172
H, W = map(int, input().split())

ans = 10**12

# 1枚目を(1,2,...,H-1)*Wとする
for h in range(1, H):
    s1 = W * h
    # 残りは(H-h)*W

    # 残りを横に割る場合
    h2 = (H - h) // 2
    h3 = (H - h) - h2
    s2 = W * h2
    s3 = W * h3
    max_s = max(s1, s2, s3)
    min_s = min(s1, s2, s3)
    ans = min(ans, max_s - min_s)

    # 残りを縦に割る場合
    w2 = W // 2
    w3 = W - w2
    s2 = (H - h) * w2
    s3 = (H - h) * w3
    max_s = max(s1, s2, s3)
    min_s = min(s1, s2, s3)
    ans = min(ans, max_s - min_s)

# 1枚目をH*(1,2,...,W-1)とする
for w in range(1, W):
    s1 = w * H
    # 残りはH*(W-w)

    # 残りを横に割る場合
    h2 = H // 2
    h3 = H - h2
    s2 = (W - w) * h2
    s3 = (W - w) * h3
    max_s = max(s1, s2, s3)
    min_s = min(s1, s2, s3)
    ans = min(ans, max_s - min_s)

    # 残りを縦に割る場合
    w2 = (W - w) // 2
    w3 = (W - w) - w2
    s2 = H * w2
    s3 = H * w3
    max_s = max(s1, s2, s3)
    min_s = min(s1, s2, s3)
    ans = min(ans, max_s - min_s)

print(ans)

Measured memory_bytes: 9236
N, M,Q = map(int, input().split())
inf = []
for i in range(Q):
    a,b,c,d = map(int, input().split())
    inf.append([a,b,c,d])
"""深さ優先探索で数列を作る cren(r, progress,result) はrがループの回数、progressがそこまででできた数列
最後、resultに保存する　ラップ関数を定義して最後値を取り出す 再起的に呼び出す
for ループを再帰化する"""

def rap(n):#nこ長さの条件を満たす数列を作る
    result = []
    for i in range(1,M+1):
        progress = [i]
        cren(n-1,progress,result)
    return result

def cren(r,progress,result):
    if r == 0:
        result.append(progress)
        return
    a = progress[-1]
    for i in range(a,M+1):
        cren(r-1,progress+[i],result)
"""rapを呼び出すことで長さnの条件を満たす数列が帰ってくる　resultは記録用だからグローバル変数として
扱われるから成り立つ"""
ans = 0
ls = rap(N)
for item in ls:
    ani = 0
    for in1 in inf:
        a = in1[0]
        b = in1[1]
        if  (item[b-1] - item[a-1]) == in1[2]:
            ani += in1[3]
    ans = max(ans, ani)
print(ans)

Measured memory_bytes: 22960
n,x =(int(i) for i in input().split())
a = list(int(i) for i in input().split())
a = sorted(a)
ans = 0

if x > sum(a):
  ans = n-1
elif x == sum(a):
  ans = n
else:
  judge = 0 
  for i in a:
    judge += i
    if judge > x:
     break
    ans += 1
print(ans)

Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func palindromePhilia(s string) int {
	l := len(s)
	m := l >> 1
	var f, b string
	var c int

	if l%2 == 0 {
		// front
		for i := m - 1; i >= 0; i-- {
			f += string(s[i])
		}
		// back
		for i := m; i < l; i++ {
			b += string(s[i])
		}
	} else {
		// front
		for i := m; i >= 0; i-- {
			f += string(s[i])
		}
		// back
		for i := m; i < l; i++ {
			b += string(s[i])
		}
	}

	if f == b {
		return 0
	}

	for i, v := range f {
		if string(v) != string(b[i]) {
			c++
		}
	}
	return c
}

func main() {
	var s string
	fmt.Scan(&s)
	fmt.Println(palindromePhilia(s))
}


Measured memory_bytes: 512
N = int(input())
a_s = [int(x) for x in input().split()]

ans = 0
start = 0
color = None
for i, a in enumerate(a_s):
    if color is None:
        color = a
    else:
        if color != a:
            ans += (i - start) // 2
            color = a
            start = i
ans += (N - start) // 2

print(ans)


Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
string s;
bool mmyy, yymm;

int main() {
  INCANT;
  cin >> s;
  int a = (s[0]-'0')*10+s[1]-'0';
  if (a>0 && a<13) mmyy=true;
  a = (s[2]-'0')*10+s[3]-'0';
  if (a>0 && a<13) yymm=true;
  if  (mmyy && yymm) cout <<  "AMBIGUOUS";
  else if (mmyy) cout << "MMYY";
  else if (yymm) cout << "YYMM";
  else cout << "NA";
  cout << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void)
{
	int n;
	int i,j,k;
	int num;
	char ans[60];

	scanf("%d", &n);

	char a[n][30] = {0};
	char s[n][60] = {0};
	for (i = 0; i < n; i++)
	{
		scanf("%s", s[i]);
		for (j = 0; j < strlen(s[i]); j++)
			a[i][s[i][j] - 97]++;
	}

	for (i = 0; i < 30; i++)
	{
		num = a[0][i];
		for (j = 0; j < n; j++)
		{
			if (num > a[j][i])
				num = a[j][i];
		}
		for (k = 0; k < num; k++)
			printf("%c", i+97);
	}

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <math.h>
using namespace std;
int main(){

	int N, K;
	string S;
	cin >> N >> S >> K;
	string str[N];
	for(int i = 0; i < N; i++){
		str[i] = S.substr(i,1);
	}
	for(int j = 0; j < N; j++){
		if(str[j] != str[K-1]){
			str[j] = "*";
		}
	}
	for(int m = 0; m < N; m++){
		cout << str[m];
	}
	cout << endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void){
   char str1[3];
   scanf("%s", str1);
   int count = 0;
   for(int i = 0; i < 3; i++){
       for(int j = 0; j < 3; j++){
           if(str1[i] != str1[j]){
               count ++;
           } 
       }
   }
   if(count){
       printf("Yes\n");
   }
   else{
       printf("No\n");
   }
   return 0;
}

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


int main() {
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    for (int i=1 ;i<10000;i++){
       C=C-B;
     if(C<=0){
       cout << "Yes" << endl;
       break;
     }
      A=A-D;
        if(A<=0){
       cout << "No" << endl;
          break;
     }
    }
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
using namespace std;
#define INF 2<<29
int solve(int a, int b) {
	return a > b;
}
int main(void) {
	int m;
	int a[20];
	int b[50001];
	int n;
	cin >> n;
	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	for (int i = 0; i <= 50000; i++)b[i] = INF;
	b[0] = 0;
	for (int i = 0; i < m; i++) {
		for (int j = 0; j + a[i] <= n; j++) {
			b[j + a[i]] = min(b[j + a[i]], b[j] + 1);
		}
	}
	cout << b[n]<<endl;
}


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

using namespace std;;

int main(){
  int n,yakusuu,chal;
  scanf("%d", &n);

  chal=1;
  while(true){
    yakusuu=0;
    for(int i=1; i <= chal; i++){
      if(chal%i == 0) yakusuu++;
    }
    if(n==yakusuu) break;
    chal++;
  }
  printf("%d\n", chal);
  return 0;
}



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

int main()
{
  //int a,b,c; cin >> a >> b >> c;
  //int mx = max({a,b,c});
  int a[3]; cin >> a[0] >> a[1] >> a[2];
  sort(a, a+3);
  //0 11 00
  //1 00
  if(a[0]%2 == a[1]%2) cout << (a[2]*3 - (a[0]+a[1]+a[2]))/2 << endl;
  else cout << ((a[2]+1)*3 - (a[0]+a[1]+a[2]))/2 << endl;
//  if( a[2]%2 == (a[0]+a[1])%2 ) cout << (a[2]*3 - (a[0]+a[1]+a[2]))/2 << endl;
  return 0;
}

/*
Ctrl+@
g++ a.cpp
./a.out
*/


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


while True:
    if len(A) == N:
        break
    else:
        print("Input again!")
        A = [int(x) for x in input().split()]


def SelectionSort(A,N):
    count = 0
    for i in range(0,N,1):
        #print(i)
        minj = i
        for j in range(i+1,N,1):
            if A[j] < A[minj]:
                minj = j
        A[i],A[minj] = A[minj],A[i]
        #count += 1
        if i != minj:
            count += 1
    return A,count

A,count = SelectionSort(A,N)
print(" ".join(map(str,A)))
print(count)


Measured memory_bytes: 5604
N = int(input())
S = input()
lb, ub = -1, N//2 + 1
while ub - lb > 1:
    m = (lb + ub) // 2
    s1 = S[:m]
    s2 = S[m:2*m]
    ss = set()
    ok = False
    for i in range(2*m, N):
        ss.add(s1)
        if s2 in ss:
            ok = True
            break
        s1 = s1[1:] + s2[0]
        s2 = s2[1:] + S[i]
    ss.add(s1)
    if s2 in ss:
        ok = True
    if ok:
        lb = m
    else:
        ub = m
print(lb)


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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;

typedef long long ll;

int main(){

    int a,b,c;
    cin >> a >> b >> c;

    if(2.0 * sqrt((long double)a * b) < c - a - b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#define INFLL        1e18
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define DELNL        cin.ignore(numeric_limits<streamsize>::max(),'\n')
#define VV(T,h,w)    vector<vector<T>>(h,vector<T>(w))
#define VVI(T,h,w,i) vector<vector<T>>(h,vector<T>(w,i))
using namespace std;
using ll=long long;using ull=unsigned long long;
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}

class union_find{
private:
    vector<ll>par,sz,rank;
    ll cnt;
public:
    union_find  (ll n):par(n),sz(n,1),rank(n,0),cnt(n){iota(ALL(par),0);}
    ll   count  ()          {return cnt;}
    ll   find   (ll n)      {return par[n]==n?n:par[n]=find(par[n]);}
    ll   size   (ll n)      {return sz[find(n)];}
    bool is_same(ll x, ll y){return find(x)==find(y);}
    void unite  (ll x, ll y)
    {
        x=find(x);y=find(y);
        if (x!=y) {
            if (rank[x]<rank[y]){
                par[x]=y;
                sz[y]+=sz[x];
            }else{
                par[y]=x;
                sz[x]+=sz[y];
                if(rank[x]==rank[y])++rank[x];
            }
            --cnt;
        }
    }
};
int main()
{
    ll n=in();
    struct town{ll x,y,idx;};
    vector<town>t(n);
    REP(i,n){
        ll x=in(),y=in();
        t[i]=town{x,y,i};
    }

    struct edge{ll from,to,len;};
    vector<edge>e;
    auto dist=[](const town&t1,const town&t2){return min(abs(t1.x-t2.x),abs(t1.y-t2.y));};
    sort(ALL(t),[](const town&t1,const town&t2){return t1.x<t2.x;});
    REP(i,n-1)e.push_back(edge{t[i].idx,t[i+1].idx,dist(t[i],t[i+1])});
    sort(ALL(t),[](const town&t1,const town&t2){return t1.y<t2.y;});
    REP(i,n-1)e.push_back(edge{t[i].idx,t[i+1].idx,dist(t[i],t[i+1])});
    sort(ALL(e),[](const edge&e1,const edge&e2){return e1.len<e2.len;});

    ll ans=0;
    union_find uf(n);
    REPC(ei,e){
        if(!uf.is_same(ei.from,ei.to)){
            uf.unite(ei.from,ei.to);
            ans+=ei.len;
        }
    }
    cout<<ans<<endl;
}

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

const int MOD = (int)1e9+7;

int main(){
	int N;
	cin >> N;
	vector<double> x(N),y(N);
	for(int i=0;i<N;i++){
		cin >> x.at(i) >> y.at(i);
		x.at(i)+=1000;
		y.at(i)+=1000;
	}

	double ans=0;
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if(i==j)	continue;
			double aa=x.at(i)-x.at(j);
			aa=aa*aa;
			double bb=y.at(i)-y.at(j);
			bb=bb*bb;
			ans+=sqrt(aa+bb);
		}
	}
	ans/=N;
	printf("%.8lf\n",ans);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

int n, a[200001], b[200001];

int main() {
	cin >> n;
	inc1(i, n) { cin >> a[i]; }
	
	dec1(i, n) {
		int s = 0;
		for(int j = i; j <= n; j += i) { s += b[j]; }
		s %= 2;
		if(s != a[i]) { b[i] = 1; }
	}
	
	vector<int> ans;
	inc1(i, n) { if(b[i] == 1) { ans.PB(i); } }
	
	cout << SI(ans) << endl;
	inc(i, SI(ans)) { cout << (i == 0 ? "" : " ") << ans[i]; }
	cout << endl;
	
	return 0;
}


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

int main(){
	int N;
	cin>>N;
	
	int d[N];
	for(int i=0;i<N;i++)
		cin>>d[i];
	
	int num[110]={};
	for(int i=0;i<N;i++){
		num[d[i]]++;
	}
	//cout<<num[100]<<endl;
	int ans=0;
	for(int i=1;i<=100;i++){
		if(num[i]>=1){
			//cout<<i<<endl;
			ans++;
		}
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <cmath>

using namespace std;

typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> pl;
typedef double db;

#define in(x) cin >> x
#define ini(x) int x; cin >> x
#define inl(x) ll x; cin >> x
#define ins(x) string s; cin >> x

#define out(x) cout << x
#define outb(x) cout << x << ' '
#define outn(x) cout << x << '\n'

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz size()
#define len length()
#define all(x) x.begin(), x.end()
#define alln(a, n) a, a+n 

#define forn(i, s, e) for (int i = s; i < e; i++)
#define forr(i, s, e) for (int i = s; i >= e; i--)
#define ford(i, s, e, d) for (int i = s; i < e; i += d)
#define fors(i, n) for (int i = 1; i*i <= n; i++)

int arr[109], ca, cb, cc, cp, cq;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	
	ini(n);
	ini(a); ini(b);
	forn(i, 0, n) in(arr[i]);
	forn(i, 0, n) {
		if (arr[i] <= a) ca++;
		if (a+1 <= arr[i] && arr[i] <= b) cb++;
		if (b+1 <= arr[i]) cc++;
	}
	outn(min(ca, min(cb, cc)));
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int g = sc.nextInt();
		int b = sc.nextInt();
		if ((r * 100 + g * 10 + b) % 4 == 0) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		sc.close();
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#define MOD 1000000007
#define mkp make_pair
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin>>N;
  vector<int> W(N);
  for(int i=0;i<N;i++) cin>>W[i];

  ll sum=0;
  for(int i=0;i<N;i++) sum+=W[i];

  ll res=0;
  ll ans=MOD;
  for(int i=0;i<N;i++){
    res+=W[i];
    ans=min(ans,abs(res-(sum-res)));
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);
    String s = scan.nextLine();
    String p = scan.nextLine();

    String text = String.join("", s, s);

    for (int i = 0; i < text.length(); i++) {
      if(text.regionMatches(i, p, 0, p.length())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  }

}


Measured memory_bytes: 26292
n=int(input())
xy=[]
for _ in range(n):
	x,y=map(int,input().split())
	xy.append([x,y])
ans=0
for i in range(n):
	for j in range(n):
		ans+=((xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2)**0.5
print(ans/n)

Measured memory_bytes: 3064
#include <stdio.h>
#include <math.h>
#include <string.h>
#define N 1005
#define reg register
using namespace std;
typedef long long ll;
int n,S,T,sx,sy,tx,ty;
int x[N],y[N],r[N];
double d[N];char vis[N];
int ne=0,h[N];struct edge{int to,x;double w;}e[1010010];
inline double ss(reg int x) {
	return (double)x*x;
}
inline double dis(reg int x1,reg int y1,reg int x2,reg int y2) {
	return sqrt(ss(x1-x2)+ss(y1-y2));
}
inline void ins(reg int s,reg int t,reg double w) {
	e[++ne].to=t;e[ne].w=w;e[ne].x=h[s];h[s]=ne;
}
inline void dijkstra() {
	reg int i,u,v;reg double w,x;
	for(i=1;i<=n;++i) d[i]=1e99;
	d[S]=0;d[T]=1e99;
	while(true) {
		u=0;x=1e99;
		for(i=1;i<=n+2;++i) if(!vis[i]&&d[i]<x) u=i,x=d[i];
		if(!u) return;
		vis[u]=1;
		for(i=h[u];i;i=e[i].x) {
			v=e[i].to;w=x+e[i].w;
			if(w<d[v]) d[v]=w;
		}
	}
}
int main() {
	reg double t;reg int i,j;
	scanf("%d%d%d%d%d",&sx,&sy,&tx,&ty,&n);
	S=n+1;T=n+2;
	for(i=1;i<=n;++i) {
		scanf("%d%d%d",x+i,y+i,r+i);
		for(j=1;j<i;++j) {
			t=dis(x[i],y[i],x[j],y[j])-r[i]-r[j];
			if(t<0) t=0;
			ins(i,j,t);ins(j,i,t);
		}
	}
	for(i=1;i<=n;++i) {
		t=dis(sx,sy,x[i],y[i])-r[i];
		if(t<0) t=0;
		ins(S,i,t);
		t=dis(tx,ty,x[i],y[i])-r[i];
		if(t<0) t=0;
		ins(i,T,t);
	}
	ins(S,T,dis(sx,sy,tx,ty));
	dijkstra();
	printf("%.12lf",d[T]);
	return 0;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double ld;
typedef pair<int,int> P;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 10*60
#define EPS 1e-9

//----***入出力***---
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);cerr<<fixed<<setprecision(15);};}initial_;



signed main(){
  string S;cin>>S;
  char c=S.at(0);
  int ans=0;
  each(c_,S){
    if(c!=c_){
      ans++;
      c=c_;
    }
  }
  print(ans)

}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<iomanip>
#include<regex>

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

using namespace std;

int main()
{
    int a,b,x,y,sum=0;
    cin >> a >> b;
    rep(i,10000){
        if((int)(i*0.08) == a){
            if((int)(i*0.10) == b){
                cout << i;
              sum = 1;
                break;
            }
        }
    }
   if(!sum) cout << "-1" << endl;
    return 0;
}

Measured memory_bytes: 256
import collections
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a



c = collections.Counter(prime_factorize(int(input())))
ans=0
l=list(c.values())

for i in l:
    j=int(i)
    a=1
    while j>0:
        if j>=a:
            j-=a
            ans+=1
            a+=1
        else:
            break
#print(l)
print(ans)


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

bool isOk(ll N, ll M, ll V, ll P, vector<ll>& A, int x) {
    if (x < P)
        return true;

    ll maxP = A[x] + M;
    if (maxP < A[P - 1])
        return false;

    ll res = M * V;
    res -= (P - 1) * M;
    res -= (N - x) * M;
    for (int i = P - 1; i < x; i++) {
        res -= min(max(0ll, maxP - A[i]), M);
    }

    return res <= 0;
}

int main() {
    ll N, M, V, P;
    cin >> N >> M >> V >> P;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());

    int low = 0, high = N;
    while (high - low > 1) {
        int mid = (high + low) / 2;
        if (isOk(N, M, V, P, A, mid)) {
            low = mid;
        } else {
            high = mid;
        }
    }
    cout << low + 1 << endl;
}


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

int main() {
    int N, D;
    cin >> N >> D;
    int ans = (N + (2*D + 1) - 1)/(2*D + 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256