akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using LL = __int128;
constexpr int maxn = 100000;
int cp[maxn], pn;
map<LL, LL> mq;
LL p[maxn];
int main(){
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    for(int i = 2; i < maxn; i += 1)
        if(not cp[i]){
            p[pn ++] = i;
            for(int j = i; j < maxn; j += i) cp[j] = 1;
            mq[(LL)i * i] = i;
        }
    map<pair<LL, LL>, int> mp;
    long long tmp;
    for(int i = 0; i < N; i += 1){
        cin >> tmp;
        LL s = tmp, d = 1, norm = s, pair = 1;
        for(int j = 0; p[j] * p[j] * p[j] <= s; j += 1){
            int r = 0;
            for(LL x = s; x % p[j] == 0; x /= p[j]){
                r = r + 1;
                d *= p[j];
            }
            for(int i = 0; i < r / 3 * 3; i += 1) norm /= p[j]; 
            for(int i = 0; i < (3 - r % 3) % 3; i += 1) pair *= p[j]; 
        }
        if(mq.count(s / d)) pair *= mq[s / d];
        else pair *= (s / d) * (s / d);
        mp[{norm, pair}] += 1;
        mp[{pair, norm}] += 0;
    }
    int ans = 0;
    for(auto p : mp)
        if(p.first.first == p.first.second) ans += 1;
        else if(p.first.first < p.first.second) ans += max(p.second, mp[{p.first.second, p.first.first}]);
    cout << ans;
    return 0;
}

Measured memory_bytes: 20352
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    l=[0]*(N+1)
    for i in range(1,N+1):
        a=2
        while i>1:
            if i%a==0:
                l[a]+=1
                i//=a
            else:
                a+=1
    
    ans=1
    for x in l:
        ans*=x+1
        ans%=MOD
    print(ans)

if __name__ == '__main__':
    main()


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;

#define pb push_back
#define ff first
#define ss second
#define SIZE 200010
#define INF 2e9 + 9
#define acmpIN "input.txt"
#define acmpOUT "output.txt"

//#pragma GCC optimize("Ofast")

int n, p;
string s;
vector<int> num;
int used[10001];
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
//    freopen(acmpIN, "r", stdin);
//    freopen(acmpOUT, "w", stdout);



    cin >> n >> p >> s;
    for(char c: s)
    {
        num.pb(c - '0');
    }
    if(p == 2 || p == 5)
    {
        ll ans = 0;
        for(int i = n - 1; i >= 0; i--)
        {
            if(num[i] % p == 0)
                ans += i + 1;
        }
        cout << ans;
        return 0;
    }
    int t = 1;
    vector<int> mods(n + 1, 0);
    for(int i = n - 1; i >= 0; i--)
    {
        mods[i] = num[i] * t % p;
        t *= 10;
        t %= p;
    }
    for(int i = n - 1; i >= 0; i--)
    {
        mods[i] += mods[i + 1];
        mods[i] %= p;
    }
    ll ans = 0;
    used[0]++;
    for(int i = n - 1; i >= 0; i--)
    {
        ans += used[mods[i]];
        used[mods[i]]++;
    }

    cout << ans;

    return 0;
}



Measured memory_bytes: 2188
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    a, b, x = input_int_list()
    ans = (b // x) - (a // x)
    if a % x == 0:
        ans += 1
    print(ans)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 61876
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=205;
int T;
int n;
long long a[N];
char s[N];
struct Basis
{
	static const int M=60;
	long long d[N];
	void clear()
	{
		memset(d,0,sizeof(d));
		return;
	}
	void insert(long long t)
	{
		for(int i=M;i>=0;i--)
			if(t&(1LL<<i))
			{
				if(d[i]) t^=d[i];
				else
				{
					for(int j=0;j<i;j++)
						if(t&(1LL<<j)) t^=d[j];
					for(int j=i+1;j<=M;j++)
						if(d[j]&(1LL<<i)) d[j]^=t;
					d[i]=t;
					break;
				}
			}
		return;
	}
	bool find(long long t)
	{
		for(int i=M;i>=0;i--)
			if(t&(1LL<<i))
			{
				if(d[i]) t^=d[i];
				else return false;
			}
		return true;
	}
}lb;
void solve()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	scanf("%s",s+1);
	lb.clear();
	for(int i=n;i>=1;i--)
		if(s[i]=='1')
		{
			if(!lb.find(a[i]))
			{
				printf("1\n");
				return;
			}
		}
		else if(s[i]=='0') lb.insert(a[i]);
	printf("0\n");
	return;
}
int main()
{
	scanf("%d",&T);
	while(T--)
		solve();
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main() {
  int a , b;
  char c;
  while(1){
  cin >> a >> c >> b;
  if (c == '?') break;

  if (c == '+') cout << a + b << endl;
  if (c == '-') cout << a - b << endl;
  if (c == '/') cout << a / b << endl;
  if (c == '*') cout << a * b << endl;
  }
  return 0;

}


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

using namespace std;
using ll = long long;

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

int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;

  vector<int> a(n, 0);

  for (int i = 1; i < n; ++i) {
    a[i] = a[i - 1];
    if (s[i - 1] == 'A' && s[i] == 'C') ++a[i];
  }

  rep(i, q) {
    int l, r;
    cin >> l >> r;
    --l;
    --r;
    int ans = a[r] - a[l - 1];
    if (s[l] == 'C' && s[l - 1] == 'A') --ans;
    cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
vector<bool> makePrimeTableBasedOne(int);

int main() {
  vector<int> questions;
  int q;
  while(cin >> q, q) questions.push_back(q);
  int maxQuestion = *(max_element(questions.begin(), questions.end()));
  auto primeTable = makePrimeTableBasedOne(maxQuestion);
  for(auto i = questions.begin(); i != questions.end(); ++i) {
    int question = *i;
    int deltas[] = {0, 2, 4, 2};
    bool loopEnd = false;
    int k, l, j;
    for(j = ((question % 2) ? question : question - 1); !loopEnd && j >= 7; j -= 2) for(k = 0, l = j; !loopEnd && primeTable[l]; ++k, l -= deltas[k]) if(k == 3) {
      cout << l + 8 << endl;
      loopEnd = true;
    }
  }
  return 0;
}

vector<bool> makePrimeTableBasedOne(int max) {
  vector<bool> primeBools(max + 1, true); // one based
  double squareMax = pow(max, (double)1 / (double)2);
  primeBools[1] = false;
  for(int i = 2; i <= squareMax; ++i) {
    if(primeBools[i]) {
      for(int j = 2; i * j < max + 1; ++j) primeBools[i * j] = false;
    }
  }
  return move(primeBools);
}

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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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; }

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    int N,M;
    cin >> N >> M;
    double total = 0;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    rep(i,N) total += A[i];
    sort(all(A),greater<int>());
    
    rep(i,M)
    {
        if( 4 * M * A[i] < total )
        { 
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<bitset>
#include<map>
#include<vector>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<ctime>
#include<complex>
using namespace std;

int n,ans,cnt;
int x[100005];
int y[100005];
int par[100005];
pair<int,int> f[200005];
pair<int,int> nei[200005];
pair<int,int> val[200005];

int getPar(int x){
	if(x==par[x]) return x;
	return par[x]=getPar(par[x]);
}

int Ab(int x){
	if(x<0) return -x;
	return x;
}

int main(){
	cin>>n;
	for(int i=0;i<n;i++) par[i]=i;
	for(int i=0;i<n;i++) cin>>x[i]>>y[i];
	for(int i=0;i<n;i++) f[i]=make_pair(x[i],i);
	sort(f,f+n);
	for(int i=0;i<n-1;i++){
		int l=f[i].second;
		int r=f[i+1].second;
		nei[cnt]=make_pair(l,r);
		val[cnt]=make_pair(min(Ab(y[l]-y[r]),Ab(x[l]-x[r])),cnt);
		cnt++;
	}
	for(int i=0;i<n;i++) f[i]=make_pair(y[i],i);
	sort(f,f+n);
	for(int i=0;i<n-1;i++){
		int l=f[i].second;
		int r=f[i+1].second;
		nei[cnt]=make_pair(l,r);
		val[cnt]=make_pair(min(Ab(y[l]-y[r]),Ab(x[l]-x[r])),cnt);
		cnt++;
	}
	sort(val,val+cnt);
	int tot=0;
	for(int i=0;i<cnt,tot<n-1;i++){
		int now=val[i].second;
		int l=nei[now].first;
		int r=nei[now].second;
		l=getPar(l);
		r=getPar(r);
		if(l!=r){
			par[l]=r;
			tot++;
			ans+=val[i].first;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5504
q = int(input())
a = [list(map(int, input().split())) for i in range(q)]
s = [0]*(2*10**5+2)
s[3] = 1
for i in range(3, 10**5):
    for j in range(2, int((2*i)**0.5)+2):
        if (i > j and i % j == 0) or (2*i-1) % j == 0:
                b = 0
                break
    else:
        b = 1
    s[2*i-1] = b
S = [0]
for i in range(1, 10**5+1):
    c = S[i-1] + s[i]
    S.append(c)
for i in range(q):
    print(S[a[i][1]] - S[a[i][0]-1])

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

using namespace std;

int main() {
	int n,m; cin>>n>>m;
	int h[n];
	vector<vector<int>> adjl(n, vector<int>());

	for(int i=0; i<n; i++) cin>>h[i];

	for(int i=0; i<m; i++) {
		int x,y;
		cin>>x>>y; x--; y--;
		adjl[x].push_back(y);
		adjl[y].push_back(x);
	}

	int ans = 0;
	for(int i=0; i<n; i++) {
		bool ok = 1;
		for(int ch : adjl[i]) {
			if(h[ch] >= h[i])
				ok = 0;
		}
		ans += ok;
	}

	printf("%d\n", ans);

	return 0;
}

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

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

    int N; cin >> N;
    vector<int> v(N+1), c(5);
    for (int i = 2; i <= N; i++) {
        int x = i;
        for (int j = 2; j <= i; j++) {
            while (x % j == 0) {
                v[j]++;
                if (v[j] == 74) c[0]++;
                else if (v[j] == 24) c[1]++;
                else if (v[j] == 14) c[2]++;
                else if (v[j] == 4) c[3]++;
                else if (v[j] == 2) c[4]++;
                x /= j;
            }
        }
    }

    int ans = 0;
    ans += c[0];
    ans += c[1] * (c[4]-1);
    ans += c[2] * (c[3]-1);
    ans += c[3] * (c[3]-1) / 2 * (c[4]-2);
    cout << ans << "\n";
}

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

int main() {
    int x,y;
    while(true){
        cin >> x >> y;
        if (x == 0 && y ==0) {
            break;
        }
        cout << min(x,y) << ' ' << max(x, y) << endl;
;
    }
    return 0;
}



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

#define LEN 100000
using namespace std;

class Pro{
public:
	string name;
	int time;
};

class Que{
	Pro p[100000];
public:
	int head=0, tail=0, n;
	void enqueue(Pro x){
		p[tail] = x;
		tail = (tail + 1) % LEN;
	}

	Pro dequeue(){
		Pro x = p[head];
		head = (head + 1) % LEN;
		return x;
	}
};


int main()
{
	int n;//??????????????°
	cin >> n;
	int q;//?????????????????????
	cin >> q;
	
	Que Q;
	for (int i = 0; i < n; i++){
		Pro x;
		cin >> x.name;
		cin >> x.time;
		Q.enqueue(x);
	}

	//????????????
	int t=0;

	while (Q.head != Q.tail){
		Pro c;
		c = Q.dequeue();
		int b = min(c.time, q);
		c.time -= b;
		t += b;

		if (c.time > 0) {
			Q.enqueue(c);
		}
		else{
		cout << c.name << ' ' << t << '\n';
		}
	}
	return 0;
}

Measured memory_bytes: 6916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod(pow(10,9)+7);

ll modpow(ll a, ll m){
	a %= mod;
	if(m == 0) return 1;
	else if(m % 2 == 0) return modpow(a*a , m/2) % mod;
	else return a * modpow(a, m-1) % mod;
}

ll nCr(ll n, ll r){
	if(r*2>n) r = n-r;
	ll mul(1), div(1);
	for(ll i(1);i<=r;++i){
		mul *= n-i+1;
		div *= i;
		mul %= mod;
		div %= mod;
	}
	return mul * modpow(div, mod-2) % mod;
}

int main(){
	ll N,M;
	cin >> N >> M;
	ll ans(1), M2(M), cnt(0);
	for(ll i(2); M2 > 1 ;++i){
		if(M2 % i == 0){
			while(M2 % i == 0){
				M2 /= i;
				cnt++;
			}
			ans *= nCr(N + cnt - 1, N - 1);
			ans %= mod;
			cnt = 0;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
	int n , j=0;
	vector<int> v;
	while(cin>>n){
		for(int i=512 ; i>=1 ; i>>=1){
			if(n>=i){
				v.push_back(i);
				n-=i;
			}
		}
		sort(v.begin(),v.end());
		vector<int>::iterator it;
		for(it=v.begin();it!=v.end()-1;++it){
			cout << *it << " ";
		}
		cout << *it << endl;
		v.clear();
	}
	return 0; 
}

Measured memory_bytes: 1216
def f;gets.to_i;end
while(n = f)>0
  m,g = f, f
  a = (1..n).to_a
  b = [a.dup]
  l = (1..f).map{
  i=0
  (r=gets.chars).map{|c|c>?0&&(*a[i,2]=a[i+1],a[i])
    i+=1}
    b<<a.dup
    r
}
  x=y=0
  puts m==(s=a[g-1])?0:l.find{|r|r=[?0]+r
  x+=1
  y=(1..n-1).find{|j|r[j-1,3].all?{|k|k<?1}&&b[x-1][j-1,2]-[m,s]==[]}}?"#{x} #{y}":1
end

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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

struct Card {
    char suit;
    int value;
};

void print(const vector<Card>& a) {
    int n = a.size();
    rep(i, 0, n) {
        cout << a[i].suit << a[i].value;
        if (i != n - 1) { cout << " "; }
        else { cout << endl; }
    }
}

vector<Card> bubble_sort(const vector<Card>& a) {
    int n = a.size();

    vector<Card> b(n);
    rep(i, 0, n) { b[i] = a[i]; }

    rep(i, 0, n) {
        rrep(j, i + 1, n) {
            if (b[j - 1].value > b[j].value) { swap(b[j - 1], b[j]); }
        }
    }
    return b;
}

vector<Card> selection_sort(const vector<Card>& a) {
    int n = a.size();

    vector<Card> b(n);
    rep(i, 0, n) { b[i] = a[i]; }

    rep(i, 0, n) {
        int minj = i;
        rep(j, i + 1, n) {
            if (b[minj].value > b[j].value) { minj = j; }
        }
        swap(b[i], b[minj]);
    }
    return b;
}

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

    vector<Card> a(n);
    rep(i, 0, n) {
        cin >> a[i].suit >> a[i].value;
    }

    vector<Card> bubble = bubble_sort(a);
    vector<Card> selection = selection_sort(a);

    bool stable = true;
    rep(i, 0, n) { if (bubble[i].suit != selection[i].suit) { stable = false; }}

    print(bubble);
    cout << "Stable" << endl;
    print(selection);
    cout << (stable ? "Stable" : "Not stable") << endl;

    return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
#define rad2deg(a) ((a)/M_PI * 180.0)
#define deg2rad(a) ((a)/180.0 * M_PI)
const std::string yes = "Yes";
const std::string no  = "No";


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 (a>b) { a=b; return 1; } return 0; }

int main(){
    int n;
    std::cin >> n;
    std::vector<int> l(n,0);
    rep(i,n){
        std::cin >> l[i];
    }

    int ans = 0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            for(int k=j+1; k<n; k++){
                if(l[i]+l[j]>l[k]&&l[j]+l[k]>l[i]&&l[i]+l[k]>l[j]){
                    if(l[i]!=l[j]&&l[i]!=l[k]&&l[j]!=l[k]){
                        ans++;
                    }
                }
            }
        }
    }
    std::cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

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

const int MAXN=100005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	if(a==0) cout<<1;
	else if(b==0) cout<<2;
	else if (c==0) cout<<3;
	else if (d==0) cout<<4;
	else cout<<5;
}


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

int main(){
  int64_t k,a,b,ans=0;
  cin >> k >> a >> b;
  if(b-a>2){
    k-=a-1;
    ans=k/2*(b-a);
    ans+=k%2+a;
  }else{
    ans=k+1;
  }
  cout << ans << endl;
  return 0;
}

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

long long n,a,m,k,q,b,c=1;
float qq,ww,ff=2,qs;
string ss,s1,s2;
int main(){
    cin>>a>>b;
    if (b>a){
        c=b;
        b=a;
        a=c;
    }
    cout<<a+max(a-1,b);
}


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

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

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

int main() {

    int N;
    std::cin >> N;

    vector<int> A(N);
    ll A_sum    = 0;
    ll even_sum = 0;
    REP(i, N) {
        std::cin >> A[i];
        A_sum += A[i];
        if((i + 1) % 2 == 0) {
            even_sum += A[i];
        }
    }

    vector<int> ans(N, 0);
    ans[0] = A_sum - 2 * even_sum;

    std::cout << ans[0] << " ";

    for(int i = 1; i < N; i++) {
        ans[i] = 2 * A[i - 1] - ans[i - 1];
        std::cout << ans[i] << ((i == N - 1) ? "\n" : " ");
    }

    return 0;
}


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



db s;
int n;
pair < db, db > a[N];

db dist (int i, int j) {
	return sqrt((a[i].f - a[j].f) * (a[i].f - a[j].f) + (a[i].s - a[j].s) * (a[i].s - a[j].s));
}


main () {
	cin >> n;
	forn (i, 1, n)
		cin >> a[i].f >> a[i].s;

	sort(a + 1, a + 1 + n);
	do {
		forn (i, 2, n)
			s += dist(i, i - 1);			
	} while (next_permutation(a + 1, a + 1 + n));

	forn (i, 1, n)
		s /= i;

	cout << fixed << setprecision(12) << s << endl;;		
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	if(n==25)
		cout<<"Christmas"<<endl;
	else if(n==24)
		cout<<"Christmas Eve"<<endl;
	else if(n==23)
		cout<<"Christmas Eve Eve"<<endl;
	else if(n==22)
		cout<<"Christmas Eve Eve Eve"<<endl;
	return 0;
} 

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

using namespace std;

#define ll				long long
#define pb				push_back
#define w(x)			int x; cin>>x; while(x--)
#define mp      		make_pair
#define mod     		1000000007
#define inf     		1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define endl	  		"\n"
#define sp 				" "
#define ca(x) 			"Case "<<x<<": "
#define all(x) 			x.begin(), x.end()
#define loop(i,a,n)		for (int i = a; i < (n); ++i)
#define rloop(i,a,n)	for (int i = n; i >= (a); --i)
#define in(n)			long long n ; scanf("%lli",&n);
#define yes				cout << "YES"<<endl
#define no				cout << "NO"<<endl



int main()
{
	string s; cin >> s;
	int c = 0, ans = 0;
	for (int i = 0; i < 3; ++i)
	{

		if (s[i] == 'R')
			c++;
		else
			c = 0;
		ans = max(c, ans);
	}
	cout << ans;
	return 0;
}



Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = LLONG_MAX;
const ll MOD = 1e9 + 7;

int main()
{
    int H, W, K;
    cin >> H >> W >> K;
    vector<vector<int>> dp(H + 1, vector<int>(W));
    dp[0][0] = 1; // 初期状態
    rep(row, H)
    {
        rep(column, W)
        {
            for (int bit1 = 0; bit1 < 1 << (W - 1); ++bit1) {
                // 2 つの横線がつながっていないか調べる
                // bit1は選ぶ横棒の位置
                // bit2は選べる横棒の位置のうち,隣合うbitの列
                // それぞれW-1の横棒の入れる場所,それぞれ入れるか入れないかで2^{W-1}の選び方がある
                bool isSeqential = false; // 隣合う横棒があるかどうか
                for (int bit2 = 0; bit2 < W - 2; ++bit2) {
                    // 立ったbitが隣り合っているならfalse
                    if ((bit1 & (1 << bit2)) && (bit1 & (1 << (bit2 + 1)))) {
                        isSeqential = true;
                    }
                }
                if (!isSeqential) {
                    if (column >= 1 && (bit1 & (1 << (column - 1)))) {
                        // 左方向に横線をたどるケース
                        dp[row + 1][column - 1] += dp[row][column];
                        dp[row + 1][column - 1] %= MOD;
                    } else if (column <= W - 2 && (bit1 & (1 << column))) {
                        // 右方向に横線をたどるケース
                        dp[row + 1][column + 1] += dp[row][column];
                        dp[row + 1][column + 1] %= MOD;
                    } else {
                        // 横線をたどらないケース
                        dp[row + 1][column] += dp[row][column];
                        dp[row + 1][column] %= MOD;
                    }
                }
            }
        }
    }
    cout << dp[H][K - 1] << endl;
    return 0;
}


Measured memory_bytes: 256
// g++ -I ~/Documents/programming/cppLib -std=gnu++14 -o test ~/Documents/programming/cppLib/test.cpp && ./test && rm test
#include <bits/stdc++.h>
using namespace std;
template <typename T> using vector2 = vector <vector  <T>>;
template <typename T> using vector3 = vector <vector2 <T>>;
template <typename T> using vector4 = vector <vector3 <T>>;
using lint = long long;
#define FOR( i, a, b ) for( lint i=(a) ; i <= (b) ; ++i )
#define REP( i, n )    for( lint i= 0  ; i <  (n) ; ++i )
#define ALL( v )       (v).begin(), (v).end()
#define MOD            1000000007

int main() {
    vector<int> PQR(3);
    cin >> PQR[0] >> PQR[1] >> PQR[2];
    sort( ALL(PQR) );
    cout << PQR[0] + PQR[1] << endl;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

ll gcd(ll x, ll y){
    if(y == 0) return x;
    return gcd(y, x % y);
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i] /= 2;
    }

    ll lcm = 1;
    for (int i = 0; i < n; ++i) {
        lcm = lcm / gcd(lcm, a[i]) * a[i];
        if (lcm > m){
            cout << 0 << endl;
            return 0;
        }
    }

    for (int i = 0; i < n; ++i) {
        if ((lcm / a[i]) % 2 == 0){
            cout << 0 << endl;
            return 0;
        }
    }

    cout << (m / lcm + 1) / 2 << endl;
}

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

#define pb push_back
#define mp make_pair
#define ft first
#define sc second
#define ull unsigned long long int
#define lli long long int
#define li long int

#define si(n) scanf("%d",&n)
#define sl(n) scanf("%ld",&n)
#define sll(n) scanf("%lld",&n)

#define pi(n) printf("%d",n)
#define pl(n) printf("%ld",n)
#define pll(n) printf("%lld",n)

using namespace std;

const int MAX=1e5+5;

int main() {
    // freopen("a.in","r",stdin);
    // freopen("a.out","w",stdout);
    int N; cin >> N;
    lli ans = 0;
    for(int i=0; i<N; i++) {
        lli tmp; cin >> tmp; ans += (tmp-1);
    }
    cout << ans << "\n";

    return 0;
}


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

int main(){
  int N,i,num=0;
  string s = "Yes";
  cin >> N;
  vector<int> H(N);

  for(i=0;i<N;i++)
  cin >> H.at(i);

  for(i=0;i<N;i++){
    if(N==1)
    break;
    else{
      if(i==0)
      continue;
      else{
        if(H.at(i)>=H.at(i-1)&&num<=H.at(i))
        continue;
        else if(H.at(i)<H.at(i-1)){
          if(H.at(i)>=H.at(i-1)-1&&num<=H.at(i)){
            H.at(i-1)--;
            num = H.at(i-1);
            continue;
          }
          else{
            s = "No";
            break;
          }
        }    
      }
    }  
  }
  cout << s << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;

#define FOR(i,n) for(ll i=0;i<n;i++)

struct edge{ll to,cost;};

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0); 
   int N;
   cin >> N;
   ull ans=0;
   ull a;
   FOR(i,N){
      cin >> a;
      if(a&1)continue;
      while(true){
         if(a%2==0){
            a/=2;
            ans++;
         }
         else break;
      }
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 1005, mod = 1e9+7;

ll n, cnt[N], a = 1;

int main()
{
	scanf("%d",&n);
	for(ll i=1;i<=n;i++) {
		ll T = i;
		for(ll j=2;j<=i;j++) {
			while(T%j==0) {cnt[j]++; T /= j;}
		}
	}
	for(ll j=2;j<=n;j++) {
		a = (a * (cnt[j] + 1)) % mod;
	}
	printf("%lld\n",a);
}


Measured memory_bytes: 256
n,q=map(int,input().split())
s=input()
a=[0,0]
for l in range(1,n):
    if s[l-1]=='A' and s[l]=='C':
        a.append(a[l]+1)
    else :
        a.append(a[l])
for k in range(q):
    x,y=map(int,input().split())
    print(a[y]-a[x])

Measured memory_bytes: 11448
import numpy as np
from numba import njit
  
# @njit
# @njit(cache = True)
@njit('(i4[::1],)', cache=True)
def solve(A):
    count = np.zeros(10**6 + 10, np.int32)
    for x in A:
        if count[x] > 1:
            continue
        count[::x] += 1
    ret = 0
    for x in A:
        ret += count[x] == 1
    return ret

N = int(input())
A = np.array(list(map(int,input().split())), np.int32)
 
print(solve(A))


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

using namespace std;
vector<int>dsu;

bool isPrime(int a){
    if(a<= 1) return false;
    if(a == 2) return true;
    if(a%2 == 0) return false;
    for(int i = 3; i*i <= a; i+=2)
        if(a%i == 0) return false;
    return true;
}

int main(){
    int n;
    cin >> n;
    for(int i = 31; i <= 55555; i+=30){
        if(isPrime(i)){
             cout << i << " ";
             n--;
             if(n == 0) break;
        }
    }
    cout << endl;
}
    

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

using namespace std;
bool ok;

int analysis(string s){
	bool isNum=true;
	for(int i=0;i<s.size();i++)if(!(s[i]>='0'&&s[i]<='9'))isNum=false;
	if(isNum){
		int tmp=atoi(s.c_str());
		if(tmp<0||tmp>=10000)ok=false;
		return tmp;
	}
	for(int i=s.size()-1;i>=0;i--){
		if(s[i]=='-'){
			int tmp=analysis(s.substr(0,i))-analysis(s.substr(i+1));
			if(tmp<0||tmp>=10000)ok=false;
			return tmp;
		}
		else if(s[i]=='+'){
			int tmp=analysis(s.substr(0,i))+analysis(s.substr(i+1));
			if(tmp<0||tmp>=10000)ok=false;
			return tmp;
		}
		else if(s[i]=='*'){
			int tmp=analysis(s.substr(0,i))*analysis(s.substr(i+1));
			if(tmp<0||tmp>=10000)ok=false;
			return tmp;
		}
	}
//	for(int i=0;i<s.size();i++){
//		if(s[i]=='*'){
//			int tmp=analysis(s.substr(0,i))*analysis(s.substr(i+1));
//			if(tmp<0||tmp>=10000)ok=false;
//			return tmp;
//		}
//	}

	return 0;
}

int main(){
	string str;
	while(cin>>str){
		ok=true;
		str=str.substr(0,str.size()-1);
		int res=analysis(str);
		if(!ok)cout<<"E"<<endl;
		else cout<<res<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    // AtCoder
    // template
    ll n, m;
    cin >> n >> m;
    vector<ll> x(m), y(m);
    rep(i, m) cin >> x.at(i) >> y.at(i);
    vector<ll> num(n, 1);
    vector<bool> red(n, false);
    red.at(0) = true;

    rep(i, m) {
        if(red[x[i] - 1])
            red[y[i] - 1] = true;

        num[x[i] - 1]--;
        num[y[i] - 1]++;

        if(num[x[i] - 1] == 0)
            red[x[i] - 1] = false;
    }

    ll ans = 0;
    rep(i, n) if(red[i]) ans++;
    cout << ans;
}

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

int main(){
    string w[] = {"Sunny", "Cloudy", "Rainy"};
    string s;
    cin>> s;

    int idx;
    for (int i = 0; i< 3; i++ ){
        if(s.compare(w[i]) == 0){
            idx = i;
            break;
        }
    }
    cout << w[(idx+1)%3] << endl;
    return 0;
}

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

# map(int, input().split())
N, Q = map(int, input().split())
events = []
for i in range(N):
    s, t, x = map(int, input().split())
    events.append((s - x, 0, x))
    events.append((t - x, 1, x))

for i in range(Q):
    d = int(input())
    events.append((d, 2, i))

events = sorted(events)
INF = 10**13
q = [INF]
cnt = defaultdict(int)
ans = [INF]*Q
for a,b,c in events:
    if b == 0:
        heappush(q,c)
        cnt[c] += 1
    elif b==1:
        cnt[c] -= 1
    else:
        while len(q) > 1 and cnt[q[0]] == 0:
            heappop(q)
        if q[0] == INF:
            ans[c] = -1
        else:
            ans[c] = q[0]
for a in ans:
    print(a)


Measured memory_bytes: 183404
k=int(input())
a=[0,0,0,0,0,0,0,0,0,0]
keta=1
for i in range(k):
  unta=-1
  a[0]+=1
  for j in range(keta):
    if (j+1<keta and a[j]>a[j+1]+1) or a[j]>=10:
      a[j+1]+=1
      unta=j
  if unta>-1:
    if unta==keta-1:
      keta+=1
    for j in range(unta+1):
      a[unta-j]=max(a[unta-j+1]-1,0)

ans=0
for i in range(10):
  ans+=a[i]*(10**i)
print(str(ans))

Measured memory_bytes: 3064
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
A = list(map(int,input().split()))
A.sort(reverse = True)
for i in range(n):
  ans += A[i*2 + 1]
print(ans)

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

typedef long long ll; 

int main(){
  ll n,h; cin >> n >> h;
  vector<ll> a(n),b(n);
  for(int i=0;i<n;i++) cin >> a[i] >> b[i];
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  ll m = a[n-1];
  ll sum = 0,t=0;
  for(int i=0;i < n && b[n-i-1] > m && sum < h; i++){t++;sum = sum + b[n-i-1];}
  if(sum < h) t += (h - sum) / m  + ((h-sum)%m == 0 ? 0 : 1);
  cout << t << endl;
  return 0;
}
  

  


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

# define F first
# define S second
# define mp make_pair
# define pii pair<int,int>

# define long long long
# define pb push_back
# define sz(a) (int)(a.size())

# define y1     tipa_y1
# define left   tipa_left
# define right  tipa_right

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const long MXLL = 4611686018427387903;
const int Sz = 1110111;

using namespace std;

inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0);
}
int a, b, c;

int main()
{
  Read_rap ();
  cin >> a >> b >> c;

  if (c - b == b - a)
    cout << "YES";
  else
    cout << "NO";



  return 0;
}









// Coded by Z...


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int res = 0;
		for(int i = 1; i <= n; i++){
			if((int)(Math.log10(i))%2 == 0) res++;
		}
		System.out.println(res);
	}

}


Measured memory_bytes: 22868
import copy


class Card:
    def __init__(self, mark, number):
        self.mark = mark
        self.number = number

    def __repr__(self):
        return self.mark + str(self.number)


def bubble_sort(C, N):
    for i in range(N):
        for j in range(i + 1, N)[::-1]:
            if C[j-1].number > C[j].number:
                C[j-1], C[j] = C[j], C[j-1]


def selection_sort(C, N):
    for i in range(N):
        minj = i
        for j in range(i, N):
            if C[j].number < C[minj].number:
                minj = j
        C[i], C[minj] = C[minj], C[i]


if __name__ == "__main__":
    N = int(input())
    C_raw = list(input().split())
    C = []
    for i in range(N):
        c = Card(C_raw[i][0], int(C_raw[i][1]))
        C.append(c)

    C_for_bubble = copy.copy(C)
    bubble_sort(C_for_bubble, N)
    print(' '.join(map(str, C_for_bubble)))
    print('Stable')

    C_for_selection = copy.copy(C)
    selection_sort(C_for_selection, N)
    print(' '.join(map(str, C_for_selection)))
    if C_for_bubble == C_for_selection:
        print('Stable')
    else:
        print('Not stable')



Measured memory_bytes: 6344
// problem: "https://atcoder.jp/contests/abc157/tasks/abc157_a"

#include<bits/stdc++.h>

using namespace std;

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

    if(n%2)
        cout<<n/2+1;
    else
        cout<<n/2;

        
    return 0;
}


Measured memory_bytes: 256
//0023 Circles Intersection
//2Ì~ÌSÆ¼aª^¦çê½Æ«A»Ì2ÂÌ~ªðíÁÄ¢é©Aàï³êÄ¢é©AðíçÈ¢©ð»è¹æ
//È¨AAÆBª®SÉ¯êÌ~Å é±ÆÍÈ¢

//³Ä³ÄA0,0,1,0,2,1Ý½¢ÉêdÈéªÉÂ¢ÄÍÈÉà¾y³êÄ¢È¢Ì¾ª


#include<iostream>
#include<cmath>
using namespace std;

double Square(double x){return x*x;}
double Distance(double x, double y)
{
	return sqrt(Square(x) + Square(y) );
}

int main(void)
{
	int n;
	cin >> n;
	while(n--)
	{
		double ax, bx, ay, by, ar, br;
		cin >> ax >> ay >> ar >> bx >> by >> br;

		//Ql@http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1251422802

		//à~ÌSðciA¼aðriAO~ÌSðcoA¼aðroÆ·éÆ
		//|ci-co|<=ro-ri@ÈçA®SÉàï·éEEEçµ¢
		double distance = Distance(ax-bx, ay-by);
		if(distance < br - ar)	//BªAðàï
			cout << -2 << endl;
		else if(distance < ar - br)	//AªBðàï
			cout << 2 << endl;
		//|ci-co| <= ar+br ËaÆbÍdÈé
		else if(distance <= ar+br)
			cout << 1 << endl;
		else
			cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

typedef struct{
    int datap;
    int datay;
    int datai=-1;//最初の順
    int dataj=-1;//後の順
}re;
int main(){
    Int n,m;cin >> n >> m;
    vector<pair<int,pair<int,pair<int,int>>>>  data(m);
    vector<int> sum(n+2,0);
    rep(i,m){
        int p,y;cin >> p >> y;
        data[i].first = p;
        sum[p+1]++;
        data[i].second.first = y;
        data[i].second.second.first = i+1;//後のp
        data[i].second.second.second = -1;
    }
    rep(i,n+2){
        sum[i+1] += sum[i];
    }
    //for(auto &i:sum) cout << " " << i;
    //cout << endl;
    sort(data.begin(),data.end());
    rep(i,m){
        data[i].second.second.second = i+1;
        int tmp = data[i].first;
        data[i].first = data[i].second.second.first;
        data[i].second.second.first = tmp;
    }
    sort(data.begin(),data.end());
    rep(i,m){
        printf("%06d%06d\n",data[i].second.second.first , data[i].second.second.second-sum[data[i].second.second.first]);
    }
    return 0;

    
}

Measured memory_bytes: 3456
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int n;

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

map<int, int> prime_factor(int n) {
  map<int, int> res;
  for(int i=2; i*i<=n; i++) {
    while(n % i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if(n != 1) ++res[n];
  return res;
}

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

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

  int t = a[0];
  REP(i, n) t = gcd(a[i], t);
  bool f2 = ((t == 1) ? true : false);

  vector<bool> used(1000005, false);

  bool f1 = true;
  RREP(i, n) {
    auto mp = prime_factor(a[i]);
    for(auto u : mp) {
      if(used[u.first]) {
        f1 = false;
        break;
      } else {
        used[u.first] = true;
      }
    }
  }

  if(f1) cout << "pairwise coprime" << endl;
  else if(f2) cout << "setwise coprime" << endl;
  else cout << "not coprime" << endl;
}


Measured memory_bytes: 7272
#include <iostream>

using namespace std;

typedef long long ll;

ll N, L, x, y, n;

int main() {
  cin >> N >> L >> x;
  bool ans = false;
  for (int i = 0; i < N-1; i++) {
    cin >> y;
    if (x+y >= L) {
      ans = true;
      n = i+1;
    }
    x = y;
  }

  cout << (ans?"Possible":"Impossible") << endl;
  if (ans) {
    for (int i = 1; i < n; i++) cout << i << endl;
    for (int i = N-1; i >= n; i--) cout << i << endl;
  }
  return 0;
}

Measured memory_bytes: 768
//## MohK
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    cin>>x;
    int a[x];
    double ans=0;
    for(int i=0;i<x;i++)
    {
        cin>>a[i];
        ans=ans+(1.0/a[i]);
    }
    cout<<1.0/ans;


    return 0;
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
class Solve{
    int N;
    int[] A;
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Read();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        Que Q;
        int sum = 0;
        for(int i=2;i<N-1;i++){
            sum += A[i];
        }
        {
            int[] d = new int[sum];
            for(int i=0;i<sum;i++){
                d[i] = i;
            }
            Q = new Que(d);
        }
        for(int i=2;i<N-1;i++){
            if(A[i]*2+1 > sum){
                int[] d = new int[sum];
                for(int j=0;j<A[i];j++){
                    d[j] = Q.Get(A[i]-j);
                }
                for(int j=A[i];j<sum;j++){
                    d[j] = Q.Get(j-A[i]);
                }
                if(A[i] == sum && A[i] != 0){
                    d[0] = sum;
                }
                Q = new Que(d);
            }
            else{
                for(int j=0;j<A[i];j++){
                    Q.Put(Q.Get(2*j+1));
                }
            }
        }
        int M = int.Parse(Console.ReadLine());
        for(int i=0;i<M;i++){
            long j = Int64.Parse(Console.ReadLine());
            if(j >= sum){
                long ans = j - sum + A[0] - A[1];
                sb.Append(ans+"\n");
            }
            else{
                long ans = Q.Get((int)(j)) + A[0] - A[1];
                sb.Append(ans+"\n");
            }
        }
    }
    void Read(){
        N = int.Parse(Console.ReadLine());
        A = new int[N-1];
        string[] str = Console.ReadLine().Split(' ');
        for(int i=0;i<N-1;i++){
            A[i] = int.Parse(str[i]);
        }
    }    
}
class Que{
    public int[] array;
    int pointer;
    int length;
    public Que(int[] a){
        array = a;
        pointer = 0;
        length = a.Length;
    }
    public Que(int n){
        array = new int[n];
        pointer = n;
        length = n;
    }
    public void Put(int a){
        if(pointer == 0){
            pointer = length-1;
        }
        else{
            pointer--;
        }
        array[pointer] = a;
    }
    public int Get(int n){
        if(pointer + n >= length){
            return array[pointer + n - length];
        }
        else{
            return array[pointer + n];
        }
    }
}

Measured memory_bytes: 26404
#include<iostream>
using namespace std;
int a[500][500];
int ans[100000];
int main(){
    int n,m,q;
    cin>>n>>m>>q;
    for (int i = 0; i < m; ++i) {
        int l,r;
	cin>>l>>r;
	for (int i = 0; i < l; ++i) {
	    for (int j = r-1; j < n; ++j) {
	        a[i][j]++;
	    }
	}
    }
    for (int i = 0; i < q; ++i) {
        int x,y;
	cin>>x>>y;
	ans[i]=a[x-1][y-1];
    }
    for (int i = 0; i < q; ++i) {
        cout<<ans[i]<<endl;
    }
}


Measured memory_bytes: 2304
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stdio.h>
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define inf 1001001001000
using namespace std;
int main(void){
    ll n,l;
    cin>>n>>l;
    vector<ll> a(n);
    ll sum = 0;
    ll mini = inf;
    rep(i,n){
        a[i] = l+i;
        sum += a[i];
        if(abs(mini)>abs(a[i])){
            mini = a[i];
        }
    }
    cout<<sum-mini<<endl;
    
}

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

int main(){
  int i,j,cnt=0;
  int a,b;
  cin>>a>>b;
  if(a<=0 && 0<=b)cout<<"Zero"<<endl;
  else if(a>0)cout<<"Positive"<<endl;
  else{
    if((b-a)%2==1)cout<<"Positive"<<endl;
    else cout<<"Negative"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define all(x) (x).begin() , (x).end()
#define f first
#define s second
#define pr(x) cout<<x<<endl;
#define pr2(x,y) cout<<x<<" "<<y<<endl;
#define pr3(x,y,z) cout<<x<<" "<<y<<endl;
#define prv(v) for(auto x:v) cout<<x<<" ";
#define ffs fflush(stdout);
using namespace std;
 
const ll N =(2e5+5);
const ll MOD = 1e9;
const ll INF = LLONG_MAX;
const ll LOG = 29;
#define PI 3.141592653589793238 
  
double circumference(double r) 
{ 
    double cir = 2.0;
    cir*=PI;
    cir*=r; 
    return cir; 
} 
long long binpow(long long a, long long b) {
    a%=MOD;    
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%MOD;
        a = (a * a)%MOD;
 
        
        b >>= 1;
    }
    res%=MOD;
    return res;
} 
vll adj[N];
ll sub[N];
bool vis[N];
void dfs(ll u){
    vis[u]=true;
    sub[u]=1;
    for(auto v:adj[u]){
        if(!vis[v]){
            dfs(v);
            sub[u]+=sub[v];
        }
    }
}
void solve(){
    ll n;
    cin>>n;
    ll a[n+1];
    for(int i = 2;i<=n;i++){
        cin>>a[i];
        adj[a[i]].pb(i);
    }
    for(int i =1;i<=n;i++){
        cout<<adj[i].size()*1ll<<endl;
    }

}
 
 
int main(){
    ios_base::sync_with_stdio(0);
     cin.tie(NULL);
     
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }
     
 
 
    return 0;     
    
        
}//42364286 418930126

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

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) (a).begin(),(a).end()

int gcd(int x,int y)
{
    int r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

int main(){
    int a,b;
    cin >> a >> b;
    cout << gcd(a, b) << endl;
    return 0;
}


Measured memory_bytes: 3096
num_list = list(map(int, input().split())) 
if num_list[0]>=num_list[3]:
    print(num_list[3])
    exit()
num=num_list[3]-num_list[0]
sum=num_list[0]

if num_list[1]>=num:
    print(sum)
    exit()
num=num-num_list[1]
sum=sum-num
print(sum)

Measured memory_bytes: 9192
#include <stdio.h>
int main()
{
	int a[30]={0},b;
	for(int i=0;i<28;i++){
		scanf("%d",&b);
		a[b-1]=1;
	}
	for(int i=0;i<30;i++){
		if(a[i]==0)
			printf("%d\n",i+1);
	}
	return 0;
}

Measured memory_bytes: 1024
ans=0
count=0
s=input()
if s[0]=="A":
        ans+=1
cut=s[2:-1]
if cut.count("C")==1:
        ans+=1
cap=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
for i in range(len(s)):
        if s[i] in cap:
                count+=1
if count==2:
        ans+=1
if ans==3:
        print("AC")
else:
        print("WA")

Measured memory_bytes: 3064
#include <stdio.h>

int main() {
  for(;;) {
    int hands[5];
    int ex[3];
    int i;
    for(i = 0; i < 3; ++i) ex[i] = 0;
    for(i = 0; i < 5; ++i) {
      scanf("%d", &hands[i]);
      if(hands[i] == 0) return 0;
      --hands[i];
      ex[hands[i]] = 1;
    }
    if(ex[0] + ex[1] + ex[2] == 2) {
      int nex = 3 - ex[0] - ex[1] * 2;
      for(i = 0; i < 5; ++i) printf("%d\n", hands[i] == nex ? 1 : 2);
    } else {
      for(i = 0; i < 5; ++i) printf("%d\n", 3);
    }
  }
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a,b,c;cin>>a>>b>>c;
  cout << max({a,b,c})*10+min({a,b,c})+(a+b+c)-(max({a,b,c})+min({a,b,c})) << endl;
}

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

int main()
{
	int a, b, c;
	int tmp;

	scanf("%d%d%d", &a, &b, &c);
	if (a > b) tmp = a, a = b, b = tmp;
	if (b > c) {
		tmp = b, b = c, c = tmp;
		if (a > b) tmp = a, a = b, b = tmp;
	}
	printf("%d %d %d\n", a, b, c);
	return 0;
}


Measured memory_bytes: 2096