akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 200010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    cout << h * w - (h - h % a) * (w - w % b) << endl;
    return 0;
}


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

int main()
{
    string str;

    cin >> str;

    for (int i = 0; i < str.size(); i++) {
        if (i == 5 || i == 13) {
            cout << " ";
        } else {
            cout << str[i];
        }
    }

    cout << endl;

    return 0;
}
    


Measured memory_bytes: 256
# ABC088C - Takahashi's Information
def main():
    *C, = map(int, open(0).read().split())
    memo = {(i - j, j - k) for i, j, k in zip(*[iter(C)] * 3)}
    flg = len(memo) == 1
    print("Yes" if flg else "No")


if __name__ == "__main__":
    main()

Measured memory_bytes: 2940
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
ll calc_d(ll n){
  ll res=0;
  while(n!=0){
    n/=10;
    res++;
  }
  return res;
}
signed main(){
  init_io();
  ll n,tmp,ans=1000000000000000;
  cin >> n;
  for(ll i=1;i*i<=n;i++){
    if(n%i!=0) continue;
    tmp = max(calc_d(i),calc_d(n/i));
    ans = min(ans,tmp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define inf 1000000000000000000

using namespace std;

const int mod=1e9+7;

void run();

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

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,c;
    cin>>n>>c;
    int d[c][c];
    rep(i,c){
        rep(j,c){
            cin>>d[i][j];
        }
    }
    int g[n][n];
    int cnt[3][c];
    memset(cnt,0,sizeof(cnt));
    rep(i,n){
        rep(j,n){
            cin>>g[i][j];
            cnt[(i+j)%3][g[i][j]-1]++;
        }
    }
    int ans=inf;
    rep(i,c){
        rep(j,c){
            if(i==j)continue;
            rep(k,c){
                if(j==k||i==k)continue;
                int t=0;
                rep(l,c){
                    t+=d[l][i]*cnt[0][l]+d[l][j]*cnt[1][l]+d[l][k]*cnt[2][l];
                }
                ans=min(ans,t);
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2176
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

// dpに、i桁まで見た時の最大の桁数を保存するver
const int match[10] = {0,2,5,5,4,5,6,3,7,6};
int n, m, a[10], dp[10010];

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for (int i = 0; i < m; i++) cin >> a[i];
    sort(a, a+m, greater<int>());

    fill(dp, dp+10010, -1);
    dp[0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < m; j++) {
            int prev = i - match[a[j]];
            if (prev >= 0) {
                dp[i] = max(dp[i], dp[prev] + 1);
            }
        }
    }

    string ans = "";
    int cur = n;
    while (cur > 0) {
        for (int i = 0; i < m; i++) {
            if  (cur - match[a[i]] >= 0 && dp[cur] == dp[cur - match[a[i]]] + 1) {
                ans += to_string(a[i]);
                cur -= match[a[i]];
                break;
            }
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using piii = pair<int, pair<int, int>>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;

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

    ll N, A, B;
    cin >> N >> A >> B;

    ll ans = (B - A) >> 1;
    if ((B - A) & 1)
        ans += min(N - B + 1, A);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;

int a[1000000], s[1000000];
signed main(){
	int n, ans = 1;
	scanf("%lld", &n);
	rrep(i,n)scanf("%lld", &a[i]);
	
	rrep(i,n){
		s[a[i]] = s[a[i]-1]+1;
		chmax(ans, s[a[i]]);
	}
	printf("%lld\n", n-ans);
	return 0;
}




Measured memory_bytes: 5888
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue> 
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int maxx = 1e5;
struct node{
	ll day, money;
}e[maxx];

bool cmp(node a, node b)
{
	return a.day < b.day;
}
int main()
{
	int n, m;
	while(~scanf("%d %d",&n,&m))
	{
		for(int i = 0; i < n; i ++) cin >> e[i].day >> e[i].money;
		sort(e, e + n, cmp);
		int id = 0;
		ll ans = 0;
		priority_queue<ll> q;
		for(int i = 1; i <= m; i ++)
		{
			while(e[id].day <= i && id < n)
			{
				q.push(e[id].money);
				id ++;
			}

			if(q.empty()) continue;
            ans += q.top();
            q.pop();
		}
		cout << ans << '\n';
	} 

	return 0;
}




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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define MOD 1e9+7
#define sp ' '


using ll = long long;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}


int main(){

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

    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;

    for(int i = 0; i < n; ++i){
        string tmp = "";
        tmp += s.substr(0, i);
        tmp += t;
        if(tmp.substr(0, s.size()) == s){
            cout << tmp.size() << endl;
            return 0;
        }
    }

    cout << s.size() + t.size() << endl;
    return 0;
}


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


int main() {
  int n,m;
  cin>>n>>m;
  
  dunk(n*(n-1)/2+m*(m-1)/2);
  
  
}

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

/*int main ()
{
  int n;
   cin>>n;
   int a[n];
   unordered_map<int,int> m;
   for(int i=0;i<n;i++)
   {
       m[cin>>a[i],a[i]]++;
   }
   int ans=0;
   sort(a,a+n);
   if(m[1]>0)
   {
       if(m[1]==1)
       cout<<1<<endl;
       else
        cout<<0<<endl;
   }
   else
    {
        for(int i=0;i<n;i++)
       {
            int f=0;
            if(m[a[i]]>1)
            {
                f=1;
                continue;
            }
            else
            {
                for(int k=2;k<=sqrt(a[i]);k++)
                {
                    if(a[i]%k==0)
                    {
                        if((m[a[i]/k])||m[k])
                        {
                            f=1;
                            break;
                        }
                    }
                }
            }
            if(!f)
                ans++;
       }
       cout<<ans<<endl;
   }
}
int main ()
{
    int n;
  cin>>n;
  int64_t a[n+10],ans=1;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  sort(a,a+n);
  if(a[0]==0)
  {
      cout<<0<<endl;
      return 0;
  }
  for(int i=0;i<n;i++)
{
  if(a[i]<=bada/ans)
  {
      ans*=a[i];
  }
  else
  {
      cout<<-1<<endl;
      return 0;
  }
}
  cout<<ans;
}*/
int main()
{
    int64_t a;float b;
    cin>>a>>b;
    int64_t res=round(b*100);
    cout<<res*a/100<<endl;
}



Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ff first
#define ss second
#define pb push_back
#define int long long
typedef pair<int,int> pii;

const int mod = 1e9 + 7;
const int MOD = 998244353;
const int N = 5e5 + 5;


void solve(){
    int a, b, c, k; cin >> a >> b >> c >> k;
    int res = 0;
    res += min(a, k);
    k -= min(a, k);
    k -= b;
    if(k > 0){
        res -= k;
    }
    cout << res << endl;
}

int32_t main(){
    // ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    // cin >> t;
    for(int T = 1 ; T <= t ; T++){
        // cout << "Case #" << T << ": " << endl;
        solve();
    }
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
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;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll n,c;
ll x[100100];
ll v[100100];

ll cx[100100]={};
ll c2x[100100]={};
ll c_cx[100100]={};
ll c_c2x[100100]={};

ll mcx[100100]={};
ll mc2x[100100]={};
ll mc_cx[100100]={};
ll mc_c2x[100100]={};
int main(){
	cin>>n>>c;
	FOR(i,1,n+1)
		cin>>x[i]>>v[i];
	ll sum=0;
	FOR(i,1,n+1){
		sum+=v[i];
		cx[i]=sum-x[i];
		c2x[i]=sum-(2*x[i]);
	}
	sum=0;
	for(int i=n;i>=1;i--){
		sum+=v[i];
		c_cx[i]=sum-(c-x[i]);
		c_c2x[i]=sum-(2*(c-x[i]));
	}
	/*FOR(i,0,n+2){
		cout<<i<<" "<<cx[i]<<" "<<c2x[i]<<" "<<c_cx[i]<<" "<<c_c2x[i]<<endl;
	}
	cout<<endl;*/
	FOR(i,1,n+1){
		mcx[i]=max(mcx[i-1],cx[i]);
		mc2x[i]=max(mc2x[i-1],c2x[i]);
	}
	for(int i=n;i>=1;i--){
		mc_cx[i]=max(mc_cx[i+1],c_cx[i]);
		mc_c2x[i]=max(mc_c2x[i+1],c_c2x[i]);
	}
	/*FOR(i,0,n+2){
		cout<<i<<" "<<mcx[i]<<" "<<mc2x[i]<<" "<<mc_cx[i]<<" "<<mc_c2x[i]<<endl;
	}*/
	ll ans=0;
	for(int i=0;i<=n;i++){
		ans=max(ans,mcx[i]+mc_c2x[i+1]);
	}
	for(int i=0;i<=n;i++){
		ans=max(ans,mc2x[i]+mc_cx[i+1]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}



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

  bool d[21000]={};
  int a=0,b=0;
  while(a*a+b*b<20000){
    int s=a*a+b*b;
    int t=s;
    if(t>0)
    while(t<20000){
      d[t]=true;
      t+=s;
    }
    a++;
    if(a*a+b*b>20000){
      b++;
      a=0;
    }
  }


  int t;
  cin>>t;
  while(t--){
    int p,q;
    cin>>p>>q;
    int m=-200,n=-200;
    int sum=0;
    while(true){
      int s=m*m+n*n;
      int a=m*p+n*q;
      int b=m*q-n*p;
      if(s&&a%s==0&&b%s==0){
        if((p*p+q*q)%s==0)
        sum+=d[(p*p+q*q)/s];
      }
      m++;
      if(m==200){
        if(n==200) break;
        n++;
        m=-200;
      }
    }

    cout<<(sum>8?'C':'P')<<endl;
  }

}



Measured memory_bytes: 3076
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

class mint {
public:
    static long long MOD;
    mint() :value(0) {}
    mint(long long val) :value(val<0 ? MOD + val % MOD : val % MOD) { }
    mint& operator+=(mint that) {
        value = value + that.value;
        if (value >= MOD)value -= MOD;
        return *this;
    }
    mint& operator-=(mint that) {
        value -= that.value;
        if (value<0)value += MOD;
        return *this;
    }
    mint& operator*=(mint that) {
        value = value * that.value % MOD;
        return *this;
    }
    mint &operator/=(mint that) {
        return *this *= that.inverse();
    }
    mint operator+(mint that) const {
        return mint(*this) += that;
    }
    mint operator-(mint that) const {
        return mint(*this) -= that;
    }
    mint operator*(mint that) const {
        return mint(*this) *= that;
    }
    mint operator/(mint that) const {
        return mint(*this) /= that;
    }
    mint operator^(long long k) const {
        if (k == 0)return 1;
        if (value == 0)return 0;
        mint n = *this, res = 1;
        while (k) {
            if (k & 1)res *= n;
            n *= n;
            k >>= 1;
        }
        return res;
    }
    mint inverse() const {
        long long a = value, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return mint(u);
    }
    long long toll() const { return value; }
    int toi() const { return (int)value; }

private:
    long long value;
};
long long mint::MOD = 1000000007ll;
ostream& operator<<(ostream& os, const mint& x) {
    os << x.toi();
    return os;
}

vector<vector<int>> combinations(int n, int mod) {
    auto res = vector<vector<int>>(n + 1, vector<int>(n + 1));
    rep(i, n + 1) res[i][0] = 1;
    for (int i = 1; i <= n; ++i) for (int j = 1; j <= i; ++j)
        res[i][j] = (res[i - 1][j - 1] + res[i - 1][j]) % mod;
    return res;
}

void solve() {
    int P;
    cin >> P;
    mint::MOD = P;

    vector<mint> b(P);
    auto C = combinations(P, P);
    rep(i, P) {
        int a;
        cin >> a;
        if (a) {
            b[0] += 1;
            mint pw = 1;
            for (int j = P - 1; j >= 0; --j) {
                b[j] -= pw * C[P - 1][j];
                pw *= -i;
            }
        }
    }
    rep(i, P)cout << b[i] << (i == P - 1 ? '\n' : ' ');
}

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

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

using namespace std;

int main(void) {
    int n;
    string s;
    while (cin >> n, n) {
        int dice[] = {1, 2, 3, 4, 5, 6}, a, b, c, d, ans = 0;
        
        for (int i = 0; i < n; i++) {
            cin >> s;
            if (s == "North")
                a = 0, b = 1, c = 5, d = 4;
            else if (s == "East")
                a = 0, b = 3, c = 5, d = 2;
            else if (s == "West")
                a = 0, b = 2, c = 5, d = 3;                
            else if (s == "South")
                a = 0, b = 4, c = 5, d = 1;
            else if (s == "Right")
                a = 1, b = 2, c = 4, d = 3;
            else
                a = 1, b = 3, c = 4, d = 2;

            swap(dice[a], dice[b]);
            swap(dice[b], dice[c]);
            swap(dice[c], dice[d]);

            ans += dice[0];
        }

        cout << ans + 1 << endl;
    }

    return 0;
}


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

int main() {
  while(true){
    int h,w;
    cin >> h >> w;
    if(h == 0&&w == 0) return 0;
    for(int i = 0;i < h;i++){
      for(int j = 0;j < w;j++){
        if(i%2 == j%2) cout << '#';
        else cout << '.';
        if(j == w-1) cout << "" << endl;
      }
    }
    cout << "" << endl;
  }
}



Measured memory_bytes: 3108
#include <iostream>
#include <string>
using namespace std;
int main()
{
  long long n;
  cin>>n;
  long long ta=1;
  for(int i=1;i<n+1;i++){
      ta *= i;
      ta=ta%1000000007;
  }
  cout<<ta<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void){
    int n,t,i,ans=0;
    double a,min=1000000;
    scanf("%d %d %lf",&n,&t,&a);
    int h[n];
    for(i=0;i<n;i++) scanf("%d",&h[i]);
    for(i=0;i<n;i++){
        double tmp=t-h[i]*0.006;
        if(min>fabs(a-tmp)){
            min=fabs(a-tmp);
            ans = i+1;
        }
    }
    printf("%d",ans);
}

Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>

int main(void)
{
    int n, m, i, count=0;
    float t=0.0;

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

    t /= 4*m;

    for(i=0; i<n; i++) {
        if(A[i] >= t) {
            count++;
        }
    }

    if(count >= m) {
        printf("Yes\n"); 
    } else {
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 1644
#include<bits/stdc++.h>
using namespace std;
 
vector<vector<int> > bookKnowledges;
vector<int> bookPrices;
int M;
 
int main(){
    int n, m, x;
    cin>>n>>m>>x;
    bookKnowledges.resize(n, vector<int>(m, 0));
    bookPrices.resize(n, 0);

    for(int i = 0; i < n; i++){
        cin>>bookPrices[i];
        for(int j = 0; j < m; j++){
            cin>>bookKnowledges[i][j];
        }
    }
    
    int result = INT_MAX;
    M = pow(2, n);

    for(int i = 0; i < M; i++){
        vector<int> myVect(m, 0);
        int tempCostBooks = 0;

        for(int j = 0; j < n; j++){
            if(i >> j & 1){
                for(int k = 0; k < m; k++){
                    myVect[k] += bookKnowledges[j][k];
                }
                tempCostBooks += bookPrices[j];
            }
        }
        int flag = 1;
        for(auto i : myVect) if(i < x) flag = 0;
        if(flag == 1){
            result = min(tempCostBooks, result);
        }
    }

    if(result != INT_MAX){
        cout<<result<<endl;
    }
    else{
        cout<<"-1"<<endl;
    }
}

Measured memory_bytes: 4084
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
using std::swap;
using std::max;
using std::min;
using std::sort;
#include <queue>
using std::priority_queue;

typedef long long LL;

const int N = 1e5 + 10;

int n, k, dif = 0;
char s[N];

int main() {
  scanf("%d %d", &n, &k);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i) {
    if (i == 1)
      continue;
    if (s[i] != s[i - 1])
      ++dif;
  }
  printf("%d\n", n - 1 - dif + min(dif, k * 2));
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int a;
	cin >> a;
	cout << a + pow(a, 2) + pow(a, 3) << endl;
}

Measured memory_bytes: 4024
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <set>
#include <iterator>

using namespace std;

typedef long long ll;
#define mems(p) memset(p,0,sizeof(p))
#define mp make_pair

void fast()
{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

	int n,m,x;
	int c[12];
	int a[12][12];

pair<int,bool> minim(int idx, vector<int> und) {
	bool bb = true;
	if (idx == n) {
		for (int unn:und){
			if (unn < x) {
				bb = false;
				break;
			}
		}
		return mp(0, bb);
	}
	pair<int,int> aa = minim(idx+1, und);
	vector<int> cund(m);
	for (int i = 0;i < m;++i){
		cund[i] = und[i]+a[idx][i];
	}
	pair<int,int> aaa = minim(idx+1, cund);
	if (aa.second && aa.first < aaa.first + c[idx]) {
		//cout << idx<<" first\n";
		return aa;
	} else if (aaa.second) {
		//cout << idx<<" second\n";
		return mp(aaa.first + c[idx], aaa.second);
	}
  	return aa;
}

int main() {

	cin>>n>>m>>x;
	for (int i = 0;i<n;++i){
		cin >> c[i];
		for (int j = 0; j < m; ++j)
		{
			cin >> a[i][j];
		}
	}

	vector<int> und(m, 0);

	pair<int,int> aa = minim(0, und);
	if (aa.second) {
		cout << aa.first << endl;
	} else {
		cout << -1 << endl;
	}
}


Measured memory_bytes: 3636
n, m , c = map(int, input().split())
b_li = list(map(int, input().split()))
ans = 0
for i in range(n):
    a_li = list(map(int, input().split()))
    if sum(a * b for a, b in zip(a_li, b_li)) + c > 0:
        ans += 1
print(ans)


Measured memory_bytes: 2940
/*
[abc142] B - Roller Coaster
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define ALL(c) (c).begin(), (c).end()

const int MAX_N = 1e5;

int N, K;
int h[MAX_N];

ll solve() {
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (h[i] >= K) {
            cnt++;
        }
    }

    return cnt;
}

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

    cout << solve() << endl;

    return 0;
}


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

string solve() {
    ll S, W;
    cin >> S >> W;
    if ( W >= S ) return "unsafe";
    else return "safe";
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3628
n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]

from itertools import permutations
import math
m = math.factorial(n)
per = permutations(xy,n)

d = 0
c = 0
for j in per :
    for i in range(n-1):
        d += ((j[i+1][0]-j[i][0])**2 + (j[i+1][1]-j[i][1])**2) ** 0.5

print(d/m)


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

int main() {
  int h,  a;
  cin >> h >> a;
  int count = 0;
  while (h - count * a > 0) count++;
  cout << count << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int checkdigit(int num)
{
	int i=1;
	while((num/=10)>0)
	{
		i++;
	}
	return i;
}

int main()
{
	char str[22];
	int num1,num2;
	
	while(scanf("%d %d",&num1,&num2)>0)
	{

		printf("%d\n",checkdigit(num1+num2));
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define lp(i, n) for (int i = 0; i < n; i++)
#define pb push_back
#define ll long long
#define ii pair<string,int>ii;

string IntToStr(int tmp){
    ostringstream out;
    out << tmp;
    return out.str();
}

int main()
{
    ll n,m=0,sum=0;
    cin>>n;
    while(n--){
        ll x;
        cin>>x;
        sum+=x;
        m=max(x,m);
    }
    cout<<sum-m/2<<endl;
}














Measured memory_bytes: 256
//...Bismillahir Rahmanir Rahim...
// Code by    Asad Bin Saber

#include <bits/stdc++.h>

using namespace std;

// typedefs...
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;

// constants...
const double PI = acos(-1);

// defines...
#define MP make_pair
#define PB push_back
#define fi first
#define se second
#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sl(a) scanf("%lld", &a)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)

ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
ll lcm(ll a, ll b)
{
    return (a/gcd(a, b)*b);
}
ll comb(ll a, ll b)
{
    ll x = max(a-b, b), ans=1;

    for(ll K=a, L=1; K>=x+1; K--, L++){
        ans *= K;
        ans /= L;
    }

    return ans;
}


void task()
{
    //code here...
    
    int a, b, h, m, ans;
    
    cin >>  a >> b >> h >> m;
    
    ans = h*60 - 11*m;
    if(ans<0) ans = -1*ans;
    
    double mid = (ans*PI/360);
    
    mid = 1.0*a*a + 1.0*b*b - 2*a*b*cos(mid);
    
    printf("%0.10lf\n", sqrt(mid));
}
 
int main()
{
    //ios_base::sync_with_stdio(0);
    //cin.tie(0);

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

    task();

    return 0;
}



Measured memory_bytes: 4160
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        for(int i=1;i<=5;i++){
            int num = sc.nextInt();
            if(num == 0){
                System.out.println(i);
            }
        }
    }
}


Measured memory_bytes: 35764
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 200'000;
const int LOGN = 19;

int n, m, k;
void solve(int test)
{
  string s, t;
  cin >> s >> t;
  int ans = 0;
  for (int i = 0; i < 3; ++i) {
    ans += s[i] == t[i];
  }
  cout << ans;
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


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

N, W = map(int, input().split())
B = [list(map(int, input().split())) for _ in range(N)]
INF = 10**10
dp = [[INF]*(10**5+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
    w, v = B[i]
    for j in range(10**5+1):
        if j-v >= 0:
            dp[i+1][j] = min(dp[i][j], dp[i][j-v]+w)
        else:
            dp[i+1][j] = dp[i][j]
for i in range(10**5, -1, -1):
    if dp[N][i] <= W:
        print(i)
        break


Measured memory_bytes: 119788
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    ll A;
    ll B = 0;
    char c;
    cin >> A;
    cin >> c;
    B += (c-'0')*100;
    cin >> c;
    cin >> c;
    B += (c-'0')*10;
    cin >> c;
    B += (c-'0');



    cout << A*B/100 << "\n";

}


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

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 ***/

int main(){
    double pai=3.141592653589;
    int h,w;
    for(;;){
        scanf("%d %d",&h,&w);
        if(h==0 && w==0) break;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if((i+j)%2==0){
                    printf("#");
                }else{
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    // cout << setprecision(5);
    // cout << a / b << " " << a % b << " " << (double)a / (double)b << endl;
    printf("%d %d %.8lf\n", a / b, a % b, (double)a / (double)b);
}


Measured memory_bytes: 3196
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <iterator>
#include <string>
#include <cmath>

# define PI 3.14159265358979323846

using namespace std;

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

    int sockets = 1;
    int strips = 0;
    while (sockets < b) {
        sockets--;
        sockets += a;
        strips++;
    }
    cout << strips << endl;
}


Measured memory_bytes: 256
import itertools
x,y,z,k = map(int,input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
A,B,C =A[:k],B[:k],C[:k]
AB = sorted(list(i+j for i in A for j in B), reverse=True)[:k]

ABC = sorted(list(i+j for i in AB for j in C),reverse = True)[:k]

for i in ABC:
    print(i)

Measured memory_bytes: 187108
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main(){
	double A, B;
	cin >> A >> B;

	double tax1 = 0.08;
	double tax2 = 0.10;

	int t1_min = ceil(A / tax1); // 税8%の時に税がA円となる税抜き価格の候補の最小値
	int t1_max = ceil((A + 1) / tax1) - 1; // 税8%の時に税がA円となる税抜き価格の候補の最大値

	int t2_min = ceil(B / tax2); // 税10%の時に税がB円となる税抜き価格の候補の最小値
	int t2_max = ceil((B + 1) / tax2) - 1; // 税10%の時に税がB円となる税抜き価格の候補の最大値

	int ans;
	if (t1_max < t2_min || t2_max < t1_min) ans = -1;
	else ans = max(t1_min, t2_min);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		int nam = in.nextInt();
		int namber = 0;
		int flag = 0;

		for(long i = 0; i < nam; i++){
		   namber =  in.nextInt();
		   if(namber % 2 == 0){
		        flag = 1;
		       if(namber % 3 == 0 || namber % 5 == 0 ){
		           flag = 0;
		       }
		       if(flag == 1){
		           System.out.println("DENIED");
		           System.exit(0);
		       }
		   }
		}
      
      System.out.println("APPROVED");
	}
}

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

using namespace std;

int main(){
	int n, k;
  cin >> n >> k;
  vector<int> P(n);
  for (auto &p: P)
    cin >> p;
  
  sort(P.begin(), P.end());
  cout << accumulate(P.begin(), P.begin() + k, 0L) << endl;
}

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

long long atack(long long x){
    if(x==1){
        return 1; 
    }
    long long y=2*atack(x/2);
    return y+1;
}

int main(void){
    // Your code here!
    long long H;cin>>H;
    long long ans=atack(H);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3608
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
using namespace std;
#define LONG_INF 10000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353LL
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
class Point{
public:
	long double x;
	long double y;
	const Point operator*(const double &a) {
		Point ans;
		ans.x = x * a;
		ans.y = y * a;
		return ans;
	}
	const Point operator=(const Point &a){
		x = a.x;
		y = a.y;
		return *this;
	}
	const Point operator+(const Point &a) const{
		Point ans;
		ans.x = a.x + x;
		ans.y = a.y + y;
		return ans;
	}
	const Point operator+=(const Point &a){
		x += a.x;
		y += a.y;
		return *this;
	}
	const Point operator-(const Point &a) const{
		Point ans;
		ans.x = x - a.x;
		ans.y = y - a.y;
		return ans;
	}
	const Point operator-=(const Point &a) {
		x -= a.x;
		y -= a.y;
		return *this;
	}
	static long double inner(const Point &a, const Point &b) {
		return a.x * b.x + a.y * b.y;
	}
	static Point norms(const Point &a) {
		long double hoge = abs(a);
		Point ans;
		ans.x = a.x / hoge;
		ans.y = a.y / hoge;
		return ans;
	}
	static long double abs(const Point &a) {
		return sqrt(a.x * a.x + a.y * a.y);
	}
};
int main(){
	Point a, b;
	cin >> a.x >> a.y;
	cin >> b.x >> b.y;
	b -= a;
	int query;
	cin >> query;
	REP(i, query) {
		Point c;
		cin >> c.x >> c.y;
		c -= a;
		double multiply = Point::inner(b, c) / Point::abs(b);
		Point ans = a + Point::norms(b) * multiply;
		cout << fixed << setprecision(11);
		cout << ans.x << " " << ans.y << endl;
	}
	return 0;
}


Measured memory_bytes: 3308
// general helpers
const debug = (message?: any, ...optionalParams: any[]) => {
  if (process.env.LOCAL_DEBUG === '1') console.log(message, ...optionalParams)
}

// helpers
const parseLines = (
  lines: string[]
): any => {
  let tmp = ``
  const tmp = lines[0].split(` `)
  const A = +tmp[0]
  const B = +tmp[1]
  const obj = { A, B }
  debug(obj)
  return obj
}

// solver
export const solve = (lines: string[]): string => {
  const { A, B } = parseLines(lines)

  let count = 1
  let result = 0
  while(true) {
    if (B <= count) {
      return `${result}`
    }
    count += A - 1
    result++
  }
}

// main
const main = (lines: string[]) => {
  console.log(solve(lines))
}

// exec main function for submit
if (process.env.LOCAL_DEBUG !== '1') {
  const { stdin: input, stdout: output } = process
  input.resume()
  input.setEncoding('utf8')
  const lines: string[] = []
  require('readline')
    .createInterface({ input, output })
    .on('line', (line: string) => lines.push(line))
    .on('close', () => main(lines))
}


Measured memory_bytes: 7628
#include<bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; i++)
typedef long long ll;

long long INF = 1e18;

int main(){
        string s;
        cin>>s;
        if( s == "ABC"){
                cout<<"ARC"<<endl;
        }else{
                cout << "ABC" <<endl;
        }
        return 0;
}


Measured memory_bytes: 3548
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <list>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(d) string(1,d)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  ll n;
  cin >> n;
  vector<ll> v;
  vector<ll> v1;
  vector<ll> v2;
  rep(i, 0, n) {
    ll a;
    cin >> a;
    v.pb(a);
    if (i % 2 == 0) {
      v1.pb(a);
    }
    else {
      v2.pb(a);
    }
  }
  sort(all(v));
  sort(all(v1));
  sort(all(v2));
  int c1 = 0;
  int c2 = 0;
  int index1 = 0;
  int index2 = 0;
  rep(i, 0, v.sz) {
    ll a = v[i];
    if (i % 2 == 0) {
      if (v1[index1] == a) {
        index1++;
      }
      else {
        c2++;
        index2++;
      }
    }
    else {
      if (v2[index2] == a) {
        index2++;
      }
      else {
        c1++;
        index1++;
      }
    }
  }
  cout << c1 << endl;
  return 0;
}




Measured memory_bytes: 2168
#include<stdio.h>
#include<stdlib.h>

int abs(int x){
 if(x<0){
  return -x; 
 }else{
  return x; 
 }
  
}

int main(void){
  
  char s[11];
  
  scanf("%s",s);
  
  int i;
  int l;
  int ans=999;
  
  for(l=0;s[l]!='\0';l++);

  
  for(i=0;i+2<=l-1;i++){

    int a=(s[i+2]-'0')+(s[i+1]-'0')*10+(s[i]-'0')*100;
   
    int d=abs(753-a);
    
    if(d<ans) ans=d;
    
  }

 printf("%d",ans);
 return 0; 
  
}


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

#define int long long
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define yn(x) ((x) ? "Yes" : "No")

typedef pair <int, int> ii;
typedef pair <int, ii> iii;

const int siz = 2e5 + 10;
const int SIZ = 1e6 + 10;
const int mod = 998244353;
const int maxx = 2e9;
const int MAXX = 1e18;
const string file = "3";

int seg[4 * siz];

void update(int id, int st, int ed, int pos, int val) {
    if (st == ed) {
        seg[id] += val;
        return;
    }

    int mid = (st + ed) / 2;
    if (pos <= mid) {
        update(2 * id, st, mid, pos, val);
    } else {
        update(2 * id + 1, mid + 1, ed, pos, val);
    }

    seg[id] = (seg[2 * id] + seg[2 * id + 1]) % mod;
}

int query(int id, int st, int ed, int lt, int rt) {
    if (rt < st || ed < lt) {
        return 0;
    }

    if (lt <= st && ed <= rt) {
        return seg[id];
    }

    int mid = (st + ed) / 2;
    int s1 = query(2 * id, st, mid, lt, rt);
    int s2 = query(2 * id + 1, mid + 1, ed, lt, rt);

    return ((s1 + s2) % mod);
}

ii a[11];

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

//    freopen ((file + ".inp").c_str(), "r", stdin);
//    freopen ((file + ".out").c_str(), "w", stdout);

    int n, k;
    cin >> n >> k;

    for (int i = 1; i <= k; i++) {
        cin >> a[i].fi >> a[i].se;
    }

    update(1, 1, n, 1, 1);
    for (int i = 2; i <= n; i++) {
        int f = 0;
        for (int j = 1; j <= k; j++) {
            (f += query(1, 1, n, max(i - a[j].se, 0LL), max(i - a[j].fi, 0LL))) %= mod;
        }

        update(1, 1, n, i, f);
    }

    cout << query(1, 1, n, n, n) << "\n";

//    cerr << "Time: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

    return 0;
}


Measured memory_bytes: 7736
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define last Last
#define int long long
const int N=1e5+5;
int n,m,a[N],b[N],c[N],dp[N];
vector<int>g[N];
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
#define gc getchar
inline int read()
{
	int ret=0,f=0;char c=gc();
	while(!isdigit(c)){if(c=='-')f=1;c=gc();}
	while(isdigit(c)){ret=ret*10+c-48;c=gc();}
	if(f)return -ret;return ret;
}
signed main()
{
	n=read();m=read();
	for(int i=1;i<=m;i++)
	{
		a[i]=read();
		b[i]=read();
		for(int j=1;j<=b[i];j++)
		{
			int x=read();
			c[i]|=(1<<(x-1));
			g[x].push_back(i);
		}
	}
	for(int i=1;i<=n;i++)
		if(g[i].size()==0){puts("-1");return 0;}
	memset(dp,0x3f,sizeof(dp));
	dp[0]=0;
	for(int i=0;i<(1<<n);i++)
	{
		for(int j=1;j<=n;j++)
			if(!(i&(1<<j)))
			{
				for(int k=0;k<g[j].size();k++)
				{
					int v=g[j][k];
					dp[i|c[v]]=min(dp[i|c[v]],dp[i]+a[v]);
				}
			}
	}
	cout<<dp[(1<<n)-1];
}

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

//define ll long long;
//define ar array;

const int N = 2e5+1;
long long arr[N];

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

    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> arr[i];
    }
    sort(arr, arr+n);
    long long ans;
    ans = arr[n-1];
    int cnt = n-2;

    for (int i = n-2; i >= 0; i--){
        if (cnt > 0){
            ans += arr[i];
            cnt--;
        }
        else {
            break;
        }
        if (cnt > 0){
            ans += arr[i];
            cnt--;
        }
        else {
            break;
        }

    }

    cout << ans << endl;

    return 0;
}



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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int64_t> alist(N);
  for (int i = 0; i < N; i++) {
    cin >> alist.at(i);
  }
  sort(alist.begin(), alist.end());
  
  vector<pair<int64_t, int64_t>> cblist(M);
  for (int i = 0; i < M; i++) {
    cin >> cblist.at(i).second >> cblist.at(i).first;
  }
  sort(cblist.begin(), cblist.end());
  reverse(cblist.begin(), cblist.end());

  
  int sansyou=0;
  for (int i = 0; i < N; i++) {
    if (cblist.at(sansyou).second<=0 && sansyou<M-1) sansyou++;
    if (cblist.at(sansyou).second<=0 && sansyou==M-1) break;
    if (cblist.at(sansyou).first >= alist.at(i)) {
      alist.at(i)=cblist.at(sansyou).first;
      cblist.at(sansyou).second--;
    }
    else break;
  }
  
  int64_t ans = 0;
  for (int i = 0; i < N; i++) {
    ans += alist.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define fi           first
#define se           second
#define ll           long long
#define pb           push_back
#define mp           make_pair
#define pll          pair<ll,ll>
#define pii          pair<int,int>
#define SZ(x)        ((int)(x).size())
#define READ(x)      freopen(x,"r",stdin)
#define WRITE(x)     freopen(x,"w",stdout)
#define all(x)       (x).begin(),(x).end()
#define isWorking()  cout<<"Wroking"<<endl
#define FOR(i,x,y)   for(int i=x; i<y; i++)
#define SORT(x)      sort(x.begin(),x.end())
#define PRINT(ok)    cout<<(ok? "YES":"NO")<<endl
#define Fast_Input   ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
typedef vector<int> VI;
const ll mod= 1e9+7,INF=1e18,mx= 1e6+5,mn=100;
int testCase=1,cas=0;

int main() {

    Fast_Input

    //cin>>testCase;
    while(testCase--) {
        ll a,b,x; cin>>a>>b>>x;
        ll yy= b/x;
        ll zz= (a-1)/x;

        if(zz<0) zz=0;
        ll ans= yy-zz;

        if(b==0 || a==0) ans++;
        cout<<ans<<endl;
    }
    return 0;
}


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

int main(){
  vector<int> A(3);
  rep(i,3) cin >> A[i];
  sort(A.rbegin(),A.rend());
  cout << A[0]*10 + A[1] + A[2] << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(){
    ll N;cin>>N;
    cout<<N*(N-1)/2;
}

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

using namespace std;
int main(){
    long long s,y,k,x;
    cin>>s;
    k=s%1000;
    s=s/10;
    if(k>753){
        x=k-753;
    }
    else x=753-k;
    while(s>0){
     k=s%1000;
    s=s/10;
    if(k>753){
        y=k-753;
    }
    else y=753-k;
    if(y<x)
        x=y;
    }
    cout<<x<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  char s[32], *c;
  int cnt[256]={0};
  char *out = "yes";
  scanf("%s", s);
  for(c=s; *c!='\0'; ++c){
    if(++cnt[*c]>1){
      out = "no";
      break;
    }
  }
  printf("%s\n", out);
  return 0;
}

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

#define int long long

signed main() {
	string s; cin >> s;
	int n = s.length();
	vector<string> v;
	string str(1,s[0]);
	v.push_back(str);
	int i = 1,j = 1;
	while(i<n) {
		if(v[j-1].length()==1) {
			if(s[i]==v[j-1][0]) {
				str = s[i]+s[i+1];
				v.push_back(str);
				i += 2;
				j++;
			}
			else {
				if(i==n-2) {
					if(s[i]==s[i+1]) {
						str = s[i] + s[i+1];
						v.push_back(str);
						break;
					}
					else {
						str = str = s[i];
						v.push_back(str);
						str = s[i+1];
						v.push_back(str);
						break;
					}
				}
				else {
					str = s[i];
					v.push_back(str);
					i++;
					j++;
				}
			}
		}
		if(v[j-1].length()==2) {
			str = s[i];
			v.push_back(str);
			i++;
			j++;
		}
	}
	cout << v.size() << endl;
	return 0;
}

Measured memory_bytes: 10996