akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
#define int long long

signed main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
        cout << 0 << endl;
        return 0;
    }
    cout << min(a*b,min(b*c,c*a)) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int n, a,b;
	scanf("%d %d %d", &n, &a,&b);
	int sum = 0;
	for(int i = 1; i <= n ; i++){
		int temp = i, total = 0;
		while (temp > 0){
			total += temp % 10;
			temp /= 10;
		}
		if(total >= a && total <= b){
			sum += i;
		}
	}
	printf("%d\n", sum);
	
	return 0;
}


Measured memory_bytes: 1700
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using Graph = vector<vector<int>>;
using ll = long long;
using p = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    for (int i = 1; i <= 10; ++i)
    {
        int money = i * 1000;
        int charge = money - n;
        if (charge < 0)
        {
            continue;
        }
        cout << charge << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)

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

cout<<T+S<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <array>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;

typedef  pair<int,int> P;

     bool d[10]={0};
     int n,k;
     bool hantei=true;




int main(){
      cin>>n>>k;
     for(int i=0;i<k;++i){
          int a;
          cin>>a;
          d[a]=1;
     }
     while(1){
          int x=n;
          hantei=1;
          while(x){
               if(d[x%10]){
                    hantei=0;
                    break;
               }
               x/=10;
          }
          if(hantei){
               cout<<n<<endl;
               break;
          }
          n++;
     }
}

Measured memory_bytes: 256
from bisect import *
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a.sort()
c.sort()
res = 0
for i in range(n):
    temp = b[i]
    res += bisect_left(a, temp) * (n - bisect_right(c, temp))
    
print(res)

Measured memory_bytes: 29324
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int a;
string s;

int main() {
    cin >> a >> s;
    cout << (a >= 3200 ? s : "red") << endl;
}


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

using ld=long double;

using Graph=vector<vector<int>>;
vector<int> SSC(Graph& g){
    int n=g.size();
    Graph rg(n);
    for(int i=0;i<n;i++) for(auto v:g[i]) rg[v].push_back(i);
    vector<int> vs;
    vector<int> used(n,false);
    function<void(int)> dfs=[&](int v){
        if(used[v]) return;
        used[v]=true;
        for(auto to:g[v]){
            dfs(to);
        }
        vs.push_back(v);
    };
    for(int i=0;i<n;i++) dfs(i);
    reverse(vs.begin(),vs.end());
    vector<int> cmp(n);
    int k=0;
    fill(used.begin(),used.end(),false);
    function<void(int)> rdfs=[&](int v){
        if(used[v]) return;
        used[v]=true;
        cmp[v]=k;
        for(auto to:rg[v]) rdfs(to);
    };
    for(auto v:vs) if(!used[v]) rdfs(v),k++;
    return cmp;
}
ld solve(int n){
    vector<ld> p(n);
    Graph g(n);
    for(int i=0;i<n;i++){
        cin>>p[i];
        int m;
        cin>>m;
        for(int j=0;j<m;j++){
            int a;
            cin>>a;
            a--;
            g[i].push_back(a);
        }
    }    
    vector<int> cmp=SSC(g);
    int k=(*max_element(cmp.begin(),cmp.end()))+1;
    vector<int> root(k,true);
    for(int i=0;i<n;i++){
        for(auto to:g[i]){
            if(cmp[i]!=cmp[to]) root[cmp[to]]=false;
        }
    }
    ld res=1;
    for(int i=0;i<k;i++){
        if(root[i]){
            ld sc=1;
            for(int j=0;j<n;j++){
                if(cmp[j]==i){
                    sc*=p[j];
                }
            }
            res*=(1-sc);
        }
    }
    return res;
}
int main(){
    int n;
    cout<<fixed<<setprecision(10);
    while(cin>>n,n){
        cout<<solve(n)<<endl;
    }
    return 0;
}


Measured memory_bytes: 3428
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main(){

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

    int a, b; cin >> a >> b;
    if (2 * b >= a) cout << 0 << endl;
    else cout << a - 2 * b << endl;
    return 0;
}

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

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds; 
 
typedef long long int ll;
typedef long int li;

const ll mod = 1000000007;
const ll inf = 1000000000000000000;

typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vli> vvli;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef map<ll, ll> mll;
typedef map<ll, string> mls;
typedef map<string, ll> msl;
typedef pair<ll, ll> pll;

// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#pragma GCC optimize ("-O3")
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(), v.end()
#define mini(a) *min_element(all(a))
#define maxi(a) *max_element(all(a))
#define tol(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define tou(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
#define FOR(i, j, k, in) for(li i=j; i<k; i+=in)
#define RFOR(i, j, k, de) for(li i=j; i>=k; i-=de)
#define rep(i,j,k) FOR(i, j, k, 1)
#define rrep(i,j,k) RFOR(i, j, k, 1)
#define repc(v) for(auto it=v.begin(); it!=v.end(); it++)
#define rrepc(v) for(auto it=v.rbegin(); it!=v.rend(); it--)
#define T ll t; cin>>t; while(t--)

ll gen(){
    ll temp;
    cin>>temp;
    return temp;
}

ll power(ll a, ll b, ll m){    
    ll res=1;
    while(b>0){
        if(b&1){
            res=(res*a)%m;
            b--;
        }
        a=(a*a)%m;
        b=b>>1;
    }
    return res;
}

ll gcd(ll a, ll b){if(a==0)return b; else return gcd(b%a, a);}
ll lcm(ll a, ll b){return (a*b)/gcd(a,b);}

#define inpt(v) generate(all(v),gen)
#define sum(v) accumulate(all(v),0LL)
#define vpll vector<pll>
#define umap unordered_map
#define uset unordered_set
#define print(v) rep(i,0,n) cout<<v[i]<<" ";

int32_t main(){
  FAST

    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout); 

    string s;
    cin>>s;
    ll n = s.length();

    ll c=0, ans = 0;
    rep(i,0,n){
      if(s[i] == 'r' or s[i] == 'R')
      c++;

      else{
        ans = max(ans,c);
        c= 0;
      }
    }
    ans = max(ans,c);
    cout<<ans;

  
  return 0;
}










Measured memory_bytes: 3636
#include <iostream>
#include <map>

using namespace std;

void Solution()
{
    string str;
    
    string most_Freq;
    string most_Long;
    
    int times = 0;
    
    map<string, int> data; // in this case, the default value of integer is "0", value can be recognized by "string" name
    
    most_Long = most_Freq = str;
    
    while (cin>>str)
    {
        data[str]++; //start to accumulate the data by variety "str"
        
        if (str.size() > most_Long.size()) //verify the longest word based on size
        {
            most_Long = str;
        }
        
        if (data[str] > times)
        {
            most_Freq = str;
            times = data[str];
        }
    }
    
    cout << most_Freq << " " << most_Long << endl;

}

int main()
{
    Solution();
    return 0;
}

Measured memory_bytes: 1192
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<stdio.h>
using namespace std;
typedef unsigned long long ll;
ll mod = (10e+8)+ 7;

int main(){
	string S;
	cin>>S;
	int a = (S[0] - 48 ) * 10;
	a += S[1] - 48;
	int b = (S[2] - 48 ) * 10;
	b += S[3] - 48;
	if(a <= 12 && a != 0){
		if(b <= 12  && b != 0){
			cout<<"AMBIGUOUS"<<endl;
		}
		else{
			cout<<"MMYY"<<endl;
		}
	}else{
		if(b <= 12 && b != 0){
			cout<<"YYMM"<<endl;
		}
		else{
			cout<<"NA"<<endl;
		}
	}
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=2e5;
const int INF=1e9;
int main(){
	int a;string s;cin>>a>>s;
	if(a>=3200) cout<<s<<endl;
	else cout<<"red"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a * b == 2){
            System.out.println(3);
        }else if(a * b == 3){
            System.out.println(2);
        }else{
            System.out.println(1);
        }
        sc.close();
    }
}

Measured memory_bytes: 35392
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
using namespace std;

int main(){
    int n,a,b;
    cin>>n>>a>>b;
    long long ans=0;
    for(int i=1;i<=n;i++){
        int sum=0,x,c=i;
        while(c){
            x=c%10;
            sum+=x;
            c/=10;
        }
        if(sum<=b&&sum>=a) ans+=i;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
//#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
int main(){
	set<string> V;
	string S;
	cin>>S;
	int K;
	cin>>K;
	int alpha[26]={};
	for(int i=0;i<S.length();i++){
		alpha[S[i]-'a']++;
	}
	/*
	for(int i=0;i<26;i++){
		if(alpha[i]>=K){
			cout<<(char)('a'+i)<<endl;
			return 0;
		}
	}
	*/
	for(int i=0;i<26;i++){
		for(int j=0;j<S.length();j++){
			if(S[j]=='a'+i){
				for(int k=1;k+j<=S.length() && k<=5;k++)
					V.insert(S.substr(j,k));
			}
		}
		if(V.size()>=K)
			break;
	}
	/*
	for(string T:V)
		cout<<T<<endl;
		*/
	int c=1;
	for(string T:V){
		if(c==K){
			cout<<T<<endl;
			return 0;
		}
		c++;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<62);
const double inf=pow(10,10);
const ld pi=acosl(1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

int main(){
	char c;
	cin>>c;
	cout<<++c<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	char str[4];
	int i;
	_Bool swap;
	_Bool answer[3] = {1, 0, 0};
	while (scanf("%s", &str) != EOF) {
		swap = answer[str[0] - 'A'];
		answer[str[0] - 'A'] = answer[str[2] - 'A'];
		answer[str[2] - 'A'] = swap;
	}
	for (i = 0; i < 3; i++) {
		if (answer[i])
			printf("%c\n", i + 'A');
	}
	return 0;
}

Measured memory_bytes: 540
#include <stdio.h>
int gcd(int,int);
int main(){
  int x=1,y=1,a;
  scanf("%d%d",&x,&y);
 a = gcd(x,y);
 printf("%d\n",a);
  return 0;
}

int gcd(int x, int y){
  int tmp,r;
 
   
  if(x<y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while(y>0){
    r = x % y;
    x = y;
    y = r;
  }
  return x;
}



Measured memory_bytes: 2128
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int W, a, b;
  cin >> W >> a >> b;
  if (b > a + W) {
    cout << b - (a + W) << endl;
  } else if (b + W < a) {
    cout << a - (b + W) << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  vector<int> a(3);
  int i;
  for(i=0;i<3;i++) cin >> a[i];
  sort(a.begin(),a.end());
  int xx = 2*a[2]-a[0]-a[1];
  if(xx%2==1) cout << xx/2+2 << "\n";
  else cout << xx/2 << "\n";
  return 0;
}


Measured memory_bytes: 3628
from collections import deque

n=int(input())

A=list(map(int,input().split()))

B=deque([])
if n%2==0:
    for i in range(n):
        if i%2==0:
            B.append(A[i])
        else:
            B.appendleft(A[i])
else:
    for i in range(n):
        if i%2==0:
            B.appendleft(A[i])
        else:
            B.append(A[i])
        

print(*B)

Measured memory_bytes: 25412
n,m=map(int ,input().split())
h=list(map(int ,input().split()))
N=[[i] for i in range(n)]
c=0
for i in range(m):
    a,b=map(int, input().split())
    N[a-1].append(b-1)
    N[b-1].append(a-1)
for i in range(n):
    l=N[i]
    if len(l)==1:
        c+=1
    else:
        max=0
        for j in range(1,len(l)):
            if h[l[j]]>max:
                max=h[l[j]]
        if h[l[0]]>max:
            c+=1
print(c)

Measured memory_bytes: 35584
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 100000000

typedef  long long ll;

using namespace std;

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r != 0){
        r = a % b;
        a = b;
        b = r;
    }
    return r;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}


void solve(void){
    string s;
    cin >> s;
    int pnum = 0;
    rep(i,0,s.size()) if(s[i] == 'p') pnum++;
    cout << s.size()/2-pnum << endl;
    
}

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



Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <queue>

typedef long long ll;
const ll LL_MAX (1LL<<60);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    string s;
    cin >>s;

    if (s.size() == 1) 
    {
        cout << 0 << endl;
        return 0;
    }
   
    ll cnt(0);
    rep(i,0,s.size()-1)
        if (s[i+1] == s[i]){cnt++; s[i+1] = (s[i]-'0') ? '0' : '1';}

    cout << cnt << endl;
    
    return 0;
}


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

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    
    vector<bool> memo(N, false);
    memo[0]=true;
    vector<int> b_num(N, 1);
    for(int m=0; m<M; m++) {
        int x, y;
        cin >> x >> y;
        
        b_num[x-1]--;
        b_num[y-1]++;
        if(memo[x-1]) {
            memo[y-1]=true;
            if(b_num[x-1]==0) {
                memo[x-1]=false;
            }
        }
    }
    
    int ans=0;
    for(int n=0; n<N; n++) {
        if(b_num[n]>0 && memo[n]) {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
    
}

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

int main(){
    ll a,b,k;
    cin>>a>>b>>k;
    for(ll i=a;i<=b;++i){
        if(i-a < k or b-i < k){
            cout<<i<<endl;
        }
    }
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            int H = in.nextInt();
            int N = in.nextInt();

            for (int i = 0; i < N; i++) {
                int A = in.nextInt();
                H -= A;

                if (H <= 0) {
                    break;
                }
            }

            out.println(H <= 0 ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 50712
// This is the template example file for programming//
#include<bits/stdc++.h>
//macros
using namespace std;
typedef long long ll;
typedef pair<int, int > Pii;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
#define pb push_back
#define rs resize 
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define repll(i, a, b) for(ll i=(a); i<(b); i++)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define COUT(a) cout << a << endl
#define ALL(a) (a).begin(),(a).end()
const long long int mod = 1e9 + 7;

ll count_a(ll n,ll a){
    ll init = a*2;
    ll res = 0;
    while(init<=n){
        res+=n/init;
        init*=a;
    }
    return res;
}


int main(){
    //cin.tie(nullptr);
    //ios::sync_with_stdio(false); 
    ll n;
    cin >> n;
    ll res = 0, div=0;
    if(n%2==1){
        COUT(0); return 0;
    }else{
        res = count_a(n,5);
    }   
    COUT(res);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

int i,n,m,H,W,ans,N,a,b,c;

char S[11];
string s;

int dp(int j,int k,string t)
{
  string u;
  int w;
  if(j<N)
  {
    for(w=0;w<=k+1;w++)
    {
      u=t+S[w];
      
      if(w==k+1)
      {
        dp(j+1,k+1,u);
      }
      else
      {
        dp(j+1,k,u);
      }
    }
  }
  
  if(j==N)
  {
    cout <<t<<endl;
  }
    
    
}


int main()
{
  cin >>N;
  S[0]='a';
  S[1]='b';
    S[2]='c';
    S[3]='d';
    S[4]='e';
    S[5]='f';
    S[6]='g';
    S[7]='h';
    S[8]='i';  
  S[9]='j';
    S[10]='k';
  

  s='a';
  dp(1,0,s);
  
  

}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i<n; i++) cin >> a[i];

    bool ans = true;
    for(int i =0; i<n; i++){
        if(a[i] % 2 == 0) {
            if(a[i] % 3 == 0 || a[i] % 5 == 0) ans = true;
            else {
                ans = false;
                break;
        }
        }
    }

    if(ans) puts("APPROVED");
    else puts("DENIED");
}

Measured memory_bytes: 3556
//include
//------------------------------------------
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;

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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//debug
//-------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define INF (1<<21)
#define RETURNED 2
#define VISITED 1
#define NOT_VISITED 0

//typedef
//-------------------------------------------
typedef long long ll;

int g[10][10];
int visited[10];
vector<int> result;

int s, d;

int dfs(int now, int parent, int cost) {
    visited[now] = VISITED;
    if (now == d) return cost;

    int test = 0;
    int tmp = INF;
    int mini = -1;
    REP(i, 10) {
        if(g[now][i] != INF && visited[i] != VISITED) {
            if (parent == 9 && now == 5 && i == 6) continue;
            int r = dfs(i, now, cost + 1);
            if (tmp > r) {
                tmp = r;
                mini = i;
            }
        }
    }
    if (mini > -1) result.push_back(mini);

    return tmp;
}

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

    REP(i, 10) REP(j, 10) g[i][j] = INF;
    g[0][1] = 1, g[1][0] = 1;
    g[1][2] = 1, g[2][1] = 1;
    g[2][3] = 1, g[3][2] = 1;
    g[3][4] = 1, g[4][3] = 1;
    g[4][5] = 1, g[5][4] = 1;
    g[5][6] = 1, g[6][7] = 1, g[7][8] = 1, g[8][9] = 1, g[9][5] = 1;

    int n;
    cin >> n;
    REP(j, n) {
        REP(i, 10) visited[i] = NOT_VISITED;
        if (!n) return 0;
        cin >> s >> d;

        if (s > 6 && d > 5 && s > d) {
            cout << s << " ";
            for (int k = s + 1; k <= 9; k++) {
                cout << k << " ";
            }
            FORR(i, 5, -1) cout << i << " ";
            FOR(i, 1, 6) cout << i << " ";

            for (int k = 6; k < d; k++) {
                cout << k << " ";
            }
            cout << d << endl;
            continue;
        }

        result.clear();
        dfs(s, -1, 0);
        reverse(result.begin(), result.end());
        cout << s << " ";
        for (int i = 0; i < result.size() - 1; i++) {
            cout << result[i] << " ";
        }
        cout << result[result.size() - 1] << endl;
    }
    return 0;
}

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

int main() {
    long long i, N, D, X, Y, count=0;
    cin >> N >> D;
    D = D*D;
    for(i=0; i<N; i++){
        cin >> X >> Y;
        if( X*X + Y*Y <= D )
            count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pa;
const ll MOD = 1e9 + 7;

#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r)-1; i >= (l); i--)

void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
}
//-----------------------------------------------------------//

int main() {
    init();
    int a, b;
    cin >> a >> b;
    if (a <= 0 && b >= 0)
        cout << "Zero" << endl;
    else if (b < 0 && (b - a) % 2 == 0)
        cout << "Negative" << endl;
    else
        cout << "Positive" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>}
#include <string.h>
#include <stdlib.h>

int stack[200];
int it = 0;

void push(int x){
	stack[it] = x;
	it++;
}

int pop(){
	it--;
	return stack[it];
}

int main(void){
		
	int a,b,i;
	
	char str[1000000];
	while(scanf("%s",str)!=EOF){
		if(strcmp(str,"+")==0){
			a = pop();
			b = pop();
			push(a+b);
			
		}else if(strcmp(str,"-")==0){
			a = pop();
			b = pop();
			push(b-a);
			
		}else if(strcmp(str,"*")==0){
			a = pop();
			b = pop();
			push(a*b);
			
		}else if(strcmp(str,"/")==0){
			a = pop();
			b = pop();
			push(b/a);
			
		}else{
			i = atoi(str);
			push(i);
			
		}
	}
	printf("%d\n",stack[0]);

	return 0;
}

Measured memory_bytes: 984
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> pi;
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair

int n;

	
main(){
	int n;
	string num[]={"1111110",
	"0110000",
	"1101101",
	"1111001",
	"0110011",
	"1011011",
	"1011111",
	"1110010",
	"1111111",
	"1111011",
	"0000000",
	};
	
	while(cin>>n){
		if(n==-1)break;
		
		int zen=10;
		rep(i,n){
			int t;
			cin>>t;
			rep(j,7){
				cout<<!(num[t][6-j]==num[zen][6-j]);
			}
			cout<<endl;
			zen=t;
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy[8] = {-1, 0, 1, 1, -1, 1, 0, -1};

template <class T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string N;
  int K;
  cin >> N >> K;
  static ll dp[110][2][5];
  int L = N.size();
  dp[0][0][0] = 1;
  for (int i = 0; i < L; i++)
  {
    const int di = N[i] - '0';
    for (int j = 0; j < 2; j++)
    {
      for (int k = 0; k < K + 1; k++)
      {
        for (int d = 0; d <= (j ? 9 : di); d++)
        {
          if (d == 0)
            dp[i + 1][j || (d < di)][k] += dp[i][j][k];
          else
            dp[i + 1][j || (d < di)][k + 1] += dp[i][j][k];
        }
      }
    }
  }
  cout << dp[L][1][K] + dp[L][0][K] << endl;
  return 0;
}

// 桁DP 0でない数字を何個持つかを保持する
// dp[決定した桁数][N未満確定か][0以外の数字が出た数] := i桁決めた時に0でない数がj個である．


Measured memory_bytes: 256
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

sys.setrecursionlimit(50000000)

ans=[]
tree=[]

def do(root,next):
    global ans
    global tree
    if root >= 0:
        ans[next]+=ans[root]
    for a in tree[next]:
        if a==root:
            continue
        do(next,a)

def resolve():
    global ans
    global tree
    readline=sys.stdin.readline
    n,q=map(int, readline().rstrip().split())
    tree=[[] for i in range(n)]
    ans=[0]*n
    for i in range(n-1):
        a,b=map(int, readline().rstrip().split())
        a-=1
        b-=1
        tree[a].append(b)
        tree[b].append(a)
    for i in range(q):
        p,x=map(int, readline().rstrip().split())
        p-=1
        ans[p]+=x
    do(-1,0)
    print(" ".join(map(str,ans)))

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------


Measured memory_bytes: 234664
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    ll a,b,c,d;cin>>a>>b>>c>>d;
    if(a==b)out("Yes");
    else out("No");
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  char a,b,c,a2,b2,c2;
  int t=0;
  scanf("%c %c %c \n",&a,&b,&c);
  scanf("%c %c %c ",&a2,&b2,&c2);
  if(a==a2){
    t=t+1;}
  if(b==b2){
    t=t+1;}
  if(c==c2){
    t=t+1;}
  printf("%d",t);
  return 0;}
  

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
// #define int cpp_int
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}

inline void solve(void){
  long P,Q,R;
  in(P,Q,R);
  out(min({P+Q,Q+R,R+P}));
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
/*
AIZU ONLINE 0003

Is it a Right Triangle?
*/

#include <stdio.h>

main()
{
	int cnt;
	int a,b,c;
	int	i;

	scanf("%d",&cnt);
	for(i=0;i<cnt;i++)
	{	scanf("%d %d %d",&a,&b,&c);


		if(a*a == b*b + c*c ||
           	   b*b == c*c + a*a ||
                   c*c == a*a + b*b)
			printf("YES\n");
		else
			printf("NO\n");

	}
	return(0);
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
long long n,ans=0;
void f(long long i)
{
	long long m=n;
	while(m%i==0)m/=i;
	if((m-1)%i==0)ans++;
}
int main()
{
	cin>>n;
	for(long long i=2;i*i<=n;i++)
		if(n%i==0)
		{
			f(i);
			if(i*i!=n)f(n/i);
		}
	f(n);
	for(long long i=2;i*i<=n-1;i++)
		if((n-1)%i==0)
		{
			ans++;
			if(i*i!=n-1)ans++;
		}
	if(n-1>=2)ans++;//n-1自身存在 
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	try {
    		int a = sc.nextInt();
    		int b = sc.nextInt();

    		int plus = a + b;
    		int minus = a - b;
    		int multi = a * b;

    		if (plus > minus) {
    			if (multi > plus) {
    				System.out.println(multi);
    			} else {
    				System.out.println(plus);
    			}
    		} else {
    			if (multi > minus) {
    				System.out.println(multi);
    			} else {
    				System.out.println(minus);
    			}
    		}
    	} finally {
    		sc.close();
    	}
    }
}



Measured memory_bytes: 21844
import java.util.Arrays;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for(int i=0; i<n; i++) {
            int[] ia = new int[3];
            ia[0] = scanner.nextInt();
            ia[1] = scanner.nextInt();
            ia[2] = scanner.nextInt();
            Arrays.sort(ia);
            if(ia[0]*ia[0] + ia[1]*ia[1] == ia[2]*ia[2]) {
                System.out.println("YES");
            }else {
                System.out.println("NO");
            }
        }
    }
}

Measured memory_bytes: 33128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;

inline int inverse(ll a) {
  ll u = 0, v = 1;
  ll m = mod;
  while (a != 0) {
    ll t = m / a;
    m -= t * a; swap(a, m);
    u -= t * v; swap(u, v);
  }
  assert(m == 1);
  return (u + mod) % mod;
}

int binom(int n, int k) {
  ll res = 1;
  if (k > n -k) k = n-k;
  for (int i = 0; i < k; i++) {
    res = (res * (n-i)) % mod;
    res = (res * inverse(i+1)) % mod;
  }
  return res % mod;
}

inline int mul(int a, int b) {
  return (int) ((long long) a * b % mod);
}

int modpow(int b, int p) {
  int res = 1;
  while (p > 0) {
    if (p & 1) {
      res = mul(res, b);
    }
    b = mul(b, b);
    p >>= 1;
  }
  return res;
}


int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  int res = modpow(2, n);
  int ca = binom(n, a);
  int cb = binom(n, b);
  //cerr << ca << " " << cb << endl;
  res = (res - ca - 1+ mod) % mod;
  res = (res - cb + mod) % mod; 
  cout << res << endl;

}



Measured memory_bytes: 384
import sys
input=sys.stdin.readline
def main():
    r,c,k=map(int,input().split())
    v=[[0]*c for _ in range(r)]
    for _ in range(k):
        ri,ci,a=map(int,input().split())
        ri-=1
        ci-=1
        v[ri][ci]=a
    dp=[[[0]*c for _ in range(r)] for i in range(4)]
    #print(dp)
    if v[0][0]>0:
        dp[1][0][0]=v[0][0]

    for i in range(r):
        for j in range(c):
            if i>0:
                dp[1][i][j]=max(dp[1][i][j],dp[0][i-1][j]+v[i][j])
                dp[0][i][j]=max(dp[0][i][j],dp[0][i-1][j])
                dp[1][i][j]=max(dp[1][i][j],dp[1][i-1][j]+v[i][j])
                dp[0][i][j]=max(dp[0][i][j],dp[1][i-1][j])
                dp[1][i][j]=max(dp[1][i][j],dp[2][i-1][j]+v[i][j])
                dp[0][i][j]=max(dp[0][i][j],dp[2][i-1][j])
                dp[1][i][j]=max(dp[1][i][j],dp[3][i-1][j]+v[i][j])
                dp[0][i][j]=max(dp[0][i][j],dp[3][i-1][j])
            if j>0:
                dp[1][i][j]=max(dp[1][i][j],dp[0][i][j-1]+v[i][j])
                dp[2][i][j]=max(dp[2][i][j],dp[1][i][j-1]+v[i][j])
                dp[3][i][j]=max(dp[3][i][j],dp[2][i][j-1]+v[i][j])
                dp[0][i][j]=max(dp[0][i][j],dp[0][i][j-1])
                dp[1][i][j]=max(dp[1][i][j],dp[1][i][j-1])
                dp[2][i][j]=max(dp[2][i][j],dp[2][i][j-1])
                dp[3][i][j]=max(dp[3][i][j],dp[3][i][j-1])
    #print(dp)
    ans=0
    for i in range(4):
        ans=max(dp[i][r-1][c-1],ans)
    return print(ans)
if __name__=="__main__":
    main()



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


using namespace std;

int main(){
    string S,T,U;
    int A ,B;
    cin >> S >> T ;
    cin >> A >> B;
    cin >> U;
    if(S==U){
        cout << A - 1 << ' ' << B << endl;
    }
    else if(T==U){
        cout << A << ' ' << B - 1 << endl;
    }
}

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

int main() {
	// your code goes here
	long long a,b,c,k;
	cin>>a>>b>>c>>k;
	if(k<=a) cout<<k;
	else{
	    long long p=a+b;
	    if(k<=p) {cout<<a;}
	    else if(k<=(p+c))
	    {
	        p=a-(k-p);
	        cout<<p;
	    }
	    else{ 
	        cout<<a-c;
	    }
	}
}


Measured memory_bytes: 3620
// Author:: Mohammad Faisal
// BEGINNING WITH THE NAME OF ALMIGHTY GOD ALLAH
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m;
  cin >> n >> m;
  if(m==n)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}

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

typedef long long ll; 
ll m=1e9+7;
ll dp[1002][1002];


int main(){
  ll n,k;
  cin>>n>>k;
  dp[0][0]=1;
  n-=k;
  for(int i=0;i<=n;i++)
    for(int j=0;j<=k;j++){
      if(j)dp[i][j]+=dp[i][j-1];
      if((i||j)&&i-j>=0)dp[i][j]+=dp[i-j][j];
      dp[i][j]%=m;
    }
  if(n<0)cout<<0<<endl;
  else cout<<dp[n][k]<<endl;
  return 0;
}



Measured memory_bytes: 7360
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

constexpr int inf = 2147483647;
constexpr int64_t inf64 = 9223372036854775807;
constexpr int mod = 1e9+7;

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

  string s;
  cin >> s;
  string res = "";
  rep(i,s.size()) {
    if(s[i] == '0') res.push_back('0');
    if(s[i] == '1') res.push_back('1');
    if(s[i] == 'B' && !(res.empty())) res.pop_back();
  }

  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
s = list(input())
t = "keyence"
a = i = 0

while i != len(s):
    if s[i] == t[i]:
        a += 1
    else:
        break
    i += 1

i = len(s) - 1
o = 6

while a != 7:
    if s[i] == t[o]:
        a += 1
    else:
        break
    i -= 1
    o -= 1

if a == 7:
    print("YES")
else:
    print("NO")

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, h, w;
  cin >> n >> h >> w;
  int res = 0;
  for (int i = 0; i < n; i += 2) {
    int x, y;
    cin >> x >> y;
    res += min(x, w - y) + min(y, w - x);
  }
  res *= h;
  cout << res << '\n';
}



Measured memory_bytes: 3212
#include <cstdio>
#include <vector>
using namespace std;

typedef vector<vector<int> > vvint;

void mul(vvint &x, const vvint &y, int m){
	int n = x.size();
	vvint z(n, vector<int>(n));
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < n; ++j)
			for(int k = 0; k < n; ++k)
				z[i][j] = (z[i][j] + (long long)x[i][k] * y[k][j]) % m;
	x.swap(z);
}

int main(){
	int n, m, a, b, c, t;
	while(scanf("%d%d%d%d%d%d", &n, &m, &a, &b, &c, &t), n){
		vvint x(n, vector<int>(n)), y = x;
		for(int i = 0; i < n; ++i){
			if(i != 0) x[i][i-1] = a;
			x[i][i] = b;
			if(i != n - 1) x[i][i+1] = c;

			y[i][i] = 1;
		}

		while(t){
			if(t & 1) mul(y, x, m);
			mul(x, x, m);
			t >>= 1;
		}

		vector<int> s(n);
		for(int i = 0; i < n; ++i){
			scanf("%d", &s[i]);
		}

		for(int i = 0; i < n; ++i){
			int p = 0;
			for(int j = 0; j < n; ++j){
				p = (p + (long long)y[i][j] * s[j]) % m;
			}
			printf("%d%c", p, i == n - 1 ? '\n' : ' ');
		}
	}
}

Measured memory_bytes: 1100
#include"iostream"
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<list>
#include<map>
#include<string>
#include<algorithm> 
#include <queue> 
#include <sstream>
#include <fstream>
#include<cmath>
#define INF 100000000000
#define LL long long
using namespace std;
map<LL, LL> m;
long long N, M, K, ans, A, B, a[6], b[6];

string s;

int main() {
	cin >> N;
	B = 1000000000000001;
	for (int i = 1; i <= 5; i++) {
		cin >> a[i];
		B = min(B, a[i]);
	}
	if(N%B==0)
	cout << N/B+4 << endl;
	else cout << N / B + 5 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int  long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
 
void solve(){
    int a,p;
    cin>>a>>p;
    cout<<(3*a+p)/2;
}
 
signed main(){
    //IOS;
    //freopen("input.txt", "r" , stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        cout<<"\n";
     //   cout<<" * "<<t<<"\n";
    }
//    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int n , m , cnt[N] ;
int main(){
    cin >> n >> m;
    for(int i = 0  ; i < m ; i++){
        int a , b;
        cin >> a >> b;
        cnt[a]++;
        cnt[b + 1]--;
    }
    int ans = 0;
    for(int i = 1 ; i <= n ; i++){
        cnt[i] += cnt[i - 1];
        if(cnt[i] == m) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <vector>

using namespace std;

int N, k, c;
int dp[222222];
char s[222222];

int n;
int d[1<<21];

void init(int n_) {
  n = 1;
  while( n < n_ ) n*=2;
  for( int i = 0; i < 2*n-1; i++ ) d[i] = 0;
}
 
void update(int i,int x) {
  i += n-1;
  d[i] = x;
  while( i > 0 ) {
    i = (i-1)/2;
    d[i] = (d[i*2+1] > d[i*2+2] ? d[i*2+1] : d[i*2+2]);
  }
}
 
int qq(int i,int j,int k,int l,int r) {
  if( r <= i || j <= l ) return 0;
  if( i <= l && r <= j ) return d[k];
  int a = qq(i,j,k*2+1,l,(l+r)/2);
  int b = qq(i,j,k*2+2,(l+r)/2,r);
  return a > b ? a : b;
}

int main(void) {
  scanf("%d%d%d", &N, &k, &c);
  c += 1;
  N += c;
  scanf("%s", s + c);
  init(N);
  for (int i = 0; i < c; i++) {
    s[i] = 'x';
  }
  // puts(s);
  // memset(dp, -1, sizeof(dp));
  dp[0] = 0;
  for (int i = c; i < N; i++) {
    if (s[i] == 'o') {
      update(i, qq(0, i - c + 1, 0, 0, n) + 1);
      // dp[i + c] = max(dp[i + c], dp[i] + 1);
    } else {
      update(i, qq(0, i - c + 1, 0, 0, n));
      // dp[i + c] = max(dp[i + c], dp[i]);
    }
  }

  if (qq(0, N, 0, 0, n) > k) {
    return 0;
  }

  map<int, int> cnt;
  vector<pair<int, int>> q;
  for (int i = 0; i < N; i++) {
    // printf("%4d", s[i] == 'o' ? d[i + n - 1] : 0);
    if (s[i] == 'o') {
      cnt[d[i + n - 1]] += 1;
      q.push_back({i, d[i + n - 1]});
    }
  }
  // puts("");

  vector<int> res;
  while (k > 0 && q.size() > 0) {
    int p = q.back().first;
    if (cnt[k] == 1) {
      res.push_back(q.back().first - c);
    }
    while (q.back().first > p - c) {
      cnt[q.back().second] -= 1;
      q.pop_back();
    }
    --k;
  }

  for (int i = res.size() - 1; i >= 0; i--) {
    printf("%d\n", res[i] + 1);
  }
  return 0;
}


Measured memory_bytes: 18544