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



int main(){
    double n,m;
    int count=0;
    double all=0;
    cin>>n>>m;
    vector<long long int> a(n);
    for (int i = 0; i < n; i++)
    {
        
        cin>>a.at(i);
        all+=a.at(i);
    }
    for (int i = 0; i < n; i++)
    {
        if(a.at(i)>=(all/(4.0*m))){
            count++;
        }
    }
    if(m<=count){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


// https://snuke.hatenablog.com/entry/2014/12/03/214243
// input  aaabaaaab
// output 921034210
int Zargorithm( int n, const int* S, int* A ) {
    A[0] = n;
    int i = 1, j = 0;
    while (i < n) {
        while (i+j < n && S[j] == S[i+j]) ++j;
        A[i] = j;
        if (j == 0) { ++i; continue;}
        int k = 1;
        while (i+k < n && k+A[k] < j) A[i+k] = A[k], ++k;
        i += k; j -= k;
    }
    return 0;
}


char str[5005];

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    scanf("%s", str);

    vector<int> S(n), A(n);
    int i;
    for(i=0; i<n; i++) {
        S[i]=str[i]-'a';
    }

    ll ans=0;
    int j;
    for(i=0; i<n; i++) {
        Zargorithm( n-i, &S[i], &A[0]);
        for(j=1; j<n-i; j++) {
            int tmp=A[j];
            int ans0=MIN(tmp,j);
            ans = MAX(ans, ans0);
        }
    }
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<time.h>
#include<stdlib.h>

using namespace std;

int main(){
    int N = 0;
    cin >> N;
    for(int i = 1; i < 10; i++){
        for(int j = 1; j < 10; j++){
            if(i*j == N){
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

using State = pair<PII, int>;
int xs, ys, xg, yg;
int N;
VT<State> circle;

int main(void) {
    scanf("%d%d%d%d", &xs, &ys, &xg, &yg);
    scanf("%d", &N);
    circle.resize(N + 2);
    circle[0] = MP(MP(xs, ys), 0);
    circle[N + 1] = MP(MP(xg, yg), 0);
    REP(i, N) {
        int x, y, r;
        scanf("%d%d%d", &x, &y, &r);
        circle[i + 1] = MP(MP(x, y), r);
    }
    priority_queue<pair<double, int>, VT<pair<double, int>>, greater<pair<double, int>>> pq;
    pq.push(MP(0, 0));
    double ans = 1e18;
    VT<bool> visited(N + 2, false);
    while (!pq.empty()) {
        double nowCost;
        int nowId;
        tie(nowCost, nowId) = pq.top(); pq.pop();
        if (visited[nowId]) continue;
        visited[nowId] = true;
        if (nowId == N + 1) {
            ans = nowCost;
            break;
        }
        double x1, y1, r1;
        x1 = circle[nowId].first.first;
        y1 = circle[nowId].first.second;
        r1 = circle[nowId].second;
        REP(i, N + 2) {
            if (visited[i]) continue;
            double x2, y2, r2;
            x2 = circle[i].first.first;
            y2 = circle[i].first.second;
            r2 = circle[i].second;
            double nextCost = nowCost + max<long double>(0.0, sqrtl(powl(x1 - x2, 2) + powl(y1 - y2, 2)) - r1 - r2);
            pq.push(MP(nextCost, i));
        }
    }
    cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 8688
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;

int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  s[k-1] = tolower(s[k-1]);
  cout << s << "\n";
}

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

signed main()
{
  int a, b;
  scanf("%d %d", &a, &b);

  int now = 1, ans = 0;
  while (now < b) {
    ++ans;
    now += (a - 1);
  }

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

  return (0);
}

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


int main() {
  int n;
  cin >> n;
  vector<char> s(n);
  rep(i,n) cin >> s[i];
  bool ans = false;
  rep(i,n){
    if (s[i] == 'Y') ans = true;
  }
  if (ans) cout << "Four" << endl;
  else cout << "Three" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    vector<int> b = a;
    sort(b.begin(),b.end());
    vector<int> odd;
    for(int i = 0; i < n; i++){
        if(i%2){
          odd.push_back(a[i]);
          odd.push_back(b[i]);
        }
    }
    set<int> odd_set(odd.begin(),odd.end());

    cout << odd_set.size()-n/2 << endl;
    return 0;
}


Measured memory_bytes: 6136
n = int(input())
dp = [i for i in range(n+1)]

for i in range(n):
    dp[i + 1] = min(dp[i + 1], dp[i] + 1)
    j = 1
    while (n >= i + j * 6):
        j *= 6
        dp[i + j] = min(dp[i + j], dp[i] + 1)
    j = 1
    while (n >= i + j * 9):
        j *= 9
        dp[i + j] = min(dp[i + j], dp[i] + 1)
print(dp[n])


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

S = input().rstrip()
s_cnt =0
t_cnt =0

for s in S:
    if s == 'S':
        s_cnt += 1
    else:
        if s_cnt >0:
            s_cnt -= 1
        else:
            t_cnt += 1
            
print(t_cnt + s_cnt)


Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline void chmin(T& t, const U& u){if(t>u)t=u;}
template<typename T,typename U> inline void chmax(T& t, const U& u){if(t<u)t=u;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T> inline T mpow(T a, T n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  string s;cin>>s;
  int ind=siz(s)-1,ans=0;
  rep(i,0,siz(s)){
      if(i>=ind-i)break;
      if(s[i]!=s[ind-i])ans++;
      
  }
  cout<<ans<<endl;
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static Scanner scan;

    public static void main(String[] args) {
        scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        double d = 1.0 * a/b;
        System.out.println(a/b + " " + a%b + " " + String.format("%.5f", d));
    }
}

Measured memory_bytes: 17372
#include <iostream>
using namespace std;
int main() {
	string s;
	cin >> s;
	if (s[2] == s[3]) {
		if (s[4] == s[5]) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

//#define FILE
#define int long long
//#define LL long long
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fst first
#define scd second
#define inv(x) ksm(x,mod - 2)

const int MAXN = 2e5 + 10;
const int INF = 2e9;
const int G = 3;
const double PI = acos(-1);
const double eps = 1e-8;
//const int mod = 1e9 + 7;
//const int mod = 998244353;

int n,k;
int a[MAXN];
int L = 1,R = 2e9,mid;

template<typename T> inline void read(T &a) {
	a = 0; char c = getchar(); int f = 1;
	while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9') {a = a * 10 + (c ^ 48); c = getchar();}
	a *= f;
}

bool chk(int x) {
	int cnt = 0;
	for(int i = 1;i <= n; ++i) 
		cnt += (a[i] + x - 1) / x - 1;
	return (cnt <= k);
}

signed main () {
#ifdef FILE
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	read(n); read(k);
	for(int i = 1;i <= n; ++i) cin >> a[i];
	while(L < R) {
		mid = (L + R) >> 1;
		if(chk(mid)) R = mid;
		else L = mid + 1;
	}
	cout << L << endl;
	return 0;
}

Measured memory_bytes: 5112
s = input()
aki = ['KIHBR',
     'AKIHBR',
     'KIHABR',
     'KIHBAR',
     'KIHBRA',
     'AKIHABR',
     'AKIHBAR',
     'AKIHBRA',
     'KIHABAR',
     'KIHABRA',
     'KIHBARA',
     'AKIHABAR',
     'AKIHABRA',
     'AKIHBARA',
     'KIHABARA',
     'AKIHABARA']
if s in aki:
    print("YES")
else:
    print("NO")

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

using namespace std;

int main() {
    int n, V[20], C[20];
    int total = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> V[i];
    }
    for (int j = 0; j < n; j++) {
        cin >> C[j];
    }

    for (int k = 0; k < n; k++) {
        if ((V[k] - C[k]) >= 0) {
            total += V[k] - C[k];
        }
    }

    cout << total << endl;

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

const (
	bufsiz = 1024 * 1024
)

func main() {
	writer := newWriter(os.Stdout)
	defer writer.Flush()

	sc := newScanner(os.Stdin)
	nPeaple := sc.scanInt()

	elements := make([]int, nPeaple)

	for i := 0; i < nPeaple; i++ {
		elements[i] = sc.scanInt()
	}

	mIndex := 0
	mValue := elements[0]

	for {
		loop := false

		for i, v := range elements { // 配列より最小値を探す
			if 0 < v && v < mValue {
				mIndex = i
				mValue = v
			}
		}

		for i, v := range elements { // 各要素を最小値で割ったあまりで置換
			if i == mIndex || v == 0 {
				continue
			}

			remainder := v % mValue
			if remainder < elements[i] {
				elements[i] = remainder
				loop = true
			}
		}

		if !loop {
			break
		}
	}

	writer.println(mValue)
}

// contains returns:
// if s contains e, true. / if s not contains e, false.
func contains(s []int, e int) bool {
	for _, v := range s {
		if e == v {
			return true
		}
	}
	return false
}

type scanner struct {
	*bufio.Scanner
}

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	return &scanner{s}
}

func (s *scanner) scanStr() string {
	s.Buffer(make([]byte, bufsiz), bufsiz)
	if !s.Scan() {
		panic("scan failed")
	}
	return s.Text()
}

func (s *scanner) scanInt() int {
	if !s.Scan() {
		panic("scan failed")
	}
	i, err := strconv.Atoi(s.Text())
	if err != nil {
		panic(err)
	}
	return i
}

type writer struct {
	*bufio.Writer
}

func newWriter(wr io.Writer) *writer {
	w := bufio.NewWriter(wr)
	return &writer{w}
}

func (w *writer) printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(w, f, args...)
}

func (w *writer) println(args ...interface{}) (int, error) {
	return fmt.Fprintln(w, args...)
}


Measured memory_bytes: 3072
#include <iostream>
using namespace std;
#define rep(i,q) for(int i = 0; q > i; i++)

int main(){
  int n,w,h;
  cin >> n >> w >> h;
  int ok = 0;
  rep(i,n){
    int wn,hn;
    cin >> wn >> hn;
    if(wn >= w && hn >= h)ok++;
  }
  cout << ok << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
typedef long long int ll;
using namespace std;
int main()
{
	int a,b;
	cin >> a >> b;
  	if(a==b){
		cout << "Draw" << endl;
    }else if(a==1){
		cout << "Alice" << endl;
    }else if(b==1){
		cout << "Bob" << endl;
    }else if(a<b){
		cout << "Bob" << endl;
    }else{
		cout << "Alice" << endl;
    }
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>
#include<cmath>
#include<cstring>
#include<map>
#include<sstream>
 
using namespace std;

long long int N,K,counts;

int main(){
  cin>>N>>K;
  counts=0;
  
  while(N>0){
    N = N/K;
    counts++;
  }
  
  cout<<counts++<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

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

	//set<string> s;
	vector<string> v;
	rep(i,n){
		string a;
		cin >> a;
		//s.emplace(a);
		v.emplace_back(a);
	}
	sort(all(v));
	//for(auto i : s){ cout << i; }
	for(auto i : v) cout << i;
	cout << endl;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
q = 10**9 + 7
stairs = [0]* (N+1)
for _ in range(M):
    a = int(input())
    stairs[a] = "*"

stairs[0] = 1
if stairs[1] != "*":
    stairs[1] = 1

for i in range(2, N+1):
    if stairs[i] != "*":
        if stairs[i-1] != "*" and stairs[i-2] != "*":
            stairs[i] = (stairs[i-1] + stairs[i-2]) % q
        elif stairs[i-1] == "*" and stairs[i-2] != "*":
            stairs[i] = stairs[i-2] % q
        elif stairs[i-1] != "*" and stairs[i-2] == "*":
            stairs[i] = stairs[i-1] % q
        else:
            stairs[i] = 0
print(stairs[N] % q)


Measured memory_bytes: 6900
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

int main(){
    int D;
    string cs ="Christmas",ev = " Eve";

    cin >> D;
    D = 25 - D; 
    cout << cs;
    for(int i=0;i<D;i++){
        cout << ev;
    }
    cout << endl;

}

Measured memory_bytes: 256
antennas=[]
for _ in range(5):
    antennas.append(int(input()))
k=int(input())
    
for i in range(5):
    for j in range(i+1,5):
        if antennas[j]-antennas[i]>k:
            print(":(")
            exit()

print("Yay!")
                    


Measured memory_bytes: 2940
n=int(input())
s=input().split()
l=[int(i) for i in s]
ll=[0 for i in range(n)]
ll[0]=l[0]
for i in range(1,n):
    ll[i]=ll[i-1]+l[i]
ll=[0]+ll
ll.sort()
now=ll[0]
cnt=1
res=0
for i in range(1,n+1):
    if ll[i]==now:
        cnt+=1
    else:
        res+=cnt*(cnt-1)//2
        cnt=1
        now=ll[i]
res+=cnt*(cnt-1)//2
print(res)

Measured memory_bytes: 99024
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>

auto& in = std::cin;
auto& out = std::cout;

int32_t a, b, c;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> a>>b>>c;
	for (int32_t i = 0; i < a; ++i)
	{
		if ((b*i + c) % a == 0) {
			std::cout << "YES\n"; return 0;
		}
	}

	std::cout << "NO\n"; return 0;
}
#endif


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<set>
#include<queue>
#define rep(i,j,n) for(int i=j;i<n;i++)
using namespace std;
#define int long long
int mul[214514];
int divi[214514];
#define inf 1000000007
int bit[114514],n;
struct edge{int u,v,cost;};
edge es[214514];
int zero=0;
int dp[55][55][3000];
string alph("abcdefghijklmnopqrstuvwxyz");
signed main(){
    int n;cin>>n;
    pair<int,int> p[1005];
    rep(i,0,n){
        cin>>p[i].first>>p[i].second;
    }
    pair<int,int> count;
    count.first=0,count.second=0;
    rep(i,1,n){
        int h=p[i-1].first/p[i].first;
        int g=p[i-1].second/p[i].second;
        if(p[i-1].first%p[i].first!=0)h++;
        if(p[i-1].second%p[i].second!=0)g++;
        int maxi=max(h,g);
        p[i].first*=maxi;
        p[i].second*=maxi;
    }
    int ans=p[n-1].first+p[n-1].second;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int N,K;
int h[100010];
int dp[100010];
const int INF = 2e9;

int main ()
{
    cin >> N >> K;
    REP(i,N) cin >> h[i];
    fill (dp, dp + 100010, INF);

    dp[0] = 0;
    for (int i = 1; i < N; i++) {
        for (int j = 1; j <= min(K, i); j++) {
            dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
        }
    }

    cout << dp[N - 1] << endl;
    REP(i,N) cerr << dp[i] << " ";
    cerr << endl;

    return 0;
}


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

int main()
{
  string T;
  cin >> T;
  for (int i = 0; i < T.size(); i++)
  {
    if (T[i] != '?') continue;
    else T[i] = 'D';
  }
  cout << T << endl;
}


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

from collections import defaultdict
import bisect

def main():
  s = input().strip()
  t = input().strip()
  ns = len(s)
  
  if len(set(list(t)) - set(list(s))):
    print(-1)
    return
  
  ichs = defaultdict(list)  
  for i, c in enumerate(s):
    ichs[c].append(i)
    
  ic = -1
  cnt = 0
  for c in t:
    ix = bisect.bisect_right(ichs[c], ic)
    
    if ix >= len(ichs[c]):
      cnt += 1
      ix = 0
    else:
      if ic == ichs[c][ix]:
        if ix + 1 >= len(ichs[c]):
          cnt += 1
          ix = 0
        else:
          ix += 1
    ic = ichs[c][ix]
  print(cnt*ns + ic + 1)
    
      
    
  

if __name__=='__main__':
  main()



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

int main() {
  cout << setprecision(15);
  int n;
  cin >> n;
  double a = 0;
  for (int i = 0; i < n; ++i) {
    double v;
    cin >> v;
    a += 1.0/v;
  }
  cout << 1/a << endl; 
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)1e9+7
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define PP pair<P,P>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2) % mod;
}
int get_rand(int MIN, int MAX) {
	random_device rnd;
	mt19937_64 mt64(rnd());
	uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt64);
}
/*--------Library Zone!--------*/

string s;
int ans[114514];
signed main() {
	cin >> s;
	int r = 0, l = 0, memo;
	rep(i, s.size()) {
		if (s[i] == 'R')r++;
		else l++;
		if (i < s.size() - 1 && s[i] == 'R' && s[i + 1] == 'L')memo = i;
		if (s[i] == 'L' && i < s.size() - 1 && s[i + 1] == 'R') {
			if ((l + r) % 2 == 0) {
				ans[memo] = (l + r) / 2;
				ans[memo + 1] = (l + r) / 2;
			}
			else {
				if (r % 2) {
					ans[memo] = (r + l) / 2 + 1;
					ans[memo + 1] = (r + l) / 2;
				}
				else {
					ans[memo] = (r + l) / 2;
					ans[memo + 1] = (r + l) / 2 + 1;
				}
			}
			l = 0; r = 0;
		}
	}
	if ((l + r) % 2 == 0) {
		ans[memo] = (l + r) / 2;
		ans[memo + 1] = (l + r) / 2;
	}
	else {
		if (r % 2) {
			ans[memo] = (r + l) / 2 + 1;
			ans[memo + 1] = (r + l) / 2;
		}
		else {
			ans[memo] = (r + l) / 2;
			ans[memo + 1] = (r + l) / 2 + 1;
		}
	}
	rep(i, s.size())cout << ans[i] << " ";
	cout << endl;
}


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

int main() {
	string s;
	int o = 0;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (i % 2 == 1) {
			if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D')o++;
		}
		if (i % 2 == 0) {
			if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D')o++;
		}
	}
	if (o == s.size())cout << "Yes" << endl;
	else cout << "No" << endl;
		return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
int N; 
cin >> N; 
string W[123] = {}; 
string ans = "Yes"; 
cin >> W[0]; 
for(int i = 1; i < N; i++){
cin >> W[i]; 
if((W[i]).at(0) != (W[i-1]).at((W[i-1]).size()-1)){
ans = "No"; 
break; 
}
}
for(int i = 0; i < N-1; i++){
 for(int j = i+1; j < N; j++){
if(W[i] == W[j]){
ans = "No"; 
break; 
}
}
}
cout << ans << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  string s;
  cin >> s;

  if(s == "Sunny"){
    cout << "Cloudy" << endl;
  }else if(s == "Cloudy"){
    cout << "Rainy" << endl;
  }else{
    cout << "Sunny" << endl;
  }
}

Measured memory_bytes: 256
def dfs(n,i,b)
  r=0
  [3,5,7].each do |j|
    nb=b|2**j
    nn=n+j*10**i
    next if N<nn
    r+=1 if [nb[3],nb[5],nb[7]].all?{|i|i==1}
    r+=dfs(nn,i+1,nb)
  end
  r
end

N=gets.to_i
puts dfs(0,0,0)


Measured memory_bytes: 1788
#include<iostream>
#include<cstring>
#include<vector>
#include<queue>
using namespace std;
int beg[5005];
int ans[5005];
int number;
int t, n;
bool vis[5003];
int dis[5003];
int  x, y;
struct cmp
{
	template<typename T>
	bool operator()(T const& left, T const& right)
	{
		if (left.second > right.second) return true;
		else return false;
	}
};
struct edge
{
	int to;
	int Next;
	int w;
}ljb[5005];
void add(int from, int to, int w)
{
	number++;
	ljb[number].to = to;
	ljb[number].w = w;
	ljb[number].Next = beg[from];
	beg[from] = number;
}
void dij(int x)
{
	memset(dis, 0x7f, sizeof(dis));
	memset(vis, 0, sizeof(vis));
	int res, pos;
	dis[x] = 0;
	priority_queue<pair<int, int>, vector<pair<int, int> >, cmp>q;
	q.push(make_pair(x, 0));
	while (!q.empty())
	{
		pair<int, int>res;
		res = q.top();
		q.pop();
		int from = res.first;
		vis[from] = 1;
		for (int j = beg[from]; j != -1; j = ljb[j].Next)
		{
			int to = ljb[j].to;
			if (!vis[to] && dis[to] > dis[from] + ljb[j].w)
			{
				dis[to] = dis[from] + ljb[j].w;
				q.push(make_pair(to, dis[to]));
			}
		}
	}
}
int main()
{
	memset(beg, -1, sizeof(beg));
	cin >> n >> x >> y;
	for (int i = 2; i <= n; i++)
	{
		add(i, i - 1, 1);
		add(i - 1, i, 1);
	}
	add(x, y, 1);
	add(y, x, 1);
	for (int i = 1; i <= n; i++)
	{
		dij(i);
		for (int j = 1; j <= n; j++)
		{
			if (i == j) continue;
			else ans[dis[j]]++;
		}
	}
	for (int i = 1; i <= n - 1; i++) 
		cout << ans[i] / 2 << endl;
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAX=30;
struct Node{
	int parent, left ,right,deg;
	Node():parent(-1),left(-1),right(-1),deg(0){}
}T[MAX];
int N;
int height(int num){
	if(num==-1 || T[num].deg==0) return 0;
	int h1=-1,h2=-1;
	if(T[num].left!=-1) h1=height(T[num].left)+1;
	if(T[num].right!=-1) h2=height(T[num].right)+1;
	return max(h1,h2);
}
int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		int id,l,r;
		cin>>id>>l>>r;
		T[id].left=l;
		T[id].right=r;
		if(l!=-1)T[l].parent=id,T[id].deg++;
		if(r!=-1)T[r].parent=id,T[id].deg++;
	}
	const char st[3][20]={"root","internal node","leaf"};
	for(int i=0;i<N;i++){
		int d=0,p=i,k,sib=-1;
		if(T[p].parent==-1)k=0;
		else if(!T[p].deg)k=2;
		else k=1;
		while(T[p].parent!=-1){
			p=T[p].parent;
			d++;
		}
		if(T[i].parent!=-1){
			p=T[i].parent;
			if(i==T[p].left) sib=T[p].right;
			else sib=T[p].left;
		}
		printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n",
			i,T[i].parent,sib,T[i].deg,d,height(i),st[k]);
	}
	return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	int n;cin>>n;
	int l[n];
	rep(i,n) cin>>l[i];

	sort(l,l+n);
	int ans=0;
	for(int i=0;i<n-2;i++){
		for(int j=i+1;j<n-1;j++){
			auto mx=lower_bound(l+j,l+n,l[i]+l[j]);
			int dl=distance(l+j+1,mx);
			//cout<<dl<<"\n";
			ans+=dl;
		}
	}

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

Measured memory_bytes: 256
# include <iostream>
# include <cmath>
using namespace std;
int main()
{
	long long n,s,p,d;
	cin>>n;
	s=n+1;
	d=sqrt(n);
	for(int i=1; i<=d; i++)
	{
		if(n%i==0)
		{
			if(n/i>=i)
			{
				p=(n/i-1)+(i-1);
				if(p<s)
				{
					s=p;
				}
			}
			else
			{
				break;
			}
		}
	}
	cout<<s; 
}

Measured memory_bytes: 3680
// Shift-JIS（シフトジス）

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

int gcd(long long a, long long b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }

    return b ? gcd(b, a % b) : a;
}

int lcm(long long a, long long b)
{
    return a * b / gcd(a, b);
}

int main()
{   
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    size_t index1 = distance(A.begin(), max_element(A.begin(), A.end()));
    int Amax1 = A[index1];
    A[index1] = 0;
    size_t index2 = distance(A.begin(), max_element(A.begin(), A.end()));
    int Amax2 = A[index2];
    for (int i = 0; i < N; i++)
    {
        if (i != index1)
        {
            cout << Amax1 << endl;
        }
        else
        {
            cout << Amax2 << endl;
        }
    }
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    printf("%d\n", n*(n-1)/2 + m*(m-1)/2);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace diverta_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] a = Console.ReadLine().Split(' ');
            var n = long.Parse(a[0]);
            var k = long.Parse(a[1]);
            Console.WriteLine(Convert.ToString(n-k+1));
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13268
def gcd(a, b):
  if a > b:
    a, b = b, a
  while a > 0:
    a, b = b % a, a
  return b

# a以上の最小のbの倍数
def overMinMulti(a, b):
  if a % b == 0:
    return a
  return (a // b + 1) * b

# a以下の最大のbの倍数
def underMaxMulti(a, b):
  return a // b * b

A, B, C, D = map(int, input().split())
E = C * D // gcd(C, D)
print(
  B - A + 1
  - ((underMaxMulti(B, C) - overMinMulti(A, C)) // C + 1)
  - ((underMaxMulti(B, D) - overMinMulti(A, D)) // D + 1)
  + ((underMaxMulti(B, E) - overMinMulti(A, E)) // E + 1)
)

Measured memory_bytes: 3064
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    string s;cin>>s;
    char tmp=s[0];
    int ans=0;
    rep2(i,1,s.size()){
        if(s[i]!=tmp){
            ans++;
            tmp=s[i];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
const int inf =         1e18;
const int mod =         1e9+7;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r;








void sol()
{   string s;
    cin>>s;
    if(s=="ABC")cout<<"ARC";
    else cout<<"ABC";
    
    
    
    //cout<<  <<endl;
}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)
    sol();
    return 0;
}

Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		int d = sc.nextInt();
		int m2 = sc.nextInt();
		int d2 = sc.nextInt();
		if(d2 == 1) {
			System.out.println(1);
		}else {
			System.out.println(0);
		}
		sc.close();
	}
}

Measured memory_bytes: 23124
#include<stdio.h>
int main()
{
    int N,K;
    unsigned long long sum1=0,sum2=0,i,m=1000000007,a;
    scanf("%d%d",&N,&K);
    for(i=K;i<=(N+1);i++){
        sum1=(sum1+i)%m;
    }
    for(i=K;i<=(N+1);i++){
        sum2=(sum2+i*(i-1))%m;
    }
    a=(N*sum1+N-K+2-sum2)%m;
    printf("%llu\n",a);
    return 0;
}


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

int ans;

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

  int n, m;
  cin >> n >> m;
  unordered_set<int> g[n];
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].insert(b);
    g[b].insert(a);
  }
  vector<int> hs(n, false);
  function<int(int, int)> dfs = [&] (int f, int num) {
    int tmp = num;
    hs[f] = true;
    for (int to : g[f]) {
      if (hs[to]) continue;
      tmp += dfs(to, 1);
    }
    return tmp;
  };
  rep(i,n) {
    if (hs[i]) continue;
    int num = dfs(i, 1);
    ans = max(ans, num);
  }

  cout << ans << endl;
}

Measured memory_bytes: 46076
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int H,W;
vector<vector<bool>> maze;

int main()
{
	cin >> H;
	cin >> W;

	maze = vector<vector<bool>>(H, vector<bool>(W,true));

	for (int i = 0; i < H; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < W; j++) {
			if (s.at(j) == '#') { maze.at(i).at(j) = false; }
		}
	}

	vector<vector<int>> h_len = vector<vector<int>>(H, vector<int>(W, 0));
	vector<vector<int>> w_len = vector<vector<int>>(H, vector<int>(W, 0));

	for (int i = 0; i < H; i++) {
		int count = 0;
		for (int j = 0; j < W; j++) {
			if (maze.at(i).at(j)) {
				count++;
				w_len.at(i).at(j) = count;
			}
			else {
				count = 0;
			}
		}

		for (int j = W-2; j >= 0; j--) {
			if (w_len.at(i).at(j) > 0 && w_len.at(i).at(j + 1) > 0){
				w_len.at(i).at(j) = w_len.at(i).at(j + 1);
			}
		}
	}

	for (int j = 0; j < W; j++) {
		int count = 0;
		for (int i = 0; i < H; i++) {
			if (maze.at(i).at(j)) {
				count++;
				h_len.at(i).at(j) = count;
			}
			else {
				count = 0;
			}
		}

		for (int i = H-2; i >= 0; i--) {
			if (h_len.at(i).at(j) > 0 && h_len.at(i + 1).at(j) > 0) {
				h_len.at(i).at(j) = h_len.at(i + 1).at(j);
			}
		}
	}

	int ans = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (maze.at(i).at(j)) {
				int tmp = h_len.at(i).at(j) + w_len.at(i).at(j) - 1;
				ans = max(ans, tmp);
			}
		}
	}

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 32256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#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 ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using D = double;
using LD = long double;
const int mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

vector<int> g[1005];

int main(){
    int n,m; cin >> n >> m;
    rep(i,m){
        int a,b; cin >> a >> b;
        a--; b--;
        g[a].pb(b);
    }

    int mini = 1e9;
    vector<int> ans;

    rep(start,n){
        vector<int> dist(n, -1);
        vector<int> prev(n, -1);
        queue<int> que;
        que.push(start);
        dist[start] = 0;

        while(!que.empty()){
            int from = que.front();
            que.pop();

            for(int to : g[from]){
                if(dist[to] == -1){
                    dist[to] = dist[from] + 1;
                    prev[to] = from;
                    que.push(to);
                }
            }
        }

        rep(goal,n){

            if(start == goal || dist[goal] == -1) continue;

            for(int next : g[goal]){

                if(next == start){

                    vector<int> cycle_option;
                    cycle_option.pb(start);
                    int pass = goal;
                    while(pass != start){
                        cycle_option.pb(pass);
                        pass = prev[pass];
                    }

                    if((int)cycle_option.size() < mini){
                        ans = cycle_option;
                        mini = cycle_option.size();
                    }
                }
            }
        }
    }

    if(mini == 1e9) cout << "-1" << endl;
    else{
        cout << ans.size() << endl;
        rep(i, (int)ans.size()) cout << ans[i] + 1 << endl;
    }
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
using namespace std;

int main()
{
    char c;
    
    cin >> c;
    
    if((c=='a')||(c=='i')||(c=='u')||(c=='e')||(c=='o')) {
        cout << "vowel\n";
    } else {
        cout << "consonant\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

int main(){
  int n,k;
  cin >> n >> k;
  set<int> set;
  int d;
  int x;
  rep(i,k){
    cin >> d;
    rep(j,d){
      cin >> x;
      set.insert(x);
    }
  }
  printf("%d\n", n-set.size());
  return 0;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

bool ok(vector<ll> &a, vector<ll> &f, ll k, ll m)
{
    rep(i, a.size())
    {
        ll aa = m / f[i];
        //cerr << aa << endl;
        assert(f[i] * aa <= m && aa >= 0 && f[i] * (aa + 1) > m);
        k -= max(0ll, (a[i] - aa));
    }
    return k >= 0;
}

int main(int argc, char const *argv[])
{
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n), f(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> f[i];
    sort(ALL(a));
    sort(ALL(f), greater<ll>());
    ll l = -1, r = 1e12 + 1;
    while (l + 1 != r)
    {
        ll med = (l + r) / 2;
        if (ok(a, f, k, med))
        {
            //cerr << "ok" << endl;
            r = med;
        }
        else
        {
            //cerr << "ng" << endl;
            l = med;
        }
    }
    cout << l + 1 << endl;

    return 0;
}


Measured memory_bytes: 3328
#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 n, a, b;
	cin >> n >> a >> b;

	ll sho = n/(a+b);
	ll amari = n%(a+b);
	ll sum_a = a*sho + min(amari, a);

	cout << sum_a << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
#define MAXN 10000
#define LL long long
#define Pr pair<int,int>
#define X first
#define Y second
int n,k;
char s[MAXN+5],Mn,Mx,ans[MAXN+5],tmp[MAXN+5];
LL read(){
    LL x=0,F=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*F;
}
void cal(char *s,int t){
	int np=n,len=0;
	while(np>=1&&s[np]==Mn)
	np--,len++;
	while(t>0&&len<n)len*=2,t--;
	if(len>=n){
		for(int i=1;i<=n;i++)
		ans[i]=Mn;
		return ;
	}
	for(int i=1;i<=len;i++)tmp[i]=Mn;
	for(int i=len+1;i<=n;i++)
	tmp[i]=s[np--];
	for(int i=1;i<=n;i++)
	if(tmp[i]<ans[i]){
		for(int j=1;j<=n;j++)
		ans[j]=tmp[j];
		return ;
	}else if(tmp[i]>ans[i])return ;
}
int main()
{
	n=read(),k=read();
	scanf("%s",s+1);
	Mn='z',Mx='a';
	for(int i=1;i<=n;i++){
		Mn=min(Mn,s[i]),Mx=max(Mx,s[i]);
		s[n*2-i+1]=s[i];ans[i]='z';
	}
	if(s[n]==Mn)cal(s,k);
	for(int i=n;i<=2*n;i++)
	if(s[i]==Mn)cal(s+i-n,k-1);
	printf("%s",ans+1);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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

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

int main()
{
  int n;
  cin >> n;
  switch (n % 10)
  {
  case 2:
  case 4:
  case 5:
  case 7:
  case 9:
    cout << "hon" << endl;
    break;
  case 0:
  case 1:
  case 6:
  case 8:
    cout << "pon" << endl;
    break;
  case 3:
    cout << "bon" << endl;
    break;
  default:
    break;
  }
  return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<numeric>
#include<set>
#include<math.h>
using namespace std;

int A, P;

int main(){
    cin >> A >> P;

    cout << (3*A + P) / 2 << "\n";
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <unordered_map> 

using namespace std;
int main(void){
    unordered_map<string, int> mp;
    string S[100000];
    char buf[10];
    int N;
    long long int ans=0;
    cin >> N ;
    for(int i=0;i<N;i++){
        cin >> buf;
        sort(buf,buf+10);
        S[i] = string(buf);
//        cout << S[i] << endl;
    }
    
    for(int i=0;i<N;i++){
        auto itr = mp.find(S[i]); 
        if( itr == mp.end() ) {
            mp[S[i]]=1;
        } else {
                ans +=mp[S[i]];
                mp[S[i]]++;
        }
    }
    
    printf("%lld",ans);
}


Measured memory_bytes: 11428
n = int(input())
pnts = []
for i in range(n):
    x,y = map(int,input().split())
    pnts.append((x,y))
s = 0
for i in range(n):
    for j in range(n):
        if j != i:
            s += ((pnts[j][0]-pnts[i][0])**2 + (pnts[j][1]-pnts[i][1])**2)**0.5
print(s/n)


Measured memory_bytes: 3188
#include<iostream>
#include <string>
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define ll long long int
#define ld long double
#define pb push_back
#define endl "\n"
#define mp make_pair
#define sz(v) (int)(v.size())
#define len(s) (int)(s.length())
#define M 1000000007
#define all(v) v.begin(),v.end()
#define fr(a,b,c) for(ll i=a;i<=b;i+=c)
#define inarr(arr,n); for(ll i=0;i<n;i++) cin >> arr[i];
#define outarr(arr,n); for(ll i=0;i<n;i++) cout<<arr[i]<<" ";
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll inf = 9e18;
const ld pi = 2*acos(0.0); 
using namespace std;
ll power(ll a,ll n) 
{
    if(n==0){
        return 1;
    }
    ll p=power(a,n/2) % M;
    p = (p * p) % M;
    if (n%2==1)
    {
        p=(p*a)%M;
    }
    return p;
}
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
const int N=1e6+5;
vector <ll> sieve(N,0); 
void si() 
{
    sieve[1]=1;
    for(int i=2;i<N;i++){
        if(sieve[i]==0){
            for(int j=i;j<N;j+=i){
                sieve[j]=i;
            }
        }
    }
}
int main(){
    ios;
    string s;
    string t;
    cin>>s>>t;
    ll ans=1e9;
    ll n=len(t);
    for(int i=0;i<len(s);i++){
        if(i+n<=len(s)){
            ll count=0;
            for(int j=i;j<i+n;j++){
                if(s[j]!=t[j-i]){
                    count+=1;
                }
            }
            ans=min(ans,count);
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

#define INF (INT64_MAX/2)
#define MAX 100
#define MOD (1000000000+7)

int main() {
	char b;

	cin >> b;

	char c = 'A';
	if( b == 'A' ) {
		c = 'T';
	}
	else if( b == 'C' ) {
		c = 'G';
	}
	else if( b == 'G' ) {
		c = 'C';
	}
		
	cout << c << endl;

	return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
int b[10][2000],n,m;
vector<int> a[10];
int fn(int p,int q,int r){
  int i;
  if(p==9)
      return q?a[p][q-1]+q*(q-1):0;
  if(b[p][q]>=0)
    return b[p][q];
  int mx=0;
  for(i=0;i<=min((int)a[p].size(),q);++i){
    if(q-i>r-(int)a[p].size())
      continue;
    mx=max(mx,(i?a[p][i-1]+i*(i-1):0)+fn(p+1,q-i,r-a[p].size()));
  }
  return b[p][q]=mx;
}
int main(){
  int i,j;
  cin>>n>>m;
  for(i=0;i<n;++i){
    int p,q;
    cin>>p>>q;
    --q;
    a[q].push_back(p);
  }
  for(i=0;i<10;++i){
    sort(a[i].begin(),a[i].end(),greater<int>());
    for(j=1;j<(int)a[i].size();++j)
      a[i][j]+=a[i][j-1];
  }
  memset(b,-1,sizeof(b));
  cout<<fn(0,m,n)<<endl;
  return 0;
}

Measured memory_bytes: 0