akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int find_parent(int a, vector <int> &parent)
{
  	if (parent[a]==a) return a;
  	return parent[a]=find_parent(parent[a], parent);
}

void Union(int a, int b, vector <int> &parent, vector <int> &size)
{
  	int p1 = find_parent(a,parent);
  	int p2 = find_parent(b,parent);
  	if (size[p2] > size[p1])
    {
      	size[p2]+=size[p1];
      	parent[p1]=p2;
    }
  	else
    {
      	size[p1]+=size[p2];
      	parent[p2]=p1;
    }
}



int main()
{
	int N,Q;
  	cin >> N >> Q;
  	vector <int> parent(N), size(N,1);
  	for (int i=0; i<N; ++i) parent[i]=i;
  	while (Q--)
    {
      	int type, node1, node2;
      	cin >> type >> node1 >> node2;
      	if (type==0) Union(node1, node2, parent,size);
      	else cout << (find_parent(node1, parent) == find_parent(node2,parent)) << "\n";
    }
}

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

int main(){
	string str,op;
	string tmp;
	string p;
	int a , b; 
	int q;
	int i , j;
	cin>>str;
	cin>>q;
	for(i=0; i<q ; i++){
		cin>>op;
		cin>> a >> b;
		if(op=="print"){
			cout << str.substr(a,b-a+1) << endl;
		} else if (op=="reverse"){
			tmp=str.substr(a,b-a+1);
			for(j=0;j<tmp.length();j++){
				str[a+j]=tmp[tmp.length()-1-j];
			}
		} else if (op=="replace"){
			cin>>p;
			for(j=a;j<b+1;j++){
				str[j]=p[j-a]; // 1 4 abcd
				//str=str.replace(a , b-a+1 , p);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
	ll x;
	cin >> x;
	for(ll i = 0;i < 1000;i++){
		for(ll j = -1000;j < 1000;j++){
			if(pow(i,5) - pow(j,5) == x){
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 4024
N,M,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
SA=[0 for i in range(N+1)]
SB=[0 for i in range(M+1)]
for i in range(N):
    SA[i+1]=A[i]+SA[i]
for i in range(M):
    SB[i+1]=B[i]+SB[i]
ans=0
for i in range(N+1):
    if SA[i]>K:
        break
    low=0
    high=M+1
    while(high-low>1):
        mid=(low+high)//2
        #SA[i]+SB[low]<=K<SA[i]+SB[high]
        if SA[i]+SB[mid]<=K:
            low=mid
        else:
            high=mid
    ans=max(ans,i+low)
print(ans)

Measured memory_bytes: 126436
l = list(map(int, input().split()))

hp = l[0]
attack = l[1]
hp2= l[2]
attack2 = l[3]

while 1 == 1:
    hp2 -= attack
    if hp2 <= 0:
        print("Yes")
        break
    hp -= attack2
    if hp <= 0:
        print("No")
        break



Measured memory_bytes: 9132
#include <bits/stdc++.h>
using namespace std;
using ll = long long;using vll = vector<ll>;
int main(){
  ll n;
  cin >> n;
  vll a(n+1), b(n);
  for (ll i = 0; i <= n; i++) cin >> a[i];
  for (ll i = 0; i < n; i++) cin >> b[i];
  
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    if (a[i] >= b[i]) {
      ans += b[i];
    }
    else {
      ans += a[i];
      b[i] -= a[i];
      if (a[i+1] >= b[i]) {
        ans += b[i];
        a[i+1] -= b[i];
      }
      else {
        ans += a[i+1];
        a[i+1] = 0;
      }
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1792
// ~/Remember,remember the 6th of March
#include <functional>
#include <iomanip>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include<complex>
#include <unordered_map>
#include<unordered_set>
#include <numeric>
#include <string>
#include<iostream>
#include <fstream>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include<cmath>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double  EPS = 1e-9;
const ll MOD = 100000000;
const int N = 2e6 + 10;
void fast()
{
	std::ios_base::sync_with_stdio(0);
}
int main()
{
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt","w",stdout);
#endif*/
	ll x, y, z, k;
	scanf("%lld%lld%lld%lld", &x, &y, &z, &k);
	vector<ll>arrx(x);
	for (ll &i : arrx)scanf("%lld", &i);
	vector<ll>arry(y);
	for (ll &i : arry)scanf("%lld", &i);
	vector<ll>arrz(z);
	for (ll &i : arrz)scanf("%lld", &i);
	sort(arrx.rbegin(), arrx.rend());
	sort(arry.rbegin(), arry.rend());
	sort(arrz.rbegin(), arrz.rend());
	vector<ll>ans;
	for (int i = 0; i < x; i++)
		for (int j = 0; j < y; j++)
			for (int kk = 0; kk < z; kk++)
				if((i+1)*(j+1)*(kk+1)<=k)
					ans.push_back(arrx[i] + arry[j] + arrz[kk]);
				else break;
	sort(ans.rbegin(), ans.rend());
	for (int i = 0; i < k; i++)
		printf("%lld\n", ans[i]);
	return 0;
}

Measured memory_bytes: 1404
#include<cstdio>
#include<algorithm>
using namespace std;
int n,cnt,mp[300005],ans[300005],del[300005],siz[300005];
int main()
{
	scanf("%d",&n);
	for(int i=1,a;i<=n;i++)
	{
		scanf("%d",&a);
		if(!mp[a])mp[a]=++cnt;
		siz[mp[a]]++;
	}
	sort(siz+1,siz+1+cnt);
	for(int i=1;i<=cnt;i++)del[1]++,del[siz[i]+1]--;
	for(int i=1,nw=0;i<=n;i++)nw+=del[i],ans[i]=ans[i-1]+nw;
	for(int k=1,te=n;k<=n;k++)
	{
		while(ans[te]<te*k)te--;
		printf("%d\n",te);
	}
}

Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 998244353
#define N 100005  //check the limits, man
int main()
{
    char ch;
    cin >> ch;
    if(ch=='A')
        cout << "T" << endl;
    if(ch=='T')
        cout << "A" << endl;
    if(ch=='C')
        cout << "G" << endl;
    if(ch=='G')
        cout << "C" << endl;

}





Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int H, W;
    while (1) {
        cin >> H >> W;
        if (H==0 && W==0) break;
        for (int j=0; j < H; j++) {
            for (int i=0; i < W; i++) {
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3080
def submit():
    n = int(input())
    a = [int(e) for e in input().split()]

    l, r = 0, 0
    ans = 0
    curr_xor = 0
    curr_sum = 0
    while r < n:
        curr_xor = curr_xor ^ a[r]
        curr_sum = curr_sum + a[r]

        # 今のrで実現する最左のlを求める
        while curr_xor != curr_sum:
            curr_xor = curr_xor ^ a[l]
            curr_sum = curr_sum - a[l]
            l += 1
            # 最悪でもr == lで止まる
        ans += r - l + 1
        # rを動かす
        r += 1

    print(ans)


submit()


Measured memory_bytes: 23560
#include <bits/stdc++.h>
using namespace std;
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int d[n];
  for(int i=0;i<n;i++) cin >> d[i];
  sort(d,d+n);
  int count = 1;
  for(int i=0;i<n-1;i++){
    if(d[i] < d[i+1]) count++;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
while True:
    n = int(input())
    if n == 0:
        break
    a = [0] * 10
    for i in range(n):
        c = int(input())
        a[c] += 1
    for c in a:
        if c == 0:
            print('-')
        else:
            print('*'*c)


Measured memory_bytes: 5628
// Author:: MUKUL KUMAR RAI
// Institution:: Jalpaiguri Government Engineering College
//If you are not doing well now just stick to it and learn new things one day you will be...
//Compete with yourself 
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld long double
#define fi first
#define se second
#define pb push_back
///*template{{{
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
#define trav(a,x) for(auto &a:x)
#define fr(i,a,b)  for(ll i=a;i<=b;i++)
#define fr1(i,a)   for(ll i=0;i<a;i++)
#define frr(i,a,b) for(ll i=b;i>=a;i--)
#define frr1(i,a)   for(ll i=a-1;i>=0;i--)
#define sorta(a,n) sort(a,a+n)
#define sortd(a,n) sort(a,a+n,greater<ll>())
#define sortva(a) sort(a.begin(),a.end())
#define sortvd(a) sort(a.begin(),a.end(),greater<ll>())
#define tc(t) while(t--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
using vi= vector<ll>;
using vvi= vector<vi>;
using vb =vector<bool>;
using vc =vector<char>;
using vs =vector<string>;
using vld =vector<ld>;
using pii =pair<ll,ll>;
using psi =pair<string,ll>;
using pci =pair<char,ll>;
using vpii =vector<pii>;
//}}}template*/
ll mod=1e9+7;
ll const maxn=1e6+5;
ll const inf=1e18;
bool ss(const pair<ll,ll> &a, const pair<ll,ll> &b) { 
    return a.first*b.second+a.second<b.first*a.second+b.second;
}
ll add(ll a,ll b){
    return ((a%mod)+(b%mod))%mod;
}
ll mul(ll a,ll b){
    return ((a%mod)*(b%mod))%mod;
}
ll powm(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
ll modinverse(ll a, ll m){
    return powm(a,m-2,m);
}
bool prime(ll x){
    if(x<=1)return false;
    for(int i=2;i<=sqrt(x);i++)if(x%i==0)return false;
    return true;
}
ll divisor(ll x){
    ll cnt=0;
    for(int i=1;i<=sqrt(x);i++){
        if(x%i==0){
            if(i!=x/i)cnt+=2;
            else cnt+=1;
        }
    }
    return cnt;
}
vector<ll> sieve(ll n) {     
    bool prim[n+1]; 
    memset(prim, true, sizeof(prim)); 
  
    for (ll p=2; p*p<=n; p++) {
        if (prim[p] == true) { 
            for (int i=p*p; i<=n; i += p) 
                prim[i] = false; 
        } 
    }
    vector<ll>v;
    for(int i=2;i<=n;i++)if(prim[i])v.push_back(i);
    return v; 
}
bool check(string s){
    ll l=0,r=sz(s)-1;
    while(l<=r){
        if(s[l]!=s[r])return false;
        l++;
        r--;
    }
    return true;
}
int main(){
  
    fio;
    ll n;
    cin>>n;
    ll A[n];
    fr1(i,n)cin>>A[i];
    ll ans=0;
    fr1(i,n){
        fr(j,i+1,n-1)ans+=(A[i]*A[j]);
    }
    cout<<ans;
    return 0;
}

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

signed main(){
	int a, b;
	cin >> a >> b;
	int ans = (b - 1) / (a - 1);
	if((b - 1) % (a - 1) != 0) ans++;
	cout << ans << endl;
}


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

void Insert();
void Delete();
void DeleteFirst();
void DeleteLast();
void Output();
int Search(int a);

typedef struct{
  int back;
  int next;
  int value;
}LIST;

LIST data[3000005];
int p = 2;

int main(){
  int n;
  string query;
  data[0] = ((LIST){0,1,-1});
  data[1] = ((LIST){1,0,-1});
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> query;
    if(query == "insert")Insert();
    else if(query == "delete")Delete();
    else if(query == "deleteFirst")DeleteFirst();
    else if(query == "deleteLast")DeleteLast();
  }
  Output();
  return 0;
}

void Insert(){
  int v;
  cin >> v;
  data[p].value = v;
  data[p].back = 0;
  data[p].next = data[0].next;
  data[0].next = p;
  data[data[p].next].back = p;
  p++;
  return;
}

void Delete(){
  int a,v;
  cin >> a;
  v = Search(a);
  if(!~v)return;
  
  data[data[v].back].next = data[v].next;
  data[data[v].next].back = data[v].back;
  return;
}

void DeleteFirst(){
  if(data[0].next == 1)return;
  data[0].next = data[data[0].next].next;
  data[data[0].next].back = 0;
  return;
}

void DeleteLast(){
  if(data[1].back == 0)return;
  data[1].back = data[data[1].back].back;
  data[data[1].back].next = 1;
  return;
}

void Output(){
  int v = data[0].next;
  while(1){
    cout << data[v].value;
    if(data[v].next == 1)break;
    cout << " ";
    v = data[v].next;
  }
  cout << endl;
  return;
}

int Search(int a){
  int v = data[0].next;
  while(1){
    if(data[v].value == a)return v;
    if(data[v].next == 1)break;
    v = data[v].next;
  }
  return -1;
}

Measured memory_bytes: 15984
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
ll modexpo(ll a,ll b)
{
     ll ans=1LL;
     while(b>0)
     {
          if(b&1)ans=(ans*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return ans;
}
 
 
 
 
 
 
 







ll res[2005];
ll f(ll l,ll r){
     ll w=0;
     for(int i=l;i<=r;i++){w+=res[i];
     }
     return w;
}
int main()
{
     int n;
     cin>>n;
     ll ct[105]={0};
     for(int i=1;i<=n;i++){
          int t=i;
          for(int j=2;j<=sqrt(t);j++){
               if(t%j==0){
                    while(t%j==0){
                         t/=j;ct[j]++;
                    }
               }
          }
          if(t>1)ct[t]++;
     }
     for(int i=2;i<=100;i++)++res[ct[i]+1];
     ll ans=1LL*f(75,2000);
     ans+=f(25,2000)*f(3,24);
     ans+=f(25,2000)*(f(25,2000)-1);
     ans+=f(15,2000)*(f(5,14));
     ans+=f(15,2000)*(f(15,2000)-1);
     ans+=f(5,2000)*(f(5,2000)-1)/2*(f(3,4));
     ans+=f(5,2000)*(f(5,2000)-1)/2*(f(5,2000)-2);
     cout<<ans;

}






















Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
long long sum, n, a[55];
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
for (int i=0; i<n; i++) cin >> a[i];
for (int i=0; i<n; i++){
	for (int j=i+1; j<n; j++){
		sum+=a[i]*a[j];
	}
}
cout << sum;
return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define in(x, l, r) (ll)(l) <= (x) && (x) < (ll)(r)

using mint = modint998244353;
mint ten[200'005], one[200'005];

struct S {
    mint a;
    int l;
};

struct F {
    int c;
};

S op(S l, S r) { return S{l.a * ten[r.l] + r.a, l.l + r.l}; }

S e() { return S{0,0}; }

S mapping(F l, S r) {
    if (l.c == 0) return r;
    else return S{one[r.l] * l.c, r.l};
}

F composition(F l, F r) { return ((l.c == 0) ? r : l); }

F id() { return F{0}; }

int main() {
    int N, Q;
    cin >> N >> Q;
    ten[0] = 1; one[0] = 0;
    rep(i,1,N+1) {
        ten[i] = ten[i-1] * 10;
        one[i] = one[i-1] * 10 + 1;
    }

    lazy_segtree<S, op, e, F, mapping, composition, id> seg(vector<S>(N,S{1, 1}));
    rep(i,0,Q) {
        int L, R, D;
        cin >> L >> R >> D;
        seg.apply(L-1, R, F{D});
        mint ans = seg.all_prod().a;
        cout << ans.val() << endl;
    }
}

Measured memory_bytes: 11468
#include<iostream>
#include<math.h>
using namespace std;
static const long long int MaxValue = pow(10, 18);

int main()
{
    long long int A, B, C, K;
    cin >> A >> B >> C >> K;

    long long int ans = 0;
    if (K % 2) ans = B - A;
    else ans = A - B;

    if (ans < - MaxValue || ans > MaxValue)
    {
        cout << "Unfair" << endl;
        return 0;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s; cin >> s;
	int b = 0, w = 0;
	for (int i = 0; i < s.size(); i++)
	{
		if(i % 2 == 0) {
			if(s[i] == '0') w++;
			else b++;
		}
		else {
			if(s[i] == '0') b++;
			else w++;
		}
	}
	cout << min(b, w) << endl;
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;
const ll INF = 100000000000000000;

int main()
{
    ll N, W;
    cin >> N >> W;

    vector<ll> weights(N), values(N);
    rep(i, 0, N) cin >> weights[i] >> values[i];

    vector<ll> dp(110000, INF);
    dp[0] = 0;
    rep(i, 0, N)
    {
        rrep(value, 110000+1, 0)
        {
            int next_value = value + values[i];
            if (next_value > 100000) continue;
            dp[next_value] = min(dp[next_value], dp[value]+weights[i]);
        }
    }

    ll res;
    rrep(value, 100000+1, 0)
    if (dp[value] <= W)
    {
        res = value;
        break;
    }
    cout << res << endl;
    return 0;
}

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

int main() {
	int n, m;
	long long sum = 0;
	cin >> n >> m;
	vector<pair<int, int>> dr(n);

	rep(i, n) {
		int ai, bi;
		cin >> ai >> bi;
		dr[i] = make_pair(ai, bi);
	}
	sort(dr.begin(), dr.end());
	int j = 0;
	rep(i, m) {
		sum += dr[j].first;
		dr[j].second--;
		if (dr[j].second == 0) {
			j++;
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/python3
# -*- coding:utf-8 -*-

from math import floor
import numpy

def main():
  h, n = map(int, input().strip().split())
  As, Bs = numpy.array([list(map(int, input().strip().split())) for _ in range(n)]).T

  dp = numpy.zeros(h+1)
  for i in range(1, len(dp)):
    dp[i] = numpy.min(dp[numpy.maximum(i - As, 0)] +  Bs)
  print(int(dp[-1]))



if __name__=='__main__':
  main()

Measured memory_bytes: 21900
#include<stdio.h>
int main()
{
	int N,a,T;
	scanf("%d",&N);
	scanf("%d",&a);
	T = N /500;
	
	int sum=0;
	for(int i=0;i<=a;i++)
	{
		sum = 500*T + i;
		if(sum == N)
		{
			printf("Yes\n");
			return 0;
	     }
	 }
	 
	 printf("No\n");
return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dp[100005][15];
signed main() {
    string S;
    cin >> S;
    dp[S.size()][0] = 1;
    int pow = 1;
    for(int i = S.size()-1; i >= 0; i--) {
        if(S[i] != '?') {
            for(int j = 0; j <= 12; j++) {
                if(dp[i+1][j]) {
                    dp[i][(j+(S[i]-'0')*pow)%13]+=dp[i+1][j];
                    dp[i][(j+(S[i]-'0')*pow)%13]%=INF;
                }
            }
        }
        else {
            for(int j = 0; j <= 12; j++) {
                if(dp[i+1][j]) {
                    for(int k = 0; k <= 9; k++) {
                        dp[i][(j+k*pow)%13]+=dp[i+1][j];
                        dp[i][(j+k*pow)%13]%=INF;
                    }
                }
            }
        }
        pow *= 10;
        pow %= 13;
    }
    cout << dp[0][5] << endl;
}

Measured memory_bytes: 15480
//created by pyoxiao on 2020/04/12
#include<bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define CL(a, b) memset(a, b, sizeof(a))
using namespace std;
const int mod = 1e9 + 7;
LL fpow(LL a, LL b, LL p = mod){LL ans = 1; a %= p; while(b) {if(b & 1) ans = ans * a % p; b >>= 1; a = a * a % p;} return ans;}
LL gcd(LL a, LL b){return b == 0 ? a : gcd(b, a % b);}
int n;
void solve() {
    scanf("%d", &n);
    LL cur = 0;
    for(int i = 1; i <= n; i ++) {
        if(i % 3 != 0 && i % 5 != 0) {
            cur += i;
        }
    }
    printf("%lld\n", cur);
}
int main() {
    int T = 1;
    // scanf("%d", &T);
    while(T --) 
        solve();
    return 0;
}

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

using namespace std;


#define PI 3.14159265
#define int long long



main(){

	int n; cin >> n;


	int ans = 0;

	for(int i = 1; i <= n; i++){
		if(to_string(i).size() % 2 == 1){
			ans++;
		}
	}
	
	cout << ans << endl;

	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int data[10]={0};
	for (int A=0;A<10;A++){
		cin>>data[A];
	}
	sort(data,data+10);
	cout<<data[9]<<endl<<data[8]<<endl<<data[7]<<endl;
	return 0;
}

Measured memory_bytes: 3132
/** Which of the favors of your Lord will you deny ? **/

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

#define LL long long
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define F first
#define S second

#define ALL(x)      (x).begin(), (x).end()
#define READ        freopen("alu.txt", "r", stdin)
#define WRITE       freopen("vorta.txt", "w", stdout)

#ifndef ONLINE_JUDGE
#define DBG(x)      cout << __LINE__ << " says: " << #x << " = " << (x) << endl
#else
#define DBG(x)
#define endl "\n"
#endif

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);

inline void optimizeIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const int nmax = 2e5+7;

 int solve(vector<int>& x, vector<int>& y) {
        int res = 0, n = x.size(), smallest, cur;
        for (int p : {1, -1}) {
            for (int q : {1, -1}) {
                smallest = p * x[0] + q * y[0] + 0;
                for (int i = 1; i < n; ++i) {
                    cur = p * x[i] + q * y[i];
                    res = max(res, cur - smallest);
                    smallest = min(smallest, cur);
                }
            }
        }
        return res;
    }

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

    vector<int>x(n),y(n);

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

    int ans = solve(x,y);
    cout<<ans<<endl;
    DBG(ans);
}

int32_t main()
{
    optimizeIO();

    int tc = 1;

    while(tc--)
    {
        solveTC();
    }

    return 0;
}

/**

**/

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}


Measured memory_bytes: 4776
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = {False: 'No', True: 'Yes'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
# sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


show_flg = True
show_flg = False


def f(b, c):
    return 9000 * c + 5000 * b


def main():
    N, Y = MI()

    for b in range(0, N+1):
        for c in range(0, N+1):
            ret = f(b, c)
            if ret == 10000 * N - Y and b + c <= N:
                print(N - b - c, b, c)
                return

    print(-1, -1, -1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39276
#include <bits/stdc++.h>
using namespace std;
int n,m,dis[105][105],vst[105][105];
char a[105][105];
struct Thing {
	int x,y,dis;
	bool operator <(const Thing yy) const {
		return dis>yy.dis;
	}
};
int main() {
//	freopen("1.in","r",stdin);
	memset(dis,0x3f,sizeof(dis));
	cin>>n>>m;
	for(int i=1; i<=n; i++)scanf("%s",a[i]+1);
	priority_queue<Thing> q;
	dis[1][1]=(a[1][1]=='#');
	q.push({1,1,dis[1][1]});
	while(!q.empty()) {
		Thing now=q.top();
		q.pop();
		//if(now.x==1&&now.y==2)return cout<<"PP",0;
		//cout<<now.x<<' '<<now.y<<' '<<dis[now.x][now.y]<<endl;
		if(vst[now.x][now.y])continue;
		vst[now.x][now.y]=1;
		//cout<<now.x<<' '<<now.y<<' '<<dis[now.x][now.y]<<endl;
		if(now.x==n&&now.y==m) {
			return cout<<dis[n][m],0;
		}
		queue<Thing> q2;
		q2.push(now);
		int inq2[105][105]={0};
		while(!q2.empty()) {
			Thing x=q2.front();
			q2.pop();
			if(x.x<n) {
				if(a[x.x+1][x.y]==a[now.x][now.y]) {
					q.push({x.x+1,x.y,dis[now.x][now.y]});
					if(!inq2[x.x+1][x.y])q2.push({x.x+1,x.y,dis[now.x][now.y]}),inq2[x.x+1][x.y]=1;
					dis[x.x+1][x.y]=min(dis[x.x+1][x.y],dis[now.x][now.y]);
				} else {
					q.push({x.x+1,x.y,dis[now.x][now.y]+(a[now.x][now.y]=='.')});
					dis[x.x+1][x.y]=min(dis[x.x+1][x.y],dis[now.x][now.y]+(a[now.x][now.y]=='.'));
				}
			}
			if(x.y<m) {
				if(a[x.x][x.y+1]==a[now.x][now.y]) {
					q.push({x.x,x.y+1,dis[now.x][now.y]});
					if(!inq2[x.x][x.y+1])q2.push({x.x,x.y+1,dis[now.x][now.y]}),inq2[x.x][x.y+1]=1;
					dis[x.x][x.y+1]=min(dis[x.x][x.y+1],dis[now.x][now.y]); 
					//if(now.x==1&&now.y==1)cout<<x.x<<' '<<x.y+1<<' '<<"F:"<<dis[x.x][x.y+1]<<q.size()<<endl;
					//system("pause");
				} else if(x.y<m) {
					q.push({x.x,x.y+1,dis[now.x][now.y]+(a[now.x][now.y]=='.')});
					dis[x.x][x.y+1]=min(dis[x.x][x.y+1],dis[now.x][now.y]+(a[now.x][now.y]=='.'));
				}
			}
		}
	}
	return 0;
}
/*
15 15
....#.#.....#..
##.#....#...###
.#.....##..#.#.
###..#..#......
###..##..##..#.
#..#.#.#.###...
.......####.#.#
##..#.#.###.##.
##.#.##....#.##
..##.#.#.#.#..#
....#.....#....
...#.#..##.###.
.######.###....
.##....####.###
..######..#####
*/ 

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

using namespace std;

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

int main() {
  string s;
  cin >> s;
  int n = 0;
  int max_n = 0;

  rep(i, s.length()) {
    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
      n++;
    } else {
      max_n = max(n, max_n);
      n = 0;
    }
  }
  max_n = max(n, max_n);
  cout << max_n << endl;
}


Measured memory_bytes: 256
while True:
    n,w,h = map(int,input().split())
    if w == 0:
        break
    ls = [[w,h]]
    for i in range(n):
        p,s = map(int,input().split())
        p -= 1
        pw,ph = ls[p]
        if s%(pw+ph) < pw:
            s %= pw+ph
            ls.extend([[min(s,pw-s),ph],[max(s,pw-s),ph]])
        else:
            s = (s-pw)%(ph+pw)
            ls.extend([[pw,min(s,ph-s)],[pw,max(s,ph-s)]])
        ls.pop(p)
    ans = [hi*wi for wi,hi in ls]
    ans.sort()
    print(' '.join(map(str,ans)))



Measured memory_bytes: 5624
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
using namespace std;

int main(){
    //drink M, shops N
    int N, M;
    cin >> N >> M;
    //N*1の配列を2つ作成
    //price A, number B
    vector<int> A(N, 0);
    vector<int> B(N, 0);
    //配列に格納
    for(int i=0; i<N; i++){
        cin >> A[i];
        cin >> B[i];
    }

    /*
    for(int x:A){
        cout << x << endl;
    }
    */
    //価格が安い順に並び替え
    //std::vector<int> array = {3, 2, 5, 7, 1};

    // 配列のインデックス indiecs = {0, 1, 2, 3, 4} を作成する。
    //std::vector<size_t> indices(array.size());
    //std::iota(indices.begin(), indices.end(), 0);

    //AとBでペアを作り，ソート
    vector<pair<int,int>> AB(N);
    for(int i=0; i<N; i++){
        AB[i] = make_pair(A[i], B[i]);
    }
    sort(AB.begin(), AB.end());

    long long price = 0;
    for(int i=0; i<N; i++){
        int buy = min(M, AB[i].second);
        price += (long long)buy*AB[i].first;
        M -= buy;
    }
    cout << price << endl;
}

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

template <typename T, typename _ = void>
struct is_container : std::false_type {};
template <typename T>
struct is_container<T, std::void_t<decltype(std::declval<T>().begin()),
                                   decltype(std::declval<T>().end())>>
    : std::true_type {};
template <typename T, typename _ = void>
struct is_pair : std::false_type {};
template <typename T>
struct is_pair<T, std::void_t<decltype(std::declval<T>().first),
                              decltype(std::declval<T>().second)>>
    : std::true_type {};
template <typename T>
void debug(const T& v) {
  if constexpr (is_pair<T>::value) {
    std::cerr << "{";
    debug(v.first);
    std::cerr << ", ";
    debug(v.second);
    std::cerr << "}";
  } else if constexpr (is_container<T>::value) {
    std::cerr << "{";
    for (auto it = v.begin(); it != v.end(); ++it) {
      if (it != v.begin()) std::cerr << ", ";
      debug(*it);
    }
    std::cerr << "}";
  } else {
    std::cerr << v;
  }
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  debug(value);
  std::cerr << ", ";
  debug(args...);
}
#if DEBUG
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  if constexpr (std::is_same<T, bool>::value) {
    std::cout << (value ? "Yes" : "No");
  } else {
    std::cout << value;
  }
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  write_to_cout(value);
  std::cout << ' ';
  write_to_cout(args...);
}
#define wt(...)                 \
  do {                          \
    write_to_cout(__VA_ARGS__); \
    cout << '\n';               \
  } while (0)

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& v) {
  for (T& vi : v) is >> vi;
  return is;
}

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

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

#include <boost/hana/functional/fix.hpp>
auto Fix = boost::hana::fix;

using ll = long long;

template <typename T>
using low_priority_queue =
    std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
  V<string> c(3);
  cin >> c;
  rep(i, 3) cout << c[i][i];
  cout << endl;
}


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

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

using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int alpha[3];
    alpha[0]=a;
    alpha[1]=b;
    alpha[2]=c;
    sort(alpha,alpha+3);
    if(alpha[2]==alpha[0]+alpha[1]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }    
}

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

int main() {
	int a[100], n;
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
    
    for (int i = n-1; i >= 0; i--) {
    	cout << a[i];
    	if (i != 0) {
    		cout << " ";
    	} else {
		cout << endl;
    	}
    }
	return 0;
}


Measured memory_bytes: 3116
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
//#include "job.h"
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int a;
string s;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>a>>s;
	if(a>=3200)rc(s);
	cout<<"red"<<endl;
    return 0;
}

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

int main()
{
    int n, m, c;
    cin >> n >> m >> c;
    int a[n][m], b[m];
    int sum = c;
    int ans = 0;
    for(int i=0;i<m;i++){
        cin >> b[i];
    }
    for(int j=0;j<n;j++){
        for(int k=0;k<m;k++){
            cin >> a[j][k];
            sum += a[j][k]*b[k];
        }
        if(sum > 0){
            ans++;
        }
        sum = c;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int t[3];
int main(void){
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        t[s[i]-'a']++;
    }
    int a=min({t[0],t[1],t[2]});
    t[0]-=a,t[1]-=a,t[2]-=a;
    if(t[0]<=1&&t[1]<=1&&t[2]<=1)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int N;
vector<int> pathes[200500];
int parent[200500];
int dist[200500];
void dfs(int from) {
    for(int i = 0; i < pathes[from].size(); i++) {
        int to = pathes[from][i];
        if(to == parent[from]) continue;
        dist[to] = dist[from] + 1;
        parent[to] = from;
        dfs(to);
    }
}

int main() {
    //cout.precision(10);
    cin >> N;
    for(int i = 1; i < N; i++) {
        int a, b;
        cin >> a >> b;
        pathes[a].push_back(b);
        pathes[b].push_back(a);
    }
    parent[1] = 0;
    dfs(1);
    int p1 = 1;
    for(int i = 2; i <= N; i++) {
        if(dist[i] > dist[p1]) p1 = i;
    }
    for(int i = 1; i <= N; i++) {
        parent[i] = 0;
        dist[i] = 0;
    }
    dfs(p1);
    int diameter = 0;
    for(int i = 1; i <= N; i++) {
        diameter = max(diameter, dist[i]);
    }
    cerr << diameter << endl;
    if(diameter % 3 == 1) cout << "Second" << endl;
    else cout << "First" << endl;
    return 0;
}


Measured memory_bytes: 22144
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b){if(a < b){ a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b){if(a > b){ a = b; return 1;} return 0;}

const ll INF = 1000000000;
const int MAX_N = 3000000;

int main(){
    string a, b;
    cin >> a >> b;

    if(a.size() > b.size()){
        cout << "GREATER" << endl;
    }else if(a.size() < b.size()){
        cout << "LESS" << endl;
    }else if(a > b){
        cout << "GREATER" << endl;
    }else if(a < b){
        cout << "LESS" << endl;
    }else{
        cout << "EQUAL" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main(){
double x1,y1,x2,y2;
double xlen,ylen,ans;
cin>>x1>>y1>>x2>>y2;
ans=pow(x2-x1,2)+pow(y2-y1,2);
ans=sqrt(ans);
cout<<fixed<<ans;
}


Measured memory_bytes: 3268
function main()
    n,m=myreads(Int)

    # -----------Union-Find-----------
    par=Vector{Int}([i for i=1:n])
    siz=ones(Int,n)
    function root(x::Int)
        index=par[x]
        while par[index]!=index
            index=par[index]
        end
        return index
    end
    function unite(x::Int,y::Int)
        rx,ry=root(x),root(y)
        if rx==ry
            return 0
        elseif rx>ry
            rx,ry=ry,rx
        end
        par[ry]=rx
        siz[rx]+=siz[ry]
    end
    function same(x::Int,y::Int)
        isequal(root(x),root(y))
    end

    for i=1:m
        a,b=myreads(Int)
        unite(a,b)
    end
    println(maximum(siz))
end

# ----------input function----------
sread()=chomp(readline())
sreads(sp=" ")=split(readline(),sp)
myread(ty)=parse(ty,sread())
myreads(ty)=parse.(ty,sreads())
main()

Measured memory_bytes: 218488
using System;
using System.Linq;
 
namespace Volumen0
{
    class Program
    {
        static void Main()
        {
            var con = new Control();
            var times = Console.ReadLine().Split().Select(int.Parse).ToArray();
            for (int j = 0; j < times[0]; ++j)
            {
                var line = Console.ReadLine().ToCharArray();
                for (var i = 0; i < line.Length; i++)
                {
                    line[i] -= 'a';
                }
                Console.WriteLine(con.Auth(line));
            }
        }
    }
    class Control
    {
        const int MAX_SIZE = 26;
        internal string Auth(char[] line)
        {
            var affin = "";
            for (var alpha = 1; affin.Equals(""); ++alpha)
            {
                if (Gcd(alpha, MAX_SIZE) != 1)
                {
                    continue;
                }
                for (var beta = 0; beta < MAX_SIZE; ++beta)
                {
                    foreach (var g in line)
                    {
                        affin += Decrypt(alpha, beta, g);
                    }
                    if (affin.Contains("that") || affin.Contains("this"))
                        return affin;
                    affin = "";
                }
            }
            return affin;
        }
        private int Gcd(int a, int b)
        {
            return b == 0 ? a : Gcd(b, a % b);
        }
        private char Decrypt(int alpha, int beta, int gamma)
        {
            if (0 <= gamma && MAX_SIZE > gamma)
            {
                return (char)((alpha * gamma + beta) % MAX_SIZE + 'a');
            }
            else
            {
                return (char)(gamma + 'a');
            }
        }
    }
}


Measured memory_bytes: 18380
n = int(input())
task = list()

for i in range(n):
    vol, limit = map(int, input().split())
    task.append((limit, vol))   # limit-first in order to sort
    
task.sort()  # sort by limit

c_time = 0
for t in task:
    c_time += t[1]
    # print(f'Job {t} finished at {c_time}')  # debug message
    if c_time > t[0]:
        print('No')
        break
else:
    print('Yes')


Measured memory_bytes: 29456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
const double eps = 1e-8;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T> ostream& operator << (ostream& os, const set<T>& s) { for (auto si : s) os << si << " "; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12); // debuged
    int T;
    T = 1;
    while (T--) solve();
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> v(3);
    cin >> v;
    string t;
    cin >> t;
    
    map<char, int> mp;
    mp['r'] = 0;
    mp['s'] = 1;
    mp['p'] = 2;
    
    // kつの独立なグループに分ける
    vector<string> s(k);
    rep(i, n) s[i % k] += t[i];
    ll ans = 0;
    for (string t : s) {
        vector<vector<int> > dp(sz(t) + 1, vector<int>(3)); // 直前にjを出した
        rep(i, sz(t)) rep(j, 3) {
            rep(k, 3) { // 出す手
                if (j == k) continue;
                bool A = ((mp[t[i]] - 1 + 3) % 3 == k);
                chmax(dp[i + 1][k], dp[i][j] + (A ? v[k] : 0));
            }
        }
        ans += *max_element(all(dp[sz(t)]));
    }
    cout << ans << endl;
}



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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }
template<class T> istream& operator>> (istream& ist, pair<T, T>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }

typedef long long ll;
int64_t const inf = std::numeric_limits<int64_t>::max();

using P = pair<int64_t, int64_t>;

int N, K;

auto in_left_cornered_rect(int x, int y, int lx, int ly) {
  return lx <= x && ly <= y;
}

auto count_points_in_rect(vector<P> const& vs, map<P, int>& counts, int i, int j) {
  auto lt = vs[i];
  auto rt = P{vs[j].first, vs[i].second};
  auto lb = P{vs[i].first, vs[j].second};
  auto rb = vs[j];
  if (counts.find(rt) == counts.end()) return 0;
  if (counts.find(lb) == counts.end()) return 0;
  return counts[lt] - counts[rt] - counts[lb] + counts[rb];
}

int main() {
  cin >> N >> K;
  vector<P> in;
  rep(i, N) {
    int x, y; cin >> x >> y;
    in.emplace_back(x, y);
  }

  // 点の座標集合の直積
  vector<P> vs = in;
  rep(i, N) rep(j, N) {
    vs.emplace_back(min(in[i].first, in[j].first),     min(in[i].second, in[j].second));
    vs.emplace_back(max(in[i].first, in[j].first) + 1, min(in[i].second, in[j].second));
    vs.emplace_back(min(in[i].first, in[j].first),     max(in[i].second, in[j].second) + 1);
    vs.emplace_back(max(in[i].first, in[j].first) + 1, max(in[i].second, in[j].second) + 1);
  }
  sort(vs.begin(), vs.end());
  vs.erase(unique(vs.begin(), vs.end()), vs.end());

  ///////////////////////

  map<P, int> counts;
  for (auto const& corner: vs) {
    rep(i, N) {
      counts[corner] += !!in_left_cornered_rect(in[i].first, in[i].second, corner.first, corner.second);
    }
  }

  ///////////////////////

  int64_t min_rect = inf;
  rep(i, vs.size()) rep(j, vs.size()) {
    if (!(vs[i].first < vs[j].first && vs[i].second < vs[j].second)) continue;
    if (count_points_in_rect(vs, counts, i, j) >= K) {
      auto W = vs[j].first - vs[i].first - 1;
      auto H = vs[j].second - vs[i].second - 1;
      minimize(min_rect, (int64_t)W * H);
    }
  }
  cout << min_rect << "\n";
}


Measured memory_bytes: 576
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	void solve() throws IOException {
		int n = readInt();
		int[] l = readArr(2*n);

		Arrays.sort(l);

		int ans = 0;
		for (int i=2*n-2; i>=0; i-=2) {
			ans += l[i];
		}

		out.println(ans);
	}


	public static void main(String[] args) throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		tok = new StringTokenizer("");
		Main main = new Main();
		main.solve();
		out.close();
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine(), " .");
		}
		return tok.nextToken();
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	long readLong() throws IOException {
		return Long.parseLong(readString());
	}

	double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}

	int[] readArr(int n) throws IOException {
		int[] res = new int[n];
		for (int i = 0; i < n; i++) {
			res[i] = readInt();
		}
		return res;
	}

	long[] readArrL(int n) throws IOException {
		long[] res = new long[n];
		for (int i = 0; i < n; i++) {
			res[i] = readLong();
		}
		return res;
	}

	void readArr2(int[] A, int[] B) throws IOException {
		int n = A.length;
		for (int i = 0; i < n; i++) {
			A[i] = readInt();
			B[i] = readInt();
		}
	}

	void readArrL2(long[] A, long[] B) throws IOException {
		int n = A.length;
		for (int i = 0; i < n; i++) {
			A[i] = readLong();
			B[i] = readLong();
		}
	}
}


Measured memory_bytes: 8144
<?php
fscanf(STDIN, "%d", $N);
fscanf(STDIN, "%s", $S);

$arr = array_pad(array(), $N, 0);

for ($i = 0; $i < 26; $i++) {
    $c = chr(97+$i);
    $l = strpos($S, $c);
    if ($l === false) continue;
    $r = strrpos($S, $c);
    for ($j = $l; $j < $r; $j++) {
        $arr[$j]++;
    }
}

echo max($arr) , "\n";


Measured memory_bytes: 4732
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    int k,x,t;
    cin>>k>>x;
    vector<int>v;
    v.push_back(x);
    t = x;
    while(--k)
    {
    	v.push_back(t+1);
    	v.push_back(x-1);
    	x--;
    	t++;
	}
	sort(v.begin(),v.end());
	for(int i=0;i<v.size();i++)
	{
		cout<<v[i]<<" ";
	}
}

Measured memory_bytes: 256