akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

const LL inf = 112345678901234567;

int main()
{
	LL N;
	in >> N;
	std::vector<LL>x(N), y(N);
	std::vector<char>d(N);
	rep(i, N) in >> x[i] >> y[i] >> d[i];

	LL x_R1 = inf, x_R2 = -inf, x_L1 = inf, x_L2 = -inf, x_F1 = inf, x_F2 = -inf;
	LL y_U1 = inf, y_U2 = -inf, y_D1 = inf, y_D2 = -inf, y_F1 = inf, y_F2 = -inf;
	rep(i, N)
	{
		if (d[i] == 'R')
		{
			x_R1 = std::min(x_R1, x[i]);
			x_R2 = std::max(x_R2, x[i]);
			y_F1 = std::min(y_F1, y[i]);
			y_F2 = std::max(y_F2, y[i]);
		}
		if (d[i] == 'L')
		{
			x_L1 = std::min(x_L1, x[i]);
			x_L2 = std::max(x_L2, x[i]);
			y_F1 = std::min(y_F1, y[i]);
			y_F2 = std::max(y_F2, y[i]);
		}
		if (d[i] == 'U')
		{
			x_F1 = std::min(x_F1, x[i]);
			x_F2 = std::max(x_F2, x[i]);
			y_U1 = std::min(y_U1, y[i]);
			y_U2 = std::max(y_U2, y[i]);
		}
		if (d[i] == 'D')
		{
			x_F1 = std::min(x_F1, x[i]);
			x_F2 = std::max(x_F2, x[i]);
			y_D1 = std::min(y_D1, y[i]);
			y_D2 = std::max(y_D2, y[i]);
		}
	}

	std::set<long double>time;
	time.insert((x_L1 - x_R1) / 2.L); time.insert((x_L2 - x_R1) / 2.L);
	time.insert((x_L1 - x_R2) / 2.L); time.insert((x_L2 - x_R2) / 2.L);
	time.insert(x_F1 - x_R1); time.insert(x_F2 - x_R1);
	time.insert(x_F1 - x_R2); time.insert(x_F2 - x_R2);
	time.insert(x_L1 - x_F1); time.insert(x_L1 - x_F2);
	time.insert(x_L2 - x_F1); time.insert(x_L2 - x_F2);
	time.insert((y_D1 - y_U1) / 2.L); time.insert((y_D2 - y_U1) / 2.L);
	time.insert((y_D1 - y_U2) / 2.L); time.insert((y_D2 - y_U2) / 2.L);
	time.insert(y_F1 - y_U1); time.insert(y_F2 - y_U1);
	time.insert(y_F1 - y_U2); time.insert(y_F2 - y_U2);
	time.insert(y_D1 - y_F1); time.insert(y_D1 - y_F2);
	time.insert(y_D2 - y_F1); time.insert(y_D2 - y_F2);

	long double ans = inf;
	for (auto t : time)
	{
		if (t < 0) t = 0;
		long double x_max = -inf, x_min = inf, y_max = -inf, y_min = inf;
		rep(i, N)
		{
			long double dx = x[i], dy = y[i];
			if (d[i] == 'R') dx += t;
			if (d[i] == 'L') dx -= t;
			if (d[i] == 'U') dy += t;
			if (d[i] == 'D') dy -= t;
			x_max = std::max(x_max, dx);
			x_min = std::min(x_min, dx);
			y_max = std::max(y_max, dy);
			y_min = std::min(y_min, dy);
		}
		ans = std::min(ans, (x_max - x_min) * (y_max - y_min));
	}

	out << std::fixed << std::setprecision(10);
	out << ans << std::endl;
}


Measured memory_bytes: 1920
#include <cstdio>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <set>
using namespace std;

void print_vector(vector<int>& v) {
    for (int i = 0; i < v.size(); i++) {
        cout << v[i] << " ";
    }
    cout << "\n";
    return;
}

int n;

int main()
{
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int a;
        cin >> a;
        ans += a - 1;
    }
    cout << ans << "\n";

    return 0;
}


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

int main(){
  int N;
  cin >> N;
  int a[N];
  int count = 0, flag = 0;
  rep(i,N) cin >> a[i];
  while(1){
    for(int i = 0;i < N;i++){
      if(a[i]%2 == 0)  a[i] /= 2;
      else  flag = 1;
    }
    if(flag == 1)	break;
    else count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 384
def solve():
 n,k = (int(i) for i in input().split())
 patterns = (n-1)*(n-2)//2
 
 if patterns < k:
    print(-1)
    exit()
 else:
  ans = (n-1)+patterns-k
  print((n-1)+patterns-k)
  for i in range(1,n+1):
    for j in range(i+1,n+1):
     if not i== j:
      if ans == 0:
        exit()
      else:
        ans -= 1
        print(i,j)
     else:
      continue

solve()

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

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

void solve()
{
        vector<ll> a(87, 0);
        a[0] = 2, a[1] = 1;
        int n; cin >> n;
        for (int i = 2; i <= n; ++i)
        {
                a[i] = a[i - 2] + a[i - 1];
        }       
        cout << a[n] << endl; 
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}


Measured memory_bytes: 3620
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int asc(const void* a, const void* b) {
	return *(int*)b- *(int*)a;
}

int main()
{
	int a[3], k;
	cin >> a[0] >> a[1] >> a[2] >> k;
	qsort(a, 3, sizeof(int), asc);
	rep(i, k) a[0] *= 2;
	cout << a[0] + a[1] + a[2] << endl;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {

    val sc = Scanner(System.`in`)
    val N = sc.nextInt()
    val M = sc.nextInt()
    val ans = LongArray(M+1){0L}
    ans[M] = N.toLong()*(N-1)/2

    val map = mutableMapOf<Int,Int>()
    Array(N){it+1 to -1}.toMap(map)

    fun root(n:Int) :Int {
        return if (map[n]!!<0) n
        else {
            map[n] = root(map[n]!!)
            map[n]!!
        }
    }

    fun size(n:Int) = -map[root(n)!!]!!

    val bridge = Array(M){0 to 0}
    for (i in 0 until M) {
        val A = sc.nextInt()
        val B = sc.nextInt()
        bridge[i] = A to B
    }
    for (i in M-1 downTo 0) {
        ans[i] = ans[i+1]
        var (a,b) = bridge[i]
        var A = root(a)
        var B = root(b)
        if (A == B) continue
        ans[i] -= size(A)*size(B).toLong()

        if (size(A) < size(B)) {
            val tmp = A
            A = B
            B = tmp
        }
        map[A] = -size(A) - size(B)
        map[B] = A
        //println(map)
    }
    for (l in 1 .. M) println(ans[l])
}

Measured memory_bytes: 127148
n = int(input())
e = [input().split() for i in range(n)]
for i in range(n) :
	e[i] = [int(j) for j in e[i]]
x = 0
for i in range(n) :
	x += e[i][1]
	x -= e[i][0]
x += n
print(x)

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

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

    long int ac=0,wa=0,tle=0,re=0;

    for(long int i=0;i<N;i++)
    {
        string input;
        cin>>input;
        if(input=="AC")
        {
            ac++;
        }
        if(input=="WA")
        {
            wa++;
        }
        if(input=="TLE")
        {
            tle++;
        }
        if(input=="RE")
        {
            re++;
        }
    }
    cout<<"AC x "<<ac<<"\n";
    cout<<"WA x "<<wa<<"\n";
    cout<<"TLE x "<<tle<<"\n";
    cout<<"RE x "<<re<<"\n";
    return 0;
}


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

using namespace std;

const int N = 100005, M = 1000000007;
vector <int> v[N];
long long dp[N][2];

void dfs(int x, int par) {
	int sz = v[x].size();
	dp[x][0] = 1;
	dp[x][1] = 1;
	for (int i = 0; i < sz; i++) {
		if (v[x][i] != par) {
			dfs(v[x][i], x);
			dp[x][0] *= (dp[v[x][i]][0] + dp[v[x][i]][1]) % M;
			dp[x][0] %= M;
			dp[x][1] *= dp[v[x][i]][0];
			dp[x][1] %= M;
		}
	}
}

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i < n; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		v[x].push_back(y);
		v[y].push_back(x);
	}
	dfs(1, 1);
	printf("%lld\n", (dp[1][0] + dp[1][1]) % M);
	return 0;
}


Measured memory_bytes: 14208
# ABC080D - Recording
def main():
    N, C, *STC = map(int, open(0).read().split())
    recorders = [[0] * (10 ** 5 + 1) for _ in range(C + 1)]
    for s, t, c in zip(*[iter(STC)] * 3):
        recorders[c][s - 1 : t] = [1] * (t - s + 1)
    ans = max(map(sum, zip(*recorders)))
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 36384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
const ll inf=1e7;
ll n,b[3][3],a[3];
ll mina(ll x,ll rl){
    ll dx[3];
    rep(0,i,3)dx[i]=abs(rl-b[x][i]);
    ll ma=inf,imin;
    rep(0,i,3){
        if(ma>dx[i]){
            ma=dx[i];
            imin=i;
        }
    }
    b[x][imin]=inf;
    //cout<<"res="<<ma<<endl;
    return ma;
}
int main(void){
    cin>>n>>a[0]>>a[1]>>a[2];
    ll l[n];
    rep(0,i,n)cin>>l[i];
    ll ans=inf;
    rep(0,bit,1<<n){
        if(bit==0)continue;
        vector<ll> s0,ns0;
        rep(0,i,n){
            if(bit & (1<<i))s0.push_back(i);
            else ns0.push_back(i);
        }
        ll n0=s0.size();
        ll nn0=ns0.size();
        ll mp0=(n0-1)*10,rl=0;
        rep(0,i,n0){
            rl+=l[s0[i]];
        }
        rep(0,i,3)b[0][i]=a[i];
        mp0+=mina(0,rl);
        rep(0,bit1,1<<nn0){
            if(bit1==0)continue;
            vector<ll>s1,ns1;
            rep(0,i,nn0){
                if(bit1&(1<<i))s1.push_back(ns0[i]);
                else ns1.push_back(ns0[i]);
            }
            ll n1=s1.size();
            ll nn1=ns1.size();
            rl=0;
            rep(0,i,n1)rl+=l[s1[i]];
            rep(0,i,3)b[1][i]=b[0][i];
            ll mp1=mp0+(n1-1)*10+mina(1,rl);
            rep(0,bit2,1<<nn1){
                if(bit2==0)continue;
                vector<ll>s2;
                rep(0,i,nn1){
                    if(bit2&(1<<i))s2.push_back(ns1[i]);
                }
                ll n2=s2.size();
                rl=0;
                //cout<<bit2<<":";
                rep(0,i,n2){
                    rl+=l[s2[i]];
                    //cout<<s2[i];
                }
                //cout<<endl;
                //cout<<rl<<endl;
                rep(0,i,3)b[2][i]=b[1][i];
                ll mp2=mp1+(n2-1)*10+mina(2,rl);
                //cout<<rl<<endl;
                //cout<<mp2<<endl;
                ans=min(ans,mp2);
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, k;
    cin >> n >> k;
    int a[n];
    rep(i, 0, n) cin >> a[i];
    k = min(k, 50);
    while (k--) {
        int cnt[n + 1] = {};
        rep(i, 0, n) {
            int s = max(0, i - a[i]);
            int e = min(n - 1, i + a[i]);
            cnt[s]++;
            cnt[e + 1]--;
        }
        rep(i, 0, n - 1) cnt[i + 1] += cnt[i];
        rep(i, 0, n) a[i] = cnt[i];
    }
    rep(i, 0, n) cout << a[i] << " ";
    cout << endl;
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> d(N);
    for (int i = 0; i < N; i ++){
        cin >> d.at(i);
    }
    vector<int> num(101, 0);
    for (int i = 0; i < N; i++){
        num.at(d.at(i)) ++;
    }
    int res = 0;
    for (int i = 1; i <= 100; i ++){
        if (num.at(i)){
            res ++;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#define LOCAL

#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <iomanip>

using namespace std;

// From Errichto's Youtube stream
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////
int N;
string S;

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

    cin >> N >> S;

    for (auto & x : S)
        x = (x == 'o' ? 0 : 1);

    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            vector<int> A(N);

            A[0] = i;
            A[1] = j;

            for (int k = 2; k < N; k++) {
                int rem = (A[k-2] + A[k-1] + S[k-1]) % 2;
                A[k] = rem;
            }

            bool ok = true;

            if (S[N-1] != (A[N-2] + A[N-1] + A[0]) % 2)
                ok = false;
            if (S[0] != (A[N-1] + A[0] + A[1]) % 2)
                ok = false;

            //debug() << A;

            if (ok) {
                for (int k = 0; k < N; k++) {
                    cout << (A[k] ? 'W' : 'S');
                }
                cout << '\n';
                return 0;
            }
        }
    }

    cout << -1 << "\n";

    return 0;
}


Measured memory_bytes: 924
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
using namespace std;

int main() {

	unsigned long long H;
	unsigned long long W;
	cin >> H;
	cin >> W;

	unsigned long long l = H % 2;
	unsigned long long t = W % 2;

	unsigned long long ans = W * (H / 2) + l * (W / 2 + t);

	if (H == 1 || W == 1) {
		ans = 1;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<map>
#include<set>
#include<vector>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<numeric>
#include<string>
#include<tuple>
using namespace std;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
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;}
template<class T>inline void                             in(T &p){cin>>p;}
template<class T1,class T2>inline void                   in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void          in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T>inline void                             ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
template<class T>inline void                             outs(T p){for_each(all(p),out<decltype(p[0])>);}
string s;
inline void solve(void){
  in(s);
  out(~s.find("AC")?"Yes":"No");
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

int dp[5003] , N , M;

int main(){
	cin >> N >> M; if(N == 2){puts("3"); return 0;}
	bool flg = 0; dp[0] = 1; if(!(N & 1)){flg = 1; --N;}
	for(int i = 1 ; i < N ; ++i){
		int val = i <= N / 2 ? i : N - i + 1;
		if(flg && i == N / 2 + 1)
			for(int j = N ; j >= val ; --j)
				for(int k = 1 ; k * val <= j ; ++k)
					dp[j] = (dp[j] + 1ll * dp[j - k * val] * (k + 1)) % M;
		else
			for(int j = val ; j <= N ; ++j) dp[j] = (dp[j] + dp[j - val]) % M;
	}
	N += flg; int sum = N;
	for(int i = 1 ; i < N ; ++i) sum = (sum + 1ll * (N - i) * dp[i]) % M;
	cout << sum; return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

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

    int A = scanner.nextInt();
    int B = scanner.nextInt();
    int K = scanner.nextInt();

    for (int i = 0; i < K; i++) {
      if (i % 2 == 0) {
        if (A % 2 == 1) A -= 1;
        B += A / 2;
        A /= 2;
      } else {
        if (B % 2 == 1) B -= 1;
        A += B / 2;
        B /= 2;
      }
    }

    System.out.printf("%d %d\n", A, B);
  }
}


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

const ll INF = 1LL << 60; //MAX 9223372036854775807

void dfs(ll x, vector<vector<ll>> &g, vector<bool> &see,vector<vector<ll>> &re,vector<ll> &dp,vector<ll> &a,vector<ll> &ans)
{
  //点xに対する処理
  see[x] = 1;
  auto itr=lower_bound(dp.begin(),dp.end(),a[x]);
  re[x][0]=itr-dp.begin();
  re[x][1]=dp[itr-dp.begin()];
  dp[itr-dp.begin()]=min(dp[itr-dp.begin()],a[x]);
  ans[x]=lower_bound(dp.begin(),dp.end(),INF-1)-dp.begin();
  for (auto p : g[x])
  {
    if (see[p])continue;
    //進む辺に対する処理（これは木構造でオイラーツアーするために使う）
    dfs(p, g, see,re,dp,a,ans);
    //戻る辺に対する処理
  }
  //点xの親に戻る時の処理
  dp[re[x][0]]=re[x][1];
}

int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
}
vector<vector<ll>> g(n);
rep(i, n-1)
{
  ll a, b;
  cin >> a >> b;
  g[a - 1].push_back(b - 1);
  g[b - 1].push_back(a - 1); 
}
vector<ll> dp(n,INF);
vector<bool> see(n);
vector<ll> ans(n,0);
vector<vector<ll>> re(n, vector<ll>(2,0) );

dfs(0,g,see,re,dp,a,ans);

for(auto an:ans)cout << an << endl;
return 0;
}

Measured memory_bytes: 46996
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {

	int N, K;
	double ans = 0;
	
	cin >> N >> K;

	for(int i = 1; i <= N; i++){
		
		int point = i;
		double sub_ans = 1 / (double)N;
		
		if(K <= point){
			ans += sub_ans;
			continue;
		}

		for(;point < K;){
			point *= 2;
			sub_ans /= 2;
		}
		
		ans += sub_ans;
	}
	
	cout << setprecision(10) << ans << "\n";
	
	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;
 
public class Main {
 
    private static ArrayList<Long> fib = new ArrayList<Long>();
 
    public static void main(String[] args) {
         Scanner sc = new Scanner(System.in);
         long N = sc.nextLong();
 
         long init = 1;
 
         for(int i = 0; i < N+1; i++){
             if(i==0 || i==1){fib.add(init);continue;}
             fib.add(fib.get(i-2) + fib.get(i-1));
         }
         System.out.println(fib.get(fib.size()-1));
    }
}

Measured memory_bytes: 17312
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define int long long
#define uint unsigned
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
const int N=100005,mod=1000000007;
ll n,a,b,arr[N];
int f[N],g[N],s1[N],s2[N],s3[N],s4[N];
signed main(){
	n=read(); a=read(); b=read();
	for(int i=1;i<=n;i++)arr[i]=read();
	arr[0]=-4e18;
	arr[n+1]=4e18; f[0]=g[0]=1; f[1]=g[1]=-1; s1[n+1]=s2[n+1]=n+1;
	for(int i=n;i;i--){
		s1[i]=arr[i+1]-arr[i]<a?i+1:s1[i+1];
		s2[i]=arr[i+1]-arr[i]<b?i+1:s2[i+1];
	}
	for(int i=0;i<=n;i++){
		if(i)s3[i]=s3[i-1]; while(arr[s3[i]+1]-arr[i]<a)s3[i]++;
		if(i)s4[i]=s4[i-1]; while(arr[s4[i]+1]-arr[i]<b)s4[i]++;
	}
	for(int i=0;i<n;i++){
		s3[i]=max(s3[i],i+1); s4[i]=max(s4[i],i+1);
		if(i)f[i]=(f[i]+f[i-1])%mod; 
		if(s3[i]<s2[i+1]){g[s3[i]]=(g[s3[i]]+f[i])%mod;
		g[s2[i+1]]=(g[s2[i+1]]-f[i])%mod;}
		if(i)g[i]=(g[i]+g[i-1])%mod;
		if(s4[i]<s1[i+1]){f[s4[i]]=(f[s4[i]]+g[i])%mod;
		f[s1[i+1]]=(f[s1[i+1]]-g[i])%mod;}
		//cout<<i<<" "<<f[i]<<" "<<g[i]<<" "<<s3[i]<<" "<<s2[i+1]<<" "<<s4[i]<<" "<<s1[i+1]<<endl;
	}
	cout<<(((ll)f[n]+g[n]+f[n-1]+g[n-1])%mod+mod)%mod;
}

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

int main(){

    int i, j, n;
    cin >> n;

    double A[n], B[n];
    for(i = 0; i < n; i++){
        cin >> A[i];
    }
    for(i = 0; i < n; i++){
        B[i] = 1;
        for(j = 0; j < n; j++){
            if(i != j){
                B[i] *= A[j];
            }
        }
    }

    double sum = 0, product = 1, result;
    for(i = 0; i < n; i++){
        sum += B[i];
        product *= A[i];
    }

    result = product / sum;

    cout << result << endl;

    return 0;


}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int[] x = new int[5];

        for(int i=0; i<5; i++){
            x[i] = sc.nextInt();
        }

        int k = sc.nextInt();

        if(x[4]-x[0]>k){
            System.out.println(":(");
        }
        else if(x[4]-x[0]<=k){
            System.out.println("Yay!");
        }
    }
}

Measured memory_bytes: 21844
#include <iostream>

int main(){
    int N;
    auto same = 0;

    std::cin >> N;

    for(auto i = 0;i < N;i++){
        int d1, d2;
        std::cin >> d1 >> d2;
        if(d1 == d2){
            same++;
        }else{
            same = 0;
        }

        if(same == 3){
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }

    std::cout << "No" << std::endl;
    return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <stdio.h>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <vector>
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

const int inf = 1e9 + 7;
const long long INF = 1e18 + 7;
const int maxn = 2e5 + 7;

ll n;
ll ans, p[maxn];
vector < ll > v;

int main(){
	ios_base::sync_with_stdio(NULL);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for (ll i = 2; i <= n; i++){
		ll x = i;
		for (ll j = 2; j <= n; j++){
			while (x % j == 0){
				if (!p[j])
					p[j]++, v.pb(j);
				else
					p[j]++;
				x /= j;
			}
		}
	}
	ans = 1;
	for (ll x : v){
		ans = (ans * (p[x] + 1) + inf) % inf;
	}
	cout << (ans + inf) % inf;
	return 0;
} 

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

using namespace std;

int main(void){
  int N;
  cin>>N;
  vector<int> a(11);
  for (int i=0;i<10;i++){
    a[i]=100*i + 10*i + i;
  }
  for (int i=1;i<10;i++){
    if (N<=a[i]&&N>a[i-1]) cout<<a[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>


 int main(){
 int N,M;
 int A = 0,B = 0;
 scanf("%d %d",&N ,&M);
 for(int i = 1; i < N; i++){
 		A += i;
 	
 }
 for(int i = 1; i < M; i++){
 		B += i;
 	
 }
  printf("%d",A + B );
  return 0;
	}
	


Measured memory_bytes: 3208
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<stack>
#include<algorithm>
#include<string>
using namespace std;

int main()
{
	long long int n,i,sum=0;cin>>n;
     for(i=1;i<=n;i=i+1)
     {
         if(i%3!=0 && i%5!=0){sum=sum+i;}
     }
     cout<<sum<<endl;
	
	
}

Measured memory_bytes: 3636
N,K=map(int,input().split())
answer=0
count=N-K+2
for y in range(K,N+2):
    min=int(y*(0+y-1)/2)
    max=int(y*(N-y+1+N)/2)
    answer+=(max+1-min)
print(answer%(10**9+7))

Measured memory_bytes: 9192
import java.util.*;

 class Main
 {
   public static void main(String args[])
   { 
    input();
   }
   static void input()
   {
     Scanner sc = new Scanner(System.in);
     
     while(true)
     {
       int n = sc.nextInt();
       
       int x = sc.nextInt();
       
       if(n == 0 && x == 0)break;
       
       output(n,x);
     }
     
   }
   static void output(int n,int x)
   {
     int answer = 0;
     
     for(int i = 1; i <= n - 2; i ++)
     {
       for(int j = i + 1; j <= n - 1; j ++)
       {
         for(int k = j + 1; k <= n; k ++)
         {
           if(i + k + j == x)
           {
             answer ++;
           }
         }
       }
     }
     System.out.println(answer);
   }
 }
  


Measured memory_bytes: 26888
//#pragma GCC target("avx2")
//#pragma GCC optimization("O3")
//#pragma GCC optimization("unroll-loops")
//assert(q==w) если q!=w --> runtime error
#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define ub upper_bound
#define lb lower_bound
#define bit __builtin_popcount
#define memset(x) memset(x,0,sizeof(x))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vector<int>> matrix;

inline void boost(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const ll maxn=2e5+123;
const ll inf=1e9+123;
const ll linf=1e18+123;
const ll mod=1e9+7;
const double eps=1e-9;
const double pi=acos(-1);
int dx[8]={0,1,-1,0,1,-1,1,-1};
int dy[8]={1,0,0,-1,1,1,-1,-1};
pii a[maxn];
int dp[maxn];
int main(){
    boost();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n,t;
    cin>>n>>t;
    for(int i=1;i<=n;i++){
        cin>>a[i].F>>a[i].S;
    }
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++){
        for(int j=t-1;j>=0;j--){
            dp[min(j+a[i].F,t+1)]=max(dp[j]+a[i].S,dp[min(j+a[i].F,t+1)]);
        }
    }
    int ans=0;
    for(int i=1;i<=t+1;i++){
        ans=max(ans,dp[i]);
    }
    cout<<ans;
	exit(0);
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <map>
#include <set>
#include <list>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)

using namespace std;

/////////////////////////////////////////////////////
#define MOD 998244353

ll N;
vector<ll> A;

ll ans;
ll i,j;

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

int main(){
    scanf("%lld", &N);
    fornum(i,0,N){
        ll a;
        scanf("%lld", &a);
        A.push_back(a);
    }
    sort(A.begin(),A.end());
    ans = 1;
    fornum(i,0,N){
        ans = (ans * gcd(A[i], i))%MOD;
    }
    printf("%lld", ans);

    return 0;
}

Measured memory_bytes: 1400
S = input()[::-1]
T = ['dream'[::-1], 'erase'[::-1],'dreamer'[::-1], 'eraser'[::-1]]

s = ''
for i in range(len(S)):
    s += S[i]
    if s in T:
        s = ''
    
if len(s) == 0:
    re = 'YES'
else:
    re = 'NO'

print(re)

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n+1);
    rep(i,n) cin>>a[i];
    vector<ll> ans(n+1);
    ll sum=0;
    rep(i,n){
        if(i%2==0){
            sum+=a[i];
        }else{
            sum-=a[i];
        }
    }
    ans[0]=sum;
    REP(i,n-1){
        ans[i]=(a[i-1]-ans[i-1]/2)*2;
    }

    rep(i,n) cout<<ans[i]<<" ";
    cout<<endl;

}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const int maxn = 2e6 + 5;
int a[15], c[15], shuf[15];
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int d, j;
    cin >> d >> j;
    for (int i = 0; i < d; ++i){
        cin >> a[i] >> c[i];
        shuf[i] = i;
    }
    int ans = 0x3f3f3f3f;
    do{
        int t = 0, sum = 0;
        for (int i = 0; i < d; ++i){
            if (sum + 100 * (shuf[i] + 1) * (a[shuf[i]] - 1) >= j){
                t += (j - sum + 100 * (shuf[i] + 1) - 1) / (100 * (shuf[i] + 1));
                break;
            }else{
                sum += 100 * (shuf[i] + 1) * a[shuf[i]] + c[shuf[i]];
                t += a[shuf[i]];
                if (sum >= j) break;
            }
        }
        ans = min(ans, t);
    }while (next_permutation(shuf, shuf + d));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;

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

int main() {
    ll N;
    cin >> N;
    string out = "No";
    rep(i,26){
        rep(j,15){
            if(N==i*4+j*7){
                out = "Yes";
                break;
            }
        }
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll n,m,ans=0;

#define INF 1000000000000000
#define MAX_V 200000

struct edge {
    ll to;
    ll cost;
};

// <最短距離, 頂点の番号>
using P = pair<ll, ll>;

vector<edge> G[MAX_V];
ll d[MAX_V];
void dijkstra(ll s) {
    For(i,0,n) d[i]=INF;
    priority_queue<P,vector<P>,greater<P>> que;
    d[s] = 0;
    que.push(P(0, s));
    while (!que.empty()){
        P p = que.top();
        que.pop();
        ll v = p.second;
        if (d[v] < p.first) continue;

        For(i,0,G[v].size()) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

void Main(){
    cin>>n>>m;
    vector<pair<pair<ll,ll>,ll>> LRC(m);
    For(i,0,m) {
        cin>>LRC.at(i).first.first>>LRC.at(i).first.second>>LRC.at(i).second;
        LRC.at(i).first.first--;LRC.at(i).first.second--;
        edge e;e.to=LRC.at(i).first.second;e.cost=LRC.at(i).second;
        G[LRC.at(i).first.first].push_back(e);
    }
    For(j,0,n-1){
        edge e;e.to=j;e.cost=0;
        G[j+1].push_back(e);
    }
    dijkstra(0);
    if(d[n-1]<INF) cout<<d[n-1]<<endl;
    else cout<<-1<<endl;
}
int main(){
    Main();
    return 0;
}


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

#define ll long long

inline ll read() {
    ll x = 0, f = 1; char ch = getchar();
    for(; ch < '0' || ch>'9'; ch = getchar())
        if(ch == '-') f = -f;
    for(; ch >= '0' && ch <= '9'; ch = getchar())
        x = x * 10 + ch - '0';
    return x * f;
}

inline void chkmin( int &a, int b ) { if(a > b) a = b; }

inline void chkmax( int &a, int b ) { if(a < b) a = b; }

#define _ read()

#define ln endl

int main()
{
	int a = _, b = _, x = _;
	double degree;
	if( 2 * x >= a * a * b)
		degree = (double)(2.0 * a * a * b - 2.0 * x) / (a * a * a);
	else
		degree = (double)1.0 / (2.0 * x / (1.0 * a * b * b));	
	printf("%.10f",(double)180.0/acos(-1)*atan(degree));
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int M1, M2, D1, D2;
    cin >> M1 >> D1;
    cin >> M2 >> D2;
    if(M1 == M2){
        cout << 0 << endl;
    }else{
        cout << 1 << endl;
    }
}

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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  if (N >= M / 2) cout << M / 2 << endl;
  else {
    long long m = M - (2 * N);
    m /= 4;
    cout << N + m << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;

int main(){
  int n, ans=0;cin>>n;
  int num=0, pre=-1, h;
  while(n--){
    cin>>h;
  	if(pre>=h){
    	num++;
    }else{
      ans = max(ans, num);
      num=0;
    }
    pre = h;
  }
  ans = max(ans, num);
  cout<<ans<<endl;
}


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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int n;
	cin >> n;
	map<char, int> s;
	for (int i = 0; i < n; i++) {
		char a;
		cin >> a;
		s[a]++;
	}
	int sum = 0;
	for (auto iter = s.begin(); iter != s.end(); iter++) {
		sum++;
	}
	if (sum == 4) {
		cout << "Four";
	}
	else {
		cout << "Three";
	}
}

Measured memory_bytes: 256
N = int(input())
out = "Yes"
S = input()
L = []

L.append(S)
for i in range(N-1):
    T = input()
    if T in L:
        out = "No"
    if T[0]!=S[-1]:
        out = "No"
    S = T
    L.append(S)
print(out)


Measured memory_bytes: 38256
import java.util.*;
import java.io.*;
class Main {
    static long ans=0;
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int N = Integer.parseInt(st.nextToken());
        
        long a=1;
        long b=1;

        for(long i=0; i<N; i++){
            st = new StringTokenizer(br.readLine());
            long ra=Long.parseLong(st.nextToken());
            long rb=Long.parseLong(st.nextToken());
            if(ra>=a && rb>=b){
                a=ra;
                b=rb;
                continue;
            }
            else{
                long l=Math.max(a/ra,b/rb);
                // long l=1;
                long tmpa=ra*l,tmpb=rb*l;
                while(tmpa<a || tmpb<b){
                    l++;
                    tmpa=ra*l;
                    tmpb=rb*l;
                }
                a=tmpa;
                b=tmpb;
            }
            
        }

        System.out.println(a+b);
    }
}

Measured memory_bytes: 23508
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#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 fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<62;



int main(void) {

    int n;
    cin>>n;
    vi v(n);
    vc c(n);
    rep(i,n)c[i]='A'+i%2;
    rep(i,n)cin>>v[i];
    vi w=v;
    Sort(w);
    map<int,char> m;
    for(int i=0;i<n;i++){
        m[w[i]]='A'+i%2;
    }
    int incorrect=0;
    for(int i=0;i<n;i++){
        if(c[i]!=m[v[i]])incorrect++;
    }
    // rep(i,n)cout<<c[i]<<endl;
    cout<<incorrect/2<<endl;

}



Measured memory_bytes: 5888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int a[105];
int b[105];
vector<int> ans;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    for(int i = 1; i <= N; i++) {
        cin >> a[i];
    }
    for(int time = 1; time <= N; time++) {
        bool ok = false;
        for(int val = time; val >= 1; val--) {
            if(ok) break;
            int num = 0;
            for(int index = N; index >= 1; index--) {
                if(b[index] != 0) {
                    num++;
                    if(num + val > time) break;
                    continue;
                }
                if(a[index] == val) {
                    ans.push_back(val);
                    b[index] = val;
                    ok = true;
                    break;
                }
            }
        }
        if(!ok) {
            cout << -1 << endl;
            return 0;
        }
    }
    for(int i = 0; i < ans.size(); i++) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;



int main(){
    ll a;
    double b;
    cin >> a >> b;
    
    //bはdoubleのため100倍しても.00が残る
    //それをroundで消し、ll型に直して掛け算すればオーバーフローを防げる
    cout << (a*(ll)round(b*100)) /100 << endl;


   

}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m,c; cin >>n >>m >>c;
  int tmp, sum=0, ans=0;
  vector<int> b(m);
  for(int i=0; i<m; i++){
    cin >>b[i];
  }
  for (int i=0; i<n; i++){
    sum=0;
    for (int j=0; j<m; j++){
      cin >>tmp;
      sum+=tmp*b[j];
      //cout <<tmp <<" "<<b[i]<<" "<<sum<<endl;
    }
    //cout <<sum<<endl;
    if(sum+c>0) ans++;
  }
  cout<<ans <<endl;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  string s;
  getline(cin, s);
  s = regex_replace(s, regex("apple"), "__YARUDAKE__");
  s = regex_replace(s, regex("peach"), "apple");
  s = regex_replace(s, regex("__YARUDAKE__"), "peach");
  cout << s << endl;
}

Measured memory_bytes: 3176
#include <iostream>
using namespace std;
void swap(int &a, int &b){
	int buf = a;
	a = b;
	b = buf;
}
int main(){
	long long n, a[200000] = {0}, b[200000] = {0};
	long long count = 0;
	cin >> n;
	for(int i = 0; i < n + 1; i++){
		cin >> a[i];
	}
	for(int i = 0; i < n; i++){
		cin >> b[i];
	}
	for(int i = 0; i < n; i++){
		if(a[i] >= b[i]){
			a[i] -= b[i];
			count += b[i];
		}else{
			b[i] -= a[i];
			count += a[i];
			if(a[i + 1] >= b[i]){
				a[i + 1] -= b[i];
				count += b[i];
			}else{
				b[i] -= a[i + 1];
				count += a[i + 1];
              a[i + 1] = 0;
			}
		}
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3328
/**So..a**/
#include<bits/stdc++.h>

using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define PB(x, v) x.push_back(v);
#define M_P(a, b) make_pair(a, b)
#define pll pair<ll, ll>
#define ll long long
#define mll map<ll, ll>
#define vl vector<ll>
#define fa(x, v) for(auto x: v)
#define fr(i, a, b) for(int i= a;i <=b; i++)
#define TEST  ll Test; cin >> Test; while(Test--)

#define B_ begin()
#define E_ end()
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define NL_ "\n"
#define F first
#define S second
#define FF first.first
#define FS first.second
#define SF second.first
#define SS second.second

#define mod(a) a%1000000007
#define MAX 2000000000
#define  ull unsigned long long



int main()
{

    FAST;
   int d, t, s;
   cin >> d >> t>> s;
   if(t*s>=d) cout <<"Yes";
   else cout <<"No";

    return 0;
}


Measured memory_bytes: 3648
from sys import stdin
s=stdin.readline().rstrip()
ans="AC"
if s[0]!='A':
	ans='WA'
if s.count('C',2,len(s)-1)!=1:
	ans='WA'
s2=s.replace('A','',1)
s2=s2.replace('C','',1)
if not s2.islower():
	ans='WA'
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

// ABC150C

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  vector<int> P(N);
  vector<int> Q(N);
  REP(i, N){
    cin >> P[i];
  }
  REP(i, N){
    cin >> Q[i];
  }
  vector<int> A = P;
  sort(A.begin(), A.end()); 
  int cnt = 0, p = 0, q = 0;
  do{
    bool flagP = true;
    bool flagQ = true;
    REP(i, N){
      if(A[i] != P[i]) flagP = false;
      if(A[i] != Q[i]) flagQ = false;
    }
    if(flagP) p = cnt;
    if(flagQ) q = cnt;
    cnt++; // 次の辞書順番号にする
  }while(next_permutation(A.begin(), A.end()));
  cout << abs(p-q) << endl;
}

Measured memory_bytes: 256
N, M = list(map(int, input().split(' ')))
MOD = int(1e9 + 7)
seeds = []
p = 2
while p*p <= M:
  while M % p == 0:
    seeds.append(p)
    M = M // p
  p += 1
if M > 1:
  seeds.append(M)
 
def comb(n, k):
  ans = 1
  for i in range(1, k + 1):
    ans = (ans * (n + 1 - i) // i)
  return ans
 
ans = 1
hogehoge = set(seeds)
for i in hogehoge:
  a_ct = seeds.count(i)
  ans = (ans * comb(a_ct + N-1, min(a_ct, N-1))) % MOD
print(ans)


Measured memory_bytes: 3064
from itertools import accumulate


N, *A = map(int, open(0).read().split())
A_acc = list(accumulate(A, initial=0))
min_diff = float("inf")
for i in range(1, N):
    left, right = A_acc[i], A_acc[N] - A_acc[i]
    min_diff = min(min_diff, abs(right - left))
print(min_diff)


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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

#define PQ(T) priority_queue<T>
#define RPQ(T) priority_queue<T,vector<T>,greater<T>>

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

inline ll square(ll x) { return x * x; }
// ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }


const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }
// ll comb(ll n, ll k) { ll v=1; for(ll i=1; i<=k; i++) v = DIV(MUL(v, n-i+1),i); return v; }
//

#define INTSPACE 12
char _buf[INTSPACE*1000000 + 3];

int loadint() {
    if (fgets(_buf, INTSPACE+3, stdin)==NULL) return 0;
    return atoi(_buf);
}

int loadvec(vector<int>& v, int N=-1) {
    if (N == 0) {
        v.clear();
        return 0;
    }
    if (N == -1) {
        N = loadint();
        if (N==0) return 0;
    }
    int bufsize = INTSPACE*N + 3;
    if (fgets(_buf, bufsize, stdin)==NULL) return 0;
    v.resize(N);

    int i=0;
    bool last = false;
    for (char *p=&_buf[0]; ;) {
        char *q = p;
        while (*q > ' ') ++q;
        if (*q == 0x0D || *q == 0x0A) last = true;
        *q = 0;
        v[i++] = atoi(p);
        if (last || i == N) break;
        p = q+1;
    }
    // assert(i <= N);
    return i;
}
void read_cr() {
    fgets(_buf, 256, stdin);
}


int main() {
    int n,a,b; cin>>n>>a>>b;
    cout << (min(n*a, b)) << endl;
    return 0;
}


Measured memory_bytes: 256