akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

int N;
long long int H;
vector<long long int> a, b, c;
long long int s[100005];

int main(void) {

	cin >> N >> H;
	long long int tmp;
	for (int i = 1; i <= N; i++) {
		cin >> tmp; a.push_back(tmp);
		cin >> tmp; b.push_back(tmp);
	}

	c = b;

	sort(c.begin(), c.end());  

	s[N] = 0;
	s[N - 1] = c[N - 1];
	for (int i = N - 2; i >= 0; i--) {
		s[i] = s[i + 1] + c[i];   // s 
	}

	long long int ans = 9999999999999999;

	//===== b only ======//
	for (int i = 1; i <= N; i++) {
		if (s[N - i] >= H) { ans =min(ans, (long long int) i); break; }
	}
	//--------------------

	//cout << "ans= " << ans << endl;

	//===== a[i] ========//
	for (int i = 0; i < N; i++) {
		int k = upper_bound(c.begin(), c.end(), a[i]) - c.begin(); //cout << "k= " << k << endl;
		long long int sum = 0;
		sum = s[k] - b[i]; //cout << "sum= " << sum << endl;
		long long int rem = H - sum;
		rem -= b[i] - a[i]; //cout << "rem= " << rem << endl;
		if (rem < 0) { continue; }
		long long int count = N-k-1+(rem + a[i] - 1) / a[i];
		ans = min(ans, count);
	}

	cout << ans << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
int64_t mod=998244353;
int64_t pw(int64_t x,int64_t y){
  int64_t z;
  if(y==0) return 1;
  else{
    z=pw(x,y/2)*pw(x,y/2)%mod;
    if(y%2==1) z=z*x%mod;
    return z;
  }
}
int main(){
  int64_t n,m,k,i,l,ans=0;
  cin>>n>>m>>k;
  vector<int64_t> mp(n),fa(n),fi(n);
  mp.at(0)=1; fa.at(0)=1; fi.at(0)=1;
  for(i=1;i<n;i++){
    mp.at(i)=mp.at(i-1)*(m-1)%mod;
    fa.at(i)=fa.at(i-1)*i%mod;
    fi.at(i)=fi.at(i-1)*pw(i,mod-2)%mod;
  }
  for(i=0;i<=k;i++){
    l=fa.at(n-1)*fi.at(i)%mod;
    l=l*fi.at(n-1-i)%mod;
    l=l*mp.at(n-1-i)%mod;
    ans=(ans+l)%mod;
//    ans+=(ans+fa.at(n-1)*fi.at(i)*fi.at(n-1-i)*mp.at(n-1-i))%mod;
  }
  ans=ans*m%mod;
  cout<<ans<<endl;
}

Measured memory_bytes: 7952
def examA():
    A, B = LI()
    ans = A*B
    print(ans)
    return

def examB():
    N = I()
    A = LI()
    for a in A:
        if a==0:
            print(0)
            return
    ans = 1
    for a in A:
        ans *= a
        if ans>10**18:
            print(-1)
            return
    print(ans)
    return

def examC():
    A, B = list(map(float, input().split()))
    #print(A,B)
    if int(A)==0:
        print(0)
        return
    if int(B)==0:
        print(0)
        return
    ans = A*(B+_ep)
    print(int(ans-_ep))
    return

# from Taka0310
def examC2():
    A, B = LDI()
    ans = int(A*B)
    print(ans)
    return

def examD():
    def factorization(n):
        arr = defaultdict(int)
        temp = n
        for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
            if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr[i] = cnt
        if temp != 1:
            arr[temp] = 1
        if arr == []:
            arr[n] = 1
        return arr
    C = [0,1,3,6,10,15,21,28,36,45]
    N = I()
    F = factorization(N)
    ans = 0
    #print(F)
    for f in F.values():
        for i in range(10):
            if C[i]>f:
                ans += i-1
                break
    print(ans)
    return

def examE():
    N = I()
    A = [0]*N
    B = [0]*N
    for i in range(N):
        A[i],B[i] = LI()
    A.sort()
    B.sort()
    if N%2==0:
        L = (A[N//2-1] + A[N//2])/2
        R = (B[N//2-1] + B[N//2])/2
        ans = int((R-L)*2) +1
    else:
        L = A[N//2]
        R = B[N//2]
        ans = (R-L)+1

    print(ans)
    return

def examF():
    inv = pow(2,mod2-2,mod2)
    N, S = LI()
    A = LI()
    dp = [[0]*(S+1)for _ in range(N+1)]
    dp[0][0] = pow(2,N,mod2)
    for i in range(N):
        a = A[i]
        for s in range(S+1):
            dp[i+1][s] += dp[i][s]
            dp[i+1][s] %= mod2
            if (s+a<=S):
                dp[i+1][s+a] += dp[i][s]*inv%mod2
                dp[i + 1][s+a] %= mod2
   # print(dp)
    ans = dp[-1][-1]%mod2
    print(ans)
    return

from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 1<<60
_ep = 10**(-16)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC2()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル
	
	int l,r,d;
	cin >> l >> r >> d;

	int ans = 0;
	for(int i=l; i<=r; i++){
		if(i%d==0){
			ans++;
		}
	}

	cout << ans << endl;

}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	
	solve();
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll unsigned long long
using namespace std;
int main(){
    ll n,a,b,ans;
    cin>>n>>a>>b;
    ll dis=b-a;
    if(dis%2==0){
        ans=dis/2;
        
    }
    else {
        ans=min(max(a-1,b-1),max(n-a,n-b));
        ans=min(ans,min( ( n-(a+(n-b)+1) )/2 + (n-b)+1, ((b-(a-1)-1)-1)/2 +(a-1)+1 ));
    }
    cout<<ans<<endl;
}

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

using namespace std;

bool isprime(int x);

int main()
{
	int i, j;
	int a, n;
	int ans = 0;
	
	cin >> n;
	
	for (i = 0; i < n; i++){
		cin >> a;
		if (isprime(a) == true) ans++;
	}
	
	cout << ans << "\n";
	
	return (0);
}

bool isprime(int x)
{
	int i = 3;
	
	if (x == 2) return (true);
	if (x < 2 || x % 2 == 0) return (false);
	
	while (x >= i * i){
		if (x % i == 0) return (false);
		i += 2;
	}
	
	return (true);
}


Measured memory_bytes: 3044
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <tuple>
#include <queue>
#include <string>
#include <map>
#include <utility>
const int maxn = 1e5+1;
typedef long long ll;
using namespace std;
std::map< std::pair<int,int> , int> M;
int y[maxn];
int x[maxn];
ll cnt[10];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll H,W;
    cin>>H>>W;
    int n;
    cin>>n;
    for(int i=1; i<=n; ++i){
        int a,b;
        cin>>a>>b;
        y[i]=a;
        x[i]=b;
        M[make_pair(a,b)]=1;
    }
    for(int dy=0; dy<3; ++dy)
        for(int dx=0; dx<3; ++dx)
            for(int i=1; i<=n; ++i){
                int base_y=y[i]-dy;
                int base_x=x[i]-dx;
                int good=1;
                if (base_x+2>W)
                    good=0;
                if (base_y+2>H)
                    good=0;
                if (base_x<=0)
                    good=0;
                if (base_y<=0)
                    good=0;
                    for(int z=dy+1; z<3; ++z)
                        for(int e=0; e<3; ++e)
                            if (M.count(make_pair(base_y+z,base_x+e)))
                                good=0;

                    for(int e=dx+1; e<3; ++e)
                        if (M.count(make_pair(y[i],base_x+e)))
                            good=0;

               // cout<<i<<" "<<dy<<" "<<dx<<" : "<<good<<endl;
                if (good){
                    int cur=0;
                    for(int e=0; e<3; ++e)
                        for(int z=0; z<3; ++z)
                            cur+=M.count(make_pair(base_y+z,base_x+e));
                    cnt[cur]++;
                   // cout<<cur<<endl;
                }
            }
    cnt[0]=(H-2)*(W-2);
    for(int i=1; i<=9; ++i)
        cnt[0]-=cnt[i];
    for(int i=0; i<=9; ++i)
        cout<<cnt[i]<<"\n";
}

Measured memory_bytes: 9344
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rrep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define maxe(x) *max_element(all(x))
#define mine(x) *min_element(all(x))
#define Size(x) ((int)(x).size())
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
long long MOD = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,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;
    }

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo,gyakugen
//mint

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        string a,b,e;
        ll c,d;
        cin>>a>>b>>c>>d>>e;
        if(a==e)cout<<c-1<<' '<<d<<endl;
        else cout<<c<<' '<<d-1<<endl;
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint ungigned
#define db double
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define pli pair<ll,int>
#define vi vector<int>
#define vpi vector<pii >
#define IT iterator
 
#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define y1 wzpakking 
#define fi first
#define se second
#define BG begin
#define ED end
 
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?(x)-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a))
#define CPY(a,b) memcpy(a,b,sizeof(a))
#define sqr(x) (1ll*x*x)
 
#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2
#define INF (1<<30)
#define int long long
using namespace std;
const int N=300005;
int n,a[N],B,W,s[N];
bool ok(int t){
	int mn=0;
	for (int i=2;i<=n-1;i+=2)
		if (s[i-1]-mn>=t) mn=min(mn,s[i]);
	return s[n]-mn>=t;
}
int calc(){
	int l=0,r=B,ans;
	while (l<=r){
		int mid=((ll)l+r)/2;
		if (ok(mid)) ans=mid,l=mid+1;
		else r=mid-1;
	}
	return ans;
}
signed main(){
	scanf("%lld",&n);
	For(i,1,n){
		scanf("%lld",&a[i]);
		if (i%2==0) W+=a[i],s[i]=s[i-1]-a[i];
		else B+=a[i],s[i]=s[i-1]+a[i]; 
	}
	if (!(n&1))
		return printf("%lld %lld\n",max(W,B),min(W,B)),0;
	ll ans=W+calc();
	printf("%lld %lld\n",ans,(ll)B+W-ans);
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
ll modfac(ll a){
    ll ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
ll modinv(ll a,ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
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(){
    ll v,e;cin >> v >>e;
    vector<tuple<ll,ll,ll>> edge(e);
    rep(i,e){
        cin >> get<1>(edge[i]) >>get<2>(edge[i]) >>get<0>(edge[i]);
    }
    sort(all(edge));
    UnionFind uf(v);
    ll ans=0;
    rep(i,e){
        if(!uf.same(get<1>(edge[i]),get<2>(edge[i]))){
            ans+=get<0>(edge[i]);
            uf.merge(get<1>(edge[i]),get<2>(edge[i]));
        }
    }
    cout <<ans <<endl;
}


Measured memory_bytes: 5172
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int n,i;
  int ans = 0;
  cin >> n;
  int a[n];
  for(i = 0; i < n; i++){
    cin >> a[i];
    if(a[i] % 2 == 0){
      if((a[i] % 3 != 0) && (a[i] % 5 != 0)){
        ans = 1;
      }
    }
  }
  if(ans == 0){
    cout << "APPROVED";
  }else{
    cout << "DENIED";
  }
}


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

void solve(){
	string a,b;
	int alen,blen,i,j;
	cin>>a>>b;
	alen = a.size();
	blen = b.size();
	int dp[alen+1][blen+1];

	for(i=0;i<=alen;i++){
		dp[i][blen]=0;
	}
	for(j=0;j<=blen;j++){
		dp[alen][j]=0;
	}
	for(i=alen-1;i>=0;i--){
		for(j=blen-1;j>=0;j--){
			dp[i][j] = a[i]==b[j]?1+dp[i+1][j+1]:max(dp[i+1][j],dp[i][j+1]);
		}
	}

	

	// for(i=0;i<=alen;i++){
	// 	for(j=0;j<=blen;j++)
	// 		cout<<dp[i][j]<<" ";
	// 	cout<<endl;
	// }

	char ans[3001] = {0};
	int index = 0;
	i=j=0;

	while(index!=dp[0][0]){
		if(a[i]==b[j]){
			ans[index++] = a[i];
			i++;
			j++;
		}else if(dp[i][j+1]==dp[i][j]){
			j++;
		}else{
			i++;
		}
	}
	ans[index]=0;
	cout<<ans<<endl;
}

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


Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    vector<int> L(N);
    int n = 1000;
    ll t[n + 1]{};
    for (int i = 0; i < N; i++) {
        cin >> L[i];
        t[L[i]]++;
    }
    sort(L.begin(), L.end());
    for (int i = 1; i <= n; i++) {
        t[i] += t[i - 1];
    }
    ll cnt = 0;

    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            int a = L[i];
            int b = L[j];
            auto itr1 = lower_bound(L.begin(), L.end(), a + b);
            auto itr2 = lower_bound(L.begin(), L.end(), b - a + 1);
            ll m = itr1 - L.begin() - (itr2 - L.begin()) - 1;
            if (b - a < a) m--;
            cnt += max(0ll, m);
        }
    }
    cout << cnt / 3<< "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
static const int MAX_PROC = 100000;

struct Process{
  string name;
  int time;
};

class Queue{
public:
  Process proc[MAX_PROC];
  int head=0, tail=0;
  void enqueue(struct Process p);
  struct Process dequeue();
  bool isEmpty();
  bool isFull();
}queue;

void Queue::enqueue(struct Process p){
  if(isFull()){
    cout << "error: queue is full" << endl;
  }
  proc[head] = p;
  head++;
  if(head == MAX_PROC) head = 0;
}

struct Process Queue::dequeue(){
  Process p;
  if(isEmpty()){
    cout << "error: queue is empty" << endl;
  }
  p = proc[tail];
  tail++;
  if(tail == MAX_PROC) tail = 0;
  return p;
}

bool Queue::isEmpty(){
  if(head == tail) return true;
  else return false;
}

bool Queue::isFull(){
  if((head+1)%MAX_PROC == tail) return true;
  else return false;
}

int main(){
  int n, q, cnt=0;
  struct Process p;
  cin >> n >> q;
  for(int i=0; i<n; i++){
    cin >> p.name >> p.time;
    queue.enqueue(p);
  }

  while(queue.isEmpty()==false){
    p = queue.dequeue();
    if(p.time <= q){
      cnt += p.time;
      cout << p.name << " " << cnt << endl;
    }else{
      cnt += q;
      p.time -= q;
      queue.enqueue(p);
    }
  }
  return 0;
}


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

int main() {
	int n; cin >> n;
	vector<int> arr(n);
	for (int i=0; i<n; i++) cin >> arr[i];
	int cnt = 0;
	for (int i=0; i<n; i++) {
		if (i % 2 == 0 && arr[i] % 2 == 1) cnt++;
	}
	cout << cnt;
}


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

int a[10];

int main(){
  int n;
  cin >> n;
  int t = 0;
  for (int i = 0; i < n; i++){
    int k; cin >> k;
    if (k < 3200) a[k/400]++;
    else t++;
  }
  int u = 0;
  for (int i = 0; i < 8; i++) {
    if (a[i] > 0) u++;
  }
  cout << max(u, 1) << " " << t + u << endl; 
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
	int N; cin >> N; 
	int cnt[300010] = {}; 
	for(int i = 0; i < N; i++){
		int a; cin >> a; cnt[a-1] --; 
	}
	sort(cnt, cnt + N); 
	int acc[300010] = {}; 
	for(int i = 1; i <= N; i++){
		int l = upper_bound(cnt, cnt + N, -i) - cnt;  
		acc[i] = acc[i-1] + l; 
	}
	for(int i = 1; i <= N; i++){
		acc[i] /= i; acc[i] *= -1;
	}
	for(int i = 1; i <= N; i++){
		int tmp = upper_bound(acc+1, acc+N+1, -i) - acc - 1; 
		cout << tmp << endl; 
	}
}

Measured memory_bytes: 3200
#include "bits/stdc++.h"

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    string s, t;
    cin >> s >> t;

    auto dp = make_v(0LL, s.length() + 1, t.length() + 1);
    for (size_t i = 0; i < s.length(); ++i) {
        for (size_t j = 0; j < t.length(); ++j) {
            if (s[i] == t[j]) {
                chmax(dp[i + 1][j + 1], dp[i][j] + 1);
            }
            chmax(dp[i + 1][j + 1], dp[i][j + 1]);
            chmax(dp[i + 1][j + 1], dp[i + 1][j]);
        }
    }

    dump(dp[s.length()][t.length()]);

    string res = "";
    size_t i = s.length(), j = t.length();
    while (i > 0 && j > 0) {
        if (dp[i][j] == dp[i - 1][j]) {
            i--;
        } else if (dp[i][j] == dp[i][j - 1]) {
            j--;
        } else {
            dump(s[i], t[j]);
            res = s[i - 1] + res;
            i--, j--;
        }
    }

    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
 

int main(){ 
	ll k,x;
	cin >> k >> x;
	FOR(i,x-k+1,x+k){
		cout << i << " ";
	}
	cout << endl;
}


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

bool check(long long val, long long k, const vector <long long>& A, const vector <long long>& F) {

	for(int i = 0; i < A.size(); i++) {
		long long limite = val / F[i];
		if(A[i] > limite) {
			k -= A[i] - limite;
		}
	}

	return k >= 0;
}

int main() {
	long long n,k;
	scanf("%lld %lld", &n, &k);

	vector <long long> A(n),F(n);

	for(int i = 0; i < n; i++) {
		scanf("%lld", &A[i]);
	}

	for(int i = 0; i < n; i++) {
		scanf("%lld", &F[i]);
	}

	sort(A.rbegin(), A.rend());
	sort(F.begin(), F.end());

	long long L = 0;
	long long R = 1000000000000;

	long long ans;

	while(L <= R) {
		long long mid = (L+R) / 2LL;

		if(check(mid, k, A, F)) {
			ans = mid;
			R = mid - 1;
		} else {
			L = mid + 1;
		}
	}

	printf("%lld\n",ans );

    return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max({a * c, a * d, b * c, b * d}) << endl;
  return 0;
}


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

const int N = 5010;

typedef long long LL;

int num[N]; LL dp[N];

int main() {
    int n, A, B; scanf("%d%d%d", &n, &A, &B);
    for (int i = 1; i <= n; i++) scanf("%d", &num[i]);
    memset(dp, 0x3f, sizeof(dp)), dp[0] = 0, num[n + 1] = n + 1, n++;
    for (int i = 1; i <= n; i++) {
        for (int j = i - 1, l = 0, r = 0, mx = 0; j >= 0; j--) {
            if (num[j] < num[i] && num[j] > mx) mx = num[j];
            if (mx <= num[j] && num[j] < num[i]) 
                dp[i] = min(dp[i], dp[j] + (LL)l * B + (LL)r * A);
            if (num[j] < num[i]) l++;
            else r++;
        }
    }
    printf("%lld\n", dp[n]);
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while (true) {
            String[] lines = br.readLine().split(" ");
            int h = Integer.parseInt(lines[0]);
            int w = Integer.parseInt(lines[1]);
            if (h == 0 && w == 0) {
                break;
            }
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    System.out.print("#");
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 31648
#include<stdio.h>
int main(){
int H,W,i,j;
 
while(1){
scanf("%d %d",&H,&W);
if((H==0)&&(W==0))break;
for(i=0;i<H;i++){
for(j=0;j<W;j++){
if(((i>0)&&(i<H-1))&&((j>0)&&(j<W-1))){
printf(".");
}else{
printf("#");
}
}
printf("\n");
}
printf("\n");
}
 
return 0;
}

Measured memory_bytes: 572
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

bool comp(const pair<PII, int> &l, const pair<PII, int> &r) {
    if (l.first.first != r.first.first) return l.first.first > r.first.first;
    if (l.first.second != r.first.second) return l.first.second < r.first.second;
    return l.second < r.second;
}

void solve(int T, int P, int R) {
    vector<pair<vector<int>, vector<int>>> team(T);//(??????,????????°)
    REP(i, T) team[i].first.resize(P, -1), team[i].second.resize(P, 0);
    vector<pair<PII, int>> ans(T); //((ac, pena), teamnum)
    while (R--) {
        int tid, pid, tim;
        string mes;
        cin >> tid >> pid >> tim >> mes;
        tid--; pid--;
        if (team[tid].second[pid] == -1) continue;
        if (mes == "CORRECT") {
            int wa = team[tid].second[pid];
            team[tid].second[pid] = -1;
            team[tid].first[pid] = wa * 1200 + tim;
        } else {
            team[tid].second[pid]++;
        }
    }
    REP(i, T) {
        int pena = 0, ac = 0;
        REP(j, P) {
            if (team[i].first[j] != -1) pena += team[i].first[j];
            if (team[i].second[j] == -1) ac++;
        }
        ans[i] = MP(MP(ac, pena), i);
    }
    sort(ALL(ans), comp);
    FORE(e, ans) {
        cout << e.second + 1 << " " << e.first.first << " " << e.first.second << endl;
    }
    return;
}

signed main(void) {
    int n, m, p, a, b, c, x, y, z, q;
    string s;
    bool f = false;
    while (cin >> n >> m >> p, n) {
        solve(n, m, p);
        //return 0;
    }
}

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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
using P = pair<ll,ll>;

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

const int INF = 1e9;

int main(){
    int x;
    cin >> x;
    int gr;
    gr = (2199-x)/200;
    cout << gr << endl;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back

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

  int arr[110];
  rep(i, N) {
    cin >> arr[i];
  }
  arr[N] = 0;

  int count = 0;
  int sum = 0;
  rep(i, N) {
    if(arr[i] == arr[i + 1]) {
      sum++;
    } else {
      count += (sum + 1) / 2;
      sum = 0;
    }
  }
  cout << count << endl;

}


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

namespace _171_d
{
    internal class Replacing
    {
        private static void Main(string[] args)
        {
            // N
            var n = int.Parse(Console.ReadLine() ?? throw new InvalidOperationException());

            // A
            var sb = new StringBuilder();
            while (true)
            {
                var ch = Convert.ToChar(Console.Read());
                sb.Append(ch);
                if (ch == '\n') break;
            }
            var array = sb.ToString().Split(" ").Select(int.Parse).ToArray();

            var a = new Dictionary<int, long>();
            long sum = 0;
            foreach (var data in array)
            {
                if (a.ContainsKey(data))
                {
                    a[data]++;
                }
                else
                {
                    a.Add(data, 1);
                }
                sum += data;
            }
            
            // Q
            var q = int.Parse(Console.ReadLine() ?? throw new InvalidOperationException());

            // B C
            for (var i = 0; i < q; i++)
            {
                var bcLine = Console.ReadLine()?.Split(" ").Select(int.Parse).ToArray();
                if (bcLine == null) return;
                var b = bcLine[0];
                var c = bcLine[1];

                if (b != c && a.ContainsKey(b))
                {
                    var value = a[b];
                    if (a.ContainsKey(c))
                    {
                        a[c] += value;
                    }
                    else
                    {
                        a.Add(c, value);
                    }

                    sum += (c - b) * value;
                    a.Remove(b);
                }

                Console.WriteLine(sum);
            }
        }
    }
}


Measured memory_bytes: 54784
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    ll a, b, c, n, k, x;
    string s, t;
    ll ans = 0;
    double dans = 0;
    string sans = "";



    cin  >> n;

    rep1(i, n){
        if(i < 10) ans++;
        else if(i < 100){}
        else if(i < 1000) ans++;
        else if(i < 10000){}
        else if(i < 100000) ans++;

    }

    std::cout << ans << endl; 
    // std::cout << sans << endl; 
    
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 998244353;
const ll INF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	int n; cin >> n;
	VI a(n), b(n); 
	REP(i,n) cin >> a[i] >> b[i];
	sort(ALL(a)); sort(ALL(b));
	if(n%2==1)
		cout << b[(n-1)/2]-a[(n-1)/2]+1 << endl;
	else{
		long double l=(long double)(a[n/2]+a[n/2-1])/2;
		long double r=(long double)(b[n/2]+b[n/2-1])/2;
		int ans=(r-l)/0.5+1;
		cout << ans << endl;
	}
	return 0;
}


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

int main()
{
	string s;

	getline(cin, s);

	for (int i = 0; i < s.size() - 4; i++) {
		if (s.substr(i, 5) == "apple")
			s.replace(i, 5, "peach");
		else if (s.substr(i, 5) == "peach")
			s.replace(i, 5, "apple");
	}

	cout << s << endl;

	return 0;
}


Measured memory_bytes: 3080
// nlather (Nishant Raj Lather)
// Chrollo_Lucifer

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1e9+7
#define boost ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define rep(i, x, n) for(ll i = x; i < n; i++)
#define rrep(i, x, n) for(ll i = x; i >= n; i--)
#define all(v) v.begin(),v.end()
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define e emplace
#define mp make_pair
double PI=3.14159265358979323846;
typedef long long int ll;
typedef long double ld;
typedef pair< ll, ll > pii;
typedef vector< ll > vi;
typedef vector< vi > vvi;

ll dp[100005][3];

int main()
{
	boost
	ll n, x;
	cin >> n;
	rep(i, 1, n + 1) rep(j, 0, 3) {
		cin >> x;
		dp[i][j] = x + max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3]);
	}
	cout << max(dp[n][0], max(dp[n][1], dp[n][2]));
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int n, u, v;
long long down[100007], up[100007], ans[100007], mod, suf[100007], pref[100007];
vector <int> edge[100007];

void dfsdown(int u, int par){
	down[u] = 1;
	for(int v : edge[u]){
		if(v == par) continue;
		dfsdown(v, u);
		down[u] = (down[u] * (down[v] + 1)) % mod;
	}
	ans[u] = down[u];
}

void dfsup(int u, int par){
	pref[0] = 1;
	for(int i = 0; i < (int)edge[u].size(); i++){
		int v = edge[u][i];
		pref[i + 1] = pref[i];
		if(v == par) continue;
		pref[i + 1] = (pref[i + 1] * (down[v] + 1)) % mod;
	}
	suf[(int)edge[u].size() + 1] = 1;
	for(int i = (int)edge[u].size() - 1; i >= 0; i--){
		int v = edge[u][i];
		suf[i + 1] = suf[i + 2];
		if(v == par) continue;
		suf[i + 1] = (suf[i + 1] * (down[v] + 1)) % mod;
	}
	for(int i = 0; i < (int)edge[u].size(); i++){
		int v = edge[u][i];
		if(v == par) continue;
		up[v] = pref[i] * suf[i + 2] % mod * (up[u] + 1) % mod;
		down[v] = down[v] * (up[v] + 1) % mod;
	}
	for(int v : edge[u]){
		if(v == par) continue;
		dfsup(v, u);
	}
}

signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n >> mod;
	for(int i = 1; i < n; i++){
		cin >> u >> v;
		edge[u].pb(v);
		edge[v].pb(u);
	}
	dfsdown(1, 1);
	up[1] = 0;
	dfsup(1, 1);
	for(int i = 1; i <= n; i++) cout << down[i] << "\n";
}


Measured memory_bytes: 15104
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
//#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define pii pair<int,int>
#define N 500500
#define dracarys ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);

int n;

void solve() {
    cin >> n;
    if (n % 1000 == 0) cout << 0 << "\n";
    else cout << (1000 - (n % 1000)) << "\n";
}

int main() {
//    freopen("sample.in", "r", stdin);
    dracarys
    int t = 1;
//    cin >> t;
    for (int i = 1; i <= t; ++i) {
//        cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 3648
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

//
#define int long long
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((a) >> (b)) & 1
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
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();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int N;
int a[202020];

signed main() {
  cin >> N;

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

  int cont = 0;
  int l = 0, r = 0; //[l,r)
  int sum = 0, xo = 0;

  for (l = 0; l < N; l++) {

    while (r < N && sum + a[r] == (xo ^ a[r])) {
      sum += a[r];
      xo ^= a[r];
      r++;
    }

    cont += r - l;
    if (l == r)
      r++;
    else {
      sum -= a[l];
      xo ^= a[l];
    }
  }

  cout << cont << endl;
  return 0;
}


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

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
const int INF = 100000;

vector<int> calc(const vector<string>& m, int st) {
  int h = m.size();
  int w = m[0].size();
  queue<pair<int,int>> q;
  vector<int> dist(h*w,INF);
  q.push(make_pair(st,0));
  while(!q.empty()) {
    int id, d;
    tie(id, d) = q.front(); q.pop();
    if (d >= dist[id]) continue;
    dist[id] = d;
    int di[] = {-w, -1, 1, w};
    REP(k,4) {
      int ni = id + di[k];
      int i = ni/w;
      int j = ni%w;
      if (m[i][j] == 'x') continue;
      if (dist[ni] > dist[id] + 1)
        q.push(make_pair(ni, dist[id]+1));
    }
  }
  return dist;
}

int main() {
  while(1){
    int w,h;
    cin>>w>>h;
    if(!w)break;
    vector<string> m(h+2, string(w+2, 'x'));
    REP(i,h) {
      string l;
      cin>>l;
      m[i+1] = "x" + l + "x";
    }
    h+=2;w+=2;
    vector<int> xl;
    int st = 0;
    REP(i,h)REP(j,w) {
      switch(m[i][j]) {
        case '*': xl.push_back(i*w+j); break;
        case 'o': st = i*w+j; break;
      }
    }
    vector<int> pl;;
    pl.push_back(st);
    pl.insert(end(pl),begin(xl),end(xl));
    int n = pl.size();
    vector<vector<int>> d(n, vector<int>(n, INF));
    REP(i,n) {
      int id = pl[i];
      auto dl = calc(m, id);
      REP(j,n)
        d[i][j] = dl[pl[j]];
    }
    vector<vector<int>> dp(1<<n, vector<int>(n, INF));
    dp[1][0] = 0;
    REP(i,1<<n) {
      REP(j,n) {
        //if (((i>>j)&1) == 0) continue;
        REP(k,n) {
          //if ((i>>k)&1) continue;
          dp[i|1<<k][k] = min(dp[i|1<<k][k], dp[i][j] + d[j][k]);
        }
      }
    }
    int mind = *min_element(begin(dp[(1<<n)-1]),end(dp[(1<<n)-1]));
    if (mind < INF)
      cout << mind << endl;
    else
      cout << "-1" << endl;
  }
  return 0;
}

Measured memory_bytes: 1316
r, g, b, n = map(int, input().split())

import math
ans = 0
for i in range(math.ceil(n / r)+1):
    for j in range(math.ceil(n / g)+1):
        if n - r * i - g * j < 0:
            break
        if  (n - r * i - g * j) % b == 0:
            ans += 1
print(ans)

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

int main(){
    string s;
    cin >> s;
    int len = (int)s.length();
    int count = 0;

    for(int i = 0; i < len/2; i ++){
        if(s[i] != s[len - i - 1]){
            count++;
        }
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3620
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	p := make([]int, n)
	for i := range p {
		fmt.Scan(&p[i])
	}

	sort.Ints(p)

	var sum int
	for i := 0; i < k; i++ {
		sum += p[i]
	}

	fmt.Println(sum)
}


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

vector<int> next(vector<int> v) {
    int n = v.size();
    vector<int> nw(n);

    for (int i=0; i<n; i++) {
        int d = v[i];
        int l = i-d, r = i+d;

        if (l<0)    nw[0]++;
        else        nw[l]++;
        if (r+1<n)  nw[r+1]--;
    }

    for (int i=1; i<n; i++) nw[i] += nw[i-1];
    return nw;
}

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

    int n, k;
    cin>>n>>k;
    vector<int> v(n);
    for (int i=0; i<n; i++)     cin>>v[i];


    for (int i=0; i<k; i++) {
        auto nw = next(v);
        if (v == nw)    break;
        v = nw;
    }

    for (int x: v)  cout<<x<<" ";

}


Measured memory_bytes: 5588
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln =  '\n';

const int mx=100010;
const ll mod=1e9+7;

ll powll(ll n,ll k){ ll ret=1; while(k){ if(k&1)ret=ret*n; n=n*n; k>>=1; } return ret; }

int main(){
  int a,b;
  cin >> a >> b;
  int cnt = 0;
  int tmp = b;
  while(tmp>0){
    tmp/=10;
    cnt++;
  }
  int c = a*powll(10,cnt) + b;
  rep(i,1000){
    if(c==i*i){
      cout << "Yes" << endl; return 0;
    }
  }
  cout << "No" << endl;
//  cout << ans << ln;
  return 0;
}

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

#define endl "\n"
#define INF (int) 9e18
#define HELL (int) (1e9 + 7)
#define int long long
#define double long double
#define uint unsigned long long
#define deb(x) cerr << #x << " => " << x << "\n"
#define deba(x) cerr << #x << "\n"; for (auto a : x) cerr << a << " "; cerr << "\n";
#define debm(x) cerr << #x << "\n"; for (auto a : x){for(auto b : a) cerr << b << " "; cerr << "\n";}
#define getMat(x, n, m, val) vector<vector<int>> x(n, vector<int> (m, val))
#define fastio ios_base :: sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pout cout << fixed << setprecision(10)

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

int32_t main() { fastio;
    
    int n, x, y;
    cin >> n >> x >> y;

    vector<int> adj[n + 1];
    for (int i = 1; i < n; i++) {
    	adj[i].push_back(i + 1);
    	adj[i + 1].push_back(i);
    }
    adj[x].push_back(y);
    adj[y].push_back(x);

    vector<int> res(n);
    for (int i = 1; i <= n; i++) {
    	vector<bool> marked(n + 1);
    	queue<pair<int, int>> Q;
    	Q.push({ i, 0 });
    	marked[i] = true;
    	while (!Q.empty()) {
    		int x = Q.front().first; y = Q.front().second;
    		Q.pop();
    		res[y]++;
    		for (auto u : adj[x]) {
    			if (!marked[u]) {
    				marked[u] = true;
    				Q.push({ u, y + 1 });
    			}
    		}
    	}
    }
    for (int i = 1; i < n; i++) {
    	cout << res[i] / 2 << endl;
    }

    return 0;
}

Measured memory_bytes: 384
fn main() {
    let s = input();
    println!("{}", solve(s));
}

fn input() -> Vec<u8> {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.pop();
    buf.into_bytes()
}

fn solve(s: Vec<u8>) -> String {
    let n = s.len();
    if !is_plaindrome(&s) { return String::from("No"); }
    if !is_plaindrome(&s[..(n-1)/2].to_vec()) { return String::from("No"); }
    if !is_plaindrome(&s[((n+3)/2)-1..].to_vec()) { return String::from("No"); }
    String::from("Yes")
}

fn is_plaindrome(s: &Vec<u8>) -> bool {
    let l = s.len();
    let mut first: Vec<u8> = s.to_vec();
    let latter: Vec<u8> = first.split_off(l/2);
    let mut latter_iter = latter.iter();
    if s.len() % 2 != 0 {
        latter_iter.next().unwrap();
    }
    first.reverse();
    for (a, b) in first.iter().zip(latter_iter) {
        if a != b {
            return false;
        }
    }
    true
}

Measured memory_bytes: 4352
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用

using namespace std;
std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

int x[100001], y[100001];

signed main() {
	string s;
	cin >> s;
	int wnum = 0, bnum = 0;
	int arr[2000000];
	int count = 0;
	int ans = 0;
	for (int i = s.length() - 1; i >= 0; i--) {
		if (s[i] == 'W') {
			count++;
		}
		else {
			ans += count;
		}

	}
	cout << ans << "\n";


	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>

using namespace std;

int main(void)
{
int n,k,s,b;
while(1)
{
cin >> n >>k;
if(n==0 && k==0)
break;
int m[100001]={0};
int a[100001];

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

m[0]=0;
for(int i=0;i<n;i++)
m[i+1]=m[i]+a[i];

s=0;

for(int i=1;i+k<=n;i++)
{
b=m[i+k]-m[i];
if(s<b)
s=b;
}
cout << s << endl;
}
return 0;
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;

void solve() {
  int N;
  cin >> N;
  cout << (2 + N - 1) / 2 << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // cout << fixed << setprecision(12);

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vd v(n);
  rep(i, n) cin >> v[i];
  sort(all(v));
  double ave = v[0];
  rep2(i, 1, n) ave = (ave + v[i]) / 2;
  printf("%.10f\n", ave);
}

Measured memory_bytes: 3704
n, m = gets.split(" ").map(&:to_i)

a = Array.new(n+2, 0)
m.times do |i|
  l, r = gets.split(" ").map(&:to_i)
  a[l] += 1
  a[r+1] -= 1
end

sum = 0
ans = 0
n.times do |i|
  sum += a[i+1]
  ans += 1 if sum == m
end

puts ans


Measured memory_bytes: 2556