akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 
#define ll long long
#define the_num 1000000007
#define ano_num 998244353
#define forn(n) for(int i=0;i<n;i++)
#define For(i,start_i,n) for(int i=start_i;i<n;i++)
#define test int t;cin >> t;while(t--)
#define all(v) v.begin(),v.end()
#define in_arr(arr,n) int arr[n];forn(n) cin >> arr[i];
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define take(data_type,n) data_type n;cin >> n;
using namespace std;
  
int main(){ 
    fast
    take(int,n);
    switch(n%10){
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout << "hon" << '\n';
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            cout << "pon" << '\n';
            break;
        case 3:
            cout << "bon" << '\n';
            break;
    }
} 

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vec_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;}
#define vec_output(v) for(auto it=v.begin();it!=v.end();it++){if(it!=v.begin())cout<<" ";cout<<*it;}cout<<endl;
#define vec_debug(v) for(auto it=v.begin();it!=v.end();it++){cerr<<*it<<" ";}cerr<<endl;
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
template <typename T>T digitsum(T n);
template <typename T>bool isPrime(T n);
template <typename T>vector<pair<T, T>> prime_factor(T n);
long long int intpow(long long int,long long int);
template <typename T>T intlog(T);
long long int combination(long long int,long long int);
long long int arith_sum1(long long int,long long int,long long int);
long long int arith_sum2(long long int,long long int,long long int);
long long int series_sum(long long int);

int main(){
    int n;
    cin>>n;
    vector<ll> vec(n);
    ll sum=0;
    rep(i,n){
        cin>>vec[i];
        if(i>=1)sum+=abs(vec[i]-vec[i-1]);
    }
    sum+=abs(vec[0])+abs(vec[vec.size()-1]);
    rep(i,n){
        if(i==0){
            if((0<=vec[0]&&vec[0]<=vec[1])||(vec[1]<=vec[0]&&vec[0]<=0)){
                cout<<sum<<endl;
            }else{
                cout<<sum-abs(vec[i])
                -abs(vec[i+1]-vec[i])+abs(vec[i+1])<<endl;
            }
        }
        else if(i>=1&&i<n-1){
            if((vec[i-1]<=vec[i]&&vec[i]<=vec[i+1])||(vec[i+1]<=vec[i]&&vec[i]<=vec[i-1])){
                cout<<sum<<endl;
            }else{
                cout<<sum-abs(vec[i]-vec[i-1])
                -abs(vec[i+1]-vec[i])+abs(vec[i+1]-vec[i-1])<<endl;
            }
        }
        else if(i==n-1){
            if((0<=vec[i]&&vec[i]<=vec[i-1])||(vec[i-1]<=vec[i]&&vec[i]<=0)){
                cout<<sum<<endl;
            }else{
                cout<<sum-abs(vec[i]-vec[i-1])
                -abs(vec[i])+abs(vec[i-1])<<endl;
            }
        }
    }
}


Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define fir first
#define sec second
#define mod 998244353
#define ll long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
#define N 100005
vector<int> G[N];
int n,dep[N],fa[N];
void dfs(int u,int f)
{
	dep[u]=dep[f]+1; fa[u]=f;
	for(int v:G[u]) if(v!=f) dfs(v,u);
}
bool ch[N];
vector<int> solve(int u,int v)
{
	dfs(u,0); vector<int> ans; int cnt=0;
	while(v!=u)
	{
		int _cnt=0;
		for(int _:G[v])
		{
			if(!ch[_]) _cnt++;
		}
		int r=++cnt;
		while(_cnt--) ans.pb(++cnt);
		ans.pb(r);
		v=fa[v];
	}
	ans.pb(n);
	return ans;
}
bool cmp(vector<int> x,vector<int> y)
{
	for(int i=0;i<(int)x.size();i++)
	{
		if(x[i]!=y[i]) return x[i]<y[i];
	}
	return 0;
}
signed main()
{
	cin>>n;
	for(int i=1;i<n;i++)
	{
		int u=read(),v=read();
		G[u].pb(v),G[v].pb(u);
	}
	dfs(1,0);
	int maxn=0;
	for(int i=1;i<=n;i++) if(dep[i]>dep[maxn]) maxn=i;
	dfs(maxn,0);
	int amaxn=0;
	for(int i=1;i<=n;i++) if(dep[i]>dep[amaxn]) amaxn=i;
	int r=amaxn;
	while(r!=maxn)
	{
		ch[r]=1;
		r=fa[r];
	}
	ch[maxn]=1;
	bool ok=1;
	for(int i=1;i<=n;i++)
	{
		if(ch[i]) continue;
		if(G[i].size()>1) ok=0;
	}
	if(!ok) {cout<<"-1\n"; return 0;}
	auto x=solve(maxn,amaxn),y=solve(amaxn,maxn);
	if(!cmp(x,y)) swap(x,y);
	for(int i:x) printf("%d%c",i," \n"[i==n]);
	return 0;
}




Measured memory_bytes: 15928
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("faild to read char") as char)
        .take_while(|c| !c.is_whitespace())
        .collect();
    token
        .parse()
        .ok()
        .expect("faild to parse token")
}

fn main(){
    let n: u64 = read();
    let mut p: u64 = read();
    let a = p;
    let mut ret = 1;
    for i in 2..a {
        if p < i * i {
            break;
        }
        let mut tmp = 0;
        while p % i == 0 {
            p /= i;
            tmp += 1;
        }
        ret *= pow(i, tmp / n);
    }
    ret *= pow(p, 1 / n);
    println!("{}", ret);
}

fn pow(a: u64, b: u64) -> u64 {
    if b == 0 {
        return 1;
    } else if b == 1 {
        return a;
    }
    let prev = pow(a, b / 2);

    if b % 2 == 0 {
        prev * prev
    } else {
        prev * prev * a
    }
}



Measured memory_bytes: 2140
#include<bits/stdc++.h>
using namespace std;
#define Sheryang main
const int maxn=1e6+7;
typedef long long ll;
const int mod=998244353;
#define IO cin.tie(0),ios::sync_with_stdio(false);
#define pi acos(-1)
#define PII pair<ll,ll>
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();if(c == '-')Nig = -1,c = getchar();while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();return Nig*x;}
#define read read()
/** keep hungry and keep calm! **/

int a[maxn];
int Sheryang(){
    int n=read,m=read;

    for(int i=1;i<=n;i++){
        int cnt=read;
        for(int j=1;j<=cnt;j++){
            int x=read;
            a[x]++;
        }
    }

    int ans=0;
    for(int i=1;i<=m;i++){
        if(a[i]==n){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
N, M = map(int, input().split())

sc = [list(map(int, input().split())) for i in range(M)]

ans = 0

for i in range(M-1):
  for j in range(i+1, M):
    if sc[i][0]==sc[j][0] and sc[i][1]!=sc[j][1]:
      ans = -1

for i in range(M):
  if N>1 and sc[i][0]==1 and sc[i][1]==0:
    ans = -1

if ans == 0:
  keta = [0 for i in range(N)]
  for i in range(M):
    keta[sc[i][0]-1] = sc[i][1]
  for i in range(N):
    ans += (10**i)*keta[N-i-1]
  if keta[0]==0 and N>1:
    ans += 10**(N-1)

if N == 1 and M > 0 and sc[0][1]==0:
  ans = 0

if M == 0:
  ans = 10**(N-1)
  if N == 1:
    ans = 0
print(int(ans))

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>

using namespace std;

#define equals(a, b) (a == b)

class Point {
    public:
        Point() = default;
        Point(int x = 0, int y = 0): x(x), y(y) {}
        Point operator + (Point p) { return Point(x + p.get_x(), y + p.get_y()); }
        Point operator - (Point p) { return Point(x - p.get_x(), y - p.get_y()); }
        Point operator * (int k) { return Point(k * x, k * y); }
        Point operator / (int k) { return Point(x / k, y / k); }
        int abs() { return sqrt(norm()); }
        int norm() { return x * x + y * y; }
        bool operator < (const Point &p) const {
            return x != p.get_x() ? x < p.get_x() : y < p.get_y();
        }
        bool operator == (const Point &p) const {
            return x == p.get_x() && y == p.get_y();
        }
        const int get_x() const { return x; }
        const int get_y() const { return y; }
    private:
        int x = 0;
        int y = 0;
};

typedef Point Vector;

int dot(Vector a, Vector b) {
    return a.get_x() * b.get_x() + a.get_y() * b.get_y();
}

int cross(Vector a, Vector b) {
    return a.get_x() * b.get_y() - a.get_y() * b.get_x();
}

struct Segment {
    Point p1;
    Point p2;
};
typedef Segment Line;

bool is_orthogonal(Vector a, Vector b) {
    return equals(dot(a, b), 0);
}

bool is_orthogonal(Point a1, Point a2, Point b1, Point b2) {
    return is_orthogonal(a1 - a2, b1 - b2);
}

bool is_orthogonal(Segment s1, Segment s2) {
    return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1), 0);
}

bool is_parallel(Vector a, Vector b) {
    return equals(cross(a, b), 0);
}

bool is_parallel(Point a1, Point a2, Point b1, Point b2) {
    return is_parallel(a1 - a2, b1 - b2);
}

bool is_parallel(Segment s1, Segment s2) {
    return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0);
}

int
main(int argc, const char *argv[])
{
    int q;
    int x0, y0, x1, y1, x2, y2, x3, y3;
    cin >> q;
    while (q--) {
        cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;        
        Point a1{x0, y0}, a2{x1, y1}, b1{x2, y2}, b2{x3, y3};
        if (is_parallel(a1, a2, b1, b2)) cout << 2;
        else if (is_orthogonal(a1, a2, b1, b2)) cout << 1;
        else cout << 0;
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3096
#include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	getline(cin,s);
	for(int i = 0; i<(int)s.size(); i++){
		string::size_type ap = s.find("apple",i);
		string::size_type pe = s.find("peach",i);
		if(ap == string::npos && pe == string::npos){break;}
		else if(ap == string::npos && pe != string::npos){s.replace(pe,5,"apple");i=pe;}
		else if(ap != string::npos && pe == string::npos){s.replace(ap,5,"peach");i=ap;}
		else if(ap<pe){s.replace(ap,5,"peach");i=ap;}
		else if(ap>=pe){s.replace(pe,5,"apple");i=pe;}
	}
	cout <<s<<endl;
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
long GCD(long m, long n);

int main() {
  long A, B, C, D;
  cin >> A >> B >> C >> D;
  long Cmul_num = (B/C) - ((A-1)/C);
  long Dmul_num = (B/D) - ((A-1)/D);

  long LCM = C * D / GCD(C, D);
  long LCM_num = (B/LCM) - ((A-1)/LCM);

  long solution = B - A +1 - Cmul_num - Dmul_num + LCM_num;

  cout << solution << endl;
  return 0;
}

long GCD(long m, long n)
{
  if(m%n == 0) return n;
  else if(n%m == 0) return m;

  else if(m>n) return GCD(n, m%n);
  else return GCD(m, n%m);
}


Measured memory_bytes: 3572
#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<stack>
#include<unordered_map>
#include<bitset>
#include<limits>
#include<complex>
#include<array>
#include<numeric>
#include<functional>

using namespace std;
#define ll long long
#define ull unsigned long long
#define rrep(i,m,n) for(ll (i)=(ll)(m);(i)>=(ll)(n);(i)--)
#define rep(i,m,n) for(ll (i)=(ll)(m);i<(ll)(n);i++)
#define REP(i,n) rep(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
constexpr long double m_pi = 3.1415926535897932L;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 61;
constexpr long double EPS = 1e-10;
template<typename T> using vector2 = vector<vector<T>>;
template<typename T> using vector3 = vector<vector2<T>>;
typedef vector<ll> Array;

class UnionFind {
	vector<int> data;
	ll num;
public:
	UnionFind(int size) : data(size, -1), num(size) { }
	bool unite(int x, int y) {//xとyの集合を統合する
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		num -= (x != y);
		return x != y;
	}
	bool findSet(int x, int y) {//xとyが同じ集合か返す
		return root(x) == root(y);
	}
	int root(int x) {//xのルートを返す
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	ll size(int x) {//xの集合のサイズを返す
		return -data[root(x)];
	}
	ll numSet() {//集合の数を返す
		return num;
	}
};

inline ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % mod;
		x = x * x % mod;
		n >>= 1;
	}
	return res;
}

ll dp[5050][5050];
ll fact[5050];

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

	ll n;
	cin >> n;
	Array p(n);
	REP(i, n)cin >> p[i], p[i]--;
	ll k = 0;
	UnionFind uni(n);
	REP(i, n) {
		if (p[i] != -2)uni.unite(i, p[i]);
		else k++;
	}
	ll ans = 0;
	vector<P> s;//連結成分の配列　{サイズ、-1を含むなら1}
	map<ll, ll> mp;//連結成分のサイズ
	map<ll, ll> ex;//-1の頂点を含むかどうか
	REP(i, n) {
		mp[uni.root(i)]++;
		if (p[i] == -2)ex[uni.root(i)] = 1;
	}
	ll nk = mod_pow(n - 1, k, MOD);
	ll nk1 = mod_pow(n - 1, k - 1, MOD);
	for (auto [key, val] : mp) {
		if (ex[key] == 1)s.push_back({ val,1 });
		else s.push_back({ val,0 });
		(ans += nk * (val - 1) % MOD) %= MOD;//連結成分内で必要な辺を計算
	}

	//連結成分間に作る辺を計算
	REP(i, s.size()) {
		if (s[i].second == 0)continue;
		REP(j, s.size()) {
			if (i == j)continue;
			(ans += nk1 * s[j].first % MOD) % MOD;
		}
	}

	//-1を含まない頂点を除外
	REP(i, s.size()) while (i < s.size() && s[i].second == 0)swap(s[i], s.back()), s.pop_back();

	//閉路を作る場合の数を計算
	dp[0][0] = 1;
	REP(i, k) {
		REP(j, k) {
			(dp[i + 1][j + 1] += dp[i][j] * s[i].first % MOD) %= MOD;
			(dp[i + 1][j] += dp[i][j]) %= MOD;
		}
	}
	fact[1] = 1;
	rep(i, 2, k)fact[i] = fact[i - 1] * i % MOD;
	rep(i, 2, k + 1) (ans += MOD - dp[k][i] * fact[i - 1] % MOD * mod_pow(n - 1, k - i, MOD) % MOD) %= MOD;
	cout << ans << "\n";


	return 0;
}

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

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

    vector<int> A(N+2, 0);
    vector<int> B(N+1, 0);
    ll sum = 0;    
    for(int i=1; i<=N; i++){
        cin>>A[i];
        B[i-1] = abs(A[i]-A[i-1]);
        sum += abs(A[i]-A[i-1]);
    }

    B[N] = abs(A[N+1]-A[N]);
    sum += abs(A[N+1]-A[N]);

    for(int i=1; i<=N; i++){
        cout<< sum - B[i-1] - B[i] +abs(A[i-1]-A[i+1]) <<endl;
    }

    return 0;
}

Measured memory_bytes: 4052
import math
a,b = [int(i)for i in input().split()]
lower1 = math.floor(a/0.08)
upper1 = math.floor((a+1)/0.08)
lower2 = math.floor(b/0.1)
upper2 = math.floor((b+1)/0.1)
if math.floor(lower1*0.08)!=a:
    lower1+=1
if math.floor(upper1*0.08)!=a:
    upper1-=1
if math.floor(lower2*0.1)!=b:
    lower2+=1
if math.floor(upper2*0.1)!=b:
    upper2-=1
ans = max(lower1,lower2)
if ans<=min(upper1,upper2):
    print(ans)
else:
    print(-1)

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

//#define int long long
int md = 100000;
#define addm(X, Y) ((X) = ((X) + (Y) % md) % md)

int n, k;
int d[10];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> k;
    rep(i, k) cin >> d[i];
    int ans = n;
    while (true) {
        string tmp = to_string(ans);
        bool ok = true;
        rep(i, tmp.size()) {
            rep(j, k) {
                if (tmp[i] - '0' == d[j]) {
                    ok = false;
                    break;
                }
            }
            if (!ok) break;
        }
        if (ok) break;
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pii;
#define ffor(n) for(ll i=0;i<n;i++)
#define rfor(x,y) for(ll i=x;i<y;i++)
#define ff first
#define ss second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
long long int knapsack(ll w , vector<ll> value ,vector<ll> weight , int n)
{
    ll dp[n+1][w+1];
    rfor(0,n+1)
    {
        for(ll j= 0; j<=w;j++)
        {
            if(i==0||j==0)
                dp[i][j] = 0;
           else if (weight[i-1] <= j)
            {
                dp[i][j] = max(value[i-1] + dp[i-1][j-weight[i-1]] , dp[i-1][j]);
            }
            else
            {
                dp[i][j] = dp[i-1][j];
            }

        }
    }
    return dp[n][w];
}
void solve()
{
    ll n,w;
    cin>>n>>w;
    vector<ll> value(n);
    vector<ll> weight(n);
    ffor(n)
    {
        cin>>weight[i]>>value[i];
    }
    cout<<knapsack(w,value,weight,n);
    return;

}
int main()
{   fastio
    ll t=1;
    // cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 82396
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;



int main()
{
string s ;
 cin>>s;

 int ans   = 0;

 int i = 0, j =s.size()-1;
 while(i<j)
 {
     if(s[i]!=s[j])
        ans++;
     i++;
     j--;
 }
 cout<<ans<<endl;
 return 0;
}


Measured memory_bytes: 3596
#include <algorithm>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <vector>


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

using namespace std;
using ll = long long;

#define M (1'000'000'007)

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> d(n + 1, 0);

    for (int x = 1; x < 100; x++) {
        for (int y = 1; y < 100; y++) {
            for (int z = 1; z < 100; z++) {
                ll r = x * x + y * y + z * z + x * y + y * z + z * x;
                if (r <= n) {
                    d[r]++;
                }
            }
        }
    }

    for (int i = 1; i <= n; i++) {
        cout << d[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
int main () {
    long long N, M;
    cin >> N >> M;
    if (!(N < M)) swap(N, M);
    if (N == 2 || M == 2) {
        puts("0");
        return 0;
    }
    if (N == 1) {
        if (M == 1) {
            puts("1");
        }
        else {
            cout << M-2 << endl;
        }
        return 0;
    }
    cout << (N-2) * (M-2) << endl;
}

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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)

#define ll long long

#define pq(name,type) priority_queue<type> name
#define vec(name,type,length,value) vector<type> name(length,value)
#define vec2(name,type,length,width,value) vector<vector<type>> name(length,vector<type>(width,value));

int main(){
	string s1,s2;
  cin >> s1 >> s2;
  int leng = s1.length(),max = 0,leng2 = s2.length();
  froop1(0,leng - leng2 + 1){
    int count = 0;
    for(int j = 0;j < leng2;j++){
      if(s1[j + i] == s2[j])count++;
    }
    if(count > max)max = count;
  }
  cout << leng2 - max << endl;

return 0;
}

Measured memory_bytes: 3628
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=pow(10,9)+7

s=input()
x,y=map(int,input().split())
lst=[[],[]]
cnt=0
tmp=0
for i in range(len(s)):
    if s[i]=="F":
        tmp+=1
    else:
        if cnt==0:
            x-=tmp
        else:
            if tmp!=0:
                lst[cnt%2].append(tmp)
        tmp=0
        cnt+=1
if cnt==0:
    x-=tmp
elif tmp!=0:
    lst[cnt%2].append(tmp)

sumx=sum(lst[0])
sumy=sum(lst[1])
# print(x,sumx)
if sumx<x or x<-sumx:
    print("No")
    exit()
if sumy<y or y<-sumy:
    print("No")
    exit()
dpx=[[0]*(sumx*2+1) for i in range(len(lst[0])+1)]
dpy=[[0]*(sumy*2+1) for i in range(len(lst[1])+1)]
dpx[0][sumx]=1
dpy[0][sumy]=1

for i in range(len(lst[0])):
    for j in range(sumx*2+1):
        if dpx[i][j]!=0:
            dpx[i+1][j+lst[0][i]]+=1
            dpx[i+1][j-lst[0][i]]+=1

for i in range(len(lst[1])):
    for j in range(sumy*2+1):
        if dpy[i][j]!=0:
            dpy[i+1][j+lst[1][i]]+=1
            dpy[i+1][j-lst[1][i]]+=1

# print(dpx)
# print(dpy)
if dpx[len(lst[0])][sumx+x]!=0 and dpy[len(lst[1])][sumy+y]!=0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 175960
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    int n;
    cin >> n;
    int k; 
    cin >> k;
    vi x(n);
    int g = INF;
    rep(I, n) {
        cin >> x[I];
        if(g == INF and x[I] >= 0) {
            g = I;
        }
    }
    if(g == INF) g = n;

    int ans = INT_MAX;
    rep(i, n) {
        int now = 0;
        if(i < g and g-i < k) {
            now = -x[i]*2;
            int ii = i+k-1;
            if(ii > n-1) continue;
            now += x[ii];
        } else if(i < g) {
            now = -x[i];
        } else if(i-g+1 >= k) {
            now = x[i];
        } else {
            now = x[i] * 2;
            int ii = i-k+1;
            if(ii < 0) continue;
            now -= x[ii];
        }
        ans = min(ans, now);
    }

    cout << ans << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  for(int i=0;i<N-2;i++){
    if(S.at(i)== 'A' && S.at(i+1)== 'B' && S.at(i+2)== 'C'){
      ans ++;
    }
  }
  cout << ans;
}

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

typedef long long int llint;

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

	llint mini = 1000001, maxi = -1000001, sum = 0;

	for (llint i = 0; i < n; ++i) {
		llint a;
		cin >> a;
		mini = min(mini, a);
		maxi = max(maxi, a);
		sum += a;
	}

	cout << mini << ' ' << maxi << ' ' << sum << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
        ios::sync_with_stdio(false);
        cin.tie(0);
        int a, b, x;
        cin >> a >> b;
        if (a % 2 == 0)
                x = max(a * 25 / 2, 10 * b);
        else
                x = max(a * 25 / 2 + 1, 10 * b);
        if (2 * x / 25 == a && x / 10 == b)
                cout << x << "\n";
        else
                cout << "-1\n";
        return 0;
}


Measured memory_bytes: 256
i = list(map(str, input().split()))

M = int(i[0])
D = i[1]
a = [[j,k] for k in range(20,int(D)+1) for j in range(M+1)\
     if j == int(str(k)[0])*int(str(k)[1]) and int(str(k)[0]) >= 2 and int(str(k)[1]) >= 2]

print(len(a))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 200001;
const int MOD = 1000000007;

        signed main() {
        int a[3][3];
        for(int i=0;i<3;i++)for(int j=0;j<3;j++)cin>>a[i][j];
        int n;
        cin>>n;
        int b;bool x[3][3];
        for(int i=0;i<3;i++)for(int j=0;j<3;j++)x[i][j]=false;
        for(int i=0;i<n;i++){
                cin>>b;
                for(int j=0;j<3;j++)for(int k=0;k<3;k++)if(a[j][k]==b)x[j][k]=true;
        }
        for(int i=0;i<3;i++){
                if(x[i][0]&&x[i][1]&&x[i][2]){
                        cout<<"Yes";
                        return 0;
                }
                if(x[0][i]&&x[1][i]&&x[2][i]){
                        cout<<"Yes";
                        return 0;
                }
        }
        if(x[0][0]&&x[1][1]&&x[2][2]){
                cout<<"Yes";
                return 0;
        }
        if(x[0][2]&&x[1][1]&&x[2][0]){
                cout<<"Yes";
                return 0;
        }
        cout<<"No";

      }


        


Measured memory_bytes: 256
def int_values(slr):
    l, r = map(lambda s: int(s), slr)
    return l, r


def conv_digits(N, digits):
    for i in range(N):
        if digits[i] is None:
            digits[i] = '0' if i > 0 or N == 1 else '1'

    return ''.join(digits)


def main():
    N, M = int_values(input().split())
    digits = [None] * N
    valid = True

    for i in range(M):
        ss = input().split()
        s = int(ss[0])
        c = ss[1]
        if N > 1 and s == 1 and c == '0':
            valid = False
        elif digits[s - 1] is None:
            digits[s - 1] = c
        else:
            valid = digits[s - 1] == c

    if valid:
        print(conv_digits(N, digits))
    else:
        print('-1')


if __name__ == "__main__":
    main()


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

using namespace std;
int a[105];

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

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

    sort(a,a+n);

    double ans = a[0];
    for(int i=1;i<n;i++){
        ans = (double)(a[i]+ans)/(double)2;
    }

    printf("%.2f",ans);

    return 0;
}


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

ll d[51][51];
ll INF=LLONG_MAX;
int warshall_floyd(){
    rep(k,51)rep(i,51)rep(j,51){
        if(d[i][k]==INF||d[k][j]==INF)continue;
        d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
    }
}
ll p[51];
int a[51],b[51];
set<int> st;
int main(){
    ll cur=1;
    rep(i,51){
        p[i]=cur;
        cur*=2;
    }
    int n;
    cin>>n;
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>b[i];
    rep(i,n){
        if(a[i]!=b[i]) break;
        if(i==n-1){
            cout<<0<<endl;
            return 0;
        }
    }
    for(int i=50;i>=0;--i){
        rep(k,51)rep(l,51) d[k][l]=INF;
        FOR(j,1,i+1){
            rep(k,51)d[k][k%j]=p[j];
        }
        for(auto it:st){
            rep(k,51) d[k][k%it]=p[it];
        }
        warshall_floyd();
        rep(j,n)if(d[a[j]][b[j]]==INF) st.insert(i+1);
    }
    ll sum=0;
    rep(k,51)rep(l,51) d[k][l]=INF;
    for(auto it:st){
        rep(k,51) d[k][k%it]=p[it];
    }
    warshall_floyd();
    rep(j,n)if(d[a[j]][b[j]]==INF){
        cout<<-1<<endl;
        return 0;
    };
    for(auto it:st) sum+=p[it];
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int N,M,ans(0);
vector <int> connect[8];
int passed[8]={0},node(0);

int dfs(int n){
  passed[n]=1;
  node++;
  if (node==N) ans+=1;
  for (int i(0);i<connect[n].size();i++){
    if (passed[connect[n][i]]==0) dfs(connect[n][i]); // is not still path
  }
  passed[n]=0;
  node--;
  return 0;
}

int main() {
  cin>>N>>M;
  for (int i(0);i<M;i++) {
    int a,b;
    cin>>a>>b;
    connect[b-1].push_back(a-1);
    connect[a-1].push_back(b-1);
  }
  dfs(0);
  cout<<ans<<endl;
  return 0;
}


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


int main() {
  int x, a;
  cin >> x >> a;
  cout << (x<a? "0":"10") << endl;
  return 0;
}

Measured memory_bytes: 3588
#include<cstdio>

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

using namespace std;

int m,n,book[100];

bool check(int w){
	int h=1,pos=0;
	rep(i,n){
		if(book[i]>w)	return false;
		if(pos+book[i]<=w)	pos+=book[i];
		else				pos=book[i],h++;
	}
	return h<=m;
}

int main(){
	while(scanf("%d%d",&m,&n),m){
		rep(i,n)	scanf("%d",book+i);

		int lo=0,hi=1500000;
		while(lo<hi){
			int mi=(lo+hi)/2;
			if(check(mi))	hi=mi;
			else			lo=mi+1;
		}

		printf("%d\n",lo);
	}

	return 0;
}

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

// helpers
const parseLines = (
  lines: string[]
): { N: number, A: number[], B: number[] } => {
  const N = +lines[0]
  const A = lines[1].split(' ').map(line => +line)
  const B = lines[2].split(' ').map(line => +line)
  const obj = { N, A, B }
  debug(obj)
  return obj
}

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

  let killed = 0
  for (let i = 0; i < N; i++) {
    if (heros[i] === monsters[i]) {
      killed += monsters[i]
      continue
    }
    if (heros[i] > monsters[i]) {
      killed += monsters[i]
      const remainPower = heros[i] - monsters[i]
      if (remainPower >= monsters[i+1]) {
        killed += monsters[i+1]
        monsters[i+1] = 0
      } else {
        killed += remainPower
        monsters[i+1] = monsters[i+1] - remainPower
      }
    } else {
      killed += heros[i]
    }
  }
  return `${killed}`
}

// 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: 31576
//Dragon_warrior7(IITK)
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define pll pair<ll, ll> 
#define ull unsigned ll
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
#define deb(x) cout<<#x<<' '<<'='<<' '<<x<<'\n'
//typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}
// const int mod=1e9+7;
// ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// ll modInverse(ll a){return power(a,mod-2);}
ll n,m,a,b,c,k,temp,x,y;
void solveforthiscase(const int & test)
{//deb(test);
cin>>n;
vll v(n);
read(v);
ll count4=0;
ll count2=0;
for(int i=0;i<n;i++)
{
    if(v[i]%4==0)
    count4++;
    else
    if(v[i]%2==0)
    count2++;
}
if(count4*2+1>=n)
{
    cout<<"Yes";
}
else if(count4*2+count2>=n)
{
    cout<<"Yes";
}
else
cout<<"No";






return ;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
// 	cin>>test;
    for(int i=1;i<=test;i++)
    {
        solveforthiscase(i);
    }
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int H, W;
string A[1001];

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

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

	queue<pair<pair<int, int>, int>> q;
	cin >> H >> W;
	rep(i, 0, H)
	{
		cin >> A[i];
		rep(j, 0, W)
		{
			if (A[i][j] == '#')
			{
				q.push(make_pair(make_pair(j, i), 0));
			}
		}
	}

	int ans = -1;
	while (!q.empty())
	{
		auto p = q.front();
		q.pop();

		ans = p.second;

		rep(i, 0, 4)
		{
			int nx = p.first.first + dx[i];
			int ny = p.first.second + dy[i];

			if (0 <= nx && nx < W && 0 <= ny && ny < H&&A[ny][nx] == '.')
			{
				A[ny][nx] = '#';
				q.push(make_pair(make_pair(nx, ny), ans + 1));
			}
		}
	}

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

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

int main ( void )
{
	string s;
	int i;
	cin >> s;

	size_t size = s.length ( );

	if ( ( size < 1 ) || ( 100 < size ) ){
		cout << "ERROR!\n";
		return 0;
	}

	for ( i = 0; i < size; i++ ){
		if ( islower ( s[i] ) == 0 ){
			cout << "ERROR!\n";
			return 0;
		}
	}

	for ( i = 0; i < size; i++ )
		cout << "x";

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

Measured memory_bytes: 256
<?php

class Magic
{
    public $d;
    public $c;
}

sscanf(fgets(STDIN), "%d %d", $h, $n);

$mag = [];
for ($i = 0; $i < $n; $i++) {
    list($d, $c) = fscanf(STDIN, "%d %d");
    $mag[] = [$d, $c]; 
}

$arr[0] = 0;

for ($i = 0; $i < $h; $i++) {
    if (!isset($arr[$i])) continue;
    
    $prev = $arr[$i];
    foreach ($mag as $magic) {
        $idx = min($h, $i + $magic[0]);
        
        if (!isset($arr[$idx]))
            $arr[$idx] = $prev + $magic[1];
        else
            $arr[$idx] = min($prev + $magic[1], $arr[$idx]);
    }
}

echo $arr[$h];

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, a[100];

int main() {
	cin >> n;
	//inc(i, n) { cin >> a[i]; }
	
	
	cout << 48 - n << endl;
	
	return 0;
}


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

int main(){
  int a,b,k;
  cin >> a >> b >> k;
  set <int> set1={};
  for(int i=a;i<min(b+1,a+k);i++){
      set1.insert(i);
  }
  for(int i=b;i>max(a-1,b-k);i--){
      set1.insert(i);
  }
  auto itr = set1.begin();
  for(int i=0;i<set1.size();i++){
      cout << *itr << endl;
      itr++;
  }
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (ll NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (ll NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (ll NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll INF =1000000000000000;

int main(){
  ll n,x,a,b,c;cin >> n >> x;
  ll ans = n;
  a = max(x,n-x);
  b = min(x,n-x);//a >= b
  
  while(b != 0){
    ans += 2*(b*(a/b));
    c = a;
    a = b;
    b = c%b;
    //cout << ans << endl;
  }
  
  ans -= a;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
  
using namespace std;
  
int main()
{
	int a,d,n;

	while(cin >> a >> d >> n && (a || d || n))
	{
		int tmp = a;
		int count = 0;

		while(true)
		{
			bool flag = true;

			if(tmp == 2)count++;

			for(int i = 2;i <= tmp/i;i++)
			{
				flag =false;
				double tmp2 = (double)tmp/(double)i;
				if(ceil(tmp2) == floor(tmp2))
				{
					flag = true;
					break;
				}
			}
			if(!flag)count++;

			if(count == n)break;

			tmp += d;
		}

		cout << tmp << endl;
	}

	return 0;
}

Measured memory_bytes: 1164
X,N = map(int,input().split())
ls1 = list(map(int,input().split()))
X1 = X
X2 = X
if not X1 in ls1:
    print(X1)
else:
    for i in range(100):
        X1 = X1 -1
        X2 = X2 +1
        if not X1 in ls1:
            print(X1)
            break
        if not X2 in ls1:
            print(X2)
            break

Measured memory_bytes: 9196
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << "[" << pa.first << ", " << pa.second << "]";
}

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  os << "{";
  for (int i = 0; i < vec.size(); i++)
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  os << "}";
  return os;
}

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl

// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

bool comp(const P& a,const P& b){
  return (a.second-a.first)<(b.second-b.first);
}

//とりあえず1-indexedでつくったBIT
class BinaryIndexedTree {
  private:
  long long n;
  std::vector<long long> bit;

  public:
  BinaryIndexedTree(long long i) : n(i), bit(i + 1, 0){};

  // a番目にwを加算
  void add(long long a, long long w) {
    for (long long x = a; x <= n; x += (x & -x)) {
      bit[x] += w;
    }
  }

  //[1,a]の和
  long long sum(long long a) {
    long long ret = 0;
    for (long long x = a; x > 0; x -= (x & -x)) {
      ret += bit[x];
    }
    return ret;
  }

    //各項がすべて非負のものに対して、sum[1,a]>=keyを満たす最小のaを返す 存在しないなら-1返す
  long long lower_bound(long long key){
    long long len=1,temp=n,now=0,value=0,flag;
    while(temp/2!=0){
      len*=2;
      temp/=2;
    }

    while(len>0){
      while(now+len>n)len/=2;

      if(value+bit[now+len]>=key){
        len/=2;
      }else{
        now+=len;
        value+=bit[now];
        len/=2;
        if(now==n){
          return -1;
        }
      }
    }

    now++;
    return now;
  }
};

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

  ll n,m;
  std::cin>>n>>m;

  std::vector<P> ivl(n);
  rep(i,0,n){
    ll l,r;
    std::cin>>l>>r;
    ivl[i]={l,r};
  }

  std::sort(all(ivl),comp);

  BinaryIndexedTree bit(m+10);
  ll now=0;

  rep(i,1,m+1){
    while(now<n&&ivl[now].second-ivl[now].first+1<i){
      bit.add(ivl[now].first,1);
      bit.add(ivl[now].second+1,-1);
      now++;
    }
    ll cnt=0;
    for(ll j=i;j<=m;j+=i){
      cnt+=bit.sum(j);
    }
    std::cout<<cnt+n-now<<"\n";
  }

  return 0;
}

Measured memory_bytes: 6400
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    double ans = 0;
    int tmp;
    double n;
	cin >> n;
	
    cout << 2* n * M_PI << endl;
}

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

using namespace std;

const int MAX_N = 1e5 + 10;

vector<int> G[MAX_N];
int A[MAX_N];
bool flag = true;

long long dfs(int u, int fa)
{
	if (G[u].size() == 1)
		return A[u];
	long long sum = 0;
	long long mx = 0;
	for (int v : G[u])
	{
		if (v == fa)
			continue;
		long long t = dfs(v, u);
		sum += t;
		mx = max(mx, t);
	}
	long long mxp = mx > sum - mx ? sum - mx : sum / 2;
	long long p = sum - A[u];
	long long rem = A[u] - p;
	if (p < 0 || p > mxp)
		flag = false;
	return rem;
}

int main()
{
	int N; cin >> N;
	for (int i = 1; i <= N; ++i)
		cin >> A[i];
	for (int i = 1; i < N; ++i)
	{
		int u, v;
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	if (N == 2)
	{
		cout << (A[1] == A[2] ? "YES" : "NO") << endl;
		return 0;
	}
	int rt = 0;
	for (int i = 1; i <= N; ++i)
		if (G[i].size() > 1)
			rt = i;
	cout << (dfs(rt, 0) == 0 && flag ? "YES" : "NO") << endl;
	return 0;
}


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

int main(){

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

	long long n ;
	cin >> n ;
	long long m ;
	cin >> m ;
	long long a ;
	cin >> a ;
	m = min(a, m) ;
	cin >> a ;
	m = min(a, m) ;
	cin >> a ;
	m = min(a, m) ;
	cin >> a ;
	m = min(a, m) ;

	cout << (n-1)/m+5 ;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
int main() {
ll n;
cin>>n;
ll f=0;
ll counter=0;
ll a[n]={};
ll dp[1000010]={};
set <ll> q;
for(ll i=0; i<n; i++){
cin>>a[i];}
sort(a,a+n);
if(a[0]==1){
if(a[1]==1){
cout<<0<<endl;}
else
cout<<1<<endl;}
else{
for(ll i=0; i<n; i++){
f=a[i];
if(q.count(f)){
dp[f]=-1;
continue;}
q.insert(f);
for(ll k=2; k*f<=1000000; k++){
dp[f*k]=-1;
}}
for(ll i=0; i<n; i++){
if(dp[a[i]]!=-1)
counter++;}
cout<<counter<<endl;}}


Measured memory_bytes: 22280
using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _158_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = ReadLine();
            string[] array = input.Split(' ');
            ulong[] n = new ulong[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                n[i] = ulong.Parse(array[i]);
            }
            ulong sum = n[1] + n[2];
            ulong result1 = n[0] / sum;
            ulong result2 = n[0] % sum;
            ulong result3 = 0;
            if (result2 > n[1])
            {
                result3 = result1 * n[1] + n[1];
            }
            else {
                result3 = result1 * n[1] + result2;
            }
            WriteLine("{0}", result3);
            ReadKey();
        }
    }
}


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

int main() {
  int x;
  cin >> x;
  if (x >= 400 && x <= 599) {
    cout << '8' << endl;
  } else if (x >= 600 && x <= 799) {
    cout << '7' << endl;
  } else if (x >= 800 && x <= 999) {
    cout << '6' << endl;
  } else if (x >= 1000 && x <= 1199) {
    cout << '5' << endl;
  } else if (x >= 1200 && x <= 1399) {
    cout << '4' << endl;
  } else if (x >= 1400 && x <= 1599) {
    cout << '3' << endl;
  } else if (x >= 1600 && x <= 1799) {
    cout << '2' << endl;
  } else if (x >= 1800 && x <= 1999) {
    cout << '1' << endl;
  }
  return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC 120, task c, 2020/09/13
//ms,

/*
*/

int main(void){
  string S;
  cin >>S;
  int r=0;
  int b=0;
  for(size_t i=0;i<S.size();i++){
    if(S.at(i)=='0') r++;
    else b++;
  }
  cout <<2*min(r,b)<<endl;
  return 0;
}
/*
*/


Measured memory_bytes: 3748
#include <stdio.h>
int main(void){
    int X,Y,Z;
    scanf("%d%d%d", &X, &Y, &Z);

    int ans = 0;
    while (1){
        if (Y * ans + Z * (ans + 1) <= X){
            ans += 1;
        }
        else {
            break;
        }
    }
    printf("%d\n", ans - 1);

    return 0;
}


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

int main() {
	string s; cin >> s;
	int q; cin >> q;
	bool elf = true;
	deque<char> que;
	rep(i, s.size()) que.emplace_back(s[i]);
	rep(ri, q) {
		int t; cin >> t;
		if (t == 1) {
			elf = (elf ? false : true);
		}
		else {
			int f; char c;
			cin >> f >> c;
			if (f == 1) {
				if (elf) que.emplace_front(c);
				else que.emplace_back(c);
			}
			else {
				if (elf) que.emplace_back(c);
				else que.emplace_front(c);
			}
		}
	}
	if (!elf) reverse(que.begin(), que.end());
	rep(i, que.size()) cout << que[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 896
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>

using namespace std;

typedef long long in;

int main(){
    int n;
    cin >> n;
    vector<int> t(n);
    in sum=0;
    for(int i=0;i<n;i++){
        cin >> t[i];
        sum+=t[i];
    }
    int m;
    cin >> m;
    vector<int> p(m);
    vector<int> x(m);
    for(int i=0;i<m;i++){
        cin >> p[i] >> x[i];
        p[i]--;
    }
    for(int i=0;i<m;i++){
        sum-=t[p[i]];
        sum+=x[i];
        cout << sum << endl;
        sum-=x[i];
        sum+=t[p[i]];
    }
    return 0;

}


Measured memory_bytes: 764
#include<stdio.h>
long long a[100001];
void quickSort(int i,int j){
	int p=i,q=j,t;long long mid;
	if(i>=j) return;
	i--;j++;
	mid=a[(i+j)/2];
	while(1){
		while(a[++i]>mid);
		while(a[--j]<mid);
		if(i<j){
			t=a[i];
			a[i]=a[j];
			a[j]=t;
		}
		else
			break;
	}
	quickSort(j+1,q);
	quickSort(p,i-1);
}
int main(){
	int n,m,i,j=1;
	long long sum=0,index=2;
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++)
		scanf("%lld",&a[i]);
	if(n==1){
		for(;m>0;m--){
			a[0]/=2;
			if(a[0]==0)
				break;
			}	
		printf("%lld",a[0]);
		return 0;			
	}	
	quickSort(0,n-1);
	while(index<=a[0]){
		index*=2; 
	}
	while(m>0){
		index/=2;
		for(i=0;i<n;i++)
			if(a[i]<index)
				break;
		m-=i;
		if(m<0){
			quickSort(0,n-1);
			for(j=0;j<m+i;j++)
				a[j]/=2;
		}
		else{
			for(j=0;j<i;j++)
				a[j]/=2;
		}
	}
	for(i=0;i<n;i++){
		sum+=a[i];
	}
	printf("%lld",sum);
	return 0;
} 

Measured memory_bytes: 896