akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		List<Integer> x =new ArrayList<Integer>();
		String str=" ";

	for(int h=0 ;; h++){
		str=scan.next();
		if(str.equals("0"))break;
		char[] chr= str.toCharArray();
		x.add(h,0);
		for(int i=0;i<chr.length;i++){
			x.set(h,x.get(h)+Integer.parseInt(String.valueOf(chr[i])));
		}
	}

		for(int data:x){
			System.out.println(data);
		}

	}

	}

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

cnt4 = 0
cnt2 = 0
for i in a:
    if i % 4 == 0:
        cnt4 += 1
    elif i % 2 == 0:
        cnt2 += 1

if cnt4 >= n//2:
    print('Yes')
elif 2 * cnt4 >= n - cnt2:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 20132
coin500 = int(input())
coin100 = int(input())
coin50 = int(input())
X = int(input())
count = 0

for i in range(coin500, -1, -1):
    if i*500 > X:
        continue
    for j in range(coin100, -1, -1):
        if i*500 + j*100 > X:
            continue
        for k in range(coin50, -1, -1):
            if 500*i+100*j+50*k == X:
                count += 1
print(count)

Measured memory_bytes: 3064
#!/usr/bin/env python3
import sys
INF = float("inf")


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


def solve(N: int, K: int, A: "List[int]"):
    tot = sum(A)
    divs = make_divisors(sum(A))

    m = 1
    for cand in divs[1:]:
        modA = sorted([a % cand for a in A])
        counter = 0
        left = 0
        while left < N and modA[left] == 0:
            left += 1
        right = N-1
        while left < right:
            smaller = min(modA[left], cand - modA[right])
            modA[left] -= smaller
            modA[right] += smaller
            counter += smaller
            if modA[left] == 0:
                left += 1
            if modA[right] == cand:
                right -= 1
        if counter <= K:
            m = cand

    print(m)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, A)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
D=[1<<99]*K=gets.to_i
q=[D[1]=1]
while n=q.shift;[[n*10%K,0,:unshift],[-~n%K,1,:<<]].each{|e,d,m|(D[e]>x=D[n]+d)&&(D[e]=x;q.send(m,e))};end
p D[0]

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

using namespace std;

typedef long long ll;
const double eps=1e-6,pi=acos(-1);
const int N=1e6+5,M=1e9+7,SEGM=4*N,OO=0x3f3f3f3f;
int t,n,m,k;
int arr[N];
int mem[N][2][2];

int solve(int i,int z,int o){
    if(i==n) return z&&o;
    int &ret=mem[i][z][o];
    if(~ret) return ret;
    ret=(solve(i+1,1,o)%M+solve(i+1,z,1)%M)%M;
    for(int j=1;j<9;++j)
        ret=(ret%M+solve(i+1,z,o)%M)%M;
    return ret;
}

int main(){
    //freopen("myfile.txt","w",stdout);
    scanf("%d",&n);
    memset(mem,-1,sizeof mem);
    printf("%d",solve(0,0,0));
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define each(it,v) for(auto &it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vl vector<long>
#define P pair<int,int>
using namespace std;

main()
{
        char a,b; cin>>a>>b;
        if(a>b)cout<<'>'<<endl;
        else if(a<b)cout<<'<'<<endl;
        else cout<<"="<<endl;
}

Measured memory_bytes: 256
import numpy as np
A, B, C, D = [int(i) for i in input().split()]

large = np.max([C, D])
small = np.min([C, D])

g = large
while small != 0:
    large, small = small, large % small

g = large

l = C * D // g

num_B_1 = B // C
num_B_2 = B // D
num_B_3 = B // l
num_B = B - (num_B_1 + num_B_2 - num_B_3)

num_A_1 = (A - 1) // C
num_A_2 = (A - 1) // D
num_A_3 = (A - 1) // l
num_A = (A - 1) - (num_A_1 + num_A_2 - num_A_3)

print(num_B - num_A)

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

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

  if (N.at(0) == '7' || N.at(1) == '7' || N.at(2) == '7')
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
}
int main(){
    ll n;cin >> n;ll k;cin >> k;
    string s;cin >> s;
    ll res=0;
    rep(i,n){
        if(s[i]=='L'){
            if(i>0&&s[i-1]=='L')res++;
        }
        else{
            if(i<n-1&&s[i+1]=='R')res++;
        }
    }
    cout << min(n-1,res+k*2) <<endl;
}


Measured memory_bytes: 3756
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
#include<functional>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

constexpr int MAX_SIZE = 1010101;
template <typename T>
class SegTree {
private:
	int n;
	const function<T(T, T)> op; // 演算
	const T ie; // 演算の単位元
	T seq[MAX_SIZE];

public:
	/// op: 演算, ie: 演算の単位元
	SegTree(int _n, function<T(T, T)> op, const T ie) : op(op), ie(ie) {
		n = 1;
		while(n < _n) n *= 2;
		for(int i = 0; i < 2 * n - 1; i++) seq[i] = ie;
	}

	/// k 番目(0-indexed)の要素を e で更新
	void update(int k, const T e) {
		k += n - 1;
		seq[k] = e;
		while(k > 0) {
			k = (k - 1) / 2;
			seq[k] = op(seq[k * 2 + 1], seq[k * 2 + 2]);
		}
	}

	// k 番目(0-indexed)の要素を取得
	T get(int k) {
		k += n - 1;
		return seq[k];
	}

	/// [a, b) 番目(0-indexed)の要素全体の演算結果を返す
	T query(int a, int b, int k = 0, int l = 0, int r = -1) {
		if(r == -1) r = n;
		if(r <= a || b <= l) return ie;
		if(a <= l && r <= b) return seq[k];
		T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return op(vl, vr);
	}
};
// [Range Sum Query] op: [] (long long a, long long b) { return a + b; }, ie: 0
// [Range Maximum Query] op: [] (long long a, long long b) { return max(a, b); }, ie: -1e18
// [Range Minimum Query] op: [] (long long a, long long b) { return min(a, b); }, ie: 1e18

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<ll> h(n);
	vector<ll> a(n);
	REP(i, n) cin >> h[i];
	REP(i, n) cin >> a[i];
	SegTree<ll> seg(n + 1, [] (long long a, long long b) { return max(a, b); }, 0);
	REP(i, n) {
		seg.update(h[i], seg.query(0, h[i]) + a[i]);
	}
	cout << seg.query(0, n + 1) << endl;
	return 0;
}

/* --------------------------------------- */


Measured memory_bytes: 9216
#!/usr/bin python3
# -*- coding: utf-8 -*-

k = int(input())
if k%2==0 or k%5==0:
    print(-1)
else:
    ret = 1
    res = 7%k
    while res != 0:
        res = (res * 10 + 7) % k
        ret += 1
    print(ret)


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

int main() {
  int h, w;
  char t;
  cin >> h >> w;
  vector<vector<bool>> a(h+1, vector<bool>(w+1, 0));
  rep(i,h){
    int s=0;
    rep(j,w+1){
      if(j<w){
        cin >> t;
        if(t == '#'){
          a.at(i).at(j) = 1;
          s++;
        }
      }else a.at(i).at(j) = s;
    }
  }
  rep(j,w){
    int s=0;
    rep(i,h) s += a.at(i).at(j);
    a.at(h).at(j) = s;
  }
  
  rep(i,h){
    if(a.at(i).at(w)) rep(j,w){
      if(a.at(h).at(j)){
        if(a.at(i).at(j)) cout << '#';
        else cout << '.';
      }
      if(j == w-1) cout << endl;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;

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

  ll n, w;
  cin >> n >> w;
  vector<ll> x(n), v(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> v[i];
  }
  vector<vector<ll>> dp(n + 1, vector<ll>(w + 1));
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= w; ++j) {
      dp[i][j] = dp[i - 1][j];
      if (x[i - 1] <= j) {
        dp[i][j] = max(dp[i][j], dp[i - 1][j - x[i - 1]] + v[i - 1]);
      }
    }
  }
  cout << dp[n][w];
}


Measured memory_bytes: 80256
# include <cmath>
# include <iostream>
# include <vector>


using namespace std;


int main() {
    int n; cin >> n;
    vector<int> v(n), c(n);
    for (int i=0; i<n; ++i) cin >> v[i];
    for (int i=0; i<n; ++i) cin >> c[i];

    int k = pow(2, n);
    int x, y;
    int ans = 0;
    for (int i=0; i<k; ++i) {
        x = 0; y = 0;
        for (int j=0; j<n; ++j) {
            if ((i>>j) & 1) {
                x += v[j];
                y += c[j];
            }
        }
        ans = max(ans, x-y);
    }

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
// J'aime
// Chemise Blanche

#include <bits/stdc++.h>
using namespace std;

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  string s;
  cin >> s;
  int ans = 0;
  for (auto &i : s) {
    if (i == '2') ans++;
  }
  cout << ans << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        for(int i  = 0; i < str.length(); i++){
            char c = str.charAt(i);
            if(Character.isUpperCase(c)){
                c = Character.toLowerCase(c);
            }else if(Character.isLowerCase(c)){
                c = Character.toUpperCase(c);
            }
            System.out.print(c);
        }
        System.out.println();
        sc.close();
    }    
}


Measured memory_bytes: 26988
fn read() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf
}

fn gcd(a: usize, b: usize) -> usize {
    let mut m = a;
    let mut n = b;
    let shift = (m | n).trailing_zeros();
    n >>= n.trailing_zeros();
    while m != 0 {
        m >>= m.trailing_zeros();
        if n > m {
            std::mem::swap(&mut n, &mut m)
        }
        m -= n;
    }
    n << shift
}

fn main() {
    let _ = read();
    let a: Vec<usize> = read()
        .trim()
        .split(' ')
        .map(|x| x.parse().unwrap())
        .collect();

    let mut ans = a[0];
    for hp in a {
        ans = gcd(ans, hp);
    }
    println!("{}", ans);
}


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

int main() {
    int n; cin >> n;
    long long ans = 0;

    for (int i = 1; i < n; ++i) {  
        for (int j = i; j < n; j += i)  
            ans++;  
    }

    cout << ans << '\n';
}


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

int main(){
	int n,k;
	cin >> n >> k;
	vector<int> l(n);
	rep(i,n) cin >> l[i];
	int ans = 0;
	sort(l.begin(),l.end(),greater<int>());
	rep(i,k) ans += l[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
 		
int main() {

int N;
vecl(A)
map<ll,ll> S;
cin>>N;
fx(N){
	vecpl(A)
	S[A.at(x)]++;
}
sorts(A)
reverses(A)
ll area=0;
fx(N){
	if(S[A.at(x)]>=4){
		if(A.at(x)!=area){
			if(area==0){
				area=A.at(x)*A.at(x);
			}else{
				area*=A.at(x);
			}
			break;
		}
	}else if(S[A.at(x)]>=2){
      		if(A.at(x)!=area){
		if(area==0){
				area=A.at(x);
			}else{
				area*=A.at(x);
				break;
			}
            }
	}
}
ce(area)
	
}

Measured memory_bytes: 8820
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
 
a,b,n=n1()
import math
if b<=n:
    i=b-1
else:
    i=n
m=math.floor((a*i)/b)-a*math.floor(i//b)
print(m)


Measured memory_bytes: 9200
using System;
using System.Collections.Generic;
using System.Linq;

class Solution
{
    static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        int h = vals[0];
        int w = vals[1];
        var n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var array = new List<int>();
        for(int t = 0; t < a.Length;t++)
        {
            array.AddRange(Enumerable.Repeat(t + 1, a[t]));
        }

        var grid = Enumerable.Range(0, h).Select(_ => new int[w]).ToArray();
        int i = 0;
        bool sw = true;
        for(int y = 0; y < h;y++)
        {
            if (sw)
            {
                for (int x = 0; x < w; x++)
                {
                    grid[y][x] = array[i++];
                }
            }
            else
            {
                for (int x = w-1; x >= 0; x--)
                {
                    grid[y][x] = array[i++];
                }
            }
            sw ^= true;
        }

        foreach (var row in grid)
        {
            Console.WriteLine(string.Join(" ", row));
        }
    }
}

Measured memory_bytes: 13524
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
struct S{
  int c0;
  int c1;
  int64_t inv;
};
S op(S a,S b){
  S ab;
  ab.c0=a.c0+b.c0;
  ab.c1=a.c1+b.c1;
  ab.inv=a.inv+b.inv+(int64_t)a.c1*b.c0;
  return ab;
}
S e(){
  S a;
  a.c0=0;
  a.c1=0;
  a.inv=0;
  return a;
}
S app(bool f,S s){
  if(!f)
    return s;
  S fs;
  fs.c0=s.c1;
  fs.c1=s.c0;
  fs.inv=(int64_t)s.c0*s.c1-s.inv;
  return fs;
}
bool com(bool f,bool g){
  return f^g;
}
bool id(){
  return 0;
}
int main(){
  int n,q;
  cin>>n>>q;
  vector<S> a(n);
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    a.at(i).c0=1-x;
    a.at(i).c1=x;
    a.at(i).inv=0;
  }
  lazy_segtree<S,op,e,bool,app,com,id> ls(a);
  for(int _=0;_<q;_++){
    int t,l,r;
    cin>>t>>l>>r;
    l--;
    if(t==1)
      ls.apply(l,r,1);
    if(t==2)
      cout<<ls.prod(l,r).inv<<endl;
  }
}

Measured memory_bytes: 14636
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define in(e,l) (std::find(l.begin(), l.end(), e) != l.end())
#define asort(l) (std::sort(l.begin(), l.end()))
#define dsort(l) (std::sort(l.rbegin(), l.rend()))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;

int main() {
  ll N, K;
  cin >> N >> K;
  string S;
  cin >> S;
  
  char std = S[0] == 'L' ? 'R' : 'L' ;
  while(K > 0 && S.find(std) != -1) {
    ll index = S.find(std);
    while(true) {
      if(S[index] == 'L') {
        S[index] = 'R';
      }else{
        S[index] = 'L';
      }
      ++index;
      if(index >= sz(S) || S[index] != std){
        break;
      }
    }
    --K;
  }
  ll ans = 0;
  char pre = S[0];
  rep(i, N-1){
    char t = S[i+1];
    if(pre == t) {
      ++ans;
    }
    pre = t;
  }
  cout << ans << endl;
  return 0;
}



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

int main()
{
    
    while(true){
        int N;
        cin>>N;
        
        if(N==0){
            break;
        }
        if(N%1111==0){
            cout<<"NA"<<endl;
            continue;
        }
        
        int cnt = 0;
        
        while(N!=6174){
            int n[4];
            n[0] = N/1000;
            n[1] = N/100%10;
            n[2] = N/10%10;
            n[3] = N%10;
            
            sort(n, n+4);
            
            int L=n[3]*1000+n[2]*100+n[1]*10+n[0];
            int S=n[0]*1000+n[1]*100+n[2]*10+n[3];
            
            N=L-S;
            cnt++;
        }
        
        cout<<cnt<<endl;
            
    }
    
    return 0;
}

Measured memory_bytes: 1180
#include <iostream>
#include<iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout<< "YES"<<endl;
#define No cout<< "No"<<endl;
#define Yes cout<< "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define space ' '
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn = 100000;

int main(){
    double n;
    cin >> n;
    double odd=0;
    for(int i=1;i<=n;i++){
        if(i%2==1){
            odd++;
        }
    }
    
    cout << odd/n<<endl;
    
    return 0;
}


Measured memory_bytes: 256
N=int(input())
a=list(map(int,input().split()))
b,c=[],0
b.append(len([a for a in a if a<400]))
b.append(len([a for a in a if a<800 and a>=400]))
b.append(len([a for a in a if a<1200 and a>=800]))
b.append(len([a for a in a if a<1600 and a>=1200]))
b.append(len([a for a in a if a<2000 and a>=1600]))
b.append(len([a for a in a if a<2400 and a>=2000]))
b.append(len([a for a in a if a<2800 and a>=2400]))
b.append(len([a for a in a if a<3200 and a>=2800]))
b.append(len([a for a in a if a>=3200]))
for i in range(8):
    if b[i]>0:
        c+=1
if b[8]>0:
    if c==0:
        print(1,b[8])
    else:        
        print(c,c+b[8])
else:
    print(c,c)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
  int a[100]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << a[k-1] << endl;
}

Measured memory_bytes: 3612
using namespace std;
#include<bits/stdc++.h>
int main()
{
  long x,y,count=0;
  cin>>x>>y;
  if(x==1)
  {
    count = 300000;
  }
  if(x==2)
  {
    count = 200000;
  }
  if(x==3)
  {
    count = 100000;
  }
  if(y==1)
  {
    count = count+300000;
  }
  if(y==2)
  {
    count = count+200000;
  }
  if(y==3)
  {
    count = count+100000;
  }
  if(x==1&&y==1)
  {
    count=count+400000;
  }
  cout<<count;
}


Measured memory_bytes: 256
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}
import Data.Char (isSpace)
import Data.List (unfoldr, sort)
import qualified Data.ByteString.Char8 as BS
import Data.Coerce (coerce)
import Data.Ord (Down(..))

sortDown :: forall a. Ord a => [a] -> [a]
sortDown = coerce (sort :: [Down a] -> [Down a])

main = do
  n :: Int <- readLn
  xs <- sortDown . unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  let solve !d [] = d
      solve !d [x] = x + d
      solve !d (x:y:xs) = solve (d + x - y) xs
  print $ solve 0 xs


Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,k;
    scanf("%d%d%d",&k,&a,&b);
    for (int i = a; i <= b; i++){
        if (i % k == 0){
            printf("OK");
            return 0;
        }
    }
    printf("NG");
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int A, B, C, K, ans = 0;
	cin >> A >> B >> C >> K;
	while(K > 0 && A > 0)
	{
		K--;
		A--;
		ans++;
	}
	while(K > 0 && B > 0)
	{
		K--;
		B--;
	}
	while(K > 0 && C > 0)
	{
		K--;
		C--;
		ans--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3624
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    boolean[] p = new boolean[n];
    for(int i = 0;i<n;i++){
      if(i+1==sc.nextInt()){
        p[i]=false;
      }else{
        p[i]=true;
      }
    }
    int count = 0;
    for(int i = 0;i<n-1;i++){
      if(p[i]==false&&p[i+1]==false){
        p[i]=true;
        p[i+1]=true;
        count++;
      }
    }
    for(int i = 0;i<n;i++){
      if(p[i]==false)count++;
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 58560
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

ll N, K;
ll A[505];

bool check(ll a){
  vector<ll> arr1(N);
  vector<ll> arr2(N);
  ll sum1 = 0;
  ll sum2 = 0;
  for(int i=0;i<N;++i){
    arr2[i] = A[i]%a;
    arr1[i] = (a - (A[i]%a))%a;
    sum1 += arr1[i];
    sum2 += arr2[i];
  }
  sort(arr1.begin(), arr1.end());
  ll ans1;
  ll sum = 0;
  if(sum>=sum2) return true;
  for(int i=0;i<N;++i){
    sum += arr1[i];
    sum2 -= (a-arr1[i])%a;
    if(sum>=sum2) {
      ans1 = sum;
      break;
    }
  }
  if(ans1<=K) return true;
  else return false;
}

int main() {
  cin>>N>>K;
  ll sum = 0;
  for(int i=0;i<N;++i) {
    cin>>A[i];
    sum += A[i];
  }
  ll ans = 1;
  for(ll i=1;i*i<=sum;++i){
    if(sum%i==0){
      if(check(i)) ans = max(ans, i);
      if(check(sum/i)) ans = max(ans, sum/i);
    }
  }
  cout<<ans<<endl;
}



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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll ans=1;
    ll n,c,k;cin >>n>>c>>k;
    vector<int>t(n);
    for (int i = 0; i < n; ++i)cin >>t[i];
    sort(all(t));
    int s=t[0];
    int ride=0;
    int i=0;
    while(i<n){
        if(t[i]-s>k||ride>=c){
            ans++;
            s=t[i];
            ride=1;
            i++;
//            cout <<s<<endl;
        }
        else {
            ride++;
            i++;
        }
    }
    cout <<ans <<endl;
}


Measured memory_bytes: 3780
using System;
using System.Collections.Generic;
using static Assistant.Input;
using System.Linq;
using Assistant;

namespace エクサウィザーズC
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt;
            var Q = ReadInt;

            var S = Console.ReadLine();
            S = 'a' + S + 'a';

            char[] t = new char[Q];
            char[] d = new char[Q];
            for (int i = 0; i < Q; i++)
            {
                var input = Console.ReadLine().Split();
                t[i] = input[0][0];
                d[i] = input[1][0];
            }

            int ansL = 0;
            int l1 = 0;
            int r1 = N + 2;
            while (r1 - l1 > 1)
            {
                int mid = (l1 + r1) / 2;

                int final = mid;
                for (int i = 0; i < Q; i++)
                {
                    if (t[i] == S[final])
                    {
                        if (d[i] == 'R') final++;
                        else final--;
                    }
                }
                if (final != 0) r1 = mid;
                else l1 = mid;
            }
            ansL = l1;

            int ansR = 0;
            int l2 = 0;
            int r2 = N + 2;
            while (r2 - l2 > 1)
            {
                int mid = (l2 + r2) / 2;

                int final = mid;
                for (int i = 0; i < Q; i++)
                {
                    if (t[i] == S[final])
                    {
                        if (d[i] == 'R') final++;
                        else final--;
                    }
                }
                if (final != N + 1) l2 = mid;
                else r2 = mid;
            }
            ansR = N + 1 - r2;

            Console.WriteLine(N - ansL - ansR);
        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] NextLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    static class Debug
    {
        //drawmap
        //drawarray
    }
}


Measured memory_bytes: 18880
n = int(input())
X = list(map(int,input().split()))
Temp = X.copy()

Temp.sort()
temp = int((Temp[int(n/2)-1]+Temp[int(n/2)])/2)
for x in X:
    if x == Temp[int(n/2)-1]:
        print(Temp[int(n/2)])
    elif x == Temp[int(n/2)]:
        print(Temp[int(n/2)-1])
    elif x < temp:
        print(Temp[int(n/2)])
    else:
        print(Temp[int(n/2)-1])

Measured memory_bytes: 26180
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 1000000000000000000ll
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}

// string to integer stuuu()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long  
///////

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n;
	cin>>n;
	vector<int> gr[n+1];
	for(int i=0;i<n-1;++i)
	{
		int x,y;
		cin>>x>>y;
		gr[x].push_back(y);
		gr[y].push_back(x);
	}
	pair<int,int> p[n];
	for(int i=0;i<n;++i)
	{
		cin>>p[i].F;
		p[i].F=-p[i].F;
		p[i].S=i+1;
	}
	sort(p,p+n);
	queue<int> q;
	q.push(1);
	int ans[n+1];
	int x=0;
	int vis[n+1]={};
	int to=0;
	for(int i=1;i<n;++i)
		to+=-p[i].F;
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		if(vis[u])
			continue;
		ans[u]=-p[x].F;
		vis[u]=1;
		++x;
		for(auto r:gr[u])
		{
			q.push(r);
		}
	}
	cout<<to<<"\n";
	for(int i=1;i<=n;++i)
	{
		cout<<ans[i]<<" ";
	}
}

Measured memory_bytes: 1408
def main():
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())
    cons = abs(A-B)
    vg = V - W
    if vg <= 0:
        print('NO')
        return
    if cons > T*vg:
        print('NO')
        return
    elif cons <= T*vg:
        print('YES')
        return

main()


Measured memory_bytes: 9188
#include <iostream>
#include <algorithm>
using namespace std;
int N,K,L[52];
int main(){
	cin >> N >> K;
 	for(int i=0;i<N;i++) cin >> L[i];
  	sort(L,L+N);
  	reverse(L,L+N);
  	int sum = 0;
  	for(int i=0;i<K;i++) sum += L[i];
  	cout << sum << endl;
}

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

int main() {
	string S;
	cin >> S;

	vector<int> ns(4);
	string op = "-+";
	int n;
	for (int i = 0; i < 4; i++) {
		ns.at(i) = S.at(i) - '0';
	}
	for (int i = 0; i < (1 << 3); i++) {
		int R = ns.at(0);
		bitset<3> b(i);
		for (int j = 1; j < 4; j++) {
			if (b.test(j-1)) {
				R += ns.at(j);
			}
			else {
				R -= ns.at(j);
			}
		}
		if (R == 7) {
			n = i;
			break;
		}
	}
	for (int i = 0; i < 3; i++) {
		cout << ns.at(i) << op.at((n & (1 << i)) >> i);
	}
	cout << ns.at(3) << "=7" << endl;
}



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

int main()
{
  int R, G, B, N, count, ans;
  cin >> R >> G >> B >> N;

  for(int i = 0; i <= N / R; i++)
  {
    for(int j = 0; R * i + G * j <= N; j++)
    {
      for(int k = 0;  R * i + G * j + B * k <= N; k++)
      {
        ans = R * i + G * j + B * k;
      }
      if(ans == N)
      {
        count++;
      }
    ans = 0;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
 
int main(void){
    int n, i,c;
    int ha = 0, ta = 0;
    char card_t[128];
    char card_h[128];
 
    scanf("%d",&n);
    for(i = 0; i < n; i++){
        scanf("%s %s",card_t,card_h);
    c = strcmp(card_t, card_h);
    if(c == 0){ha++; ta++;}
    if(c > 0){ta += 3;}
    if(c < 0){ha += 3;}
}
printf("%d %d\n",ta, ha);
return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
using namespace std;
int main()
{
      string s;
      cin>>s;
      string pre[]={"ABC","ARC"};
      string last=s.substr(s.size()-3,s.size());
      //cout<<last;
      if(pre[0]==last)
      {
            cout<<pre[1];
      }
      else
      cout<<pre[0];
      cout<<endl;
}


Measured memory_bytes: 3592
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    println!("{}", v.iter().sum::<i64>() - v.iter().max().unwrap());
}

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

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



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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define rept(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(v) v.bigin(),v.end()
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
int main(){
    ll x,y;
    cin>>x>>y;
    if(y>=x*2&&y<=x*4&&y%2==0){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}



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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll a(n),b(n),c(n);
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>b[i];
  rep(i,n) cin>>c[i];
  
  vsort(a);
  vsort(c);
  
  ll ans=0;
  rep(i,n){
    ll x=lower_bound(all(a), b[i])-a.begin();
    ll y=c.end()-upper_bound(all(c), b[i]);
    ans+=x*y;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 2560
//                             In The Name Of Allah                                           
//                             	Mohammad Hosseini
#include <bits/stdc++.h>
#define	ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long
#define ld long double
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std; 

const int N = 3e5 + 100, OO = 1e16, T = 4500 + 100, M = 1e9 + 7, P = 6151, SQ = 280, lg = 30;
typedef pair <int, int> pii;
int n, a[N];

bool check() {
	int od, ev, sum;
	od = ev = sum = 0;
	bool b = false;
	for(int i = 0; i < n; i++) {
		sum += a[i] - 1;
		if(a[i] == 1)
			b = true;
	}
	if(b) {
		if(sum % 2)
			return true;
		return false;
	}
	for(int i = 0; i < n; i++)
		od += (a[i] % 2), ev += ((a[i] + 1) % 2);
	if(ev % 2 == 1) 
		return true;
	if(od > 1)
		return false;
	int gc = 0;
	for(int i = 0; i < n; i++) {
		if(a[i] % 2 == 1)
			a[i]--;
		gc = __gcd(a[i], gc);
	}
	for(int i = 0; i < n; i++)
		a[i] /= gc;
	return !check();
}

int32_t main() {
	use_fast;
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	if(check()) 
		cout << "First" << endl;
	else
		cout << "Second" << endl;
	return 0;
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- uploaded by ubuntu 20.04 
5- ...
*/



Measured memory_bytes: 4436
// Problem Link: 
// Tutorial Link: 

#include<bits/stdc++.h>
 
using namespace std;
 
#define LL long long
#define ll  long long
#define all(v) v.begin(), v.end()
#define pb push_back
#define pLL pair<LL,LL>
#define ff first
#define ss second
#define rep(i,a,b) for(LL i=a;i<b;++i)
#define repb(i,a,b) for(LL i=a;i>b;--i)
#define ld double
#define mp make_pair
#define vLL vector<LL>
#define vpLL vector<pLL>
#define vld vector<ld>
#define pld pair<ld,ld>
#define vpld vector<pld>
#define SLL set<LL>
#define SpLL set<pLL>
#define FIO ios::sync_with_stdio(false)
#define mod 1000000007

LL poww(LL a,LL n)
{
    if(n==0) return 1;
    LL val=poww(a,n/2);
    if(n%2==0) return (val*val)%mod;
    else return (((val*val)%mod)*a)%mod;
}

LL s, fact[2005], inv[2005];

inline LL comb(LL n,LL k)
{
    if(n==0||k==0||n-k<0) return 1;
    return (((fact[n]*inv[k])%mod)*inv[n-k])%mod;
}

inline LL cur(LL n) {
	return comb(s-2*n-1, s-3*n);
}

int main()
{
	FIO;
	fact[0]=1;
	inv[0]=1;
	rep(i,1,2001){
	    fact[i]=(fact[i-1]*i)%mod;
	    inv[i]=poww(fact[i],mod-2);
	}
	cin >> s;
	if(s < 3) {
		cout << 0 << endl;
		return 0;
	}
	LL ans = 0;
	for(int n = 1; n <= s/3; n++) {
		ans = (ans + cur(n))  % mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long
#define ff first
#define ss second

template <class T>
void print(vector<T>& v){
    for(T x:v) cout<<x<<" ";
    cout<<"\n";
}
void inp(vector<int>& v, int n){
    for (int i=0; i<n; ++i) scanf("%d", &v[i]);
}


void sol(){
    string s;
    cin>>s;
    int res=0;
    for (char c:s){
        res+=c-'0';
    }
    if (res%9==0) printf("Yes\n");
    else printf("No\n");
    return;
}

int main() {
    // int t;
    // cin>>t;
    // t++;
    // for (int i=1; i<t; ++i){
        // cout<<"Case #"<<i<<": ";
        sol();
    // }
    return 0;
}

Measured memory_bytes: 3748
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <cmath>

using namespace std;

void a_sandglass2(void) {
	int x, t;
	cin >> x >> t;
	cout << ((x - t<0)?0:x-t) << endl;
}

int main()
{
    a_sandglass2();
    return 0;
}

Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {

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

		int A = in.nextInt();
		int B = in.nextInt();
		int C = in.nextInt();

		if (A == B && A == C) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}


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

int main() {
    ll n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> drink(n);
    for (int i = 0; i < n; ++i) cin >> drink[i].first >> drink[i].second;
    sort(drink.begin(), drink.end());
    ll now = 0;
    ll ans = 0;
    for (pair<ll, ll> j : drink) {
        if (now + j.second > m) {
            ans += j.first * (m - now);
            break;
        } else {
            ans += j.first * j.second;
            now += j.second;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
/**
 * @author      : cromarmot (yexiaorain@gmail.com)
 * @license     : GPL
 * @created     : 星期六 9月 28, 2019 20:01:55 CST
 */

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define ten5 100000+10
#define MOD 1000000007
#define rep(i,a,n) for (int i=a;i<n;i++)
#define iif(c,t,f) ((c)?(t):(f))
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
const double pi = acos(-1.0);

int n;

int main(){
  cin>>n;
  printf("%.15lf\n",(n+1)/2/double(n));
  return 0;
}

/*
 *
 * hash prime
   61,83,113,151,211,281,379,509683,911
   1217,1627,2179,2909,3881,6907,9209
   12281,16381,21841,29123,38833,51787,69061,92083
   122777,163729,218357,291143,388211,517619,690163,999983
   1226959,1635947,2181271,2908361,3877817,5170427,6893911,9191891
   12255871,16341163,21788233,29050993,38734667,51646229,68861641,91815541
   122420729,163227661,217636919,290182597,386910137,515880193,687840301,917120411
   1000000007,1000000009
 * */



Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
#include<map>
#include<set>
#include <climits>
using namespace std;
#define INF 1100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int C[110000];

const int MAX = 510000;

ll fac[MAX],finv[MAX],inv[MAX];
//http://drken1215.hatenablog.com/entry/2018/06/08/210000
//テーブルを作る前処理　O(n)
//pが素数でなくてはならない
void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
//二項係数計算
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}


int main(){
    COMinit();
    int N,a[110000],x,y;
    cin>>N;
    for(int i=0;i<110000;i++){
        C[i]=-1;
    }
    for(int i=0;i<=N;i++){
        cin>>a[i];
        if(C[a[i]]!=-1){
            x=C[a[i]]; y=i;
        }
        C[a[i]]=i;
    }
    int s=x+(N-y)+1;
    for(int i=1;i<=N+1;i++){
        ll ans=COM(s,i)-COM(s-1,i);
        ans*=(-1);
        ans+=COM(N+1,i);
        if(ans<0) ans+=MOD;
        ans%=MOD;
        ans%=MOD;
        cout<<ans<<endl;
    }





}


Measured memory_bytes: 14584
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a1,a2,a3;
  cin>>a1>>a2>>a3;
  while(!(1<=a1<=13 && 1<=a2<=13 && 1<=a3<=13))
  {
    cin>>a1>>a2>>a3;
  }
  if(a1+a2+a3 >= 22)
    cout<<"bust";
  else
    cout<<"win";
  return 0;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    ll N,M;
    cin>>N>>M;
    ll ans=0;
    for(ll i=1;i<=sqrt(M)+1;++i){
        if(M%i==0){
            if(i*N<=M) ans=max(ans,i);
            if((M/i)*N<=M) ans=max(ans,M/i);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2 == 0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) == len(answer):
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a, b;
    cin>>a>>b;
    
    if((a*b)%2==0){
        cout<<"Even"<<endl;
    }
    else if((a*b)%2==1){
        cout<<"Odd"<<endl;
    }
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           ((ll)x.size())
#define hell            (1000000007)
#define inf             ((ll)5e18 + 5)
#define PI              ((double)3.14159265358979323844)
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    string s;
    cin>>s;
    cout<<s[0]<<s[1]<<s[2]<<endl;
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;int sum=0;
  cin>>N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
      cin>>a.at(i);
      sum=sum+a.at(i);
  }int err_min;int id=a.at(0)*N-sum;
   int err=max(id,-1*id);int temp;
  for(int j=0;j<N;j++){
      if(sum<a.at(j)*N){
          err_min=a.at(j)*N-sum;
      }else{
          err_min=sum-a.at(j)*N;
      }if(err_min<err){
          err=err_min;temp=j;
      }
  }cout<<temp<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,l,s;
  cin>>n>>l;
  s=n*(2*l+n-1)/2;
  int ans;
   
  if( l >= 0 )
    ans = s-l;
  else {
    if( l+n-1 < 0 )
      ans = s-(l+n-1);
    else
      ans = s;
  }
  
  cout<<ans<<endl;
}

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

using namespace std;

struct pot {
    int a;
    int b;
    int c;
};

const int N = 45;
const int INF = 1e9 + 7;
int n, m, dp[N][N * 10][N * 10], Ma, Mb;
pot arr[N];


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    cin >> n >> Ma >> Mb;
    for(int i = 1; i <= n; i++){
        int a, b, c;
        cin >> a >> b >> c;
        arr[i].a = a;
        arr[i].b = b;
        arr[i].c = c;
    }

    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= n * 10; j++){
            for(int k = 0; k <= n * 10; k++){
                dp[i][j][k] = INF;
            }
        }
    }

    dp[1][arr[1].a][arr[1].b] = arr[1].c;
    dp[1][0][0] = 0;

    for(int i = 2; i <= n; i++){
        for(int j = 0; j <= n * 10; j++){
            for(int k = 0; k <= n * 10; k++){
                dp[i][j][k] = min(dp[i][j][k], dp[i - 1][j][k]);
                if(j - arr[i].a >= 0 && k - arr[i].b >= 0){
                    dp[i][j][k] = min(dp[i][j][k], dp[i - 1][j - arr[i].a][k - arr[i].b] + arr[i].c);
                }
            }
        }
    }
    int fmin = INF;
    for(int j = 1; j <= n * 10; j++){
        for(int k = 1; k <= n * 10; k++){
            int gc = __gcd(j, k);
            if(j / gc == Ma && k / gc == Mb){
                fmin = min(fmin, dp[n][j][k]);
            }
        }
    }
     if(fmin == INF){
        cout << -1 << '\n';
    } else {
        cout << fmin << '\n';
    }  
    return 0;
}

Measured memory_bytes: 32128