akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;

#define MAX(A,B) ((A) > (B)? (A): (B))

int data[100][50] = {0};
int table[100][50] = {0};

int main() {
	int size = 0;
	char str[200];
	while (gets(str) != NULL) {
		for (int i = 0, count = 0, sum = 0, len = strlen(str); i <= len; i++) {
			if (str[i] == ',' || str[i] == '\0') {
				data[size][count++] = sum;
				sum = 0;
			} else {
				sum = str[i++] - '0';
				for (int j = i; '0' <= str[i] && str[i] <= '9'; i++)
					sum = sum*10 + (str[i]-'0');
				--i;
			}
		}
		++size;
	}
	table[0][0] = data[0][0];
	for (int i = 1; i < size; i++) {
		for (int j = 0, side = (i >= size/2+1? size-i: i+1); j < side; j++) {
			if (i == side-1) {
				if (j == 0)
					table[i][j] = table[i-1][0] + data[i][j];
				else if (j == side-1)
					table[i][j] = table[i-1][j-1] + data[i][j];
				else
					table[i][j] = MAX(table[i-1][j-1], table[i-1][j]) + data[i][j];
			} else {
				table[i][j] = MAX(table[i-1][j], table[i-1][j+1]) + data[i][j];
			}
		}
	}
	cout << table[size-1][0] << endl;
	return 0;
}

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

int main() {

  int N, K;
  cin >> N;
  cin >> K;
  
  int x = 1;
  
  for (int i = 0; i < N; i++) {
  	if (K < x) {
      x += K;
    }
    else {
      x *= 2;
    }
  }
  
  cout << x << endl;
  
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/03/05  Problem: 079_arc_c / Link: https://arc079.contest.atcoder.jp/tasks/arc079_c?lang=en  ----- */
/* ------問題------

長さ N の非負整数列 ai に対し、数列の最大値が N−1 以下になるまで以下の操作を繰り返し行うことを考えます。なお、この操作はD問題で考える操作と同一です。

数列のうち最も大きい要素を求める、複数ある場合はどれか 1 つ選ぶ。この要素の値を N 減らす。これ以外の要素の値を 1 増やす。
なお、この操作を行い続けると、いつかは数列の最大値が N−1 以下になることが証明できます。

ここで、数列 ai が与えられるので、何回操作を行うことになるかを求めてください。

-----問題ここまで----- */
/* -----解説等-----

ええーこの2問なんでこの点数なのかわからない
こちらも端折っていくだけ

----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	cin >> N;
	VL a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}
	int update = 1;
	while (update) {
		update = 0;

		FOR(i, 0, N) {
			LL ret = a[i] / N;
			if (ret) {
				a[i] -= ret*N;
				ans += ret;

				FOR(j, 0, N) {
					if (i == j)continue;
					a[j] += ret;
				}
			}
		}
		LL m = 0;
		FOR(i, 0, N) {
			m = max(m, a[i]);
		}

		if (m < N)update = 0;
		else update = 1;
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
while true do
  h,w = gets.split(" ").map(&:to_i)
  if h == 0 || w == 0 then
    break
  end
  puts("#"*w)
  (h-2).times do
    puts("#"+"."*(w-2)+"#")
  end
  puts("#"*w)
  puts
end

Measured memory_bytes: 8820
import sys
input=sys.stdin.readline
n,q=map(int,input().split())
s=input()
a=[0]*n
for x in range(1,n):
  a[x]+=a[x-1]
  if s[x-1]=='A' and s[x]=='C':
    a[x]+=1
  
    
for y in range(q):
  
  l,r=map(int,input().split())
  ans=a[r-1]-a[l-1]
  print(ans)
  

Measured memory_bytes: 13220
#include<bits/stdc++.h>
#define me(a,x) memset(a,x,sizeof(a))
#define sc scanf 
#define itn int
using namespace std;
const int N=1e5+5;
const long long mod=1e9+7;
const int oo=0x7fffffff;
const int sup=0x80000000;
typedef long long ll;
typedef unsigned long long ull;
template <typename it>
string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}
template <typename it>int o(it a){cout<<a<<endl;return 0;}
ll f[N]={0};
int a[N];
int p[N]={0};
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>a[i],p[a[i]]=1;
	f[0]=1;
	f[1]=1;
	if(p[1])f[1]=0;
	for(int i=2;i<=n;i++){
		f[i]=(f[i-1]+f[i-2])%mod;
		if(p[i])f[i]=0;
	}
	o(f[n]);
}


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

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

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

    int s = 0;
    for (int i = 0; i < N - 1; i++) {
        int a = abs(A[i] - A[i+1]);
        if (a > s) {
            s = a;
        }
    }
    if (abs(K - A[N-1] + A[0]) > s) {
        s = abs(K - A[N-1] + A[0]);
    }

    cout << K - s << endl;



}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
    int n, x;

    cin >> n;

    for (int i = 1; i <= n; i++)
    {
        x = i;

        if (x % 3 == 0)
        {
            cout << " " << i;
        }
        else
        {
            while (x != 0)
            {
                if (x % 10 == 3)
                {
                    cout << " " << i;
                    break;
                }

                x /= 10;
            }
        }

    }

    cout << endl;

    return 0;
}



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

int main(){
    long long  n,m;
    cin >> n >> m;
    long long  a[m];
    long long  sum = 0;
    rep(i,m){
        cin >> a[m];
        sum += a[m];
    }
    
    long long remain = n - sum;
    if(remain >= 0) cout << remain << endl;
    else cout << -1 << endl;
}

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

int main(){
	int N;
	cin >> N;
	vector<long long> A(N + 1);
	vector<long long> B(N);
	for(int i = 0; i < N + 1; i++) cin >> A.at(i);
	for(int i = 0; i < N; i++) cin >> B.at(i);
	
	long long cnt = 0;
	for(int i = 0; i < N; i++){
		long long ii = A.at(i) + A.at(i + 1);
		int attack = min(ii, B.at(i));
		if(ii < B.at(i)) A.at(i + 1) = 0;
		else if(A.at(i) < B.at(i)){
			long long dis = B.at(i) - A.at(i);
			A.at(i + 1) -= dis;
		}
		cnt += attack;
	}
	cout << cnt << endl;
}

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

int main()
{
  int64_t N, ans = 0;
  cin >> N;
  string S;
  cin >> S;
  vector<int> R(N + 1, 0), G(N + 1, 0), B(N + 1, 0);
  for (int i = 0; i < N; i++)
  {
    if (S[i] == 'R')
      R[i + 1]++;
    else if (S[i] == 'G')
      G[i + 1]++;
    else
      B[i + 1]++;
    R[i + 1] += R[i];
    G[i + 1] += G[i];
    B[i + 1] += B[i];
  }
  for (int i = 0; i < N - 2; i++)
  {
    for (int k = i + 2; k < N; k++)
    {
      if (S[i] == S[k])
        continue;
      int j = (k + i) / 2;
      if (S[i] != 'R' && S[k] != 'R')
      {
        ans += R[k] - R[i];
        if (j - i == k - j && S[j] == 'R')
        {
          ans--;
        }
      }
      else if (S[i] != 'G' && S[k] != 'G')
      {
        ans += G[k] - G[i];
        if (j - i == k - j && S[j] == 'G')
        {
          ans--;
        }
      }
      else
      {
        ans += B[k] - B[i];
        if (j - i == k - j && S[j] == 'B')
        {
          ans--;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;

int main()
{
  int64_t n, k;
  cin >> n >> k;
  vector<priority_queue<int64_t>> vpq(MAXN);
  for (int i = 0; i < n; i++)
  {
    int64_t t, d;
    cin >> t >> d;
    vpq[t].push(d);
  }
  int64_t s1 = 0;
  vector<int64_t> v1, v2;
  for (int i = 0; i < MAXN; i++)
  {
    if (vpq[i].empty())
      continue;
    v1.emplace_back(vpq[i].top());
    vpq[i].pop();
    while (vpq[i].size())
    {
      v2.emplace_back(vpq[i].top());
      vpq[i].pop();
    }
  }
  sort(v1.begin(), v1.end(), greater<int64_t>());
  sort(v2.begin(), v2.end(), greater<int64_t>());
  int64_t ans = 0;
  for (int64_t i = 1; i <= min(k, (int64_t)v1.size()); i++)
  {
    int64_t tmp = accumulate(v1.begin(), v1.begin() + i, 0LL) + i * i;
    int j = k - i;
    if (j <= v2.size())
    {
      tmp += accumulate(v2.begin(), v2.begin() + j, 0LL);
      ans = max(ans, tmp);
    }
  }
  cout << ans << endl;
}

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define all(c) begin(c),end(c)
const ll INF = 1e10;
int main() {
	cin.sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	vector<vector<int>>path(N);
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		path[a].push_back(b);
		path[b].push_back(a);
	}
	int min_p = N,min_node=0;
	rep(i, N) {
		if (min_p > path[i].size()) {
			min_node = i;
			min_p = path[i].size();
		}
	}
	deque<int>ans;
	ans.push_back(0);
	set<int>st;
	st.insert(0);
	bool flag = true;
	while (flag) {
		int n = ans.back();
		flag = false;
		rep(i, path[n].size()) {
			if (!st.count(path[n][i])) {
				ans.push_back(path[n][i]);
				st.insert(path[n][i]);
				flag = true;
				break;
			}
		}
	}
	flag = true;
	while (flag) {
		int n = ans.front();
		flag = false;
		rep(i, path[n].size()) {
			if (!st.count(path[n][i])) {
				ans.push_front(path[n][i]);
				st.insert(path[n][i]);
				flag = true;
				break;
			}
		}
	}
	cout << ans.size() << endl;
	rep(i, ans.size()) {
		cout << ans[i]+1;
		if (i != ans.size() - 1)cout << " ";
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 11392
# Problem D - Not Divisible
# input
N = int(input())
a_nums = list(map(int, input().split()))

# initialization
max_a = max(a_nums)
fact_list = [0] * (max_a + 1)
ans = 0

# count
for a in a_nums:
    tmp = max_a // a
    for i in range(tmp):
        fact_list[a*(i+1)] += 1

# count 2
for a in a_nums:
    if fact_list[a]==1:
        ans += 1

# output
print(ans)


Measured memory_bytes: 32172
X, N = map(int, input().split())
if N == 0:
    P = []
else:
	P = list(map(int, input().split()))

P = sorted(P)

prev = 1000
ans = 101
for i in range(101, -1, -1):
    if i in P:
        pass
    else:
        if abs(X-i) <= prev:
            ans = min(i, ans)
            prev = abs(X-i)
print(ans)

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

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

const int MAX { 200010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

ll solve(int N, const vector<ll>& xs)
{
    return 0;
}

int main()
{
    ios::sync_with_stdio(false);

    string S, T, U;
    int A, B;

    cin >> S >> T >> A >> B >> U;

    (S == U) ? --A : --B;

    cout << A << ' ' << B << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

void rsorta_d32(void *base, const int count, const int size, const int index){
	typedef int32_t rsort_t;
	rsort_t (*a)[size] = (rsort_t(*)[size])base;
	rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
	int c[0x100];
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(0<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(0<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(1<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(1<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(2<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(2<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(3<<3))+0x80]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(3<<3))+0x80]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	free(b);
}

int n;
int a[100001];
int b[100001];
int c[100001];
int d[200001];

int inc(int i){
	i+=100000;
	while(i<=200000){
		d[i]++;
		i+=i&-i;
	}
}

int sum(int i){
	i+=100000;
	int s=0;
	while(i>0){
		s+=d[i];
		i-=i&-i;
	}
	return s;
}

long f(int x){
	for(int i=1; i<=n; i++){
		c[i]=c[i-1]+(a[i]<=x?1:-1);
	}
	memset(d, 0, sizeof(d));
	long ans=0;
	inc(c[0]);
	for(int i=1; i<=n; i++){
		ans+=sum(c[i]-1);
		inc(c[i]);
	}
	return ans;
}

int main(void){
	n=nextint();
	for(int i=1; i<=n; i++){
		a[i]=b[i]=nextint();
	}
	rsorta_d32(b+1, n, 1, 0);
	int kl=1, kr=n;
	long m = (long)n*(n+1)/4+1;
	//printf("%d\n", m);
	while(kl<=kr){
		int km=(kl+kr)/2;
		//printf("%d %d %ld\n", km, b[km], f(b[km]));
		if(f(b[km])>=m) kr=km-1; else kl=km+1;
	}
	//printf("%d %d %ld\n", kl, b[kl], f(b[kl]));
	printf("%d\n", b[kl]);
}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int di2[] = {1, 1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1};
const int dj2[] = {1, -1, 1, -1, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;


int main(){
  int n;
  ll k;
  cin >> n >> k;
  vector<ll> a(n), b(n);
  rep(i, n) cin >> a[i] >> b[i];

  vector<bool> used(n, false);

  ll ans = 0;
  rep(i, n) {
    if((a[i] | k) == k) ans += b[i];
  }
  rep(d, 32) {
    ll tmp = 0;

    if(!(k & 1ll<<d)) continue;
    rep(i, n) {
      if(!(a[i] & 1ll<<d) && (k>>(d+1) | a[i]>>(d+1)) == k>>(d+1)) tmp += b[i];
    }

    chmax(ans, tmp);
  }

  cout << ans << endl;
}

Measured memory_bytes: 4840
#include <queue>
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define set0(x) memset(x,0,sizeof(x))
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();int f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
ll n,cnt[300],mod = 1e9+7;
char ch[100010];
int main() {
	read(n);
	cin>>ch;
	for(int i=1;i<=180;i++)cnt[i] = 1;
	for(int i=0;i<n;i++)cnt[ch[i]]+=1;
	for(int i=2;i<=180;i++)cnt[i] = (cnt[i]*cnt[i-1])%mod;
	cout<<(cnt[180]+mod-1)%mod<<endl;
	return 0;
}


Measured memory_bytes: 384
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
#define MAX_N 110000
#define MOD 1000000007
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
ll dp[MAX_N][101][2]={};
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll d,n;
  string k;
  cin >> k >> d;
  n = k.size();
  dp[0][0][0] = 1;
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
      for(int b=0;b<2;b++){
        ll end;
        if(b==1) end = 9;
        else end = k[i]-'0';
        for(int l=0;l<=end;l++){
          ll nd = (j+l)%d;
          ll nb = (b||(l!=end));
          dp[i+1][nd][nb] += dp[i][j][b];
          dp[i+1][nd][nb] %= MOD;
        }
      }
    }
  }
  cout << (dp[n][0][0]+dp[n][0][1]-1+MOD)%MOD <<endl;
}


Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int i;
    int flag=0;
    if(s.length()==3)
    {
        for(i=0;i<3;i++)
        {
            if(s[i]=='7')
            {
                flag=1;
                break;
            }
            else
                flag=0;
        }
        if(flag==1)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3620
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
//if(strcmp(s[i],"AC")==0)
//if(s[l]=='#')
/*小文字判定
if((moji>= 'a') && (moji<='z')){
    printf("a\n");
    return 0;
  }
  */

int W_Length(char *str){
	int length = 0;
	while(*str++ != '\0')
		length++;
	return length;
}

void swap(int *a, int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}
//swap(&a, &b)

double deg(double theta){//deg to theta
return theta*(2*3.14159265359)/360;
}

int cmp( const void *p, const void *q ) {
    return *(int*)p - *(int*)q;
}//ちいさい順
//qsort(a,n,sizeof(int),cmp);
//char s[n][11]

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}
//qsort(s,n,sizeof(s[0]),cmp_s);


int main (void)
{
	int l[210000],c[210000],n,i,j,k,count=0,m=1,temp;
  char s[200005];

scanf("%d",&n);
	for(i=0;i<n;i++){
scanf("%d",&l[i]);

	}
  for(i=0;i<n-2;i++){
    for(j=i+1;j<n-1;j++){
      for(k=j+1;k<n;k++){
      if(l[k]<l[j]+l[i]&&l[j]<l[k]+l[i]&&l[i]<l[j]+l[k]&&l[k]!=l[i]&&l[k]!=l[j]&&l[j]!=l[i]&&i!=j&&j!=k){
      count++;
        //printf("%d%d%d\n",l[i],l[j],l[k]);
      }
      
      }
    
    }
  
  
  }
  printf("%d",count);
	
return 0;
}


Measured memory_bytes: 1736
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10


		
#階乗#
lim = 10**5   #必要そうな階乗の限界を入力
fact = [1] * (lim+1)
for n in range(1, lim+1):
	fact[n] = n * fact[n-1] % mod

#階乗の逆元#
fact_inv = [1]*(lim+1)
fact_inv[lim] = pow(fact[lim], mod-2, mod)
for n in range(lim, 0, -1):
	fact_inv[n-1] = n*fact_inv[n]%mod

def C(n, r):
	if n < r:
		return 0
	else:
		return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod

N, K = MAP()
A = LIST()
A.sort()

max_sum = 0
for i in range(K-1, N):
	max_sum = (max_sum + A[i]*C(i, K-1)%mod)%mod

A = A[::-1]
min_sum = 0
for i in range(K-1, N):
	min_sum = (min_sum + A[i]*C(i, K-1)%mod)%mod

print((max_sum - min_sum)%mod)

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

bool dpx[8005][8005];
bool dpy[8005][8005];

int main()
{
    string S;
    cin >> S;
    int x, y;
    cin >> x >> y;
    int s = S.length();
    REP(i, S.length())
    {
        if (S[i] == 'T')
        {
            s = i;
            break;
        }
        x--;
    }
    vector<int> X, Y;
    int n = 0;
    bool axisX = true;
    FOR(i, S.length(), s)
    {
        if (S[i] == 'T')
        {
            if (n != 0)
            {
                if (axisX)
                {
                    X.push_back(n);
                }
                else
                {
                    Y.push_back(n);
                }
            }
            axisX = !axisX;
            n = 0;
            continue;
        }
        n++;
    }
    if (axisX)
    {
        X.push_back(n);
    }
    else
    {
        Y.push_back(n);
    }

    dpx[0][0] = true;
    REP(i, X.size())
    {
        REP(j, 8005)
        {
            if (dpx[i][j])
            {
                dpx[i + 1][abs(j + X[i])] = dpx[i + 1][abs(j - X[i])] = true;
            }
        }
    }
    dpy[0][0] = true;
    REP(i, Y.size())
    {
        REP(j, 8005)
        {
            if (dpy[i][j])
            {
                dpy[i + 1][abs(j + Y[i])] = dpy[i + 1][abs(j - Y[i])] = true;
            }
        }
    }

    if (dpx[X.size()][abs(x)] && dpy[Y.size()][abs(y)])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 34176
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

int main(void){
    int n, q;
    char s[100010];
    cin >> n >> q;
    cin >> s;
    
    vector<int> a(n, 0);
    for (int i = 0; i < n - 1; i++) {
        a[i + 1] = a[i];
        if (s[i] == 'A' && s[i + 1] == 'C') a[i + 1]++;
        //cout << a[i] << " ";
    }
    
    for (int i = 0; i < q; i++) {
        int l, r;
        cin >> l >> r;
        l--;  r--;
        cout << a[r] - a[l] << endl;
    }
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if (a == b && b == c && c == a) cout << 1 << endl;
  else if (a!=b&&b!=c&&c!=a)
    cout << 3 << endl;
  else
    cout << 2 << endl;
}

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


int main(){

    int N, X, m[1000];
    cin >> N >> X;
    for( int i = 0; i < N; i ++ ) cin >> m[i];


    int min_donut = m[0];

    for( int i = 0; i < N; i ++ ){
        X -= m[i];
        min_donut = min( min_donut, m[i] );
    }

    cout << N + X/min_donut << endl;

    return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=200000000000000;
double pi=3.141592653589793;
//setprecision(20) <<

const int MOD = 1000000007;

long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
long myPow(long long x, long long n, long long m=MOD){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

class Point{
public:
	long long x;
	long long y;
	long long dis;
	Point(long long _x,long long _y,long long _dis){
		x=_x;
		y=_y;
		dis=_dis;
	}
};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	long long n,k;
	cin>>n>>k;
	vector<long long>a(n);
	vector<long long>f(n);
	vector<long long>d(n);
	
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		cin>>f[i];
	}sort(a.begin(),a.end());
	sort(f.begin(),f.end(),greater<long long>());
	//cout<<a[1]<<f[1]<<endl;
	long long ans=INF;
	long long r=10000000;
	long long l=-1;
	long long mid=2;
	while(r-l>1){
		long long m=l+(r-l)/2;
		if((a[1]-m)*f[1]>mid)l=m;
		else r=m;
		//cout<<m<<endl;
	}
	//cout<<r<<endl;
	long long right=INF;
	long long left=-1;
	while(right-left>1){
		long long mid=left+(right-left)/2;
		bool isOK=false;
		long long k_=0;
		long long ans_=0;
		//mid=12;
		for(int i=0;i<n;i++){
			long long r=10000000;
			long long l=-1;
			while(r-l>1){
				long long m=l+(r-l)/2;
				if((a[i]-m)*f[i]<=mid)r=m;
				else l=m;
				//cout<<m<<endl;
			}
			k_+=r;
			ans_=max((a[i]-r)*f[i],ans_);
			
		//cout<<i<<" "<<k_<<endl;
		}
		if(k_<=k)isOK=true;
		if(isOK){
			right=mid;
			ans=min(ans,ans_);
		}
		else left=mid;
		//cout<<ans<<endl;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890123456789LL
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	string S;
	cin >> N >> S;
	int nw = 0, ne = 0;
	for(int i = 0; i < N; i++) if(S[i] == 'E') ne++;
	int ans = N;
	for(int i = 0; i < N; i++) {
		if(S[i] == 'E') ne--;
		ans = min(ans, ne+nw);
		if(S[i] == 'W') nw++;
	}
	cout << ans << "\n";
	return 0;}

// look at my code
// my code is amazing


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

using namespace std;

#define INF 1000000000
#define INFLL 0x3f3f3f3f3f3f3f3fLL 
#define EPS 10e-9
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define st first
#define nd second
#define sz(v) int(v.size())
#define all(X) (X).begin(), (X).end()
#define FOR(I, A, B) for(int I = A; I < B; I++)
#define RFOR(I, A, B) for(int I = A; I >= B; I--)

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<iii> viii;
typedef vector<ll> vll;

ll _sieve_size;
bitset<10000010> bs;
vll primes;

void sieve(ll upperbound) {
	_sieve_size = upperbound + 1;
	bs.set();
	bs[0] = bs[1] = 0;
	for (ll i = 2; i <= _sieve_size; i++){
		if (bs[i]) {
			for (ll j = i * i; j <= _sieve_size; j += i){
				bs[j] = 0;
			}
			primes.push_back(i);
		}
	}
}

map<ll,ll> getPrimeFact(ll n) {
	ll ind = 0, pf = primes[0];
	map<ll,ll> ans;
	while (pf*pf <= n) {
		while (n % pf == 0) {
			n /= pf;
			ans[pf]++; 
		}
		if(ind + 1 == sz(primes)) break;
		pf = primes[++ind];
	}
	if (n != 1) ans[n]++;
	return ans;
}

ll getans(ll e){
	ll l = 1, r = 1000000;
	while(l < r){
		ll mid = (l+r+1)/2;
		if((mid*(mid+1))/2 > e){
			r = mid-1;
		} else {
			l = mid;
		}
	}
	return l;
}

int main(){
	ll n;
	scanf("%lld", &n);
	sieve(1000000);
	map<ll,ll> fact = getPrimeFact(n);
	ll ans = 0;
	for(auto par : fact){
		ll e = par.nd;
		//printf("e: %lld, getans: %lld\n", e, getans(e));
		ans += getans(e);
	}
	printf("%lld\n", ans);
	return 0;

}



Measured memory_bytes: 5544
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	string a,b,c;
	cin>>a>>b>>c;
	
	cout<<"A"+b.substr(0,1)+"C"<<endl;
	
    return 0;
}



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

using namespace std;

#define MAX 1010

struct Point{
  double x,y;
  Point(){}
  Point(double x,double y) : x(x),y(y) {}
};

int N,X,Y;
Point sp;
vector<Point> p;
vector<int> G[MAX];

double getDist(Point &a,Point &b){
  return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}

void init(){
  for(int i = 0 ; i < MAX ; i++){
    G[i].clear();
  }  
}

void solve(){
  int res = 0;
  queue<int> que;
  que.push(0);
  int d[N+1];
  memset(d,0,sizeof(d));
  bool ok=1;
  while(!que.empty()) {
    int x=que.front();que.pop();
    for(int i=0; i<G[x].size(); i++) {
      int y=G[x][i];
      if(d[y]) continue;
      if(x && X>Y) ok=0;
      d[y]=d[x]+1;
      que.push(y);
    }
  }
  for(int i=1; i<=N; i++) res=max(res,d[i]*X);
  if(ok) cout << res << endl;
  else cout << "You're always welcome!" << endl;
}

int main(){
  int Tc;
  cin >> Tc;
  while(Tc--){
    init();
    cin >> N >> X >> Y;
    cin >> sp.x >> sp.y;
    p.resize(N);
    for(int i = 0 ; i < N ; i++){
      cin >> p[i].x >> p[i].y;
      if(getDist(sp,p[i]) <= 10){
	G[0].push_back(i+1);
      }
    }
    for(int i = 0 ; i < N ; i++){
      for(int j = 0 ; j < N ; j++){
	if(i == j){ continue; }
	if(getDist(p[i],p[j]) <= 50){
	  G[i+1].push_back(j+1);
	}
      }
    }
    solve();
  }
  return 0;
}

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

int main(void) {
    int A,B,C,D,P;cin>>A>>B>>C>>D>>P;
    int X = P * A;
    int Y = B;
    if (P > C) {
        Y += (P - C) * D;
    }
    cout << min(X, Y) << endl;
    return 0;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k%2==1){
            ret*=now;
            ret%=mod2;
        }
        now*=now;
        now%=mod2;
        k/=2;
    }
    return ret;
}


int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int n;cin>>n;
    int a[n];
    int cnt[3];
    fill(cnt,cnt+3,0);
    rep(i,0,n){
        cin>>a[i];
        cnt[a[i]-1]++;
    }
    double dp[n+1][n+1][n+1];
    memset(dp,0,sizeof dp);
    dp[0][0][0]=0;
    dp[1][0][0]=(double)0;
    rep(i,0,n+1){
        rep(j,0,n+1){
            if(i+j>n)break;
            rep(k,0,n+1){
                if(i+j+k>n)break;
                if(i==0&&j==0&&k==0)continue;
                dp[k][j][i]/=(double)(i+j+k);
                dp[k][j][i]+=(double)n/(i+j+k);
                if(i+1+j+k<=n)dp[k+1][j][i]+=(k+1)*dp[k][j][i];
                if(k>0)dp[k-1][j+1][i]+=(j+1)*dp[k][j][i];
                if(j>0)dp[k][j-1][i+1]+=(i+1)*dp[k][j][i];
            }
        }
    }
   /* rep(i,0,4){
        rep(j,0,4){
            rep(k,0,4)cout<<dp[k][j][i]<<" ";
            cout<<endl;
        }
    }*/
    cout<<fixed<<setprecision(12)<<dp[cnt[0]][cnt[1]][cnt[2]]<<endl;
    
}


Measured memory_bytes: 213376
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef pair <int, int> pii;
 
const int N = 1e5 + 10;
int n, m, ans;
pii ar[N];

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> ar[i].first >> ar[i].second;
	sort(ar, ar + n);
	
	int r = 0;
	while (r < n && m) {
		int tmp = min(m, ar[r].second);
		m -= tmp;
		ans += tmp * ar[r].first;
		r++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
import numpy as np

N,M=list(map(int,input().split()))
A=np.zeros((N,2))

for i in range(N):
    a,b=list(map(int,input().split()))
    A[i][0]=a
    A[i][1]=b

B=sorted(A,key=lambda x: x[0])

i=0
count=0
cost=0
while(1):
    if count+B[i][1]<=M:
        count+=B[i][1]
        cost+=B[i][0]*B[i][1]
    elif count+B[i][1]>M:
        add=(M-count)
        count+=add
        cost+=B[i][0]*add
    if count==M:
        break
    i+=1
print(int(cost))

Measured memory_bytes: 32044
#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
using namespace std;

const long long INF=9000000000000000;
int main(){
  int n,e=0,w=0,ans,aans=100000000;
  cin>>n;
  char d[n];
  int de[n];
  int dw[n];
  for(int i=0;i<n;i++){
    cin>>d[i];
    if(d[i]=='E')
      e++;
    else{
      w++;
    }
    de[i]=e;dw[i]=w;
  }
  for(int i=0;i<n;i++){
    if(i==0)
      ans=dw[n-1]-dw[0];
    else if(i==n-1)
      ans=de[n-2];
    else{
      ans=de[i-1]+dw[n-1]-dw[i];
    }
    aans=min(aans,n-1-ans);
  }
  cout<<aans<<endl;
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++)
    {
        if (i % 2)
        {
            if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D')
            {
                continue;
            }
            else
            {
                cout << "No\n";
                return 0;
            }
        }
        else
        {
            if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D')
            {
                continue;
            }
            else
            {
                cout << "No\n";
                return 0;
            }
        }
    }
    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 3660
#ABC158 D - String Formation

start = str(input())
Q = int(input())
S = "X"
cnt = 0
q = []
for i in range(Q):
    q.append(input().split(' '))
    if(q[i][0] == '1'):
        #S = S[::-1]
        cnt += 1

cntq = 0
for i in range(Q):
    #q = input().split(' ')
    if(q[i][0] == '1'):
        #S = S[::-1]
        cntq += 1
 
    else:
        if((q[i][1] == '1' and (cnt-cntq)%2 == 0) or(q[i][1] == '2' and (cnt-cntq)%2 == 1)):
            S = q[i][2] + S
        else:
            S = S + q[i][2]

if(cnt%2 == 1):
    start = start[::-1]


#print(S)
print(S.replace("X",start))


Measured memory_bytes: 40528
def grading(m, f, r):
    p = m + f
    if m == -1 or f == -1: return 'F'
    if p >= 80: return 'A'
    if p >= 65: return 'B'
    if (p >= 50) or (r >= 50): return 'C'
    if p >= 30: return 'D'
    return 'F'

if __name__ == '__main__':
    while True:
        m, f, r = [int(i) for i in input().split()]
        if m == f == r == -1: break
        print(grading(m, f, r))

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

int main(){
    int N; cin >> N;
    int ans=10000;
    
    for (int i=0; i<N; i++){
        int A; cin >> A;
        int cnt=0;
        while(A%2==0){
            cnt++;
            A/=2;
        }
        ans=min(ans,cnt);
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n,a,b = map(int, input().split())

q = n // (a + b)
r = n % (a + b)

if(r <= a and a != 0):
  print("{}".format(q * a + r))
elif(r > a and a != 0):
  print("{}".format((q + 1)* a))
elif(a == 0):
  print("0")

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

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

    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;

        sum += a;
    }
    
    if (h - sum <= 0)
    {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

const bool ready = [](){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

/* 
 * mul one by 2
 * c>b>a
 */
void solve() {
    cini(a); // red
    cini(b); // green
    cini(c); // blue
    cini(k);

    int cnt=0;
    while(cnt<k && b<=a) {
        b*=2;
        cnt++;
    }
    while(cnt<k && c<=b) {
        c*=2;
        cnt++;
    }

    if(c>b && b>a)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


Measured memory_bytes: 3604
N,M = map(int, input().split())
X = list(map(int,input().split()))
if N >= M:
  print(0)
else:
  X = sorted(X)
  list = [X[i]-X[i-1] for i in range(1,M)]
  list = sorted(list)
  list1 = list[:M-N]
  print(sum(list1))

Measured memory_bytes: 20172
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

int main()
{   
    int n,a,b;
    cin >> n >> a >> b;
    
    int sum = 0;
    rep2(i,1,n+1)
    {
        int dig_sum = 0;
        int tmp = i;
        while(tmp>0)
        {
            dig_sum += tmp%10;
            tmp /= 10;
        }
        if(dig_sum>=a && dig_sum<=b) sum += i;
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

S = list(input()) + [""]

cnt = 0
for i in range(len(S)-1):
	if S[i]==S[i+1]:
		cnt += 1
		S[i+2] = "_"

print(len(S)-1-cnt)


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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

int main() {
  int n, x;
  cin >> n >> x;
  vector<int> a;
  load(a, n);

  sort(a);
  int sum = 0;
  int people = 0;

  for (int i = 0; i < n; ++i) {
    sum += a[i];
    if (sum > x) {
      break;
    }
    people++;
  }
  if (sum < x) {
    people--;
  }
  p(people);
}

Measured memory_bytes: 256
from sys import stdin
N = int(stdin.readline().rstrip())

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

if N == 1:
    print(0)
else:
    ans = 0
    for i,j in factorize(N):
        for k in range(1,10**9):
            j -= k
            if j < 0:
                break
            ans += 1
    print(ans)

Measured memory_bytes: 9224
void main() {
	auto N = readAs!long;

	auto m = redBlackTree!long;
	auto plist = generate_prime_list(1000001);
	if(isPrime(N)) {
		writeln(1);
		return;
	}

	// 5327304283665
	// 
	ulong cnt;

	ulong M = N;
	foreach(p; plist) {
		while(M % p == 0) {
			M /= p;
		}
	}
	if(M > 1000000) {
		m.insert(M);
		cnt++;
		N = N / M;
	}

	while(N > 1) {
		debug writefln("N: %d", N);

		bool done = false;
		loop: foreach(p; plist) {
			//debug writefln("p: %d", p);
			if(p > N) break;
			ulong z = p;
			while(z <= N) {
				if(N % z == 0 && (N / z).isPrime) {
					if((N / z) !in m) {
						m.insert(N / z);
						N = z;
						cnt++;
						done = true;
						break loop;
					}
				}
				if(z !in m && N % z == 0) {
					debug writefln("z: %d", z);
					m.insert(z);
					N /= z;
					cnt++;
					done = true;
					break loop;
				}
				z *= p;
			}
			
		}
		if(!done) break;
	}
	debug m.writeln;
	cnt.writeln;
}
bool isPrime(ulong n) {
	if(n <= 1) return false;
	else if(n == 2) return true;
	else if(n % 2 == 0) return false;

	foreach(i; iota(3, n.to!double.sqrt.ceil+1, 2)) {
		if(n % i == 0) return false;
	}
	return true;
}

ulong[] generate_prime_list(T)(T N) if(isIntegral!T) {
	ulong[] prime_list = [2];
	bool not_prime = false;
	foreach(i; 3..N.to!ulong+1) {
		auto p = i.to!float.sqrt.ceil.to!ulong;
		foreach(j; prime_list) {
			if(j > p) break;
			if(i % j == 0) {
				not_prime = true;
				break;
			}
		}
		if(!not_prime) prime_list ~= i;
		not_prime = false;
	}
	return prime_list;
}

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

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

long rl() {
	return readAs!long;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 3512
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
using namespace std;

int main() {

  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<bool> dp(k + 1);
  dp[0] = false;
  for (int i = 1; i <= k; ++i) {
    bool flag = false;
    for (int j = 0; j < n; ++j) {
      if (i - a[j] >= 0 && dp[i-a[j]] == false) {
        flag = true;
        break;
      }
    }
    dp[i] = flag;
  }
  if (dp[k]) {
    cout << "First\n";
  } else {
    cout << "Second\n";
  }
  return 0;
}


Measured memory_bytes: 3624
import java.util.*;

public class Main {

	public static long digitdp(int digit, String n, int k) {
		long ans = 0;
		long dp[][][] = new long[digit + 1][2][k + 1];
		dp[0][0][0] = 1;
		for (int i = 0; i < digit; ++i) {
			final int num = (int) (n.charAt(i) - '0');
			for (int smaller = 0; smaller < 2; ++smaller) {
				for (int j = 0; j < k + 1; ++j) {
					for (int x = 0; x <= (smaller == 1 ? 9 : num); ++x) {
						if (x != 0 && j == k)
							continue;
						int small = (smaller == 1 ? 1 : (x < num ? 1 : 0));
						int l = j + (x == 0 ? 0 : 1);
						dp[i + 1][small][l] += dp[i][smaller][j];
					}
				}
			}
		}
		ans = dp[digit][0][k] + dp[digit][1][k];
		return ans;
	}

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		int k = sc.nextInt();
		int digit = n.length();
		sc.close();
		long ans = digitdp(digit, n, k);
		System.out.println(ans);
	}
}


Measured memory_bytes: 23764