akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int main()
{
  int n;
  cin>>n;
  int *ar = new int[n];
  for(int i = 0;i<n;i++)
   	cin>>ar[i];
  for(int i = n-1;i > 0;i--)
  {
    for(int j = 0;j<i;j++)
    {
      if(ar[j] > ar[j+1])
      {
        int temp = ar[j];
        ar[j] = ar[j+1];
        ar[j+1] = temp;
      }
    }
  }
  float sum = (ar[0] + ar[1])/2.0;
  for(int i = 2;i<n;i++)
  {
    sum = (sum + ar[i])/2.0;
  }
  cout<<sum;
  return 0;
}

Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_A main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    ll A, B, C, K; cin >> A >> B >> C >> K;

    if (abs(A-B) > (ll)1e18) {
        cout << "Unfair" << endl;
    } else if (K%2==1) {
        cout << B - A << endl;
    } else {
        cout << A - B << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2")
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<set>
#include<unordered_map>
#include<assert.h>
#include<time.h>
#include<stdlib.h>
#include<random>
#include<queue>
using namespace std;
using lld = long long int;
using pll = pair<lld, lld>;
using lf = double;
using pff = pair<lf, lf>;
using pif = pair<int, lf>;
using pii = pair<int, int>;
using pli = pair<lld, int>;
using pil = pair<int, lld>;
using piii = pair<int, pii>;
#define M 998244353
lld n;
int x, m;
int ad[100009];
lld a[100009];
int main() {
	int i, j, k, l;
	int t = 1, tv = 0;
	//scanf("%d", &t);
	while (t--) {
		scanf("%lld %d %d", &n, &x, &m);
		lld cur = x;
		ad[x] = 1;
		a[0] = x;
		lld cycle = 0;
		int cl = -1;
		lld cn;
		lld ci;
		lld base = cur;
		lld res = 0;
		for (i = 2;i <= n; i++) {
			lld nxt = (cur * cur) % m;
			a[i - 1] = nxt;
			if (ad[nxt] == 0) {
				ad[nxt] = i;
				base += nxt;
			}
			else {
				cl = i - ad[nxt];
				cn = nxt;
				ci = ad[nxt];
				break;
			}
			cur = nxt;
		}
		//printf("%lld %lld %d\n", ci, cn, cl);
		if (ci > 0 && n - ci - cl > 0) {
			lld ds = (n - ci - cl) / cl;
			lld cbase = 0;
			res = base;
			for (i = ci; i < ci + cl; i++) {
				cbase += a[i - 1];
			}
			res += cbase * ds;
			lld dl = (n - ci - cl) % cl;
			for (i = ci; i <= ci + dl; i++) {
				res += a[i - 1];
			}
		}
		else {
			res = base;
		}
		printf("%lld\n", res);
	}
	return 0;
}

Measured memory_bytes: 2464
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

template<typename T> void print(const T & v);


int main() {
    ll N;
    cin >> N;
    vector<ll> t(N), x(N), y(N);

    for (int i = 0; i < N; i++) {
        cin >> t.at(i) >> x.at(i) >> y.at(i);
    }
    ll a = 0, b = 0, ten = 0;
    bool ans = true;
    for (int i = 0; i < N; i++) {
        ll c = abs(x.at(i)-a) + abs(y.at(i)-b);
        ll d = t.at(i) - ten;
        if(d < c){
            cout << "No" << endl;
            return 0;
        }
        if(d == c){
            a = x.at(i);
            b = y.at(i);
            ten = t.at(i);
        }else if(d >= c && (d-c) % 2 == 0){
            a = x.at(i);
            b = y.at(i);
            ten = t.at(i);
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


// Use For Debug
template <typename T>
void print(T const & v){
    for(int i = 0; i < v.size(); i++){
        if(i) cout << " ";
        cout << v[i];
    }
    cout << endl;
}


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

using namespace std; 

int main(){

	string s; 
	
	vector<int> container(20);
	
	cin >> s;
	
	int ans = 0;
	
	
	for(int i=0;i<s.size();i++){
		container[i] = s[i]=='A'?1:s[i]=='C'?1:s[i]=='G'?1:s[i]=='T'?1:0;
	}
	
	int sum = 0;
	for(int i=0;i<s.size();i++){
		if(!container[i]){
			sum = 0;
		}else{
			sum+=1;
		}
		ans = max(sum,ans);
	}
	
	cout << ans << endl;
	
	
	
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
CB = [[0] * 2 for i in range(M)]

for i in range(M):
    B, C = map(int, input().split())
    CB[i][0], CB[i][1] = C, B

A.sort(reverse=True)
CB.sort(reverse=True)

sum = 0
x, y = 0, 0
for _ in range(N):
    if y < M and A[x] < CB[y][0]:
        sum += CB[y][0]
        CB[y][1] -= 1
        if CB[y][1] <= 0:
            y += 1
    else:
        sum += A[x]
        x += 1

print(sum)


Measured memory_bytes: 23980
n = int(input())
l = []
for i in range(n):
    xyh = list(map(int, input().split()))
    l.append(xyh)
    if xyh[2]:
        x, y, h = xyh
for i in range(101):
    for j in range(101):
        k = h + abs(i - x) + abs(j - y)
        if all(h == max(k - abs(i - x) - abs(j - y), 0) for x, y, h in l):
            print(i, j, k)

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

int main()
{
    int x, y;
    cin >> x >> y;
    ll ans = 0;
    if(x == 3) {
        if(y == 3) {
            ans += 200000;
        }
        else if(y == 2) {
            ans += 300000;
        }
        else if(y == 1) {
            ans += 400000;
        }
        else ans += 100000;
    }
    else if(x == 2) {
        if(y == 3) {
            ans += 300000;
        }
        else if(y == 2) {
            ans += 400000;
        }
        else if(y == 1) {
            ans += 500000;
        }
        else ans += 200000;
    }
    else if(x == 1) {
        if(y == 3) {
            ans += 400000;
        }
        else if(y == 2) {
            ans += 500000;
        }
        else if(y == 1) {
            ans += 1000000;
        }
        else ans += 300000;
    }
    else {
        if(y == 3) {
            ans += 100000;
        }
        else if(y == 2) {
            ans += 200000;
        }
        else if(y == 1) {
            ans += 300000;
        }
        else ans += 0;
    }
    cout << ans << endl;
    return 0;
}

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

bit = [0] * 20
ans = 0
L = R = 0
while L < N:
    A_new = bin(A[R])[2:].zfill(20) if R < N else '0' * 20
    ok = 1
    remove_left = 1
    for i in range(20):
        if A_new[i] == '1' and bit[i] == 1:
            ok = 0
            break
    if ok:
        for i in range(20):
            if A_new[i] == '1':
                bit[i] = 1
        if R < N:
            remove_left = 0
        R = min(R + 1, N)
    if remove_left:
        A_left = bin(A[L])[2:].zfill(20)
        for i in range(20):
            if A_left[i] == '1':
                bit[i] = 0
        ans += R - L
        L += 1
print(ans)


Measured memory_bytes: 76748
#include<bits/stdc++.h>
#define ll                  long long
#define dl                 double
#define pb                push_back
#define eb                emplace_back
#define mp                make_pair
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   for(int i=s;i<n;i++){cout <<  V[i] ;} cout << endl;
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
using namespace std;

int main()
{
fast;
ll q=1;
//cin >> q;
while(q--)
{
    ll n,m,i,j,l,r,a,t,b,c,u,v,w,p,x,y;
    //n=m=i=j=l=r=a=t=b=c=u=v=w=p=x=y=0;
    cin >> n;
    vector<ll> V(n);
    CIN(V,0,n);
    dl ans = 0;
    for(i=0;i<n;i++) ans += 1.0/(dl)V[i];


    cout << fixed << setprecision(10) << 1.0/ans ;


}
    return 0;
}


Measured memory_bytes: 256
/*..............................................*\
Author:Kishor Kumar Paroi
Dept:CSE-1703053
email.kishor.josephite@gmail.com
RUET,BANGLADESH
\*---------------------------*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include<bits/stdc++.h>
#include<iostream>
#include<iterator>

#define max(a,b) ((a>b)?a:b)                        //finding max
#define min(a,b) ((a<b)?a:b)                        //finding min
#define Max(a,b,c) max(a,max(b,c))                  //finding max between 3 numbers
#define Min(a,b,c) min(a,min(b,c))                  //finding min between 3 numbers
#define Pi acos(-1.0)                               //defining Pi for mathematical uses
#define Clear(a) memset(a,0,sizeof(a))              //clearing memory of an array
#define setfalse(a) memset(a,false,sizeof(a))       //setting the array into false
#define settrue(a) memset(a,true,sizeof(a))         //setting the array into true
#define clrstr(a) memset(a,'\0',sizeof(a))          //setting string array to null
#define open freopen("input.txt","r",stdin)         //opening input file
#define close freopen ("output.txt","w",stdout)     //opening output file
#define Case(a) printf("Case %d: ",a)               //printing case number
#define caseh(a) printf("Case #%d: ",a)             //printing case number having '#'
#define getcase(a) scanf("%d",&a)                   //scanning case number
#define caseloop(a,b) for(a=1;a<=b;a++)             //making case loop
#define EPS 1e-9                                    //small value for avoiding preccesion error
#define LL long long                                //long long short form
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

//const int N=100*1000;
//const int mod=1e9+7;

//# define int min3(int a,int b,int c){return min(a,min(b,c));}
//#define int max3(int a,int b,int c){return max(a,max(b,c));}
//#define int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
//#define int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b)
        cout<<c<<endl;
    else if(b==c)
        cout<<a<<endl;
    else
        cout<<b<<endl;

    return 0;
}


Measured memory_bytes: 256
import Data.Char

main :: IO()
main = do
    ns <- getLine
    putStrLn $ solve (map digitToInt ns)


solve :: [Int] -> String
solve ns
    | ns !! 0 == ns !! 1 || ns !! 1 == ns !! 2 || ns !! 2 == ns !! 3 = "Bad"
    | otherwise = "Good"

Measured memory_bytes: 380
// YOU THINK YOU KNOW ME.//


#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define int                      long long
#define MOD                     1000000007
#define inf                     9e18
#define ld                      long double
#define countbit                __builtin_popcount
#define loop(i,a,n)				for(int i=a;i<n;i++)
#define pb                      push_back
#define pf                      push_front
#define mp                      make_pair
#define f                       first
#define s                       second
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define boost                   ios_base::sync_with_stdio();cin.tie(0);cout.tie(0);
#define cases                   int tests;cin>>tests;while(tests--)
#define all(s)                  s.begin(),s.end()
#define line                    cout<<endl;
#define watch(x)                cout<<(#x)<<" is "<<x<<endl
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rich_set;
bool isprime(int n){if(n==1)return false;if(n==2)return true;for(int i=2;i<=sqrt(n);i++){if(n%i==0){ return false;}}return true;}
int poww(int b,int e){if(e==0)return 1;else if(e%2==0){int a=pow(b,e/2);return a*a;}else {int a=pow(b,e/2);return b*a*a;}}
int powm(int x,int y,int m=MOD){x=x%m;int res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
int modInverse(int a, int m=MOD) { return powm(a, m-2, m);}
void print(vector<int>v){for(int i=0;i<v.size();i++){cout<<v[i]<<" ";}}
void print(int arr[]){int size = *(&arr + 1) - arr; for(int i=0;i<size;i++){cout<<arr[i]<<" ";}}
string to_bin(int n){string res="";int i=0;while(n>0){if(n%2==1){res=res+'1';}else{res=res+'0';}n/=2;i++;}reverse(all(res));return res;}
int to_dec(string s){int n=s.size(),ans=0,temp=1;for(int i=n-1; i>=0; i--){int x=s[i]-'0';ans+=x*temp;temp*=2;}return ans;}
void result(bool f){if(f)cout<<"YES"<<endl;else cout<<"NO"<<endl;}
int dp[100005];
int fn(int u, vector<int> adj[], 
                    vector<bool> &visited) 
{ 
    if(visited[u]==1)return dp[u];
    visited[u] = true; 
    //cout << u << " "; 
    int val=0;
    
    for (int i=0; i<adj[u].size(); i++) 
        {
            int x= adj[u][i];
            int temp = fn(x,adj,visited)+1ll;
            val= max(val,temp);
        }
    dp[u]=val;
    return val;


}  


void DFS(vector<int> adj[], int V) 
{ 
    vector<bool> visited(V, false); 
    for (int u=1; u<=V; u++) 
        if (visited[u] == false) 
          int x=  fn(u, adj, visited); 
} 
  

void solve(){
	int n,m;
    cin>>n>>m;
    vector<int> v[n+1];

    loop(i,0,m){
        int a,b;
        cin>>a>>b;
        v[a].pb(b);
      //  v[b].pb(a);
    }
    DFS(v,n);
    int ans=-1;
    for(int i=1;i<=n;i++){
        ans= max(ans,dp[i]);
    }
    cout<<ans<<endl;
}
int32_t main(){
	boost
  //cases
	solve();	
	
	//return 0;
}

Measured memory_bytes: 9216
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		while (sc.hasNextLine()) {
			int nico = Integer.parseInt(sc.nextLine());
			
			int sum = 2;
			for (int i = 1; i < nico; i++) {
				sum = sum + i + 1;
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 26012
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,q;
    cin>>n>>q;
    vector<tuple<ll,ll,ll>> L(n);
    rep(i,n) cin>>get<1>(L[i])>>get<2>(L[i])>>get<0>(L[i]);
    sort(all(L));
    vector<ll> ans(q,-1);
    // vector<ll> D(n*2,0);
    unordered_map<ll,ll> D;
    set<ll> s;
    rep(i,q){
        ll d;
        cin>>d;
        s.insert(d);
        D[d]=i;
    }
    rep(i,n){
        auto t=L[i];
        ll X=get<0>(t);
        ll S=get<1>(t);
        ll T=get<2>(t);
        auto it=s.lower_bound(S-X);
        while (it != s.end() && *it < T-X ) {
            auto it2 = it;
			++it2;
            ans[D[*it]]=X;
			s.erase(it);
            it = it2;
		}
    }
    rep(i,q) cout<<ans[i]<<endl;
    return 0;
}

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

typedef long long ll;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

// bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
//     return arg1.first > arg2.first;
// }

int main(void) {
    int n, m;
    cin >> n >> m;

    vector<int> a(m);
    int k, atmp;
    for(int in=0;in<n;in++) {
        cin >> k;
        for(int ik=0;ik<k;ik++) {
            cin >> atmp; atmp--;
            a.at(atmp)++;
        }
    }

    int cnt = 0;
    for(int im=0;im<m;im++) {
        if(a.at(im)==n) cnt++;
    }

    cout << cnt << endl;
    return 0;
}


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

int n;

int main(){
    cin >> n;
    char c[n]; 
    int w=0;
    int r=0;
    for(int i=0; i<n; i++){
        cin >> c[i];
        if(c[i]=='R') r++;
    }
    //cout << "r = " << r << "\n";
    int ans=max(w,r);
    for(int i=0; i<n; i++){
        if(c[i]=='W'){
            w++;
        }else{
            r--;
        }
        //cout << "r = " << r << "\n";
        //cout << "w = " << w << "\n";
        int cur_ans = max(w,r);
        ans = min(ans, cur_ans);
    }

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

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

typedef long long ll;
typedef vector<int, int> vi;
typedef pair<int, int> pi;
#define F first;
#define S second;
#define PB push_back;
#define MP make_pair;
#define REP(i, a, b) for(int i = a; i <= b; i++)
ll itr(int *arr, int curr, int size, int value) {
	if(size==curr){
		return value%360;
	}
	ll add = itr(arr, curr+1, size, value + arr[curr]);
	ll sub = itr(arr,curr+1, size, value-arr[curr]);
	if(add == 0){
		return add;
	}
	return sub;
}
int main(){
	int s;
	cin >> s;
	unordered_set<int> se;
	while(s--) {
		int val;
		cin>>val;
		if(se.find(val) != se.end()) {
			cout << "NO";
			return 0;
		}
		se.insert(val);
	}
	cout << "YES";
}


Measured memory_bytes: 8520
#include <cstdio>
#include <algorithm>
#define int short
const int N = 105;
using namespace std;
int L[N][N], R[N][N], f[N][N][N][N], ans;
int n, m, sx, sy;
char s[N];
inline int min(int a, int b) {
	return a < b ? a : b;
}
inline int max(int a, int b) {
	return a > b ? a : b;
}
signed main() {
	scanf("%hd%hd", &n, &m);
	for(int i = 1; i <= n; i ++ ) {
		scanf("%s",s+1);
		for(int j = 1; j <= m; j ++ ) {
			int x = s[j] == 'o';
			L[i][j] = L[i][j-1]+x;
			R[i][j] = R[i-1][j]+x;
			if(s[j] == 'E') sx = i, sy = j;
		}
	}
	for(int i = sx; i; i -- ) 
	for(int j = sy; j; j -- ) 
	for(int k = sx; k <= n; k ++ ) 
	for(int l = sy; l <= m; l ++ ) {
		if(1 < i && k+1 < sx+i) ans = max(ans, f[i-1][j][k][l] = max(f[i-1][j][k][l], f[i][j][k][l]+L[i-1][min(l,m-sy+j)]-L[i-1][max(j-1,l-sy)]));
		if(k < n && sx+k < n+i) ans = max(ans, f[i][j][k+1][l] = max(f[i][j][k+1][l], f[i][j][k][l]+L[k+1][min(l,m-sy+j)]-L[k+1][max(j-1,l-sy)]));
		if(1 < j && l+1 < sy+j) ans = max(ans, f[i][j-1][k][l] = max(f[i][j-1][k][l], f[i][j][k][l]+R[min(k,n-sx+i)][j-1]-R[max(i-1,k-sx)][j-1]));
		if(l < m && sy+l < m+j) ans = max(ans, f[i][j][k][l+1] = max(f[i][j][k][l+1], f[i][j][k][l]+R[min(k,n-sx+i)][l+1]-R[max(i-1,k-sx)][l+1]));
	}
	printf("%hd\n", ans);
}

Measured memory_bytes: 227584
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
const ll INF=1000000000000001;
const double PI=3.141592653589;


int main(){
  int n; cin>>n;
  bool ans=0;
  rep(i,101){
    for(int j=0;j+i<=100;j++){
      if(i*4+j*7==n)
      ans=1;
    }
  }
  if(ans)
  cout<<"Yes"<<endl;
  else
  cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using Int = long long;

int main() {

	Int A, B, C, D, E, F;

	std::cin >> A >> B >> C >> D >> E >> F;

	long double max_density = (long double)(E * 100) / (long double)(100 + E);
	long double ans_density = 0;
	Int ans_sum = 0;
	Int ans_sugar = 0;
	Int number_a = F / 100 / A;
	Int number_b = F / 100 / B;
	Int number_c = F / C;
	Int number_d = F / D;

	for (Int a = 0; a <= number_a; a++) {
		for(Int b=0;b<=number_b;b++){
			long double sum = 100 * A * a + 100 * B * b;
			if (sum > F)break;

			if (100 * A * a + 100 * B * b > 0) {
				for (Int c = 0; c <= number_c; c++) {
					long double sum = 100 * A * a + 100 * B * b + C * c;
					if (sum > F)break;

					for (Int d = 0; d <= number_d; d++) {
						long double sum = 100 * A * a + 100 * B * b + C * c + D * d;
						if (sum > F)break;

						long double sugar = C * c + D * d;
						long double density = sugar*100/ sum;//この行をsugar/sum*100にするとWA
						if (density >= ans_density && density <= max_density) {
								ans_density = density;
								ans_sum = sum;
								ans_sugar = sugar;
						}
					}
					
				}
				
			}
		}
	}

	std::cout << ans_sum <<" "<< ans_sugar << std::endl;

}

Measured memory_bytes: 256
// AtCoder ABC112: A - Programming Education
// 2020.1.29 bal4u

#include <stdio.h>

int main()
{
	int N, A, B;
	
	scanf("%d", &N);
	if (N == 1) puts("Hello World");
	else {
		scanf("%d%d", &A, &B);
		printf("%d\n", A+B);
	}
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <random>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define pi 3.141592653589793
#define prique priority_queue
constexpr auto mod=1000000007;
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
bool prime(int n){
    int cnt=0;
    for(int i=1;i<=sqrt(n);i++){
        if(n%1==0)cnt++;
    }
    if(cnt!=1) return false;
    else return n!=1;
}
struct UnionFind{
    vector<int> r;
    UnionFind(int N){
        r=vector<int>(N,-1);
    }
    int root(int x){
        if(r[x]<0) return x;
        return r[x]=root(r[x]);
    }
    bool unite(int x,int y){
        x=root(x);
        y=root(y);
        if(x==y) return false;
        if(r[x]>r[y]) swap(x,y);
        r[x]+=r[y];
        r[y]=x;
        return true;
    }
    int size(int x){
        return -r[root(x)];
    }
};
vector<int> v;
int n,m,cnt=1,ans=1,aa[220000];
pair<int,int> pp[220000];
string s,ss[220000];
queue<int> que;
signed main(){
    cin>>n;
    rep(i,n){
        cnt*=10;
        cnt%=mod;
    }
    rep(i,n){
        ans*=8;
        ans%=mod;
    }
    cnt+=ans;
    cnt%=mod;
    ans=1;
    rep(i,n){
        ans*=9;
        ans%=mod;
    }
    ans*=2;
    ans%=mod;
    if(cnt<ans){
        cout<<cnt+mod-ans;
    }else{
        cout<<cnt-ans;
    }
}

Measured memory_bytes: 10604
//23
#include<iostream>
#include<map>

using namespace std;

int m[11][1000];

void calc(int p,int d,int u){
  if(d<=10){
    for(int i=0;i<=9;i++){
      if(!(u&1<<i)){
	int cs=p+i*d;
	m[d][cs]++;
	calc(cs,d+1,u|1<<i);
      }
    }
  }
}

int main(){
  calc(0,1,0);
  for(int n,s;cin>>n>>s;){
    cout<<((s<1000)?m[n][s]:0)<<endl;
  }
  return 0;
}

Measured memory_bytes: 792
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int a,b;
  cin >> a>>b;
  if(b%a == 0)cout << a+b << endl;
  else cout << b-a << endl;
}

Measured memory_bytes: 3520
#include<iostream>

using namespace std;

int main(){
    int a_1,a_2,a_3,sum;
    cin >> a_1 >> a_2 >> a_3; 
    sum = a_1 + a_2 + a_3;
    if(sum < 22) cout << "win";
    else cout << "bust";
}

Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>

using namespace std;
typedef long long ll;
ll waru = 1e9+7;

int main() {

	ll N;
	cin >> N;

    vector<double > p(N,0);
    for(ll i = 0; i < N; i++){
        cin >> p[i];
    }

    vector<vector<double > > dp(N+1, vector<double >(N+1, 0));
    dp[0][0] = 1.0;

    for(ll i = 0; i < N; i++){
        for(ll j = 0; j <= i; j++){
            dp[i+1][j+1] += dp[i][j] * p[i];
            dp[i+1][j]   += dp[i][j] * (1.0 - p[i]);
        }
    }

    
    /*
    for(ll i = 0; i <= N; i++){
        for(ll j = 0; j <= N; j++){
            cout << fixed;
            cout << setprecision(5) << dp[i][j] << " ";
        }
        cout << endl;
    }
    */

    double ans = 0;

    for(ll j = N/2+1; j <= N; j++){
        ans += dp[N][j];
    }
    
    cout << fixed;
    cout << setprecision(9) << ans << " ";    
}

Measured memory_bytes: 70656
#include<stdio.h>
#include<string.h>

int n[100],x,i;
char a[5];

int main(){
    n['A']=1,n['B']=n['C']=0;
    while(scanf("%s",a)!=EOF){
        x=n[a[0]];
        n[a[0]]=n[a[2]];
        n[a[2]]=x;
    }
    a[0]='A';
    for(i=0;i<3;i++)if(n[65+i]==1)printf("%c\n",a[0]+i);
    
    return 0;
}
	


Measured memory_bytes: 2052
#define _USE_MATH_DEFINES
#pragma region include

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////

void solve() {
	LL N, A, B;
	cin >> N >> A >> B;
	LL Q = N / (A + B);
	LL ans = Q * A;
	LL temp = N % (A + B);
	if (temp < A) {
		ans += temp;
	}
	else {
		ans += A;
	}
	cout << ans << endl;
}

#pragma region main
signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 233;
int a[maxn],b[maxn],c[maxn],d[maxn],pre[maxn],p[maxn],n;
int ord[maxn];
bool cmp(int i,int j){
	return b[i]<b[j];
}
bool cmp2(int i,int j){
	return a[i]<a[j];
}
bool vis[maxn];
bool check(){
	for(int i=1;i<=n;i++)p[ord[i]] = d[i];
//	for(int i=1;i<=n;i++)cout<<p[i]<<" ";cout<<endl;
	int cnt = 0;
	int x = 1;
	while(!vis[x]){
		vis[x] = 1;
		cnt++;x = p[x];
	}
	if(cnt==n)return 0;
	return 1;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),pre[i] = a[i];
	for(int i=1;i<=n;i++)scanf("%d",&b[i]);
	for(int i=1;i<=n;i++)d[i] = i,ord[i] = i;
	sort(ord+1,ord+1+n,cmp2); 
	sort(a+1,a+1+n);
	sort(d+1,d+1+n,cmp);
	for(int i=1;i<=n;i++)c[d[i]] = a[i];
/*	for(int i=1;i<=n;i++)cout<<a[i]<<" ";cout<<endl;
	for(int i=1;i<=n;i++)cout<<d[i]<<" ";cout<<endl;
	for(int i=1;i<=n;i++)cout<<c[i]<<" ";cout<<endl;*/
	bool ok = 0;
	if(check())ok = 1;
	for(int i=1;i<=n;i++)if(pre[i]==c[i])ok = 1;
	sort(b+1,b+1+n);
	for(int i=1;i<=n;i++)if(a[i]>b[i]){
		cout << "No" << endl;
		return 0; 
	}
//	for(int i=1;i<=n;i++)cout<<b[i]<<" ";cout<<endl;
	for(int i=1;i<n;i++)
	if(a[i+1]<=b[i])ok = 1;
	if(ok)puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 4224
#include <stdio.h>
int main(void){
    int i, num, sum;
    char number[1001];
    
    while(1) {
        scanf("%s", number);
        if(number[0] == '0') break;
        else {
            sum = 0;
            for(i=0; number[i] != '\0'; i++) {
                    num = number[i] - '0';
                    sum += num;
            }
            printf("%d\n", sum);
        }
    }
    return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
vector<int> tot;

class UF{
private:
	vector<int> rank, par;
public:
	UF( int n ) : par(n), rank(n, 0){
		for( int i = 0; i < n; ++i )
			par[i] = i;
	}

	int root( int a ){
		if( par[a] == a ) return a;
		return par[a] = root(par[a]);
	}

	bool sameset( int a, int b ){
		return root(a) == root(b); 
	}

	void merge( int a, int b ){
		int ra = root(a);
		int rb = root(b);

		if( ra == rb ) return;

		if( rank[ra] > rank[rb] ){
			par[rb] = ra;
			tot[ra] += tot[rb];
			//cout << tot[ra] << endl;
		}
		else{
			par[ra] = rb;
			tot[rb] += tot[ra];
			if( rank[ra] == rank[rb] )
				rank[rb]++;
		}
	}
};
 
int main(){
	int n, m, cnt = 0;
	cin >> n >> m;
	char c[n][m];
	int cn[n][m];
	vector<int> keep;
	tot.assign(n*m+5, 1);

	UF uf(n*m+5);
	for( int i = 0; i < n; ++i ){
		for( int j = 0; j < m; ++j ){
			cin >> c[i][j];
			cn[i][j] = cnt;
			cnt++;
			if( c[i][j] == '#' ){
				keep.push_back(cnt-1);
				int nx = i-1, ny = j-1;
				if( nx >= 0 && c[nx][j] == '#' ){
					//cout << cn[i][j] << ' ' << cn[nx][j] << endl;
					uf.merge(cn[i][j], cn[nx][j]);
				}
				if( ny >= 0 && c[i][ny] == '#' ){
					//cout << cn[i][j] << ' ' << cn[i][ny] << endl;
					uf.merge(cn[i][j], cn[i][ny]);
				}
			}
		}
	}

	bool bl = true;
	for( int i = 0; i < keep.size(); ++i ){
		if( tot[uf.root(keep[i])] <= 1 ){
			bl = false;
			break;
		}
	}
	if( bl ) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

int main(void){
    int A[4];
    char S[5];
    scanf("%s",S);
    for(int i=0;i<4;i++){
        A[i]=S[i]-'0';
    }

    for(int i=0;i<8;i++){
        int ans=A[0];
        for(int j=0;j<3;j++){
            if(i&(1<<j)) ans+=A[j+1];
            else ans-=A[j+1];
        }
        if(ans==7){
            for(int j=0;j<3;j++){
                printf("%d",A[j]);
                if(i&(1<<j)) printf("+");
                else printf("-");
            }
            printf("%d=7\n",A[3]);
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 128
require "prime"
M = (10 ** 9) + 7
N = gets.to_i
if N == 1
  p 1
  exit
end
h = {}
(2..N).each do |i|
  i.prime_division.each do |a,b|
    h[a] ||= 1
    h[a] += b
  end
end
p h.values.inject(:*).modulo(M)


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

int main() {
    int n,i,w[100]={0},j,S1[100]={0},S2[100]={0},t;
    int ans[100] = {0},min = 0;
    scanf("%d",&n);
    for(i = 0; i < n; i++)
        scanf("%d",&w[i]);
    
    for(t = 0; t < n; t++) {
        for(j = 0; j <= t; j++)
            S1[t] += w[j];
        for(j = n-1; j > t; j--)
            S2[t] += w[j];
    }
    
    for(i = 0; i < n; i++)
        ans[i] = abs(S1[i]-S2[i]);
    
    for(i = 0; i < n ; i++){
        if(i == 0)
            min = ans[i];
        else if(min > ans[i])
            min = ans[i];
    }
    printf("%d",min);
}

Measured memory_bytes: 128
// input! macro is published in the following URLs.
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
// https://github.com/tanakh/competitive-rs.git
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        _n: usize,
        s: chars,
    }
    let ans = s
        .windows(3)
        .filter(|x| x[0] == 'A' && x[1] == 'B' && x[2] == 'C')
        .count();
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    Int N; cin >> N;
    vector<Int> h(N);
    rep(i, 0, N) cin >> h[i];
    
    vector<Int> dp(N, LLONG_MAX);
    dp[0] = 0;
    dp[1] = abs(h[1]-h[0]);

    rep(i, 2, N) {
        dp[i] = min(dp[i], dp[i-2] + abs(h[i]-h[i-2]));
        dp[i] = min(dp[i], dp[i-1] + abs(h[i]-h[i-1]));
    }

    cout << dp[N-1] << endl;
}

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

int main() {
    int N; cin >> N;
    string s[100];
    for (int i = 0; i < N; i++) cin >> s[i];

    bool judge = true;
    
    // check for duplicates
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            if (s[i] == s[j]) judge = false;
        }
    }

    // check　connectivity 
    for (int i = 0; i < N-1; i++) {
        if (s[i].back() != s[i+1].front()) judge = false;
    }

    cout << (judge ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>	
#define int long long int
#define pb push_back
#define endl "\n"
#define F first
#define S second 
#define mod 1000000007     
using namespace std;
const int N = 1e5 + 5;
vector<vector<int>> g;
int dp[N];
bool visit[N];
void dfs(int v){
	dp[v] = 0;
	visit[v] = true;
	for(auto to: g[v]){
		if(!visit[to])
			dfs(to);
		dp[v] = max(dp[v], 1 + dp[to]);
	}
}
main()
{	
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int n, m;
	cin >> n >> m;
	int in[n + 1] = {0};
	g.resize(n + 1);
	for(int i = 0, x, y; i < m; i++){
		cin >> x >> y;
		g[x].pb(y);
		in[y]++;
	}
	for(int i = 1; i <= n; i++){
		if(!in[i])
			dfs(i);
	}
	cout << *max_element(dp, dp + N) << endl;
}

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

    map<int,int>mp;
int main()
{
set<int>s;
set<int>::iterator it;
   long long  int n,k,a,b,mx,sum=0,f=0,d;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {cin>>a>>b;
    s.insert(a);
    mp[a]+=b;

    }
for(it=s.begin();it!=s.end();++it)
{
    d=*it;
    sum+=mp[d];
    if(sum>=k){break;}
}
cout<<d<<endl;
}


Measured memory_bytes: 6144
N = gets.to_i
men = N.times.map{
  a = gets.to_i
  a.times.map{
    x, y = gets.split.map &:to_i
    [x-1, y]
  }
}
# p men

ans = 0
(2**N).times{|bits|
  ok = [0] * N
  N.times{|i|
    next if bits[i] == 0
    ok[i] = 1
    men[i].each{|x, y|
      ok[x] = 1 if y == 1
    }
  }
  if N.times.all?{|i|
    ok[i] == 0 || men[i].all?{|x, y|
      ok[x] == y
    }
  }
    ans = [ans, bits.to_s(2).count(?1)].max
  end
}
p ans

Measured memory_bytes: 1916
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int[] ans = new int[n];
            for (int i = 0; i < m * 2; i++)
                ans[in.nextInt() - 1]++;
            for (int ca : ans)
                out.println(ca);
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



Measured memory_bytes: 21332
n,*a=map(int,open(0).read().split())
x=s=l=c=0
for r,b in enumerate(a):
  x^=b
  s+=b
  while x<s:
    x^=a[l]
    s-=a[l]
    l+=1
  c+=r-l+1
print(c)

Measured memory_bytes: 91172
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// スペース区切りの整数の入力
      int a = sc.nextInt();
	  int b = sc.nextInt();
      int c= sc.nextInt();

		// 出力
      if ((a==b && a!=c) || (a==c && a!=b)  || (b==c&& a!=c)) {
		System.out.println(2);
      }else if (a==b && b==c){ 
		System.out.println(1);
      }else{
        System.out.println(3);
      }
      
   }
}


Measured memory_bytes: 23892
#include<set>
#include<map>
#include<stack>
#include<cmath>
#include<queue>
#include<deque>
#include<cstdio>
#include<vector>
#include<climits>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
int read(){
	bool f=0;int x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+c-'0',c=getchar();
	return !f?x:-x;
}
#define MAXN 500
#define INF 0x3f3f3f3f
priority_queue<double> Q;
int main(){
	int n=read();
	for(int i=1;i<=n;i++)
		Q.push(-read());
	while(Q.size()!=1){
		double x=Q.top();Q.pop();
		double y=Q.top();Q.pop();
		Q.push((x+y)/2);
	}
	printf("%.7f\n",-Q.top());
	return 0;
}


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

	#define ONLINE_JUDGE
	#define pb(a) push_back(a)
	#define ALL(a) (a.begin(), a.end())
	#define FOR(x,to) for(x=0;x<(to);x++)

	using ll = long long;

	const int E5 = 1e5;

	//////////// Solution /////////////////////////////////

	void solve() {
		int n,d;
		cin >> d >> n;
		int k = 0;
		int i = 0;
		for (i = 1; n && i <= 100000000; ++i) {
			int t = i;
			k = 0;
			for (int j = 0; j < 3; ++j) {
				if (t%100==0) {
					++k;
					t /= 100;
				} else {
					break;
				}
			}
			if (k==d) {
				--n;
				if (n==0) {
					break;
				}
			}
		}

		cout << i << '\n';
	}	

	/////////// End Solution ///////////////////////////////////////

	//////// Initialization ////////////////////////////////////

	int main() {

		#ifndef ONLINE_JUDGE
		FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
		clock_t time_start = clock();
		#endif

		ios::sync_with_stdio(false);
		cin.tie(NULL);

		solve();

		#ifndef ONLINE_JUDGE
		fclose(FIN);
		cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
		#endif

		return 0;
	}

		//////// End Initialization ///////////////////////////////////////

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>
#include<iomanip>
 
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define pii pair<int,int>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define mp(a, b) make_pair(a, b)
#define mt(a,b,c) make_tuple(a,b,c)
#define rank qwertyuio
#define next dfghjk
#define plus fsghsf
#define minus ytryr
#define pb push_back
#define debug(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
 
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
 
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int mod = (int)1e9 + 7;
const int mod1 = (int)1e9 + 9;
const int mod2 = 998244353;
const int mod3 = (int)1e6+3;
const ld eps = 1e-12;
const double pi = atan2(0, -1);
const int ABC = 26;
 
 
ll binary_search(vector<ll> arr,ll val,ll l,ll r){
    ll m=l+(r-l)/2;
    if(l>=r){
        return l;
    }
    if(val<arr[m]){
        return binary_search(arr,val,l,m);
    }
    else{
        return binary_search(arr,val,m+1,r);
    }
}//return position less than
ll binary_search2(vector<ll> arr,ll val,ll l,ll r){
    ll m=l+(r-l)/2;
    if(l>=r){
        return l;
    }
    if(val<=arr[m]){//changed here
        return binary_search2(arr,val,l,m);
    }
    else{
        return binary_search2(arr,val,m+1,r);
    }
}//return position less than or equal
ll power(ll x, ll y) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % mod;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % mod; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % mod; 
    } 
    return res; 
} 
ll modInverse(ll n) 
{ 
    return power(n, mod-2); 
}
ll gcdl(ll a ,ll b){ 
    if (a == 0) 
        return b;  
    return gcdl(b % a, a);  
 }
bool sortxy(pii &a,pii &b){
    if(a.first!=b.first){
        return a.first<b.first;
    }
    else{
        return a.second<b.second;
    }
}
bool sortyx(pii &a,pii &b){
    if(a.second!=b.second){
        return a.second<b.second;
    }
    else{
        
        return a.first<b.first;
    }
}
ll minll(ll a,ll b){
    return a<b? a:b;
}

ll save[200007];
int num=100000;
int main()
{   string s;
    cin>>s;
    int i;
    rep(i,0,s.length()){
        s[i]='x';
    }
    cout<<s;
             
    
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<algorithm>

using namespace std;
typedef pair<int,int> P;
 
bool operator < (const P &a, const P &b){
	if(a.first != b.first){
		return (a.first< b.first);
	}else{
		return (a.second< b.second);
	}
}
typedef long long ll;

int n,mh;
int n2=1<<17;
int d[100001],h[100001];
ll dat[1<<18],sum[1<<18];

int query(int a,int b,int k,int l,int r){
	if(r<=a || b<=l)return 0;
	if(a<=l && r<=b)return dat[k]+sum[k];
	else{
		int ml=query(a,b,k*2+1,l,(l+r)/2);
		int mr=query(a,b,k*2+2,(l+r)/2,r);
		return (max(ml,mr)+sum[k]);
	}
}

void add(int a,int b,int x,int k,int l,int r){
	if(r<=a || b<=l)return;
	if(a<=l && r<=b){
		sum[k]+=x;
		while(k>0){
			k=(k-1)/2;
			dat[k]=max(dat[k*2+1]+sum[k*2+1],dat[k*2+2]+sum[k*2+2]);
		}
	}else{
		add(a,b,x,k*2+1,l,(l+r)/2);
		add(a,b,x,k*2+2,(l+r)/2,r);
	}
}

int main(void){
	scanf("%d%d",&n,&mh);
	for(int i=0;i<n-1;i++){
		scanf("%d%d",&d[i],&h[i]);
	}
	ll res=0;
	int nh=mh;
	priority_queue<P> que;
	for(int i=0;i<n-1;i++){
		add(i,i+1,nh,0,0,n2);
		P in;
		in.second=i;
		in.first=h[i];
		que.push(in);
		nh-=d[i];
		
		while(nh<=0){
			P p=que.top();
			que.pop();
			int Smax=query(p.second,i+1,0,0,n2);
			
			if(p.first+Smax>mh){
				p.first=mh-Smax;
				que.push(p);
				continue;
			}
			ll cost=min((-1*nh)/p.first+1,(mh-Smax)/p.first);
			res+=cost;
			nh+=cost*p.first;
			add(p.second,i+1,cost*p.first,0,0,n2);
            		que.push(p);
		}
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 6128