akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;


namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] header = Console.ReadLine().Split(' ');
            int sunukeNum = int.Parse(header[0]);
            int okashikind = int.Parse(header[1]);
            List<int> okashimochiList = new List<int>();
            for(int i = 0; i < okashikind; i++)
            {
                int total = int.Parse(Console.ReadLine());
                string[] input = Console.ReadLine().Split(' ');
                foreach(var x in input)
                {
                    int target = int.Parse(x);
                    if(!okashimochiList.Exists(e => e == target))
                    {
                        okashimochiList.Add(target);
                    }
                }
            }
            Console.WriteLine(sunukeNum - okashimochiList.Count);
        }

        
        
    }
}


Measured memory_bytes: 29100
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
  ll n; cin >> n;
  vl rate(n);
  rep(i,n){
    ll x; cin >> x; rate.at(i) = x;
  }
  
  ll count = 0; ll free = 0;
  
  vector<bool> tf (8,false);
  rep(i,n){
    rep(j,8){
      if(400*j <= rate.at(i) && rate.at(i) <= 400*j + 399){
        tf.at(j) = true;
      }
      if(rate.at(i) >= 3200){
        free++;
        break;
      }
    }
  }
  
  rep(i,8){
    if(tf.at(i)){
      count++;
    }
  }
  
  if(count == 0) cout << 1 << ' ' << free << endl;
  else cout << count << ' ' << count + free << endl;
}

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


def solve(N: int, A: "List[int]", B: "List[int]"):

    enough = []
    husoku = 0
    counter = 0
    for a, b in zip(A, B):
        if a < b:
            husoku += b-a
            counter += 1
        else:
            enough.append(a-b)
    enough.sort(reverse=True)
    i = 0
    while husoku > 0 and i < len(enough):
        husoku -= enough[i]
        counter += 1
        i += 1

    if husoku > 0:
        print(-1)
    else:
        print(counter)
    return


def main():

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


if __name__ == '__main__':
    main()


Measured memory_bytes: 21628
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
int main(void){
	ll n,i,sum=0,ans,res;
	cin>>n;
	ll a[n];
	for(i=0;i<n;i++){cin>>a[i];sum+=a[i];}
	sum-=a[0];
	res=a[0];
	ans=abs(res-sum);
	for(i=1;i<n-1;i++){
		sum-=a[i];
		res+=a[i];
		ans=min(ans,abs(res-sum));
	}
	cout<<ans<<endl;
	return 0;
}



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

using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 100;
const int inf = 0x3f3f3f3f;

const int SZ = 1 << 20;  //快速io
struct fastio {
    char inbuf[SZ];
    char outbuf[SZ];

    fastio() {
        setvbuf(stdin, inbuf, _IOFBF, SZ);
        setvbuf(stdout, outbuf, _IOFBF, SZ);
    }
} io;

void read(int &x) {
    x = 0;
    char ch, c = getchar();
    while (c < '0' || c > '9') ch = c, c = getchar();
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    if (ch == '-') x = -x;
}

char s[maxn];
int b[maxn], w[maxn];
vector<int> bb, ww;

int main() {
    //freopen("in.txt", "r", stdin);
    int n;
    scanf("%d %s", &n, s + 1);
    ll ans = 0x3f3f3f3f;
    for (int i = 1; i <= n; i++) {
        b[i] = b[i - 1];
        w[i] = w[i - 1];
        if (s[i] == '.') {
            w[i]++;
            ww.push_back(i);
        } else {
            b[i]++;
            bb.push_back(i);
        }
    }
    ll temp;
    int pos;
    for (int i = 1; i <= n; i++) {
        temp = 0;
        if (s[i] == '.') {
            temp += b[i];
            pos = lower_bound(bb.begin(), bb.end(), i) - bb.begin();
            if (pos < bb.size())
                temp = temp + w[n] - w[bb[pos] - 1];
        } else {
            temp = temp + w[n] - w[i - 1];
            pos = lower_bound(ww.begin(), ww.end(), i) - ww.begin();
            if (pos != 0) {
                pos--;
                temp = temp + b[ww[pos]];
            }
        }
        ans = min(ans, temp);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3188
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    else:
        for i in range(H):
            for j in range(W):
                if j == W - 1:
                    print("#")
                elif i != 0 and i != H - 1 and j != 0 and j != W - 1:
                    print(".", end="")
                else:
                    print("#", end="")
        print()



Measured memory_bytes: 7000
N, K=map(int, input().split())
zeros=[0]
ones=[0]
S=list(input())
now=S[0]
one=0
zero=0
for i,s in enumerate(S):
  if s==now:
    if s=="0":
      zero+=1
    else:
      one+=1
  else:
    if s=="0":
      zero+=1
      ones.append(one)
      now=s
    else:
      one+=1
      zeros.append(zero)
      now=s
  if i==N-1:
    if s=="0":
      zeros.append(zero)
    else:
      ones.append(one)
#print(zeros, ones)
ans=0
lone=len(ones)
lzero=len(zeros)
if lzero==0:
  print(N)
  exit()
if lzero<=K:
  print(N)
  exit()

if S[0]=="0":
  
  for i in range(lzero-K+1):
    idx=min(i+K, lzero-1)
    idx2=min(idx, lone-1)
    idx3=max(i-1, 0)
    ans=max(ans, zeros[idx]-zeros[i]+ones[idx2]-ones[idx3])
    
else:
  for i in range(lzero-K+1):
    idx=min(i+K, lzero-1)
    idx2=min(idx+1, lone-1)
    
    ans=max(ans, zeros[idx]-zeros[i]+ones[idx2]-ones[i])

print(ans)
    

Measured memory_bytes: 9788
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long Int;
#define MAX_N 60

int N, K;
Int X1[MAX_N], Y1[MAX_N], Z1[MAX_N];
Int X2[MAX_N], Y2[MAX_N], Z2[MAX_N];

int xsLen, ysLen, zsLen;
Int xs[MAX_N * 2], ys[MAX_N * 2], zs[MAX_N * 2];

int main() {
	int i;
	int a, b, c;

	scanf("%d%d", &N, &K);
	for (i = 0; i < N; ++i) {
		scanf("%lld%lld%lld", &X1[i], &Y1[i], &Z1[i]);
		scanf("%lld%lld%lld", &X2[i], &Y2[i], &Z2[i]);
	}

	xsLen = ysLen = zsLen = 0;
	for (i = 0; i < N; ++i) {
		xs[xsLen++] = X1[i]; ys[ysLen++] = Y1[i]; zs[zsLen++] = Z1[i];
		xs[xsLen++] = X2[i]; ys[ysLen++] = Y2[i]; zs[zsLen++] = Z2[i];
	}
	sort(xs, xs + xsLen); sort(ys, ys + ysLen); sort(zs, zs + zsLen);

	Int ans = 0;
	for (a = 0; a < xsLen - 1; ++a)
		for (b = 0; b < ysLen - 1; ++b)
			for (c = 0; c < zsLen - 1; ++c)
			{
				int cnt = 0;
				for (i = 0; i < N; ++i) {
					if (
						X1[i] <= xs[a] && xs[a + 1] <= X2[i] &&
						Y1[i] <= ys[b] && ys[b + 1] <= Y2[i] &&
						Z1[i] <= zs[c] && zs[c + 1] <= Z2[i]
						) {
						++cnt;
					}
				}
				if (cnt >= K) {
					ans += (xs[a + 1] - xs[a]) * (ys[b + 1] - ys[b]) * (zs[c + 1] - zs[c]);
				}
			}
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 2732
#include <bits/stdc++.h>
#define _for(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define FOR(...)   _for (__VA_ARGS__)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;

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

  string s, t, u;
  ll a, b;
  cin >> s >> t >> a >> b >> u;

  if (s == u) -- a;
  else -- b;
  cout << a << " " << b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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

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

  //vi to[200005];

  int N, Q; cin >> N >> Q;
  vvi to(N,vi());
  REP(i,N-1) {
    int a, b; cin >> a >> b;
    --a; --b;
    to[a].PB(b);
    to[b].PB(a);
  }

  vi ans(N);
  //ans.resize(N);
  REP(i,Q) {
    int p, x; cin >> p >> x;
    --p;
    ans[p] += x;
  }

  vector<bool> checked(N,false);
  queue<int> que;
  que.push(0);
  checked[0] = true;

  while (!que.empty()) {
    int node = que.front();
    que.pop();
    int point = ans[node];
    for (auto &next : to[node]) {
      if (!checked[next]) {
        ans[next] += point;
        que.push(next);
        checked[next] = true;
      }
    }
  }

  REP(i,N) {
    //cout << ans[i] << endl;
    cout << ans[i] << "\n";
  }

  /*for (auto &a : ans) {
    cout << a << endl;
  }*/
  
  return 0;
}

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

int gcd(int a, int b){
  int p, q, tmp;
  p = a;
  q = b;
  while(q != 0){
    tmp = q;
    q = p % q;
    p = tmp;
  }
  return p;
}
int main(){
  long long ans = 0;
  int n;
  cin >> n;
  for(int i=0; i<n; i++) {
    for(int j=0; j<n; j++) {
      for(int k=0; k<n; k++) {
        ans += gcd(i+1, gcd(j+1, k+1));
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <limits>
#include <iomanip>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define forr(start,end) for(int i = start; i < end; i++)
#define gap ' '

const int MAXN = 200;
//ll a[MAXN], ST[MAXN * 4], LZ[MAXN*4];

/*bool perfectSquare(ll x){
    ll s = sqrt(x);
    if(s *s == x) return true;
    else return false;
}*/
typedef long double ld;

int main() { 
    string s;
    cin >> s;
    sort(s.begin(),s.end());
    int cnt = 1;
    for(int i = 0; i < s.length(); ++i){
        if(s[i] == s[i+1]){
            ++cnt;
        }
        else{
            if(cnt % 2 != 0){cout << "No" << endl; return 0;}
            cnt = 1;
        }
    }
    cout << "Yes" << endl;
  
    return 0; 
} 


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

int main(){
  int a;
  cin>>a;
  
  int res=0;
  for(int i=0;i<1001;++i){
    for(int j=0;j<1001;++j){
      int total=7*i+4*j;
      if(total==a) ++res;
    }
  }
  if(res>0)
    cout<<"Yes"<<endl;
  else if(res==0)
    cout<<"No"<<endl;
}

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

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0LL)
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

template<typename A, size_t N, typename T> // n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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


int solve(){
  string s,t;cin>>s>>t;
  int n = sz(s);

  map<int, int> d;
  rep(i, n){
    if (d.find(s[i] - 'a') == d.end()){
      d[s[i]-'a'] = t[i]-'a';
    }
    else if(d[s[i]-'a'] != t[i]-'a'){
      cout << "No" << endl;
      return 0;
    }
  }

  d = map<int, int>();
  rep(i, n){
    if (d.find(t[i] - 'a') == d.end()){
      d[t[i]-'a'] = s[i]-'a';
    }
    else if(d[t[i]-'a'] != s[i]-'a'){
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;

int main()
{
  int N;cin>>N;
  vector<ll> a(N+1);
  for (int i=1;i<=N;i++)
   cin>>a[i];
  
  int now=1;
  for (int i=1;i<=N;i++)
  {
     if (now == a[i])
      now++;
  }
  if (now==1) cout<<-1<<endl;
  else cout<< N-now+1<<endl;
}

Measured memory_bytes: 1792
#!/usr/bin/env python
# -*- coding: utf-8 -*-


import sys


def generate_graph(v_info):
    for info in v_info:
        adj_info = info[2:]
        for each in adj_info:
            adj_matrix[int(info[0]) - 1][int(each) - 1] = 1
    return adj_matrix


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertex_num = int(_input[0])
    vertex_info = list(map(lambda x: x.split(), _input[1:]))
    adj_matrix = [[0] * vertex_num for _ in range(vertex_num)]
    # assert len(vertex_info) == vertex_num

    ans = generate_graph(vertex_info)
    for v_result in ans:
        print(*v_result)

Measured memory_bytes: 8416
#include<bits/stdc++.h>
using namespace std;
 
void solve(int left, int right, vector<int> v){
    if(right == 0){
        for(int i=0;i<v.size();++i){
            cout << v[i];
            if(i+1 == v.size())cout << endl;
            else cout << " ";
        }
    }else{
        for(int i=right;i>0;--i){
            if(i <= left){
                v.push_back(i);
                solve(i, right - i, v);
                v.pop_back();
            }
        }
    }
}
 
int main(){
    int n;
    while(cin >> n, n != 0){
        for(int i=n;i>0;--i){
            vector<int> v;
            v.push_back(i);
            solve(i, n - i, v);
            v.pop_back();
        }
    }
 
    return 0;
}

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

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

    vector<int64_t> a(n);
    for (auto& e : a) cin >> e;

    vector<pair<int64_t, int64_t>> cb(m);
    for (auto& e : cb) cin >> e.second >> e.first;

    sort(a.begin(), a.end());
    sort(cb.begin(), cb.end(), greater<>());

    for (int ai = 0, cbi = 0; ai < n && cbi < m; cbi++) {
        if (a[ai] >= cb[cbi].first) break;

        for (int aai = ai + cb[cbi].second; a[ai] < cb[cbi].first && ai < aai && ai < n; ai++) {
            a[ai] = cb[cbi].first;
        }
    }

    cout << accumulate(a.begin(), a.end(), 0ll) << endl;
}


Measured memory_bytes: 2560
using System;
using System.Linq;

namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
      
      string[] str=Console.ReadLine().Split(' ');
     int A=int.Parse(str[0]);
      int B=int.Parse(str[1]);
      string s=Console.ReadLine();
      int flg=0;
      try{
        int fw=int.Parse(s.Substring(0,A));
      }catch (Exception){
        flg=1;
      }
      if(s.Substring(A,1)!="-"){
        flg=1;
      }try{
        int le=int.Parse(s.Substring(A+1));
        if(s.Substring(A+1).Length!=B){
          flg=1;
        }
      }catch (Exception){
        flg=1;
      }
      if(flg==0){
        Console.WriteLine("Yes");
      }else{
        Console.WriteLine("No");
      }
    }
    
  }

}



Measured memory_bytes: 28744
def main():
    N = int(input())
    Red = []
    Blue = []
    for i in range(N):
        a, b = map(int, input().split())
        Red.append([b,a])
    for i in range(N):
        c, d = map(int, input().split())
        Blue.append([c,d])

    Red.sort(reverse=True)
    Blue.sort()
    ans = 0
    for x, y in Blue:
        for v, u in Red:
            if x > u and y > v:
                ans += 1
                Red.remove([v,u])
                break
    
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 39024
MAX = 10**9 * 2
while 1:
	N = int(raw_input())
	if N == 0:
		break
	signal = raw_input().split(" ")
	xst = MAX + 1
	xlt = - xst
	for i in range(N):
		if signal[i] == "x":
			if i < N-1 and signal[i+1] == "x" :
				print "none"
				break
			if (i + 1) % 2 != 0:
				left = MAX + 1 if i <= 0 else int(signal[i-1]) 
				right = MAX + 1 if i >= N-1 else int(signal[i+1])
				xst = min(xst, left, right)
			else :
				left = - (MAX + 1) if i <= 0 else int(signal[i-1]) 
				right = - (MAX + 1) if i >= N-1 else int(signal[i+1])
				xlt = max(xlt, left, right)
		elif i < N-1 and signal[i+1] != "x" :
				if ( (i + 1) % 2 != 0 and int(signal[i]) >= int(signal[i+1]) 
				  or (i + 1) % 2 == 0 and int(signal[i]) <= int(signal[i+1])) :
					print "none"
					break
	else :
		x = "none"
		tmpx = xlt + 1
		while tmpx < xst:
			if x != "none" :
				print "ambiguous"
				break
			x = tmpx
			tmpx += 1
		else :
			print x

Measured memory_bytes: 4332
from collections import deque
O = deque(list(input()))
E = deque(list(input()))
Ans = []

for i in range(len(O) + len(E)):
    if i % 2 == 0:
        Ans.append(O.popleft())
    else:
        Ans.append(E.popleft())

print(''.join(Ans))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  ll n,d; cin >> n >> d;
  ll x[n][d];
  REP(i, n) REP(j, d) cin >> x[i][j];

  ll ans = 0;
  REP(i, n-1) FOR(j, i+1, n) {
    ll dist = 0;
    REP(k, d){
      dist += (x[i][k] - x[j][k]) *  (x[i][k] - x[j][k]);
    }
    REP(l, 161){
      if(dist == l*l){
        ans++;
        break;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
//pantyhose(black) + glasses = infinity

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

#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"

const int MAX_N = 100002;

int n;
vector<int> s[MAX_N];

int main() {
	#ifdef GLASSES_GIRL
		freopen(FILE_NAME".inp", "r", stdin);
		freopen(FILE_NAME".out", "w", stdout);
	#endif
	ios::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    int x;
    for (x=1; x*(x-1)/2<n; ++x);
    if (x*(x-1)/2!=n) {
        cout << "No";
        return 0;
    }
    int nEdge = 0;
    for (int i=1; i<=x; ++i) {
        for (int j=i+1; j<=x; ++j) {
            s[i].push_back(++nEdge);
            s[j].push_back(nEdge);
        }
    }
    cout << "Yes\n" << x << '\n';
    for (int i=1; i<=x; ++i) {
        cout << s[i].size() << ' ';
        for (auto v : s[i])
            cout << v << ' ';
        cout << '\n';
    }
}



Measured memory_bytes: 4736
/*
* problem:
* method:
* date:
*/
#include<iostream>
#define LL long long
const LL MAXN=10e5,MAX=1e18;
using namespace std;
LL x[100010];
int main() {
	int i;
	LL n,a,res=1;
	cin>>n;
	for(i=0; i<n; i++) {
		scanf("%lld",x+i);
		if(x[i]==0) res=0;
	}
	if(res){
		for(i=0;i<n;i++){
			if(x[i]<=MAX/res){
				res*=x[i];
			}else{
				res=-1;
				break;
			}
		}
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 4396
import sys
input = sys.stdin.readline

h,w,m = map(int,input().split())

h_array = [ 0 for i in range(h) ]
w_array = [ 0 for i in range(w) ]
ps = set()
for i in range(m):
    hi,wi = map( lambda x : int(x) - 1 , input().split() )
    h_array[hi] += 1
    w_array[wi] += 1
    ps.add( (hi,wi) )

h_great = max(h_array)
w_great = max(w_array)
h_greats = list()
w_greats = list()
for i , hi in enumerate(h_array):
    if hi == h_great:
        h_greats.append(i)
for i , wi in enumerate(w_array):
    if wi == w_great:
        w_greats.append(i)

ans = h_great + w_great


for _h in h_greats:
    for _w in w_greats:
        if (_h,_w) in ps:
            continue
        print(ans)
        exit()

print(ans-1)

Measured memory_bytes: 83360
#[allow(unused_macros)]
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[allow(unused_macros)]
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }

fn main() {
    input! {
        n: i32,
        a: i32,
    }
    println!("{}", n * n - a);
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl;}
const LL MOD = 1e9 + 7;
const LL LLINF = 1LL << 60;
const int INF = 1 << 30;

enum {
    M,
    A,
    R,
    C,
    H
};

map<char, int> dict{
    make_pair('M',M),
    make_pair('A',A),
    make_pair('R',R),
    make_pair('C',C),
    make_pair('H',H)
};

int main(void)
{
    LL N;
    cin >> N;

    vector<LL> S(5);
    rep(i, N) {
        string s;
        cin >> s;

        if(s[0] == 'M' or s[0] == 'A' or s[0] == 'R' or s[0] == 'C' or s[0] == 'H'){
            S[dict[s[0]]]++;
        }
    }

    LL ans = 0;
    for (int i = 0; i < 3; i++)
    {
        for (int j = i+1; j < 4; j++)
        {
            for (int k = j+1; k < 5; k++)
            {
                ans += S[i] * S[j] * S[k];
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 100005
#define eps 1e-12
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
int A,B,C,D,E,F;
int w[35],t[3005];
void Solve() {
	read(A);read(B);read(C);read(D);read(E);read(F);
	w[0] = 1;
	for(int i = 1 ; i <= F / 100 ;  ++i) {
		if(i >= A) w[i] |= w[i - A];
		if(i >= B) w[i] |= w[i - B];
	}
	t[0] = 1;
	for(int i = 1 ; i <= F ; ++i) {
		if(i >= C) t[i] |= t[i - C];
		if(i >= D) t[i] |= t[i - D];
	}
	t[0] = 0;
	for(int i = 1 ; i <= F ; ++i) {
		if(t[i]) t[i] = i;
		else t[i] = t[i - 1];
	}
	int a = A * 100,b = 0;
	for(int i = 1 ; i <= F / 100 ; ++i) {
		if(!w[i]) continue;
		int rem = min(F - i * 100,i * E);
		int s = t[rem],p = i * 100 + s;
		if(s * a > b * p) {a = p;b = s;}
	}
	out(a);space;out(b);enter;
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	Solve();
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

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

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (rl,gl,bl,n) = get!(usize, usize, usize, usize);

    let mut count = 0;
    for r in 0..(n/rl+1) {
        for g in 0..(n-r*rl)/gl+1 {
            if (n-r*rl-g*gl) % bl == 0 {
                count += 1;
            }
        }
    }
    println!("{}", count);

}


Measured memory_bytes: 8572
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main() {
    unsigned short *A, *B;

    int C[VMAX+ 1];
    int n, i, j;
    scanf("%d", &n);

    A = malloc(sizeof(short) * n + 1);
    B = malloc(sizeof(short) * n + 1);

    for (i=0; i<=VMAX; i++) C[i]=0;

    for (i=0; i<n; i++) {
        scanf("%hu", &A[i+1]);
        C[A[i + 1]]++;
    }

    for (i=1; i<=VMAX; i++) C[i] = C[i] + C[i-1];

    for (j=1; j<=n; j++) {
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }

    for (i=1; i<=n; i++) {
        if (i>1) printf(" ");
        printf("%d", B[i]);
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 9572
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector<long long> ans;

void dfs(long long x) {
    if (x > 3234566667) return;
    ans.push_back(x);
    for (int i = -1; i <= 1; i++) {
        int add = x % 10 + i;
        if (0 <= add && add <= 9) {
            dfs(x * 10 + add);
        }
    }
}

int main() {
    int K; cin >> K;
    for (long long i = 1; i < 10; i++) dfs(i);
    sort(ans.begin(), ans.end());
    cout << ans[K-1] << endl;
}


Measured memory_bytes: 4252
#include <vector>
#include <iostream>
#include <map>
using namespace std;
template<typename T, typename S> vector<T>& operator<<(vector<T>& a, S b) { a.push_back(b); return a; }
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	map<char,int> t;
	t['I']=1, t['X']=10, t['V'] = 5;
	t['L'] = 50 , t['C'] = 100 , t['M'] = 1000 , t['D'] = 500;
	string s;
	while(cin >> s){
		int ret = 0;
		ret += t[s[0]];
		rep(i,s.length()-1){
			if(t[s[i+1]] > t[s[i]])ret -= 2*t[s[i]];
			ret += t[s[i+1]];
		}
		cout << ret << endl;
	}
}

Measured memory_bytes: 0
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		while (n-- > 0) {
			int m = scanner.nextInt();
			int[] num = new int[m];
			for (int i = 0; i < m; i++)
				num[i] = scanner.nextInt();
			int a = 0;
			int b = 0;
			for (int i = 1; i < m; i++) {
				a = Math.max(a, num[i] - num[i - 1]);
				b = Math.max(b, num[i - 1] - num[i]);
			}
			System.out.println(a + " " + b);

		}
	}
}

Measured memory_bytes: 26812
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

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

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int k;
    string s;
    cin >> k >> s;
    if(s.size()<=k)cout << s << endl;
    else {
        rep(i,k)cout << s[i];
        cout << "..." << endl;
    }
}

Measured memory_bytes: 3644
#include <iostream>
using namespace std;
int N, K, X, Y, sum = 0;
int main()
{
  cin >> N >> K >> X >> Y;
  for (int i = 0; i < N; i++)
  {
    if (i < K)
    {
      sum += X;
    }
    else
    {
      sum += Y;
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#define int long long
#define ll getchar();getchar();return 0;
using namespace std;
int a[114];
signed main(){
	int n, m, x,cnt=0,cnta=0;
	cin >> n >> m >> x;
	for (int i = 0; i < m; i++)cin >> a[i];
	for(int i=0;i<m;i++){
		for (int j = 0; j < x; j++) {
			if (j == a[i])cnt++;
		}
		for (int k = x; k < n; k++) {
			if (k == a[i])cnta++;
		}
	}
	cout << min(cnt, cnta) << endl;
	ll
}

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

using namespace std;
#define INFS (1LL<<28)
#define INF (1LL<<60)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long
#define double long double



int a[200];


signed main(){
	int n;
	cin>>n;
	lp(i,n-1){
		cin>>a[i+1];
	}
	a[0]=1000000;
	a[n]=1000000;
	int ans=0;
	lp(i,n){
		ans+=min(a[i],a[i+1]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

struct Node_struct{
	Node_struct *l, *r, *p;
	int key;
};
Node_struct* Root;

void insert(int num){
	Node_struct *x = Root , *y = NULL, *z;
	z=(Node_struct*)malloc(sizeof(Node_struct));
	z->key = num;
	z->l = NULL, z->r = NULL;
	
	while(x != NULL){
		y = x;
		if(z->key > x->key) x = x->r;
		else x = x->l;
	}
	z->p = y;
	if(y == NULL) Root = z;
	else if(z->key > y->key) y->r = z;
	else y->l = z;
}

void in(Node_struct *cur){
	if(cur==NULL)	return;
	in(cur->l);
	printf(" %d",cur->key);
	in(cur->r);
}

void pre(Node_struct *cur){
	if(cur==NULL)	return;
	printf(" %d", cur->key);
	pre(cur->l);
	pre(cur->r);
}

int main(){
	int i, n;
	int id;
	string s;
	scanf("%d", &n);
	
	for(i=0; i<n; ++i){
		cin >> s;
		if(s[0] == 'i'){
			scanf("%d", &id);
			insert(id);
		}
		else if(s[0] == 'p'){
			in(Root);
			printf("\n");
			pre(Root);
			printf("\n");
		}
	}
	
	return 0;
}


Measured memory_bytes: 26672
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        Set<String> set = new HashSet<String>();

        int n = scan.nextInt();

        for(int i = 0; i < n; i++) {
            String order = scan.next();

            if(order.equals("insert")) {
                set.add(scan.next());
            } else {
                if(set.contains(scan.next())) {
                    System.out.println("yes");
                } else {
                    System.out.println("no");
                }
            }
        }
    }
}


Measured memory_bytes: 260172
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from math import gcd

K = read_a_int()
A, B = read_ints()
for x in range(A, B + 1):
    if x % K == 0:
        print('OK')
        exit()
print('NG')


Measured memory_bytes: 67344
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <numeric>

using namespace std;

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

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

int n, k;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    n = (int) s.size();
    cin >> k;

    for (auto &c : s) {
        if (c == 'a') continue;
        int cost = 'z' - c + 1;
        if (k >= cost) {
            c = 'a';
            k -= cost;
        }
    }

    if (k > 0) {
        k %= 26;
        s[n - 1] = (char) (s[n - 1] + k);
    }
    cout << s << endl;
}

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

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

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

  vector<int> v;
  for(auto x: m){
    v.push_back(x.second);
  }

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

  int c = v.size();
  int ans=0;
  for (int i = 0; i < c-k; i++) {
    ans+=v[i];
  }

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


Measured memory_bytes: 10748
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int x,a;
	cin >> x;
	a =x%7;

	if(a == 2)cout << "sat" << endl;
	if(a == 3)cout << "sun" << endl;
	if(a == 4)cout << "mon" << endl;
	if(a == 5)cout << "tue" << endl;
	if(a == 6)cout << "wed" << endl;
	if(a == 0)cout << "thu" << endl;
	if(a == 1)cout << "fri" << endl;

	return 0;
}



Measured memory_bytes: 3104
s = input()
n = len(s)
p = 0
ten = 1
cnt = [0] * 2019
cnt[0] = 1
ans = 0
for i in reversed(s):
    p = (p + int(i) * ten) % 2019
    ans += cnt[p]
    cnt[p] += 1
    ten = ten * 10 % 2019

print(ans)


Measured memory_bytes: 9136
#include <bits/stdc++.h>
 
int main() {
  std::ios::sync_with_stdio(false);
  int N;
  std::cin >> N;
  std::vector<int> vec;
  int x = 0;
  for (int i = 0; i < N; i++) {
    int a;
    std::cin >> a;
    vec.push_back(a);
    x ^= a;
  }
  std::cout << (vec[0] ^ x);
  for (int i = 1; i < N; i++) {
    std::cout << " " << (vec[i] ^ x);
  }
  return 0;
}

Measured memory_bytes: 4348
#include<bits/stdc++.h>
using namespace std;
//define
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
#define elif else if
//vectordefine
#define vint vector<int>
#define vc vector<char>
#define vtr vector<string>
#define pb(n) push_back(n)
//queuedefine
#define qint queue<int>
#define qc queue<char>
#define qstr queue<str>
//mapdefine
#define mint map<int>
#define mc map<char>
//pairdefine
#define pint pair<int,int>
#define pis pair<int,str>
#define pic pair<int,char>
#define pci pair<char,int>
#define mod 100000007

string syugei(int N){
  string ST="b";
  for(int i=0;i<N;i++){
    if(i%3==0||i==0)ST="a"+ST+"c";
    else if(i%3==1||i==1)ST="c"+ST+"a";
    else if(i%3==2||i==2)ST="b"+ST+"b";
  }
  return ST;
}
// int hantei(string S){
//   for(int i=0;i<S.size(),i++){
//     for(int j=0;j<)
//   }
// }
//main
signed main(){
  int N,M,O,P,X,count=0,count2=0;
  double D=0;
  int c='A'-'a';
  //char C;
  str S,T;
  cin>>N;
  double A[N]={},B[N]={};
  rep(0,N){
    cin>>A[i];
    D+=1/A[i];
  }
  printf("%.6f\n",1/D);
}


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

int main(){
  int A,B; cin>>A>>B;
  int ans=0;
  for(int i=A;i<=B;i++){
    string s=to_string(i);
    if(s[0]==s[4]&&s[1]==s[3]) ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N, A, B;

ll f1(ll A, ll B) {
  ll ret = A-1;
  A -= ret;
  B -= ret;
  if(A%2 != B%2) {
    --B; ++ret;
  }
  return ret + (B-A)/2;
}

ll f2(ll A, ll B) {
  ll ret = N-B;
  A += ret;
  B += ret;
  if(A%2 != B%2) {
    ++A; ++ret;
  }
  return ret + (B-A)/2;
}

int main() {
  cin>>N>>A>>B;
  
  // meet at 1 / N
  ll ret = min(B-1, N-A);
  
  // head towards each other
  if(B%2 == A%2) {
    ret = min(ret, (B-A)/2);
  }
  // A go to 1 then head towards B
  ret = min(ret, f1(A,B));
  
  // B go to N then head towards A
  ret = min(ret, f2(A,B));
  
  cout<<ret<<"\n";
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
namespace my_std {
using namespace std;
#define reg register
#define Rint register int
#define FOR(i, a, b) for (register int i = (a), ed_##i = (b); i <= ed_##i; ++i)
#define ROF(i, a, b) for (register int i = (a), ed_##i = (b); i >= ed_##i; --i)
typedef long long i64;
#define Templ(T) template <typename T>
inline int read() {
    reg int ans = 0, f = 1;
    reg char c = getchar();
    while (!isdigit(c)) f ^= (c == '-'), c = getchar();
    for (; isdigit(c); c = getchar()) ans = (ans << 1) + (ans << 3) + (c ^ 48);
    return f ? ans : -ans;
}
Templ(_Tp) inline int chkmin(_Tp &x, _Tp y) { return x > y ? x = y, 1 : 0; }
Templ(_Tp) inline int chkmax(_Tp &x, _Tp y) { return x < y ? x = y, 1 : 0; }
} // namespace my_std
using namespace my_std;

#define N 100010
#define pb push_back
int n, m, a[N], b[N], c[N];
int oud[N], f[N], s[N], r[N];
//out degree, father, size, ring
vector<int> q[4];
i64 ans;
inline int find(int x){ return x == f[x] ? x : (f[x] = find(f[x])); }
//0类：自环自成连通块
//1类：环自成连通块
//2/3类：其他连通块（中的自环/其他边）

int main() {
    n = read(), m = read();
    FOR(i, 1, n) f[i] = i, r[i] = 1;
    FOR(i, 1, m){
        a[i] = read(), b[i] =read(), c[i] = read();
        ++oud[a[i]], ans += a[i] != b[i];
        f[find(a[i])] = find(b[i]);
    }
    FOR(i, 1, n){
        ++s[find(i)];
        if(oud[i] != 1) r[find(i)] = 0;
    }

    reg i64 cnt(0);
    FOR(i, 1, n){
        cnt += find(i) == i && s[i] > 1 && r[i];
    }
    if(!cnt) return printf("%lld\n", ans), 0;
    ans += cnt;
    //无环
    FOR(i, 1, m){
        if(c[i] == 1) continue;
        Rint u = (find(a[i]));
        if(r[u]){
            if(s[u] == 1) q[0].pb(c[i] - 2);
            else if(s[u] > 1) q[1].pb(c[i] - 1);
        }
        else{
            q[a[i] == b[i] ? 2 : 3].pb(c[i] - 1);
        }
    }
    reg i64 sum(0);
    FOR(o, 0, 3) for(Rint i: q[o]) sum += i;
    if(sum < cnt) return puts("-1"), 0;
    //可用次数不够
    if(q[2].empty() && q[3].empty()) return puts("-1"), 0;
    //没有能开始贡献的
    FOR(o, 0, 3) sort(q[o].begin(), q[o].end());
    if(q[3].size()) cnt -= q[3].back(), q[3].pop_back();
    else ++ans, cnt -= q[2].back(), q[2].pop_back();
    //开始贡献
    for(Rint i: q[1]) cnt -= i;
    for(Rint i: q[3]) cnt -= i;
    if(cnt <= 0) return printf("%lld\n", ans), 0;
    //无需额外次数
    reg i64 res(1145141919810364364ll);
    sum = 0;
    Rint p(0);
    for(Rint i: q[2]) sum += i;
    ROF(i, q[0].size(), 0){
        if(i < (int)q[0].size()) sum += q[0][i];
        while(p < (int)q[2].size() && sum - q[2][p] >= cnt)
            sum -= q[2][p++];
        if(sum >= cnt){
            chkmin(res, 2ll * ((int)q[0].size() - i) +
                ((int)q[2].size() - p));
        }
    }
    //2 Pointers求剩余两种各取几个
    printf("%lld\n", ans + res);
    return 0;
}

Measured memory_bytes: 6980
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main(){
	FIO
	
	char a, b;
	cin >> a >> b;
	if(a < b)puts("<");
	else if(a == b)puts("=");
	else puts(">");
 	return 0; 
}


Measured memory_bytes: 256
#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 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 int inf = INT_MAX;
const ll INF = LLONG_MAX;
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=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    string S, T; cin >> S >> T;

    rep(i, n){
        cout << S[i] << T[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    int l;
    int length = 1;
    int input[length];
    for(int i = 0;i < length && cin>>l;i++){
        input[i] = l;
    }
    cout << (int)input[0]/3600 << ":" << (int)(input[0]%3600)/60 << ":" << input[0]%60 << endl;
    return 0;
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int f1[200000+10],f2[200000+10],n,k,l,x,y;
map<pair<int,int>,int > m;
int find(int x,int p[]){
	return p[x]==x?p[x]:p[x]=find(p[x],p);
}
void un(int x,int y,int p[]){
	if(find(x,p)!=find(y,p)){
		p[find(x,p)]=find(y,p);
	}
}
void init(int p[]){
	for(int i=1;i<=n;i++){
		p[i]=i;
	}	
}
int main(){
	cin>>n>>k>>l;
	init(f1);init(f2);
	for(int i=1;i<=k;i++){
		cin>>x>>y;
		un(x,y,f1);
	}
	for(int i=1;i<=l;i++){
		cin>>x>>y;
		un(x,y,f2);
	}
	for(int i=1;i<=n;i++){
		find(i,f1);find(i,f2);
	}
	for(int i=1;i<=n;i++){
		m[make_pair(f1[i],f2[i])]++;
	}
	for(int i=1;i<=n;i++){
		cout<<m[make_pair(f1[i],f2[i])]<<" ";
	}
	return 0;
}

Measured memory_bytes: 13568
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int a,b;
	string S;
	cin >> a >> b >> S;
	int n = S.size();
	int flag = 0;
	for(int i = 0; i < n; i++) {
		if(i == a){
			if (S[i] != '-'){
				flag = 1;
				break;
			}
		}
		else{
			if (S[i] == '-'){
				flag = 1;
				break;
			}
		}
	}

	if (flag == 0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256