akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int M=2147483647;
int a[400010];
int f(int x,int y,int i,int l,int r){
  if(r<=x||y<=l)return M;
  if(x<=l&&r<=y)return a[i];
  return MIN(f(x,y,i*2,l,(l+r)/2),f(x,y,i*2+1,(l+r)/2,r));
}  
int main(){
  int n,t,q,x,y,i,m;
  scanf("%d %d",&n,&m);
  for(t=1;t<n;t*=2);
  for(i=1;i<t*2;i++)a[i]=M;
  while(m--){
    scanf("%d %d %d",&q,&x,&y);
    if(q)printf("%d\n",f(x,y+1,1,0,t));
    else{
      x+=t;
      for(a[x]=y;x-1;x/=2)a[x/2]=MIN(a[x],a[x^1]);
    }
  }
  return 0;
}

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

class matrix {
	int rawnum,colnum;
public:
	matrix(int r=0,int c=0){rawnum=r,colnum=c;}
	int value[101][101];
	void matrixInitialize(int val);
	int setrawnum(int raw){return rawnum=raw;}
	int setcolumnnum(int col){return colnum=col;}
	int getrawnum(void){return rawnum;}
	int getcolumnnum(void){return colnum;}
	int setmember(int raw,int col,int val);
	int getmember(int raw,int col);
	matrix operator *(matrix x);
};

int matrix::setmember(int raw, int col, int val){
	if(0<raw && raw<=rawnum && 0<col && col<=colnum){
		value[raw-1][col-1]=val;
		return 1;
	}
	else{
		return -1;
	}
}

int matrix::getmember(int raw,int col){
	if(0<raw && raw<=rawnum && 0<col && col<=colnum){
		return value[raw-1][col-1];
	}
	else{
		return -1;
	}
}

void matrix::matrixInitialize(int val){
	for(int r=0;r<rawnum;r++){
		for(int c=0;c<colnum;c++)
			value[r][c]=val;
	}
}

matrix matrix::operator*(matrix x){
	matrix y;
	int r,c,j,val;

	if(this->colnum == x.rawnum){
		y.rawnum=this->rawnum;
		y.colnum=x.colnum;
		for(r=1;r<=this->rawnum;r++){
			for(c=1;c<=x.colnum;c++){
				val=0;
				for(j=1;j<=this->colnum;j++){
					val += this->getmember(r,j) * x.getmember(j,c);
				}
				y.setmember(r,c,val);
			}
		}
		return y;
	} else{
		y.rawnum=0;
		y.colnum=0;
		return y;
	}
}

int inputline(int *x,int *n){
	char buf[1024];
	int i=0,j=0,r;

	r=1;
	cin.getline(buf,1024);

	while(buf[i] !='\0'){
		*x=0;
		while(buf[i] != ' ' && buf[i] != '\0'){
			*x = *x * 10 + buf[i] - '0';
			i++;
		}
		x++;
		i++;
		j++;
	}
	*n = j;
	return r;
}

int main() {
	int l,n,m,o=1;
	class matrix a,b,c;
	int x[1024];

	inputline(x,&n);
	if(n != 2)
		return -1;
	n = x[0];
	m = x[1];

	//cout << n << ' ' << m << endl;

	a.setrawnum(n);
	a.setcolumnnum(m);

	b.setrawnum(m);
	b.setcolumnnum(o);

	for(int i=0;i<n;i++){
		inputline(x,&l);
		for(int j=0;j<m;j++)
			a.setmember(i+1,j+1,x[j]);
	}
	for(int i=0;i<m;i++){
		inputline(x,&l);
		b.setmember(i+1,1,x[0]);
	}

	c = a * b;

	//cout << n << ' ' << m << endl;

	/* for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cout << a.getmember(i+1,j+1) << ' ';
		}
		cout << endl;
	}
	for(int i=0;i<m;i++){
		for(int j=0;j<o;j++){
			cout << b.getmember(i+1,j+1) << ' ';
		}
		cout << endl;
	} */
	for(int i=0;i<n;i++){
		for(int j=0;j<o;j++){
			cout << c.getmember(i+1,j+1); // << ' ';
		}
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 3300
/*
 * 0611.cc: Silk Road
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 1000;
const int MAX_M = 1000;

const int INF = 1 << 30;

/* typedef */

/* global variables */

int ds[MAX_N], cs[MAX_M];
int dp[MAX_N + 1];

/* subroutines */

/* main */

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

  for (int i = 0; i < n; i++) cin >> ds[i];
  for (int i = 0; i < m; i++) cin >> cs[i];

  for (int i = 0; i <= n; i++) dp[i] = INF;
  dp[0] = 0;

  for (int i = 0; i < m; i++) {
    for (int j = n - 1; j >= 0; j--)
      if (dp[j] < INF) {
	int d = dp[j] + cs[i] * ds[j];
	if (dp[j + 1] > d) dp[j + 1] = d;
      }
  }

  printf("%d\n", dp[n]);
  return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define ll long long
using namespace std;
bool cmp(long long a,long long b)
{
    return a>b;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string a,b,c;
    cin>>a>>b>>c;
    cout<<a[0]<<b[0]<<c[0]<<endl;
}

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

int main() {
    string s;
    cin >> s;
    string ans = "Yes";
    for (int i = 0; i < s.size(); i += 2) {
        if (s[i] == 'L') {
            ans = "No";
            break;
        }
    }
    for (int i = 1; i < s.size(); i += 2) {
        if (s[i] == 'R') {
            ans = "No";
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
mod = 10**9+7
A, G, C, T = 0, 1, 2, 3
dp = [[[[0]*4 for _ in range(4)] for _ in range(4)] for _ in range(n+1)]
for i in range(4):
    for j in range(4):
        for k in range(4):
            if (i == A and j == G and k == C)\
            or (i == A and j == C and k == G)\
            or (i == G and j == A and k == C):
                continue
            else:
                dp[3][i][j][k] += 1

for i in range(3, n):
    for j in range(4):
        for k in range(4):
            for l in range(4):
                for m in range(4):
                    if (k == A and l == G and m == C)\
                    or (k == G and l == A and m == C)\
                    or (k == A and l == C and m == G)\
                    or (j == A and l == G and m == C)\
                    or (j == A and k == G and m == C):
                        continue
                    else:
                        dp[i+1][k][l][m] += dp[i][j][k][l]%mod

ans = 0
for i in range(4):
    for j in range(4):
        for k in range(4):
            ans += dp[n][i][j][k]
            ans %= mod

print(ans)


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

using namespace std;

// MACROS

#define ll long long
#define ull unsigned long long
#define ld long double

#define vi vector<int>
#define vll vector<ll>
#define vld vector<ld>
#define u_s unordered_set

#define pii pair<int,int>
#define pll pair<ll,ll>

#define FOR(i, n) for (ll (i) = 0; i < n; i++)
#define FORN(i, a, b) for (ll (i) = a; i < b; i++)
#define FORE(i, l) for (auto (i) : l)

#define pb push_back
#define pob pop_back
#define emp emplace
#define fi first
#define se second

#define all(n) (n).begin(), (n).end()
#define in(n) cin >> (n);
#define debug(n) cout << #n << ": " << n << '\n';

// FUNCTIONS

template< typename T >
inline T gcd(T a, T b) { if (b) return gcd(b, a % b); return a; }

template< typename T >
inline T ext_gcd(T a, T b, T & x, T & y) { if (a == 0) { x = 0; y = 1; return b; } T x1, y1; T g = ext_gcd(b % a, a, x1, y1); x = y1 - (b / a) * x1; y = x1; return g; }

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);	
    //cout << setprecision(15);
    ll n;
    cin >> n;
    map<string, ll> m;
    ll ma = 0;
    FOR(i, n)
    {
        string s;
        cin >> s;
        m[s]++;
        ma = max(ma, m[s]);
    }
    for (auto it = m.begin(); it != m.end(); it++)
    {
        if (it->second == ma) cout << it->first << '\n';
    }
}



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

const int DIM = 1e2 + 5;

string str[DIM], ans;

int main( void ) {
    
    int n, l;
    cin >> n >> l;
    
    for( int i = 1; i <= n; i ++ )
        cin >> str[i];
    
    sort( str + 1, str + n + 1 );
    
    for( int i = 1; i <= n; i ++ )
        ans += str[i];
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,m,d=MI()
if d==0:
    x=(m-1)*(n-d)
else:
    x=2*(m-1)*(n-d)
y=n**2
print(x/y)



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

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

gcd_A = A[0]
for i in range(1, N):
    gcd_A = gcd(gcd_A, A[i])

print(gcd_A)


Measured memory_bytes: 14252
package main

import (
	"fmt"
	"unicode"
)

func main() {

	var n, k int
	var s []rune
	var r rune

	fmt.Scanf("%d %d\n", &n, &k)

	for i := 0; i < n; i++ {
		fmt.Scanf("%c", &r)
		if i+1 == k {
			r = unicode.ToLower(r)
		}
		s = append(s, r)
	}

	for i := range s {
		fmt.Printf("%c", s[i])
	}
	fmt.Println("")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define next nxt
using namespace std;
char st[500010];
int go[500010][26],next[500010],w,len;
long long work(long long r,int ch)
{
	if (r<=len) return go[r][ch];
	long long n1=go[len/2][ch],n2=go[w][ch],l1=len/2,l2=w;
	while (l1+l2<=r)
	{
		long long tmp=l1;l1+=l2;l2=tmp;
		tmp=n1;n1+=n2;n2=tmp;
	}
	return n1+work(r-l1,ch);
}
int main()
{
	scanf("%s\n",st+1);len=strlen(st+1);
	for (int i=1;i<=len;i++)
	{
		for (int j=0;j<26;j++) go[i][j]=go[i-1][j];
		go[i][st[i]-'a']++;
	}
	next[0]=-1;
	for (int i=1;i<=len;i++)
	{
		int t=next[i-1];
		while ((t!=-1)&&(st[t+1]!=st[i])) t=next[t];
		next[i]=t+1;
	}
	w=next[len];
	while (w>=len/2) w=next[w];
	w=len/2-w;
	long long l,r;scanf("%lld%lld",&l,&r);
	for (int i=0;i<26;i++) printf("%lld ",work(r,i)-work(l-1,i));
}

Measured memory_bytes: 21760
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

//#include "Union_Find.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <list>
#include <bitset>

using namespace std;
#define REP(i,a,n) for(int i = (a); i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
#define FLOAT setprecision(16)
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(begin(dest), end(dest), val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
//sum, 累積和
// 負のときの割り算に注意
#if 1
#include <array>
#include <unordered_set>
#include <unordered_map>
template<class T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

//#include "Union_Find.h"

string S, T;
int N;
PP A[100000], B[100000];
int SS[100001], TT[100001];
int main() {
	cin >> S >> T;
	cin >> N;
	REP(i, 0, N) {
		cin >> A[i] >> B[i];
	}
	REP(i, 0, S.size()) {
		SS[i + 1] = SS[i] + (S[i] == 'A' ? 1 : 2);
	}
	REP(i, 0, T.size()) {
		TT[i + 1] = TT[i] + (T[i] == 'A' ? 1 : 2);
	}
	REP(i, 0, N) {
		int sd = SS[A[i].second] - SS[A[i].first - 1];
		int td = TT[B[i].second] - TT[B[i].first - 1];
		cout << ((td - sd) % 3 == 0 ? "YES" : "NO") << endl;
	}
	return 0;
}

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

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

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976

int main()
{
    int n,m; cin >> n >> m;
    ll a[m],c[m];
    rep(i,m){
        int b;
        cin >> a[i] >> b;
        int S = 0;
        rep(j,b){
            int bit; cin >> bit;
            bit--;
            S = S | (1<<bit);
        }
        c[i] = S;
    }
    ll dp[m+1][1<<n];
    rep(i,m+1) rep(j,(1<<n)) dp[i][j] = INF;
    dp[0][0] = 0;
    for(int i = 0; i < m; i++){
        for(int S = 0; S < (1<<n); S++){
            dp[i+1][S] = min(dp[i+1][S],dp[i][S]);
            int T = (S | c[i]);
            dp[i+1][T] =  min(dp[i+1][T], dp[i][S] + a[i]);
        }
    }
    if(dp[m][(1<<n)-1] == INF) cout << -1 << endl;
    else cout << dp[m][(1<<n)-1] << endl;
}

Measured memory_bytes: 32256
#include <iostream>
#include <math.h>
#include <vector>
#include <cstdio>
using namespace std;

double l[21],a[21],b[21];
int n,m;
double res = 0;
vector<int> vec;

double distance(int x,int y){
	return pow(l[x]-l[y],2)+pow(a[x]-a[y],2)+pow(b[x]-b[y],2);
}

void check(int x){
	double total = 0;
	vec.push_back(x);
	if(vec.size() == m){
		for(int i = 0;i < m;i++){
			for(int j = i+1;j < m;j++){
				total += distance(vec[i],vec[j]);
			}
		}
		if(res < total){
			res = total;
		}
	}
	else if(vec.size() < m){
		for(int i = x+1;i < n;i++){
			check(i);
		}
	}
	vec.pop_back();
}

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

	for(int i = 0;i < n;i++){
		check(i);
	}

	printf("%.10f\n",res);
	return 0;
}

Measured memory_bytes: 3300
#include <bits/stdc++.h>
using namespace std;
#define go(i, a, n) for (ll i = a; i < n; i++)
#define gor(i, a, n) for (int i = n - 1; i >= a; i--)
#define show(x) cout << x << '\n'
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vpair vector<pair<ll, ll>>
#define vtuple vector<tuple<ll, ll, ll>>
#define ff first
#define ss second
#define mod 1000000007
#define memset(a, k) memset(a, k, sizeof(a))
#define answer(z, k) cout << "Case #" << z << ": " << k << endl;
auto t1 = chrono::high_resolution_clock::now();
bool prime[1000001];
ll expo(ll a, ll b)
{
	if (b == 0)
		return 1;
	if (b % 2)
		return ((a % mod) * (expo((a * a) % mod, b / 2) % mod)) % mod;
	return expo((a * a) % mod, b >> 1) % mod;
}
ll mul(ll a, ll b)
{
	a = a % mod;
	b = b % mod;
	if (b == 0)
		return 0;
	if (b % 2)
		return ((a % mod) + (mul((a + a) % mod, b >> 1) % mod)) % mod;
	return mul((a + a) % mod, b >> 1) % mod;
}

bool ispoweroftwo(ll x)
{
	return x && !(x & (x - 1));
}
ll xorcal(ll n)
{
	if (n % 4 == 0)
		return n;
	if (n % 4 == 1)
		return 1;
	if (n % 4 == 2)
		return n + 1;
	if (n % 4 == 3)
		return 0;
}
void sieve(ll n)
{
	memset(prime, true);
	prime[0] = false;
	prime[1] = false;
	for (ll i = 2; i * i <= n; i++)
	{
		if (prime[i] == true)
		{
			for (ll j = i * i; j <= n; j += i)
				prime[j] = false;
		}
	}
}
bool isprime(ll n)
{
	if (n <= 1)
		return false;
	if (n <= 3)
		return true;

	if (n % 2 == 0 or n % 3 == 0)
		return false;

	for (ll i = 5; i * i <= n; i += 6)
	{
		if (n % i == 0 or n % (i + 2) == 0)
			return false;
	}
	return true;
}

ll modinverse(ll a, ll m)
{
	ll m0 = m;
	ll y = 0, x = 1;

	if (m == 1)
		return 0;

	while (a > 1)
	{
		ll q = a / m;
		ll t = m;

		m = a % m;
		a = t;
		t = y;

		y = x - q * y;
		x = t;
	}

	if (x < 0)
		x += m0;

	return x;
}

ll gcd(ll a, ll b)
{
	if (a == 0)
		return b;
	return (b % a, a);
}
bool ispalindrome(string s)
{
	string t = s;
	reverse(t.begin(), t.end());
	if (t == s)
		return true;
	return false;
}
void binary(ll a[], ll n)
{
	gor(i, 0, 64)
	{
		ll k = n >> i;
		a[i] = k & (ll)1;
	}
}
ll countBits(ll n)
{
	if (n == 0)
		return 0;
	return 1 + countBits(n & (n - 1));
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll turn = 0;
	while (1)
	{
		if (turn % 2 == 0)
			c -= b;
		else
			a -= d;
		if (c <= 0)
		{
			show("Yes");
			break;
		}
		else if (a <= 0)
		{
			show("No");
			break;
		}
      turn++;
	}
	auto t2 = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(t2 - t1).count();
	clog << "Time taken = " << duration * 1.0 / 1000 << " seconds" << endl;
	return 0;
}


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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで降順
#define pb push_back
#define eb emplace_back
#define fst first
#define snd second
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;
constexpr ll inf = 1ll<<61;
constexpr ll mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>T add(const T &a, const T &b){return (a+b)%mod;}

signed main(){
  string s; cin >> s;
  map<char,int> mp;
  rep(i,s.size()) mp[s[i]]++;
  bool f = true;
  for(auto p : mp)
    if(p.second != 2) f = false;
  if(f)
    cout << "Yes\n";
  else
    cout << "No\n";
}


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

int main(){
   int n, k;
   cin >> n >> k;
   int d[k];
   int a[1100];
   int q;
   for(int i=0; i<k; i++){
      cin >> d[i];
      for(int j=0; j<d[i]; j++){
         cin >> q;
         a[q-1] = -1;
      }
   }
   int p=0;
   for(int i=0; i<n; i++){
      if(a[i]!=-1) p++;
   }

   cout << p << endl;

}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=998244353;
const ll inf=1e17;
const ll ms=(2e5)+5;


vector<pair<int,int>> vv;


int main()
{
    idfc;
    int n;
    cin>>n;
    int i;
    int a,b;
    for(i=1;i<=n;i++)
    {
        cin>>a>>b;
        vv.pb(a-b,a+b);
    }
    sort(vv.begin(),vv.end());

    int y=INT_MIN;
    int ans=0;
    for(i=0;i<n;i++)
    {
        a=vv[i].first;
        b=vv[i].second;
      //  cout<<a<<" "<<b<<" "<<y<<"\n";
        if(y>a)
        {
            ans++;
            y=min(y,b);
        }
        else y=b;
    }
    cout<<n-ans;
    return 0;
}

Measured memory_bytes: 4232
#include<algorithm>
#include<cmath>
#include<deque>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>

#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
typedef long long ll;
#define rep(i,n) for(ll i=0; i<n; i++)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
using namespace std;

int main(){
  int n;  cin >> n;
  vector<double> v(n);
  rep(i,n){
    cin >> v[i];
  }
  sort(all(v));
  double ans = 0.0;
  for(int i = 0; i < n-1; i++){
    v[i+1] = (v[i+1]+v[i])/2.0;
  }
  cout << v[n-1];
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;

struct M {
	int64_t x;
	int64_t v;
};

struct B {
	int64_t v;
	int64_t x;
};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int64_t n, d, a; cin >> n >> d >> a;
	vector<M> ms(n);
	FOR_LT(i, 0, n) {
		cin >> ms[i].x >> ms[i].v;
	}
	sort(ms.begin(), ms.end(), [](const auto& lhs, const auto& rhs) {
		return lhs.x < rhs.x;
	});

	int64_t p = 0;
	int64_t sv = 0;
	int64_t ans = 0;

	list<B> rem;
	while (p < n) {
		int64_t nx = ms[p].x;
		if (ms[p].v - sv > 0) {
			int64_t nb = (ms[p].v - sv + a - 1) / a;
			ans += nb;

			sv += nb * a;
			int64_t ny = nx + d * 2;
			rem.push_back({ nb * a, ny });
		}

		p++;
		while (p != n && !rem.empty() && rem.front().x < ms[p].x) {
			sv -= rem.front().v;
			rem.pop_front();
		}
	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 8064
'use strict'
function Main(input){
  input=input.trim().split(/\s+/).map(x=>x-0);
  var r=input.filter(x=>x%10).map(x=>x%10);
  var m=Math.min.apply(null,r);
  if(m===Infinity){
    r=[0];
    m=0;
  }
  input=input.map(x=>x-x%10);
  var result=input.reduce((a,c)=>a+c,0)+10*(r.length-1)+m;
  console.log(result);
}

Main(require('fs').readFileSync('/dev/stdin','utf8'));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int main() {
  vector<int> vec(3);
  rep(i,3){
    cin >> vec.at(i);
  }
  SORT(vec);
  cout << vec.at(0) << " " << vec.at(1) << " " << vec.at(2) << endl;
}


Measured memory_bytes: 3156
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define f first
#define s second
signed main(){
	ic(a) ic(b)
	cout<<max(0,a-b*2)<<endl;
}	

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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

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

  vector<int> v;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;

    int c = 0;
    while (a % 2 == 0) {
      a /= 2;
      c++;
    }
    v.push_back(c);
  }
  p(min(v));
}

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

int main(void){
    int n,k;
    cin >> n >> k;
    int h[n];
    for(int i = 0;i < n;i++)cin >> h[i];
    
    ll dp[n+10];
    for(int i = 0;i <= n;i++)dp[i] = 1e18;
    dp[0] = 0;
    
    for(int i = 0;i < n;i++){
        for(int j = 1;j <= k;j++){
            if(i + j < n)dp[i + j] = min(dp[i + j],dp[i] + abs(h[i] - h[i + j]));
        }
    }
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 4784
#pragma GCC optimize "-O3"
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define LSOne(S) (S & (-S))
#define ll long long
#define two pair<int,int>
#define twol pair<ll,ll>
#define four pair<two,two>
#define pb push_back
#define mk make_pair
#define y1 y1922
#define INF 1000000000000000000
#define P 1000000007
#define lmax 1000000000
#define nn 1000003
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define vi vector<int>
#define vll vector<ll>
#define vtwo vector<two>
#define ALL(container) (container).begin(), (container).end()
#define sz(container) (int)(container.size())
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define mid(a,b) (a+b>>1)
#define minN 0
#define maxN 10000000
#define na(x) ((x)<P?(x):(x)-P)
#define ab(a) (-(a)<(a)?(a):-(a))
#define FAST std::ios::sync_with_stdio(false)
#define xRand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define rnd rng
#define IT iterator
typedef
tree<
  int,// aq pair<int,int> shegidzlia
  null_type,
  less/*_equal*/<int>,// aqac
  rb_tree_tag,
  tree_order_statistics_node_update>
ordered_set;
// '_equal' mashin ginda roca multiset gchirdeba
template<class key, class value,class cmp = std::less<key>>
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
ordered_map<int, int> my_map;
inline int rin(){
	int x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
inline int bin(){
	int x=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x;
}
int n;
int main(){FAST;xRand;
cin>>n;
cout<<(n-2)*180<<endl;

}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
                 *   *   * *   *
                  *   *   *   *
                   *   * *   *
                     *  *   *
					   *  *


*/






Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
int ABS(int a) {if(a<0) a = -a; return a;}
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2;
    int diff_x = x2-x1;
    int diff_y = y2-y1;
    out(x2-diff_y);
    out(y2+diff_x);
    out(x1-diff_y);
    out(y1+diff_x);

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <climits>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long> vl;

#define COUT cout <<
#define SPACE_COUT << " "  <<
#define COMMA_COUT << ", " <<
#define ENDL << endl

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

    int N;    
    cin >> N;

    vector<ll> A, B;
    for (int i = 0; i < N; ++i) {
        ll aa, bb;
        cin >> aa >> bb;
        A.push_back(aa);
        B.push_back(bb);
    }
    
    ll a = 1, b = 1;
    for (int i = 0; i < N; ++i) {        
        ll aa = (a + A[i]-1) / A[i];
        ll bb = (b + B[i]-1) / B[i];
        ll M = max(aa, bb);
        M = M == 0 ? 1 : M;
        a = A[i] * M;
        b = B[i] * M;
    }
    cout << a + b << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import deque


def main():
    sas = deque(list(input()))
    sbs = deque(list(input()))
    scs = deque(list(input()))

    deques = {"A": sas, "B": sbs, "C": scs}
    player = "A"
    while True:
        if len(deques[player]) == 0:
            ans = player
            break
        player_temp = deques[player].popleft()
        player = player_temp.upper()
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9052
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;

namespace ABC156A
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = RInt;
            var R = RInt;

            int ans = R + 100 * (10 - Math.Min(N, 10));

            Console.WriteLine(ans);
        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String RNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int RInt => int.Parse(RNext());
        public static long RLong => long.Parse(RNext());
        public static int[] RInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] RLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
        public static string RString => RNext();
        //以下未テスト
        public static int[] RIntsC(int c) => Enumerable.Repeat(0, c).Select(x => int.Parse(RNext())).ToArray();
        public static long[] RLongsC(int c) => Enumerable.Repeat(0, c).Select(x => long.Parse(RNext())).ToArray();
        public static char[][] RMap(int h) => Enumerable.Repeat(0, h).Select(x => Console.ReadLine().ToCharArray()).ToArray();
    }

    static class Debug
    {
        static public void Draw2D<T>(T[,] map, int mode = 1)
        {
#if DEBUG
            int W = map.GetLength(0);
            int H = map.GetLength(1);

            string[,] map2 = new string[W + 1, H + 1];
            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = 0.ToString();
                    else if (i == 0) map2[i, j] = (j - 1).ToString();
                    else if (j == 0) map2[i, j] = (i - 1).ToString();
                    else map2[i, j] = map[i - 1, j - 1].ToString();
                }
            }

            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write(map2[i, j].Last());
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        public static void Draw1D<T>(T[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


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


def solve():
    cnt = {i + (1 - N % 2): 0 for i in range(0, 2 * N // 2, 2)}
    for a in A:
        if a not in cnt:
            return 0

        if N % 2 == 1:
            if a % 2 == 1:
                return 0
            cnt[a] += 1
        else:
            if a % 2 == 0:
                return 0
            cnt[a] += 1

    for key, value in cnt.items():
        if key == 0:
            if value != 1:
                return 0
        else:
            if value != 2:
                return 0

    return 2 ** (N // 2) % (10 ** 9 + 7)


print(solve())


Measured memory_bytes: 14692
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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(b<a){a=b;return true;}return false;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll n,m;cin>>n>>m;
    vector<ll> a(n);
    rep(i,n){
        cin>>a[i];
        a[i]--;
    }
    ll sum=0;
    vector<vector<int>> in(m+m),out(m+m);

    rep(i,n-1){
        if(a[i]<a[i+1]) sum+=a[i+1]-a[i];
        else            sum+=a[i+1]+m-a[i];

        if(a[i+1]-a[i]==1) continue;
        if(a[i]<a[i+1]){
            in[a[i]+2].push_back(i);
            out[a[i+1]].push_back(a[i+1]-a[i]-1);
        }else{
            in[a[i]+2].push_back(i);
            out[a[i+1]+m].push_back(a[i+1]+m-a[i]-1);
        }
    }

    vector<ll> profit(m,0);
    ll cnt=0,num=0;
    rep(i,m+m){
        cnt+=(ll)in[i].size();
        num+=cnt;
        profit[i%m]+=num;
        for(auto x:out[i])num-=x;
        cnt-=(ll)out[i].size();
    }
    cout<<sum-(*max_element(ALL(profit)))<<endl;
    return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <typename T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> bool chmin(T &a, const T &b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const long long INFLL = 1LL << 60;
const long long MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    ll R, G, B;
    R = G = B = 0;
    for(auto a : S) {
        if(a == 'R')
            R++;
        else if(a == 'G')
            G++;
        else
            B++;
    }
    ll s = 0;
    rep(i, N) {
        rep(j, i + 1, N - 1) {
            if(S.at(i) == S.at(j)) continue;
            if(j + j - i > N - 1) continue;
            if(S.at(i) != S.at(j + j - i) && S.at(j) != S.at(j + j - i)) s++;
        }
    }
    ll sum = R * G * B - s;
    cout << sum << endl;
}


Measured memory_bytes: 3572
N=int(input())
otoshidama= [list(map(str,input().split())) for _ in range(N)]

goukei=0

for ii in range(N):
    if otoshidama[ii][1] == "JPY":
        goukei += float(otoshidama[ii][0]) * 1.0
    elif otoshidama[ii][1] == "BTC":
        goukei += float(otoshidama[ii][0]) * 380000.0

print(goukei)


Measured memory_bytes: 3060
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cmath>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<iomanip>
#include<utility>
using namespace std;
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define rg register
#define il inline
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define rep0(i,n) for(register int i=0;i<(n);++i)
#define per0(i,n) for(register int i=(n)-1;i>=0;--i)
#define rep(i,st,ed) for(register int i=(st);i<=(ed);++i)
#define per(i,ed,st) for(register int i=(ed);i>=(st);--i)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> il T qmin(const T &a,const T &b){return a<b?a:b;}
template<typename T> il T qmax(const T &a,const T &b){return a>b?a:b;}
template<typename T> il void getmin(T &a,const T &b){if(a>b) a=b;}
template<typename T> il void getmax(T &a,const T &b){if(a<b) a=b;}
il void fileio(string s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int inf=(int)1e9+7;
const ll linf=(ll)1e17+7;

int main(){
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	puts((b-a)&1?"Borys":"Alice");
	return 0;
} 

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)

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


int main(){
	
	int n;cin >> n;
	ll a = 0;
	ll b = 0;
	REP(i, n){
		ll aa = LLINF;
		ll bb = LLINF;
		ll x, y;cin >> x >> y;
		ll tmp = max(1LL, max(a / x, b / y));
		while(a > tmp * x || b > tmp * y)tmp++;
		a = tmp * x;
		b = tmp * y;
	}
	
	cout << a + b << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

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

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

// const int dx[8] = {1, 1, 0,-1,-1,-1, 0, 1};
// const int dy[8] = {0, 1, 1, 1, 0,-1,-1,-1};

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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; }
int ctoi(char c){return c-'0';}

void dfs(string s,int size){
  if(s.size() == size-1){
    if(size == 1){
      print('a');
      return;
    }
    int last = 0;
    rep(i,size)chmax(last,s[i]-'a');
    rep(i,last+2){
      string t = s + (char)('a'+i);
      print(t);
    }
    return;
  }
  int last = 0;
  rep(i,size)chmax(last,s[i]-'a');
  if(s.size() == 0)last--;
  rep(i,last+2){
    string t = s + (char)('a'+i);
    if(t.size() < size)dfs(t,size);
  }
}

// TODO: write
int main() {
  int n;cin>>n;
  string s;
  dfs(s,n);
  
  return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main()
{
long double a,b;
cin>>a>>b;
if(a!=0&&b!=0&&a>=1&&b<=pow(10,100))
if(a==b)
cout<<"EQUAL";
else if(a>b)
cout<<"GREATER";
else
cout<<"LESS";
 return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
s = []
c = []
for m in range(M):
    si, ci = map(int, input().split())
    s.append(si)
    c.append(ci)

ss = 10 ** (N - 1)
if N == 1:
    ss -= 1

for i in range(ss, 10 ** N):
    for m in range(M):
        if str(i)[s[m] - 1] != str(c[m]):
            break
    else:
        print(i)
        exit()

print(-1)


Measured memory_bytes: 3064
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;

int main()
{

    string s;
    cin>>s;
    int cnt=0,ans=0,i;
    for(i=0; i<s.size(); i++)
    {
        cnt=0;
        if(s[i]=='R')
        {
            cnt=1;
            while(s[i]==s[i+1])
            {
                cnt++;
                i++;
            }
        }
        ans=max(ans,cnt);
    }
cout<<ans<<endl;
}


Measured memory_bytes: 3196
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < s.length; i++) {
			if(s[i] == 'B') {
				if( sb.length() > 0)sb.deleteCharAt(sb.length()-1);
			}else {
				sb.append(s[i]);
			}
		}
		System.out.println(new String(sb));

		sc.close();

	}

}

Measured memory_bytes: 21588
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int rate = scan.nextInt();
		
		if(rate >= 1200){
			System.out.println("ARC");
		}else{
			System.out.println("ABC");
		}
		
		scan.close();

	}

}


Measured memory_bytes: 9808
const lines=readlines(open("/dev/fd/0"))
let
    state=0
    global input
    input()=lines[state+=1]
end
int(s::String)=parse(Int32,s)
intSub(s::SubString{String})=parse(Int32,s)
intLine()=map(intSub,split(input()))
function main()
    a,b=intLine()
    println(b%a<1 ? a+b : b-a)
end
main()

Measured memory_bytes: 120480
/*Allah Vorosha*/
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define n_p next_permutation
#define p_p prev_permutation
#define in insert
#define rev reverse
#define pf push_front
#define pob pop_back
#define uniq(v)         v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define all(x) (x).begin(),(x).end()
#define pof pop_front
#define ios ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define scn scanf
#define prt printf
#define rep(i, a, n) for(int i = a; i < n; i++)
#define mod 1000000007
#define yes cout << "YES\n"
#define no cout << "NO\n";
#define take for(auto &it : a) cin >> it;
#define out cout << a << "\n";
#define l_b lower_bound
#define u_b upper_bound
#define Max 100005
template<typename T> T mymax(T x, T y) {
    return (x > y ? x : y);
}

using namespace std;

const int N = 1e5 + 5;

void solve() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ans = a * c;
    ans = max(ans, b * d);
    ans = max(ans, b * c);
    ans = max(ans, d * a);
    cout << ans << '\n';
}

int main() {
    /*int tc;
    scanf("%d", &tc);
    while(tc--)*/
    solve();
    return 0;
}


Measured memory_bytes: 3628
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define INF 1000000000
#define MOD 998244353LL
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair

#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (int i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 100005

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

    ll n, a, b;
    cin >> n >> a >> b;
    if(a < b) swap(a, b);
    ll d = a-b;
    if(d % 2 == 0){
        cout << d/2 << "\n";
    } else{
        cout << min(n-a, b-1)+d/2+1;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s; cin>>s;
	int n=s.length();
	int i=0,j=n-1;
	bool chk=true;
    
    while(i<j)
    {
        if(s[i]!=s[j]){
            chk=false;
            break;
        }
        i++; --j;
    }
    
    i=0;j=(n/2)-1;
    if(chk)
	while(i<j)
	{
		if(s[i]!=s[j])
		{
			chk=false;
			break;
		}
		i++; j--;
	}
	if(chk)
	{
		i=(n+3)/2;
		--i;
		j=n-1;
		while(i<j)
	{
		if(s[i]!=s[j])
		{
			chk=false;
			break;
		}
		i++; j--;
	}
	}
	if(chk)
		cout<<"Yes";
	else cout<<"No";


}

Measured memory_bytes: 256
str = gets().split("")
n = str.length

check = 0

for i in 0..n-1
	if str[i] == "A"
		if str[i+1] == "C"
			check = 1
		end
	end
end

if check == 0
	puts("No")
elsif check == 1
	puts("Yes")
end

Measured memory_bytes: 3836
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
 
 
#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>
 
using namespace std;

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

    int K,X;
    cin >> K >> X;
    if(X - K + 1 < -1000000){
        for(int i = -1000000; i < X + K; i++){
            cout << i;
            if(i != X + K - 1) cout << " ";
        }
    }else if(X + K - 1 > 1000000){
        for(int i = X - K + 1; i < 1000000; i++){
            cout << i;
            if(i != X + K - 1) cout << " ";
        }

    }else{
        for(int i = X - K + 1; i < X + K; i++){
            cout << i;
            if(i != X + K - 1) cout << " ";
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256