akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.string, std.conv, std.array, std.range, std.algorithm, std.typecons;

void main() {
    long n, m;
    readf("%d %d\n", &n, &m);

    long[][] ss = [];
    foreach (i; 0..m) {
        ss ~= readln.strip.split(" ")[1..$].map!(to!long).array;
    }
    long[] ps = readln.strip.split(" ").map!(to!long).array;

    long solve(long k, long[] sw) {
        if (k >= n) {
            long ret = 0;
            foreach (i; 0..m) {
                long cnt = 0;
                foreach (j; 0..n) {
                    if (ss[i].canFind(j+1)) {
                        cnt += sw[j];
                    }
                }
                if (cnt % 2 == ps[i]) {
                    ret++;
                }
            }
            if (ret == m) {
                return 1;
            }
            return 0;
        }

        long a = solve(k+1, sw);
        long[] sw2 = sw.dup;
        sw2[k] = 1;
        long b = solve(k+1, sw2);
        return a+ b;
    }

    long ans = solve(0, new long[](n));
    writeln(ans);
}


Measured memory_bytes: 380
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <iomanip>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define outD(fpv) cout << setprecision(20) << fpv << endl;
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
inline void YES(bool cond) { cond ? puts("YES") : puts("NO"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
template<typename Type> inline void unique(Type& arr) { sort(arr); arr.erase(unique(arr.begin(), arr.end()), arr.end()); }
constexpr ll INF_I = std::numeric_limits<ll>::max();
constexpr ll BIGP = 1000000007L;
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //
    ll N;
    cin >> N;
    vector<ll> A(N + 1);
    vector<ll> B(N);
    rep(i, N + 1) cin >> A[i];
    rep(i, N) cin >> B[i];
    //
    ll ans = 0;
    rep(i, N)
    {
        ll t0 = min(A[i], B[i]);
        ans += t0;
        A[i] -= t0;
        B[i] -= t0;
        ll t1 = min(A[i+1], B[i]);
        A[i + 1] -= t1;
        ans += t1;
    }
    cout << ans;
    //
    return 0;
}

Measured memory_bytes: 4680
// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod7=1000000007LL;
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add(LL _x, LL _y, LL _mod=mod7){
  _x+=_y;
  return _x>=_mod ? _x-_mod : _x;
}
inline LL sub(LL _x, LL _y, LL _mod=mod7){
  _x-=_y;
  return _x<0 ? _x+_mod : _x;
}
inline LL mul(LL _x, LL _y ,LL _mod=mod7){
  _x*=_y;
  return _x>=_mod ? _x%_mod : _x;
}
LL mypow(LL _a, LL _x, LL _mod){
  if(_x == 0) return 1LL;
  LL _ret = mypow(mul(_a, _a, _mod), _x>>1, _mod);
  if(_x & 1) _ret=mul(_ret, _a, _mod);
  return _ret;
}
LL mymul(LL _a, LL _x, LL _mod){
  if(_x == 0) return 0LL;
  LL _ret = mymul(add(_a, _a, _mod), _x>>1, _mod);
  if(_x & 1) _ret=add(_ret, _a, _mod);
  return _ret;
}
void sleep(double sec = 1021){
  clock_t s = clock();
  while(clock() - s < CLOCKS_PER_SEC * sec);
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/
const int N=101010;
void build(){

}
int n, vl[N];
vector<int> v[N];
char c[N];
void init(){
  n=getint();
  for(int i=1; i<n; i++){
    int ui=getint();
    int vi=getint();
    v[ui].push_back(vi);
    v[vi].push_back(ui);
  }
  scanf("%s", c+1);
  for(int i=1; i<=n; i++)
    vl[i]=(c[i] == 'W');
}
int root, sz[N];
void go(int now, int prt){
  sz[now]=(c[now] == 'W');
  for(int son: v[now]){
    if(son == prt) continue;
    go(son, now);
    sz[now]+=sz[son];
  }
}
int cnt[N], ans, bst, dp[N][2];
void DP(int now, int prt){
  for(int son: v[now]){
    if(son == prt or sz[son] == 0)
      continue;
    cnt[now] ++;
    DP(son, now);
    ans+=2;
  }
  for(int son: v[now]){
    if(son == prt or sz[son] == 0)
      continue;
    int tdp[2];
    tdp[0]=(1+(((vl[son]+cnt[son]+1)&1)?1:-1))+dp[son][0];
    tdp[1]=(1+(((vl[now]+cnt[now]+(now != prt))&1)?1:-1))+dp[son][1];
    bst=max(bst, tdp[0]+dp[now][1]);
    bst=max(bst, tdp[1]+dp[now][0]);
    dp[now][0]=max(dp[now][0], tdp[0]);
    dp[now][1]=max(dp[now][1], tdp[1]);
  }
  //printf("%d: %d %d\n", now, dp[now][0], dp[now][1]);
  ans+=(vl[now]+cnt[now]+(now!=prt))&1;
}
void solve(){
  for(int i=1; i<=n; i++)
    if(c[i] == 'W'){
      root=i;
      break;
    }
  if(!root){
    cout<<0<<endl;
    exit(0);
  }
  go(root, root);
  DP(root, root);
  cout<<ans-bst<<endl;
}
int main(){
  build();
  //__ = getint();
  while(__ --){
    init();
    solve();
  }
}


Measured memory_bytes: 15616
/*
ID: jerrywcy
LINK: https://atcoder.jp/contests/abc127/tasks/abc127_d
LANG: C++
STATUS:
*/
#include <bits/stdc++.h>

#define init(array,x) memset(array,x,sizeof(array))

using namespace std;

const int inf=0x3f3f3f3f;
const int maxn=1e5+10;

struct oper{
    int b,c;
}o[maxn];

int n,m;
priority_queue<int,vector<int>,greater<int> > q;
long long ans;

bool cmp(oper x,oper y){
    return x.c>y.c;
}

int main()
{
	ios::sync_with_stdio(false);
    scanf("%d %d",&n,&m);
    for (int i=1,x;i<=n;i++){
        scanf("%d",&x);
        ans+=x;
        q.push(x);
    }

    for (int i=1;i<=m;i++)scanf("%d %d",&o[i].b,&o[i].c);
    sort(o+1,o+m+1,cmp);

    for (int i=1;i<=m;i++){
        int b=o[i].b,c=o[i].c;
        if (c<q.top()){
            cout<<ans<<endl;
            return 0;
        }
        while (b && q.top()<c){
            ans-=q.top();
            ans+=c;
            q.pop();
            q.push(c);
            b--;
        }
    }
    cout<<ans<<endl;

	return 0;
}


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

int main() {
	int N, M;
	cin >> N >> M;
	int i = 1, j = N;
	int dif = j - i;
	for (int k = 0; k < M; k++) {
		if (j - i == N - dif || j - i == N - (j - i)) i++;
		cout << i << " " << j << endl;
		dif = j - i;
		i++;
		j--;
	}
}


Measured memory_bytes: 3636
#include <iostream>
#include <queue>
#include <set>
#include <vector>
using namespace std;

int N;
int M;

int L[200010];
int R[200010];
int D[200010];

typedef pair<int,int> P;

vector<P> edges[100010];
set<int> st;

int dist[100010];
int visited[100010];

int main()
{
	fill(dist,dist + 100010,-1e9);

	cin >> N >> M;

	for(int i = 1;i <= M;i++)
	{
		cin >> L[i] >> R[i] >> D[i];
		edges[L[i]].push_back({R[i],D[i]});
		edges[R[i]].push_back({L[i],-D[i]});
		st.insert(L[i]);
		st.insert(R[i]);
	}

	int s = -1;

	while(!st.empty())
	{
		auto ite = st.begin();
	
		{
			s = *ite;

			queue<P> que;
			que.push({s,0});
			dist[s] = 0;

			while(!que.empty())
			{
				int v = que.front().first;
				int d = que.front().second;
				que.pop();

				st.erase(v);
				for(P& p : edges[v]) {
					if(dist[p.first] == -1e9){
						dist[p.first] = d + p.second;
						que.push(P(p.first,d + p.second));
					}
					else if(dist[p.first] != d + p.second)
					{
						cout << "No" << endl;
						return 0;
					}

				}
				
			}
			
		}
	}

	cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 16768
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

//const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(100005);
// comb(n,k)ならcomb(n+k+5)とかにしておく

mint f(int n, int k) {
  if (n < 0) return 0;
  mint res = comb(n,k);
  // nPk = nCk * k!
  //res *= comb.fact[k]; // <- nPk求めたいときは必要
  return res;
}
// f(n,k).x で nCk か nPk が計算される

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

  for (int i = 1; i <= k; ++i) {
    mint ans = f(n-k+1,i).x * f(k-1,i-1).x;
    printf("%d\n", ans);
  }

  return 0;
}

Measured memory_bytes: 1792
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}
void YES(bool ok){
    cout << (ok ? "Yes" : "No") << endl;
}
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll q; cin >> q;
    while(q--){
        ll a,b; cin >> a >> b;
        ll c,d; cin >> c >> d;
        if(a < b || b > d){
            YES(false);
            continue;
        }
        if(c >= b){
            YES(true);
            continue;
        }
        ll g = gcd(b,d);
        ll max_ = (b - g + (a % g)) % b;
        YES(max_ <= c);
    }
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

struct mint {
    lint v;
    lint _mod;
    mint() : v(0) {}
    mint(signed v, lint _mod = mod) : v(v), _mod(_mod) {}
    mint(lint t, lint _mod = mod) : _mod(_mod) {
        v = t % _mod;
        if (v < 0)
            v += _mod;
    }

    mint pow(lint k) {
        mint res(1), tmp(v);
        while (k) {
            if (k & 1)
                res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    static mint add_identity() { return mint(0); }
    static mint mul_identity() { return mint(1); }
    mint inv() { return pow(_mod - 2); }

    mint &operator+=(mint a) {
        v += a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator-=(mint a) {
        v += _mod - a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator*=(mint a) {
        v = v * a.v % _mod;
        return *this;
    }
    mint &operator/=(mint a) { return (*this) *= a.inv(); }

    mint operator+(mint a) const { return mint(v) += a; };
    mint operator-(mint a) const { return mint(v) -= a; };
    mint operator*(mint a) const { return mint(v) *= a; };
    mint operator/(mint a) const { return mint(v) /= a; };

    mint operator-() const { return v ? mint(_mod - v) : mint(v); }

    bool operator==(const mint a) const { return v == a.v; }
    bool operator!=(const mint a) const { return v != a.v; }
    bool operator<(const mint a) const { return v < a.v; }
};
ostream &operator<<(ostream &os, mint m) { return os << m.v; }

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, h, d;
    cin >> n >> h >> d;
    vector<mint> dp(h + 1);
    mint facto = 1;
    mint f     = 0;
    for (int i = 1; i <= n; ++i) {
        facto *= i;
        f += facto;
    }
    dp[0] = facto;
    for (int i = 1; i <= h; ++i) {
        dp[i] = dp[i - 1] * f;
        if (i - d - 1 >= 0)
            dp[i] -= dp[i - 1 - d] * f;
        else
            dp[i] += dp[0] - dp[0] * f;
        dp[i] += dp[i - 1];
    }
    mint ret = dp[h] - dp[h - 1];
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 15872
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def main():
    N = int(input())
    print(N // 3)

if __name__ == '__main__':
    main()


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

namespace AtCoderApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            // スペース区切りの整数の入力
            string[] input = Console.ReadLine().Split(' ');
            int b = int.Parse(input[0]);
            int c = int.Parse(input[1]);
            if (((b * c) % 2) > 0)
            {
                Console.WriteLine("Odd");
            }
            else
            {
                Console.WriteLine("Even");
            }
        }
    }
}


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

signed main() {
  int N,K,Q;
  cin >> N >> K >> Q;
  vector<int> S(N);

  for(int i=0; i<Q; i++) {
    int a; cin >> a;
    S[a-1]++;
  }

  for(int i=0; i<N; i++) {
    int score = K - Q + S[i];
    if(score > 0) puts("Yes");
    else puts("No");
  }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
#define REP(i, m, n) for(ll i = (ll)m; i < (ll)n; i++)
#define PER(i, m, n) for(ll i = (ll)m; i > (ll)n; i--)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG

template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;

const double PI = 3.14159265358979323846;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

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

int main(){
    string s;
    cin >> s;
    int size = s.length();
    bool ok = false;
    int sum = 0;

    REP(i, 0, size){
        sum += s[i] - '0';
    }
    if(sum % 9 == 0) ok = true; 

    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3748
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] line1 = line.split(" ");
        int a = Integer.parseInt(line1[0]) - Integer.parseInt(line1[1]) + 1;
        System.out.println(a);
    }
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n, k, ans = 0;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i], a[i]--;

  int logk = 1;
  while ((1LL << logk) < k) logk++;
  vector<vector<ll>> doubling(logk, vector<ll>(n));
  rep(i, n) doubling[0][i] = a[i];

  rep(i, logk - 1) rep(j, n) doubling[i + 1][j] = doubling[i][doubling[i][j]];

  int now = 0;
  for (int i = 0; k > 0; ++i) {
    if (k & 1) now = doubling[i][now];
    k = k >> 1;
  }

  cout << now + 1 << endl;
  return 0;
}


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

#define sz(a) ((int)a.size())
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define forse(i,s,e) for(int i=(int)s;i<(int)e;i++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

using dbl=double;
using ll=long long;
using pii=pair<int, int>;
using pll=pair<ll, ll>;

dbl PI=3.141592653589793;


void solve(){
	int n;
	cin >> n;
	ll out=0;
	forse(i,1,n+1)
		for(int j=i;j<=n;j+=i)
		   	out+=j;
	cout << out;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); 
	int T=1;
//	cin >> T;
	for(int c=1;c<=T;c++){
		solve();
	}
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,K;
    cin >> N >> K;

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

    int ans =0;

    for(int i=0;i<N;i++){
        if(K <= vec.at(i)){
            ans++;
        }
    }

    cout << ans << endl;
}

// //配列
// vector<int> vec(N);
// for (int i = 0; i < N; i++) {
// cin >> vec.at(i);
// }

// //配列の要素数
// 配列変数.size();

// //初期値の指定
// vector<型> 配列名(要素数, 初期値);

// //要素の追加
// vec.push_back(10);

Measured memory_bytes: 640
import math
import numpy as np

N = int(input())

A = list(map(int, input().split()))

max_num = max(A)
min_num = min(A)

ans = 100101101

for i in range(min_num, max_num + 1):
    cost = 0
    for j in range(len(A)):
        cost += (A[j] - i) * (A[j] - i)
    ans = min(ans, cost)

print(ans)

Measured memory_bytes: 12504
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn rep<T, F: FnMut() -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|_| f()).collect()
}

fn tabulate<T, F: FnMut(usize) -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|i| f(i)).collect()
}

fn abs_diff(x: usize, y: usize) -> usize {
    if x <= y {
        y - x
    } else {
        x - y
    }
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let h: usize = scan(tokens);
    let w: usize = scan(tokens);
    let a: Vec<Vec<usize>> = rep(h, || rep(w, || scan(tokens)));
    let b: Vec<Vec<usize>> = rep(h, || rep(w, || scan(tokens)));
    let d: Vec<Vec<usize>> = tabulate(h, |i| tabulate(w, |j| abs_diff(a[i][j], b[i][j])));
    let m: usize = d.iter().map(|row| row.iter().max().unwrap()).max().unwrap() * (h + w) + 1;
    let mut dp: Vec<Vec<Vec<bool>>> = vec![vec![vec![false; m]; w]; h];
    for i in 0..h {
        for j in 0..w {
            if i == 0 && j == 0 {
                dp[i][j][d[i][j]] = true;
            }
            if i > 0 {
                for x in 0..m {
                    if dp[i - 1][j][x] {
                        dp[i][j][abs_diff(x, d[i][j])] = true;
                        if x + d[i][j] < m {
                            dp[i][j][x + d[i][j]] = true;
                        }
                    }
                }
            }
            if j > 0 {
                for x in 0..m {
                    if dp[i][j - 1][x] {
                        dp[i][j][abs_diff(x, d[i][j])] = true;
                        if x + d[i][j] < m {
                            dp[i][j][x + d[i][j]] = true;
                        }
                    }
                }
            }
        }
    }
    for x in 0..m {
        if dp[h - 1][w - 1][x] {
            println!("{}", x);
            break;
        }
    }
}


Measured memory_bytes: 96508
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	
	answer := 0
	m := 200001

	for i := 0; i < n; i++ {
		sc.Scan()
		p, _ := strconv.Atoi(sc.Text())
		if p <= m {
			m = p
			answer++
		}
	}
	fmt.Println(answer)
}

Measured memory_bytes: 2048
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

bool dp[85][85][2*85*85];  // dp[i][j][k] : (i,j)の偏りをkにできるならtrue

int main() {
    ll h, w;
    cin >> h >> w;

    vvl a(h, vl(w));
    rep(i, h) {
        rep(j, w) {
            cin >> a[i][j];
        }
    }
    vvl b(h, vl(w));
    rep(i, h) {
        rep(j, w) {
            cin >> b[i][j];
        }
    }

    dp[0][0][abs(a[0][0] - b[0][0])] = true;
    rep(i, h) {
        rep(j, w) {
            exrep(k, 0, 2*80*80) {
                if(dp[i][j][k]) {
                    if(i+1 < h) {
                        dp[i+1][j][k + abs(a[i+1][j] - b[i+1][j])] = true;
                        dp[i+1][j][abs(k - abs(a[i+1][j] - b[i+1][j]))] = true;
                    }
                    if(j+1 < w) {
                        dp[i][j+1][k + abs(a[i][j+1] - b[i][j+1])] = true;
                        dp[i][j+1][abs(k - abs(a[i][j+1] - b[i][j+1]))] = true;
                    }
                }
            }
        }
    }
    
    exrep(k, 0, 2*80*80) {
        if(dp[h-1][w-1][k]) {
            out(k);
            re0;
        }
    }

    re0;
}

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

int main() {
    int H, W;
    cin >> H >> W;

    while(!(H == 0 && W == 0)) {
        int inner_height = H - 2;
        int inner_width = W - 2;

        for(int i=0; i<W; ++i) cout << "#";
        cout << endl;

        for(int i=0; i<inner_height; ++i) {
            cout << "#";
            for(int j=0; j<inner_width; ++j) {
                cout << ".";
            }
            cout << "#" << endl;
        }

        for(int i=0; i<W; ++i) cout << "#";
        cout << endl;

        cout << endl;

        cin >> H >> W;
    }

    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    map<pair<int,int>,int>mp;
    for(int i=1; i<=n; ++i){
        string s=to_string(i);
        int x=s[0]-'0',y=s[s.size()-1]-'0';
        mp[make_pair(x,y)]++;
    }
    int ans=0;
    for(int i=1; i<=n; ++i){
        string ss=to_string(i);
        int xa=ss[0]-'0',ya=ss[ss.size()-1]-'0';
        ans+=mp[make_pair(ya,xa)];
    }
    cout<<ans<<endl;
    return 0;
}


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

string substrBack(string str, size_t pos, size_t len) {
    const size_t strLen = str.length();
 
    return str.substr(strLen - pos, len);
}
 
int main() {
  string str;
  int snum;
  int check=0;
  cin >> str;
  string c,bc;
  
  snum = str.length();
  
  for(int i = 0;i<snum/2;++i){
   c = str[i];
   bc = substrBack(str, i+1, 1);  
     if(c != bc) ++check;

     

  }
  
  cout << check << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define ALL(x) x.begin(), x.end()
#define DEBUG(args...) { string _s = #args; replace(ALL(_s), ' ', '\0');\
replace(ALL(_s), ',', ' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); _debug(_it, args);}
#define endl "\n"
#define F first
#define S second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void _debug(istream_iterator<string>) {}
template<typename T, typename... Args>
void _debug(istream_iterator<string> it, T first, Args... args) {
    cerr << ">> " << *it << " : " << first << endl; _debug(++it, args...);
}
template <typename T1, typename T2>
inline ostream& operator << (ostream& out, const pair<T1, T2>& p) {
    return out << "(" << p.F << ", " << p.S << ")";
}
template<typename T>
inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty()) return out << "[]";
    else { out << '['; for (auto& e : v) { out << e << ", "; } return out << "\b\b]"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const set<T>& s) {
    if (s.empty()) return out << "{}";
    else { out << '{'; for (auto& e : s) { out << e << ", "; } return out << "\b\b}"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const unordered_set<T>& s) {
    return out << set<T>(ALL(s));
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const map<T1, T2>& m) {
    if (m.empty()) return out << "{}";
    out << '{'; for (auto& p : m) { out << p << ", "; } return out << "\b\b}";
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const unordered_map<T1, T2>& m) {
    return out << map<T1, T2>(ALL(m));
}
template<typename T>
inline ostream& operator << (ostream& out, const ordered_set<T>& s) {
    return out << set<T>(ALL(s));
}

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef pair<ll, ll> pll;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;
/************************************** MAIN PROGRAM ********************************************/

int main()
{
    //freopen("input.txt", "r", stdin);
    SPEED
    ll n, W;
    cin >> n >> W;
    vector<ll> w(n), v(n);
    for (int i = 0; i < n; ++i) {
        cin >> w[i] >> v[i];
    }
    /// dp[i][j] = max values that can be packed in a knapsack with remaining space j and using prefix len = i of items
    vector<ll> dp(W + 1, 0);
    for (int i = 1; i <= n; ++i) {
        for (int j = W; j >= 0; --j) {
            if (j >= w[i - 1]) {
                dp[j] = max(dp[j], v[i - 1] + dp[j - w[i - 1]]);
            }
        }
    }
    cout << dp[W];
}
/************************************** END OF PROGRAM ******************************************/


Measured memory_bytes: 1024
# master ID cardの数を求める問題
# 単純に考えてNまいのIDcardに対して、それが全てを通過できるか考えると、
# 計算量はO(N*M)かかるので10^5*10^5で10^10となり、通らない
# 番目の ID カードのうちどれか 1 枚を持っていれば通過できます。
# とのことから、i 番目のゲートを通るIDカードは連続で並んでいるので、
# Mのゲートに対して、開始点(Li)と終了点(Ri)のmax,minをとれば良い
n,m = map(int,input().split())
max_l = 0
min_r = n
for i in range(m):
  l,r = map(int,input().split())
  if max_l <  l:
    max_l = l
  if min_r > r:
    min_r = r
ans = 0
if min_r - max_l +1 > 0:
  ans = min_r - max_l +1
print(ans)
  


Measured memory_bytes: 43480
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>//////////////////////////////////////////
#define deb(...)/////////////////////////////////////////////////
#define DBP(...)/////////////////////////////////////////////////
#ifdef LOC///////////////////////////////////////////////////////
#include"debuglib.h"/////////////////////////////////////////////
#endif///////////////////////////////////////////////////////////
#define x first//////////////////////////////////////////////////
#define y second/////////////////////////////////////////////////
#define pb push_back/////////////////////////////////////////////
#define sz(x)int((x).size())/////////////////////////////////////
#define each(a,x)for(auto&a:(x))/////////////////////////////////
#define all(x)(x).begin(),(x).end()//////////////////////////////
#define rep(i,b,e)for(int i=(b);i<(e);i++)///////////////////////
using namespace std;using ll=long long;using Pii=pair<int,int>;//
using Vi=vector<int>;void run();int main(){cin.sync_with_stdio///
(0);cin.tie(0);cout<<fixed<<setprecision(18);run();return 0;}////
//-------------------------------------------------------------//

int gcd(int a, int b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

void run() {
	int n; cin >> n;
	Vi elems(n);
	each(e, elems) cin >> e;

	Vi prefs(n), sufs(n);

	prefs[0] = elems[0];
	rep(i, 1, n) prefs[i] = gcd(prefs[i-1], elems[i]);

	sufs[n-1] = elems[n-1];
	for (int i = n-2; i >= 0; i--) sufs[i] = gcd(sufs[i+1], elems[i]);

	int ans = max(prefs[n-2], sufs[1]);

	rep(i, 1, n-1) {
		ans = max(ans, gcd(prefs[i-1], sufs[i+1]));
	}

	cout << ans << endl;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
int main() {
    int a, b; cin >> a >> b;
    if (a <= 5) cout << 0 << endl;
    else if (a <= 12) cout << b / 2 << endl;
    else cout << b << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "YES"  # type: str
NO = "NO"  # type: str

def solve(a: "List[int]", b: "List[int]"):
    count = [0] * 4
    for i in range(3):
        count[a[i] - 1] += 1
        count[b[i] - 1] += 1
    if max(count) >= 3:
        ret = NO
    else:
        ret = YES
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = [int()] * (3)  # type: "List[int]" 
    b = [int()] * (3)  # type: "List[int]" 
    for i in range(3):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(a, b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ld long double
#define mp make_pair

void print(vector<auto> &a)
{
    for (int i = 0; i<a.size(); i++) cout<<a[i]<<' ';
    cout<<endl;
}

void get(vector<auto> &a)
{
    for (int i = 0; i<a.size(); i++) cin>>a[i];
}

const ll p = 998244353;

int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    s = s%p;
    if (s<0) s+=p; 
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}


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

    int n, k;
    cin>>n>>k;
    vector<ll> a(n);
    get(a);
    vector<ll> dp(n);
    dp[0] = 0;
    for (int i = 1; i<n; i++)
    {
        dp[i] = dp[i-1] + abs(a[i]-a[i-1]);
        for (int j = 1; j<=min(i, k); j++) dp[i] = min(dp[i], dp[i-j]+abs(a[i]-a[i-j]));
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 1792
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

map<pair<string, string>, ll> brute_force(int N, string S) {
    map<pair<string, string>, ll> counter; // <l2r, r2l>
    REP(i, (1 << N)) {
        string l2r;
        string r2l;
        REP(j, N) {
            if ((1 << j) & i) l2r += S[j];
            else r2l += S[j];
        }
        reverse(ALL(r2l));
        ++counter[mp(l2r, r2l)];
    }
    return counter;
}


int main(void)
{
    cin.sync_with_stdio(false);
    int N;
    string S;
    cin >> N;
    cin >> S;
    string revS(S);
    reverse(ALL(revS));

    // 前半、後半でbrute force
    auto former = brute_force(N, S);
    auto latter = brute_force(N, revS);

    ll ans = 0;
    for(auto kv: former) {
        auto l2r = kv.first.first;
        auto r2l = kv.first.second;
        auto cnt = kv.second;
        ans += cnt * latter[{l2r,r2l}];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 103424
a, b, c =list(map(int, input().split()))
# print (a, b, c)
n = [a, b, c]

c5 = 0
c7 = 0
for i in n:
    if i == 5:
        c5 += 1
    if i == 7:
        c7 += 1

if c5 == 2 and c7 == 1:
    print("YES")
else:
    print("NO")


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

int main() {
  int n,m=0,x=0;
  cin>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    m=a.at(m)-1;
    if(m==1){
      cout<<i+1<<endl;
      break;
    }
    else if(i==n-1)
      cout<<"-1"<<endl;
  }
}

Measured memory_bytes: 640
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }
void rsorta_d32(void *base, const int count, const int size, const int index){
	typedef int32_t rsort_t;
	rsort_t (*a)[size] = (rsort_t(*)[size])base;
	rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
	int c[0x100];
	for(int k=0; k<4; k++){
		memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(k<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(k<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	}
	free(b);
}

int a[80];
int main(void){
	int n=nextint();
	for(int i=0; i<n; i++){
		a[i]=nextint();
	}
	long m=1000;
	for(int i=0; i<n-1; i++){
		if(a[i]<a[i+1]){
			long k=m/a[i];
			m-=k*a[i];
			m+=k*a[i+1];
		}
	}
	printf("%ld\n", m);
}


Measured memory_bytes: 1596
def main():
    N,K = list(map(int,input().split()))
    H = list(map(int,input().split()))

    sorted_H = sorted(H,reverse=True)

    for i in range(K):
        if(i < len(sorted_H)):
            sorted_H[i] = 0

    '''
    for _ in range(K):
        if(len(H) > 0):
            maximum = max(H)
            H.remove(maximum)
            '''

    print(sum(sorted_H))

if __name__ == "__main__":
    main()

Measured memory_bytes: 26764
N, M, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())

for i in range(1, N):
    A[i] += A[i-1]
for i in range(1, M):
    B[i] += B[i-1]

A = [0]+A
B = [0]+B
j = M
ans = 0
for i in range(N+1):
    k = K-A[i]
    if k < 0:
        break
    while B[j] > k:
        j -= 1
    ans = max(ans, i+j)

print(ans)

Measured memory_bytes: 123888
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int gcd(int a, int b) { return b?gcd(b,a%b):a; }

int main() {
  int n; cin >> n;
  int x[n+1]; REP(i,n+1) cin >> x[i];
  sort(x, x+n+1);

  int ans = x[1]-x[0];
  for (int i = 1 ; i < n+1; i++) {
    int diff = x[i] - x[i-1];
    ans = gcd(ans,diff);
  }
  COUT(ans);
  return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

int main() {
	int n,k;
	cin >> n >> k;
	int cnt[500000];
	for(int i = k*2-1; i >= 1; i--) {
		if(i%2==0) {
			cnt[i/2] = cnt[i]+1;
		}
	}
	double p[25];
	p[0] = 1.0;
	for(int i = 0; i < 25-1; i++) {
		p[i+1] = p[i]*0.5;
	}
	double ans = 0;
	for(int i = 1; i <= n; i++) {
		//cout << p[cnt[i]];
		ans += (1.0/n)*p[cnt[i]];
	}
	printf("%.12lf\n",ans);
	return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int x, y;

int solve() {
    if (abs(x) <= abs(y)) {
        return abs(y) - abs(x) + (x >= 0 && y >= 0 ? 0 : (x < 0 && y <= 0 ? 2 : 1));
    } else {
        return abs(x) - abs(y) + (x >= 0 && y > 0 ? 2 : (x <= 0 && y <= 0 ? 0 : 1));
    }
}

void input() {
    cin >> x >> y;
}

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

    input();
    cout << solve() << endl;
}

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

int main(int argc, char const *argv[]) {
    int N, L;
    cin >> N >> L;
    int lmin = L;
    int lmax = L + N - 1;
    int sum = (lmin + lmax) * N / 2;
    if(lmin * lmax >= 0) {
        if(abs(lmin) < abs(lmax)) {
            sum -= lmin;
        } else {
            sum -= lmax;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
    "use strict";
	// 1行目がinput[0], 2行目がinput[1], …に入る
    const input_ = input.split("\n");
    const N = parseInt(input_[0], 10);
    const tmp = input_[1].split(" ");
    
    let value = [];
    for(let i=0; i<N; i++){
        value += tmp[0][i]+tmp[1][i];
    }
    // 出力
	console.log('%s',value);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

public class ALDS1_11_A
{
    public static void Main(string[] args)
    {
        //var exStdIn = new System.IO.StreamReader( "input.txt" );
        //System.Console.SetIn( exStdIn );

        int n = int.Parse(Console.ReadLine());
        var graph = new List<List<int>>();
        for (int i = 0; i < n; i++)
        {
            graph.Add(new List<int>());
            for (int j = 0; j < n; j++)
            {
                graph[i].Add(0);
            }
        }

        for (int i = 0; i < n; i++)
        {
            int[] val = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            for (int j = 2; j < val[1] + 2; j++)
            {
                graph[val[0] - 1][val[j] - 1] = 1;
            }
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                sb.Append(graph[i][j].ToString());
                if (j < n - 1)
                {
                    sb.Append(" ");
                }
            }
            sb.AppendLine();
        }
        Console.Write(sb.ToString());
    }
}



Measured memory_bytes: 18320
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    cout << max(a + b, max(a - b, a * b));
    return 0;
}

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

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

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {100000000};

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

int main() {
  int N, X, Y;
  cin >> N >> X >> Y;
  --X; --Y;
  vector<vector<int>> dp(N, vector<int>(N, INTINF));
  rep(i, N) {
    srep(j, i+1,N)
    dp[i][j] = std::min(j-i, std::abs(Y-j)+std::abs(X-i)+1);
  }
  vector<int> answer(N+1);
  rep(i, N) {
    srep(j, i+1, N) {
      ++answer[dp[i][j]];
    }
  }
  srep(i, 1, N) {
    cout << answer[i] << '\n';
  }
}


Measured memory_bytes: 16000
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <cmath>
#include <bits/stdc++.h>

using namespace std;




int main()
{
    string s;
    cin>>s;
    for (int i=0;i<s.length();i++)
    {
        if (s[i]==',')
        {
            s[i]=' ';
        }
    }
    cout<<s;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

double len(double a,double b){
	return sqrt(a*a+b*b);
}

int main(){
	int x,h;
	double S;

	while(1){
		scanf("%d %d",&x,&h);
		if(x == 0 && h == 0){
			break;
		}

		S = x*x*1.0;
		S += x*len(x*0.5,h*1.0)*2.0;

		printf("%f\n",S);
	}

	return 0;
}

Measured memory_bytes: 632
#include <iostream>

using namespace std;

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

    int a1[n], a2[n];

    for(int i=0;i<n;i++){
        cin >> a1[i];
    }
    for(int i=0;i<n;i++){
        cin >> a2[i];
    }
    int tmp, ans=0;
    for(int i=0;i<n;i++){
        tmp=0;
        for(int j=0;j<n;j++){
            if(i==j){
                tmp=tmp+a1[j]+a2[j];
            }else if(i<j){
                tmp+=a2[j];
            }else{
                tmp+=a1[j];
            }
        }
        ans=max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        long N =  sc.nextLong();
        long M =  sc.nextLong();

        if(N>=M)
        N = N%M;
        while(true){
            long temp =  Math.abs(N-M);
            if(temp>=N){
                break;
            }
            N=temp;
        }
        System.out.println( N);
    }

}


Measured memory_bytes: 21844