akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int n;
    cin >> n;
    vector l(n,0);
    for (int i=0; i<n; i++) cin >> l[i];

    int ans = 0;
    for (int i=0; i<n; i++) {
        for (int j=i+1; j<n; j++) {
            if (l[i] == l[j])continue;
            for (int k=j+1; k<n; k++) {
                if (l[i]==l[k] || l[j]==l[k]) continue;
                if (l[i]+l[j]<=l[k] || l[i]+l[k]<=l[j] || l[j]+l[k]<=l[i]) continue;
                ans++;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3224
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    a,b,c=MI()
    print(len(list(set([a,b,c]))))

main()


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

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;

  int64_t sum = 0;
  unordered_map<int64_t, vector<int>> reminders;
  for (int i = 0; i < N; i++) {
    int64_t A;
    cin >> A;
    sum += A;
    int64_t r = sum % M;
    if (reminders.find(r) == reminders.end()) {
      reminders[r] = vector<int>();
    }
    reminders[r].push_back(i);
  }

  int64_t count = 0;
  for (auto& kv : reminders) {
    int64_t K = kv.second.size();
    if (K >= 2) {
      count += K * (K - 1) / 2;
    }
    if (kv.first == 0) {
      count += K;
    }
  }
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 6540
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
using ll = long long;



int main() {
	int n;
	cin >> n;
	if (n > 999) cout << "ABD" << endl;
	else cout << "ABC" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)
 
inline ll ii(){ ll x; cin >> x; return x; }
inline string is(){ string x; cin >> x; return x; }
inline ld id(){ ld x; cin >> x; return x; }
inline void oi(ll x){ cout << x; }
inline void od(ld x){ cout << fixed << setprecision(10) << x; }
inline void os(string x){ cout << x; }
inline void oe(){ cout << endl; }
inline void oie(ll x){ oi(x); oe(); }
inline void ode(ld x){ od(x); oe(); }
inline void ose(string x){ os(x); oe(); }
inline void maxin(ll &a, ll b){ a=max(a,b); }
inline void minin(ll &a, ll b){ a=min(a,b); }

ll m[412345];
ll mod=998244353;

int main(){
    ll N=ii();
    ll K=ii();
    vector<pii> lr;
    REP(i,0,K){
        ll l=ii(), r=ii();
        lr.push_back(pii(l,r));
    }
    ll t=1;
    m[1]=-1;
    REP(i,0,N){
        t+=m[i]+mod;
        t%=mod;
        REP(j,0,K){
            m[i+lr[j].first]+=t;
            m[i+lr[j].first]%=mod;
            m[i+lr[j].second+1]-=t;
            m[i+lr[j].second+1]+=mod;
            m[i+lr[j].second+1]%=mod;
        }
    }
    oie(t);
    return 0;
}


Measured memory_bytes: 6676
from scipy.sparse.csgraph import dijkstra
import numpy as np

H, W = map(int, input().split())
C = [list(map(int, input().split())) for i in range(10)]
cost = np.r_[dijkstra(C)[:, 1], 0].astype(int)

A = np.array([list(map(int, input().split())) for i in range(H)])
print(cost[A].sum())

Measured memory_bytes: 14604
S = input()

odd = 0
even = 0
for i, s in enumerate(S):
    if (i+1)%2 == 0:
        if s == 'L' or s == 'U' or s == 'D':
            odd += 1
    else:
        if s == 'R' or s == 'U' or s == 'D':
            even += 1
            
if odd + even == len(S):
    print('Yes')
else :
    print('No')

Measured memory_bytes: 3060
N=int(input())
axis1=[]
axis2=[]
for i in range(N):
    x,y = map(int,input().split())
    axis1.append(x-y)
    axis2.append(x+y)

ans1 = max(axis1)-min(axis1)
ans2 = max(axis2)-min(axis2)

print(max(ans1,ans2))

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

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll K,A,B,n;
	cin >> K >> A >> B;
	ll ans = 1 + K;
	if((B-A)>2 && K>A){
		//まずA枚にするのにかかる手数はA-1回
		ll t = A;
		ll x = K-(A-1);//残りの操作回数
		t += x%2 + (x/2LL)*(B-A);
		ans = max(ans,t);
	}else{
		ans = 1+K;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define st first
#define nd second 

using  namespace std;
using pii = pair<int, int>;
using ll = long long;
const int N = 2e5 + 10;
int a[N], has[N];

int main(){
	int n;
	scanf("%d", &n);
	ll sum = 0;
	for(int i = 1; i <= n; i++){
		scanf("%d",&a[i]);
		sum += has[a[i]];
		has[a[i]]++;
	}
	for(int i = 1; i <= n; i++){
		printf("%lld\n", sum - 1LL * (has[a[i]] -1));
	}
}

Measured memory_bytes: 3712
def resolve():
    MOD = 998244353
    N, K = map(int, input().split())
    S = [tuple(map(int, input().split())) for _ in range(K)]
    L = [0] * K
    R = [0] * K
    L, R = zip(*S)

    dp = [0] * (N + 1)
    dp[1] = 1

    dp_acum = [0] * (N + 1)
    dp_acum[1] = 1

    for i in range(2, N + 1):
        for j in range(K):
            li = i - R[j]
            ri = i - L[j]
            if ri < 0:
                continue
            li = max(li, 1)
            dp[i] += dp_acum[ri] - dp_acum[li - 1]
            dp[i] %= MOD

        dp_acum[i] = dp_acum[i - 1] + dp[i]
        dp_acum[i] %= MOD

    print(dp[N])


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 24632
#include <iostream>

using namespace std;

int main()
{
    string s;
    cin >> s;
    bool bad=0;
    for(int i=0;i<3;i++)
    {
        if(s[i]==s[i+1]) bad=1;
    }
    if(!bad) cout << "Good" << endl;
    else cout << "Bad" << endl;
    return 0;
}


Measured memory_bytes: 256
using System;

    class Program
    {
        static void Main(string[] args)
        {
            var line = System.Console.ReadLine();
            var data = line.Split(new char[] { ' ' });
            long N = Convert.ToInt64(data[0]);
            long K = Convert.ToInt64(data[1]);
            line = System.Console.ReadLine();
            data = line.Split(new char[] { ' ' });
            ulong[] Hs = new ulong[N];
            for (int i = 0; i < N; i++)
            {
                Hs[i] = Convert.ToUInt64(data[i]);
            }

            Array.Sort(Hs);
            Array.Reverse(Hs);
            ulong sumH = 0;
            if (Hs.Length - K > 0)
            {
              ulong[] after = new ulong[Hs.Length - K];
                Array.Copy(Hs, K, after, 0, after.Length);
                for (int i = 0; i < after.Length; i++)
                {
                    sumH += after[i];
                }
            }
            Console.WriteLine(sumH.ToString());
        }
    }

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

const int MX=100010;

vector<int> G[MX];

int n, m, deg[MX], par[MX];

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	cin>>n>>m;
	for(int i=1; i<n+m; i++){
		int u,v; cin>>u>>v;
		G[u].push_back(v);
		deg[v]++;
	}
	queue<int> Q;
	for(int i=1; i<=n; i++) if(deg[i]==0) Q.push(i);

	while(!Q.empty()){
		int v = Q.front(); Q.pop();
		for(int x:G[v]){
			deg[x]--;
			if(deg[x]==0){
				par[x]=v; Q.push(x);
			}
		}
	}

	for(int i=1; i<=n; i++) cout<<par[i]<<'\n';

	return 0;
}

Measured memory_bytes: 7040
n=int(input())
l=[0,0,0,0]
for _ in range(n):
	s=input()
	if(s=='AC'):
		l[0]+=1
	elif(s=='WA'):
		l[1]+=1
	elif(s=='TLE'):
		l[2]+=1
	elif(s=='RE'):
		l[3]+=1
print("AC x",l[0])
print("WA x",l[1])
print("TLE x",l[2])
print("RE x",l[3])

Measured memory_bytes: 9212
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int X = 0;
    int ans = 0;
    for(auto &x : s){
        if(x == 'I') X++;
        if(x == 'D') X--;
        ans = max(ans, X);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

int A[510][510];
int a, b, c, d;

void solve() {
	cin >> a >> b >> c >> d;
	if(a % c == 0 && b % d == 0) puts("No");
	else{
		puts("Yes");
		rep(i, a)rep(j, b) {
			if(i % c == c-1 && j % d == d-1) A[i][j] = -c * d * 1000 + 999;
			else A[i][j] = 1000;
		}
		rep(i, a){rep(j, b)printf("%d ", A[i][j]); puts("");}
	}
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
};

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000000
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

/*
 * sort everything in desc order
 * 6 5 3
 * 20 15 12 8 5 1
 * BS on the no of ops
 * and to decide on how many times to center a monster
 * x*A + (total - x)*B >= v[i]
 * x*(A - B) >= v[i] - total*B
 * x >= ceil((v[i] - total*B)/(A - B))
 */
int main() {
	int n, A, B;
	cin >> n >> A >> B;
	vector <int> v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	auto check = [&](ll mid) {
		ll sum = 0;
		for (int i = 0; i < n; i++) {
			sum += max(0LL, (v[i] - mid * B + (A - B - 1)) / (A - B));
		}
		return (sum <= mid);
	};
	ll lo = 1, hi = MOD, ans = -1;
	while(lo <= hi) {
		ll mid = (lo + hi) / 2;
		if (check(mid)) {
			ans = mid;
			hi = mid - 1;
		}
		else {
			lo = mid + 1;
		}
	}
	cout << ans;
}


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

#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll n, m;
    cin >> n >> m;
    VVL G(n);
    rep(i, 0, m){
        ll a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);

    }
    ll i = 0;
    queue<PL> que;
    que.push({0, 0});
    vector<bool> seen(n, false);
    seen[0] = true;
    bool f;
    while(!que.empty()){
        auto q = que.front();
        que.pop();
        if(q.second > 2){
            f = false;
            break;
        }
        if(q.first == n-1){
            f = true;
            break;
        }
        for(auto g : G[q.first]){
            if(!seen[g]) que.push({g, q.second+1});
        }
    }
    if(f) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 14440
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

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

    if (a > 0) {
        cout << "Positive" << endl;
    } else if (b >= 0) {
        cout << "Zero" << endl;
    } else if ((b - a) % 2 == 0) {
        cout << "Negative" << endl;
    } else {
        cout << "Positive" << endl;
    }

    return 0;
}


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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll oo = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;
typedef pair<int, int>             pii;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/

struct edge{
    int from, to, w;

    edge(){}
    edge(int x, int y, int we): from(x), to(y), w(we){}

    bool operator < (const edge &rhs) const{
        return w > rhs.w;
    }

};

int main(){
    fIO

    int n;
    cin >> n;

    int A[n + 5], B[n + 5];
    for(int i = 0; i < n; i++) cin >> A[i];

    for(int i = 0; i < n; i++) cin >> B[i];

    vi perm;
    for(int i = 0; i < n; i++) perm.pb(i + 1);


    int cnt = 0, aLoc, bLoc;
    do{
        cnt++;
        int a = 0, b = 0;
        for(int i = 0; i < n; i++) {
            if(A[i] == perm[i]) a++;
            if(B[i] == perm[i]) b++;
        }
        if(a == n) aLoc = cnt;
        if(b == n) bLoc = cnt;
    }while(next_permutation(all(perm)));

    cout << abs(aLoc - bLoc);
}












Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            long sum = 0;
            for (int i = 0; i < n; i++)
            {
                sum += i;
            }
            Console.WriteLine(sum);
        }

        static List<T[]> GeneratePermutation<T>(params T[] array) where T : IComparable
        {
            var a = new List<T>(array).ToArray();
            var res = new List<T[]>
            {
                new List<T>(a).ToArray()
            };
            var n = a.Length;
            var next = true;
            while (next)
            {
                next = false;

                int i;
                for (i = n - 2; i >= 0; i--)
                {
                    if (a[i].CompareTo(a[i + 1]) < 0)
                        break;
                }
                if (i < 0)
                    break;

                var j = n;
                do
                {
                    j--;
                } while (a[i].CompareTo(a[j]) > 0);

                if (a[i].CompareTo(a[j]) < 0)
                {
                    var tmp = a[i];
                    a[i] = a[j];
                    a[j] = tmp;
                    Array.Reverse(a, i + 1, n - i - 1);
                    res.Add(new List<T>(a).ToArray());
                    next = true;
                }
            }
            return res;
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#define int long long
#define uint unsigned long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
using namespace std;

signed main()
{
	int A, B;
	cin >> A >> B;
	cout << ((A + B) % 24) << endl;
}


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

int main()
{
  char a, b, c, d;
  cin >> a >> b >> c >> d;
  
  string ans = "No";
  if ((a == b && b == c) || (b == c && c == d)) ans = "Yes";
  
  cout << ans << endl;
}

Measured memory_bytes: 256
use proconio::{fastout, input};
use std::cmp::Ordering;

#[fastout]
fn main() {
    input! {n: usize, v: [f64; n]};

    let mut v: Vec<f64> = v;
    v.sort_by(cmp_f64);

    while v.len() > 1 {
        let m1 = v.pop().unwrap();
        let m2 = v.pop().unwrap();
        v.push((m1 + m2) / 2.0);
        v.sort_by(cmp_f64);
    }

    println!("{}", v[0]);
}

fn cmp_f64(a: &f64, b: &f64) -> Ordering {
    if a < b {
       return Ordering::Greater;
    } else if a > b {
      return Ordering::Less;
    }
    return Ordering::Equal;
}

Measured memory_bytes: 2184
#include <algorithm>
    #include <iostream>
    #include <string>
    using namespace std;
     
    int main() {
    	int N,A,B;
    	cin>>N>>A>>B;
    	int sum=0;
    	for(int i=1;i<=N;i++){
    	    int a=i/10000;
    	    int b=(i%10000)/1000;
    	    int c=(i%1000)/100;
    	    int d=(i%100)/10;
    	    int e=(i%10)/1;
    	    if(A<=a+b+c+d+e & a+b+c+d+e<=B){
    	        sum+=10000*a+1000*b+100*c+10*d+1*e;
    	    }
    	}
    	cout<<sum<<endl;
    }


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;
int mod = 1000000007;

void solve();

int main(void){
    int N, M; cin >> N >> M;
    vector<int> job[M+1]; //job[i]はi日後に報酬の入る仕事の報酬一覧
    rep(i, N){
        int a, b; cin >> a >> b;
        if(a <= M) job[a].push_back(b);
    }
    int ans = 0;
    priority_queue<int> pq;
    for(int i = 1; i <= M; i++){
        rep(j, job[i].size()) pq.push(job[i][j]);
        if(!pq.empty()){
            ans += pq.top();
            pq.pop();
        }
    }
    cout << ans << endl;
    return 0;
}

void solve(){}

Measured memory_bytes: 5504
N = gets.to_i

plan = N.times.map { gets.split(" ").map(&:to_i) }
plan.unshift([0,0,0])

(0..N-1).each { |i|
  t1,x1,y1 = plan[i]
  t2,x2,y2 = plan[i+1]

  min = (x2-x1) + (y2-y1)

  if min > t2 - t1 || (min - (t2 - t1))%2 == 1
    puts 'No'
    exit
  end
}

puts 'Yes'


Measured memory_bytes: 9724
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
     Scanner sc = new Scanner(System.in); 
		double n = sc.nextDouble();
	    double  k = sc.nextDouble();
	    sc.close();
	    double p = 0;
	      
	  double a = 1.0/n; 
	   for (int i=1; i<n+1; i++) {
		  int cn = i;
		   double t = a; 
		   while(cn<k) {
			     t = t*0.5;
			     cn= cn*2;
			    } 
		   
		   p = p+t ;
	   }
       System.out.println(p);
	}
}

Measured memory_bytes: 24404
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int[] a = new int[n];
        int[] b = new int[n];

        for (int i = 0; i < n; i++)
        {
            a[i] = sc.NextInt();
            b[i] = sc.NextInt();
        }

        a = a.OrderBy(i => i).ToArray();
        b = b.OrderBy(i => i).ToArray();

        int answer = 0;
        if (n % 2 == 1)
        {
            answer = b[(n - 1) / 2] - a[(n - 1) / 2] + 1;
        }
        else
        {
            answer = (b[n / 2] + b[n / 2 - 1]) - (a[n / 2] + a[n / 2 - 1]) + 1;
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

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

int main(){
	int n;
	cin >> n;
	if(n%10==3){
		cout << "bon" << endl;
	}else if(n%10==0 || n%10==1 ||n%10==6 ||n%10==8 ) {
		cout << "pon" << endl;
	}else{
		cout << "hon" << endl;
	}
/*	for(i=0;i<n;i++){
		
	}
*/	

}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ

signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    set<string> st;
    string s; cin >> s;
    int sz=s.size();
    int k; cin >> k;
    for(int i=1;i<=5;i++){
        rep(j,sz-i+1){
            string ss=s.substr(j,i);
            st.insert(ss);
        }
    }
    vector<string> v;
    int cnt=0;
    for(auto u:st){
        if(cnt==k-1){
            cout << u << endl;
            return 0;
        }
        cnt++;
    }
}


Measured memory_bytes: 4828
def ext_euc(a, b):
    if b == 0:
        return 1, 0, a
    y, x, v = ext_euc(b, a % b)
    y -= (a // b) * x
    return x, y, v


def mod_inv(a, mod):
    x, _, _ = ext_euc(a, mod)
    return x % mod


def main():
    MOD = 10**9 + 7
    S = int(input())
    length = 1
    ans = 0
    comb = 1 # (S-2*l-1)_C_(l-1)
    while 3 * length <= S:
        ans += comb
        comb *= (S-3*length)*(S-3*length-1)*(S-3*length-2)
        comb %= MOD
        comb *= mod_inv(length, MOD) * mod_inv(S-2*length-1, MOD) * mod_inv(S-2*length-2, MOD)
        comb %= MOD
        length += 1
    print(ans % MOD)


if __name__ == '__main__':
    main()

Measured memory_bytes: 69412
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

ll s[505][505];

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    for (int i = 0, l, r; i < m; i++) {
        cin >> l >> r;
        l--; r--;
        s[l][r]++;
    }
    for (int i = 0; i < n; i++) {
        for (int j = 1; j < n; j++) {
            s[i][j] += s[i][j - 1];
        }
    }
    for (int j = 0; j < n; j++) {
        for (int i = n - 2; i >= 0; i--) {
            s[i][j] += s[i + 1][j];
        }
    }
    for (int i = 0, l, r; i < q; i++) {
        cin >> l >> r;
        l--; r--;
        cout << s[l][r] << endl;
    }
}

Measured memory_bytes: 2944
import math
while True:
    s = []
    n = int(input())
    if n == 0:
        break
    s = list(map(int, input().split()))
    m = sum(s) / n
    v2 = 0
    for i in range(n):
        v2 += (s[i]-m)**2
    v2 = v2/n
    print(math.sqrt(v2))


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

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

  if(A==B){
    if(A==C){
      cout << "No" << endl;
    }else{
      cout << "Yes" << endl;
    }
  }else{
    if(A==C || B ==C){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;   
    }
  }
}

Measured memory_bytes: 256
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

n = iinput()
txy = np.array([iarr() for i in range(n)])
t,x,y = txy.T[0], txy.T[1], txy.T[2]

flag = 0 if t[0] < abs(x[0]) + abs(y[0]) else 1
for i in range(n-1):
    dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    time = abs(t[i+1] - t[i])
    if time < dist: flag = 0; break
    if (time - dist)%2 == 1: flag = 0; break

ans = "Yes" if flag else "No"
print(ans)


Measured memory_bytes: 41404
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	ll r, D, x2000;
	cin >> r >> D >> x2000;
	
	ll x = x2000;
	for(int i = 1; i <= 10; ++i) {
		x = r * x - D;
		cout << x << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr auto INF = INT_MAX >> 1;
constexpr auto LINF = 5000000000000000;
constexpr auto MOD = 1000000007;

int main() {

	int n, h;
	cin >> n >> h;
	priority_queue<P, V<P>, less<P>> p;
	rep(i, n) {
		int a, b;
		cin >> a >> b;
		p.push(P(a, 0));
		p.push(P(b, 1));
	}

	int ans = 0;
	while (h > 0) {
		int atk = p.top().first;
		if (p.top().second == 0) {
			ans += (h + atk - 1) / atk;
			h = 0;
		}
		else {
			ans++;
			h -= atk;
			p.pop();
		}
	}

	cout << ans << endl;

}

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

int main() {
    int n, k;
    cin >> n >> k;
    double ans = 0.0;
    for (int i = 1; i <= n; i++) {
        int j = i;
        double tmp = 1.0;
        while (j < k) {
            j *= 2;
            tmp *= 0.5;
        }
        ans += tmp;
    }
    printf("%.16f\n", ans / (double)n);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
 
using namespace std;
using namespace __gnu_pbds;
 
#define debug(s) cout << #s << " = " << s << endl
#define all(v) (v).begin(), (v).end()
#define mem(a,val) memset(a, val, sizeof a)
 
#define maxn 100010
#define INF 1e15
#define ff first
#define ss second
#define endl '\n'
typedef long long ll;
 
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int maxi = 0, ans = 0;
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    if (x >= maxi) ++ans;
    maxi = max(maxi, x);
  }
  cout << ans << endl;
}





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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

s64 mygcd(s64 x, s64 y)
{
    if (y == 0) return x;
    return mygcd(y, x % y);
}

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

    int n;
    cin >> n;

    const int lim = 1000000;
    vs32 a(n);
    rep (i, n) cin >> a[i];

    bool ans1 = true, ans2 = true;

    vs32 div(lim + 1);
    vector< bool > isprime(lim + 1, true);
    div[0] = div[1] = 1;
    isprime[0] = isprime[1] = false;
    rep (i, lim + 1)
    {
        if (isprime[i])
        {
            div[i] = i;
            for (int j = i + i; j <= lim; j += i)
            {
                isprime[j] = false;
                div[j] = i;
            }
        }
    }

    // check pairwise
    vector< bool > found(1000001, false);
    rep (i, n)
    {
        s64 x = a[i];
        set<int> temp;
        while (div[x] != 1)
        {
            temp.insert(div[x]);
            x /= div[x];
        }
        for (auto d : temp)
        {
            if (found[d])
            {
                ans1 = false;
                break;
            }
            found[d] = true;
        }
        if (!ans1) break;
    }

    s64 g = 0;
    rep (i, n)
    {
        g = mygcd(g, a[i]);
    }
    ans2 = g == 1;

    if (ans1)
    {
        cout << "pairwise coprime" << "\n";
    }
    else if (ans2)
    {
        cout << "setwise coprime" << "\n";
    }
    else
    {
        cout << "not coprime" << "\n";
    }

    return 0;
}



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

using ll = long long;

vector<ll> fact(ll n) {
	vector<ll> ans;
	
	for(ll i = 2; i*i <= n; i++) {
		if(n % i == 0) {
			ans.push_back(i);
			if(i*i < n) {
				ans.push_back(n/i);
			}
		}
	}
	return ans;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	//$ while(1) {
		//$ int n;
		//$ cin >> n;
		
		//$ cout << "n = " << n << endl;
		//$ for(int i = 1; i <= n; i++) {
			//$ cout << "i = " << i << ", rem = " << n % i << endl;
		//$ }
		
		//$ cout << endl << endl;
	//$ }
	
	ll n;
	cin >> n;
	vector<ll> f = fact(n-1);
	ll ans = f.size() + 2;
	f = fact(n);
	for(ll x : f) {
		ll tmp = n;
		while(tmp % x == 0) {
			tmp /= x;
		}
		if(tmp % x == 1) {
			ans++;
		}
	}
	
	if(n == 2) ans--;
	cout << ans << endl;
}


Measured memory_bytes: 384
order = {'a' : 0, 'b' : 1, 'c' : 2}
S = [input() for i in range(3)]

turn = 0
while(True):
        if(not S[turn]):
            break
        card = S[turn][0]
        S[turn] = S[turn][1:]
        turn = order[card]
print(["A","B","C"][turn])

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

int main(void){
    long long n;
    cin >> n;
    
    long long t, a;
    long long t_sum = 1, a_sum = 1;
    long long max;
    for(long long i = 1; i <= n; i++){
        cin >> t >> a;
        max = ((t_sum - 1) / t + 1 > (a_sum - 1) / a + 1) ? (t_sum - 1) / t + 1 : (a_sum - 1) / a + 1;
        t_sum = max * t;
        a_sum = max * a;
    }
    
    cout << t_sum + a_sum << endl;
    
    return 0;
}


Measured memory_bytes: 256
//  RAKSHIT KADAM

 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the size of arrayss!!!
 
// NUMERIC DEFINITIONS :
    #define INF 100000000000000005
    #define inf 1000000004
    #define MOD  1000000007
    #define mod 998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
#define ld long double
 #define ll long long
 #define int long long
 
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
 
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn = 500003;
// ll fact[1000005];
//void facto()
//{
//    ll lim =1000005;fact[0]=1;
//    for(ll i=1;i<lim;i++)
//    {
//        fact[i]=(fact[i-1]*i)%MOD;
//    }
//}
//ll ncr(ll a,ll b)
//{
//    ll ret = 0;
//    ret = fact[a]*(modInverse(fact[b],MOD));
//    ret%=MOD;
//    ret*=modInverse(fact[a-b],MOD);
//    ret%=MOD;
//    return ret;
//}

void solve()
{
    ll n;cin>>n;
    ll k;cin>>k;
    ll ans =0;
    ll a[n];for(ll i=0;i<n;i++)cin>>a[i];
    ll l =1,r =10000000006;
    
    while(l<=r)
    {
        ll mid = l+r>>1;
        ll cnt=0;
        
        for(ll i=0;i<n;i++)
        {
            cnt+=(a[i]-1)/mid;
        }
        if(cnt<=k)
        {
            ans=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    
    }
    cout<<ans<<endl;
}
signed main()
{
   Need_for_speed(activated);
//
//    satisfy
//    {
//        solve();
//    }
//
   
    solve();
    
    return 0;
}
//Concentrate while implementing,,,!!!
 


Measured memory_bytes: 5156
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
const int MOD = 1e9+7;
using namespace std;


int main(){
	int n, coun = 0;
	double sum = 0;
	cin >> n;
	vector<pair<int, int> > place(n);
	for (int i = 0; i < n; i++){
		int x, y;
		cin >> x >> y;
		place[i] = make_pair(x, y);
	}
	vector<int> v;
	for (int i = 0; i < n; i++){
		v.push_back(i);
	}
	do{
		for (int i = 0; i < n-1; i++){
			sum += sqrt((place[v[i]].first - place[v[i+1]].first)*(place[v[i]].first - place[v[i+1]].first) + (place[v[i]].second - place[v[i+1]].second)*(place[v[i]].second - place[v[i+1]].second));
		}
		coun++;
	}while(next_permutation(v.begin(), v.end()));
	cout << setprecision(10) <<sum/coun << endl; 
	return 0;
}

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

ll L[100];
bool seen[100];

ll Lucas(int N){
    if(seen[N]==true||L[N]!=-1)return L[N];
    seen[N]=true;
    L[0]=2;
    L[1]=1;
    if(N!=1&&N!=0)L[N]=Lucas(N-1)+Lucas(N-2);    
    return L[N];
}

int main(){
    int N;
    cin>>N;
    rep(i,100){
        seen[i]=false;
        L[i]=-1;
    }
    cout<<Lucas(N)<<endl;
    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define pi 3.1415926535897
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define mod1 998244353
#define inf 1000000000000000000
#define inf1 1000000000
#define endl '\n'
ll arr[55][55];
ll temp[55][55];
ll ans[55][55];
void calculate(ll n,ll k1)
{
	if(k1==0)
		return;
	if(k1==1)
	{
		for(ll i=1;i<=n;i++)
			for(ll j=1;j<=n;j++)
				ans[i][j]=arr[i][j];
		return;
	}
	calculate(n,k1/2);
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=n;j++)
		{
			ll an=0;
			for(ll k=1;k<=n;k++)
			{
				ll c=(ans[i][k]*ans[k][j])%mod;
				an=(an+c)%mod;
			}
			temp[i][j]=an;
		}
	}
	for(ll i=1;i<=n;i++)
		for(ll j=1;j<=n;j++)
			ans[i][j]=temp[i][j];
	if(k1%2==1)
	{
		for(ll i=1;i<=n;i++)
		{
			for(ll j=1;j<=n;j++)
			{
				ll an=0;
				for(ll k=1;k<=n;k++)
				{
					ll c=(arr[i][k]*ans[k][j])%mod;
					an=(an+c)%mod;
				}
				temp[i][j]=an;
			}
		}
		for(ll i=1;i<=n;i++)
		for(ll j=1;j<=n;j++)
			ans[i][j]=temp[i][j];
	}
	return;
}
int main()
{
	fastio;
	#ifdef APNA_IO
		freopen("input.txt" , "rt" ,stdin);
		freopen("output.txt" , "wt" ,stdout);
	#endif
	ll n,k;
	cin>>n>>k;
	for(ll i=1;i<=n;i++)
		for(ll j=1;j<=n;j++)
			cin>>arr[i][j];
	calculate(n,k);
	ll fans=0;
	for(ll i=1;i<=n;i++)
		for(ll j=1;j<=n;j++)
			fans=(fans+ans[i][j])%mod;
	cout<<fans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cmath>

using namespace std;


int main()
{
  unsigned long L, R;
  cin >> L >> R;

  unsigned long ans = 2019;
  for(unsigned long i = L; i <= min(R, L+2019); i++){
    for(unsigned long j = i + 1; j <= min(R, L+2019); j++){
      ans = min(ans, (i*j) % 2019);
    }
  }
  cout << ans << endl;

  return 0;
}


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

#define rep(i,n) for(int i=0; i<(n); ++i)
using ll = long long;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false;}

const int MAX_N = 1e5+3;
const ll INF = 1LL << 60;
ll dp[MAX_N];

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

  rep(i,MAX_N) dp[i] = INF;
  dp[0] = 0;
  for (int i=1; i<=n; ++i) {
    for (int pow6 = 1; pow6 <= i; pow6 *= 6) {
      chmin(dp[i], dp[i-pow6] + 1);
    }
    for (int pow9 = 1; pow9 <= i; pow9 *= 9) {
      chmin(dp[i], dp[i-pow9] + 1);
    }
  }
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
#include <iomanip>
#include <sstream>

int main(void)
{
    int64_t N;

    std::cin >> N;

    for (int64_t i = 0; i < N; ++i) {
        int64_t A;
        std::cin >> A;
        if (A % 2 == 1) continue;
        if (A % 3 == 0 || A % 5 == 0) continue;
        std::cout << "DENIED" << std::endl;
        return 0;
    }

    std::cout << "APPROVED" << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int64_t MOD = 1000000007;
const int MAXN = 2000010;
int64_t pow10[MAXN];
int64_t pow9[MAXN];
int64_t pow8[MAXN];

int main()
{
  int64_t N;
  cin >> N;
  pow10[0] = 1;
  pow9[0] = 1;
  pow8[0] = 1;
  for (int i = 1; i < MAXN; i++)
  {
    pow10[i] = (pow10[i - 1] * 10) % MOD;
    pow9[i] = (pow9[i - 1] * 9) % MOD;
    pow8[i] = (pow8[i - 1] * 8) % MOD;
  }
  if (N == 1)
  {
    cout << 0 << endl;
  }
  else
  {
    int64_t ans = pow10[N];
    ans = (ans - (2 * pow9[N] % MOD) + MOD) % MOD;
    (ans += pow8[N]) %= MOD;
    cout << ans << endl;
  }
}


Measured memory_bytes: 50504
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<ll> a(3 * n);
    for (int i = 0; i < a.size(); ++i) {
        cin >> a[i];
    }
    sort(a.rbegin(), a.rend());

    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        ans += a[2 * i + 1];
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Extentions;

class IO
{
    int idx;
    string[] input = In.ReadToEnd().Split(new[] { " ", "\n", "\r" },
        StringSplitOptions.RemoveEmptyEntries);

    T Get<T>(Func<string, T> parser) => parser(input[idx++]);

    public string S => Get(s => s);
    public char C => Get(char.Parse);
    public int I => Get(int.Parse);
    public long L => Get(long.Parse);
    public double F => Get(double.Parse);
    public decimal D => Get(decimal.Parse);
    public BigInteger B => Get(BigInteger.Parse);

    T[] Gets<T>(int n, Func<string, T> parser)
        => input.Skip((idx += n) - n).Take(n).Select(parser).ToArray();

    public string[] Ss(int n) => Gets(n, s => s);
    public char[] Cs(int n) => Gets(n, char.Parse);
    public int[] Is(int n) => Gets(n, int.Parse);
    public long[] Ls(int n) => Gets(n, long.Parse);
    public double[] Fs(int n) => Gets(n, double.Parse);
    public decimal[] Ds(int n) => Gets(n, decimal.Parse);
    public BigInteger[] Bs(int n) => Gets(n, BigInteger.Parse);

    public void Write<T>(params T[] xs) => WriteLine(string.Join(" ", xs));
    public void Write(params object[] xs) => WriteLine(string.Join(" ", xs));
}

static class Extentions
{
}

static class Program
{
    public static void Main()
    {
        var sw = new StreamWriter(OpenStandardOutput()) { NewLine = "\n" };
#if DEBUG
        sw.AutoFlush = true;
#else
        sw.AutoFlush = false;
#endif
        SetOut(sw);
        Solve(new IO());
        Out.Flush();
    }

    static void Solve(IO io)
    {
        var n = io.I;
        var k = io.I;
        var ans = 1;
        for (var i = 0; i < n; i++) ans = Min(ans * 2, ans + k);
        io.Write(ans);
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int n;
    std::cin>>n;
    std::vector<std::string> s(n);
    for(auto i = s.begin();i != s.end();i++){
        std::cin>>*i;
    }

    std::string ans = "Three";
    for(auto i = s.begin();i != s.end();i++){
        if((*i).find("Y") != std::string::npos){
            ans = "Four";
            break;
        }
    }
    std::cout<<ans<<std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <vector>

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPC(i, a) REP(i, 0, a)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)
#define RREPC(i, a) RREP(i, a, 0)
#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr int I_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

template <class T> static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
static boost::dynamic_bitset<> scan(char trueValue = 'o');

int main(int argc, char *argv[]) {
  // INFILE();
  ll n, k;
  cin >> n >> k;
  ll total = k;

  REPC(i, n - 1) total *= (k - 1);
  cout << total << endl;
  return 0;
}

template <class T> static void scan(vector<T> &v) {
  map<type_index, const char *const> m = {{typeid(int), "%d"},
                                          {typeid(ll), "%lld"},
                                          {typeid(double), "%lf"},
                                          {typeid(char), "%c"}};

  auto tFormat = m[typeid(T)];

  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string> &v, bool isWord) {
  if (isWord) {
    for (auto &n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

static boost::dynamic_bitset<> scan(char trueValue) {
  string s;
  getline(cin, s);

  if (s.size() == 0) {
    getline(cin, s);
  }

  for_each(begin(s), end(s),
           [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
  return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


Measured memory_bytes: 256