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

int main() {
    int N; cin >> N;
    string S; cin >> S;
    int ans = 0;
    
    for (int i = 0; i < N - 2; i++) {
        if (S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline
n,m=map(int,input().split())
z=n*(n-1)//2
l=[-1]*n
a=[1]*n
b=[input().split() for _ in range(m)]
c=[0]*m+[z]
def r(s):
  t=l[s]
  if t<0:
    return s
  else:
    l[s]=r(t)
    return l[s]
def f(s):
  return r(int(s)-1)
for i in range(m-1,-1,-1):
  x,y=map(f,b[i])
  if x!=y:
    s,t=a[x],a[y]
    z-=s*t
    if s<t:
      l[x]=y
      a[y]+=s
    else:
      l[y]=x
      a[x]+=t
  c[i]=z
for x in c[1:]:
  print(x)

Measured memory_bytes: 41040
# ARC086C - Not so Diverse
n, k = list(map(int, input().rstrip().split()))
lst = sorted(list(map(int, input().rstrip().split())))
dic = {}
for i in lst:
    if i not in dic:
        dic[i] = 1
    else:
        dic[i] += 1

cnt = sorted([i for i in dic.values()], reverse=True)
ans = 0
for i in range(len(cnt)):
    if k > 0:
        k -= 1
        continue
    ans += cnt[i]
print(ans)

Measured memory_bytes: 33696
from collections import deque
s=input()
n = int(input())

f=False
q= deque(s)

for _ in range(n):
    i = input()

    if i[0] == '1': f=False if f else True
    else:
        _,a,b =i.split()
        
        if f :
            if a == '1':q.append(b)
            else:q.appendleft(b)
        else:
            if a == '1':q.appendleft(b)
            else:q.append(b)

if f: q.reverse()

for i in q:print(i,end='')


Measured memory_bytes: 7664
using System;
using static System.Console;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        int[] a = ReadLine().Split().Select(int.Parse).ToArray();
        int A = a[0];
        int B = a[1];
        int C = B % A;
        if (C == 0)
        {
            Write(A + B);
        }
        else
        {
            Write(B - A);
        }

    }
}

Measured memory_bytes: 13268
import fractions

n = int(input().strip())
an = list(map(int, input().strip().split(' ')))


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


temp = an[0]
for i in range(len(an)):
    temp = lcm(temp, an[i])

m = temp - 1

ret = 0
for a in an:
    ret += m % a

print(ret)


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

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

    int ans = t / a * b;

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


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int A,B;
  cin >> A >> B;
  int tmp1,tmp2;
  if ((A+B)%2==1)cout << "IMPOSSIBLE"<<endl;
  else{
    tmp1 = (A+B)/2;
    if(A>=tmp1 && B<tmp1)cout << tmp1 <<endl;
    else if (A<tmp1 && B>=tmp1) cout << tmp1 << endl;
    else cout << "IMPOSSIBLE" << endl;
  }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long long
const int N = 100005;
struct node
{
	int a, b;
	bool operator <(const node &rhs)const
	{
		return abs(a - b) < abs(rhs.a - rhs.b);
	}
	
} p[N];
int n, a[N], b[N], t[N], tot, ans;
LL tot1, tot2, sum;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; ++i)
		cin >> p[i].a, tot1 += p[i].a;
	for (int i = 1; i <= n; ++i)
		cin >> p[i].b, tot2 += p[i].b;
	if (tot1 < tot2)
		return cout << -1, 0;
	for (int i = 1; i <= n; ++i)
		if (p[i].a < p[i].b)
			++ans, sum += p[i].b - p[i].a;
		else
			t[++tot] = p[i].a - p[i].b;
	sort(t + 1, t + tot + 1);
	for (int i = tot; i > 0 && sum > 0; --i)
	{
		++ans;
		sum -= t[i];
	}
	cout << ans;
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  
  string s;
  map<string, int> a;
  for(int i=0; i<n; i++) {
    cin >> s;
    sort(s.begin(), s.end());
    a[s]++;
  }
  
  int64_t ans = 0;
  vector<int64_t> memo(100001, -1);
  for(pair<string, int64_t> p : a) {
    if(p.second>1) ans += p.second*(p.second-1)/2;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 11980
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a;
  for (; n; n /= 10) {
    a.push_back(n % 10);
  }
  n = a.size();
  bool found = false;
  for (int i = 0; i < n / 2; ++i) {
    if (a[i] != a[n - 1 - i]) found = true;
  }
  puts(found ? "No" : "Yes");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#define rep(i,N) for(int i=0;i<(N);i++)
#define PI 3.1415926535897932
using namespace std;

int main(){
	int x;
	cin>>x;
	if(x==1){
		cout<<0<<endl;
	}else if(x==0){
		cout<<1<<endl;
	}
}

Measured memory_bytes: 3592
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <limits>

using namespace std;

template<class T = int,T divided_by = 10>
constexpr T PINF(){ return std::numeric_limits<T>::max()/divided_by; }
template<class T = int,T divided_by = 10>
constexpr T MINF(){ return std::numeric_limits<T>::lowest()/divided_by; }

template<class T = int> T gcd(T a, T b){ return b ? gcd(b,a%b) : a; }
template<class T = int> T lcm(T a, T b){ return a / gcd(a,b) * b; }
template<class T = int> T lcm_safe(T a, T b){ T p = a/gcd(a,b); return (b <= PINF<T>()/p) ? p*b:PINF<T>(); }
//オーバーフローするとき+INFを返す
//

constexpr long long MOD = 1000000000 + 7;
int main() {
	cin.tie(nullptr); ios::sync_with_stdio(false);

	long long n;
	cin >> n;
	long long counts = 0, maxX = 0, maxPoss = 0;
	long long poss = 1;
	for(int i = 0; i < n; ++i){
		cin >> maxX;
		++counts;
		long long want = counts*2 - 1;
		// cout << want << " ";
		if (maxPoss < want && want <= maxX) {
			// cout << "ok";
			// ok
			maxPoss = want;
		} else {
			// cout << "not ok";
			// cout << "counts " << counts;
			poss *= counts;
			poss %= MOD;
			counts--;
		}
		// cout << " maxpoxx" << maxPoss << endl;
	}

	while(1 < counts){
		// cout << "counts " << counts << " poss " << poss << endl;;
		poss *= counts;
		poss %= MOD;
		counts--;
	}
	cout << poss << endl;
	return 0;
}

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

#define sz(s)               (int)s.size()
using namespace std;
int main()
{
	int ans = 0,c=0;
	int n; cin >> n;
	string s; cin >> s;

	for (int i = 0; i < n; ++i)
	{
		if (s[i] == 'I')c++;
		else c--;
		ans = max(c, ans);
	}
	cout << ans;

}

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

Int m;
vector<Int> d, c;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> m;
	d.resize(m);
	c.resize(m);
	for(Int i=0; i<m; ++i)
		cin >> d[i] >> c[i];
	Int s = accumulate(c.begin(), c.end(), (Int)0);
	Int t = 0;
	for(Int i=0; i<m; ++i)
		t += d[i] * c[i];
	Int ans = (t-1) / 9 + s-1;
	cout << ans << "\n";
}

Measured memory_bytes: 3328
from operator import itemgetter
import sys
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

N = int(input())
Q = sorted([inpl() for _ in range(N)], key=itemgetter(2), reverse=True)

for cx in range(101):
    for cy in range(101):
        ch = abs(cx - Q[0][0]) + abs(cy - Q[0][1]) + Q[0][2]
        for x, y, h in Q:
            if h != max(ch - abs(x-cx) - abs(y-cy), 0):
                break
        else:
            print(cx, cy, ch)

Measured memory_bytes: 42992
#include <iostream>

using namespace std;
typedef long long ll;
const int N=1e5+7;

int vis[N];

bool solve(ll x, ll y)
{
    if(x<2&&y<2) return 0;
    for(ll i=1; 2*i<=x; i++)
        if(!solve(x-2*i,y+i)) return 1;
    for(ll i=1; 2*i<=y; i++)
        if(!solve(x+i,y-2*i)) return 1;
    return 0;
}

int main()
{
#ifdef local
    freopen("in.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,m;
    cin>>n>>m;
    if(abs(n-m)<2) cout<<"Brown";
    else cout<<"Alice";
    return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N (long long)420000



long long p[N+20];
long long d[N+20];

void init(void) {
	f(i, N) {
		p[i] = i;
		d[i] = 1;
	}
	return;
}

long long pa(long long x) {
	if (p[x] == x)return x;
	else return p[x] = pa(p[x]);
}


void uni(long long x, long long y) {
	long long px = pa(x);
	long long py = pa(y);
	if (px == py)return;
	if (d[px] < d[py]) {
		p[px] = py;
		d[py] = max(d[py], d[px] + 1);
	}
	else {
		p[py] = px;
		d[px] = max(d[px], d[py] + 1);
	}
	return;
}

bool jud(long long x, long long y) {
	long long px = pa(x);
	long long py = pa(y);
	if (px == py)return true;
	else return false;
}



int main() {
	init();
	vector<pair<long long, pair<long long, long long> > >a;
	long long e[N];
	long long b[N];
	f(i, N) {
		e[i] = -1;
		b[i] = -1;
	}
	long long n, k, m;
	long long x, y, z;
	long long xx, yy, zz, nn, aa;
	long long s, ans;
	bool v = true;
	ans = 0;
	scanf("%lld %lld", &n, &m);
	f(i, m) {
		scanf("%lld %lld %lld", &x, &y, &z);
		a.push_back(make_pair(z, make_pair(x, y)));
		a.push_back(make_pair(z + 1, make_pair(x + 1, y)));
	}
	sort(a.begin(), a.end());
	xx = 0;
	yy = 1;
	zz = a[0].first;
	nn = 0;
	aa = 0;
	while (true) {

		if ((zz - a[0].first) % 2 == 0) {
			if (aa < a.size()) {
				while (a[aa].first == zz) {
					e[xx] = aa + 2;
					b[aa + 2] = xx;
					xx = aa + 2;
					aa++;
					if (aa >= a.size())break;
				}
			}
			k = 0;
			while (true) {
				k = e[k];
				if (k < 2)break;
				x = (a[k - 2].second.first + ((zz - a[k - 2].first) / 2)) % n;
				y = (a[k - 2].second.second + ((zz - a[k - 2].first) / 2)) % n;
				z = zz;
				v = jud(x, y);
				if (!v) {
					uni(x, y);
					ans += zz;
					nn++;
					if (nn + 1 == n)break;
				}
				else {
					e[b[k]] = e[k];
					if (e[k] == -1)xx = b[k];
					else b[e[k]] = b[k];

				}
			}
			if (nn + 1 == n)break;
		}
		else {
			if (aa < a.size()) {
				while (a[aa].first == zz) {
					e[yy] = aa + 2;
					b[aa + 2] = yy;
					yy = aa + 2;
					aa++;
					if (aa >= a.size())break;
				}
			}
			k = 1;
			while (true) {
				k = e[k];
				if (k <2)break;
				x = (a[k - 2].second.first + ((zz - a[k - 2].first) / 2)) % n;
				y = (a[k - 2].second.second + ((zz - a[k - 2].first) / 2)) % n;
				z = zz;
				v = jud(x, y);
				if (!v) {
					uni(x, y);
					ans += zz;
					nn++;
					if (nn + 1 == n)break;
				}
				else {
					e[b[k]] = e[k];
					if (e[k] == -1)yy = b[k];
					else b[e[k]] = b[k];

				}
			}
			if (nn + 1 == n)break;
		}
		zz++;
		if (nn + 1 == n)break;
	}


	printf("%lld\n", ans);


	return 0;
}


Measured memory_bytes: 27628
cnv 0 = [0]
cnv i =
  let d = i `mod` 4
      r = i `div` 4
  in
    if r /= 0
    then d:(cnv r)
    else [d]

ans i =
  let a = cnv i
      r = concat $ map show $ reverse a
  in
    r
main = do
  c <- getContents
  let i = takeWhile (/= -1) $ map read $ lines c :: [Int]
      o = map ans i
  mapM_ putStrLn o
  

Measured memory_bytes: 4208
<?php
    $str = trim(fgets(STDIN));
    $length = floor(strlen($str) / 2);
    $def = 0;
    for($i=0; $i<$length; $i++){
        $a = substr($str, $i , 1);
        $b = substr($str, -($i+1) , 1);
        if($a != $b){
            $def++;
        }
    }
    echo $def;
?>

Measured memory_bytes: 3576
n,m = [int(x) for x in input().split(' ')]
prob = [1] + [0 for x in range(n-1)]
ball = [1 for x in range(n)]
for i in range(m):
    x,y = [int(x) for x in input().split(' ')]
    ball[x-1] -= 1
    ball[y-1] += 1
    if prob[x-1] == 1:
        prob[y-1] = 1
    if ball[x-1] == 0:
        prob[x-1] = 0

print(sum(prob))

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

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

  string A, B, C;
  cin >> A >> B >> C;

  if(A[A.size()-1] == B[0] && B[B.size()-1] == C[0]){
    cout << "YES" << endl;
  }
  else cout << "NO" << endl;
  
}

Measured memory_bytes: 256
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

x = INT()

if x < 600:
    ans = 8
elif x < 800:
    ans = 7
elif x < 1000:
    ans = 6
elif x < 1200:
    ans = 5
elif x < 1400:
    ans = 4
elif x < 1600:
    ans = 3
elif x < 1800:
    ans = 2
else:
    ans = 1

print(ans)


Measured memory_bytes: 10332
import java.util.*;

class Main{

    void solve(){
        Scanner sc = new Scanner(System.in);

        while(true){
            int math = sc.nextInt(), greedy = sc.nextInt(), geo = sc.nextInt();
            int dp = sc.nextInt(), graph = sc.nextInt(), other = sc.nextInt();
            if(math==0 && greedy==0 && geo==0 && dp==0 && graph==0 && other==0) break;
            
            int type1 = math + dp, type2 = greedy + graph, type3 = geo + other;
            int max = 0;
            for(int i=0; i<=2; i++){
                if(type1>=i && type2>=i && type3>=i)
                    max = Math.max(max, i + (type1-i)/3 + (type2-i)/3 + (type3-i)/3);
            }
            System.out.println(max);
        }
    }

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

Measured memory_bytes: 64040
#! /usr/bin/python
# -*- coding: utf-8 -*-

dxy = ((1, 0), (-1, 0), (0, 1), (0, -1), (1, 1), (-1, -1))

import Queue

def main():
    # input
    while(True):
        try:
            buf = map(int, raw_input().split())
            if len(buf) == 0:
                break

            t = buf[0]
            N = buf[1]
            obstacle = []
            for x in range(N):
                obstacle.append(tuple(map(int, raw_input().split())))
            start = tuple(map(int, raw_input().split()))
            print(countGrid(start, obstacle, t))

        except EOFError:
            break

def countGrid(start, obstacle, t):
    cnt = [0,]

    # 到達可能なマス
    q = Queue.Queue()

    # 障害物+ 一度通ったマス
    obstacle.append(start)
    invalid_area = obstacle

    q.put(start)
    cnt[0] += 1

    def countGrid_(que, t):

        for x in range(t):
            grids = []
            while not(que.empty()):
                grid = que.get()

                invalid_area.append(grid)
                grids += makeGrids(grid)
            clear_grids = ejectObstacle(grids, invalid_area)

            for x in clear_grids:
                que.put(x)
                cnt[0] += 1

        return

    countGrid_(q, t)
    return cnt[0]

def makeGrids(grid):
    zipedGrid = [zip(grid, x) for x in dxy]
    return tuple(map(lambda x:tuple(map(sum, x)), zipedGrid))

def ejectObstacle(grids, obstacle):
    grids = list(set(grids))
    return filter(lambda x: x not in obstacle, grids)

def test():
    print(ejectObstacle(((1,2), (1,3), (1,4), ), [(1,2), (1, 5)]))
    print(makeGrids((2,3)))
    start = (0, 0)
    obstacle = [(1, 0), (2, 0)]
    t = 2
    print(countGrid(start, obstacle, t))

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

Measured memory_bytes: 5356
from heapq import heappush, heappop
import sys
input = sys.stdin.readline

T = int(input())
for _ in range(T):
    N, A, B, C, D = map(int, input().split())
    pq = [(0, N)]
    used = set()
    while pq:
        c, x = heappop(pq)
        if x in used:
            continue
        used.add(x)
        if x == 1:
            print(c + D)
            break
        heappush(pq, (c + D * (x - 1), 1))
        if x % 2 == 0:
            heappush(pq, (c + A, x // 2))
        else:
            heappush(pq, (c + D + A, (x - 1) // 2))
            heappush(pq, (c + D + A, (x + 1) // 2))
        if x >= 3:
            if x % 3 == 0:
                heappush(pq, (c + B, x // 3))
            else:
                heappush(pq, (c + D * (x % 3) + B, x // 3))
                heappush(pq, (c + D * (3 - x % 3) + B, x // 3 + 1))
        if x >= 5:
            if x % 5 == 0:
                heappush(pq, (c + C, x // 5))
            else:
                heappush(pq, (c + D * (x % 5) + C, x // 5))
                heappush(pq, (c + D * (5 - x % 5) + C, x // 5 + 1))
        else:
            heappush(pq, (c + D * (5 - x) + C, 1))

Measured memory_bytes: 96468
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;
const int MAX = 110000;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

int main() {
    int n;
    cin >> n;
    vec a(n);
    rep(i, n) cin >> a[i];

    lint res = 1;

    map<int, int> mp;
    rep(i, n) mp[a[i]]++;

    bool f = true;

    for (auto&& p : mp) {
        int k = p.first, v = p.second;
        if (k % 2 == n % 2) f = false;
        if (v != 2 && k > 1) f = false;
        res *= v;
        res %= MOD;
    }

    if (f) cout << res << endl;
    else cout << 0 << endl;
    return 0;
}

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

int main(){
  int num;
  string str;
  int cnt = 0;
  int kekka = 0;
  
  cin >> num >> str;
  
  for(int i = 0; i < num; i++){
    if(str.at(i) == 'I') cnt++;
    else cnt--;
    
    if(cnt > kekka) kekka = cnt;
  }
  
  cout << kekka;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N, K;
    cin >> N >> K;
    double win_rate = 0.0;
    rep2(i, 1, N+1){
        double prob = 1.0 / N;
        ll now = i;
        while (now < K){
            now *= 2;
            prob /= 2;
        }
        win_rate += prob;
    }
    cout << win_rate << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(){
   int x,k,i;
 
  scanf("%d",&x);
   k=1;i=x;
   while (i>0) {
      i+=x;
      if (i>=360) i-=360;
      k++;
   }
   printf("%d\n",k);
   return 0;
}


Measured memory_bytes: 1684
object Main extends App {
	val pw = new java.io.PrintWriter(System.out)

	@scala.annotation.tailrec
	def loop(start: Int, end: Int)(f: Int => Unit): Unit =
		if (start < end) {
			f(start)
			loop(start + 1, end)(f)
		}

	val n, m = Scanner.nextInt
	val k = Scanner.nextLong

	val a = Array.fill(n)(Scanner.nextLong).scanLeft(0L)(_ + _)
	val b = Array.fill(m)(Scanner.nextLong).scanLeft(0L)(_ + _)

	var ans = 0
	var j = m
	loop(0, n+1) { i =>
		if (a(i) <= k) {
			while (a(i) + b(j) > k) j -= 1
			ans = Math.max(ans, i + j)
		}
	}

	pw.println(ans)
	pw.flush()
}

object Scanner {
	private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0

	@inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
	@inline private def hasNextByte(): Boolean = if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else true
	@inline private def hasNext(): Boolean = {
		while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
		hasNextByte()
	}
	@inline private def readByte(): Byte = if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else -1

	def next(): String = {
		if(!hasNext()) ???
		val sb = new StringBuilder; var b = readByte()
		while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
		sb.toString
	}

	def nextInt(): Int = {
		val n = nextLong()
		if (n < Int.MinValue || Int.MaxValue < n) ???
		n.toInt
	}

	def nextLong(): Long = {
		if(!hasNext()) ???
		var minus = false; var b = readByte()
		if (b == '-') { minus = true; b = readByte() }

		@scala.annotation.tailrec
		def go (b: Byte, n: Long = 0): Long = if ('0' <= b && b <= '9') go(readByte(), n * 10 + b - '0') else if (minus) -n else n

		go(b)
	}

	def nextDouble(): Double = next().toDouble
}


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

#define vi vector<int>

int main() {

    string S;
    cin >> S;

    vi child(100005, 1);
    for (int i = 0; i < S.length(); i++) {
        if (S[i] == 'R') {
            if (S[i+1] == 'R') {
                child[i+2] += child[i];
                child[i] = 0;
            }

        }
    }

    for (int i = S.length() - 1; i >= 0; i--) {
        if (S[i] == 'L') {
            if (S[i-1] == 'L') {
                child[i-2] += child[i];
                child[i] = 0;
            }
        }
    }

    for (int i = 0; i < S.length(); i++) {
        cout << child[i] << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 1024
package main

import "fmt"

var N, L int

func main() {
	fmt.Scanf("%d %d\n", &N, &L)
	S := make([]string, N)
	for i := range S {
		fmt.Scanf("%s\n", &S[i])
	}

	for range S {
		for i := range S[1:] {
			if !Lt(S[i], S[i+1]) {
				S[i], S[i+1] = S[i+1], S[i]
			}
		}
	}
	s := ""
	for _, s_ := range S {
		s += s_
	}
	fmt.Println(s)
}

func Lt(s, t string) bool {
	for i := 0; i < L; i++ {
		if s[i] < t[i] {
			return true
		}
		if s[i] > t[i] {
			return false
		}
	}
	return false
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
typedef long double ld;
#define pb push_back
#define fi first
#define se second
const ll mod = 1e9+7;
const int N = 2e5+6;
ll a[123];
void solve(){
	int n;
	ll x; 
	cin>>n>>x; 
	for(int i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+1+n);
	ll sum = 0;
	int ans = 0;
	for(int i=1;i<=n;i++){
		if(sum+a[i]<=x){
			ans = i;
		}
		sum+=a[i];
	}
	if(sum<x)ans = n-1;
	cout<<ans<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3620
n,*as=$<.read.split.map(&:to_i)

arr = Array.new(n+1,0)
arr[0] = 3

ret = 1

as.each do |a|
  ret = ret * arr[a] % 1000000007
  arr[a] -= 1
  arr[a+1] += 1
end

p ret


Measured memory_bytes: 9724
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
/*#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
#define ll long long
#define ull unsigned long long
#define int long long
#define ld long double
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define repb(i, r, l) for (int i = r; i >= l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}

using namespace std;

mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {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;}
                                                                    
typedef pair < int , int > pii ;
typedef pair < long long  , long long > pll ;

const int N = 1e5 + 1;
int n , m;
int a[N];
string s;

main(){
	int a , b , c;
	cin >> a >> b >> c;
	if(a + b + c >= 22)ret("bust");
	ret("win");	
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <functional>
#include <numeric>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <stdio.h>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;

int n, m;
int v[505][505];
int a[505][505], b[505][505];

int main(){
	cin >> n >> m;
	for(int i=0; i<n; i++){
		string s;
		cin >> s;
		for(int j=0; j<m; j++){
			if(s[j] == '#'){
				v[i][j] = a[i][j] = b[i][j] = 1;
			}
		}
	}

	for(int i=0; i<n;i++){
		for(int j=n-1-i; j>=0; j-=4){
			a[i][j] = 1;
			if(j>0) a[i][j-1] = 1;
			if(j>1) b[i][j-2] = 1;
			if(j>2) b[i][j-3] = 1;
		}
		for(int j=n-i; j<m; j+=4){
			if(j>=0) b[i][j] = 1;
			if(j+1>=0 && j+1<m) b[i][j+1] = 1;
			if(j+2>=0&& j+2<m) a[i][j+2] = 1;
			if(j+3>=0 && j+3<m) a[i][j+3] = 1;
		}
	}	for(int i=0; i<m; i++){
		a[0][i] = 1;
		b[0][i] = 0;
		a[n-1][i] = 0;
		b[n-1][i] = 1;
	}
	for(int i=1; i<n-1; i++){
		b[i][0] = 1;
		a[i][0] = 0;
		a[i][m-1] = 1;
		b[i][m-1] = 0;
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			if(b[i][j] && a[i][j] && !v[i][j]){
				assert(0);
			}
			if(!b[i][j] && !a[i][j] && v[i][j]){
				assert(0);
			}
			if(a[i][j]) putchar('#');
			else putchar('.');
		}
		puts("");
	}
	puts("");
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			if(b[i][j] && a[i][j] && !v[i][j]){
				assert(0);
			}
			if(!b[i][j] && !a[i][j] && v[i][j]){
				assert(0);
			}
			if(b[i][j]) putchar('#');
			else putchar('.');
		}
		puts("");
	}


}


Measured memory_bytes: 3712
#include <iostream>
using namespace std;
int main() {
    long long int N;
    cin >> N;
    long long int input[N];
    for (int i = 0; i < N; ++i) {
        cin >> input[i];
    }
    long long int sum=0;
    long long int highest = 0;
    for (long long int i = 0; i < N; ++i) {
        if(highest<=input[i]){
            highest=input[i];
        }
        sum+=highest-input[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 4752
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<int, P> PP;
struct edge { int to; int to2; int cost; };
string k = "keyence";
signed main() {
	string s; cin >> s;
	rep(i, s.size()) {
		for (int j = i; j < s.size(); j++) {
			string now;
			rep(l, s.size()) {
				if ((i <= l&&l <= j));
				else now.push_back(s[l]);
			}
			if (now == k) {
				puts("YES");
				return 0;
			}
		}
	}
	if (s == k)puts("YES");
	else puts("NO");
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
//#include "test.h"

using namespace std;


int main()
{
	int n;

	cin >> n;

	char* str = new char[n+1];

	cin >> str;
	/*
		Nを読み取る
		Sを読み取る
		N %2 = 1 ならNoを出力
		N%2 = 0の場合
			S[i+N/2] == S[i]が全て満たされていればYes
	*/

	if (n % 2 == 1) {
		cout << "No" << endl;
		delete[] str;
		return 0;
	}

	for (int i = 0; i < n / 2; i++) {

		if (str[i] != str[i + n / 2]) {
			cout << "No" << endl;
			delete[] str;
			return 0;
		}

	}

	cout << "Yes" << endl;
	delete[] str;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n, m, x;
	cin >> n >> m >> x;
	int l = 0;
	int r = 0;
	for( int i = 0; i < m; ++i ){
		int temp;
		cin >> temp;
		if( temp < x ){
			++l;
		}
		if( temp > x ){
			++r;
		}
	}
	cout << min(l, r) << endl;
	return 0;
}

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

int store[100000];

int main()
{
    int N, K, Q;
    scanf("%d %d %d", &N, &K, &Q);

    for (int i = 1; i <= Q; i++) {
        int tmp;
        scanf("%d", &tmp);
        store[tmp]++;
    }

    for (int i = 1; i <= N; i++) {
        int tmp = (store[i] + K) - Q;
        if (tmp < 1) puts("No");
        else puts("Yes");
    }
}

Measured memory_bytes: 1024
s = list(input())
a = list()
b = list()
c = list()
a.append(s[0])
for i in range(1,4):
    if s[i] == a[0]:
        a.append(s[i])
    elif len(b) == 0:
        b.append(s[i])
    elif s[i] == b[0]:
        b.append(s[i])
    else:
        c.append(s[i])
if (len(a) == 2) and (len(b) == 2):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
from time import perf_counter
t0 = perf_counter()


import sys
sys.setrecursionlimit(300000)
from collections import defaultdict
from random import randint

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


D = I()
C = LMI()
S = [LMI() for _ in range(D)]


# 貪欲解の生成
last = defaultdict(int)
ans0 = []
for d in range(D):
    m = -INF
    ans = -1
    for i in range(26):
        lans = S[d][i]
        for j in range(26):
            if i == j:
                lans -= C[j] * (d + 1 - d - 1)
            else:
                lans -= C[j] * (d + 1 - last[j])
        if lans > m:
            m = lans
            ans = i
    ans0.append(ans)



T = ans0
last = [[i + 1] * 26 for i in range(D)]
for d in range(D):
    i = T[d]
    j = 0
    for dd in range(d, D):
        last[dd][i] = j
        j += 1

def eval(d, q):
    i = T[d]
    val = S[d][q] - S[d][i]

    contrib = 0
    if d == 0:
        j = 1
    else:
        j = last[d - 1][i] + 1
    for dd in range(d, D):
        if dd > d and last[dd][i] == 0:
            break
        contrib += j - last[dd][i]
        # last[dd][i] = j
        j += 1
    val -= contrib * C[i]

    contrib = 0
    j = 0
    for dd in range(d, D):
        if last[dd][q] == 0:
            break
        contrib += last[dd][q] - j
        # last[dd][q] = j
        j += 1
    val += contrib * C[q]

    # T[d] = q

    return val

def apply(d, q):
    i = T[d]

    if d == 0:
        j = 1
    else:
        j = last[d - 1][i] + 1
    for dd in range(d, D):
        if dd > d and last[dd][i] == 0:
            break
        last[dd][i] = j
        j += 1

    j = 0
    for dd in range(d, D):
        if last[dd][q] == 0:
            break
        last[dd][q] = j
        j += 1

    T[d] = q

while perf_counter() - t0 < 1.8:
    d = randint(0, D - 1)
    q = randint(0, 25)
    if eval(d, q) > 0:
        apply(d, q)
for t in T:
    print(t + 1)

Measured memory_bytes: 81420
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define _GLIBCXX_DEBUG
#define int long long
int INF = 1e9+7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
unsigned day;
if(dow < dow1) dow += 7;
day = dow - dow1;
day += 7 * n - 6;
return day;
}
unsigned DayToWeekNumber(unsigned day)
{
  return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
  return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main(){
	int N,M; cin>>N>>M;
	int H[N+1];
	REP(i,N+1)cin>>H[i];
	int A[M];
	int B[M];
	vector<int>C(N+1);
	rep(i,M){
		cin>>A[i]>>B[i];
		if(H[A[i]]<=H[B[i]])C[A[i]]=1;
		if(H[A[i]]>=H[B[i]])C[B[i]]=1;
	}
	int ans=0;
	REP(i,N+1)if(C[i]==0)ans++;
	cout<<ans<<endl;
}

Measured memory_bytes: 6388
/*================================================================
rehtegot!
*   
*   File Name：d.cpp
*   Author：YaliKiWi
*   Date：2019年10月27日
*   Discribe：
*
================================================================*/


#include<bits/stdc++.h>
using namespace std;
#define fo(i,s,e) for(register int i=s,i%:%:_end=e;i<=i%:%:_end;i++)
#define max_(x,y) ((x)>(y)?(x):(y))
#define min_(x,y) ((x)<(y)?(x):(y))
#define dd double
#define ull unsigned long long
#define ll long long
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define pi 3.141592653589793
dd a,b,x;
dd c;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	scanf("%lf%lf%lf",&a,&b,&x);
	c=x*2.0/(b*a);
	if(c<=a){
		printf("%.12lf",atan(b/c)*180/pi);
		return 0;
	}
	else{
		dd d=(2*x-a*a*b)/(a*a);
		b-=d;
		printf("%.12lf",atan(b/a)*180/pi);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define N 1000005
typedef long long ll;
const ll LLINF=1ll<<60;
// const int mx=1e5+7;
// int n;
//vector<int> a(mx),b(mx);
// vector<int> g[mx];
// int deg[mx];
// vector<int> adj[mx];
//vector<int> ans;
//---dfs--
//bool visited[mx];
//vector<ll> val(mx,0);

// void dfs(int s,int e,int c1,int c2){
// 	if(a[s]^c1!=b[s]) {ans.push_back(s), c1^=1;}
// 	for(auto u:adj[s]){
// 		if(u!=e){
// 			dfs(u,s,c2,c1);
// 		}
// 	}
// }
//---dfs---

//---primes---
// const int N = 1e7 + 10;

// bool prime[N];
 
// int spf[N];
 
// void calc(){
// 	for(int i = 2; i<1e4; i++){
// 		if(prime[i])
// 			continue;
// 		spf[i] = i;
// 		for(int j = i * i; j < N; j += i){
// 			prime[j] = 1;
// 			spf[j] = i;
// 		}
// 	}
// 	for(int i = 2; i < N; i++)
// 		if(!spf[i])
// 			spf[i] = i;
// }

// vector<pair<int,int>> getp(int x){
// 	int curr=x;
// 	vector<pair<int,int>> ans;
// 	while(curr>1){
// 		int a=spf[curr];
// 		int count=0;
// 		while(curr%a==0){ curr/=a; count++;}
// 		ans.push_back(make_pair(a,count));
// 	}
// 	return ans;
// }

// bool ispr(int n) {
// 	if(n==1) return false;
//     for (int i=2;i*i<=n;++i){
//         if(n%i==0){
//             return false;
//         }
//     }
//     return true;
// }
//---primes---

//---segment_tree---
// int upd(int t,int val,int l,int r,int y, int z){
// 	if(y<l||y>r) return tr[val];
// 	if(l==r) return tr[val]=z;
// 	int s=(l+r)/2;
// 	upd(t^1,2*val+1,l,s,y,z);
// 	upd(t^1,2*val+2,s+1,r,y,z);
// 	if(t) tr[val]=tr[2*val+1]|tr[2*val+2];
// 	else tr[val]=tr[2*val+1]^tr[2*val+2];
// 	return tr[val];
// }
//int query(){}
//---segment_tree---


int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	int T=1;
	//cin>>T;
	while(T--){
		string s;
		cin>>s;
		ll n=(ll)s.size();
		ll sum=0;
		for(ll i=0;i<n;i++){
			sum+=(ll)(s[i]-'0');
		}	
		if(sum%9==0) cout<<"Yes\n";
		else cout<<"No\n";
 	}
}

Measured memory_bytes: 3732
n=int(input())
a=list(map(int, input().split()))
a.sort(reverse=True)
ans=0
if n%2==0:
    for i in range(0,n,2):
        ans+=a[i]-a[i+1]
else:
    for i in range(0,n-1,2):
        ans+=a[i]-a[i+1]
    ans+=a[n-1]
print(ans)


Measured memory_bytes: 3060
A, B, N = input().split()
f = 0
if int(N) >= int(B):
    f = (int(B) - 1) / int(B)
    f = f - int(f)
else:
    f = int(N) / int(B)
    f = f - int(f)

print(int(f*int(A)))

Measured memory_bytes: 9184
#include<iostream>
using namespace std;
int main(){
  long long a,b,t;
  cin >> a >> b;
  if(a>b){
    t=a;
    a=b;
    b=t;
  }
  if((b+a)%2==0){
    cout << (b+a)/2<<endl;
  }else{
    cout <<"IMPOSSIBLE\n";
  }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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 dp[105][4][2];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    int K;
    cin >> s >> K;
    int n = s.size();
    dp[0][0][0] = 1;
    rep(i,n){
        rep(j,4){
            rep(k,2){
                int ns = s[i] - '0';
                rep(l,10){
                    int ni = i + 1;
                    int nj = j;
                    int nk = k;
                    if(l != 0) nj = j + 1;
                    if(nj > K) continue;
                    if(k == 0){
                        if(l > ns) continue;
                        if(l < ns) nk = 1;
                    }
                    dp[ni][nj][nk] += dp[i][j][k];
                }
            }
        }
    }
    cout << dp[n][K][0] + dp[n][K][1] << endl;
    return 0;
}


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


void solve(long long A, long long B, long long K){
  long long a = A;
  long long b = B;

  if (K <= A) {
    a = A - K;
  } else if (K <= A + B) {
    a = 0;
    b -= K - A;
  } else {
    a = 0; b = 0;
  };
  cout << a << ' ' << b << endl;
}

// 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 A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long K;
    scanf("%lld",&K);
    solve(A, B, K);
    return 0;
}


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

int main()
{
	int n;
	double kg, m;

	while(scanf("%d, %lf,%lf", &n, &kg, &m) != EOF){
		if (kg / (m * m) >= 25)
		{
			cout << n << endl;
		}
	}

}

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

using ll = long long;

const int MOD = 1e9 + 7;
const int i2 = (MOD + 1) / 2;
const int MAXN = 5010;
int N, M;
char S[MAXN];
int dp[MAXN][MAXN];

// let dp[i][j] be the number of ways to make a string of length j using i operations
// it's obvious that the number of ways to form each string of length j is equal
// we only need to divide dp[N][|S|] by 2^|S| to get the answer

int main() {
	scanf("%d %s", &N, S); M = int(strlen(S));
	dp[0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= i; j++) {
			dp[i+1][j+1] = (dp[i+1][j+1] + ll(2) * dp[i][j]) % MOD;
			dp[i+1][max(j-1, 0)] = (dp[i+1][max(j-1, 0)] + dp[i][j]) % MOD;
		}
	}

	int ans = dp[N][M];
	for (int i = 0; i < M; i++) ans = ll(ans) * i2 % MOD;
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 96512
#include <stdio.h>

int main(void){
  int data[37];
  int n;
  int a,b,c,d,e;

  for( a=0;a<37;a++ ) data[a]=0;

  for(a=0;a<10;a++)
    for(b=0;b<10;b++)
      for(c=0;c<10;c++)
        for(d=0;d<10;d++){
          e=a+b+c+d;
          if( e<37 ) data[e]++;
        }

  while( 1 ){
    if( scanf("%d ",&n)!=1 )
      break;
    if( n<37 )
      printf("%d\n",data[n]);
    else
      printf("0\n");
  }

  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
  map<char,int> ch;
  string w;
  cin>>w;
  int i=0;
  for(int i=0;i<w.size();i++){
    ch[w[i]]++;
  }
  bool can=true;
  map<char,int>::iterator it;
  for(it=ch.begin();it!=ch.end();++it)
    if(it->second%2!=0)can=false;
  if(can)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
  long long n, a, b, ans, sur;
  cin >> n >> a >> b;
  if (a == 0) {
    cout << 0 << endl;
    return 0;
  }
  ans = n/(a+b)*a;
  sur = n%(a+b);
  if (sur>=a) {
    ans += a;
  } else {
    ans += sur;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
  int no_of_input,input1,input2,input3;
  cin >> input1 >> input2 >> input3;
  if(input1+input2+input3>=22){
    cout << "bust";
  }
  else{
    cout << "win";
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <iomanip>

#include <algorithm>

//#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

int main() {
  int N;
  cin >> N;
  vector<int> x(N);
  vector<int> y(N);
  int kaijo=1;

  for (int i = 0; i < N; i++) {
    cin >> x[i] >> y[i];
    kaijo *= (i+1);
  }
  //cout << kaijo<< endl;

  // 各点の距離を求める
  double tmp;
  double sum = 0;
  int count = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      //cout << pow(x[i] - x[j], 2) << " " << pow(y[i] - y[j], 2) << endl;
      tmp = sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2));
      // cout << i <<" " << j  << " " << tmp  << endl;
      sum += tmp;
      count++;
    }
  }
  double total = sum * (kaijo * (N-1))/count;

  cout << setprecision(10) << total/kaijo << endl;
}


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

using namespace std;

int main(){
	int n, r, p, c;
	while(cin >> n >> r, n|r){
		vector<int> res;
		for(int i = n;i >= 1;i--){
			res.push_back(i);
		}
		for(int i = 0;i < r;i++){
			cin >> p >> c;
			vector<int> tmp;
			for(int i = p-1;i < p + c-1;i++){
				tmp.push_back(res[i]);
			}
			for(int i = 0;i < n;i++){
				if(p-1 <= i && i < p + c - 1)continue;
				tmp.push_back(res[i]);
			}
			res = tmp;
		}
		cout << res[0] << endl;
	}
}

Measured memory_bytes: 1220
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb emplace_back
#define koto_memory(a) cout<<(sizeof(a)/1048576.0)<<" MB";
#define res(v) sort(all(v)),v.erase(unique(all(v)), v.end());
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
#define deb(x) cout<<"\n["<<#x<<" = "<<x<<"]\n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
int n,k,a[N];
void solve(){
  cin>>n>>k;
  rep(i,0,n-1)cin>>a[i];
  rep(i,k,n-1){
    a[i]>a[i-k]?cout<<"Yes":cout<<"No";
    cout<<"\n";
  }
}
int32_t main()
{
  ibs;cti;
  solve();return 0;
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 5208
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

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

    std::vector<int> h(n);
    for (int i = 0; i < n; i++)
    {
        std::cin >> h[i];
    }

    int ans = 0;
    std::vector<int> ansp;
    for (int i = 0; i < n - 1; i++)
    {
        if(h[i+1] <= h[i]) {
            ans++;
        } else {
            ansp.push_back(ans);
            ans = 0;
        }
    }
    ansp.push_back(ans);

    std::cout << *std::max_element(ansp.begin(), ansp.end()) << "\n";
}

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

typedef long long ll;
typedef long double ld;

bitset <5005> pref[5005];
bitset <5005> suf[5005];
int niz[5005];

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n, k;
    cin >> n >> k;
    pref[0][0] = 1;
    suf[n+1][0] = 1;
    ll ukup = 0;
    for(int i=1; i<=n; i++){
        cin >> niz[i];
        ukup += niz[i];
        pref[i] = pref[i-1] | (pref[i-1] << niz[i]);
    }
    if(ukup < k){
        cout << n;
        return 0;
    }
    for(int i=n; i>=1; i--){
        suf[i] = suf[i+1] | (suf[i+1] << niz[i]);
    }
    int cnt = 0;
    for(int i=1; i<=n; i++){
        if(niz[i] >= k){
            cnt++;
            continue;
        }
        int r = k-1;
        int l = k-niz[i];
        int tren = 0;
        for(int j=l; j<=r; j++) if(suf[i+1][j]) tren++;
        int r1 = r;
        for(int j=0; j<=r1; j++){
            if(tren && pref[i-1][j]){
                cnt++;
                break;
            }
            if(l > 0){
                l--;
                if(suf[i+1][l]) tren++;
                if(suf[i+1][l+1]) tren--;
            }
            if(r > 0){
                r--;
                if(suf[i+1][r]) tren++;
                if(suf[i+1][r+1]) tren--;
            }
        }
    }
    cout << n-cnt;
    return 0;
}


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

const ll MAXN = 200000;
const ll INF = 1001001001;

ll N, ans=0, tmpv=-1, tmpi=-1;
vector<ll> XR, YR, color;
vector<pair<ll,ll>> XYB;

signed main(){
    cin >> N;
    XR.resize(N);
    YR.resize(N);
    color.resize(N,0);
    for(int i=0;i<N;i++) {
        cin >> XR[i] >> YR[i];
    }
    for(int i=0;i<N;i++) {
        ll c, d;
        cin >> c >> d;
        XYB.push_back(make_pair(c,d));
    }
    sort(XYB.begin(), XYB.end());
    for(int i=0;i<N;i++) {
        tmpv=-1;
        tmpi=-1;
        for(int j=0;j<N;j++) {
            if(XYB[i].first>XR[j]&&color[j]==0) {
                if(XYB[i].second>YR[j]) {
                    if(tmpv<YR[j]) {
                        tmpv = YR[j];
                        tmpi = j;
                    }
                }
            }
        }
        if(tmpi!=-1) {
            color[tmpi]=1;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636