akhauriyash/Code-Regression huggingface dataset:
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!();
    let m = get!();
    let x = get!();
    let y = get!();
    
    let mut xmax = x;
    let mut ymin = y;
    use std::cmp::{max,min};
    
    for _ in 0..n {
    	xmax = max(xmax, get!());
    }
    for _ in 0..m {
    	ymin = min(ymin, get!());
    }
    
    if xmax < ymin {
    	println!("No War");
    } else {
    	println!("War");
    }
    
}

Measured memory_bytes: 4352
#include <stdio.h>

int main (void){
    long long how_box;
    long long limit;
    scanf("%lld%lld",&how_box,&limit);
    long long loop1;
    long long ct=0;
    long long data[how_box];
    for(loop1=0;loop1<how_box;loop1++){
        scanf("%lld",&data[loop1]);
    }
    for(loop1=0;loop1<how_box-1;loop1++){
        if(loop1!=how_box-1){
            while(data[loop1]+data[loop1+1]>limit){
                if(data[loop1+1]>=(data[loop1]+data[loop1+1]-limit)){
                    ct+=((data[loop1]+data[loop1+1]-limit));
                    data[loop1+1]-=(data[loop1]+data[loop1+1]-limit);
                    
                }else if(data[loop1+1]!=0){
                    data[loop1+1]--;
                    ct++;
                }else if(data[loop1]>=(data[loop1]+data[loop1+1]-limit)){
                    ct+=(data[loop1]+data[loop1+1]-limit);
                    data[loop1]-=(data[loop1]+data[loop1+1]-limit);
                }else{
                    data[loop1]--;
                    ct++;
                }
            }
        }
    }
    printf("%lld\n",ct);
    
    return 0;

}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/












int N, M, A[201010], B[201010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> M;
    rep(i, 0, N) cin >> A[i];
    rep(i, 0, M) cin >> B[i];

    vector<int> ansand, ansor;
    int a = 0, b = 0;
    while (a < N and b < M) {
        if (A[a] == B[b]) {
            ansand.push_back(A[a]);
            ansor.push_back(A[a]);
            a++; b++;
        } else if (A[a] < B[b]) {
            ansor.push_back(A[a]);
            a++;
        } else {
            ansor.push_back(B[b]);
            b++;
        }
    }
    while (a < N) {
        ansor.push_back(A[a]);
        a++;
    }
    while (b < M) {
        ansor.push_back(B[b]);
        b++;
    }

    int A = ansand.size();
    int B = ansor.size();

    printf("%d %d\n", A, B);
    fore(i, ansand) printf("%d\n", i);
    fore(i, ansor) printf("%d\n", i);
}


Measured memory_bytes: 5048
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read() {
	int x=0,f=1; char ch=getchar();
	while(ch<'0' || ch>'9') { if(ch=='-') f=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=(x<<3)+(x<<1)+(ch^48); ch=getchar(); }
	return x * f;
}
const int N = 2e5+7, MOD = 1e9+7;
int n,cnt,ans;
int head[N],sz[N],p[N],fa[N];
struct Edge {
	int next,to;
}edge[N<<1];
inline void add(int u,int v) {
	edge[++cnt] = (Edge)<%head[u],v%>;
	head[u] = cnt;
}
int Pow(int x,int y) {
	int res = 1, base = x;
	while(y) {
		if(y&1) res = (res*base)%MOD; base = (base*base)%MOD; y >>= 1;
	}
	return res;
}
void Dfs(int u,int fath) {
	sz[u] = 1, fa[u] = fath;
	for(int i=head[u];i;i=edge[i].next) {
		int v = edge[i].to;
		if(v != fath) {
			Dfs(v,u); sz[u] += sz[v];
		}
	}
}
signed main()
{
	n = read();
	for(int i=1,u,v;i<=n-1;++i) {
		u = read(), v = read();
		add(u,v), add(v,u);
	}
	p[0] = 1;
	for(int i=1;i<=n;++i) p[i] = (p[i-1]<<1)%MOD;
	int inv = Pow(p[n],MOD-2);
	Dfs(1,0);
	for(int u=1;u<=n;++u) {
		int tot = (p[n-1]-1+MOD)%MOD;
		for(int i=head[u];i;i=edge[i].next) {
			int v = edge[i].to;
			if(v == fa[u]) tot = (tot - (p[n-sz[u]]-1+MOD)%MOD+MOD)%MOD;
			else tot = (tot - (p[sz[v]]-1+MOD)%MOD+MOD)%MOD;
		}
		ans = (ans+(tot*inv)%MOD)%MOD;
	}
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> H(N + 1);
  for (int i = 1; i <= N; i++)
    cin >> H[i];
  int res = 0;
  for (int i = 0; i < N; i++)
    if (H[i] < H[i + 1]) res += H[i + 1] - H[i];
  cout << res << '\n';
  return 0;
}


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

int fac(int x);

int main(){
  int N; cin >> N;
  int P[N], Q[N];
  for(int i=0;i<N;i++) cin >> P[i];
  for(int i=0;i<N;i++) cin >> Q[i];

  int a=0,b=0,n;

  for(int i=0;i<N-1;i++){
    n = fac(N-i-1);
    a += (P[i]-1)*n;
    b += (Q[i]-1)*n;
    for(int j=i+1;j<N;j++){
      if(P[i]<P[j]) P[j]--;
      if(Q[i]<Q[j]) Q[j]--;
    }
  }

  cout << abs(a-b) << endl;
  return 0;
}

int fac(int x){
  int tmp = 1;
  for(int i=1;i<=x;i++) tmp *= i;
  return tmp;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1e9 + 7;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
int main() {
    int n, q; cin >> n >> q;
    int s[n], t[n], x[n];
    rep(i, n) {
        cin >> s[i] >> t[i] >> x[i];
        t[i]--;
        s[i] -= x[i]; t[i] -= x[i];
    }
    int d[q]; rep(i, q) cin >> d[i];
    set<pii> se;
    rep(i, q) se.insert(pii(d[i], i));
    //for (auto e : se) cout << e.first << " " << e.second << endl;
    tuple<int, int, int> a[n]; rep(i, n) a[i] = tie(x[i], s[i], t[i]);
    sort(a, a + n);
    /*
    rep(i, n) {
        int x, s, t;
        tie(x, s, t) = a[i];
        cout << s << " " << t << " " << x << endl;
    }
     */
    int ans[q]; rep(i, q) ans[i] = -1;
    rep(i, n) { //O(N)
        int x, l, r;
        tie(x, l, r) = a[i];
        auto it = se.lower_bound(pii(l, -1)); //O(logSIZE)
        while (it != se.end()) { //exist
            if (it -> first > r) break;
            ans[it -> second] = x;
            se.erase(it++); //全部でQ回 whileと同じ回数
        }
        //for (auto e : se) cout << e.first << " "; cout << endl;
    }
    rep(i, q) cout << ans[i] << endl;
}


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

int main(){

  int N; cin >> N;
  double sum = 0;
  
  for(int i=0; i<N; i++){
    double x; string u; cin >> x >> u;
    
    if(u == "JPY"){
      //日本円
      sum += x;
    }else{
      //ビットコイン
      sum += x * 380000.0;
    }
  
  }
  
  cout << sum << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s; cin>>s;
  sort(s.begin(),s.end());
  for(char c='a'; c<'a'+26; c++){
    if(s.find(c)==-1){
      cout<<c;
      return 0;
    }
  }
  cout<<"None";
}

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

vector <int> edges[100000];

const long long MOD = 1000000007;

long long dfs(int v, int par, int K, bool exists_parent){
    long long ret = 1;
    long long color_num;
    if(exists_parent){
        color_num = K - 2;
    } else{
        color_num = K - 1;
    }
    for(auto u : edges[v]){
        if(u == par){
            continue;
        }
        ret *= color_num;
        ret = ret % MOD;
        color_num --;
    }
    for(auto u : edges[v]){
        if(u == par){
            continue;
        }
        ret *= dfs(u, v, K, true);
        ret = ret % MOD;
    }
    return ret;
}

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

    for(int i = 0; i < N - 1; i++){
        int a;
        int b;
        cin >> a >> b;
        edges[a - 1].push_back(b - 1);
        edges[b - 1].push_back(a - 1);
    }

    cout << (K * dfs(0, -1, K, false)) % MOD << endl;
    return 0;
}


Measured memory_bytes: 11520
#include <iostream>
using namespace std;
int main(){
  int a,b,n,cnt;
  while(cin >> a){
    cin >> b;
    n=a+b;
    cnt=0;
    while(n){
      n/=10;
      cnt++;
    }
    cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> mvec(size_t a){return vector<T>(a);}template<class T, class... Ts>auto mvec(size_t a, Ts... ts){return vector<decltype(mvec<T>(ts...))>(a, mvec<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}/* 重み付きUnionFind */struct WUnionFind {vector<int> par;vector<int> rank;WUnionFind(int n = 1) {init(n);}void init(int n = 1) {par.resize(n); rank.resize(n);for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;}int root(int x) {if (par[x] == x) {return x;}else {int r = root(par[x]);return par[x] = r;}}bool issame(int x, int y) {return root(x) == root(y);}bool merge(int x, int y) {x = root(x); y = root(y);if (x == y) return false;if (rank[x] < rank[y]) swap(x, y);if (rank[x] == rank[y]) ++rank[x];par[y] = x;return true;}};/* IO高速化 */void fastio(){ios::sync_with_stdio(false);cin.tie(NULL);}
/* ここからコード開始 */

int main(){
  fastio;
  ll N;
  cin >> N;
  auto a = mvec<ll>(N);
  for(auto&& i : a){
    cin >> i;
  }
  auto ans = mvec<ll>(N+1);
  auto ok = mvec<ll>(0);
  rem(i, N, 0){
    ll tmp{};
    for(ll j{2}; j*i <= N; j++){
      tmp+= ans[j*i];
      tmp%= 2;
    }
    ans[i] = (2 + a[i-1]%2 - tmp) % 2;
    if(ans[i]) ok.push_back(i);
  }
  cout << ok.size() << rt;
  ll sw{};
  for(auto&& i : ok){
    if(sw) cout << sp;
    cout << i;
    sw = 1;
  }
  if(sw) cout << rt;
}

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

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

    ll a[n];
    map<ll, int> m;
    ll cou = 0;
    for(ll i = 0; i < n; i++){
        cin >> a[i];
        auto itr = m.find(a[i]);
        if(itr == m.end()){
            m.insert(make_pair(a[i], 1));
        }else{
            m[a[i]]++;
            cou++;
        }
    }

    if(cou == 0){
        cout << n << endl;
    }else{
        ll k = cou / 2;
        if(cou % 2 != 0){
            k++;
        }

        cout << n - (k * 2) << endl;
    }
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
int n,m,k;
int main()
{
	cin>>n>>m>>k;
	for (int i=0;i<=n;i++)
	{
		for (int j=0;j<=m;j++)
		{
			int now=i*m+j*n-2*i*j;
			if (now==k)
			{
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
	return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int N = in.nextInt(), M = in.nextInt();
        int[] l = new int[N + 1], r = new int[N + 1];
        for (int i = 1; i < N + 1; i++) {
            l[i] = in.nextInt();// 1 <= l <= r <= M
            r[i] = in.nextInt();
        }

        @SuppressWarnings("unchecked")
        List<Integer>[] nByLen = new List[M + 1];
        for (int n = 1; n < N + 1; n++) {
            int len = r[n] - l[n] + 1;
            if (nByLen[len] == null) {
                nByLen[len] = new ArrayList<>();
            }
            nByLen[len].add(n);
        }

        int accum = N;

        Fenwick F = new Fenwick(M);
        for (int d = 1; d < M + 1; d++) {
            int sum = accum;
            for (int e = d; e < M + 1; e += d) {
                sum += F.accum(e);
            }
            System.out.println(sum);
            if (nByLen[d] != null) {
                accum -= nByLen[d].size();
                for (int i : nByLen[d]) {
                    F.add(l[i], 1);
                    F.add(r[i] + 1, -1);
                }
            }
        }
    }
}

class Fenwick {
    private final int[] fenwick;

    public Fenwick(int n) {
        fenwick = new int[n + 1];
    }

    public int accum(int i) {
        int sum = 0;
        for (; i >= 0; i = (i & (i + 1)) - 1) {
            sum += fenwick[i];
        }
        return sum;
    }

    public int sum(int begin, int end) {
        return accum(end) - accum(begin - 1);
    }

    public void add(int i, int a) {
        for (; i < fenwick.length; i = i | i + 1) {
            fenwick[i] += a;
        }
    }

    @Override
    public String toString() {
        int N = fenwick.length;
        long[] raw = new long[N];
        long[] acc = new long[N];
        for (int i = 1; i < N; i++) {
            acc[i] = accum(i);
            raw[i] = acc[i] - acc[i - 1];
        }
        StringBuilder s = new StringBuilder();
        s.append("Fenwick [\n");
        s.append(" fenwick=" + Arrays.toString(fenwick) + "\n");
        s.append(" accum  =" + Arrays.toString(acc) + "\n");
        s.append(" raw    =" + Arrays.toString(raw) + "\n]");
        return s.toString();
    }
}

Measured memory_bytes: 142660
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, l[101], sum;

int main(){
	cin >> n;
	sum = 0;
	for(ll i  = 1; i <= n; i++){
		cin >> l[i];
		sum += l[i];
	}
	
	string ans = "Yes";
	for(ll i = 1; i <= n; i++){
		if(2*l[i] >= sum){
			ans = "No";
			break;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import numpy as np

N,M,X = map(int, input().split())

values = []
scores = []
for _ in range(N):
    tmp = list(map(int, input().split()))
    values.append(tmp[0])
    scores.append(tmp[1:])
scores = np.array(scores)
values = np.array(values)

def df(arg, score, tmp,args):
    tmps = []
    if arg==N:
        if len(np.where(score>=X)[0]) == M:
            return tmp
        else:
            return 0
    check = df(arg+1, score, tmp, args)
    if check:
        if type(check)==list:
            tmps.extend(check)
        else:
            tmps.append(check)
    check = df(arg+1, score+scores[arg], tmp+values[arg], args+[arg])
    if check:
        if type(check)==list:
            tmps.extend(check)
        else:
            tmps.append(check)
    if tmps == []:
        return 0
    else:
        return tmps

tmp = df(0, np.zeros(M), 0, [])
if tmp != 0:
    print(min(tmp))
else:
    print(-1)



Measured memory_bytes: 27440
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int main(){
  int n,s,t,min=1e9,a,b,c,i,j,d[410][410];
  scanf("%d %d %d",&n,&s,&t);
  for(i=0;i<410*410;i++)d[i/410][i%410]=1e9;
  d[0][0]=0;
  while(n--){
    scanf("%d %d %d",&a,&b,&c);
    for(i=400;i--;){
      for(j=400;j--;)d[i+a][j+b]=MIN(d[i+a][j+b],d[i][j]+c);
    }
    for(i=1;s*i<410&&t*i<410;i++){
      if(d[s*i][t*i]==0)continue;
      min=MIN(d[s*i][t*i],min);
    }
  }
  printf("%d\n",min-1e9?min:-1);
  return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <cstdio>

using namespace std;

const long long INF = 100000000;
const long long MOD = 1000000007;

std::vector<bool> IsPrime;

void sieve(size_t max)
{
  if (max + 1 > IsPrime.size())
  {                                // resizeで要素数が減らないように
    IsPrime.resize(max + 1, true); // IsPrimeに必要な要素数を確保
  }
  IsPrime[0] = false; // 0は素数ではない
  IsPrime[1] = false; // 1は素数ではない

  for (size_t i = 2; i * i <= max; ++i)     // 0からsqrt(max)まで調べる
    if (IsPrime[i])                         // iが素数ならば
      for (size_t j = 2; i * j <= max; ++j) // (max以下の)iの倍数は
        IsPrime[i * j] = false;             // 素数ではない
}

class Node{
public:
  long long w;
  long long v;
};

class UnionFind{
public:
  vector<long long> parent;
  UnionFind(long long N){
    parent.resize(N + 1);
    for (int i = 0; i < N;i++){

    }
  }
};

int main()
{
  long long N;
  cin >> N;
  vector<long long> dp(N + 1, 0);
  dp[0] = 2;
  dp[1] = 1;
  for (long long i = 2; i <= N; i++)
  {
    dp[i] = dp[i - 1] + dp[i - 2];
  }
  cout << dp[N] << endl;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        String s = sc.next();
        String t = sc.next();
        if (s.equals(t.substring(0, t.length() - 1))) {
            out.println("Yes");
        }
        else {
            out.println("No");
        }
        out.flush();
    }
}

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

#define int long long

signed main() {
    int a;
    cin >> a;
    double b;
    cin >> b;
    int ib = b * 100 + 0.5;
    a *= ib;
    a /= 100;
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 3676
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int a, b;
    cin>>a>>b;
    string x ="", y="";
    forn(i,b)   x += (a+'0');
    forn(i,a)   y += (b+'0');
    if(x<y) cout<<x<<endl;
    else    cout<<y<<endl;
    return 0;
}



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

namespace _0325
{
    class Program
    {
        static void Main(string[] args)
        {
            int[][] recs = new int[6][];
            for (int i = 0; i < recs.Length; i++)
            {
                recs[i] = RArInt().OrderBy(x => x).ToArray();
            }
            recs = recs.OrderBy(x => x[0]).ThenBy(x => x[1]).ToArray();

            bool pair1 = recs[0].SequenceEqual(recs[1]);
            bool pair2 = recs[2].SequenceEqual(recs[3]);
            bool pair3 = recs[4].SequenceEqual(recs[5]);

            bool res = false;
            if (pair1 && pair2 && pair3)
            {
                if (recs[0][0] == recs[2][0] && recs[0][1] == recs[4][0] && recs[2][1] == recs[4][1])
                {
                    res = true;
                }
            }
            Console.WriteLine(res ? "yes" : "no");


        }
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



Measured memory_bytes: 20344
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while (true){
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == 0 && b==0) break;
            if ( a > b){
                b = swap(a, a=b);
            }
            System.out.println(a + " " +b);
        }
    }

    static int swap(int a, int b){
        return a;
    }

}


Measured memory_bytes: 35996
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	boolean check(int m, long[] A) {
		int n = A.length;
		class S implements Comparable<S> {
			long id;
			long v;

			public S(long id_, long v_) {
				id = id_;
				v = v_;
			}

			public int compareTo(S o) {
				return Long.compare(-this.id, -o.id);
			};
		}
		PriorityQueue<S> pq = new PriorityQueue<>();
		for (int i = 1; i < A.length; ++i) {
			if (A[i] > A[i - 1])
				continue;
			while (!pq.isEmpty() && pq.peek().id > A[i]) {
				pq.poll();
			}
			long cur = A[i];
			while (!pq.isEmpty() && pq.peek().id == cur && pq.peek().v == m - 1) {
				pq.poll();
				--cur;
			}
			if (cur < 1)
				return false;
			if (pq.isEmpty() || pq.peek().id < cur) {
				pq.add(new S(cur, 1));
			} else {
				pq.add(new S(cur, pq.poll().v + 1));
			}
		}
		return true;
	}

	void run() {
		Scanner sc = new Scanner();
		int n = sc.nextInt();
		long[] A = new long[n];
		boolean flag = true;
		for (int i = 0; i < n; ++i) {
			A[i] = sc.nextLong();
			if (i > 0)
				flag &= A[i] > A[i - 1];
		}
		if (flag) {
			System.out.println(1);
			return;
		}
		int ok = n;
		int ng = 1;
		while (ok - ng > 1) {
			int m = (ok + ng) / 2;
			if (check(m, A)) {
				ok = m;
			} else {
				ng = m;
			}
		}
		System.out.println(ok);
	}

	void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

}

class Scanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		return (int) nextLong();
	}
}


Measured memory_bytes: 63324
#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<limits.h>
#include<cmath>
#include<queue>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
typedef long long ll;

int main(){

  int n,k; cin >> n >> k;
  vector<int> h(n);rep(i,n){cin>>h[i];}
  int ans=0;
  rep(i,n){
    if (h[i]>=k){ans++;}
  }

  cout << ans;

  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define li long long int
#define ld long double
#define F first
#define S second
//const li M = 1000000007;
#define ld long double
li dx[]={-1,1,0,0};
li dy[]={0,0,-1,1};

int main()
{
	li N,K,i,j; cin>>N>>K;
	vector<li> A(N);
	for(i=0;i<N;i++)
	cin>>A[i];
	sort(A.begin(),A.end());
	for(i=1;i<N;i++)
	A[i]=A[i-1]+A[i];
	cout<<A[K-1];
	
}



Measured memory_bytes: 3628
use std::collections::VecDeque;
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let n: usize = read();
    let mut v = VecDeque::new();
    for _ in 0..n {
        let command: String = read();
        match &*command {
            "insert" => {
                let value: u32 = read();
                v.push_front(value);
            }
            "delete" => {
                let value: u32 = read();
                match v.iter().position(|&x| x == value) {
                    Some(i) => {
                        v.remove(i);
                        ()
                    }
                    None => (),
                }
            }
            "deleteFirst" => {
                v.pop_front();
                ()
            }
            "deleteLast" => {
                v.pop_back();
                ()
            }
            _ => {}
        }
    }
    while !v.is_empty() {
        let value: u32 = v.pop_front().unwrap();
        if !v.is_empty() {
            print!("{} ", value);
        } else {
            println!("{}", value);
        }
    }
}



Measured memory_bytes: 9960
#include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-10)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


int N;


bool solve(){
	if((N%10) == ((N/10)%10) && ((N/10)%10) == ((N/100)%10)) return true;
	if(((N/10)%10) == ((N/100)%10) && ((N/100)%10) == ((N/1000)%10)) return true;
	return false;
}


signed main(){
	cin >> N;

	if(solve()) Yes;
	else No;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int p[100005];

int root(int x) {return p[x] < 0 ? x : p[x] = root(p[x]);}

void mer(int x, int y) {
    if ((x = root(x)) == (y = root(y))) return;
    if (p[x] > p[y]) swap(x, y);
    p[x] += p[y];
    p[y] = x;
}

int main() {
    ios::sync_with_stdio(false);
    int n, m, k, a[100005] = {}, b[100005] = {}, c[100005] = {}, d[100005] = {}, e[100005] = {};
    vector<int> g[100005] = {}, h[100005] = {};
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) p[i] = -1;
    for (int i = 0; i < m; i++) cin >> a[i] >> b[i], g[a[i]].push_back(b[i]), g[b[i]].push_back(a[i]), mer(a[i], b[i]);
    for (int i = 0; i < k; i++) cin >> c[i] >> d[i], h[c[i]].push_back(d[i]), h[d[i]].push_back(c[i]);
    for (int i = 1; i <= n; i++) e[i] = -p[root(i)];
    for (int i = 1; i <= n; i++) {
        for (int j : g[i]) if (root(i) == root(j)) e[i]--;
        for (int j : h[i]) if (root(i) == root(j)) e[i]--;
        cout << e[i] - 1 << ' ';
    }
}


Measured memory_bytes: 16660
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<P>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
template <typename T>inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}

int main(){
    ll n;cin>>n;
    cout<<n*n*n<<endl;
    return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
//const int MAX=;



int main(){
	int H,W;
	cin>>H>>W;
	char B[1005][1005];
	rep(i,H)rep(j,W)cin>>B[i][j];
	
	int d[1005][1005];
	queue<P> q;
	rep(i,H)rep(j,W){
		if(B[i][j]=='#'){
		d[i][j]=0;
		q.push(make_pair(i,j));
		}
		else d[i][j]=-1;
	}
	vector<int> dx={1,0,-1,0};
	vector<int> dy={0,1,0,-1};
	while(!q.empty()){
		P p=q.front();
		int x=p.first;
		int y=p.second;
		q.pop();
		rep(t,4){
			int nx=x+dx[t];
			int ny=y+dy[t];
			if(0<=nx && nx<H && 0<=ny && ny< W && d[nx][ny]==-1){
				d[nx][ny]=d[x][y]+1;
				q.push(make_pair(nx,ny));
			}
			
		}
	}
	int ans=0;
	rep(i,H)rep(j,W)ans=max(ans,d[i][j]);
	
	cout<<ans<<endl;
	
}

Measured memory_bytes: 13328
'use strict';
(function(input){
  
  const compose=Symbol();
  
  Function.prototype[compose]=function(outerFunc){
    const that=this;
    return function(I){
        return outerFunc(that(I));
      }
  }
  
  function func0(Input){
    return input.
    split(/\s+/).
    map(x=>x-0);
  }
  
  function func1(ABCK){
    const [A,B,C,K]=ABCK;
    const BCKS=[B,C,Math.max(K-A,0),Math.min(A,K)];
    return BCKS;
  }
  
  function func2(BCKS){
    const [B,C,K,S]=BCKS;
    const CKS=[C,Math.max(K-B,0),S];
    return CKS;
  }
  
  function func3(CKS){
    const [C,K,S]=CKS;
    const result=S-K;
    return result;
  }
  
  console.log(
    func0[compose](
      func1
    )[compose](
      func2
    )[compose](
      func3
    )(input)
  );
})(require('fs').readFileSync('/dev/stdin','utf8'));


Measured memory_bytes: 29688
//
//AtCoder Beginner Contest 115
//C
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    vector<ll> h(n);
    REP(i, n) cin >> h[i];
    
    sort(ALL(h));
    ll ans = 1e12;
    REP(i,n-k+1){
        ans = min(ans, h[i+k-1]-h[i]);
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
 
#define PB	push_back
#define ALL(x)	(x).begin(), (x).end()
#define ALLR(x)	(x).rbegin(), (x).rend()
#define MP	make_pair
 
#define debug(_x)		cerr << #_x << '=' << (_x) << endl;
#define debug2(_x, _y)	cerr << #_x << '=' << (_x) << ' ' << #_y << '=' << (_y) << endl;
#define debugn(_a)		cerr << #_a << ": "; for (const auto _x: _a) cerr << (_x) << ' '; cerr << endl;

#define HERE debug(__LINE__);

#define FAST_IO ios::sync_with_stdio(false); cin.tie(0)

#define int long long int

typedef pair<int, int> ii;
typedef pair<pair<int, int>, int> iii;
typedef vector<int> vi;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX>>1;
const int NINF = LONG_LONG_MIN/2;

const int N = 100009;
vi adj[N];
bool vis[N];
int dist[N];

void dfs(int v) {
	vis[v] = true;
	for (int u: adj[v]) {
		if (!vis[u]) {
			dfs(u);
		}
		dist[v] = max(dist[v], dist[u]+1);
	}
}

int32_t main() {
	FAST_IO;
	
	int n, m;
	cin >> n >> m;

	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
	
		adj[x].PB(y);
	}
	
	for (int i = 1; i <= n; i++) {
		if (!vis[i]) {
			dfs(i);
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		ans = max(dist[i], ans);
	}
	
	cout << ans << endl;
}

// g++ -Wall -Wextra -Wshadow -fsanitize=undefined


Measured memory_bytes: 8704
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
const int MOD=1e9+7;
const int INF=1e15;

signed main(){
    string S;
    int K;cin>>S>>K;
    int c=S.size();
    vector<vector<int>>dpk(c+1,vector<int>(K+1,0));
  	vector<vector<int>>dpm(c+1,vector<int>(K+1,0));
  	dpk[1][1]=S[0]-'0'-1;
  	dpk[1][0]=1;
  	dpm[1][1]=1;
    for(int i=1;i<=c;i++){
        dpk[i][0]+=dpk[i-1][0];
      	for(int j=1;j<=K;j++){
            dpk[i][j]+=dpk[i-1][j-1]*9+dpk[i-1][j];
            if(S[i-1]!='0'){
                int d=S[i-1]-'0';
              	dpk[i][j]+=dpm[i-1][j]+dpm[i-1][j-1]*(d-1);
                dpm[i][j]+=dpm[i-1][j-1];
            }
            else{
                dpm[i][j]=dpm[i-1][j];
            }
        }
    }
  	cout<<dpk[c][K]+dpm[c][K]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
//const int MOD = 1e9 + 7;

ll N, M, K, Q, X;
string S;

int main() {
    cin >> X;

    ll ans = 0;
    ans += X / 500LL * 1000LL;
    X -= X / 500LL * 500LL;
    cout << ans + X / 5LL * 5LL << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        char S[],T[];
        Scanner input=new Scanner(System.in);
        S=input.next().toCharArray();
        T=input.next().toCharArray();
        int count=0;
        for(int i=0;i<3;i++)
        {
            if(S[i]==T[i])
            {
                
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 23636
//my vegetable has exploded. :(
#include<bits/stdc++.h>
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MM(x,y) memset(x,y,sizeof(x))
#define MCPY(a,b) memcpy(a,b,sizeof(b))
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=b;i>=a;i--)
#define fi first
#define se second
using namespace std;
#define int long long

inline int quickpow(int m,int n,int p){int b=1;while(n){if(n&1)b=b*m%p;n=n>>1;m=m*m%p;}return b;}
inline int getinv(int x,int p){return quickpow(x,p-2,p);}
inline int read(void){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){f=ch=='-'?-1:1;ch=getchar();}
    while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
    return x * f;
}
const int MAXN = 3e5+100;
int n,a[MAXN],pos[MAXN],premax[MAXN],sufmin[MAXN];
///------------------head------------------
signed main(signed argc, char *argv[]){
    n = read();
    rep(i,1,n) a[i] = read();
    premax[1] = a[1]; sufmin[n] = a[n];
    for (int i = 2; i <= n; ++i) premax[i] = max(premax[i-1],a[i]);
    for (int i = n - 1; i >= 1; --i) sufmin[i] = min(sufmin[i+1],a[i]);
    bool isok = 1;
    for (int i = 2; i <= n - 1; ++i) if (a[i] != i && a[i] < premax[i-1] && a[i] > sufmin[i+1]) isok = 0;
    for (int i = 1; i <= n - 1; ++i) if (premax[i] != i){
        int d = a[i] == i,dd = (a[i+1] == i+1);
        isok = (d == dd) ? 0 : isok;
    } 
    printf("%s\n",isok?"Yes":"No");
    return 0;
 }

/* Examples: */
/*

*/

/*

*/


Measured memory_bytes: 9728
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int X[N];
    int sum;
    for(int i=0; i<N; i++){
        cin >> X[i];
    }
    int minD;
    sort(X,X+N);
    for(int p=X[0]; p<=X[N-1]; p++){
        sum=0;
        for(int i=0; i<N; i++){
            sum+=(p-X[i])*(p-X[i]);
        }
        if(p==X[0]) minD=sum;
        else minD=min(minD,sum);
    }
    cout << minD;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <tuple>
#include <deque>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <unordered_set>
#define int long long
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()

using namespace std;

const int MOD = 1e9 + 7;
const int INF = 1e9;

void fast()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

signed main()
{
	fast();
	int x;
	cin >> x;
	cout << 1 - x << '\n';
	return 0;
}

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

#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define vint vector<int>

int main(){
    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];
    int res=0;
    rep(i,n){
        if(a[i]+res!=i+1) res++;
    }
    if(res==n) cout<<-1<<endl;
    else cout<<res<<endl;
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 1e9+7;

int main() {
    int N;
    cin >> N;
    vector<pair<LL, LL>> A(N + 1, pair<LL, LL>(LINF, 0));
    FOR(i, 1, N + 1) {
        LL a;
        cin >> a;
        A[i] = make_pair(a, i);
    }

    sort(ALL(A), greater<pair<LL, int>>());
    vector<vector<LL>> dp(N + 1, vector<LL>(N + 1, 0));

    FOR(i, 1, N + 1) {
        LL act = A[i].first;
        LL index = A[i].second;

        dp[i][0] = dp[i - 1][0] + abs(act*(index - i));
        dp[0][i] = dp[0][i - 1] + abs(act*(N - i + 1 - index));
    }

    FOR(i, 2, N + 1) {
        LL act = A[i].first;
        LL index = A[i].second;
        FOR(j, 1, i) {
            LL x = act*abs(index - (i - j));
            LL y = act*abs(N - j + 1 - index);
            LL sl = dp[i - j - 1][j] + x;
            LL sr = dp[i - j][j - 1] + y;
            dp[i - j][j] = max(sl, sr);
        }
    }

    LL res = 0;
    REP(i, N + 1) {
        res = max(res, dp[i][N - i]);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 34660
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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


int main(){
  
  ll n; cin >> n; ll num = 0;
  
  rep(i,100000000){
    if(n <= i*(i+1)/2){
      num = i;
      break;
    }
  }
  
  rep(i,num){
    if(i != num*(num+1)/2 - n -1){
      cout << i+1 << ' ';
    }
    
  }
  
  cout << endl;
  
  
}

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

int main(){
    int a,b; cin >> a >> b;
    int ans = 0;
    int tap = 1;
    while(tap < b){
        tap += a-1;
        ans++;
    }
    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n, k; cin >> n >> k;
	string s; cin >> s;
	int ans = 0;
	rep(i, 0, n - 2)
	{
		if (s[i] == s[i + 1])++ans;
	}
	ans = min(n - 1, ans + k * 2);
	cout << ans << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  char a;
  cin >> a;
  if(a == 'a' || a =='e' || a == 'u' || a == 'i' || a == 'o') cout << "vowel" << endl;
  else cout << "consonant" << endl;
  return 0;
}

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

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

vector<pair<ll,int>> factorize(ll n){
  vector<pair<ll,int>> res;
  for(ll i=2; i*i<=n; i++){
    if(n%i) continue;
    res.emplace_back(i,0);
    while(n%i==0){
      n /= i;
      res.back().second++;
    }
  }
  if(n != 1) res.emplace_back(n,1);
  return res;
}
  

main(){
  ll a,b;
  cin >> a >> b;
  ll g =gcd(a,b);
  auto f=factorize(g);
  int s=f.size() +1;
  cout << s << endl;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
truely_loved_food = {x for x in range(m + 1)}
for i in range(n):
    li = list(map(int, input().split()))
    k=li[0]
    loved_food = set(li[1:])
    truely_loved_food = truely_loved_food & loved_food
print(len(truely_loved_food))

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;

int main() {
    int N, i;
    cin >> N >> i;
    cout << N - i + 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	while(true){
		int n;
		cin>>n;
		if(n==0)break;
		for(int i=0;i<n;i++){
			int a,b,c,d,e,f,g,h;
			cin>>a>>b>>c>>d>>e>>f>>g>>h;
			cout<<a*e-b*f-c*g-d*h<<" ";
			cout<<a*f+b*e+c*h-d*g<<" ";
			cout<<a*g+c*e+d*f-b*h<<" ";
			cout<<a*h+d*e+b*g-c*f<<endl;
		}
	}
}			



Measured memory_bytes: 3092
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");

  	var N = parseInt(input[0], 10);
	var tmp = input[1].split(" ");
	
  	var dif = 0;
  	var sum = 0;
  	var pre = 0;
  	var cur = 0;
  
  	for (var i = 0; i < N; i++) {
		cur = parseInt(tmp[i], 10);

      	if (pre !== 0) {
          	if (pre + dif > cur) {
              	
              	dif = pre + dif - cur;
              	sum = sum + dif;
            } else {
              dif = 0;
            }
        }
      	pre = cur;      	
	}
  
	//出力
	console.log('%d',sum);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 49000
n = int(input())

count = 0
for i in range(1,n+1):
  temp_count = 0
  if i%2 == 0:
    continue
  for j in range(1,i+1):
    if i%j == 0:
      temp_count += 1
  if temp_count == 8:
    count += 1
    
print(count)


Measured memory_bytes: 9064