akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

struct S{
	ll a;
	ll b;
	ll c;
};

bool operator <(S x,S y){
	if(x.b==y.b&&x.c==y.c){
		return x.a>y.a;
	}
	else if(x.b==y.b){
		return x.c<y.c;
	}
	return x.b>y.b;
}


int main(){
	ll M,T,P,R;
	while(cin>>M>>T>>P>>R,M||T||P||R){
		vector<S> v(T);
		ll fal[T][P];
		rep(i,T){
			rep(j,P){
				fal[i][j]=0;
			}
		}
		rep(i,T){
			v[i].a=i;
			v[i].b=v[i].c=0;
		}
		rep(i,R){
			ll m,t,p,r;
			cin>>m>>t>>p>>r;
			//cout<<m<<" "<<t<<" "<<p<<" "<<r<<endl;
			t--;
			p--;
			if(r){
				fal[t][p]++;
			}
			else{
				v[t].b++;
				v[t].c+=m+fal[t][p]*20;
			}
		}
		sort(ALL(v));
		rep(i,T){
			//cout<<v[i].a+1<<" "<<v[i].b<<" "<<v[i].c<<endl;
		}
		rep(i,T){
			if(!i){
				cout<<v[i].a+1;
			}
			else{
				if(v[i].b==v[i-1].b&&v[i].c==v[i-1].c){
					cout<<"="<<v[i].a+1;
				}
				else cout<<","<<v[i].a+1;
			}
		}
		cout<<endl;
	}
	return 0;
}

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

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  int A,B,C;
  A = a.size()-1;
  B = b.size()-1;       
  if(a.at(A) == b.at(0) && b.at(B) == c.at(0)) cout << "YES" << endl;
  else cout << "NO" << endl;
     }

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

#define mod 1000000007

using namespace std;
 
int main(void){
	
	int a, b, ans;
	
	cin >> a >> b;
	
	if(1 <= b && b <= 9)
		ans = a*10 + b;
	else if(10 <= b && b <= 99)
		ans = a*100 + b;
	else
		ans = a*1000 + b;
	
	if(sqrt(ans) == (int)(sqrt(ans))){
		cout << "Yes";
	}else
		cout << "No";
	
	return 0;
}

Measured memory_bytes: 256
//In The Name Of The God

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define F first
#define S second
#define X first.first
#define Y first .second
#define A second.first
#define B second.second
#define mp make_pair
#define pb push_back
#define pf push_front
#define P push
#define pob pop_back
#define pof pop_front
#define PO pop
#define rep(i,j,k) for(int i = j ; i <= k ; ++ i)
#define rrep(i,j,k) for(int i = j ; i>=k ; --i)
#define FR(i,j,k) for(int i = j ; i < k ; ++ i )
#define rFR(i,j,k) for(int i = j ; i > k ; -- i )
#define lb(x) x&-x;
#define SZ size()
#define LB lower_bound
#define UB upper_bound
#define IT iterator
#define RIT reverse_iterator
#define E end()
#define BE begin()
#define RE rend()
#define RBE rbegin()
#define UN unsigned

typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll ;
typedef pair<int,pii> pip;
typedef pair<pii,int> ppi;
typedef pair<pii,pii> ppp;
typedef pair<int,pll> pipl;
typedef pair<pll,int> ppli ;
typedef pair<pll,pll> plpl ;
typedef pair<ll,pii> lpip;
typedef pair<pii,ll> lppi;
typedef pair<pii,pii> lppp;
typedef pair<ll,pll> lpipl;
typedef pair<pll,ll> lppli ;
typedef pair<pll,pll> lplpl ;
typedef vector<int> vi ;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef set<int> sti;
typedef set<ll> stl;
typedef set<pii > stpi;
typedef set<pll> stpl;
typedef vi::IT vit;
typedef vl::IT vlt;
typedef vpi::IT vpit;
typedef vpl::IT vplt;
typedef sti::IT stit;
typedef stl::IT stlt;
typedef stpi::IT stpit;
typedef stpl::IT stplt;
typedef vpi::RIT rvpit;
typedef vpl::RIT rvplt;
typedef sti::RIT rstit;
typedef stl::RIT rstlt;
typedef stpi::RIT rstpit;
typedef stpl::RIT rstplt;

const int MAXN = 500000;
const int SUPERN = 5000000;
const int MD = 1e9+7;
//......Variables........
ll n,m,a,b,t[MAXN];
//......Funcs............

//......Code.............
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
cin>>n>>m;
rep(i,1,m)
{
cin>>a>>b;
t[a]^=1;
t[b]^=1;
}
bool f=true;
rep(i,1,n)
{
f=f&&(!t[i]);
}
if(f)cout<<"YES";
else cout<<"NO";
    return 0;
}

Measured memory_bytes: 1024
using System;
    using System.Linq;
    using System.Collections.Generic;
     
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int r = int.Parse(input[0]);
            int g = int.Parse(input[1]);
            int b = int.Parse(input[2]);

            int number = r * 100 + g * 10 + b;

            if(number%4==0){
                Console.WriteLine("YES");
            }else{
                Console.WriteLine("NO");
            }
        }
    }

Measured memory_bytes: 11092
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));

  $a = [];
  $b = [];
  $c = [];
  for($i=1;$i<=$n;$i++){
    list($s, $p) = explode(" ", trim(fgets(STDIN)));
    $a[] = $i;
    $b[] = $s;
    $c[] = $p;
  }

  $x = [$a, $b, $c];

  array_multisort($x[1], SORT_ASC, SORT_STRING, $x[2], SORT_DESC, $x[0], SORT_ASC);

  $a = $x[0];

  foreach($a as $ans){
    echo $ans.PHP_EOL;
  }

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

#define NMIN 1
#define NMAX 100
#define AMIN 1
#define AMAX 100
int main(){
  int N,A[NMAX],i,j,subA,cnt=0,minj;
  scanf("%d",&N);
  if(N<NMIN||N>NMAX) exit(1);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
    //  if(A[i]<AMIN||A[i]>AMAX) exit(1);
  }
  
  for(i=0;i<N;i++){
 minj = i;
    for(j=i; j<N; j++)
      if(A[j] < A[minj]) {
	minj = j;
      }
    if(minj!=i){
    subA = A[i];
    A[i] = A[minj];
    A[minj] = subA;
    cnt++;
      }
  }
   for(i=0;i<N;i++){
     /*   if(i==N-1)
     printf("%d\n",A[i]);
     else
     printf("%d ",A[i]);*/
     i==N-1 ? printf("%d\n",A[i]) : printf("%d ",A[i]);
   }
  printf("%d\n",cnt);
  return 0;
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long   ll;
typedef unsigned long long   ull;
typedef long double ld;
typedef pair<ll, ll>    pll;
typedef pair<ull, ull>    pull;
typedef pair<int, int>  pii;
typedef pair<ld, ld>  pld;
struct node{
    set<int> one;
    set<pii> two;
    set<pair<int, pii>> three;
};
int n;
int a[30009];
node f(int l, int r){
    node ret;
    if(l == r){
        ret.one.insert(a[l]);
        return ret;
    }
    node c1 = f(l, (l+r)/2);
    node c2 = f((l+r)/2+1, r);
    for(auto u : c1.one)
        ret.one.insert(u);
    for(auto u : c2.one)
        ret.one.insert(u);
    
    for(auto u : c1.two)
        ret.two.insert(u);
    for(auto u : c2.two)
        ret.two.insert(u);
    
    for(auto u : c1.three)
        ret.three.insert(u);
    for(auto u : c2.three)
        ret.three.insert(u);
    
    for(auto u1 : c1.one)
        for(auto u2 : c2.one)
            ret.two.insert({u1, u2});
    
    for(auto u1 : c1.one)
        for(auto u2 : c2.two)
            ret.three.insert({u1, u2});
    
    for(auto u1 : c1.two)
        for(auto u2 : c2.one)
            ret.three.insert({u1.ff, {u1.ss, u2}});

    return ret;
}
int input(){
    char c;
    cin >> c;
    return (c-'a');
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    
    cin >> n;
    for(int i = 0; i < n; ++i)
        a[i] = input();
    cout << f(0, n-1).three.size() << "\n";
}

Measured memory_bytes: 1152
#include <cstdio>
#include <iostream>
#include <string>
#include <string.h>
#include <cmath>
#include <deque>
#include <algorithm>
#include <time.h>
#include <math.h>
#include <ctime>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <stdlib.h>
#define ms(a) memset(a,0,sizeof(a))
#define st(a,n) sort(a,a+n)
#define fr(i,k,n) for(int i=k;i<=n;++i)
#define FR(i,k,n) for(int i=n;i>=k;--i)
#define pb push_back
#define inf 0x3f3f3f
#define vc vector
#define exp 1e-6
#define ci cin
#define co cout
#define ed endl
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
const int mod =1e9+7;
const int maxn=1e5+10;
const double pi=acos(-1);
int main()
{
    int n;
    ci>>n;
    int ans=1,pos=0;
    while(n--)
    {
        int x;
        ci>>x;
        if(ans<=x)
            ans=x,pos++;
    }
    co<<pos<<ed;
    return 0;
}



Measured memory_bytes: 256
#include <ctime> 
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cstring>
#include <utility>
#include <iostream>
#include <algorithm>
#define LL long long
#define Rg register
#define RI register LL
#define RC register char
#define ed puts("") 
#define pair pair<LL,LL>
#define space putchar(' ') 
#define lson l,mid,rt<<1 
#define rson mid+1,r,rt<<1|1  
using namespace std;   
const LL maxn=250005;  
template <typename tp> inline void read(tp & x) 
{	
    x=0;
    RI f=1; 
    RC c=getchar();  
    while(c<'0' || c>'9'){if(c=='-') f=-1;c=getchar(); } 
    while(c>='0' && c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();} 
 	x*=f;
} 	
    	
template <typename Tp> inline void print(Tp x)  
{			
    if(x<0) x=-x,putchar('-'); 
    if(x>9) print(x/10);
    putchar(x%10+'0');
}	

int T;
int n,m;
int x,y,z;
int tot;
int head[1000005];
bool vis[1000005];
int Dis[1000005];
int cnt[1000005];
struct qwq
{
	int to;
	int next;
	int dis;
}s[10000005];

inline void add(int x,int y,int z)
{
	tot++;
	s[tot].to=y;
	s[tot].dis=z;
	s[tot].next=head[x];
	head[x]=tot; 
}

inline bool SPFA()
{
	queue<int> q;
	memset(Dis,-1,sizeof Dis);
	for(RI i=0;i<=n;++i)
		vis[0]=1,q.push(i);
	while(q.size())
	{
		int temp=q.front();
		q.pop();
		vis[temp]=false;	 
		for(RI i=head[temp];i;i=s[i].next)
		{
			int v=s[i].to;
			if(Dis[v]<Dis[temp]+s[i].dis)
			{
				Dis[v]=Dis[temp]+s[i].dis;
				if(!vis[v])
				{
					q.push(v);
					vis[v]=true;
					++cnt[v];
					if(cnt[v]>=n)
						return false;	
				}	
			}	
		}		
	}
    return true;
} 

bool flg;

inline void SPFA_DFS(int u)
{
    if(flg) 
        return;
    vis[u]=1;
    for(RI i=head[u];i;i=s[i].next)
    {
    	if(flg) 
            return;
        int v=s[i].to;
        if(Dis[u]+s[i].dis<Dis[v])
        {
            Dis[v]=Dis[u]+s[i].dis;
            if(vis[v])
            {
                flg=1;
                return;
            }
            SPFA_DFS(v);
        }
    }
    vis[u]=0;
    return ;
}

int main()
{
	read(n),read(m);
	if(m==0)
	{
		printf("Yes"),ed;
		return 0; 
	}
	for(RI i=1;i<=m;++i)
	{
		read(x),read(y),read(z);
		add(x,y,z);
		add(y,x,-z);
	}
	for(RI i=0;i<=n;++i)
	{
		SPFA_DFS(i);
		if(flg)
		{
			printf("No");	
			return 0;
		}
	}
//	bool flag=SPFA();
//	if(!flag)
//	{
//		printf("No");
//		return 0;
//	}
	printf("Yes");
	return 0;
}//qwqwqwqwqqw

Measured memory_bytes: 11648
#include <iostream>
using namespace std;
#define rep(i, n) for (int i=0; i<n; i++)

int main(){
    int N, M, count=0, S=0;
    cin >> N >> M;
    int A[N];
    rep(i, N) cin >> A[i];
    rep(i, N){
        S = S + A[i];
    }
    
    rep(i, N){
        if (A[i] * 4 * M >= S) count ++;
    }
    if (count >= M) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int k;
  cin >> k;
  string s;
  cin >> s;
  int n = sz(s);
  if(n<=k){
    cout<<s<<endl;
  }else{
    rep(i,k)cout<<s[i];
    cout<<"..."<<endl;
  }
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    int n;
    long long a[200005];
    vector<long long> h;
    vector<long long> l;
    
    cin >> n;
    for (int i = 1;i <= n;i++){
        cin >> a[i];
        if (i >= 2){
            h.push_back(i-a[i]);
        };
        if (i != n){
            l.push_back(i+a[i]);
        }
    }
    
    sort(l.begin(),l.end());
    
    long long ans = 0;
    
    for (int i = 0;i < h.size();i++){
        ans += upper_bound(l.begin(),l.end(),h[i]) - lower_bound(l.begin(),l.end(),h[i]);
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 8180
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;
    vector<long long> A(N),B(N),C(N);
    for(int i=0;i<N;i++) cin >> A[i];
    for(int i=0;i<N;i++) cin >> B[i];
    for(int i=0;i<N;i++) cin >> C[i];
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    long long sum = 0;
    for(int j=0;j<N;j++){
        auto itrA = upper_bound(A.begin(),A.end(), B[j]-1);
        auto itrC = lower_bound(C.begin(),C.end(), B[j]+1);
        sum += (itrA - A.begin()) * (C.end() - itrC); 
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 2688
#include <stdio.h>

int main(void)
{
	int a,b,c, ans = 0;
	int key;
	scanf("%d %d %d", &a,&b,&c);
	for(key = 0; key < 10000; key++){
		if((b*key + c)%a == 0){
			ans++;
			printf("YES");
			break;
		}
	}
	if(!ans)
		printf("NO");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
#include<cstdio>
using namespace std;
int main(){
	int A,B,C;
	cin >> A >> B >> C;
	if(A*B == 35 && C==5 ){
    cout << "YES"<< endl;
    }else if(A*C == 35 && B==5){
    cout << "YES" << endl;
    }else{
    cout << "NO" <<endl; 
    }		
}

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

ll pow5(ll n) //n^5
{
	return n*n*n*n*n;
}

int main()
{
	ll X;
	cin >> X;
	for (ll i = -120; i <= 120; ++i)
	{
		for (ll j = -120; j <= 120; ++j)
		{
			//cout << i << " " << j << " " << pow5(i) - pow5(j) << endl;
			if (pow5(i) - pow5(j) == X)
			{
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll
#define INF INT_MAX/10
#define MOD 1000000007

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

int Input[100100];

int main() {
  long double x, y; cin >> x >> y;
  cout << x / y << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

template<typename T>
vector<T> Divisor(T n) {
	vector<T> ret;
	
	for(T i = 1; i * i <= n; ++i) {
		if( n % i == 0 ) { 
			ret.push_back(i);	
			if( i * i != n ) ret.push_back(n / i);
		}
	}
	
	sort(ret.begin(), ret.end());
	
	return ret;
}

template<typename T>
bool prime_factor(T n) {
	for(T i = 2; i * i <= n; ++i) {
		if( n % i == 0 ) return false;
	}
	
	return true;
}

template<typename T>
vector<T> common_divisor(vector<T> &a, vector<T> &b) {
	
	vector<T> ret;
	
	if( a.size() <= b.size() ) { 
		for(int i = 0; i < a.size(); ++i) {
			auto result = find(b.begin(), b.end(), a[i]);
		
			if( result != b.end() ) ret.push_back(a[i]);
		}
	}
	
	else {
		for(int i = 0; i < b.size(); ++i) {
			auto result = find(a.begin(), a.end(), b[i]);
		
			if( result != a.end() ) ret.push_back(b[i]);
		}
	}
	
	return ret;
}

int main(void) {
	ll a, b;
	cin >> a >> b;
	
	vector<ll> div, div2, div3;
	
	div = Divisor(a);
	div2 = Divisor(b);
	div3 = common_divisor(div, div2);
	
	int ans = 0;
	for(auto x : div3) {
		if( prime_factor(x) ) ans++;
		
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 512
# /usr/bin/python
# -*- coding: utf-8 -*-
from collections import deque,defaultdict


N = int(input())

colors = [-1 for _ in range(N)]
tree = [{} for _ in range(N)]
for _ in range(N-1):
  u,v,w = map(int, input().split())
  tree[u-1][v-1] = w % 2
  tree[v-1][u-1] = w % 2

visiting = set([0])
colors[0] = 0
while len(visiting) > 0:
  p = visiting.pop()
  for q in tree[p]:
    if colors[q] < 0:
      colors[q] = (tree[p][q]+colors[p]) % 2
      visiting.add(q)

for c in colors:
  print(c)

Measured memory_bytes: 87072
#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 FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(int i = n; i >= 0; ++i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define itn int
#define ednl endl
using namespace std;
typedef long long ll;template<typename TypeInt>TypeInt G_C_D(TypeInt a, TypeInt b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename TypeInt>
TypeInt G_C_D(const std::vector<TypeInt> &list){TypeInt a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename TypeInt>TypeInt L_C_M(TypeInt a, TypeInt b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename TypeInt>TypeInt L_C_M(const std::vector<TypeInt> &list){TypeInt a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	int N,T;
	cin>>N>>T;
	vector<int> c(N);
	vector<int> t(N);
	int cost=INF;
	FDS(i,N){
		cin>>c[i]>>t[i];
		if(t[i]<=T){
			if(c[i]<cost){
				cost=c[i];
			}
		}
	}
	if(cost==INF){
		cout<<"TLE"<<endl;
	}
	else{
		cout<<cost<<endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, m;
    cin>>n>>m;
    vl vs(n);
    cin>>vs;

    ll ans = 0;
    rep(i, m + 1) rep(j, m + 1) {
        if (i + j > n) continue;
        if (i + j > m) continue;
        ll r = m - i - j;
        ll s = 0;
        vl mns;
        rep(k, i) {
            s += vs[k];
            if (vs[k] < 0) mns.push_back(vs[k]);
        }
        rep(k, j) {
            s += vs[n - k - 1];
            if (vs[n - k - 1] < 0) mns.push_back(vs[n - k - 1]);
        }
        sort(rng(mns));
        rep(k, min((int)r, sz(mns))) s -= mns[k];
        chmax(ans, s);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

	int n;
	cin >> n;
	
	if (n >= 64) {
		cout << 64 << endl;
		return 0;
	}
	else if (n >= 32) {
		cout << 32 << endl;
		return 0;
	}
	else if (n >= 16){
		cout << 16 << endl;
		return 0;
	}
	else if (n >= 8) {
		cout << 8 << endl;
		return 0;
	}
	else if (n >= 4) {
		cout << 4 << endl;
		return 0;
	}
	else if (n >= 2) {
		cout << 2 << endl;
		return 0;
	}
	else {
		cout << 1 << endl;
		return 0;
	}
	
	


}

Measured memory_bytes: 256
array = $stdin.gets.chomp.split(' ').map(&:to_i).sort

if (array[1] - array[0]) % 2 == 1
    sum = (array[2] + 1) * 3
else
    sum = array[2] * 3
end

print (sum - array[0] - array[1] - array[2])/2

Measured memory_bytes: 1788
n,k=map(int,input().split())

x=[]
for i in range(n):
    x.append(int(input()))

x.sort()

y=[]

for j in range(n-k+1):
  p=x[j+k-1]-x[j]
  y.append(p)

y.sort()

print(y[0])

Measured memory_bytes: 11292
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(8)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T x; cin >> x; return x; }

struct vec2d {
	double x, y;
	vec2d() {}
	vec2d(double x, double y) :x(x), y(y) {}
	vec2d operator+(const vec2d&v)const {
		return vec2d(x + v.x, y + v.y);
	}
	vec2d operator-(const vec2d&v)const {
		return vec2d(x - v.x, y - v.y);
	}
	bool operator==(const vec2d&v)const {
		return x == v.x && y == v.y;
	}
	bool operator!=(const vec2d&v)const {
		return !operator==(v);
	}
	static double cross_product(const vec2d&v0, const vec2d&v1) {
		return v0.x * v1.y - v0.y * v1.x;
	}
	static vec2d cross_point(const vec2d&v0, const vec2d&v1, const vec2d&v2, const vec2d&v3) {
		return vec2d(((v1.x * v0.y - v0.x * v1.y) * (v3.x - v2.x) - (v3.x * v2.y - v2.x * v3.y) * (v1.x - v0.x)) / ((v1.x - v0.x) * (v3.y - v2.y) - (v3.x - v2.x) * (v1.y - v0.y)), ((v1.x * v0.y - v0.x * v1.y) * (v3.y - v2.y) - (v3.x * v2.y - v2.x * v3.y) * (v1.y - v0.y)) / ((v1.x - v0.x) * (v3.y - v2.y) - (v3.x - v2.x) * (v1.y - v0.y)));
	}
};
double area(const vector<vec2d>&vertex) {
	double ret = 0;
	REP(i, vertex.size() - 2)ret += vec2d::cross_product(vertex[i + 1] - vertex[0], vertex[i + 2] - vertex[0]) / 2;
	return ret;
}
vector<vec2d>get_left_area(const vector<vec2d>&vertex, const vec2d&p1, const vec2d&p2) {
	vector<vec2d>ret; ret.reserve(vertex.size());
	double previous_cp = vec2d::cross_product(p2 - p1, vertex.back() - p1);
	int num = vertex.size();
	REP(i, num) {
		double cp = vec2d::cross_product(p2 - p1, vertex[i] - p1);
		if (cp * previous_cp < 0) {
			ret.push_back(vec2d::cross_point(p1, p2, vertex[i], vertex[(i + num - 1) % num]));
		}
		if (cp >= 0) {
			ret.push_back(vertex[i]);
		}
		previous_cp = cp;
	}
	return ret;
}
signed main() {
	SETP;
	int n = in();
	vector<vec2d>vertex(n);
	REP(i, n) {
		int x = in(), y = in();
		vertex[i] = (vec2d(x, y));
	}
	int q = in();
	REP(i, q) {
		int p1x = in(), p1y = in(), p2x = in(), p2y = in();
		vector<vec2d>left_area = get_left_area(vertex, vec2d(p1x, p1y), vec2d(p2x, p2y));
		cout << area(left_area) << endl;
	}
}


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

int main(){
  int N, p[50];
  cin >> N;
  int count = 0;
  for(int i = 0;i < N;i++){
    cin >> p[i];
    if(p[i] != i + 1)count++;
  }
  if(count > 2){
    cout << "NO";
  }else{
    cout << "YES";
  }
}


Measured memory_bytes: 256
n=gets.to_i
r=[]
n.times do |i|
  r << gets.split.map(&:to_i)
end
s=0
n.times do |i|
  i.times do |j|
    s+=((r[i][0]-r[j][0])**2+(r[i][1]-r[j][1])**2)**0.5
  end
end
puts s*2/n

Measured memory_bytes: 3836
//Author: AnandRaj doubleux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define prinp(p) cout<<p.first<<" "<<p.second<<endl
#define prinv(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int in=f;in<f+n;in++) cin>>V[in]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MAX = 1e6+5;
const ll INF = 1e18+5;
int MOD = 1e9+7;
/////////////////FastExp///////////////////
ll powN(ll a,ll p,int bit)
{
	if(p==0) return 1;
	ll z=powN(a,p/2,bit);
	z=(z*z)%bit;
	if(p%2) z=(z*a)%bit;
	return z;
}
/////////////////FastExp///////////////////
///////////////////PnC/////////////////////
// vl Fac(MAX),Inv(MAX);
// void CalcFac()
// {
// 	Fac[0]=Inv[0]=1;
// 	for(int i=1;i<MAX;i++)
// 	{
// 		Fac[i]=(Fac[i-1]*i)%MOD;
// 		Inv[i]=powN(Fac[i],MOD-2);
// 	}
// }

// ll NCR(int n,int r)
// {
// 	if(r>n) return 0;
// 	return (((Fac[n]*Inv[r])%MOD)*Inv[n-r])%MOD;
// }
///////////////////PnC/////////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX, true);
vi MinDiv(MAX);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
    		MinDiv[i]=i;
        	for (j = i * i; j <= MAX; j += i)
            {
				is_prime[j] = false;
				MinDiv[j]=i;
    		}
    	}
	}
	for(int i=2;i<=MAX;i++) if(is_prime[i]) MinDiv[i]=i;
}
//////////////////Sieve////////////////////

int main()
{
	int n;
	cin>>n;
	string X;
	cin>>X;
	int bit=0;
	for(auto x:X) bit+=(x=='1');
	int bit2=bit-1;

	if(bit==0)
	{
		for(int i=0;i<n;i++)
		{
			cout<<1<<endl;
		}
		return 0;
	}
	else if(bit==1)
	{
		if(X[n-1]=='1')
		{
			for(int i=0;i<n;i++)
			{
				if(X[i]=='0')
				{
					cout<<2<<endl;
				}
				else cout<<0<<endl;
			}
		}
		else
		{
			for(int i=0;i<n;i++)
			{
				if(i==n-1)
				{
					cout<<2<<endl;
				}
				else if(X[i]=='0')
				{
					cout<<1<<endl;
				}
				else cout<<0<<endl;
			}
		}
		return 0;
	}


	bit++;
	int curr=1,curr2=1;
	int NAO=0,MNAO=0;
	for(int i=n-1;i>=0;i--)
	{
		if(X[i]=='1')
		{
			NAO+=curr%bit;
			NAO%=bit;

			MNAO+=curr2%bit2;
			MNAO%=bit2;
		}
		curr*=2;
		curr%=bit;

		curr2*=2;
		curr2%=bit2;
	}
	// cout<<NAO<<endl;
	// cout<<MNAO<<endl;
	for(int i=0;i<n;i++)
	{
		int FN;
		if(X[i]=='0')
		{
			FN = NAO;
			int ex = powN(2ll,(ll)n-i-1,bit);
			FN+=ex;
			FN%=bit;
		}
		else
		{
			FN = MNAO;
			int ex = powN(2ll,(ll)n-i-1,bit2);
			FN-=ex;
			FN%=bit2;
			if(FN<0) FN+=bit2;
		}

		int step = 1;
		while(FN)
		{
			int bitcnt = __builtin_popcount(FN);
			FN%=bitcnt;
			step++;
		}
		cout<<step<<endl;
	}
}	

Measured memory_bytes: 7744
import sys
input = sys.stdin.readline
S = list(input())[: -1]
T = list(input())[: -1]
res = len(T)
for i in range(len(S) - len(T) + 1):
  t = 0
  for j in range(len(T)): t += S[i + j] == T[j]
  res = min(res, len(T) - t)
print(res)

Measured memory_bytes: 65432
#include<algorithm>
#include<iostream>
#include<cstring>
#include<fstream>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#define INF 0X3F3F3F3F
#define N 5005
#define M 2000005
#define LL long long
#define FF(i,a,b) for(int i=a;i<=b;++i)
#define RR(i,a,b) for(int i=a;i>=b;--i)
#define FJ(i,a,b) for(int i=a;i<b;++i)
#define SC(x) scanf("%d",&x)
#define SCC(x,y) scanf("%d%d",&x,&y)
#define SCCC(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define SS(x) scanf("%s",x)
#define PR(x) printf("%d\n",x)
#define CL(a, x) memset(a, x, sizeof(a))
#define _q fd[rt]
#define _l fd[rt << 1]
#define _r fd[rt << 1 | 1]
#define MID int mid=((l+r)>>1)
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r
#define zero(x) (((x)>0?(x):-(x))<EPS)
#define PB push_back
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define MP make_pair
#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
using namespace std;
int n, k;
int a[N];
bool f[5005][5005];
bool g[5005][5005];
int main(){
  //  IN;
    int ans, maxn;
    int i, j, p1, p2;
    SCC(n, k);
    int big = 0;
    int num = 0;
    FF(i, 1, n){
        SC(a[++num]);
        if(a[i] >= k){
            ++big;
            --num;
        }
    }
    f[0][0] = 1;
    FF(i, 1, num){
        FF(j, 0, k - a[i]){
            if(f[i - 1][j])f[i][j + a[i]] = 1;
        }
        FF(j, 0, k)if(f[i - 1][j])f[i][j] = 1;
    }
    for(i = 0; i <= num + 1; ++i)
        g[i][0] = 1;
    RR(i, num, 1){
        FF(j, 0, k - a[i]){
            if(g[i + 1][j])g[i][j + a[i]] = 1;
        }
        FF(j, 0, k)if(g[i + 1][j])g[i][j] = 1;
    }

    ans = big;

    for(i = 1; i <= num; ++i)
    {
        p2 = k - 1;
        maxn = 0;

        for(p1 = 0; p1 < k; ++p1)
        {
            if(!f[i - 1][p1]) continue;
            while((!g[i + 1][p2] || p2 + p1 >= k) && p2 > 0) p2--;
            maxn = max(maxn, p2 + p1);
        }


        if(maxn >= k - a[i]) ans++;
    }

    printf("%d\n", n - ans);
    return 0;
}


Measured memory_bytes: 49152
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
int n, k, v[100005], tab[100005];
int knap(int obj){
    if(tab[obj]!=INF){
        return tab[obj];
    }
    if(obj==n){
        return tab[obj]=0;
    }
    if(obj>n){
        return tab[obj]=INF;
    }
    for(int i=1; i<=k; i++){
        tab[obj]=min(tab[obj], abs(v[obj]-v[obj+i])+knap(obj+i));
    }
    return tab[obj];
}
int main()
{
    memset(tab, INF, sizeof(tab));
    cin >> n >> k;
    for(int i=1; i<=n; i++){
        cin >> v[i];
    }
    cout << knap(1) << endl;
    return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    bool flag2 = false;
    ll N, M, X;
    ll mini = LONG_LONG_MAX;
    vector<pair<ll, vector<ll>>> C;
    cin >> N >> M >> X;
    rep(i, N) {
        ll c;
        vector<ll> A;
        cin >> c;
        A.resize(M);
        rep(i, M) cin >> A[i];
        C.emplace_back(c, A);
    }
    rep(i, 1LL << N) {
        ll money = 0;
        bool flag = true;
        vector<ll> rikai(M);
        rep(j, N) {
            if(i & (1LL << j)) {
                money += C[j].first;
                rep(k, M) {
                    rikai[k] += C[j].second[k];
                }
            }
        }
        iter(j, rikai) {
            if(j < X) flag = false;
        }
        if(flag) {
            flag2 = true;
            mini = min(mini, money);
        }
    }
    if(flag2) cout << mini << endl;
    else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define pb push_back
#define INF 1000000005
#define LINF 1000000000000000005

int h,w,n;

ll f[200005],inv[200005],dp[3005],mod=1e9+7;

pi a[3005];

ll pwr(ll a, ll p){
    if(p==0) return 1;
    ll t=pwr(a,p/2);
    t*=t; t%=mod;
    if(p%2) t*=a,t%=mod;
    return t;
}

ll comb(ll n, ll k){
    return f[n]*inv[k]%mod*inv[n-k]%mod;
}

ll fuck(ll p, ll q){
    return comb(a[q].x-a[p].x+a[q].y-a[p].y,a[q].x-a[p].x);
}

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> h >> w >> n;
    f[0]=1; inv[0]=1;
    for(int i=1;i<=h+w;i++) f[i]=f[i-1]*i%mod,inv[i]=pwr(f[i],mod-2);
    for(int i=1;i<=n;i++){
        cin >> a[i].x >> a[i].y;
    }
    sort(a+1,a+n+1);
    a[n+1]={h,w}; a[0]={1,1};
    for(int i=1;i<=n+1;i++){
        dp[i]=fuck(0,i);
        for(int j=1;j<i;j++){
            if(a[j].y<=a[i].y) dp[i]-=dp[j]*fuck(j,i),dp[i]=(dp[i]%mod+mod)%mod;
        }
    }
    cout << dp[n+1];
}


Measured memory_bytes: 3456
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <tuple>

template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr r, l;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

constexpr int inf = (1 << 30) - 1;

int main() {
  int A, B, M;
  std::cin >> A >> B >> M;
  int mia = inf, mib = inf;
  std::vector<int> a(A), b(B);
  for (int &x: a) {
    std::cin >> x;
    chmin(mia, x);
  }
  for (int &x: b) {
    std::cin >> x;
    chmin(mib, x);
  }
  int ans = mia + mib;
  while (M--) {
    int x, y, c;
    std::cin >> x >> y >> c;
    chmin(ans, a[x - 1] + b[y - 1] - c);
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
int main(){
  char s[100010],s1[100010],s2[100010]={};
  int i,r=0,c=0;
  scanf("%s",s);
  for(i=0;s[i];i++){
    if(s[i]-'x')s1[r++]=s[i];
  }
  s[i]=r=0;
  while(i--){
    if(s[i]-'x')s2[r++]=s[i];
  }
  if(strcmp(s1,s2)){
    printf("-1\n");
    return 0;
  }
  for(r=0;s[r+1];r++);
  for(i=0;s[i];i++){//printf("%c %c %d\n",s[i],s[r],c);
    if(s[i]==s[r]){
      r--;
      continue;
    }
    c++;
    if(s[i]=='x');
    else{
      r--;
      i--;
    }
  }//printf("%d\n",r);
  c+=r+1;
  printf("%d\n",c/2);
  return 0;
}
  


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

void main() {
    auto N = readln.chomp.to!int;
    if (N == 0) {
        writeln(0);
        return;
    }
    int[] po;
    while (N != 0) {
        const c = abs(N % 2);
        po ~= c;
        N = (N - c)  / (-2);
    }
    po.retro.each!write;
    writeln;
}



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

int main() {
  int H, N, x, y=0;
  string ans = "No";
  cin >> H >> N;
  
  for (int i = 0; i < N; i++) {
    cin >> x;
    y += x;
  }
  
  if (H <= y) ans = "Yes";

  cout << ans << endl;;
}

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

int main() {
  ll n, k;
  cin >> n >> k;
  if(n < k){
    ll num = abs(n - k);
    cout << min(num, abs(num - k)) << endl;
    return 0;
  }else {
    ll num2 = n % k;
    cout << min(num2, abs(num2 - k)) << endl;
    return 0;
  }
}

Measured memory_bytes: 384
#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define MOD 1000000007
using namespace __gnu_pbds;
using namespace std;

int n,m,dp[310][310][310];
vector<pair<int,int> > v[310];

inline void add(int &x,int y)
{
	x+=y;
	if(x>=MOD) x-=MOD;
}

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int l,r,x;cin>>l>>r>>x;
		v[r].push_back(make_pair(l,x));
	}
	int ans=0;
	dp[0][0][0]=1;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			for(int k=0;k<=n;k++){
				int w=max(max(i,j),k);
				bool flag=true;
				for(int l=0;l<v[w].size();l++){
					int a=v[w][l].first,b=v[w][l].second,cnt=0;
					if(i>=a) cnt++;
					if(j>=a) cnt++;
					if(k>=a) cnt++;
					if(cnt!=b){
						flag=false;break; 
					}
				}
				if(!flag){
					dp[i][j][k]=0;continue;
				}
				if(w==n) add(ans,dp[i][j][k]);
				else{
					add(dp[w+1][j][k],dp[i][j][k]);
					add(dp[i][w+1][k],dp[i][j][k]);
					add(dp[i][j][w+1],dp[i][j][k]);
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 114572
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (N, K) = read!(usize, usize);

    if K > (N - 1) * (N - 2) / 2 {
        println!("-1");
        return;
    }

    let M = N * (N - 1) / 2 - K;
    let mut E = vec![];
    for u in 0..N {
        for v in u + 1..N {
            if E.len() >= M {
                break;
            }
            E.push((u, v));
        }
    }

    println!("{}", M);
    for (u, v) in E {
        println!("{} {}", u + 1, v + 1)
    }
}


Measured memory_bytes: 4352
number,target = gets.chomp.split(" ").map(&:to_i)
score = Array.new(number).map{Array.new(2, 0)}
for i in 0..number - 1
  score[i] = gets.chomp.split(" ").map(&:to_i)
  score[i][2] = (i + 1)*100
  score[i][3] = score[i][0]
  score[i][4] = score[i][1]
  score[i][1] = score[i][0]*(i + 1)*100 + score[i][4]
  score[i][0] = score[i][1] / score[i][3]
end
total = 0
result = 10**10
count = 0
check = Array.new(number, 0)
check[0] = -1
inst = 0

for i in 0..2**number - 1
  check[0] += 1
  for j in 0..number - 2
    if check[j] == 2
      check[j] = 0
      check[j + 1] += 1
    end
  end
  for j in 0..number - 1
    if check[j] == 1
      total += score[j][1]
      count += score[j][3]
    end
  end
  if total < target
    for j in 1..number
      if check[-j] == 0
        inst = -j
        break
      end
    end
    for j in 1..score[inst][3] - 1
      total += score[inst][2]
      if total >= target
        break
      end
    end
    count += j
  end
  if count < result && total >= target
    result = count
  end
  inst = 0
  total = 0
  count = 0
end

print result


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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

 
int main() {
  int L,R,ans=2019;
  cin >> L >> R;
  FOR(i,L,R) {
    FOR(j,i+1,R+1) {
      ans = min(ans,((i%2019)*(j%2019))%2019);
      if(ans==0)break;
    }
    if(ans==0)break;
  }
  cout << ans << endl;
  return 0;
}
  


Measured memory_bytes: 256
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;

const int N = (int) 0, mod = (int) 0;

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, a, b;
    cin >> n >> a >> b;
    string x;
    cin >> x;
    int pa = 0, pb = 0;
    for (int i = 0; i < (int) x.size(); ++i) {
        char c = x[i];
        if (c == 'a') {
            if (pa + pb < a + b) {
                pa++;
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        } else if (c == 'b') {
            if (pa + pb < a + b && pb < b) {
                pb++;
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        } else {
            cout << "No" << endl;
        }
    }
}


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

using namespace std;

int cnt[80][50];
int cnt2[200100], cnt5[200100];

char str[50];

long long inp()
{
    memset(str, 0, sizeof(str));
    scanf("%s", str);
    long long ret = 0;
    int point = 0;
    int pointflag = 0;
    for(int i = 0; str[i] ; ++i)
    {
        if(pointflag)
        {
            point++;
        }
        if(str[i] == '.'){
            pointflag = 1;
        }else{
            ret = ret*10+str[i]-'0';
        }
    }
    while(point < 9) ret *= 10, point++;
    return ret;
}

int main()
{
#ifdef CitricAcid
    freopen ("input.txt", "rt", stdin);
#endif
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; ++i)
    {
        long long xint = inp();
        while(xint%2 == 0) cnt2[i]++, xint /= 2;
        while(xint%5 == 0) cnt5[i]++, xint /= 5;
        cnt[cnt2[i]][cnt5[i]]++;
    }
    for(int i = 64; i >= 0; --i)
        for(int j = 25; j >= 0; --j)
            cnt[i][j] = cnt[i][j] + cnt[i+1][j] + cnt[i][j+1] - cnt[i+1][j+1];
    long long ans = 0;
    for(int i = 1; i <= n; ++i)
    {
        int tmp2 = max(0, 18-cnt2[i]);
        int tmp5 = max(0, 18-cnt5[i]);
        ans += cnt[tmp2][tmp5];
        if(cnt2[i] >= tmp2 && cnt5[i] >= tmp5) ans--;
    }
    printf("%lld\n", ans/2);
}


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

#define pb push_back
#define fi first
#define se second
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pii pair<int,int>

const int mod=1e9+7;
int lowbit(int x) {return x&(-x);}

string s;
int d;
int f[10010][110];

int getf1(int l,int x) {
	if (f[l][x]!=-1) return f[l][x];
	if (l>=s.size()) {
		if (x==0) return 1;
		else return 0;
	}
	int res=0;
	for (int i=0;i<10;i++) {
		res+=getf1(l+1,(x+d-i%d)%d);
		res%=mod;
	}
	return f[l][x]=res;
}

int getf2(int l,int x) {
	if (l>=(int)s.size()) {
		if (x==0)return 1;
		else return 0;
	}
	int res=0;
	for (int i=0;i<(int)(s[l]-'0');i++) {
//		cout<<l<<" "<<i<<" "<<(x+d-i%d)%d<<" "<<res<<endl;
		res+=getf1(l+1,(x+d-i%d)%d);
		res%=mod;
	}
	int i=(int)(s[l]-'0');
	res+=getf2(l+1,(x+d-i%d)%d);
	res%=mod; 
	return res;
}

int main(){
	memset(f,-1,sizeof(f));
	cin>>s>>d;
	cout<<(getf2(0,d)+mod-1)%mod;
	return 0;
}


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

int main(){
    string s;
    cin >> s;
    int n0, n1;
    rep(i, s.size()) if(s.at(s.size()-1-i) == 'A') n0 = s.size()-1-i;
    rep(i, s.size()) if(s.at(i) == 'Z') n1 = i;
    cout << n1 - n0 + 1 << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define mp(a, b) make_pair(a, b)
#define lowbit(x) (x & (-x))
#define ls (rt << 1)
#define rs (rt << 1 | 1)
typedef long long ll;
typedef pair<int, int> pii;
const int maxn = 2e5 + 10;
ll n, k;
ll a[maxn];
ll solve(ll x)
{
	ll ret = 0;
	for(int i = 1; i <= n; ++i)
	{
		if(a[i] * a[i] <= x) --ret;
		if(a[i] > 0)
		{
			ll tmp = x / a[i];
			while(tmp * a[i] > x) --tmp;
			ret += upper_bound(a + 1, a + n + 1, tmp) - 1 - a;
		}
		else if(a[i] == 0)
		{
			if(x >= 0) ret += n;
		}
		else
		{
			ll tmp = x / a[i];
			while(tmp * a[i] > x) ++tmp;
			ret += a + n - lower_bound(a + 1, a + n + 1, tmp) + 1;
		}
	}
	return ret / 2;
}
int main()
{
	cin >> n >> k;
	for(int i = 1; i <= n; ++i)
		cin >> a[i];
	sort(a + 1, a + n + 1);	
	ll l = -1e18, r = 1e18;
	while(l <= r)
	{
		ll mid = (l + r) / 2;
		if(solve(mid) >= k)
			r = mid - 1;
		else
			l = mid + 1;
	}
	cout << l << endl;
	return 0;
}
/*
3 3
0 -1 1
*/

Measured memory_bytes: 1792