akhauriyash/Code-Regression huggingface dataset:
#include <iostream>


using namespace std;
const int BITSIZE = 41;
int main() {
    long long N, K;
    long long a[1000];
    long long set[1000000];
    int set_size = 0;
    int bit[BITSIZE] = {0};
    cin >> N >> K;
    for (int i=0; i<N; i++) cin >> a[i];

    int ite = 0;
    for (int left=0; left < N; left++) {
        long long sum = 0;
        for (int right = left; right < N; right++) {
            sum += a[right];
            set[ite] = sum;
            set_size++;
            ite++;

            long long tmp = sum;
            int tmp_ite = 0;
            while (tmp > 0) {
                if (tmp % 2 == 1) bit[tmp_ite]++;
                tmp /= 2;
                tmp_ite++;
            }
        }
    }

    //for (int i=0; i<set_size; i++) cerr << set[i] << endl;
    for (int i=BITSIZE-1; i>=0; i--) {
        cerr << "mask " << i << endl;

        if (bit[i] < K) continue;
        for (int j=0; j<BITSIZE; j++) bit[j] = 0;

        long long mask = 1LL << i;
        int new_set_size = 0;
        for (int j = 0; j < set_size; j++) {
            if (set[j] & mask) {
                cerr << set[j] << endl;
                set[new_set_size] = set[j];
                new_set_size++;

                long long tmp = set[j];
                int tmp_ite = 0;
                while (tmp > 0) {
                    if (tmp % 2 == 1) bit[tmp_ite]++;
                    tmp /= 2;
                    tmp_ite++;
                }
            }
        }
        set_size = new_set_size;
    }

    long long ret = (set_size > 0) ? set[0] : 0;
    for (int i=1; i<set_size; i++) {
        ret &= set[i];
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 5504
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

#define rep(i,a,b) for(auto (i)=a;i<b;i++)
#define list(i,N) for(auto (i)=0;i<N;i++)

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
#define mp make_pair
#define pb push_back

#define int ll
#define INF 1e18+5
#define mod 1000000007
#define MAX 1000000000

int32_t main(){

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

	int N, K, S; cin >> N >> K >> S;

	list(i,K) cout << S << " ";
	
	list(i,N-K){
		if(S!=MAX) cout << S+1 << " ";
		else cout << S-1 << " ";
	}

	return 0;
}


Measured memory_bytes: 1280
#include"bits/stdc++.h"
#define pb push_back

using namespace std;
typedef long long ll;

namespace io{
	const int L=(1<<19)+1;
	char ibuf[L],*iS,*iT,obuf[L],*oS=obuf,*oT=obuf+L-1,c,st[55];int f,tp;
	char gc(){
		if(iS==iT){
			iT=(iS=ibuf)+fread(ibuf,1,L,stdin);
			return iS==iT?EOF:*iS++;
		}
		return*iS++;
	}
	void cbuf(){fwrite(obuf,1,oS-obuf,stdout);oS=obuf;}
	void putc(char x){*oS++=x;if(oS==oT)cbuf();}
	void gs(char*s){
		for(c=gc();c<'A'||c>'Z';c=gc());
		for(;c>='A'&&c<='Z';c=gc())*s++=c;
	}
	template<class I>void gi(I&x){
		for(f=1,c=gc();c<'0'||c>'9';c=gc())if(c=='-')f=-1;
		for(x=0;c<='9'&&c>='0';c=gc())x=x*10+(c&15);x*=f;
	}
	template<class I>void print(I x){
		if(!x)putc('0');if(x<0)putc('-'),x=-x;
		while(x)st[++tp]=x%10+'0',x/=10;
		while(tp)putc(st[tp--]);
	}
};
using io::putc;
using io::gi;
using io::gs;
using io::print;

const int P=1E9+7;

int Q,n;
ll fib[233];
struct aw {
	ll a,b;
	aw(){}
	aw(ll _a, ll _b){a=_a, b=_b;}
} ;
vector<aw>basic[233];

void prepare(){
	fib[0]=1,fib[1]=2;
	for (n=2;fib[n-1]<2E18;n++){
		fib[n]=fib[n-1]+fib[n-2];
		for(int j=0,l=basic[n-1].size();j<l;j++){
			aw w=basic[n-1][j];
			basic[n].pb(aw(w.a+w.b,w.a));
		}
		if(n>2)
			basic[n].pb(aw(fib[n-1]*2+fib[n-3],fib[n-1]+fib[n-3]));
		else
			basic[n].pb(aw(3,2));
	}
	for(int i=2;i<=n;i++)basic[i].pb(aw(fib[i]+fib[i-2],fib[i]));
	n--;
}

void work(ll a,ll b){
	if(a==1&&b==1){print(1),putc(' '),print(1),putc('\n');return;}
	int l=0,r=n,mid=(l+r+1)>>1;
	while(l<r){
		if(fib[mid]<=a)l=mid;else r=mid-1;
		mid=(l+r+1)>>1;
	}
	if(fib[mid+1]<=b)mid++;
	print(mid),putc(' ');
	if(mid==1){
		ll ret=(a%P)*(b%P)%P;
		print(ret),putc('\n');
	}else{
		ll ret=0;
		for (int i=0,l=basic[mid].size();i<l;i++){
			aw w=basic[mid][i];
			if(w.a<=a&&w.b<=b)ret=(ret+(a-w.a+w.b)/w.b)%P;
			if(w.a<=b&&w.b<=a)ret=(ret+(b-w.a+w.b)/w.b)%P;
		}
		print(ret),putc('\n');
	}
}

int main(){
	prepare();
	gi(Q);
	while(Q--){
		ll a,b;
		gi(a),gi(b);
		if(a>b)swap(a,b);
		work(a,b);
	}
	io::cbuf();
	return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define int long long

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

struct edge{ int to,cost; };
vector<int> RG[3000],can_use(3000,0);

int bellmanford(vector<edge> G[],int n,int s){
  const int INF = 1LL << 60;
  vector<int> dist(n,INF); //sからの最短距離
  dist[s] = 0;
  for(int i = 0; i < n; i++){
    for(int u = 0; u < n; u++){
      if(!can_use[u]) continue;
      for(auto e : G[u]){
        if(dist[u] != INF && dist[e.to] > dist[u] + e.cost){
          dist[e.to] = dist[u] + e.cost;
          //n回目にも更新があるなら負の閉路が存在
          if(i == n-1){
            cout << "inf" << endl;
            return 0;
          }
        }
      }
    }
  }
  cout << -dist[n-1] << endl;
  return 0;
}
signed main(){

  int n,m; cin >> n >> m;
  vector< edge > G[n];
  for(int i = 0; i < m; i++){
    int a,b,c; cin >> a >> b >> c;
    a--,b--;
    G[a].push_back({b,-c});
    RG[b].push_back(a);
  }

  function< void(int,int) > dfs =
  [&](int u,int pre){
    if(can_use[u]) return;
    can_use[u] = 1;
    for(int v : RG[u]){
      if(v == pre) continue;
      dfs(v,u);
    }
  };
  dfs(n-1,-9);
    
  bellmanford(G,n,0);

  return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  int sum = 0;
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    if (x < (K - x)) {
      sum += x * 2;
    } else {
      sum += (K - x) * 2;
    }
  }
  cout << sum;
}


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

using namespace std;

void ColoringColorfully()
{
  string st;
  cin >> st;
  string rst = st;
  int count = 0;
  int r_count = 0;
  for (int i = 1; i < st.length(); i++)
  {
    if (st[i - 1] == st[i])
    {
      count++;
      if (st[i] == '0') st[i] = '1';
      else st[i] = '0';
    }
    if (rst[rst.length() - i] == rst[rst.length() - i - 1])
    {
      r_count++;
      if (rst[rst.length() - i - 1] == '0') rst[rst.length() - i - 1] = '1';
      else rst[rst.length() - i - 1] = '0';
    }
  }
  int ans = min(count, r_count);

  cout << ans << endl;
  return;

}


int main()
{
  ColoringColorfully();
}

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

int main(){
    using namespace std;

    int N;
    int flag = 0;
    cin >> N;
    int p[N];
    for (int i =0;i <N;i++){
        cin >> p[i];
        if(p[i] != i+1) flag++;
    }

    if(flag == 0 or flag == 2) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

int isPrime(int x);

int main(){
  int i,n,x;
  int answer = 0;
  scanf("%d", &n);
  if(n>10000) return 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    if(x>1000000000) return 0;
    answer = answer + isPrime(x);
  }
  printf("%d\n", answer);
  return 0;
}
int isPrime(int x)
{
  int i;
  if(x==2)return 1;
  if(x<2||x%2==0)return 0;
  
    for (i = 3; i <= sqrt(x); i++) {
      if (x % i == 0) {
        return 0;
      }
      i++;
    }
    return 1;
  
}


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

const function<int(int, int)> minQ = [](int l, int r) { return min(l, r); };
const function<int(int, int)> maxQ = [](int l, int r) { return max(l, r); };

int data[1 << 23];
int v[1 << 20];

template <typename T>
class SegmentTree2 {
	using func_t = function<T(T, T)>;
	const int h, w;
	const T id;
	func_t merge;
	int size(int n) {
		int res;
		for (res = 1; res < n; res <<= 1);
		return res;
	}
	T sub_h(int li, int lj, int ri, int rj, int si, int ti, int k) {
		if (ri <= si || ti <= li) return id;
		if (li <= si && ti <= ri) return sub_w(lj, rj, 0, w, k, 1);
		const int mi = (si + ti) / 2;
		return merge(sub_h(li, lj, ri, rj, si, mi, k * 2), sub_h(li, lj, ri, rj, mi, ti, k * 2 + 1));
	}
	T sub_w(int lj, int rj, int sj, int tj, int i, int k) {
		if (rj <= sj || tj <= lj) return id;
		if (lj <= sj && tj <= rj) return data[i * w * 2 + k];
		const int mj = (sj + tj) / 2;
		return merge(sub_w(lj, rj, sj, mj, i, k * 2), sub_w(lj, rj, mj, tj, i, k * 2 + 1));
	}
public:
	SegmentTree2(int h_, int w_, T id_, func_t merge_) :
		h(size(h_)), w(size(w_)), id(id_), merge(merge_) {
		fill(data, data + (1 << 23), id);
		for (int i = 0; i < h_; i++)
			for (int j = 0; j < w_; j++)
				data[(h + i) * w * 2 + w + j] = v[i * w_ + j];
		for (int i = h * 2 - 1; i >= h; i--)
			for (int j = w - 1; j > 0; j--)
				data[i * w * 2 + j] = merge(data[i * w * 2 + j * 2], data[i * w * 2 + j * 2 + 1]);
		for (int i = h - 1; i > 0; i--)
			for (int j = 1; j < w * 2; j++)
				data[i * w * 2 + j] = merge(data[i * 2 * w * 2 + j], data[(i * 2 + 1) * w * 2 + j]);
	}
	void Update(int pi, int pj, T val) {
		pi += h;
		pj += w;
		data[pi * w * 2 + pj] = val;
		int tj = pj;
		while (tj >>= 1) {
			data[pi * w * 2 + tj] = merge(data[pi * w * 2 + tj * 2], data[pi * w * 2 + tj * 2 + 1]);
		}
		while (pi >>= 1) {
			data[pi * w * 2 + pj] = merge(data[(pi * 2) * w * 2 + pj], data[(pi * 2 + 1) * w * 2 + pj]);
			tj = pj;
			while (tj >>= 1) {
				data[pi * w * 2 + tj] = merge(data[pi * w * 2 + tj * 2], data[pi * w * 2 + tj * 2 + 1]);
			}
		}
	}
	T Find(int li, int lj, int ri, int rj) {
		return sub_h(li, lj, ri + 1, rj + 1, 0, h, 1);
	}
};

int main()
{
	cin.sync_with_stdio(false);
	cin.tie(0);
	int r, c, q, r1, r2, c1, c2;
	while (cin >> r >> c >> q, r | c | q) {
		for (int i = 0; i < r; i++) {
			for (int j = 0; j < c; j++) {
				cin >> v[i * c + j];
			}
		}
		SegmentTree2<int> st(r, c, INT_MAX, minQ);
		while (q--) {
			cin >> r1 >> c1 >> r2 >> c2;
			printf("%d\n", st.Find(r1, c1, r2, c2));
		}
	}
	return 0;
}

Measured memory_bytes: 39940
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string s;
  cin >> s;
  string prev = s.substr(0, 1);
  ll i = 1, sub_size = 1, k = 1;
  while (i < s.size()) {
    if (s.substr(i, sub_size) == prev) {
      if (i == s.size() - 1) break;
      sub_size++;
    } else {
      prev = s.substr(i, sub_size);
      k++;
      i += sub_size;
      sub_size = 1;
    }
  }
  cout << k << endl;
  return 0;
}

Measured memory_bytes: 3700
class dice:
    def __init__(self,label):
        self.top, self.front, self.right, self.left, self.rear, self.bottom \
                = label
   
    def roll(self,op):
        if   op=='N': self.top, self.front, self.bottom, self.rear = \
                                self.front, self.bottom, self.rear , self.top
        elif op=='E': self.top, self.left , self.bottom, self.right = \
                                self.left , self.bottom, self.right, self.top
        elif op=='W': self.top, self.right, self.bottom, self.left = \
                                self.right, self.bottom, self.left , self.top
        elif op=='S': self.top, self.rear , self.bottom, self.front = \
                                self.rear , self.bottom, self.front, self.top
   
    def print_top(self): print(self.top)
    def print_right(self): print(self.right)
   
    def get_label(self):
        return [self.top, self.front, self.right, self.left, self.rear, self.bottom]
    
label = list(map(int,input().split()))
d = dice(label)
q = int(input())
for _ in range(q):
    top_front = [int(x) for x in input().split()]
    for op in 'EEENEEENEEESEEESEEENEEEN':
        if d.get_label()[:2] == top_front:
            d.print_right()
            break
        d.roll(op)


Measured memory_bytes: 5608
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(){
  int N,K;
  cin >> N >> K;
  int h[N], ans=0;
  rep(i,N) cin >> h[i];
  rep(i,N) if(h[i]>=K) ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#pragma region header
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a / gcd(a, b) * b ;
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
vi d;
int N;
void dfs(int n) {
    if(n>N) return;
    d.pb(n);
    for(auto p:{3,5,7}) dfs(n*10+p);
}
bool ok(int n) {
    string S = to_string(n);
    bool t=false,f=false,s=false;
    rep(i, S.size()) {
        if(S[i]=='3') t=true;
        else if(S[i]=='5')f=true;
        else s=true;
    }
    if(t&&f&&s) return true;
    else return false;
}
signed main() {
    cin >> N;
    for(auto p:{3,5,7}) dfs(p);
    int count = 0;
    for(auto p:d) if(ok(p)) count++;
    cout << count << endl;
    // for(auto p:d)cout << p << ' ';cout << char(10);
    return 0;
}

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

int main() {
  long N;
  vector<long> T(5);
  cin >> N >> T[0] >> T[1] >> T[2] >> T[3] >> T[4];
  long ans = 0;
  for (int i=0; i<5; i++) {
    ans = max(ans,(N+T[i]-1)/T[i]-1);
  }
  cout << ans+5 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <sstream>
#include <numeric>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>

///////////////////////////////////////////////////////////////
// namespace
///////////////////////////////////////////////////////////////
using namespace std;
// namespace mp = boost::multiprecision;

///////////////////////////////////////////////////////////////
// types
///////////////////////////////////////////////////////////////
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
// using mpi = mp::cpp_int;
// using mpf = mp::number<mp::cpp_dec_float<1024>>;

///////////////////////////////////////////////////////////////
// mod https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a
///////////////////////////////////////////////////////////////
// ll MOD = 1000000007;
//
// ll mod(long long val) {
//     long long res = val % MOD;
//     if (res < 0) res += MOD;
//     return res;
// }
//
// ll modinv(ll a) {
//     ll b = MOD, u = 1, v = 0;
//     while (b) {
//         ll t = a / b;
//         a -= t * b; swap(a, b);
//         u -= t * v; swap(u, v);
//     }
//     u %= MOD;
//     if (u < 0) u += MOD;
//     return u;
// }
//
// const int MAX = -1;
// ll fac[MAX], finv[MAX], inv[MAX];
// void com_init() {  // initialize nCk table with O(N)
//     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;
//     }
// }
// ll com(int n, int k){  // nCk
//     if (n < k) return 0;
//     if (n < 0 || k < 0) return 0;
//     return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
// }


int main() {
    int k, a, b; cin >> k >> a >> b;
    for (int i = a; i <= b; ++i) {
        if (i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}


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

int main(){
	int n,q;
	cin>>n;
	vector<int>s(n);
	for(int i=0;i<n;++i)cin>>s.at(i);
	cin>>q;
	vector<int>t(q);
	for(int i=0;i<q;++i)cin>>t.at(i);
	int ans=0;
	for(int i=0,j;i<q;++i){
		s.push_back(t.at(i));
		for(j=0;t.at(i)!=s.at(j);++j){}
		ans+=j!=n;
		s.pop_back();
	}
	cout<<ans<<"\n"s;
}


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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9;
const LL LINF = INF * INF;

const int MAX = 307;
int n;
double dp[MAX][MAX][MAX];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("In.txt", "w", stdout);

	cin >> n;
	int c1 = 0, c2 = 0, c3 = 0, xx;
	FOR(i, 0, n)
	{
		cin >> xx;
		c1 += xx == 1;
		c2 += xx == 2;
		c3 += xx == 3;
	}
	
	FOR(z, 0, n + 1)
	FOR(y, 0, n + 1 - z)
	FOR(x, 0, n + 1 - z - y)
	{
		if (!(x + y + z))
			continue;
		
		double res = 1;
		if (x)
			res += x * dp[x - 1][y][z] / n;
		if (y)
			res += y * dp[x + 1][y - 1][z] / n;
		if (z)
			res += z * dp[x][y + 1][z - 1] / n;
		
		dp[x][y][z] = res * n / (x + y + z + 0.0);
	}
	
	cout << fixed << setprecision(12) << dp[c1][c2][c3] << endl;
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}


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

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

ll lcm(ll a, ll b) {
  return a / gcd(a,b) * b;
}

int main() {
  int n; cin >> n;
  vector<ll> t(n);
  rep(i,n) cin >> t[i];
  ll c = 1;
  rep(i,n) {
    c = lcm(t[i], c);
  }
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int cnt[4];

int main() {
	int A, B;
	cin >> A >> B;
	cnt[A]++; cnt[B]++;
	if (cnt[1] == 0) cout << "1" << endl;
	if (cnt[2] == 0) cout << "2" << endl;
	if (cnt[3] == 0) cout << "3" << endl;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 100000000

#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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


static const double EPS = 1e-8;

int tx[] = {-1,0,1,0};
int ty[] = {0,1,0,-1};

int stage[5][5];

bool isFull(int x1,int y1,int x2,int y2){
	for(int y=y1;y<=y2;y++){
		for(int x=x1;x<=x2;x++){
			if(stage[y][x] != 1) return false; 
		}
	}

	return true;
}

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

		for(int i=0;i<n;i++){
			for(int y=0;y<5;y++){
				for(int x=0;x<5;x++){
					scanf("%d",&stage[y][x]);
				}
			}
			int res = 0;
			for(int y1=0;y1<5;y1++){
				for(int x1=0;x1<5;x1++){
					for(int y2=y1;y2<5;y2++){
						for(int x2=x1;x2<5;x2++){
							if(isFull(x1,y1,x2,y2)){
								res = max(res,(x2-x1+1)*(y2-y1+1));
							}
						}
					}
				}
			}
			printf("%d\n",res);
		}
	}

}

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

using namespace std;

#define pb push_back

const int maxi = 1e6+10;
int a[1010][1010];
int dp[1010][1010];

string s;
vector<int> v[maxi];
int n, m, k;


int range(int x1, int y1, int x2, int y2)
{
    int val = dp[x2][y2] + dp[x1-1][y1-1] - dp[x1-1][y2] - dp[x2][y1-1];

    return val;
}
int cnt;
int main()
{
    cin>>n>>m>>cnt;

    for(int i=1;i<=n;i++)
    {
        cin>>s;

        for (int j  = 0 ;j<m;j++)
            if (s[j] == '1') a[i][j+1] = 1; else a[i][j+1] = 0;
    }


    for (int i =1;i<=n;i++)
        for (int j =1;j<=m;j++)
           dp[i][j] = (a[i][j] + dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1]);

    int ans = n+ m;

    for (int mask = 0 ;mask<(1<<n);mask++)
    {
        int last = 0;

        int cur = 0;
        int ok = 1;

        for (int j = 1;j<=m;j++)
        {
            int pre = 0;

            for (int k=1;k<=n;k++)
              if ((mask&(1<<(k-1))) || k == n)
              {
                  int sum = range(pre+1, last+1,k,j);

                  if (sum>cnt)
                  {
                      cur++;
                      if (j -1 == last) ok = 0;
                      last = j -1;
                      break;
                  } else
                   pre = k ;
              }
        }

        if (ok)
            ans = min(ans, cur + __builtin_popcount(mask));
    }

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


Measured memory_bytes: 26880
#!/usr/bin/env python3
import sys
from math import gcd
from functools import reduce
def input(): return sys.stdin.readline().rstrip()

def pairwaise(bools):
    for i in range(2,10**6):
        hantei=0
        for j in range(i,10**6+1,i):
            hantei+=bools[j]
        if hantei>1:
            return False
    return True


def main():
    n=int(input())
    A=list(map(int, input().split()))
    gcds=reduce(gcd,A)
    if gcds>1:
        print('not coprime')
    else:
        bools=[0]*(10**6+5)
        for AA in A:
            if bools[AA]==1 and AA!=1:
                print('setwise coprime')
                exit()
            bools[AA]+=1
        if pairwaise(bools):
            print('pairwise coprime')
        else:
            print('setwise coprime')

    
    


if __name__ == '__main__':
    main()

Measured memory_bytes: 185720
s = input()
r = [0 for _ in s]
s += 'R'
j = 0
try:
    while True:
        i = j
        j = s.index('L', i + 1)
        c = j - i
        i = j
        j = s.index('R', i + 1)
        d = j - i
        r[i - 1] = (c + 1) // 2 + d // 2
        r[i] = c // 2 + (d + 1) // 2
except ValueError:
    pass
print(*r)


Measured memory_bytes: 6400
#include <stdio.h>
int H, A[1000000];

void maxHeapify(int i) {
	int l=2*i, r=2*i+1;
	int largest, t;
	if (l <= H && A[l] > A[i])
		largest = l;
	else
		largest = i;
	if (r <= H && A[r] > A[largest])
		largest = r;

	if (largest != i) {
		t = A[i]; A[i] = A[largest]; A[largest] = t;
		maxHeapify(largest);
	}
}

void buildMaxHeap() {
	for (int i = H / 2; i >= 1; i--) {
		maxHeapify(i);
	}
}

int main() {
	int i;
	scanf("%d", &H);
	for (i = 1; i <= H; i++) {
		scanf("%d", &A[i]);
	}
	buildMaxHeap();
	for (i = 1; i <= H; i++) {
		printf(" %d", A[i]);
	}
	printf("\n");
	return 0;
}



Measured memory_bytes: 4696
#include <iostream>
using namespace std;
int n,g[150][150],c[100],f[100],e[100],cnt=1;
void dfs(int now){
  c[now]=1;
  f[now]=cnt;
  cnt++;
	for(int i=0;i<n;i++){
		if(g[now][i] && c[i]!=1){
      		dfs(i);
      		cnt++;
		}
    }
  e[now]=cnt;
}
int main(){
 
  int a,k,num;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a>>k;
    for(int j=0;j<k;j++){
      cin>>num;
      g[a-1][num-1]=1;
    }
  }
	for(int i=0;i<n;i++){
	   if(c[i]!=1){
     	 dfs(i);
      	 cnt++;
       }
	}
 
	for(int i=0;i<n;i++){
		cout<<i+1<<" "<<f[i]<<" "<<e[i]<<endl;
	}
  return 0;
 
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll n,m,k;
ll mem;
ll ans;

ll factorial(ll n,ll mod = mod){
  static ll dp[e5];
  if(dp[n]) return dp[n];
  if(n == 0) return dp[n] = 1;
  return dp[n] = (n*factorial(n-1))%mod;
}

ll powl(ll x,ll r,ll mod = mod){
  ll ret = 1;
  for(;r != 0;r >>= 1){
    if(r&1 != 0) ret *= x,ret %= mod;
    x *= x,x %= mod;
  }
  return ret;
}

ll inverse(ll x,ll mod = mod){
  return powl(x,mod-2,mod);
}

ll combination(ll n,ll m,ll mod = mod){
  if(n < m) return 0;
  return (((factorial(n)*inverse(factorial(m)))%mod)*inverse(factorial(n-m)))%mod;
}

int main(){
  cin >> n >> m >> k;
  // for(ll i = 0;i < n;i++){
  //   for(ll j = 0;j < m;j++){
  //     mem += i*(i+1)/2*m+j*(j+1)/2*n;
  //     mem += (n-i)*(n-i-1)/2*m+(m-j)*(m-j-1)/2*n;
  //     mem %= mod;
  //   }
  // }
  ll mem = ((n-1)*n*(2*n-1)/6+n*(n-1)/2)/2*m*m + ((m-1)*m*(2*m-1)/6+m*(m-1)/2)/2*n*n;
  mem %= mod;
  ans = mem * k;
  ans %= mod;
  ans %= mod;
  ans *= inverse(n*m);
  ans %= mod;
  ans *= k-1;
  ans %= mod;
  ans *= inverse(n*m-1);
  ans %= mod;
  ans *= combination(n*m,k);
  ans %= mod;
  cout << ans << endl;



}


Measured memory_bytes: 8064
# import math
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque

# import numpy as np
# import scipy as scp

# 入力の受け取り
d,n = map(int,input().split())
if d ==0:
    if n <=99:
        ans = n
    elif n==100:
        ans = 101
elif d == 1:
    if n <=99:
        ans = n*100
    elif n==100:
        ans = 101*100
else:
    if n <=99:
        ans = n*100**2
    elif n==100:
        ans = 101*100**2

print(ans)

Measured memory_bytes: 3064
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    auto S = sread();
    long i = S.length;
    loop_w: while (0 < i)
    {
        foreach (t; ["dream", "dreamer", "erase", "eraser"])
        {
            auto s = S[max(0, i - t.length) .. i];
            if (s == t)
            {
                i -= s.length;
                continue loop_w;
            }
        }
        writeln("NO");
        return;
    }
    writeln("YES");
}


Measured memory_bytes: 2556
#include <bits/stdc++.h>
using namespace std;
#define int long long   // aaaaaaaaaaaaaaaaaa
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define in(s,x) s.find(x) != s.end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<pair<int,int>> VPII;
const ll mod=1000000007;
const ll INF= 1LL<<60-1;
ll powmod(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 gcd(ll a,ll b) { return b?gcd(b,a%b):a;} ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
template<typename T, typename U>ostream& operator << (ostream& os, pair<T, U>& pair_var)
{os << pair_var.first << " " << pair_var.second ;return os;}
template<class tContainer>
long long sum(tContainer const& iContainer) {return  std::accumulate(std::begin(iContainer), std::end(iContainer), 0LL);}

// head


int m,n,k,res,tmp,tmp2,tmp3,h,w,x,y;
VI a;
deque<PII> que;
string s;
//VI b;
vector<PII> g[2100600];
int b[2100000];
int c[210] = {};
int rui[210000];
set<int> ch;

signed main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>s;
  for (char bb : s){
    if(bb=='7'){cout << "Yes" << '\n';exit(0);}
  }
  cout << "No" << '\n';
  
}

Measured memory_bytes: 52876
/*Bismillahir Rahmanir Rahim*///{
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1;
const double eps = 1e-6, ldeps = 1e-9;
struct Dbg {
static constexpr auto &os = cout;   // replace by cerr in interactive.
template<class C> static auto dud(C *x)->decltype(os << *x, 0);
template<class C> static char dud(...);
template<class C> typename enable_if<sizeof dud<C>(0)!=1, Dbg&>::type operator<<(const C &x) { os << x; return *this; }
template<class C> Dbg &dump(C b, C e) {
    *this << "\n[";
    int cur = 0;
    for (C i = b; i!=e and cur<26; i++, cur++) *this << ", "+2*(i==b) << *i;
    return *this << ']';
}
template<class C> typename enable_if<sizeof dud<C>(0)==1, Dbg&>::type operator<<(const C &x) {
    return dump(begin(x), end(x));
}
template<class C, size_t X> typename enable_if<!is_same<C, const char>::value, Dbg&>::type operator <<(C (&x)[X]) {
    return dump(begin(x), end(x));
}
template<class B, class C> Dbg &operator <<(const pair<B, C> &x) {
    return *this << '{' << x.first << ", " << x.second << '}';
}
Dbg &operator<<(ostream&(*x)(std::ostream&)) { os << x; return *this; }
} dbg;
void err(istringstream *iss) { delete iss; }
template<class C, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args...);
}
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(#args), args), dbg << endl
#define cbug(a, args...) if (a) bug(args);
#define ASSERT(a, o, b, args...) if (!((a)o(b))) bug(a, b, ##args), assert((a)o(b));
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
int T, Q, cn;//}
const int inf = 1000000007, mxn = 100005;

int n;
ll ans, a[mxn], b[mxn];

signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); cout.precision(11);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i] >> b[i];
    }

    ll inc = 0;
    for (int i = n; i >= 1; i--) {
        a[i] += inc;
        ll trgt = a[i] ? ((a[i]-1)/b[i]+1)*b[i] : 0;
        inc += trgt-a[i];
    }

    cout << inc << '\n';
}

Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;
int main()
{
    int a,b,x;
    cin>>a>>b>>x;
    if(a<=x and x<=a+b)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
 return 0;
}
    

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

int main() {
  ll n=0;

  cin >> n;
  n = n%10;
  if ((n==2)||(n==4)||(n==5)||(n==7)||(n==9)) cout << "hon" << endl;
  else if ((n==0)||(n==1)||(n==6)||(n==8)) cout << "pon" << endl;
  else cout << "bon" << endl;
  return 0;
}



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

using namespace std;

typedef long long ll;


int main() {
	int n;
	cin >> n;
	ll minV;
	cin >> minV;
	ll maxV = -1000000000;
	ll x;
	for (int i=1;i<n;i++) {
		cin >> x;
		maxV = max(maxV,x-minV);
		minV = min(minV,x);
	}
	cout << maxV << endl;
	return 0;
}


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

#define PI 3.14159265358979323846264338327950288

int main(){
    int a, b, h, m;
    scanf("%d%d%d%d", &a, &b, &h, &m);
    double deg = abs(0.5*(60*h-11*m)) * PI / 180.0;
    double dist = pow(a*a + b*b - 2 *(double) a * (double) b * cos(deg), 0.5);
    printf("%.15f", dist);
    return 0;
}


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


if __name__ == '__main__':

    N = int(input())
    A = list(map(int, input().split()))

    dp = [0] * N
    dp[1] = max(A[0], A[1])
    c = A[0]

    for i in range(2, N):
        if i % 2 == 0:
            dp[i] = max(dp[i - 2] + A[i], dp[i - 1])
            c += A[i]
        else:
            dp[i] = max(dp[i - 2] + A[i], c)

    print(dp[-1])


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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    char a; cin>>a;
    if(a>='A' && a<='Z') cout<<"A\n";
    else cout<<"a\n";
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const ll mod = 1e9+7;


void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


/* 注意 

    1LL<<60 * N とかのオーバーフローに気を付けろ
    制約がヒントになる、ちゃんと全ての制約を見ろ

*/


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

    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int const inf = 1e9+1;
    vector<int> dp(n+5, inf);
    rep(i, n) {
        *lower_bound(dp.begin(), dp.end(), a[i]) = a[i];
    }

    cout << lower_bound(dp.begin(), dp.end(), inf) - dp.begin() << endl;
    
    return 0;
}



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


int main() {
	
	vector< string > days = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN","MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
	string s;
	cin >> s;
	int pos = -1;
	while (++pos < (int) days.size()) {
		if (days[pos] == s) break;
	}
	
	int i;
	for (i=pos+1; i<(int)days.size(); i++) {
		if (days[i] == "SUN") break;
	}
	cout << i - pos << '\n';
	
	
	
	return 0;
}


Measured memory_bytes: 3632
/**akshaykumar01**/
 
#include<bits/stdc++.h>
using namespace std;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define pu push_back           
#define pp pop_back
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const int MOD=1e9+7 ;
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N=2e5+2;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> ivc;
typedef pair<ll,ll> ipr;

int main()
{
    IOS();
   
    ll n,i;
    cin>>n;
    i=n*(n-1)/2;
    cout<<i;
    return 0;
  
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

int dp[1000 + 1][1 << 12];

vector<int> cost;
vector<int> key;

void solve() {
  int N, M;
  cin >> N >> M;

  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    cost.push_back(a);

    int mask = 0;
    while (b--) {
      int c;
      cin >> c;
      mask = mask | (1 << (c - 1));
    }
    key.push_back(mask);
  }

  const int mask = (1 << N) - 1;

  for (int i = 0; i < M + 1; i++) {
    for (int x = 0; x < mask + 1; x++) {
      dp[i][x] = INF;
    }
  }

  dp[0][0] = 0;
  for (int i = 0; i < M; i++) {
    for (int x = 0; x < mask + 1; x++) {
      if (dp[i][x] == INF) {
        continue;
      }
      int k = key[i];
      dp[i + 1][x] = min(dp[i + 1][x], dp[i][x]);
      dp[i + 1][x | k] = min(dp[i + 1][x | k], dp[i][x] + cost[i]);
    }
    cout << endl;
  }

  int ans = -1;
  if (dp[M][mask] != INF) {
    ans = dp[M][mask];
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 32384
import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline

n=int(input())
a=list(map(int,input().split()))

ans=0

j=0
tot=0
for i in range(n):
    while j<n and (tot^a[j])==tot+a[j]:
        tot+=a[j]
        j+=1
    ans+=j-i
    tot-=a[i]
print(ans)


Measured memory_bytes: 72396
N=int(input())
A=list(map(int,input().split()))

num=A[0]
data=[[A[0],0]]

for i in range(1,N):
    if A[i]>num:
        data.append([A[i],i])
        num=A[i]
        
B=sorted(A,reverse=True)
C=[0]*N
C[0]=B[0]
for i in range(1,N):
    C[i]=C[i-1]+B[i]
    
    
ans=[0]*N
cnt=0
kkk=0
for i in range(len(data)-1,0,-1):
    
    zzz=data[i-1][0]
    while kkk<N and B[kkk]>zzz:
        kkk+=1
    num=C[kkk-1]-kkk*zzz
    num-=cnt
    ans[data[i][1]]=num
    cnt+=num

ans[0]=sum(A)-sum(ans)

for u in ans:
    print(u)

Measured memory_bytes: 74220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
void solve(){
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
        cout<<"Yes";
    else
        cout<<"No";
}
void trials(){
    int t;
    for(cin>>t;t--;cout<<endl){
        solve();
    }
}
int main(){
    solve();
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int max = 1;
      	HashMap<String,Integer> map = new HashMap<String,Integer>();
      	for(int i=0;i<a;i++){
          String s = sc.next();
          if( map.containsKey(s) ){
            map.put(s,map.get(s)+1);
            if( map.get(s) > max ){
              max = map.get(s);
            }
          }else{
            map.put(s,1);
          }
        }
      /*
      	for(String key : map.keySet() ){
          if( map.get(key) != max ){
            map.remove(key);
          }
        }
      */
      	int cnt = 0;
      	//Object[] mapkey = map.keySet().toArray();
      	//Arrays.sort(mapkey);
      	for(String key : map.keySet()){
          if( map.get(key) == max )
          cnt++;
        }
      	String[] name = new String[cnt];
      	cnt=0;
      	for(String key : map.keySet()){
			if( map.get(key) == max ){
              name[cnt] = key;
              cnt++;
            }
        }
      	Arrays.sort(name);
      	for(int i=0;i<name.length;i++){
          System.out.println(name[i]);
        }
	}
}

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

int main() {
	unordered_set<int> a;
	for (int i = 0; i < 28; ++i) {
		int b;
		cin >> b;
		a.insert(b);
	}
	for (int i = 1; i <= 30; ++i) {
		if (!a.count(i)) cout << i << endl;
	}
}


Measured memory_bytes: 3104
import sys

sys.setrecursionlimit(2 ** 20)  # 再帰回数上限の向上 かなり多くしないとREになる


class Node:
    def __init__(self,
                 left,
                 right):
        self.left = left
        self.right = right


def insert(t: dict, i: int, r: int):
    if r > i:
        if t[r].left is not None:
            insert(t, i, t[r].left)
        else:
            t[r].left = i
    if r < i:
        if t[r].right is not None:
            insert(t, i, t[r].right)
        else:
            t[r].right = i


def inorder(t: dict, p: int, in_ls: list):
    if t[p].left is not None:
        inorder(t, t[p].left, in_ls)
    in_ls.append(p)
    if t[p].right is not None:
        inorder(t, t[p].right, in_ls)


def preorder(t: dict, p: int, pre_ls: list):
    pre_ls.append(p)
    if t[p].left is not None:
        preorder(t, t[p].left, pre_ls)
    if t[p].right is not None:
        preorder(t, t[p].right, pre_ls)


N = int(input())
T = {}
in_list = []
pre_list = []

order = list(map(str, input().split()))
root = int(order[1])
T[root] = Node(None, None)

for _ in range(N-1):
    order = str(input())
    if order[0] == 'i':
        order = list(order.split())
        T[int(order[1])] = Node(None, None)
        insert(T, int(order[1]), root)
    elif order[0] == 'f':
        order = list(order.split())
        if int(order[1]) in T:
            print('yes')
        else:
            print('no')
    else:
        inorder(T, root, in_list)
        print('', *in_list)
        preorder(T, root, pre_list)
        print('', *pre_list)
        in_list = []
        pre_list = []



Measured memory_bytes: 130776
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define ff first
#define ss second
#define inf 9e18
#define pii pair<int,int>
#define setp(x) fixed<<showpoint<<setprecision(x)
#define fastio ios_base::sync_with_stdio(0);  cin.tie(0); cout.tie(0);
using namespace std;
int n;
long double a[3000];
long double ans = 0.0;
long double dp[3000][1505];
int cnt=0;
long double solve(int i,int t){
    if(t<0)
        return 0;
    if(i==n){
       return  1;
    }
    if(dp[i][t]!=-1)
        return dp[i][t];
    long double a1,a2;
    a1=a2=0;
    a1 = (1-a[i])*solve(i+1,t-1);
    a2 = a[i]*solve(i+1,t);
    return dp[i][t] = a1+a2;
}
int32_t main()
{
    
    fastio
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<3000;i++)
        for(int j=0;j<1505;j++)
            dp[i][j] = -1;
    ans = solve(0,n/2);
    
    cout<<setp(10)<<ans;
    return 0;
}

Measured memory_bytes: 71040
import java.util.Scanner;

public class Main {
	 public static void main(String[] args) {
		 Scanner sc = new Scanner(System.in);
		 int n=sc.nextInt();
		 int m=sc.nextInt();
		 int l=sc.nextInt();
		 
		 long A[][]=new long[n][m];
		 long B[][]=new long[m][l];
		 
		 for(int i=0;i<n;i++) {
			 for(int j=0;j<m;j++) {
				 A[i][j]=sc.nextLong();
			 }
		 }
		 for(int i=0;i<m;i++) {
			 for(int j=0;j<l;j++) {
				 B[i][j]=sc.nextLong();
			 }
		 }
		 
		 for(int i=0;i<n;i++) {
			 for(int j=0;j<l;j++) {
				 long ass=0;
				 for(int k=0;k<m;k++) {
					 ass +=A[i][k]*B[k][j];
				 }
				 System.out.print(ass);
				 if(j !=l-1) {
					 System.out.print(" ");
				 }	else {
					 System.out.println("");
				 }
				 
			 }
		 }
		 
		 sc.close();
	 }
}



Measured memory_bytes: 53568
// C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<string>
using namespace std;
int main()
{
    int k;
    string s;

    cin >> s;
    cin >> k;
    int key;
    k--;
    for (int i = 0; i < 100; i++) {
        if (s[i] != '1') {
            key = i;
            break;
        }
    }

    if (k < key) {
        cout << '1' << endl;
    }
    else {
        cout << s[key] << endl;
    }

    return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
     
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define hell 1000000007  
#define hell2 998244353 

int solve(){
    vi v(1500000);
    v[0]=0;
    rep(i,1,1e6+1e5*5) v[i]=v[i-1]+i;
    int n,t,ans=0,j;
    cin>>n;
    for(int i=2;i*i<=n;i++){
        t=0;
        while(n%i==0){
            n=n/i;
            t++;
        }
        j=lower_bound(all(v),t)-v.begin();
        if(v[j]>t) j--;
        ans=ans+j;
        
    }
    if(n>1) ans++;
    cout<<ans;

    return 0;
}   
     
signed main(){
    IOS;
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        cout<<"\n";
      // cout<<" * "<<t<<"\n";
    }
//    return 0;
} 

Measured memory_bytes: 14988