akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define  all(A)         (A).begin() , (A).end()
#define  pb             push_back
#define  mp             make_pair
#define  ln(X)          (int)(X).length()
#define  forn(i, n)     for (int i = 0; i < int(n); i++)
#define  forr(i, n)     for (int i = int(n - 1); i >= 0; i--)
#define  fora(i, a, b)  for (int i = int(a); i <= int(b); i++)
#define  forb(i, a, b)  for (int i = int(a); i >= int(b); i--)
#define  deb(x)       cout << #x << ':' << x << endl;
int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);

    
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        string s;
        cin>>s;
        if(n&1)
        {
            cout<<"No";
        }
        else
        {
            string a="",b="";
            forn(i,n/2)
            {
                a=a+s[i];
                b=b+s[i+n/2];
            }
            if(!a.compare(b))cout<<"Yes";
            else cout<<"No";

        }
    }
    
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		int top1 = 0;
		int top2 = 0;
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			if (A[i] > top1) {
				top2 = top1;
				top1 = A[i];
			} else if (A[i] > top2) {
				top2 = A[i];
			}
		}
		sc.close();

		for (int i = 0; i < N; i++) {
			if (A[i] == top1) {
				System.out.println(top2);
			} else {
				System.out.println(top1);
			}
		}
	}
}


Measured memory_bytes: 86408
T = []
for i in range(5):
  t = int(input())
  T.append([t % 10, t])
T.sort()
ans = 0
flag = 0
for i in range(5):
  if T[i][0] == 0:
    ans += T[i][1]
  else:
    if flag == 0:
      ans += T[i][1]
      flag =1
    else:
      ans += ((T[i][1] // 10) + 1) * 10
print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
using namespace std;

int main(){
  int L,R,ans=10000;
  cin>>L>>R;
  
  if((R/2019)-(L/2019)>=1) ans=0;
  else if(L%2019==0 || R%2019==0) ans=0;
  else if(R-L>=2018) ans=0;
  
  else{
    int l=L%2019,r=R%2019;
    
    for(int i=l; i<=r-1; ++i){
      for(int j=i+1; j<=r; ++j){
        ans=min(ans,i*j%2019);
      }
    }
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using ll=long long;
using vi=vector<int>;
using pii=pair<int, int>;

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
ll read(){ll a;scanf("%lld",&a);return a;}

const int inf = TEN(9) + 10;
const int mod = TEN(9) + 10;

int N, X;

signed main()
{
	cin >> N >> X;

	vi L(N + 1);
	rep1(i, N) cin >> L[i];

	int ans = 1;

	int d = 0;
	rep1(i, N) {
		d += L[i];
		if (d <= X) ans++;
	}

	cout << ans << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int R;
    cin >> R;
    cout << M_PI * R * 2;
    return 0;
}

Measured memory_bytes: 3784
/* 
Rohit645
Rohit Kumar 
*/

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

using ll = long long;
using db = double;
using pll = pair < ll, ll >;

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

#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end() 
#define fastIo() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;

int main() {
	fastIo();
	ll n; cin >> n;
	ll a[n];
	for(ll i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll fcnt=-INF, cnt = 1;
	for(ll i = 1; i < n; i++) {
		if(a[i] <= a[i-1]) {
			cnt++;
		}
		else {
			cnt = 1;
		}
		fcnt = max(cnt, fcnt);		
	}
	if (n == 1) cout << 0 << endl;
	else 
		cout << fcnt-1 << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF=1<<29;
ll mod=1000000007;

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

	int N,Ans=0;
	cin>>N;
	for(int i=1;i<=N;i++){
		string str=to_string(i);
		if(str.size()%2==1) Ans++;
	}
	cout<<Ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int n,key,cnt,ans;
int t[1000001];
int main(){
  while(scanf("%d",&n)&&n){
    for(int i=0;i<n;i++)scanf("%d",&t[i]);
    t[n]=ans=-1;
    sort(t,t+n);
    key=t[0];
    cnt=1;
    for(int i=1;i<=n;i++){
      if(key==t[i])cnt++;
      else{
	if(cnt>n/2)ans=key;
	key=t[i];
	cnt=1;
      }
    }
    if(ans==-1)printf("NO COLOR\n");
    else printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 4960
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define int long long
#define pp pair<int,int>
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
int max(int x, int y)
{
    return x>y ? x : y;
}
int min(int x, int y)
{
    return x<y ? x : y;
}
void _(int&a , int b)
{
    a=(a%mod+b%mod)%mod;
    a=(a+mod)%mod;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m;cin >> n >> m;
    int ans=0;
    for (int i = 0; i < m; ++i)
    {
    	int d;cin >> d;ans+=d;
    }
    if(ans>n)cout << -1;else cout << n-ans;
    }

Measured memory_bytes: 3648
A, B, C, D = map(int, input().split())

if C <= A:
    if D <= A:
        result = 0
    elif A <= D and D <= B:
        result = D - A
    else:
        result = B - A
elif A <= C and C <= B:
    if D <= B:
        result = D - C
    else:
        result = B - C
else:
    result = 0

print(result)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define pb(a) push_back(a)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

typedef long long unsigned int ll;
typedef pair<ll, ll> P;

int main(){
	int N,res=0;
	cin >> N;
	int v[N],c;
	REP(i,N){
		cin >> v[i];
	}
	REP(i,N){
		cin >> c;
		if(v[i]-c>0) res+=v[i]-c;
	}
	cout <<res<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ll n,h,w,a1,a2,ans=0,i;
	cin>>n>>h>>w;
	for(i=0;i<n;i++)
	{
		cin>>a1>>a2;
		if(a1>=h && a2>=w)
		ans++;
	}
	cout<<ans;
 	return 0;
}


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

class BinaryIndexedTree {
 private:
  int n;
  vector<int64> xs;
 public:
  BinaryIndexedTree(int n) : n(n), xs(n) {}

  // Adds x to the i-th element.
  void Add(int i, int64 x) {
    int cur = i;
    while (cur < n) {
      xs[cur] += x;
      cur = cur | (cur + 1);
    }
  }

  // Returns a sum of a range [l r).
  int64 SumOfRange(int l, int r) {
    if (l >= r) return 0;
    if (l > 0) {
      return SumOfRange(0, r) - SumOfRange(0, l);
    }
    int64 s = 0;
    int i = r - 1;
    while (i >= 0) {
      s += xs[i];
      i = (i & (i + 1)) - 1;
    }
    return s;
  }
};

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

  int n, q;
  cin >> n >> q;
  BinaryIndexedTree bit(n);
  vector<int64> xs(n);
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
  }
  for (int i = 0; i < n; i++) {
    bit.Add(i, xs[i]);
  }
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t == 0) {
      int p, x;
      cin >> p >> x;
      bit.Add(p, x);
    } else {
      int l, r;
      cin >> l >> r;
      cout << bit.SumOfRange(l, r) << "\n";
    }
  }
}

Measured memory_bytes: 12176
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

K=ri()
print(K//2 * (K-K//2))

Measured memory_bytes: 3064
n=int(input())
inf=10000000
p=[-1 for i in range(n)]
M=[[inf for j in range(n)] for i in range(n)]
d=[inf for i in range(n)]
color=["white" for i in range(n)]
for i in range(n):
    tmp=list(map(int,input().split()))
    root=tmp[0]
    k=tmp[1]
    for j in range(k):
        v=tmp[2*(j+1)]
        M[root][v]=tmp[2*(j+1)+1]

def dijkstra(s):
    d[s]=0
    while True:
        mincost=inf
        for i in range(n):
            if color[i] is not "black" and d[i]<mincost:
                mincost=d[i]
                u=i
        if mincost is inf:
            break
        color[u]="black"
        for j in range(n):
            if color[j] is not "black" and M[u][j] is not inf:
                if d[u]+M[u][j]<d[j]:
                    d[j]=d[u]+M[u][j]
                    color[j]="gray"
                    p[j]=u

dijkstra(0)
for i in range(n):
    print(i,d[i])


Measured memory_bytes: 5776
#include <stdio.h>
#define N 13

int main(void){

  int n, i, a;
  char patt;
  int s[N] = {0};
  int h[N] = {0};
  int c[N] = {0};
  int d[N] = {0};
  
  scanf("%d", &n);
  n *= 2;

  for(i = 0; i < n; i++){
    scanf("%c %d", &patt, &a);
    switch(patt){
       case 'S':
	 s[a-1] = a;
	 break;
       case 'H':
	 h[a-1] = a;
	 break;
       case 'C':
	 c[a-1] = a;
	 break;
       case 'D':
	 d[a-1] = a;
	 break;
    }
  }

  for(i = 0; i < 52; i++){
    if (((s[i]) != (i + 1)) && (i < N)) {
      printf("S %d\n", i+1);
    } else if (((h[i-N]) != (i-N+1)) && ((N <= i) && (i < N*2))){
      printf("H %d\n", i-N+1);
    } else if (((c[i-N*2]) != (i-N*2+1)) && ((N*2 <= i) && (i < N*3))){
	printf("C %d\n", i-N*2+1);
	  } else if (((d[i-N*3]) != (i-N*3+1)) && (N*3 <= i)){
      printf("D %d\n", i-N*3+1);
    }
  }
  return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(void) {
	ll n, m, k;
	cin>>n>>m>>k;
	vector<vector<P> > l(n);
	REP(i, m) {
		ll a, b, c;
		cin>>a>>b>>c;
		--a;
		--b;
		l[a].pb(P(b, c));
		l[b].pb(P(a, c));
	}
	vector<ll> shop(k);
	REP(i, k) {
		ll gomi;
		cin>>gomi;
		--gomi;
		shop[i] = gomi;
	}
	priority_queue<P> que;
	vector<ll> dir(n, INF * INF);
	REP(i, k) {
		que.push(P(0, shop[i]));
		dir[shop[i]] = 0;
	}
	while(!que.empty()) {
		P np = que.top();
		que.pop();
		if(dir[np.second] != np.first) continue;
		REP(i, l[np.second].size()) {
			if(dir[l[np.second][i].first] > dir[np.second] + l[np.second][i].second) {
				dir[l[np.second][i].first] = dir[np.second] + l[np.second][i].second;
				que.push(P(dir[l[np.second][i].first], l[np.second][i].first));
			}
		}
	}
	ll res = 0;
	REP(i, n) {
		REP(j, l[i].size()) {
			ll k = (ll)(double(dir[l[i][j].first] - dir[i] + l[i][j].second) / 2 + 0.5);
			res = max(res, dir[i] + k);
		}
	}
	cout<<res<<endl;
}

Measured memory_bytes: 8812
import scala.io.StdIn.readLine
import scala.io.StdIn.readInt
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val x = sc.nextDouble()
  var m = 100.0
  var y = 0
  do{
    y += 1
    m *= 1.01
    m =  m.floor
  }while(m < x)
  println(y)
}

Measured memory_bytes: 55288
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    double A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    double sugar, water, sugar_max = 0, water_max = 0, limit, concentration, max;
    limit = 100*E / (100 + E);          // 最大濃度[%]
    for(int a=0;a<=30;a++){             // 操作1
        for(int b=0;b<=30;b++){         // 操作2
            for(int c=0;c<=3000;c++){     // 操作3
                for(int d=0;d<=3000;d++){ // 操作4
                    water = 100*A*a + 100*B*b;  // 水の総量
                    sugar = C*c + D*d;          // 砂糖の総量
                    if(sugar + water > F)       // 重量制限
                        break;
                    if(sugar + water == 0){
                        concentration =  0;
                    }else{
                        concentration = 100*sugar / (sugar + water);    // 濃度[%]
                    }
                    if(concentration <= limit && concentration > max){
                        sugar_max = sugar;
                        water_max = water;
                        max = concentration;
                    }
                }
            }
        }
    }

    if(max == 0)
        cout << 100*A << " " << 0 << endl; 
    else
        cout << sugar_max + water_max << " " << sugar_max << endl; 
    
    return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
a = [input() for _ in range(H)]

b = []

for i in a:
    if i != '.' * W:
        b.append(i)

h = len(b)

ans = [[] for _ in range(h)]
        
for i in range(W):
    jdg = True
    for j in range(h):
        if b[j][i] != '.':jdg = False
        ans[j].append(b[j][i])
    if jdg:
        for j in range(h):
            ans[j].pop()

for a in ans:
    print(*a, sep='')


Measured memory_bytes: 4596
'use strict';

function Main(input) {
    const tmp = input.split("\n")[0].split(" ");
    let A = parseInt(tmp[0], 10);
    let B = parseInt(tmp[1], 10);
    if (A == 1) {
        A += 13;
    }
    if (B == 1) {
        B += 13;
    }

    if (A == B) {
        console.log("Draw");
    } else if (A > B) {
        console.log("Alice");
    } else {
        console.log("Bob");
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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



int main() {
	int n, a, b;
	cin >> n >> a >> b;
	if (n*a >= b) {
		cout << b << endl;
	}
	else {
		cout << n*a << endl;
	}



	return 0;
}

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


int main(){
  int x; cin >> x;
  int n = x / 100;
  int p = x - 100*n;
  if(n*5 < p)cout << 0 << endl;
  else cout << 1 << endl;   
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG

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

using ll = long long;

#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                     \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

ll f(ll x) {
  int res = 0;
  while (x % 2 == 0) {
    x /= 2;
    res++;
  }
  return res;
}

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

void solve(ll N, ll M, std::vector<ll> a) {
  rep(i, N) { a.at(i) /= 2; }

  ll t = f(a.at(0));
  rep(i, N) {
    if (t != f(a.at(i))) {
      cout << 0 << endl;
      return;
    }
    a.at(i) >>= t;  // a.ati /= 2^t
  }
  M >>= t;

  ll l = 1;
  rep(i, N) {
    l = lcm(l, a.at(i));
    if (l > M) {
      cout << 0 << endl;
      return;
    }
  }

  M /= l;
  int ans = (M + 1) / 2;
  cout << ans << endl;
}

int main() {
  ll N;
  scanf("%lld", &N);
  ll M;
  scanf("%lld", &M);
  std::vector<ll> a(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }
  solve(N, M, std::move(a));
  return 0;
}


Measured memory_bytes: 3968
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
// const int mod=998244353;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,k;
    cin>>n>>k;
    int m=(n-1)*(n-2)/2;
    if(m<k){
        cout<<-1<<endl;
        return;
    }
    cout<<(n-1)+m-k<<endl;
    REP(i,2,n)cout<<1<<sp<<i<<endl;
    int cnt=m-k;
    REP(i,2,n){
        REP(j,i+1,n){
            if(!cnt)return;
            cout<<i<<sp<<j<<endl;
            cnt--;
        }
    }
}

Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<map>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)
int INF=1e9;
const long long mod=1e9+7;
typedef long long ll;

int main(){
  double W,H,x,y;
  cin>>W>>H>>x>>y;
  if(W/2==x&&H/2==y){
    cout<<double(W*H/2)<<" "<<1<<endl;
  }
  else{
    cout<<double(W*H/2)<<" "<<0<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	float a,b,c,d,e,f,x,y;
	while(scanf("%f %f %f %f %f %f",&a,&b,&c,&d,&e,&f)!=EOF){
		y=(a*f-d*c)/(a*e-d*b);
		x=(c-b*y)/a;
		printf("%5.3f %5.3f\n",x,y);
	}
	return 0;
}

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

int main()
{
    list<int>a;
    int q;
    cin>>q;
    auto now=a.end();
    REP(i,q)
    {
        int q1;
        cin>>q1;
        if(q1==0)
        {
            int x;
            cin>>x;
            now=a.insert(now,x);
        }else if(q1==1)
        {
            int y;
            cin>>y;
            advance(now,y);
        }else if(q1==2)now=a.erase(now);
    }
    for(auto itr:a)cout<<itr<<endl;
}


Measured memory_bytes: 18636
N=int(input())
ans=''

if N==0:
    print(0)
    exit()
else:    

    while N != 1:
        if N % (-2) ==0:
            N = N//(-2)
            ans = '0' + ans
        else:
            ans = '1' + ans
            N = (N-1) // (-2)

    ans = '1' + ans

    print(ans)
    

Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
using namespace std;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;

int n,len;
string s; 
vector<string> v;


int main() {
    ios::sync_with_stdio(false);cin.tie(0);
  	cin>>n>>len;
  	 for(int i=1;i<=n;++i){
  	 	cin>>s;
  	 	v.pb(s);
  	 }

  	 sort(v.begin(),v.end());
  	 for(auto w:v){
  	 	cout<<w;
  	 }



    return 0;
}

Measured memory_bytes: 3608
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N =int(input())
    A = list(map(int, input().split()))
    ans = 0
    while True:
        ok = True
        for i in range(N):
            if A[i] != 0 and A[i] % 2 == 0:
                A[i] //= 2
            else:
                ok = False
        if not ok:
            break
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()


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

int main(void){
    // Here your code !
    int n;
    cin >> n;
    vector<int> menber(n);
    for(int i = 0; i < n; i++) cin >> menber[i];
    
    //int upper = 0,lower = 200;
    unsigned long long int ans = n * 200 * 200 + 1;
    
    for(int i = -100; i <= 100; i++){
        
        //int mid = ((upper + lower) / 2) - 100;
        int mid = i;
        unsigned long long int tmp = 0;
        
        for(int j = 0; j < n; j++){
            tmp += pow(menber[j] - mid,2);
        }
        
        ans = min(tmp,ans);
    }
    
    cout << ans << endl;

}


Measured memory_bytes: 256
import sys
import numpy as np

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return is_prime


def main():
    prime = primes(10**5)
    like2017 = [False]*(10**5+1)
    for i in range(1,10**5+1,2):
        if prime[i] and prime[(i+1)//2]:
            like2017[i] = True
    like2017 = np.array(like2017).cumsum()

    Q = int(readline())
    for _ in range(Q):
        l,r = map(int, readline().split())
        print(like2017[r]-like2017[l-1])

if __name__ == '__main__':
    main()


Measured memory_bytes: 30144
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define DEBUG 0 
#define LIMIT (LONG_MAX / 10)
#define POSITIVE_LAST_D (LONG_MAX % 10)
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

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


Measured memory_bytes: 81340
import sys

input=sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()


def II(): return int(input())


def MI(): return map(int,input().split())


def MF(): return map(float,input().split())


def LI(): return list(map(int,input().split()))


def LF(): return list(map(float,input().split()))


def TI(): return tuple(map(int,input().split()))


# rstrip().decode('utf-8')


def main():
	n,k=MI()
	m=10**9+7
	
	ans=0
	
	for i in range(n-k+2):
		ans+=n*(n+1)//2-i*(i-1)//2-(n-i)*(n-i+1)//2+1
		#print(n*(n+1)//2-i*(i-1)//2,(n-i)*(n-i+1)//2)
		ans%=m
		#print(ans)
	print(ans)
	
	
	
	

if __name__=="__main__":
	main()


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

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

bool vis[405][405];
ll ara[405];
pll dp[405][405];

/** dp[i][j].first - total sum for this interval ; dp[i][j].second - minimum total cost to build this interval **/

pll FuN(ll lft,ll rgt)
{
    if(lft > rgt)
        return make_pair(0LL , 0LL);
    if(lft == rgt)
        return make_pair(ara[lft] , 0);
    if(lft+1 == rgt)
        return make_pair(ara[lft]+ara[rgt] , ara[lft]+ara[rgt]);
    if(vis[lft][rgt])
        return dp[lft][rgt];
    pll ret = {1e18 , 1e18};
    for(ll i=lft ; i<rgt ; i++){
        pll pr1 = FuN(lft , i);
        pll pr2 = FuN(i+1 , rgt);
        pll newpr = make_pair((pr1.first+pr2.first) , (pr1.first+pr2.first+pr1.second+pr2.second));
        if(ret.second > newpr.second)
            ret = newpr;
    }
    vis[lft][rgt] = 1;
    return dp[lft][rgt] = ret;
}

int main()
{
    ll i,j,k,n;
    cin>>n;
    for(i=1 ; i<=n ; i++)   cin>>ara[i];

    pll ans = FuN(1 , n);
    cout<<ans.second<<endl;

    return 0;
}


Measured memory_bytes: 6140
//--------------------------------------------------
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,avx,avx2,popcnt,fma")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Ofast")
//--------------------------------------------------
#include <bits/stdc++.h>
#include <chrono>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <cassert>
#include <random>
#include <bitset>
#include <iomanip>
#include <numeric>
#include <time.h>
#include <ctime>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <fstream>
#include <stack>
#include <cstring>
//--------------------------------------------------
#define forn(i, n) for(int i = 0; i < n; i++)
#define forw(i, n) for(int i = n-1; i >= 0; --i)
#define forns(i, n, s) for(int i = s; i < n; i++)
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
//----------------------------------------------------
using namespace std;
//----------------------------------------------------
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
typedef vector<ll> lnum;
typedef complex<ld> comp;
//----------------------------------------------------
const ll mod = 1e9 + 7, mod2 = 998244353;
const ld eps = 1e-6;
const ll inf = 1e18;
const int base = 1e9;
const ld PI = 3.1415926;
//----------------------------------------------------
//#define endl '\n';
#ifdef MY_DEBUG
void deb(ld x) { cerr << x << endl; };
#else
void deb(ld x){};
#endif
//----------------------------------------------------
//----------------------------------------------------
ll x, y, a, b, c;
vector<ll> r, g, d;
multiset<ll> s;
ll ans = 0;
//----------------------------------------------------
unsigned int bitcount(ull val) { return __builtin_popcount(val) + __builtin_popcount(val >> 32); }

void local() {
    freopen("test.in", "r", stdin);
}

void remote() {
}

void read() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> x >> y >> a >> b >> c;
    r.resize(a), g.resize(b), d.resize(c);
    forn(i, a) cin >> r[i];
    forn(i, b) cin >> g[i];
    forn(i, c) cin >> d[i];
}


int main() {
#ifdef MY_DEBUG
    local();
#else
    remote();
#endif
    read();

    sort(all(r), greater<ll>());
    sort(all(g), greater<ll>());
    sort(all(d), greater<ll>());

    forn(i, x) ans += r[i], s.insert(r[i]);
    forn(i, y) ans += g[i], s.insert(g[i]);

    int k = 0;
    while (k < d.size() && d[k] > *s.begin()){
        ans = ans - *s.begin() + d[k];
        s.erase(s.begin());
        s.insert(d[k]);
        k++;
    }

    cout << ans << endl;

}

Measured memory_bytes: 11008
#include <stdio.h>
typedef long long int ll;
const int MOD=1e9+7;
const int N=2e3+10;
ll fac[N],ans[N][N];
ll pow(ll a,ll t){
    if(t==0)return 1;
    ll temp=pow(a,t/2);
    temp*=temp;
    temp%=MOD;
    if(t&1){
        temp*=a;
        temp%=MOD;
    }
    return temp;
}
ll rev(ll n){return pow(n,MOD-2);}
ll C(int n,int k){return (fac[n]*((rev(fac[k])*rev(fac[n-k]))%MOD))%MOD;}
ll H(int n,int k){return C(n+k-1,k);}
void init(){
    fac[0]=fac[1]=1;
    for(int i=2;i<N;i++)fac[i]=(fac[i-1]*i)%MOD;
    for(int i=0;i<N;i++)for(int j=0;j<N;j++)ans[i][j]=-1;
    ans[0][0]=1;
    return ;
}
ll dp(int n,int k){
    if(n<0||k<0)return 0;
    if(ans[n][k]>=0)return ans[n][k];
    if(n==k)return ans[n][k]=dp(n-1,k-1);
    return ans[n][k]=(dp(n-1,k-1)+k*dp(n-1,k))%MOD;
}
int main(){
    int n,k,now=1;
    ll ans=0;
    scanf("%d%d",&n,&k);
    init();
    //for(int i=1;i<=k;i++){
    //    ans+=dp(n,i);
    //    ans%=MOD;
    //}
    printf("%lld\n",dp(n,k));
}


Measured memory_bytes: 34372
use std::cmp;

#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<::std::cmp::Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> ::std::cmp::Ordering {
        other.0.cmp(&self.0)
    }
}

#[allow(dead_code)]
pub struct Scanner<'a> {
    _buf: &'a str,
    iter: ::std::str::SplitWhitespace<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    pub fn new(buf: &'a str) -> Self {
        Scanner {
            _buf: buf,
            iter: buf.split_whitespace(),
        }
    }

    pub fn array<T>(&mut self, n: usize) -> Vec<T>
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        let mut res = Vec::with_capacity(n);
        for _ in 0..n {
            res.push(self.value());
        }
        res
    }

    pub fn value<T>(&mut self) -> T
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        self.next().parse().unwrap()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.next().chars().collect()
    }

    fn next(&mut self) -> &str {
        self.iter.next().unwrap()
    }
}

fn cnt(v: &[i64]) -> Vec<i64> {
    let mut res = vec![0; 100001];
    for &e in v {
        res[e as usize] += 1;
    }
    res
}

fn top2(cnt: &[i64]) -> ((i64,i64),(i64,i64)) {
    let mut v: Vec<_> = cnt.iter().enumerate().map(|(i,&e)| (e,i as i64)).collect();
    v.sort_by_key(|&e| Rev(e));
    (v[0], v[1])
}

fn main() {
    let mut _input = String::new();
    {
        use ::std::io::Read;
        ::std::io::stdin().read_to_string(&mut _input).unwrap();
    }
    let mut sc = Scanner::new(&_input);

    let n = sc.value::<usize>();
    let m = (n/2) as i64;
    let (mut a, mut b) = (Vec::with_capacity(m as usize), Vec::with_capacity(m as usize));
    for _ in 0..m {
        a.push(sc.value::<i64>());
        b.push(sc.value::<i64>());
    }

    let cnt_a = cnt(&a);
    let cnt_b = cnt(&b);
    let top2_a = top2(&cnt_a);
    let top2_b = top2(&cnt_b);
    //eprintln!("{:?}", top2_a);
    //eprintln!("{:?}", top2_b);

    let ans = if (top2_a.0).1 != (top2_b.0).1 {
        m - (top2_a.0).0 + m - (top2_b.0).0
    }
    else {
        cmp::min(
            m - (top2_a.0).0 + m - (top2_b.1).0,
            m - (top2_a.1).0 + m - (top2_b.0).0
        )
    };

    println!("{}", ans);
}


Measured memory_bytes: 12408
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int n, ptr, res;
int a[200000];

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);
    vector<int> dic(n+1, 0);
    for (int i = 0; i < n; ++i)
    {
        scanf("%d", &a[i]);
        ++dic[a[i]];
    }

    if (dic.size() <= k)
    {
        cout << 0 << endl;
    }
    sort(dic.begin(), dic.end());
    int ans = 0;
    auto itr = dic.begin();
    while(distance(itr, dic.end()) > k)
    {
        ans += *itr;
        ++itr;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4872
n=gets.to_i
v=gets.split.map &:to_i

odd=Hash.new 0
even=Hash.new 0

n.times{|i|
  [even, odd][i%2][v[i]]+=1
}

odd[-1]=0
even[-1]=0

odd=odd.sort_by{|k,v|v}.reverse
even=even.sort_by{|k,v|v}.reverse

if odd[0][0]!=even[0][0]
  p n-odd[0][1]-even[0][1]
else
  p [
    n-odd[0][1]-even[1][1],
    n-odd[1][1]-even[0][1]
  ].min
end


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

int main(){

    int A, B;
    cin >> A >> B;
    string S;
    cin >> S;

    bool ans = true;
    for(int i = 0; i < S.length(); i++){
        if(i == A && S[i] != '-') ans = false;
        else if(i != A && !('0' <= S[i] && S[i] <= '9')) ans = false; 
    }

    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int X, ans=0; cin >> X;
if(400<=X&&X<=599){ans=8;}
if(600<=X&&X<=799){ans=7;}
if(800<=X&&X<=999){ans=6;}
if(1000<=X&&X<=1199){ans=5;}
if(1200<=X&&X<=1399){ans=4;}
if(1400<=X&&X<=1599){ans=3;}
if(1600<=X&&X<=1799){ans=2;}
if(1800<=X&&X<=1999){ans=1;}
cout << ans << "\n";
}

Measured memory_bytes: 3628
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli r;
    cin>>r;
    out(r*r);
}

Measured memory_bytes: 3572
<?php
list($N, $M) = ints();
if($N==1)$map[] = "0";
for($i = 10**($N-1); $i < 10**$N; $i++){
    $map[] = sprintf("%d", $i);
}
for($i = 0; $i < $M; $i++){
    $map2 = [];
    list($s, $c) = ints();
    foreach($map as $num){
        if($num[$s-1] == $c){
            $map2[] = $num;
        }
    }
    $map = $map2;
}
if($map){
    foreach($map as $value){
        echo $value,"\n";
        exit;
    }
}else{
    echo -1,"\n";
}

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;}
function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;}

function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array: ";
            echo implode(" ", addIndex($val))."\n";
        }else{
            echo "array:array\n";
            if(isCleanArray($val)){
                foreach($val as $row)echo implode(" ", addIndex($row))."\n";
            }else{
                foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row))."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}
function addIndex($val){
    if(!isCleanArray($val)){
        $val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);
    }
    return $val;
}
function isCleanArray($array){
    $clean = true;
    $i = 0;
    foreach($array as $k => $v){
        if($k != $i++)$clean = false;
    }
    return $clean;
}
/**
 * 座圧対象の配列を渡すと以下の値を返す
 * ・圧縮された配列
 * ・復元用のMap
 * ・圧縮用のMap
 **/
function atsu($array){
    $a = array_flip($array);
    $fuku = array_flip($a);
    sort($fuku);
    $atsu = array_flip($fuku);
    foreach($array as $i => $val)$array[$i] = $atsu[$val];
    return [$array, $fuku, $atsu];
}
//配列の最大公約数
function gcdAll($array){
    $gcd = $array[0];
    for($i = 1; $i < count($array); $i++){
        $gcd = gcd($gcd, $array[$i]);
    }
    return $gcd;
}

//最大公約数
function gcd($m, $n){
    if(!$n)return $m;
    return gcd($n, $m % $n);
}

//配列の最小公倍数
function lcmAll($array){
    $lcm = $array[0];
    for($i = 1; $i < count($array); $i++){
        $lcm = lcm($lcm, $array[$i]);
    }
    return $lcm;
}

//最小公倍数
function lcm($a, $b) {
    return $a / gcd($a, $b) * $b;
}
//ビットカウント-1の数を数える
function popcount($x){
    $con = 0;
    while ($x) {
        $x &= $x-1;
        ++$con;
    }
    return $con;
}


Measured memory_bytes: 4856
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 1e5
#define INF 1<<30
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;
int main() {
	cin >> A >> B;
	if (A >= 13) {
		cout << B << endl;
	}
	else if (6 <= A && A <= 12) {
		cout << B / 2 << endl;
	}
	else {
		cout << 0 << endl;
	}
}


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

int main(){
  int a,b; cin >> a >> b;
  if(a <= 5) cout << 0;
  else if(a <= 12) cout << b/2;
  else cout << b;
}

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

int main(){
  int n;
  cin>>n;
  double a;
  double sum=0;
  for(int i=0;i<n;i++){
    cin>>a;
    sum+=1/a;
  }
  
  
  cout<<1/sum <<endl;
}

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

using namespace std;
 
#define MD 1000000007
typedef long long int ll;

int main(){
    int a,b;
    cin>>a>>b;
    if(a%500<=b){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import math

a,b,c,d = map(int,input().split())

s1=b//c - (a-1)//c
s2=b//d - (a-1)//d
s12=b//(c*d//math.gcd(c,d)) - (a-1)//(c*d//math.gcd(c,d))
#print(s1,s2,s12)
print(b-a+1-(s1+s2-s12))


Measured memory_bytes: 8932
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 11000

int N,K,M,R;
int ans[NUM];

void calc(int bunshi,int bunbo){

	for(int i = 0; i < NUM; i++){
		ans[i] += bunshi/bunbo;
		bunshi %= bunbo;
		bunshi *= 10;
		if(bunshi == 0)return;
	}
}

void func(){

	for(int i = 0; i < NUM; i++)ans[i] = 0;

	if(M == 0){
		calc(1,N);
	}else{ //M == 1
		calc(1,N);
		for(int a = 1; a <= N-1; a++){
			calc(1,N*a);
		}
	}

	for(int a = NUM-1; a >= 1; a--){
		if(ans[a] >= 10){
			ans[a-1] += ans[a]/10;
			ans[a] %= 10;
		}
	}

	printf("%d.",ans[0]);
	for(int a = 1; a <= R; a++){
		printf("%d",ans[a]);
	}
	printf("\n");
}


int main(){

	while(true){
		scanf("%d %d %d %d",&N,&K,&M,&R);
		if(N == 0 && K == 0 && M == 0 && R == 0)break;

		func();
	}

	return 0;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int solve(vi& tbl){
    int m = (int)tbl.size();
    // for(auto& e : tbl) cerr << e << " "; cerr << endl;
    vector<vi> dp(m + 1, vi(3, -1));
    dp[0][0] = 0;
    rep(i, m - 1){
        rep(j, 3){
            int& cur = dp[i][j];
            if(cur == -1) continue;
            chmax(dp[i + 1][0], cur);

            if(j == 0){
                chmax(dp[i + 1][2], cur + tbl[i]);
                chmax(dp[i + 1][1], cur + tbl[i + 1]);
            }
            else if(j == 1){
                if(tbl[i] >= 2){
                    chmax(dp[i + 1][1], cur + tbl[i + 1] - 1);
                }
            }
            else {
                if(tbl[i] >= 2){
                    chmax(dp[i + 1][2], cur + tbl[i] - 1);
                    chmax(dp[i + 1][1], cur + tbl[i + 1]);
                }
            }
        }
    }
    int ret = 0;
    rep(j, 3){
        chmax(ret, dp[m - 1][j]);
    }
    return ret;
}

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

    int n; cin >> n;
    string in; cin >> in;
    in += "0000";

    int res = 0;
    rep(i, n){
        if(in[i] == '0') continue;
        vi tbl;
        int j = i;
        while(in[j] == '1'){
            int cnt = 0;
            while(in[j] == '1') cnt++, j++;
            tbl.emplace_back(cnt);
            j++;
        }
        i = j;
        res += solve(tbl);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1172
from collections import deque
n, l = map(int, input().split())
a = list(map(int, input().split()))
last = -1
for i in range(1,n):
    if a[i-1] + a[i] >= l :
        last = i
if last == -1:
    print("Impossible")
else:
    print("Possible")
    for i in range(1, last):
        print(i)
    for i in range(n-1,last,-1):
        print(i)
    print(last)

Measured memory_bytes: 90316
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

int main() {
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	cout << min(a, min(b, c)) + min(d, e) - 50 << endl;
}


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

using namespace std;

namespace {

    template<class T> ostream& operator<<(ostream& os, const vector<T>& xs) {
        if (xs.empty()) return os << "[]";
        os << "[" << xs[0];
        for (int i = 1; i < xs.size(); i++) os << " " << xs[i];
        return os << "]";
    }

    vector<string> F;
    bool input() {
        F.clear(); F.resize(8);
        string s;
        getline(cin, s);
        if (cin.eof()) return false;
        istringstream is(s);
        for (int i = 0; i < 8; i++) {
            string t; is >> t;
            F[i] = t;
        }
        return true;
    }

    vector<int> xs[3];
    void init() {
        for (int i = 0; i < 3; i++) 
            xs[i].resize(4);
        xs[0][0] = 0; xs[0][1] = 1; xs[0][2] = 2; xs[0][3] = 3;
        xs[1][0] = 1; xs[1][1] = 2; xs[1][2] = 7; xs[1][3] = 4;
        xs[2][0] = 0; xs[2][1] = 1; xs[2][2] = 4; xs[2][3] = 5;
    }

    void rot(vector<int>& ys) {
        int t = ys[3];
        for (int i = 3; i >= 0; i--) ys[i] = ys[i - 1];
        ys[0] = t;
    }

    void rot(vector<string>& s, int index) {
        vector<int>& from = xs[index];
        vector<int> to = xs[index];
        rot(to);
        vector<string> t = s;
        for (int i = 0; i < 4; i++) {
            s[ to[i] ] = t[ from[i] ];
            s[ 7 - to[i] ] = t[ 7 - from[i] ];
        }
    }

    void dfs(vector<string>& s, int index, set< vector<string> >& X) {
        if (index == 3) return;
        for (int i = 0; i < 4; i++) {
            X.insert(s);
            rot(s, index);
            dfs(s, index + 1, X);
        }
    }

    void solve() {
        set< vector<string> > X;
        sort(F.begin(), F.end());
        int ans = 0;
        do {
            if (X.count(F)) continue;
            ans++;
            dfs(F, 0, X);
        } while (next_permutation(F.begin(), F.end()));
        cout << ans << endl;
    }
}

int main() {
    init();
    while (input()) solve();
    return 0;
}

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

long fulfill(long num, long x){
	if(num != -1){
		return (num - num % x) / x + 1;
	}else{
		return 0;
	}
}
 
int main() {
	long a, b, x;
	cin >> a >> b >> x;
	cout << fulfill(b, x) - fulfill(a - 1, x) << endl;
}

Measured memory_bytes: 256