akhauriyash/Code-Regression huggingface dataset:
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
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);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    ll n;
    cin>>n;
    vl v;
    rep(i,n+1)
    {
        ll c;
        cin>>c;
        v.pb(c);
    }
    ll ans=0;
    ll branches=0;
    ll lim[n+1]={0};
    lim[0]=1;
    for(int i=1;i<=n;i++)
    {
        ll temp=(lim[i-1]-v[i-1])*2;
        if(temp>1e16)
            temp=1e16;
        lim[i]=temp;
    }
    for(int i=n;i>=0;i--)
    {
        ll maxi=branches+v[i];
        ll mini=(branches+1)/2+v[i];
        if(mini>lim[i])
        {
            cout<<-1<<'\n';
            return;
        }
        if(maxi>=lim[i])
        {
            ans+=lim[i];
            branches=lim[i];
        }
        else
        {
            ans+=maxi;
            branches=maxi;
        }
    }
    cout<<ans<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 16784
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
int x;
cin>>x;
int Day = x%7;
if(Day == 0){
             cout<<"thu"<<endl;
            }
else if(Day == 1){
             cout<<"fri"<<endl;
            }
else if(Day == 2){
             cout<<"sat"<<endl;
            }
else if(Day == 3){
             cout<<"sun"<<endl;
            }
else if(Day == 4){
             cout<<"mon"<<endl;
            }
else if(Day == 5){
             cout<<"tue"<<endl;
            }
else {
             cout<<"wed"<<endl;            
}
}


Measured memory_bytes: 3100
def solve(S):
    N = len(S)
    i = 0
    while i < N:
        if N - i < 5:
            return False
        if S[i: i + 5] == "dream":
            if i + 7 <= N and S[i + 5: i + 7] == "er":
                if i + 7 == N or S[i + 7] != "a":
                    i += 7
                else:
                    i += 5
            else:
                i += 5
        elif S[i: i + 5] == "erase":
            if i + 5 < N and S[i + 5] == "r":
                i += 6
            else:
                i += 5
        else:
            return False
    return True

S = input()
print("YES" if solve(S) else "NO")

Measured memory_bytes: 3188
def solve(A, B, C, K):
  card_counts = [A,B,C]
  card_points = [1,0,-1]
  card_remain = K
  max_point = 0
  
  for i in range(3):
    if card_remain > card_counts[i]:
      card_remain -= card_counts[i]
      max_point += card_counts[i] * card_points[i]
    else:
      max_point += card_remain * card_points[i]
      break
  return max_point

A, B, C, K = map(int, input().split())
ans = solve(A, B, C, K)
print(ans)

Measured memory_bytes: 9120
#include<bits/stdc++.h>
namespace lib
{
	#define LL long long
	#define ull unsigned long long
	#define rgi register int
	#define rgl register long long
	#define rgc register char
	const double pi=acos(-1); 
	using namespace std;
	class fastio
	{
		private:
			#define _NUMLEN 112
			char _num[_NUMLEN],_ch; int _f,_head; bool _useSTD;
		public:
			fastio() {_f=0,_head=0,_useSTD=0,SUF=_ch=' ';}
			char SUF;
			inline void ioSTD() {_useSTD=1; ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); }
			inline void gc(char & _c) {if(_useSTD)cin>>_c; else _c=getchar(); }
			inline void pc(char _c) {if(_useSTD)cout<<_c; else putchar(_c); }
			template<typename _T> inline fastio & operator - (_T & _x)
			{
				if(_useSTD)cin>>_x; else{
					_x=0; 
					while(!isdigit(_ch)) _f|=_ch=='-',gc(_ch); 
					while(isdigit(_ch)) _x=(_x<<1)+(_x<<3)+(_ch^48),gc(_ch); 
					_f&&(_x=-_x,_f=0); 
				}return *this; 
			}
			template<typename _T> inline fastio & operator + (_T _x)
			{
				if(_useSTD)cout<<_x<<SUF; else{
					_T _k; 
					if(_x==0) {pc('0'),pc(SUF);return *this;} if(_x<0) pc('-'),_x=-_x;
					while(_x>0) _k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k; while(_head>0) pc(_num[_head]),--_head;
					pc(SUF);
				}return *this; 
			}
			template<typename _T> inline fastio & operator >> (_T & _x) {cin>>_x;return *this;}
			template<typename _T> inline fastio & operator << (_T _x) {cout<<_x;return *this;}
			#define edn pc('\n')
	}io;
	inline void fileio(string _r,string _w) {if(_r[0]!='-')freopen(_r.c_str(),"r",stdin); if(_w[0]!='-')freopen(_w.c_str(),"w",stdout); }
	#define mem(_x,_set) memset(_x,_set,sizeof(_x))
}
using namespace lib;
// ----------------------------

// #define int ll
const int maxn=100004;
const int mod=1000000007,inf=1000000007;

LL n, a, b, fac1 = 1LL, fac2 = 1LL, fac_a = 1LL, fac_b = 1LL;

LL qpow(LL base, LL power) {
	LL res = 1LL % mod;
	while (power) {
		if (power & 1) res = res * base % mod;
		base = base * base % mod;
		power >>= 1;
	}
	return res;
}

LL inv(LL x) { return qpow(x, mod - 2); }

int main() {
	scanf("%lld %lld %lld", &n, &a, &b);
	LL pre = (qpow(2, n) + mod - 1) % mod;
	for(LL i = n; i >= n - a + 1; --i) {
		fac1 = fac1 * i % mod;
	}
	for(LL i = 1; i <= a; ++i) {
		fac_a = fac_a * i % mod;
	}
	fac1 = fac1 * inv(fac_a) % mod;
	for(LL i = n; i >= n - b + 1; --i) {
		fac2 = fac2 * i % mod;
	}
	for(LL i = 1; i <= b; ++i) {
		fac_b = fac_b * i % mod;
	}
	fac2 = fac2 * inv(fac_b) % mod;
	
	printf("%lld", ((pre - fac1 - fac2) % mod + mod) % mod);
	
	return 0;
}

// ----------------------------
// by imzzy


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

int main(){
  int n;cin>>n;
  vector<int> c(n,0),s(n,0),f(n,0);
  REP(i,n-1) cin>>c.at(i)>>s.at(i)>>f.at(i);
  REP(i,n){
    int cc,ss,ff,t=0;
    for(int j=i;j<n-1;j++){
      cc=c.at(j);ss=s.at(j);ff=f.at(j);
      while(t<ss||t%ff)t++;
      t+=cc;
    }
    cout<<t<<endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var x = long.Parse(spl[0]);
        var k = long.Parse(spl[1]);
        var d = long.Parse(spl[2]);


        long xx = Math.Abs(x);
        
        var co = xx / d;

        if(k <= co) {
            return xx - d * k;
        }

        k -= co;

        long po = xx - d*co;
        
        if(Math.Abs(po - d) < po) {
            po = Math.Abs(po - d);
            k--;
        }

        //Debug.WriteLine("po:" + po);

        if(k % 2 == 0) return po;

        return Math.Abs(po - d);
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 27396
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}

int main(){
	int a;scanf("%d",&a);
	if(a==1){
		printf("Hello World\n");return 0;
	}
	int x,y;scanf("%d%d",&x,&y);printf("%d\n",x+y);
}

Measured memory_bytes: 128
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split())) 
    e = sum(B)
    for i in range(len(B)):
        attack = min(B[i],A[i])
        B[i] -= attack
        A[i] -= attack

        if i < N:
            attack = min(B[i],A[i+1])
            B[i] -= attack
            A[i+1] -= attack

    print(e-sum(B))



if __name__ == '__main__':
    main()


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

#define ll long long
#define ld long double
using namespace std;

int  main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    ll ma1 = 0;
    ll ma2 = 0;
    for (ll i = 1; i <= n; i++){
        ll x,y;
        cin >> x >> y;
        if (x > ma1){
            ma1 = x;
            ma2 = y;
        }
    }
    cout << ma2 + ma1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 int main() {
	int a,b,c;
   cin>>a>>b>>c;
   int max =a;
   if(b> max ) max =b;
   if(c> max ) max =c;

   cout<<a+b+c-max<<endl;
	}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

const int N = 1111, H = 11111;
int dp[H], a[N], b[N];
int h, n;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> h >> n;
    rep(i, 1, n) {
        cin >> a[i] >> b[i];
    }
    int ans = 1e9;
    rep(x, 1, H - 1) {
        dp[x] = 1e9;
        rep(i, 1, n) {
            if(a[i] <= x) {
                dp[x] = min(dp[x], dp[x - a[i]] + b[i]);
            }
        }
        if(x >= h) {
            ans = min(ans, dp[x]);
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main(void) {
    string S;
    cin >> S;
    int ans = 0, t = 0;
    for (int i = 0; i < 3; i++) {
        if (S[i] == 'R') {
            ++t;
        }

        if (S[i] == 'S' || i == 2) {
            ans = max(ans, t);
            t = 0;
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
using namespace std;
long long x,y,z;
map<long long,long long>use;
struct node
{
    long long g,s;
}a[100001];
bool cmp(const node a,const node b)
{
    return a.g-a.s<b.g-b.s;
}
long long tot,ansg[100001],anss[100001],ans=-1e18,sumg,sums,l,r;
int main()
{
    cin>>x>>y>>z;
    for(int i=1;i<=x+y+z;i++)
    {
        long long A,B,C;
        cin>>A>>B>>C;
        tot+=C;
        A-=C;
        B-=C;
        a[i].g=A;
        a[i].s=B;
    }
    sort(a+1,a+x+y+z+1,cmp);
    for(l=1;l<=y;l++)
    {
        use[a[l].s]++;
        sums+=a[l].s;
    }
    anss[y]=sums;
    for(;l<=y+z;l++)
    {
        if(a[l].s<=use.begin()->first)
        {
            anss[l]=sums;
            continue;
        }
        sums-=use.begin()->first;
        if(use.begin()->second>1)
            use.begin()->second--;
        else
            use.erase(use.begin());
        use[a[l].s]++;
        sums+=a[l].s;
        anss[l]=sums;
    }
    use.clear();
    for(r=x+y+z;r>y+z;r--)
    {
        use[a[r].g]++;
        sumg+=a[r].g;
    }
    ansg[y+z+1]=sumg;
    for(;r>=y;r--)
    {
        if(a[r].g<=use.begin()->first)
        {
            ansg[r]=sumg;
            continue;
        }
        sumg-=use.begin()->first;
        if(use.begin()->second>1)
            use.begin()->second--;
        else
            use.erase(use.begin());
        use[a[r].g]++;
        sumg+=a[r].g;
        ansg[r]=sumg;
    }
    for(int i=y;i<=y+z;i++)
        ans=max(ans,anss[i]+ansg[i+1]);
    cout<<ans+tot;
}

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

int main(){
    int w,h,x,y,r;
    cin >> w >> h >> x >> y >> r;
    if(x-r>=0 && y-r>=0 && w-x-r>=0 && h-y-r>=0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0; 
}


Measured memory_bytes: 3088
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn f(k: usize, v: &mut Vec<usize>) {
    for i in 2..k + 1 {
        if k % i == 0 {
            v[i] += 1;
            f(k / i, v);
            break;
        }
    }
}

fn main() {
    let n: usize = read();
    let mut prime_cnt = vec![0; 100];
    for k in 2..n + 1 {
        f(k, &mut prime_cnt);
    }
    let mut c2: u32 = 0;
    let mut c4: u32 = 0;
    let mut c14: u32 = 0;
    let mut c24: u32 = 0;
    let mut c74: u32 = 0;
    for i in 0..n {
        if prime_cnt[i] >= 2 {
            c2 += 1;
            if prime_cnt[i] >= 4 {
                c4 += 1;
                if prime_cnt[i] >= 14 {
                    c14 += 1;
                    if prime_cnt[i] >= 24 {
                        c24 += 1;
                        if prime_cnt[i] >= 74 {
                            c74 += 1;
                        }
                    }
                }
            }
        }
    }
    let mut ans = 0;
    ans += (c2 - 2) * c4 * (c4 - 1) / 2;
    ans += (c2 - 1) * c24;
    ans += (c4 - 1) * c14;
    ans += c74;
    println!("{}", ans);
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)
#define SORT(c) sort((c).begin(),(c).end())
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

void solve() {
  int N, A; cin >> N;
  double ans = 0;
  REP0(i, N) {
      cin >> A; 
      ans += (1/(double)A);
  }
  cout << (1/ans) << endl;
}

int main(int argc, char const *argv[])
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout<<std::fixed<<std::setprecision(10);
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

long long pow(long long a, long long n)
{
  long long temp = a;
  a = 1;
  for (long long i = 0; i < n; i++)
  {
    a *= temp;
    if (a >= 1000000007)
      a %= 1000000007;
  }
  return a;
}

int main(void)
{
  long long n, sum = 0;
  scanf("%lld", &n);
  sum = sum + (pow(10, n) % 1000000007);
  sum = (sum - (2 * (pow(9, n))));
  sum %= 1000000007;
  sum = sum + pow(8,n) % 1000000007;
  if (sum < 0)
    sum += 1000000007;
  printf("%lld\n", sum);
  return 0;
}


Measured memory_bytes: 1728
#include<bits/stdc++.h>
 
using namespace std;
 
//container util
//------------------------------------------
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
 
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define REACH(i,c) for(typeof((c).end()) i=(c).end(); i!=(c).begin(); --i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).begin(),(c).end(),greater<int>())
 
#define PB(a) push_back(a)
#define PF(a) pop_front(a)
 
#define MP(a,b) make_pair(a,b)
 
#define FS first
#define SE second
 
#define ALL(x) (x).begin(),(x).end()
#define MAX_EL(c) *max_element((c).begin(),(c).end())
#define MIN_EL(c) *min_element((c).begin(),(c).end())
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef string str;
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
//grobal var
//------------------------------------------
const int MAX = 100000*2;
const LL MOD = 100003;
LL fac[MAX],inv[MAX],finv[MAX];


// ---------------calculate combination nCk-----------
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
long long modPow(long long x, long long k) {
	long long ret = 1;	
	while (k > 0) {
		if (k & 1) modMul(ret, x, MOD);
		modMul(x, x, MOD);
		k >>= 1;
	}
	return ret;
}

int main(){
// magic spell------------------------------
  cin.tie(0);
  ios::sync_with_stdio(false);
//------------------------------------------
  int X,A;
  while(cin >> X >> A){
    int ans;
    ans = X<A ? 0 : 10;

    cout << ans << endl;

  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int fc(int x, int y, int z){
  return x*x + y*y + z*z +x*y + y*z + z*x;
}

int main(){
  map<int, int> mp;
  int n;
  cin >> n;
  rep2(i, 1, n+1){
    rep2(j, 1, n+1){
      if(i*i + j*j + i*j > n) break;
      rep2(k, 1, n+1){
        int ret = fc(i, j, k);
        if(ret > n) break;
        mp[ret]++;
      }
    }
  }
  rep2(i, 1, n+1){
    cout << mp[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include<cmath>
using namespace std;
int main()
{
		int t[100010],a[100010],b[100010],s=0,n;
		cin>>n;
		int flag=true,c=0,d=0;
		for(int i=1;i<=n;i++)
		{
			cin>>t[i]>>a[i]>>b[i];
			if(((t[i]-t[i-1])-(abs(a[i]-c)+abs(b[i]-d)))%2!=0||((t[i]-t[i-1])-(abs(a[i]-c)+abs(b[i]-d))<0))
			flag=false;
			c=a[i];
			d=b[i];
		}
		if(flag)
		cout<<"Yes"<<endl;
		else
		cout<<"No"<<endl;

	return 0;
}

Measured memory_bytes: 1408
// ABC117_B
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <set>
#include <map>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    int N;
    cin >> N;
    vector<int> vec(N);
    REP(i, N) cin >> vec[i];
    
    // calculation
    sort(vec.begin(), vec.end());
    int sum = 0;
    REP(i, N-1) {
        sum += vec[i];
    }
    
    if (sum > vec[N-1]) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }
    
    
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A_list = list(map(int,input().split()))

A_number = [int(x) for x in range(1,N+1)]

dic_A = dict(zip(A_list,A_number))
dic_A_sort = sorted(dic_A.items())

for i in range(N):
    print(dic_A_sort[i][1], end =" ")


Measured memory_bytes: 25860
#include<stdio.h>
int main()
{
    int n, a, b;
    scanf("%d %d %d", &n, &a, &b);
    int i, t;
    int ans = 0;
    for (i = 0; i < n; i++)
    {
        scanf("%d", &t);
        if (t < a || b <= t)
            ans++;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include<cstdio>
int main() {
	char s[11],t[11];
	scanf("%s", s);
	int j = 0;
	for (int i = 0; s[i] != '\0'; i++) {
		if (s[i] == '0' || s[i] == '1') {
			t[j] = s[i];
			j++;
		}
		else if(j>0){
			j--;
		}
	}
	t[j] = '\0';
	printf("%s", t);
	return 0;
}

Measured memory_bytes: 128
// Code by Nguyen Huu Lam
#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;

typedef long long LL;

#define y0 Sword_Art_Online
#define y1 Your_lie_in_April
#define yn Darling_in_the_Franxx
#define tm Plastic_Memories
#define lr Charlotte
#define norm Weathering_with_you
#define left Violet_Evergarden
#define have Date_a_live
#define ends Your_name
#define prev Five_centimeters_per_second
#define hash Slient_voice

#define ordered_set tree<LL, null_type, less<LL>, rb_tree_tag, tree_order_statistics_node_update>
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

LL Rand(LL l, LL h){
    return uniform_int_distribution<LL>(l, h)(rng);
}

template <typename T> void read(T &t){
    t = 0; char ch = getchar(); int f = 1;
    while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
    do { (t *= 10) += ch - '0'; ch = getchar(); } while (isdigit(ch)); t *= f;
}

const LL MaxN = 10 + 1e5;

LL n, a[MaxN], x, kq;
multiset<LL> s;

void InOut(){
    #define TASK "ABC"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
}

int main(){
    // InOut();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for(int i = 0 ; i < n ; ++i){
        cin >> x;
        a[x] = i + 1;
    }
    s.insert(0);
    s.insert(0);
    s.insert(n + 1);
    s.insert(n + 1);
    s.insert(a[n]);
    for(int i = n - 1 ; i > 0 ; --i){
        s.insert(a[i]);
        auto it = s.lower_bound(a[i]);
        LL x1 = *(--it), x2 = *(--it);
        it++;
        it++;
        LL x3 = *(++it), x4 = *(++it);
        kq += ((x1 - x2) * (x3 - a[i]) + (x4 - x3) * (a[i] - x1)) * i;
    }
    cout << kq << endl;

    return 0;
}

Measured memory_bytes: 5760
/*
AuThOr Gwj
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	fastio;
	LL a;
	vector<char> c;
	cin>>a;
	while(a){
		c.PB(((a%26)-1+26)%26+'a');
		int tmp=a%26;
		if(tmp==0) tmp=26;
		a-=tmp;
		a/=26;
	}
	reverse(ALL(c));
	for(auto it:c)
	{
		cout<<it;
	}
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<long long int> a(n);
  int zer = 0;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    if(a[i] == 0) zer = 1;
  }
  long long int ans = 1;
  for(int i = 0; i < n; i++){
    if(ans == 0){
      cout << "0" << endl;
      return 0;
    }
    long long int op = 1000000000000000000LL/ans;
    long long int p = (1000000000000000001LL)/ans;
    if(p != op) p = op;
    if(a[i] > p){
      if(zer == 0){
        cout << "-1" << endl;
        return 0;
      }
    }
    ans = ans * a[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K;cin>>N>>K;K--;
  vector<int>h(N);
  for(int &g:h)cin>>g;
  sort(h.begin(),h.end());
  int ans=INT_MAX;
  for(int i=0;i+K<N;i++)
    ans=min(ans,h[i+K]-h[i]);
  cout<<ans<<endl;
}

Measured memory_bytes: 640
program Wall
    implicit none
    integer(4):: h,w,c(0:9,0:9), changer(0:9)
    integer(4):: i,j,ans
    integer(4),allocatable:: a(:,:)

    read*, h,w

    do i=0,9
        read*, c(:,i)
    end do

    allocate(a(w,h))

    do i=1,h
        read*, a(:,i)
    end do

    call warf(c)

    changer(0:9) = c(1,0:9)

    ans=0
    do i=1,h
        do j=1,w
            if (a(j,i) == -1) cycle
            ans = ans + changer(a(j,i))
        end do
    end do
    print*, ans
contains
    subroutine warf(det)
        integer(4):: det(:,:)
        integer(4):: i,j,k,l
        
        l = size(det,dim=1)
        do k=1,l
            do i=1,l
                do j=1,l
                    det(i,j) = min(det(i,j), det(i,k)+det(k,j))
                end do
            end do
        end do
    end subroutine
end program Wall

Measured memory_bytes: 384
n,m = map(int,input().split())
g = [set() for i in range(n)]
visited = [False] * n
group = []

for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    g[a].add(b)
    g[b].add(a)

for i in range(n):
    if visited[i]:
        continue
    s = set()
    q = [i]
    while len(q) > 0:
        p = q.pop()
        visited[p] = True
        s.add(p)
        for x in g[p]:
            if visited[x]:
                continue
            q.append(x)
    group.append(s)

ans = 0
for x in group:
    ans = max(ans, len(x))
print(ans)

Measured memory_bytes: 160764
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <limits>
#include <type_traits>

using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;
 
int main() {
    int N;
    double v[Nmax];
    cin >> N;
    FOR(i,0,N){
        cin >> v[i];
    }
    sort(v, v+N);
    FOR(i,0,N-1){
        v[i+1] = (v[i]+v[i+1]) / 2;
    }
	cout << v[N-1] << endl;
 }

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <sstream>

using namespace std;
typedef unsigned int ui;

int main(){
  int Q;

  double c[7];
  for(int i = 0 ; i < 7 ; i++){
    c[i] = pow(0.5,i+1);
  }


  cin >> Q;
  while(Q--){
    ui s;

    scanf("%x" ,&s);
    ui integer = (s & 0x7fffffff) >> 7;
    ui decimal = (s & 0x0000007f);

    double d = 0;
    for(int i = 0 ; i < 7 ; i++){
      if((1 << i) & decimal)
	d += c[6-i];
    }    

    char str[10];
    sprintf(str,"%.7f" ,d);

    int pos = -1;
    for(int i = 8 ; i >= 0 ; i--){
      if(str[i] != '0' && str[i] != '.'){
	pos = i;
	break;
      }
    }

    if((s >> 31) & 1) cout << '-';
    cout << integer << '.';
    
    if(pos == -1) cout << '0' << endl;
    else{
      for(int i = 2 ; i <= pos ; i++){
	cout << str[i];
      }
      cout << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 1316
#include<algorithm>
#include<vector>
#include<stack>
#include<deque>
#include<iostream>
#include<cstdio>
#define F first
#define S second
#define LIM 1000000010
#define pb push_back
#define all(n) n.begin(),n.end()
using namespace std;
typedef pair<int,int> P;
short dp[5002][5002];
int main(){
  int n,m;
 
  vector<int> X,Y;
  
  while(scanf("%d%d",&n,&m) != EOF){
    for(int i=0;i<n;i++)for(int j=0;j<n;j++)dp[j][i] = 0;
    for(int i=0;i<n;i++){
      int x,y;
      scanf("%d %d",&x,&y);
      X.pb(x); Y.pb(y);
    }
    vector<int> x,y;
    x = X;
    y = Y;
    X.pb(-LIM); X.pb(LIM); Y.pb(-LIM); Y.pb(LIM);
    sort(all(X)); sort(all(Y));
    X.erase(unique(all(X)),X.end());
    Y.erase(unique(all(Y)),Y.end());
    for(int i=0;i<n;i++){
      x[i] = find(all(X),x[i])-X.begin();
      y[i] = find(all(Y),y[i])-Y.begin();
      dp[y[i]][x[i]]++;
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	dp[i+1][j+1] += dp[i+1][j]+dp[i][j+1]-dp[i][j];

      }

    }
    for(int i=0;i<m;i++){
      int sx,sy,gx,gy;
      scanf("%d %d %d %d",&sx,&sy,&gx,&gy);
      sx = lower_bound(all(X),sx)-X.begin();
      sy = lower_bound(all(Y),sy)-Y.begin();
      gx = upper_bound(all(X),gx)-X.begin()-1;
      gy = upper_bound(all(Y),gy)-Y.begin()-1;
      cout << dp[gy][gx]-dp[gy][sx-1]-dp[sy-1][gx]+dp[sy-1][sx-1] << endl;

    }



  }
  return 0;
}

Measured memory_bytes: 50184
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iomanip>

using namespace std;

#define forn(i,n) for (int i = 0; i < int(n); i++)
#define ford(i,n) for (int i = int(n) - 1; i >= 0; i--)
#define fore(i,l,r) for (int i = int(l); i <= int(r); i++)
#define all(a) a.begin(), a.end()
#define sz(a) int(a.size())
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define x first
#define y second

template<typename X> inline X abs(const X& a) { return a < 0 ? -a : a; }
template<typename X> inline X sqr(const X& a) { return a * a; }

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

const int INF = int(1e9);
const li INF64 = li(1e18);
const ld EPS = 1e-9;
const ld PI = acosl(ld(-1));

string s;
int k;

inline bool read()
{
	if (!getline(cin, s))
		return false;
	assert(cin >> k);

	return true;
}

inline void solve()
{
	forn (i, sz(s))
	{
		if (!k)
			break;
			
		if (s[i] == 'a')
			continue;
			
		int need = ('z' - s[i]) + 1;
		if (need > k)
			need = 0;
			
		k -= need;
		s[i] = (s[i] - 'a' + need) % 26 + 'a';
	}
	
	s[sz(s) - 1] = (s[sz(s) - 1] - 'a' + k) % 26 + 'a';
	
	cout << s << endl;
}

int main()
{
#ifdef SU2_PROJ
	assert(freopen("input.txt", "r", stdin));
	assert(freopen("output.txt", "w", stdout));
#endif

	cout << setprecision(25) << fixed;
	cerr << setprecision(10) << fixed;

	srand(int(time(NULL)));

	assert(read());
	solve();

#ifdef SU2_PROJ
	cerr << "TIME: " << clock() << endl;
#endif

	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
  
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}
  
/*------------------------------------------------------------------*/
int main(){
    char b; cin >> b;
    if(b == 'A')cout << 'T' << endl;
    else if(b == 'T')cout << 'A' << endl;
    else if(b == 'C')cout << 'G' << endl;
    else cout << 'C' << endl;
}

Measured memory_bytes: 256
// AtCoder ABC131: B - Bite Eating
// 2019.9.3 bal4u

#include <stdio.h>

#define ABS(x)  ((x)>=0?(x):-(x))

int main()
{
	int i, L, N, ans, mi, x;
	
	scanf("%d%d", &N, &L);
	mi = 1000;
	for (i = 0; i < N; i++) {
		if (ABS(L+i) < mi) x = L+i, mi = ABS(x);
	}
	printf("%d\n", N*L+(N-1)*N/2 - x);
	return 0;
}



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


int main(void) {
    using namespace std;

    constexpr long MOD = 998244353;
    auto powm = [&](long a, long b) {
        long r = 1;
        while(b) {
            if(b&1) r *= a, r %= MOD;
            a *= a, a %= MOD;;
            b >>= 1;
        }
        return r;
    };

    long n;
    cin >> n;
    vector<long> d(n);
    for(auto &x: d) cin >> x;

    map<long,long> m;
    long mx = 0;
    for(auto &x: d) m[x]++, mx = max(mx, x);

    if(!(d[0] == 0 && m[0] == 1)) {
        cout << 0 << endl;
        return 0;
    }

    long r = 1;
    for(int i=1; i<=mx; i++) {
        r *= powm(m[i-1], m[i]), r %= MOD;
    }

    cout << r << endl;
}


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

using namespace std;

int n;
int m[18][18];
long long dp[1 << 17];

int main() {
    
    scanf("%d", &n);

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

    long long ans = -1e17;
    for (int i = 0; i < (1 << n); ++i) {
        vector<int> v;
        for (int j = 0; j < n; ++j)
            if(i & (1 << j)) v.push_back(j);
        
        for (int j = 0; j < (int)v.size(); ++j)
            for (int k = j + 1; k < (int)v.size(); ++k)
                dp[i] += m[v[j]][v[k]];
        
        int mask = i;

        while(mask) {
            int cur = mask ^ i;
            dp[i] = max(dp[i], dp[mask] + dp[cur]);
            ans = max(ans, dp[i]);
            mask = (mask - 1) & i;
        }
    }

    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 768
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include<stdbool.h>
typedef long long ll;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define swap(a,b) {ll tp=a;a=b;b=tp;}
const ll MOD = 1000000007;

int main(){
    int n; scanf("%d", &n);
    int a[101010], ch[101010] = {0};
    rep(i,n) scanf("%d", a+i+1);
    int ans = 0, tmp = 1;
    while(tmp != 2 && ch[tmp] == 0){
        ch[tmp] = 1;
        ans++;
        tmp = a[tmp];
    }
    if(tmp != 2) ans=-1;
    printf("%d", ans);
}


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

constexpr ll mod=998244353;

struct LazySegmentTree {
private:
    int n;
    vector<ll> node, lazy;

public:
    LazySegmentTree(vector<ll> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1, 0);

        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }

    void eval(int k, int l, int r) {
        if(lazy[k] != 0) {
            (node[k] += lazy[k])%=mod;
            if(r - l > 1) {
                lazy[2*k+1] += lazy[k] / 2;
                lazy[2*k+2] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
    }

    void add(int a, int b, ll x, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] += (r - l) * x;
            eval(k, l, r);
        }
        else {
            add(a, b, x, 2*k+1, l, (l+r)/2);
            add(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = (node[2*k+1] + node[2*k+2])%mod;
        }
    }
    ll getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return node[k];
        ll vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        ll vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return (vl + vr)%mod;
    }
};

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	LazySegmentTree dp(vector<ll>(n+1,0));
	dp.add(1,2,1);
	int k; cin >> k;
	vector<int> l(k),r(k);
	for(int i=0;i<k;i++){
		cin >> l[i] >> r[i];
	}
	for(int i=1;i<n;i++){
		for(int j=0;j<k;j++){
			if(i+l[j]>n)continue;
			ll p=dp.getsum(i,i+1);
			dp.add(i+l[j],min(n+1,i+r[j]+1),p);
		}
	}
	// for(int i=1;i<=n;i++){
	// 	cout << dp.getsum(i,i+1) << endl;
	// }
	cout << dp.getsum(n,n+1) << endl;
}

Measured memory_bytes: 12976
N,K = map(int,input().split())
P = list(map(int,input().split()))
P = list(map(lambda x: (x+1)/2,P))

S = sum(P[0:K])
O = [S]
for i in range(N-K):
    S = S + P[K+i] - P[i]
    O.append(S)

print(max(O))

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

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

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

int main()
{
    ll a, b;
    scanf("%lld %lld", &a, &b);

    ll g = gcd(a, b);

    vector<int> fac;
    for (ll i = 2; i * i <= g; i++) {
        int cnt = 0;
        while (g % i == 0) {
            g /= i;
            cnt++;
        }

        if (cnt > 0)
            fac.push_back(i);
    }

    if (g > 1)
        fac.push_back(g);

    printf("%d\n", (int)fac.size() + 1);

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
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 (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール
#include <random>

// 処理内容
int main() {
    
    ll n; cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];

    // ll n = 10;
    // vector<ll> a(n);

    // mt19937_64 mt(114514);
    // uniform_int_distribution<ll> rg(0, n-1);
    // REP(t, 10) {
    //     ll i = t;
    //     REP(j, n) {
    //         ll k = (i + j) % n;
    //         a[k] += j;
    //     }
    // }

    ll sum = accumulate(ALL_OF(a), 0LL);
    if (sum % (n * (n + 1) / 2) != 0) {
        cout << "NO" << endl;
        return 0;
    }

    ll opnum = sum / (n * (n + 1) / 2);

    vector<ll> d(n);
    REP(i, n) d[i] = a[(i+1)%n] - a[i] - opnum;

    bool okay = true;
    ll opcur = 0;
    REP(i, n) {
        if (d[i] % n == 0) {
            ll opterm = -d[i] / n;
            if (opterm < 0) {
                okay = false;
                break;
            } else {
                opcur += opterm;
            }
        } else {
            okay = false;
            break;
        }
    }
    cout << YES(okay) << endl;

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
  int n;
  cin >> n;
  if(n==0||n==2)n=1;
  else if(n==1)n=2;
  else n=0;
  cout << n << endl;
  return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
#define llint long long
#define inf 1e18
#define mod 1000000007

using namespace std;

llint n, K;
llint h[305];
llint dp[305][305][305];
llint mn[305];
vector<llint> comp;

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

	cin >> n >> K;
  for(int i = 1; i <= n; i++) cin >> h[i];
  for(int i = 0; i <= n; i++) comp.push_back(h[i]);
  sort(comp.begin(), comp.end());
  comp.erase(unique(comp.begin(), comp.end()), comp.end());
  for(int i = 0; i <= n; i++) h[i] = lower_bound(comp.begin(), comp.end(), h[i]) - comp.begin();
  llint m = comp.size();

  for(int i = 0; i <= n; i++){
    for(int j = 0; j <= K; j++){
      for(int k = 0; k < m; k++){
        dp[i][j][k] = inf;
      }
    }
  }
  dp[0][0][0] = 0;

  mn[m] = inf;
  for(int i = 1; i <= n; i++){
    for(int j = 0; j <= K; j++){
      if(j > 0){
        for(int k = m-1; k >= 0; k--){
          mn[k] = min(mn[k+1], dp[i-1][j-1][k]);
        }
        llint mn2 = inf;
        for(int k = 0; k < m; k++){
          mn2 = min(mn2, dp[i-1][j-1][k] - comp[k]);
          dp[i][j][k] = min(dp[i][j][k], mn2+comp[k]);
          dp[i][j][k] = min(dp[i][j][k], mn[k]);
        }
      }
      for(int k = 0; k < m; k++){
        if(k > h[i]) dp[i][j][h[i]] = min(dp[i][j][h[i]], dp[i-1][j][k]);
        else dp[i][j][h[i]] = min(dp[i][j][h[i]], dp[i-1][j][k] + comp[h[i]]-comp[k]);
      }
    }
  }

  /*for(int i = 1; i <= n; i++){
    for(int j = 0; j <= K; j++){
      for(int k = 0; k < m; k++){
        cout << dp[i][j][k] << " ";
      }
      cout << endl;
    }
    cout << endl;
  }*/

  llint ans = inf;
  for(int j = 0; j <= K; j++){
    for(int k = 0; k < m; k++){
      ans = min(ans, dp[n][j][k]);
    }
  }
  cout << ans << endl;

	return 0;
}


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

#define debug(x) cerr<<#x<<'='<<x<<endl
#define set0(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();ll f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}

ll dp[253][253][32] = {0};

int n,c,l[10],perm[10];

int main() {
	read(n);read(c);
	ll fm = 1;
	for(int i=0;i<n;i++){
		read(l[i]);
		perm[i] = i;
		if(i)fm*=i*c;
	}
	sort(l,l+n);
	ll ans = 0;
	do{
		memset(dp,0,sizeof(dp));
		int m = (n-1);
		dp[0][m*l[m]][0] = 1;
		for(int j=0;j<m*c;j++){
			//cout<<j<<' '<<(1<<(j%m))<<endl;
					
			for(int k=1;k<m*c;k++){
				for(int cc = 0;cc<1<<m;cc++){
					//if(dp[j][k][cc])cout<<j<<' '<<k<<' '<<cc<<' '<<dp[j][k][cc]<<endl;
					if(!dp[j][k][cc])continue;
					dp[j+1][k-1][cc]+=dp[j][k][cc];
					if((cc&(1<<(j%m))) == 0){
						dp[j+1][max(k,m*l[perm[j%m]])-1][cc|(1<<(j%m))]+=dp[j][k][cc];
					}
				}
			}
		}
		for(int k=0;k<m*c;k++) ans+=dp[m*c][k][(1<<m)-1];
		//return 0;
	}while(next_permutation(perm,perm+n-1));
	//cout<<ans<<' '<<fm<<endl;
	cout<<setprecision(25)<<fixed<<(double)ans/fm<<endl;
	return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  ll x,y;
  cin >> x>>y;
  int ans=1;
  while(x*2<=y)
  {
    x*=2;
    ans++;
  }
  cout <<ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#define rep(i,k,n) for(int i=(int)(k);i<(int)(n);i++)
using namespace std;

int n,pos;
vector<int> pre,in,post;

void rec(int l,int r){
    if(l>=r) return;
    int root=pre[pos++];
    int m=distance(in.begin(),find(in.begin(),in.end(),root));
    rec(l,m);
    rec(m+1,r);
    post.push_back(root);
}

void solve(){
    pos=0;
    rec(0,pre.size());
    rep(i,0,n){
        if(i) cout<<" ";
        cout<<post[i];
    }
    cout<<endl;
}

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

    rep(i,0,n){
        cin>>k;
        pre.push_back(k);
    }

    rep(i,0,n){
        cin>>k;
        in.push_back(k);
    }

    solve();

    return 0;
}


Measured memory_bytes: 3164
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())


int main(){
	string a,b; int c,d; cin >> a >> b >> c >> d;
	string e; cin >> e;
	if(a == e) c--; else d--;
	cout<<c<<" "<<d<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a;
char s[3];
int main(){
    for(int i=0;i<3;i++){
        cin>>s[i];
        if(s[i]=='A')a++;
    }
    if(a!=3&&a!=0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256