akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define in insert
#define rep(i,a,b) for(int i = a ; i < b ; i++)
#define repr(i,a,b) for(int i = b ; i > a ; i--) 
 
signed main(){
    fast;
    int a, b, c, d, i=0;
    cin >> a>> b>> c>>d;
    while(a>0 && c>0){
        if(i%2==1)
            a-=d;
        else
            c-=b;
        i++;
    }
    if(a<=0)
        cout << "No";
    else
        cout << "Yes";
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
#define _GLIBCXX_DEBUG
 
int main() {
  string s, t;
  bool ans = 1;
  cin >> s >> t;
 
  if(s.size() == t.size()-1) {
    for(int i = 0; i < s.size(); i++) {
        if(s[i] == t[i]) continue;
        else { ans = 0; break; }
    }
    }
  
  else ans = 0;
  
  if(ans == 1) cout << "Yes" << endl;
  else if(ans == 0) cout << "No" << endl; 
}

Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while(true) {

			int n = sc.nextInt();
			int m = sc.nextInt();
			int p = sc.nextInt();

			if(n == 0 && m == 0 && p ==0) {
				break;
			}
			int [] x = new int[n];
			int ticketSum = 0;
			for(int i = 0; i < n; i++) {
				x[i] = sc.nextInt();
				ticketSum += x[i];
			}

			int backGold = ticketSum * (100-p);
			int ans = 0;

			if(x[m-1] != 0) {
			ans = backGold/x[m-1];
			}

			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 36108
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n;
    cin >> n;
    vector<ll> z(n);
    for (int i = 0; i < n; i++) {
        cin >> z[i];
    }
    ll ok = 100000000000000;
    ll ng = 1;
    while (ok - ng > 1) {
        ll mid = (ok + ng) / 2;
        ll zmid = mid;
        for (int i = 0; i < n; i++) {
            zmid /= z[i];
            zmid *= z[i];
        }
        if (zmid >= 2)ok = mid;
        else ng = mid;
    }
    ll ook = 1;
    ll nng = 100000000000000;
    while (nng - ook > 1) {
        ll mid = (ook + nng) / 2;
        ll zmid = mid;
        for (int i = 0; i < n; i++) {
            zmid /= z[i];
            zmid *= z[i];
        }
        if (zmid <= 2)ook = mid;
        else nng = mid;
    }
    if (ook - ok == -1)cout << -1 << endl;
    else {
        cout << ok << " " << ook << endl;
    }
}

Measured memory_bytes: 4004
import java.lang.reflect.Array;
import java.util.*;


public class Main {
    static boolean[] isPrime;
    static int[] sumOf2017ishNum;

    static void createPrimeNumberList(int primeNumMax){
        isPrime = new boolean[primeNumMax+1];
        HashSet<Integer> checkedNumbers = new HashSet<Integer>();
        for(int i = 0; i <= primeNumMax; i++){
            if(checkedNumbers.contains(i) || i < 2){
                isPrime[i] = false;
            }else{
                isPrime[i] = true;
                int currentNum = i;
                while(currentNum <= primeNumMax){
                    checkedNumbers.add(currentNum);
                    currentNum += i;
                }
            }
        }
    }

    static void calculateSumOf2017ish(int primeNumMax){
        sumOf2017ishNum = new int[primeNumMax+1];
        sumOf2017ishNum[0] = 0;
        for(int i = 1; i <= primeNumMax; i++){
            int p = (i+1) / 2;
            if(isPrime[i] && isPrime[p]){
                sumOf2017ishNum[i] = sumOf2017ishNum[i-1] + 1;
            }else {
                sumOf2017ishNum[i] = sumOf2017ishNum[i-1];
            }
        }
    }

    static void solve(){
        Scanner sc = new Scanner(System.in);
        int primeNumMax = 100000;
        createPrimeNumberList(primeNumMax);
        calculateSumOf2017ish(primeNumMax);
        int n = sc.nextInt();
        for (int i = 0; i < n; i++){
            int l = sc.nextInt();
            int r = sc.nextInt();
            int count = sumOf2017ishNum[r] - sumOf2017ishNum[l-1];
            System.out.println(count);
        }
    }
    public static void main(String[] args){
        solve();
    }
}


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

using namespace std;

int main() {
	int n;
	cin >> n;
	int arr[n];
	for(int i = 0 ; i <n; i++){
		cin >> arr[i];
	}
	int count = 0;
	for(int i = 0; i < n;i++){
		if (arr[i] % 2 == 0){
			while (arr[i] % 2 == 0){
				arr[i] = arr[i] * 3;
				arr[i] = arr[i] / 2;
				count++;
			}
		}
		else {
			continue;
		}
	}

cout << count << endl;
}


Measured memory_bytes: 3648
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                    \
    sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
    {
sim > struct rge
{
    c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
    ~debug()
    {
        cerr << endl;
    }
    eni(!=) cerr << boolalpha << i;
    ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
    sim dor(const c &)
    {
        ris;
    }
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 10;
ll n;
ll k;
ll arr[100005];
ll dp[100005];
ll ans=1e18;
vector<ll>v;
ll dfs(ll x)
{
    if(x==n-1)
    return 0;
    if(x>=n)
    return 1e18;
    if(dp[x]!=-1)
    return dp[x];
    
    ll c=1e18;
    for( int i=1;i<=k;i++)
    {
        //c=1e18;
       if(x+i<n)
      v.push_back(dfs(x+i)+abs(arr[x]-arr[x+i]));
   
    }
    ans=*min_element(v.begin(),v.end());
    v.clear();
   return dp[x]=ans;
   // debug()<<imie(v);
    return 0;
   
}
int main()
{
    fastio
    memset(dp,-1,sizeof dp);
cin>>n>>k;
for(ll i=0;i<n;i++)
{
    cin>>arr[i];
}

cout<<dfs(0)<<endl;
    return 0;
}

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

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





using ll = long long;

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



int n, q;
ll a[maxn];
ll acc[maxn];
ll racc[maxn];

ll solve(ll x) {

    auto p1 = [&](int i) {
	// true if player1 take a[i]
	//   x ..... va
	ll va=a[i];
	ll dist=va-x;
	int j=lower_bound(a,a+n,x-dist)-a;
	int t2=i-j+1;
	int t1=n-i;
	//cout<<i<<": "<<t1<<" "<<t2<<endl;
	return t1<=t2;
    };

    int lo = -1;
    int hi = n-1;
    while (hi-lo>1) {
	int mid = (lo+hi)/2;
	if (p1(mid)) {
	    hi = mid;
	} else {
	    lo = mid;
	}
    }
    int l = hi;

    // p1 gets [l,n-1]
    int turns = n-l;
    int idx = l-1-turns;

    ll res = racc[l] + (idx>=0 ? acc[idx] : 0);
    return res;
}

ll brute(ll x) {
    vector<bool> used(n, false);
    ll res = 0;
    for (int i=0; i<n; i++) {
	if (i%2==0) {
	    int j=n-1;
	    while (j>0 && used[j]) j--;
	    assert(!used[j]);
	    res += a[j];
	    used[j]=true;
	} else {
	    int idx=0;
	    while (used[idx]) idx++;
	    for (int j=0; j<n; j++) {
		if (used[j]) continue;
		if (abs(x-a[j]) < abs(x-a[idx])) {
		    idx=j;
		}
	    }
	    used[idx]=true;
	}
    }
    return res;
}

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

    cin>>n>>q;
    for (int i=0; i<n; i++) {
	cin>>a[i];
	acc[i]=a[i];
	if (i-2>=0) {
	    acc[i]+=acc[i-2];
	}
    }

    for (int i=n-1; i>=0; i--) {
	racc[i]=racc[i+1]+a[i];
    }


    while (q--) {
	int x;
	cin>>x;

	ll res = solve(x);
	// ll bru = brute(x);
	// assert(res==bru);
	// cout<<res<<" ?? "<<bru<<endl;
	cout<<res<<"\n";
    }
    
    
    
    return 0;
}


Measured memory_bytes: 5988
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	vector<long long> a(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	long long ans = 0;
	for (int i = 0; i < n - 1; i++) {
		long long diff = a[i] + a[i+1] - x;
		if (diff > 0) {
			ans += diff;
			long long tmp = min(a[i+1], diff);
			a[i+1] -= tmp;
			diff -= tmp;

			if (diff > 0) {
				a[i] -= diff;
			}
		}
	}

	cout << ans << endl;
	// for (auto x: a) {
	// 	cout << x << " ";
	// }
	// cout << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <math.h>
//#include <numeric>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
#define n_max 100000

#define rep(i,n) for(int i = 0; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl

int main()
{
    int a, b;

    cin >> a >> b;

    if(a >= 13)     { cout << b << endl; }
    else if(a >= 6) { cout << b/2 << endl; }
    else            { cout << 0 << endl; }
    return 0;
}


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

Measured memory_bytes: 128
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

int main()
{
    int a,b,h;
    cin >> a >> b >> h;
    cout << (a+b) * h / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionC
    {
        public struct sc
        {
            public int s;
            public int c;
        }

        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var nm = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            var scArray = new sc[nm[1]];

            for (int i = 0; i < nm[1]; i++) {
                // 整数配列の入力
                var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

                scArray[i] = new sc() { s = input[0], c = input[1] };
            }
            var min = (int)Math.Pow(10, nm[0] - 1);
            if(min == 1) {
                min = 0;
            }

            var max = (int)Math.Pow(10, nm[0]);

            for (int i = min; i < max; i++) {
                var flag = true;

                foreach(var sc in scArray) {
                    var str = i.ToString();
                    var a = str[sc.s - 1];
                    if(a != sc.c.ToString()[0]) {
                        flag = false;
                        break;
                    }
                }
                if (flag) {
                    Console.WriteLine(i);
                    Console.Out.Flush();

                    return;
                }
            }

            Console.WriteLine(-1);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13396
fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let s: String = std::io::Read::bytes(stdin.lock())
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    s.parse().ok().expect("error")
}

fn count_divisor(n: u32) -> u32 {
    let mut res: u32 = 0;
    for i in 1..n+1 {
        if n % i == 0 {
            res += 1;
        }
    }
    res
}

fn main() {
    let n: u32 = input();
    let mut ans = 0;
    for i in 1..n+1 {
        if count_divisor(i) == 8 && i % 2 == 1 {
            ans += 1;
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void)
{
    int h, w;

    while (true)
    {

        cin >> h >> w;
        if (h == 0 && w == 0)
            break;
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 3108
N=int(input())
A=list(map(int,input().split()))
a=0
M=(N-1)//2
sumA=sum(A)
oddA=0
for i in range(M+1):
    oddA+=A[2*i]
x=oddA-sumA//2
#xが最初のやつ
dp=[x]
for i in range(N-1):
    dp.append(A[i]-dp[-1])
for j in range(N):
    print(dp[j]*2,end=' ')

Measured memory_bytes: 14092
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    h, w = LI()
    ch, cw = LI_()
    dh, dw = LI_()
    q = deque()
    s = [None] * h
    c = [None] * h
    for i in range(h):
        s[i] = S()
        c[i] = [inf] * w
    q.append((ch, cw))
    c[ch][cw] = 0
    while q:
        nh, nw = q.popleft()
        now = c[nh][nw]
        for mh, mw in [(0, 1), (1, 0), (-1, 0), (0, -1)]:
            mh += nh
            mw += nw
            if 0 <= mh < h and 0 <= mw < w and c[mh][mw] > now and s[mh][mw] == ".":
                c[mh][mw] = now
                q.appendleft((mh, mw))
        for i in range(-2, 3):
            i += nh
            for j in range(-2, 3):
                j += nw
                if 0 <= i < h and 0 <= j < w and c[i][j] > now + 1 and s[i][j] == ".":
                    c[i][j] = now + 1
                    q.append((i, j))
    print(-1 if c[dh][dw] == inf else c[dh][dw])
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 109352
from bisect import bisect_left, bisect_right
N = int(input())
*A, = map(int, input().split())
*B, = map(int, input().split())
*C, = map(int, input().split())
A.sort()
B.sort()
C.sort()
ans = 0
for b in B:
    a = bisect_left(A, b)
    c = bisect_right(C, b)
    ans += a * (N-c)
print(ans)

Measured memory_bytes: 29356
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
using namespace std;
const int MAXN=100005;

int N,M,Q;
vector<int> adj[MAXN];
int op[MAXN][3];

int opdep[MAXN],dep[MAXN],col[MAXN];
queue<int> que;

void Mark(int id)
{
    if(opdep[op[id][0]]>=op[id][1])
        return;
    opdep[op[id][0]]=dep[op[id][0]]=op[id][1];
    if(!col[op[id][0]])
        col[op[id][0]]=op[id][2];
    que.push(op[id][0]);
    while(!que.empty())
    {
        int u=que.front();
        que.pop();
        for(int i=0;i<(int)adj[u].size();i++)
        {
            int v=adj[u][i];
            if(opdep[v]>=dep[u]-1)
                continue;
            opdep[v]=dep[u]-1;
            dep[v]=dep[u]-1;
            if(!col[v])
                col[v]=op[id][2];
            que.push(v);
        }
    }
}

int main()
{
    scanf("%d%d",&N,&M);
    for(int i=1;i<=M;i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    scanf("%d",&Q);
    for(int i=1;i<=Q;i++)
        scanf("%d%d%d",&op[i][0],&op[i][1],&op[i][2]);
    memset(opdep,-1,sizeof opdep);
    for(int i=Q;i>=1;i--)
        Mark(i);
    for(int i=1;i<=N;i++)
        printf("%d\n",col[i]);

    return 0;
}


Measured memory_bytes: 9208
import java.util.*;
public class Main {
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			double n = sc.nextDouble();
			System.out.println(judge(n));
		}
	}
	
	
	private String judge(double n) {
		if(n <= 48.00){
			return "light fly";
		}
		if(n <= 51.00){
			return "fly";
		}
		if(n <= 54){
			return "bantam";
		}
		if(n <= 57){
			return "feather";
		}
		if(n <= 60){
			return "light";
		}
		if(n <= 64){
			return "light welter";
		}
		if(n <= 69){
			return "welter";
		}
		if(n <= 75){
			return "light middle";
		}
		if(n <= 81){
			return "middle";
		}
		if(n <= 91){
			return "light heavy";
		}
		else{
			return "heavy";
		}
	}


	public static void main(String [] args){
		new Main().doit();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) {
    return vector<T>(a);
}

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) {
    t = v;
}

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int N;
    cin>>N;
    long double a;
    vector<int> d2(N), d5(N);
    auto plane = make_v<ll>(19, 19);
    for (size_t i = 0; i < N; i++)
    {
        cin>>a;
        ll tmp = llround(a*1e9);
        ll tmp2 = tmp;
        while (tmp%2==0)
        {
            d2[i]++;
            tmp /=2;
        }
        tmp=tmp2;
        while (tmp%5==0)
        {
            d5[i]++;
            tmp/=5;
        }
        plane[min(18, d2[i])][min(18, d5[i])]++;
    }
    ll ans=0;
    for (size_t i = 0; i < 19; i++)
    {
        for (size_t j = 0; j < 19; j++)
        {
            for (size_t i2 = 0; i2 < 19; i2++)
            {
                for (size_t j2 = 0; j2 < 19; j2++)
                {
                    if (i+i2 >= 18 and j + j2 >= 18)
                    {
                        ans+= plane[i][j]*plane[i2][j2];
                        if (i==i2 and j == j2)
                            ans -= plane[i][j];
                    }

                }

            }

        }

    }

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

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

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

    while (true)
    {
        if (A < B) break;
        B *= 2;
        K -= 1;
    }

    while (true)
    {
        if (B < C) break;
        C *= 2;
        K -= 1;
    }

    if (K < 0) cout << "No";
    else cout << "Yes";

    return 0;
    
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }


const string YES = "Yes";
const string NO = "No";

void func(std::string N){

    lli num = 0;
    REP(i,0,N.size()){
        num += N[i]-'0';
    }
    if(num%9==0){
        cout<<YES<<endl;
    }
    else{
        cout<<NO<<endl;
    }

}

int main(){
    // cout << fixed << setprecision(5);

    std::string N;
    std::cin >> N;
    func(N);
    return 0;
}


Measured memory_bytes: 3856
#include <bits/stdc++.h>
using namespace std;
int main() {
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     string s,t;
     cin>>s>>t;
     int count=0;
     for(int i=0;s[i];i++)
          if(s[i]!=t[i])
          count++;
     cout<<count;
	return 0;
}


Measured memory_bytes: 3884
#include<iostream>
#include<vector>
#include<algorithm>
#include<climits>

const int MAX_N=1000000;

typedef long long ll;

using namespace std;

ll n,dat[2*MAX_N-1];

void init(int n_){
	n=1;
	while(n<n_)n*=2;
}

void update(int k,ll a){
	k+=n-1;
	dat[k]=a;
	
	while(k>0){
		k=(k-1)/2;
		dat[k]=max(dat[2*k+1],dat[2*k+2]);
	}
}

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

int main(void){
	
	ll in,m,ans=0;
	
	cin >> m;
	
	init(m);
	
	for(int i=0;i<m;i++){
		cin >> in;
		update(in,in+query(1,in+1,0,0,n));
		ans=max(ans,dat[in+n-1]);
	}
	//cout << m*(m+1)/2-query(1,m+1,0,0,n) << endl;
	cout << m*(m+1)/2-query(1,m+1,0,0,n) << endl;
	
	return 0;
}

Measured memory_bytes: 2748
while 1:
    str=input().split()
    n=int(str[0])
    m=int(str[1])
    if n==0 and m==0: break
    str=input().split()
    a=[0]*n
    for i in range(n):
        a[i]=int(str[i])
    a.sort()
    a.reverse()
    flag=0
    max=0
    for i in range(n):
        if flag!=0: break
        for j in range(i+1,n):
            v=a[i]+a[j]
            if m>=v:
                if max<v: max=v
    if max==0: print("NONE")
    else: print(max)



Measured memory_bytes: 5624
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long LL;

const int MAX_N=1e5+5;
int n,m;
string s;

int main()
{
	ios::sync_with_stdio(false);
	while(cin>>s){
		n=s.length();	
		int p=753,ans=1000;
		for(int i=0;i<=n-3;++i)
		{
			m=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
			ans=min(ans,abs(m-p));
		}
		cout<<ans<<endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200000+10

using namespace std;

int a[N];

int main()
{
    int n,m,u,v;
    while(cin>>n>>m)
    {
        queue<int>q;
        memset(a,0,sizeof(a));
        int flag=0;
        for(int i=1;i<=m;i++)
        {
            cin>>u>>v;
            a[u]=v;
            if(u==1)
            q.push(v);
        }
        while(!q.empty())
        {
            v=q.front();
            if(a[v]==n)
            {
                flag=1;
                break;
            }
            q.pop();
        }
        if(flag)
            printf("POSSIBLE\n");
        else
            printf("IMPOSSIBLE\n");
    }
    return 0;
}


Measured memory_bytes: 1408
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  std::string S;
  std::cin >> S;

  i64 answer = 0;
  i64 B = 0;
  for (const char& S_i : S) {
    switch (S_i) {
    case 'B':
      ++B;
      break;
    case 'W':
      answer += B;
      break;
    }
  }

  std::cout << answer << std::endl;
  return 0;
}

Measured memory_bytes: 640
#include<stdio.h>

void mH(int A[],int i,int n){
  int l,r,temp,large;
  l=2*i;
  r=2*i+1;

  if(l<=n&&A[l]>A[i]) large=l;
  else large=i;
  if(r<=n&&A[r]>A[large]) large=r;

  if(large!=i){
    temp=A[i];
    A[i]=A[large];
    A[large]=temp;
    mH(A,large,n);
  }

  return;
}

void bMH(int A[],int H){
  int i;

  for(i=H/2;i>=1;i--)
    mH(A,i,H);

  return;
}

int main(){
  int n,i;
  int A[500001];
  for(i=1;i<500001;i++)
    A[i]=-2000000001;
  scanf("%d",&n);
  for(i=1;i<=n;i++)
    scanf("%d",&A[i]);

  bMH(A,n);

  for(i=1;i<=n;i++)
    printf(" %d",A[i]);
  printf("\n");

  return 0;
}



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

int main() {
    int a,b;
    
    cin >> a >> b;

    if ( a >= (b*2) )
    {
        cout << (a - b*2) << endl;
    } 
    else
    {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long 
#define inf 1e18
using namespace std;
const int N=1e5+100;
int n,a[N],b[N],w,ans,sh[N*2];
signed main()
{
	scanf("%lld",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&a[i],&b[i]);
		sh[++w]=a[i];
		sh[++w]=b[i];
	}
	sort(sh+1,sh+1+n+n);
	int sum=0;ans=inf;
	for (int i=1;i<=n;i++) sum+=a[i];
	ans=min(ans,sum);
	sum=0;
	for (int i=1;i<=n;i++) sum+=b[i];
	ans=min(ans,sum);
	sum=0;
	for (int i=1;i<=n-2;i++) sum+=sh[i];
	for (int i=1;i<=n;i++)
	{
		int tmp=sum+a[i]+b[i],pa,pb;
		pa=lower_bound(sh+1,sh+1+2*n,a[i])-sh;
		pb=lower_bound(sh+1,sh+1+2*n,b[i])-sh;
		if (pa>pb) swap(pa,pb),swap(a[i],b[i]);
		if (pa<=n-2)
		{
			tmp-=a[i];
			if (pb<=n-1)
			{
				tmp-=b[i];
				tmp+=sh[n-1]+sh[n];
			}
			else tmp+=sh[n-1];
		}
		ans=min(ans,tmp);
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 6844
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    List<Integer> l = new ArrayList<Integer>();
    for (int i = 0; i < 10; i++) {
      int t = sc.nextInt();
      l.add(t);
    }
    
    Collections.sort(l);
    Collections.reverse(l);
    for (int i = 0; i < 3; i++) {
      System.out.println(l.get(i));
    }
  }
};

Measured memory_bytes: 12000
#include <iostream>
#include<algorithm>
//#include<math.h>
#define MAX 1000000
using namespace std;
void minn(int e)
{
    int t=0;
    int mi[MAX]={0};
    for(int z=0;z*z*z<=e;z++)
        for(int y=0;y*y<=e-z*z*z;y++)
        {
            int x=e-z*z*z-y*y;
            //cout<<x<<y<<z<<endl;
            mi[t++]=x+y+z;
        }
     sort(mi,mi+t);
     cout<<mi[0]<<endl;
}
int main()
{
    int e;
    while(cin>>e)
    {
        if(e==0)
            break;
        minn(e);
    }
    return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    int a, b;

	cin >> a >> b;

	if (a + b == 15) Out("+");
	else if (a * b == 15) Out("*");
	else Out("x");
	
	return 0;
}


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

using namespace std;
using ll = long long;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

int main(){
	int A, B;
	int N;
	cin >> N;
	A= 0;
	B = 0;
	vector<char> a(N);
	rep(i, N){
		char c;
		cin >> c;
		if(c == 'R') A++;
		a[i] = c;
	}
	int ans = A;
	rep(i, N){
		if(a[i] == 'W') B++;
		if(a[i] == 'R') A--;
		ans = min(ans, max(A, B));
	}
	cout << ans << endl;
}


Measured memory_bytes: 3628
#include <cmath>
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int K, A, B;
    float d;
    
    cin >> K;
    cin >> A >> B;
    
    d = (float)A / (float)K;
    
    if(K * ceil(d) > B)    cout << "NG" << endl;
    else cout << "OK" << endl;
}


Measured memory_bytes: 3648
import itertools

N  = int(input())
P   = tuple(map(int,input().split()))
Q  = tuple(map(int,input().split()))

it = []

for i in range(N):
    it.append(i+1)

retu = list(itertools.permutations(it))

result = abs(retu.index(P)-retu.index(Q))

print(result)

Measured memory_bytes: 8052
import java.util.*;

public class Main{

    static int[] dp;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char[] cs = s.toCharArray();
        dp = new int[3];
        
        dp[0] = (cs[0]=='R'?1:0);

        for(int i=1;i<3;i++){
            dp[i] = cs[i]=='R'?(dp[i-1]+1):0;
        }

        int max = 0;
        for (int i = 0; i < 3; i++) {
            max = Math.max(max, dp[i]);
        }

        System.out.println(max);

        sc.close();
    }


}

Measured memory_bytes: 35572
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
from fractions import gcd
# from math import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
a,b,c,d=n1()
a1=b//c
a2=(a-1)//c
b1=b//d
b2=(a-1)//d
l=lcm(c,d)
c1=b//l
c2=(a-1)//l
ans=a1-a2+b1-b2-c1+c2
print(b-a+1-ans)

Measured memory_bytes: 5044
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;


int main() {
	int a, b;
	cin >> a >> b;
	int ans = 6;
	cout << ans - a - b << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int h, w;

int main(void)
{
  while(1){
    cin >> h >> w;
    if(h == 0 && w == 0) break;

    int l = h*h + w*w;
    for(int i = l; ; i++){
      for(int y = 1; y <= 150; y++){
        for(int x = 1; x <= 150; x++){
          if(x <= y) continue;
          if(x*x + y*y == i){
            if(i == l && y <= h) continue;
            cout << y << " " << x << endl;
            goto end;
          }
        }
      }
    }
    end:;
  }
  return 0;
}



Measured memory_bytes: 3096
#include <stdio.h>
int main(void)
{
    int mat1[101][101];
    int mat2[101][101];
    double mat3[101][101];
    int ra,rb,rc;
    int i,j,k;
    scanf("%d %d %d", &ra, &rb, &rc);
    for(i=0; i<ra; i++)
    {
        for(j=0; j<rb; j++)
{
            scanf("%d", &mat1[i][j]);
        }
    }
    for(i=0; i<rb; i++)
    {
        for(j=0; j<rc; j++)
{
            scanf("%d", &mat2[i][j]);
        }
    }
    for(i=0; i<ra; i++)
    {
        for(j=0; j<rc; j++)
        {
            for(k=0; k<rb; k++)
            {
                mat3[i][j] += mat1[i][k] * mat2[k][j];
            }
        }
    }
    for(i=0; i<ra; i++)
    {
        for(j=0; j<rc; j++)
        {
            if(j != rc-1)
 printf("%.0lf ", mat3[i][j]);
            else 
printf("%.0lf", mat3[i][j]);
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define repa(X,A,Y) for (int (X) = A;(X) <= (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};


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

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


Measured memory_bytes: 888
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=200111;
const int inf=1000000007;
const int MOD=1000000007;
const double PI = 3.1415926535897932384626433;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

vvl comb(int n) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
		}
	}
	return v;
}

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll __gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

int keta(ll a){
	int ke=1;
	while(a/=10)ke++;
	return ke;
}

vector<long long> enum_divisors(long long N) {
	vector<long long> res;
	for (long long i = 1; i * i <= N; ++i) {
		if (N % i == 0) {
			res.push_back(i);
			// 重複しないならば i の相方である N/i も push
			if (N/i != i) res.push_back(N/i);
		}
	}
	// 小さい順に並び替える
	sort(res.begin(), res.end());
	return res;
}

ll zyou(ll x,ll n){
	ll y=1;
	rep(i,0,n){
		y*=x;
	}
	return y;
}

int main() {
	int x,y;
	cin>>x>>y;
	vi lis[2];
	lis[0] = {1, 3, 5, 7, 8, 10, 12};
	lis[1] = {4, 6, 9, 11};
	rep(i,0,2){
		bool f1=false;
		bool f2=false;
		int z=lis[i].size();
		rep(j,0,z){
			if(lis[i][j]==x)f1=true;
			if(lis[i][j]==y)f2=true;
		}
		if(f1&&f2){
			print("Yes");
			return 0;
		}
	}
	print("No");

}


Measured memory_bytes: 256
N = int(input())
S = input()
count = 0
R = S.count("R")
G = S.count("G")
B = S.count("B")
count = R*G*B

for i in range(N-2):
    for j in range(i+1, N-1):
        if j +(j-i) <= N-1 and S[i] != S[j]:
            if S[i] != S[j+(j-i)] and S[j] != S[j+(j-i)]:
                count -= 1

print(count)

Measured memory_bytes: 73552
#include <bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
using namespace std;

int main() {
	IO
	int n;
	cin >> n;
	ll arr[n], mul = 1, lcm, gcd = 0;
	double sum = 0;
	for (int i = 0; i < n; i++){
		cin >> arr[i];
		sum += 1.0 / arr[i];
	}
	cout << 1.0 / sum;
	return 0;
}


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

int main()
{
	double r,s,l;
	cin >> r;
	s = r*r*M_PI;
	l = 2*r*M_PI;
	cout << fixed << s << " " << l << "\n";
	return 0;
}

Measured memory_bytes: 3244
a, b, c, d = list(map(int, input().split()))

xs = [a, b]
if a < b and b == 0:
  xs.append(b - 1)
if a == 0 and a < b:
  xs.append(a + 1)

ys = [c, d]
if c < d and d == 0:
  ys.append(d - 1)
if c == 0 and c < d:
  ys.append(c + 1)

anses = []

for x in xs:
  for y in ys:
    anses.append(x * y)

print(max(anses))


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

int main(){
	int N;
	cin >> N;
	int a[N];
	for(int i=0; i<N; i++){
		cin >> a[i];
	}
	ll dp[N][N];
	for(int i=0; i<N; i++){
		dp[i][i] = a[i];
	}
	for(int i=0; i<N-1; i++){
		dp[i][i+1] = abs(a[i] - a[i+1]);
	}
	if(N % 2 == 0){
		for(int i=3; i<N; i=i+2){
			for(int j=0; j<N-i; j++){
				dp[j][j+i] = max(min(dp[j][j+i-2]+a[j+i]-a[j+i-1], dp[j+1][j+i-1]+a[j+i]-a[j]), min(dp[j+2][j+i]+a[j]-a[j+1], dp[j+1][j+i-1]+a[j]-a[j+i])); 
			}
		}
		cout << dp[0][N-1] << endl;
	}else{
		for(int i=2; i<N; i=i+2){
			for(int j=0; j<N-i; j++){
				dp[j][j+i] = max(min(dp[j][j+i-2]+a[j+i]-a[j+i-1], dp[j+1][j+i-1]+a[j+i]-a[j]), min(dp[j+2][j+i]+a[j]-a[j+1], dp[j+1][j+i-1]+a[j]-a[j+i])); 
			}
		}
		cout << dp[0][N-1] << endl;
	}
	return 0;
}

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

int main(){

   int n,d;
   cin >> n >> d;
   int person = 0;
   int count = 0;
   while(count < n){
      count += 1 + 2 * d;
      person++;
   }
   cout << person << endl;
   return 0;
}

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

int main(){
	char ch,ch2;
	
	while(1){
		scanf("%c",&ch);
		if(islower(ch)){
			ch2=toupper(ch);
			cout<<ch2;
		}else{
			ch2=tolower(ch);
			cout<<ch2;
		}
		if(ch=='\n'){
			break;
		}
 	}
  	return 0;
}

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

const char COLOR[4] = { 'R', 'G', 'B', 'Y' };

ll H, W, D;
char ans[500][500];

int main(void) {
  cin >> H >> W >> D;

  REP(i, 0, H) REP(j, 0, W) {
    ll y = i + j + H, x = i - j + W;
    ans[i][j] = COLOR[((y / D) % 2) * 2 + (x / D) % 2];
  }

  REP(i, 0, H) {
    REP(j, 0, W) cout << ans[i][j];
    cout << endl;
  }
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int x,y;
  cin>>x>>y;
  cout<<x+y/2<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1001001001;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
//printf("%.10f\n", N);
/*
ll memo[100000];
ll fibo(ll n){
    if(memo[n] != 0)return memo[n];
    if(n <= 1)return n;
    else return memo[n] = fibo(n - 1)+ fibo(n - 2);
}*/
int main() {
    ll X,A,B;
    cin >> X >> A >> B;
    if(abs(A - X) < abs(B - X))cout << "A" << endl;
    else cout << "B" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++) cin>>a[i];
	int ans=1;
	int mode=0;
	for(int i=1;i<n;i++)
	{
		if(mode==0)
		{
			if(a[i]==a[i-1]) continue;
			if(a[i]>a[i-1])
				mode=1;
			else
				mode=-1;
		}
		else if(mode==1)
		{
			if(a[i]<a[i-1])
			{
				mode=0;
				ans++;
			}
		}
		else
		{
			if(a[i]>a[i-1])
			{
				mode=0;
				ans++;
			}
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main() {
double n, m, d;
double ans;  
cin >> n >> m >> d;
if(d ==0)
cout  << std::setprecision(std::numeric_limits<float >::max_digits10) << (m-1) / n << endl; 
else 
cout << std::setprecision(std::numeric_limits<float >::max_digits10) << 2 * (1 - d/n) * (m-1)/n << endl;
} 


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

using ll = long long;

int main() {
	ll n; cin >> n;
	vector<ll>a(n + 1LL); rep(i, n + 1LL) { cin >> a[i]; }
	vector<ll>b(n); rep(i, n) { cin >> b[i]; }

	ll c = 0LL;
	for (ll i = n; i >= 1LL; i--) {
		if (b[i - 1LL] > a[i]) {
			b[i - 1LL] -= a[i]; c += a[i];
			a[i] = 0LL;
			if (b[i - 1LL] > a[i - 1LL]) {
				b[i - 1LL] = 0LL; c += a[i - 1LL];
				a[i - 1LL] = 0LL;
			}
			else {
				a[i - 1LL] -= b[i - 1LL]; c += b[i - 1LL];
				b[i - 1LL] = 0LL;
			}
		}
		else {
			a[i] -= b[i - 1LL]; c += b[i - 1LL];
			b[i - 1LL] = 0LL;
		}
	}

	cout << c << endl;
}


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

int main(void){
    int i,j;
    long long int n,ans,c=0,r=0,g=0,b=0;
    vector<char> list={'R','G','B'};
    string s;
    cin>>n;
    cin>>s;
    for(i=0;i<n;i++){
        if(s[i]=='R')r++;
        if(s[i]=='G')g++;
        if(s[i]=='B')b++;
        if(i<n-2){
            for(j=1;(i+2*j)<n;j++){
                if(s[i]=='R'&&s[i+j]=='G'&&s[i+2*j]=='B')c++;
                else if(s[i]=='R'&&s[i+j]=='B'&&s[i+2*j]=='G')c++;
                else if(s[i]=='G'&&s[i+j]=='R'&&s[i+2*j]=='B')c++;
                else if(s[i]=='G'&&s[i+j]=='B'&&s[i+2*j]=='R')c++;
                else if(s[i]=='B'&&s[i+j]=='R'&&s[i+2*j]=='G')c++;
                else if(s[i]=='B'&&s[i+j]=='G'&&s[i+2*j]=='R')c++;
            }
        }
    }
    cerr<<r<<" "<<g<<" "<<b<<endl;
    cerr<<c<<endl;
    ans=r*g*b-c;
    cout<<ans<<endl;
}

Measured memory_bytes: 3612
import collections

n = int(input())
blueCards = [input() for i in range(n)]
blueCards = collections.Counter(blueCards)
m = int(input())
redCards = [input() for i in range(m)]
redCards = collections.Counter(redCards)

diff = blueCards - redCards
print(diff.most_common()[0][1]) if diff else print(0)

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

int main(void) {
  int N;
  cin >> N;
  vector<long long> A(N), B(N), C(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> B[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> C[i];
  }

  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    long long a_num = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
    long long b_num = C.end() - upper_bound(C.begin(), C.end(), B[i]);
    ans += a_num * b_num;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2560