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

using namespace std;

int main(void) {
  map<string, int> hand;
  cin >> hand["Alice"] >> hand["Bob"];
  if (hand["Alice"] == 1) hand["Alice"] += 13;
  if (hand["Bob"] == 1)   hand["Bob"] += 13;

  if (hand["Alice"] > hand["Bob"]) {
    cout << "Alice" << endl;
  } else if (hand["Alice"] < hand["Bob"]) {
    cout << "Bob" << endl;
  } else {
    cout << "Draw" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <utility>
using namespace std;
using ll = long long int;
using pa = pair<int, int>;
 
int main() {
	int N, A, B;
	cin >> N >> A >> B;
 
	cout << min(A, B) << " " << max(A + B - N, 0);
 
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <functional>
using namespace std;
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N - 1), B(N - 1);
	vector<vector<int> > G(N);
	for (int i = 0; i < N - 1; ++i) {
		cin >> A[i] >> B[i]; --A[i], --B[i];
		G[A[i]].push_back(B[i]);
		G[B[i]].push_back(A[i]);
	}
	vector<long long> S(N);
	for (int i = 0; i < N; ++i) {
		cin >> S[i];
	}
	vector<int> sub(N, 1);
	function<void(int, int)> dfs = [&](int pos, int pre) {
		for (int i : G[pos]) {
			if (i != pre) {
				dfs(i, pos);
				sub[pos] += sub[i];
			}
		}
	};
	dfs(0, -1);
	vector<long long> ans(N - 1);
	int equal_ptr = -1;
	long long sum = 0;
	for (int i = 0; i < N - 1; ++i) {
		if (sub[A[i]] < sub[B[i]]) {
			swap(A[i], B[i]);
		}
		if (sub[B[i]] * 2 == N) {
			equal_ptr = i;
		}
		else {
			ans[i] = (S[A[i]] - S[B[i]]) / (2 * sub[B[i]] - N);
			sum += ans[i] * sub[B[i]];
		}
	}
	if (equal_ptr != -1) {
		ans[equal_ptr] = (S[0] - sum) / (N / 2);
	}
	for (int i = 0; i < N - 1; ++i) {
		cout << ans[i] << '\n';
	}
	return 0;
}

Measured memory_bytes: 18432
#include <iostream>
#include <map>
using namespace std;
int main(){
  int n; cin >> n;
  map<int, int> m;
  for(int i=0; i<n; i++){
    int a;
    cin >> a;
    m.insert(make_pair(a, i+1));
  }
  cout << m[1];
  for(int i=2; i<=n; i++) cout << " " << m[i];
  return 0;
}

Measured memory_bytes: 5504
package main

import (
  "fmt"
)

func main() {
  var n, m int
  fmt.Scanf("%d %d\n", &n, &m)

  total := 0
  a := make([]int, n)
  for i:=0; i < n; i++ {
    var tmp int
    fmt.Scan(&tmp)
    a[i] = tmp
    total += tmp
  }

  cnt := 0
  for _, v := range(a) {
    if float64(v) >= float64(total)/(4.0*float64(m)) {
      cnt += 1
    }
  }
    
  if cnt >= m {
    fmt.Println("Yes")
  } else {
    fmt.Println("No")
  }
}

Measured memory_bytes: 512
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<double,double>         pdd;
typedef pair<ld,ld>                 pld;
typedef pair<string , string>       pss;
#define pb(x)                       push_back(x)
#define ts(x)                       to_string(x)
#define ti(x)                       stoi(x)
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define tab                         '\t'
#define sep                         ' '
#define mine(v)                     *min_element(all(v))
#define maxe(v)                     *max_element(all(v))
#define error(x)                    cerr << #x << " = " << x << endl
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define endl                        "\n"
inline ll input(){ll n; cin >> n ; return n;}
ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const int MAXN = 1e3 + 10;
const int MOD = 1e9 + 7;
const int MOD2 = 998244353;
const ll INF = 8e18;
ll n;
ll w[MAXN],s[MAXN],v[MAXN];
ll wa[MAXN],sa[MAXN],va[MAXN];
vector<pll> vec;
ll dp[20010];
ll dp2[20010];
ll ans;

int main()
{
    fast_io;
    cin >> n;
    for(int i = 1;i <= n;i++){
        cin >> w[i] >> s[i] >> v[i];
    }
    for(int i = 1;i <= n;i++){
        vec.push_back({w[i] + s[i],i});
    }
    sort(all(vec));
    for(int i = 0;i < n;i++){
        ll ind = vec[i].S;
        wa[i + 1] = w[ind];
        sa[i + 1] = s[ind];
        va[i + 1] = v[ind];
    }
    for(int i = 1;i <= n;i++)
    {
        for(int j = 0;j <= sa[i];j++){
            dp2[wa[i] + j] = max(dp[j] + va[i],dp[wa[i] + j]);
        }
        for(int j = 1;j <= 20000;j++)
            dp[j] = max(dp[j],dp2[j]);
    }
    for(int i = 1;i <= 20000;i++){
        ans = max(ans,dp[i]);
    }

    cout << ans << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<climits> //INT_MIN/MAX
using namespace std;

#define FOR(i,s,e) for(ll (i)=(s);(i)<(e);(i)++)
#define FORR(i,s,e) for(ll (i)=(s);(i)>(e);(i)--)
#define MOD 1000000007
#define debug(x) cout<<#x<<": "<<x<<endl
typedef long long ll;

/* 2017/01/18 問題 ----- abc051 d /Link http://abc051.contest.atcoder.jp/tasks/abc051_d */
/* -----解説等-----
問題:


*/
#define INF 10000000
int d[110][110];
int s[1010];
int t[1010];
int c[1010];

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

    int M; int N;
    cin >> N >> M;

    FOR(i, 0, N) { //for Warshall
        FOR(j, 0, N) {
            if (i == j)d[i][j] = 0;
            else d[i][j] = INF;
        }
    }
    
   


    FOR(i, 0, M) {
        cin >> s[i] >> t[i] >> c[i];
        s[i]--; t[i]--;
        d[s[i]][t[i]] = c[i];
        d[t[i]][s[i]] = c[i];
    }

    FOR(k, 0, N) { 
        FOR(i, 0, N) {
            if (d[i][k] < INF)
                FOR(j, 0, N) {
                if (d[k][j] == INF)continue;
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }

    //使用したかのチェック
    ll ans=0;
    FOR(i, 0, M) {// M辺についてcheck
        int yes = 1;
        FOR(j, 0, N) {
            FOR(k, 0, N) {
                if(j!=k)
                //最短経路であるか否か
                if (d[j][k] == d[j][s[i]] + c[i] + d[t[i]][k])yes = 0;
            }
        }
        ans += yes;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;

int main()
{string S;
 cin >> S;
 //配列S入力
 int cnt1 = 0;
 int cnt2 = 0;
 
 for(int i = 0; i < S.size(); i++)
 {if(i%2 == 0 && S[i] != '0'){cnt1++;}
  else if(i%2 == 1 && S[i] !='1'){cnt1++;}
  else if(i%2 == 0 && S[i] =='0'){cnt2++;}
  else if(i%2 == 1 && S[i] =='1'){cnt2++;}}
 
 cout << min(cnt1,cnt2) << endl;
 
 return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()){
			int n = sc.nextInt();
			int m = sc.nextInt();
			
			int[][] map = new int[n][2];
			
			for(int i=0;i<n;i++){
				map[i][0] = sc.nextInt();
				map[i][1] = sc.nextInt();
			}
			
			Arrays.sort(map, new Comparator<int[]>(){
				public int compare(int[] o1, int[] o2) {
					return o1[0] - o2[0];
                }
            });

			int cnt, a, b, c, d;
			for(int i=0;i<m;i++){
				cnt = 0;
				a = sc.nextInt();
				b = sc.nextInt();
				c = sc.nextInt();
				d = sc.nextInt();
				
				for(int j=0;j<n;j++){
					if(map[j][0]>=a){
						for(int k=j;k<n;k++){
							if(map[k][0]>c){
								j = n;
								k = n;
							}else if(b<=map[k][1] && map[k][1]<=d){
								cnt++;
							}
						}
						break;
					}
				}
				System.out.println(cnt);
			}
		}	
	}	
}

Measured memory_bytes: 159944
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
	int N;
	int A[100];
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	ll money = 1000;
	ll kabu = 0;
	for(int i = 0; i < N-1; i++){
		if(A[i] <= A[i+1]){
			kabu += money / A[i];
			money -= (money / A[i]) * A[i];
		}
		else{
			money += kabu * A[i];
			kabu = 0;
		}
	}
	money += kabu * A[N-1];
	cout << money << endl;
	return 0;
}


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

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

    vector<long> a(n);
    vector<pair<long,long>> bc(m);
    for(int i=0; i<n; i++)
        cin >> a[i];
    for(int i=0; i<m; i++)
        cin >> bc[i].second >> bc[i].first;

    sort(a.begin(), a.end());
    sort(bc.begin(), bc.end());

    auto it = a.begin();
    for(int i=m-1; i>=0; i--) {
        long b = bc[i].second;
        long c = bc[i].first;
        auto nt = upper_bound(it, a.end(), c);
        if(nt - it > b)
            nt = it + b;
        for(auto t = it; t != nt; t++)
            *t = c;
        it = nt;
    }


    long sum = 0;
    for(auto &x: a) sum += x;

    cout << sum << endl;
}


Measured memory_bytes: 2560
#include <stdio.h>

int main(void)
{
	char s[100] ;
	int a=0, i=0 ;
	
	scanf("%s",s) ;
	
	for(i=0; i<100 ; i++){
		if(a == 0 && s[i] == 'C'){
			a++ ;
			
		}
		if(a == 1 && s[i] == 'F'){
			a++ ;
			break ;
		}
	}
	
	if(a == 2) printf("Yes\n") ;
	else printf("No\n") ;
	
	return 0;
	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int h,a;
	cin >> h >> a;

	cout << h/a + (h%a==0 ? 0 : 1) << '\n';
	return 0;
}



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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c; cin>>a>>b>>c;
    if (a+b+c>=22){
        cout<<"bust\n";
    }else{
        cout<<"win\n";
    }
    return 0;
}


Measured memory_bytes: 256
n,x=gets.split.map &:to_i
a=[1];b=[1]
n.times{|i|a<<a[i]*2+3;b<<b[i]*2+1}
f=->n,x{n==0 ? x<=0?0:1 : x<=1+a[n-1] ? f[n-1,x-1] : b[n-1]+1+f[n-1,x-2-a[n-1]]}
p f[n,x]

Measured memory_bytes: 1916
/*
 * wafuIroha.cpp
 *
 *  Created on: 2020/02/23
 *      Author: black
 */
#include <iostream>
using namespace std;

int main(){
	string s;
	cin >> s;

	for(int i=0; i<s.length(); ++i){
		for(int j=i+1; j<s.length(); ++j){
			if (s[i] == s[j]){
				cout << "no" << endl;
				return 0;
			}
		}
	}
	cout << "yes" << endl;

	return 0;
}


Measured memory_bytes: 256
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product

def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=list(map(int,input().split()))

ans=0
flag=-1

for i in range(n-1):
    if flag==-1:
        if a[i]>a[i+1]:
            flag=0
        elif a[i]<a[i+1]:
            flag=1
    elif flag==1:
        if a[i]>a[i+1]:
            flag=-1
            ans+=1
    else:
        if a[i]<a[i+1]:
            flag=-1
            ans+=1

print(ans+1)

Measured memory_bytes: 89320
import java.util.Arrays;
import java.util.Scanner;

/**
 * ABC111C
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        long C = sc.nextLong();
        long D = sc.nextLong();
        
        long CD = lcm(Math.max(C, D),Math.min(C, D));
        
        long cnum = num(C,A,B);
        long dnum = num(D,A,B);;
        long cdnum = num(CD,A,B);
       
        long ans = (B-A+1)-(cnum+dnum-cdnum);
        
//        System.out.println(cnum +" "+ dnum + " " + cdnum);
        

        System.out.println(ans);
        
        sc.close();
    }
    
    static long lcm (long a, long b) {
    	long temp;
    	long c = a;
    	c *= b;
    	while((temp = a%b)!=0) {
    		a = b;
    		b = temp;
    	}
    	return (long)(c/b);
    }
    
    static long num(long n,long A,long B) {
    	if(A%n==0) {
        	return (B-(A))/n+1;
        }else if((A+(n-A%n)>B)){
        	return 0;
        }else {
        	return(B-(A+(n-A%n)))/n+1;
        }
    }
}

Measured memory_bytes: 23124
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	while (1) {
		string t;
		cin >> t;
		if (t == "-")
			break;
		int n, h;
		cin >> n;
		for (int i = 0; i < n; i++) {
			cin >> h;
			string t2 = t.substr(0, h);
			t.erase(0, h);
			t += t2;
		}
		cout << t << endl;
	}
	return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  ll n;
  cin>>n;
  int a[n];
  ll ans=0;
  map<int,int> m;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
    m[a[i]]++;
    ans+=a[i];
  }
  ll q;
  cin>>q;
  for(ll i=0;i<q;i++)
  {
    int b,c;
    cin>>b>>c;
    ans=ans+(m[b]*(c-b));
    m[c]=m[c]+m[b];
    m[b]=0;
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 8320
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    for(i in 0 .. 50000){
        if((i * 1.08).toInt() == n){
            println(i)
            break
        }
        else if (i == 50000){
            println(":(")
        }
    }
}


Measured memory_bytes: 31688
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main(){
	string str;
	getline(cin,str);
	
		for(int i=0;i<str.size();i++)
		{
			if('A'<=str[i] && str[i]<='Z')
			{
				str[i]+=32;
				cout<<str[i];
			}
			else if('a'<=str[i] && str[i]<='z')
			{
				str[i]-=32;
				cout<<str[i];
			}
			else
			{
				cout<<str[i];
			}
		}
	
	cout<<endl;
	return 0;
}


Measured memory_bytes: 3156
s = list(input())
count = 0
l = 0
r = len(s)-1

#リストsの先頭と末尾を比較
#先頭と末尾がx以外で異なるなら,-1を返す。
#先頭と末尾が同じなら先頭と末尾を移動させる。
#どちらか片方がxなら片方にxを追加し先頭と末尾を移動させたとするので最初にxだったほうだけ移動させる

#xabxa
while l != r:
    if s[l] != s[r]:
        if s[l] != "x" and s[r] != "x":
            count = -1
            break
        elif s[l] == "x" and s[r] != "x":
            l += 1
            count += 1
        elif s[r] == "x" and s[l] != "x":
            r -= 1
            count += 1
    elif s[l] == s[r]:
        if abs(l-r) == 1:
            break
        else:
            l += 1
            r -= 1

print(count)

Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define ff(i, n) for (int i = 1; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;

vl g[N];
map<pair<int,int>,int> m;

void dfs(int v, int p){
    int cnt = 1, temp = 0;
    if(p != 0)temp = m[mp(p,v)];
    f(i,g[v].size()){
        int k = g[v][i];
        if(k != p){
            if(cnt == temp)cnt++;
            m[mp(v,k)] = cnt++;
            dfs(k,v);
        }
    }
    return ;
}


void solve(){
    int n, mx = LLONG_MIN;
    cin>>n;
    int a[n+3];
    f(i,n+3)a[i] = 1;
    vector<pair<int,int> > v;
    f(i,n-1){
        int x, y;
        cin>>x>>y;
        v.pb(mp(x,y));
        g[x].pb(y);
        g[y].pb(x);
    }
    ff(i,n)mx = max(mx,(int)g[i].size());
    cout<<mx<<endl;
    dfs(1,0);
    f(i,v.size())cout<<m[v[i]]<<endl;
}


int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


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

using namespace std;

namespace IntegerMath
{
  int64_t floor_div(int64_t x, int64_t y) {
    return x / y;
  }
  
  int64_t ceil_div(int64_t x, int64_t y) {
    return (x / y) + min(static_cast<int64_t>(1), x % y);
  }

  int64_t sqrt(int64_t x) {
    return static_cast<int64_t>(
      ::floorl( ::sqrtl( 
        static_cast<long double>(x)
      ) )
    );
  }

  int64_t log2(int64_t x) {
    return static_cast<int64_t>(
      ::floorl( ::log2l( 
        static_cast<long double>(x)
      ) )
    );
  }    

  int64_t log10(int64_t x) {
    return static_cast<int64_t>(
      ::floorl( ::log10l( 
        static_cast<long double>(x)
      ) )
    );
  }

  int64_t number_of_digits(int64_t x) {
    return static_cast<int64_t>(
      ::ceill( ::log10l( 
        static_cast<long double>(x + 1)
      ) )
    );
  }

  uint64_t gcd(uint64_t a, uint64_t b)
  {
    uint64_t n = std::min(a, b), m = std::max(a, b);
    return (n == 0) ? m : gcd(m % n, n);
  }

  uint64_t lcm(uint64_t a, uint64_t b)
  {
    uint64_t d = gcd(a, b);
    return (a % d == 0) ? (a / d) * b : a * (b / d);
  }
};

struct QueueItem {
  uint64_t a, f;
  
  QueueItem(uint64_t a, uint64_t f) : a(a), f(f) {}
  uint64_t cost() const { return a * f; }
  
  bool operator<(const QueueItem &rhs) const { return cost() < rhs.cost(); }
};

bool binary_search_query(
  uint64_t N, uint64_t K, 
  const vector<uint64_t> &A, const vector<uint64_t> &F, 
  uint64_t z
)
{
  for (uint64_t n = 0; n < N; ++n) {
    uint64_t c = A[n] * F[n];
    if (c > z) {
      uint64_t k = IntegerMath::ceil_div(c - z, F[n]);
      if (k > K) { return false; }
      K -= k;
    }
  }
  return true;
}

uint64_t binary_search(
  uint64_t N, uint64_t K, 
  const vector<uint64_t> &A, const vector<uint64_t> &F
)
{
  uint64_t hi = 0, lo = 0;
  for (uint64_t n = 0; n < N; ++n) {
    hi = max(hi, A[n] * F[n]);
  }
  
  while (hi - lo > 1) {
    uint64_t mid = (hi + lo) >> 1;
    if (binary_search_query(N, K, A, F, mid)) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  
  return binary_search_query(N, K, A, F, lo) ? lo : hi;
}

int main()
{
  uint64_t N, K;
  cin >> N >> K;
  
  vector<uint64_t> A(N), F(N);
  for (uint64_t n = 0; n < N; ++n) { cin >> A[n]; }
  for (uint64_t n = 0; n < N; ++n) { cin >> F[n]; }
  
  sort(A.begin(), A.end(),    less<uint64_t>());
  sort(F.begin(), F.end(), greater<uint64_t>());
  
  cout << binary_search(N, K, A, F) << endl;
  
  return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
using namespace std;
int main(int argc, const char * argv[]) {
    string s;
    int K,n;
    cin>>s>>K;
    n=s.length();
    for(int i=0;i<n;i++){
        if(s[i]=='a')continue;
        if(K>='z'+1-s[i]){
            K-='z'+1-s[i];
            s[i]='a';
        }
    }
    if(K){
        K%=26;
        s.back()+=K;
    }
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 512
//=========================================c++
/* ===========================================
// 20.04.07 AtCoder Beginner Contest 160. D - Line++
// 
// 
=========================================== */
/* ===========================================

content

=========================================== */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int (i)=1;(i)<=(n);i++)
#define rez(i,n) for(int (i)=0;(i)<(n);i++)
#define ET "\n"
#define CLR(arr) memset(&arr, 0, sizeof(arr))

class CRun{
private:
    struct {
        int N = 0;
        int X = 0;
        int Y = 0;
        //unique_ptr<vector<int>[]> vec;
    }gv;
public:
    CRun(){}; ~CRun(){};
    
    void build();
    void solve();
};

void CRun::build(){
    cin >> gv.N >> gv.X >> gv.Y;
}

void CRun::solve(){
    int ans[gv.N +1]; memset(&ans, 0, sizeof(ans));
    
    for (int start = 1; start < gv.N; start++) {
        for (int end = start +1; end <= gv.N; end++) {
            int pass_1 = end - start;
            int pass_2 = abs(gv.X - start) + abs(gv.Y - end) + 1;
            ans[min(pass_1, pass_2)] += 1;
        }
    }
    
    rep (i, gv.N -1) {
        cout << ans[i] << ET;
    }
}


int main(){
    CRun run;
    run.build();
    run.solve();
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN=100010;
int x,y,a,b,c,t,tot;
ll p[MAXN*3],q[MAXN],r[MAXN],ans;
int main () {
	scanf("%d%d%d%d%d",&x,&y,&a,&b,&c);
	for (int i=1;i<=a;i++) {
		scanf("%d",&q[i]);
	}
	sort(q+1,q+a+1);
	for (int i=a;i>=a-x+1;i--) {p[++tot]=q[i];}
	for (int i=1;i<=b;i++) {
		scanf("%d",&r[i]);
	}
	sort(r+1,r+b+1);
	for (int i=b;i>=b-y+1;i--) {p[++tot]=r[i];} 
	for (int i=1;i<=c;i++) {
		scanf("%d",&t);
		p[++tot]=t;
	}
	sort(p+1,p+tot+1);
	for (int i=tot;i>=tot-x-y+1;i--) {
		ans+=p[i];
	}
	printf("%lld\n",ans);
	return 0;
}


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

int main(){
    int n, i, j;
    vector<int> a(200000);
    cin >> n;
    for(i = 0;i < n;i++){
        cin >> a.at(i);
    }
    int max1, max2, maxi;
    max1 = -1;
    for(i = 0;i < n;i++){
        if(max1 < a.at(i)){
            max1 = a.at(i);
            maxi = i;
        }
    }

    max2 = -1;
    for(j = 0;j < n;j++){
        if(max2 < a.at(j) && maxi != j){
            max2 = a.at(j);
        }
    }

    if(max1 == max2){
        for(i = 0;i < n;i++){
            cout << max1 << endl;
        }
    }else{
        for(i = 0;i < n;i++){
            if(i == maxi){
                cout << max2 << endl;
            }else{
                cout << max1 << endl;
            }
        }
    }
}

Measured memory_bytes: 2432
(defun solver ()
  (let* ((a (read)) (b (read)) (c (read)) (2c (* 2 c))
         (x (read)) (y (read)))
    (cond ((< (+ a b) 2c)
           (format t "~a~%" (+ (* x a) (* y b))))
          ((and (> x y) (> 2c a))
           (format t "~a~%" (+ (* y 2c) (* (- x y) a))))
          ((and (> x y) (<= 2c a))
           (format t "~a~%" (* x 2c)))
          ((and (<= x y) (> 2c b))
           (format t "~a~%" (+ (* x 2c) (* (- y x) b))))
          ((and (<= x y) (<= 2c b))
           (format t "~a~%" (* y 2c))))))

(solver)


Measured memory_bytes: 6628
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<ctype.h>
#include<math.h>
#define PI 3.14159265359
#define N_MAX 100
#define min(x,y) ((x) < (y) ? (x) : (y))
#define max(x,y) ((x) > (y) ? (x) : (y))

void swap(int *a,int *b)
{
  int tmp;
  tmp = *a;
  *a = *b;
  *b = tmp;
}

void Selectionsort(int a[],const int n)
{
  int i, j, min_index, count = 0;
  for(i = 1; i <= n; i++)
    {
      min_index = i;
      for(j = i; j <= n; j++)
	{
	  if(a[j] < a[min_index]) min_index = j;
	}
      if(min_index != i)
	{
	  swap(&a[i],&a[min_index]);
	  count++;
	}
    }
  for(i = 1; i <= n; i++)
    {
      printf("%d",a[i]);
      if(i != n) printf(" ");
    }
  printf("\n%d\n",count);
}

int main()
{
  int i,n,a[N_MAX+1];
  scanf("%d",&n);
  for(i = 1; i <= n; i++) scanf("%d",&a[i]);
  Selectionsort(a,n);
  return 0;
}

Measured memory_bytes: 604
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static long[] ans = new long[]{-1,-1,-1};
	public static void main(String[] args) throws Exception {


		String s = nextString();

		int min=s.length();
		for(char c = 'a' ;c <='z';c++){
			char[] x = s.toCharArray();
			for(int i=0;i<x.length;i++){
				boolean flg=true;
				for(int k=0;k<x.length-i;k++){
					if(x[k]==c){
						if(k!=0){
							x[k-1]=c;
						}
					}else{
						flg=false;
					}
				}
				if(flg){
					min=Math.min(min, i);
					break;
				}
			}
		}
		System.out.println(min);

	}



	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 22740
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 10;
const int inf=0x3f3f3f3f;

string s;
int k;
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>k>>s;
    int len=s.length();
    if(len<=k) cout<<s<<endl;
    else{
        for(int i=0;i<k;i++) cout<<s[i];
        cout<<"..."<<endl;
    }
    return 0;
}


Measured memory_bytes: 3036
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define F first
#define S second
#define mod 1000000007
#define INF 9000000000000000000
signed main(void){
    int n;cin>>n;
    vector<int>V(n);rep(i,n)cin>>V[i];
    int ans=0;int x=0;
    rep(i,n-1){
        if(V[i+1]<=V[i])x++;
        else x=0;
        ans=max(ans,x);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s,a;
    cin>>s;
    int n=s.size();
    int b=0;
    
    for (int i=0;i<n;i++){
        if(a.size()==0&&s[i]=='B'){
            continue;
        }
        
        else if(s[i]!='B'){
        a.push_back(s[i]);
        
        }
        else{
         a.pop_back();
        }
    }
    cout<<a<<endl;
}
    


Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
 while(1){
  int H,W;
  scanf("%d%d", &H,&W);
  if(H==0 && W==0){break;}
  int i,j;
  for(i=0; i<H; i++){
   for(j=0; j<W; j++){
    if(i%2==0 && j%2==0){printf("#");}
    else if(i%2==0 && j%2==0){printf("#");}
    else if(i%2!=0 && j%2==0){printf(".");}
    else if(i%2==0 && j%2!=0){printf(".");}
    else if(i%2!=0 && j%2!=0){printf("#");}
}
   printf("\n");
  }
  printf("\n");
 }
 return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N;
  cin >> N;
  vi A(N+1),B(N);
  rep(i,N+1) cin >> A[i];
  rep(i,N) cin >> B[i];
  
  ll ans=0;
  rep(i,N) {
    if(B[i]<=A[i]) ans+=B[i];
    else {
      B[i]-=A[i];
      ans+=A[i];
      if(B[i]<=A[i+1]) {
        ans+=B[i];
        A[i+1]-=B[i];
      }
      else {
        ans+=A[i+1];
        A[i+1]=0;
      }
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3964
n,k = map(int,input().split())
r,s,p = map(int,input().split())
S = input()
ans = 0
hand = ""
dic = {"r":"p","p":"s","s":"r"}
for i in range(n):
    if i < k:
        if S[i] == "r":
            ans += p
            hand += "p"
        elif S[i] == "p":
            ans += s
            hand += "s"
        else:
            ans += r
            hand += "r"
   
    else:
        if dic[S[i]] == hand[i-k]:
            hand += "q"
            continue
        else:
            if S[i] == "r":
                ans += p
                hand += "p"
            elif S[i] == "p":
                ans += s
                hand += "s"
            else:
                ans += r
                hand += "r"
        
print(ans)

Measured memory_bytes: 3444
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] suki = new int[m+1];
		for(int  i= 0; i < n; i++){
			int k = sc.nextInt();
			for(int j = 0; j < k; j++){
				suki[sc.nextInt()]++;
			}
		}
		int count = 0;
		for(int i = 1; i <= m; i++){
			if(suki[i] == n){
				count++;
			}
		}
		System.out.print(count);
	}
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
string T;
using pvv=pair<vector<int>,vector<int>>;

void update(int,int&,int&);
pvv createbit(int);

int main(){
    int N;
    cin >> N >> T;
    pvv ans = createbit(N);
    for(int x:ans.first){
        cout << x << " ";
    }
    cout << endl;
}


void update(int q,int &last,int &next){
    if(next!=0&&last%2!=q%2)next=3-next;
    last=q;
}


pvv createbit(int N){
    if(N==0){
        pvv send;
        send.first={0};
        send.second=vector<int>(T.size(),0);
        return send;
    }
    pvv receve = createbit(N-1);
    pvv send;
    int pot = (int)receve.first.size();
    send.first=vector<int>(pot*3,0);
    send.second=vector<int>(T.size());
    vector<int>next(pot*3);
    int q=0;
    vector<int>last(pot*3,0);
    for(int i=0;i<3;i++)for(int x=pot*i;x<pot*(i+1);x+=1)next[x]=i;
    
    
    
    for(int i=0;i<T.size();i++){
        if(T[i]=='S'){
            q++;
            continue;
        }
        
        int k=receve.second[i];
        
        for(int x=k;x<pot*3;x+=pot){
            update(q, last[x], next[x]);
            
            if(next[x]==2)send.second[i]=x;
        }
        
        for(int x=k;x<=pot*3;x+=pot)next[x]=(next[x]+1)%3;
        
    }
    
    for(int i=0;i<pot*3;i++){
        update(q, last[i], next[i]);
        send.first[i]=receve.first[i%pot]+next[i]*pot;
    }
    
    return send;
    
}

Measured memory_bytes: 14072
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
#define all(v) v.begin(), v.end()

int main(){
  ll N,A,B;
  cin >> N >> A >> B;
  if(A>B||(N==1&&A!=B)){
    cout << 0 << endl;
  }else{
    cout << ((N-1)*B+A)-((N-1)*A+B)+1 << endl;
  }
}
      

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
int N;
int a[10101];

int main() {
  cin >> N;
  ll ans = 0;
  rep(i, 0, N) {
    int a;
    cin >> a;
    while (a) {
      if (a % 2 == 0) {
        a /= 2;
        ans++;
      } else {
        break;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import math
K=int(input())
N=0
k=K*K
d1=[0]*int(k)
i=0
j=0
for b in range(K):
    for c in range(K):
        d1[i]=math.gcd((c+1),(b+1))
        i+=1
for a in range(K):
    for x in d1:
        N+=math.gcd(x,(a+1))
print(N)

Measured memory_bytes: 9400
# pragma GCC optimize("Ofast")
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size)
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int h,w; cin >> h >> w;
    vector<string> a(h);
    vector<string> ans(h);
    rep(i,h) cin >> a[i];
    vector<vector<int> > map(h,vector<int> (w,1)); 
    //行の削除
    rep(i,h){
        rep(j,w){
            if(a[i][j]=='#') break;
            if(j==w-1){
                rep(k,w){
                    map[i][k] = 0;
                }
            }
        }
    }

    //列の削除
    rep(i,w){
        rep(j,h){
            if(a[j][i]=='#') break;
            if(j==h-1){
                rep(k,h){
                    map[k][i] = 0;
                }
            }
        }
    }
    int k = 0;
    rep(i,h){
        bool judge = true;
        rep(j,w){
            if(map[i][j]==1){
                judge = false;
                ans[k] += a[i][j];
            }
        }
        if(judge == false)++k;
    }

    rep(i,k){
            cout << ans[i];
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 384
import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int a, b;
    readf("%s %s", &a, &b);
    readln;
    
    auto ans = max(max(a + b, a - b), a * b);
    
    ans.writeln;
}

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

int main() {
    int N;
    cin >> N;
    vector<string> W(N);
    for (int i = 0; i < N; i++) {
        cin >> W[i];
    }

    set<string> st;
    for (int i = 0; i < N; i++) {
        if (i > 0 && (st.find(W[i]) != st.end() || W[i - 1].back() != W[i][0])) {
            cout << "No" << endl;
            return 0;
        }
        st.insert(W[i]);
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>

using namespace std;


int main() {
  int H,W;
  cin >> H >> W;
  
  vector<string> s;
  vector<string> s_rep;
  
  for(int i=0;i<H;++i) {
    string tmp;
    cin >> tmp;
    s.push_back(tmp);
    s_rep.push_back(tmp);
  }
  
  //string result;
  
  for(int i=0;i<H*W;++i) {
    int h = i / W;
    int w = i % W;
    
    if(s[h][w] == '#'){ s_rep[h][w]='#'; continue; }
    
    int count=0;
    if(h-1>=0 && s[h-1][w] == '#'){ count++; }
    if(h+1<H && s[h+1][w] == '#'){ count++;}
    if(w-1>=0 && s[h][w-1] == '#'){ count++;}
    if(w+1<W && s[h][w+1] == '#'){ count++;}
    
    if((h-1>=0 && w-1>=0) && s[h-1][w-1] == '#'){ count++;}
    if((h-1>=0 && w+1<W) && s[h-1][w+1] == '#'){ count++;}
    if((h+1<H && w-1>=0) && s[h+1][w-1] == '#'){ count++;}
    if((h+1<H && w+1<W) && s[h+1][w+1] == '#'){ count++;}
    
    //cout << "/" << count << "/";
    s_rep[h][w] = to_string(count)[0];
    //cout << endl;
  }
  
  for(int i=0;i<H;++i) {
    cout << s_rep[i] << endl;
  }
}

Measured memory_bytes: 256
import sys,collections;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n = I()
s = list(Ss())
if s.count("Y") > 0:
    print("Four")
else:
    print("Three")

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

using namespace std;

#define vv vector< vector< int > >
#define ll long long
#define ALL(a) (a).begin(), (a).end()
const long long mod = 1000000000 + 7;
const long long INF = 9e18;
const double PI = 3.14159265358979323846;

ll gcd(ll a, ll b){if (b == 0) return a;return gcd(b, a % b);}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int vector_finder(vector<int> vec, int number) {
    auto itr = find(vec.begin(), vec.end(), number);
    size_t index = distance( vec.begin(), itr );
    if (index != vec.size()) {
        return 1;
    }
    else {
        return 0;
    }
}

int main(){
    int s;
    cin >> s;
    vector<int> nums;
    nums.push_back(s);
    int i = 2;
    while(true){
        if (s % 2 == 0){
            s = s / 2;
        }
        else{
            s = 3*s + 1;
        }
        if(vector_finder(nums, s)){
            cout << i << endl;
            return 0;
        }
        else{
            nums.push_back(s);
        }
        i++;
    }
    return 0;
}


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

long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

int main()
{
	long long a, b;
	cin >> a >> b;
	long long x, y, d;
	d = extGCD(a, b, x, y);
	cout << x << " " << y << endl;
	return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, k; cin >> n >> k;
	double ans = 0;
	for(int i = n; i >= 1; i--){
		int j = 0, l = i;
		for(; l < k; l *= 2) j++;
		ans += 1.0 / n * pow(0.5, j);
	}
	printf("%.9f\n", ans);
	
	return 0;
}

Measured memory_bytes: 256
a, b, k = map(int, input().split())
div = []
for i in range(1, 105):
    if (a % i == 0) and (b % i == 0):
        div.append(i)

if len(div) < k: 
    print(max(div))
else:
    div.sort()
    print(div[-k])


Measured memory_bytes: 2940
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int A, B, C, N;
int L[8];
int V[3];

int f() {
  if (V[0] == 0 || V[1] == 0 || V[2] == 0) return 1<<28;
  return abs(V[0] - C) + abs(V[1] - B) + abs(V[2] - A);
}

int dfs(int idx) {
  if (idx == N) return f();

  V[0] += L[idx];
  int ret = 10+dfs(idx+1);
  V[0] -= L[idx];

  V[1] += L[idx];
  ret = min(ret, 10+dfs(idx+1));
  V[1] -= L[idx];

  V[2] += L[idx];
  ret = min(ret, 10+dfs(idx+1));
  V[2] -= L[idx];

  ret = min(ret, dfs(idx+1));
  return ret;
}

int main() {
  ios::sync_with_stdio(false);
  cin >> N >> A >> B >> C;
  for (int i=0; i<N; i++) {
    cin >> L[i];
  }
  cout << dfs(0) - 30 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

int n,q,S[10000],T[500];
int a,b=0,i,j,count=0;

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

    for(i=0;i<n;i++){
        for(j=0;j<q;j++){
            if(S[i]==T[j]){
                for(a=0;a<i;a++){
                    if(S[a]==S[i]){
                        b++;
                        break;
                    }
                }
            count++;
            }
        }
    }

printf("%d\n",count-b);

return 0;

}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

/*int n,p[10100],q[10100],r[10100],x[10100];
set<VI> hs;
bool valid() {
	int pl=r[0],pr=r[0];
	rep(i,1,n) {
		if (pl<r[i]&&r[i]<pr) return 0;
		if (r[i]<pl) pl=r[i]; else if (r[i]>pr) pr=r[i];
	}
	return 1;
}
void dfs(int x) {
	if (x==n) {
		rep(i,0,n) printf("%d ",r[i]); puts("");
		assert(valid()==hs.count(VI(r,r+n)));
	} else {
		rep(i,n-x,n+x+1) {
			r[x]=i;
			dfs(x+1);
		}
	}
}*/
const int N=110;
int n,a[N],dp[N][N][N],ret;
map<int,int> hs;
void upd(int &a,int b) {
	a+=b; if (a>=mod) a-=mod;
}
int main() {
	scanf("%d",&n);
	rep(i,1,2*n) scanf("%d",a+i),hs[a[i]]=0;
	sort(a+1,a+2*n);
	int id=0;
	for (auto &x:hs) x.se=++id;
	rep(i,1,2*n) a[i]=hs[a[i]];
	dp[0][1][0]=1;
	rep(i,0,n) rep(j,1,a[n+i]-a[n-i]+2) rep(k,0,j) if (dp[i][j][k]) {
		int nj=j,nk=k;
		if (a[n+i+1]!=a[n+i]) nj++;
		if (a[n-i-1]!=a[n-i]) nj++,nk++;
		if (i<n-1) {
			rep(l,0,nj) upd(dp[i+1][nj-max(abs(l-nk)-1,0)][l-max(l-nk-1,0)],dp[i][j][k]);
		} else {
			upd(ret,dp[i][j][k]);
		}
//		printf("%d %d %d %d\n",i,j,k,dp[i][j][k]);
	}
	printf("%d\n",ret);
}


Measured memory_bytes: 3200
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdlib.h>
#include<stack>
#include<set>
#include<string.h>
#include<map>
#include<vector>
#define pb push_back
#define eb emplace_back
#define ins insert 
#define mp make_pair
#define ll long long 
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define M 10000007
using namespace std;
void solve(){
	string s1,s2,s3="";
	cin>>s1>>s2;
	ll n1=s1.length(),n2=s2.length();
	ll lcs[n1+1][n2+1];
	for (int i = 0; i <=n1; ++i)
	{
		for (int j = 0; j <=n2; ++j)
		{
			if(i==0 || j==0)
				lcs[i][j]=0;
			else if(s1[i-1]==s2[j-1])
				lcs[i][j]=1+lcs[i-1][j-1];
			else
				lcs[i][j]=max(lcs[i-1][j],lcs[i][j-1]);
		}
	}
	ll i=n1,j=n2;
	while(i>0 && j>0){
		if(s1[i-1]==s2[j-1]){
			s3+=s1[i-1];
			i--;j--;
		}
		else if(lcs[i-1][j]>lcs[i][j-1])
			i--;
		else
			j--;
	}
	for (int i = s3.length()-1; i>=0; --i)
	{
		cout<<s3[i];
	}
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0 ;
}


Measured memory_bytes: 70656
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int X;
int A[100];
int main(){
  int i;
  int res = 0;
  rd(N);
  rd(X);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  sort(A,A+N);
  for(i=(0);i<(N-1);i++){
    if(X >= A[i]){
      X -= A[i];
      res++;
    }
  }
  if(X==A[N-1]){
    res++;
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191123-1

// --- original code ---
// int N, X, A[100];
// {
//   int res = 0;
//   rd(N,X,A(N));
//   sort(A,A+N);
//   rep(i,N-1) if(X >= A[i]) X -= A[i], res++;
//   if(X==A[N-1]) res++;
//   wt(res);
// }


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

#define pb push_back
#define fi first
#define se second
typedef long long ll;

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

	int n, m;
	cin >> n >> m;

	int ans = n * (n - 1) / 2 + m * (m - 1) / 2;
	cout << ans << '\n';
}


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

int N,M;
string s;
int ac[200005];
int bc[200005];
vector<int> G[200005];

int main(){
  cin>>N>>M;
  cin>>s;
  for(int i=0;i<M;i++){
    int u,v;
    cin>>u>>v;
    u--,v--;
    G[u].push_back(v);
    G[v].push_back(u);

    if(s[v]=='A')ac[u]++;
    else bc[u]++;
    
    if(s[u]=='A')ac[v]++;
    else bc[v]++;
  }
  
  set<int> st;
  queue< int > Q;
  
  for(int i=0;i<N;i++){
    if( ac[i]==0 || bc[i]==0){
      Q.push(i);
      st.insert(i);
    }
  }
  while(!Q.empty()){
    int pos=Q.front();Q.pop();
    for(int to:G[pos]){
      if(s[pos]=='A')ac[to]--;
      else bc[to]--;
      if(ac[to]==0||bc[to]==0)
        if( st.count(to) == 0 ){
          Q.push(to);
          st.insert(to);
        }
    }
  }

  if(st.size() == N )cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 20868
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<cmath>

using namespace std;
typedef long long LL;

LL n,a,b,c,d,x;

int main(){
	
	int i,j,k;
	cin>>n>>a>>b>>c>>d;
	
	for(i=0;i<n;i++){
		LL tmp=1ll*i*c-(n-1-i)*d;
		if(tmp<=(b-a)&&tmp+(n-1)*(d-c)>=(b-a))
			break;
	}
	if(i<n)puts("YES");
	else puts("NO");

	return 0;
}


Measured memory_bytes: 256