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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vvi A(2, vi (n));
  rep(i, 0, 2) {
    rep(j, 0, n) {
      cin >> A[i][j];
    }
  }
  int ans = 0;
  rep(i, 0, n) {
    int tmp = 0;
    rep(j, 0, i+1) {
      tmp += A[0][j];
    }
    rep(j, i, n) {
      tmp += A[1][j];
    }
    ans = max(ans, tmp);
  }

  cout << ans << endl;

  return 0;
};


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,q,h,s,d,ma;
int main()
{
    cin>>q>>h>>s>>d>>n;
    ma=min(min(2*q,h)*4,min(s*2,d));
    cout<<n/2*ma+(n%2)*min(min(2*q,h)*2,s);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
  string S;
  cin>>S;
  int l=S.size();
  for(int i=0;i<l-1;i++){
    if(S[i]=='A'&&S[i+1]=='C'){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
'use strict'

const main = arg => {
    var input = arg.trim().split("\n");
    const lastIndex = input.indexOf("0 0");
    const nums = input.slice(0, lastIndex);
    const result = [...Array(nums.length)].map(obj => (0));

    const callback = (num, max, target, i) => {
        if(num.length >= 3){ return; }
        for(var j=num[num.length-1]+1;j<=max;j++){
            const newNum = [...num];
            newNum.push(j);
            const sum = newNum.reduce((a, b) => a + b);
            if(100 < newNum.length){ break; }
            if(sum === target ){
                if(newNum.length < 3){break;} 
                //    console.log("nums:"+JSON.stringify(newNum));
                result[i]++; 
            }
            if(sum < target){ 
                callback(newNum, max, target, i);
            } else {
                break;
            }
        }
    }

    nums.forEach((row,num) => {
        const next = row.split(" ").map(str => parseInt(str, 10));
        const n = next[0];
        const x = next[1];

        for(var i=1;i<=n;i++){
            callback([i], n, x, num);
        }
    });

    console.log(result.join("\n"));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 20096
my $n = get;
my @a = (1..$n).map(-> $_ {
	my ($a, $b) = get.words;
	$a == $b;
});
for 0..$n-3 -> $i {
	if @a[$i] && @a[$i+1] && @a[$i+2] {
		say "Yes";
		exit;
	}
}
say "No";

Measured memory_bytes: 89536
#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);

int k;

void solv()
{
    scanf("%d", &k);
    double x = 0, y = 0;
    double a = 0;
    int ans = 0;
    while (1)
    {
        x += sin(a);
        y += cos(a);
        a += (double)k / 360 * acos(-1);
        ++ans;
        if (abs(x) < 0.00001 && abs(y) < 0.00001)
            break;
    }
    printf("%d\n", ans / 2);
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


Measured memory_bytes: 4128
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  auto n = readln.chomp.to!int;
  auto s = readln.chomp;
  int res;
  auto prev = 'S';
  foreach (e; s) {
    if (prev != e) {
      res++;
      prev = e;
    }
  }
  res.writeln;
}


Measured memory_bytes: 2428
#include<stdio.h>

int main()
{
	int TC;
  	scanf("%d", &TC);
  	long long int nums[TC], max = 1e18, prod = 1, flag = 0, zero = 0;
	for (int i = 0; i < TC; i++)
		{
    	scanf("%lld", &nums[i]);
   		flag = (nums[i] > max) ? 1 : flag;
    	prod *= nums[i];
    	(nums[i]) ? max /= nums[i] : zero = 1;
  		}

  	(zero) ? puts("0") : ((flag) ? puts("-1") : printf("%lld\n", prod));
  	return 0;
}


Measured memory_bytes: 2508
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb; 
typedef long long ll;  
typedef double db;                         
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, N = 1e5 + 48, mod = 1e9 + 7, maxn = 102;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;


int n, a[204], k, dp[N]; 



main () {
	cin >> n >> k;		
	forn (i, 1, n)
		cin >> a[i];

	forn (x, 1, k)
		forn (i, 1, n) {
			if (a[i] > x)        
				break;

			if (!dp[x - a[i]]) {
				dp[x] = 1;		 
				break;
			}
		}

	puts(dp[k] ? "First" : "Second");
}                       

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

int main() {
  int N, M, K[30], A[30][30];
  int count_total = 0;

  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    cin >> K[i];
    for (int j = 0; j < K[i]; j++) {
      cin >> A[i][j];
    }
  }

  for (int i = 1; i <= M; i++) {
    int count_kind = 0;
    for (int j = 0; j < N; j++) {
      for (int k = 0; k < K[j]; k++) {
        if (A[j][k] == i) count_kind++;
      }
    }
    if (count_kind == N) count_total++;
  }

  cout << count_total << endl;

  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double eps = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1};

int main() {
	// cin.tie(0); // tie
	// ios::sync_with_stdio(false); // sync
	int a, L;
	while (cin >> a >> L, L) {
		char s[32] = "";
		map<int, int> m;
		m[a] = 0;

		int i = 1;
		while (1) {
			sprintf(s, "%0*d", L, a);
			sort(s, s + L);
			int x = strtol(s, 0, 10);
			reverse(s, s + L);
			int y = strtol(s, 0, 10);
			a = y - x;
			if (!m.insert(make_pair(a, i)).second) break;
			++i;
		}

		int j = m[a];
		cout << j << ' ' << a << ' ' << i - j << endl;
	}
	return 0;
}

Measured memory_bytes: 1264
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
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 dp[3005][3005] ;
 ll ep[3005][3005] ;

 int main(){
 ll n,t ; cin>>n>> t ;
 vector<ll> A(n),B(n) ;
 rep(i,n) cin>>A[i]>>B[i] ;
 rep(i,3005){
   dp[0][i]=0 ;
   ep[0][i]= 0;
 }
 
 rep(i,n){
   rep(j,3005){
    if(j>=A[i]) dp[i+1][j]= max(dp[i][j-A[i]]+B[i],dp[i][j]) ;
    else dp[i+1][j]= dp[i][j] ;

    if(j>=A[n-1-i]) ep[i+1][j]=max(ep[i][j-A[n-1-i]]+B[n-1-i],ep[i][j]) ;
    else ep[i+1][j]= ep[i][j] ;

   }
 }
 
 ll ans= 0 ;

 rep(i,n){
  rep(j,t){
    chmax(ans, dp[i][j]+ep[n-1-i][t-1-j]+B[i]) ;
  }
 }

 cout<<ans<<endl ;

   return 0 ;
 }



Measured memory_bytes: 144556
N,M,X=map(int,input().split())
A=[int(i) for i in input().split()]
cost0=0
costN=0

for i in range(X):
    if i in A:
        cost0+=1

for i in range(X+1,N):
    if i in A:
        costN+=1

print(min(cost0,costN))

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

#define PI 3.14159265359
#define EPS 1e-16
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = (a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (a); i <= (long long)(n); i++)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std;

int main(void)
{
    int n; 
    cin >> n;
    string s;
    cin >> s;
    
    int k = 0;
    int m = 0;
    irep(i, n) {
        if(s[i] == '(') {
            k++;
        } else {
            k--;
        }
        m = min(k, m);
    }
    cout << string(-m, '(') << s << string(k-m, ')') << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main()
{
    int N;
    cin >> N;
    vector<int> ue(N);
    vector<int> dn(N);
    rep(i, N) cin >> ue.at(i);
    rep(i, N) cin >> dn.at(i);
    int mx = 0;

    rep(i, N)
    {
        int candy = 0;
        rep(n, i + 1)
        {
            candy += ue.at(n);
        }
        rep2(m, i, N)
        {
            candy += dn.at(m);
        }
        mx = max(mx, candy);
    }
    cout << mx << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
#include<cstdio>
using namespace std;

typedef long long ll;
 bool check[100100]={false};

int main(){
    ll ans=0;
    int n,k,r,s,p;
    cin>>n>>k>>r>>s>>p;
    string t;
    cin>>t;
    for(int i=0;i<n;i++){
       if(i>=k&&check[i-k]==false){
           check[i]=true;
           if(t[i]=='r'){ans+=p;}
           else if(t[i]=='s'){ans+=r;}
           else{ans+=s;}
       }else if(i<k){
           check[i]=true;
           if(t[i]=='r'){ans+=p;}
           else if(t[i]=='s'){ans+=r;}
           else{ans+=s;}
       }else if(i>=k&&t[i]!=t[i-k]){
           check[i]=true;
           if(t[i]=='r'){ans+=p;}
           else if(t[i]=='s'){ans+=r;}
           else{ans+=s;}
       }
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

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

using namespace std;
using llng = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
template<class T> using hset = unordered_set<T>;
template<class Key, class T> using hmap = unordered_map<Key, T>;

int main() {
    llng N, P; cin >> N >> P;
    llng bsc[2][51];
    bsc[0][0] = 1; bsc[1][0] = 0;
    for(int i = 1; i <= N; i++) {
        llng A; cin >> A;
        if (A % 2 == 0) {
            bsc[0][i] = bsc[0][i-1] + bsc[0][i-1];
            bsc[1][i] = bsc[1][i-1] + bsc[1][i-1];
        } else {
            bsc[0][i] = bsc[0][i-1] + bsc[1][i-1];
            bsc[1][i] = bsc[1][i-1] + bsc[0][i-1];
        }
    }
    cout << bsc[P][N] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
int main(){
  int A,B,C;
  std::cin>>A >>B >>C;
  if(A==B && B!=C){
    std::cout<<"Yes";
  }
  else if (B==C && C!=A){
    std::cout<<"Yes";
  }
  else if(C==A && A!=B){
    std::cout<<"Yes";
  }
  else{
    std::cout<<"No";
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a[100005],sum,maxm=-1;
    cin>>n;
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
    sort(a,a+n);
    for(int i=0;i<n;i++)
    {
        if(a[i]==a[i-1]) continue;
        sum=1;
        for(int j=i+1;;j++)
        {
            if(j>=n) break;
            if(a[j]<=a[i]+1) sum++;
            else break;
        }
        for(int j=i-1;;j--)
        {
            if(j<0) break;
            if(a[j]>=a[i]-1) sum++;
            else break;
        }
        if(sum>maxm) maxm=sum;
    }
    cout<<maxm;
}


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

constexpr int INF = 1e9;

using pii = pair<int, int>;

struct edge {
    int to, cap, cost, rev;
};

using edges = vector<edge>;
using graph = vector<edges>;

void add_edge(graph& g, int from, int to, int cap, int cost) {
    g[from].push_back(edge{to, cap, cost, (int)g[to].size()});
    g[to].push_back(edge{from, 0, -cost, (int)g[from].size()-1});
}

int min_cost_flow(graph& g, int s, int t, int f) {
    int res = 0;
    const int N = g.size();
    vector<int> h(N), dist(N), prevv(N), preve(N);
    while(f > 0) {
        priority_queue<pii, vector<pii>, greater<pii>> que;
        fill(dist.begin(), dist.end(), INF);
        dist[s] = 0;
        que.push(make_pair(0, s));
        while(!que.empty()) {
            pii p = que.top();
            int v = p.second;
            que.pop();
            if(dist[v] < p.first) {
                continue;
            }
            for(int i=0; i<g[v].size(); ++i) {
                edge& e = g[v][i];
                if(e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]) {
                    dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
                    prevv[e.to] = v;
                    preve[e.to] = i;
                    que.push(make_pair(dist[e.to], e.to));
                }
            }
        }
        if(dist[t] == INF) {
            return -1;
        }
        for(int v=0; v<N; ++v) {
            h[v] += dist[v];
        }
        int d = f;
        for(int v=t; v!=s; v=prevv[v]) {
            d = min(d, g[prevv[v]][preve[v]].cap);
        }
        f -= d;
        res += d * h[t];
        for(int v=t; v!=s; v=prevv[v]) {
            edge& e = g[prevv[v]][preve[v]];
            e.cap -= d;
            g[v][e.rev].cap += d;
        }
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    vector<int> v;
    for(int i=0; i<N; ++i) {
        cin >> A[i] >> B[i];
        v.push_back(A[i]);
        v.push_back(B[i]);
    }
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    graph g(N+v.size()+3);
    int source = N + v.size();
    int unuse = N + v.size() + 1;
    int sink = N + v.size() + 2;
    for(int i=0; i<N; ++i) {
        add_edge(g, source, i, 1, 0);
    }
    for(int i=0; i<N; ++i) {
        int a = lower_bound(v.begin(), v.end(), A[i]) - v.begin();
        add_edge(g, i, N+a, 1, -B[i]);
        int b = lower_bound(v.begin(), v.end(), B[i]) - v.begin();
        add_edge(g, i, N+b, 1, -A[i]);
        add_edge(g, i, unuse, 1, 0);
    }
    for(int i=0; i<v.size(); ++i) {
        add_edge(g, N+i, sink, 1, 0);
    }
    add_edge(g, unuse, sink, INF, 0);
    cout << -min_cost_flow(g, source, sink, N) << endl;
}


Measured memory_bytes: 3404
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
using namespace std;
typedef long long ll;

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

  map<int, int> mp;
  rep(i, n){
    int a; cin >> a;
    if(!mp[a])mp[a]++;
    else mp[a]--;
  }
  ll ans = 0;
  for(auto x : mp) if(x.second) ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4864
using System;
using System.IO;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var X = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var Ps = Enumerable.Range(1, 100).ToArray();
        var answer = 100 * 100 * 100;
        foreach (var P in Ps)
        {
            var sum = 0;
            for (int i = 0; i < N; i++)
            {
                var consume = X[i] - P;
                sum += consume * consume;
            }
            if (sum < answer) answer = sum;
        }
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
}

Measured memory_bytes: 28184
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int beki(int a,int b,int M = modulo){
	int x = 1;
	while(b!=0){
		if(b&1){
			x=((long long)x*a)%M;
		}
		a=((long long)a*a)%M;
		b>>=1;
	}
	return x;
}


int gyakugen(int a){
	return beki(a,modulo-2);
}

int ans;
int n,a,b;

void decrease(int x){
	int t = 1;
	for(int i=0;i<x;i++){
		t = mod(t * (n-i));
		t = mod(t * gyakugen(i+1));
	}
	ans = mod(ans - t);
}

int main(){
	
	cin>>n>>a>>b;
	
	ans = beki(2,n);
	
	decrease(0);
	decrease(a);
	decrease(b);
	
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 384
n, m = map(int, input().split())
l = [input().split() for _ in range(m)]

count_wa = [0]*n
flag_ac = [False]*n
for i in l:
    if not flag_ac[int(i[0])-1]:
        if i[1] == "AC":
            flag_ac[int(i[0])-1] = True 
        elif i[1] == "WA":
            count_wa[int(i[0])-1] += 1

for i in range(n):
    if not flag_ac[i]:
        count_wa[i] = 0

print(sum(flag_ac), sum(count_wa))


Measured memory_bytes: 33684
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] in = sc.next().toCharArray();
        List<String> out = new ArrayList<>();
        String kotae = "";
        for(int i = 0; i < in.length; i++){
            char b01 = in[i];
            if(b01 == '0'){
                out.add(out.size(),"0");
            }
            else if(b01 == '1'){
                out.add(out.size(),"1");
            }
            else if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            }
        }

        for(int i = 0; i < out.size(); i++){
            String s = out.get(i);
            kotae = kotae + s;
        }
        System.out.println(kotae);
    }
}


Measured memory_bytes: 22868
n = int(input())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
s = aa[0] + sum(bb)
best = s
for i in range(1, n):
    s += aa[i] - bb[i - 1]
    if s > best:
        best = s
print(best)


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

int main(){
    char b;
    cin >> b;
    if (b=='A'){
        cout << 'T';
    }
    else if (b=='T'){
        cout << 'A';
    }
    else if (b=='C'){
        cout << 'G';
    }
    else if (b=='G')
        cout << 'C';
}

Measured memory_bytes: 256
#include<iomanip>
#include<cmath>
#include<iostream>
#define pi acos(-1)
using namespace std;
 int is_prime( long long int n)
{
    if(n==2){ return 1;}
    else{ for(int i=2;i*i<=n;i++)
        {
            if( n%i ==0){ return 0;
            break;
            }
        }
    }
    return 1;
}
int main()
{
    long long int n,a,b,q,p,d;
    cin>>n>>a>>b;
    d=a+b;
    q=n/d;
    p=a*q;
    if(n%d){
        if(n%d>=a)p+=a;
        else p+=n%d;
    }
    cout<<p;
}


Measured memory_bytes: 256
using System;

namespace question2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int K = int.Parse(str[0]);
            int X = int.Parse(str[1]);

            int resm = X - K + 1;
            int resp = X + K - 1;
            if (resm < -1000000) resm = -1000000;
            if (resp > 1000000) resp = 1000000;


            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            for (int i = resm; i < resp + 1; i++)
            {
                sb.Append(i.ToString());
                sb.Append(" ");
            }
            Console.WriteLine(sb);
        }
    }
}


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

int n;
int64_t k;

bool check(int64_t cost, vector<int64_t> &a, vector<int64_t> &f) {
  int64_t d = k;
  for (int i = 0; i < n; i++) {
    d -= max(0l, a.at(i) - cost / f.at(i));
  }
  return d >= 0;
}

int main() {
  int64_t s = 0;
  cin >> n >> k;
  vector<int64_t> a(n), f(n), anew(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    s += a.at(i);
  }
  for (int i = 0; i < n; i++) cin >> f.at(i);
  sort(a.begin(), a.end());
  sort(f.rbegin(), f.rend());
  int64_t cost = 1000000000000000000l, cost_ng = 0;
  if (s <= k) {
    cout << 0 << endl;
    return 0;
  }
  while (cost - cost_ng > 1) {
    int64_t h = (cost + cost_ng) / 2;
    if (check(h, a, f)) {
      cost = h;
    } else {
      cost_ng = h;
    }
  }
  cout << cost << endl;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
	int a,b,c,ans;
	cin >> a >> b >>c;
 	ans=c-a+b;
  if(ans<0){
    ans=0;
  }
 	cout << ans;
	return 0;
}

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

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

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

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

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

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

void d_err() {
    cerr << endl;
}

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

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

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

    map<string, int> m;
    int mm = 0;
    REP(i, N) {
        string s;
        cin >> s;
        m[s]++;

        mm = max(mm, m[s]);
    }

    for(auto it = m.begin(); it != m.end(); ++it) {
        if (it->se == mm) cout << it->fi << endl;
    }


    
}


Measured memory_bytes: 23808
import re

def makelist(n, m):
    return [[0 for i in range(m)] for j in range(n)]

N = int(input())

MOD = int(1e9) + 7

acgt = ["A", "C", "G", "T"]
changed = [".*AGC", ".*GAC", ".*ACG", ".*A.GC", ".*AG.C"]
abcl = [ a+b+c for a in acgt for b in acgt for c in acgt]

dp = {}
for now in abcl:
    if any(map(lambda ch: re.match(ch, now), changed)):
        dp[now] = 0
    else:
        dp[now] = 1

N -= 3

while N > 0:
    dpNow = {}
    for abc in abcl:
        abc = abc[:min(N, 3)]
        dpNow[abc] = 0
        for key, value in dp.items():
            now = key + abc
            if not any(map(lambda ch: re.match(ch, now), changed)):
                dpNow[abc] += value
                dpNow[abc] %= MOD
    dp = dpNow
    N -= 3

ans = 0
for v in dp.values():
    ans += v
    ans %= MOD

print(ans)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll ;

#define PI (acos(-1))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    int n; cin >> n;
    vector <int> as;
    int sum = 0;
    REP(i, n){
        int a; cin >> a;
        as.push_back(a);
        sum ^= a;
    }
    REP(i, n-1){
        cout << int(sum ^ as[i]) << " ";
    }
    cout << int(sum ^ as[n-1]) << endl;
    return 0;
}

Measured memory_bytes: 4312
#include <atcoder/dsu>
#include <cstdio>
#include <iostream>
using namespace std;
using namespace atcoder;
int main(){
  int N, M, a, b;
  cin >> N >> M;
  dsu d(N);
  for(int i = 0; i<M; i++){
    cin >> a >> b;
    d.merge(a-1, b-1);
  }
  cout << d.groups().size()-1 << endl;
  
  return 0;
}

Measured memory_bytes: 8912
program prob2
    implicit none
    integer::A, B, i
    character(len=15)::S
    read(*,*) A, B
    read(*,*) S
    do i = 1, A+B+1
        if(i == A+1) then
            if(S(i:i) .ne. "-") then
                write(*,'(a)') "No"
                stop
            end if
        else if(ichar(S(i:i)) < ichar('0') .or. ichar(S(i:i)) > ichar('9')) then
            write(*,'(a)') "No"
            stop
        end if
    end do
    write(*,'(a)') "Yes"
    stop
end program

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

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

using vi=vector<int>;
using vvi=vector<vi>;

int res;

int dfs(const vvi& g,int k,int u)
{
	int d=0;
	for(int v:g[u]){
		int t=dfs(g,k,v);
		if(t==k-1)
			res+=u!=0;
		else
			d=max(d,1+t);
	}
	return d;
}

int main()
{
	for(int n,k;cin>>n>>k && n|k;){
		vi a(n);
		rep(i,n) cin>>a[i],a[i]--;

		res=0;
		if(a[0]!=0) a[0]=0,res++;

		vvi g(n);
		repi(i,1,n) g[a[i]].push_back(i);

		dfs(g,k,0);
		cout<<res<<endl;
	}
}


Measured memory_bytes: 13952
#include <iostream>
#include <math.h>
#include<stdio.h>
#include <climits>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	int n=0,k,i=1,flag = 0;
	int stac;
	int ans;
	int a[200001] = { 0 };

	cin >> k >>n;
	while (cin >> a[i]) {
		i++;
	}

	ans = a[n] - a[1];
	for (i = 2; i <= n; i++) {
		if (a[i] - a[i - 1] > a[i + 1] - a[i]) {
			stac = k + a[i] - a[i - 1];
			if (stac < ans) ans = stac;
		}
		else {
			stac = k + a[i] - a[i+1];
			if (stac < ans) ans = stac;
		}
	}
	cout << ans << "\n";
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int m=0,n,aa[1100][1100],a,b,cnt=0;
pair<int,int> p[220000];
string s,ss[110000];
double d;
char c;
signed main(){
    cin>>n;
    d=n/3.0;
    printf("%.6f",d*d*d*1.0);
}

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

class dice{	
public:
	int d[7];
	int set();
	int E();
	int W();
	int N();
	int S();
	int R();//?°´???????????¢
	int C(int *,int *,int *,int *);//??\??????????????????
};
int dice::set(){
	for(int i=1;i<=6;i++){
		cin>>d[i];
	}
	return 0;
}
int dice::C(int *w,int *x,int *y,int *z){
	int a[4];
	a[0]=*w;
	a[1]=*x;
	a[2]=*y;
	a[3]=*z;
	*w=a[3];
	*x=a[0];
	*y=a[1];
	*z=a[2];
	return 0;
}
int dice::E(){
	C(&d[1],&d[3],&d[6],&d[4]);
	return 0;
}
int dice::W(){
	C(&d[1],&d[4],&d[6],&d[3]);
	return 0;
}
int dice::N(){
	C(&d[1],&d[5],&d[6],&d[2]);
	return 0;
}
int dice::S(){
	C(&d[1],&d[2],&d[6],&d[5]);
	return 0;
}
int dice::R(){
	C(&d[2],&d[4],&d[5],&d[3]);
	return 0;
}
int main(){
	dice A,B;
	A.set();
	B.set();
	for(int i=0;i<4;i++){
		B.E();
		if(B.d[1]==A.d[1])break;
	}
	for(int i=0;i<4;i++){
		B.N();
		if(B.d[1]==A.d[1])break;
	}
	for(int i=0;i<4;i++){
		B.R();
		int l=0;
		for(int j=0;j<4;j++){
			if(A.d[j+1]==B.d[j+1]){
				l++;
			}
		}
		if(l==4){
			cout<<"Yes"<<endl;
			goto last;
		}
	}
	cout<<"No"<<endl;
	last:
	return 0;
}

Measured memory_bytes: 1156
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        w: usize,
        h: usize,
        n: usize,
    }

    let mut is_white = vec![vec![true; w]; h];
    for _ in 0..n {
        input! {
            x: usize,
            y: usize,
            a: u8,
        }

        match a {
            1 => {
                for i in 0..h {
                    for j in 0..x {
                        is_white[i][j] = false;
                    }
                }
            },
            2 => {
                for i in 0..h {
                    for j in x..w {
                        is_white[i][j] = false;
                    }
                }
            },
            3 => {
                for i in 0..y {
                    for j in 0..w {
                        is_white[i][j] = false;
                    }
                }
            },
            4 => {
                for i in y..h {
                    for j in 0..w {
                        is_white[i][j] = false;
                    }
                }
            },
            _ => unreachable!(),
        }
    }

    let mut ans = 0;
    for i in 0..h {
        ans += is_white[i].iter().filter(|&a| *a == true).count();
    }
    println!("{}", ans);
}


Measured memory_bytes: 2172
#include <bits/stdc++.h>
#include<algorithm>
#define ll long long
#define pb push_back
#define popb pop_back
#define ull unsigned long long 
#define beg begin
#define MAXN 1000000007
#define mp make_pair
#define pii pair<int,int>
#define piii pair<int,pii>
using namespace std;


int main(void) {
     ios::sync_with_stdio(0);
     int x1,x2,y1,y2 ;
     cin >> x1 >> y1 >> x2 >> y2 ;
     float a = -(y2 - y1)/2.0,b = (x2-x1)/2.0 ;
     float temp1 = a + (x1 + x2)/2.00 , temp2 = b + (y1 + y2)/2.00 ;
     //cout << temp1 << " " << temp2 << endl ; 
     cout << 2*temp1 - x1 << " " << 2*temp2 - y1 << " " << 2*temp1 - x2 << " " << 2*temp2 - y2 ;
     
}

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

int main(){
    int i, c = 0;
    string s, result = "";
    cin >> s;
    for(i=s.size()-1; i>=0; i--){
        if(s[i] == 'B'){
            c++;
        }else if(c > 0){
            c--;
        }else{
            result = s[i] + result;
        }
    }
    cout << result;
    return 0;
}

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

int main()
{
        int n;
        cin>>n;
        int w;
        cin>>w;
        vector<int>wt(n),val(n);
        for(int i=0;i<n;i++)
        {
            cin>>wt[i]>>val[i];
        }
        vector<vector<long long>>dp(n+1,vector<long long>(w+1,0));
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=w;j++)
            {
                if(wt[i-1]<=j){
                    dp[i][j]=max(dp[i-1][j],val[i-1]+dp[i-1][j-wt[i-1]]);
                }
                else
                dp[i][j]=dp[i-1][j];
            }
        }
        cout<<dp[n][w];
}


Measured memory_bytes: 80256
#include<stdio.h>
#include<string.h>

int main(void){

  char str1[100],str2[100];
  int str1_len,str2_len;
  int i,j,k,l,m;
  int a,b,c;
  int s1,s2,s3;
  int up=0;
  int sum[100];
  int count;

  scanf("%d",&count);//???????????????????????°??????count??\??????

  if((count>50)||(count<0)){
    return 0;
  }

  for(i=0;i<count;i++){//count????????°??????input??¨output?????°?????????
    
    scanf("%s",str1);//???????????°?????????
    scanf("%s",str2);
    
    str1_len = strlen(str1);//?????°?????????
    str2_len = strlen(str2);

    if(str1_len<=str2_len){
     
      a = 0;
      b = 0;

      for(j=str1_len-1;j>=0;j--){
	s1 = str1[j]-'0';
	s2 = str2[(str2_len-1)-b]-'0';

	if(s1+s2+up<10){
	  sum[a] = s1+s2+up;
	  up = 0;

	}else{
	  sum[a] = (s1+s2+up)%10;
	  up = 1;
   
	}
	a++;
	b++;
      }
      if(str1_len != str2_len){
	c = 0;

	for(k=str2_len-str1_len-1;k>=0;k--){

	  s3 = str2[k];


	  if(((s3-'0')+up)<10){

	    sum[str1_len+c] = (s3-'0')+up;
	    up = 0; 
	  }else{
	    sum[str1_len+c] = ((s3-'0')+up)%10;
	    up = 1;
	  }
	  c++;
	}
      }
      if(up == 1){
	sum[str2_len] = 1;
	if(str2_len>=80){
	  printf("overflow");
	}else{
	  for(l=str2_len;l>=0;l--){
	    printf("%d",sum[l]);
	  }
	}
      }else{
	if(str2_len>=81){
	  printf("overflow");
	}else{
	  for(l=str2_len-1;l>=0;l--){
	    printf("%d",sum[l]);
	  }
	}
      }
      up = 0;
      printf("\n");


    

    }else{
      a = 0;
      b = 0;
      for(j=str2_len-1;j>=0;j--){
	s1 = str1[(str1_len-1)-b]-'0';
	s2 = str2[j]-'0';


	if(s1+s2+up<10){
	  sum[a] = s1+s2+up;
	  up = 0;
	}else{
	  sum[a] = (s1+s2+up)%10;
	  up = 1;
	}
	a++;
	b++;
      }

      c = 0;

      for(k=str1_len-str2_len-1;k>=0;k--){

	s3 = str1[k];

	if(((s3-'0')+up)<10){

	  sum[str2_len+c] = (s3-'0')+up;
	  up = 0; 
	}else{
	  sum[str2_len+c] = ((s3-'0')+up)%10;
	  up = 1;
	}
	c++;
      }

      if(up == 1){
	sum[str1_len] = 1;
	if(str1_len>=80){
	  printf("overflow");
	}else{
	  for(l=str1_len;l>=0;l--){
	    printf("%d",sum[l]);
	  }
	}
      }else{
	if(str1_len>=81){
	  printf("overflow");
	}else{
	  for(l=str1_len-1;l>=0;l--){
	    printf("%d",sum[l]);
	  }
	}
      }

      up = 0;
      printf("\n");


    } 
    for(m=0;m<100;m++){
      sum[m]=0;
    }
    memset(str1,'\0',str1_len);
    memset(str2,'\0',str2_len);


  }
  return 0;
}

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

using namespace std;

int main() {

	int N, R;
	cin >> N >> R;

	if (N < 10) {
		cout << R+100 * (10 - N);
	}
	else {
		cout << R;
	}

}

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

int solve(int n, int k, vector<int>h){
  vector<int>dp(n,INF);
  dp[0] = 0;
  for (int i=0; i<n; i++){
    for (int j=i+1; j<=i+k; j++){
      if (j<n){
        dp[j] = min(
          dp[j],
          dp[i] + abs( h[i] - h[j] )
        );
      }
    }
  }
  return dp[n-1];
}

int main(){
  int n,k; cin>>n>>k;
  vector<int>h(n); rep(i,n) cin>>h[i];
  cout << solve(n,k,h) << endl;
}

Measured memory_bytes: 4260
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        if(n == 2){
            System.out.println(1);
            return;
        }
        HashSet<Long> hs = calc_n1(n-1);
        hs = calc_n0(n,hs);
        System.out.println(hs.size());
    }
    
    public static HashSet<Long> calc_n1(long l){
        long max = (long)Math.pow(l,0.5)+1;
        HashSet<Long> ret = new HashSet<>();
        ret.add(l-1);
        for(long i = 2; i < max; i++){
            if(l % i == 0){
                ret.add(l/i);
                ret.add(i);
            }
        }
        return ret;
    }
    
    public static HashSet<Long> calc_n0(long l, HashSet<Long> hs){
        long max = (long)Math.pow(l,0.5)+1;
        hs.add(l);
        for(long i = 2; i < max; i++){
            long l2 = l;
            boolean div = false;
            while(l2 % i == 0){
                l2 /= i;
                div = true;
            }
            if(l2 % i == 1 && div){
                hs.add(i);
            }
        }
        return hs;
    }
}

Measured memory_bytes: 21972
#include<algorithm>
#include<iostream>
#include<string>

using namespace std;

int main(){
	int a,b,c,x,y;
	cin>>a>>b>>c>>x>>y;
	int amore=max(0,x-y);
	int same=min(x,y);
	int bmore=max(0,y-x);
	int ans=0;
	ans=min(a,c*2)*amore+min(a+b,c*2)*same+min(b,c*2)*bmore;
	cout<<ans<<endl;
}


Measured memory_bytes: 3620
N,M = list(map(int,input().split()))
H = list(map(int,input().split()))
ans = [0 for i in range(N)]
R = []
for i in range(M):
    R.append(list(map(int,input().split())))
R.sort()
for a,b in R:
    if H[a-1] == H[b-1]:
        ans[a-1]+=1
        ans[b-1]+=1
    elif H[a-1] < H[b-1]:
        ans[a-1] += 1
    else:
        ans[b-1] += 1
print(ans.count(0))


Measured memory_bytes: 94156
#include<bits/stdc++.h>
using namespace std;
typedef int sign;
typedef long long ll;
#define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
#define Fordown(i,a,b) for(register sign i=(sign)(a);i>=(sign)(b);--i)
const int N=1e5+5;
template<typename T>bool cmax(T &a,T b){return (a<b)?a=b,1:0;}
template<typename T>bool cmin(T &a,T b){return (a>b)?a=b,1:0;}
template<typename T>T read()
{
	T ans=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')f=-1,ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
	return ans*f;
}
template<typename T>void write(T x,char y)
{
	if(x==0)
	{
		putchar('0'),putchar(y);
		return;
	}
	if(x<0)
	{
		putchar('-');
		x=-x;
	}
	static char wr[20];
	int top=0;
	for(;x;x/=10)wr[++top]=x%10+'0';
	while(top)putchar(wr[top--]);
	putchar(y);
}
void file()
{
#ifndef ONLINE_JUDGE
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
#endif
}
int n,m;
struct seg
{
	int l,r,len;
	bool operator < (const seg &s)const
	{return len<s.len;}
}e[N*3];
void input()
{
	n=read<int>(),m=read<int>();
	For(i,1,n)e[i].l=read<int>(),e[i].r=read<int>(),e[i].len=e[i].r-e[i].l+1;
}
int sum[N];
void add(int x,int v)
{
	for(;x<=m;x+=x&-x)sum[x]+=v;
}
int cal(int x)
{
	int res=0;
	for(;x;x-=x&-x)res+=sum[x];
	return res;
}
void work()
{
	int ans,pos=1;
	sort(e+1,e+n+1);
	For(i,1,m)
	{
		for(;pos<=n&&e[pos].len<i;pos++)
			add(e[pos].l,1),add(e[pos].r+1,-1);
		ans=n-pos+1;
		for(int j=i;j<=m;j+=i)ans+=cal(j);
		write(ans,'\n');
	}
}
int main()
{
//	file();
	input();
	work();
	return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


template<class T>
vector<T> cumsum1d(const vector<T> &v){
    int size = v.size();
    vector<T> cum(size+1,0);
    for(int i = 0; i < size; i++){
        cum[i+1] = v[i] + cum[i];
    }
    return cum;
}


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

    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        a[i]--;
    }

    if(k==1){
        cout << 0 << endl;
        return 0;
    }
    vector<ll> cumulative = cumsum1d(a);
    for(int i = 0; i <= n; i++){
        cumulative[i] %= k;
    }
    map<ll,ll> mp;
    ll ans = 0;
    for(int i = 0; i <= n; i++){
        mp[cumulative[i]]++;
        if(i>=k){
            mp[cumulative[i-k]]--;
        }
        ans += mp[cumulative[i]]-1;
    }
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 15872
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

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


int main(){
    int n;
    IN n;
    int ans = inf;
    rep(i,0,n){
        int a;
        IN a;
        int c = 0;
        while(!(a&1)){
            c++;
            a >>= 1;
        }
       // P(c);
        ans = min(ans,c);
    }
    P(ans);
    
	return  0;
}

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

void scan(int &x) {
    x = 0;

    char c = getchar();
    int f = 1;

    while ('0' > c || c > '9') {
        if (c == '-') {
            f = -1;
        }

        c = getchar();
    }

    while ('0' <= c && c <= '9') {
        x = x * 10 - '0' + c;

        c = getchar();
    }

    x *= f;

    return;
}

void print(int x) {
    if (x < 0) {
        putchar('-');
        print(0 - x);

        return;
    }

    if (x >= 10) {
        print(x / 10);
    }

    putchar(x % 10 + '0');

    return;
}
int main (){
	int n;
	long long smax = 0;
	long long ans = 0;
	
	scanf ("%d", &n);
	for (int i = 1; i <= n; i ++) {
		long long x;
		
		scanf ("%lld", &x);
		if (x <= smax) {
			ans += (smax - x);
		} 
		else {
			smax = x;
		}
	}
	printf ("%lld", ans);
	
	return 0;
}



Measured memory_bytes: 1720
#include <iostream>
#include <cstdio>
using namespace std;
int c[100+5];
int main()
{
    int n;cin>>n;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        if(x>=3200) x=3200;
        c[x/400]++;
    }
    int ans=0;
    for(int i=0;i<8;i++)
        if(c[i]>0) ans++;
    cout<<max(ans,1)<<" ";
    ans+=c[8];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256