akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (int i = 0; i< (n); ++i)
const int INF = 1001001001;

/*
 *
 * */

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

    int A[M+10];
    rep(i,M+10) A[i] = 0;

    rep(i,N) {
        int num;
        cin >> num;
        rep(j,num){
            int index;
            cin >> index;
            A[index]++;
        }
    }

    int count = 0;
    rep(i,M+10){
        if(A[i]==N){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
/* Author - Ankur Kumar Singh 
	IDE :- Offine Linux
	
 ---------------------------------*/
#include <bits/stdc++.h>
using namespace std;
/* variable type :- */
	# define ll long long int
	# define ld long double
	# define I int
/* map */
	# define abc  pair<long long int,long long int>
	map < pair < abc,abc > , long long int > pqr;
	map <  pair < long long int,long long int > ,long long int > xyz;	
/* vector */
	# define pb push_back
	# define pp pop_back
	# define ff first
	# define ss second
	# define mp make_pair
	# define ac accumulate
/* pairs */
	vector<pair<ll,ll>>a;
	vector<pair<pair<int,int>,pair<int,int> > > b;
	vector<pair<ll,pair<ll,ll>>>c;
	priority_queue<ll>pq; // pq.top() = Largest Element
	priority_queue<ll,vector<ll>,greater<ll>>bc; // bc.top() = Smallest Element
 
bool compare( const pair<long long int,long long int>&x , const pair<long long int,long long int>&y )
{
	return x.ff>y.ff;
}
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
{
        return (a.ss < b.ss);
}
int main()
{
    ll n;
    cin>>n;
    char x,y;
    string p[n+1];
    for(ll i=0;i<n;i++)
    {
        //string p;
        cin>>p[i];
        if(i==0)continue;
        if(p[i][0]!=p[i-1][p[i-1].size()-1])
        {
            cout<<"No";return 0;
        }
        for(ll j=0;j<i;j++)
        {
            if(p[j]==p[i])
            {
                 cout<<"No";return 0;
            }
        }
        
        
    }
    cout<<"Yes";
}

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



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    Scanner cin;

    int H, W;
    string[] board;
    void calc()
    {
        cin = new Scanner();
        H = cin.nextInt();
        W = cin.nextInt();
        board = new string[H];
        for (int i = 0; i < H; i++)
        {
            board[i] = cin.next();
        }

        int[] vy = { 1, 0, -1, 0, 1, 1, -1, -1 };
        int[] vx = { 0, 1, 0, -1, 1, -1, 1, -1 }; 

        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                if (check(i, j)) Console.Write('#');
                else
                {
                    int cnt = 0;
                    for (int k = 0; k < 8; k++)
                    {
                        int ny = i + vy[k];
                        int nx = j + vx[k];
                        if (check(ny, nx)) cnt++;
                    }
                    Console.Write(cnt);
                }
            }
            Console.WriteLine();
        }

    }

    bool check(int y, int x)
    {
        return inside(y, x) && board[y][x] == '#';
    }

    bool inside(int y, int x)
    {
        return y >= 0 && x >= 0 && y < H && x < W;
    } 

}



class Scanner
{
    string[] s;
    int i;

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

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

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

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll a[110],b[110];
int main(){
	ll n;
	cin>>n;
	bool f=0;
	for(int i=1;i<=n;i++){
		cin>>a[i]>>b[i];
		if(i>=3){
			if(a[i-2]==b[i-2]&&a[i-1]==b[i-1]&&a[i]==b[i])f=1;
		}
	}
	cout<<(f?"Yes":"No");
	return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define MOD 1000000007LL

using namespace std;
using llong = long long;

int main()
{
	IOS;
	int n;
	cin >> n;
	if (n % 1000 == 0) cout << 0;
	else cout << 1000 - (n % 1000);
	return 0;	
}



Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define DIST(x1,x2, y1, y2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)))
#define DIST3D(x1,x2, y1, y2, z1, z2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)) + ((z1-z2)*(z1-z2)))
#define CLR(a) a.clear()
#define VCLR(a, n) for(int i=0; i<=n+3; i++) a[i].clear()
#define SIZE(a) a.size()
#define ERASE(a, b) memset(a, b, sizeof a)
#define PB(a, b) a.push_back(b)
#define PB2(a,i,b) a[i].push_back(b)
#define LL long long
#define DBG cout<<"I Am Here"<<endl
#define DBGA(a) cout<<a<<endl
#define DBGI(b,a) cout<<b<<' '<<a<<endl
#define DBGL(i,s,e,b) or(int i=s; i<=e; i++) cout<<b<<endl
#define INF 1e9
#define INV 1e-6
#define sll(a) scanf("%I64d", &a)
#define pll(a) printf("%I64d\n", a)
#define si(a) scanf("%d", &a)
#define pii pair<int,int>
#define MAX 600005
#define CASE(i) printf("Case %d: ", i);
#define PI acos(-1)
#define piis pair<int, string>
#define fast1 ios_base::sync_with_stdio(false);
#define fast2 cin.tie(0)

using namespace std;

int arr[10];

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);
    for(int i=0; i<k; i++){
        int x;
        scanf("%d", &x);
        arr[x] = 1;
    }
    for(int i=n; i<=90000 ; i++)
    {
        int temp = i, cnt = 0, dig = 0;
        while(temp){
            if(arr[temp%10]==0) cnt++;
            temp = temp/10;
            dig++;
        }
        if(dig==cnt){
            printf("%d", i);
            return 0;
        }
    }

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

int main(){
int n;cin>>n;
vector<int> v(n);
int a=0,b=0;
for(int i=0;i<n;i++){
    cin>>v[i];
}
sort(v.begin(),v.end());
for(int i=0;i<n;i++){
    if(i%2)a+=v[i];
    else b+=v[i];
}
cout<<abs(a-b);
}

Measured memory_bytes: 380
#include<stdio.h>

#define Max 10000
#define NIL -1

typedef struct Node{
  int p, l, r;
}Node;

Node T[Max];
int n;

void preParse(int u){
  if(u == NIL) return;
  printf(" %d", u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u){
  if(u == NIL) return;
  inParse(T[u].l);
  printf(" %d", u);
  inParse(T[u].r);
}

void postParse(int u){
  if(u == NIL) return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d", u);
}

int main(){
  int i, v, l, r, root;

  scanf("%d", &n);
  for(i = 0 ; i < n ; i++){
    T[i].p = NIL;
  }

  for(i = 0 ; i < n ; i++){
    scanf("%d %d %d", &v, &l, &r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL) T[l].p = v;
    if(r != NIL) T[r].p = v;
  }

  for(i = 0 ; i < n ; i++){
    if(T[i].p == NIL) root = i;
  }

  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

typedef pair<long long,int> P;

int main(){
	int N,L;
	vector <string> vec;

	scanf("%d %d",&N,&L);
	for(int i=0;i<N;i++){
		string s;
		cin >> s;
		vec.push_back(s);
	}

	sort(vec.begin(),vec.end());

	for(int i=0;i<N;i++){
		cout << vec[i];
	}
	printf("\n");

	return 0;
}


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

using namespace std;

#define ll long long
#define ull unsigned long long
int main()
{
	//ifstream cin("in.txt");
	//ofstream cout("out.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

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

	if (n%2)
	{
		cout<<"No\n";
		return 0;
	}

	string ans = "Yes";
	for (int i =0; i<n/2; i++)
	{
		if (s[i] != s[i+n/2])
		{
			ans = "No";
			break;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int m,k;
	cin>>m>>k;
	if(m==1){
		if(k==0){
			cout<<"0 0 1 1"<<endl;
		}
		else cout<<-1<<endl;
	}
	else{
		if(pow(2,m)<=k)cout<<-1<<endl;
		else{
			vl v;
			rep(i,pow(2,m)){
				if(i!=k)v.push_back(i);
			}
			v.push_back(k);
			rrep(i,pow(2,m)){
				if(i!=k)v.push_back(i);
			}
			v.push_back(k);
			cout<<v<<endl;
		}
	}

}


Measured memory_bytes: 6128
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;

string s;
int list[26];
bool check(){
	for(int i=0;i<26;i++){
		if(list[i]%2) return false;
	}
	return true;
}

int main(){
	cin >> s;
	for(int i=0;i<s.length();i++){
		list[s[i]-'a']++;
	}
	cout << (check()?"Yes":"No") << endl;
	return 0;
}


Measured memory_bytes: 256
use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();

    let lr: Vec<(i64, i64)> = (0..n).map(|_| (sc.read(), sc.read())).collect();
    let ans1 = solve(&lr);
    let lr = lr.into_iter().map(|(l, r)| (-r, -l)).collect();
    let ans2 = solve(&lr);
    println!("{}", cmp::max(ans1, ans2));
}

fn solve(lr: &Vec<(i64, i64)>) -> i64 {
    let n = lr.len();
    let mut left = lr
        .iter()
        .enumerate()
        .map(|(i, &(l, _))| (l, i))
        .collect::<Vec<_>>();
    let mut right = lr
        .iter()
        .enumerate()
        .map(|(i, &(_, r))| (r, i))
        .collect::<Vec<_>>();
    left.sort();
    right.sort();

    let mut used = vec![false; n];
    let mut ans = 0;
    let mut cur = 0;

    let mut left = left.into_iter().rev();
    let mut right = right.into_iter();
    for _ in 0..n {
        while let Some((_, i)) = left.next() {
            if used[i] {
                continue;
            }
            let (l, r) = lr[i];
            used[i] = true;
            if cur < l {
                ans += l - cur;
                cur = l;
            } else if r < cur {
                ans += cur - r;
                cur = r;
            }
            break;
        }
        while let Some((_, i)) = right.next() {
            if used[i] {
                continue;
            }
            let (l, r) = lr[i];
            used[i] = true;
            if cur < l {
                ans += l - cur;
                cur = l;
            } else if r < cur {
                ans += cur - r;
                cur = r;
            }
            break;
        }
    }
    ans + cur.abs()
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 12540
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define gcd __gcd
#define all(x) (x).begin(), (x).end()
template<class T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<class T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
const int INF = 1e18, MOD = 1e9 + 7;
signed main() {
    INCANT;
    int n, f, m, res = 0;
    string s;
    vector<pair<string, string>> r;
    map<string, map<string, int>> ma;
    cin>>n>>f;
    rep(i, n){
        vector<string> v;
        cin>>m;
        rep(j, m){
            cin>>s;
            v.push_back(s);
        }
        each(t, v){
            each(u, v){
                if(t != u){
                    ma[t][u]++;
                }
            }
        }
    }
    set<pair<string, string>> se;
    string t, u;
    each(p, ma){
        each(o, p.second){
            if(o.second >= f){
                t = p.first, u = o.first;
                if(t > u){
                    string tmp = t;
                    t = u;
                    u = tmp;
                }
                if(se.insert({t, u}).second){
                    res++;
                    r.push_back({p.first, o.first});
                }
            }
        }
    }
    cout<<res<<endl;
    each(p, r){
        cout<<p.first<<' '<<p.second<<endl;
    }
}



Measured memory_bytes: 4132
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;
const int inf = 1e9;
int main(){
	int n,m,x;
	cin >> n >> m >> x;
	vector<int> c(n);
	vector<vector<int>> a(n, vector<int>(m));
	for(int i=0; i<n; i++){
		cin >> c[i];
		for(int j=0; j<m; j++){
			cin >> a[i][j];
		}
	}

	int ans = inf;
	for(int i=0; i<(1<<n); i++){
		vector<int> b(m, 0);
		int cost = 0;
		for(int j=0; j<n; j++){
			if(i>>j&1) continue;
			cost += c[j];
			for(int k=0; k<m; k++){
				b[k] += a[j][k];
			}
		}
		bool ok = true;
		for(int j=0; j<m; j++){
			if(b[j] < x){
				ok = false;
			}
		}
		if(ok){
			ans = min(ans, cost);
		}
	}
	if(ans == inf){
		cout << -1 << endl;
	}else{
		cout << ans << endl;
	}
	return 0;
}


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

using namespace std;

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    int ans = c - (a-b);
    if (ans < 0) {
        cout << 0 << endl;
    } else {
        cout << ans << endl;
    }
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> wi;
static const int MAX=200000;

int main(){
  int R[MAX], n;
  cin >> n;
  rep(i, n)cin >> R[i];

  int maxv=-2000000000, minv=R[0];

  for(int i=1; i<n; i++){
    maxv=max(maxv,R[i]-minv);
    minv=min(minv,R[i]);
  }

  cout << maxv << endl;

  return 0;
}


Measured memory_bytes: 3908
use std::io;
use std::str;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let split: Vec<&str> = input.as_str().split_whitespace().collect();

    let a: i64 = split[0].parse().unwrap();
    let b: i64 = split[1].parse().unwrap();

    let first: Vec<i64> = vec![1, 3, 5, 7, 8, 10, 12];
    let second: Vec<i64> = vec![4, 6, 9, 11];

    match a {
        1 | 3 | 5 | 7 | 8 | 10 | 12 => {
            if first.contains(&b) {
                println!("Yes")
            } else {
                println!("No")
            }
        }
        4 | 6 | 9 | 11 => {
            if second.contains(&b) {
                println!("Yes")
            } else {
                println!("No")
            }
        }
        _ => {
            if b == 2 {
                println!("Yes")
            } else {
                println!("No")
            }
        }
    }
}

Measured memory_bytes: 4352
open System

[<EntryPoint>]
let main args =
    let N  = Console.ReadLine () |> int

    let Ai = Console.ReadLine ()
             |> fun s -> s.Split(' ')
             |> Seq.map int

    let M1 = Ai
             |> Seq.zip (seq { 0 .. N })
             |> Seq.sumBy (fun (i, e) -> e * (if i % 2 = 0 then 1 else -1))

    let Mi = Ai
             |> Seq.scan (fun Mb a -> 2 * a - Mb) M1
             |> Seq.take N
    
    for M in Mi do
        printfn "%i" M

    0


Measured memory_bytes: 56704
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
    return a / GCD(a, b) * b;
}


int main(void){
   long long a, b;
   cin >> a >> b;
   
   long long ans = LCM(a,b);
   cout << ans << endl;
}


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

typedef struct {
	double x, y, z, r;
} Coord;

typedef struct {
	int from, to;
	double weight;
} Edge;

Coord coord[ 100 ];
int node[ 100 ];
Edge edge[ 4950 ];

int compare( const void *a, const void *b ) {
	double at = (*(Edge *)a).weight, bt = (*(Edge *)b).weight;

	if ( at < bt )
		return -1;
	if ( at > bt )
		return 1;
	return 0;
}

int find( int x ) {
	if ( node[ x ] == x )
		return x;
	else
		return node[ x ] = find( node[ x ] );
}

int main( void ) {
	int i, j;
	int n;

	while ( scanf( "%d", &n ), n ) {
		int cnt;
		double sum;

		for ( i = 0; i < n; i++ )
			scanf( "%lf %lf %lf %lf", &coord[ i ].x, &coord[ i ].y, &coord[ i ].z, &coord[ i ].r );

		cnt = 0;
		for ( i = 0; i < n; i++ )
			for ( j = i + 1; j < n; j++ ) {
				edge[ cnt ].from = i;
				edge[ cnt ].to = j;
				edge[ cnt ].weight = fmax( hypot( hypot( coord[ i ].x - coord[ j ].x, coord[ i ].y - coord[ j ].y ), coord[ i ].z - coord[ j ].z ) - coord[ i ].r - coord[ j ].r, 0.0 );
				cnt++;
			}
		qsort( edge, cnt, sizeof(Edge), &compare );

		for ( i = 0; i < n; i++ )
			node[ i ] = i;

		sum = 0.0;
		for ( i = 0; i < cnt; i++ ) {
			int set1 = find( edge[ i ].from ), set2 = find( edge[ i ].to );
			if ( set1 != set2 ) {
				node[ set2 ] = set1;
				sum += edge[ i ].weight;
			}
		}

		printf( "%.3f\n", sum );
	}

	return 0;
}

Measured memory_bytes: 880
using System;

public class Program
{
	public static void Main(string[] args)
	{
		var ss = new StreamScanner();
		//---------------------------------
		var x = ss.Next<int>();
		var y = ss.Next<int>();
		var z = ss.Next<int>();
		if (x<y&&y<z)
		{
			Console.WriteLine("Yes");
		}
		else 
		{
			Console.WriteLine("No");
		}

		/*
		//????????????int, double, string?????????????????£????????????
		int i = ss.Next<int>();
		double d = ss.Next<double>();
		string s = ss.Next<string>();

		//?????°???????????????????????¨?????????????????????????????????????????????????´???????
		int[] array = ss.Next<int>(10);
		*/
		//---------------------------------
	}
}

public class StreamScanner
{
	private readonly char[] _c = { ' ' };
	private int _index = -1;
	private string[] _input = new string[0];
	private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

	public T Next<T>()
	{
		if (_index == _input.Length - 1)
		{
			_index = -1;
			while (true)
			{
				string rl = _sr.ReadLine();
				if (rl == null)
				{
					if (typeof(T).IsClass) return default(T);
					return (T)typeof(T).GetField("MinValue").GetValue(null);
				}
				if (rl != "")
				{
					_input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
					break;
				}
			}
		}
		return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
	}

	public T[] Next<T>(int x)
	{
		var ret = new T[x];
		for (var i = 0; i < x; ++i) ret[i] = Next<T>();
		return ret;
	}

	public T[][] Next<T>(int x, int y)
	{
		var ret = new T[y][];
		for (var i = 0; i < y; ++i) ret[i] = Next<T>(x);
		return ret;
	}
}

Measured memory_bytes: 9900
#include<bits/stdc++.h>
#define N 2000001
#define M 10001
using namespace std;
int n,A[N],B[N],C[M];

void CountingSort(){
  for(int i=1;i<=n;i++)C[A[i]]++;
  for(int i=1;i<M;i++)C[i]+=C[i-1];
  for(int i=n;i>=1;i--)
    B[C[A[i]]]=A[i],C[A[i]]--;
}

int main(){
  cin>>n;
  for(int i=1;i<=n;i++)cin>>A[i];
  CountingSort();
  for(int i=1;i<=n;i++){
    if(i!=1)cout<<' ';
    cout<<B[i];
  }
  cout<<endl;
  return 0;
}

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

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define endl "\n"
#define ar array
#define pb push_back
#define sz(X) ((int)(X).size())
#define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define get_pos(c, x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define all(X) (X).begin(), (X).end()
#define  No cout<<"NO"<<endl;
#define  Yes cout<<"YES"<<endl;
#define  nl cout<<endl;

template<typename T>
ostream &operator+(ostream &out, const vector<T> &vec) {
    for (const auto &x : vec) {
        out << x << " ";
    }
    out << "\n";
    return out;
}

template<typename T>
ostream &operator*(ostream &out, const vector<T> &vec) {
    for (const auto &x : vec) {
        out + x;
    }
    return out;
}

template<typename T>
istream &operator>>(istream &in, vector<T> &vec) {
    for (auto &x : vec) {
        in >> x;
    }
    return in;
}
// DEBUG
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
	cerr << ts(h); if (sizeof...(t)) cerr << ", ";
	DBG(t...); }

#ifdef _DEBUG // compile with -DLOCAL
	#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
	#define dbg(...) 0
#endif

template<class T>
bool ckmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }

template<class T>
bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }


const int mod = 1e9 + 7;
const int mod2 = 998244353;
const ll INF = 1e9 + 6;

ll add(ll a, ll b) {
    a += b;
    return a % mod;
}

ll mul(ll a, ll b) {
    a *= b;
    return a % mod;
}

inline ll power(ll x, ll y, ll p) {
    ll res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
const int MXN = 1e3 + 5;
int n,c,k;
 
void solve() {
int n;
cin>>n;
vector<int>h(n);
cin>>h;
int dp[n+1]={0};
memset(dp,0x1f,sizeof(dp));
dp[0]=0;
dp[1]=abs(h[0]-h[1]);
for(int i=2;i<n;i++){
    dp[i]=min({dp[i],dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2])});
}
cout<<dp[n-1]<<endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
    #endif
    int t = 1;
   // cin >> t;
    while (t--)solve();
    // cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}
//look if it requires ll


Measured memory_bytes: 4000
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<iomanip>
#include<string>
#include<math.h>
 
using namespace std;
 
 
int main(){
    string s;
    cin>>s;
    int ans=0;
    for(int i=1;i<s.length();i++){
        if(s[i]!=s[i-1])ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
int cmpnum(const void * n1, const void * n2)
{
	if (*(long *)n1 > *(long *)n2)
	{
		return 1;
	}
	else if (*(long *)n1 < *(long *)n2)
	{
		return -1;
	}
	else
	{
		return 0;
	}
}


int main(){
  long long K, N, maxa;
  long long a[2*100000],b[2*100000];

  scanf("%lld%lld",&K, &N);


  for (int i = 0; i < N; i++)
  {
      scanf("%lld", a + i);
  }

  qsort(a, N, sizeof(long long), cmpnum);

  b[0] = K + a[0] - a[N-1];  
  for (int i = 1; i < N; i++)
  {
      b[i] = a[i] - a[i-1];
  }  

  maxa = 0;

for (int i = 0; i < N; i++)
  {
      maxa = maxa < b[i] ? b[i] : maxa;
  }  

  
   printf("%lld\n", K-maxa);
  

  return 0;
}

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

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

	int H, W;
	cin >> H >> W;
	vector<string> A(H);
	for (int i = 0; i < H; i++) {
		cin >> A[i];
	}

	vector<vector<int>> dist(H, vector<int>(W, -1));
	deque<pair<int, int>> que;
	for (int r = 0; r < H; r++) {
		for (int c = 0; c < W; c++) {
			if (A[r][c] == '#') {
				dist[r][c] = 0;
				que.push_back(make_pair(r, c));
			}
		}
	}

	vector<int> ud = { -1, 1, 0, 0 };
	vector<int> lr = { 0, 0, -1, 1 };
	while (!que.empty()) {
		int nowh, noww;
		nowh = que.front().first; noww = que.front().second; que.pop_front();
		for (int i = 0; i < 4; i++) {
			int nexth = nowh + ud[i];
			int nextw = noww + lr[i];
			if (0 <= nexth && nexth < H && 0 <= nextw && nextw < W && dist[nexth][nextw] == -1) {
				dist[nexth][nextw] = dist[nowh][noww] + 1;
				que.push_back(make_pair(nexth, nextw));
			}
		}
	}

	int maxdist = 0;
	for (int r = 0; r < H; r++) {
		for (int c = 0; c < W; c++) {
			maxdist = max(maxdist, dist[r][c]);
		}
	}

	cout << maxdist << '\n';
}

Measured memory_bytes: 13456
#include<cstdio>
#include<map>
#include<utility>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main(){
	ll h, w, a[100000];
	int n;
	scanf("%lld %lld %d", &h, &w, &n);
	map<P, ll> m;
	for(int i = 0; i < n; i++){
		int a, b; scanf("%d %d", &a, &b);
		for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++){
			int y = a - j, x = b - k;
			if(1 <= y && y <= h - 2 && 1 <= x && x <= w - 2) m[P(y, x)]++;
		}
	}
	ll sum = 0, res[10] = {};
	for(auto it = m.begin(); it != m.end(); it++) res[it -> second]++;
	res[0] = (h - 2) * (w - 2) - m.size();
	for(int i = 0; i < 10; i++) printf("%lld\n", res[i]);
	return 0;
}

Measured memory_bytes: 56448
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <utility>
#include <algorithm>
using namespace std;


int main(){
    
    int n, l;
    cin>>n>>l;
    
    int sum=n*l+(n-1)*n/2;
    
    int m1=10000;
    int m2=-10000;
    
    for(int i=0; i<n; i++){
        if(l+i>=0){
            m1=min(m1, l+i);
        }else{
            m2=max(m2, l+i);
        }
    }
    
    if(fabs(m1)<=fabs(m2)){
        cout<<sum-m1<<endl;
    }else{
        cout<<sum-m2<<endl;
    }
}


Measured memory_bytes: 256
def actual(s, t):
    """
    kyoto
    okyot
    tokyo
    otoky
    yotok
    kyoto
    """
    for _ in range(len(s)):
        s = s[-1] + s[:-1]

        if s == t:
            return 'Yes'

    return 'No'

s = input()
t = input()

print(actual(s, t))

Measured memory_bytes: 9080
import scala.io.{StdIn => in}

object Main extends App {
  val n = in.readInt
  val ans = in.readLine.split(" ").map(ch => rec(0,ch.toInt)).min

  def rec(cnt:Int, num:Int):Int = {
    if(num % 2 == 1) cnt
    else rec(cnt + 1, num / 2)
  }

  println(ans)
}

Measured memory_bytes: 25296
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>

using namespace std;

int main() {
	int n;
	int r[100];

	cin >> n;

	for (int i = 1; i <= n; i++) {
		cin >> r[i-1] >> r[i];
	}

	int m[100][100];

	for (int i = 1; i <= n; i++) {
		m[i][i] = 0;
	}

	
	for (int l = 2; l <= n; l++) {
		for (int i = 1; i <= n - l + 1; i++) {
			int j = i + l - 1;
			m[i][j] = (1 << 21);
			for (int k = i; k <= j -1; k++) {
				m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + r[i - 1] * r[k] * r[j]);
			}
		}
	}
	cout << m[1][n] << endl;

	return 0;
}


Measured memory_bytes: 3120
(a,b,c,d,e)=map(int,input().split())

if a==c:
    t=d-b
    if e<=t:
        print(t-e)
    else:
        print(0)
    
if c>a:
    if b>d:
        t=60*(c-a)-b+d
        if e<=t:
            print(t-e)
        else:
            print(0)
        
        
    if b<=d:
        t=(c-a)*60+d-b
        if e<=t:
            print(t-e)
        else:
            print(0)
        



Measured memory_bytes: 9196
N = gets.to_i
A = [[]]
N.times{|i|
  A << gets.chomp.split(" ").map(&:to_i)
}

ans = 0
bef = (1..N).to_a
begin
  pair = []
  bef.each{|i|
    next if A[i].empty?
    o = A[i][0]
    (pair << i; pair << o) if A[o][0] == i
  }
  bef = pair.uniq
  bef.sort.reverse.each{|i|
    A[i].shift
  }
  ans += 1
end until pair.empty?

puts A.all?{|a| a.empty?} ? ans - 1 : -1


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

int compare(const void *n1, const void *n2){
	if(*(int *)n1 < *(int *)n2)
		return 1;
	else if(*(int *)n1 > *(int *)n2)
		return -1;
	else
		return 0;
}

int main(void){
	int n, m, sum = 0;
	int a[100] = {0};

	scanf("%d%d", &n, &m);
	for(int i=0; i < n; i++) {
		scanf("%d", &a[i]);
		sum += a[i];
	}

	qsort(a, n, sizeof(a[0]), compare);

	if(a[m-1] >= sum / (4.0*m))
		printf("Yes");
	else
		printf("No");

	return 0;
}


Measured memory_bytes: 128
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, K = map(int, input().split())

    res = 0
    for b in range(K + 1, N + 1):
        p = N // b
        q = N - b * p
        res += max(0, q - K + 1)
        res += p * max(0, b - 1 - K + 1)
        if K == 0:
            res -= 1

    print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39276
from bisect import bisect_right
INFTY = 10**11
A,B,Q = map(int,input().split())
S = [int(input()) for _ in range(A)]
S.insert(0,-INFTY)
S.append(INFTY)
T = [int(input()) for _ in range(B)]
T.insert(0,-INFTY)
T.append(INFTY)
for _ in range(Q):
    x = int(input())
    indS = bisect_right(S,x)
    indT = bisect_right(T,x)
    d1 = x-S[indS-1]+abs(S[indS-1]-T[indT-1])
    d2 = x-S[indS-1]+abs(S[indS-1]-T[indT])
    d3 = S[indS]-x+abs(S[indS]-T[indT-1])
    d4 = S[indS]-x+abs(S[indS]-T[indT])
    d5 = x-T[indT-1]+abs(T[indT-1]-S[indS-1])
    d6 = x-T[indT-1]+abs(T[indT-1]-S[indS])
    d7 = T[indT]-x+abs(T[indT]-S[indS-1])
    d8 = T[indT]-x+abs(T[indT]-S[indS])
    print(min(d1,d2,d3,d4,d5,d6,d7,d8))

Measured memory_bytes: 99492
#include<iostream>
using namespace std;
#define sz 105

char f,g;
bool flag;
int arr[sz][sz],brr[sz],crr[sz];

int cal(int n){
    int x=0;

    for(int i=1; i<=n; i++){
        if(n%i==0)x++;
    }
    return x;

}


int main(){

    int n,m, i,j,k, x,y,z;

    cin>>n;
    x=0;
    for(i=1; i<=n; i+=2){
      if(cal(i)==8)x++;
    }
    cout<<x<<endl;



    return 0;

}


Measured memory_bytes: 256
import numpy as np
listA=list(map(int,input().split()))
N=listA[0]
K=listA[1]
A=list(map(int,input().split()))
Anp=np.array(A)
if(N/K==1):
    print(1)
elif((N-1)%(K-1)==0):
    print(int((N-1)/(K-1)))
else:
    print(int((N-1)/(K-1))+1)

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

using namespace std;

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

int main(){
  int n, k;
  cin >> n >> k;
  char b = '-';
  int r = 0;
  REP(i, n){
    char c;
    cin >> c;
    if(b != c){
      ++r;
    }
    b = c;
  }
  r = max(1, r - 2 * k);
  cout << n - r << endl;
  return 0;
}

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

int arr[1000000];
int n;

int main() {
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}

	sort(arr, arr + n);

	// when we find a that divides b, we will just replace b with 0

	// handle a|b where a is small, a != b
	// note that we can't just delete all but one copy of duplicates, or we'll
	// forget that a duplicate existed in the first place
	for (int i = 0; i < n; i++) {
		if (arr[i] == 0) continue;

		// don't double-search for any a (which would degenerate into n^2)
		if (i > 0 && arr[i] == arr[i-1]) continue;

		if (arr[i] > 1000) break;

		for (int j = i + 1; j < n; j++) {
			if (arr[j] % arr[i] == 0 && arr[j] != arr[i]) {
				arr[j] = 0;
			}
		}
	}

	sort(arr, arr + n);

	// handle a|b where b/a is small, a != b
	for (int ratio = 2; ratio <= 1000; ratio++) {
		int j = 0; // second pointer
		for (int i = 0; i < n; i++) {
			if (arr[i] == 0) continue;

			while (j < n && arr[j] < ratio * arr[i]) {
				j++;
			}

			while (j < n && arr[j] == ratio * arr[i]) {
				arr[j] = 0;
				j++;
			}

			if (j == n) break;
		}
	}

	sort(arr, arr + n);

	// handle duplicates
	int count = 0;
	for (int i = 0; i < n; i++) {
		if (arr[i] != 0 && (i == 0 || arr[i] != arr[i-1]) && (i == n - 1 || arr[i] != arr[i+1])) {
			count++;
		}
	}

	cout << count << "\n";
}


Measured memory_bytes: 4400
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

func main() {
	sc.Split(bufio.ScanWords)

	S := getString()

	for i := 0; i < len(S); i++ {
		fmt.Print("x")
	}
	fmt.Print("\n")

}


Measured memory_bytes: 640
#include <algorithm> //STLͨ���㷨
#include <cmath> //������ѧ����
#include <cstdio> //��������/�������
#include <iostream> //����������/���
#include <cstring> //�ַ�������
#include <string> //�ַ�����
#include <ctime> //�������ʱ��ĺ���
#define itn int
#define fro for
#define ll long long
#define reg register
#define inf 1234567890
#define rep(i,a,b,c) for (int i=a;i<=b;i+=c)
/*#include <bitset> //STLλ������
#include <cstype> //�ַ�����
#include <cerrno> //���������
#include <complex> //������
#include <clocale> //���屾�ػ�����
#include <cstdlib> //������������ڴ���亯��
#include <deque> //STL˫�˶�������
#include <exception> //�쳣������
#include <fstream> //�ļ�����/���
#include <functional> //STL�������㺯��(���������)
#include <limits> //�����������������ֵ����
#include <list> //STL�����б�����
#include <map> //STLӳ������
#include <iomanip> //����������/���
#include <ios> //��������/���֧��
#include <iosfwd> //����/���ϵͳʹ�õ�ǰ������
#include <istream> //����������
#include <ostream> //���������
#include <queue> //STL��������
#include <set> //STL��������
#include <sstream> //�����ַ�������
#include <stack> //STL��ջ����
#include <stdexcept> //��׼�쳣��
#include <streambuf> //�ײ�����/���֧��
#include <utility> //STLͨ��ģ����
#include <vector> //STL��̬��������
#include <cwchar.h>//���ַ�����������/���
#include <cwctype.h> //���ַ�����*/

using namespace std;

int ans;

int max(int x,int y){return x>y?x:y;}

int min(int x,int y){return x<y?x:y;}

int abs(int x){return x>0?x:-x;}

int gcd(int x,int y){return (!y)?x:gcd(y,x%y);}

void exgcd(int a,int b,int &d,int &x,int &y){if (!b){d=a,x=1,y=0;}else{exgcd(b,a%b,d,y,x);y-=x*(a/b);}}

int quick_power(ll a,int b){ll r=1;for (;b;b>>=1,a=a*a)if (b&1) r=r*a;return r;}

inline char read() {
	static const int IN_LEN = 1000000;
	static char buf[IN_LEN], *s, *t;
	return (s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin), (s == t ? -1 : *s++) : *s++);
}
template<class T>
inline void read(T &x) {
	static bool iosig;
	static char c;
	for (iosig = false, c = read(); !isdigit(c); c = read()) {
		if (c == '-') iosig = true;
		if (c == -1) return;
	}
	for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');
	if (iosig) x = -x;
}

char sr[10000000],z[20];int C=-1,Z=0;
void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}
void print(int x){
	if (x<0) sr[++C]='-',x=-x;
    while(z[++Z]=x%10+48,x/=10);
    while(sr[++C]=z[Z],--Z);sr[++C]='\n';
}
//int find(int x){return fa[x]=fa[x]==x?x:find(fa[x]);}

//void add(int x,int y,int z){to[++cnt]=y;v[cnt]=z;Next[cnt]=head[x];head[x]=cnt;}
int q;
int main()
{
	int n;
	read(n);
	for (int i=1;i<=n;i++) read(q),ans^=q;
	if (ans) puts("No");else puts("Yes");
	return 0;
}









Measured memory_bytes: 2688
fn main() {
  let k: u64 = read();
  
  let km = k % 50;
  let kd = k / 50;
  
  let mut vec: Vec<u64> = vec![];
  for _ in 0 .. km {
    vec.push(100-km+kd);
  }
  for _ in km .. 50 {
    vec.push(49-km+kd);
  }
  
  println!("50");
  print_vec(&vec, " ");
}

fn read<T: std::str::FromStr>() -> T {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  buf.trim().parse::<T>().ok().unwrap()
}

fn print_vec<T: std::string::ToString>(vec: &Vec<T>, sep: &str) {
  let out = vec.iter().map(|e| e.to_string()).collect::<Vec<_>>().as_slice().join(sep);
  println!("{}", out);
}

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

int main() {
	long long n, m, ans = 0; cin >> n >> m;
	if (n * 2 >= m) { ans += m / 2; m -= m; }
	else { ans = n; m -= n * 2; }
	if (m >= 4)ans += m / 4;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int>arr(n);
	for(int i=0;i<n;i++)
		cin>>arr[i];
	int left_sum,right_sum;
	left_sum=arr[0];
	right_sum=arr[n-1];
	int l=1;int r=n-2;
	while(l<=r){
		if(left_sum>right_sum){
			right_sum+=arr[r];
			r--;
		}else {
			left_sum+=arr[l];
			l++;
		}
	}

	cout<<abs(left_sum-right_sum);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	int k;
	cin >> k;
	string s{};
	cin >> s;
	if(s.size()>k){
		cout<< s.substr(0,k)<< "...";
	}
	else{
		cout<<s;
	}
}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int re =0;
		if (s.length()==1) {
			System.out.println(s.charAt(0)-'0');
			return ;
		}
		int nonine=0;
		for (;nonine<s.length();nonine++) {
			if (s.charAt(nonine)!='9') {
				break;
			}
		}
		if (nonine==s.length()) {
			System.out.println(9*s.length());
			return ;
		}
		if (nonine==s.length()-1) {
			System.out.println(9*s.length()-1);
			return ;
		}
		int nextnine = nonine+1;
		for (;nextnine<s.length();nextnine++) {
			if (s.charAt(nextnine)!='9') {
				break;
			}
		}
		if (nextnine==s.length()) {
			System.out.println(9*s.length()-9+s.charAt(nonine)-'0');
			return ;
		}
		if (s.charAt(nonine)=='0') {
			System.out.println(9*s.length()-9+s.charAt(nonine)-'0'-2);
		} else {
			System.out.println(9*s.length()-9+s.charAt(nonine)-'0'-1);
		}


	}
}

Measured memory_bytes: 35772
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(x) (int)(x).size()
#define endl '\n'
#define FOR(a, b, c) for (auto a = (b); (a) < (c); ++(a))
#define F0R(a, b) FOR (a, 0, (b))
#define CEIL(a, b) ((a) + (b)-1) / (b)
template <class T>
bool ckmin(T& a, const T& b) {
  return a > b ? a = b, true : false;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, true : false;
}
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
  if (DEBUG) std::cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << mt(__VA_ARGS__) << "] "
template <typename T>
struct IsC {
  template <typename C>
  static char test(typename C::const_iterator*);
  template <typename C>
  static int test(...);
  static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <>
struct IsC<string> {
  static const bool value = false;
};
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(ostream&, const C&);
template <typename T1, typename T2>
ostream& operator<<(ostream&, const pair<T1, T2>&);
template <typename... T> using TS = tuple_size<tuple<T...>>;
template<size_t idx, typename... T>
typename enable_if<TS<T...>::value == idx + 1, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return o << ", " << get<idx>(t) << ')';
}
template<size_t idx, typename... T>
typename enable_if<0 < idx && idx + 1 < TS<T...>::value, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return operator<<<idx + 1>(o << ", " << get<idx>(t), t);
}
template<size_t idx = 0, typename... T>
typename enable_if<1 < TS<T...>::value && !idx, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return operator<<<idx + 1>(o << '(' << get<idx>(t), t);
}
template<typename T>
ostream& operator<<(ostream& o, const tuple<T>& t) {
  return o << get<0>(t);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p) {
  return o << mt(p.fi, p.se);
}
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(
    ostream& o, const C& c) {
  o << '[';
  for (auto it = c.cbegin(); it != c.cend(); ++it)
    o << *it << (next(it) != c.cend() ? ", " : "");
  return o << ']';
}
template <typename T>
void tprint(vector<vector<T>>& v, size_t width = 0, ostream& o = cerr) {
  if (!DEBUG) return;
  for (const auto& vv : v) {
    for (const auto& i : vv) o << setw(width) << i;
    o << endl;
  }
}

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

  string s; cin >> s;
  if (s.back() == 's') {
    s += "es";
  } else {
    s += "s";
  }
  cout << s << endl;
  
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 2e5 + 5;

int32_t main()
{
	IOS;
	int a;
	double d;
	cin >> a >> d;
	int b = round(d * 100);
	int ans = a * b;
	ans /= 100;
	cout << ans;
	return 0;
}

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

int main(void){
  string 	s;
  string	s1;
  string	s2;
  string 	t;
  string	t1;
  string	t2;
  int		c;
  int		i;
  int		j;
  int		max;
  
  cin >> s;
  cin >> t;

  s1 = s;
  s2 = s;
  t1 = t;
  t2 = t;
  
  c = 0;
  max = 0;
  for(i=0; i<s1.size() - t1.size() + 1; i++)
  {
    for(j=0; j<t1.size(); j++)
    {
      if(s1[i + j] == t1[j])
        c++;
    }
    if(max < c)
      max = c;
    c = 0;
  }
  cout << t1.size() - max;
  
  return 0;
}


Measured memory_bytes: 3616
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,c,d,x,y,z;
string s,t;
//

signed main() {
  RAPID;
  IN3(a,b,c);
  YES((b*10+c)%4==0);
}

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

int main(void) {
	string S, T;
	cin >> S >> T;
	int S_[26];
	int T_[26];
	for (int i = 0; i < 26; i++) {
		S_[i] = T_[i] = -1;
	}
	for (int i = 0; i < S.length(); i++) {
		if (S_[S[i] - 'a'] != -1 || T_[T[i] - 'a'] != -1) {
			if (S_[S[i] - 'a'] != T[i] - 'a' || T_[T[i] - 'a'] != S[i] - 'a') {
				cout << "No" << endl;
				return 0;
			}
		}
		else {
			S_[S[i] - 'a'] = T[i] - 'a';
			T_[T[i] - 'a'] = S[i] - 'a';
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 776
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String s = scanner.next();
        int len = s.length();
        StringBuilder sb = new StringBuilder(s.length());
        for (int i = 0; i < len; i++) {
            sb.append("x");
        }
        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 21844