akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	long long n, k;
	cin >> n >> k;
	vector<long long>duck;
	vector<long long>fork;
	for (int i = 0; i < n; i++)
	{
		long long a;
		cin >> a;
		duck.push_back(a);
	}
	//long long score = 1;
	//int g = k;
	//for (int i = 0; g > 0; i++)
	//{
	//	score *= duck[i];
	//	g -= 1;
	//}
	//fork.push_back(score);
	//for (int i = 1; i + k <= n; i++)
	//{
	//	score = score / duck[i - 1] * duck[i + k - 1];
	//	fork.push_back(score);
	//}
 //
	//for (int i = 0; i+1< fork.size(); i++)
	//{
	//	//cout << fork[i] << " " << fork[i + 1];
	//	if (fork[i + 1] > fork[i])
	//		cout << "Yes"<<endl;
	//	else
	//		cout << "No"<<endl;
	//}


	for (int i = 0; i + k < n; i++)
	{
		if (duck[i] < duck[i + k])
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}

	return 0;
}



Measured memory_bytes: 5276
#include <iostream>

int main(){
    long long int n, m;
    std::cin >> n >> m;
    long long int sum = 0;
    for (int i = 1; i <= m; ++i)
    {
        int a;
        std::cin >> a;
        sum += a;
    }
    if (n >= sum)
    {
        std::cout << n - sum << std::endl;
    }
    else
    {
        std::cout << -1 << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <strings.h>
using namespace std;
int main()
{
int i,count=0;
string S;
cin>>S;
string T;
cin>>T;
for(i=0;i<3;i++)
{
if(S[i]==T[i])
{
count++;
}
}
cout<<count;
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int max,min,a,i,n;
	long long sum;
	max=10000000;
	min=-10000000;
	sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(max>a){
			max=a;
		}
		if(min<a){
			min=a;
		}
		sum+=a;
	}
	printf("%d %d %lld\n",max,min,sum);
	
	return 0;
}



Measured memory_bytes: 2768
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cout << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 28;
constexpr lint   INFL = 1LL << 60;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  rep (i, n) cin >> h[i];
  sort(all(h), greater<int>());
  int mini = INT_MAX;
  for (int i = 0; i <= n - k; ++i) mini = min(mini, h[i] - h[i + k - 1]);
  cout << mini << endl;
  return 0;
}

Measured memory_bytes: 640
#![allow(unused_imports)]pub mod pcl{pub mod stdin{use std::io::prelude::*;use std::io::stdin;use std::str::FromStr;pub fn read_line()->String{let mut s=String::new();stdin().read_line(&mut s).unwrap();s.trim().to_string()}pub fn read<T:FromStr>()->T{read_from(stdin())}pub fn read_token()->String{read_token_from(stdin())}pub fn read_ascii()->char{read_ascii_from(stdin())}pub fn read_from<R:Read,T:FromStr>(read:R)->T{read_token_from(read).parse().unwrap_or_else(|_|panic!("failed to parse a value"))}pub fn read_token_from<R:Read>(read:R)->String{read.bytes().flat_map(|x|x.map(|x|x as char)).skip_while(|x|x.is_whitespace()).take_while(|x|!x.is_whitespace()).collect()}pub fn read_ascii_from<R:Read>(read:R)->char{read.bytes().flat_map(|x|x.map(|x|x as char)).skip_while(|x|x.is_whitespace()).next().expect("failed to get a next character")}}}
use pcl::stdin::*;
fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut res = vec![0; n];
    for _ in 0..m {
        let s: usize = read();
        let mut c: u8 = read();
        c += b'0';
        if res[s - 1] != 0 && res[s - 1] != c {
            println!("-1");
            return;
        }
        res[s - 1] = c;
    }
    for i in 0..n {
        if res[i] == 0 {
            if n != 1 && i == 0 {
                res[i] = b'1';
            } else {
                res[i] = b'0';
            }
        }
    }
    if n != 1 && res[0] == b'0' {
        println!("-1");
        return;
    }
    println!("{}", unsafe { String::from_utf8_unchecked(res) });
}



Measured memory_bytes: 4352
import java.util.*;

public class Main {
    public static void main(String args[] ) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        int count = 0;
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        if (n >= 3) {
            Arrays.sort(arr);

            for (int i = 0; i < n - 2; i++) {
                for (int j = i+1; j < n - 1; j++) {
                    for (int k = j+1; k < n; k++) {
                        if (arr[i] + arr[j] > arr[k]) count++;
                        else break;
                    }
                }
            }
        }
        System.out.println(count);
    }
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos,dp[100002][4];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("ABC"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>s;
      dp[Size(s)][3]=1;
      rrrep(i,Size(s)-1,0){
        rrrep(j,3,0){
          if(j==3){
        if(s[i]=='?'){
        dp[i][3]=dp[i+1][3]*3;
        }
        else{
          dp[i][3]=dp[i+1][3];
        }
          }
          else{
            if(s[i]=='?'){
            dp[i][j]=dp[i+1][j]*3+dp[i+1][j+1];
            }
            else if(alph[j]==s[i]){
              dp[i][j]=dp[i+1][j]+dp[i+1][j+1];
            }
            else{
              dp[i][j]=dp[i+1][j];
            }
          }
          dp[i][j]%=MOD;
        }
      }
      Cout(dp[0][0]);
     

       
return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define mem(a, b) memset(a, b, sizeof(a))
#define inf (1e9 + 7)
#define eps 0.000001
typedef long long LL;
using namespace std;
const LL mod = (1e9 + 7);

LL a, b, c, d, n, ans = 0;

struct node
{
    LL v, w;
}nd[5];

bool cmp(const node & a, const node & b)
{
    return a.w * b.v > a.v * b.w;
}

int main()
{
    cin>>a>>b>>c>>d>>n;
    n *= 100;
    nd[0].v = a;
    nd[0].w = 25;
    nd[1].v = b;
    nd[1].w = 50;
    nd[2].v = c;
    nd[2].w = 100;
    nd[3].v = d;
    nd[3].w = 200;
    sort(nd, nd + 4, cmp);
    for(int i = 0;i < 4;i++)
    {
        if(nd[i].w <= n)
        {
            LL cnt = n / nd[i].w;
            ans += cnt * nd[i].v;
            n %= nd[i].w;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

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

    bool ans = false;
    for (int i = 1; i <= 9; ++i) {
        if (n%i == 0) {
            if (n/i <= 9) {
                ans = true;
            }
        }
    }
    if (ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
	return 0;
}

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

int main() {
    int h,w;
	scanf("%d%d",&h,&w);
	char grid[h+5][w+5];
	for(int i=0;i<h;i++)scanf("%s",grid[i]);
	int dp[h][w];
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(i==0&&j==0)continue;
			if(grid[i][j]=='#')continue;
			if(i==0){
				dp[i][j]=dp[i][j-1];
			}else if(j==0){
				dp[i][j]=dp[i-1][j];
			}else{
				dp[i][j]=dp[i-1][j]+dp[i][j-1];
			}
			dp[i][j]%=1000000007;
		}
	}
	printf("%d",dp[h-1][w-1]);
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
 
using namespace std;
 
long long h, n, a[1000005], ans, k;
 
int main () {
  cin >> n >> k;
  for(int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  reverse(a + 1, a + n + 1);
  for(int i = 1 + k; i <= n; i++) {
    ans+=a[i];
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 1792
import sys

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


def main():
    N, D, X, *A = map(int, read().split())

    ans = X
    for a in A:
        ans += (D + a - 1) // a

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9188
e,y = map(int,input().split(" "))

if e == 0:
  if y < 1912:
    print("M",y-1867,sep='')
  elif y < 1926:
    print("T",y-1911,sep='')
  elif y < 1989:
    print("S",y-1925,sep='')
  else:
    print("H",y-1988,sep='')
elif e == 1:
  print(y+1867)
elif e == 2:
  print(y+1911)
elif e == 3:
  print(y+1925)
elif e == 4:
  print(y+1988)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x; 
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x; 
        return true;
    }
    return false;
}
template<typename Val>
bool bitcheck(Val bit, size_t idx) {
    return bit & (1 << idx);
}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr); ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH) cout << unitbuf;
    }
} PROCON_INIT;

void solve() {
    char c; cin >> c;
    
    if (c >= 'A' && c <= 'Z') cout << 'A' << endl;
    else cout << 'a' << endl;
}

signed main() {
    solve();
    return 0;
}

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

ll gcd(ll a, ll b){
	return b ? gcd(b, a%b) : a;
}

ll lcm(ll a, ll b){
	return a*b/gcd(a, b);
}

ll f(ll a, ll b, ll c){
	ll ans = a;
	ans -= a/b;
	ans -= a/c;
	ans += a/lcm(b, c);
	
	return ans;
}

int main(){
	ll a, b;
	int c, d;
	cin >> a >> b >> c >> d;

	ll ans = f(b, c, d) - f(a-1, c, d);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)


void solve(long long n, long long m){
    cout << (n-1) * (m-1 ) << endl;
}

int main(){

    long long n;
    scanf("%lld",&n);
    long long m;
    scanf("%lld",&m);
    solve(n, m);
    return 0;
}



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

int main(){
  int n, m, a, b;
  cin >> n >> m;
  vector<vector<bool>> vn(n, vector<bool>(n,false));
  for(int i=0; i<m; ++i){
    cin >> a >> b;
    --a; --b;
    vn[a][b] = true;
    vn[b][a] = true;
  }
  vector<vector<int>> dp(n, vector<int>((1<<n),0));
  dp[0][1] = 1;
  for(int i=1; i<(1<<n); ++i) for(int j=0; j<n; ++j){
    if(i >> j &1){
      for(int k=0; k<n; ++k){
        if(!vn[j][k]) continue;
        if((i >> k &1) == 0) continue;
        dp[j][i] += dp[k][i -(1 << j)];
      }
    }
  }
  int ans = 0;
  for(int i=1; i<n; ++i){
    ans += dp[i][(1<<n)-1];
  }
  cout << ans << endl;
}

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

struct Point2 { 
    double x, y; 

    Point2() { x = 0; y = 0; }

    Point2(double x_, double y_) {
        x = x_; y = y_;
    }

    Point2 operator + (const Point2& rhs) const {
        return Point2(x + rhs.x, y + rhs.y);
    }

    Point2 operator - (const Point2& rhs) const {
        return Point2(x - rhs.x, y - rhs.y);
    }

    Point2 operator / (const double rhs) const {
        return Point2(x / rhs, y / rhs);
    }
};

struct Matrix2 {
    double a00, a01, a10, a11;

    Matrix2(double a00_, double a10_, double a01_, double a11_) {
        a00 = a00_; a01 = a01_;
        a10 = a10_; a11 = a11_;
    }

    Point2 operator * (const Point2& rhs) const {
        return Point2(a00 * rhs.x + a01 * rhs.y, a10 * rhs.x + a11 * rhs.y);
    }
};

Matrix2 Rotation(double theta) {
    return Matrix2(cos(theta), sin(theta), -sin(theta), cos(theta));
}

Point2 operator * (const double lhs, const Point2& rhs) {
    return Point2(lhs * rhs.x, lhs * rhs.y);
}

void koch(int depth, Point2 from, Point2 to) {
    if (depth == 0) return;

    Point2 s, t, u;
    double theta = M_PI * 60.0 / 180.0;

    s = (2 * from + to) / 3.0;
    t = (from + 2 * to) / 3.0;
    u = Rotation(theta) * (t - s) + s;

    koch(depth - 1, from, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(depth - 1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(depth - 1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(depth - 1, t, to);
}

int main() {
    Point2 from = Point2(0, 0);
    Point2 to = Point2(100, 0);
    int depth;

    scanf("%d", &depth);
    printf("%.8f %.8f\n", from.x, from.y);
    koch(depth, from, to);
    printf("%.8f %.8f\n", to.x, to.y);

    return 0;
}



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

using namespace std;

int main()
{
    string s;
    cin >> s;
    int resultado = 0;
    for(int i = 0; i < s.size(); i++)
        resultado = (resultado + s[i] - '0')%9;

    cout << (resultado == 0 ? "Yes" : "No");
    return 0;
}



Measured memory_bytes: 3716
#include<bits/stdc++.h> 
#include<stdio.h>
using namespace std; 
int main(){

	long long int peri,sum=0;
	int n,t=0;
	cin >> peri >> n;
	int arr[n],b[n];
	b[0]=0;
	for(int i=0; i< n;i++){
		cin >> arr[i];
		if(i!=0){
		b[i]=arr[i]-arr[i-1];
		t = max(t,b[i]);
	}
	}	
	b[0]=peri - arr[n-1]+ arr[0]; 
	t = max(b[0],t);
	for(int j=0;j<n;j++){
		sum = sum + b[j];
	}
	cout << (sum-t);
	
}

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

int n, q;
vector<int> s, t, x, d, v;
map<int, int> mp;
typedef pair<int, int> P;
typedef pair<int, P> PP;
vector<PP> w;
constexpr int INF = INT_MAX;
struct LazySegmentTree {
private:
    int n;
    vector<int> node, lazy;
    vector<bool> lazyFlag;
 
public:
    LazySegmentTree(vector<int> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1, INF);
        lazyFlag.resize(2*n-1, false);
 
        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
 
    void lazyEvaluate(int k, int l, int r) {
        if(lazyFlag[k]) {
            node[k] = lazy[k];
            if(r - l > 1) {
                lazy[k*2+1] = lazy[k*2+2] = lazy[k];
                lazyFlag[k*2+1] = lazyFlag[k*2+2] = true;
            }
            lazyFlag[k] = false;
        }
    }
 
    void update(int a, int b, int x, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        lazyEvaluate(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] = x;
            lazyFlag[k] = true;
            lazyEvaluate(k, l, r);
        }
        else {
            update(a, b, x, 2*k+1, l, (l+r)/2);
            update(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = min(node[2*k+1], node[2*k+2]);
        }
    }
 
    int find(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        lazyEvaluate(k, l, r);
        if(b <= l || r <= a) return INF;
        if(a <= l && r <= b) return node[k];
        int vl = find(a, b, 2*k+1, l, (l+r)/2);
        int vr = find(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
    }
};
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n >> q;
	s.resize(n); t.resize(n); x.resize(n); d.resize(q);
	for(int i=0; i<n; ++i){
		cin >> s[i] >> t[i] >> x[i];
		v.push_back(s[i] - x[i]);
		v.push_back(t[i] - x[i]);
	}
	for(int i=0; i<q; ++i){
		cin >> d[i];
		v.push_back(d[i]);
	}
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	for(int i=0; i<v.size(); ++i) mp[v[i]] = i;
	for(int i=0; i<n; ++i){
		s[i] = mp[s[i]-x[i]];
		t[i] = mp[t[i]-x[i]];
		w.push_back(PP(x[i], P(s[i], t[i])));
	}
	sort(w.begin(), w.end());
	LazySegmentTree seg(vector<int>(v.size(), INF));
	for(int i=n-1; i>=0; --i) seg.update(w[i].second.first, w[i].second.second, w[i].first);
	for(int i=0; i<q; ++i){
		int r = seg.find(mp[d[i]], mp[d[i]]+1);
		if(r == INF) cout << -1 << "\n";
		else cout << r << "\n";
	}
}

Measured memory_bytes: 57068
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    sort(all(a));
    vector<ll> isd(a[n-1]+1,0);
    rep(i,n){
        if(isd[a[i]]>=1) isd[a[i]]++;
        else{
            for(ll j=1;a[i]*j<=a[n-1];j++) isd[a[i]*j]++;
        }
    }
    ll ans=0;
    rep(i,n){
        if(isd[a[i]]==1) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

typedef long long int ll;
ll powk(ll a, ll n = 2){
    ll r = 1;
    for(ll i = 0;i < n;i++){
        r *= a;
    }

    return r;
}

int main()
{
    ll n;
    cin >> n;
    vector<pair<double,double>> xy(n);
    for(ll i = 0;i < n;i++){
        cin >> xy[i].first >> xy[i].second;
    }
    sort(xy.begin(), xy.end());
    
    double ans = 0, cnt = 0;
    do{
        double t = 0;
        for(ll i = 0;i < n - 1;i++){
            double s = 0;
            s += pow(xy[i].first- xy[i + 1].first, 2);
            s += pow(xy[i].second - xy[i + 1].second, 2);
            t += sqrt(s);
        }
        cnt++;
        ans += t;
    } while(next_permutation(xy.begin(), xy.end()));

    cout << setprecision(15) << ans / cnt;

    return 0;
}

Measured memory_bytes: 256
Public Class Program
  Shared Sub Main()
    Dim abk As Long() = Cin.LngArr()
    Dim a As Long = abk(0)
    Dim b As Long = abk(1)
    Dim k As Long = abk(2)
    Dim ak As Long = a - k
    If ak < 0 Then 
      a = 0
      b += ak
      If b < 0 Then b = 0
    Else
      a = ak
    End If 
    Console.WriteLine(a.ToString() & " " & b.ToString())
  End Sub
End Class

Public Class Cin
  Public Shared Function Str() As String
    Return Console.ReadLine().Trim()
  End Function
  Public Shared Function Int() As Integer
    Return Integer.Parse(Str())
  End Function
  Public Shared Function Lng() As Long
    Return Long.Parse(Str())
  End Function
  Public Shared Function Dbl() As Double
    Return Double.Parse(Str())
  End Function
  Public Shared Function StrArr(Optional separator As String = " ") As String()
    Return Str().Split(separator)
  End Function
  Public Shared Function IntArr(Optional separator As String = " ") As Integer()
    Return Array.ConvertAll(Of String, Integer)(StrArr(separator), AddressOf Integer.Parse)
  End Function
  Public Shared Function LngArr(Optional separator As String = " ") As Long()
    Return Array.ConvertAll(Of String, Long)(StrArr(separator), AddressOf Long.Parse)
  End Function
  Public Shared Function DblArr(Optional separator As String = " ") As Double()
    Return Array.ConvertAll(Of String, Double)(StrArr(separator), AddressOf Double.Parse)
  End Function
End Class

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n, m;
    cin >> n >> m;
    vector<int> s(m), c(m);
    for(int i = 0; i < m; ++i){
        cin >> s[i] >> c[i];
        --s[i];
    }

    vector<int> res(n, -1);
    for(int i = 0; i < m; ++i){
        int id = s[i];
        if(res[id] == -1){
            res[id] = c[i];
        }
        else{
            if(res[id] != c[i]){
                cout << -1 << endl;
                return 0;
            }
        }
    }
    if(n > 1){
        if(res[0] == 0){
            cout << -1 << endl;
            return 0;
        }
        if(res[0] == -1){
            res[0] = 1;
        }
    }
    for(int i = 0; i < n; ++i){
        if(res[i] == -1)    res[i] = 0;
    }
    for(int i = 0; i < n; ++i)  cout << res[i];
    cout << endl;
}

Measured memory_bytes: 256
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int N,K,A[200001];
	scan(K>>N);
	int dismax=0;
	rep(i,N) scan(A[i]);
	rep(i,N-1){
		dismax=max(dismax,abs(A[i]-A[i+1]));
	}
	dismax=max(dismax,K-A[N-1]+A[0]);
	prin(K-dismax);
	return 0;
}


Measured memory_bytes: 4384
//header{{{
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#include <boost/graph/adjacency_list.hpp>
//#include <boost/graph/dijkstra_shortest_paths.hpp>
//#include <boost/graph/graph_utility.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <boost/version.hpp>
  
using namespace std;
//using namespace boost::multiprecision;
//using namespace boost::math;

/*
typedef boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS,
        boost::no_property, boost::property<boost::edge_weight_t, int> > Graph;
*/


#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int_fast64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};
//}}}

signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout.setf(ios_base::fixed);
    cout.precision(10);

    int n, d;
    cin >> n >> d;

    vector<int> x(n), y(n);

    rep(i,n){
        cin >> x[i] >> y[i];
    }

    int cnt = 0;

    rep(i,n){
        if(square(x[i]) + square(y[i]) <= square(d)){
            ++cnt;
        }
    }

    cout << cnt << '\n';

    return 0;
}


Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair<int, int>
#define vi vector<int>
#define pb emplace_back
#define sz(x) (int)x.size()
#define all(v) v.begin(), v.end()
#define x first
#define y second
#define rep(i, j, k) for(i=j; i<k; i++)
#define sep(i, j, k) for(i=j; i>k; i--)
const int N = 2e5+5, inf = 1e9+7;
int n, k, i, j;
int h[N], dp[N];

bool Q;
struct Line {
    mutable int k, m, p;
    bool operator<(const Line& o) const {
        return Q ? p < o.p : k < o.k;
    }
};
struct LineContainer : multiset<Line> {
    const int inf = LLONG_MAX;
    int div(int a, int b){
        return a / b - ((a ^ b) < 0 && a % b);
    }
    bool isect(iterator x, iterator y) {
        if (y == end()) { x->p = inf; return false; }
        if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
        else x->p = div(y->m - x->m, x->k - y->k);
        return x->p >= y->p;
    }
    void add(int k, int m) {
        auto z = insert({k, m, 0}), y = z++, x = y;
        while (isect(y, z)) z = erase(z);
        if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
        while ((y = x) != begin() && (--x)->p >= y->p)
            isect(x, erase(y));
    }
    int query(int x) {
        assert(!empty());
        Q = 1; auto l = *lower_bound({0,0,x}); Q = 0;
        return l.k * x + l.m;
    }
};

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int i, j, a, b, ans = 0;
    cin>>n>>k;
    rep(i, 1, n+1) cin>>h[i];
    LineContainer cur;
    cur.add(2*h[n], -h[n]*h[n]-k);
    sep(i, n-1, 0){
        dp[i] = -cur.query(h[i]) + h[i]*h[i];
        cur.add(2*h[i], -dp[i]-h[i]*h[i]-k);
    }
    cout<<dp[1];
}

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

int main() {
    int n;
    cin>>n;
    vector<int> d(n,0);
    rep(i,n)cin >> d[i];
    sort(d.begin(),d.end());
    int ans = 0;
    cout << d[n/2] - d[n/2-1];
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 640
N = int(input())
S = list(input())

#print(S)

W_people = [0]
W_psn = 0
for i in range(N-1):
    if S[i] == 'W':
        W_psn += 1
    W_people.append(W_psn)

E_people = [0]
E_psn = 0
S.reverse()
for i in range(N-1):
    if S[i] == 'E':
        E_psn += 1
    E_people.append(E_psn)
S.reverse()
E_people.reverse()

#print(E_people)
#print(W_people)

_min = N
for i in range(N):
    _min = min(E_people[i] + W_people[i], _min)
    
print(_min)
        

Measured memory_bytes: 20216
#include <iostream>
#include <cmath>
using namespace std;
int main(){
  long long N,ans=0;
  cin >> N;
  ans = N-1;
  for(long long i=2;i<=sqrt(N);i++){
    if(N%i==0){
      ans=min(N/i-1+i-1,ans);
    }
  }
  cout << ans << endl;
  return 0;
}

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

typedef long long ll;

const int N = 300010;
const ll inf = 1e16;

ll f[N];
int n, m;
struct tree { int l, r; ll mx, tag; } t[N << 2];
struct line { int l, r; ll v; } a[N];

#define lc (rt << 1)
#define rc (rt << 1 | 1)
void build(int l, int r, int rt) {
    t[rt].l = l; t[rt].r = r;
    if(l == r) return; int mid = (l + r) >> 1;
    build(l, mid, lc); build(mid + 1, r, rc);
}
void up(int rt) { t[rt].mx = max(t[lc].mx, t[rc].mx); }
#define l (t[rt].l)
#define r (t[rt].r)
#define mid ((l + r) >> 1)
void down(int rt) {
    if(t[rt].tag) {
        t[lc].mx += t[rt].tag; t[rc].mx += t[rt].tag;
        t[lc].tag += t[rt].tag; t[rc].tag += t[rt].tag;
        t[rt].tag = 0;
    }
}
void upd(int L, int R, ll c, int rt) {
    if(L <= l && r <= R) {
        t[rt].mx += c; t[rt].tag += c;
        return;
    }
    down(rt);
    if(L <= mid) upd(L, R, c, lc);
    if(R > mid) upd(L, R, c, rc);
    up(rt);
}
ll query(int L, int R, int rt) {
    if(L <= l && r <= R) return t[rt].mx;
    down(rt); ll ans = -inf;
    if(L <= mid) ans = max(ans, query(L, R, lc));
    if(R > mid) ans = max(ans, query(L, R, rc));
    return ans;
}
#undef l
#undef r
#undef mid
#undef lc
#undef rc

bool operator < (line a, line b) { return a.r < b.r; }

int main() {
    scanf("%d%d", &n, &m);
    build(1, n, 1);
    for(int i = 1; i <= m; ++i) {
        scanf("%d%d%lld", &a[i].l, &a[i].r, &a[i].v);
    }
    sort(a + 1, a + m + 1);
    int r = 1;
    for(int i = 1; i <= n; ++i) { 
        upd(i, i, query(1, i, 1), 1);
        while(a[r].r == i) {
            upd(a[r].l, a[r].r, a[r].v, 1);
            ++r;
        }
    }
    printf("%lld\n", max(0LL, query(1, n, 1)));
}

Measured memory_bytes: 20736
#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 INF 1e9
#define ALL(v) v.begin(), v.end()
#define downque(que)  priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;

int main(){
  int n,m; cin>>n>>m;
  vector<pair<int,int>> pa(n);
  REP(i,n){
    cin>>pa[i].first>>pa[i].second;
  }
  sort(ALL(pa));
  ll cost=0;
  int i=0;
  int j=0;
   while(j<m){
     
     if(pa[i].second>0){
     cost+=pa[i].first;
     pa[i].second--;
     j++;
     }else i++;

   }
   cout<<cost<<endl;
}



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

int main() {
    vector<int> a = {1, 5, 10, 50, 100, 500};
    int tot = 0;
    for(int i = 0; i < 6; ++i) {
        int c; cin >> c;
        tot += c * a[i];
    }
    cout << (tot >= 1000) << endl;
}



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

using namespace std;
using ll=long long;
using ull=unsigned long long;

typedef pair<int,int>Pi;
typedef pair<long long,long long>P;
typedef pair<long long,P>PP;
typedef pair<P,P>PPP;

const long long MOD=1e9+7;
const long long INF=5e18;
const int di[4]={1,0,-1,0};
const int dj[4]={0,1,0,-1};

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()


ll h,w,a,ans;

void input(){
	cin>>h>>w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>a;
			ans+=a*(i+1)*(j+1)*(h-i)*(w-j);
		}
	}
	return;
}

void solve(){
	cout<<ans<<endl;
	return;
}

int main(){
	input();
	solve();
	return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1,0};
const int dy[]={0,1,0,-1,1,1,-1,-1,0};
const int INF = 1e9;
const long long LINF = 1e18;
const double EPS = 1e-8;
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(ll i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> Pii;
typedef pair<Pii,int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
template<class T>
ostream& operator<<(ostream &out, const vector<T> &v){
	out << "{";
	rep(i,v.size()){
		out << v[i] <<", ";
	}
	return out << "}" << endl;
}
int main() {
    int n;
    cin >> n;
    vll a(n);
    vll b;
    rep(i,n){
       cin >> a[i];
       b.pb(a[i]-i-1);
    }

    sort(all(b));
    ll ret = 0;
    if(b.size() % 2 == 1){
        ret = b[b.size()/2];
    }
    else{
        ret = (b[b.size()/2-1] + b[b.size()/2])/2;
    }
    ll ans = 0;
    rep(i,n){
        ans += abs(a[i]-ret-i-1);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3956
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)


























int main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> imos(n + 10);
    REP(i, m){
        ll l, r;
        cin >> l >> r;
        imos[l]++;
        imos[r + 1]--;
    }
    REP(i, n + 5){
        imos[i + 1] += imos[i];
    }
    ll ans = 0;
    for(ll i = 1; i <= n; i++){
        if(imos[i] >= m) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <queue>
#include <stack>
#define sf(n) scanf("%d",&n);
#define sfl(n) scanf("%lld",&n);
#define pf(n) printf("%d",n);
#define pfl(n) printf("%lld",n);
#define pr printf("\n");
#define LL long long
using namespace std;

int num[55];
int main(){
    int N,K;
    scanf("%d%d",&N,&K);
    for(int i=0;i<N;i++){
        scanf("%d",&num[i]);
    }
    sort(num,num+N,greater<int>());
    int ans=0;
    for(int i=0;i<K;i++){
        ans+=num[i];
    }
    printf("%d\n",ans);
    return 0;
}
/*
10
7 7
CEOKERE
ACMICPC
PKPIZKC
*/


Measured memory_bytes: 256
const main = (input) => {
  input = input.split(' ');
  const a = parseInt(input[0], 10);
  const b = parseInt(input[1], 10);
  const c = parseInt(input[2], 10);
  
  if (a+b===c || a+c===b || b+c===a) {
    console.log('Yes');
  }else{
    console.log('No');
  }
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = null;
		try{
			scan = new Scanner(System.in);
			while(true){
				int h,w;
				h = scan.nextInt();
				w = scan.nextInt();
				if(h == 0 && w == 0)break;
				for(int i = 1 ;i <= h;i++){
					for(int j = 1 ; j <= w;j++){
						if(i == 1 || i == h || j == 1 || j == w)
							System.out.printf("#");
						else
							System.out.printf(".");
					}
					System.out.println();
				}
				System.out.println();
			}
		}finally{
			if(scan != null)scan.close();
		}
	}
}

Measured memory_bytes: 42380
#include<stdio.h>
int main(void)
{
	int i,j,k,cards[4][13];
	char z;
	for (i = 0; i < 4; i++)
	{
		for (j = 0; j < 13; j++)
		{
			cards[i][j] = 0;
		}
	}
	scanf("%d",&k);
	for(i=0;i < k;i++)
	{
		scanf("%c", &z);
		scanf("%c %d", &z,&j);

		if(z == 'S')
		{
			cards[0][j - 1] = 1;
		}
		if(z == 'H')
		{
			cards[1][j - 1] = 1;
		}
		if(z == 'C')
		{
			cards[2][j - 1] = 1;
		}
		if(z == 'D')
		{
			cards[3][j - 1] = 1;
		}
	}

	for(i=0;i<13;i++)
	{
		if(cards[0][i] == 0)
		{
			printf("S %d\n",i+1);
		}
	}
	for(i=0;i<13;i++)
	{
		if(cards[1][i] == 0)
		{
			printf("H %d\n",i+1);
		}
	}
	for(i=0;i<13;i++)
	{
		if(cards[2][i] == 0)
		{
			printf("C %d\n",i+1);
		}
	}
	for(i=0;i<13;i++)
	{
		if(cards[3][i] == 0)
		{
			printf("D %d\n",i+1);
		}
	}
	return 0;
}


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

int main(){
  int *data, num, cnt=0, i, j, min;

  //input data
  scanf("%d",&num);
  data=(int *)malloc(num*sizeof(int));
  for(i=0;i<num;i++) scanf("%d",&data[i]);

  
  //selection sort
  for(i=0;i<num;i++){
    min=i;

    for(j=i;j<num;j++) //search minimum data
      if(data[j]<data[min]) min=j;
	

    if(min!=i){
      //data[i]<->data[min]
      j=data[i];
      data[i]=data[min];
      data[min]=j;
      
      cnt++;//minimum value change count
    }
    
  }

  //output result
  for(i=0;i<num-1;i++) printf("%d ",data[i]);
  printf("%d\n%d\n",data[i],cnt);

  free(data);
  return 0;
}



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

int main()
{
	int n, x, sol = 0;;
	cin >> n; int m = n + 1;
	for (int i = 0; i < n; ++i) {
		cin >> x;
		if (x <= m) sol++, m = x;
	}
	cout << sol;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int p=0,q=1;
  while(q*2-1<=n) q*=2,p++;
  vector<int> ans;
  for(int i=0;i<p;i++) ans.push_back(i+1);
  q=n-(q-1);
  int x=1;
  for(int i=p-1;i>=0;i--){
    if((q>>i)&1){
      ans.insert(ans.begin()+i,p+x);
      x++;
    }
  }
  q=ans.size();
  for(int i=0;i<q;i++) ans.push_back(i+1);
  cout<<ans.size()<<endl;
  for(int i=0;i<(int)ans.size();i++)
    cout<<ans[i]<<" \n"[i==(int)ans.size()-1];
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		try {
			int correctNum = scanner.nextInt();
			int correctYen = scanner.nextInt();

			for (int x = 0; x <= correctNum; x++) {
				for (int y = 0; y <= correctNum - x; y++) {
					int z = correctNum - (x + y);
					int sumYen = 10000 * x + 5000 * y + 1000 * z;
					if (sumYen == correctYen) {
							System.out.print(String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z));
							return;
					}
				}
			}
			System.out.print("-1 -1 -1");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			scanner.close();
		}
	}
}


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

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())


int main()
{
	int n,i,j,k;
	cin>>n;
    cin>>k;
    int*H=new int[n+1];

    for(i=1;i<=n;++i)
        cin>>H[i];
    	
    long long int*dp=new long long int[n+1];
    
    dp[1]=0;dp[2]=dp[1]+abs(H[2]-H[1]);
    
    for(i=3;i<=n;++i)
    {
        dp[i]=INT_MAX;
    }

    for(i=3;i<=n;++i)
    {
    	for(j=((i-k>=1)?i-k:1);j<=i-1;++j)
        {
            dp[i]=min(dp[j]+abs(H[j]-H[i]),dp[i]);
        }
    }
    cout<<dp[n]<<endl;
}

Measured memory_bytes: 1408
#include<iostream>
#include<sstream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;
typedef long long ll;

int main(){

	char a;
	cin>>a;
	//cout<<a - 'A'<<endl;
	if(a - 'A' <= 25){
		cout<<"A"<<endl;
	}else{
		cout<<"a"<<endl;
	}

	return 0;
}


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

int main() {
    long long A, B, K;
    cin >> A >> B >> K;
    if (A >= K) {
        A = A - K;
        cout << A << " " << B << endl;
    } else if (A + B >= K) {
        B = A + B - K;
        A = 0;
        cout << A << " " << B << endl;
    } else {
        cout << "0 0" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
# Problem https://atcoder.jp/contests/abc064/tasks/abc064_a
# Ruby 2nd Try

yes = "YES"
no = "NO"
a,b,c = gets.chomp('\n').split(' ').map(&:to_i)
rgbmod = (b*10+c) % 4
if rgbmod == 0
    puts(yes)
else
    puts(no)    
end

Measured memory_bytes: 1788
module Main where

import Debug.Trace
import Data.List
import qualified Data.Sequence as S
import qualified Data.ByteString.Char8 as B
import Data.Int
import Data.Char
import Data.Array
import Data.Maybe
import qualified Data.Map as M
import Data.Ord
import Data.Functor
import Control.Applicative
import Control.Monad
import Text.Printf

solve :: Int -> [[Int]] -> [(Int, Int, Int, String, [Int])]
solve n l = sort (iter 0 (-1) root) where
    iter depth parent node = info:(concatMap (iter (depth+1) node) (children!node)) where
        info :: (Int, Int, Int, String, [Int])
        info = (node, parent, depth,
                case node of
                 _  | node == root      -> "root"
                    | null (children!node)  -> "leaf"
                    | otherwise         -> "internal node",
                    children!node)

    root = iter 0 where
        iter x 
            | tree!x == -1 = x
            | otherwise = iter (tree!x)

    (tree, children) = iter [] [] (sort l) where
        iter ac cc [] = ((listArray (0, n-1) (replicate n (-1))) // ac,
                         (listArray (0, n-1) (replicate n [])) // cc)
        iter ac cc ((x:0:ls):ns) = iter ac cc ns 
        iter ac cc ((x:y:ls):ns) = iter ([(i, x) | i <- ls]++ac) ((x, ls):cc) ns 

readIntLn:: IO Int
readIntLn = (fst . fromJust . B.readInt) <$> B.getLine

readIntList:: IO [Int]
readIntList = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

print' (n, p, d, t, l) = do 
    putStr $ "node "++show n++": parent = "++show p++", depth = "++show d++", "++t++", "
    printInts l

printInts l = do
    putStr "["
    iter l where
        iter [] = putStrLn "]"
        iter [x] = putStrLn $ show x++"]"
        iter (x:xs) = do
            putStr $ show x++", "
            iter xs 

main :: IO() 
main = do
    n <- readIntLn
    l <- replicateM n readIntList
    mapM_ print' $ solve n l 



Measured memory_bytes: 67540
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

int n, k, c, t;
int main(void){
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i){
    scanf("%d", &t);
    if (t >= k) ++c;
  }
  printf("%d", c);
  return 0*printf("\n");
}


Measured memory_bytes: 128
n,t=map(int, input().split())
x=[]
y=[]
m=[]
for i in range(n):
    a,b=map(int, input().split())
    x.append(a)
    y.append(b)
    m.append([a,b])
x.sort()
y.sort()
ans=float('inf')
for i in range(n-1):
    for j in range(i,n):
        if i>=j:continue
        for k in range(n-1):
            for l in range(k,n):
                if k>=l:continue
                count=0
                for a,b in m:
                    if x[i]<=a<=x[j] and y[k]<=b<=y[l]:
                        count+=1
                if count>=t:
                    ans=min(ans,(x[j]-x[i])*(y[l]-y[k]))
print(ans)
    


Measured memory_bytes: 74492
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

//1の連続、1つの0の繰り返しになる
// eg. 111011010111111
// 0と隣接する部分は1つ消費される
// 111011010111111 -> 110000000011111
// 各0が左/右を選ぶ　(耳DP?) dp[i][j]:= i個目で左/右/パス
// 111011010111111

ll INF = 10000000000;
ll f(string s){
  // 各0に対して左、右の1の個数をメモ
  vvl dat;
  ll m = s.size();
  ll o = 0;
  for(int i=0;i<m;i++){
    if(s[i]=='1') o++;
    if(s[i]=='0'||i==m-1){
      if(dat.size()!=0) dat[dat.size()-1][1] = o;
      if(o!=0&&s[i]=='0') dat.push_back(vll{o, 0});
      o = 0;
    }
  }

  ll n = dat.size();
  if(n==0) return 0;
  if(dat[n-1][1]==0) n--;
  if(n==0) return 0;
  //for(int i=0;i<n;i++) std::cout << dat[i][0] << " " << dat[i][1] << '\n';
  vvl dp = VV(n+1, 4, -INF, ll);


  //直前のものがパスなら余っている :0
  //左なら一個消費されている :1
  //強い右なら全て消費されている :2
  //弱い右なら一つ残して全て消費されている
  dp[0][0] = 0;
  for(int i=1;i<=n;i++){
    vll now = dat[i-1];
    //今0
    dp[i][0] = max({dp[i-1][0], dp[i-1][1], dp[i-1][2], dp[i-1][3]});
    //今1
    dp[i][1] = max({dp[i-1][0]+now[0],
        dp[i-1][1]+now[0]-1,dp[i-1][2]+1});

    if(now[0]==1){
      dp[i][2] = dp[i-1][0]+now[1]-1;
      dp[i][3] = dp[i-1][0]+now[1];
    }else{
      dp[i][2] = max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}) + now[1] - 1;
      dp[i][3] = max({dp[i-1][0], dp[i-1][1], dp[i-1][2]}) + now[1];
    }
  }
  return max({dp[n][0], dp[n][1], dp[n][2], dp[n][3]});
}
int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  string s;std::cin >> s;
  ll ans = 0;
  string now = "";

  for(int i=0;i<n;i++){
    //初めの0は無視する
    if(now.size()==0&&s[i]=='0') continue;
    now += s[i];
    if((i==n-1)||(now.size()>1&&now[now.size()-1]=='0'&&now[now.size()-2]=='0')){
      ans += f(now);
      now = "";
    }
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1912
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A;
  string B;
  cin >> A >> B;
  int ans = 0;
  for(int i=0;i <= A-3;i++){
    if(B.at(i)=='A' && B.at(i+1)=='B' && B.at(i+2)=='C'){
      ans++;
    }
  }
		cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
	public static void main(String[] args) throws IOException {
		int num;
		int maxNum;
		int minNum;
		String[] line;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		num = Integer.parseInt(br.readLine());
		line = br.readLine().split("\\s");

		ArrayList<Integer> list = new ArrayList<>();
		for (int i = 0; i < num; i++) {
			list.add(Integer.parseInt(line[i]));
		}

		Collections.sort(list);
		maxNum = list.get(num - 1);
		minNum = list.get(0);
		System.out.println(maxNum - minNum);
	}
}


Measured memory_bytes: 21332
#include <algorithm>
#include <climits>
#include <iostream>
#include <iomanip>
#include <random>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using std::cin;
using std::cerr;
using std::cout;
using std::endl;
using std::make_pair;
using std::pair;
using std::stack;
using std::string;
using std::unordered_map;
using std::unordered_set;
using std::vector;
using std::lower_bound;
using std::upper_bound;

int main(int argc, char* argv[]) {
  int a, b;
  cin >> a >> b;
  for (int i = 1; i <= 1000; ++i) {
    if (int(i * 0.08) == a && int(i * 0.1) == b) {
      cout << i;
      return 0;
    }
  }
  cout << -1;
  return 0;
}


Measured memory_bytes: 256