akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var a = cin.ReadInt;
            var b = cin.ReadInt;
            WriteLine(a * b % 2 == 0 ? "Even" : "Odd");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 11220
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define LD long double
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(x) ((x)<0?-(x):(x))
#define si(n) scanf("%d",&n)
#define sf(n) scanf("%f",&n)
#define sl(n) scanf("%lld",&n)
#define slu(n) scanf("%llu",&n)
#define sd(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
#define pnl printf("\n")
#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,n) for(int i=(n);i>=0;i--)
#define DB(s, x) cout<<"\n"<<s<<" = "<<(x)<<"\n";
#define CL(a,b) memset(a,b,sizeof(a))
#define GOLD ((1+sqrt(5))/2)
const double PI=3.14159265358979323846264338327950288419716939937510582097494459230;
void swaps (char *x,char *y){char temp;temp=*x;*x=*y;*y=temp;}
void swapi(int *a,int *b){int temp;temp=*a;*a=*b;*b=temp;}
ULL gcd(ULL a,ULL b){if(a==0)return b;if(b==0)return a;if(a==1||b==1)return 1;if(a==b)return a;if(a>b)return gcd(b,a%b);else return gcd(a,b%a);}
#define SIZE 1000001
int main()
{
    int A,B,C,D,E,F,x=1,y=1;
    scanf("%d%d%d%d%d%d",&A,&B,&C,&D,&E,&F);
    for(int i=0; i<=F/(100*A); i++)
    {
        int a=i*100*A;
        if(a>F) break;
        for(int j=0; j<=F/(100*B); j++)
        {
            int b=j*100*B;
            if(a+b>F) break;
            for(int k=0; k<F/C; k++)
            {
                int c=k*C;
                if(a+b+c>F) break;
                for(int l=0; l<F/D; l++)
                {
                    int d=l*D;
                    if((a+b+c+d)>F||(c+d)>(a+b)/100*E) break;
                    int tz=(c+d);
                    int tm=(a+b);
                    if(x*(tm+tz)<=tz*(y+x))
                    {
                        x=tz;
                        y=tm;
                    }
                }
            }
        }
    }
    printf("%d %d",x+y,x);
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#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()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1000000000;

int main() {
    int N;
    cin >> N;
    vector<int>A(N);
    for (int i=0; i<N; i++)cin >> A[i];
    int ans = 0;
    for (int i=0; i<N; i++){
        if (i%2 == 0 and A[i]%2 == 1)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define endl '\n'
#define pb push_back
#define fi first
#define se second
typedef long long ll;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define all(con) con.begin(),con.end()
#define w(x) int x; cin>>x; while(x--)
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cout<<fixed<<setprecision(8);
    ll n;
    cin>>n;
    vl a(n);
    ll neg = 0;
    ll mn = INT_MAX;
    rep(i,0,n)
    {
    	cin>>a[i];
    	mn = min(mn,abs(a[i]));
    	if(a[i] < 0)
    		neg++;
    }
    ll ans = 0;
    rep(i,0,n)
    	ans += abs(a[i]);
    if(neg&1^1)
    {
    	cout<<ans<<endl;
    }
    else
    {
    	ans -= 2*mn;
    	cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3976
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int v, e;

struct UnionFind {
    vector<int> par, cnt;

    UnionFind(int n): par(n, -1), cnt(n) {}
    int find(int x) {
        if (par[x]<0) return x;
        return par[x] = find(par[x]);
    }
    bool same(int i, int j) {
        // iとjが同じグループかどうかを判別する
        return find(i) == find(j);
    }
    int size(int x) {
        return -par[find(x)];
    }

    bool unite(int x, int y) {
        // iとjを併合する
        x = find(x);
        y = find(y);
        bool ok = (-par[x]>cnt[x] || -par[y]>cnt[y]);
        if (x == y) {
            cnt[x]++;
        } else if (par[x] > par[y]) {
            par[y] += par[x];
            par[x] = y;
            cnt[y] += cnt[x]+1;
        } else {
            par[x] += par[y];
            par[y] = x;
            cnt[x] += cnt[y]+1;
        }
        return ok;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> v >> e;
    priority_queue< P<int, P<int, int> > > pq;
    for (int i = 0; i < e; i++) {
        int s, t, w;
        cin >> s >> t >> w;
        pq.push(make_pair(-w, make_pair(s, t)));
    }

    UnionFind uni(v);

    int ans = 0;
    while (!pq.empty()) {
        P<int, P<int, int> > q = pq.top(); pq.pop();
        if (!uni.same(q.second.first, q.second.second)) {
            uni.unite(q.second.first, q.second.second);
            ans -= q.first;
        }
    }
    cout << ans << '\n';
    return 0;
}



Measured memory_bytes: 4560
#include <iostream>
#include <vector>

using namespace std;

int main() {
	vector<long long int> ll(90, 0);
	ll[0] = 2;
	ll[1] = 1;
	for (int i = 2; i < 90; i++) {
		ll[i] = ll[i - 1] + ll[i - 2];
	}

	int n;
	cin >> n;

	cout << ll[n] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#include <vector>
using namespace std;
int main(){
  int x,a,b;
  cin >> x >> a >> b;
  if(a >= b){
    cout << "delicious" << endl;
  }else if(b - a > x){
    cout << "dangerous" << endl;
  }else{
    cout << "safe" << endl;
  }
  return 0;
}

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

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)



int main() {
	ll n,m,a,ans=1;
	const ll mod = 1000000007;
	in(n);
	in(m);

	vll s(n+1,0),t(n+1,1);
	rep(i, 0, m) {
		in(a);
		if (s[a - 1] == 1 || s[a + 1] == 1) {
			outn(0);
			return 0;
		}

		s[a] = 1;
	}

	repeq(i, 1, n) {
		if (s[i] == 0) {
			if (t[i - 1] != 0) {
				t[i] = t[i - 1];
				if (i > 1) {
					t[i] += t[i - 2];
				}
				if (t[i] > mod) {
					t[i] %= mod;
				}
			}
		}
		else {
			t[i] = 0;
			ans = (ans * t[i - 1]);
			if (ans > mod) {
				ans %= mod;
			}
		}
		if (ans == 0) {
			outn("a");
		}
	}
	ans = (ans * t[n]) % mod;

	outn(ans);


	return 0;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define F first
#define S second
#define MP make_pair
#define PB push_back
 
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)
int main(){
	ll n;
	rl(n);
	vector<ll> arr(n-1),ans(n,-1);
	fr(i,0,n-1)
		rl(arr[i]);
	fr(i,0,n-1)
	{
		if(ans[i]==-1){
			ans[i]=arr[i];
			ans[i+1]=arr[i];
		}
		else
		{
			if(ans[i]<arr[i])
			{
				ans[i+1]=arr[i];
			}
			else
			{
				ans[i]=arr[i];
				ans[i+1]=arr[i];
			}
		}
	}
	ll sum=0;
	fr(i,0,n)
	{
		sum+=ans[i];
	}
	wl(sum);
	NL;
	return 0;
}

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

using namespace std;

#define MP make_pair
#define PB push_back
#define f first
#define s second

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;

//int dr1[] = {-1, 0, 1, 0};
//int dc1[] = {0, 1, 0, -1};
//int dr3[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
//int dc3[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
const ll MOD = 998244353;
const int INF = 1000000007;

ll modx(ll a)
{
    return (a%MOD+MOD)%MOD;
}

ll times(ll a, ll b)
{
    return modx(modx(a)*modx(b));
}

ll add(ll a, ll b)
{
    return modx(modx(a)+modx(b));
}

ll sub(ll a, ll b)
{
    return modx(MOD+modx(a)-modx(b));
}

ll fastExp(ll base, ll exp)
{
    if(exp == 0LL)
    {
        return 1LL;
    }

    if(exp%2==0)
    {
        return fastExp(times(base, base), exp/2);
    }
    else
    {
        return times(base, fastExp(times(base, base), exp/2));
    }
}


const int MAXN = (int)2e5+1;
const ll MAXV = (ll)1e6+1;
ll N, arr[MAXN], ct[MAXV], sum_prods[MAXV], ans;


int main()
{
    //freopen("input.in","r",stdin);
    //freopen("output.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> N;
    //cout << fastExp(3LL, 5);
    for(int i=0; i<N; i++)
    {
        cin >> arr[i];
        ct[arr[i]]++;
    }
    for(ll i=MAXV-1; i>=1; i--)
    {
        ll sum_tot = 0, sum_squares = 0;
        for(ll j=i; j<MAXV; j+=i)
        {
            sum_tot = add(sum_tot, times(j, ct[j]));
            sum_squares = add(sum_squares, times(j, times(j, ct[j])));
            sum_prods[i] = sub(sum_prods[i], sum_prods[j]);
        }
        ll res1 = sub(times(sum_tot, sum_tot), sum_squares);
        res1 = times(res1, (MOD+1)/2);
        sum_prods[i] = add(sum_prods[i], res1);
        ans = add(ans, times(sum_prods[i], fastExp(i, MOD-2)));
    }

    cout << ans;
    return 0;
}


Measured memory_bytes: 17408
import itertools
la = [500 * i for i in range(int(input())+1)]
lb = [100 * i for i in range(int(input())+1)]
lc = [50 * i for i in range(int(input())+1)]
d = int(input())
r = list(itertools.product(la, lb, lc))
ans = 0

for s in r:
  if sum(s) == d:
    ans += 1
print(ans)

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

using namespace std;

#define pb push_back
#define pp pop_back
#define mp make_pair
#define F first
#define S second
#define xmax(x,y) ((x) = max((x),(y)))
#define xmin(x,y) ((x) = min((x),(y)))
#define all(x) (x).begin(),(x).end()
#define mem(x) memset(x , 0 , sizeof(x))
#define _ ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define FP(a , b , c)  for(ll (a) = (b) ; (a) < (c) ; (a++));
#define FM(a , b , c)  for(ll (a) = (b) ; (a) >= (c) ; (a--));
#define connect(a , b , c) a[b].pb(c) , a[c].pb(b)

typedef long long int ll;
typedef unsigned long long int ull;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector <ll> vl;
typedef vector <int> vi;
typedef vector <string> vs;

const ll Maxn3 = 1e3 + 10;
const ll Maxn4 = 1e4 + 10;
const ll Maxn5 = 1e5 + 10;
const ll Maxn6 = 1e6 + 10;
const ll Maxn7 = 1e7 + 10;
const ll Maxn8 = 1e8 + 10;
const ll Maxn9 = 1e9 + 10;
const ll Maxn18 = 1e18 + 10;
const ll Mod1 = 1e7 + 7;
const ll Mod2 = 1e9 + 7;
const ll LLMax = LLONG_MAX;
const ll LLMin  = LLONG_MIN;
const ll INTMax = INT_MAX;
const ll INTMin  = INT_MIN;

ll mn = LLMax , mx = LLMin;

int main()
{_
    ll n;cin >> n;
	return cout << n / 3 , 0;
}
///SAliB


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std ;
int n ;
int a[20] ;
int x[20][20] , y[20][20] ;
int ans = 0 ;
int l[20] ; //1是真 0是假 
int r[20] ;
bool judge()
{
	memset(r , -1 , sizeof(r)) ;
	for(int i = 1 ; i <= n ; i ++)
	{
		if(l[i] == 0)
		  continue ;
		for(int j = 1 ; j <= a[i] ; j ++)
		{
			int u = x[i][j] ;
			int v = y[i][j] ;
			if(r[u] == -1)
			  r[u] = v ;
			else if(r[u] != v)
			  return 0 ;
		}
	}
	for(int i = 1 ; i <= n ; i ++)
	{
		for(int j = 1 ; j <= a[i] ; j ++)
		{
			int u = x[i][j] ;
			int v = y[i][j] ;
			if(l[u] == 1 && r[u] == 0 || l[u] == 0 && r[u] == 1)
			  return 0 ;
		}
	}
	return 1 ;
}
int cal()
{
	int cnt = 0 ;
	for(int i = 1 ; i <= n ; i ++)
	  if(l[i] == 1)
	    cnt ++ ;
	return cnt ;
}
void dfs(int u)
{
	if(u == n + 1)
	{
		if(judge())
		  ans = max(ans , cal()) ;
		return ;
	}
	for(int i = 0 ; i < 2 ; i ++)
	{
		l[u] = i ;
		dfs(u + 1) ;
	}
}
int main()
{
	scanf("%d" , &n) ;
	for(int i = 1 ; i <= n ; i ++)
	{
		scanf("%d" , &a[i]) ;
		for(int j = 1 ; j <= a[i] ; j ++)
		  scanf("%d%d" , &x[i][j] , &y[i][j]) ;
	}
	dfs(1) ;
	printf("%d\n" , ans) ;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
    string s;
    string tmp;
    int y,m,d;
    cin >> s;
    for (int i = 0; i < 4;++i){
        tmp += s[i];
    }
    y = stoi(tmp);
    tmp.clear();
    tmp += s[5];
    tmp += s[6];
    m = stoi(tmp);
    tmp.clear();
    tmp += s[8];
    tmp += s[9];
    d = stoi(tmp);

    //cout << y << " " << m << " " << d << endl;

    if(y<2019){
        cout << "Heisei" << endl;
        return 0;
    }
    if(y==2019 && m<4){
        cout << "Heisei" << endl;
        return 0;
    }
    if(y==2019 && m==4 && d<=30){
        cout << "Heisei" << endl;
        return 0;
    }
    cout << "TBD" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const ll MOD = 1000000007;
// const int INF = 2000000000;

int D, N;

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

  int ans = 0;
  int cnt = 0;
  for (int i = 1; i < 10000000; i++) {
    if (D == 0) {
      if (i % 100 != 0) {
        cnt++;
      }
    } else if (D == 1) {
      if (i % 100 == 0 && i % 10000 != 0) {
        cnt++;
      }
    } else {
      if (i % 10000 == 0 && i % 1000000 != 0) {
        cnt++;
      }
    }

    if (cnt == N) {
      ans = i;
      break;
    }
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn._
object Main extends App {
  val x = readLong()
  (0L to math.sqrt(2000000000).ceil.toLong).find(i ⇒ i * (i + 1) / 2 >= x) match {
    case Some(min) ⇒ println(min)
    case None ⇒ ???
  }
}

Measured memory_bytes: 28720
W, H, x, y, r = (int(x) for x in input().split())

def judge(W, H, x, y, r):
    if -100 <= x and x <= 100:
        if -100 <= y and y <= 100:
            if 0 < W and W <= 100:
                if 0 < H and H <= 100:
                    if 0 < r and r <= 100:
                        return True

if judge(W, H, x, y, r):
    if x + r <= W and y + r <= H and 0 <= x - r and 0 <= y - r:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 5604
#include<iostream>
using namespace std;
int main(){
    int a,b,c,t;
    cin>>a>>b>>c;
    if(a>b){
        t=a;
        a=b;
        b=t;
    }
    if(b>c){
        t=b;
        b=c;
        c=t;
    }
    if(a>b){
        t=a;
        a=b;
        b=t;
    }
    cout<<a<<" "<<b<<" "<<c<<endl;
    return 0;
}     


Measured memory_bytes: 3084
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e4+2;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,num,min1=26,cnt=0,max1=0,pos;
	cin>>n>>num;
	string s,t;
	cin>>s;
	t=s;
	reverse(t.begin(),t.end());
	s+=t;
	for(i=0;i<n;i++){
		if((int)(s[i]-'a'+1)<min1){
			min1=(int)(s[i]-'a'+1);
		}
	}
	s=' '+s+(char)('z'+1);
	char opt=(int)(min1+'a'-1);
	if(num>log2(n)){
		for(i=1;i<=n;i++){
			cout<<opt;
		}
		return 0;
	}
	if(num!=1){
		for(i=1;i<=2*n+1;i++){
			//cout<<s[i];
			if(s[i]==opt){
				cnt++;
			}
			else{
				//cout<<i<<' '<<cnt<<endl;
				if(i<=n||!cnt){
					cnt=0;
					continue;
				}
				//cout<<i<<' '<<cnt<<endl;
				if(cnt*(1<<(num-1))>=n){
					//cout<<i<<' '<<s[i]<<endl;
					for(i=1;i<=n;i++){
						cout<<opt;
					}
					return 0;
				}
				if(cnt>max1){
					max1=cnt;
					pos=i-cnt-1;
				}
				else{
					if(cnt==max1){
						bool cac=true;
						j=pos;
						k=i-cnt-1;
						while(j>pos-(n-cnt*(1<<(num-1)))){
							if(s[j]>s[k]){
								break;
							}
							if(s[j]<s[k]){
								cac=false;
								break;
							}
							j--;
							k--;
						}
						if(cac){
							pos=i-cnt-1;
						}
					}
				}
				cnt=0;
			}
		}
		//cout<<max1<<' '<<pos<<endl;
		for(i=1;i<=max1*(1<<(num-1));i++){
			cout<<opt;
		}
		j=n-max1*(1<<(num-1));
		//cout<<j<<endl;
		while(j){
			cout<<s[pos];
			pos--;
			j--;
		}
	}
	else{
		t=s.substr(1,n);
		//cout<<t<<endl;
		for(i=1;i<=n+1;i++){
			if(s.substr(i,n)<t){
				t=s.substr(i,n);
			}
		}
		cout<<t;
	}
}

Measured memory_bytes: 1024
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n,m,q ;
	cin >> n >> m >> q ;
	vvll sum(n+2,vll(n+2,0)) ;
	for(int i=0;i<m;i++){
		ll a,b ;
		cin >> a >> b ;
		sum.at(1).at(n)++ ;
		sum.at(1).at(b-1)-- ;
		sum.at(a+1).at(n)-- ;
		sum.at(a+1).at(b-1)++ ;
	}
	for(int i=1;i<=n;i++) for(int j=n;j>=1;j--) sum.at(i).at(j) += sum.at(i).at(j+1) ;
	for(int j=1;j<=n;j++) for(int i=1;i<=n;i++) sum.at(i).at(j) += sum.at(i-1).at(j) ;
	/*for(auto i:sum){
		for(auto j:i){
			cout << j << " " ;
		}
		cout << endl ;
	}*/
	for(int i=0;i<q;i++){
		ll a,b ;
		cin >> a >> b ;
		cout << sum.at(a).at(b) << endl ;
	}
}



Measured memory_bytes: 2944
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iter = input.split_whitespace();
    iter.next();
    let k: u32 = iter.next().unwrap().parse().unwrap();

    let mut h: Vec<u64> = iter.map(|it| it.parse().unwrap()).collect();
    h.sort();
    for _ in 0..k {
        h.pop();
    }

    let sum: u64 = h.iter().fold(0_u64, |sum, i| sum + i);
    return format!("{}", sum);
}


Measured memory_bytes: 10492
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long int N, A, count = 1;
	cin >> N;
	for (long long int i = 1; i <= sqrt(N); i++) {
		if (N % i == 0) {
			A = N / i;
		}
	}
	while (A >= 10) {
		A /= 10;
		count++;
	}
	cout << count;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    ll n, x, m;
    cin >> n >> x >> m;


    set<ll> numbox;
    vector<ll> numarray;

    ll f = x;
    ll tmp = x;
    int loopitr = -1;
    for(ll i=0; i<n; i++){
        if (numbox.find(tmp) != numbox.end()){
            rep(j, numarray.size()){
                if (numarray[j] == tmp) loopitr = j;
            }
            break;
        }
        numarray.push_back(tmp);
        numbox.insert(tmp);
        tmp *= tmp;
        tmp %= m;
    }

    if (x == 0) {cout << 0 << endl; return 0;}
    if (n == 1) {cout << x << endl; return 0;}
 //   show(numarray);


    ll ans = 0;
    vector<ll> sub_array;

    if (n <= numarray.size()){
        rep(i, n){
            ans += numarray[i];
        }
    } else {
        copy(numarray.begin() + loopitr, numarray.end(), back_inserter(sub_array));
       // show(sub_array);
        ll mainsum = 0;
        rep(i, numarray.size()) mainsum += numarray[i];
        ll subsum = 0;
        rep(i, sub_array.size()) subsum+= sub_array[i];

        ll remain = n-numarray.size();
        if (sub_array.size() == 0) return 0;
        ll remain_x = remain/sub_array.size();
        ll remain_y = remain%sub_array.size();

        ans += mainsum;
        ans += remain_x*subsum;
        rep(i, remain_y) ans+=sub_array[i];
    }
    cout << ans << endl;
}



Measured memory_bytes: 6692
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 X;
  std::cin >> X;
  std::cout << (X == 7 || X == 5 || X == 3 ? "YES" : "NO") << std::endl;
  return 0;
}

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

#define NIL -1
#define MAX 25

class Node{
public:
  int key;
  Node* parent;
  Node* left;
  Node* right;

  Node(){
    parent = NULL;
    left = NULL;
    right = NULL;
  }
};

Node* root = NULL;

void preOrder(Node* n){
  printf(" %d",n->key);
  if(n->left != NULL) preOrder(n->left);
  if(n->right != NULL) preOrder(n->right);
};

void inOrder(Node* n){
  if(n->left != NULL) inOrder(n->left);
  printf(" %d",n->key);
  if(n->right != NULL) inOrder(n->right);
}

void insert(int k){
  Node* n = root;
  Node* new_node = new Node;
  new_node->key = k;

  if(root == NULL){
    root = new_node;
    return;
  }

  while(true){
    if(k < n->key){
      if(n->left != NULL) n = n->left;
      else{
        n->left = new_node;
        new_node->parent = n;
        return;
      }
    }
    else{
      if(n->right != NULL) n = n->right;
      else{
        n->right = new_node;
        new_node->parent = n;
        return;
      }
    }
  }
}

Node* find(int key){
  Node* n = root;

  while(n != NULL){
    if(n->key == key) break;
    n = (key < n->key) ? n->left : n->right;
  }

  return n;
}

Node* getMinimum(Node* n){
  while(n->left != NULL){
    n = n->left;
  }
  return n;
}

Node* getSuccessor(Node* x){
  if(x->right != NULL){
    return getMinimum(x->right);
  }
  else{
    Node* y = x->parent;
    while(y != NULL && x == y->right){
      x = y;
      y = y->parent;
    }
    return y;
  }
}

void deleteNode(Node* z){
  //実際に削除するノードをyとする
  Node* y;

  //zが子を二つ持たない場合はz自身を削除すればよい
  if(z->left == NULL || z->right == NULL){
    y = z;
  }
  //そうでない場合はzの次節点を実際には削除する。
  else{
    y = getSuccessor(z);
  }

  //削除されるNode yに代わって、親子関係を保存できるように
  //yの子xを取得する。
  Node* x;
  if(y->left != NULL){
    x = y->left;
  }
  else{
    x = y->right;
  }

  //xが存在する場合は、xの親をyの親にする。
  if(x != NULL){
    x->parent = y->parent;
  }

  //yの親の子にxを設定する。
  if(y->parent == NULL){
    root = x;
  }
  else if(y == y->parent->left){
    y->parent->left = x;
  }
  else{
    y->parent->right = x;
  }

  if(y != z){
    z->key = y->key;
  }

  delete(y);
}



int main(){

  int n;
  scanf("%d", &n);

  char c[10];
  int key;
  for(int i=0; i<n; i++){
    scanf("%s",c);
    if(c[0] == 'i'){
      scanf("%d",&key);
      insert(key);
    }
    else if(c[0] == 'p'){
      inOrder(root); printf("\n");
      preOrder(root);printf("\n");
    }
    else if(c[0] == 'f'){
      scanf("%d",&key);
      if(find(key) != NULL) printf("yes\n");
      else printf("no\n");
    }
    else{
      scanf("%d",&key);
      Node* n= find(key);
      if(n != NULL) deleteNode(n);
    }
  }

  return 0;
}



Measured memory_bytes: 21880
/*#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")  */
#include <bits/stdc++.h>
 
#define file ""
 
#define all(x) x.begin(), x.end()
 
#define sc second
#define fr first
 
#define pb push_back
#define mp make_pair

#define pss pair<line*, line*>
 
using namespace std;
using namespace __gnu_cxx;
 
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
                                 
const ll inf = 1e18;
const int MOD = 1e9 + 7;

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

const int N = 1e6 + 5;
           
ll dp[N];

int main() {                
#ifdef Mask                                                         
  freopen(".in", 	"r", stdin);
  freopen(".out", "w", stdout);  
#endif
	ios_base :: sync_with_stdio(false);               
  cin.tie(nullptr); 	
  int n;
  cin >> n;
  int a[n + 1];
  for (int i = 1; i <= n; i++)
  	cin >> a[i], dp[i] = 1e18;
  dp[1] = 0;
  for (int i = 1; i <= n; i++) {
   	if (i + 1 <= n) dp[i + 1] = min(dp[i] + abs(a[i] - a[i + 1]), dp[i + 1]);
   	if (i + 2 <= n) dp[i + 2] = min(dp[i + 2], dp[i] + abs(a[i] - a[i + 2]));
  }
  cout << dp[n];
	return 0;   
}



Measured memory_bytes: 1408
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();

    return format!("ABC{}", n);
}


Measured memory_bytes: 2108
import sys
from random import choice,randint
inp=sys.stdin.readline
out=sys.stdout.write
flsh=sys.stdout.flush
 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()]
def LF(): return [float(x) for x in inp().strip().split()]
def LS(): return inp().strip().split()
def I(): return int(inp().strip())
def F(): return float(inp().strip())
def S(): return inp().strip()
def pf(s): return out(s+'\n')
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    def SieveOfEratosthenes(n):
        prime = [True for i in range(n + 1)]
        p = 2
        while (p * p <= n):
            if (prime[p] == True):
                for i in range(p * 2, n + 1, p):
                    prime[i] = False
            p += 1
        prime[0]= False
        prime[1]= False
        l=[]
        for i in range(n+1):
            if prime[i]:
                l.append(i)
        return l
    l=SieveOfEratosthenes(100006)
    # print(l)
    x=I()
    for i in l:
        if i>=x:
            print(i)
            break



if __name__ == "__main__":
    main()

Measured memory_bytes: 5508
/*
 * FileName:     C
 * CreatedDate:  2020-03-28 21:10:40 +0900
 * LastModified: 2020-03-28 21:26:12 +0900
 */

#include <stdio.h>

int main(void){
    int K,N;
    scanf("%d %d",&K,&N);
    int A[N];
    int doko_max=0;
    for(int i=0;i<N;i++){
        scanf("%d",&A[i]);
        if(i>0 && doko_max<A[i]-A[i-1]){
            doko_max=A[i]-A[i-1];
        }
    }
    if( K-A[N-1]+A[0]>doko_max ){
        doko_max=K-A[N-1]+A[0];
    }
    printf("%d\n",K-doko_max);
    return 0;
}


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

namespace ITP1_10_A
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] input = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x)).ToArray();
            double distance =
                Math.Sqrt(Math.Pow((input[3] - input[1]), 2) + Math.Pow((input[2] - input[0]), 2));
            Console.WriteLine(distance.ToString("f5"));
        }
    }
}

Measured memory_bytes: 10004
#include<iostream>
#include<vector>

using namespace std;

int main()
{
  int n;
  string a,b;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a>>b;
    int f[a.size()+1][b.size()+1];
    for(int i=0;i<a.size()+1;i++){
      for(int j=0;j<b.size()+1;j++){
	f[i][j]=0;
      }
    }

    for(int j=1;j<a.size()+1;j++){
      for(int k=1;k<b.size()+1;k++){
	if(a[j-1]==b[k-1]){
	  f[j][k]=f[j-1][k-1]+1;
	}else{
	  f[j][k]=max(f[j-1][k],f[j][k-1]);
	}
      }
    }
    /*
    for(int j=0;j<b.size()+1;j++){
      for(int i=0;i<a.size()+1;i++){
	cout<<f[j][i]<<" ";
      }
      cout<<endl;
    }
    */
    cout<<f[a.size()][b.size()]<<endl;
  }
  return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define MOD 1000000007
#define PI 3.14159265

#define MAX 100001



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

    vector<int> vec;
    int n;
    cin >> n;
    if (n == 0) {
        cout << "0" << endl;
        return 0;
    }
    while (n) {
        int r = n % -2;
        int d = n / -2;
        if (r < 0) {
            d++;
        }
        n = d;
        vec.pb(abs(r));
    }
    reverse(all(vec));
    for (auto it : vec) cout << it;
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define se second
#define fi first
#define rep(i, l, r) for (ll i = (ll)(l); i < (ll)(r); i++)
#define print(v) for (const auto itr : v){cout << itr << ' ';} cout << endl;
ll powermod(ll x, unsigned ll y, ll p){ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
#define mod 1000000007
#define inf 1e18
using namespace std;
const ll INF = 1e18L + 5;
const ll maxn = 2e5 + 5;
ll ceel(ll a, ll b)
{
   if (a % b == 0)
       return a / b;
   return a / b + 1;
}
ll lcm(ll a, ll b) { return (a * b) / __gcd(a, b); };

string change (string s)
{
    // cout<<s<<"* ";
    if(count(s.begin(),s.end(),'9')==s.length())
    {
        for(auto &it:s)
            it='0';
        s+='1';
        reverse(s.begin(),s.end());
        return s;
    }
    ll i=s.length()-1;
    while(i>=1 and (s[i]=='9' or s[i]>=s[i-1]+1 ))
        i--;
    s[i]++;
    i++;
    for(;i<s.length();i++)
        s[i]=max(char(s[i-1]-1),'0');
    return s;
}

int main()
{

ll i,j,k,n,m;
cin>>k;
string s="1";
string ans;
while(k)
{
    ans=s;
    s=change(s);
    k--;    
}

cout<<ans;
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
 
int comp( const void *c1, const void *c2 );
 
int main()
{
  int n, cnt=0, i;
  long int  a[100001]={0}, b;
  
  scanf("%d", &n); 
  for(i=0; i < n; i++){
    scanf("%ld", &a[i]);
  }
  qsort(a, n, sizeof(long int), comp);
  for(i=0; i < n; i++){
    if(a[i]!=a[i+1]){
      cnt++;
    }else{
      i++;
    }
  }
  printf("%d\n", cnt);
  return 0;
}


int comp( const void *c1, const void *c2 )
{
  int tmp1 = *(int *)c1;
  int tmp2 = *(int *)c2;
 
  if( tmp1 > tmp2 )  return -1;
  if( tmp1 == tmp2 ) return  0;
  if( tmp1 < tmp2 )  return  1;
}

Measured memory_bytes: 1788
import sys, math, re
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

s = input()
s = s.replace('BC', 'D')
matches = re.findall(r'[AD]+', s)
ans = 0
for w in matches:
    n = len(w)
    p = n-1
    for i in range(n-1, -1, -1):
        if w[i] == 'A':
            ans += p-i
            p -= 1

print(ans)

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl

typedef long long LL;
typedef long double LD;

int main(){
  int n,k;
  cin >> n >> k;
  double ans=0;
  repp(i,1,n+1){
    double tmp=(double)1/n;
    LL x=i;
    for(;x<k;x*=2){
      tmp*=0.5;
    }
    ans+=tmp;
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())

from heapq import heappush, heappop
Q = []
for _ in range(N):
    x, l = mapint()
    heappush(Q, (x+l, x-l))

ans = 0
now = -10**20
while Q:
    r, l = heappop(Q)
    if l<now:
        continue
    ans += 1
    now = r

print(ans)

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

int main(){
  int N,A,B,j=0;
  cin>>N>>A>>B;
  for(int i=1;i<=N;i++){
    int l=0;
    for(int k=i;k>0;k/=10)
      l+=k%10;
    if(A<=l && l<=B){
      j+=i;
    }
  }
  cout<< j <<endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
const ll MOD = 1000000007;

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n%2 != 0)
            res = res * a % mod;
        a = a * a % mod;
        n /= 2;
    }
    return res;
}

int main() {
    ll N, K;
    cin >> N >> K;
    cout << K * modpow(K-1, N-1, MOD) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	long long h, n, i, j, k, x, s;
	cin >> h >> n;
	s = 0;
	for (i = 0; i < n; i++) {
		cin >> x;
		s += x;
	}
	if (s >= h) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}


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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    set<int> nums;
    rep(i, 3){
        int c;
        cin >> c;
        nums.insert(c);
    }

    cout << nums.size() << endl;
}

Measured memory_bytes: 256
#include<iostream>
    #include<cstdio>
    #include<cstring>
    namespace Wo_Zhen_Cai_A
    {
    	typedef long long ll;
    	const int N=2010,MOD=1000000007;
    	inline void inc(ll a,ll &b){b=(a+b)%MOD;} 
    	ll qpow(ll a,ll b){ll c=1;for(;b;b>>=1,a=a*a%MOD)if(b&1)c=c*a%MOD;return c;}
    	ll fact[N*N],ifact[N*N];
    	ll C(int n,int m){return fact[n]*ifact[n-m]%MOD*ifact[m]%MOD;}
    	ll f[N][N];
    	int n,k;
    	void solve()
    	{
    		scanf("%d%d",&n,&k);
    		if(k==1){printf("1\n");return;}
    		fact[0]=1;for(int i=1,tmp=n*k;i<=tmp;i++)fact[i]=fact[i-1]*i%MOD;
    		ifact[n*k]=qpow(fact[n*k],MOD-2);
    		for(int i=n*k;i;i--)ifact[i-1]=ifact[i]*i%MOD;
     
    		f[0][0]=1;
    		for(int i=0;i<=n;i++)
    			for(int j=i;j<=n;j++)
    			{
    				if(i+j==0)continue;
     
    				if(i)inc(f[i-1][j],f[i][j]);
    				if(j)inc(f[i][j-1]*C(k*i+(k-1)*(j-i-1)+k-2,k-2)%MOD,f[i][j]);
     
     
    //				printf("f[%d][%d] = %lld\n",i,j,f[i][j]);
    			}
    		printf("%lld\n",f[n][n]*fact[n]%MOD);
    	}
    }
    int main()
    {
    	Wo_Zhen_Cai_A::solve();
    	return 0;
    }

Measured memory_bytes: 94592
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>
#include<map>

using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

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

ll bpow(int n) {
	ll x = 1;
	for (int i = 1; i <= n; i++) {
		x *= 2;
	}
	return x;
}

void solve() {

	int n;
	cin >> n;
	if (n == 1) {
		cout << "Hello World" << endl;
	}
	else {
		int a, b;
		cin >> a >> b;
		cout << a + b << endl;
	}

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <map>
#include <algorithm>
using namespace std;
const int SIZEN = 500010;
int N;
map<long long ,int> mp;
int main(){
	scanf("%d",&N);
	long long ans = 0;
	for(int i = 1;i <= N;i++){
		long long x;
		scanf("%lld",&x);
		mp[x]++;
		ans += x;
	}
	int M;
	scanf("%d",&M);
	for(int i = 1;i <= M;i++){
		long long x,y;
		scanf("%lld%lld",&x,&y);
		ans -= x * mp[x];
		ans += y * mp[x];
		mp[y] += mp[x];
		mp[x] = 0;printf("%lld\n",ans);
	}
	
	return 0;
}
/*
4
1 1 1 1
3
1 2
2 1
3 5
*/

Measured memory_bytes: 9244
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define gc getchar()
#define mp make_pair
#define int long long
#define P pair<int,int>
#define ri register int
#define rb register bool
#define rc register char
#define t(i) edge[i].to
#define w(i) edge[i].wei
#define rp(i,x,y) for(ri i=x;i<=y;++i)
#define my(i,x,y) for(ri i=x;i>=y;--i)
#define e(i,x) for(ri i=head[x];i;i=edge[i].nxt)

const int N=100000+10,M=200000+10,mod=1e9+7;
int n,m,head[N],ed_cnt,dis1[N],g1[N],dis2[N],g2[N],as,S,T;
bool vis[N];
struct ed{int to,nxt,wei;}edge[M<<1];
struct edg{int fr,to,wei;}e[M];

il int read()
{
	rc ch=gc;ri x=0;rb y=1;
	while(ch!='-' && (ch<'0' || ch>'9'))ch=gc;
	if(ch=='-')ch=gc,y=0;
	while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^'0'),ch=gc;
	return y?x:-x;
}
il int abss(ri x){return x>0?x:-x;}
il void ad(ri x,ri y,ri z){edge[++ed_cnt]=(ed){x,head[y],z};head[y]=ed_cnt;}
il void dij1()
{
	priority_queue< P,vector<P>,greater<P> >Q;Q.push(mp(0,S));
	memset(dis1,63,sizeof(dis1));dis1[S]=0;g1[S]=1;memset(vis,0,sizeof(vis));
	while(!Q.empty())
	{
		ri nw=Q.top().second;Q.pop();if(vis[nw])continue;vis[nw]=1;
		e(i,nw)
		{
			if(dis1[nw]+w(i)==dis1[t(i)])(g1[t(i)]+=g1[nw])%=mod;
			if(dis1[nw]+w(i)<dis1[t(i)])dis1[t(i)]=dis1[nw]+w(i),g1[t(i)]=g1[nw],Q.push(mp(dis1[t(i)],t(i)));
		}
	}
}
il void dij2()
{
	priority_queue< P,vector<P>,greater<P> >Q;Q.push(mp(0,T));
	memset(dis2,63,sizeof(dis2));dis2[T]=0;g2[T]=1;memset(vis,0,sizeof(vis));
	while(!Q.empty())
	{
		ri nw=Q.top().second;Q.pop();if(vis[nw])continue;vis[nw]=1;
		e(i,nw)
		{
			if(dis2[nw]+w(i)==dis2[t(i)])(g2[t(i)]+=g2[nw])%=mod;
			if(dis2[nw]+w(i)<dis2[t(i)])dis2[t(i)]=dis2[nw]+w(i),g2[t(i)]=g2[nw],Q.push(mp(dis2[t(i)],t(i)));
		}
	}
}

signed main()
{
	//freopen("3883.in","r",stdin);freopen("3883.out","w",stdout);
	n=read();m=read();S=read();T=read();
	rp(i,1,m){ri x=read(),y=read(),z=read();ad(x,y,z);ad(y,x,z);e[i]=(edg){x,y,z};}
	dij1();dij2();as=1ll*g1[T]*g1[T]%mod;
	rp(i,1,n)
		if(dis1[i]+dis2[i]==dis1[T] && dis1[i]==dis2[i])as=(as-1ll*g1[i]*g1[i]%mod*g2[i]%mod*g2[i]%mod+mod)%mod;
	rp(i,1,m)
	{
		if(dis1[e[i].fr]+dis2[e[i].to]+e[i].wei==dis1[T] && abss(dis1[e[i].fr]-dis2[e[i].to])<e[i].wei)
			as=(as-1ll*g1[e[i].fr]*g1[e[i].fr]%mod*g2[e[i].to]%mod*g2[e[i].to]%mod+mod)%mod;
		swap(e[i].fr,e[i].to);
		if(dis1[e[i].fr]+dis2[e[i].to]+e[i].wei==dis1[T] && abss(dis1[e[i].fr]-dis2[e[i].to])<e[i].wei)
			as=(as-1ll*g1[e[i].fr]*g1[e[i].fr]%mod*g2[e[i].to]%mod*g2[e[i].to]%mod+mod)%mod;
	}
	printf("%lld\n",as);
	return 0;
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#include <vector>
#include <math.h>

using namespace std;

 int main(){

 int n,k;
 cin>>n>>k;

  if(n == 1){
    cout<<"1"<<endl;
    return 0;
  }

  int num = 1;
  int dig=0;

  while(num <= n){
      num *= k;
       dig++;
  }

  cout<<dig<<endl;

 return 0;
 }


Measured memory_bytes: 256