akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

if n==1:
    print(1)
    exit()

def cost(p,q):
    e = 0
    for i in range(n):
        for j in range(n):
            v = xy[i]
            u = xy[j]
            if p==u[0]-v[0] and q==u[1]-v[1]:
                e += 1
                break
    return n-e

res = 10**9
for i in range(n):
    for j in range(n):
        if i==j:
            continue
        v = xy[i]
        u = xy[j]
        res = min(res, cost(v[0]-u[0], v[1]-u[1]))

print(res)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;


//      DEEP

using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define all(v) v.begin(),v.end()
#define pb push_back
#define endl '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef pair<long long,long long> pll;
typedef set<int> si;


/*
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
*/
/*
typedef tree<
pair<int, int>,
null_type,
less<pair<int, int>>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
*/

const ll mod = 1e9 + 7;
const ll modl=998244353;
const double pie=3.1415926535;
                                                    //power
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

                                                      //GCD
ll gcd(ll x,ll y){
   if(y==0)return x;
   return gcd(y,x%y);
}
                                              // SIEVE

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/

int main(){
    boost;
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
      int h,a;
      cin>>h>>a;
      int ans=h/a;
      if(h%a==0)cout<<ans<<endl;
      else cout<<ans+1<<endl;
 }
}















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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007
#define rev(v) reverse(v.begin(), v.end());

bool comp(int a, int b){
    return (a<b);
}

int main(){
    long long x; cin >> x;
    long long n = 100;
    int cnt = 0;
    while(n<x){
        n+=n/100;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

#define make_it_fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define ll long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define imn INT_MIN
#define imx INT_MAX

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}

template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}

void _print() {cerr << "]\n";}

template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...) 20
#endif

ll power(ll a,ll b,ll m=1e9+7)
{
    a%=m;
    if(b==1)
    return a;
    if(b==0)
    return 1;
    ll ret=power(a,b/2);
    ret=(ret%m*ret%m)%m;
    if(b&1)
    ret=(ret%m*a%m)%m;
    return ret;
}

ll lcm(ll a,ll b)
{
    return (a*b)/(__gcd(a,b));
}
vector<ll> par;

ll findpar(ll x)
{
    while(x!=par[x])
    x=par[x];
    return x;
}

void solve()
{
    ll n,m,i;
    cin>>n>>m;
    vector<ll> siz(n+1,1);
    par=vector<ll> (n+1);
    for(i=1;i<=n;i++)
    par[i]=i;
    while(m--)
    {
        ll x,y;
        cin>>x>>y;
        ll a=findpar(x),b=findpar(y);
        if(a==b)
        continue;
        if(siz[b]>siz[a])
        swap(a,b);
        siz[a]+=siz[b];
        // siz[par[y]]=siz[par[x]];
        par[b]=par[a];
    }
    // debug(par,siz);
    ll ans=imn;
    for(i=1;i<=n;i++)
    {
        ans=max(siz[i],ans);
    }
    cout<<ans<<endl;
}

int main()
{
    int TEST_CASES=1;
    // cin>>TEST_CASES;
    while(TEST_CASES--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 6428
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = LLONG_MAX;
/* テンプレートここまで */

int main() {
  ll n; cin >> n;
  ll ans1 = 0;
  ll ans2 = 0;
  vector<ll> a(n); REP(i, n) cin >> a[i];
  ll sum = 0;

  //+-+-...
  REP(i, n){
    sum += a[i];
    if(i%2 == 0 && sum <= 0){
      ans1 += 1 - sum;
      sum = 1;
    }else if(i%2 == 1 && sum >= 0){
      ans1 += sum + 1;
      sum = -1;
    }
  }

  //-+-+...
  sum = 0;
  REP(i, n){
    sum += a[i];
    if(i%2 == 1 && sum <= 0){
      ans2 += 1 - sum;
      sum = 1;
    }else if(i%2 == 0 && sum >= 0){
      ans2 += sum + 1;
      sum = -1;
    }
  }

  cout << (ll)min(ans1, ans2) << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
#define REP(i,a,n) for(int i=a;i<(n);i++)
#define REP_sz(i,s) for(int i=0;i<s.size();i++)
#define RE return
#define FILL(a,b) memset(a,b,sizeof(a))
#define SO(a) sort(all(a))
#define pb push_back
#define sz(a) a.size()
#define V vector
#define ld long double
#define viit(a) vector<int>::iterator a
#define msit1(a) map<string,int>::iterator a
#define miit(a) map<int,int>::iterator a
#define msit2(a) map<int,string>::iterator a
#define IT iterator
#define FOR(i,a,n) for(int i=a;i<=(n);i++)
#define B(s) s.back()
#define all(a) a.begin(),a.end()
#define ER1(a) a.erase(a.begin())
#define ER0(a) a.erase(a.end())
#define pii pair<int,int>
#define pause system("PAUSE")
#define cls system("CLS")
using namespace std;
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
	int n,ans=1;
	cin>>n;
	if(n==1){
		cout<<0;
		RE 0;
	}
	if(n==2){
		cout<<1;
		RE 0;
	}
	if(n==3){
		cout<<3;
		RE 0;
	}
	for(int i=1;i<=n;i++)
	{
		int sum=0;
		if(i==1)sum--;
		sum+=(n-1)/i;
		ans+=sum;
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3648
use std::fmt::Write;
fn main() {
    let n: usize = read();
    let mut vec: Vec<u8> = read_as_vec();
    let cnt = selection_sort(n, &mut vec);
    println!("{}", join(' ', &vec));
    println!("{}", cnt);
}

fn selection_sort(n: usize, vec: &mut Vec<u8>) -> u32 {
    let mut cnt = 0;
    for i in 0..n {
        let mut min = i;
        for j in i..n {
            if vec[j] < vec[min] {
                min = j
            }
        }
        if min != i {
            // swap
            let tmp  = vec[i];
            vec[i]   = vec[min];
            vec[min] = tmp;
            cnt += 1;
        }
    }
    cnt
}

fn join<T: std::fmt::Display>(delimiter: char, arr: &[T]) -> String {
    let mut text = String::new();
    for (i, e) in arr.iter().enumerate() {
        if i > 0 {
            text.push(delimiter);
        }
        write!(text, "{}", e).unwrap();
    }
    text
}

fn read<T: std::str::FromStr>() -> T {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input.trim().parse::<T>().ok().unwrap()
}

fn read_as_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse::<T>().ok().unwrap())
        .collect()
}


Measured memory_bytes: 5040
#define _USE_MATH_DEFINES
//#include <windows.h>
#include <algorithm>
#include <cstdio>
#include <list>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <fstream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cstdlib>
#include <cmath>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define INF 1000000007
using namespace std;
typedef long long LL;
//typedef pair<int,int> P;
//typedef priority_queue<P, vector<P>, greater<P> > minPQ;
struct edge {int to,cost;};
//const int SIZE = 1<<18;

int main() {
	int sx,sy,tx,ty;
	cin >>sx>>sy>>tx>>ty;
	tx -= sx;
	ty -= sy;
	REP(i,tx) cout << 'R';
	REP(i,ty) cout << 'U';
	REP(i,tx) cout << 'L';
	REP(i,ty+1) cout << 'D';
	REP(i,tx+1) cout << 'R';
	REP(i,ty+1) cout << 'U';
	cout << 'L';
	cout << 'U';
	REP(i,tx+1) cout << 'L';
	REP(i,ty+1) cout << 'D';
	cout << 'R';
	cout << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>

#ifdef _MSC_VER
#define getchar_unlocked _getchar_nolock
#endif

int * vec;
int n;
long long ans = 0;

bool check_mon_up(int * start, int * end)
{
	if (end - start <= 1)
		return true;
	
	for (auto i = start; i < end - 1; i++)
		if (*i >= *(i + 1))
			return false;
	return true;
}

bool chec_mon_do(int * start, int * end)
{
	if (end - start <= 1)
		return true;

	for (auto i = start; i < end - 1; i++)
		if (*i <= *(i + 1))
			return false;
	return true;
}

int * m_find_max(int * start, int * end)
{
	int max = -1;
	int * numb = nullptr;
	for (int * i = start; i < end; i++)
		if (max < *i) max = *i, numb = i;
	return numb;
}

void m_find_two_max(int * start, int * end, int *& max, int *& tax)
{
	int mm = -1, mt = -1;
	for (int * i = start; i < end; i++)
	{
		if (*i > mm)
		{
			mt = mm;
			mm = *i;
			tax = max;
			max = i;
		}
		else if (*i > mt)
		{
			mt = *i;
			tax = i;
		}
	}
}

void m_find_tax(int * start, int * end, int * max, int *& tax)
{
	int mm = *max, mt = -1;
	for (int * i = start; i < end; i++)
		if (*i > mt)
			if (i != max)
			{
				tax = i;
				mt = *i;
			}
}

void fu(int * start, int * end, int * max)
{
	if (end - start == 1)
		return;
	int * tax = 0;
	m_find_tax(start, end, max, tax);
	if (tax == max)
		return;
	if (tax > max)
	{
		ans += (long long)(*tax) * (max - start + 1) * (end - tax);
		fu(start, tax, max);
	}
	else
	{
		ans += (long long)(*tax) * (tax - start + 1) * (end - max);
		fu(tax + 1, end, max);
	}
	return;
}

void func(int * start, int * end)
{
	if (end - start <= 1)
		return;
	if (end - start == 2)
	{
		ans += (long long)(*(end - 1) > *start) ? *start : *(end - 1);
		return;
	}
	if (check_mon_up(start, end))
	{
		for (int i = 0; i < end - start - 1; i++)
			ans += (long long)(*(start + i)) * (i + 1);
		return;
	}
	if (chec_mon_do(start, end))
	{
		for (int i = 1; i < end - start; i++)
			ans += (long long)(*(start + i)) * (end - start - i);
		return;
	}
	int * max = m_find_max(start, end);
	fu(start, end, max);
	func(start, max);
	func(max + 1, end);
	return;
}

bool read_int_unlocked(int * out)
{
	int c = 0;
	*out = 0;
	c = getchar_unlocked();
	for (; '0' <= c && c <= '9'; c = getchar_unlocked())
		*out = (*out) * 10 + c - '0';
	return true;
}

int main()
{
	std::ios::sync_with_stdio(false);
	read_int_unlocked(&n);
	vec = new int[n];
	int * const start = vec;
	int * const end = vec + n;
	for (int * i = start; i < end; i++)
		read_int_unlocked(i);
	func(start, end);
	std::cout << ans;
	//system("pause");
	return 0;
}

Measured memory_bytes: 640
<?php

fscanf(STDIN, "%d %d %d", $a, $b, $c);

$count = 0;
for ($i = 1; $i <= $a; $i++) {
    if ($i < 10) {
        if ($i >= $b && $i <= $c) {
            $count+= $i;
        }
    } else {
        // $arr = str_split($i);
        $arr = array_map('intval', str_split($i));
        $sum = array_sum($arr);
        if ($sum >= $b && $sum <= $c) {
            $count+= $i;
        }
    }
}
echo $count;

?>


Measured memory_bytes: 16208
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <numeric>

/* debug macros */
#ifdef WAFDAYO
#define DBG_LINE() {std::cerr<<"\e[2m[L"<<__LINE__<<"]\e[m ";}
#define DBG_PRINT(s,t,u) {std::cerr<<(s)<<" \e[2m=\e[m \e[1m"<<(t)<<"\e[m"<<(u);}
#define SELECT_7TH(x1,x2,x3,x4,x5,x6,x7,...) x7
#define dbg1(x1) DBG_PRINT(#x1,x1,std::endl)
#define dbg2(x1,x2) DBG_PRINT(#x1,x1,", ")dbg1(x2)
#define dbg3(x1,x2,x3) DBG_PRINT(#x1,x1,", ")dbg2(x2,x3)
#define dbg4(x1,x2,x3,x4) DBG_PRINT(#x1,x1,", ")dbg3(x2,x3,x4)
#define dbg5(x1,x2,x3,x4,x5) DBG_PRINT(#x1,x1,", ")dbg4(x2,x3,x4,x5)
#define dbg6(x1,x2,x3,x4,x5,x6) DBG_PRINT(#x1,x1,", ")dbg5(x2,x3,x4,x5,x6)
#define dbg(...) DBG_LINE()\
SELECT_7TH(__VA_ARGS__,dbg6,dbg5,dbg4,dbg3,dbg2,dbg1)(__VA_ARGS__)
#else
#define dbg(...) {}
#endif

/* utility functions */
struct read_item{read_item(){};
template<class T>operator T(){T t;std::cin>>t;return t;}};
char splf(int i,int n){return(i+1<n)?' ':'\n';};
template<bool up>
struct _RI{int i;_RI(int a):i(a){}
int operator*(){return i;}void operator++(){i+=(up?1:-1);}
bool operator!=(const _RI& r){return up?i<r.i:i>=r.i;}};
template<bool up>
struct _RX{_RI<up> x,y;_RI<up> begin(){return x;}_RI<up> end(){return y;}
_RX(int a,int b):x(up?a:(a-1)),y(b){}_RX(int a):_RX(up?0:a,up?a:0){}};
typedef _RX<true> range;
typedef _RX<false> revrange;

/* types and constants */
typedef int64_t i64;
typedef uint64_t u64;
// const i64 inf = (i64)1.05e18;
// const int inf = (int)1.05e9;

using namespace std;

int main() {

	const int h1 = read_item();
	const int m1 = read_item();
	const int h2 = read_item();
	const int m2 = read_item();
	const int k = read_item();

	int hm1 = (h1 * 60 + m1);
	int hm2 = (h2 * 60 + m2);
	int ans = hm2 - hm1 - k;
	printf("%d\n", ans);

	return 0;
}

/* wafdayo~~~ */


Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define N 1000009
#define pi 3.1416

vector<int> a, b;

int main()
{
    double a, b, x;
    cin >> a >> b >> x;
    if(a * a * b / 2.0 <= x)
    {
        double res = a * b - (x / a);
        double ans = (a * a) / (2.0 * res);
        ans = atan(ans);
        printf("%.10lf\n", 90.0 - (ans * 180 / acos(-1)));
    }
    else
    {
        double res = (2.0 * x / a) / (b * b);
        res = atan(res);
        printf("%.10lf\n", 90.0 - (res * 180 / acos(-1)));
    }

}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
typedef long long ll;
using namespace std;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

int a, b, x;

long double calc_vol(double degree, int a, int b)
{
    long double theta = (double)degree / 180 * PI;
    if (theta > PI / 2.0 - EPS)
    {
        return 0.0;
    }

    long double vol;
    if (a * tan(theta) <= b)
    {
        vol = a * a * b - a * a * a * tan(theta) / 2.0;
    }
    else
    {
        vol = b * b / tan(theta) * a / 2.0;
    }
    return vol;
}
void solve()
{
    long double max_err = 0.000001;
    long double vol = -1;
    long double low = 0;
    long double high = 90;
    long double mid;

    while (fabs(x - vol) > max_err)
    {
        mid = (low + high) / 2.;
        vol = calc_vol(mid, a, b);
        if (vol > x)
            low = mid;
        else
            high = mid;
    }
    cout << fixed << setprecision(10) << mid;
}

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

    solve();
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import copy

H, W, K = map(int, input().split())

C = []

x_l = []
y_l = []

# マス目の読み込み
for y in range(H):
    tmp = list(str(input()))
    C.append(tmp)

# 計算用のリストの作成
for i in range(2 ** H):
    x_l.append(list(str(bin(i))[2:].zfill(H)))

for i in range(2 ** W):
    y_l.append(list(str(bin(i))[2:].zfill(W)))

#print(*x_l)
#print(*y_l)

# 演算
tmp_k = 0
ans = 0
for x in x_l:
    for y in y_l:
        tmp_k = 0
        tmp_C = copy.deepcopy(C)
        # x の演算
        for i in range(len(x)):
            if x[i] == '1':
                tmp_C[int(i)] = ['.'] * W
        # y の演算
        for j in range(len(y)):
            if y[j] == '1':
                for k in range(len(x)):
                            tmp_C[k][int(j)] = '.'
        # K の演算 
        for tmp_tmp_C in tmp_C:
            tmp_k = tmp_k + tmp_tmp_C.count('#')
        #print(tmp_k)
        if tmp_k == K:
            ans += 1

#print('-' * 40)
print(ans)

Measured memory_bytes: 9220
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(long long i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n,cnt=0;
    string s,t;
    cin>>n>>s;
    t=s;
    sort(all(t));
    ll r=0;
    rep(i,n){
        if(t[i]=='R') r++;
        else break;
    }
    cnt=r;
    rep(i,r){
        if(s[i]=='R') cnt--;
    }
    cout<<cnt<<endl;
    return 0;
}

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

int main() {
  map<string, int> m;
  int N;
  cin >> N;
  rep(i, N){
    string S;
    cin >> S;
    if(!m.count(S)) m[S]=1;
  }
  cout << m.size() << endl;
}


Measured memory_bytes: 19224
n, k = list(map(int, input().split(' ')))
lens = {}
lens[0] = 1
for i in range(1, 51):
  lens[i] = lens[i-1] * 2 + 3
memo = {}
def sumP(level, index):
  key = (level, index)
  if key in memo:
    return memo[key]
  if level == 0:
    if index == 1:
      memo[key] = 1
    else:
      memo[key] = 0
  elif index < lens[level] // 2 + 1:  # レベル一つ下の奴の一部分のみ
    memo[key] = sumP(level-1, index-1)
  elif index == lens[level] // 2 + 1:  # ど真ん中のPを入れて一つ下全部(index-1は左端のB)
    memo[key] = 1 + sumP(level-1, lens[level-1])
  else: # レベル一つ下の奴の丸々1つ + P + レベル一つ下の奴の一部分もしくは全部, minは最後のBを捨てるため
    memo[key] = sumP(level-1, lens[level-1]) + 1 + sumP(level-1, min(lens[level-1], index-lens[level-1]-2))
  return memo[key]

print(sumP(n, k))

  

Measured memory_bytes: 3188
#include<string.h>
/**/#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<stdbool.h>
#define int long long
#define elif else if
#define mod 1000000007

int main(void)
{
	int n;
	scanf("%lld",&n);
	long double a[n+1];
	for(int i = 1;i<=n;i++)
		scanf("%Lf",a+i);

	long double dp[n+1][n+1];
	
	// memset(dp,-1,sizeof(dp));
	for(int i=0;i<=n;i++) 
		for(int j=0;j<=n;j++)
			dp[i][j] = 0;
	
	dp[0][0] = 1;

	for(int i=1;i<=n;i++) 
		dp[i][0] = dp[i-1][0]*(1-a[i]);
	
	for(int i=1;i<=n;i++)
		for(int j=1;j<=i;j++)
			dp[i][j] = dp[i-1][j-1]*a[i] + dp[i-1][j]*(1-a[i]);
	
	long double ans=0.0;
	for(int i=(n/2)+1;i<=n;i++) 
		ans += dp[n][i];
	
	printf("%.10Lf\n",ans);
	return 0;	
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

#define MAXN 25

ll dp[1<<MAXN];
int a[MAXN][MAXN];

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

  dp[0]=1;
  rep(bit, 1<<n)rep(l, n){
    if((bit>>l) %2 == 0)continue;

    int bc = __builtin_popcount(bit)-1;
     dp[bit] += dp[bit - (1<<l)] * a[bc][l];
    dp[bit] %= MOD;
  }

  cout<<dp[(1<<n)-1]<<endl;

  return 0;
}


Measured memory_bytes: 19980
c = []
for _ in range(3):
    c.append(list(map(int, input().split())))

j1 = c[0][0] - c[0][1]
j2 = c[0][1] - c[0][2]
for i in range(1, 3):
    _j1 = c[i][0] - c[i][1]
    _j2 = c[i][1] - c[i][2]
    if j1 == _j1 and j2 == _j2:
        continue
    print("No")
    break
else:
    print("Yes")

Measured memory_bytes: 61960
#include <stdio.h>
int main(void){
    int A,B,C,D,cnt=0;
    
    scanf("%d",&A);
    scanf("%d",&B);
    scanf("%d",&C);
    scanf("%d",&D);
    
    while(A>0 && C>0){
        if(cnt%2==0){
            C=C-B;
        }
        if(cnt%2==1){
            A=A-D;
        }
        
        cnt++;
    }
    
    if(cnt%2==1){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    
    return 0;
}

Measured memory_bytes: 2084
import Control.Monad
import Data.List
main = do
    [h,w] <- map read . words <$> getLine
    ss <- replicateM h $ words <$> getLine
    let Just i = findIndex (any (=="snuke")) ss
        Just j = findIndex (=="snuke") (ss !! i)
    putStrLn $ (['A'..'Z'] !! j) : show (i + 1)

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

bool g[50][50];

bool visited[50];

int n, m;

int dfs(int v) {
  visited[v] = 1;

  for (int c = 0; c < n; c++) {
    if (!g[v][c]) continue;
    if (visited[c]) continue;
    dfs(c);
  }
}

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

  cin >> n >> m;

  vector<int> aa(50), bb(50);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;

    a--;
    b--;
    g[a][b] = 1;
    g[b][a] = 1;
    aa[i] = a;
    bb[i] = b;
  }

  int ans = 0;

  for (int i = 0; i < m; i++) {
    g[aa[i]][bb[i]] = g[bb[i]][aa[i]] = 0;

    for (int j = 0; j < n; j++) {
      visited[j] = false;
    }

    dfs(0);

    bool brd = 0;
    for (int j = 0; j < n; j++) {
      if (!visited[j]) brd = true;
    }
    if (brd) ans++;

    g[aa[i]][bb[i]] = g[bb[i]][aa[i]] = 1;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
//////// Don't_be_late 
// https://atcoder.jp/contests/abc177/tasks/abc177_a
// date: 2020-08-29T21:00:28.777315
// memo: 

//<editor-fold desc="my macro">

#include<bits/stdc++.h>
#ifdef LOCAL
    #include<my/dump.h>
#else
    #define dump(...) 42 
    #define dumpi(x) 42 
#endif

typedef long long ll;
using namespace std;

#define repe(x, a) for(auto& (x) : (a))
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rep3(i, a, b) for(ll i=a, i##_len=(b);i<i##_len;i++)
#define _rep2(i, n) _rep3(i,0,n)
#define repd(...) _overload3(__VA_ARGS__,_repd3,_repd2,)(__VA_ARGS__)
#define _repd3(i, a, b) for(ll i=b-1, i##_len=(a);i>=i##_len;i--)
#define _repd2(i, n) _repd3(i,0,n)
#define loop(...) _overload3(__VA_ARGS__,,_loop2,_loop1)(__VA_ARGS__)
#define _loop2(i, a) for(ll i=a;; i++)
#define _loop1(i) _loop2(i,0)

#define all(x) x.begin(),x.end()
#define SIZE(x) ((ll)(x).size())

#define F first
#define S second
#define vec vector
#define umap unordered_map
#define uset unordered_set

ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define inrange(x,start,stop) ((start) <= (x) && (x) < (stop))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template <typename Cont, typename Func>
Cont fmap(const Cont &container, Func functor) {
    Cont result(container.size());
    std::transform(container.begin(), container.end(), result.begin(), functor);// [](int x){return x * 2;}
    return result;
}
template <typename Cont, typename Pred>
Cont filter(const Cont &container, Pred predicate) {
    Cont result;
    std::copy_if(container.begin(), container.end(), std::back_inserter(result), predicate);// [](int x){return x == 2;}
    return result;
}   

template<typename T, typename ...Args>
void ci(T& first, Args&... args) {
    ((cin >> first), ..., (cin >> args)); //C++17
}

template<char Sep, typename T, typename ...Args>
void print_seq(const T& first, const Args&... args) {
    ((cout << first), ..., (cout << Sep << args)); //C++17
}

void co(){ cout << endl; }
template<typename... Words>
void co(Words... words) {
    print_seq<' '>(words...);
    cout << endl;
}
#define coi(x) cout<<(x)<<" "

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define sankou(n,a,b) cout << ((n) ? (a) : (b) ) << endl

#define asrt(expr...) assert((expr))
//</editor-fold>

#define INF 1e19
#define MOD 1e9+7
#define MAXR 1e5

int solve() {
    ll D,T,S;
    ci(D,T,S);
//    co(D <= T * S );
    Yes(D <= T * S );
    return 0;

}

int main(){
    //入力の高速化用のコード
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    
    solve();
    return 0;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
  int n; cin >> n;
  deque<int> b;
  for (int i = 0; i < n; ++i) {
    int a; cin >> a;
    if (n%2 == i%2) {
      b.push_back(a);
    } else {
      b.push_front(a);
    }
  }

  for (int i = 0; i < n; ++i) cout << b[i] << " ";
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long n, d, x, y, s=0;
	cin>>n>>d;
	for (int i=0; i<n; i++)
	{
		cin>>x>>y;
		if (x*x+y*y<=d*d) s++;
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 3588
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int[][] a = new int[h][w];
        for(int i = 0; i < h; i++) {
            for(int j = 0; j < w; j++) {
                a[i][j] = sc.nextInt();
            }
        }
         
        int ans = Integer.MAX_VALUE;
        for(int i = 0; i < h; i++) {
            for(int j = 0; j < w; j++) {
                int now = 0;
                for(int k = 0; k < h; k++) {
                    for(int l = 0; l < w; l++) {
                        now += Math.min(Math.abs(i - k), Math.abs(j - l)) * a[k][l];
                    }
                }
                ans = Math.min(ans, now);
            }
        }
         
        System.out.println(ans);
    }
}


Measured memory_bytes: 29352
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

ll n, a, b;


void solve() {
    unordered_map<ll, ll> mp;
    if (b < a) cout << 0 << endl;
    else if (n == 1 && a != b) cout << 0 << endl;
    else if (a == b) cout << 1 << endl;
    else {
        cout << (n - 2) * (b - a) + 1 << endl;
    }
}

int main() {
    cin >> n >> a >> b;
    solve();
    return 0;
}

Measured memory_bytes: 256
import Data.Char

splitBy :: Char -> String -> [String]
splitBy _ [] = []
splitBy a x =
  let s = takeWhile (/= a) x
      x'= dropWhile (/= a) x
  in
    if x' == []
    then [s]
    else s:(splitBy a $ drop 1 x')

splitC [] = []
splitC (x:xs) =
  let s = takeWhile (\a -> ord(a) >= ord('a') && ord(a) <= ord('z')) xs
      r = dropWhile (\a -> ord(a) >= ord('a') && ord(a) <= ord('z')) xs
      x'= toLower x
  in
    (x':s):(splitC r)

split' s = 
  let s1 = splitBy '_' s
      s2 = concat $ map splitC s1
  in
    s2

camel (s:sx) = ( toUpper s):sx

cnv 'X' _ = []
cnv 'U' [] = []
cnv 'U' (x:xs) = (camel x) ++ cnv 'U' xs
cnv 'L' [] = []
cnv 'L' (x:xs) = x ++ cnv 'U' xs
cnv 'D' (x:[]) = x
cnv 'D' (x:xs) = x ++ "_" ++ cnv 'D' xs

ans [t,c] = cnv (c!!0) $ split' t

main = do
  c <- getContents
  let i = filter(\[a,b] -> b /= "X") $ map words $ lines c
      o = map ans i
  mapM_ putStrLn o

Measured memory_bytes: 3976
#include<iostream>
#include<string>

using namespace std;

int main() {
  int A, B;
  cin >> A;
  cin >> B;
  
  if ((B-1)%(A-1) == 0) {
    cout << (B-1)/(A-1) << endl;
  } else {
    cout << (B-1)/(A-1) + 1 << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,s,d,f[100001],g,h,j,i,z;
	scanf("%d %d %d",&a,&s,&d);
	for(i=0;i<s;i++)
		scanf("%d",&f[i]);
	f[s]=d;
	for(i=0;i<=s;i++){
		for(j=i+1;j<=s;j++){
			if(f[i]>f[j]){
				z=f[i];
				f[i]=f[j];
				f[j]=z;
			}
		}
	}
	f[s+1]=f[0];
	z=2100000000;
	for(i=0;i<=s;i++){
		g=f[i]-d;
		if(g<0)
			g+=a;
		h=d-f[i+1];
		if(h<0)
			h+=a;
		if(z>h*2+g)
			z=h*2+g;
		if(z>g*2+h)
			z=g*2+h;
		//printf("%d %d %d\n",z,h*2+g,g*2+h);
	}
	printf("%d\n",z*100);
	return 0;
}

Measured memory_bytes: 1068
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int A, B, C, D; cin >> A >> B >> C >> D;
  vector<int> a, b;
  for (int i = A; i <= B; ++i) a.push_back(i);
  for (int i = C; i <= D; ++i) b.push_back(i);
  int ans = 0;
  rep(i, (int)a.size()){
    rep(j, (int)b.size()){
      if (a[i] == b[j]) {
        ans++;
        //cout << a[i] << " " << b[j] << endl;
      }
    }
  }
  if (ans != 0) cout << ans - 1 << endl;
  else cout << 0 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
typedef long long lli;
#define mod 1000000007
const int INF = 1e6;
const int MAX = 1e5+10;
#define fori(n) for(int i=0;i<n;i++)
#define forj(n) for(int j=0;j<n;j++)
#define forli(n) for(lli i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define print(a) cout<<a<<endl
#define print2(a,b) cout<<a<<" "<<b<<endl
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl
#define sortvec(a) sort(a.begin(),a.end())
 
//FUNCTONS
lli llipower(lli x, lli y){lli res = 1;x = x % mod; while (y > 0){if (y & 1) res = (res*x) % mod; y = y>>1;x = (x*x) % mod;}return res;}
lli llipowerp(lli x, lli y,lli p){lli res = 1;x = x % p; while (y > 0){if (y & 1) res = (res*x) % p; y = y>>1;x = (x*x) % p;}return res;}
lli gcd(lli a, lli b){ if (!a) return b; return gcd(b%a,a);}
lli binarySearch(vector<int> arr, int l, int r, int x){ 
	if (r >= l) { 
		lli mid = l + (r - l) / 2; 
		if (arr[mid] == x) return mid; 
		if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x); 
		return binarySearch(arr, mid + 1, r, x); 
	} 
	return -1;
}

template <typename T>
void printvec(vector<T> inp){
	for(int i=0;i<inp.size();i++){
		cout<<inp[i]<<" ";
	}
	cout<<endl;
}
template <typename T>
T ceildiv(T x, T y){
	return 1 + ((x - 1) / y);
}
lli modInverse(lli a, lli m){//m is PRIME 
    lli g = gcd(a, m); 
    if (g != 1) return -1;
    else return llipowerp(a, m-2, m);
} 
int main(){

	
	int n;
	cin>>n;
	cout<<n/2+n%2<<endl;
}
 
 

Measured memory_bytes: 256
import math
import itertools

N,D = list(map(int, input().split()))

X = []

for i in range(N):
    X.append(list(map(int, input().split())))

def kyori2jou(p1, p2):
    sum = 0
    for x1, x2 in itertools.zip_longest(p1, p2):
        sum += (x1 - x2) ** 2
    return sum

count = 0
for i in range(len(X)):
    for j in range(i+1, len(X)):
        p1 = X[i]
        p2 = X[j]
        if p1 == p2:
            continue
        k2 = kyori2jou(p1, p2)
        k1 = math.sqrt(k2)
        k1int = round(k1)
        if k2 == k1int**2:
            count += 1

print(count)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
int h, w, k;
long long dp[110][20];
const int mod = 1000000007;
int f(int n) {
	n++;
	int d[10];
	d[1] = 1;
	d[2] = 2;
	for (int i = 3; i <= n; i++)d[i] = d[i - 1] + d[i - 2];
	return d[n];
}
signed main() {
	cin >> h >> w >> k;
	dp[0][1] = 1;
	for (int i = 0; i < h; i++) {
		for (int j = 1; j <= w; j++) {
			dp[i + 1][j - 1] += dp[i][j] * (f(max(w - j - 1, (int)0)) * f(max(j - 3, (int)0))) % mod;
			dp[i + 1][j]     += dp[i][j] * (f(max(w - j - 1, (int)0)) * f(max(j - 2, (int)0))) % mod;
			dp[i + 1][j + 1] += dp[i][j] * (f(max(w - j - 2, (int)0)) * f(max(j - 2, (int)0))) % mod;
		}
	}
	cout << dp[h][k] % mod << endl;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        k: usize,
    }
    let mut p = 0.;
    for a in 1..n + 1 {
        let i = (k as f64 / a as f64).log2().ceil().max(0.);
        p += 0.5_f64.powf(i) / n as f64;
    }
    println!("{}", p);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
  #define debug(...) printf(__VA_ARGS__)
#else
  #define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

constexpr int kMaxN = 1e5 + 100;
VI edges[kMaxN];
VI block[kMaxN];

int vid[kMaxN];
int size[kMaxN];
void DFS(int v, int idx) {
  vid[v] = idx;
  size[v] = 1;
  for (int u : edges[v]) {
    if (!vid[u]) {
      DFS(u, idx);
      size[v] += size[u];
    }
  }
}

int main() {
  int N, M, K;
  scanf("%d%d%d", &N, &M, &K);
  for (int i = 0; i < M; i++) {
    int A, B;
    scanf("%d%d", &A, &B);
    edges[A].PB(B);
    edges[B].PB(A);
  }
  for (int i = 0; i < K; i++) {
    int A, B;
    scanf("%d%d", &A, &B);
    block[A].PB(B);
    block[B].PB(A);
  }
  for (int v = 1; v <= N; v++) {
    if (!vid[v])
      DFS(v, v);
  }
  for (int v = 1; v <= N; v++) {
    size[v] = size[vid[v]];
  }
  for (int v = 1; v <= N; v++) {
    size[v]--;
    for (int u : edges[v]) {
      if (vid[v] == vid[u])
        size[v]--;
    }
    for (int u : block[v]) {
      if (vid[v] == vid[u])
        size[v]--;
    }
  }
  for (int v = 1; v <= N; v++)
    printf("%d%c", size[v], " \n"[v == N]);
  return 0;
}


Measured memory_bytes: 13056
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
string c;
int main()
{
	cin>>c;
	int n=c.size();
	for(int i=0;i<n;i++)
	{
		if(c[i]=='C')
		{
			for(int j=i+1;j<n;j++)
			{
				if(c[j]=='F')
				{
					cout<<"Yes";
					return 0;
				}
			}
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include    <stdio.h>

int    main(void)

{ 

    int a,b,d,r; 

    double f; 

   // scanf("%d,%d",&a,&b); 

    scanf("%d",&a); 

    scanf("%d",&b); 

    d=a/b; 

    r=a%b;

    f=(double)a/b; 

    printf("%d %d %lf\n",d,r,f); 

    return 0;

 }

Measured memory_bytes: 636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
#include <limits>
using namespace std;
// 素因数分解
typedef pair<long long, long long> P;
vector<P> prime_factorize(long long n)
{
vector<P> res;
for (long long p = 2; p * p <= n; ++p)
{
if (n % p != 0)
continue;
int num = 0;
while (n % p == 0)
{
++num;
n /= p;
}
res.push_back(make_pair(p, num));
}
if (n != 1)
res.push_back(make_pair(n, 1));
return res;
}
// 因数分解
long long gcd(long long x, long long y)
{
  if (y == 0)
  {
    return x;
  }
  else
  {
    return gcd(y, x % y);
  }
}
const int MOD = 1000000007;
typedef long long int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)
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; }

int main()
{
    ll A, B;
    cin >> A >> B;
    for (int i = 1;i<=B; i++)
    {
        if((A*i)%B==0){
            cout << A * i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3584
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int B[99];
int main(){
  int i, res;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<(N-1);Lj4PdHRW++){
      rd(B[Lj4PdHRW]);
    }
  }
  res = B[0] + B[N-2];
  for(i=(1);i<(N-1);i++){
    res +=min_L(B[i-1], B[i]);
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190902-1

// --- original code ---
// int N, B[99];
// {
//   int res;
//   rd(N,B(N-1));
//   res = B[0] + B[N-2];
//   rep(i,1,N-1) res += min(B[i-1],B[i]);
//   wt(res);
// }


Measured memory_bytes: 256
#include <stdio.h>
int n,m;
int count=0;
int road[102];

int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%d%d",&road[i*2],&road[i*2+1]);
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<m;j++){
			if((road[j*2]==i)||(road[j*2+1]==i)){
				count++;
			}
		}
		printf("%d\n",count);
		count=0;
	}
	return 0;
}

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

typedef long long ll;
const int maxn = 2e5 + 5;
int a[maxn];
int b[maxn];
int n;

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++) 
    {
        cin >> a[i] >> b[i];
    }
    sort(begin(a), begin(a) + n);
    sort(begin(b), begin(b) + n);
    if (n & 1)
    {
        ll left = a[n / 2], right = b[n / 2];
        cout << right - left + 1 << endl;
    }
    else
    {
        ll l1 = a[(n - 1) / 2], r1 = b[(n - 1) / 2], l2 = a[n / 2], r2 = b[n / 2];
        cout << (r1 + r2) - (l1 + l2) + 1 << endl;
    }
    return 0;
}

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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353
#define Graph vector<vector<int>>

int main() {
    int a, b, c, d; cin >> a >> b >> c >> d;
    string ans = "No";
    if (abs(a - c) <= d) ans = "Yes";
    else if (abs(a - b) <= d && abs(b - c) <= d) ans = "Yes";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
while True:
    a, op, b = input().split()

    a = int(a)
    b = int(b)

    if op == '?':
        break

    if op == '+':
        print(a + b)
    elif op == '-':
        print(a - b)
    elif op == '*':
        print(a * b)
    elif op == '/':
        print(a // b)


Measured memory_bytes: 5596
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#include <sstream>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007
#define M 998244353

using namespace std;

lli comb(lli a){
    lli b;
    b=a*(a-1)/2;
    return b;
}

int main() {
    lli sum=0,n,a,ans=0;
    map<lli,lli> mp;
    lli i,j,k;
    cin>>n;
    mp[0]++;
    rep(i,0,n){
        cin>>a;
        sum+=a;
        mp[sum]++;
    }
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        ans+=comb(itr->second);
    }
    cout<<ans<<endl;
}


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

int main(){
    string S;
    cin >> S;
    string month = S.substr(5,2);
    if(month == "01" || month =="02" || month == "03" || month == "04"){
        cout << "Heisei" << endl;
    }else{
        cout <<"TBD"<<endl;
    }
}

Measured memory_bytes: 256
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll l;
    std::cin >> l;
    ll nowl = l;
    ll r = 0;
    while(nowl/2){
        r++;
        nowl/= 2;
    }
    
    // L = 10101011101101
    //     01111111111111
    ll n = r+1;
    ll m = 0;
    vector<string> result;
    for (int i = n-1; i >= 1; i--) {
        ll x = l-(ll)pow(2,i-1);
        if(x >= (ll)pow(2,r)){
            l-=(ll)pow(2,i-1);
            m++;
            result.push_back( to_string(i)+" "+to_string(n)+" "+to_string(x) );
        }
    }
    for (int i = 1; i < n; i++) {
        m+=2;
        result.push_back( to_string(i)+" "+to_string(i+1)+" "+to_string( (ll)pow(2,i-1) ) );
        result.push_back( to_string(i)+" "+to_string(i+1)+" "+to_string(0) );
    }
    
    std::cout << n<<" " <<m<< std::endl;
    
    for (auto e : result) {
        std::cout << e << std::endl;
    }
}


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

struct Edge {
    int to, cost;
};

struct St {
    int pos;
    int cost;
    bool operator<(const St& s) const {
        return cost > s.cost;
    }
    St(const int p, const int c) {
        pos = p;
        cost = c;
    }
};

const int N = 100001;
vector<Edge> edge[N];
int visited[N];

int main()
{
    int n, en, s;
    cin >> n >> en >> s;

    for (int i=0; i < en; ++i) {
        int from;
        Edge e;
        cin >> from >> e.to >> e.cost;
        edge[from].push_back(e);
    }

    priority_queue<St> que;
    que.push(St(s, 0));
    fill(visited, visited+N, -1);

    while (!que.empty()) {
        St cur = que.top();
        que.pop();
        if (visited[cur.pos]!=-1) {
            continue;
        }
        visited[cur.pos] = cur.cost;

        for (int i=0; i < edge[cur.pos].size(); ++i) {
            Edge e = edge[cur.pos][i];
            if (visited[e.to] != -1) continue;
            que.push(St(e.to, cur.cost + e.cost));
        }
    }

    for (int i=0; i < n; ++i) {
        if (visited[i] == -1) {
            cout << "INF" << endl;
        }
        else {
            cout << visited[i] << endl;
        }
    }

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int count = 1;
  while (true) {
    string count_str = to_string(count);
    auto itr = find(count_str.begin(), count_str.end(), '3');
    if (count % 3 == 0 || itr != count_str.end()) {
      cout << " " << count;
    }
    if (++count > n) break;
  }
  cout << endl;
}


Measured memory_bytes: 3292
#include<iostream>
#include<algorithm>
using namespace std;
struct data1;
struct data1{
	int a,b;
};
	bool operator < (const struct data1 &lhs,const struct data1 &rhs){
		return lhs.a<rhs.a;
	}
data1 rounte[1005];
int main()
{
	int n,t,ctmp,ttmp,u=0;
	cin>>n>>t;
	for(int i=0;i<n;++i)
	{
		cin>>ctmp>>ttmp;
		if(ttmp>t)continue;
		rounte[u].a=ctmp;
		rounte[u].b=ttmp;
		++u;
	}
	sort(rounte,rounte+u);
	data1& k=rounte[0];
	//cout<<k.a<<ends<<k.b<<" "<<u<<endl;
	if(u==0)cout<<"TLE"<<endl;
	else cout<<k.a<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    long a, max, min;
    long long sum;
    cin >> n >> a;
    max = a;
    min = a;
    sum = a;

    for(int i=1; i<n; i++){
        cin >> a;
        if(a > max) max = a;
        if(a < min) min = a;
        sum += a;
    }
    cout << min << " " << max << " " << sum << endl;
    return 0;
}

Measured memory_bytes: 3084
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<int> vec, int number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}


int main(){
    string S;
    cin >> S;
    char prev = S[0];
    ll cnt=0;
    llRep(i,S.size()-1){
        if (S[i]!=prev){
            cnt ++;
            prev = S[i];
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 512
N, X  = map(int, input().split())
L = [0]+[int(i) for i in input().split()]
D = [0, 0]
for i in range(2, N+2):
    D.append(D[i-1] + L[i-1])

ans = 0
for i in D[1:]:
    if i <= X:
        ans += 1

print(ans)

Measured memory_bytes: 3064