akhauriyash/Code-Regression huggingface dataset:
// Educational DP - ATCoder - D - Knapsack 1
// A. Bacca
#include <bits/stdc++.h>
using namespace std;

int n, w;
vector <pair <int, long long> > items;
vector <vector <long long> > dp_items;

void Recibir() {
	int wi, vi;
	cin >> n >> w;
	
	dp_items.resize(n+1);
	for (int i=0; i<=n; i++) dp_items[i].assign(100001, -1);
	
	for (int i=0; i<n; i++) {
		cin >> wi >> vi;
		items.push_back(pair <int, long long> (wi, vi));
	}
}

long long Backpack(int idx, int wlf) {
	long long take {0}, leave {0};
	
	// Datos guardados
	if (dp_items[idx][wlf] != -1) return dp_items[idx][wlf];
	
	// Caso base, out of range
	if (idx == n) return 0;
	// Caso recursivo
	else {
		// Excede el peso
		if (wlf < items[idx].first) return dp_items[idx][wlf] = Backpack(idx+1, wlf);
		// Se puede tomar o no tomar
		else {
			take = Backpack(idx+1, wlf - items[idx].first) + items[idx].second;
			leave = Backpack(idx+1, wlf);
			return dp_items[idx][wlf] = max(take, leave);
		} 
	}
}

int main() {
	Recibir();
	cout << Backpack(0, w);
	return 0;
}

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

#define pb push_back
#define eb emplace_back

using namespace std;

using vi = vector<int>;
using ll = long long;

int main(){
    ios :: sync_with_stdio(false);
    cout.precision(12);
    double n, k;
    cin >> n >> k;


//    // cerr << x << endl;

//     long double r = pow(2, n) - 1.0;
//     long double b = pow(2, x);
//     long double result = r/n;
//     result/=b;

    long double result=0;
    double p = 1.0/n;
    for(int i=1; i<=n; ++i){
        double x = k/i;
        int l = ceil(log2(x));
       // cerr << "L = " << l << endl;
        if(l>0)
            result+= p * (1/pow(2, l));
        else
            result+=p;
    }
    //result/=n;
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>

int main(void)
{
        int i;
        double n;
        int sum;
        double ans;

        scanf("%lf", &n);

        for(i = 1; i <= n; i++){
                if(i % 2 == 1){
                        sum++;
                }
        }

        ans = sum / n;

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

        return 0;
}

Measured memory_bytes: 128
/* When Talent doesn't work, Hard work beats Talent*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include"bits/stdc++.h"

using namespace std;

#define Fast_D cout<<fixed<<setprecision(13);
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define nl "\n"
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define scanstr(s) cin>>ws; getline(cin,s);
//#define Local = 1;
#ifdef Local
#define debug(x) cout << __LINE__ << " " << #x <<"..." << x << endl
#define dev(x) cout << __LINE__ << " " << #x << "..." ; for(auto &it : x) cout<< it << " "; cout << endl;
#define des(x) cout << __LINE__ << " " << #x << "..." << x << endl;
#else
#define debug(x) ;
#define dev(x);
#define des(x)
#endif

const double PI = 3.141592653589793;

void solve()
{
	int n,x;
	cin >> n >> x;
	vector <int> a(n+1);
	a[0] = x;
	for(int i=1;i<n+1;i++) cin >> a[i];
	sort(all(a));
	int sz = a.size();
	vector <int> dif;
	for(int i=0;i<sz-1;i++)
	{
		dif.push_back(a[i+1]-a[i]);
	}
	int ans = dif[0];
	for(int i=0;i<dif.size();i++)
	{
		ans = __gcd(ans,dif[i]);
	}
	cout << ans ;
}

int32_t main()
{
	FastIO;
	Fast_D;
	int T;
	T = 1;
	while(T--) solve();
	return 0;
}



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

string s[105];

int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i = 0 ; i < n ; i ++){
		cin>>s[i];
	}
	sort(s,s+n);
	for(int i = 0 ; i < n ; i++){
		cout << s[i];
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
a = []
for i in range(3):
	a.append(list(map(int,input().split())))

judge = 0
if a[0][1] - a[1][1] == a[0][2] - a[1][2] == a[0][0] - a[1][0]:
	if a[1][1] - a[2][1] == a[1][2] - a[2][2] == a[1][0] - a[2][0]:
		if a[1][0] - a[1][1] == a[2][0] - a[2][1] == a[0][0] - a[0][1]:
			if a[1][1] - a[1][2] == a[2][1] - a[2][2] == a[0][1] - a[0][2]:
				judge = 1

if judge == 0:
	print("No")
else:
	print("Yes")
	


Measured memory_bytes: 3064
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>
#include <random>
#include <type_traits>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

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

int main() {

    int N;
    cin >> N;

    vector<int> L(N);
    for (int i = 0; i < N; i++) cin >> L[i];

    sort(L.begin(), L.end());

    LL ans = 0;
    for (int i = 2; i < N; i++) {
        for (int j = 0; j < i; j++) {
            int c = L[i] - L[j] + 1;
            int pos = lower_bound(L.begin(), L.end(), c) - L.begin();
            ans += max(0, j - pos);
        }
    }

    cout << ans << endl;

    return 0;
}





















































Measured memory_bytes: 256
#include <bits/stdc++.h>
#define m ((long long)1e9+7)
typedef long long ll;
using namespace std;
         
int main() {
      string s,t;
      cin>>s>>t;
      int ss=s.size(),st=t.size();
      int h[26][ss];
      for(int i=0;i<26;i++)
      for(int j=0;j<ss;j++)
      h[i][j]=0;
      h[s[0]-'a'][0]++;
      for(int i=1;i<ss;i++){
      h[s[i]-'a'][i]++;
      for(int j=0;j<26;j++)
      h[j][i]+=h[j][i-1];
      }
      int in=upper_bound(h[t[0]-'a'],h[t[0]-'a']+ss,0)-h[t[0]-'a'],co=-1;ll su=0;
      if(in==ss)
      {
          cout<<-1<<endl;
          return 0;
      }
      co=in+1;
      //cout<<in<<endl;
      for(int i=1;i<st;i++)
      {
          in=upper_bound(h[t[i]-'a']+in,h[t[i]-'a']+ss,h[t[i]-'a'][in])-h[t[i]-'a'];
          //cout<<in<<endl;
          if(in<ss)
          {
              co=in+1;
          }
          else
          {
              su+=(ll)ss;co=-1;
              in=upper_bound(h[t[i]-'a'],h[t[i]-'a']+in,0)-h[t[i]-'a'];
              //cout<<in<<endl;
              //cout<<su<<endl;
              if(in==ss)
              {
                  cout<<-1<<endl;
                  return 0;
              }
          }
      }
      su+=(ll)(in+1);
      cout<<su<<endl;
	return 0;
}

Measured memory_bytes: 10752
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>

#include <vector>
#include <stack> // s.top()
#include <queue> // s.front()
using namespace std;

typedef long long llong;
typedef vector<int> vecint;
typedef vector<llong> vecllong;
typedef pair<llong, llong> P;

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10

bool pairComp(const P& firstElof, const P& secondElof) {
	return firstElof.second > secondElof.second;
}

// ========================================================


int main() {
	int N, K;
	cin >> N >> K;

	if (N % 2 == 1) {
		N++;
	}
	if (K <= N / 2)cout << "YES" << endl;
	else cout << "NO" << endl;



	return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S, T, ans = "No";
  cin >> S >> T;
  if (S == T) ans = "Yes";
  for (int i = 0; i < S.size(); i++) {
    S = S.substr(1) + S[0];
    if (S == T) ans = "Yes";
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

ll proinverse(ll x,ll m){
    ll res=1,M=m-2;
    while(M>0){
        if(M&1) res=res*x%m;
        x=x*x%m;
        M>>=1;
    }
    return res;
}

int main(){
    ll n,s,x=proinverse(2,mod); cin>>n>>s;
    vector<ll> a(n,0);
    vector<vector<ll>> dp(n+1,vector<ll>(s+1,0));
    rep(i,n) cin>>a[i];
    dp[0][0]=1;
    rep(i,n) dp[0][0]=(dp[0][0]*2)%mod;
    rep(i,n){
        rep(j,s+1){
            dp[i+1][j]=(dp[i+1][j]+dp[i][j])%mod;
            dp[i+1][j]%=mod;
            if(j+a[i]<=s){
                dp[i+1][j+a[i]]=dp[i+1][j+a[i]]+(dp[i][j]*x)%mod;
                dp[i+1][j+a[i]]%=mod;
            }
        }
    }
    cout<<(dp[n][s]+mod)%mod<<endl;
}

Measured memory_bytes: 73696
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	// AtCoder Beginner Contest 116
	// https://atcoder.jp/contests/abc116/tasks
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int ab = sc.nextInt();
		int bc = sc.nextInt();
		int ca = sc.nextInt();
		System.out.println((ab * bc) / 2);
		
	}
	
	static class FastReader { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine()); 
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try{ 
                str = br.readLine(); 
            } catch (IOException e) { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
}


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

int main(void){
    int n, x;
    long long d = 0;
    int result = 1;

    cin >> n >> x;
    
    vector<int> l(n);

    rep(i, n){
        cin >> l.at(i);
    }

    rep(i, n){
        d += l.at(i);
        if(d <= x){
            result++;
        }
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 256
from collections import deque
while True:
    w, h = map(int, input().split())
    if w == 0 and h == 0:
        break
    areas = [list(map(int, input().split())) for _ in range(h)]

    # print(areas)

    # 島の数を出す。
    # 島の定義は陸地続きであること。ただし、斜めもみて、陸だったらそれは島
    # 左上からスタートして、陸続きのものは飛ばす

    move_positions = [[-1, -1], [-1, 0], [-1, 1],
                      [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]]
    count = 0
    queue = deque([])
    for i in range(h):
        for j in range(w):
            start_position = [i, j]
            queue.append(start_position)
            has_island = False
            while queue:
                now_position = queue.popleft()
                if areas[now_position[0]][now_position[1]] == 0:
                    continue
                has_island = True
                areas[now_position[0]][now_position[1]] = 0
                for move_position in move_positions:
                    next_position = [now_position[0] + move_position[0],
                                     now_position[1] + move_position[1]]
                    if 0 <= next_position[0] and next_position[0] < h and 0 <= next_position[1] and next_position[1] < w:
                        queue.append(next_position)
            if has_island:
                count += 1
    print(count)



Measured memory_bytes: 6040
#include<bits/stdc++.h>
#define ri register int
using namespace std;
typedef long long ll;
#define pb push_back
const int rlen=1<<18|1;
char buf[rlen],*ib=buf,*ob=buf;
#define gc() (((ib==ob)&&(ob=(ib=buf)+fread(buf,1,rlen,stdin)),ib==ob)?-1:*ib++)
inline int read() {
  int ans=0;
  bool f=1;
  char ch=gc();
  while(!isdigit(ch)) f^=ch=='-',ch=gc();
  while(isdigit(ch)) ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
  return f?ans:-ans;
}
const int N=1e5+5;
int n,a[N],m;
int main() {
  #ifdef ldxcaicai
  freopen("lx.in","r",stdin);
  #endif
  n=read(),m=read();
  int pre=0;
  for(ri i=1;i<=n;++i) {
    a[i]=read();
    int ct=0;
    while(!(a[i]&1)) a[i]>>=1,++ct;
    if(i!=1&&ct!=pre) return puts("0"),0;
    pre=ct;
  }
  int mt=1;
  while(pre--) mt*=2;
  int t=a[1];
  for(ri i=1;i<=n;++i) {
    int g=__gcd(t,a[i]);
    if((ll)t/g*a[i]>m*2/mt) return puts("0"),0;
    t=t/g*a[i];
  }
  m=m*2/mt/t;
  if(m&1) ++m;
  cout<<m/2;
  return 0;
}

Measured memory_bytes: 896
#include<cstdio>
typedef long long ll;
int n;
ll X;
ll len[64], patties[64];
ll f(int n, ll m)
{
	if (n == 0) // single patty
		return (m > 0) ? 1 : 0;
	ll ret = 0;
	if (m == 0) return ret;
	m--; // bun
	if (m >= len[n - 1]) // n-1 level
	{
		ret += patties[n - 1];
		m -= len[n - 1];
	}
	else return ret + f(n - 1, m);
	if (m == 0) return ret;
	m--; ret++; //patty
	if (m >= len[n - 1]) // n-1 level
	{
		ret += patties[n - 1];
		m -= len[n - 1];
	}
	else return ret + f(n - 1, m);
	return ret;
}
int main()
{
	len[0] = 1; patties[0] = 1;
	for (int i = 1; i <= 50; i++)
	{
		len[i] = len[i - 1] * 2 + 3;
		patties[i] = patties[i - 1] * 2 + 1;
	}
	scanf("%d%lld", &n, &X);
	printf("%lld\n", f(n, X));
	return 0;
}


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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

double rad(double ang){
	return ang / 180 * M_PI;
}

int main()
{
	double a,b,h,m;
	cin>>a>>b>>h>>m;

	double angA = 30*h + 0.5*m;
	double angB = 6*m;

	angA = rad(angA);
	angB = rad(angB);

	double dist = sqrt(pow(a*cos(angA) - b*cos(angB), 2) + pow(a*sin(angA) - b*sin(angB),2));

	printf("%.15f\n", dist);

	return 0;
}

Measured memory_bytes: 4148
#!/usr/bin/env python3
import sys
import math

def solve(A: int, B: int, N: int):
    print(math.floor(A*min(B-1, N)/B) - A * math.floor(min(B-1, N)/B))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)

if __name__ == '__main__':
    main()

Measured memory_bytes: 62080
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashMap;
public class Main {
	public static void main(String args[]) {
		Sc sc = new Sc(System.in);
		int N = sc.nI();
		int table[] = new int[N];
		int orgtab[] = new int[N];
		int parity = 0;
		for(int i = 0; i<N; i++) {
			table[i] = sc.nI();
			orgtab[i] = table[i];
		}

		Arrays.sort(table);
		HashMap<Integer,Integer> map = new HashMap<>();
		for(int i = 0; i<N; i++) {
			map.put(table[i],i);
		}

		for(int i = 0; i<N; i+=2) {
			int a = (map.get(orgtab[i])+i)%2;
			parity += a;
		}
		System.out.println(parity);
	}
}

class Sc {
    public Sc(InputStream i) {
        r = new BufferedReader(new InputStreamReader(i));
    }

    public boolean hasM() {
        return peekToken() != null;
    }

    public int nI() {
        return Integer.parseInt(nextToken());
    }

    public double nD() { 
        return Double.parseDouble(nextToken());
    }

    public long nL() {
        return Long.parseLong(nextToken());
    }

    public String n() {
        return nextToken();
    }

    private BufferedReader r;
    private String line;
    private StringTokenizer st;
    private String token;

    private String peekToken() {
        if (token == null) 
            try {
                while (st == null || !st.hasMoreTokens()) {
                    line = r.readLine();
                    if (line == null) return null;
                    st = new StringTokenizer(line);
                }
                token = st.nextToken();
            } catch (IOException e) { }
        return token;
    }

    private String nextToken() {
        String ans = peekToken();
        token = null;
        return ans;
    }
}

Measured memory_bytes: 24968
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b;
	string s;
	cin >> a >> b >> s;
	for (int i = 0; i < a; i++) {
		if (s[i] != '-') {
			continue;
		} else {
			cout << "No" << endl;
			return 0;
		}
	}
	if (s[a] != '-') {
		cout << "No" << endl;
		return 0;
	}
	for (int i = a + 1; i < a + b + 1; i++) {
		if (s[i] != '-') {
			continue;
		} else {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <cassert>
using namespace std;
/*
(5,3) ->
1 2
2 3
3 4
4 5

(5,8) ->
 -1
 */

int findMax(int N)
{
    return (N-1)*(N-2)/2;
}

void printPath(int N, int K)
{
    vector<pair<int,int>> path;
    
    for (int i=0; i<N-1; i++)
    {
        path.push_back(make_pair(1,i+2));
    }
    
    int cntToAdd = findMax(N) - K;
    
    for (int i=2; i<=N-1; i++)
    {
        for (int j=i+1; j<=N; j++)
        {
            path.push_back(make_pair(i,j));
        }
    }
   
    cout << N-1+cntToAdd << endl;
    for (int i=0; i<N-1+cntToAdd; i++)
    {
        cout << path[i].first << " " << path[i].second << endl;
    }
}


int solve(int N, int K)
{
    if (findMax(N) < K)
    {
        cout << -1 << endl;
        return -1;
    }
    else
    {
        printPath(N,K);
        return 1;
    }
}

void test()
{
    //assert(solve(5,8) == -1);
    assert(solve(5,3) == 1);
    assert(solve(7,11) == 1);
    //assert(findMax(7) == 11);
    //assert(findMax(5) == 4);
    //assert(findMax(15) == 49);
}

 
int main()
{
    int N,K;
    cin >> N >> K;
    //test();
    solve(N,K);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> ii;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string ar[3] = {"Sunny", "Cloudy", "Rainy"};
    string s;
    cin >> s;
    for (int ctr1 = 0; ctr1 < 3; ++ctr1)
        if (ar[ctr1] == s)
            cout << ar[(ctr1 + 1) % 3] << "\n";

    return 0;
}

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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

void solve() {
    ll X;
    cin >> X;
    ll sen = (X/500)*1000;
    X%=500;
    cout << sen + (X/5)*5 << endl;
}

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


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

int main()
{
    int x,y,z;
    cin>>x>>y>>z;
    swap(x,y);
    swap(x,z);
    cout<<x<<" "<<y<<" "<<z<<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);

        int w = sc.nextInt();
        int h = sc.nextInt();
        int n = sc.nextInt();

        int[][] square = new int[h][w];

        for(int i=0; i<n; i++) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            int a = sc.nextInt();

            switch(a) {
                case 1:
                    square = usedArea1(square, x, h);
                    break;
                case 2:
                    square = usedArea2(square, x, w, h);
                    break;
                case 3:
                    square = usedArea3(square, y, w);
                    break;
                case 4:
                    square = usedArea4(square, y, w, h);
                    break;
            }
        }
        //System.out.println(java.util.Arrays.deepToString(square));
        int count = 0;
        for(int i=0; i<h; i++) {
            for(int j=0; j<w; j++) {
                if(square[i][j] == 0) {
                    count++;
                }
            }
        }

        System.out.println(count);
        sc.close();
    }

    public static int[][] usedArea1(int[][] square, int x, int h) {
        for(int i=0; i<h; i++) {
            for(int j=0; j<x; j++) {
                square[i][j] = 1;
            }
        }
        return square;
    }

    public static int[][] usedArea2(int[][] square, int x, int w, int h) {
        for(int i=0; i<h; i++) {
            for(int j=x; j<w; j++) {
                square[i][j] = 1;
            }
        }
        return square;
    }

    public static int[][] usedArea3(int[][] square, int y, int w) {
        for(int i=0; i<y; i++) {
            for(int j=0; j<w; j++) {
                square[i][j] = 1;
            }
        }
        return square;
    }

    public static int[][] usedArea4(int[][] square, int y, int w, int h) {
        for(int i=y; i<h; i++) {
            for(int j=0; j<w; j++) {
                square[i][j] = 1;
            }
        }
        return square;
    }
}


Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ABC0613
{
    class Program
    {
        static void Main(string[] args)
        {
            string ans = "No";
            string[] inp = Console.ReadLine().Split();
            int a = int.Parse(inp[0]);
            int b = int.Parse(inp[1]);
            int c = int.Parse(inp[2]);
            int k = int.Parse(Console.ReadLine());

            for(int i=0;i<k;i++)
            {
                if(a>=b)
                {
                    b = 2*b;
                }
                else if(b>=c)
                {
                    c = 2 * c;
                }
                else
                {
                    break;
                }
            }
            if (a < b && b < c) { ans = "Yes"; }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27264
import sys
raw_input = sys.stdin.readline
N,W = map(int,raw_input().split())
arr = []
tot = 0
for i in range(N):
    arr.append(map(int,raw_input().split()))
    tot += arr[i][1]
dp = [100000000000 for x in range(tot+1)]
dp[0] = 0
for i in range(N):
    a,b = arr[i]
    for j in range(tot,b-1,-1):
        dp[j] = min(dp[j],dp[j-b]+a)
for i in range(tot,-1,-1):
    if dp[i]<=W:
        print i
        break

Measured memory_bytes: 33516
#include<iostream>
#include<cmath>
#include<vector>
#include<bitset>
#include<bitset>
#include<string>
#include<utility>
#include<queue>

using namespace std;

int main(){
    int n;
    cin >> n;
    int ac=0,wa=0,tle=0,re=0;
    string temp;
    for(int i=0;i<n;i++){
        cin >> temp;
        if(temp =="AC")ac++;
        else if(temp=="WA")wa++;
        else if(temp=="TLE")tle++;
        else if(temp=="RE")re++;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}

Measured memory_bytes: 3220
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int long long i=0;i<n;i++)
typedef int long long ll;
using namespace std;

int main(){
    ll n;
    cin>>n;
    ll o=1;
    int nm[5];
    rep(i,5){nm[i]=0;}
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        if(s[0]=='M'){
            nm[0]++;
        }else if(s[0]=='A'){
            nm[1]++;
        }else if(s[0]=='R'){
            nm[2]++;
        }else if(s[0]=='C'){
            nm[3]++;
        }else if(s[0]=='H'){
            nm[4]++;
        }
    }
    int kazu=0;
    rep(i,5){if(nm[i]!=0)kazu++;}
    if(kazu<=2){cout<<0<<endl;return 0;}
    ll ans=0;
    vector<ll> v;
    
    if(kazu==3){
        rep(i,5){
            if(nm[i]!=0){
                v.push_back(nm[i]);
            }
        }
        ans+=v[0]*v[1]*v[2];
    }
    if(kazu==4){
        rep(i,5){
            if(nm[i]!=0){
                v.push_back(nm[i]);
            }
        }
        ans+=v[0]*v[1]*v[2]+v[0]*v[1]*v[3]+v[0]*v[2]*v[3]+v[1]*v[2]*v[3];
    }
    if(kazu==5){
        rep(i,5){
            if(nm[i]!=0){
                v.push_back(nm[i]);
            }
        }
        ans+=v[0]*v[1]*v[2]+v[0]*v[1]*v[3]+v[0]*v[1]*v[4]+v[0]*v[2]*v[3]+v[0]*v[2]*v[4];
        ans+=v[0]*v[3]*v[4]+v[1]*v[2]*v[3]+v[1]*v[2]*v[4]+v[1]*v[3]*v[4]+v[2]*v[3]*v[4];
    }
    cout<<ans<<endl;
    
  
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int i, j, k;
    int n, m, l;
    int a[100][100];
    int b[100][100];
    long c[100][100]={0};
    scanf("%d %d %d", &n, &m, &l);
    for(i=0; i<n; i++)for(j=0; j<m; j++)scanf("%d", &a[i][j]);
    for(i=0; i<m; i++)for(j=0; j<l; j++)scanf("%d", &b[i][j]);
    for(i=0; i<n; i++)for(j=0; j<l; j++)for(k=0; k<m; k++)c[i][j]+=a[i][k]*b[k][j];
    for(i=0; i<n; i++)for(j=0; j<l; j++){
            if(j!=l-1)printf("%ld ", c[i][j]);
            else printf("%ld\n", c[i][j]);
        }
    return 0;
}

Measured memory_bytes: 764
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }


int main() {
    int n; scanf("%d", &n);
    vector<int> a(n);
    for (int& i : a) scanf("%d", &i);
    sort(a.rbegin(), a.rend());

    int x = 0, y = 0;
    rep(i, n) (i & 1 ? y : x) += a[i];
    printf("%d\n", x - y);
    return 0;
}


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

#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int e,y;
    cin>>e>>y;y--;
    if(e==0){
        y++;
        if(y<=1911){
            cout<<"M"<<y-1868+1<<endl;
        }
        else if(y<=1925){
            cout<<"T"<<y-1912+1<<endl;
        }
        else if(y<=1988){
            cout<<"S"<<y-1926+1<<endl;
        }
        else{
            cout<<"H"<<y-1989+1<<endl;
        }
    }
    else if(e==1){
        cout<<1868+y<<endl;
    }
    else if(e==2){
        cout<<1912+y<<endl;
    }
    else if(e==3){
        cout<<1926+y<<endl;
    }
    else{
        cout<<1989+y<<endl;
    }
    return 0;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define ll long long
int main(){
    ll int n,k;
    cin>>n>>k;
    vector<ll int> h(n);
    for(auto &i:h){
        cin>>i;
    }
    sort(h.begin(),h.end(),greater<int>());
    ll int sum=0;
    rep(i,n-k){
        sum+=h.at(i+k);
    }
    cout<<sum<<endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

ll dp[101][4][2];

void solve_abc154() {
	string s;
	ll n, k;
	ll ans = 0;

	cin >> s >> k;

	n = s.size();

	dp[0][0][0] = 1;
	rep(i, n) {
		ll nd = s[i] - '0';
		rep(j, 4) {
			rep(p, 2) {
				rep(d, 10) {
					ll ni = i + 1;
					ll nj = j;
					ll np = p;

					if (d != 0) {
						nj++;
					}

					if (nj > k) {
						continue;
					}

					if (p == 0) {
						if (d > nd) {
							continue;
						}
						else if (d < nd) {
							np = 1;
						}
					}
					dp[ni][nj][np] += dp[i][j][p];
				}
			}
		}
	}

	ans = dp[n][k][0] + dp[n][k][1];

	cout << ans << "\n";
}

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

	solve_abc154();

	return 0;
}

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

int main(){
  int sum;
  string s;
  while(1){
    cin>>s;
    if(s[0]=='0') break;
    sum=0;
    for(int i=0;i<s.size();i++) sum+=s[i]-'0';
    cout<<sum<<endl;
  }
  return 0;
}

Measured memory_bytes: 3160
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define F first
#define S second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n;
int a[200010];
int b[200010],c[200010];
int main()
{
	cin >>n;
	for (int i=0;i<n;i++) cin >>a[i];
	b[0]=a[0];
	for (int i=1;i<n;i++) b[i]=max(b[i-1],a[i]);
	c[n-1]=a[n-1];
	for (int i=n-2;i>=0;i--) c[i]=max(c[i+1],a[i]);
	for (int i=0;i<n;i++)
	{
		int t=-1e9;
		if (i) t=max(t,b[i-1]);
		if (i!=n-1) t=max(t,c[i+1]);
		cout <<t<<"\n";
	}
	return 0;
} 

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

int main()
{
	int n;
	cin>>n;
	long long l[90];
	l[0]=2;
	l[1]=1;
	for(int i=2;i<=n;i++)
	{
		l[i]=l[i-1]+l[i-2];
	}
	cout<<l[n]<<endl;
	return 0;
}

Measured memory_bytes: 256
X, Y = map(int, input().split())

a = (4*X - Y) / 2
b = (Y - 2*X) / 2
res = "Yes"

if a < 0 or b < 0:
    res = "No"

if a.is_integer() and b.is_integer():
    pass
else:
    res = "No"

print(res)

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

using ll = long long;
#define f(i,a,b) for (int i = a; i < b; i++)
#define fr(i,a,b) for (int i = b-1; i >= a; i--)
const ll mod = 1e9+7;
const int mxn = 2e6;

ll fact[mxn], inv[mxn];

ll modpow(ll a, ll b) {
  	return b?modpow(a*a%mod,b/2)*(b&1?a:1)%mod:1;
}

ll comb(int n, int k) {
  	if (n<k||k<0) return 0;
	return fact[n]*inv[k]%mod*inv[n-k]%mod;
}

void add(ll &a, ll b) {
  if (b>=mod) b%=mod;
  a += b;
  if (a>=mod) a-=mod;
}

int main() {
	int n; cin >> n;
  	f(i,0,mxn) fact[i] = i?fact[i-1]*i%mod:1;
  	inv[mxn-1] = modpow(fact[mxn-1],mod-2);
  	fr(i,0,mxn-1) inv[i] = inv[i+1]*(i+1)%mod;
  	ll ans = 0;
  	f(k,0,n) {
    	ll p = (mod+comb(n-1,k)-comb(k-1,n-k-1))%mod;
      	add(ans,p*fact[k]%mod*fact[n-1-k]%mod);
    }
  	cout << ans << endl;
	return 0;
}

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

int n;
vector<int> a;

int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++) {
	int t; cin >> t;
	a.push_back(t - i);
    }
    sort(a.begin(), a.end());
    int b = a[n / 2];
    long long res = 0;
    for (int i = 0; i < n; i++) 
	res += abs(a[i] - b);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1400
#include <iostream>

#define REP(loop, n) for(int i = (loop) ; i < n ; ++i)

using namespace std;

int main(void)
{
	long double A, B, V, W, T;
	cin >> A >> V;
	cin >> B >> W;
	cin >> T;

	// 距離
	double dst = abs(A - B);

	// 速度差
	double diff = V - W;

	if (V > W && dst / diff <= T)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}

	rewind(stdin);
	getchar();
	return 0;
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;
long long int n,cnt=0,ans=0,a[ohara],b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
  
       cin.tie(0);
    ios::sync_with_stdio(false);
      
      cin>>n;
      map<ll,ll> mpp;
      rep(i,n){
        cin>>b;
        mpp[b]++;
      }
      cin>>m;
      rep(i,m){
        cin>>a[i];
      }
      rep(i,m){
        if(mpp[a[i]]==0){
          Cout("NO");
          return 0;
        }
        mpp[a[i]]--;
      }
      Cout("YES");
    
       
return 0;
}


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

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

  int cnt = 0;
  for(int x=a; x<=b; x++) {
    int i = x;
    int j = i / 10000;
    i = i - (j * 10000);
    int k = i / 1000;
    i = i - (k * 1000);
    int l = i / 100;
    i = i - (l * 100);
    int m = i / 10;
    i = i - (m * 10);
    int n = i;
    if(j == n && k == m)
      cnt++;
  }

  cout << cnt << endl;
}

Measured memory_bytes: 256
fun str() = readLine()!!
fun read(d:String = " ") = str().split(d)
fun <T> list(d:String = " ",f:String.()->T) = read(d).map {f(it)}
fun list() = list {toInt()}

fun main() {
	val (n,m,q) = list()
	val req = Array(q) {
		list().toIntArray().also {
			--it[0]
			--it[1]
		}
	}

	val a = IntArray(n)
	fun dfs(v:Int,depth:Int):Int {
		a[depth] = v
		return when(depth) {
			n-1->req.indices.filter {a[req[it][1]]-a[req[it][0]]==req[it][2]}
					.sumBy {req[it][3]}
			else->(v..m)
					.map {dfs(it,depth+1)}.max()!!
		}
	}

	println(dfs(1,0))
}


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


int main() {
  string w;
  cin >> w;
  string s = "abcdefghijklmnopqrstuvwxyz";
  vector<int> k(26, 0);
  
  rep(i, 26) {
    for(char a : w) {
      if(s[i] == a) k[i]++;
    }
  }
  
  rep(i, 26) {
    if(k[i]%2 != 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  
}


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

using namespace std;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)
typedef long long ll;
typedef pair <int, int> P;
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;

using namespace std;

int a[310][310];
int b[310][310];


int main() {
	int n;
	cin >> n;
	REP(i, n)REP(j, n) {
		cin >> a[i][j];
		b[i][j] = a[i][j];
	}
	REP(k, n)REP(i, n)REP(j, n) {
		if (i == j || j == k || k == i || b[i][k] == INF || b[k][j] == INF)continue;
		else if (a[i][j] > b[i][k] + b[k][j]) {
			cout << -1 << endl;
			return 0;
		}
		else if (a[i][j] == b[i][k] + b[k][j]) {
			b[i][j] = INF;
		}
	}
	ll res = 0;
	 
	REP(i, n)REP(j, n) {
		if(b[i][j]!=INF)res += b[i][j];
	}
	cout << res / 2 << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
long long i,j,n,m,a,b,x,y,rez,mas[400005],z;
long long M=998244353;
long long power(long long aa,long long bb,long long p)
{
   if (bb==0)
   {
       return 1;
   }
   long long ret = power(aa,bb/2,p);
   ret = (ret * ret)%p;
   if ((bb % 2) == 1)
   {
       ret = (ret * aa) %p;
   }
   return ret % p;
}
int main()
{
    std::cin.sync_with_stdio(false);
    std::cin.tie(0);
    cin >> n >> a >> b >> m;
    i=2;
    mas[0]=1;
    mas[1]=1;
    while (i<=n)
    {
        mas[i]=mas[i-1]*i;
        mas[i]%=M;
        i++;
    }
    if (m==0)
    {
        cout << "1";
        return 0;
    }

    x=0;
    while (x<=n)
    {
        y=m-x*a;
        if (y%b==0)
        {
            if (y/b<=n&&y/b>=0)
            {
                //cout << mas[n] << " " << power(mas[x],M-2,M) << " " << power(mas[n-x],M-2,M) << " ";
                z=mas[n]*power(mas[x],M-2,M);
                z%=M;
                z*=power(mas[n-x],M-2,M);
                z%=M;
                z*=mas[n];
                z%=M;
                z*=power(mas[y/b],M-2,M);
                z%=M;
                z*=power(mas[n-y/b],M-2,M);
                z%=M;
                rez+=z;
                //rez+=((mas[n]*power(mas[x],M-2,M)*power(mas[n-x],M-2,M))%M)*((mas[n]*power(mas[y/b],M-2,M)*power(mas[n-y/b],M-2,M))%M);
                rez%=M;
                while (rez<0)
                {
                    rez+=M;
                }
                rez%=M;
            }
            //cout << rez << "\n";
           // cout << x << " " << a << " " << y/b << " " << b << "\n";
        }
        x++;
    }
    cout << rez;
    return 0;
}


Measured memory_bytes: 2688
N = gets.to_i
R = Array.new(N + 1) { [] }
(N - 1).times do
  a, b = gets.split.map(&:to_i)
  R[a].push b
  R[b].push a
end

G = Array.new(N + 1)
q1 = [1]
q2 = [N]
until q1.empty? && q2.empty?
  nq1 = []
  q1.each do |x|
    if G[x].nil?
      G[x] = 1
      nq1 += R[x]
    else
      next
    end
  end
  nq2 = []
  q2.each do |x|
    if G[x].nil?
      G[x] = 2
      nq2 += R[x]
    else
      next
    end
  end  
  q1 = nq1
  q2 = nq2
end

if G.count(1) > N / 2
  puts "Fennec"
else
  puts "Snuke"
end

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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if ( a+b>c+d ) {
    cout << "Left\n";
  } else if ( a+b==c+d ) {
    cout << "Balanced\n";
  } else {
    cout << "Right\n";
  }
  return 0;
}

Measured memory_bytes: 256
n, a, b = [int(i) for i in input().split()]
if a > b:
    print(0)
elif n == 1:
    if a == b:
        print(1)
    else:
        print(0)
else:
    c = a*(n-1) + b
    d = b*(n-1) + a
    if(d - c + 1 >= 1):
        print(d - c + 1)
    else:
        print(0)

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

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

    int min = x - k;
    int max = x + k;

    for(int i = min + 1; i < max; i++){
        if(i != max - 1){
            cout << i << " ";
        }else{
            cout << i << endl;
        }
    }
}

Measured memory_bytes: 256
import collections
n = int(input())

arr = map(int,raw_input().split())

deque = collections.deque()

for i in range(n):
	if i % 2 == 0:
		deque.appendleft(arr[i])

	else :
		deque.append(arr[i])

for i in range(n) :
	arr[i] = str(deque.pop())

if i % 2 == 1:
	print ' '.join(arr)

else :
	print ' '.join(reversed(arr))

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;


int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];


  double sum = 0.0;
  rep(i, n) sum += 1.0/a[i];

  cout << 1.0/sum << endl;


  
  return 0;
}

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

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

int main(){
  while(1){
  vector<vector<ll>> A(10000);
  ll an,bn,r;
  cin>>an>>bn>>r;
  if(an==0 && bn==0){break;}
  r*=4;
  vector<pll> w(an);
  for(int i=0;i<an;i++){
    ll x,y;
    cin>>x>>y;
    w[i]={x,y};
  }
  for(int i=0;i<bn;i++){
    ll x,y;
    cin>>x>>y;
    A[y].push_back(x);
  }
  for(int i=0;i<A.size();i++){
    sort(A[i].begin(),A[i].end());
  }
  ll count=0;
  for(int i=0;i<an;i++){
    pll &W=w[i];
    ll d=0;
    for(ll y=r;y>=0;y--){
      while((d+1)*(d+1)+y*y<=r*r){d++;}
      //cout<<y<<" "<<r<<" "<<d<<endl;
      if(y+W.second<A.size()){
	count+=(ll)(upper_bound(A[y+W.second].begin(),A[y+W.second].end(),W.first+d)-lower_bound(A[y+W.second].begin(),A[y+W.second].end(),W.first-d));
      }
      if(W.second-y>=0 && y!=0){
	count+=(ll)(upper_bound(A[W.second-y].begin(),A[W.second-y].end(),W.first+d)-lower_bound(A[W.second-y].begin(),A[W.second-y].end(),W.first-d));
      }
    }
    
  }
  cout<<count<<endl;
  }

  return 0;
}



Measured memory_bytes: 5472
#include<iostream>
#include<vector>
#include<queue>
#define LL long long
LL N, M;
int ans;
std::vector<int> G[100010];
int T[100010];
LL L, R;
bool flag;
int main() {
	std::cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int a, b;
		std::cin >> a >> b;
		G[a].emplace_back(b);
		G[b].emplace_back(a);
	}
	std::queue<int> q;
	q.push(1);
	T[1] = 1;
	while (!q.empty()) {
		int size = q.size();
		for (int i = 0; i < size; i++) {
			int tmp = q.front();
			q.pop();
			int in;
			if (T[tmp] == 1)in = 2;
			else in = 1;
			for (auto u : G[tmp]) {
				if (T[u] && T[u] != in) {
					flag = true;
					break;
				}
				if (!T[u]) {
					q.push(u);
				}
				T[u] = in;
			}
			if (flag)break;
		}
		if (flag)break;
	}
	if (!flag) {
		for (int i = 1; i <= N; i++) {
			if (T[i] == 1)L++;
			else R++;
		}
		std::cout << L * R - M << std::endl;
	}
	else {
		LL ans = (N*(N - 1)) / 2LL;
		std::cout << ans-M << std::endl;
	}
	return 0;
}

Measured memory_bytes: 6272
/**
 *    Author:  AKASH-ALAM       
**/
#include <bits/stdc++.h>
#define endl        '\n'
#define db          double
#define ld          long double
#define ll          long long
#define ull         unsigned long long
#define sqr(x)      (x) * (x)
#define gcd(a, b)   __gcd(a, b)
#define lcm(a, b)   ((a/gcd(a,b)) * b)
#define pf(x) 		push_front(x)
#define pb(x)       push_back(x)
#define eb(x)		emplace_back(x)
#define all(x)      (x).begin(), (x).end()
#define rall(x) 	(x).rbegin(), (x).rend()
#define sz(x) 		(int)x.size()
#define debug(x) 	cerr << #x << " = " << (x) <<endl
#define Fast_io    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

const ld PI = acos((ld)-1);
const int MOD = 1e9+7;
const ll INF = 1e18; 
using namespace std;

int main(){
    Fast_io;
    int n;  cin >> n;
    long long pow = 1;
    for(int i = 1; i <= n; i++) {
        pow *= i;
        pow = pow % MOD;
    }
    cout << pow % MOD << endl;
    return 0;
}

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

using namespace std;

int main()
{
	string s;
	cin >> s;
	int ans = 700;
	for (int i = 0; i < 3; i++) {
		if (s[i] == 'o') {
			ans += 100;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sc1(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scl1(a) scanf("%lld",&a)
#define scl2(a,b) scanf("%lld%lld",&a,&b)
#define scl3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define pf1(a) printf("%d ",a)
#define pfl1(a) printf("%lld ",a)
#define pfn printf("\n")
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vl vector<long long>
#define si set<int>
#define sl set<long long>
#define msi multi_set<int>
#define msl multi_set<long long>
#define usi unordered_set<int>
#define usl unordered_set<long long>
#define mii map<int,int>
#define mli map<long long,int>
#define mll map<long long,long long>
#define umii unordered_map<int,int>
#define umli unordered_map<long long,int>
#define umll unordered_map<long long,long long>
#define lp(i,a,b) for(int i=a;i<b;i++)
#define rlp(i,a,b) for(int i=a;i>b;i--)
#define dslp(it,c) for(typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define pb push_back
#define pf push_front
#define ft first
#define sd second
#define N 100001
#define mod 1000000007
#define mod1 100000000
using namespace std;
typedef vector<vector<ll> > matrix;

int fun(vi v[],bool vis[],int ver,int y){
    vis[ver]=1;
    y++;
    lp(i,0,v[ver].size()){
        if(!vis[(v[ver][i])]){
            y+=fun(v,vis,(v[ver][i]),0);
        }
    }
    return y;
}

int main(){
    int n,m,x,y;
    sc2(n,m);
    vi v[n+1];
    lp(i,0,m){
        sc2(x,y);
        v[x].pb(y);
        v[y].pb(x);
    }
    x=0;y=0;
    bool vis[n+1]={0};
    lp(i,1,n+1){
        if(!vis[i]){
            x++;
            y=max(y,fun(v,vis,i,0));
        }
    }
    printf("%d\n",y);
    
}

Measured memory_bytes: 24164
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<string>
#include<set>
#include<utility>
#include<vector>

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

const int INF = 1001001001;

void solve(){
  int n;  cin >> n;
  vector<int> x(n);
  map<ll, ll> mp;
  rep(i, n){
    cin >> x[i];
    mp[x[i]]++;
  }
  ll ans=0;
  for(auto it=mp.begin(); it!=mp.end(); it++){
    ans += it->second*(it->second-1)/2;
  }

  rep(i, n){
    ans -= mp[x[i]]*(mp[x[i]]-1)/2;
    mp[x[i]]--;
    ans += mp[x[i]]*(mp[x[i]]-1)/2;
    cout << ans << endl;
    ans -= mp[x[i]]*(mp[x[i]]-1)/2;
    mp[x[i]]++;
    ans += mp[x[i]]*(mp[x[i]]-1)/2;
  }
}

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


Measured memory_bytes: 10240
N = int(input())
S = [input() for _ in range(N)]
dic = {}
for i in range(N):
    if S[i] not in dic.keys():
        dic[S[i]] = 1
    else:
        dic[S[i]] += 1

maxI = max(dic.values())
ans = []

for keys in dic.keys():
    if dic[keys] == maxI:
        ans.append(keys)

ans.sort()

for i in ans:
    print(i)


Measured memory_bytes: 38588
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { //USE LONGS TO AVOID OVERFLOW THEN CAST
 
	public static void main(String[] args) { 
		FastScanner input = new FastScanner();
		PrintWriter w = new PrintWriter(System.out);
		int N = input.nextInt();
		int ans = N+N*N+N*N*N;
		//CODE
		w.println(ans);
		w.flush();
	}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 25376