akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<math.h>
#include<cmath>
#define ll long long
using namespace std;
long double pi = 3.14159265358979323846;
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);



int main()
{
	int n;  cin >> n;
	int mn = 1000000;
	int z,c=0;
	for (int i = 0; i < n; i++)
	{
		cin >> z;
		if (mn > z)
		{
			c++;
			mn = z;
		}
	}
	cout << c;

	return 0;

}

Measured memory_bytes: 384
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String o = sc.next();
        String e = sc.next();
        sc.close();

        // 主処理
        String result = "";
        for (int i = 0; i < o.length(); i++) {
            result += o.charAt(i);
            if (i == o.length() - 1 && e.length() != o.length()) {
                break;
            }
            result += e.charAt(i);
        }

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using ll = int64_t;
using ld = long double;
using ull = uint64_t;
using namespace std;
using namespace __gnu_pbds;
typedef vector <int> vi;
typedef pair <int, int> ii;

const int INF = (int)1e9;

#define maxn 100010
#define mod (ll) (1e9 + 9)

ll inv(ll a, ll b){
    return 1 < a ? b - inv(b % a, a) * b / a : 1;
}

int main() {
#ifdef BZ
    freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(6);

    int n;
    cin >> n;

    vi a (n);

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

    vi dp (n, INF);

    dp[0] = 0;

    for (int i = 0; i < n; i++) {
        if (i - 1 >= 0) {
            dp[i] = min (dp[i], dp[i - 1] + abs (a[i] - a[i - 1]));
        }
        if (i - 2 >= 0) {
            dp[i] = min (dp[i], dp[i - 2] + abs (a[i] - a[i - 2]));
        }
    }

    cout << dp[n - 1] << "\n";


}

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

typedef pair<string, int> psi;

int main()
{
  int n, q, time, t = 0;
  string name;
  queue<psi> p;
  cin >> n >> q;
  for(int i = 0; i < n; i++){
    cin >> name >> time;
    p.push(psi(name, time));
  }
  while(!p.empty()){
    name = p.front().first;
    time = p.front().second;
    if(time <= q){
      t += time;
      cout << name << " " << t << endl;
    }else{
      time -= q;
      t += q;
      p.push(psi(name, time));
    }
    p.pop();
  }
}

Measured memory_bytes: 4404
#include <iostream>
using namespace std;
typedef long long ll;
int main(void){
    ll mod=1e9+7;
    ll n,m,ans1=0,ans2=0;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        ll a;
        cin>>a;
        ans1+=(2*i-n+1)*a;
    }
    for(int i=0;i<m;i++){
        ll a;
        cin>>a;
        ans2+=(2*i-m+1)*a;
    }
    cout<<((ans1%mod)*(ans2%mod))%mod<<endl;
}


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

int mod = 998244353;
int n, N;
string s;
vector<int> rgb[3];
vector<int> ord[3];

int calc(vector<int> &a, vector<int> &b) {
	int i;
	int ret = 1;
	
	for (i = n - 1; i >= 0; i--) {
		int id = lower_bound(b.begin(), b.end(), a[i]) - b.begin();
		int hoge = n - id;
		int mul = hoge - ((n - 1) - i);
		ret *= mul;
		ret %= mod;
	}
	return ret;
}

signed main() {
	int i, j;
	
	cin >> n >> s;
	N = 3 * n;
	
	rep(i, N) {
		if (s[i] == 'R') rgb[0].push_back(i);
		if (s[i] == 'G') rgb[1].push_back(i);
		if (s[i] == 'B') rgb[2].push_back(i);
	}
	
	typedef pair<int, int> P;
	rep(i, n) {
		vector<P> vec;
		vec.push_back(P(rgb[0][i], 0));
		vec.push_back(P(rgb[1][i], 1));
		vec.push_back(P(rgb[2][i], 2));
		sort(vec.begin(), vec.end());
		rep(j, 3) {
			ord[j].push_back(rgb[vec[j].second][i]);
		}
	}
	
	int ans = 1;
	rep(i, n) {
		ans *= (i + 1);
		ans %= mod;
	}
	
	(ans *= calc(ord[0], ord[1])) %= mod;
	(ans *= calc(ord[1], ord[2])) %= mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6012
n = input()
d =  {}

res = []
qes = []
score = []
for i in xrange(n):
    r,s = raw_input().split()
    if r not in d:
        d[r] = [(int(s),i)]
    else:
        d[r].append((int(s),i))
    if r not in res:
        qes.append(r)
    res.append(r)
    score.append(s)
qes = sorted(qes)

for j in qes:
    for k in sorted(d[j],reverse=True):
        print  k[1]+1

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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cout << #x << " = " << (x) << endl;
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

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; }
const ll INF = 1LL << 60;

//Write From this Line

int main()
{
	ll h;
	cin >>  h;
	//2^0 + 2^1 + ... + 2^count
	ll count = 1 ;
	while(h > 1){
		h /= 2;
		count ++ ;
	}
	ll ans = 0 ;
	rep(i,count){
		ans += pow(2,i);
	} 
	cout << ans << endl;
}


Measured memory_bytes: 256
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (ql:quickload '(:cl-debug-print :fiveam))
  #-swank (set-dispatch-macro-character #\# #\> (lambda (s c p) (declare (ignore c p)) (read s nil (values) t))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)
#-swank (disable-debugger) ; for CS Academy

;; BEGIN_INSERTED_CONTENTS
(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (let* ((s (read))
         (p 1000000000)
         (x1 p)
         (x2 1)
         (y2 (ceiling (+ s 1) p))
         (y1 (- (* p y2) s)))
    (if (= s (expt 10 18))
        (format t "0 0 1000000000 0 0 1000000000~%")
        (progn
          (assert (= s (abs (- (* x1 y2) (* x2 y1))) ))
          (format t "0 0 ~D ~D ~D ~D~%" x1 y1 x2 y2)))))

#-swank (main)


Measured memory_bytes: 18404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll solve(ll X) {
    ll ans = 0;
    for (ll i = 1, j = 0; i <= X; ++i) {
        j += i, ++ans;
        if (X <= j) return ans;
    }
}

int main() {
    ll X; cin >> X;
    cout << solve(X) << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    ll n;
    cin >> n;
    constexpr int m = 5;
    vl a(m);
    rep(i, 5) cin >> a[i];
    sort(all(a));
    cout << (n + a[0]-1)/a[0] + 4 << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

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

#define MOD 1000000007

int main() {
  ll n, m, k;
  cin >> n >> m >> k;
  vector<ll> va;
  vector<ll> vb;
  rep(i, 0, n) {
    ll a;
    cin >> a;
    va.pb(a);
  }
  rep(i, 0, n) {
    ll b;
    cin >> b;
    vb.pb(b);
  }
  ll mx = 0;
  rep(i, 0, 1 << n) {
    ll c = 0;
    vector<ll> va1;
    vector<ll> vb1;
    rep(j, 0, n) {
      if ((i >> j) & 1) {
        c++;
      }
    }
    if (c == k) {
      rep(j, 0, n) {
        if ((i >> j) & 1) {
          va1.pb(va[j]);
          vb1.pb(vb[j]);
        }
      }
      vector<pair<ll,ll> > v;
      rep(j,0,va1.sz){
        v.pb(mp(va1[j],vb1[j]));
      }
      sort(all(v));
      reverse(all(v));
      ll a1 = 0;
      ll m1 = m;
      rep(j,0,v.sz){
        a1 += v[j].fi*min(m1,v[j].se);
        m1-=v[j].se;
        if(m1<0)m1=0;
      }
      mx = max(mx,a1+m1);
    }
  }
  cout << mx << endl;
  return 0;
}

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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

lnt fact[2000010], invfact[2000010];

lnt invmod(lnt a, lnt p){ // a^-1 mod p
	lnt b = p, u = 1, v = 0;
	while(b){
		lnt t = a / b;
		a -= t*b; swap(a, b);
		u -= t*v; swap(u, v);
	}
	u %= p;
	if(u < 0) u += p;
	return u;
}

void factmod(lnt m){
	fact[0] = invfact[0] = 1;
	for(lnt i = 1; i < 2000010; i++){
		fact[i] = (fact[i-1] * i) % m;
		invfact[i] = (invfact[i-1] * invmod(i, m)) % m;
	}
}

lnt nCrmod(lnt n, lnt r, lnt m){
	return (((fact[n] * invfact[r]) % m) * invfact[n-r]) % m;
}

lnt powmod(lnt a, lnt p, lnt m){
	lnt res = 1, tmp = a;
	while(p != 0){
		if(p % 2) res = (res*tmp) % m;
		tmp = (tmp*tmp) % m;
		p >>= 1;
	}
	return res;
}

int main(){
	summon_tourist;

	lnt K; string S; cin >> K >> S;
	factmod(MOD);

	lnt ans = 0;
	REP(i, K+1){
		lnt nokori = K+S.size()-i;
		lnt num = nCrmod(nokori-1, S.size()-1, MOD);
		num *= powmod(25, nokori-S.size(), MOD); num %= MOD;
		num *= powmod(26, i, MOD); num %= MOD;
		ans += num; ans %= MOD;
	}
	cout << ans << ln;
}

Measured memory_bytes: 35684
import std.algorithm;
import std.array;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	int n;
	int m;
	while (readf (" %s %s", &n, &m) > 0)
	{
		auto a = new bool [] [] (n, n);
		foreach (j; 0..m)
		{
			int u, v;
			readf (" %s %s", &u, &v);
			u -= 1;
			v -= 1;
			a[u][v] = true;
			a[v][u] = true;
		}
		auto t = 1 << n;
		auto f = new int [] [] (t, n);
		f[1][0] = 1;
		foreach (s; 0..t)
		{
			foreach (v; 0..n) if (s & (1 << v))
			{
				foreach (u; 0..n) if (!(s & (1 << u)))
				{
					if (a[v][u])
					{
						int r = s | (1 << u);
						f[r][u] += f[s][v];
					}
				}
			}
		}
		writeln (sum (f[t - 1][]));
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int index(vector<int>& v, int x){
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}

int main(){
  int W, H;
  while(cin>>W>>H && W){
    int N;
    cin>>N;
    int x1[1000], y1[1000], x2[1000], y2[1000];
    vector<int> ax, ay;
    REP(i, N) cin>>x1[i]>>y1[i]>>x2[i]>>y2[i];
    REP(i, N) ax.push_back(x1[i]);
    REP(i, N) ax.push_back(x2[i]);
    REP(i, N) ay.push_back(y1[i]);
    REP(i, N) ay.push_back(y2[i]);
    ax.push_back(0); ax.push_back(W);
    ay.push_back(0); ay.push_back(H);
    sort(ax.begin(), ax.end());
    sort(ay.begin(), ay.end());
    ax.erase(unique(ax.begin(), ax.end()), ax.end());
    ay.erase(unique(ay.begin(), ay.end()), ay.end());
    bool block[2002][2002] = {};
    /*
    REP(i, ay.size() - 1){
      REP(j, ax.size() - 1){
        int bx = ax[j], ex = ax[j + 1];
        int by = ay[i], ey = ay[i + 1];
        REP(k, N){
          if(x1[k] <= bx && ex <= x2[k] && y1[k] <= by && ey <= y2[k]){
            block[i][j] = true;
            break;
          }
        }
      }
    }
    */
    REP(i, N){
      int bx = index(ax, x1[i]);
      int ex = index(ax, x2[i]);
      int by = index(ay, y1[i]);
      int ey = index(ay, y2[i]);
      FOR(y, by, ey)FOR(x, bx, ex)block[y][x] = true;
    }
    bool used[2002][2002] = {};
    int ans = 0;
    REP(i, ay.size() - 1){
      REP(j, ax.size() - 1){
        if(!block[i][j] && !used[i][j]){
          ans++;
          queue<int> qx, qy;
          qx.push(j); qy.push(i);
          used[i][j] = true;
          while(!qx.empty()){
            int x = qx.front(), y = qy.front();
            qx.pop(); qy.pop();
            REP(r, 4){
              int nx = x + dx[r];
              int ny = y + dy[r];
              if(valid(nx, ny, ax.size() - 1, ay.size() - 1) && !block[ny][nx] && !used[ny][nx]){
                used[ny][nx] = true;
                qx.push(nx);
                qy.push(ny);
              }
            }
          }
        }
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

using namespace std;
using ll = long long;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

ll digits(ll x) {
  ll d = 1;
  while(x >= 10) {
    x = x / 10;
    d++;
  }
  return d;
}

void solve(long long N){
  ll ans = digits(N);
  for(ll i=1; i*i<=N; i++) {
    if(N%i==0) {
      ans = min(ans, digits(N/i));
    }
  }
  std::cout << ans << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  solve(N);
  return 0;
}


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

typedef long long s64;

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

const int MaxN = 50;
const int MaxM = 100;
const int MaxK = 100;
const int M = 1000000007;

int n, m, k;
vector<int> adj[MaxN + 1];

int bin[MaxM + MaxK][MaxM + MaxK];

int prePow[MaxN + 1];

int inv[MaxN + 1];

int dfs_clock = 0;
int dfn[MaxN + 1], low[MaxN + 1];

int sta_n = 0;
int sta[MaxN + 2];

bool ins[MaxN + 1];

int res = 1;

inline int gcd(int a, int b)
{
	while (b > 0)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}

void dfs(const int &u)
{
	dfn[u] = low[u] = ++dfs_clock;
	sta[sta_n++] = u;

	for (int v : adj[u])
	{
		if (dfn[v])
			tense(low[u], dfn[v]);
		else
		{
			dfs(v);
			tense(low[u], low[v]);

			if (low[v] >= dfn[u])
			{
				int nV = 1, nE = 0;
				for (int u = 1; u <= n; ++u)
					ins[u] = false;
				ins[u] = true;

				while (sta[sta_n] != v)
				{
					ins[sta[--sta_n]] = true;
					++nV;
				}

				for (int su = 1; su <= n; ++su)
				{
					if (!ins[su])
						continue;

					for (int sv : adj[su])
						nE += ins[sv];
				}

				nE >>= 1;

				if (nE > nV)
					res = (s64)res * bin[nE + k - 1][k - 1] % M;
				else if (nE < nV)
					res = (s64)res * k % M;
				else
				{
					int ways = 0;
					for (int i = 1; i <= nV; ++i)
						ways = (ways + prePow[gcd(i, nV)]) % M;

					res = (s64)res * ways % M * inv[nV] % M;
				}
			}
		}
	}
}

int main()
{
	cin >> n >> m >> k;
	for (int i = 0; i < m; ++i)
	{
		int u, v;
		cin >> u >> v;

		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	for (int i = 0; i < m + k; ++i)
	{
		bin[i][0] = 1;
		for (int j = 1; j <= i; ++j)
			bin[i][j] = (bin[i - 1][j] + bin[i - 1][j - 1]) % M;
	}

	inv[1] = 1;
	for (int i = 2; i <= n; ++i)
		inv[i] = (s64)(M - M / i) * inv[M % i] % M;

	prePow[0] = 1;
	for (int i = 1; i <= n; ++i)
		prePow[i] = (s64)prePow[i - 1] * k % M;

	for (int u = 1; u <= n; ++u)
		if (!dfn[u])
			dfs(u);

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 384
A, B, C, D = gets.split.map(&:to_i)

E = C.lcm(D)

underB  = B     - B.div(C) - B.div(D) + B.div(E)
underA1 = A - 1 - (A-1).div(C) - (A-1).div(D) + (A-1).div(E)

p underB - underA1

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

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

    vector<int> d(N);
    for(int i = 0; i < N; i++)
    {
        cin >> d.at(i);
    }

    int A[110] = {0};

    for(int i = 0; i < N; i++)
    {
        A[d.at(i)]++;
    }

    int count = 0;

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

    cout << count << endl;
}

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl;
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

// Aliases
#define PB push_back
#define MP make_pair
#define FST first
#define SND second
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<string> vs;

// I/O Asynchronizing
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

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

inline ll ncnt(const ll n, const ll c, const ll d) {
    return n - (n / c) - (n / d) + (n / (c * d / gcd(c, d)));
}

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    cout << ncnt(b, c, d) - ncnt(a - 1, c, d) << "\n";

    return 0;
}


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



int main(){
    int h,w,k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    int c[10][1005];
    int ans = 1e9;
    rep(div,1<<(h-1)){
        int g = 0;
        vector<int> id(h);
        id[0] = g;
        rep(i,h-1){
            if(div>>i&1) ++g;
            id[i+1]=g;
        }
        ++g;
        rep(i,g)rep(j,w) c[i][j] = 0;
        rep(i,h)rep(j,w) c[id[i]][j] += s[i][j] - '0';

        int num = g-1;
        vector<int> now(g);
        auto add = [&](int j){
            rep(i,g) now[i] += c[i][j];
            rep(i,g) if(now[i]>k) return false;
            return true;
        };

        rep(j,w){
            if(!add(j)){
                num++;
                now = vector<int>(g);
                if(!add(j)) {
                    num = 1e9;
                    break;
                }
            }
        }
        ans = min(ans,num);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<queue>


#define rep(i,x) for(int i=0;i<(int)(x);i++)
#define reps(i,x) for(int i=1;i<=(int)(x);i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)

#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 2e9

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

using namespace std;

int main()
{
    ll n;
    cin >> n;
    vector<ll> v(n), a(n), b(n);

    rep(i, n){
        cin >> v[i];
    }

    rep(i, n){
        if(i == 0) a[i] = v[i];
        else a[i] = gcd(a[i-1], v[i]);
    }

    rep(i, n){
        if(i == 0) b[n-1] = v[n-1];
        else b[n-1-i] = gcd(b[n-i], v[n-1-i]);
    }

    ll m = -INF;
    rep(i, n){
        if(i == 0) m = max(m, b[1]);
        else if(i == n-1) m = max(m, a[n-2]);
        else{
            ll g = gcd(a[i-1], b[i+1]);
            m = max(m, g);
        }
    }

    cout << m;
}


Measured memory_bytes: 2560
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	fmt.Println(calc(a, b))
}

func calc(a, b int) string {
	switch {
	case a <= 0 && 0 <= b:
		return "Zero"
	case a < 0 && (b-a)%2 == 0:
		return "Negative"
	default:
		return "Positive"
	}
}


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vst = vector<st>;
using vchar = vector<char>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;


int main(){
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  if(a <= c && c <= b && b <= d) cout << b - c << endl;
  else if(a <= c && c <= d && d <= b) cout << d - c << endl;
  else if(c <= a && a <= d && d <= b) cout << d - a << endl;
  else if(c <= a && a <= b && b <= d) cout << b - a << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args){
		new Main().run();
	}


	void run(){
		Scanner sc = new Scanner(System.in);

		boolean f = false;
		long[] a = new long[3];
		for(int i=0;i<3;i++){
			a[i] = sc.nextLong();
			if(a[i]%2==0){
				f = true;
			}
		}
		if(f){
			System.out.println(0);
		}else{
			Arrays.sort(a);
			System.out.println(a[0]*a[1]);
		}
	}

}


Measured memory_bytes: 9932
#!/usr/bin/env python3
import sys

NO = "IMPOSSIBLE"  # type: str

def solve(A: int, B: int):
    if (A + B) % 2 == 0:
        print(int((A + B) / 2))
        return
    print(NO)
    return 

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <stdio.h>

int main(){
	int H, W, i, j;
	scanf("%d %d", &H, &W);
	while(H != 0 && W != 0){
		for(i = 0; i < H; i++){
			for(j = 0; j < W; j++){
				if(i % 2 == 1 && j % 2 == 1 || i % 2 == 0 && j % 2 == 0){
					printf("#");
				} else {
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
		scanf("%d %d", &H, &W);
	}
	return 0;
}

Measured memory_bytes: 572
from collections import defaultdict
from heapq import heappop, heappush


class Graph(object):
    """
    隣接リストによる有向グラフ
    """

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()


class Dijkstra(object):
    """
    ダイクストラ法（二分ヒープ）による最短経路探索
    計算量: O((E+V)logV)
    """

    def __init__(self, graph, start):
        self.g = graph.graph

        # startノードからの最短距離
        # startノードは0, それ以外は無限大で初期化
        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        # 最短経路での1つ前のノード
        self.prev = defaultdict(lambda: None)

        # startノードをキューに入れる
        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            # 優先度（距離）が最小であるキューを取り出す
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q, (alt, v))

    def shortest_distance(self, goal):
        """
        startノードからgoalノードまでの最短距離
        """
        return self.dist[goal]

    def shortest_path(self, goal):
        """
        startノードからgoalノードまでの最短経路
        """
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]
h,w = map(int,input().split())
g = Graph()
for i in range(10):
    c = list(map(int,input().split()))
    for j in range(10):
        src,dst,weight = i,j,c[j]
        g.add_edge(src, dst, weight)

ans = 0
for y in range(h):
    tmp = list(map(int,input().split()))
    for x in range(w):
        if tmp[x] != -1 and tmp[x] != 1:
            d = Dijkstra(g, tmp[x])
            ans += d.shortest_distance(1)
print(ans)

Measured memory_bytes: 9288
import java.util.Scanner;


public class Main{

	public static void main(String args[]){
	int i,j,k,n,q;;
	Scanner sc=new Scanner(System.in);
	
	n=Integer.parseInt(sc.next());
	long s[]=new long[n+1];
	for(i=0;i<n;i++){
		s[i]=Integer.parseInt(sc.next());
	}
	
	q=Integer.parseInt(sc.next());
	long T[]=new long[q+1];
	
	for(i=0;i<q;i++){
		T[i]=Integer.parseInt(sc.next());
	}
	
	int count=0;
	
	for(j=0;j<q;j++){
		for(i=0;i<n;i++){
	if(T[j]==s[i]){
			count++;
			break;
			}
		}	
	}
	System.out.println(count);
	}
}

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

using namespace std;

struct Edge
{
    int u, v, w;
    Edge(){};
    Edge(int _u, int _v, int _w) : u(_u), v(_v), w(_w){};
};

int l;
int n, m;
vector<Edge> res;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> l;
    n = 1;
    m = 0;
    int t = 1;
    while (t*2 <= l)
    {
        n++;
        m++;
        res.push_back(Edge(n - 1, n, 0));
        m++;
        res.push_back(Edge(n - 1, n, t));
        t = t * 2;
    }
    while (t < l)
    {
        int Res = 1, tmp = 1;
        while (tmp <= l - t)
        {
            tmp *= 2;
            Res++;
        }
        tmp /= 2;
        Res--;
        m++;
        res.push_back(Edge(Res, n, t));
        t += tmp;
    }
    cout << n << ' ' << m << '\n';
    for (Edge x : res)
    {
        cout << x.u << ' ' << x.v << ' ' << x.w << '\n';
    }
    return 0;
}


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

int main()
{
	string s, t[8] = { "black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white" };

	cin >> s;

	while (s != "0") {
		int r, g, b, i = 0;

		r = stoi(s.substr(1, 2), nullptr, 16);
		g = stoi(s.substr(3, 2), nullptr, 16);
		b = stoi(s.substr(5, 2), nullptr, 16);

		if (r > 127)
			i += 4;
		if (g > 127)
			i += 2;
		if (b > 127)
			i += 1;

		cout << t[i] << endl;
		
		cin >> s;
	}

	return 0;
}


Measured memory_bytes: 3176
#include <iostream>
#include <cstdio>

using namespace std;

const int al_size=(int)('z'-'a')+1;

int main() {
	bool al_ap[al_size];
	bool non_flg=true;
	char c;
	
    for(int i=0; i<al_size; i++){
        al_ap[i] = false;
    }
    
    while(cin >> c){
        if(c>='a' && c<='z'){
            al_ap[c-'a'] = true;
        }
    }
    for(int i=0; i < al_size; i++){
        if(!al_ap[i]){
            cout<< (char)(i+'a')<<endl;
            non_flg=false;
            break;
        }
    }
    if(non_flg){
        cout << "None" << endl;
    }
    
    return 0;
}

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

using namespace std;

typedef long long int ll;

int main(){
  int N;
  cin >> N;
  vector<double> A;

  int i;
  for(i=0;i<N;i++){
    double Ai;
    cin >> Ai;
    Ai=1.0/Ai;
    A.emplace_back(Ai);
  }

  double sum=0.0,ans;
  for(auto v : A){
    sum+=v;
  }

  ans=1.0/sum;

  cout << ans << endl;
  
}

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

int main() {
	string s;
	cin >> s;
	int a[4];
	for (int i = 0; i < 4; i++) {
		a[i] = s[i] - '0';
	}
	for (int i = 0; i < (1 << 3); i++) {
		int ans = a[0];
		for (int j = 0; j < 3; j++) {
			ans += pow(-1, (i >> j) & 1) * a[j + 1];
		}
		if (ans == 7) {
			cout << a[0];
			for (int j = 0; j < 3; j++) {
				cout << "+-"[(i >> j) & 1] << a[j + 1];
			}
			cout << "=7" << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
s = gets.chomp
t = gets.chomp
def fin; p -1; exit; end
pos = Hash.new { |h, k| h[k] = [] }
s.each_char.with_index { |c, i| pos[c] << i }
l = 0
prev_i = -1
t.each_char do |c|
  j = pos[c].bsearch { |x| x > prev_i } rescue fin
  prev_i = j || pos[c][0]
  l += 1 if !j
end
p s.size * l + (prev_i + 1) rescue fin


Measured memory_bytes: 3324
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    static long gcd(long x, long y) {
        return y == 0 ? x : gcd(y, x % y);
    }

    static long lcm(long x, long y) {
        return x * (y / gcd(x, y));
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
//        String[] str = br.readLine().split(" ");

        long[] t = new long[n];
        for (int i = 0; i < n; i++) {
            t[i] = Long.parseLong(br.readLine());
        }

        if(t.length == 1){
            System.out.println(t[0]);
        } else {
            long recent_lcm = lcm(Long.max(t[0], t[1]), Long.min(t[0], t[1]));
            for (int i = 2; i < n; i++) {
                recent_lcm = lcm(Long.max(recent_lcm, t[i]), Long.min(recent_lcm, t[i]));
            }

            System.out.println(recent_lcm);
        }
    }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
	string s;	cin >> s;
  	if     (s == "MON") cout << 6 << endl;
    else if(s == "TUE") cout << 5 << endl;
  	else if(s == "WED") cout << 4 << endl;
  	else if(s == "THU") cout << 3 << endl;
  	else if(s == "FRI") cout << 2 << endl;
  	else if(s == "SAT") cout << 1 << endl;
  	else if(s == "SUN") cout << 7 << endl;

}

Measured memory_bytes: 256
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;

int n, k;
LL a[5003];
int pref[5003][5003], suff[5003][5003];

int main()
{
	scanf("%d %d", &n, &k);
	LL sum = 0;
	for (int i = 1; i <= n; i++) {
		scanf("%lld", &a[i]);
		a[i] = MIN(k, a[i]);
		sum += a[i];
	}

	if (sum < k) {
		printf("%d\n", n);
		return 0;
	}

	pref[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= k; j++) pref[i][j] = pref[i - 1][j];
		for (int j = k - a[i]; j >= 0; j--) pref[i][j + a[i]] |= pref[i][j];
	}

	suff[n + 1][0] = 1;
	for (int i = n; i >= 1; i--) {
		for (int j = 0; j <= k; j++) suff[i][j] = suff[i + 1][j];
		for (int j = k - a[i]; j >= 0; j--) suff[i][j + a[i]] |= suff[i][j];
	}

	for (int i = 0; i <= n + 1; i++) {
		//for (int j = 1; j <= k + 1; j++) pref[i][j] += pref[i][j - 1];
		for (int j = 1; j <= k + 1; j++) suff[i][j] += suff[i][j - 1];
	}
	int cnt = 0;
	for (int i = 1; i <= n; i++) {
		// pref[i - 1][...], suff[i + 1][...]
		if (a[i] >= k) continue;
		int flag = 0;
		for (int j = 0; j < k; j++) {
			if (pref[i - 1][j] == 0) continue;
			int t = suff[i + 1][k - 1 - j] - (k - a[i] - j > 0 ? suff[i + 1][k - a[i] - 1 - j] : 0);
			if (t > 0) {
				flag = 1;
			}
		}
		if (!flag) cnt++;
	}

	printf("%d\n", cnt);
	return 0;
}


Measured memory_bytes: 195840
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))

n, k = load_list()

p = 0
for i in range(1, n+1):
    if i >= k:
        p += 1 / n
        continue
    m = math.ceil(math.log2(k) - math.log2(i))
    p += 1 / n * ((1/2) ** m)

print(p)


    


Measured memory_bytes: 3316
// hackerearth incom
        #include <bits/stdc++.h>

        using namespace std;

        typedef long long ll;
        const ll N = 1e6+5;
        const ll MOD = 1000000007;
        #define all(x) x.begin(),x.end()
        #define pii pair<ll,ll>
        #define pis pair<ll,string>
        #define F first
        #define S second
        #define LCM(a,b) ((a*b)/__gcd(a,b))
        #define inf 1e15
        #define test ll cse;cin>>cse;for(ll _i=1;_i<=cse;_i++)
        #define PI 3.14159265
        #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
        const double EPS = 1E-9;
        typedef vector<vector<double>> matrix;
        typedef vector<int> vi;


int prime[N];
int nod[N];
int Exp(ll x, ll n){
    ll ans = 1, X =x,N= n;
    while(N > 0){
        if(N&1) ans = (ans*X);
        X = (X*X);
        N >>= 1;
    }
    return ans;
}

unordered_map< int, int> primeCount;

int solve(ll num){

    unordered_map<int,int> mapp;
    while(num > 1){
        mapp[ prime[num]]++;
        num /= prime[num];
    }

    for(auto ele: mapp) primeCount[ele.first]++;
    // number of factors
    int res = 1; for(auto ele: mapp) res *= (ele.S+1);

    // sum of divisors/factors
    // ll ans = 1;
    // for(auto ele: mapp){
    //     ll ai = ele.F;
    //     ll pi = ele.S;

    //     ans *= (Exp(ai,pi+1)-1)/(ai-1);
    // }
    return res;
}

void sieve(){
    memset(prime,0,sizeof(prime));
    prime[0] = prime[1] = 1;

    for(int i = 2; i <= N; i++){
        if(prime[i]==0){
            for(int j=i; j <= N;j+=i) prime[j] = i;
        }
    }
}

int main(){

    fast;
    sieve();

    int n;
    int ar[N];

    cin >> n;
    for(int i = 0; i < n; i++) cin >> ar[i];
    for(int i = 0; i < n; i++) {
        solve(ar[i]);
    }


    bool coprime = true;
    bool setprime = true;

    for(auto ele: primeCount) {

        if(ele.second > 1) coprime = false;
        if(ele.second == n) setprime = false;
    }


    if(coprime)
        cout << "pairwise coprime\n";
    else if(setprime)
        cout << "setwise coprime\n";
    else
        cout << "not coprime\n";
    return 0;
}


Measured memory_bytes: 14280
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>

#define rep(i,n) for(int i = 0;i < n;i++)
#define Rep(i,m,M) for(int i = m;i < M;i++)
#define print(var) cout<<#var" = "<<var<<endl;

typedef long long ll;

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;

int main()
{
	ll x;
	cin >> x;
	ll ans = ceil(((double)(2.0*x-1.0)) / 11.0);
	cout << ans;
}


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

int main() {
	int n;
	cin >> n;
	int64_t a = 1;
	int64_t b = 1;
	int64_t c = 1;
	for(int i=0;i<n;i++){
		a *= 10;
		b *= 9;
		c *= 8;
		a %= 1000000007;
		b %= 1000000007;
		c %= 1000000007;


	}
	int64_t answer;

	answer = (a - b) * 2 -(a - c);
	if(answer >= 1000000007){
		while(answer >= 1000000007){
			answer -= 1000000007;
		}
		}
	else if(answer < 0){
		while(answer < 0){
			answer += 1000000007;
		}
		}
		

	cout << answer << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef pair<ll, int> pli;

#ifndef ONLINE_JUDGE
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
#else
#define dbg(x)
#endif

#define X first
#define Y second
bool iscubic(ll num){
    ll rt = pow((double)num, 1.0/3.0);
    for (ll i = max(0LL, rt - 2); i <= rt + 2; i++){
        if (i * i * i == num) return true;
    }
    return false;
}
const int MAXN = 100100;
bool isprime[MAXN];
vector<int> primes;
void sieve(){
    memset(isprime, true, sizeof isprime);
    isprime[0] = isprime[1] = false;
    for (ll i = 2; i < MAXN; i++){
        if (isprime[i]){
            primes.push_back(i);
            for (ll j = i * i; j < MAXN; j += i){
                isprime[j] = false;
            }
        }
    }
}

vector<pii> factorise(ll num){
    vector<pii> ans;
    for (int x : primes){
        int f = 0;
        if ((ll) x * x > num) break;
        while (num % x == 0){
            f += 1;
            num /= x;
        }
        f %= 3;
        if (f) ans.emplace_back(x, f);
    }
    if (num != 1) ans.emplace_back(num, 1);
    return ans;
}

vector<pii> invert(vector<pii> v){
    for (pii &x : v){
        x.Y = 3 - x.Y;
    }
    return v;
}

int main(){
    sieve();
    std::ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    vector<ll> tmp(n);
    for (int i = 0; i < n; i++) cin >> tmp[i];
    vector<pli> arr;
    sort(tmp.begin(), tmp.end());
    for (int L = 0, R; L < n; L = R){
        R = L + 1;
        while (R < n && tmp[L] == tmp[R]) R++;
        arr.emplace_back(tmp[L], R - L);
    }
    n = (int)arr.size();
    int cube = 0;
    map<vector<pii>, pii> mmap;
    for (int i = 0; i < n; i++){
        if (iscubic(arr[i].X)) cube = 1;
        else {
            vector<pii> ori = factorise(arr[i].X);
            vector<pii> inv = invert(ori);
            if (mmap.count(ori)){
                mmap[ori].X += arr[i].Y;
            } else if (mmap.count(inv)){
                mmap[inv].Y += arr[i].Y;
            } else {
                mmap[ori] = {arr[i].Y, 0};
            }
        }
    }
    int res = cube;
    for (auto &it : mmap){
        res += max(it.second.X, it.second.Y);
    }
    cout << res << endl;


    return 0;
}


Measured memory_bytes: 14716
#include <bits/stdc++.h>
#define rep(i,n)  for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define deb(x) cerr << #x <<": " << x << '\n';
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
typedef long double ld;
typedef long long ll;
 
vector<ll> primes;
void SieveOfEratosthenes(ll n){
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (ll p=2; p*p<=n; p++){
        if (prime[p] == true){
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (ll p=2; p<=n; p++)
       if (prime[p])
           primes.push_back(p);
}
 
bool isPrime(ll n){
  if(n == 1) return false;
  ll i = 2;
  while (i*i <= n){
      if (n % i == 0) return false;
      ++i;
  }
  return true;
}

ll fast_pow(ll base, ll n){
    if(n == 0) return 1;
    if(n == 1)  return base;
    ll halfn = fast_pow(base, n/2);
    if(n % 2 == 0) return halfn * halfn;
    else return halfn * halfn * base;
}
 
int main(){
    ios;
    ll n; cin >> n;
    if(isPrime(n)){cout << 1; return 0;}
    SieveOfEratosthenes(5e6 + 6e5);
    ll ans = 0, check = 0;
    for(ll i = 0; i < primes.size(); i++){
        for(ll j = 1; j <= 40; j++){
            check = fast_pow(primes[i],j);
            if(n % check == 0) {ans++; n/=check;}
        }
    }
    if(isPrime(n) && n > 5e6 + 6e5)ans++;
    cout << ans;
    return 0;
}


Measured memory_bytes: 12860
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//CODE
void solve(void)
{
  int A,B;
  cin>>A>>B;
  if(A<9 && B<9)
  {
    cout<<"Yay!"<<endl;
  }
  else
  {
    cout<<":("<<endl;
  }
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256