akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using dd = double;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<dd, dd>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<dd>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vpd = vector<pd>;

template <class T, class V>
istream& operator>>(istream& in, pair<T, V>& pair) {
    return in >> pair.first >> pair.second;
}

template <class T>
istream& operator>>(istream& in, vector<T>& elements) {
    for (size_t i = 0; i < elements.size(); ++i) {
        in >> elements[i];
    }
    return in;
}

template <class Container, class Element>
bool Contains(const Container& container, const Element& element) {
    return container.find(element) != container.end();
}

template <class T>
ostream& operator<<(ostream& out, const vector<T>& elements) {
    for (const T& element : elements) {
        out << element << ' ';
    }
    return out;
}

template <class T, class V>
ostream& operator<<(ostream& out, const pair<T, V>& pair) {
    return out << pair.first << ' ' << pair.second;
}

#define FOR(i,n) for(size_t i=0, i##_len=(n); i<i##_len; ++i)
#define SORT(c) sort((c).begin(), (c).end())
#define SUM(c) accumulate((c).begin(), (c).end(), 0ll)

int main() {
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    
    int n;
    cin >> n;
    
    vd a(n);
    cin >> a;
    
    double result = 0;
    for (double d : a) {
        result += 1 / d;
    }
    
    result = 1 / result;
    
    cout << fixed << result << endl;
    
    return 0;
}


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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        n: usize
    }
    let mut min = n;
    for a in 1..n + 1 {
        if n < a * a {
            break;
        }
        if n % a == 0 {
            let b = n / a;
            min = std::cmp::min(a + b - 2, min);
        }
    }
    println!("{}", min);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define nl ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()
#define pi acos(-1)

using namespace std;

int main() {
    nl // Bazzi - Paradise

    int n;
    string s, t;
    cin >> n >> s >> t;

    for(int i=0; i<n; ++i) {
        cout << s[i] << t[i];
    }


    return 0;
}

Measured memory_bytes: 3612
a = [0]
until a[1] == "?" do
    a = gets.split
	a[0] = a[0].to_i
	a[2] = a[2].to_i
	break if a[1] == "?"
    case a[1]
    when "+" then
        ans = a[0] + a[2]
    when "-" then
        ans = a[0] - a[2]
    when "*" then
        ans = a[0] * a[2]
    when "/" then
        ans = a[0] / a[2]
    end
	puts ans
end

Measured memory_bytes: 8616
from collections import deque
N = int(input())
H = list(map(int, input().split()))
V = deque()
for i in range(len(H)):
    counter = 0
    for j in range(i):
        if H[i] >= H[j]:
            counter += 1
    if counter == i :
        V.append(H[i])
print(len(V))




Measured memory_bytes: 38768
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N,K;cin>>N>>K;
  string S;cin>>S;
  
  if(S[K-1]=='A'){
    S[K-1]='a';
  }
  else if(S[K-1]=='B'){
    S[K-1]='b';
  }
  else{
    S[K-1]='c';
  }
  
  cout<<S<<endl;
}

Measured memory_bytes: 3628
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(false);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int N;
  cin >> N;
  string ans;
  int p = 1;
  int idx = 0;
  rep(i, 0, 30) {
    if (N < p) {
      ans = string(i, 'a');
      p /= 26;
      int j = 0;
      while (1) {
        int d = N / p;
        N -= d * p;
        ans[j++] = d + 'a';
        p /= 26;
        if (p == 0) break;
      }
      break;
    }
    N -= p;
    p *= 26;
    idx += p;
  }
  cout << ans << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 3616
/*----------------by syr----------------*/
/*
  -----  -----  -----
  |   |  |---|    _/
  |   |  | \_    /
  -----  |   \  -----

  |---\  \   /  |\  /|
  |   |   \_/   | \/ |
  |   |   / \   |    |
  |---/  /   \  |    |
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i,x,y) for(int i=(x);i<(y);++i)
#define REP(i,x,y) for(int i=(x);i<=(y);++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef pair<int,int> pii;

const int INF=1e9+7;
const int maxn=3005;

int n;
int a[maxn];
ll dp[maxn][maxn];

int main(){
	scanf("%d",&n);
	FOR(i,0,n) scanf("%d",a+i);
	FOR(len,0,n){
		FOR(i,0,n){
			int j=i+len;
			if(j>=n) continue;
			if(!len){
				if(n&1) dp[i][j]=a[i];
				else dp[i][j]=-a[i];
				continue;
			}
			if((n-len)&1){
				if(i+1<n) dp[i][j]=dp[i+1][j]+a[i];
				if(j-1>=0) dp[i][j]=max(dp[i][j],dp[i][j-1]+a[j]);
			}else{
				if(i+1<n) dp[i][j]=dp[i+1][j]-a[i];
				if(j-1>=0) dp[i][j]=min(dp[i][j],dp[i][j-1]-a[j]);
			}
		}
	}
	printf("%lld",dp[0][n-1]);
	return 0;
}


Measured memory_bytes: 70144
#include<bits/stdc++.h>
#define clr(x) memset(x, 0, sizeof(x))
#define sz(x) (int)x.size()
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;

using namespace std;

typedef long long ll;
typedef pair<long , long> pll;

const ll mx = 105;
const ll mod = 998244353;
const ll maxn = 1e17;


bool vis[101][101];

bool in(ll x, ll y, ll r, ll c){
  return x>=0 && y >= 0 && x < r && y<c;
}

void solve(){
 
  char x;

  cin>>x;

  if(x >= 'A' && x <= 'Z'){
    cout<<"A\n";
  }
  else{
    cout<<"a\n";
  }


}   


int main(){

   ios_base::sync_with_stdio(false);
   cin.tie(0);

    ll t = 1;
    
   // cin>>t;

    while(t--){
        solve();
    }
   
}




Measured memory_bytes: 3564
#include <iostream>
#include <vector>
using namespace std;
int n;
int sum = 0;
int path1, path2;
int ok = 0;
void solve(int n) {
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			int price = 7 * i + 4 * j;
			if (price == n)
				ok = true;
			if (price > n)
				break;
		}

	}
	if (ok)cout << "Yes " << endl;
	else cout << "No " << endl;

}
int main() {
	cin >> n;
	vector<bool>dp(107);
	dp[0] = true;
	for (int i = 0; i < n; i++) {
		if (dp[i]) {
			dp[i + 4] = true;
			dp[i + 7] = true;
		}
	}
	if (dp[n])cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		String[] o = sc.next().split("");
		String[] e = sc.next().split("");
		StringBuilder answer = new StringBuilder();
		for(int i = 0; i < e.length;i++) {
			answer.append(o[i]);
			answer.append(e[i]);
		}
		if(o.length > e.length) {
			answer.append(o[o.length -1]);
		}
		System.out.println(answer);
	}

}

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

#define boost ios::sync_with_stdio(0); cin.tie(0);
#define int long long
const int N = 1e5 + 10;
const int MOD = 1e9 + 7;

int32_t main(){
    boost;

    string s;

    cin >> s;

    string ans = "";

    for(int i = 0 ; i < s.length() ; ++i){

    	if(s[i] != 'B'){
    		ans += s[i];
    	}
    	else{
    		if(ans.length() != 0)
    			ans.erase(ans.length() - 1);
    	}
    }

    cout << ans;
    return 0;
}

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

""" 方針
[入力例１]
3 4
1 1
2 2
3 3

ans = [1, 2, 2, 3, 3, 3]
K=4より、答えは3


"""

def solve():
    N, K = list(map(int, input().split()))
    A, B = [], []

    num_cnt_hash = {}
    for i in range(N):
        a, b = list(map(int, input().split()))

        if not a in num_cnt_hash:
            num_cnt_hash[a] = 0
        num_cnt_hash[a] += b
    
    nums = list(num_cnt_hash.keys())
    nums.sort()

    k = 0
    for num in nums:
        k += num_cnt_hash[num]
        if k >= K:
            print(num)
            return


if __name__ == "__main__":
    solve()


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

using namespace std;

int N, M;

struct edge
{
  int u, v, cost, time;
  double p;

  edge(int u, int v, int cost, int time) : u(u), v(v), cost(cost), time(time) {};

  bool operator<(const edge &e) const
  {
    return p < e.p;
  }

};

typedef vector< edge > Edges;

class DisjointSet
{
private:
  vector< int > rank, p;

  void link(int x, int y)
  {
    if(rank[x] > rank[y]) {
      p[y] = x;
    } else {
      p[x] = y;
      if(rank[x] == rank[y]) rank[y]++;
    }
  }

public:
  DisjointSet() {}

  DisjointSet(int size)
  {
    rank.resize(size, 0);
    p.resize(size, 0);
  }

  void makeSet(int x)
  {
    p[x] = x, rank[x] = 0;
  }

  void Union(int x, int y)
  {
    link(findSet(x), findSet(y));
  }

  int findSet(int x)
  {
    return (x != p[x] ? p[x] = findSet(p[x]) : p[x]);
  }
};

double kruskal(Edges &edges, int V)
{
  sort(edges.rbegin(), edges.rend());
  DisjointSet uf_tree(V);
  for(int i = 0; i < V; i++) {
    uf_tree.makeSet(i);
  }
  double ret = 0;
  for(int i = 0; i < edges.size(); i++) {
    edge &e = edges[i];
    ret += e.p;
  }
  for(int i = 0; i < edges.size(); i++) {
    edge &e = edges[i];
    if(uf_tree.findSet(e.u) != uf_tree.findSet(e.v)) {
      uf_tree.Union(e.u, e.v);
      ret -= e.p;
    }
  }
  return ret;
}

bool calc(Edges &edges, double value)
{
  double ret = 0.0;
  for(int i = 0; i < edges.size(); i++) {
    edge &e = edges[i];
    e.p = (double) e.cost - (double) e.time * value;
  }
  return kruskal(edges, N) <= 0.0;
}

int main()
{
  Edges edges;
  scanf("%d %d", &N, &M);
  for(int i = 0; i < M; i++) {
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    edges.push_back(edge(a, b, d, c));
  }
  double row = 0.0, high = 1e9;
  for(int i = 0; i < 100; i++) {
    double mid = (row + high) / 2;
    if(calc(edges, mid)) high = mid;
    else row = mid;
  }
  cout << fixed << setprecision(5) << (high + row) / 2 << endl;
}

Measured memory_bytes: 3444
#include<stdio.h>
int main(){
  char h[1000001]={0,1};
  int a,b,i,j,c[1000001]={0};
  for(i=0;i<500001;i++){
    if(h[i]==0)continue;
    h[i*2]=1;
    if(i*3<1000001)h[i*3]=1;
    if(i*5<1000001)h[i*5]=1;
  }
  for(i=j=0;i<1000001;i++){
    if(h[i])j++;
    c[i]=j;
  }
  while(scanf("%d",&a),a){
    scanf("%d",&b);
    printf("%d\n",c[b]-c[a-1]);
  }
  return 0;
}

Measured memory_bytes: 5492
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define PDD pair<double, double>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 1, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 0) u += MOD;
    return u;

}

LL exp(LL a, LL b){
    LL sum = a;
    LL res = 1;
    while(b){
        if(b&1){
            res = (res * sum)%MOD;
        }
        sum = (sum * sum) % MOD;
        b>>=1;
    }
    return res;
}

int main(){
    int N, A, B, C, X;
    while(cin>>N>>A>>B>>C>>X&&N){
        int ans = 0;
        REP(i, N){
            int d;
            cin >> d;
            while(ans<10001&&X!=d){
                X = (A * X + B ) % C;
                ++ans;
            }
            if(X==d){
                X = (A * X + B ) % C;
                ++ans;
            }else{
                ans=100000;
            }
        }
        if(ans>=10002)cout<< -1 << endl;
        else cout << ans - 1 << endl;
    }
    return 0;
}



Measured memory_bytes: 3012
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll N,M;
  cin >> N >> M;
  //ll M_MAX=1000000001;
  ll N_MAX=100100;
  ll a[100100];
  ll A;
  a[0]=0;
  for(int i=1;i<=N;i++){
    cin >> A;
    A%=M;
    a[i]=A;
  }
  for(int i=1;i<=N;i++){
    a[i]=a[i-1]+a[i];
    a[i]%=M;
  }
  ll ans=0;
  map<ll,ll> m;
  for(int i=0;i<=N;i++){
    ans+=m[a[i]];
    m[a[i]]++;
  }
  /*ll ans=0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<=N;j++){
      if((a[j]-a[i])%M==0)ans++;
    }
  }*/

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

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

int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	
	int ax = x2 - x1;
	int ay = y2 - y1;
	int bx = -ay;
	int by = ax;
	
	int x4 = x1 + bx;
	int y4 = y1 + by;
	int x3 = x4 + ax;
	int y3 = y4 + ay;
	
	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
	return 0;
}

Measured memory_bytes: 256
N,M,X=map(int,input().split())
A=list(map(int,input().split()))
cnt_1=0
cnt_2=0
for i in range(X):
    if i in A:
        cnt_1+=1



for i in range(X,N):
    if i in A:
        cnt_2+=1


print(min(cnt_1,cnt_2))
    



Measured memory_bytes: 3064
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    long nAns = 0;
    long nMax = 0;
    for(int i = 0; i < n; i++){
        long a;
        scanf("%ld", &a);
        nMax = max(nMax, a);
        nAns += (nMax - a);
    }
  
    printf("%ld", nAns);
    return 0;
}


Measured memory_bytes: 3224
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = LIST()
q = INT()
count = [0]*(10**5+1)
for x in a:
    count[x] += 1
ans = 0
for i in range(10**5+1):
    ans += i * count[i]
for i in range(q):
    b, c = MAP()
    ans += (c - b) * count[b]
    count[c] += count[b]
    count[b] = 0
    print(ans)

Measured memory_bytes: 21996
#include <bits/stdc++.h>
using namespace std;
struct node
{
    int k;
    int a[15];
    int p;
}s[15];
int main()
{
    int n,m;
    int i,j,k;
    int b[15],num,flag,ans,flag1;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        ans=0;
        for(i=0;i<m;i++)
        {
            scanf("%d",&s[i].k);
            for(j=0;j<s[i].k;j++)
            {
                scanf("%d",&s[i].a[j]);
            }
        }
        for(i=0;i<m;i++)
            scanf("%d",&s[i].p);
        for(i=0;i<(1<<n);i++)
        {
            flag=flag1=0;
            memset(b,0,sizeof(b));
            for(j=0;j<n;j++)
            {
                if(i&(1<<j))
                {
                    b[j+1]=1;
                    flag1=1;
                }
            }
            for(j=0;j<m;j++)
            {
                num=0;
                for(k=0;k<s[j].k;k++)
                {
                    if(b[s[j].a[k]]==1)
                        num++;
                }
                if(num%2!=s[j].p)
                {
                    flag=1;
                    break;
                }
            }
            if(flag==0)
                ans++;
        }
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0) 
#define setbit0(n, i) ((n) & (~(1LL << (i)))) 
#define setbit1(n, i) ((n) | (1LL << (i))) 
#define togglebit(n, i) ((n) ^ (1LL << (i))) 
#define lastone(n) ((n) & (-(n))) 
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}

template <class T>
void read(T &x) {
    char c;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        ;
    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
#define ll long long 
#define lll __int128_t
#define pb push_back
#define mp make_pair
typedef pair < int,int> ii;
typedef vector<ii> vii;
typedef vector<ll>vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll hashPrime = 1610612741;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s, t;
    cin>>s>>t;
    for (ll i = 0; i < t.size() - 1;i++){
        if(s[i]!=t[i]){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}

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

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


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
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 int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    a--; b--; c--; d--;
    string s;
    cin >> s;
    REP(i, a, max(c, d)+1)if(s[i] == '#' && s[i+1] == '#'){
        cout << "No" << endl;
        return 0;
    }
    if(c < d){
        cout << "Yes" << endl;
    }else{
        REP(i, b, d+1){
            if(s[i-1] == '.' && s[i] == '.' && s[i+1] == '.'){
                cout << "Yes" << endl;
                return 0;
            }
        }
        cout << "No" << endl;
    }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define MAX_N 114514
#define ll long long int
using namespace std;
ll bit[MAX_N+2];
ll n;
ll a[MAX_N];
ll A[MAX_N];
ll N;
void init(ll n_){
    n=n_;
    for(ll i=0;i<n+1;i++){
        bit[i]=0;
    }

}
ll sum(ll i){
    ll s=0;
    while(i>0){
        s+=bit[i];
        i-=i&-i;
    }
    return s;
}
void add(ll i,ll x){
    while(i<=n){
        bit[i]+=x;
        i += i & -i;
    }
}
ll invnum(vector<ll> t){
    n=t.size();
    init(n);
    ll ans=0;
    for(ll j=0;j<n;j++){
        ans+=j-sum(t[j]);
        add(t[j],1);
    }
   return ans;
}

ll solve(ll x){
    vector<ll> S(N+1);
    vector<tuple<ll,ll>> U(N+1);
    S[0]=0;
    for(ll i=0;i<N;i++){
        if(A[i]<x){
            S[i+1]=S[i]-1;
        }
        else{
            S[i+1]=S[i]+1;   
        }
    }
    for(ll i=0;i<N+1;i++){
        U[i]=make_tuple(S[i],i+1);
    }
    sort(U.begin(),U.end());
    vector<ll> T(N+1);
    for(ll i=0;i<N+1;i++){
        T[i]=get<1>(U[i]);
    }
    return invnum(T);
}
int main(void){
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    
    ll low=1;
    ll high=A[0];
    for(ll i=1;i<N;i++){
        if (high<A[i]){
            high=A[i];
        }
    }
    high++;
    ll M=(N*(N+1))/2;
    while(high-low>1){
        ll mid=(low+high)/2;
        if (solve(mid)*2<=M){
            low=mid;
        }
        else{
            high=mid;
        }
    }
    cout<<low<<endl;
}


Measured memory_bytes: 5772
import math, random

def make_circle(points):
	# Convert to float and randomize order
	shuffled = [(float(x), float(y)) for (x, y) in points]
	random.shuffle(shuffled)
	
	# Progressively add points to circle or recompute circle
	c = None
	for (i, p) in enumerate(shuffled):
		if c is None or not is_in_circle(c, p):
			c = _make_circle_one_point(shuffled[ : i + 1], p)
	return c


# One boundary point known
def _make_circle_one_point(points, p):
	c = (p[0], p[1], 0.0)
	for (i, q) in enumerate(points):
		if not is_in_circle(c, q):
			if c[2] == 0.0:
				c = make_diameter(p, q)
			else:
				c = _make_circle_two_points(points[ : i + 1], p, q)
	return c


# Two boundary points known
def _make_circle_two_points(points, p, q):
	circ = make_diameter(p, q)
	left  = None
	right = None
	px, py = p
	qx, qy = q
	
	# For each point not in the two-point circle
	for r in points:
		if is_in_circle(circ, r):
			continue
		
		# Form a circumcircle and classify it on left or right side
		cross = _cross_product(px, py, qx, qy, r[0], r[1])
		c = make_circumcircle(p, q, r)
		if c is None:
			continue
		elif cross > 0.0 and (left is None or _cross_product(px, py, qx, qy, c[0], c[1]) > _cross_product(px, py, qx, qy, left[0], left[1])):
			left = c
		elif cross < 0.0 and (right is None or _cross_product(px, py, qx, qy, c[0], c[1]) < _cross_product(px, py, qx, qy, right[0], right[1])):
			right = c
	
	# Select which circle to return
	if left is None and right is None:
		return circ
	elif left is None:
		return right
	elif right is None:
		return left
	else:
		return left if (left[2] <= right[2]) else right


def make_diameter(a, b):
	cx = (a[0] + b[0]) / 2.0
	cy = (a[1] + b[1]) / 2.0
	r = math.hypot(cx - a[0], cy - a[1])
	return (cx, cy, r)


def make_circumcircle(a, b, c):
	# Mathematical algorithm from Wikipedia: Circumscribed circle
	ox = (min(a[0], b[0], c[0]) + max(a[0], b[0], c[0])) / 2.0
	oy = (min(a[1], b[1], c[1]) + max(a[1], b[1], c[1])) / 2.0
	ax = a[0] - ox;  ay = a[1] - oy
	bx = b[0] - ox;  by = b[1] - oy
	cx = c[0] - ox;  cy = c[1] - oy
	d = (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by)) * 2.0
	if d == 0.0:
		return None
	x = ox + ((ax*ax + ay*ay) * (by - cy) + (bx*bx + by*by) * (cy - ay) + (cx*cx + cy*cy) * (ay - by)) / d
	y = oy + ((ax*ax + ay*ay) * (cx - bx) + (bx*bx + by*by) * (ax - cx) + (cx*cx + cy*cy) * (bx - ax)) / d
	ra = math.hypot(x - a[0], y - a[1])
	rb = math.hypot(x - b[0], y - b[1])
	rc = math.hypot(x - c[0], y - c[1])
	return (x, y, max(ra, rb, rc))


_MULTIPLICATIVE_EPSILON = 1 + 1e-14

def is_in_circle(c, p):
	return c is not None and math.hypot(p[0] - c[0], p[1] - c[1]) <= c[2] * _MULTIPLICATIVE_EPSILON


# Returns twice the signed area of the triangle defined by (x0, y0), (x1, y1), (x2, y2).
def _cross_product(x0, y0, x1, y1, x2, y2):
	return (x1 - x0) * (y2 - y0) - (y1 - y0) * (x2 - x0)

p = []
for i in range(int(input())):
	x = list(map(int, input().split()))
	p.append((x[0], x[1]))
x = make_circle(p)
x = list(x)
print(x[2])

Measured memory_bytes: 4464
import Foundation

func readInts() -> [Int]{
   return readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let nk = readInts()
    let k = nk[1]
    var ans = 0
    
    let value = readInts().sorted(by: <)
    for i in 0..<k {
        ans += value[i]
    }
    print(ans)
    
}
main()


Measured memory_bytes: 13712
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,x[N],sa[N],rk[N];
bool cmp(int a,int b){return x[a]<x[b];}
int cnt,inv[N];
vector<int> e[N];
struct segment_tree{
	int id[N];
	#define lc x<<1
	#define rc x<<1|1
	void init(int x,int l,int r,bool tp){
		if (l==r) return void(id[x]=(tp?inv[l]:l));
		int mid=(l+r)>>1;
		init(lc,l,mid,tp);
		init(rc,mid+1,r,tp);
		id[x]=++cnt;
		if (tp){
			e[id[x]].push_back(id[lc]);
			e[id[x]].push_back(id[rc]);
		}
		else{
			e[id[lc]].push_back(id[x]);
			e[id[rc]].push_back(id[x]);
		}
	}
	void addedge(int x,int l,int r,int L,int R,int p,bool tp){
		if (l>=L&&r<=R){
			if (tp) e[p].push_back(id[x]);
			else e[id[x]].push_back(p);
			return;
		}
		int mid=(l+r)>>1;
		if (L<=mid) addedge(lc,l,mid,L,R,p,tp);
		if (R>mid) addedge(rc,mid+1,r,L,R,p,tp);
	}
}T1,T2;
int dfn[N],low[N],scc[N],sta[N],top;
bool ins[N];
void tarjan(int x){
	static int cnt=0;
	dfn[x]=low[x]=++cnt;
	ins[sta[++top]=x]=1;
	for (int i=0;i<e[x].size();i++){
		int v=e[x][i];
		if (!dfn[v]) tarjan(v),low[x]=min(low[x],low[v]);else
		if (ins[v]) low[x]=min(low[x],dfn[v]);
	}
	if (low[x]==dfn[x]){
		while (sta[top]!=x) scc[sta[top]]=x,ins[sta[top--]]=0;
		scc[x]=x;ins[x]=0;top--;
	}
}
bool check(int ans){
	for (int i=1;i<=cnt;i++) e[i].clear();
	cnt=n+n;
	T1.init(1,1,n+n,0);
	T2.init(1,1,n+n,1);
	for (int i=1;i<=cnt;i++) dfn[i]=0;
	for (int i=1,l=1,r=1;i<=n+n;i++){
		while (x[sa[l]]<=x[sa[i]]-ans) l++;
		while (r<n+n&&x[sa[r+1]]<x[sa[i]]+ans) r++;
		if (l<i){
			T1.addedge(1,1,n+n,l,i-1,inv[i],0);
			T2.addedge(1,1,n+n,l,i-1,i,1);
		}
		if (i<r){
			T1.addedge(1,1,n+n,i+1,r,inv[i],0);
			T2.addedge(1,1,n+n,i+1,r,i,1);
		}
	}
	for (int i=1;i<=cnt;i++)
		if (!dfn[i]) tarjan(i);
	for (int i=1;i<=n+n;i++)
		if (scc[i]==scc[inv[i]]) return 0;
	return 1;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d%d",&x[i],&x[i+n]);
	for (int i=1;i<=n+n;i++) sa[i]=i;
	sort(sa+1,sa+n+n+1,cmp);
	for (int i=1;i<=n+n;i++) rk[sa[i]]=i;
	for (int i=1;i<=n;i++) inv[rk[i]]=rk[i+n],inv[rk[i+n]]=rk[i];
	int l=0,r=1e9;
	while (l<r){
		int mid=(l+r)>>1;
		if (check(mid+1)) l=mid+1;else r=mid;
	}
	printf("%d\n",l);
	return 0;
}

Measured memory_bytes: 22144
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N, M;
  cin >> N >> M;
  vector<int> road(N);
  
  for (int i=0; i<N; i++)
    road.at(i) = 0;
  
  for (int i=0; i<M; i++) {
    int a, b;
    cin >> a >> b;
    
    road.at(a-1)++;
    road.at(b-1)++;
    
  }
  
  for (int i=0; i<N; i++)
    cout << road.at(i) << endl;
  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
map<int,int> mapping;
int ansB[300005];

int main()
{
    int n;
    cin >> n;
    vector<int> A(n),B(n),C(n);
    vector<int> total;
    for(int i = 0;i < n;i++)
        scanf("%d",&A[i]),total.push_back(A[i]);
    for(int i = 0;i < n;i++)
        scanf("%d",&B[i]),total.push_back(B[i]);
    for(int i = 0;i < n;i++)
        scanf("%d",&C[i]),total.push_back(C[i]);
    sort(total.begin(),total.end());
    for(int i = 0;i < total.size();i++)
        mapping[total[i]] = i + 1;
    for(int i = 0;i < n;i++)
    {
        A[i] = mapping[A[i]];
        B[i] = mapping[B[i]];
        C[i] = mapping[C[i]];
    }
    sort(C.begin(),C.end());
    for(int i = 0;i < n;i++)
    {
        int cur = B[i];
        vector<int>::iterator it = upper_bound(C.begin(),C.end(),cur);
        ansB[cur] = C.end() - it;
    }
    sort(A.begin(),A.end(),greater<int>());
    int start = 0;
    sort(B.begin(),B.end(),greater<int>());
    long long ans = 0;
    long long arrAns = 0;
    for(int i = 0;i < n;i++)
    {
        int cur = A[i];
        for(;B[start] > cur && start < n;start++)
            arrAns += ansB[B[start]];
        ans += arrAns;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 17776
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#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;}

#define INF 2147483600

int main(){
  int n,m;
  cin>>n>>m;
  vector<vector<int>> vec(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    vec[a].pb(b);
    vec[b].pb(a);
  }
  int q;
  cin>>q;
  vector<int> v(q), d(q), c(q);

  rep(i,q){
    cin>>v[i]>>d[i]>>c[i];
    v[i]--;
  }

  vector<int> col(n,0);
  vector<int> visited(n,-1);

  for(int i=q-1; i>=0; i--){
    if(visited[v[i]] >= d[i]) continue;

    queue<int> pos, dep;
    pos.push(v[i]); dep.push(d[i]);
    visited[v[i]] = d[i];

    while(!pos.empty()){
      int p = pos.front(); pos.pop();
      int depth = dep.front(); dep.pop();
      if(col[p]==0) col[p] = c[i];
      if(depth==0) continue;
      for(auto to : vec[p]) if(visited[to] < depth-1){
        visited[to] = depth-1;
        pos.push(to);
        dep.push(depth-1);
      }
    }
  }

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


  return 0;
}


Measured memory_bytes: 9336
def dfs(i, f):
    global ans
    if i == len(s) - 1:
        ans += sum(map(int, f.split("+")))
        return 0
    dfs(i + 1, f + "+" + s[i + 1])
    dfs(i + 1, f + s[i + 1])

s = input()
ans = 0
dfs(0, s[0])
print(ans)

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

using namespace std;

int N;
vector<pair<int, int> > PointsInfo;

void solve() {
	int minLen, lenX, lenY;

	minLen = 2000000000;
	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) {
			lenX = PointsInfo[i].first - PointsInfo[j].first;
			lenX *= lenX;
			if (lenX > minLen) {
				break;
			}
			lenY = PointsInfo[i].second - PointsInfo[j].second;
			minLen = min(minLen, lenX + lenY*lenY);
		}
	}

	cout << minLen << endl;
}

int main() {
	int x, y;

	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> x >> y;
		PointsInfo.push_back({ x,y });
	}
	sort(PointsInfo.begin(), PointsInfo.end());
	solve();
	
	return 0;
}


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

const int N = 200 * 1000 + 20;
int n, a[N], cnt[N];

int main() {
	cin >> n;
    for (int i = 1; i < n; i++) {
    	cin >> a[i];
        cnt[a[i]]++;
    }
    for (int i = 1; i <= n; i++)
		cout << cnt[i] << " ";
    return cout << endl, 0;
}

Measured memory_bytes: 5148
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 100005;
const lo mod = 1000000007;

lo n,m,b,a[li],k,flag;
lo cev;
string s;
vector<lo> v;

int main(void){
	fio();
	cin>>s;
	for(int i=0;i<(int)s.size();i++){
		if(s[i]=='o') cev++;
	}
	lo at=15-(lo)s.size();
	if(cev+at>=8){cout<<"YES\n";return 0;}
	cout<<"NO";
	return 0;
}


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

int main()
{
    int k, x;

    cin >> k;
    cin >> x;

    if(k == 0) {
        cout << x;
        return 0;
    }

    for(int i = 0; i < (k*2-1); i++) {
        cout << x - k + i + 1;

        if(i != (k*2-2)) {
            cout << " ";
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define re return
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
ll string_to_int(string s)
{
	ll n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
string s;
ll t[10],res;
void dfs(vector<ll>v){
	ll sum=0;
	rep(i,v.size()){
		sum+=v[i];
	}
	if(sum<s.size()){
		forn(i,1,s.size()-sum){
			v.pb(i);
			dfs(v);
			v.pop_back();
		}
	}
	else{
		int sum=0; 
		rep(i,v.size()){
			forn(j,sum,sum+v[i]-1){
				res+=(s[j]-'0')*t[sum+v[i]-1-j];
			}sum+=v[i];
		}
	}
}
int main(){
	cin>>s;
	t[0]=1;forn(i,1,9)t[i]=t[i-1]*10LL;
	vector<ll>vv;
	dfs(vv);
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;

map<char, string> t;

void init(){
  t['0'] = "0000";
  t['1'] = "0001";
  t['2'] = "0010";
  t['3'] = "0011";
  t['4'] = "0100";
  t['5'] = "0101";
  t['6'] = "0110";
  t['7'] = "0111";
  t['8'] = "1000";
  t['9'] = "1001";
  t['a'] = "1010";
  t['b'] = "1011";
  t['c'] = "1100";
  t['d'] = "1101";
  t['e'] = "1110";
  t['f'] = "1111";
}

string toString(long double d){
  ostringstream oss;
  oss << setprecision(32) << d;
  return oss.str();
}
  

string toBinary(string s){
  string ret = "";
  for(int i = 0 ; i < s.size() ; i++){
    ret += t[s[i]];
  }
  return ret;
}

long double calcDecimal(string s){
  long double ret = 0.0f;
  for(int i = 25 ; i < 32 ; i++){
    if(s[i] == '1') ret += pow(0.5, i-24);
  }
  return ret;
}

long double calcInte(string s){
  long double ret = 0.0f;
  for(int i = 1 ; i < 25 ; i++){
    if(s[i] == '1') ret += pow(2.0, 24-i);
  }
  return ret;
}

string hitPoint(string s){
  bool ispoint = false;
  for(int i = 0 ; i < s.size() ; i++){
    if(s[i] == '.') ispoint = true;
  }
  
  if(!ispoint) s += ".0";
  return s;
}

string eraseZero(string s){
  if(s.size() == 1) return s;
  string ret;
  for(int i = s.size()-1 ; i >= 0 ; i--){
    if(s[i] == '.') return s;
    if(s[i] != '0') return s.substr(0, i+1);
  }
}
  
int main(){
  init();
  int n;
  cin >> n;
  string sixt;
  while(n--){
    cin >> sixt;
    string s = toBinary(sixt);
    long double inte = calcInte(s);
    long double decimal = calcDecimal(s);
    
    //cout << setprecision(16) << "inte = " << inte << endl << "decimal = " << decimal << endl;
    
    long double ans = inte + decimal;
    string Ans;
    Ans = toString(ans);
    string answer = Ans;
    answer = hitPoint(answer);
    if(s[0] == '1') cout << '-';
    cout << answer << endl;
    /*
    cout << "Ans = " << Ans << endl;
    string ANS = eraseZero(Ans);
    //cout << "ANS = " << ANS << endl;
    ANS = hitPoint(ANS);
    if(s[0] == '1') cout << '-';
    cout << ANS << endl;
    */
  }
  return 0;
}

Measured memory_bytes: 1328
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;
 
ll N, T[101], V[101];
double dp[20001][101];
 
int main(void) {
  cin >> N;
  REP(i, 0, N) cin >> T[i];
  REP(i, 0, N) cin >> V[i];
 
  T[N] = 0;
  REP(i, 0, N) T[i + 1] += T[i];
  V[N] = 0;
 
  REP(i, 0, 20001) REP(j, 0, 101) dp[i][j] = -1e20;
  dp[0][0] = 0;
  ll vi = 0;
  REP(t, 1, T[N] + 1) {
    ll vmax = V[vi], lvmax = V[vi];
    if(t >= T[vi]) {
      vmax = min(V[vi], V[vi + 1]);
      lvmax = V[vi];
      vi++;
    }
    REP(v, 0, vmax + 1) {
      dp[t][v] = max(dp[t][v], dp[t - 1][v] + v);
      if(v <= vmax && v + 1 <= lvmax) dp[t][v] = max(dp[t][v], dp[t - 1][v] + v + 0.25);
      if(v + 1 <= 100) dp[t][v] = max(dp[t][v], dp[t - 1][v + 1] + v + 0.5);
      if(v - 1 >= 0) dp[t][v] = max(dp[t][v], dp[t - 1][v - 1] + v - 0.5);
    }
  }
  printf("%.15lf\n", dp[T[N]][0]);
}


Measured memory_bytes: 16000
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define EVEL 1
 
#ifndef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
    ll N,A,B,X[100010];
    ll ans=0;
int main(){
    cin>>N>>A>>B;
    REP(i,N)cin>>X[i];
    REP(i,N-1){
        ans+=min((X[i+1]-X[i])*A,B);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <cstring>

int main() {
    int num[105], ans = 0, len = 1, n; 
    scanf("%d", &n); 
    for (int i = 1; i <= n; i++) {
        scanf("%d", &num[i]); 
    }

    for (int i = 2; i <= n; i++) {
        if (num[i] == num[i - 1]) {
            len++; 
        }
        else {
            ans += len / 2; 
            len = 1; 
        }
    }
    ans += len / 2; 
    printf("%d\n", ans); 

    return 0; 
}

Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm> 
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <list>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x&&x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS*max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x*x + y*y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;

ll gcd(ll x, ll y)
{
	if (x == 0) return y;
	if (y == 0) return x;

	ll t;

	while (y != 0)
	{
		t = x%y;
		x = y;
		y = t;
	}
	return x;
}

int main()
{
	int n,k;
	cin >> n >> k;

	vector <int> a(n);

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

	int mx = *max_element(a.begin(),a.end());

	ll g = a[0];
	for (int i = 1; i < n; ++i)
	{
		g = gcd(g, a[i]);
	}

	if (k <= mx && k%g == 0)
	{
		cout << "POSSIBLE" << endl;
	}
	else
	{
		cout << "IMPOSSIBLE" << endl;
	}

	return 0;




}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"

int main(){
  int N;
  cin>>N;
  vector<int> com(26,100);
  for(int i=0;i<N;i++){
    string S;
    cin>>S;
    vector<int> cnt(26);
    for(int j=0;j<S.size();j++)
      cnt[S[j]-'a']++;
    for(int j=0;j<26;j++)
      com[j] = min(com[j],cnt[j]);
  }
  string ans ="";
  for(int i=0;i<26;i++)
    for(int j=0;j<com[i];j++)
      ans += 'a' + i;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        char[] s=sc.next().toCharArray();
        sc.close();
        int n=s.length;
        int min=n;
        for(int i=1;i<n;i++){
            if(s[i]!=s[i-1]){
                min=Math.min(min, Math.max(i, n-i));
            }
        }
        System.out.println(min);
    }
}


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


int main() {
  string A,B;
  cin>>A;
  for(int i=0;i<A.size();i++){
    if(A.at(i)=='7'){
      B="Yes";
      break;
    }
  }
  if(B=="Yes"){
    cout<<B<<endl;
  }
  else{
    cout<<"No"<<endl;
  }

}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
constexpr int N_max = 200'000;

int main() {
    int n, k, c;
    string s;
    cin >> n >> k >> c >> s;

    auto begins = vector<int>(k);
    int day = 0;
    for (int i = 0; i < k; ++i) {
        while (s[day] == 'x')
            ++day;
        begins[i] = day;
        ++day;
        day += c;
    }

    auto ends = vector<int>(k);
    day = s.length() - 1;
    for (int i = k - 1; i >= 0; --i) {
        while (s[day] == 'x')
            --day;
        ends[i] = day;
        --day;
        day -= c;
    }

    for (int i = 0; i < k; ++i) {
        cerr << i << "th " << (begins[i] + 1) << ":" << (ends[i] + 1) << "\n";
        if (begins[i] == ends[i])
            cout << (begins[i] + 1) << "\n";
    }
    return 0;
}


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

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;




int main(){
	int N,K,Q; cin >> N >> K >> Q;
	vector<int> A(Q);
	rep(i,Q){
		cin >> A[i];
		A[i]--;
	}
	vector<int> res(N);
	rep(i,Q){
		res[A[i]]++;
	}
	rep(i,N){
		if(Q-res[i] >= K){
			cout << "No" << endl;
		}
		else cout << "Yes" << endl;
	}
}



Measured memory_bytes: 1408