akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;

const int MAX_DIG = 42;
int max_id = 0;
ll A, B;
vl CA, CB;

void dig_cnt_check(ll x, vl& D) {
	int p = 0;
	ll y = x;
	ll cycle = (ll)2;
	while (y > 0) {
		ll a = (x + 1) / cycle;
		ll b = (x + 1) - (a * cycle);
		ll c = (ll)0;
		if (b > cycle / 2)
			c = b - cycle / 2;
		ll cnt = a * cycle / 2 + c;
		D[p] = cnt;
		++p;
		y >>= 1;
		cycle <<= 1;
	}
	max_id = p - 1;
}

ll solve(void) {
	ll ret = (ll)0;
	CA.resize(MAX_DIG, (ll)0);
	CB.resize(MAX_DIG, (ll)0);
	dig_cnt_check(A - 1, CA);
	dig_cnt_check(B, CB);
	for (int i = 0; i <= max_id; ++i) {
		ll cnt = CB[i] - CA[i];
		if (cnt % (ll)2 == (ll)1)
			ret += ((ll)1 << i);
	}
	return ret;
}

int main(void) {
	cin >> A >> B;

	ll ans = solve();

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <deque>
using namespace std;
int main(){

  int q;
  deque <int> a;
  cin>>q;

  for(int i=0;i<q;i++){
    int n,d;
    cin>>n>>d;
    if(!n){
      int x;
      cin>>x;
      if(d) a.push_back(x);
      else a.push_front(x);
    }
    else if(n==1){
      cout<<a[d]<<endl;
    }
    else {
      if(d) a.pop_back();
      else a.pop_front();
    }
  }

  return 0;

}



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

int main() {
	int n;
	string s;
	cin >> n;
	cin >> s;
	bool ans = true;
	if (n%2) ans = false;
	else {
		rep(i,n/2) if (s[i]!=s[i+n/2]) ans = false;
	}
	if (ans) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        var x = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine(Array.IndexOf(x, 0) + 1);
    }
}


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

int main(void) {
	int p, q, r;
	cin >> p >> q >> r;
	int m = max(p, max(q, r));
	cout << p + q + r - m << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PB push_back
#define LL long long
const int mod = 1000 * 1000 * 1000 + 7;
using namespace std;

int x[200005];
int y[200005];
LL xPref[200005] , yPref[200005];
LL sumX(int l , int r)
{
	return xPref[r] - (l ? xPref[l - 1] : 0);
}
LL sumY(int l , int r)
{
	return yPref[r] - (l ? yPref[l - 1] : 0);
}
int main()
{
	ios_base::sync_with_stdio(0);
	int n , l;
	cin >> l >> n;
	for(int  i = 0; i < n; i++)
	{
		cin >> x[i];
		y[i] = l - x[i];
	}
	for(int i = 0; i < n; i++)
	{
		xPref[i] = x[i] + (i ? xPref[i - 1] : 0);
		yPref[i] = y[i] + (i ? yPref[i - 1] : 0);
	}
	LL ans = max(x[n - 1], (l - x[0]));
	for(int zliva = 0; zliva < n - 1; zliva++)
	{	
		LL ans2 = 0;
		int ptr1 = n - 1 , ptr2 = zliva;

		int ptrMid = (ptr1 + ptr2 + 1) / 2;
		ans2 += sumX(ptr2 , ptrMid - 1) * 2;
		ans2 += sumY(ptrMid + 1 , ptr1) * 2;
		if((ptr1 + ptr2 + 1) % 2 == 0)
		{
			ans2 += y[ptrMid];
		}
		else
			ans2 += x[ptrMid];
		ans = max(ans , ans2);
	}
	for(int i = 0; i < n ;i++)
	{
		x[i] = l - x[i];
		y[i] = l - y[i];
	}
	reverse(x ,x + n);
	reverse(y , y + n);
	for(int i = 0; i < n; i++)
	{
		xPref[i] = x[i] + (i ? xPref[i - 1] : 0);
		yPref[i] = y[i] + (i ? yPref[i - 1] : 0);
	}
	for(int zliva = 0; zliva < n - 1; zliva++)
	{	
		LL ans2 = 0;
		int ptr1 = n - 1 , ptr2 = zliva;

		int ptrMid = (ptr1 + ptr2 + 1) / 2;
		ans2 += sumX(ptr2 , ptrMid - 1) * 2;
		ans2 += sumY(ptrMid + 1 , ptr1) * 2;
		if((ptr1 + ptr2 + 1) % 2 == 0)
		{
			ans2 += y[ptrMid];
		}
		else
			ans2 += x[ptrMid];
		ans = max(ans , ans2);
	}
	cout << ans;
	
	return 0;
}


Measured memory_bytes: 4992
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

ll Pow(ll A, ll B, ll mod){
  if (B == 0) return 1;
  else{
    if (B % 2 == 0){
      return Pow(A * A % mod, B / 2, mod) % mod;
    }else{
      return A * Pow(A * A % mod, B / 2, mod) % mod;
    }
  }
}

ll nCr(ll N, ll C, ll mod){
  ll ans = 1; C = min(C, N - C);
  for (ll i = 1; i <= C; i++){
    ans *= N - i + 1; ans %= mod;
    ans *= Pow(i, mod - 2, mod); ans %= mod;
  }
  return ans;
}

int main(){
  int N, A, B; cin >> N >> A >> B;
  int ans = 0;
  for (int i = 0; i < N; i++){
    int num; cin >> num;
    if (A <= num && num < B){}
    else ans++;
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
// 38DTG
// 23062020
#include<bits/stdc++.h>
using namespace std;
#define bolt ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
typedef long long ll;
typedef long double ld;
const ld pi=3.1415926535897932384626433;
const int mod = 1000000007;
const ll inf=3e18;
int main ()
{
   bolt;
	ll a,b;
  cin>>a>>b;
  cout<<a*b;
}


Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
//#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX;
using namespace std;
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 long long LLINF=1LL<<60;
//set<int>::iterator it;



int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
	
	int i,n,pos,max=0,ans;
	string s;
	set<char> se;
	cin>>n>>s;
	for(pos=0;pos<n;pos++){//pos文字目の後で切る 
		ans=0;
		for(i=0;i<=pos;i++){
			se.insert(s[i]);
		}
		for(i=pos+1;i<n;i++){
			if(se.find(s[i])!=se.end()){
				ans++;
				se.erase(s[i]);
			}
		}
		
		if(ans>max)max=ans;
		se.clear();
	}
	cout<<max<<endl;
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
//////////////////////////////////////////////////////
	return 0;
}


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

using namespace std;

const int MAXN=2e5+1;

int n,a[MAXN];
bool ans=1;

int main() {
	scanf("%d",&n);
	for(int i=1; i<=n; ++i) scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	for(int i=1; i<n; ++i)
		if(a[i]==a[i+1]) {
			puts("NO");
			ans=0;
			break;
		}
	if(ans) puts("YES");
	return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  if(a==b){
    cout << "Draw" << endl;
  }else if(a==1){
    cout << "Alice" << endl;
  }else if(b==1){
    cout << "Bob" << endl;
  }else if(a>b){
    cout << "Alice" << endl;
  }else if(a<b){
    cout << "Bob" << endl;
  }
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
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; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

using Graph = vector<vector<int>>;

ll dfs1(ll now, ll par, Graph &G, vector<ll> &cnt){
	ll res = 0;
	if((int)G[now].size()>2) res++;
	for(auto next: G[now]){
		if(next == par) continue;
		res += dfs1(next, now, G, cnt);
	}
	cnt[now] = res;
	return res;
}

ll tot = 0;

void dfs2(ll now, ll par, Graph &G, vector<ll> &cnt){
	ll res = 0;
	for(auto next: G[now]){
		ll val;
		if(next == par){
			val = cnt[0] - cnt[now];
		}else{
			val = cnt[next];
			dfs2(next, now, G, cnt);
		}
		if(val>0) res++;
	}
	tot += max((int)G[now].size() - 1 - res, 0ll);
	return;
}

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

    ll N;
    cin >> N;

    Graph G(N);
    REP(i, N-1){
	    ll a, b;
	    cin >> a >> b;
	    G[a].push_back(b);
	    G[b].push_back(a);
	}

	vector<ll> cnt(N, 0);
	dfs1(0, -1, G, cnt);

	//cerr << cnt << endl;
	bool ok = false;
	REP(i, N) if((int)G[i].size()>2) ok = true;
	if(!ok){
		cout << 1 << endl;
		return 0;
	}

	dfs2(0, -1, G, cnt);

	cout << tot << endl;
    return 0;
}

Measured memory_bytes: 14208
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>
using namespace std;
#define INF 1<<20


struct edge{
	int to;
	int cost;
	edge() {};
	edge(int a, int b) {
		to = a;
		cost = b;
	}
};

struct Node {
	int pos;
	int cost;
	Node() {};
	Node(int a, int b) {
		pos = a;
		cost = b;
	}
	bool operator <(const Node& rhs) const {
		return cost > rhs.cost;
	}
};

void dijkistra(int st, int TO,int V,vector<vector<edge> > graph) {
	priority_queue<Node> q;
	vector<int> d(V);
	for (int i = 0;i < V;i++) {
		d[i] = INF;
	}
	d[st] = 0;
	q.push(Node(st, 0));
	while (!q.empty()) {
		Node s = q.top(); q.pop();
		int pos = s.pos;
for (int i = 0;i < graph[pos].size();i++) {
	int to = graph[pos][i].to;
	int cost = graph[pos][i].cost;
	if (d[pos] + cost < d[to]) {
		d[to] = d[pos] + cost;
		q.push(Node(to, d[to]));
	}

}
	}
	cout << d[TO] << endl;
}
int partition(int A[], int p, int r) {
	int x = A[r];
	int i = p - 1;
	for (int j = p;j < r;j++) {
		if (x >= A[j]) {
			i = i + 1;
			swap(A[i], A[j]);
		}
	}
	swap(A[i + 1], A[r]);
	return i + 1;
}
void quicksort(int A[], int p, int r) {
	if (p < r) {
		int q = partition(A, p, r);
		quicksort(A, p, q - 1);
		quicksort(A, q + 1, r);
	}
}

int getNumberOfCoin(int C[], int n, int m) {
	int T[50000];
	for (int j = 0;j <= n;j++) {
		T[j] = INF;
	}
	T[0] = 0;
	for (int i = 0;i < m;i++) {
		for (int j = 0;j <= n;j++) {
			if (j - C[i] >= 0) {
				T[j] = min(T[j], T[j - C[i]] + 1);
			}
		}
	}
	return T[n];
}
int knapsack(int w, int n, int* v, int* ww) {
	int W[101][10001];
	for (int j = 0;j <= w;j++) {
		W[0][j] = 0;
	}
	for (int i = 0;i < n;i++) {
		for (int k = 0;k < n;k++) {
			for (int j = 0;j <= w;j++) {
				if (j - ww[k] < 0) {
					W[i + 1][j] = W[i][j];
				}
				if (j - ww[i] >= 0) {
					W[i + 1][j] = max(W[i][j], W[i][j - ww[k]] + v[k]);

				}
			}
		}
	}
	return W[n][w];
}
int fib(int n) {
	vector<int> v(n + 1);
	v[0] = 1;
	v[1] = 1;
	for (int i = 2;i < n + 1;i++) {
		v[i] = v[i - 2] + v[i - 1];
	}
	return v[n];
}
int isPrime(int x) {
	if (x <= 1) return false;
	if (x > 2 && x % 2 == 0) return false;
	for (int i = 2;i <= sqrt(x);i++) {
		if (x%i == 0) {
			return false;
		}
	}
	if (x == 2) return true;
	return true;
}
int gnc(int a, int b) {
	while (b%a != 0) {
		if (a > b) swap(a, b);
		else {
			b = b%a;
		}
	}
	return a;
}
int calc(int a, long long int b, long long int m) {
	if (b == 0) return 1;
	else if (b % 2 == 0) {
		long long int d = calc(a, b / 2, m);
		return (d*d) % m;
	}
	else {
		long long int d = calc(a, b -1, m);
		return (d*a) % m;
	}
}


int main() {
	string S;
	cin >> S;
	for (int i = 0;i < 5;i++) {
		cout << S[i];
	}
	cout << ' ';
	for (int i = 6;i < 13;i++) {
		cout << S[i];
	}
	cout << ' ';
	for (int i = 14;i < 19;i++) {
		cout << S[i];
	}
	cout << endl;
	return 0;
	}




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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

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

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)1e3+11;

void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        
        ll a;
        ld b;
        cin>>a>>b;
        
        ld ans=(ld)(a*b);
        cout<<(ll)ans<<endl;
        
        
      
       
}
int main(){
        FS;
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}

Measured memory_bytes: 3756
#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{
	int n, m;
	int s;
	
	while (1){
		
	vector<int> p = vector<int>();
	vector<int> s2 = vector<int>();
	
	scanf("%d %d", &n, &m);
	
	if (n == 0 && m == 0){
		break;
	}
	
	for (int i = 0; i < n; i++){
		int k;
		scanf("%d", &k);
		p.push_back(k);
	}
	
	p.push_back(0);
	for (int i = 0; i < p.size(); i++){
		for (int j = 0; j < p.size(); j++){
			s2.push_back(p[i] + p[j]);
		}
	}
	
	sort(s2.begin(), s2.end());
	int max = -1;
	for (int i = 0; i < s2.size(); i++){
		vector<int>::iterator it = upper_bound(s2.begin(), s2.end(), m - s2[i]);
		//printf("%d\n", *(it - 1));
		
		if (it != s2.begin() && max < s2[i] + *(it - 1)){
			max = s2[i] + *(it - 1);
		}
	}
	
	printf("%d\n", max);
	
	}
	
	return (0);
}

Measured memory_bytes: 9024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define for1(i,n) for(int i=1;i<=(int)(n);i++)
const int MOD = 1e9 + 7 ;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=4000012;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      int n,l;
      cin>>n>>l;
      vector<int> v;
      int s=0;
      for(int i=1;i<=n;i++)
      {
            v.pb(l+i-1);
            s+=(l+i-1);
      }
      sort(all(v));
      int mn=1e18;
      int ans=-1e18;
      for(int i=1;i<=n;i++)
      {
            if(abs(s-(s-(l+i-1)))<mn)
            {
                  mn=abs(s-(s-(l+i-1)));
                  ans=s-(l+i-1);
            }
      }
      cout<<ans;
}     
// I never lose. I either win or I learn

Measured memory_bytes: 256
n = int(input())

result = 0
word_list = {}

for i in range(n):
    input_word = "".join(sorted(input()))
    flag = 1
    if input_word in word_list:
        word_list[input_word] += 1
        result += word_list[input_word]
        flag = 0
    else:
        word_list[input_word] = 0

print(result)

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

void MAIN() {
  int n; cin >> n;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    int t; cin >> t;
    if (t % 2) cnt++;
  }
  if (cnt % 2) cout << "NO" << '\n';
  else cout << "YES" << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3612
#include<iostream>
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define vi vector<int>
#define lvi vector<long long>
#define pi pair<int,int>
#define lpi pair<long long ,long long>
#define mp make_pair
#define pb push_back
#define ll long long 
#define faltu ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007
#define mod1 1000000000000000007
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>multiordered_set;
ll int pw(ll int a, ll int b,ll md) {
    if (b == 0) return 1;
    ll int t = pw(a, b / 2,md);
    if (b % 2 == 0) return (t * t)%mod;
    else return ((t * t)%mod * a)%mod;
}
vector<int> pm;
void prm(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
              prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p]) pm.push_back(p);
}
bool cmp(const pair<ll int,ll int> &a,const pair<ll int,ll int> &b)
{
    if(a.first==b.first)return a.second<b.second;
    return a.first>b.first;
}
ll int gcd(ll int a,ll int b)
{
    if(!a)return b;
    return gcd(b%a,a);
}
map<int,int>pa;
int find(int i){
    if(pa[i]==i)return i;
    return pa[i]=find(pa[i]);
}     
void join(int i,int j){
    int a=find(i);
    int b=find(j);
    if(b>=a)pa[b]=a;
    else pa[a]=b;
}  
int isp[1000006];
vector<int>prime;
void getprime(int n)
{
    for(int i=2;i<n;i++){
        if(isp[i]==-1)continue;
        for(int j=2*i;j<n;j+=i){
            isp[j]=-1;
        }
        prime.push_back(i);
    }
}             
int ddx[]={-1,-1,-1,0,1,1,1,0};
int ddy[]={-1,0,1,1,1,0,-1,-1};
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int vis[1000005];
int main()
{
    faltu;
    int t=1;
    //cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int a[n+1];
        int g=0,flag=0,mx=0;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            vis[a[i]]++;
            if(!i)g=a[i];
            else g=gcd(g,a[i]);
            mx=max(mx,a[i]);
        }
        getprime(mx+1);
        for(int i:prime)
        {
            int cnt=0;
            cnt+=vis[i];
            for(int j=2*i;j<mx+1;j+=i)cnt+=vis[j];
            if(cnt>1){flag=1;break;}
        }
        if(flag==0)cout<<"pairwise coprime\n";
        else
        {
            if(g!=1)cout<<"not coprime\n";
            else cout<<"setwise coprime\n";
        }
    }
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e6 + 5;

const ll inf = 8e18;

int n;
ll a[maxn];


ll solve(vector<ll> v, ll x) {
    ll res = 0;
    for (auto i: v) {
	res += abs(i-x);
    }
    return res;
}

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

    cin>>n;
    vector<ll> v;
    for (int i=1; i<=n; i++) {
	cin>>a[i];
	v.push_back(a[i]-i);
    }

    sort(v.begin(), v.end());
    ll median = v[n/2];

    ll res = inf;
    res = min(res, solve(v, median));
    if (n/2+1<n) res = min(res, solve(v, v[n/2+1]));
    out(res);

    return 0;
}


Measured memory_bytes: 5104
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(container) container.begin(), container.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
#define YesNo(cond) Cout((cond) ? "Yes" : "No");
using namespace std;
using ll = long long;

int main(void){
    Cin(int, a);
    Cin(int, b);
    Cin(int, c);
    Cin(int, d);
    Cout(min(a*b, c));
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>

using namespace std;

int main() {
	int n, w;
	struct { int v, w; } item[101];
	cin >> n >> w;
	for (int i = 1; i <= n; i++)
		cin >> item[i].v >> item[i].w;
	int dp[101][10001] = {};
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= w; j++)
			if (item[i].w <= j)
				dp[i][j] = max(dp[i-1][j], dp[i-1][j-item[i].w] + item[i].v);
			else
				dp[i][j] = dp[i-1][j];
	cout << dp[n][w] << endl;
	return 0;
}

Measured memory_bytes: 5116
N, A, B, C = map(int, input().split())
l = list(int(input()) for i in range(N))
INF = 10 ** 9

def dfs(cur, a, b, c):
  if cur == N:
    return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur+1, a, b, c)
  ret1 = dfs(cur+1, a+l[cur], b, c) + 10
  ret2 = dfs(cur+1, a, b+l[cur], c) + 10
  ret3 = dfs(cur+1, a, b, c+l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))

Measured memory_bytes: 3192
import java.util.Scanner;

public class Main {
	
	static int GCD(int x, int y)
	{
		int mod;		
		if(x==0 || y==0) // this if branch is used to deal with some inputs with 0s 
		{
			if(x==0 && y==0) return -1;// If both of x and y are 0, return -1 which means there is no greatest common divisor for x and y.
			else if(x==0)  return y;
			else  return x;
		}			
		else if(x>y) // the following is used to deal with inputs without 0s, and there are three cases: x>y, x<y, or x==y 
		{
			mod = x%y; // to use this observation: given x>=y, gcd(x, y) = gcd(y, x%y)
			if(mod==0) return y; // this if is here for the case that one number is the multiple of the other number, e.g. 10, 20, it will return 10
			else return getGCD(y, mod);
		}
		else if(x<y)// the case of x<y
		{
			mod = y%x;
			if(mod==0) return x;
			else return getGCD(x, mod);
		}			
		else return x; // when x==y, the greatest common divisor is either x or y itself
	}
	
	static int getGCD(int num1, int num2) // num1 >= num2
	{
		int divisor=1;
		for(int i=2; i<=num2; i++)
		{
			int mod1 = num1%i;
			int mod2 = num2%i;
			if(mod1==0 && mod2 ==0)
			{
				if(i>divisor)	divisor=i;
			}
		}
		return divisor;
	}

	public static void main(String argv[]) {
        Scanner in = new Scanner(System.in);
        int x = in.nextInt();
        int y = in.nextInt();
        System.out.println(GCD(x,y));
//        System.out.println(gcd_recursive(x,y));
        in.close();
	}
}



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

int main(){
    int N, tmp=0, ans=0, count=0;
    cin >> N;
    vector<int> x(N), y(N), xDif(100000, 0), yDif(100000, 0);

    for(int i=0; i<N; i++){
	cin >> x[i] >> y[i];
    }

    for(int i=0; i<N; i++){
	for(int j=0; j<N; j++){
	    xDif[tmp] = x[i] - x[j];
	    yDif[tmp] = y[i] - y[j];
	    tmp++;
	}	
    }
    
    for(int k=0; k<tmp; k++){
	count = 0;
	for(int i=0; i<N; i++){
	    if(xDif[k]==0 && yDif[k]==0)
		break;
	    for(int j=0; j<N; j++){
		if(xDif[k]==x[i]-x[j] && yDif[k]==y[i]-y[j] )
		    count ++;	
	    }
	}
	ans = max(ans, count);
    }
    ans = N-ans;
    
    cout << ans<< endl;

}


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

int main()
{
    int N, a[100010];
    cin >> N;
    for (int i = 0; i < N; i++) cin >> a[i];

    int cnt[100010] = {};
    for (int i = 0; i < N; i++) cnt[a[i]]++, cnt[a[i] + 1]++, cnt[a[i] - 1]++;

    int ans = 0;
    for (int x : cnt) ans = max(ans, x);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0

for i in range(a+1):
	for j in range(b+1):
		for k in range(c+1):
			if 500*i + 100*j + 50*k == x:
				count += 1

print(count)

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

int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	vector<int> B(N);
	vector<int> C(N-1);
	rep(i,N){
		cin >> A[i];
		A[i]--;
	}
	rep(i,N){
		cin >> B[i];
	}
	rep(i,N-1){
		cin >> C[i];
	}
	
	int ans = 0;
	
	rep(i,N){
		ans += B[i];
	}
	rep(i,N-1){
		if(A[i]+1 == A[i+1]){
			ans += C[A[i]];
		}
	}
	
	cout << ans << endl;
	
	
    return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String in = sc.nextLine();
        String[] nums = in.split("");

        int a = Integer.parseInt(nums[0]);
        int b = Integer.parseInt(nums[1]);
        int c = Integer.parseInt(nums[2]);
        int d = Integer.parseInt(nums[3]);

        if (a + b + c + d == 7) {
            System.out.print(a + "+" + b + "+" + c + "+" + d + "=7");
        } else if (a - b + c + d == 7) {
            System.out.print(a + "-" + b + "+" + c + "+" + d + "=7");
        } else if (a - b - c + d == 7) {
            System.out.print(a + "-" + b + "-" + c + "+" + d + "=7");
        } else if (a - b - c - d == 7) {
            System.out.print(a + "-" + b + "-" + c + "-" + d + "=7");
        } else if (a + b - c - d == 7) {
            System.out.print(a + "+" + b + "-" + c + "-" + d + "=7");
        } else if (a + b + c - d == 7) {
            System.out.print(a + "+" + b + "+" + c + "-" + d + "=7");
        } else if (a + b - c + d == 7) {
            System.out.print(a + "+" + b + "-" + c + "+" + d + "=7");
        } else if (a - b + c - d == 7) {
            System.out.print(a + "-" + b + "+" + c + "-" + d + "=7");
        }
    }

}


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

int main()
{
   int a,b,c;
   scanf("%d %d %d",&a,&b,&c);
   if((a==b)&&(a!=c&&b!=c))
    printf("Yes\n");
   else if(a==c&&a!=b&&c!=b)
    printf("Yes\n");
   else if(c==b&&c!=a&&b!=a)
     printf("Yes\n");
   else
    printf("No\n");

    return 0;
}


Measured memory_bytes: 128
//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

signed main(){
  int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;

  cout << a[K-1] << endl;

  return 0;
}

Measured memory_bytes: 256
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd = readln.split.to!(int[]), h = rd[0], w = rd[1];
  auto n = readln.chomp.to!size_t;
  auto a = readln.split.to!(int[]);

  auto k = 0;
  foreach (i; 0..h) {
    auto r = new int[](w), j = 0;
    for (;;) {
      auto m = min(a[k], w-j);
      r[j..j+m][] = k+1;
      j += m;
      a[k] -= m;
      if (a[k] == 0) ++k;
      if (j == w) break;
    }

    if (i % 2 == 0)
      foreach (c, ri; r) write(ri, c < w-1 ? " " : "");
    else
      foreach_reverse (c, ri; r) write(ri, c > 0 ? " " : "");
    writeln;
  }
}


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

typedef pair<string,int> P;
const int INF = 1<<30;

string str;
int dir[4] = {-1,1,-4,4};
map<string,int> dp;


void bfs(){
	queue<string> Q;
	Q.push("01234567");
	dp["01234567"] = 0;

	while(!Q.empty()){
		string now = Q.front(); Q.pop();
		int p;
		for(int i=0; i<8; i++) if(now[i]=='0'){
			p = i;
			break;
		}

		for(int i=0; i<4; i++){
			int next = p+dir[i];
			if(next>=0 && next<8 && !(p==3&&i==1) && !(p==4 && i==0)){
				string nn = now;
				swap(nn[p],nn[next]);
				if(dp.find(nn) == dp.end()){
					dp[nn] = dp[now]+1;
					Q.push(nn);
				}
			}
		}
	}
}

int main(){
	bfs();
	while(getline(cin,str)){
		str.erase(remove(str.begin(),str.end(),' '),str.end());
		printf("%d\n",dp[str]);
	}

}

Measured memory_bytes: 5436
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    int val = INF<int>, ans = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        scanf("%d", &x);
        if(val > x){
            ans++;
            val = x;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#C問題
import fractions
A, B, C, D = map(int,input().split())
if A%C ==0:
    count = 1 + B//C - A//C
else:
    count = B//C - A//C
if A%D ==0:
    count = 1 + B//D - A//D + count
else:
    count = B//D - A//D + count
lcm = C*D//fractions.gcd(C,D)
if A%lcm ==0:
    count = count - (1 + B//lcm - A//lcm)
else:
    count = count - (B//lcm - A//lcm)
print(B-A+1-count)

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

// --------------------------------------------------------------------------------
#define FASTIO	ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define frepi(a,b) for(int i=a;i<=b;++i)
#define int long long
// --------------------------------------------------------------------------------

string t;

int cost(string s){
	int ans = 0;
	int tt = t.size();
	for(int i=0;i<tt;++i){
		if(s[i]!=t[i])ans++;
	}
	return ans;
}
void test_case(int tc)
{
	string s;cin>>s>>t;
	int n = s.size();
	int k = t.size();
	int ans = INT_MAX;
	for(int i=0;i<=n-k;++i){
		string s1 = s.substr(i,i+k);
		ans = min(ans,cost(s1));
	}
	cout<<ans;
}

int32_t main()
{
	FASTIO;
	#ifndef ONLINE_JUDGE
		freopen("/home/suryakant/input.txt","r",stdin);
		freopen("/home/suryakant/output.txt","w",stdout);
	#endif
	
    int tc=1;
    //cin>>tc;
    for(int i=1;i<=tc;++i)test_case(tc);
}

Measured memory_bytes: 3660
/*
* @author:  codancer
* @createTime:  2020-08-30, 22:48:51
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9+7;
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define fep(i,a,b) for(int i=(a);i>=(b);i--)
#define deb(x) cerr<<#x<<" = "<<(x)<<"\n"
typedef vector<int> VI;
typedef vector<ll> VII;
typedef pair<int,int> pii;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll Rand(ll B) {
	return (ull)rng() % B;
}
const int N = 2e5+100;
int par[N],siz[N];
void init(int n){
	rep(i,1,n) par[i]=i,siz[i]=1;
}
int find(int x){
	return par[x]==x?x:par[x]=find(par[x]);
}
int ans=0;
void unite(int x,int y){
	x=find(x);
	y=find(y);
	if(x==y) return ;
	par[x]=y;
	siz[y]+=siz[x];
	ans=max(ans,siz[y]);
	siz[x]=0;
}
int main(){
	int n,m,a,b;
	cin>>n>>m;
	init(n);
	rep(i,1,m){
		cin>>a>>b;
		unite(a,b);
	}
	cout<<max(ans,1)<<endl;
	return 0;
}

Measured memory_bytes: 5200
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define MOD 1000000007

typedef long long ll;

int main()
{
    int n;
    string s1, s2;

    cin >> n >> s1 >> s2;

    int dir = 2; //0:= 1:|
    int i = 0;
    ll ans = 1;
    while (i < n)
    {
        ll h = 1;
        if (s1[i] == s2[i])
        {
            if (dir == 2)
                h = 3;
            if (dir == 1)
                h = 2;

            dir = 1;

            i++;
        }
        else
        {
            if (dir == 2)
                h = 6;
            if (dir == 1)
                h = 2;
            if (dir == 0)
                h = 3;

            dir = 0;

            i += 2;
        }

        ans = (ans * h) % MOD;
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
	long long N;
	cin>>N;
	int count=0;
	for(int i=1; i<N; i++){
		int A=i,B;
		B=N-A;
        if(A>=B) break;
		if(A+B==N && A!=B)count++;
	}
  cout<<count<<endl;	
		
		
}

Measured memory_bytes: 256
a, b = map(int, input().split())
c = []
if a > b:
    a, b = b, a
if b%a == 0:
    print(a)
else:
    while True:
        for i in range(a):
            x = i + 2
            if a%x == 0:
                if b%x == 0:
                    c.append(x)
                    a = a//x
                    b = b//x
                    break
                elif b%(a//x) == 0:
                    c.append(a//x)
                    a = x
                    b = b//(a//x)
                    break
            if x > a**0.5:
                break
        if x > a**0.5:
            break
    s = 1
    for j in c:
        s = s * j
    print(s)



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

using namespace std;

typedef long long ll;

ll a,b,c,d;
int main(){
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	ll x1,x2,x3,x4;
	x1=a*c;
	x2=a*d;
	x3=b*c;
	x4=b*d;
	ll ans;
	ans=max(max(x1,x2),max(x3,x4));
	printf("%lld",ans);
	return 0;	
}

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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) {
        freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);
        //freopen("d:\\code\\cpp\\contests\\stdout", "w", stdout);
    }

    string s;
    cin >> s;
    int k;
    cin >> k;

    vector<pii> v;
    int cnt = 1;
    const int n = s.size();
    for(int i=1; i<n; i++){
        if (s[i] == s[i-1]){
            cnt++;
        }
        else{
            v.push_back(make_pair(s[i-1], cnt));
            cnt = 1;
        }
    }
    v.push_back(make_pair(s.back(), cnt));

    map<int, int> H;
    if (s[0] != s.back()){
        for(auto it : v)
            H[it.second]+=k;
    }
    else{
        if (v.size() == 1){
            cout << ((ll)k) * s.size() / 2 << endl;
            return 0;
        }
        H[v[0].second] += 1;
        H[v.back().second] += 1;
        H[v[0].second + v.back().second] += k-1;
        for(int i=1; i+1<v.size(); i++)
            H[v[i].second] += k;
    }

    ll sol = 0;
    for(auto it : H)
        sol += (ll)it.first / 2 * it.second;
    cout << sol << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789)        cerr << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

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

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] data = new int[N][2];
        for (int i  = 0; i < N; i++) {
            data[i][0] = sc.nextInt()-1;
            data[i][1] = sc.nextInt();
        }
        Arrays.sort(data, Comparator.comparing((int[] i) -> i[1]));
        int x = data[0][0] + data[0][1] + 1;
        System.out.println(x);
    }
}

Measured memory_bytes: 95096
#include <iostream>                                                                                                                                                                           
#include <cmath>                                                                                                                                                                              
#include <algorithm>                                                                                                                                                                          
using namespace std;                                                                                                                                                                          
int main() {                                                                                                                                                                                  
    int N;                                                                                                                                                                                    
    cin >> N;                                                                                                                                                                                 
    cout << ((N % 2 == 0) ? N : 2 * N)<< endl;                                                                                                                                                
} 

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

constexpr static ll MOD = 1000000007ll;
constexpr static int INF = 1 << 28; // for x <= 10^9
constexpr static ll INFL = 1ll << 60; // for x <= 10^19

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

    vector<double> vs(n);
    for (int i = 0; i < n; i++) {
        cin >> vs[i];
    }
    sort(vs.begin(), vs.end());

    double ans = accumulate(vs.begin() + 1, vs.end(), vs[0], [](double a, double b) {
        return (a + b) / 2.0;
    });
    cout << ans << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a[4] = {} , b[4] = {} , c[4][4] = {};
    for (int i = 1 ; i <= 3 ; i++) {
        for (int j = 1 ; j <= 3 ; j++) cin >> c[i][j];
    }
    a[2] = c[2][1] - c[1][1];
    a[3] = c[3][1] - c[1][1];
    b[1] = c[1][1];
    b[2] = c[1][2];
    b[3] = c[1][3];
    for (int i = 1 ; i <= 3 ; i++) {
        for (int j = 1 ; j <= 3 ; j++) {
            if ((a[i] + b[j]) != c[i][j]) {
                cout << "No";
                return 0;
            }
        }
    }
    cout << "Yes";
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<math.h>
#define ll long long int
#define ve vector<int>
#define vl vector<long long int>
#define all(a) a.begin(),a.end()
using namespace std;

int main(){
  ll x,y,A=1;
  cin>>x>>y;
  while(true){
    x=x*2;
    if(x>y) break;
    A++;
  }
  cout<<A<<endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from collections import deque

k = int(input())
ln_list = []
dq = deque([])

for i in range(1, 10):
    dq.append(i)

while len(dq) > 0 and len(ln_list) < k:
    obj = dq.popleft()
#    print(" obj: " + str(obj))
    ln_list.append(obj)
    last_i = int(str(obj)[-1])
#    print("  last_i: " + str(last_i))
    for i in range(-1, 2):
        next_int = last_i + i
        if -1 < next_int < 10:
            tmp = int(str(obj) + str(next_int))
#            print(tmp)
            dq.append(tmp)

print(ln_list[k-1])


Measured memory_bytes: 53980
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getl (map read . words) >>= print

solve :: [Int] -> Int
solve [k, s] = length $ [x| x <- [0..k], y <- [0..k], let z = s - x - y, z >= 0, z <= k]

getl :: (String -> a) -> IO a
getl f = f <$> getLine


Measured memory_bytes: 764
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template<int MOD>
struct ModInt {
	static const int Mod = MOD;
	unsigned x;
	ModInt() : x(0) {}
	ModInt(signed sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	ModInt(signed long long sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	int get() const { return (int)x; }

	ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
	ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }

	ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
	ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
	ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
	ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }

	ModInt inverse() const {
		signed a = x, b = MOD, u = 1, v = 0;
		while (b) {
			signed t = a / b;
			a -= t * b; std::swap(a, b);
			u -= t * v; std::swap(u, v);
		}
		if (u < 0) u += MOD;
		ModInt res; res.x = (unsigned)u;
		return res;
	}
};
template <int M>
ostream &operator << (ostream &os, const ModInt<M> &m) { return os << m.x; }
template <int M>
istream &operator >> (istream &is, ModInt<M> &m) { signed long long s; is >> s; m = ModInt<M>(s); return is; };
template<int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
	ModInt<MOD> r = 1;
	while (k) {
		if (k & 1) r *= a;
		a *= a;
		k >>= 1;
	}
	return r;
}

using mint = ModInt<1000000007>;

//nCrで用いる
vector<mint> fact, factinv;
//nCrで用いる 予め計算しておく
void nCr_compute_factinv(int N) {
	N = min(N, mint::Mod - 1);
	fact.resize(N + 1); factinv.resize(N + 1);
	fact[0] = 1;
	rep(i, 1, N + 1) fact[i] = fact[i - 1] * i;
	factinv[N] = fact[N].inverse();
	for (int i = N; i >= 1; i--) factinv[i - 1] = factinv[i] * i;
}
mint nCr(int n, int r) {
	if (n >= mint::Mod)
		return nCr(n % mint::Mod, r % mint::Mod) * nCr(n / mint::Mod, r / mint::Mod);
	return r > n ? 0 : fact[n] * factinv[n - r] * factinv[r];
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, W, A, B; cin >> H >> W >> A >> B;

	nCr_compute_factinv(H + W);
	mint ans(0);
	rep(i, B, W) {
		ans += nCr(H - A - 1 + i, i) * nCr(A + W - i - 2, A - 1);
	}

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

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


def solve(X: int):
    y = 100
    ans = 0
    while y < X:
        y = int(y * 1.01)
        ans += 1
    print(ans)


# Generated by 1.1.6 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()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 63508
l=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
if a%c==0 or b%d==0:
  if a/c>=b/d:
    print(l-(a//c))
  else:
    print(l-(b//d))
else:
  x=(a//c)+1
  y=(b//d)+1
  if x>=y:
    print(l-x)
  else:
    print(l-y)


Measured memory_bytes: 5592
#include <iostream>
#include <map>
#include <set>
#include <string>
using namespace std;

int main()
{
    string S, T;
    cin >> S >> T;

    map<char, int> ms, mt;
    for (auto c : S) ms[c]++;
    for (auto c : T) mt[c]++;

    multiset<int> ss, st;
    for (auto e : ms) ss.insert(e.second);
    for (auto e : mt) st.insert(e.second);
    cout << (ss == st ? "Yes" : "No") << endl;
}


Measured memory_bytes: 776
import java.util.*;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner( System.in );
		
		int N = sc.nextInt();
		Set<Integer> A = new HashSet<Integer>();
		
		for ( int i = 0; i < N; i++ ) {
			A.add(sc.nextInt()); 
		}
		
		System.out.println(A.size());
		
		sc.close();

	}

}

Measured memory_bytes: 23764
while true
    rateA,rateB,s = gets.split(" ").map(&:to_i)
    break if rateA ==0 && rateB == 0 && s == 0
    a=[]
    for i in 1..s/2
        sa = i*(100+rateA)/100
        (1..s-sa).to_a.reverse.each do |j|
            sb = j*(100+rateA)/100
            if sa + sb < s
                break
            end
            if sa + sb == s
                a.push([i,j])
                break
            end
        end
    end
    maximum = 0
    for i in 0..a.length-1
        maximum = [maximum, a[i][0]*(100+rateB)/100 + a[i][1]*(100+rateB)/100].max
    end
    puts(maximum)
end

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

int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans = 0,sum = 0;
    for (int i = 0; i < n; i++){
        if (s[i] == 'I'){
            sum++;
        }
        if (s[i] == 'D'){
            sum--;
        }
        ans = max(ans,sum);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256