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

int main() {
	int n,x;
	cin >> n >> x;
	vector<int> dist;
	for (int i = 0; i < n; ++i) {
		int xi;
		cin >> xi;
		dist.push_back(abs(xi-x));
	}
	sort(dist.begin(), dist.end());
	int div = dist[0];
	while (div > 1) {
		bool flag = true;
		for (int val : dist) {
			if (val % div != 0) {
				flag = false;
				break;
			}
		}
		if (flag)break;
		else div--;
	}
	cout << div << endl;
	return 0;
}


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

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String input = br.readLine();
			int x = Integer.parseInt(input);
			System.out.println(x * x * x);
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
	}
}


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

int main(){
    int w,a,b;
    int min,max;
    scanf("%d%d%d",&w, &a, &b);
    if(a<b){
        min = a;
        max = b;
    }
    else{
        min = b;
        max = a;
    }

    if(max<=min+w)
        printf("%d\n",0);
    else   
        printf("%d\n",max-(min+w));
        
        return 0;
}

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

int main(void){
  ll x; cin >> x;

  ll bud=100;
  ll count=0;
  while(bud<x){
    count++;
    bud*=1.01;
  }  
  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int a,b;
    cin >> a >> b;
    if (a <= 9 && b <= 9) cout << a * b << endl;
    else cout << -1 << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()

#define MAX_N 1000000

int
main(int argc, char **argv)
{
	int val[MAX_N + 1];
	int n, q;
	int a, v;
	int ai, vi;
	int i;

	scanf("%d %d", &n, &q);
	for (i = 1; i <= n; ++i)
		val[i] = 0;

	a = 1, v = 0;
	while (q--)
	{
		scanf("%d %d", &ai, &vi);
		val[ai] += vi;
		if (vi > 0)
		{
			if (val[ai] > v || (val[ai] == v && ai < a))
			{
				a = ai;
				v = val[ai];
			}
		}
		else
		{
			a = 1, v = 0;
			for (i = n; i >= 1; --i)
			{
				if (val[i] >= v)
				{
					a = i;
					v = val[i];
				}
			}
		}

		printf("%d %d\n", a, v);
	}

	return 0;
}

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

long long a,b,ind=1;
char white='.',black='#';

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

    cin>>a>>b;

    cout<<100<<" "<<100<<endl;

    for(long long i=1;i<=50;i++)
    {
        for(long long j=1;j<=100;j++)
        {
            if(b==1)
                cout<<white;
            else
                if(i%2==0&&j%2==0)
                {
                    cout<<black;
                    b--;
                }
                else
                    cout<<white;
        }
        cout<<endl;
    }
    for(long long i=1;i<=50;i++)
    {
        for(long long j=1;j<=100;j++)
        {
            if(a==1)
                cout<<black;
            else
                if(i%2==0&&j%2==0)
                {
                    cout<<white;
                    a--;
                }
                else
                    cout<<black;
        }
        cout<<endl;
    }

    return 0;
}


Measured memory_bytes: 3656
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def Z_algorithm(s):
        n = len(s)
        z = [0]*n
        z[0] = n
        j = 0
        for i in range(1,n):
            while i+j < n and s[j] == s[i+j]:
                j += 1
            z[i] = j
            if j == 0:
                i += 1
                continue
            k = 1
            while i+k < n and k+z[k] < j:
                z[i+k] = z[k]
                k += 1
            i += k
            j -= k
        return z
    n = I()
    s = input()
    ans = 0
    for i in range(n):
        z = Z_algorithm(s[i:])
        for j in range(i,n):
            l = min(j-i,z[j-i])
            if ans < l:
                ans = l
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 52316
def main():
    N, M = (int(i) for i in input().split())
    X = [int(i) for i in input().split()]
    if N >= M: 
        print(0)
    elif N < M: 
        X.sort()
        diff = [[0,0] for _ in range(M-1)]
        for i in range(M-1):
            diff[i] = [X[i+1] - X[i],i]
        diff.sort(reverse=True)
        diff = diff[:N-1]
        diff.sort(key=lambda p:p[1])

        ans = 0
        cnt = 0
        for i in range(N-1):
            ans += X[diff[i][1]] - X[cnt]
            cnt = diff[i][1] + 1
        ans += X[-1] - X[cnt]
        print(ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 72616
#include <atcoder/math>
#include <cstdio>
using ll = int64_t;
#define rep(i, j, n) for (size_t i = 0; i < (int)n; ++i)

int main() {
  int t;
  scanf("%d", &t);
  ll n, m, a, b;
  while (t--) {
    scanf("%lld%lld%lld%lld", &n, &m, &a, &b);
    printf("%lld\n", atcoder::floor_sum(n, m, a, b));
  }
}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <chrono>

using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)

#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pi pair<ll,ll>
#define pii pair<ll,pi >
#define ppi pair<pi,ll>
#define ppp pair<pi,pi >
#define ex(str,a,b) str.substr((int)(a),min((int)str.size()-a,(int)(b-a+1))) 
#define all(X) X.begin(),X.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// for pair comparison function(ascending order) use return (i1.ff < i2.ff);

/* string operations :
   str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
   __builtin_popcount(n) : no. of set bits in n.
*/

const int M = (1<<20)+5;
const int md = 1e9+7;

priority_queue<ll,vector<ll >,greater<ll > > pq;

ll pwr(ll a,ll n,ll m)
{
	ll p=1;
	while(n>0)
	{
		if(n%2==1)
			p=(p*a)%m;
		a=(a*a)%m;
		n=n/2;
	}
	return p;
}

int cnt[10*M];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n,i,j,ans = 0;
	cin >> n;
	for(i=1;i<=n;++i)
	{
		for(j=i;j<=n;j+=i)
			cnt[j]++;
	}

	for(i=1;i<=n;++i)
		ans += i*cnt[i];

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

	

Measured memory_bytes: 42752
def prime(i):
    if i == 2:
        return True
    else:
        if i % 2 == 0:
            return False
        for j in range(3, int(i**0.5)+1, 2):
            if i % j == 0:
                return False
        return True

Q = int(input())
l_r = [[int(_) for _ in input().split()] for _ in range(Q)]
Csum = [0]*(10**5+1)
cnt = 0

for i in range(3, 10**5, 2):
    if prime(i) and prime((i+1)//2):
        cnt += 1
    Csum[i] = cnt

for i in l_r:
    print(Csum[i[1]]-Csum[i[0]-2])

Measured memory_bytes: 23148
import sys

# Nの読み込み
N = int(input())

# sを読み込み，1文字づつリストへ流す
str_list = list(input())

# Rの数を数える
# Bの数はN-R_num
R_num = 0
for s in str_list:
    if s=='R':
        R_num += 1

# R_num, B_numを比較
if R_num > (N-R_num):
    print('Yes')
else:
    print('No')


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

#define ll long long
#define ull unsigned long long
#define vii vector<int>
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pdd pair<double,double>
#define pldld pair<long long double, long long double>
#define ff first
#define ss second
#define pb push_back
#define read freopen("alu.txt","r",stdin);
#define write freopen("vorta.txt","w",stdout);
#define fastio ios::sync_with_stdio(false); cin.tie(NULL);
#define PI 2*acos(0.0)
#define DEBUG(x) cerr << #x << " = " << x << endl

const int MAX = 2e6 + 5, MOD = 1e9 + 7  , MAXLG = log2(MAX)+1;
const ll inf = 1e18 + 5;

ll arr[MAX];
int main(){

    fastio;
    int n,m;
    cin>>n>>m;
    ll sum = 0;
    for(int i=0; i<n; i++){
        cin>>arr[i];
        sum += arr[i];
    }
    sort(arr, arr+n, greater<ll>());
    bool ok = true;
    for(int i=0; i<m; i++){
        if(4*m*arr[i] < sum){
            ok = false;
            break;
        }
    }
    if(ok) cout<<"Yes\n";
    else cout<<"No\n";
}


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

int main(){
    int A, B, K;
    cin >> A >> B >> K;

    if((B - A + 1)/2 >= K){
        for(int i = 0; i < K; i++){
            cout << A + i << endl;
        }
        for(int j = B - K + 1; j <= B; j++){
            cout << j << endl;
        }
    }else{
        for(int i = A; i <= B; i++){
            cout << i << endl;
        }
    }
}

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

int main() {
    int N, W;
    cin>>N>>W;
    vector<pair<long, long>> I(N+1, {0, 0});
    vector<vector<long>> DP(100010, vector<long>(N+1, __INT_MAX__));
    REP(i, 1, N+1){
        cin >> I[i].first >> I[i].second;
    }

    REP(i, 0, N){
        DP[0][i] = 0;
    }

    REP(i, 1, N+1){
        REP(v, 0, 100010){
            if(v -I[i].second >= 0) DP[v][i] = min(DP[v][i], DP[v - I[i].second][i-1] + I[i].first);
            DP[v][i] = min(DP[v][i], DP[v][i-1]);
        }
    }
    int ans = 0;    
    REP(v, 0, 100010){
        if(DP[v][N] <= W) ans = max(ans, v);
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 82304
#include <iostream>

using namespace std;

int main()
{
  
    char a,b,c,d;
    cin>>a;
    cin>>b;
    cin>>c;
    cin>>d;
    if(a==b || c==d || b==c )
    {
        cout <<"Bad";
    }
 
    else
    {
        cout<<"Good";
    }
 
 
    return 0;
}

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

void solve(int w,int h);

int main(void){
  int w,h;
  while(scanf("%d%d",&w,&h) && w && h){
    solve(w,h);
  }
  return 0;
}

void solve(int w,int h){
  unsigned short map[52][52];
  struct q{
    short ii,jj;
  }next[20000];
  int i,j,k,di,dj;
  int q_num,island;
  bool flg=true;

  for(i=0;i<52;i++) for(j=0;j<52;j++) map[i][j]=0;

  for(i=1;i<=h;i++) for(j=1;j<=w;j++) scanf("%hu",&map[i][j]);

  for(island=2;flg;island++){
    flg=false;
    for(i=1;i<=h && !flg ;i++)
      for(j=1;j<=w && !flg;j++) if(map[i][j]==1) flg=true;
    if(!flg) continue;

    next[0]=(struct q){i-1,j-1};
    map[i-1][j-1]=island;

    for(q_num=1,i=0;i<q_num;i++){
      for(di=-1;di<=1;di++){
	for(dj=-1;dj<=1;dj++){
	  if(map[next[i].ii+di][next[i].jj+dj]==1){
	    next[q_num++]=(struct q){next[i].ii+di,next[i].jj+dj};
	    map[next[i].ii+di][next[i].jj+dj]=island;
	  }
	}
      }
    }
  }
  printf("%d\n",island-3);
}

Measured memory_bytes: 620
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

bool f(vector<int> H, int value, int A, int B) {
	for (int i = 0; i < H.size(); ++i) {
		if (H[i] / B > value - 1) {
			H[i] -= B*value;
		}
		else {
			H[i] = 0;
		}
	}
	int cnt = 0;
	for (int i = 0; i < H.size(); ++i) {
		if (H[i] > 0) {
			cnt += (H[i] / (A - B));
			cnt += min(H[i] % (A - B), 1);
			if (cnt > value) return false;
		}
	}
	return cnt <= value;
}

int main(void) {
	int N, A, B; cin >> N >> A >> B;
	vector<int> H(N); for (auto &a : H) cin >> a;
	int low = 0;
	int high = 1e9 + 1;
	while (high - low > 1) {
		int mid = (high + low) / 2;
		if (f(H, mid, A, B)) {
			high = mid;
		}
		else {
			low = mid;
		}
	}
	cout << high << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime MOD
    mint inv() const { return pow(MOD-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination MOD prime
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
    mint p(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[n-k];
    }
}; //comb(10000007);
// comb(5, 2) → 10, comb.p(5, 2) → 20
// comb.fact[4] → 24, 2のN乗 → mint(2).pow(N)

template<typename T>
struct BIT {
    int n;
    vector<T> d;
    BIT(int n=0):n(n), d(n+1) {}
    void add(int i, T x=1) {
        for (i++; i <= n; i += i&-i) {
            //i&-iで最下位bitを足している
            d[i] += x;
        }
    }
    T sum(int i) {
        T x = 0;
        for (i++; i; i -= i&-i) {
            x += d[i];
        }
        return x;
    }
    T semiopenSum(int l, int r) {
        // [l,r)の半開区間
        return sum(r-1) - sum(l-1);
    }
};  // BIT<int> bit(N);

mint dp[200005];

int main() {
    // dp、Kが小さい、BIT
    // L と　Rに注目
    int N, K;
    cin >> N >> K;
    vector<P> LR(K);
    rep(i, K) cin >> LR[i].first >> LR[i].second;
    BIT<mint> bit(N);
    bit.add(0);
    dp[0] = 1;
    for (int i = 1; i <= N; i++) {
        for (auto p : LR) {
            if (i - p.first < 0) continue;
            int left = i - p.second, right = i - p.first;
            if (left < 0) left = 0;
            dp[i] += bit.semiopenSum(left, right+1);
        }
        bit.add(i, dp[i]);
    }
    cout << dp[N-1] << '\n';
    return 0;
}


Measured memory_bytes: 6424
#include<bits/stdc++.h>
#define MAXN 1000005
#define P int(998244353)
using namespace std;
typedef long long ll;

int N,M;
ll fac[MAXN], ifac[MAXN];

ll qpow(ll x, int n){
	ll res = 1;
	while(n){
		if(n&1) res = res * x % P;
		x = x * x % P;
		n /= 2;
	}
	return res;
}

void init(){
	fac[0] = ifac[0] = 1;
	for(int i=1;i<=N+M;i++){
		fac[i] = fac[i-1] * i % P;
		ifac[i] = qpow(fac[i], P-2);
	}
}

ll comb(int n, int k){
	if(k > n) return 0;
	return fac[n] * ifac[k] % P * ifac[n-k] % P;
}


int main(){

//	freopen("1.in", "r", stdin);
//	freopen("1.ans", "w", stdout);

 	cin>>N>>M;
 	if(N < M) swap(N,M);
 	init();
 	
 	ll ans = 0;
 	for(int i=1;i<=M;i++){
 		ans = (ans + comb(N+M-2*i,M-i) * comb(2*i,i) % P) % P;
	}
 	ans = ans * qpow(comb(N+M, M), P-2) % P * qpow(2, P-2) % P;
 	ans = (ans + N) % P;
 	
    cerr<<"ans = "<<ans<<endl;
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 19276
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (n); i++)
 
int main() {
    string S;
    cin >> S;
    if(S == "AAA" || S == "BBB"){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  ll N, b, a = 1LL << 60;
  cin >> N;
  for (int i=0; i<5; i++) {
    cin >> b;
    a = min(a, b);
  }
  cout << (N + a - 1) / a + 4 << endl;
}

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

int main()
{
    int  abc[3];
    for (int i = 0; i < 3; i++){
        cin >> abc[i];
    }
    sort(abc, abc+3);
    cout << abc[0] << " "<< abc[1] << " "<< abc[2] << endl;
}


Measured memory_bytes: 3116
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n															#“親“要素を格納

	def find(self, x):																		#要素xが属するグループの根を返す
		if self.parents[x] < 0:															#正負で根かどうか判断。負なら根。
			return x
		else:
			self.parents[x] = self.find(self.parents[x])			#自己ループ
			return self.parents[x]

	def union(self, x, y):																#要素x、yを同じグループに併合する
		x = self.find(x)
		y = self.find(y)

		if x == y:
			return

		if self.parents[x] > self.parents[y]:
			x, y = y, x

		self.parents[x] += self.parents[y]									#根がどんどん深くなる
		self.parents[y] = x

	def size(self, x):																		#要素xが属するグループのサイズを返す
		return -self.parents[self.find(x)]

	def same(self, x, y):																	#要素x、yが同じグループに属するかどうかを返す
		return self.find(x) == self.find(y)

	def members(self, x):																	#要素xと同じグループに属する要素をリストで返す
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def roots(self):																			#全ての根の要素をリストで返す
		return [i for i, x in enumerate(self.parents) if x < 0]

	def group_count(self):																#グループの数を返す
		return len(self.roots())

	def all_group_members(self):													#{ルート要素：[そのグループに含まれる要素のリスト]…}の辞書
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):																		#ルート要素：[そのグループに含まれる要素のリスト]を文字列で
		return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
		


n,m,k=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(m)]
CD=[list(map(int,input().split())) for _ in range(k)]

U=UnionFind(n)

for a,b in AB:
	U.union(a-1,b-1)
	
res=[0]*n
for i in range(n):
	res[i]=U.size(i)-1
for a,b in AB:
	res[a-1]-=1
	res[b-1]-=1
for c,d in CD:
	if U.same(c-1,d-1):
		res[c-1]-=1
		res[d-1]-=1

print(*res)

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

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

	int ans, y;
	double x, z;

	x = n / 1.08;
	ans = (int)x;
	z = ans * 1.08;
	y = (int)z;

	if (y == n) cout << ans << endl;
	else {
		ans++;
		z = ans * 1.08;
		y = (int)z;
		if (y == n) cout << ans << endl;
		else cout << ":(" << endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int a, b;
	scanf("%d%d", &a, &b);
	int max = a+b;
	if(max < a-b) max = a-b;
	if(max < a*b) max = a*b;
	
	printf("%d", max);
	
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int i,j,s,n,m,a[100][100],b[100],c[100];

  scanf("%d%d",&n,&m);

  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%d",&a[i][j]);
    }
  }
  for(i=0;i<m;i++){
    scanf("%d",&c[i]);
  }
  for(i=0;i<n;i++){
    s = 0;
    for(j=0;j<m;j++){
      s += a[i][j] * c[j];
    }
    printf("%d\n",s);
  }
  
  return 0;
}


Measured memory_bytes: 2096
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define boost ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define pii pair<int,int>
#define forn(i,n) for(int i=0;i<n;i++)
#define Forn(i,n) for(int i=1;i<=n;i++)
#define F first
#define S second
int main()
{
      boost;
      int a,b,c,d;
      cin>>a>>b>>c>>d;
      cout<<min(a,b)+min(c,d)<<endl;
      
}


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

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;

bool prime[10101];

void mainmain(){
	rep(i,10101) prime[i]=true;
	prime[0]=prime[1]=false;
	for(int i=2;i*i<10101;i++){
		if(prime[i]){
			for(int j=i*i;j<10101;j+=i){
				prime[j]=false;
			}
		}
	}
	int n;
	while(cin>>n){
		int ans=0;
		rep(i,n){
			if(prime[i+1]&&prime[n-i]) ans++;
		}
		cout<<ans<<endl;
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

Measured memory_bytes: 1172
def solve(n):
    import math
    m = 26
    nn = n - 1
    for i in range(1, m + 1):
        p = m ** i
        if p > nn:
            break
        nn -= p
    s = ''
    for j in range(1, i + 1):
        p = m ** (i - j)
        x, nn = divmod(nn, p)
        s += chr(x + ord('a'))
    return s

def main(istr, ostr):
    n, = list(map(int, istr.readline().strip().split()))
    result = solve(n)
    print(result, file=ostr)


if __name__ == "__main__":
    import sys

    main(sys.stdin, sys.stdout)


Measured memory_bytes: 9208
//Bismillah_hir_rahmanir_rahim

#include <bits/stdc++.h>
using namespace std;


int main()
{

  int a,b;
  cin>>a>>b;
  if(a<=8 && b<=8)
  {
      printf("Yay!\n");
  }
  else{
    printf(":(\n");  
  }

    

    return 0;
}


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

using namespace std;

inline int read()
{
	int sum=0,ff=1; char ch=getchar();
	while(!isdigit(ch))
	{
		if(ch=='-') ff=-1;
		ch=getchar();
	}
	while(isdigit(ch))
		sum=sum*10+(ch^48),ch=getchar();
	return sum*ff;
}

const int mod=1e9+7;
int n,m,bin[1000005],inv[1000005];

inline int ksm(int x,int y)
{
	int ret=1ll;
	while(y)
	{
		if(y&1) ret=ret*x%mod;
		x=x*x%mod;
		y>>=1ll;
	}
	return ret;
}

inline int C(int x,int y)
{
	return bin[x]%mod*inv[x-y]%mod*inv[y]%mod;
}

signed main()
{
	n=read();
	m=read();
	bin[0]=1,inv[0]=1;
	for ( int i=1;i<=n;i++ ) bin[i]=bin[i-1]*i%mod;
	for ( int i=1;i<=n;i++ ) inv[i]=ksm(bin[i],mod-2)%mod;
	int ans=1;
	for ( int i=1;i<n;i++ ) 
		if(n-i<=m)
			ans=(ans+C(n,i)*C(n-1,i-1)%mod+mod)%mod;
	printf("%lld\n",ans);
	return 0;
}
	

Measured memory_bytes: 5888
// https://atcoder.jp/contests/abc152/tasks/abc152_b
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    REP(i, max(a, b)) { cout << min(a, b); }
    cout << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <bits/stdc++.h>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)

//using namespace std;


int main(){
  int b,p;cin>>b>>p;
  long long ans=pow(p-1,b-1);
  ans=ans*p;
  cout<<ans<<endl;



}

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  string s; cin >> s;
  int ans = INF;
  REP(i, s.length()-2) {
    int temp = 100 * (s[i] - '0') + 10 * (s[i + 1] - '0') + (s[i + 2] - '0');
    ans = min(ans, abs(753 - temp));
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
#[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, 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,
        k: f64,
    }

    let num = n as f64;
    let mut ans = 0.0;
    for i in 1..n+1 {
        if k as usize <= i {
            ans = ans +  1.0;
        } else {
            ans = ans + (0.5 as f64).powf((k/i as f64).log2().ceil());
        }
    }

    println!("{}", ans/num);
}


Measured memory_bytes: 4476
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return y; else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x);y>>=1;if(y<=0)break;x=(x*x);}return res;}

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

Measured memory_bytes: 256
// Problem : C - H and V
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_c
// Memory Limit : 1024 MB
// Time Limit : 1000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

inline int gi()
{
    int f = 1, x = 0; char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return f * x;
}

inline LL gl()
{
    LL f = 1, x = 0; char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return f * x;
}

const int INF = 0x3f3f3f3f, N = 10, M = N << 1;

int n, m, k;
char s[N][N], g[N][N];
bool vis[N + N];
LL ans;

inline void check()
{
	memcpy(g, s, sizeof g);
	for (int i = 1; i <= n; i+=1)
		if (vis[i])
		{
			for (int j = 1; j <= m; j+=1)
				g[i][j] = 'R';
		}
	for (int i = n + 1; i <= n + m; i+=1)
		if (vis[i])
		{
			for (int j = 1; j <= n; j+=1)
				g[j][i - n] = 'R';
		}
	int cnt = 0;
	for (int i = 1; i <= n; i+=1)
		for (int j = 1; j <= m; j+=1)
			if (g[i][j] == '#')
				++cnt;
	if (cnt == k) ++ans;
}

void dfs(int u)
{
	if (u > n + m) {check(); return;}
	vis[u] = false;
	dfs(u + 1);
	vis[u] = true;
	dfs(u + 1);
	vis[u] = false;
}

int main()
{
    //File("");
    n = gi(), m = gi(), k = gi();
    for (int i = 1; i <= n; i+=1)
    	scanf("%s", s[i] + 1);
    dfs(1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3744
//
//  max_volume.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <string>
#include <iomanip>
int main(int argc, const char* argv[]) {
  float l;
  std::cin >> l;
  // std::cout.precision(6);
  // std::cout << (l/3)*(l/3)*(l/3) << std::endl;
  printf("%f\n", (l/3)*(l/3)*(l/3));

}

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

unsigned long long dp[90];

unsigned long long fibo(unsigned long long x)
{
	if(x==0) return 2;
	else if(x==1) return 1;
	if(dp[x]!=-1)
		return dp[x];
	dp[x]=fibo(x-1)+fibo(x-2);
	return dp[x];
}

int main(){
	long long a,b;
	cin>>a;
	memset(dp,-1,sizeof dp);
	b=fibo(a);
	cout<<b<<endl;
	return 0;
}

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

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

	map<string, vector<int>> idx;

	string word;
	int page;
	while(cin >> word >> page) {
		idx[word].emplace_back(page);
	}

	for(auto &word_info : idx) {
		cout << word_info.first << "\n";

		vector<int> &pages = word_info.second;
		sort(pages.begin(), pages.end());
		pages.erase(unique(pages.begin(), pages.end()), pages.end());

		for(unsigned i = 0; i < pages.size(); ++i) {
			cout << pages[i] << (i + 1 == pages.size() ? "\n" : " ");
		}
	}

	return 0;
}

Measured memory_bytes: 1240
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000003
#define INF2 1000000000000000000
#define int long long 
int F[2100010];

int Mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

void fact(void) {
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i <= 2100000; i++) {
		F[i] = Mul(i, F[i - 1]);
	}
}
int square(int x) {
	return (x * x) % mod;
}

int power(int x, int y) {
	if (y == 0) return 1;
	else if (y == 1) return x % mod;
	else if (y % 2 == 0) return square(power(x, y / 2)) % mod;
	else return square(power(x, y / 2)) * x % mod;
}

int Div(int a, int b) {
	return Mul(a, power(b, mod - 2));
}
int P(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return Div(F[n], F[n - r]);
}

int C(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	int ret;
	ret = Div(F[n], Mul(F[n - r], F[r]));
	return ret;
}
int H(int n, int r) {
	if (n == 0 && r == 0) return 1;
	return C(n + r - 1, r);
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    fact();
    int Q; cin >> Q;
    while(Q--) {
        int x, d, n;
        cin >> x >> d >> n;
        if (d == 0) {
            cout << power(x, n) << endl;
            continue;
        } 
        x = Div(x, d);
        if (x + n - 1 >= mod) {
            cout << 0 << endl;
            continue;
        }
        //cout << x << " " << x + n - 1 << " ";
        cout << Mul(Div(F[x + n - 1], F[x - 1]), power(d, n)) << endl;
    }

    return 0;
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long

int main() {
  int n ;
  cin >> n ;
  vector<int> v(n);
  int four = 0 ;
  int two  = 0;
  int no = n;
  string ans = "No";
  
  rep(i,n){
    cin>> v.at(i);
    if(v.at(i) % 4 == 0) four ++ ;
    if(v.at(i) % 2 == 0) two  ++ ;
  }
  
  no -= two ;
  two -= four;
  
  if(two == 0){
    if(four + 1 - no >= 0 ) ans ="Yes";
  }
  else 
    if(four >= no) ans ="Yes";
 
  
  cout <<ans ;

}


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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

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

int main() {
    ll n;cin >> n;
    vector<pair<ll,ll>> xl;
    rep(i,n){
        ll a,b;
        cin >> a >> b;
        xl.push_back(make_pair(a,b));
    }

    for(ll i=0;i<n;i++){
        ll x,l;
        tie(x,l) = xl[i];
        xl[i].first = x - l;
        xl[i].second = x + l;
    }

    sort(ALL(xl),[](auto a,auto b){
        return a.second < b.second;
    });

    ll end = -INF;
    ll cnt = 0;
    for(ll i=0;i<n;i++){
        if(xl[i].first >= end)end = xl[i].second;
        else cnt++;
    }
    cout << n - cnt << endl;
    return 0;
}


Measured memory_bytes: 2420
K = int(input())
def calc(a, b):
    if abs(X-a)+abs(Y-b) >= 2*K:
        if abs(X-a) >= K:
            r1 = K if X > a else -K
        else:
            r1 = abs(X-a) * (1 if X > a else -1)
        r2 = (K-abs(r1)) * (1 if Y > b else -1)
    elif abs(X-a)+abs(Y-b) == K:
        r1, r2 = X-a, Y-b
    else:
        rr = 2*K - abs(X-a)-abs(Y-b)
        rr = 0 if rr % 2 else rr//2
        if abs(X-a) < abs(Y-b):
            r1 = (abs(X-a)+rr) * (1 if X > a else -1)
            r2 = (K-abs(r1)) * (1 if Y > b else -1)
        else:
            r2 = (abs(Y-b)+rr) * (1 if Y > b else -1)
            r1 = (K-abs(r2)) * (1 if X > a else -1)
    return (a+r1, b+r2)

x, y = 0, 0
X, Y = map(int, input().split())
if K % 2 == 0 and (X+Y) % 2:
    print(-1)
else:
    ANS = []
    while x != X or y != Y:
        x, y = calc(x, y)
        ANS.append((x, y))

    print(len(ANS))
    for ans in ANS:
        print(*ans)


Measured memory_bytes: 59392
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
signed main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    int r; cin>>r;
    cout << r*r << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define pb push_back
using namespace std;
const int DN=1e5+5,M=1e9+7;
int n,f,g,dp[2][DN],viz[DN];
vector<int>v[DN];
void dfs(int nod)
{
	int frunza=1;
	viz[nod]=1;
	dp[0][nod]=dp[1][nod]=1;
	for(auto i:v[nod])
		if(!viz[i])
		{
			frunza=0;
			dfs(i);
			dp[0][nod]=(1LL*dp[0][nod]*(dp[0][i]+dp[1][i]))%M;
			dp[1][nod]=(1LL*dp[1][nod]*dp[0][i])%M;
		}
}
int main() 
{
	cin>>n;
	for(int i=1;i<n;i++)
	{
		cin>>f>>g;
		v[f].pb(g);
		v[g].pb(f);
	}
	dfs(1);
	cout<<(dp[0][1]+dp[1][1])%M;
}

Measured memory_bytes: 11008
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let p: Vec<i32> = (0..n).map(|_| read()).collect();
    let q: Vec<i32> = (0..n).map(|_| read()).collect();
    let permutation = permutation(&(1..n as i32 + 1).collect::<Vec<i32>>());
    let p_position = permutation.iter().position(|x| *x == p).unwrap();
    let q_position = permutation.iter().position(|x| *x == q).unwrap();
    println!(
        "{}",
        if p_position > q_position {
            p_position - q_position
        } else {
            q_position - p_position
        }
    );
}

fn permutation<T: Clone + Copy>(x: &Vec<T>) -> Vec<Vec<T>> {
    if x.len() == 1 {
        vec![x.clone()]
    } else {
        let mut result = vec![];
        for i in 0..x.len() {
            let mut tmp = x.clone();
            tmp.remove(i);
            for mut x_i in permutation(&tmp) {
                x_i.insert(0, x[i]);
                result.push(x_i);
            }
        }
        result
    }
}
#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	pair<pair<long long,long long>,int> l[n],r[n];
	long long a,b;
	for (int i = 0; i < n; ++i)
	{
		cin>>a>>b;
		l[i]={{b,a},i};
		r[i]={{-a,-b},i};
	}
	sort(l,l+n);
	sort(r,r+n);
	int memo[n]={},nl=0,nr=0;
	long long ans1=0LL,ans2=0LL,now=0LL;
	for (int i = 0; i < n; ++i)
	{
		if (i%2==0)
		{
			while(memo[l[nl].second]==1)
			{
				++nl;
			}
			memo[l[nl].second]=1;
			if (l[nl].first.second<=now&&now<=l[nl].first.first)
			{
				continue;
			}
			ans1+=abs(now-l[nl].first.first);
			now=l[nl].first.first;
		}
		else
		{
			while(memo[r[nr].second]==1)
			{
				++nr;
			}
			memo[r[nr].second]=1;
			if (-r[nr].first.first<=now&&now<=-r[nr].first.second)
			{
				continue;
			}
			ans1+=abs(now+r[nr].first.first);
			now=-r[nr].first.first;
		}
	}
	ans1+=abs(now);
	for (int i = 0; i < n; ++i)
	{
		memo[i]=0;
	}
	now=0LL;
	nl=0;
	nr=0;
	for (int i = 0; i < n; ++i)
	{
		if (i%2==1)
		{
			while(memo[l[nl].second]==1)
			{
				++nl;
			}
			memo[l[nl].second]=1;
			if (l[nl].first.second<=now&&now<=l[nl].first.first)
			{
				continue;
			}
			ans2+=abs(now-l[nl].first.first);
			now=l[nl].first.first;
		}
		else
		{
			while(memo[r[nr].second]==1)
			{
				++nr;
			}
			memo[r[nr].second]=1;
			if (-r[nr].first.first<=now&&now<=-r[nr].first.second)
			{
				continue;
			}
			ans2+=abs(now+r[nr].first.first);
			now=-r[nr].first.first;
		}
	}
	ans2+=abs(now);
	cout<<max(ans1,ans2)<<endl;
	return 0;
}


Measured memory_bytes: 5376
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  int a;cin>>a;
  string s;cin>>s;

  if(a>=3200)out(s)
  else out("red")

  return 0;
}


Measured memory_bytes: 256
n=int(input())
s1=input()
s2=input()
if n==1:
    print(3)
    exit()
s=""
i=0
while i<n:
    if s1[i]==s2[i]:
        s+="1"
        i+=1
    else:
        s+="2"
        i+=2
ans=0
if s[0]=="1":
    ans+=3
else:
    ans+=6
before=s[0]
for j in range(1,len(s)):
    if before=="1":
        if s[j]=="1":
            ans*=2
        else:
            ans*=2
    else:
        if s[j]=="2":
            ans*=3
    before=s[j]
print(ans%(10**9+7))


Measured memory_bytes: 3064
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut it = s.split_whitespace();
	let n: usize = it.next().unwrap().parse().unwrap();
	let q: usize = it.next().unwrap().parse().unwrap();
	let mut rw = Vec::with_capacity(n);
	for _ in 0..n {
		let s: i32 = it.next().unwrap().parse().unwrap();
		let t: i32 = it.next().unwrap().parse().unwrap();
		let x: i32 = it.next().unwrap().parse().unwrap();
		rw.push((s, t, x));
	}

	let mut e = vec![];
	for (s, t, x) in rw {
		let l = s - x;
		let r = t - x;
		e.push((l, x));
		e.push((r, -x));
	}
	e.sort();

	use std::io::Write;
	let out = std::io::stdout();
	let mut out = out.lock();
	let mut set = std::collections::BTreeSet::new();
	let mut e = e.into_iter().peekable();
	for d in it.take(q).map(|a| a.parse::<i32>().unwrap()) {
		while match e.peek() {
			Some(e) if e.0 <= d => true,
			_ => false,
		} {
			let e = e.next().unwrap();
			if e.1 > 0 {
				set.insert(e.1);
			} else {
				set.remove(&(-e.1));
			}
		}
		writeln!(out, "{}", set.iter().next().unwrap_or(&-1)).unwrap();
	}
}


Measured memory_bytes: 15308
#include <stdio.h>
#include <bits/stdc++.h>
  
#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 mp(a, b) make_pair(a, b)
  
using namespace std;
  
const int N = 1000000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int PPP = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;
  
int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    //ll TL = 2.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int n;
    cin >> n;
    map<int, int> m;
    rep(i, 0, n)
    {
        int x;
        cin >> x;
        m[x]++;
    }
    vector<int> a;
    for (auto it : m)
        if (it.se >= 4)
        {
            a.push_back(it.fi);
            a.push_back(it.fi);
        }
        else if (it.se >= 2)
        {
            a.push_back(it.fi);
        }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    if (sz(a) < 2)
        cout << 0 << "\n";
    else
        cout << (ll)a[0] * a[1] << "\n";
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <functional>
using namespace std;

typedef long long ll;

ll a[100003], sum[100003];
bool flag[100003];

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; ++i) cin >> a[i];
	a[n] = 1e9;
	sort(a, a + n);
	sum[0] = a[0];
	for (int i = 1; i < n; ++i) sum[i] = sum[i - 1] + a[i];
	flag[n - 1] = flag[n] = true;
	int ans = 1;
	for (int i = n - 2; i >= 0; --i) {
		int ind = upper_bound(a, a + n, 2 * sum[i]) - a;
		--ind;
		flag[i] = flag[ind];
		if (flag[i]) ++ans;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1920
#include <iostream>
                using namespace std;
     
                int main() {
                	// your code goes here
                	int h,n,a,i;
                	cin>>h>>n;
                	for(i=0;i<n;i++)
                	{
                		cin>>a;
                		h-=a;
                	}
                	if(h<=0) cout<<"Yes"<<endl;
                	else cout<<"No"<<endl;
                	return 0;
                }

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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 main() {
  int N;
  scanf("%d", &N);
  int b[N-1];
  for (int i = 0; i < N-1; ++i) {
    scanf("%d", &b[i]);
  }

  int ans[N];
  int sum = 0;

  sum += b[0];


  FOR(i,1,N-2){
    sum += min(b[i-1],b[i]);
  }

  sum += b[N-2];

  cout << sum << endl;



}

Measured memory_bytes: 256