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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(a) int((a).size())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define inin(a, n, i) memset(a, i, sizeof(a[0])*(n))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define trav(x, c) for(auto& x : c)
#define rep(i, n) for(int i = 0; i < n; i++)
#define repa(i, b, e) for(int i = (b)-((b)>(e)); i != (e)-((b)>(e)); i += 1-2*((b)>(e)))
	
template<class T> bool chkmax(T &x, T y) { return x < y ? x = y, true : false; }
template<class T> bool chkmin(T &x, T y) { return x > y ? x = y, true : false; }
template<class A, class B> A cvt(B x) { stringstream s; s << x; A r; s >> r; return r; }

void read() {}
void print() {}
template<class T, class... Args> void read(T& a, Args&... args) { cin >> a; read(args...); }
template<class T, class... Args> void print(T a, Args... args) { cout << a << ' '; print(args...); }
template<class... Args> void println(Args... args) { print(args...); cout << '\n'; }

#define debug(args...) { string s_(#args); replace(all(s_), ',', ' '); stringstream ss_(s_); istream_iterator<string> it_(ss_); cerr_(it_, args); }
void cerr_(istream_iterator<string> it) { (void) it; }
template<class T, class... Args> void cerr_(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << endl; cerr_(++it, args...); }

template<class T, class S>  ostream& operator<<(ostream& os, const pair<T, S>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<class T> ostream& operator<<(ostream &os, const set<T> &s) { os << '{'; string sep; for (const auto &x : s) os << sep << x, sep = ", "; return os << '}'; }
template<class T, class S> ostream& operator<<(ostream &os, const map<T, S> &m) { os << '{'; string sep; for (const auto &x : m) os << sep << x, sep = ", "; return os << '}'; }
template<class T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }

const int INF = 0x3F3F3F3F;
const int MAXN = (int) 1e6;
const int MOD = (int) 1e9+7;

//=========================

void run_test() {
    int n; read(n);
    vi a(n); rep(i, n) read(a[i]);
	ll ans = 0;
    repa(i, 1, n) if(a[i-1] > a[i]) ans += a[i-1] - a[i], a[i] = a[i-1];
    println(ans);
}

//=========================

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//int t_ = 1, t__; cin >> t__; while(t_ <= t__) { cout << "Case #" << t_++ << ": "; run_test(); }
	// int t_; cin >> t_; while(t_--) run_test();
	run_test();
	return 0;	
}


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

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	map<int, int> need, real;
	int n, m, x;
	scanf("%d", &n);
	REP(i, 0, n) scanf("%d", &x), real[x]++;
	scanf("%d", &m);
	REP(i, 0, m) scanf("%d", &x), need[x]++;
	for (auto u : need)
		if (real[u.x] < u.y)
		{
			puts("NO");
			return 0;
		}
	puts("YES");
	return 0;
}


Measured memory_bytes: 18944
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(
    a: usize,
    b: usize,
    c: usize,
    x: usize,
    );
    let mut count = 0;
    for i in 0..a + 1 {
        for j in 0..b + 1 {
            for k in 0..c + 1 {
                let total = 500 * i + 100 * j + 50 * k;
                if total == x {
                    count += 1;
                }
            }
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 4352
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#define int long long

#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)

#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()

#define mi(N) int N; cin >> N;
#define ms(s) string s; cin >> s;
#define md(d) double d; cin >> d;
#define mv(v, N) vi v(N); rep(N)cin >> v[i];

#define mod 1000000007
#define out_of_grid(x, y) x < 0 || y < 0 || x >= h || y >= w

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

namespace mp = boost::multiprecision;
using INT = mp::cpp_int;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

template<typename T>
void say(vector<T> s, char r) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << r << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("yes");
	else say("no");
}

void Yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

void YN(bool b) {
	if (b)say("YES");
	else say("NO");
}

void Yay(bool b) {
	if (b)say("Yay!");
	else say(":(");
}

template<typename T>
void maxi(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void mini(T& a, T b) {
	a = min(a, b);
}

template<typename T>
vector<vector<T>> fill_vector(int h, int w, T val) {
	vector<vector<T>> ret;
	vector<T> v(w, val);
	rep(h)ret.push_back(v);
	return ret;
}



signed main() {
	mi(n);
	vvi e(n);
	vi ans(n, 0);
	rep(n - 1) {
		mi(a);
		mi(b);
		e[--a].push_back(--b);
		e[b].push_back(a);
	}
	mv(c, n);
	sort(rev(c));
	auto it = c.begin();
	queue<pii> q;//{to,from}
	rep(n) {
		if (e[i].size() > 1) {
			ans[i] = *(it++);
			for (int x : e[i]) {
				if (e[x].size() > 1)q.push({ x,i });
			}
			break;
		}
	}
	while (!q.empty()) {
		pii p = q.front();
		q.pop();
		ans[p.first] = *(it++);
		for (int x : e[p.first]) {
			if (x == p.second)continue;
			if (e[x].size() > 1)q.push({ x,p.first });
		}
	}
	for (int& x : ans) {
		if (x == 0)x = *(it++);
	}
	say(accumulate(c.begin()+1, c.end(), 0ll));
	say(ans, ' ');
}

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


#define ll              long long
#define pb              push_back
#define nn           cout << "\n";


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

    ll t,b,j,c,d,e,f=0,i,n=0,k,m=0,w=0;

   cin>>b>>c;
   d=b%c;
   e=abs(d-c);
   

   cout<<min(e,d);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first

string dst__; stringstream dss__;
#define DBG(...) dst__=#__VA_ARGS__;replace(dst__.begin(),dst__.end(),',',' ');dss__.str("");dss__.clear(stringstream::goodbit); dss__<<dst__; debug(dss__,__VA_ARGS__);
inline void debug(stringstream& ds){cerr<<endl;return;}
template<typename F, typename... R>void debug(stringstream& ds,const F& f, const R&... r){string n; ds>>n; cerr<< n <<'='<<f<<' '; debug(ds,r...);}

typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
typedef pair<int,int>PI; typedef vector<int> VI;
constexpr LL LINF=334ll<<53; constexpr int INF=15<<26; constexpr LL MOD=1E9+7;

int comp(VI &a, int pos, int s){
    if((a[pos-1]<=s and a[pos]<= s) or (a[pos]<=s and a[pos+1]<=s)) return 1;
    if((a[pos-1]>s and a[pos]>s) or (a[pos]>s and a[pos+1]>s)) return -1;
    return 0;
}

bool check(int s, VI &a){
    int n=((int)a.size()+1)/2;
    for(int i=0; i<n; i+=1){
        int p=comp(a,n-1+i,s),q=comp(a,n-1-i,s);
        if(p==1 or q==1) return true;
        if(p==-1 or q==-1) return false;
    }
    int res=0;
    if(a[0]<=s)++res;
    if(a[n-1]<=s)++res;
    if(a[a.size()-1]<=s)++res;
    return res>=2;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    VI a(2*n-1);
    for(int i=0; i<2*n-1; ++i){
        cin >> a[i];
    }
    int l=0, u=2*n;
    while(u-l>1){
        int mid=(l+u)/2;
        if(check(mid,a))u=mid;
        else l=mid;
    }

    cout << u << "\n";
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

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

  reps1(i, n+1) {
    ll ans = 0;
    reps1(x, ll(sqrt(i))) {
      reps1(y, ll(sqrt(i))) {
        ll judge = (x+y)*(x+y) - 4 * (x*x + y*y + x*y - i);
        // cout << i << " " << x << " " << y << " " << judge << endl;
        if (ll(sqrt(judge)) * ll(sqrt(judge)) != judge) continue;
        // cout << "a";
        if (-(x+y)*(x+y) + judge <= 0) continue;
        // cout << "b";
        // cout << -(x+y)*(x+y) + judge << endl;
        if ((-(x+y)*(x+y) + judge) % 2 != 0) continue;
        // cout << "c" << endl;
        ans++;

      }
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
  int m;
  cin >> m;
  vector<int> nodes;
  vector<pair<int, int>> child;
  int root = -1;
  for (int i = 0; i < m; i++){
    string q;
    cin >> q;
    if (q == "insert"){
      int k;
      cin >> k;
      if (!nodes.empty()){
        int v = 0;
        while (1){
          if (k < nodes[v]){
            if (child[v].first != -1){
              v = child[v].first;
            } else {
              child[v].first = nodes.size();
              break;
            }
          } else {
            if (child[v].second != -1){
              v = child[v].second;
            } else {
              child[v].second = nodes.size();
              break;
            }
          }
        }
      }
      nodes.push_back(k);
      child.push_back(make_pair(-1, -1));
    }
    if (q == "find"){
      int k;
      cin >> k;
      if (nodes.empty()){
        cout << "no" << endl;
      } else {
        int v = 0;
        while (1){
          if (k < nodes[v]){
            if (child[v].first == -1){
              cout << "no" << endl;
              break;
            } else {
              v = child[v].first;
            }
          } else if (k > nodes[v]){
            if (child[v].second == -1){
              cout << "no" << endl;
              break;
            } else {
              v = child[v].second;
            }
          } else {
            cout << "yes" << endl;
            break;
          }
        }
      }
    }
    if (q == "print"){
      //Inorder
      if (!nodes.empty()){
        stack<int> S;
        vector<int> t(nodes.size(), 0);
        S.push(0);
        while (!S.empty()){
          int v = S.top();
          S.pop();
          if (t[v] == 1){
            cout << ' ' << nodes[v];
          }
          if (t[v] == 0){
            S.push(v);
            if (child[v].second != -1){
              S.push(child[v].second);
            }
            S.push(v);
            if (child[v].first != -1){
              S.push(child[v].first);
            }
          }
          t[v]++;
        }
      }
      cout << endl;
      //Preorder
      if (!nodes.empty()){
        stack<int> S;
        vector<int> t(nodes.size(), 0);
        S.push(0);
        while (!S.empty()){
          int v = S.top();
          S.pop();
          if (t[v] == 0){
            cout << ' ' << nodes[v];
          }
          if (t[v] == 0){
            S.push(v);
            if (child[v].second != -1){
              S.push(child[v].second);
            }
            S.push(v);
            if (child[v].first != -1){
              S.push(child[v].first);
            }
          }
          t[v]++;
        }
      }
      cout << endl;
    }
  }
}


Measured memory_bytes: 9124
def draw
   mp=gets.split(' ').map(&:to_i)
   if mp[0]==0 && mp[1]==0 then return -1 end
   for y in 1..mp[0] do
      for x in 1..mp[1] do
         if (x+y)%2==0 then print "#" else print "." end
      end
      print "\n"
   end
   print "\n"
   return 0
end

ret=draw
until ret==-1 do
    ret=draw
end

Measured memory_bytes: 8692
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
typedef int Weight;
struct Edge {
	int src, dst;
	Weight weight;
	Edge(int src_, int dst_, Weight weight_) :
		src(src_), dst(dst_), weight(weight_) { }
	Edge(int src_, int dst_) :
		src(src_), dst(dst_) {

	}
};
pair<bool, vector<Weight>> spfa(const int v_num, const vector<vector<Edge>>&es, const vector<int> start) {
	vector<Weight>diss(v_num, INT_MAX);
	queue<int>que;
	vector<bool>use(v_num);
	vector<int>count(v_num);
	for (int i = 0; i < start.size(); ++i) {
		const int  astart = start[i];
		que.emplace(astart);
		diss[astart] = 0;
	}
	while (!que.empty()) {
		int src(que.front());
		que.pop();
		use[src] = false;
		for (auto e : es[src]) {
			const int d = e.dst;
			if (diss[src] + e.weight < diss[d]) {
				diss[d] = diss[src] + e.weight;
				if (!use[d]) {
					use[d] = true;
					count[d]++;
					if (count[d] >= v_num)return make_pair(false, vector<Weight>());
					que.emplace(d);
				}
			}
		}
	}
	return make_pair(true, diss);
}
int main() {
	int N, M, K; cin >> N >> M >> K;
	vector<vector<Edge>>es(N);
	for (int i = 0; i < M; ++i) {
		int s, t, l; cin >> s >> t >> l; l *= 2; s--; t--;
		es[s].emplace_back(s, t, l);
		es[t].emplace_back(t, s, l);
	}
	vector<int>starts(K);
	for (int i = 0; i < K; ++i) {
		cin >> starts[i];
		starts[i]--;
	}
	auto p(spfa(N, es, starts));
	vector<Weight>ws(p.second);
	int ans = 0;
	for (auto ees : es) {
		for (auto e : ees) {
			ans = max(ans, (ws[e.src] + ws[e.dst] + e.weight)/2);
		}
	}
	cout << (ans+1) /2<< endl;
	return 0;
}

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

const int N = 3005;
const long long mod = 998244353ll;

long long f[N][N];
int a, b, c, d;

int main () {
	scanf("%d%d%d%d", &a, &b, &c, &d);
	for (int i = a; i <= c; i++) {
		for (int j = b; j <= d; j++) {
			if (i == a && j == b) f[i][j] = 1ll;
			else f[i][j] = 0ll;
			if (i > a) f[i][j] = (f[i][j] + f[i - 1][j] * j) % mod;
			if (j > b) f[i][j] = (f[i][j] + f[i][j - 1] * i) % mod;
			if (i > a && j > b) f[i][j] = (f[i][j] + mod * mod - f[i - 1][j - 1] * (i - 1) % mod * (j - 1)) % mod;
		}
	}
	printf("%lld\n", f[c][d]);
	return 0;
}

Measured memory_bytes: 74124
#include<iostream>
using namespace std;
int main(){
  int n,y;
  cin >> n >> y;
  bool flag=false;
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n-i;j++){
      if(i * 10000 + j * 5000 + (n-i-j) * 1000 == y){
        cout << i << " " << j << " " << n-i-j;
        flag  = true;
        i = n+1;
        break;
      }
    }
  }
  if(flag == false){
    cout << "-1 -1 -1";
  }
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
B=sorted(A)
if N%2==1:
  D=[0]
  for i in range(N-1):
    D.append((i//2)*2+2)
  if B==D:
    print((2**((N-1)//2))%(10**9+7)) 
  else:
    print(0)
else:
  D=[(i//2)*2+1 for i in range(N)]
  if B==D:
    print((2**(N//2))%(10**9+7))
  else:
    print(0)

Measured memory_bytes: 14008
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        // スペース区切りの整数の入力
        string[] input = Console.ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int a = int.Parse(input[1]);
        int b = int.Parse(input[2]);

        int sum = 0;

        for(int i = 1; i <= n; i++)
        {
            string num = i.ToString();
            int c = num.Length;
            int[] keta = new int[c];
            int nn = i;
            for(int j = 0; j < c; j++)
            {
                keta[j] = (nn % 10);
                nn /= 10;　// 1桁目を取り出す
            }
            if(keta.Sum() >= a && keta.Sum() <= b)
            {
                sum += i;
            }
        }
        Console.WriteLine(sum);
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(0),cin.tie(0);
#define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a)
#define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1<<(i-1)))
#define gg exit(0);

const int N=1000010;

int n,tot;
int a[N],p[N],cnt[N];

main(){
    #define task "TASK"
    if(fopen(task".inp","r")){
        freopen(task".inp","r",stdin);
        //freopen(task".out","w",stdout);
    }
    forinc(i,1,n=in) cnt[a[i]=in]++;
    sort(a+1,a+n+1);
    forinc(i,1,n) if(cnt[a[i]]){
        if(!p[a[i]] && cnt[a[i]]==1) tot++;
        cnt[a[i]]=0;
        for(int j=a[i];j<=a[n];j+=a[i]) p[j]=1;
    }
    cout<<tot;
}


Measured memory_bytes: 12136
class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;
  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n){
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n){
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
}

/* [入力]
  const [H,W]=o.nn(2)
  const [N,M]=o.nn(2)
  const N=o.n()
  const S=o.s()
  const arr1=[]
  for(let i=0;i<N;i++)arr1.push(o.n())
 */

/* [BFS,DFS]
  const [H,W]=o.nn(2),map=new Array(H),save=new Array(H)
  const DH=[0,0,-1,1]
  const DW=[1,-1,0,0]
  for(let i=0;i<H;i++){
    map[i]=o.s().split('')
    save[i]=new Array(W)
    save[i].fill(-1)
  }
  // let queue=[[?,?,1]]
  // save[?][?]=0
  while(queue.length>0){
    let [h,w,c]=queue.shift()
    for(let i=0;i<4;i++){
      if(h+DH[i]<0 || h+DH[i]>=H || w+DW[i]<0 || w+DW[i]>=W){
        continue
      }
      if(map[h+DH[i]][w+DW[i]]==?){
        continue
      }
      if(save[h+DH[i]][w+DW[i]]==-1){
        queue.push([h+DH[i], w+DW[i], c+1])
        save[h+DH[i]][w+DW[i]]=c
      }
    }
  }
*/
const o = new AtCoder()

let [a,b]=o.nn(2)
let aa=String(a).repeat(b)
let bb=String(b).repeat(a)

if(aa < bb){
  o.o(aa)
}else{
  o.o(bb)
}

Measured memory_bytes: 7500
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a,k,ans;
vector<ll> v;
int main(void){
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    for(int i=0;i<k;i++){
        ans+=v[i];
    }
    cout<<ans<<endl;
}


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

long n, sum;
vector<long> v;
int main(void){
	cin >> n;

	for (int i = 0; i < n; ++i){
		long input;
		cin >> input; sum += input;
		v.push_back(input);//v.pushback(X)???vector???v??????????°????X??????????????????
	}

	sort(v.begin(), v.end());//??????
	cout << v.front() << " " << v.back() << " " << sum << endl;//????????¨??????
	
	//system("pause");
	return 0;
}

Measured memory_bytes: 1348
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

"""
URL: https://atcoder.jp/contests/dp/tasks/dp_o
O - Matching / 
実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 
100 点

問題文
N 人の男性たちと N 人の女性たちがいます。 
男性たちには 1,2,…,N と番号が振られています。 
同様に、女性たちには 1,2,…,N と番号が振られています。

各 i,j (1≤i,j≤N) について、男性 i と女性 j の相性の良し悪しが
    整数 ai,j によって与えられます。 
ai,j=1 ならば男性 i と女性 j は相性が良く、
    ai,j=0 ならば相性が悪いです。

太郎君は、相性が良い男女どうしのペアを N 組作ろうとしています。 
このとき、各男性および各女性は
    ちょうど 1 つのペアに属さなければなりません。

N 組のペアを作る方法は何通りでしょうか？ 
109+7 で割った余りを求めてください。

制約
入力はすべて整数である。
1≤N≤21
ai,j は0 または 1 である。

解法
配るDP
こういう時は事前にいくつの値が何個bit立ってるかを計算しておくのが良い

知見
    ================================================
    |bit_length = [0]                              |
    |for i in range(n):                            |
    |    bit_length += [x + 1 for x in bit_length] |
    |で2**n-1までのbitの立っている数を前計算できる     |
    ================================================
"""

#solve
def solve():
    n = II()
    a = LIR(n)
    n1 = 1 << n
    dp = [0] * n1
    dp[0] = 1
    b = [0]
    for i in range(n):
        b += [x + 1 for x in b]

    c = [1 << i for i in range(n)]
    for i in range(n1-1):
        p = b[i]
        ap = a[p]
        for j in range(n):
            if ap[j]:
                j1 = c[j]
                if i & j1:
                    continue
                dp[i|j1] += dp[i]


    print(dp[-1] % mod)


    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 147644
a=[]
b=[]
n,m,l=map(int,input().split())
for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(m):
    b.append(list(map(int,input().split())))
c=[[0]*l for i in range(n)]
for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j]+=a[i][k]*b[k][j]
    print(*c[i])


Measured memory_bytes: 7036
#include <bits/stdc++.h>
#include <vector>
using namespace std;
bool flag[10000000];
int n, hasil;
int main(){

	for(int i = 1; i <= 1000000; i++){
		flag[i] = true;
	}
	for(int i = 2; i <= 1000; i++){
		if(flag[i] == true){
			for(int u = i*i; u <= 1000000; u = u + i){
				flag[u] = false;
			}
		}
	}
	flag[1] = false;
	while(cin >> n){
		hasil = 0;
		for(int i = 1; i <= n; i++){
			if(flag[i])
				hasil++;
		}
		cout << hasil << endl;
	}
	return 0;
}

Measured memory_bytes: 4076
#include<stdio.h>
int main(){
    int N,K,l[50],i,j,a,b=0;
    scanf("%d %d",&N,&K);
    for(i=0;i<N;i++){
        scanf("%d",&l[i]);
    }
    for(i=0;i<N;i++){
        for(j=i+1;j<N;j++){
            if(l[i]<l[j]){
                a=l[i];
                l[i]=l[j];
                l[j]=a;
            }
        }
    }
    for(i=0;i<K;i++){
        b+=l[i];
    }
    printf("%d\n",b);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int N;
    cin >> N;
    vector< vector<int> > edges(N);
    REP(i, N) {
        int u, k;
        cin >> u >> k;
        u--;
        edges[u].resize(k);
        REP(j, k) {
            cin >> edges[i][j];
            edges[i][j]--;
        }
    }

    queue<int> que;
    vector<int> dist(N, -1);
    dist[0] = 0;
    que.push(0);
    while(!que.empty()) {
        int v = que.front();
        que.pop();

        for(int next: edges[v]) {
            if(dist[next] == -1) {
                dist[next] = dist[v] + 1;
                que.push(next);
            }
        }
    }

    REP(i, N) cout << i+1 << " " << dist[i] << endl;
    return 0;
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,q; cin >> n >> q;
    string s; cin >> s;
    int cnt[n];
    int c = 0;
    for(int i = 1; i < n; i++){
        if(s[i-1] == 'A' && s[i] == 'C')c++;
        cnt[i] = c;
    }
    cnt[0] = 0;

    for(int i = 0; i < q; i++){
        int l,r; cin >> l >> r;
        cout << cnt[r-1]-cnt[l-1] << endl;
    }
}

Measured memory_bytes: 1408
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a / g * b;
}
#endif


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

    ll A, B, C, D; cin >> A >> B >> C >> D;

    ll cm = lcm(C, D);

    ll ans = (B - A + 1) - ((B / C - (A - 1) / C) + (B / D - (A - 1) / D) - (B / cm - (A - 1) / cm));
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[57];
int pos[57];
int main(){
    int n;
    cin>>n;
    int cnt=0;
    for(int i=1;i<=n;++i){
        cin>>a[i];
        if(a[i]!=i)
            pos[++cnt]=i;
    }
    if(cnt>2)
        cout<<"NO";
    else
        cout<<"YES";
    return 0;
}


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

int main() {


    ll H, W;
    cin >> H >> W;
    
    if(H == 1 || W == 1){
        cout << 1 << endl;
    } else if(H%2 ==1 && W % 2==1){
        cout << (H*W + 2 - 1) / 2 << endl;
    } else {
        cout << (H*W) / 2 << endl;
    }

    return 0;
}


Measured memory_bytes: 3628
#![allow(unused_imports)]

//input
use proconio::input;
use proconio::marker::{Bytes, Chars};
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
use std::collections::HashSet;
//use std::collections::VecDeque;
//use std::collections::BinaryHeap;

//use std::cmp::*;

fn main() {
    input! {
        n: usize,
        k: usize,
        a: [usize;n],
    }

    let mut r = vec![];
    let mut dic = HashSet::new();
    let mut now = 1;

    while !dic.contains(&now) {
        r.push(now);
        dic.insert(now);
        now = a[now - 1];
    }

    //println!("{:?}", r);
    //println!("{:?}", dic);

    let mut start = 0usize;

    for i in 0..r.len() {
        if r[i] == now {
            start = i;
        }
    }
    //println!("{}", start);
    let mut gr = vec![];

    for i in start..r.len() {
        gr.push(r[i]);
    }

    //println!("{:?}", gr);
    if k <= start {
        println!("{}", r[k]);
    } else {
        println!("{}", gr[(k - start) % gr.len()]);
    }
}


Measured memory_bytes: 10888
import std.stdio,std.math,std.string,std.conv,std.typecons,std.format;
import std.algorithm,std.range,std.array;

T[] readarr(T=long)(){return readln.chomp.split.to!(T[]);}
void scan(T...)(ref T args){auto input=readln.chomp.split;foreach(i,t;T)args[i]=input[i].to!t;}

//END OF TEMPLATE

void main(){
    ulong n,k;
    scan(n,k);
    ulong x;
    if(n<k)
        x=min(n,k-n);
    else if(k==n)
        x=0;
    else{
        x=min(n%k,abs((n%k).to!long-k.to!long));
    }   
    x.writeln;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#define INF 1001001001
#define ll long long
#define rep(i,n)  for(i=0; i<n;  i++)
#define rep2(i,n) for(i=1; i<=n; i++)

int  get_min(int a, int b){ if(a<b) return a; else return b; }
int  get_max(int a, int b){ if(a>b) return a; else return b; }

int main(){
    ll n, a, b; /*N = A = B = 10e18*/
    scanf("%lld %lld %lld",&n,&a,&b);

    ll c = a+b;
    ll included_blue_blocks = a * (n/c);
    ll not_included_blue_blocks = n%c;
    ll result_blue_blocks;

    if(not_included_blue_blocks > a)    not_included_blue_blocks = a;
    result_blue_blocks = included_blue_blocks + not_included_blue_blocks;
    printf("%lld",result_blue_blocks);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=a;i<b;i++)
using namespace std;
using ll=long long;
const ll LINF=0x1fffffffffffffff;



const vector<vector<ll>>dis={
    {0,1,2,1,2,3,2,3,4},
    {1,0,1,2,1,2,3,2,3},
    {2,1,0,3,2,1,4,3,2},
    {1,2,3,0,1,2,1,2,3},
    {2,1,2,1,0,1,2,1,2},
    {3,2,1,2,1,0,3,2,1},
    {2,3,4,1,2,3,0,1,2},
    {3,2,3,2,1,2,1,0,1},
    {4,3,2,3,2,1,2,1,0}
};
signed main(){
    ll n;
    string s;
    cin>>n>>s;
    vector<vector<ll>>cnt(9,vector<ll>(9));
    for(auto&&i:s)i-='1';
    rep(i,0,n-1)cnt[s[i]][s[i+1]]++;
    vector<ll>a={0,1,2,3,4,5,6,7,8},ans;
    ll max=LINF;
    do{
        vector<vector<ll>>cost(9,vector<ll>(9));
        ll c=0;
        rep(i,0,9)rep(j,0,9)c+=dis[i][j]*cnt[a[i]][a[j]];
        if(c<max){
            max=c;
            ans=a;
        }
    }while(next_permutation(a.begin(),a.end()));
    rep(i,0,3){
        rep(j,0,3)cout<<char(ans[i*3+j]+'1');
        cout<<endl;
    }
}






Measured memory_bytes: 3320
import java.util.*;

public class Main {

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

		int x,a,b,z;

		// 入力
		x = scanner.nextInt();
		a = scanner.nextInt();
		b = scanner.nextInt();

		z = x - a;
		while(z >= 0){
			z -= b;
		}
		z += b;

		System.out.println(z);

		scanner.close();
	}
}

Measured memory_bytes: 20948
L,R=map(int,input().split())
n=2019
if R-L>=2019:
    print(0)
else:
    L%=n
    R%=n
    if L>=R:
        print(0)
    else:
        ans=(L*R)%n
        for i in range(L,R+1):
            for j in range(i+1,R+1):
                ans=min(ans,i*j%n)
        print(ans)

Measured memory_bytes: 9196
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    char a = s[0];
    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
        cout << "Bad" << endl;
    else
        cout << "Good" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#define INF 1000000001

using namespace std;

void warshall_floyd(int d[][300], int n)
{
  for (int k = 0; k < n; k++){       // 経由点
    for (int i = 0; i < n; i++) {    // 始点
      for (int j = 0; j < n; j++) {  // 終点
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }
}

int main()
{
  int n, m, l;
  cin >> n >> m >> l;
  
  int d[300][300];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      d[i][j] = INF;
  
  int a, b, c;
  for (int i = 0; i < m; ++i) {
    cin >> a >> b >> c;
    d[a-1][b-1] = c;
    d[b-1][a-1] = c;
  }
  
  warshall_floyd(d, n);
  
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      if (d[i][j] <= l)
        d[i][j] = 1;
      else
        d[i][j] = INF;
  
  warshall_floyd(d, n);
  
  int q;
  cin >> q;
  
  while (q--) {
    int s, t;
    cin >> s >> t;
    cout << (d[s-1][t-1] == INF ? -1 : d[s-1][t-1] - 1) << endl;
  }
}


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

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

  int hours = S / (60 * 60);
  S = S - hours * (60 * 60);
  int minutes = S / 60;
  int seconds = S - minutes * 60;

  cout << hours << ":" << minutes << ":" << seconds << endl;
  return 0;
}


Measured memory_bytes: 3084
# -*- coding: utf-8 -*-
from collections import defaultdict,deque
N = int(input())
abc = [list(map(int, input().split())) for _ in range(N-1)]
Q, K = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(Q)]

# graph = defaultdict(lambda: defaultdict(int))
graph = [defaultdict(int) for _ in range(N)]

for a,b,c in abc:
    graph[a-1][b-1] = c
    graph[b-1][a-1] = c

def xfs(v):
    dist = [-1 for _ in range(N)]
    dist[v] = 0
    que = deque()
    que.append(v)
    while len(que) > 0:
        i = que.pop()  # 深さ優先探索        
        # i = que.popleft() #幅優先探索
        for n, val in graph[i].items():
            if dist[n] == -1:
                dist[n] = dist[i] + val
                que.append(n)
    return dist

dist = xfs(K-1)

for x,y in xy:
    print(dist[x-1] + dist[y-1])


Measured memory_bytes: 99336
/* Stay hungry, stay foolish. */
/* Copyright by HenryLi */
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<vector>
#include<set>
#include<sstream>
#include<stack>
#include<ctime>
#include<cmath>
#include<cctype>
#include<climits>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<complex>
using namespace std;
template <class _T> inline void read(_T &_x) {
	int _t; bool _flag=false;
	while((_t=getchar())!='-'&&(_t<'0'||_t>'9')) ;
	if(_t=='-') _flag=true,_t=getchar(); _x=_t-'0';
	while((_t=getchar())>='0'&&_t<='9') _x=_x*10+_t-'0';
	if(_flag) _x=-_x;
}
typedef long long LL;
const int mod = 1000000007;
const int maxn = 100010;
LL v[maxn], f[maxn];
LL C(int n, int m) {
	return f[n] * v[m] % mod * v[n - m] % mod;
}
int n, m;
int main() {
	//freopen("fuck.in","r",stdin);
	//freopen("fuck.out","w",stdout);
	v[0] = v[1] = f[0] = f[1] = 1;
	for (int i = 2; i < maxn; i++)
		v[i] = v[mod % i] * (mod - mod / i) % mod;
	for (int i = 2; i < maxn; i++) {
		f[i] = f[i - 1] * i % mod;
		v[i] = v[i - 1] * v[i] % mod;
	}
	scanf("%d%d", &n, &m);
	LL ans = n + 1;
	for (int i = 1; i < m; i++) {
		if (m - i > n) continue;
		for (int j = 1; j <= m - i; j++) {
			if ((m - i) + (m - i - j) > n) continue;
			ans += C(m - 1, i - 1) * C(m - i - 1, j - 1) % mod * C(n - (m - i) - (m - i - j) + 2, 2) % mod;
			ans %= mod;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
    a[i]--;
  }
  int ans=0;
  rep(i,n)if(a[a[i]]==i)ans++;
  cout<<ans/2<<endl;
  return 0;
}


Measured memory_bytes: 1024
from sys import stdin
#from collections import deque
#from math import ceil


def ii(): return int(stdin.readline())


def fi(): return float(stdin.readline())


def mi(): return map(int, stdin.readline().split())


def fmi(): return map(float, stdin.readline().split())


def li(): return list(mi())


def lsi():
    x=list(stdin.readline())
    x.pop()
    return x


def si(): return stdin.readline()


def sieve(x):
    a=[True]*(x+1)
    sq=floor(sqrt(x))
    for i in range(3, sq+1, 2):
        if a[i]:
            for j in range(i*i, x+1, i):
                a[j]=False
    if x>1:
        p=[2]
    else:
        p=[]
    for i in range(3, x+1, 2):
        if a[i]:
            p.append(i)
    return p
#vowel={'a', 'e', 'i', 'o', 'u', 'y', 'A', 'E', 'I', 'O', 'U', 'Y'}
#pow=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 140737488355328, 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496, 9007199254740992, 18014398509481984, 36028797018963968, 72057594037927936, 144115188075855872, 288230376151711744, 576460752303423488, 1152921504606846976, 2305843009213693952, 4611686018427387904, 9223372036854775808]
############# CODE STARTS HERE #############
n, m=mi()
a=li()
print('No' if sum(a)<n else 'Yes')

Measured memory_bytes: 13984
#include <iostream>
#include <cstdio>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include <functional>
#include<stdio.h>
#include<assert.h>
#include<stack>
#include<sstream>
#include <cstdlib>
#include<map>
#include<algorithm>
#include<iostream>
#include<set>
#include<utility>
#include<memory.h>
#include<string>
#include<vector>
#include<numeric>
#include <unordered_map>
using namespace std;
#define ll  long long
#define pb push_back
#define fi(ss) freopen (ss,"r",stdin)
#define fo(ss) freopen (ss,"w",stdout)
#define sz(v)               ((int)((v).size()))
#define all(x)          (x).begin(),(x).end()
#define REP(i, v)       for(int i=0;i<sz(v);i++)
typedef pair<int,int> pii;
#define ios std::ios_base::sync_with_stdio(false);
using namespace std;
const int maxn = 1001;

int main() {
	ll a,b;
	cin >> a >> b;
	ll x,y;
	x = a, y = b;
	ll s = 1;
	while(x <= y / 2LL) x *= 2LL,s++;
	cout << s << "\n";
}



Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N>>K;
	K=N*N-K;
	vector<long long int>v(N);
	for(auto &i:v)cin>>i;
	sort(v.begin(),v.end());
	long long int ans=accumulate(v.begin(),v.end(),0LL)*N*2;
	L=0;
	R=200001;
	while(R-L>1){
		int mid=(R+L)/2;
		long long int num=0;
		for(auto i:v){
			num+=lower_bound(v.begin(),v.end(),mid-i)-v.begin();
		}
		if(num<K)L=mid;
		else R=mid;
	}
	auto w=v;
	for(int i=1;i<N;i++){
		w[i]+=w[i-1];
	}
	for(auto i:v){
		int box=lower_bound(v.begin(),v.end(),R-i)-v.begin();
		K-=box;
		ans-=i*box;
		if(box){
			ans-=w[box-1];
		}
	}
	ans-=L*K;
	//cout<<K<<endl;
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

/* -- template -- */
map<ll, int> cnt;

void fact(ll N) {
    for(ll i = 2; i * i <= N; ++i) {
        if(N % i == 0) {
            cnt[i]++;
            N /= i;
            i = 1;
        }
    }
    if(N != 1)cnt[N]++;
}

int main() {
    ll N; cin >> N;
    fact(N);
    int tmp = 0;
    for(auto itr = cnt.begin(); itr != cnt.end(); ++itr) {
        int ans = itr -> second;
        int j = 1;
        while(ans - j >= 0) {
            tmp++;
            ans -= j;
            ++j;
        }
    }
    cout << tmp << endl;
}


Measured memory_bytes: 3640
#!/usr/bin/env python3

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    s = list(input()[:-1].decode())
    a_count = s.count('a')
    b_count = s.count('b')
    c_count = s.count('c')
    arr = sorted([a_count, b_count, c_count])
    if max(arr) - min(arr) > 1:
        print('NO')
    else:
        print('YES')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 71608
def BellmanFord(x,n,s):
	inf = float("inf")
	dist = [inf for i in range(n+1)]
	dist[s] = 0
	for i in range(1,n+1):
		for j,k,c in x:
			if j!=inf and dist[k]>dist[j]+c:
				dist[k] = dist[j]+c
				if i==n and k==n: return -1
	return dist
n,m = (int(i) for i in input().split())
x = []
for _ in range(m):
	i,j,k = (int(l) for l in input().split())
	x.append([i,j,-k])
b = BellmanFord(x,n,1)
if b==-1: print("inf")
else: print(-b[n])

Measured memory_bytes: 3388
#include<bits/stdc++.h>
using namespace std;
typedef signed long long int ll;
#define INF (1<<29)
int l;
//ll a[200005];
ll a;
ll dp[200005][5]={0};
int main(){
    cin>>l;
    //for(int i=0;i<l;i++) cin>>a[i];
    
    /*for(int i=0;i<5;i++){
        for(int j=0;j<l+2;j++){
            dp[j][i]=INF;
        }
    }*/
    
    for(int i=0;i<5;i++) dp[0][i]=0;
    
    for(int i=1;i<=l;i++){
        cin>>a;
        int b=(a==0?2:(a%2));
        
        int c=!(a%2);
        
        dp[i][0]=dp[i-1][0]+a;
        
        dp[i][1]=min(dp[i][0],dp[i-1][1]+b);
        
        dp[i][2]=min(dp[i][1],dp[i-1][2]+c);
        
        dp[i][3]=min(dp[i][2],dp[i-1][3]+b);
        
        dp[i][4]=min(dp[i][3],dp[i-1][4]+a);
        
    }
    cout<<dp[l][4]<<endl;
    return 0;
    
}


Measured memory_bytes: 8064
#include<stdio.h>
int main(void){
	int i,j,tmp, x[10];
	for (i = 0; i < 10; i++){
		//printf("?±±?????????%d ", i);
		scanf("%d", &x[i]);
	}
	for (i = 0; i < 10; i++){
		for (j = 0; j < 9; j++){
			if (x[j] < x[j+1]){
				tmp = x[j];
				x[j] = x[j+1];
				x[j+1] = tmp;
			}
		}
	}
	//printf("%d????????????????±±?????????\n");
	for (i = 0; i < 3;++i)
		printf("%d\n",x[i]);
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double dd;
const int N = 1e5+5;
const dd eps = 1e-8;
const int mod = 1e9+7;

int cnt1,cnt2;
string now;


int main(){
  ios::sync_with_stdio(false);
  // freopen("input.txt","r",stdin);
  cin>>now;
  for(int i = 0;i < now.size();i++){
    if(now[i] == 'A') cnt1++;
    if(now[i] == 'B') cnt2++;    
  }
  if(cnt1 && cnt2) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;  
  return 0;
}


Measured memory_bytes: 256