akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//SOLVE
void solve(void)
{
  int N,W;
  cin>>N>>W;
  vector<int> Weight (N,0);
  vector<int> Value (N,0);
  for (int i = 0; i < N; i++)
  {
    cin>>Weight[i]>>Value[i];
  }
  vector<vector<int> > DP (N+1,vector<int>(W+1,0));
  for (int i = 0; i < N; i++)
  {
    for (int w = 0; w < W+1; w++)
    {
      if(w < Weight[i])
      {
        DP[i+1][w] = DP[i][w];
      }
      else
      DP[i+1][w] = max(DP[i][w],DP[i][w - Weight[i]] + Value[i]);
    }
    
  }
  cout<<DP[N][W]<<endl;
  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,n;
  cin>>A>>B;
for(int i=A; i<=B; i++)
if(i%10/1==i/10000 && i%10000/1000==i%100/10){
  n++;
}
cout << n <<endl;
}

Measured memory_bytes: 256
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    let mut v2 = Vec::new();
    for _ in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        let v = s.trim().split_whitespace()
            .map(|e| e.parse().ok().unwrap()).collect();
        v2.push(v);
    }
    v2
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main(){
    let stdin = read_vec::<isize>();
    let (n, d)=(stdin[0], stdin[1]);
    let a = n/(d*2+1);
    let amari = {
        if n%(d*2+1)==0{
            0
        }else{
            1
        }
    };

    println!("{:?}", a+amari);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define MOD 1000000007
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LLI long long int
#define LI long int 
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//               When something is important enough, you do it even if the odds are not in your favor.
LLI cost[100004];
int main(){   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      LI n,i;cin>>n;
      LI arr[n];fo(i,0,n) cin>>arr[i];
      cost[n-2]=abs(arr[n-1]-arr[n-2]);
      rfo(i,n-3,-1){
        cost[i]=min(abs(arr[i]-arr[i+1])+cost[i+1],abs(arr[i]-arr[i+2])+cost[i+2]);
      }
      cout<<cost[0];
    }
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define max 100010

using namespace std;


int q_sort(int d[],int left,int right){
	if(left >= right) return 0;
	int pipot = d[(left+right)/2], l = left, r = right, tmp;
	while(l<r){
		while(d[l] < pipot) l++;
		while(d[r] > pipot) r--;
		if( l <=  r){
			tmp = d[l];
			d[l] = d[r];
			d[r] = tmp;
			l++;
			r--;
		}
	}
	q_sort(d,left,r);
	q_sort(d,l,right);
}

int main(void)
{
	int n; cin>>n;
	int a[n]; for(int i = 0; i < n; i++) cin>>a[i];
	q_sort(a,0,n-1);
	int syurui[max]; for(int i = 0; i < max; i++) syurui[i] = 0;
	for(int i = 0; i < n; i++) syurui[a[i]]++;
	int ans = 0;
	for(int i = 0; i < max; i++){
		if(syurui[i] != 0) ans++;
	}
	
	int two_num = 0, one_num = 0;
	for(int i = 0; i < max; i++){
		if(syurui[i] >= 2 && syurui[i] % 2 == 0){
			syurui[i] = 2;
			two_num++;
		}
		else if(syurui[i] > 2 && syurui[i] % 2 == 1) syurui[i] = 1;
	}
	if(two_num % 2 == 1) ans--;
	//cout<<"two_num = "<<two_num<<", ans = "<<ans<<endl;
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 1024
def main():
    n, x = map(int, input().split())
    A = list(map(int, input().split()))

    A.sort()

    if sum(A) == x:
        return n

    for i in range(0, n):
        x -= A[i]
        if x < 0:
            break
    ans = i
    return ans


print(main())


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main() {
    int ans = 0;
    vector<int> b;
    for (int i = 0; i < 5; i++)
    {
        int A;
        cin >> A;
        if(A % 10 != 0) b.push_back(A % 10);
        int temp = (A + 9) / 10;
        ans += temp * 10;
    }

    if(b.size() >= 1){
        int sub = *min_element(b.begin(), b.end());
        ans -= (10 - sub);
    }
    cout << ans << endl;
}

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

typedef long long ll;
using namespace std;

#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define all(v) (v).begin(),(v).end()
#define UNIQUE(v) (v).erase( unique( all(v) ), (v).end() );
#define MOD 1000000007

ll item[3000][3000];
ll dp[3000][3000][4];

int main(){
	int r, c, k;	cin >> r >> c >> k;

	REP(i, r) REP(j, c)	item[i][j] = 0;
	REP(i, k){
		ll x, y;	cin >> x >> y;
		x--; y--;
		cin >> item[x][y];
	}

	REP(i, r) REP(j, c) REP(l, 4)	dp[i][j][l] = 0;

	REP(i, r) REP(j, c){
		ll tmp = 0;
		if( i != 0 )	tmp = max( {dp[j][i-1][0], dp[j][i-1][1], dp[j][i-1][2], dp[j][i-1][3]} );

		if( j != 0 ){
			dp[j][i][0] = max( dp[j-1][i][0], tmp );
			dp[j][i][1] = dp[j-1][i][1];
			dp[j][i][2] = dp[j-1][i][2];
			dp[j][i][3] = dp[j-1][i][3];

			if( item[i][j] != 0 ){
				dp[j][i][1] = max( {dp[j-1][i][1], dp[j-1][i][0] + item[i][j], tmp + item[i][j]} );
				dp[j][i][2] = max( {dp[j-1][i][2], dp[j-1][i][1] + item[i][j]} );
				dp[j][i][3] = max( {dp[j-1][i][3], dp[j-1][i][2] + item[i][j]} );
			}
		}else{
			dp[j][i][0] = tmp;
			dp[j][i][1] = tmp + item[i][j];
			dp[j][i][2] = 0;
			dp[j][i][3] = 0;
		}
	}

	r--; c--;
	cout << max( {dp[c][r][0], dp[c][r][1], dp[c][r][2], dp[c][r][3]} ) << endl;

	return 0;
}


Measured memory_bytes: 355132
#include <iostream>
#include <algorithm>
#include <vector>
#define ll long long
#define INF (1000000000000)
#define NIL (-1)
using namespace std;

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

  vector<ll> x(100001,0);
  vector<ll> mod(m);
  vector<ll> mod2(m);
  for(ll i = 0; i < n; i++){
    ll temp;
    cin >> temp;
    x[temp]++;
  }
  for(ll i = 0; i < 100001; i++){
    mod[i%m]+= x[i];
    mod2[i%m] += x[i]/2;
  }

  ll ans = 0;
  ll ans2 = 0;
  ll ans3 = 0;
  ans += mod[0] / 2;

  if(m %2 != 0){
    for(ll i = 1; i <= m/2; i++){
      ans += min(mod[i], mod[m-i]);
      ans2 += min(mod2[i], (mod[i] - min(mod[i],mod[m-i]))/2);
      ans2 += min(mod2[m-i], (mod[m-i] - min(mod[i], mod[m-i]))/2);
    }
  }else{
    for(ll i = 1; i < m/2; i++){
      ans += min(mod[i], mod[m-i]);
      ans2 += min(mod2[i], (mod[i] - min(mod[i],mod[m-i]))/2);
      ans2 += min(mod2[m-i], (mod[m-i] - min(mod[i], mod[m-i]))/2);
    }
    ans += mod[m/2] / 2;
  }

  cout << ans + ans2 << endl;

}


Measured memory_bytes: 2560
fun main () {
    readLine()!!.toInt()
    val list = readLine()!!.split(" ").map { it.toInt() }
    var a = 0
    var b = 0
    var c = 0
    var count = 0
    for (i in list.indices) {
        a = list[i]
        for (j in i + 1 until list.size) {
            b = list[j]
            for (k in j + 1 until list.size) {
                c = list[k]
                if (a != b && b != c && c != a) {
                    if (a + b > c && b + c > a && c + a > b) {
                        count++
                    }
                }
            }
        }
    }
    println(count)
}

Measured memory_bytes: 38420
//Pantyhose(black) + glasses = infinity

#include <bits/stdc++.h>
using namespace std;
 
#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"

void solve() {
	int n;
	cin >> n;

	vector<int> group(n+1);
	vector<pair<int, int> > res;

	for (int i=1; n+1-n%2>2*i; ++i)
		group[i] = group[n+1-n%2-i] = i;
	// PR(group, n);

	for (int i=1; i<=n; ++i) {
		for (int j=i+1; j<=n; ++j) {
			if (group[i]!=group[j])
				res.push_back({i, j});
		}
	}

	cout << res.size() << '\n';
	for (auto v : res)
		cout << v.first << ' ' << v.second << '\n';
}

int main() {
	#ifdef GLASSES_GIRL
		freopen(FILE_NAME".in", "r", stdin);
		freopen(FILE_NAME".out", "w", stdout);
	#endif
	ios::sync_with_stdio(0); cin.tie(0);
	solve();
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main()
{
	long int A[200];
	int N,flag,c,i;
	flag=0;
	c=0;
	cin>>N;
	for(i=0;i<N;i++)
	{
		cin>>A[i];
	}
	while(flag==0)
	{
		for(i=0;i<N;i++)
		{
			if((A[i]%2)==0)
			{
			   A[i]/=2;	
			}
			else if((A[i]%2)==1)
			{
				flag=1;
				break;
			}
			if(i==N-1)
			c++;
		}
	}
	cout<<c;
}
  

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define all(a) (a).begin(), (a).end()

int main() {
	int h, w;
	while (cin >> h >> w && h > 0) {
		string a, b;
		for (int i = 0; i < w; ++i) {
			a += (i % 2 == 0) ? '#' : '.';
			b += (i % 2 == 1) ? '#' : '.';
		}
		for (int i = 0; i < h; ++i)
			if (i % 2 == 0)
				cout << a << endl;
			else
				cout << b << endl;
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3196
import sys
input = sys.stdin.readline

def frog_2():
    N, K = map(int,input().split())
    H = tuple(map(int,input().split()))

    dp = [float("inf")] * N
    dp[0] = 0

    for n in range(1, N):
        k = max(0, n - K) # k: 'n' ループ目の最大ジャンプ幅 'K' 
        h = H[n]          # h: 'n' ループ目の足場の高さ'H'
        dp[n] = min(abs(h - H[i]) + dp[i] for i in range(k, n))
        
    print(dp[-1])

frog_2()

Measured memory_bytes: 14236
/* https://atcoder.jp/contests/abc122/tasks/abc122_c */

#include <iostream>
#include <string>
#include <vector>

std::vector<int> solve(const int N, const int Q, std::string S, std::vector<int> &l, std::vector<int> &r)
{
  std::vector<int> cum_sum_ac(N, 0);

  for (int i = 1; i < N; ++i) {
    bool is_exist_A = S.at(i-1) == 'A';
    bool is_exist_C = S.at(i) == 'C';
    cum_sum_ac.at(i) = cum_sum_ac.at(i-1);
    if (is_exist_A && is_exist_C) {
      cum_sum_ac.at(i)++;
    }
  }

  std::vector<int> sum_acs(Q);
  for (int i = 0; i < Q; ++i) {
    sum_acs.at(i) = cum_sum_ac.at(r.at(i)) - cum_sum_ac.at(l.at(i));
  }

  return sum_acs;
}

int main(int argc, char *argv[])
{
  // Input
  int N, Q;
  std::string S;

  std::cin >> N >> Q >> S;

  std::vector<int> l(Q);
  std::vector<int> r(Q);

  for (int i = 0; i < Q; ++i) {
    std::cin >> l.at(i) >> r.at(i);
    l.at(i)--;
    r.at(i)--;
  }

  // Output
  std::vector<int> sum_acs = solve(N, Q, S, l, r);
  for (auto e: sum_acs)
    std::cout << e << std::endl;

  return 0;
}


Measured memory_bytes: 2296
#include <stdio.h>

int main (void) {
    int a, b, c = 0;

    scanf("%d %d", &a, &b);

    b = b * 2;

    if (a <= b) {
        printf("%d", 0);
    } else {
        c = a - b;
        printf("%d", c);
    }

    return 0;
}

Measured memory_bytes: 128
<?php
$n=trim(fgets(STDIN));

$ai=array('S'=>0,'H'=>1,'C'=>2,'D'=>3);
$ia=array('S','H','C','D');

$fl=[];
for($i=0;$i<4;$i++){
  $fl[$i]=[];
  for($j=1;$j<=13;$j++){$fl[$i][$j]=1;}
}

for($i=0;$i<$n;$i++){
  list($a,$b)=explode(' ',trim(fgets(STDIN)));
  $fl[$ai[$a]][$b]=0;
}

$o='';
for($i=0;$i<4;$i++){
  for($j=1;$j<=13;$j++){
    if($fl[$i][$j]){
      $o.=$ia[$i].' '.$j.PHP_EOL;
    }
  }
}
print $o;

Measured memory_bytes: 15456
#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mem(a,b) memset((a),(b),sizeof(a))
#define MP make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define _GLIBCXX_PERMIT_BACKWARD_HASH
#include <ext/hash_map>
using namespace __gnu_cxx;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
struct str_hash{size_t operator()(const string& str)const{return __stl_hash_string(str.c_str());}};
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-4;
const int MAX=1e6+10;
const ll mod=1e9+7;
/****************************************  head  ****************************************/
int main()
{
	int a[5],ans,i;
	while(~scanf("%d",&a[0]))
	{
		ans=0;
		for(i=1;i<3;i++) scanf("%d",&a[i]);
		sort(a,a+3);
		for(i=1;i<3;i++) ans+=a[i]-a[i-1];
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 256
//set many funcs
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1145141919
#define llinf 1145141919810364364
#define mod 1000000007

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int n,i,a[131072],r=0,m;
    scanf("%d",&n);
    for(i = 1;i <= n;i++){scanf("%d",&a[i]);}
    for(i = 1;i <= n;i++){
        if(a[i] == i){
            m=a[i];a[i]=a[i+1];a[i+1]=m;r++;
        }
    }
    printf("%d\n",r);
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <db,db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD=998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

const int N=100005;

int dp[N+1][101];
void solve()
{
int n,w;
cin>>n>>w;

pair<int,int> p[n+1];
for(int i=1;i<=n;i++)
cin>>p[i].fi>>p[i].se;

for(int i=0;i<=N;i++)
for(int j=0;j<=n;j++)
dp[i][j]=INF;
for(int j=0;j<=n;j++)
dp[0][j]=0;
for(int i=1;i<=N;i++)
{
    for(int j=1;j<=n;j++)
    {
        dp[i][j]=dp[i][j-1];
        if(i>=p[j].se)
        dp[i][j]=min(dp[i][j],dp[i-p[j].se][j-1]+p[j].fi);
    }
}
for(int i=N;i>=0;i--)
if(dp[i][n]<=w)
{
    cout<<i<<endl;
    return;
}



}




int32_t main()
{
    IOS;
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        
        solve();
    }
    return 0;
}

Measured memory_bytes: 82580
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<vector>
#define ll long long
#define N 200
#define ls (now<<1)
#define rs ((now<<1)|1)
#define RG register
using namespace std;

inline ll read(){
    RG ll x=0,o=1; RG char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=((x<<3)+(x<<1))+ch-'0',ch=getchar();
    return x*o;
}

int n,s,a[N];

int main(){ int ans=0;
	n=read(),s=read();
	for(RG int i=1;i<=n;++i) a[i]=read(); sort(a+1,a+1+n);
	for(RG int i=1;i<=n;++i) if(s>=a[i]) s-=a[i],++ans; else break ;
	if(ans==n&&s) --ans; cout<<ans;
}


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

int main()
{
    long int L[2] = {2, 1};
     int num;
    int i;
    std::cin >> num;
    
    for(i = 1; i < num; i++){
        switch(i % 2){
            case 1:
                L[0] = L[0] + L[1];
                break;
            case 0:
                L[1] = L[0] + L[1];
                break;
        }
    }
    
    if(i % 2){
        std::cout << L[1];
    }else{
        std::cout << L[0];
    }
    
    return 0;
}


Measured memory_bytes: 256
function Main(input) {
  input = input.split("\n");
  var n = parseInt(input[0].split(" ")[0]);
  var m = parseInt(input[0].split(" ")[1]);
  var ans=0;
  for(i=1;i<=10000;i++){
    ans += Math.pow(1-Math.pow((1/2),m),i-1)*Math.pow((1/2),m)*(1900*m+(n-m)*100)*i;
  }
  ans=Math.ceil(ans);
  if(ans%10==1){
    ans -= 1;
  }else if(ans%10 == 9){
    ans += 1;
  }
  console.log('%s', ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 8008
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<string, int> P;
typedef vector<vector<int>> Graph;

const double PI = 3.14159265358979323846;

const int mod = 1000000007;

int main(int argc, char *args[]) {
	vector<int> a = {1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
	int K; cin >> K;
	cout << a[K-1] << endl;

	return 0;
}

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

int main(){
  int t=0;
  vector<int> v;
  while(1){
    int a;
    cin >> a;
    v.push_back(a);
    if(v[t] == 0)break;
    t++;
  }
  for(int i=0;i<t;i++){
    cout << "Case " << i+1 << ": " << v[i] << endl;
  }
}

Measured memory_bytes: 1320
l_1 = sorted(list(str(input())))
l_2 = sorted(list(str(input())),reverse=True)
s_1 = "".join(l_1)
s_2 = "".join(l_2)
if s_1==s_2:
    print("No")
    exit()
l=sorted([s_1,s_2])
if l[0]==s_1:print("Yes")
else:print("No")

Measured memory_bytes: 3188
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) x*=i;
    return x;
}

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

ll lcm(ll a,ll b)
{
   return a/gcd(a,b)*b;
}

void f(ll rest,string s){
    if(rest==0){
        cout<<s<<endl;
    }else{
        for(char c='a';c<='c';c++){
            f(rest -1,s+c);
        }
    }
}


int main(){
    ll n;
    cin>>n;
    vector<ll> a(n),b(n);
    rep(i,n) {
        cin>>a[i];
        b[i]=a[i];
    }
    sort(ALL(b));
    rep(i,n){
        if(a[i]<=b[(n+1)/2 - 1]) {
            cout<<b[(n+1)/2]<<endl;
            continue;
        }
        else if(a[i]>=b[(n+1)/2]){
            cout<<b[(n+1)/2 - 1]<<endl;
            continue;
        }
    }
    return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  ul n, k;
  cin >> n >> k;
  n -= n/k*k;
  cout << min(n, k-n) << endl;
  return 0;
}


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

int main(){

  long long n, d, m, t, x[200000];
  map<long long, int> mp;

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>d;
    mp[d]++;
  }
  cin>>m;
  for(int i=0;i<m;i++){
    cin>>t;
    mp[t]--;
    if(mp[t]<0){
      cout<<"NO"<<endl;
      return 0;
    }
  }

  cout<<"YES"<<endl;

  return 0;
}


Measured memory_bytes: 12800
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var m = int.Parse(spl[1]);
        var q = int.Parse(spl[2]);

        var AA = new List<int[]>();
        for (int i = 0; i < q; i++) {
            var ary = ToIntArray(input.ReadLine(), 4);
            AA.Add(ary);
        }

        Func<int[], long> count = (A) => {
            long sum = 0;
            foreach(var aa in AA) {
                var ai = aa[0] - 1;
                var bi = aa[1] - 1;
                var ci = aa[2];
                var di = (long)aa[3];
                sum += (A[bi] - A[ai] == ci ? di : 0);
            }
            return sum;
        };


        int[] tmp = new int[n];
        for (int i = 0; i < tmp.Length; i++) tmp[i] = 1;

        long max = 0;
        bool hasNext = true;

        while(hasNext) {
            //print(tmp);
            var sum = count(tmp);
            max = Math.Max(max, sum);

            hasNext = next(tmp, m, 0);
        }

        return max;
    }

    static bool next(int[] A, int max, int p) {
        bool isLast = p == A.Length - 1;
        if (isLast) {
            if (A[p] == max) {
                return false;
            } else {
                A[p] += 1;
                return true;
            }
        }

        var hasNext = next(A, max, p + 1);
        if (hasNext) return true;

        if (A[p] == max) {
            return false;
        } else {
            A[p] += 1;
            A[p + 1] = A[p] - 1;
            next(A, max, p + 1);
            return true;
        }
    }

    static void print(int[] A) {
        var buil = new StringBuilder();
        foreach (var i in A) {
            buil.Append(i);
            buil.Append(',');
        }
        Debug.WriteLine(buil.ToString());
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 27724
#include <stdio.h>
int main(void){
  int n,w[100],v[100],ws,i,j;
  long int dp[100][100001],max;
  scanf("%d%d",&n,&ws);
  for (i=0;i<n;i++){
    scanf("%d%d",&w[i],&v[i]);
    dp[i][0]=0;
  }
  for (i=0;i<=ws;i++) dp[0][i]=(i<w[0])? 0:v[0];
  for (i=1;i<n;i++){
    for (j=1;j<=ws;j++){
      max=dp[i-1][j];
      if (j>=w[i]&&dp[i-1][j-w[i]]+v[i]>max) max=dp[i-1][j-w[i]]+v[i];
      dp[i][j]=max;
    }
  }
  printf("%ld\n",dp[n-1][ws]);
  return 0;
}

Measured memory_bytes: 78336
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

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

ostream& operator << (ostream& os, const mint a) {
    os << a.x;

    return os;
}


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll N;
    cin >> N;

    vll A(N);
    REP(i, N) cin >> A[i];

    vector<int> cnt(61, 0);

    mint ans = 0;
    int j_max = 0;
    REVREP(i, N) {
        vector<int> tmp(61, 0);

        int j = 0;
        while(A[i] > 0) {
            if (A[i] & 1) tmp[j]++;
            A[i] >>= 1;
            j++;
        }

        int n = N - i - 1;

        j_max = max(j_max, j);

        mint b = 1;
        REP(k, j_max) {
            if (tmp[k] == 0) {
                ans += b * cnt[k];
            } else {
                ans += b * (n - cnt[k]);
            }

            b *= 2;
            cnt[k] += tmp[k];
        }
    }

    print(ans);

}


Measured memory_bytes: 5524
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

int main(){
	int n;
	cin >> n;
	int A[n];
	for (int i = 0; i < n; i++){
		scanf("%d",&A[i]);
	}
	int q, k, sum = 0;
	cin >> q;
	for(int i = 0; i < q ; i++){
		scanf("%d",&k);	
		// lower_bound returns iterator.
		if(*lower_bound(A,A+n,k)==k)
			sum++;
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3512
#include<iostream>
#include<string>

using namespace std;

int count( string str, string t, int &curr ){
    int cnt = 0;
    for( ; curr + t.size() - 1 < str.size(); cnt++, curr += t.size() ){
        if( str.substr(curr, t.size()) != t ) break;
    }
    return cnt;
}

bool isA( string str, int curr ){
    if ( str.substr(0, curr) != ">'" ) return false;
    int cnt = count(str, "=", curr);
    if ( cnt < 1 || str[curr++] != '#' ) return false;
    if ( cnt != count(str, "=", curr) ) return false;
    return ( curr == str.size()-1 && str[curr] == '~');
}

bool isB( string str, int curr ){
    if ( str.substr(0, curr) != ">^" ) return false;
    int cnt = count(str, "Q=", curr);
    return ( cnt && curr == str.size()-2 && str.substr(str.size()-2, 2) == "~~");
}

int main(){
    int tcase; cin >> tcase;
    for ( int i = 0; i < tcase; i++ ) {
        string snake; cin >> snake;
        if ( isA(snake, 2) ) cout << "A" << endl;
        else if ( isB(snake, 2) ) cout << "B" << endl;
        else cout << "NA" << endl;
    }
    return 0;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    ll ans = (1 + (n - 1)) * (n - 1) / 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
# 087_a
X=int(input())
A=int(input())
B=int(input())

if (1<= (A+B) and X<= 10000) and (1<=A and A<= 1000) and (1<=B and B<= 1000):
    a=X-A
    b=int(a/B)
    print(a-(b*B))


Measured memory_bytes: 9164
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;
        static void SolveA()
        {
            var o = ReadAndParseIntArr();
            int n = o[0];
            int m = o[1];

            long ans = (m * 1900 + (n - m) * 100) * pow(2, m);
            Console.WriteLine(ans);
        }
        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if( x == 2) { return true; }
            if( x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while( i * i <= x)
            {
                if( x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if( n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if( n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

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

int main(){
    long long n,m,ok=0LL,ng=200001LL,mid,i,j,ok_count,ng_count=0LL,ans=0LL;
    cin>>n>>m;
    int a[n];
    for(i=0LL;i<n;i++)cin>>a[i];
    sort(a,a+n,greater<int>());
    while(ok+1LL<ng){
        mid=(ok+ng)/2LL;
        ok_count=j=0LL;
        for(i=n-1;i>=0;i--){
            while(j<n&&a[i]+a[j]>=mid)j++;
            ok_count+=j;
        }
        (ok_count>=m?ok:ng)=mid;
    }
    long long accum[n+1];
    accum[0]=0LL;
    for(i=1LL;i<=n;i++)accum[i]=a[i-1]+accum[i-1];
    for(i=n-1,j=0LL;i>=0LL;i--){
        while(j<n&&a[i]+a[j]>=ng)j++;
        ng_count+=j;
        ans+=(a[i]*j+accum[j]);
    }
    cout<<ans+(m-ng_count)*ok<<endl;
    return 0;
}

Measured memory_bytes: 1408
n,A,B,C=map(int,input().split())
l=[]
for _ in range(n):
    l.append(int(input()))
def solve(cur,a,b,c):
    if cur==n:
        #base case
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else float('INF')
    ret0=solve(cur+1,a,b,c)
    ret1=solve(cur+1,a+l[cur],b,c)+10
    ret2=solve(cur+1,a,b+l[cur],c)+10
    ret3=solve(cur+1,a,b,c+l[cur])+10
    return min(ret0,ret1,ret2,ret3)
print(solve(0,0,0,0))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define TRACE
#ifdef TRACE
#define tr(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define tr(...)
#endif

#define ll long long
#define ld long double 
#define endl "\n"
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (ll)(a.size())
#define all(a) a.begin(), a.end() 
#define fr(i,n) for(i=1;i<=n;i++)
#define rp(i,n) for(i=0;i<n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
typedef pair<ll, ll> ii;
typedef vector<ll> vl;
const ll N = 200010;
ll mod=1e9+7;

ll ffmod(ll x, ll y, ll mod)
{
    ll rt=1;
    while(y)
    {
        if(y&1ll) rt=(rt*x)%mod;
        x=(x*x)%mod, y/=2ll;
    }
    return rt;
}

ll n, bit[N], a[N], h[N], dp[N];

void upd(ll i, ll val)
{
    for(;i<=n;i+=(i&-i))
        bit[i]=max(bit[i], val);
    return;
}

ll qry(ll i)
{
    ll rt=0;
    for(;i>0;i-=(i&-i))
        rt=max(rt, bit[i]);
    return rt;
}

int main()
{
    FIO;
    ll i,mx=0;
    cin>>n;
    fr(i,n) cin>>h[i];
    fr(i,n) cin>>a[i];
    fr(i,n)
    {
        dp[i]=a[i]+qry(h[i]-1);
        upd(h[i], dp[i]);
        mx=max(mx, dp[i]);
//        tr(dp[i]);
    } 
    cout<<mx<<endl;
    return 0;
}


Measured memory_bytes: 6528
#include <iostream>

using namespace std;

typedef long long ll;
#define x first
#define y second
#define mp make_pair

int n, k;
ll s;
const int max_val = (ll)1e9;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> k >> s;
for(int i = 0 ; i < k ; ++i){
	cout << s << ' ';
}
for(int i = k ; i < n ; ++i){
	if(s == max_val){
		cout << 1 << ' ';
	}
	else{
		cout << max_val << ' ';
	}
}
cout << endl;

return 0;
}



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

#define LL long long
#define Dl double
#define Pb push_back
#define Po pop_back
#define Mp make_pair
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)

using namespace std;

typedef vector<LL> Vl;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef vector<Pll> Vpl;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
#define X first
#define Y second
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

int main()
{
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

    string s;
    cin >> s;

    set<char> st;
    LL L = s.size();
    for(LL i = 0; i < L; i++){
        st.In(s[i]);
    }

    if(st.size() < L)
        cout << "no\n";
    else
        cout << "yes\n";

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using namespace std;

int main() {
  fastIO;

  int n;
  cin >> n;
  vector<int> V(n), C(n);
  rep(i, n) cin >> V.at(i);
  rep(i, n) cin >> C.at(i);

  int maxValue = 0;
  for(int bit=0; bit<(1<<n); ++bit) {
    int subsum = 0;
    for(int i=0; i<n; ++i) {
      if(bit & (1 << i) ) {
        subsum += V.at(i) - C.at(i);
      }
    }
    maxValue = max(subsum, maxValue);
  }

  cout << maxValue << endl;
}


Measured memory_bytes: 3644
// abc135_b
// #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)

int main(void) {
	int n;
	cin >> n;
	vector<int> p(n);
	rep(i, n) cin >> p[i];
	int k = 0;
	rep(i, n)
		if (p[i] != i + 1) {
			k++;
		}
	if (k <= 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;

	}

}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(long long i=(l);i<(r);i++)
#define dec(i, l, r)   for(long long i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    LL w, h;cin >> w >> h;
    vector<LL> p(w), q(h);
    inc(i, 0, w) cin >> p[i];
    inc(i, 0, h) cin >> q[i];
    int np = w+1;
    int nq = h+1;
    sort(p.begin(), p.end());
    sort(q.begin(), q.end());
    int i = 0;
    int j = 0;
    LL ans = 0;
    while(i < w || j < h){
        if(i == w){
            ans += np*q[j];
            nq--;
            j++;
            continue;
        }
        if(j == h){
            ans += nq*p[i];
            np--;
            i++;
            continue;
        }
        if(p[i] < q[j]){
            ans += nq*p[i];
            np--;
            i++;
        }else{
            ans += np*q[j];
            nq--;
            j++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
S = input()
Q = int(input())
A = [input().split() for i in range(Q)]

tmp = 0
s = S
t = ''

for li in A:
#     print(s,t,tmp)
    if li[0] == '1':
        tmp = (tmp+1)%2
    else:
        if (tmp+int(li[1]))%2 == 1:
            t += li[2]
        else:
            s += li[2]
            
if tmp == 0:
    print(t[::-1]+s)
else:
    print(s[::-1]+t)

Measured memory_bytes: 41520
#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
vector<int> A;
int n, k;
int dp1[MAX];
int dp2[MAX];
void solve1() {
    for (int i = 0; i < MAX; i++) dp1[i] = 0;
    for (int i = 0; i < MAX; i++) {
        for (auto a: A) {
            if (i + a >= MAX) break;
            // if (dp1[i+a] == -1) dp1[i+a] = 1 - dp1[i];
            if (dp1[i] == 0) dp1[i+a] = 1;
        }
    }
    string ans;
    if (dp1[k] == 1) ans = "First";
    else ans = "Second";
    cout << ans << endl;
    return;
}
// void solve2() {
//     for (int i = 0; i < MAX; i++) dp2[i] = 0;
//     for (int i = 0; i < MAX; i++) {
//         for (auto a: A) {
//             if (i - a >= 0 && dp2[i-a] == 0) dp2[i] = 1;
//         }
//     }
//     string ans;
//     if (dp2[k] == 1) ans = "First";
//     else ans = "Second";
//     cout << "ans2: " << ans << endl;
//     return;
// }

int main() {
    cin >> n >> k;
    A.resize(n);
    for (int i = 0; i < n; i++) cin >> A[i];
    solve1();
    // solve2();
    return 0;
}

Measured memory_bytes: 4012
#include<iostream>
#include<cstdio>
using namespace std;
int n,m,dx[8]={1,1,1,0,0,-1,-1,-1},dy[8]={0,1,-1,1,-1,0,1,-1};
char map[150][150];
int vis[150][150],f[150][150];
void sear(int x,int y){
	
	for(int k=0;k<8;k++){
		int i=x,j=y;
		i+=dx[k];
		j+=dy[k];
		if(vis[i][j]==1){
			f[x][y]++;
		}
	}
}
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin>>map[i][j];
			if(map[i][j]=='#')vis[i][j]=1;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(vis[i][j]!=1){
				sear(i,j);
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
		if(vis[i][j]==1)printf("#");
		else printf("%d",f[i][j]);
		}
	printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<stdio.h>
#include<sstream>
#include<map>
#include<vector>
#include<queue>
using namespace std;
int main()
{
  string s;
  cin>>s;
  int a=s.size();
  int max1=0,sum=0;
  for(int b=0;b<a;b++)
  {
      for(int c=b;c<a;c++)
      {
          if(s[c]=='A'||s[c]=='C'||s[c]=='G'||s[c]=='T')
            sum++;
          else break;
      }
      if(sum>max1) max1=sum;
      sum=0;
  }
  cout<<max1;
}










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

//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))
#define int long long

signed main(){
    int r;
    cin >> r;
    printf("%.10f\n", M_PI * r * 2);
}

Measured memory_bytes: 3724
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  int i,n,p[10],q[10],k=0,c,b,sum=0,a[10];
  scanf("%d\n",&n);
  for(i=0;i<n;i++){
    a[i]=i+1;
  }
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
  }
  for(i=0;i<n;i++){
    scanf("%d",&q[i]);
  }
  do{
    sum++;
    for(i=0;i<n;i++){
      if(a[i]!=p[i]){
        k=1;
        break;
      }
    }
    if(k==0){
      c=sum;
    }
    k=0;
  }while(next_permutation(a,a+n));
  sum=0;
  for(i=0;i<n;i++){
    a[i]=i+1;
  }
  do{
    sum++;
    for(i=0;i<n;i++){
      if(a[i]!=q[i]){
        k=1;
        break;
      }
    }
    if(k==0){
      b=sum;
    }
    k=0;
  }while(next_permutation(a,a+n));
  printf("%d\n",abs(b-c));
  return 0;
}

Measured memory_bytes: 256
//////https://atcoder.jp/contests/abc178/tasks/abc178_e
#include <bits/stdc++.h>

using namespace std;

const int MO=1e9+7;
const int MAXN=2e5+4;
long long a[MAXN];
long long b[MAXN];

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

    for (int i=1; i<=n; i++) {
        long long x, y;
        cin>>x>>y;
        a[i]=x+y;
        b[i]=x-y;
    }
    sort(a+1, a+n+1);
    sort(b+1, b+n+1);

    cout<<max(a[n]-a[1], b[n]-b[1])<<"\n";

    return 0;
}

Measured memory_bytes: 6756
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

struct edge {
	ll u;
	ll v;
	ll cost;
	edge() {}
	edge(ll u, ll v, ll c) :u(u), v(v), cost(c) {}
};

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	ll V, E; cin >> V >> E;
	vector<vector<edge>> G(V);
	for (int i = 0; i < E;i++) {
		ll s, t, w; cin >> s >> t >> w;
		G[s].push_back(edge(s, t, w));
		G[t].push_back(edge(t, s, w));
	}

	vector<int> checked(V, 0);
	vector<ll> min_d(V, INF);
	ll ans = 0;
	min_d[0] = 0;
	while (true) {
		ll next = -1;
		for (int i = 0; i < V;i++) {
			if (checked[i] == 1)continue;
			if (next == -1 || min_d[i] < min_d[next]) {
				next = i;
			}
		}
		if (next == -1)break;
		checked[next] = 1;
		ans += min_d[next];
		for (auto e : G[next]) {
			min_d[e.v] = min(min_d[e.v], e.cost);
		}
	}

	/*for (int i = 0; i < V;i++) {
		if (checked[i] == 0) {
			cout << "cann't create minimum spanning tree" << endl;
			return 0;
		}
	}*/
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11048