akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-

# 標準入力
a, b = map(int, input().split())
#input_num_str= input()
#input_num = int(input())

# スペース区切りの整数の入力
#num_list = list(map(int,input().split()))

result = a + b

if result <  (a -b ):
    result = a-b

if result < (a * b):
    result = a * b

print(result)

Measured memory_bytes: 2940
///           _____                  _______                  _____                   _____
///          /\    \                /::\    \                /\    \                 /\    \
///         /::\    \              /::::\    \              /::\____\               /::\    \
///        /::::\    \            /::::::\    \            /:::/    /              /::::\    \
///       /::::::\    \          /::::::::\    \          /:::/    /              /::::::\    \
///      /:::/\:::\    \        /:::/~~\:::\    \        /:::/    /              /:::/\:::\    \
///     /:::/__\:::\    \      /:::/    \:::\    \      /:::/    /              /:::/__\:::\    \
///    /::::\   \:::\    \    /:::/    / \:::\    \    /:::/    /              /::::\   \:::\    \
///   /::::::\   \:::\    \  /:::/____/   \:::\____\  /:::/    /      _____   /::::::\   \:::\    \
///  /:::/\:::\   \:::\    \|:::|    |     |:::|    |/:::/____/      /\    \ /:::/\:::\   \:::\    \
/// /:::/  \:::\   \:::\____|:::|____|     |:::|____|:::|    /      /::\____/:::/  \:::\   \:::\____\
/// \::/    \:::\  /:::/    /\:::\   _\___/:::/    /|:::|____\     /:::/    \::/    \:::\  /:::/    /
///  \/____/ \:::\/:::/    /  \:::\ |::| /:::/    /  \:::\    \   /:::/    / \/____/ \:::\/:::/    /
///           \::::::/    /    \:::\|::|/:::/    /    \:::\    \ /:::/    /           \::::::/    /
///            \::::/    /      \::::::::::/    /      \:::\    /:::/    /             \::::/    /
///            /:::/    /        \::::::::/    /        \:::\__/:::/    /              /:::/    /
///           /:::/    /          \::::::/    /          \::::::::/    /              /:::/    /
///          /:::/    /            \::::/____/            \::::::/    /              /:::/    /
///         /:::/    /              |::|    |              \::::/    /              /:::/    /
///         \::/    /               |::|____|               \::/____/               \::/    /
///          \/____/                 ~~                      ~~                      \/____/
//I am aqua
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define mp make_pair
#define speed  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fo for(int i=0;i<n;i++) cin>>a[i];
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define l first
#define r second
#define input.txt ifstream fin("input.txt"); ofstream fout("output.txt");
using namespace std;
///--------------------------------------------------------------------------------------------------------------------

///--------------------------------------------------------------------------------------------------------------------

///--------------------------------------------------------------------------------------------------------------------
int main()
{
    ll a,b;
    cin>>a>>b;
    cout<<a*b/__gcd(a,b);
}
///I know that ;
///I know where I am
///Do not think I don't


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
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;
}
 
using namespace std;


void solve(){
  int n,k;
  cin>>n>>k;
  vector<int>v(n);
  rep(i,n)cin>>v[i];
  int ans=0;
  for(int left=0;left<=min(n,k);++left){
      priority_queue<int,vector<int>,greater<int>>pq,prepq;
      int cmp=0;
      rep(i,left){
        cmp+=v[i];
        pq.emplace(v[i]);
      }
      int pre=cmp;
      prepq=pq;
    for(int right=0;right<=min(n,k)-left;++right){
      cmp=pre;
      pq=prepq;
      rep(i,right){
        cmp+=v[n-1-i];
        pq.emplace(v[n-1-i]);
      }
      int cnt=0;
      while(!pq.empty()){
        if(pq.top()>=0)break;
        if(cnt>=k-left-right)break;
        int x=pq.top();
        pq.pop();
        cmp-=x;
        ++cnt;
      }
      chmax(ans,cmp);
    }
  }
  cout<<ans;
}

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


Measured memory_bytes: 256
n, m = map(int, input().split())
ps = list()
for i in range(m):
    ps.append(list(map(int, input().split())))
ans = list(0 for _ in range(n))
for i in range(1, n + 1):
    for p in ps:
        ans[i - 1] += p.count(i)
print('\n'.join(map(str, ans)))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < (int)(n);i++)

int main() {
  int N, K, S = 0;
  cin >> N >> K;
  vector<int> v(N);
  REP(i, N) {
    cin >> v[i];
    if(i < K) S += v[i];
  }
  int m = S;
  REP(i, N - K) {
    S = S - v[i] + v[i + K];
    if(S > m) m = S;
  }
  cout << fixed << setprecision(8) << (double)(K + m) / 2 << endl;
}

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



int main()
{
	int n;
	cin>>n;
	int arr[n+10];
	long long cnt=0;
	for(int i=0;i<n;i++)
		cin>>arr[i];
	sort(arr, arr+n);
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			for(int k=j+1;k<n;k++)
			{
				if(arr[i]+arr[j]>arr[k])
					cnt++;
				else
					break;
			}
		}
	}
	cout<<cnt;
}

Measured memory_bytes: 256
X, N = map(int, input().split())
P = set(map(int, input().split()))

if X not in P:
    print(X)
    exit()

p, m = X, X
while True:
    m -= 1
    if m not in P:
        print(m)
        break
    p += 1
    if p not in P:
        print(p)
        break


Measured memory_bytes: 9168
use std::io;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let s:Vec<char> = buf.trim().chars().collect();
	if s[2] == s[3] && s[4] == s[5] {
		println!("Yes");
	}else{
		println!("No");
	}
}

Measured memory_bytes: 4352
/*
  Author: @yash_31
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#define ll long long int
#define eb emplace_back
#define fatafat ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
#define ft first
#define sd second
#define vpi vector<pair<int,int> >
#define vpl vector<pair<ll,ll> >
#define mkpr make_pair
#define deb(x) std::cout<<#x<<":"<<x<<endl;
#define whole(x) (x).begin(),(x).end()
#define revwhole(x) (x).rbegin(),(x).rend()
#define endl "\n"
#define fbo find_by_order
#define ook order_of_key

using namespace std; 
using namespace __gnu_pbds;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag,tree_order_statistics_node_update> gharKaSet;
 
const int maxlimit=1e5+2;
const ll inf=1e18;

int main()
{
  fatafat
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  bool turn=true;
  while(true){
    if(c<=0){cout<<"Yes";return 0;}
    if(a<=0){cout<<"No";return 0;}
    if(turn){c-=b;}
    else a-=d;
    turn=!turn;
  }
  return 0;
}

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

bool exist(int arr[],int n, int x)
{
	for(int i=0; i<n;i++)
	{
		if(x==arr[i])
			return true;
	}
	return false;
}

int main()
{
	int x, n;
	
	cin >> x >> n;
	int arr[n];
	for(int i=0; i<n;i++)
	{
		cin >> arr[i];
	}
	sort(arr, arr+n);
	int the_near = x;
	int the_near_low = the_near;
	int the_near_high = the_near;
	bool a = exist(arr, n, the_near_low);
	bool b = exist(arr, n, the_near_high);
	while( a && b )
	{
		the_near_low -= 1;
		the_near_high += 1;
		a = exist(arr, n, the_near_low);
		b = exist(arr, n, the_near_high);
		
	}
	if(!a)
		cout << the_near_low<<endl;
	if(!b && a)
		cout << the_near_high<<endl;
	
	
	
	
	
}

Measured memory_bytes: 3640
import sys

input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    f = set(range(1,M+1))
    for _ in range(N):
        a = set(list(map(int, input().split()))[1:])
        f.intersection_update(a)
    print(len(f))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#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()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int INF = 1234567890;

int D;
int x[100000];

const int B = 317;
// default,sorted
vector<int> d[B],s[B];

int f(int l, int r, int p, int q)
{
    int ret = r-l+1;
    for(int i=l; i<=r; ++i)if(p<=x[i] && x[i]<=q) --ret;
    return ret;
}

int g(int bid, int p, int q)
{
    int lidx = lower_bound(all(s[bid]), p) - s[bid].begin();
    int ridx = upper_bound(all(s[bid]), q) - s[bid].begin();
    int ct = ridx - lidx;
    return B - ct;
}

int query(int l, int r, int e)
{
    int a = min(x[l],x[r]), b = max(x[l],x[r]);

    int lb = l/B, rb = r/B;
    int ret = 0;

    if(lb==rb) ret += f(l,r,a-e,b+e);
    else
    {
        ret += f(l,B*(lb+1)-1,a-e,b+e);
        for(int i=lb+1; i<rb; ++i) ret += g(i,a-e,b+e);
        ret += f(B*rb,r,a-e,b+e);
    }

    return ret;
}

int main()
{
    scanf(" %d", &D);
    rep(i,D) scanf(" %d", &x[i]);

    rep(i,B)
    {
        d[i] = vector<int>(B,INF);
        rep(j,B)
        {
            int id = i*B+j;
            if(id<D) d[i][j] = x[id];
        }

        s[i] = d[i];
        sort(all(s[i]));
    }

    int Q;
    scanf(" %d", &Q);
    while(Q--)
    {
        int l,r,e;
        scanf(" %d %d %d", &l, &r, &e);
        --l; --r;
        printf("%d\n", query(l,r,e));
    }

    return 0;
}

Measured memory_bytes: 4232
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n+1) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
constexpr int MOD = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}

constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};
//}}}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> a(n),b(n),c(n);

    rep(i,n){
        cin >> a[i];
    }
    rep(i,n){
        cin >> b[i];
    }
    rep(i,n){
        cin >> c[i];
    }

    sort(all(a));
    sort(all(b));

    vector<int> cum(n);

    rep(i,n){
        int len = upper_bound(all(a),b[i]-1) - a.begin();
        cum[i] += len;
    }
    for(int i = 1;i < n;++i){
        cum[i] += cum[i-1];
    }

    int res = 0;

    rep(i,n){
        int pos = upper_bound(all(b),c[i]-1) - b.begin();
        if(pos != 0) res += cum[pos-1];
    }

    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

char s[4][4] = {"AC", "WA", "TLE", "RE"};
char t[4];
int a[4] = {};

int main(){
	int n; scanf("%d", &n);
	REP(i, n){
		scanf("%s", t);
		REP(j, 4) if(t[0] == s[j][0]) a[j]++;
	}
	REP(j, 4) printf("%s x %d\n", s[j], a[j]);
}


Measured memory_bytes: 3812
#include <iostream>
#include <math.h>

using namespace std;

int main(){
        int c;
        int sumPrice = 0;
        int sum = 0;
        int price;
        int num;
        while(cin >> price){
                char ch; 
                cin >> ch; 
                cin >> num;
                c++;
                sumPrice += price*num;
                sum += num;
        }   
        cout << sumPrice << "\n" << (int)round((double)sum/c) << endl;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define LINT long long

int main(){
  int N;
  cin >> N;
   if(N<1200) cout << "ABC" <<endl;
   else if (N<2800) cout << "ARC" <<endl;
   else cout << "AGC" <<endl;



  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
//const int MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const double pi = acos(-1.0);
const double EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

struct Random_Number_Generator{
    mt19937_64 mt;

    Random_Number_Generator() : mt(chrono::steady_clock::now().time_since_epoch().count()) {}

    int64_t operator () (int64_t l, int64_t r){
        uniform_int_distribution<int64_t> dist(l, r-1);
        return dist(mt);
    }

    int64_t operator () (int64_t r){ 
        return (*this)(0, r);
    }
};

ll c[27], a[365][27];
ll res = 0, sum = 0;
vector<int> ans(365), now(365);
set<int> s[27];

ll insert(int d, int q){
    ll ret = a[d][q];
    s[q].insert(d);
    set<int>::iterator it1 = s[q].find(d), it2 = it1;
    int l = *--it1, r = *++it2;
    ret += c[q]*(r-l)*(r-l-1)/2;
    ret -= c[q]*((d-l)*(d-l-1)/2 + (r-d)*(r-d-1)/2);
    s[q].erase(d);
    return ret;
}

ll remove(int d, int q){
    ll ret = -a[d][q];
    set<int>::iterator it1 = s[q].find(d), it2 = it1;
    int l = *--it1, r = *++it2;
    ret += c[q]*((d-l)*(d-l-1)/2 + (r-d)*(r-d-1)/2);
    ret -= c[q]*(r-l)*(r-l-1)/2;
    return ret;
}

ll eval(int d, int q){
    return insert(d, q) + remove(d, now[d]);
}

void change(int d, int q){
    s[q].insert(d), s[now[d]].erase(d);
    now[d] = q;
}

int main(){
    int D;
    cin >> D;
    rep(i, 26){
        cin >> c[i];
        s[i].insert(-1), s[i].insert(D);
    }
    c[26] = 0;
    rep2(i, -1, D) s[26].insert(i);
    rep(i, D){
        rep(j, 26) cin >> a[i][j];
        a[i][26] = 0;
    }
    Random_Number_Generator rnd;

    rep(i, D) now[i] = 26;
    copy(all(now), ans.begin());

    int T = 300000;
    double start_temp = 3000, end_temp = 0;
    rep(t, T){
        ll M = -INF;
        int d = rnd(D), q = 0;
        rep(i, 26){
            if(i == now[d]) continue;
            if(chmax(M, eval(d, i))) q = i;
        }
        double temp = start_temp+(end_temp-start_temp)*t/T;
        double p = exp(M/temp);
        if(p > (rnd(INF)%INF)/double(INF)){
            change(d, q);
            sum += M;
            if(chmax(res, sum)) copy(all(now), ans.begin());
        }
    }

    rep(i, D) cout << min(26, ans[i]+1) << endl;
}

Measured memory_bytes: 4408
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	VI S(N);
	map<string, int>mp;
	vector<string>T(N);
	REP(i, N) {
		cin >> T[i] >> S[i];
		mp[T[i]] = i;
	}
	string X;
	cin >> X;
	int ans = 0;
	FOR(i, mp[X]+1, N) {
		ans += S[i];
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
/*--- AOJ 0008 ---*/

#include<stdio.h>

#define  NUM  100

int main(void)
{
	int a, b, c, d;
	int n;
	int sum = 0;

	while (scanf("%d", &n) != EOF) {
		for (a = 0; a < 10; a++) {
			for (b = 0; b < 10; b++) {
				for (c = 0; c < 10; c++) {
					for (d = 0; d < 10; d++) {
						if (n == a + b + c + d)
							sum++;
					}
				}
			}
		}
		printf("%d\n", sum);
		sum = 0;
	}

	return (0);
}

Measured memory_bytes: 596
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

const int MaxN = 100;

int n;
int a[MaxN + 1];

bool book[MaxN + 1];

inline bool count(int x, int up)
{
	int now = 0;
	for (int i = 1; i <= n && now < up; ++i)
		if (!book[i] && a[i] == x)
			++now, book[i] = true;
	return now == up;
}

inline bool solve()
{
	int l = *max_element(a + 1, a + n + 1);
	if (!count(l, 2))
		return false;

	if (l & 1)
	{
		int mid = (l + 1) / 2;
		for (int i = mid; i < l; ++i)
			if (!count(i, 2))
				return false;

		for (int i = 1; i <= n; ++i)
			if (!book[i] && a[i] <= mid)
				return false;
	}
	else
	{
		int mid = l / 2;
		for (int i = mid + 1; i < l; ++i)
			if (!count(i, 2))
				return false;

		if (!count(mid, 1))
			return false;

		for (int i = 1; i <= n; ++i)
			if (!book[i] && a[i] <= mid)
				return false;
	}

	return true;
}

int main()
{
	cin >> n;
	for (int i = 1; i <= n; ++i)
		cin >> a[i];

	puts(solve() ? "Possible" : "Impossible");

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<iomanip>
#include <set>
#include <vector>
#include <map>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
using namespace std;

const int NN=1e5+10;
const int mod=1e9+7;

int n;
struct Node{
    char str[60];
    int num[27];
}node[60];
char word[30]="abcdefghijklmnopqrstuvwxyz";

int main()
{
    scanf("%d",&n);
    int flag=0;
    memset(node,0,sizeof(node));
    for(int i=0;i<n;i++){
        scanf("%s",&node[i].str);
        int len=strlen(node[i].str);
        for(int j=0;j<len;j++){
            node[i].num[node[i].str[j]-'a']++;
        }
    }
    for(int i=0;i<26;i++){
        int Min=node[0].num[i];
        for(int j=1;j<n;j++){
            if(node[j].num[i]<Min){
                Min=node[j].num[i];
            }
        }
        for(int j=0;j<Min;j++){
            printf("%c",word[i]);
            flag=1;
        }
    }
    printf("\n");


}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int y = sc.nextInt();
    int z = sc.nextInt();
    int ans = 0;
    x -= z;
    while (x >= (y + z)) {
      ans++;
      x -= y + z;
    }
    System.out.println(ans);

  }
}

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

int main()
{
    long long X,Y,i;

    scanf("%lld %lld",&X,&Y);

    i = 0;

    while(X<=Y){
        X = X*2;
        i++;
    }

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

    return 0;
}

Measured memory_bytes: 128
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var n, k, s string
	fmt.Scan(&n, &k, &s)
	strSlice := strings.Split(s, "")
	i, _ := strconv.Atoi(k)
	strSlice[i-1] = strings.ToLower(strSlice[i-1])
	fmt.Println(strings.Join(strSlice, ""))
}


Measured memory_bytes: 640
import sys
import math
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
from collections import Counter
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#######ここから天ぷら########
n=int(input())
G=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

color=[-1 for i in range(n)]
color[0]=0
def coloring(x):
    for i in G[x]:
        if color[i] != -1:continue
        color[i]=1-color[x]
        coloring(i)
coloring(0)
A=[];B=[]
ans=[0 for i in range(n)]
for i in range(n):
    if color[i]==0:A.append(i)
    else:B.append(i)


if 1:
    if len(A)>len(B):
        A,B=B,A
    
    if len(A)<=n//3:
      qq=deque([i for i in range(3,n+1,3)]+[i for i in range(1,n+1,3)]+[i for i in range(2,n+1,3)])
      for i in A:
          ans[i]=qq.popleft()
      for i in B:
          ans[i]=qq.popleft()
      print(*ans)
      exit()
    
    else:
      qq=deque([i for i in range(1,n+1,3)]+[i for i in range(3,n+1,3)]+[i for i in range(2,n+1,3)])
      for i in A:
          ans[i]=qq.popleft()
      for i in B:
          ans[i]=qq.popleft()
      print(*ans)
      exit()

Measured memory_bytes: 167752
#define _USE_MATH_DEFINES  // M_PI等のフラグ

#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <vector>
#include <list>

#define MOD 1000000007
#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))

using namespace std;

string replace_with_str(string str, string str_from, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(str_from, pos), pos != string::npos) {
        str.replace(pos, str_from.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

/* リュカ数のメモ化 */
vector<int64_t> memo(87, -1);

int64_t L(int i) {
    /* i番目のリュカ数を返す */
    if (i==0) return memo.at(0);
    if (i==1) return memo.at(1);
    if (memo.at(i) == -1)
        memo.at(i) = L(i-1)+L(i-2);
    return memo.at(i);
}

void solve(){
    memo.at(0) = 2;
    memo.at(1) = 1;

    int N;
    cin >> N;

    int64_t ans = 0;

    cout << L(N) << endl;
}

int main(int argc, char const *argv[]){
    solve();
    return 0;
}

Measured memory_bytes: 3596
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){


}

Node treeSearch(Node u, int k){
  if( u == NIL || k == u->key){
    return u;
  }
  if( k < u->key ){
    return treeSearch( u->left, k);
  }else {
    return treeSearch( u->right, k);
  }

}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while( x != NIL ){
    y = x;
    if( z->key < x->key ){
      x = x->left;
    }else{
      x = x->right;
    }
  }

  z->parent = y;

  if( y == NIL ){
    root = z;
  }else if( z->key < y->key ){
    y->left = z;
  }else{
    y->right = z;
  }

}

void inorder(Node u){
  if( u == NIL ){
    return;
  }

  inorder(u->left);
  printf(" %d" ,u->key);
  inorder(u->right);  
}

void preorder(Node u){
  if( u == NIL ){
    return;
  }

  printf(" %d" ,u->key);
  preorder(u->left);
  preorder(u->right);  


}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 19364
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int PN[1000000];
bool isPrime[1300000];
int Index=0;
void Init(){
  for(int i=0;i<1300000;i++){
    isPrime[i] = false;
  }
  for(int i=3;i<1300000;i+=2)isPrime[i] = true;
  isPrime[2] = true;

  int lim = sqrt(1300000.0)+1;
  for(int i=3;i<=lim;i+=2){
    if(!isPrime[i])continue;
    for(int j=i+i;j<=1300000;j+=i){
      isPrime[j] = false;
    }
  }

  for(int i=2;i<1300000;i++){
    if(isPrime[i])PN[Index++] = i;
  }
}


int main(){
  int n,ans,sum;
  Init();
  while(cin >> n && n){
    ans = 0;
    for(int i=0;i<=n;i++){
      if(PN[i] > n)break;
      sum = 0;
      
      for(int j=i;j<=n;j++){
	sum += PN[j];
	if(sum == n){
	  ans++; break;
	}
	else if(sum > n)break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
var n,l,r,x,y,mid:longint;
var s,ls:string;
begin
  readln(n);
  writeln(0);flush(output);readln(s);
  if s='Vacant' then exit else
  if ((s='Male') and ((n+1) mod 4>0)) or ((s='Female') and ((n+1) mod 4=0))
  then x:=0;ls:=s;
  writeln(n-1);flush(output);readln(s);
  if s='Vacant' then exit else
  if ((s='Male') and ((n+1) mod 4>0)) or ((s='Female') and ((n+1) mod 4=0))
  then x:=n-1;
  l:=0;r:=n-1;
  while s<>'Vacant' do
  begin
    mid:=(l+r)>>1;writeln(mid);flush(output);readln(s);
    if s='Vacant' then exit;     {
    if ((n+1) mod 4=0) then begin
    if ((s='Male') and (x<mid)) or ((s='Female') and (x>mid)) then
    begin r:=mid;if x<mid then x:=r;continue;end;
    if ((s='Male') and (x>mid)) or ((s='Female') and (x<mid)) then
    begin l:=mid;if x>mid then x:=l;end;
    end else begin
    if ((s='Male') and (x<mid)) or ((s='Female') and (x>mid)) then
    begin l:=mid;if x<mid then x:=l;continue;end;
    if ((s='Male') and (x>mid)) or ((s='Female') and (x<mid)) then
    begin r:=mid;if x>mid then x:=r;end;}
    if mid-1=l then begin l:=mid;ls:=s;continue;end;
    if mid+1=r then begin r:=mid;continue;end;
    if ((mid-1-l) mod 2=0) then
    begin
      if ls<>s then begin l:=mid;ls:=s;end
      else r:=mid;
    end else begin if ls<>s then r:=mid else begin ls:=s;l:=mid;end;end;
  end;
end.


Measured memory_bytes: 724
def Ryuka(n):
    L = [2,1]
    for i in range(n-1):
        L.append(L[len(L)-1]+L[len(L)-2])

    return L[len(L)-1]

def main():
    N = int(input())
    print(Ryuka(N))

if __name__ == "__main__":
    main()


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N; cin >> N;
  ll N, L; cin >> N >> L;
  // ll x, y, z; cin >> x >> y >> z;
  // ll a, b, c; cin >> a >> b >> c;
  vector<string> s(N);rep(i, N)  cin >> s[i];
  // vector<ll> a(N); rep(i, N) cin >> a[i];
  sort(s.begin(), s.end());
  rep(i, N) {
    cout << s[i];
  }
  cout << endl;
  // ll ans = 0;
  // bool ok = false;

  // cout << ans << endl;
  // cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3632
n = int(input())
a = list(map(int, input().split()))

b = list(map(lambda x: x%4, a))
# print(b)
c1 = b.count(0)
c2 = b.count(2)
# print(c)
if c1 >= len(a)//2:
    print('Yes')
elif c2 >= len(a) - 2*c1:
    print('Yes')
else:
    print('No')

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define IREP(i, v) for (auto i = v.begin(); i != v.end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes()
{
    cout << "Yay!" << endl;
}
void no()
{
    cout << ":(" << endl;
}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b ;
    cin >> a >> b ;
    if(a<=8 && b<=8){
        yes() ;
    }
    else{
        no() ;
    }
    

    return 0;
}


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

int main()
{
  long long n;
  cin>>n;
  long long ans=0;
  long long k = sqrt(n)+1;
  for(long long i=k;i>=1;i--){
  	if(n%i==0){
    	ans=i+n/i-2;
        break;
    }
  }
  cout<<ans<<endl;
  
}

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

using namespace std;

int main()
{
    int a[3],k;

    cin>>a[0]>>a[1]>>a[2];
    cin>>k;
    sort(a,a+3);
    for(int i=1;i<=k;i++){
        a[2]=a[2]*2;
    }
    cout<<a[0]+a[1]+a[2];

    return 0;
}


Measured memory_bytes: 3620
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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 div_round_up(int x, int div) {
    return (x + div - 1) / div;
}

int main(void) {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    int m = div_round_up(A, D);
    int n = div_round_up(C, B);

    if (m >= n) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3568
#include <iostream>
#include <algorithm>
#include <numeric>
#include <map>
#include <vector>
#include <climits>

int main(void) {
  long long int A,B,C,X,Y;
  std::cin >> A >> B >> C >> X >> Y;
  
  /* minimize(A*x + B*y + C*z)
     s.t X := x + z/2
         Y := y + z/2
         1 <= A,B,C <= 5000
         1 <= X,Y <= 10^5
  */

  long long int minsum = LLONG_MAX;
  for (int z = 0; z <= 2*100000; ++z) {
    long long int x = X - z/2;
    long long int y = Y - z/2;
    if (x < 0) {
      x = 0;
    }
    if (y < 0) {
      y = 0;
    }
    long long int sum = A * x + B * y + C * z;
    if (minsum > sum) {
      minsum = sum;
    }
  }

  std::cout << minsum << std::endl;
  return 0;
}


Measured memory_bytes: 256
// Pratiyush Mishra(pratiush7)
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define repab(i,a,b) for(ll i=a;i<=b;i++)
#define ull unsigned long long int
#define ll long long int
#define LL_MAX 9223372036854775807
#define pb push_back
#define pf push_front
#define mp make_pair
#define popb pop_back
#define vl vector<ll>
#define bs(v,x) binary_search(v.begin(),v.end(),x)
#define popf pop_front
#define p() cout<<'\n'
#define p0(x) cout<<x<<" "
#define p1(x) cout<<x<<'\n'
#define p2(x,y) cout<<x<<" "<<y<<'\n'
#define p3(x,y,z) cout<<x<<" "<<y<<" "<<z<<'\n'
#define pr1(x) cout<<fixed<<setprecision(15)<<x<<'\n'
#define mod 1000000007
#define mod1 998244353
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define get(n) ll n;cin>>n
#define getvec(v,n) vector<ll> v(n);for(ll i=0;i<n;i++) cin>>v[i];
#define getstr(s) string s;cin>>s
#define all(x) x.begin(),x.end()
#define countBits(x) __builtin_popcount (x)
using namespace std;

void permute(vector<vl> &v,vector<ll> x,ll l,ll r){
  if(l==r){
    v.pb(x);
    return;
  }
  for(ll i=l;i<=r;i++){
    swap(x[l],x[i]);
    permute(v,x,l+1,r);
    swap(x[l],x[i]);
  }
}

int main(){
  fio;
  get(n);
  getvec(v1,n);getvec(v2,n);
  vector<vl> v;
  permute(v,v1,0,n-1);
  sort(all(v));
  ll a=lower_bound(all(v),v1)-v.begin();
  ll b=lower_bound(all(v),v2)-v.begin();
  ll ans=abs(a-b);
  p1(ans);
  return 0;
}


Measured memory_bytes: 4408
n = int(input())
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
abs_list = [abs(a-b) for a,b in zip(x,y)]
p1 = p2 = p3 = p4 = 0
for a in abs_list:
    p1 += a
    p2 += a**2
    p3 += a**3
p2 = p2 **(1/2)
p3 = p3 **(1/3)
p4 = max(abs_list)
preanswer = [p1,p2,p3,p4]
answer = ['{:.6f}'.format(i) for i in preanswer]
for a in answer:
    print(a)



Measured memory_bytes: 5648
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;

int main() {
    int N;
    cin >> N;
    map<int, int> cnt;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        cnt[a]++;
    }

    vector<pair<int, int>> vp;
    for (auto p : cnt) {
        vp.push_back(p);
    }

    int n = vp.size();
    ll l = 0, r = 0;
    for (int i = n - 1; i >= 0; i--) {
        // cout << vp[i].first << " " << vp[i].second << " ";
        if (l == 0) {
            if (vp[i].second >= 4) {
                l = vp[i].first;
                r = vp[i].first;
            } else if (vp[i].second >= 2) {
                l = vp[i].first;
            }
        } else if (r == 0) {
            if (vp[i].second >= 2) {
                r = vp[i].first;
            }
        }
        // cout << l << " " << r << endl;
        if (l * r != 0) {
            cout << l * r << endl;
            return 0;
        }
    }
    cout << 0 << endl;
}


Measured memory_bytes: 6136
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=1e9+7;
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}
template<typename T>
void chmax(T &a,T b){
  if(a<b)a=b;
}

signed main(){
  int n;cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  map<int,int> m;
  for(int i=0;i<n;i++){
    int tmp=v[i];
    for(int j=2;j*j<=tmp;j++){
      int cnt=0;
      while(tmp%j==0){
        tmp/=j;
        cnt++;
      }
      chmax(m[j],cnt);
    }
    chmax(m[tmp],1LL);
  }
  int lcm=1;
  for(auto p:m){
    lcm*=pw(p.first,p.second);
    lcm%=MOD;
  }
  int ans=0;
  for(int p:v)ans+=lcm*pw(p,MOD-2),ans%=MOD;
  cout<<ans%MOD<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S max_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 main(){
  int A, B, res;
  rd(A);
  rd(B);
  res =max_L(max_L(A+B, A-B), A*B);
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// {
//   int A, B, res;
//   rd(A,B);
//   res = max(A+B, A-B, A*B);
//   wt(res);
// }


Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * 2962.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

/* global variables */

char s[MAX_N + 4];

/* subroutines */

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

void or_expr(char *(&cpt), int &a0, int &a1);

void term(char *(&cpt), int &a0, int &a1) {
  int pos = cpt - s;
  if (*cpt == '(') {
    cpt++; // '('
    or_expr(cpt, a0, a1);
    cpt++; // ')'
  }
  else {
    cpt++; // '?'
    a0 = a1 = 1;
  }
  //printf("term(%d)=(%d,%d)\n", pos, a0, a1);
}

void and_expr(char *(&cpt), int &a0, int &a1) {
  int pos = cpt - s;
  term(cpt, a0, a1);
  while (*cpt == '&') {
    cpt++; // '&'
    int b0, b1;
    term(cpt, b0, b1);
    setmin(a0, a1 + b0);
    a1 += b1;
  }
  //printf("and_expr(%d)=(%d,%d)\n", pos, a0, a1);
}

void or_expr(char *(&cpt), int &a0, int &a1) {
  int pos = cpt - s;
  and_expr(cpt, a0, a1);
  while (*cpt == '|') {
    cpt++; // '|'
    int b0, b1;
    and_expr(cpt, b0, b1);
    setmin(a1, a0 + b1);
    a0 += b0;
  }
  //printf("or_expr(%d)=(%d,%d)\n", pos, a0, a1);
}

/* main */

int main() {
  scanf("%s", s);

  char *cpt = s;
  int a0, a1;
  or_expr(cpt, a0, a1);
  printf("%d %d\n", a0, a1);
  return 0;
}



Measured memory_bytes: 3420
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
//*********************************************DO IT NOW****************************************************************
#include<bits/stdc++.h> 
#include<random>
#define int long long   
#define pp pair<int,int> 
#define ss second 
#define ff first 
#define pb push_back
#define mod 1000000009
#define pi 3.14159265359
#define mk(arr,n,type)  type *arr=new type[n];
#define sl s1.length();
#define yes cout<< "YES"<<endl
#define no  cout<< "NO"<<endl
#define all(v) (v).begin(),(v).end()
#define s(v)   sort(v,v+n)
#define  mt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define read(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define print(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" "
#define for1(i,a,n)  for(int i=0;i<n;i++)
#define rep(i, c) for(int i = 0; i < (int)c; i++)
using namespace std;
//**********************************************DO IT NOW***************************************************************
void fastio()
{  
  #ifndef ONLINE_JUDGE
  freopen("INPUT.txt","r",stdin);
  freopen("OUTPUT.txt","w",stdout); 
  #endif
  ios_base :: sync_with_stdio(false); 
  cin.tie(NULL) ; 
  cout.tie(NULL);
}
int dp[101][1001],ans1=1e9,dp1[1000001];
int num[10];
signed main()
{   
    fastio();
    int t=1;
//    cin>>t;
    while(t--)
    { 
      int n;
      cin>>n;
      double x=(n+1)/2;
      double xx=x/n;
      cout<<fixed<<setprecision(10)<<xx;
    }
}

    
// 🍪 🍪 🍪


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<ll>> matrix;

ll a[100005];
ll b[100005];

void solve() {
  int n;
  cin >> n;
  for(int i = 0; i < n; i++) cin >> a[i];
  for(int i = 0; i < n; i++) cin >> b[i];
  vector<int> diffs;
  for(int i = 0; i < n; i++) {
    diffs.push_back(b[i] - a[i]);
  }
  // negative are bad
  sort(diffs.begin(), diffs.end());
  int ret = 0;
  ll change = 0;
  for(int i = 0; i < diffs.size(); i++) {
    if(diffs[i] > 0) {
      ret++;
      change += diffs[i];
    }
  }
  for(int i = 0; i < diffs.size() && change > 0; i++) {
    if(diffs[i] < 0) {
      ret++;
      change += diffs[i];
    }
  }
  if(change > 0) ret = -1;
  cout << ret << endl;
}

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


Measured memory_bytes: 2428
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<functional>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

// bit
template<typename T, int NN>
struct bit {
  typedef std::function<T(T,T)> OP;
  T data_[NN], e_; // 0-base
  OP& op_;
  bit(OP& op, T e) : e_(e), op_(op) { std::fill_n(data_, NN, e_); }
  int lb(int i){ return i&-i; }
  T query(int i) { // 1-base
    T res = e_;
    while(i > 0) { res = op_(res, data_[i-1]); i -= lb(i); }
    return res;
  }
  void add(int i, T const& v) { // 1-base
    while(i <= NN) { data_[i-1] = op_(data_[i-1], v); i += lb(i); }
  }
};

using bit2k = bit<int, 2048>;
bit2k::OP min_op = [](int x, int y){ return std::min(x, y); };
bit2k::OP max_op = [](int x, int y){ return std::max(x, y); };

int const INF = 1e9+5;

int main() {
  int N; std::cin >> N;
  std::vector<int> a(N+2);
  for(int i = 0; i < N+2; ++i) std::cin >> a[i];
  
  std::vector<bit2k> xy(N+1, bit2k(min_op,  INF));
  std::vector<bit2k> yx(N+1, bit2k(max_op, -INF));
  for(int y = N; y >= 1; --y) {
    for(int x = N; x > y; --x) { // play for Y
      int res = std::abs(a[N+1] - a[x]);
      res = std::min(res, xy[x].query(N-x));
      yx[y].add(N+1-x, res);
    }
    for(int x = y-1; x >= 0; --x) { // play for X
      int res = std::abs(a[N+1] - a[y]);
      res = std::max(res, yx[y].query(N-y));
      if(y==1 && x==0) fin(res);
      xy[x].add(N+1-y, res);
    }
  }
  return 0;
}


Measured memory_bytes: 32384
#include <stdio.h>

#define  MAX 10000

int main(int argc, char *argv[]) {
	
	int in[MAX] = { 0 };
	int i = 0;
	
	do{
		fscanf(stdin, "%d", &in[i]);
		i++;
	}while(in[i-1] != 0);
	
	i = 0;
	while(in[i] != 0) {
		fprintf(stdout, "Case %d: %d\n", i+1, in[i]);
		i++;
	}
	
	return 0;
	
}

Measured memory_bytes: 648
def soin(num):
    re = []
    div = 2
    while 1:
        lim = int(num ** 0.5) + 1
        while num % div:
            div += 1
            if div > lim:
                re += [1]
                return re
        sisu = 0
        while num % div == 0:
            num //= div
            sisu += 1
        re += [sisu]
        if num == 1:
            return re


def com(a, b):
    if a == b:
        return 1
    t = (a, b)
    if (a, b) in com_memo:
        return com_memo[t]
    re = com(a - 1, b) * a // (a - b)
    com_memo[t] = re
    return re


def f(n, m):
    sisus = soin(m)
    ans = 1
    for s in sisus:
        ans = ans * com(s + n - 1, n - 1) % md
    print(ans)


md = 10 ** 9 + 7
n, m = map(int, input().split())
if m==1:
    print(1)
    exit()
com_memo = {}
f(n, m)


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

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

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);

int n, k;
string s;

vector<int> block;
int num[MAX_N];

int ans;

int main(void) {
  // Here your code !
  scanf("%d %d", &n, &k);

  cin >> s;

  for (int i = 0; i < n; ++i) {
    if (s[i] == '0') {
      if (i == 0 || s[i - 1] == '1') {
        num[i] = 1;
      }
    }
  }

  for (int i = 1; i < n; ++i) {
    num[i] += num[i - 1];
  }

  num[n] = num[n - 1] + 1;

  int cnt = num[n - 1];

  if (k >= cnt) {
    printf("%d\n", n);
    return 0;
  }

  ans = -1;

  for (int i = 0; i < n; ++i) {
    int add = (s[i] == '0') ? k - 1 : k; // already using 0 part

    auto itr = upper_bound(num + i, num + n + 1, num[i] + add);

    int ind = (itr - num) - 1;

    if (num[ind] - num[i] != add) continue;

    int score = ind - i + 1;

    ans = max(ans, score);
  }

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

  return 0;
}


Measured memory_bytes: 896