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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

const int INF=1e9;
const int MOD=1e9+7;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

// length of [1,n]
ll count(ll n)
{
	ll res=0;
	res+=n/3*4; // Fizz
	res+=n/5*4; // Fizz
	for(ll i=1,d=1;i<=n;i*=10,d++){
		ll j=min(i*10-1,n);
		ll x=j/3+j/5-j/15,y=(i-1)/3+(i-1)/5-(i-1)/15;
		res+=d*((j-i+1)-(x-y));
	}
	return res;
}

int main()
{
	for(ll n;cin>>n && n;){
		ll lo=1,hi=1e18; // count(x)>n-1となる最小のx
		while(lo<hi){
			ll mi=(lo+hi)/2;
			if(count(mi)>n-1)
				hi=mi;
			else
				lo=mi+1;
		}
		
		ll x=lo;
		ll offset=count(x-1);
		ostringstream oss;
		rep(i,30){
			if((x+i)%15==0)
				oss<<"FizzBuzz";
			else if((x+i)%3==0)
				oss<<"Fizz";
			else if((x+i)%5==0)
				oss<<"Buzz";
			else
				oss<<x+i;
		}
		string res=oss.str().substr(n-1-offset,20);
		cout<<res<<endl;
	}
}

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

using namespace std;

struct edge {
    int to, cost;
};

vector<int> dijkstra(const vector<vector<edge>>& g, int s) {

    int n = g.size();
    const int INF = numeric_limits<int>::max();
    vector<int> dist(n, INF);

    using P = pair<int,int>;
    priority_queue<P, vector<P>, greater<P>> que;

    que.emplace(0, s);
    dist[s] = 0;
    while (!que.empty()) {
        int d, v; tie(d, v) = que.top(); que.pop();
        if (dist[v] < d) continue;
        for (const edge& e : g[v]) {
            int nxt = d + e.cost;
            if (dist[e.to] > nxt) {
                dist[e.to] = nxt;
                que.emplace(nxt, e.to);
            }
        }
    }
    return dist;
}

int main() {

    int n, m, s; cin >> n >> m >> s;
    vector<vector<edge>> g(n);

    for (int i = 0; i < m; ++i) {
        int u, v, c; cin >> u >> v >> c;
        g[u].push_back((edge){v, c});
    }

    const int INF = numeric_limits<int>::max();
    for (int d : dijkstra(g, s)) {
        if (d < INF) cout << d << endl;
        else cout << "INF" << endl;
    }

    return 0;
}



Measured memory_bytes: 12944
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double h = sc.nextDouble(), w = sc.nextDouble();
		if (h != 1 && w != 1)
			System.out.println((long) Math.ceil(h * w / 2));
		else
			System.out.println(1);
		sc.close();
	}
}


Measured memory_bytes: 37428
#include <iostream>
#include <vector>
#include <cassert>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int N;
int a,b;
int M;
vector<int> x,y,z;
int K;

int rev(int k,int l,int r) {
    if(k<l||r<k) return k;
    int t2=r-k;
    return l+t2;
}

int main() {
    cin>>N;
    cin>>a>>b;
    cin>>M;
    x.resize(M);
    y.resize(M);
    z.resize(M);
    rep(i,M) cin>>x[i]>>y[i]>>z[i];
    rep(i,M) y[i]--,z[i]--;
    cin>>K;
    K--;

    for(int i=M-1;i>=0;i--) {
        if(x[i]==0) {
            K=rev(K,y[i],z[i]);
        }
    }
    int ans=a+b*K;
    rep(i,M) {
        if(K<y[i]||z[i]<K) continue;
        if(x[i]==0) {
            K=rev(K,y[i],z[i]);
        }
        if(x[i]==1) {
            ans++;
        }
        if(x[i]==2) {
            ans/=2;
        }
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using ld= long double;
using pll= pair<ll, ll>;
using vi= vector<int>;
using vl= vector<ll>;
using vd= vector<ld>;
using vs= vector<string>;
using vb= vector<bool>;
using vpll= vector<pll>;
using vvi= vector<vi>;
using vvl= vector<vl>;
using vvd= vector<vd>;
using vvs= vector<vs>;
using vvb= vector<vb>;
using vvpll= vector<vpll>;
constexpr ll mod= 1e9 + 7;
#define ALL(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define REPBASE(i, a, b) for(ll(i)= (a); (i) < (b); (i)++)
#define RREPBASE(i, a, b) for(ll(i)= (a); (i) >= (b); (i)--)
#define REPB(i, n) REPBASE(i, 0, n)
#define REPS(i, n) REPBASE(i, 1, n + 1)
#define RREP(i, n) RREPBASE(i, n - 1, 0)
#define RREPS(i, n) RREPBASE(i, n, 1)
#define REP(...) _overload(__VA_ARGS__,REPBASE,REPB)(__VA_ARGS__)
#define EACH(x,c) for(auto& x : c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())
#define YES(n) ((n) ? "YES" : "NO")
#define Yes(n) ((n) ? "Yes" : "No")
#define yes(n) ((n) ? "yes" : "no")
#define SZ(x) ((ll)(x).size())
#define BIT(n) (1LL<<(n))
template <class T>
bool chmax(T &a, const T &b) {
    if(a < b) {
        a= b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if(b < a) {
        a= b;
        return 1;
    }
    return 0;
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    ll N;
    cin >> N;
    vl A(N);
    vvpll X(N,vpll(0));
    REP(i,N){
        cin >> A[i];
        X[i].assign(A[i],mp(0,0));
        REP(l,A[i]){
            cin >> X[i][l].fi >> X[i][l].se;
            X[i][l].fi--;
        }
    }
    ll count = 0;
    REP(i,BIT(N)){
        bool ok = 1;
        REP(l,N){
            if((i & BIT(l)) != 0){
                REP(k,A[l]){
                    if(X[l][k].se == 0){
                        if((i & BIT(X[l][k].fi)) != 0){
                            ok = 0;
                            break;
                        }
                    }else{
                        if((i & BIT(X[l][k].fi)) == 0){
                            ok = 0;
                            break;
                        }
                    }
                }
            }
            if(!ok)break;
        }
        if(ok)chmax(count,(ll)__builtin_popcountll(i));
    }
    cout << count << "\n";
}

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

class node {
public:
    node()
        : _key(),
        _previous(this),
        _next(this)
    {}

    node(const int key,
        node* previous,
        node* next)
        : _key(key),
        _previous(previous),
        _next(next)
    {}

    node* privious() const
    {
        return _previous;
    }

    node* next() const
    {
        return _next;
    }

    int key() const {
        return _key;
    }

    void set_previous(node* previous)
    {
        _previous = previous;
        return;
    }

    void set_next(node* next)
    {
        _next = next;
        return;
    }

private:
    int _key;
    node* _previous;
    node* _next;
};

class list {
public:
    list() : _origin(new node())
    {}

    void insert(const int val) {
        node* newnode
            = new node(val, _origin, _origin->next());
        _origin->next()->set_previous(newnode);
        _origin->set_next(newnode);
    }

    void erase(const int val) {
        node* pos = _origin->next();
        for (;pos != _origin; pos = pos->next())
        {
            if (pos->key() == val) {
                break;
            }
        }
        if (pos != _origin) {
            this->erase(pos);
        }
        return;
    }

    void erase_first() {
        this->erase(_origin->next());
    }

    void erase_last() {
        this->erase(_origin->privious());
    }

    void print() const {
        node* pos = _origin->next();
        for (; pos->next() != _origin; pos = pos->next()) {
            std::cout << pos->key();
            std::cout << " ";
        }
        std::cout << pos->key();
        return;
    }

private:
    void erase(node* pos) {
        pos->privious()->set_next(pos->next());
        pos->next()->set_previous(pos->privious());
        delete pos;
        return;
    }

private:
    node* _origin;
};

void execute(list& l, const std::string& command)
{
    if (command == "deleteFirst") {
        l.erase_first();
        return;
    }
    if (command == "deleteLast") {
        l.erase_last();
        return;
    }
    const std::string cmd
        = command.substr(0, command.find(' '));
    const int val
        = std::stoi(command.substr(command.find(' ') + 1, command.size()));
    if (cmd == "insert") {
        l.insert(val);
        return;
    }
    if (cmd == "delete") {
        l.erase(val);
        return;
    }
}

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

    int n;
    std::cin >> n;
    std::cin.ignore();  //ignore \n

    list l;
    std::string buf;
    for (int i = 0; i < n; ++i) {
        getline(std::cin, buf);
        execute(l, buf);
    }
    l.print();
    std::cout << std::endl;

    return 0;
}

Measured memory_bytes: 34500
#include <iostream>
#include <bits/stdc++.h>
#define f(i,a,b) for (int i=a; i<b; i++)
#define F(i,a,b) for (int i=a; i<=b; i++)
#define fod(i,a,b) for (int i=a; i>=b; i--)
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define MOD 1000000007

using namespace std;

template<class t> inline t read(t &x){
	x=0;char c=getchar();bool f=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return  x;
}
template<class t> inline void write(t x){
	if(x<0){putchar('-'),write(-x);}
	else{if(x>9)write(x/10);putchar('0'+x%10);}
}

typedef long long ll;
typedef pair<int, int> pii;
typedef map<int,int> mii;

const int maxn=1e5+5;
int A[maxn][3];
int B[maxn][3];
int main()
{
    int n;
    cin>>n;
    F(i,1,n) read(A[i][0]), read(A[i][1]), read(A[i][2]);
    F(i,1,n){
        f(j,0,3) {
            int res=0;
            f(k,0,3) {
                if (j!=k) res=max(B[i-1][k]+A[i][j], res);
            }
            B[i][j]=res;
        }
    }
    cout<<max(B[n][2], max(B[n][0],B[n][1]));
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cassert>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

struct Dinic {
    struct Edge {int to, rev, cap;};
    vector<vector<Edge>> Graph;
    vector<int> dist, iter;
    Dinic(int v) : Graph(v) {}
    void AddEdge(int from, int to, int cap) {
        Graph[from].push_back({to, SZ(Graph[to]), cap});
        Graph[to].push_back({from, SZ(Graph[from]) - 1, 0});
    }
    bool bfs(int s, int t) {
        dist.assign(SZ(Graph), -1);
        queue<int> q;
        dist[s] = 0;
        q.push(s);
        while (!q.empty() && dist[t] == -1) {
            int v = q.front();
            q.pop();
            for (const auto &e: Graph[v]) {
                if (e.cap > 0 && dist[e.to] == -1) {
                    dist[e.to] = dist[v] + 1;
                    q.push(e.to);
                }
            }
        }
        return dist[t] != -1;
    }
    int dfs(int now, int t, int mn) {
        if (now == t) return mn;
        for (int &i = iter[now]; i < SZ(Graph[now]); ++i) {
            Edge &e = Graph[now][i];
            if (e.cap > 0 && dist[now] + 1 == dist[e.to]) {
                int d = dfs(e.to, t, min(mn, e.cap));
                if (d > 0) {
                    e.cap -= d;
                    Graph[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }
    int MaxFlow(int s, int t) {
        int ans = 0;
        while (bfs(s, t)) {
            iter.assign(SZ(Graph), 0);
            int f = 0;
            while ((f = dfs(s, t, 1001001001)) > 0) ans += f;
        }
        return ans;
    }
};

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n), d(n);
    REP(i, n) cin >> a[i] >> b[i];
    REP(i, n) cin >> c[i] >> d[i];
    Dinic D(2 * n + 2);
    REP(i, n) {
        D.AddEdge(0, i + 1, 1);
        D.AddEdge(i + n + 1, 2 * n + 1, 1);
    }
    REP(i, n) REP(j, n) {
        if (a[i] < c[j] && b[i] < d[j]) {
            D.AddEdge(i + 1, j + n + 1, 1);
        }
    }
    cout << D.MaxFlow(0, 2 * n + 1) << "\n";
    return 0;
}


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

using namespace std;
using ll = long long;

const int MAX_N = 100000;
const ll MOD = 1000000007;
int N;

ll dp1[MAX_N]; // iを白で塗った時の場合の数
ll dp2[MAX_N]; // iを黒で塗った時の場合の数
vector<int> table[MAX_N];

ll rec1(int node, int par);
ll rec2(int node, int par);

ll rec2(int node, int par) {
  if (dp2[node] >= 0) return dp2[node];
  
  ll cnt = 1;
  for (int next : table[node]) {
    if (next == par) continue;
    cnt *= rec1(next, node);
    cnt %= MOD;
  }
  return dp2[node] = cnt;
}

ll rec1(int node, int par) {
  if (dp1[node] >= 0) return dp1[node];
  
  ll cnt = 1;
  for (int next : table[node]) {
    if (next == par) continue;
    cnt *= (rec1(next, node) + rec2(next, node)) % MOD;
    cnt %= MOD;
  }
  return dp1[node] = cnt;
}

int main() {
  cin >> N;
  fill(dp1, dp1 + N, -1);
  fill(dp2, dp2 + N, -1);
  
  for (int i = 0; i < N - 1; i++) {
    int s, t;
    cin >> s >> t;
    s--; t--;
    table[s].push_back(t);
    table[t].push_back(s);
  }
  
  cout << (rec1(0, -1) + rec2(0, -1)) % MOD << endl;
}

Measured memory_bytes: 14208
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell1 1e9+7
#define hell2 1e9+9
#define pi 3.1415926535
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define ll long long
#define ld long double 
#define no_of_digits(n) floor(log10(n)) + 1
#define see(x) cout << (#x) << " is " << (x) << endl
#define INF 1e9

using namespace std;

ll mult(ll a,ll b, ll p=hell1){   return ((a%p)*(b%p))%p; }
ll multbig(ll a,ll b,ll mod=hell1){   if(a==0 or b==0) return 0;if(a==1 or b==1) return (a*b)%mod;ll cur=multbig(a,b/2,mod);cur=(2*cur)%mod;if(b%2) cur=(cur+a)%mod;return cur;
}
ll add(ll a, ll b, ll p=hell1){ if(a>=p) a%=p; if(b>=p) b%=p; if(a+b>p) return (a + b)%p; else return a+b;}
ll sub(ll a, ll b, ll p=hell1){return (a%p - b%p + p)%p;}
ll fpow(ll n, ll k, ll p = hell1) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = hell1) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = hell1){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}
int isPowerof2(ll x) { return (x && !(x & x-1)); } 
ll log2(ll x) { ll res = 0; while (x >>= 1) res++; return res; } 

// max({a, b, c, d})

vector<ll>adj[200005];
ll update[200005];
ll ans[200005];

int binaryToDecimal(string n) 
{ 
    string num = n; 
    int dec_value = 0; 
  
    // Initializing base value to 1, i.e 2^0 
    int base = 1; 
  
    int len = num.length(); 
    for (int i = len - 1; i >= 0; i--) { 
        if (num[i] == '1') 
            dec_value += base; 
        base = base * 2; 
    } 
  
    return dec_value; 
} 

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

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

    int i;
    for(i=n-1;i>0;i--)
    {
        if(a[i-1]-a[i] > 1)
        {
            cout << "No\n";
            break;
        }
        else if(a[i-1]-a[i] == 1) a[i-1] = a[i];
        // else a[i-1] = a[i];
    }
    if(i == 0) cout << "Yes\n";
}




Measured memory_bytes: 6400
N = int(input())
S = list(input())

A=[[0]*(N+1) for i in range(3)]

C=0
D=0
for i in range (1,N+1):
    if(S[i-1]=="W"):
        D+=1
    A[0][i]=D

C=0
D=0
for i in range (N-1,-1,-1):
    if(S[i]=="E"):
        C+=1
    A[1][i]=C

for i in range (N+1):
    A[2][i]=A[1][i]+A[0][i]


print(min(A[2]))

Measured memory_bytes: 31832
#include<stdio.h>

int main()
{
    int n,p;
    scanf("%d%d",&n,&p);
    int i,j;
    int arr[n];
    int arr1[n];
    for(i=n,j=1;i>0;i--,j++)
    {
        if(j==p)
            printf("%d",i);
    }
}


Measured memory_bytes: 128
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll n, m;
vector<ll> x, y;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        ll temp;
        cin >> temp;
        x.push_back(temp);
    }
    for (int i = 0; i < m; i++)
    {
        ll temp;
        cin >> temp;
        y.push_back(temp);
    }
    ll xle = x[n - 1] - x[0];
    ll yle = 0;
    for(int i=1;i<m;i++){
        yle += (y[i] - y[i - 1]) * i * (m- i);
        yle%=MOD;
    }
    ll ans=0;
    for(int i=1;i<n;i++){
        ll temp = (x[i] - x[i - 1]) * i * (n - i);
        temp%=MOD;
        temp*=yle;
        temp%=MOD;
         ans += temp;
        ans%=MOD;
    }
    /*
    for (int i = 1; i < m; i++)
    {
        ans *= (y[i] - y[i - 1]) * i * (m - i) * xle;
        ans %= MOD;
    }
    */
    cout << ans << "\n";
}


Measured memory_bytes: 2548
n, m = map(int, input().split())
a = [[None] * m for _ in range(n)]
b = [None] * m
for i in range(n):
    a[i] = list(map(int, input().split()))
for i in range(m):
    b[i] = int(input())
for i in range(n):
    c = 0
    for j in range(m):
        c += a[i][j] * b[j]
    print(c)



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

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

    double sum = 0;
    for (int i = 0; i < n; i++) {
        double x;
        string u;
        cin >> x >> u;
        if (u == "JPY") sum += x;
        else sum += 380000.0 * x;
    }

    cout << fixed << setprecision(6) << sum << endl;
    return 0;
}

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

namespace AtCoderTest
{
    class Program
    {
        static void Main()
        {
            var buf = Console.ReadLine().Trim().Split();
            int N = int.Parse(buf[0]);
            int K = int.Parse(buf[1]);
            buf = Console.ReadLine().Trim().Split();
            const int inf = (int)1e9;
            List<int> h = new List<int>();
            List<int> min = new List<int>();
            min.Add(0);
            for (int i = 0; i < N; i++) {
                h.Add(int.Parse(buf[i]));
                min.Add(inf);
            }

            for (int i = 1; i < N; i++) {
                for (int l = 0; l < K; l++) {
                    int j = i + l;
                    if (j >= N) continue;
                    int mtmp = min[i-1];

                    int diff = h[j]-h[i-1];
                    if (diff < 0) diff = -diff;
                    int cost = diff + mtmp;

                    if (cost < min[j]) min[j] = cost;

                }
            }

            int sum = min[N-1];
            Console.WriteLine(sum);
        }

    }
}

Measured memory_bytes: 36536
import numpy as np

A_500 = int(input())
B_100 = int(input())
C_50 = int(input())
X = int(input())

A_prob = np.arange(0, A_500 + 1) * 500
B_prob = np.arange(0, B_100 + 1) * 100
C_prob = np.arange(0, C_50 + 1) * 50

sum_prob_list = []
for A in A_prob:
    for B in B_prob:
        for C in C_prob:
            sum_prob_list.append(str(A + B + C))
            
print(sum_prob_list.count(str(X)))

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

int main(){
    int N, K;
    cin >> N >> K;

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

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

    int out = 0;
    for (int i = 0; i < K; i++){
        out += p[i];
    }

    cout << out << endl;
}

Measured memory_bytes: 3628
/*	
*  Sachin Mittal
*/
#include<bits/stdc++.h>
#define int long long
#define M 998244353
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define mem0(dp) memset(dp,0,sizeof(dp))
#define mem1(dp) memset(dp,-1,sizeof(dp))
#define pb push_back
#define sz(s) (int)(s.size())
using namespace std;
int32_t main(){
ios
int t=1;
//cin>>t;
while(t--)
{
	int n,m;cin>>n>>m;
	vector<int> a(n);
	double sm=0;
	for(int i=0;i<n;i++)cin>>a[i],sm+=a[i];
	sm/=(4*m*1.0);
	//cout<<sm<<" ";
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]>=sm)cnt++;
	}
	if(cnt>=m)cout<<"Yes\n";
	else cout<<"No";
}
}

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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int p, q, r;
    cin >> p >> q >> r;
    int mi = max(p, max(q, r));
    print(p + q + r - mi);

    return 0;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
import math
def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
def LIR(n): return [LI() for i in range(n)]
mod = 1000000007

#A
n,k = LI()
ans = k
for i in range(1,n):
    ans *= k-1
print(ans)
#B
"""
r,n,m = LI()
l = [2*r*math.cos(math.asin((n/2-i)/n*2)) for i in range(n+1)]
ans = 0
for i in range(1,n+m):
    a = 0 if i-m <= 0 else l[i-m]
    b = 0 if i >= n else l[i]
    ans += max(a,b)
print(ans)
"""

#C
"""
n = II()
a = LI()
print(sum(a)-n)
"""

#D
"""
s = list(S())
lis = []
sign = ["","+"]
k = 2**(len(s)-1)
d = 10-len(s)
for i in range(d):
    s.insert(0,"0")
i = 0
for a0 in range(2):
    for a1 in range(2):
        for a2 in range(2):
            for a3 in range(2):
                for a4 in range(2):
                    for a5 in range(2):
                        for a6 in range(2):
                            for a7 in range(2):
                                for a8 in range(2):
                                    if i >= k:break
                                    lis.append(s[0]+sign[a0]+s[1]+sign[a1]+s[2]+sign[a2]+s[3]+sign[a3]+s[4]+sign[a4]+s[5]+sign[a5]+s[6]+sign[a6]+s[7]+sign[a7]+s[8]+sign[a8]+s[9])
                                    i += 1
ans = 0
for i in lis:
    ans += eval(i[d:])
print(ans)
"""
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 38256
#include <iostream>

using namespace std;

void toE(int a[])
{
    int tmp = a[0];
    a[0] = a[3];
    a[3] = a[5];
    a[5] = a[2];
    a[2] = tmp;
}

void toW(int a[])
{
    int tmp = a[0];
    a[0] = a[2];
    a[2] = a[5];
    a[5] = a[3];
    a[3] = tmp;
}

void toS(int a[])
{
    int tmp = a[0];
    a[0] = a[4];
    a[4] = a[5];
    a[5] = a[1];
    a[1] = tmp;
}

void toN(int a[])
{
    int tmp = a[0];
    a[0] = a[1];
    a[1] = a[5];
    a[5] = a[4];
    a[4] = tmp;
}

void spin(int a[])
{
    int tmp = a[1];
    a[1] = a[3];
    a[3] = a[4];
    a[4] = a[2];
    a[2] = tmp;
 }

int main()
{
    int a[6], b[6];
    int uNum[6] = {-1}, fNum[6] = {-1};
    string ans = "No";
    int last_U = 0, last_F = 0;

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

    for (int i = 0; i < 6; i++)
    {
        if (a[0] == b[i])
        {
            uNum[last_U] = i;
            last_U++;
        }
        if (i == 5 && uNum[0] == -1)
        {
            cout << ans << endl;
            return 0;
        }
    }

    for (int j = 0; j < last_U; j++)
    {
        switch (uNum[j])
        {
            case 0:
            break;
            case 1:
            toN(b);
            break;
            case 2:
            toW(b);
            break;
            case 3:
            toE(b);
            break;
            case 4:
            toS(b);
            break;
            case 5:
            toN(b);
            toN(b);
            break;
        }

        for (int i = 1; i <= 4; i++)
        {
            if (a[1] == b[i])
            {
                fNum[last_F] = i;
                last_F++;
            }
            if (i == 4 && fNum[0] == -1)
            {
                cout << ans << endl;
                return 0;
            }
        }

        for (int k = 0; k < last_F; k++)
        {
            switch (fNum[k])
            {
                case 1:
                    break;
                case 2:
                    spin(b);
                    spin(b);
                    spin(b);
                    break;
                case 3:
                    spin(b);
                    break;
                case 4:
                    spin(b);
                    spin(b);
                    break;
            }

            int c = 0;
            while (a[c] == b[c])
            {
                c++;
                if (c == 6)
                {
                    ans = "Yes";
                    cout << ans << endl;
                    return 0;
                }
            }
        }

    }

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



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

using namespace std;

int n;
int a, b, c;
vector<int> l;

int ans = 10000;

void dfs(int i, int mp_a, int mp_b, int mp_c, int len_a, int len_b, int len_c) {
  if (len_a != 0 && len_b != 0 && len_c != 0) {
    int sum = abs(a - len_a) + abs(b - len_b) + abs(c - len_c);
    sum += (mp_a + mp_b + mp_c);
    ans = min(ans, sum);
    // cout << len_a << " " << len_b << " " << len_c << " " << sum << endl;
  }
  if (i == n) {
    return;
  }
  // i本目の竹をAとして使う
  if (len_a == 0) {
    dfs(i + 1, mp_a, mp_b, mp_c, len_a + l[i], len_b, len_c);
  } else {
    dfs(i + 1, mp_a + 10, mp_b, mp_c, len_a + l[i], len_b, len_c);
  }
  // i本目の竹をBとして使う
  if (len_b == 0) {
    dfs(i + 1, mp_a, mp_b, mp_c, len_a, len_b + l[i], len_c);
  } else {
    dfs(i + 1, mp_a, mp_b + 10, mp_c, len_a, len_b + l[i], len_c);
  }
  // i本目の竹をCとして使う
  if (len_c == 0) {
    dfs(i + 1, mp_a, mp_b, mp_c, len_a, len_b, len_c + l[i]);
  } else {
    dfs(i + 1, mp_a, mp_b, mp_c + 10, len_a, len_b, len_c + l[i]);
  }
  // i本目の竹を使わない
  dfs(i + 1, mp_a, mp_b, mp_c, len_a, len_b, len_c);
}

int main() {
  cin >> n >> a >> b >> c;
  l.assign(n, 0);

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

  dfs(0, 0, 0, 0, 0, 0, 0);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import numpy as np


def main():
    n, t = map(int, input().split())
    ts = list(map(int, input().split()))
    ans = t
    for i in range(n-1):
        now = ts[i+1] - ts[i]
        ans += min(now, t)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 48952
n = int(input())
a = list(map(int,input().split()))
c = [0]

for i in range(n):
    c.append(c[i]+a[i])
c.sort()
c.append('end')

k = 1
t = 0
for i in range(n+1):
    if c[i] == c[i+1]:
        k += 1
    else:
        t += int(k*(k-1)/2)
        k = 1
print(t)

Measured memory_bytes: 26136
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k;cin>>n>>k;
    int a[n];
    for (int i=0;i<n;i++)
        cin>>a[i];
    int dp[n]={0};
    for (int i=1; i<n; i++){
        int mn=INT_MAX;
        for (int j=i-1; j>=0 && j>=i-k;j--){
            int x=abs(a[i]-a[j])+dp[j];
            mn=min(mn,x);
        }
        dp[i]=mn;
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 4392
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>

#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
const ll mod = 998244353;


ll A, B, T;

int main() {
	
	cin >>A>>B>>T;
	cout << (T / A)*B << endl;

	return 0;
}

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

using namespace std;

int main(void){
  int x, k;
  cin >> k >> x;


  if (500* k >= x)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


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

using namespace std;

int main()
{
	int n;
	cin >> n;
	unordered_set<int> s;
	for (int i = 0; i < n; i++)
	{
		int d;
		cin >> d;
		s.insert(d);
	}
	cout << s.size() << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;

int main(){
	string s;
	cin >> s;
	int p = 700;
	for(int i = 0; i < 3; i++)if(s[i] == 'o')p+=100;
	cout << p << endl;
    return 0;
}

Measured memory_bytes: 256
def check(pos, c):
  if pos < 0 or pos >= len(S):
    return False
  return S[pos] == c
N = int(input())
S = input()
R_pos = [i for i, c in enumerate(S) if c == 'R']
G_pos = [i for i, c in enumerate(S) if c == 'G']
B_pos = [i for i, c in enumerate(S) if c == 'B']
B_l = len(B_pos)
res = 0
for i in R_pos:
  for j in G_pos:
    res += B_l
    dis = abs(i - j)
    res -= check(min(i, j) - dis, 'B')
    res -= check(max(i, j) + dis, 'B')
    if dis % 2 == 0:
      res -= check(max(i, j) - dis // 2, 'B')
print(res)

Measured memory_bytes: 76436
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxx =  100005;
int a[maxx];
int main()
{
    int n;
    cin>>n;
    int flag = 0;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    for(int i=2;i<=n;i++){
        if(a[i] > a[i-1]){
            a[i]-=1;
        }
    }
    for(int i=2;i<=n;i++){
        if(a[i] < a[i-1]){
            flag = 1;
        }
    }
    if(flag){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }
    return 0;
}



Measured memory_bytes: 640
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

int n, p[200010];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", p + i);
	int minp = p[0], count = 0;
	for (int i = 0; i < n; i++)
		count += p[i] <= minp, minp = min(minp, p[i]);
	printf("%d\n", count);
}

Measured memory_bytes: 896
num=list(map(int,input().split()))

turn=0
while True:
    if turn%2 == 0:
        num[2] = num[2]-num[1]
        if num[2] <= 0:
            print('Yes')
            break
    else:
        num[0] = num[0]-num[3]
        if num[0] <= 0:
            print('No')
            break
    turn += 1

Measured memory_bytes: 9188
from collections import defaultdict

N=int(input())
S=input()

d = defaultdict(list)
for i in range(N):
  d[int(S[i])].append(i)
    
ans = 0
for n1 in range(10):
  if not d[n1]:continue
  for n2 in range(10):
    if not d[n2]:continue
    if d[n1][0]>d[n2][-1]: continue
    for n3 in range(10):
      if not d[n3]:continue
      if d[n1][0]>d[n3][-1] or d[n2][0]>d[n3][-1]:continue
      for idx in d[n2]:
        if idx>d[n1][0] and idx<d[n3][-1]:
          ans += 1
          break
            
print(ans)

Measured memory_bytes: 10740
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    ll n;
    cin >> n;
    vector<ll> A(5);
    rep(i, 5) cin >> A[i];
    sort(ALL(A));
    ll ans = ceil((long double)n / A[0]) + 4;
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
//
//  main.cpp
//  sss
//
//  Created by  on 2019/09/04.
//  Copyright © 2019 . All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    vector <int> vec(5);
    for (int i = 0; i < 5; i++){
        cin >> vec.at(i);
    }
    int k;
    cin >> k;
    sort(vec.begin(),vec.end());
    if (vec.at(4)-vec.at(0) <=k){
        cout << "Yay!" << endl;
    }
    else{
        cout << ":(" << endl;
        
    }
}





Measured memory_bytes: 256
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

#define debug(s) cout << #s << " = " << s << endl
#define all(v) (v).begin(), (v).end()
#define KeepUnique(v) (v).erase( unique(all(v)), v.end() )
#define MEMSET(a, val) memset(a, val, sizeof (a))
#define PB push_back
#define endl '\n'
typedef long long ll;

inline int myrand(int l, int r) {
	int ret = rand(); ret <<= 15; ret ^= rand();
	if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
	return ret;
}

template <typename F, typename S>
ostream& operator << (ostream& os, const pair< F, S>& p) {
	return os<<"(" <<p.first<<", "<<p.second<<")"; }

typedef pair<int, int> ii;

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

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

struct sgt {
	vector<int> t;
	int N;
	sgt() {N = 0;}
	sgt(int N) {
		this -> N = N;
		t.resize(N << 2 | 123);
	}
	void insert(int x) {
		update(1, 0, N - 1, x + (N >> 1));
	}
	void update(int u, int b, int e, int p) {
		if(b > p or e < p) return;
		if(b == e) return void(t[u]++);
		int mid = b + e >> 1;
		update(u << 1, b, mid, p);
		update(u << 1 | 1, mid + 1, e, p);
		t[u] = t[u << 1] + t[u << 1 | 1];
	}
	int leq(int x) {
		return query(1, 0, N - 1, 0, x + (N >> 1));
	}
	int query(int u, int b, int e, int i, int j) {
		if(b > j or e < i) return 0;
		if(i <= b and e <= j) return t[u];
		int mid = b + e >> 1;
		return query(u << 1, b, mid, i, j) + query(u << 1 | 1, mid + 1, e, i, j);
	}
};

const int maxn = 1e5;

vector<int> a;
int n;

ll geq(int m) {
	sgt ds(n << 1 | 1);
	vector<int> pre(n);
	for(int i = 0; i < n; i++) {
		if(a[i] < m) pre[i] = -1;
		else pre[i] = +1;
		if(i != 0) pre[i] += pre[i - 1];
	}
	ds.insert(0);
	ll ret = 0;
	for(int i = 0; i < n; i++) {
		ret += ds.leq(pre[i]);
		ds.insert(pre[i]);
	} return ret;
}

int32_t main () {
    // freopen("in", "r", stdin);
    cin >> n;
    a.resize(n);
    for(int &b : a) cin >> b;
    	
    vector<int> vec = a;
	sort(all(vec));
	// for(int i = 0; i < n; i++) {
	// 	cout << vec[i] << '\t';
	// } cout << endl;
	// for(int i = 0; i < n; i++) {
	// 	cout << geq(vec[i]) << '\t';
	// } cout << endl;

	ll req = 1LL * n * (n + 1) / 2;
	if(req & 1) req /= 2;
	else req /= 2, req--;

	int ans = -1;
	int lo = 0, hi = n - 1;
	while(lo <= hi) {
		int mid = lo + hi >> 1;
		if(geq(vec[mid]) <= req) {
			ans = mid;
			hi = mid - 1;
		} else {
			lo = mid + 1;
		}
	}
	if(ans == -1) cout << vec.back() << endl;
	else cout << vec[ans - 1] << endl;
}

Measured memory_bytes: 4560
#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<ll,ll>;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}


int main() {
  ll x;
  cin >> x;
  for(int i=0; i<2000; i++) {
      ll a=pow(i,5);
      for(int j=-2000; j<2000; j++) {
          ll b=pow(j,5);
          if(a-b==x) {
              cout << i << " " << j << endl;
              return 0;
          }
      }
  }
  return 0;
}


Measured memory_bytes: 4204
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());

            double ans = 0;
            for (int i = 0; i < N; i++)
            {
                string[] s = Console.ReadLine().Split(' ');
                double x = double.Parse(s[0]);
                if (s[1] == "BTC")
                {
                    x *= 380000.0;
                }
                ans += x;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#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()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#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; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}


// https://kyopro-friends.hatenablog.com/entry/2019/01/12/231035

typedef vector<ll> vec;
typedef vector<vector<ll> > mat;

int m;

vec matmul(vec &dp, mat &mt) {
    vec ret(m, 0);
    for (int i = 0; i < m; ++i) for (int j = 0; j < m; ++j) {
        (ret[i] += mt[i][j] * dp[j]) %= mod;
    }
    return ret;
}

mat update(mat &mt) {
    mat ret(m, vec(m, 0));
    for (int i = 0; i < m; ++i) for (int j = 0; j < m; ++j)
        for (int k = 0; k < m; ++k) {
        (ret[i][j] += mt[i][k] * mt[k][j]) %= mod;
    }
    return ret;
}

void matpow(vec &dp, mat &mt, ll k) {
    m = (int)dp.size();
    while (k) {
        if (k & 1) dp = matmul(dp, mt);
        mt = update(mt);
        k >>= 1;
    }
}

void solve() {
  int n;
  ll k;
  cin >> n >> k;
  mat a = vector<vector<ll> >(n, vector<ll>(n));

  rep(i, n) rep(j, n) cin >> a[i][j];

  ll ans = 0;
  rep(i, n) {
    mat b = a;
    vec v = vector<ll>(n);
    v[i] = 1;
    matpow(v, b, k);
    rep(j, n) add(ans, v[j]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
N = int(input())
ABs = [None]*N
for i in range(N):
    ABs[i] = list(map(int, input().split()))

ABs = sorted(ABs, key=lambda x:x[1])

time = 0
answer = "Yes"
for i in range(N):
    A, B = ABs[i]
    time += A
    if time > B:
        answer = "No"
        break

print(answer)

Measured memory_bytes: 55184
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    int ans = 0;
    for(int i=0; i<n; ++i){
        int h;
        cin >> h;
        if(k <= h)
            ++ ans;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int i,j,k,N,wmax,wmin,hmax,hmin;
    int d[200]={0},n[200]={0};
    int board[401][401];

    while(scanf("%d",&N),N){

        for(i=0;i<401;i++){
            for(j=0;j<401;j++){
                board[i][j]=-1;
            }
        }
        board[200][200]=0;

        for(i=1;i<N;i++){
            scanf("%d%d",&n[i],&d[i]);
        }

        for(k=1;k<N;k++){
            for(i=0;i<401;i++){
                for(j=0;j<401;j++){
                    if(board[i][j]==n[k]){
                        switch(d[k]){
                            case 0:
                                board[i][j-1]=k;
                                break;
                            case 1:
                                board[i+1][j]=k;
                                break;
                            case 2:
                                board[i][j+1]=k;
                                break;
                            case 3:
                                board[i-1][j]=k;
                                break;
                        }
                    }
                }
            }
        }

        wmax=0;
        wmin=401;
        for(i=0;i<401;i++){
            for(j=0;j<401;j++){
                if(board[i][j]>-1){
                    if(wmin>j) wmin=j;
                    break;
                }
            }
            for(k=400;k>=0;k--){
                if(board[i][k]>-1){
                    if(wmax<k) wmax=k;
                    break;
                }
            }
        }

        hmax=0;
        hmin=401;
        for(i=0;i<401;i++){
            for(j=0;j<401;j++){
                if(board[j][i]>-1){
                    if(hmin>j) hmin=j;
                    break;
                }
            }
            for(k=400;k>=0;k--){
                if(board[k][i]>-1){
                    if(hmax<k) hmax=k;
                    break;
                }
            }
        }
        printf("%d %d\n",wmax-wmin+1,hmax-hmin+1);
    }
    return 0;
}

Measured memory_bytes: 1228
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define int long long
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
signed main() {
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;
	string ans = "NO";
	for (int M = 0; M <= N - 1; M++) {
		if (-M * D + (N - M - 1) * C <= B - A && B - A <= -M * C + (N - M - 1) * D) {
			ans = "YES";
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define all(cont)           begin(cont), end(cont)
using ll = long long;
using vi = vector<ll>;


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

	ll n;
	string s;
	cin >> n >> s;
	ll mid = n / 2;
	string a(begin(s), begin(s)+mid);
	string b(begin(s) + mid, end(s));
	if (a == b)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256