akhauriyash/Code-Regression huggingface dataset:
n = int(raw_input())
matrix = []
for i in range(n):
    line = raw_input()
    splited = line.split()
    splited = map(lambda x: int(x), splited)
    matrix.append(splited)

result = 0
candidate = 0
selected = [0]
for i in range(n):
    weight = 2001
    for item in selected:
        for j in range(n):
            if matrix[j][item] != -1 and matrix[j][item] < weight and j not in selected:
                candidate = j
                weight = matrix[j][item]
    selected.append(candidate)
    if(len(selected) == n + 1):
        break
    result += weight
print result

Measured memory_bytes: 6460
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>

using namespace std;
typedef long long ll;
int main(){
    ll n,a[100000],sum[100001];
    sum[0]=0;
    scanf("%lld",&n);
    for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);
        if(i%2){
            sum[i+1]=sum[i]-a[i];
        }
        else{
            sum[i+1]=sum[i]+a[i];
        }
    }
    for(int i=0;i<n;i++){
        if(i==0){
            printf("%lld\n",sum[n]);
        }
        else if(i%2){
            printf("%lld\n",-sum[n]+2*sum[i]);
        }
        else{
            printf("%lld\n",sum[n]-2*sum[i]);
        }
    }
}

Measured memory_bytes: 2816
/*
 * drish1001
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>  
#include <iostream> 
using namespace __gnu_pbds; 
using namespace std;
#define     pb                 push_back
#define     mp                 make_pair
#define     ff                 first
#define     ss                 second
#define    MOD                1000000007
#define     pll                pair<ll,ll>
void        sorta(auto &v)     {sort(v.begin(),v.end());} 
void        sortd(auto &v)     {sort(v.begin(),v.end(), greater<>());} 
void        fast()            {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
typedef        long long        ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> magic; 

//all variables and functions be1ow this ..

int main()
{
	fast();
	ll n;
	cin >> n;
	cout << 1-n << endl;	
}


Measured memory_bytes: 3616
#include <stdio.h>

int main() {
  int year, month, day;
  scanf("%d/%d/%d", &year, &month, &day);
  if(year >= 2019 && month >= 5) {
    printf("TBD\n");
  } else {
    printf("Heisei\n");
  }
  return 0;
}


Measured memory_bytes: 128
A = input()
B = input()
C = input()
turn = 'a'
while True:
  if turn == 'a':
    if len(A) == 0:
      print('A')
      break
    turn = A[0]
    A = A[1:]
  elif turn == 'b':
    if len(B) == 0:
      print('B')
      break
    turn = B[0]
    B = B[1:]
  else:
    if len(C) == 0:
      print('C')
      break
    turn = C[0]
    C = C[1:]

Measured memory_bytes: 9104
/*author - Ashutosh Chitranshi*/
#include<bits/stdc++.h>
using namespace std;
#pragma GCC push_options
#pragma GCC optimize ("unroll-loops")
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define pow2(x) ((x)*(x))
#define ll long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define pf push_front
#define mod 1000000007
#define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
#define mp make_pair
#define ff first
#define ss second
#define null NULL
#define all(c) (c).begin(),(c).end()
#define nl "\n"
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vi > vvi;
typedef vector< vl > vvl;
typedef pair< int,int > ii;
typedef pair< ll,ll> pll;
typedef map< ll,ll> mll;
typedef map< int,int> mii;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a,b;
    cin >> a >> b;
    cout << a*b << "\n";
    return 0;
}

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

// beetさんから引っ張ってきましたModintライブラリ
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

template<typename T,T MOD = 1000000007>
struct Mint{
    static constexpr T mod = MOD;
    T v;
    Mint():v(0){}
    Mint(signed v):v(v){}
    Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

    Mint pow(long long 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=1LL*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;}

    static Mint comb(long long n,int k){
        Mint num(1),dom(1);
        for(int i=0;i<k;i++){
            num*=Mint(n-i);
            dom*=Mint(i+1);
        }
        return num/dom;
    }
};
template<typename T,T MOD> constexpr T Mint<T, MOD>::mod;
template<typename T,T MOD>
ostream& operator<<(ostream &os,Mint<T, MOD> m){os<<m.v;return os;}

typedef Mint<long long> P;
const int MAX_K = 100010;
P Index[MAX_K];   // Index[i] := gcd(Aj)=iとなる数列{Aj}が何組あるか

int main() {
    long long N, K;
    cin >> N >> K;

    // initialize
    for(int i = 0; i <= K; ++i) Index[i].v = 0LL;
    for(long long i = K; i >= 1; --i) {
        Index[i] = P(K/i).pow(N);
        for(long long j = 2*i; j <= K; j += i) {
            Index[i] -= Index[j];
        }
    }

    P res(0LL);
    for(int i = 1; i <= K; ++i) {
        res += Index[i]*P(i);
    }
    cout << res << endl;
    return 0;
}

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

using namespace std;

int main() {
  static int wa[100001];
  static bool ac[100001];

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

  int p, a = 0, w = 0;
  string s;
  for (int i = 0; i < m; i++) {
    cin >> p >> s;
    if (ac[p]) continue;
    if (s == "WA") wa[p]++;
    else {
      ac[p] = true;
      a++;
      w+=wa[p];
    }
  }

  cout << a << " " << w << endl;
}


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

int main(){
    int N, count = 0, s;
    bool flag = true;
    cin >> N;
    int A[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    while(flag == true){
        flag = false;
        for(int j = N - 1; j > 0; j--){
            if(A[j] < A[j - 1]){
                s = A[j];
                A[j] = A[j - 1];
                A[j - 1] = s;
                flag = true;
                count++;
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(i == N - 1){
            cout << A[i] << endl;
        } else {
            cout << A[i] << " ";
        }
    }

    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  int l, r, d;
  cin >> l >> r >> d;
  cout << r / d - (l - 1) / d << endl;
  return 0;
}


Measured memory_bytes: 3572
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int h = sc.nextInt();
        int c = sc.nextInt();
        int g = gcd(w, h);
        System.out.println(w * h / g / g * c);
    }
    
    static int gcd(int x, int y) {
        if (x % y == 0) {
            return y;
        } else {
            return gcd(y, x % y);
        }
    }
}



Measured memory_bytes: 26352
n = int(input())
a = list(map(int,input().split()))
wa = 1
ka = 0
if(a.count(0)>=1):
  print(0)
  ka +=1
else:
  for i in range(n):
    wa = wa*a[i]
    if(wa>10**18):
      print("-1")
      ka +=1
      break
if(ka==0):
  print(wa)



Measured memory_bytes: 21600
//templates
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <unordered_map>
#include <map>
#include <cmath>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define SZ(x) ((int)(x).size())
typedef long long ll;

using namespace std;

int main(){
  int r;
  cin >> r;
  cout << 3*pow(r,2) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){

    int n;
    cin>>n;

    pair<int,int> arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i].first;
        arr[i].second = i;
    }

    sort(arr,arr+n);

    for(int i=0;i<n;i++){
        cout<<arr[i].second+1<<" ";
    }
    cout<<endl;



}


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

using namespace std;

const int MAX_N = 310;
const long long MOD = 1e9 + 7;

int n, m;
vector<pair<int, int>> a[MAX_N];
long long dp[MAX_N][MAX_N][MAX_N];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int L, R, x;
        cin >> L >> R >> x;
        L--; R--;
        a[R].push_back({L, x});
    }
    dp[0][0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                int z = max(max(i, j), k);
                bool flag = 0;
                for (auto p : a[z]) {
                    int cnt = 1;
                    if (j - 1 >= p.first) {
                        cnt++;
                    }
                    if (k - 1 >= p.first) {
                        cnt++;
                    }
                    if (cnt != p.second) {
                        flag = 1;
                        break;
                    }
                }
                if (!flag) {
                    dp[z + 1][j][k] = (dp[z + 1][j][k] + dp[i][j][k]) % MOD;
                }
                flag = 0;
                for (auto p : a[z]) {
                    int cnt = 1;
                    if (i - 1 >= p.first) {
                        cnt++;
                    }
                    if (k - 1 >= p.first) {
                        cnt++;
                    }
                    if (cnt != p.second) {
                        flag = 1;
                        break;
                    }
                }
                if (!flag) {
                    dp[i][z + 1][k] = (dp[i][z + 1][k] + dp[i][j][k]) % MOD;
                }
                flag = 0;
                for (auto p : a[z]) {
                    int cnt = 1;
                    if (i - 1 >= p.first) {
                        cnt++;
                    }
                    if (j - 1 >= p.first) {
                        cnt++;
                    }
                    if (cnt != p.second) {
                        flag = 1;
                        break;
                    }
                }
                if (!flag) {
                    dp[i][j][z + 1] = (dp[i][j][z + 1] + dp[i][j][k]) % MOD;
                }
            }
        }
    }
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            ans = (ans + dp[n][i][j] + dp[i][n][j] + dp[i][j][n]) % MOD;
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 227584
def dif(x, y):
    return (x**2 + y**2)**.5

def main():
    n, d = map(int, input().split())
    ans = 0
    for i in range(n):
        x, y = map(int, input().split())
        if dif(x, y) <= d:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, K; cin >> N >> K;
  ll x = 1;
  for (ll i = 0 ; i < N; i++) {
    x = min(2 * x, x + K);
  }
  cout << x << endl;
      
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
vector<int> to[100005];

int main(){
    int n, m, a, b;
    cin >> n >> m;
    rep(i, m){
        cin >> a >> b;
        a --; b --;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    queue<int> q;
    vector<int> dist(n, INF);
    vector<int> pre(n, -1);
    dist[0] = 0;
    q.push(0);
    while(!q.empty()){
        int v = q.front();
        q.pop();
        for (auto u: to[v]){
            if (dist[u] != INF) continue;
            dist[u] = dist[u] + 1;
            pre[u] = v;
            q.push(u);
        }
    }
    cout << "Yes" << endl;
    rep(i, n){
        if (i == 0) continue;
        int ans = pre[i];
        ans++;
        cout << ans << endl;
    }
    return 0;
}   

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

long inv(int a, int m) {
    long i = 1, j = 0;
    for(int b = m; a > 1; swap(i, j), swap(a, b)) {
        j = (j + b / a * (m - i)) % m;
        b %= a;
    }
    return i;
}
long f[222222] = {1};
long co(long a, long b, int p) {
    return f[a] * inv(f[b] * f[a - b] % p, p) % p;
}
int main() {
    int n, k, p = 1e9 + 7;
    cin >> n >> k;
    for(int i = 0; i < n; i++)
        f[i + 1] = f[i] * (i + 1) % p;
    k = min(k, n - 1);
    long r = 0;
    for(int i = n - k; i <= n; i++)
        (r += co(n, i, p) * co(n - 1, i - 1, p) % p) %= p;
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
using namespace std;

int main(){
    double r; cin >> r;
    const double pi = 3.14159265359879;
    cout << 2 * pi * r << endl;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,k;
    cin >> n >> k;
    int ans=1;
    for(int i=0;i<n;i++){
        if(ans*2<ans+k){
            ans=ans*2;
        }
        else {
            ans=ans+k;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n, m, c = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)
count = 0
n.times do |i|
  sum = 0
  a = gets.chomp.split.map(&:to_i)
  m.times do |j|
    sum += b[j] * a[j]
  end
  if (sum+c > 0) then
    count += 1
  end
end
puts count


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std ;
#define An setprecision(16) 
int main(){
    int N,M;
    cin >> N >> M;
    int L[M],R[M];
    for(int i=0;i<M;i++)cin >> L[i] >> R[i];
    int AL=L[0],AR=R[0];
    for(int i=1;i<M;i++){
        if(L[i]>=AL){
            AL=L[i];
        }
        if(R[i]<AR){
            AR=R[i];
        }
    }
    if(AR-AL>=0){
        cout << AR - AL +1 << endl;
    }else{
        cout << 0 << endl;
    }
    
}

Measured memory_bytes: 4380
import java.util.*;
public class Main {
	Scanner sc = new Scanner(System.in);
	int a,b,c,d,e,f,k,l,m,n,x,y,z;
	int ans;
	String[] S;

	Main(){
		// 整数の入力
		n = sc.nextInt();

		// 出力
		System.out.println(n*n*n);
	}

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

Measured memory_bytes: 21716
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = input()
    print(" ".join(a.split(",")))
    return

#B
def B():
    k, s = LI()
    ans = 0
    for i in range(k + 1):
        for j in range(k + 1):
            if 0 <= s - (i + j) <= k:
                ans += 1
    print(ans)
    return

#C
def C():
    sx, sy, tx, ty = LI()
    UD = ("U", "D")
    LR = ("R", "L")
    ans = UD[sy > ty] * (abs(sy - ty)) + LR[sx > tx] * (abs(sx - tx))
    ans += UD[ty > sy] * (abs(sy - ty)) + LR[tx > sx] * (abs(sx - tx))
    ans += LR[tx > sx] + UD[sy > ty] * (abs(sy - ty) + 1) + LR[sx > tx] * (abs(sx - tx) + 1) + UD[ty > sy]
    ans += LR[sx > tx] + UD[ty > sy] * (abs(sy - ty) + 1) + LR[tx > sx] * (abs(sx - tx) + 1) + UD[sy > ty]
    print(ans)
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()


Measured memory_bytes: 38640
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ms memset
#define MOD 1000000007
#define MOD2 1000000009
#define sp fixed<<setprecision
#define sz(x) (int)(x).size()
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
ll fpow(ll x,ll y,ll p=MOD){x=x%p;ll sum=1;while(y){if(y&1)sum=sum*x;sum%=p;y=y>>1;x=x*x;x%=p;}return sum;}
ll inv(ll a,ll m=MOD){ll c=m;ll y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=c;return x;}
ll add(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return (a%MOD + b%MOD + MOD)%MOD;}
ll sub(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return (a%MOD - b%MOD + MOD)%MOD;}
ll mul(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return ((a%MOD)*(b%MOD) + MOD)%MOD;}
void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    if (sz(name)) {
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}
int main(){
    setIO();
    ll n;
    cin>>n;
    vector<ll>v(n);
    for(int i=0;i<n;i++)
      cin>>v[i];
    ll res=0;
    ll maxi=v[0];
    for(int i=1;i<n;i++){
      res+=max(0LL,maxi-v[i]);
      maxi=max(maxi,v[i]);
    }
    cout<<res;

}


Measured memory_bytes: 4772
import java.util.*;
class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
  char c[]=sc.next().toCharArray();
  int ans=0;
  for(int i=0;i<c.length;i++){
    ans+=(c[i]-'0');
  }System.out.println(ans%9==0?"Yes":"No");
}
}

Measured memory_bytes: 40456
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll ans,a,n,cnt,c[25]={0,1},d[25]={1,10};
int main(){
	scanf("%lld",&n);
	if(n%2){
		cout<<0;return 0;
	}
	for(ll i=10;i<=n;i*=5)
	ans+=n/i;
	cout<<ans;
	return 0;
} 
/**
*　　┏┓　　　┏┓+ +
*　┏┛┻━━━┛┻┓ + +
*　┃　　　　　　　┃
*　┃　　　━　　　┃ ++ + + +
*  ████━████+
*  ◥██◤　◥██◤ +
*　┃　　　┻　　　┃
*　┃　　　　　　　┃ + +
*　┗━┓　　　┏━┛
*　　　┃　　　┃ + + + +Code is far away from 　
*　　　┃　　　┃ + bug with the animal protecting
*　　　┃　 　 ┗━━━┓ 神兽保佑,代码无bug　
*　　　┃ 　　　　　　 ┣┓
*　　  ┃ 　　　　　 　┏┛
*　    ┗┓┓┏━┳┓┏┛ + + + +
*　　　　┃┫┫　┃┫┫
*　　　　┗┻┛　┗┻┛+ + + +
*/

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
const int INF = 1e9;
using namespace std;

signed main() {
    string S; cin >> S;
    int cnt=0;
    rep(i,6){
        if(S[i]=='1') cnt++;
    }
    cout << cnt << endl;
}


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

using namespace std;

typedef long long ll;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int counts[8] = {0,0,0,0,0,0,0,0};

	for (int i = 0; i < 3; i++) {
		int a;
		cin >> a;
		counts[a]++;
	}

	if (counts[5] == 2 && counts[7] == 1) {
		cout << "YES";
	} else {
		cout << "NO";
	}

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define int long long
 
#define sz(c) c.size()
#define fr first
#define sc second
#define pb push_back
#define sz(c) c.size()
#define ppb  pop_back
#define all(a)      (a).begin(),(a).end()
#define rep(i,a,n)   for( int i=a ; i<n ; i++)
#define U 1000000007
#define N 100005
#define ins insert
using namespace std;
signed main()
{
  ios_base::sync_with_stdio(false);
  int n,m;
  cin>>n>>m;
  int w[n+1],v[n+1],dp[2][m+1];
  rep(i,1,n+1) cin>>w[i]>>v[i];
 
  rep(i,0,n+1)
  {
    int t=i%2;
    rep(j,0,m+1)
    {
      if(i==0||j==0) dp[t][j]=0;
      else if(w[i]<=j)
        dp[t][j]=max(v[i]+dp[!t][j-w[i]],dp[!t][j]);
      else dp[t][j]=dp[!t][j];
    }
    if(i==n) cout<<dp[t][m];
  }
  
 
 
 
 
}

Measured memory_bytes: 1792
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#define N 100020
#define M 16
using namespace std;

int a[N];
bool u[N];
int f[1 << M | 1], g[1 << M | 1];

int main(void)
{
    int n, u, v, w;
    int i, j, o;

    scanf("%d", &n);
    for(i = 1; i < n; i ++)
    {
        scanf("%d %d %d", &u, &v, &w);
        a[u] ^= w;
        a[v] ^= w;
    }
    for(i = o = 0; i < n; i ++)
        if(a[i])
        {
            o += ::u[a[i]];
            ::u[a[i]] ^= 1;
        }
    for(i = n = 0; i < M; i ++)
        if(::u[i])
            a[n ++] = i;

    // for(i=0;i<n;i++)cout<<a[i]<<' ';cout<<endl;

    for(i = 1; i < (1 << n); i ++)
    {
        f[i] = __builtin_popcount(i) - 1;
        g[i] = g[i & (i - 1)] ^ a[__builtin_ctz(i)];
        for(j = i & (i - 1); j; j = i & (j - 1))
            if(!g[j])
                f[i] = min(f[i], f[j] + f[i ^ j]);
    }
    printf("%d\n", o + f[(1 << n) - 1]);

    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
typedef pair<int,int> P;
int A,B,W,N;
int dp[2][10001];
vector<P> vc;
int dm(){
	int a=1,b=1,ret=2e9;
	while(a<=W&&dp[0][a]<0) a++;
	while(b<=W&&dp[1][b]<0) b++;
	while(a<=W&&b<=W){
		chmin(ret,abs(a-b));
		if(a<=b){
			a++;
			while(a<=W&&dp[0][a]<0) a++;
		}else{
			b++;
			while(b<=W&&dp[1][b]<0) b++;
		}
	}
	return ret;
}
int dc(int l,int r){
	return vc[r].fs-vc[l].fs;
}
int main(){
	cin>>A>>B>>W;
	rep(i,A){
		int a,b;
		cin>>a>>b;
		vc.pb(P(b,a));
	}
	rep(i,B){
		int a,b;
		cin>>a>>b;
		vc.pb(P(b,-a));
	}
	sort(all(vc));
	rep(j,2) rep(i,W+1) dp[j][i]=-1;
	int N=A+B,ans=2e9,n[2]={},l=0,r=0;
	for(;l<N;l++){
		for(;r<N;r++){
			if(n[0]==0||n[1]==0||dm()>=dc(l,r-1)){
				int id=0,c=vc[r].fs,w=vc[r].sc;
				if(w<0) id=1,w=-w;
				n[id]++;
				for(int i=W;i>w;i--){
					if(dp[id][i-w]>=0) chmax(dp[id][i],dp[id][i-w]);
				}
				dp[id][w]=r;
				if(n[0]&&n[1]){
					chmin(ans,max(dm(),dc(l,r)));
//					printf("(l,r)=%d,%d\n",l,r);
//					show(ans);
				}
			}else{
				break;
			}
		}
		int id=0,c=vc[l].fs,w=vc[l].sc;
		if(w<0) id=1,w=-w;
		n[id]--;
		rep(i,W+1){
			if(dp[id][i]==l) dp[id][i]=-1;
		}
//		printf("l,r,n0,n1= %d,%d,%d,%d\n",l,r,n[0],n[1]);
		if(n[0]&&n[1]){
			chmin(ans,max(dm(),dc(l+1,r-1)));
//			printf("(l,r)=%d,%d\n",l+1,r-1);
//			show(ans);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1292
import std.stdio; // ??\????????????????????????
import std.string; // chomp????????????????????????(?????????????????????)
import std.conv; // to????????????????????????
import std.array; // split?????????????????????
import std.algorithm; // map?????????????????????

void main() {
    // ????????????????????????map???????????¨???array??????????????????????????¨??????????????????????????????????????????
    auto a = readln.split.map!(to!int).array;
    a.sort;
    writeln(a[0], " ", a[1], " ", a[2]);
}

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

int high[11] = {0};

int main()
{
    for(int i = 0; i < 10; i++)
    {
        scanf("%d",&high[i]);
    }
    for(int i = 0; i < 10; i++)
    {
        for(int j = i+1; j < 10; j++)
        {
            if(high[i] < high[j])swap(high[i],high[j]);
        }
    }
    for(int i = 0; i < 3; i++)
    {
        printf("%d\n",high[i]);
    }
    return 0;
}

Measured memory_bytes: 1188
#include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
string s[110];
int main()
{
	int n,l;
	scanf("%d%d\n",&n,&l);
	for(int i=1;i<=n;i++) cin>>s[i];
	sort(s+1,s+n+1);
	for(int i=1;i<=n;i++) cout<<s[i];
	return 0;
}

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

int main() {
	int a, b;
	cin >> a >> b;
	
	bool is_hit = false;
	for(int i=1; i<10000; i++) {
		if ( (int(0.08 * i) == a) && (int(0.1 * i) == b) ) {
			is_hit = true;
			cout << i << endl;
			break;
		}
	}
	if (is_hit == false) {
		cout << -1 << endl;
	}

	return 0;
}


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

int main( void ) {
    
    int w, a, b;
    cin >> w >> a >> b;
    
    if( b + w < a )
        cout << a - b - w << endl;
    else
    if( a + w < b )
        cout << b - a - w << endl;
    else
        cout << 0 << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#define int long long
#define double long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define ms(v,x) memset(v,x,sizeof(v))
#define pii pair<int,int>
#define ff first
#define ss second
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define td(v) v.begin(),v.end()
#define inf 1000000000 // 1e9
#define M   1000000007 // 1e9 + 7
using namespace std;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}
main(){
    fastio;
    int n;
    cin >> n;
    vector<int> a(n),b(n),c(n-1);
    int ans = 0;
    for(int &x : a){
        cin >> x;
    }
    for(int &x : b){
        cin >> x;
        ans += x;
    }
    for(int &x : c) cin >> x;
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1]+1){
            ans += c[a[i]-2];
        }
    }
    cout << ans << endl;
}   

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

int main() {
	int sum = 0;
	for (int b = 0; b < 4; b++) {
		int a;
		cin >> a;
		sum += a;
	}
	printf("%d\n%d\n", sum / 60, sum % 60);
}

Measured memory_bytes: 3228
import java.util.*;
class Main{
    Scanner sc=new Scanner(System.in);
    void main(){
	int q=sc.nextInt();
	for(int i=0;i<q;i++){
	    int c=sc.nextInt();
	    int a=sc.nextInt();
	    int n=sc.nextInt();
	    int ans=0;
	    while(true){
		if(c>=1&&a>=1&&n>=1){
		    c--;a--;n--;
		    ans++;
		}else if(c>=2&&a>=1){
		    c-=2;a--;
		    ans++;
		}else if(c>=3){
		    c-=3;
		    ans++;
		}else break;
	    }
	    System.out.println(ans);
	}
    }
    public static void main(String[]ag){
	new Main().main();
    }
}

Measured memory_bytes: 26964
n = int(input())
arr = [0] * 20000
for i in range(1,1001):
    for j in range(1,1001):
        for k in range(1,1001):
            if i*i+j*j+k*k >= n :
                break 
            arr[i*i+j*j+k*k+i*j+i*k+k*j] += 1 
for i in range(1,n+1):
    print(arr[i])

Measured memory_bytes: 9300
using System;
using System.Collections.Generic;
class Solve{
    int N;
    int[] a;
    public Solve(){}
    public static int Main(){
        new Solve().Calc();
        return 0;
    }
    void Calc(){
        getinput();
        int min = N;
        int max = 0;
        int[] b;
        for(int i=0;i<N;i++){
            if(min > a[i])
                min = a[i];
            if(max < a[i])
                max = a[i];
        }
        b = new int[max-min+1];
        for(int i=0;i<max-min+1;i++){
            b[i] = 0;
        }
        for(int i=0;i<N;i++){
            b[a[i]-min]++;
        }
        if((b[0] == 1 && max == 2*min) || (b[0] == 2 && max == 2*min-1)){
            int i = 1;
            while(i < max-min+1){
                if(b[i] <= 1){
                    Console.WriteLine("Impossible");
                    return;
                }
                i++;
            }
        }
        else{
            Console.WriteLine("Impossible");
                    return;
        }
        Console.WriteLine("Possible");
    }
    void getinput(){
        N = int.Parse(Console.ReadLine());
        string[] str = Console.ReadLine().Split(' ');
        a = new int[N];
        for(int i=0;i<N;i++){
            a[i] = int.Parse(str[i]);
        }
    }    
}

Measured memory_bytes: 2776
#include <stdio.h>
int main(void){
  int N;
  int i;
  int s=0;
  scanf("%d",&N);
  int b=N;
  for(i=0;i<8;i++){
    int a;
    a=b%10;
    b=b/10;
    s=s+a;
  }
  
  if(N%s==0){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 1660
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
int main(){
string n,t;
int ms=0;
map<string,int>ta;
	while(cin>>n){
	ta[n]++;
	if( ms<n.size() )ms=n.size(),t=n;
	}
	string a;
	ms=0;
	for(map<string,int>::iterator it=ta.begin();it!=ta.end();it++){
		if(ms<(*it).second)ms=(*it).second,a=(*it).first;
	}
	
	cout<<a<<" "<<t<<endl;

	return 0;
}

Measured memory_bytes: 1196
#include <algorithm>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using ll = long long int;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 373;

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

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> init_vector2(size_t n0, size_t n1, T e = T()) {
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> init_vector3(size_t n0, size_t n1, size_t n2, T e = T()) {
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

class edge {
   public:
    ll v;
    ll d;
    edge() : v(0), d(0) {}
    edge(ll v, ll d) : v(v), d(d) {}
};

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

    vector2<edge> left(n);
    vector2<edge> right(n);
    rep(i, m) {
        ll l, r, d;
        cin >> l >> r >> d;
        l--;
        r--;
        left[l].push_back(edge(r, d));
        right[r].push_back(edge(l, d));
    }

    bool ans = true;

    vector<ll> x(n);
    vector<bool> used(n);

    rep(i, n) {
        if (used[i]) {
            continue;
        }

        x[i] = 0;
        used[i] = true;

        queue<ll> q;
        q.push(i);
        while (not q.empty()) {
            const ll v = q.front();
            q.pop();
            for (const edge& e : left[v]) {
                if (used[e.v]) {
                    if (x[v] + e.d != x[e.v]) {
                        ans = false;
                        goto end;
                    }
                } else {
                    x[e.v] = x[v] + e.d;
                    used[e.v] = true;
                    q.push(e.v);
                }
            }

            for (const edge& e : right[v]) {
                if (used[e.v]) {
                    if (x[v] - e.d != x[e.v]) {
                        ans = false;
                        goto end;
                    }
                } else {
                    x[e.v] = x[v] - e.d;
                    used[e.v] = true;
                    q.push(e.v);
                }
            }
        }
    }

end:
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef array<int, 2> duo;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}




void _main() {
        int n; cin >> n;
        vector<duo> a(n);
        for (int i = 0; i < n; i++) cin >> a[i][1] >> a[i][0];
        sort(all(a));
        int time = 0;
        for (int i = 0; i < n; i++) {
//                cout << a[i][1] << ' ' << a[i][0] << '\n';
                if (time + a[i][1] > a[i][0]) {
                        cout << "No\n";
                        return;
                }
                time += a[i][1];
        }
        cout << "Yes\n";
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 4764
#include <iostream>
#include <string>
#include <vector>

int main(){
    int k;
    std::cin >> k;
    std::string s;
    std::cin >> s;
    std::string ans;
    std::vector<char> vec;
    if((int)s.length()<=k){
        std::cout << s << std::endl;
    }else{
        for(int i=0;i<k;++i){
            vec.push_back(s[i]);
        }
        vec.push_back('.');
        vec.push_back('.');
        vec.push_back('.');
        for(int i=0;i<vec.size();++i){
            std::cout << vec[i];
        }
        std::cout << "" << std::endl;
    }
    return 0;
}



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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())
#define all(a) (a).begin(), (a).end()

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//print
#define pv(val) cerr << #val << '=' << (val) << endl

const int INF = 1e9;

int main(void){

	string S; cin >> S;

	S += char('a'-1);

	reverse(all(S));
	map<char, bool> alpha;
	REP(i,S.length()) alpha[S[i]] = true;


	REP(i,S.length()){
		REP(j,26){
			char m = j + 'a';
			if(!alpha[m] and m > S[i]){
				S[i] = m;
				S.erase(S.begin(), S.begin() + i);
				reverse(all(S));
				cout << S << endl;
				return 0;
			}
		}
		alpha[S[i]] = false;
	}


	cout << -1 << endl;
	return 0;

}


Measured memory_bytes: 3640
using System;

// https://atcoder.jp/contests/abc122/tasks/abc122_a
namespace ADoubleHelix
{
    class Program
    {
        static void Main(string[] args)
        {
            // 入力の取得
            var inputBase = Console.ReadLine();

            char answerBase;
            switch (inputBase)
            {
                case "A":
                    answerBase = 'T';
                    break;
                case "T":
                    answerBase = 'A';
                    break;
                case "C":
                    answerBase = 'G';
                    break;
                case "G":
                    answerBase = 'C';
                    break;
                default:
                    throw new ArgumentException();
            }

            // 解答の出力
            Console.WriteLine(answerBase);
        }
    }
}


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

int main(){
    int N;
    cin >> N;
    
    string strN = to_string(N);
    
    int f = 0;
    
    for(int i = 0; i < strN.length(); i++){
        f += (int) strN.at(i) - '0';
    }
    
    if(N % f == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    

    
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
typedef long long ll;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    cout << a+b+c - max(a,max(b,c))<< endl;
    return 0;
}


Measured memory_bytes: 256
from collections import deque, defaultdict
import copy
import bisect
#sys.setrecursionlimit(10 ** 9)
import math
import heapq

import sys
def input():
	return sys.stdin.readline().strip()

A, B, C, D, E, F = list(map(int, input().split()))

water = [0]*(F//100 + 1)
water[0] = 1
water_list = [0]
for i in range(1, len(water)):
	if A <= i and water[i - A] == 1:
		water[i] = 1
		water_list.append(i*100)
	elif B <= i and water[i - B] == 1:
		water[i] = 1
		water_list.append(i * 100)

suger = [0]*(E*water_list[-1]//100 + 1)
suger[0] = 1
max_n = 0
ws = [A*100, 0]
for i in range(1, len(suger)):
	if C <= i and suger[i - C] == 1:
		suger[i] = 1
	elif D <= i and suger[i - D] == 1:
		suger[i] = 1
	if suger[i] == 1:
		max_s = i*100/E
		loc = bisect.bisect_left(water_list, max_s)
		if loc <= len(water_list) and  water_list[loc] + i <= F:
			if max_n < 100*i/(water_list[loc] + i):
				ws = [water_list[loc], i]
			max_n = max(max_n, 100*i/(water_list[loc] + i))
print(ws[0] + ws[1], ws[1])






Measured memory_bytes: 41452
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  int n;
  cin >> n;
  //a,c,g,tは0,1,2,3と変換する
  int dp[n+1][4][4][4];
  memset(dp,0,sizeof(dp));
  dp[0][3][3][3] = 1;
  REP(i,n){
    //c1,c2,c3はそれぞれ1,2,3つ前の文字を意味する。
    REP(c1,4)REP(c2,4)REP(c3,4){
      if(dp[i][c1][c2][c3]==0) continue;
      REP(neu,4){
        if(c2==0&&c1==1&&neu==2) continue;
        if(c2==0&&c1==2&&neu==1) continue;
        if(c2==2&&c1==0&&neu==1) continue;
        if(c3==0&&c1==2&&neu==1) continue;
        if(c3==0&&c2==2&&neu==1) continue;
        dp[i+1][neu][c1][c2] += dp[i][c1][c2][c3];
        dp[i+1][neu][c1][c2] %= MOD;
      }
    }
  }
  ll ans = 0;
  REP(i,4)REP(j,4)REP(k,4) ans = (ans+dp[n][i][j][k])%MOD;
  cout << ans << endl;
}


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

N = int(input())
X = [int(x) for x in input().split(" ")]

Y = [0 for x in range(100+1)]
for i in range(1, 100+1):
    Y[i] = 0
    for x in X:
        Y[i] += (i - x) ** 2

print(min(Y[1:100+1]))


Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
	long double ans=0.0;
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		long double sum=1.0/n;
		int now=i;
		while(now<k){
			now*=2;
			sum/=2;
		}
		ans+=sum;
	} 
	cout<<fixed<<setprecision(10)<<ans;
    return 0;
}


Measured memory_bytes: 3780
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;


string to_string(string s) {
	return '"' + s + '"';
}

string to_string(const char* s) {
	return to_string((string) s);
}

string to_string(bool b) {
	return (b ? "true" : "false");
}

string to_string(char ch) {
	return string("'")+ch+string("'");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <class InputIterator>
string to_string (InputIterator first, InputIterator last) {
	bool start = true;
	string res = "{";
	while (first!=last) {
		if (!start) {
			res += ", ";
		}
		start = false;
		res += to_string(*first);
		++first;
	}
	res += "}";
	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;
}

void debug_out() { cerr << endl; }

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

template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x){
	input>>x.F>>x.S;
	return input;
}

template <typename A>
istream& operator>>(istream& input,vector<A>& x){
	for(auto& i:x)
		input>>i;
	return input;
}

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



const int mod=1e9+7;

int mul(int a,int b)
{
	return (a*1ll*b)%mod;
	}
	
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
	}
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
		}
	return res;
	}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N=200005;


void solve()
{  
	int n,k;
	cin>>n>>k;
	k--;
	string s;
	cin>>s;
    s[k]=tolower(s[k]);
    cout<<s;
	}
	
   
	
	

int main()
{   
    ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tc=1;
	//cin>>tc;
    while(tc--)
	{
        solve();
		}
	
	}


Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

int main()
{	

	const ll MOD = 1000000007;

	ll n, m;
	cin >> n >> m;

	vector<ll> as(m);
	rep(i, m)
	{
		cin >> as[i];
	}

	vector<ll> counts(100000 + 1);
	counts[0] = 1;
	counts[1] = 1;
	counts[2] = 2;

	reple(i, 3, n)
	{
		counts[i] = (counts[i - 1] + counts[i - 2]) % MOD;
	}

	vector<int> steps;
	int start = 0;
	for (ll a : as)
	{
		steps.push_back((a - 1) - start);

		start = a + 1;
	}

	steps.push_back(n - start);

	ll answer = 1;
	for (int s : steps)
	{
		if (s < 0)
		{
			answer = 0;
			break;
		}
		answer *= counts[s];
		answer %= MOD;
	}


	cout << answer << endl;

	return 0;
}

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

int n, m, q;
vector<int> a, b, c, d;
vector<int> A(11, 1);
int ans;

void dfs(int i) {
  if (i == n + 1) {
    int calc = 0;
    for (int j = 0; j < q; j++) {
      if (A[b[j]] - A[a[j]] == c[j]) {
        calc += d[j];
      }
    }
    ans = max(ans, calc);
    return;
  }

  for (int j = A[i - 1]; j <= m; j++) {
    A[i] = j;
    dfs(i + 1);
  }
}

int main() {
  cin >> n >> m >> q;
  a.assign(q, 0);
  b.assign(q, 0);
  c.assign(q, 0);
  d.assign(q, 0);
  for (int i = 0; i < q; i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  dfs(1);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3656
N,W = map(int, input().split())
L = [[int(l) for l in input().split()] for _ in range(N)]

w = L[0][0]
M = 0
for i in range(N):
    M += L[i][0]-w
dp = [[[0]*(M+1) for _ in range(N+1)] for _ in range(N+1)]
t = 0
for i in range(N):
    t += L[i][0]-w
    for j in range(i+2):
        for k in range(t+1):
            if j*w+k < L[i][0]:
                dp[i+1][j][k] = dp[i][j][k]
            else:
                dp[i+1][j][k] = max(dp[i][j][k], dp[i][j-1][k-(L[i][0]-w)]+L[i][1])

ans = 0
for j in range(N+1):
    for k in range(M+1):
        if j*w+k <= W:
            ans = max(ans, dp[N][j][k])
print(ans)

Measured memory_bytes: 27264
import sys
sys.setrecursionlimit(500000)

def f(i):
    if memo[i] != float("Inf"):return memo[i]

    memo[i] = min(memo[i],f(i-1)+abs(ary[i-1]-ary[i]))
    if i > 1: memo[i] = min(memo[i],f(i-2)+abs(ary[i-2]-ary[i]))

    return memo[i]
n = int(input())
ary = list(map(int,input().split()))
memo = [float("Inf") for _ in range(n)]
memo[0] = 0
print(f(n-1))

Measured memory_bytes: 96276