akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
double PI = acos(-1);
double l[8];
 
double f(double t0,vector<double> L){
    double v = cos(t0) * L[0] * L[1];
    double sum = 0;
    for(int i = 0 ; i < L.size() - 1 ; i++){
        double X = v / L[i] / L[i+1];
        sum += acos(X);
    }
    // cout << sum << endl;
    return sum;
}
double calc(double t0,vector<double> L){
    double v = cos(t0) * L[0] * L[1];
    double sum = 0;
    for(int i = 0 ; i < L.size() - 1 ; i++){
        double X = v / L[i] / L[i+1];
        sum += sin(acos(X)) * L[i] * L[i+1] / 2.0;
    }
    return sum;
}
int main(){
    int N;
    cin >> N;
    for(int i = 0 ; i < N ; i++) cin >> l[i];
     
    double ans = 0;
    for(int i = 0 ; i < (1<<N) ; i++){
        vector<double> L;
        for(int j = 0 ; j < N ; j++)
            if( i >> j & 1 ) L.push_back(l[j]);
        if( L.size() < 3 ) continue;
        sort(L.begin(),L.end());
        do{
            L.push_back(L.front());
             
            double le = 0 , ri = PI;
            for(int k = 0 ; k < 128 ; k++){
                double mi = (le+ri) / 2.;
                if( f(mi,L) > 2 * PI ){
                    ri = mi;
                }else{
                    le = mi;
                }
            }
            if( fabs(f(le,L)-2*PI)  < 1e-9 )
				ans = max(ans,calc(le,L));
            L.pop_back();
        }while(next_permutation(L.begin()+1,L.end()));
        // cout << L.size() << "|" <<  f(2*PI/6,L) << endl;
    }
    printf("%.15lf\n",ans);
}

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

using namespace std;
const int N = 1e6+100;
typedef long long ll;
vector<pair<int,pair<int,int> > > roadwork;
set<pair<ll,ll> > peo;
ll ans[N];
int main(){
	ll n,q;
	ll s,t,x,d;
	cin>>n>>q;
	for(ll i=1;i<=n;i++){
		cin>>s>>t>>x;
		roadwork.push_back({x,{s-x,t-1-x}});
	}
	for(ll i=1;i<=q;i++){
		cin>>d;
		peo.insert({d,i});
		ans[i]=-1;
	}
	sort(roadwork.begin(),roadwork.end());
	for(auto work:roadwork){
		ll L=work.second.first;
		ll R=work.second.second;
		if(peo.size()==0) break;
		auto it=peo.lower_bound({L,-1});
		while(!peo.empty()&&it!=peo.end()&&(*it).first<=R){
			ans[(*it).second]=work.first;
			peo.erase(it++);
		}
	} 
	for(ll i=1;i<=q;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 18544
#include <stdio.h>
long long gcd(long long gcd_a, long long gcd_b) {
	if (gcd_a < gcd_b) {
		long long gcd_c;
		gcd_c = gcd_a;
		gcd_a = gcd_b;
		gcd_b = gcd_c;
	}
	if (!gcd_b)return gcd_a;
	return gcd(gcd_b, gcd_a % gcd_b);
}
long long n, m, l, x;
long long a[100000];
long long b[100000];
int main() {
	scanf("%lld%lld", &n, &m);
	for (int i = 0; i < n; i++) {
		scanf("%lld", a + i);
		l = a[i];
		while (l % 2 == 0) {
			b[i]++;
			l /= 2;
		}
	}
	for (int i = 1; i < n; i++) {
		if (b[i] != b[i - 1]) {
			printf("0\n");
			return 0;
		}
	}
	l = b[0];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			a[i] /= 2;
		}
	}
	x = a[0];
	for (int i = 1; i < n; i++) {
		x = x * a[i] / gcd(x, a[i]);
		if (x > m) {
			printf("0\n");
			return 0;
		}
	}
	for (int i = 1; i < l; i++) {
		x *= 2;
		if (x > m) {
			printf("0\n");
			return 0;
		}
	}
	printf("%lld\n", (m / x + 1) / 2);
}

Measured memory_bytes: 1664
using System;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int N = sc.NextInt();
        int K = sc.NextInt();

        double ans = 0;
        for (int i = 1; i <= N; i++)
        {
            int cnt = 0;
            long cp = i;
            while (cp < K)
            {
                cp *= 2;
                cnt++;
            }

            ans += Math.Pow(0.5, cnt) /N;
        }
        
        Console.WriteLine(ans);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

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

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

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

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 11092
def HalfPizza(a , b , c , x , y):

    ans = 0

    if a + b < c * 2:
        ans += a * x + b * y
    else:
        ans += c * 2 * min(x, y)
        ans += min(abs(x - y) * a if x > y else abs(x - y) * b , c * 2 * abs(x - y))

    return ans

def main():
    a , b , c , x , y = map(int, input().split())
    print(HalfPizza(a , b , c , x , y))

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
from collections import defaultdict

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

def no():
    print("Impossible")
    quit(0)

def yes():
    print("Possible")
    quit(0)

cnts = defaultdict(int)
for x in xs:
    cnts[x] += 1

d = max(xs)
delems = []
for i in range(d+1):
    delems.append(max(i, d - i))

for delem in delems:
    if cnts[delem] <= 0:
        no()
    cnts[delem] -= 1

minx = min(delems) + 1
for x, rem in cnts.items():
    if rem > 0:
        if not minx <= x <= d:
            no()
yes()


Measured memory_bytes: 3444
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final String s = scanner.nextLine();
        final String t = scanner.nextLine();

        final Set<Character> sSet = new HashSet<>();
        final Set<Character> tSet = new HashSet<>();

        for (final char c : s.toCharArray()) {
            sSet.add(c);
        }

        for (final char c : t.toCharArray()) {
            tSet.add(c);
        }

        if (!sSet.containsAll(tSet)) {
            System.out.println(-1);
            return;
        }

        final Map<Character, List<Integer>> map = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            map.computeIfAbsent(s.charAt(i), e -> new ArrayList<>()).add(i);
        }

        long counter = 0;
        int currentIndex = -1;
        for (int i = 0; i < t.length(); i++) {
            final List<Integer> indexList = map.get(t.charAt(i));
            final int indexInIndexes = extendedBinarySearch(indexList, currentIndex);
            if (indexInIndexes == indexList.size()) {
                counter++;
                currentIndex = indexList.get(0);
            } else {
                currentIndex = indexList.get(indexInIndexes);
            }

        }

        System.out.println(counter * s.length() + 1 + currentIndex);
    }

    @SuppressWarnings("unchecked")
    private static int extendedBinarySearch(final Object indexes, final int value) {
        final int rawIndex;
        if (indexes instanceof int[]) {
            rawIndex = Arrays.binarySearch((int[]) indexes, value);
        } else {
            rawIndex = Collections.binarySearch((List<Integer>) indexes, value);
        }

        if (rawIndex >= 0) {
            return rawIndex + 1;
        }

        return -(rawIndex + 1);
    }
}


Measured memory_bytes: 35368
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        let mut vec_line: Vec<T> = Vec::new();
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            vec_line.push(buf);
        }
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

fn main() {
    let s = str2vec(&input_line_str());
    let k: usize;
    input!(k);
    let mut one_count = 0;
    let mut other_num = '0';

    for z in s {
        if z != '1' {
            other_num = z;
            break;
        }
        one_count += 1;
    }

    if k <= one_count {
        println!("1");
    } else {
        println!("{}", other_num);
    }
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <math.h>
/*147 into x, 105 into y*/
#define MAX 10000000000
int gcd(int,int);
int main(){
  int x,y;
  int d,n;
  int tmp,ans;
  scanf("%d %d",&x,&y);
  /*if(x <= 0 || MAX < y){                                                      
    return 0;                                                                   
  */
  ans = gcd(x,y);
  printf("%d\n",ans);
  return 0;
}

int gcd(int x,int y){
  int tmp;
  int r;
  if(x == y){
    return x;
  }

  if(x <= y){
    tmp = x;
    x = y;
    y = tmp;
  }
  while(y > 0){
    if(x != y){
      r = x % y;
    }
    x = y;
    y = r;
    if(x%y==0){
      return r;
    }
  }
}

Measured memory_bytes: 592
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	}
	
	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] monsterArr = new int[n+1];
		int[] heroArr = new int[n];
		
		for(int i = 0; i < n+1;i++) {
			monsterArr[i] = sc.nextInt();
		}
		for(int i = 0; i < n;i++) {
			heroArr[i] = sc.nextInt();
		}
		
		sc.close();
		
		long ans = 0;
		for(int i = 0; i < n; i++) {
			int numOfMonster = monsterArr[i];
			int capableBeat = heroArr[i];
			if(numOfMonster >= capableBeat) {
				ans += capableBeat;
			}else {
				capableBeat -= numOfMonster;
				ans += numOfMonster;
				int nextMonster = monsterArr[i+1];
				if(nextMonster >= capableBeat) {
					ans += capableBeat;
					monsterArr[i + 1] -= capableBeat;
				}else {
					ans += nextMonster;
					monsterArr[i + 1] = 0;
				}
			}
		}
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 65496
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		for(int i = 0; i < n; i++) {
			int[] a = new int[31];
			for(int j = 1; j < 31; j++) {
				a[j] = stdIn.nextInt();
			}
			System.out.println(solv(a,0));
		}
	}
	
	static int solv(int[] ck, int count) {
		if(check(ck)) {
			return count;
		}
		if(count >= 9) return 99;
		int max = 20;
		int[] a = ck;
		int[] b = new int[a.length];
		for(int i = 0; i < a.length; i++) {
			b[i] = a[i];
		}
		swap(a,1,28);
		swap(a,2,29);
		swap(a,3,30);
		swap(a,15,16);
		swap(a,21,19);
		max = Math.min(solv(a,count+1),max);
		for(int i = 0; i < a.length; i++) {
			a[i] = b[i];
		}
		swap(a,7,22);
		swap(a,8,23);
		swap(a,9,24);
		swap(a,13,18);
		swap(a,10,12);
		max = Math.min(solv(a,count+1),max);
		for(int i = 0; i < a.length; i++) {
			a[i] = b[i];
		}
		swap(a,1,24);
		swap(a,4,27);
		swap(a,7,30);
		swap(a,16,18);
		swap(a,10,21);
		max = Math.min(solv(a,count+1),max);
		for(int i = 0; i < a.length; i++) {
			a[i] = b[i];
		}
		swap(a,3,22);
		swap(a,6,25);
		swap(a,9,28);
		swap(a,12,19);
		swap(a,13,15);
		max = Math.min(solv(a,count+1),max);
		
		return max;
	}
	
	static void swap(int[] a, int f, int t) {
		int tmp = a[f];
		a[f] = a[t];
		a[t] = tmp;
	}
	
	static boolean check(int[] a) {
		int b = a[1];
		for(int i = 1; i < 10; i++) {
			if(b != a[i]) {
				return false;
			}
		}
		b = a[22];
		for(int i = 23; i < 31; i++) {
			if(b != a[i]) {
				return false;
			}
		}
		if(a[10] != a[12]) return false;
		if(a[13] != a[15]) return false;
		if(a[18] != a[16]) return false;
		if(a[21] != a[19]) return false;
		if(a[14] != a[15]) return false;
		if(a[11] != a[12]) return false;
		if(a[17] != a[18]) return false;
		if(a[21] != a[20]) return false;
		
		return true;
	}
}
		

Measured memory_bytes: 154364
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;
vec(dp,0);
ll Max=0;
//
void solve(long long H, long long N, std::vector<long long> A, std::vector<long long> B){
    //sort(all(A));
    dp[0]=0;
    rep(i,H+Max){
        rep(j,N){
            if(i-A[j]>=0&&dp[i-A[j]]!=LLONG_MAX){
                dp[i]=min(dp[i],dp[i-A[j]]+B[j]);
            }
        }
    }
    ll ans=LLONG_MAX;
    repf(i,H,H+Max){
        //op(dp[i])
        ans = min(ans,dp[i]);
    }
    op(ans)
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long H;
    scanf("%lld",&H);
    dp.resize(H+10001);
    rep(i,H+10001)dp[i]=LLONG_MAX;
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    std::vector<long long> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
        Max=max(A[i],Max);
        scanf("%lld",&B[i]);
    }
    solve(H, N, std::move(A), std::move(B));
    return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  // 1. X未満の     gcd(abs(x[i-1] - x[i]), abs(X - x[i]))
  // 2. Xより大きい  gcd(abs(x[i] - x[i+1]), abs(X - x[i]))
  int N, X; cin >> N >> X;
  vector<int> x(N);
  rep(i, N) {
    cin >> x[i];
  }
  if (N == 1) {
    cout << abs(x[0] - X) << "\n";
    return 0;
  }
  auto k = __gcd(abs(x[0] - X), abs(x[1] - X));
  rep(i, N) {
    k = __gcd(k, abs(x[i] - X));
  }
  cout << k << "\n";
}


Measured memory_bytes: 640
// c lib
#include <cstdio>
#include <cstdlib>
#include <cmath>

// container
#include <vector>
#include <string>
#include <map>
#include <list>
#include <queue>

// Convenience
#include <algorithm>
#include <functional>

// IO
#include <iostream>

using namespace std;

constexpr long long NMAX = 100000;
constexpr long long KMAX = 100000;
constexpr long long WMAX = 10000;

bool judge(long long p, int n, int k, int* w) {
    auto k_rem = k;
    auto p_rem = 0;
    for (auto i = 0; i < n; i++) {
        auto w_val = w[i];
        while (w_val > p_rem) {
            k_rem--;
            p_rem = p;
            if (k_rem < 0) {
                return false;
            }
        }
        p_rem -= w_val;
    }
    return true;
}

int main() {
    auto n = 0;
    auto k = 0;
    
    cin >> n;
    cin >> k;

    auto w = new int[n];

    for (int i = 0; i < n; i++) {
        cin >> w[i];
    }

    auto ph = 0ll;
    auto pl = 0ll;
    ph = NMAX * WMAX + 1;

    while (true) {
        auto p = (ph + pl) / 2;
        if (judge(p, n, k, w)) {
            if (ph == p) {
                cout << ph << endl;
                break;
            }
            ph = p;
        } else {
            if (pl == p) {
                cout << ph << endl;
                break;
            }
            pl = p;
        }
    }
}


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

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

  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }

  long long max=-1000000, min=1000000, sum=0;

  for(int i=0;i<n;i++){
    if(max<vec.at(i)){
      max = vec.at(i);
    }
    if(min>vec.at(i)){
      min = vec.at(i);
    }
    sum += vec.at(i);
  }

  cout << min << " " << max << " " << sum << endl;
}



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

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

  if ((a * b) % 2 == 0) {
    cout << "Even" << endl;
  }
  
  else {
    cout << "Odd" << endl;
  }
  
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define fi first
#define se second
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 1e5 + 5;
const ll LINF = 1e18 + 5;
constexpr int mod = 1e9 + 7;
int n, dp[1<<16], a[N], cnt[16];
int dfs(int S)
{
	if(!S) return 0;
	if(~dp[S]) return dp[S];
	int &x = dp[S]; x = INF;
	for(int i=0; i<=15; i++) if((S>>i)&1)
		for(int j=0; j<=15; j++) if(i^j && (S>>j)&1)
		{
			int k = i^j;
			int T = S^(1<<i)^(1<<j)^(1<<k);
			if((T>>k)&1) x = min(x, dfs(T)+1);
			else x = min(x, dfs(T)+2);
		}
	return x;
}
int main()
{
	scanf("%d", &n);
	for(int i=1; i<n; i++)
	{
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		a[x] ^= z; a[y] ^= z;
	}
	for(int i=0; i<n; i++) cnt[a[i]]++;
	memset(dp, -1, sizeof(dp));
	int S = 0, ans = 0;
	for(int i=1; i<=15; i++)
	{
		ans += cnt[i]/2;
		if(cnt[i]&1) S |= (1<<i);
	}
	printf("%d\n", dfs(S) + ans);
	return 0;
}

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

#define N 1000
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
#define all(cont) cont.begin(), cont.end()
#define sortcmp(n, cmpfunc) sort(all(n), cmpfunc)
#define fastio ios::sync_with_stdio(false); cin.tie(0)

double powm(double a, double b);

int main(){
	fastio;
	// #ifndef ONLINE_JUDGE
 //    	freopen("input.in", "r", stdin);
 //    	freopen("output.out", "w", stdout);
	// #endif
   	ll n, k;
   	double cur, ans;
	cin >> n >> k;
	for(int i = 1 ; i <= n ; i++){
		cur = 1/(double)n;
		int j = i;
		while(j < k){
			cur *= (1/(double)2);
			j *= 2;
		}
		if(i == 1) ans = cur;
		else ans += cur;
	}
	printf("%.12lf\n", ans);

	return 0;
}


double powm(double a, int b){
	double x=1, y=a; 
    while (b > 0) {
        if (b%2) x = (x*y);
        y = (y*y);
        b /= 2;
    }
    return x;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#include<map>
#include<cstdlib>
#include<string>
#include<algorithm>
#define mod 998244353;
using namespace std;
int main()
{
	char s[1000];
	scanf("%s",s);
	int len=strlen(s);
	for(int i=0;i<len-8;i++)
	printf("%c",s[i]); 
	printf("\n");
 }

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  char S[100];

  scanf("%s", S);
  
  char T[100];
  
  for(int i=0; S[i] != '\0'; i++){
    T[i] = 'x';
    T[i+1] =  '\0';
  }
  
  printf("%s", T);
  
  return 0;
}

Measured memory_bytes: 128
import math
import itertools
import numpy as np


def list_add(l):
    wrk = np.array(l[0], dtype=int)
    for i in l[1:]:
        wrk = np.array(wrk, dtype=int) + np.array(i, dtype=int)
    return wrk.tolist()


n, m, x = map(int, input().split())
l = []
for i in range(n):
    l.append(input().split())

ans = -1

for i in range(1, n+1):
    c_list = list(itertools.combinations(l, i))
    for c in c_list:
        t = list_add(c)
        ok = True
        for c in t[1:]:
            if c < x:
                ok = False
        if ok:
            if ans == -1 or ans > t[0]:
                ans = t[0]
print(ans)

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

LL gcd(LL a, LL b){
    if(a < b) {
        LL tmp = a;
        a = b;
        b = tmp;
    }

    if(b == 0) return a;
    return gcd(b, a%b);
}

void solve(long long N, std::vector<long long> A){
    LL ans = A[0];
    REP1(i, A.size()){
        ans = gcd(ans, A[i]);
    }

    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
	
	/*
	 * default function
	 * */	
	int ni() {
		return cin.nextInt();
	}
	
	String nl() {
		return cin.nextLine();
	}
	
	void println(String str) {	
		System.out.println(str);
	}
	
	void print(String str) {
		System.out.print(str);
	}
	
	/*
	 * default variable
	 */
	
	static final int MOD = 1000000007;
	
	Scanner cin = new Scanner(System.in);	
	String  output;
	
	public static void main(String[] args) {			
		new Main().run();						
	}
	/* default above */
		
	public void run() {
			
		input();
		/* 
		 * start
		 */	
		
		
		long res = solve();
		
		/*
		 * finish
		 */
		
		output = res +"";
		println(output);
			
	}
	/* 
	 * define variable
	 */
	
	int N, T;
	int[] times;
	
	void input() {
		N = ni();
		T = ni();
		
		times = new int[N];
		
		for (int i = 0; i < N; i ++) {
			times[i] = ni();
		}		
	}
	
	
	long solve() {
		//first push began at 0
		long sum   = T;
		long preEnd= T;
		
		for (int i = 1; i < N; i ++) {
			
			if (times[i] >= preEnd) {
				preEnd = times[i] + T;
				sum += T;
			}
			
			else {
				long diff = times[i] - times[i-1];
				preEnd += diff;
				sum += diff;
			}
		}
		
		return sum;
	}
	
}


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

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend() 
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());
 
    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}
// FILE I/O
void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(string s = "") {
	unsyncIO();
	// cin.exceptions(cin.failbit); 
	// throws exception when do smth illegal
	// ex. try to read letter into int
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

int main()
{
  long long num;
  cin >> num;
  vector<long long> sums(11, 1);
  int numOfChars = 0;
  for (int i = 1; i < sums.size(); i++)
  {
      sums[i] = sums[i-1] + pow(26, i);
      if (num >= sums[i])
        numOfChars++;
  }
    num -= sums[numOfChars];
    while (numOfChars > 0)
    {
        cout << (char)('a' + num / (long long)pow(26, numOfChars));
        num = num % (long long)pow(26, numOfChars);
        numOfChars--;
    }
    cout << (char)('a' + num) << endl;
}
   

Measured memory_bytes: 4056
import sys
from collections import defaultdict

rl = sys.stdin.readline


def solve():
    N = int(rl())
    A = list(map(int, rl().split()))
    
    counter = defaultdict(int)
    for ai in A:
        counter[ai] += 1
    
    B = defaultdict(int)
    for ai in A:
        B[ai] = counter[ai] * (counter[ai] - 1) // 2
    
    tmp = sum(B.values())
    for ai in A:
        print(tmp - B[ai] + (counter[ai] - 1) * (counter[ai] - 2) // 2)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 30824
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll MAX=200030;
const ll MOD=1000000007;
int N;
char S[MAX];
int dp[MAX],dpn[MAX],nnnn[26],start;
main(){
    scanf(" %s",S);
    N=strlen(S);
    for(int i=0;i<26;i++) nnnn[i]=N+i;
    for(int i=N-1;i>=0;i--) {
        dp[i]=MAX;
        for(int j=0;j<26;j++) if(dp[i]>dp[nnnn[j]]) dpn[i]=nnnn[j], dp[i]=dp[nnnn[j]];
        dp[i]++;
        nnnn[S[i]-'a']=i;
    }
    int t=MAX;
    for(int i=0;i<26;i++){
        if(t>dp[nnnn[i]]) start=nnnn[i],t=dp[nnnn[i]];
    }
    while(start<N){
        printf("%c",S[start]);
        start=dpn[start];
    }
    printf("%c\n",start-N+'a');

    return 0;
}


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

int main()
{	
	int n;
	bool f = 0;

	cin >> n;

	for (int i = 1; i < 10; i++) {
		if (n % i == 0 && n / i < 10) {
			cout << "Yes" << endl;
			f = 1;
			break;
		}
	}

	if (!f)
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int num2 = sc.nextInt();
        if(num>=10||num2>=10)
        {
            System.out.println(-1);
        }
        else
        {
            System.out.println(num*num2);
        }
    }
}

Measured memory_bytes: 23252
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <list>
#include <set>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()

using namespace std;

int N, M, K, W,X;
int dp[101];

int main() {
	int k,res=100001,Ma, Mb,sum=0;

	cin >> N;
	
	vector <int> a(N),b(N);
	vector <vector<int>> aa;
	
	rep(i, N) {
		cin >> a[i];
		sum += a[i];
		
	}
	sort(all(a));

	rep(i, N) {
		if (a[i] % 10 != 0) {
			res = min(res, a[i]);
		}
	}
	if (sum % 10 != 0) {
		cout << sum;
	}
	else if(res != 100001){
		cout << sum - res;
	}
	else {
		cout << 0;
	}



}



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


class Main {

    public static void main(String[] args) throws IOException
    {
        PrintWriter out = new PrintWriter(System.out);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        int answer = (int)(Math.ceil(n/1000.0));
        out.println(answer*1000 - n);

        out.flush();
        out.close();

    }

    static class pair{
        long x1;
        long x2;

        public pair(long x1 , long x2)
        {
            this.x1 = x1;
            this.x2 = x2;
        }

    }

}


Measured memory_bytes: 32872
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int N,K;
int A[100005];
int main(){
  while(1){
    scanf("%d %d",&N,&K);
    if(!N && !K) break;
    memset(A,0,sizeof(A));
    for(int i=0;i<K;i++){
      int k;
      scanf("%d",&k);
      A[k]=1;
    }
    int res=0;
    if(A[0]==0){
      int co=0;
      for(int i=1;i<=N+1;i++){
	if(A[i]) co++;
	else{ res = max(res,co); co=0; }
      }
    } else{
      int co[2]={};
      int f=0;
      for(int i=1;i<=N+1;i++){
	if(A[i]){ co[0]++; co[1]++; }
	else{
	  res = max(res,max(co[0],co[1]));
	  co[f]=0;
	  f++;
	  f&=1;
	  co[f]++;
	}		 
      }
    }
    printf("%d\n",res);
  }
}

Measured memory_bytes: 1584
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N, A;

int main()
{
	in>>N>>A;
	out<<N*N-A<<std::endl;
	return 0;
}


Measured memory_bytes: 256
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const long double EPS = 1e-10;
const int MAX = 1405;

struct Histogram {
  int h, id;
};


int h, w, c[MAX][MAX], t[MAX][MAX];

int solve() {
  int ans = 0;

  rep(i, h) {
    stack<Histogram> s;
    t[i][w] = 0;
    rep(j, w + 1) {
      Histogram rect;
      rect.h = t[i][j];
      rect.id = j;
      if (s.empty()) s.push(rect);
      else {
        if (s.top().h < rect.h) {
          s.push(rect);
        }
        else if (s.top().h > rect.h) {
          int target = j;
          while (!s.empty() && s.top().h >= rect.h) {
            Histogram pre = s.top();
            s.pop();
            int area = pre.h * (j - pre.id);
            ans = max(ans, area);
            target = pre.id;
          }
          rect.id = target;
          s.push(rect);
        }
      }
    }
  }

  return ans;
}

int main() {
  cin >> h >> w;
  rep(i, h) {
    rep(j, w) {
      cin >> c[i][j];
    }
  }

  rep(j, w) {
    rep(i, h) {
      if (c[i][j] == 1) t[i][j] = 0;
      else {
        if (i == 0) t[i][j] = 1;
        else t[i][j] = t[i - 1][j] + 1;
      }
    }
  }

  cout << solve() << endl;

}


Measured memory_bytes: 18460
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
#include<algorithm>
#include<math.h>

using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
const long long INF = 1LL << 60;
typedef pair<int, int> P;

int main(){
    int N,K;
    scanf("%d %d", &N, &K);
    ll answer = K;
    for (int i = 0; i < N - 1; ++i) {
        answer *= K - 1;
    }
    printf("%lld\n", answer);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main() {
	int N;
    scanf("%d",&N);
    for(int a4 = 0; a4 <= 100; a4 += 4) {
    	for(int a7 = 0; a4 + a7 <= 100; a7 +=7) {
        	if(a4 + a7 == N){
            	printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 128
def printData(data) :
    for i, value in enumerate(data) :
        if i > 0 :
            print(" ", end = "")
        print(value, end = "")
    print()
    
def selectionSort(data, N) :
    count = 0
    for i in range(0, N) :
        sortIdx = i
        for j in range(i + 1, N) :
            if data[sortIdx] > data[j] :
                sortIdx = j
        if sortIdx != i :
            buf = data[sortIdx]
            data[sortIdx] = data[i]
            data[i] = buf
            count += 1
            
    printData(data)
    print(count)
    
N = int(input())
data = [int(char) for char in input().split()]
selectionSort(data, N)
            
        


Measured memory_bytes: 5624
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
int MOD = 1000000007;
int sx,sy,gx,gy;
int n;
int x[1010];
int y[1010];
int r[1010];
double dist[1010][1010];
#define MAX_V 1010
struct edge{
    int to;
    double cost;
};
typedef pair<double,int> pii;
int V;
vector<edge> G[MAX_V];
double d[MAX_V];
void dijkstra(int s){
    priority_queue<pii,vector<pii>,greater<pii>> que;
    fill(d,d+V,INF*1.0);
    d[s] = 0.0;
    que.push(pii(0.0,s));
    while(!que.empty()){
        pii p = que.top();que.pop();
        int v = p.se;
        if(d[v] < p.fi) continue;
        rep(i,G[v].size()){
            edge e = G[v][i];
            if(d[e.to] > d[v]+e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(pii(d[e.to],e.to));
            }
        }
    }
}

signed main(){
    cin >> sx >> sy >> gx >> gy >> n;
    rep(i,n)cin >> x[i] >> y[i] >> r[i];
    x[n] = sx;
    y[n] = sy;
    r[n] = 0;
    x[n+1] = gx;
    y[n+1] = gy;
    r[n+1] = 0;
    V = n+2;
    rep(i,n+2){
        rep(j,n+2){
            double c;
            if(i == j){
                c = 0.0;
            }else if((r[i]+r[j]) >= sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]))){
                c = 0.0;
            }else{
                c = sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]))-(r[i]+r[j]);
            }
            edge e1 = {i,c};
            edge e2 = {j,c};
            G[j].pb(e1);
            G[i].pb(e2);
        }
    }
    dijkstra(n);
    //cout << d[n+1] << endl;
    printf("%10.10lf\n",d[n+1]);


    
    return 0; 
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://arc064.contest.atcoder.jp/tasks/arc064_c
// rm -r -f test;oj dl http://yahoo-procon2017-qual.contest.atcoder.jp/tasks/yahoo_procon2017_qual_c


Measured memory_bytes: 38896
#include<bits/stdc++.h>
using namespace std;
struct pr{int nw,p;};

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	string s,t; cin>>s>>t;
	vector<vector<int>>c(26);
	for(int i=0;i<s.size();++i){
		c.at(s.at(i)-'a').emplace_back(i);
	}
	int64_t p=0,n=0;
	for(int i=0;i<t.size();++i){
		int j=t.at(i)-'a';
		auto near=lower_bound(c.at(j).begin(),c.at(j).end(),p);
		if(near!=c.at(j).end()){
			p=*near+1;
		}
		else{
			if(!c.at(j).size()){
				cout<<"-1\n"s;
				return 0;
			}
			n+=s.size();
			p=c.at(j).front()+1;
		}
	}
	cout<<n+p<<"\n"s;
}


Measured memory_bytes: 4156
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main(){
	int n, num;
	long long price, amount;
	map<int, long long> member;
	vector<int> array;

	while(cin >> n, n){
		member.clear();
		array.clear();
		for(int i = 0; i < n; i++){
			cin >> num >> price >> amount;
			member[num] +=  price * amount;
			for(int i = 0; i < array.size(); i++){
				if(num == array[i]){
					continue;
				}
			}
			if(member[num] >= 1000000){
				array.push_back(num);
			}
		}
		if(array.empty()){
			cout << "NA" << endl;
		}
		else{
			for(int i = 0; i < array.size(); i++){
				cout << array[i] << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1288
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def size(self, x):
        return -self.parents[self.find(x)]
        
    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())
    
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

    
N, M, K = map(int,input().split())

uf_friend = UnionFind(N)

friend = [0] * N

for i in range(M):
    a, b = map(int,input().split())
    uf_friend.union(a-1,b-1)
    friend[a-1] += 1
    friend[b-1] += 1

block = [0] * N 
    
for i in range(K):
    c, d = map(int,input().split())
    if uf_friend.same(c-1,d-1):
        block[d-1] += 1
        block[c-1] += 1
    
ans = [0] * N

for i in range(N):
    ans[i] = uf_friend.size(i)-friend[i]-block[i]-1

print(*ans)

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

#define INF 100100100
#define MOD 1000000007

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

#define FOR(i,n) for(ll i=0;i<n;i++)


int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0); 
   int N;
   cin>>N;
   vector<ull>a(N);
   ull ans=0;
   FOR(i,N){
      int a;
      cin>>a;
      ans+=a-1;
   }
   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++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  int n;cin>>n;
  vector<int>h(n);
  rep(i,n)cin>>h[i];
  int ans=0,cnt=0;
  reverse(all(h));
  rep(i,n){
    if(h[i]>h[i+1])cnt=0;
    else cnt++;
    ans=max(ans,cnt);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3780
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=100000 +117;
const int MM=100000 +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
int solve(int x,int k){
	while(1){
		int t=x/k;
		int tar=t*k;
		++t;
		x-=(x-tar)/t*t;
		if(x==tar)return t-1;
		x-=t;
	}
}
int main(){
	//open();
	n=read();
	int res=0;
	for(int i=1;i<=n;++i){
		int a=read(),k=read();
		res^=solve(a,k);
	}
	if(res){
		printf("Takahashi\n");
	}
	else printf("Aoki\n");


	close();
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
bool is_prime(int x) {
  for (int i=2; i*i<=x; i++) if (x%i == 0) return false;
  return true;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  vector<int> vs;
  for (int n=2; n<=55555; n++) if (is_prime(n)) {
    if (n%5==1) vs.pb(n);
  }
  assert(vs.size()>=55);
  vs.resize(N);
  for (int x : vs)cout<<x << " ";cout<<"\n";
  return 0;
}


Measured memory_bytes: 256
using System;

class Program
{
  public static void Main(string[] args)
  {
    int seconds = int.Parse(Console.ReadLine());
    int[] times = new int[3];
    int division = 3600;
    for(int i = 0;i < 3;i++)
    {
      times[i] = seconds/division;
      seconds %= division;
      division /= 60;
    }
    Console.WriteLine("{0}:{1}:{2}",times[0],times[1],times[2]);
  }
}

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

int main(void) {
    long int n;
    string s;
    cin>>s;
    long int a=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='+'){a++;}
        else if(s[i]=='-'){a--;}

    }
    cout<<a<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	long long a,b,c;
	long long ans;
	cin>>a>>b>>c;
	long long tmin = min(a,min(b,c));
	long long tmin2;
	if(a%2==0||b%2==0||c%2==0) {
		cout<<0<<endl;
	} else {
		if(tmin==a) {
			tmin2 = min(b,c);
		} else if(tmin==b) {
			tmin2 = min(a,c);
		} else {
			tmin2 = min(a,b);
		}
		cout<<tmin*tmin2;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair

using namespace std;
map<pair<ll,ll>,ll> ma;
void dfs(ll curr,vector<ll> v[], ll para)
{
    ll st = 1;
    //set<ll> st;
    //st.insert()
    for(auto it = v[curr].begin();it!=v[curr].end();it++)
    {
        if(*it == para) 
            continue;
        if(st == ma[mp(min(curr,para),max(curr,para))])
            st++;
        ma[mp(min(*it,curr),max(*it,curr))] = st;
        //cout<<"at "<<curr+1<<" with "<<*it+1<<" = "<<st<<"\n";
        st++;
        dfs(*it,v,curr);
    }
}

int main()
{
   FAST/**/
   ll n;
   cin>>n;
   
   ll deg[n];
   memset(deg,0,sizeof(deg));
   vector<ll> v[n];
   vector<pair<ll,ll>> ed;
   for(ll i=0;i<n-1;i++)
   {
       ll a,b;
       cin>>a>>b;
       
       a--,b--;
       ed.pb(mp(min(a,b),max(a,b)));
       v[a].pb(b);
       v[b].pb(a);
       deg[a]++,deg[b]++;
   }
   
   ll col = 0;
   for(ll i=0;i<n;i++)
        col = max(col, deg[i]);
   dfs(0,v,-1);        
   cout<<col<<"\n";
   for(ll i=0;i<n-1;i++)
        cout<<ma[ed[i]]<<"\n";
   return 0;
}  
   


Measured memory_bytes: 16756
#include <stdio.h>

int main(){
    int matrix[3][3];
    char x;
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            scanf("%d", &matrix[i][j]);
        }
    }
    int n;
    scanf("%d",&n);
    int input[n];
    for(int k=0;k<n;k++){
        scanf("%d", &input[k]);
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(input[k] == matrix[i][j]){
                    matrix[i][j] = x;
                }
            }
        }
    }
    int ctr[8] = {0};
    int last=2;
    for(int i=0;i<3;i++){
        if(matrix[i][0]==x){
            ++ctr[0];
        }
        if(matrix[i][2]==x){
            ++ctr[1];
        }
        if(matrix[0][i]==x){
            ++ctr[2];
        }
        if(matrix[2][i]==x){
            ++ctr[3];
        }
        if(matrix[i][i]==x){
            ++ctr[4];
        } 
        if(matrix[i][last--]==x){
            ++ctr[5];
        }
        if(matrix[1][i]==x){
            ++ctr[6];
        }
        if(matrix[i][1]==x){
            ++ctr[7];
        }
    }
    int flag = 0;
    for(int i=0;i<8;i++){
        if(ctr[i]==3){
            flag = 1;
        }
    }
    printf("%s\n", (flag == 1) ? "Yes" : "No");

    return 0;
}

Measured memory_bytes: 1656
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A=sc.nextInt();
        int B=sc.nextInt();
        int ans=0;
        if(A<B){
            ans=B-A-1;
        }else{
            ans=A-B-1;
        }
        if(ans%2==0)
            System.out.println("Borys");
        else
            System.out.println("Alice");
    }
    
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef long int li;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<float, float> ff;
typedef pair<double, double> dd;
typedef unsigned int ui;
typedef vector<ii> vii;
typedef vector<ff> vff;
typedef set<int> si;
typedef set<lli> slli;
typedef vector<lli> vlli;
typedef long long ll;
typedef long long ll;
typedef vector<ll> vll;
typedef unsigned long long int ulli;
#define MOD 1000000007
#define INF (unsigned)(~0)>>1
typedef pair<int, ii> iii;
void arr_int(int* given_arr, int n){
  for(int i=0;i<n;i++)
    scanf("%d", &given_arr[i]);
  return;
}
void solve();
int main(int argc, char const *argv[]){
  solve();
  return 0;
}
void solve(){
  int N;
  scanf("%d", &N);
  int arr[N];
  int sum = 0;
  for(int i=0;i<N;i++){
    scanf("%d", &arr[i]);
    sum+= arr[i];
  }
  int mean1 = sum/N;
  int stamina = 0;
  for(int i=0;i<N;i++){
    stamina += (mean1 - arr[i])*(mean1 - arr[i]);
  }
  if(sum%N!=0){
    mean1++;
    int stamina2 = 0;
    for(int i=0;i<N;i++){
      stamina2 += (mean1 - arr[i])*(mean1 - arr[i]);
    }
    stamina = min(stamina, stamina2);
  }
  printf("%d\n", stamina);

}


Measured memory_bytes: 256
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String str = s.next();
int l = str.length();
char[] out = new char[l];
for (int i=0 ; i<l ; i++)
out[i] = str.charAt(i);
for (int i=l-1 ; i >= 0 ; i--)
System.out.print(out[i]);
System.out.println();
}
}

Measured memory_bytes: 0