akhauriyash/Code-Regression huggingface dataset:
<?php

[$N] = fscanf(STDIN, "%d");

$array = [];


[$tmp] = fscanf(STDIN, "%d");
$array[] = $tmp;
for($i=2;$i<=$N;$i++){
    [$tmp] = fscanf(STDIN, "%d");
    $target = binarySearch($array, $tmp);
    $array[$target] = $tmp;
}
echo count($array);



function isOK($target, $array_value){
    if($target > $array_value){
        return true;
    }else{
        return false;
    }
}
function binarySearch(array $array, int $target){
    $ng = -1;
    $ok = count($array);
    while(abs($ok - $ng) >1){
        $mid = intdiv($ng + $ok, 2);
        if(isOK($target, $array[$mid])){
            $ok = $mid;
        }else{
            $ng = $mid;
        }
    }
    return $ok;

}


Measured memory_bytes: 21048
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static Input in = new Input(System.in);
    static PrintWriter out = new PrintWriter(System.out);


    public static void main(String[] args) {
        int N = in.nextInt();
        out.println(2 * Math.PI * N);
        out.flush();
    }

    static class Input {
        private BufferedReader br;
        private String[] buff;
        private int index = 0;

        Input(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
        String next() {
            while (buff == null || index >= buff.length) {
                buff = nextLine().split(" ");
                index = 0;
            }
            return buff[index++];
        }
        byte nextByte() {
            return Byte.parseByte(next());
        }
        short nextShort() {
            return Short.parseShort(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        float nextFloat() {
            return Float.parseFloat(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}

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

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
  
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)2e5+11;
ll const LG=(ll)log2(N)+1;

void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
       
        ll a,b,c;
        cin>>a>>b>>c;
        cin>>k;
        while(b<=a){
                b*=2;
                k--;
        }
        while(c<=b){
                c*=2;
                k--;
        }
        if(k<0){
                cout<<"No\n";
        }else{
                cout<<"Yes\n";
        }
       
        
        
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        for(ll tc=1;tc<=q;tc++){
                // cout<<"Case #"<<tc<<": ";
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}


Measured memory_bytes: 3636
N = int(input())

A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
prev = -1
score = 0
for i in range(N):
    if prev+1 == A[i]:
        score+=C[prev-1]
    score+=B[A[i]-1]
    prev = A[i]

print(score)

Measured memory_bytes: 38384
/*author : Yashvardhan
Monday, May 11, 2020
1:36 AM
*/

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

using ll = long long;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define rev(Y) reverse(all(Y))

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

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

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int takemod(int a){return ((a%mod)+mod)%mod;}

int pow(int a, int b, int m)
{
	int ans = 1;
	a %= m;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int modinv(int a){return takemod( pow( takemod(a), mod-2,mod ) );}

int n,a,b,c;
vi arr;

vi strg;
int ans = inf;
void solve(int ind, pi x, pi y, pi z){
	if(ind == n){
		vpi tmp = {x,y,z};
		int mini = inf;
		int curr = 0;
		for(int i = 0; i < 3; i++){
			int val = tmp[i].ff;
			int occ = tmp[i].ss;
			mini = min(mini, occ);
			curr += (occ - 1) * 10;
			curr += abs(strg[i] - val);
		}
		if(mini == 0) return;
		ans = min(ans, curr);
		return;
	}
	solve(ind + 1, x, y, z);
	solve(ind + 1, {x.ff + arr[ind], x.ss + 1}, y, z);
	solve(ind + 1, x, {y.ff + arr[ind], y.ss + 1}, z);
	solve(ind + 1, x, y, {z.ff + arr[ind], z.ss + 1});
}

signed main()
{

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

	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	cin >> n >> a >> b >> c;

	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		arr.pb(x);
	}
	strg.pb(a);
	strg.pb(b);
	strg.pb(c);

	solve(0, {0,0}, {0,0}, {0,0});

	cout << ans << endl;
	

	t2 = clock();
	cerr << endl << t2-t1 << endl;
	
	return 0;
}



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

using namespace std;
const int maxn = 20;
const int maxm = 1010;
const int inf = 0x3f3f3f3f;

int n, m;
int a[maxm], b[maxm];
int dp[1 << maxn];

int f(int mask) {
    int &ret = dp[mask];
    if (ret != -1) return ret;

    ret = inf;
    int tren = inf;
    for (int i = 0; i < m; i++)
        tren = min(tren, f(mask | b[i]) + a[i]);
    return ret = tren;
}

int main() {
    scanf("%d%d", &n, &m);
    for (int i = 0; i < m; i++) {
        int x;
        scanf("%d%d", a+i, &x);
        for (int j = 0; j < x; j++) {
            int a;
            scanf("%d", &a); a--;
            b[i] |= (1 << a);
        }
    }

    memset(dp, -1, sizeof dp);
    dp[(1 << n) - 1] = 0;

    int x = f(0);
    if (x >= inf) printf("-1\n");
    else printf("%d\n", x);
    return 0;
}


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

int main() {
    string S;
    string T;
    int size_s, size_t;
    bool t;
    cin >> S;
    cin >> T;
    size_s = S.size();
    size_t = T.size();
    for(int i=0; i<size_s; i++){
        if (S[i] == T[i]){
            t = true;
            continue;
        } else{
            t = false;
            break;
        }
    }
    if(t){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
from collections import deque

N, Q = list(map(int, input().split(" ")))
AB = [list(map(int, input().split(" "))) for _ in range(N-1)]
PX = [list(map(int, input().split(" "))) for _ in range(Q)]

points = [0 for _ in range(N+1)]
g = [[] for _ in range(N+1)]
for a, b in AB:
    g[a].append(b)

# print(g)

for p, x in PX:
    points[p] += x

q = deque([1])
while q:
    node = q.popleft()
    for child in g[node]:
        points[child] += points[node]
        q.append(child)

print(*points[1:])


Measured memory_bytes: 129604
n, m = map(int, input().split())

lrds = [tuple(map(int, input().split())) for _ in range(m)]

xs = [None for _ in range(n)]

ps = [[] for _ in range(n)]

for lrd in lrds:
    l, r, d = lrd
    ps[l-1].append((r-1, d))
    ps[r-1].append((l-1, -d))

not_decided = set(range(n))

def solve():
    while len(not_decided) != 0:
        t = not_decided.pop()
        xs[t] = 0

        stack = [t]
        while len(stack) != 0:
            c = stack.pop()
            for p in ps[c]:
                another, relative_position = p
                if another in not_decided:
                    xs[another] = xs[c] + relative_position
                    not_decided.remove(another)
                    stack.append(another)
                else:
                    if xs[another] != xs[c] + relative_position:
                        return False
    return True

if solve():
    print("Yes")
else:
    print("No")


Measured memory_bytes: 100052
#include<cstdio>
#include<algorithm>
using namespace std;
int n, A[10100], B[10100];
long long S, s1, s2;
int main() {
	int i;
	scanf("%d", &n);
	for (i = 1; i <= n; i++) {
		scanf("%d", &A[i]);
		S -= A[i];
	}
	for (i = 1; i <= n; i++) {
		scanf("%d", &B[i]);
		S += B[i];
	}
	if (S < 0) {
		printf("No\n");
		return 0;
	}
	for (i = 1; i <= n; i++) {
		long long t = B[i] - A[i];
		if (t < 0) {
			s2 += (-t);
		}
		else {
			s1 += (t+1) / 2;
			s2 += t % 2;
		}
	}
	if (max(s1,s2) <= S)printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;
using namespace std;

int main(void) {
  ll i, j, k, a, b, c, n, m;
  scanf("%lld%lld%lld", &a, &b, &c);
  printf("%lld", (a - b + 1) * (a - c + 1));
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
char s[110];
int p=0;
double f(double a,int b,double c){
  if(b==2)return a+c;
  if(b==3)return a-c;
  if(b==4)return a*c;
  return a/c;
}
int kobun(){
  int i,r=0,o[3],or[]={0,0,1,1,2,2};
  int n[3],a;
  char c[]={")=+-*/"};
  while(1){
    for(a=0;'0'<=s[p]&&s[p]<='9';p++)a=a*10+s[p]-'0';
    if(s[p]=='('){
      p++;
      a=kobun();
    }
    for(i=0;s[p]-c[i];i++);
    for(;r&&or[o[r-1]]>=or[i];r--)a=f(n[r-1],o[r-1],a);
    n[r]=a;
    o[r++]=i;
    p++;
    if(or[i]==0)return n[0];
  }
  return 0;
}
int main(){
  int n;
  for(scanf("%d",&n);n--;p=0){
    scanf("%s",s);
    printf("%d\n",kobun());
  }
  return 0;
}

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

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T,X;
  cin>>T>>X;
  double ans= (double)T/(double)X;
  cout<<ans;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main(){
  string s1,s2,s3; cin>>s1>>s2>>s3;
  s1[0]=s1[0]-32;
  s2[0]=s2[0]-32;
  s3[0]=s3[0]-32;
  cout<<s1[0]<<s2[0]<<s3[0]<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define NIL -1
int F[45];
int fibonacci(int n){
  if(n==0 || n==1){
    return F[n]=1;
  }
  if(F[n]>0){
    return F[n];
  }
  return F[n]=fibonacci(n-2)+fibonacci(n-1);
}

int main(){
  int i,n;
  scanf("%d",&n);
  for(i=0;i<=n;i++){
    F[i]=NIL;
  }
  F[n]=fibonacci(n);
  printf("%d\n",F[n]);
  return 0;
}



Measured memory_bytes: 2044
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			Dice dice1 = new Dice(sc.nextLine().split(" "));
			Dice dice2 = new Dice(sc.nextLine().split(" "));

			Boolean clear = false;
			for (int i = 0; i < 2; i++) {
				for (int j = 0; j < 4; j++) {
					for (int k = 0; k < 4; k++) {
						if (Arrays.equals(dice1.d, dice2.d)) {
							clear = true;
							break;
						}
						dice2.S();
					}
					dice2.E();
				}
				dice2.R();
			}
			if (!clear) {
		        System.out.println("No");
		    } else {
		        System.out.println("Yes");
		    }
		}
	}
	static class Dice{
		private int[] d = new int[6];

		public Dice(String[] d_num) {
			for(int i = 0;i < d.length;i++) {
				d[i] = Integer.parseInt(d_num[i]);
			}
		}

		public void N() {
		    int tmp = d[0];
		    d[0] = d[1];
		    d[1] = d[5];
		    d[5] = d[4];
		    d[4] = tmp;
		}

		public void E() {
		    int tmp = d[0];
		    d[0] = d[3];
		    d[3] = d[5];
		    d[5] = d[2];
		    d[2] = tmp;
		}

		public void W() {
		    int tmp = d[0];
		    d[0] = d[2];
		    d[2] = d[5];
		    d[5] = d[3];
		    d[3] = tmp;
		}

		public void S() {
		    int tmp = d[0];
		    d[0] = d[4];
		    d[4] = d[5];
		    d[5] = d[1];
		    d[1] = tmp;
		}
		public void R() {
			int tmp = d[1];
			d[1] = d[3];
			d[3] = d[4];
			d[4] = d[2];
			d[2] = tmp;
		}
	}
}



Measured memory_bytes: 26376
#include<cstdio>

int a, b, c;

int main() {
  scanf("%d %d %d", &a, &b, &c);
  if (a == b && a != c || a == c && a != b || b == c && a != b) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
}


Measured memory_bytes: 128
import itertools

n=int(input())
A=list(map(int,input().split()))
q=int(input())
m=list(map(int,input().split()))
fin=False
"""
def solve(i,m):
    global n
    if m==0:
        print("yes")
        fin=True
        return True
    if i>=n:
        return False
    solve(i+1,m) 
    solve(i+1,(m-A[i]))
    #return res
for i in range(q):
    fin=False
    cnt=0
    #for i in range(n):
    solve(0,m[i])
    if fin ==True:
        cnt=cnt+1
    if fin==False and cnt==0:
        print("no")
    #fin=False
"""

fin=False
s=[]
for i in range(n):
    fin=False
    S=list(itertools.combinations(A,i))
    for k in range(len(S)):
        t=sum(S[k])
        s.append(t)
for i in m:
    if i in s:
        print("yes")
    else:
        print("no")

                



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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;
ll gcd(ll a, ll b)
{
    return (b ? gcd(b, a % b) : a);
}
int main()
{
    speed;
    cout << fixed << setprecision(10);
    /*start*/
    vector<ll> a(3);
    rep(i, 3) cin >> a[i];
    sort(All(a));
    ll red, blue;
    red = a.back() / 2;
    blue = red + a.back() % 2;
    ll ans = abs((red - blue) * a[0] * a[1]);
    c(ans);

    return 0;
}


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

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

  string s,t; cin >> s >> t;
  for(int i = s.size()-1; i >= 0; i--){
    if(s[i] == t[0] || s[i] == '?'){
      bool judge = true;
      for(int j = 0; j < t.size(); j++){
        if(i+j >= s.size() || (s[i+j] != t[j] && s[i+j] != '?')) judge = false;
      }
      if(judge){
        for(int j = 0; j < s.size(); j++){
          if(i == j){
            cout << t;
            j += t.size();
            j--;
            continue;
          }
          if(s[j] == '?') cout << 'a';
          else cout << s[j];
        }
        cout << endl;
        return 0;
      }
    }
  }
  cout << "UNRESTORABLE" << endl;

  return 0;
}


Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char c) {return to_string((string) &c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    string s;cin >> s;
    auto c = [&](ll x){
        bool ok = true;
        ll cnt = 0;
        rrep(i,n, 0){
            if(s[i] - '0' == x % 10){
                x /= 10;
                cnt++;
            }
        }

        return cnt >= 3;
    };
    ll ans = 0;
    rep(i,0,1000){
        if(c(i))ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 764
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}
const int N=2e5+10;
int n,m;
ll k,a[N],b[N],sum[N];
int main()
{
    n=read(),m=read(),k=read();
    rep(i,1,n) a[i]=read();
    rep(i,1,m) b[i]=read(),sum[i]=sum[i-1]+b[i];


    ll now=0;
    int ans=0,mx=0;
    for(int i=1;i<=n;++i){
        if(now+a[i]<=k) now+=a[i],mx=i;
        else{
            break;
        }
    }
    //printf("mx:%d\n",mx);
    ans=mx;
    for(int i=1;i<=m;++i){
        if(now+b[i]<=k) {
            now+=b[i],ans=max(ans,mx+i);
            //printf("i:%d mx:%d now:%lld\n",i,mx,now);
        }
        else {
            if(mx) now-=a[mx--],--i;
            else break;
        }
    }
    printf("%d\n",ans);

}


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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

void solve() {
    int n, m;
    cin >> n >> m;

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

    int cnt = 0;
    for (auto f : foods_count) {
        if (n <= f.second) cnt++;
    }
    cout << cnt << endl;
}

int main() {
    solve();

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] x = new int[n];

        for (int i=0; i<n; i++) x[i] = sc.nextInt();

        long ans = Long.MAX_VALUE;

        for (int i=1; i<=100; i++){
            int tmp = i;
            long sum = 0;
            for (int j=0; j<n; j++){
                sum += Math.pow(x[j]-tmp, 2);
            }
            ans = Math.min(ans, sum);
        }

        System.out.print(ans);



//        Arrays.sort(x);



    }
}


Measured memory_bytes: 23124
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, m; cin >> n >> m;
  vector<map<int, bool> > mp(m);
  REP(i, m) {
    int k; cin >> k;
    REP(j, k) {
      int ss; cin >> ss; --ss;
      mp[i][ss] = true;
    }
  }
  vector<int> p(m); REP(i, m) cin >> p[i];
  int ans = 0;
  REP(i, 1 << n) {
    bool ok = true;
    REP(j, m) {
      int cnt = 0;
      REP(k, n) if (i >> k & 1) {
        if (mp[j].count(k) == 1) ++cnt;
      }
      cnt %= 2;
      if (cnt != p[j]) {
        ok = false;
        break;
      }
    }
    if (ok) ++ans;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
import itertools
N = int(input())
P = ''.join(input().split())
Q = ''.join(input().split())
tmp = itertools.permutations([str(i+1) for i in range(N)])
target = []
for a in tmp:
    target.append(''.join(a))
print(abs(target.index(P)-target.index(Q)))


Measured memory_bytes: 41072
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(d,w):
        aa = [LI() for _ in range(d)]
        r = 0
        for i in range(d-2):
            for j in range(w-2):
                for k in range(i+2,d):
                    for l in range(j+2,w):
                        mi = inf
                        for m in range(i,k+1):
                            t = aa[m][j]
                            if mi > t:
                                mi = t
                            t = aa[m][l]
                            if mi > t:
                                mi = t
                        for m in range(j,l+1):
                            t = aa[i][m]
                            if mi > t:
                                mi = t
                            t = aa[k][m]
                            if mi > t:
                                mi = t
                        s = 0
                        for m in range(i+1,k):
                            for n in range(j+1,l):
                                if mi <= aa[m][n]:
                                    s = -inf
                                    break
                                s += mi - aa[m][n]
                        if r < s:
                            r = s
        return r


    while 1:
        n,m = LI()
        if n == 0:
            break
        rr.append(f(n,m))

    return '\n'.join(map(str, rr))


print(main())



Measured memory_bytes: 9056
def partition(a, p, r):
    x = a[r]["value"]
    i = p - 1
    for j in range(p, r):
        if a[j]["value"] <= x:
            i += 1
            tmp = a[i]
            a[i] = a[j]
            a[j] = tmp
    tmp = a[i+1]
    a[i+1] = a[r]
    a[r] = tmp
    return i + 1


def quick_sort(a, p, r):
    if p < r:
        q = partition(a, p, r)
        quick_sort(a, p, q-1)
        quick_sort(a, q+1, r)


def print_a(a):
    for x in a:
        print(x["design"], x["value"])


n = int(input())
a = []
for _ in range(n):
    s = input().split()
    a.append({"design": s[0], "value": int(s[1])})
b = a.copy()

quick_sort(a, 0, n - 1)

for i in range(n - 1):
    if a[i]["value"] == a[i+1]["value"]:
        if b.index(a[i]) > b.index(a[i + 1]):
            print("Not stable")
            break
else:
    print("Stable")

print_a(a)


Measured memory_bytes: 34684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll N;
  cin>>N;
  vector<ll> kushi(N*2);
  for(ll i=0;i<N*2;i++) cin>>kushi[i];
  sort(kushi.begin(),kushi.end());
  ll ans=0;
  for(ll i=0;i<N*2;i+=2) ans+=kushi[i];
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <queue>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <functional>
using namespace std;

int H, W; char c[200][200]; vector<int>A, B;

int main() {
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) cin >> c[i][j];
	}
	for (int i = 0; i < H; i++) {
		int cnt = 0;
		for (int j = 0; j < W; j++) { if (c[i][j] == '#') cnt++; }
		if (cnt != 0) A.push_back(i);
	}
	for (int i = 0; i < W; i++) {
		int cnt = 0;
		for (int j = 0; j < H; j++) { if (c[j][i] == '#') cnt++; }
		if (cnt != 0) B.push_back(i);
	}
	for (int i = 0; i < A.size(); i++) {
		for (int j = 0; j < B.size(); j++) cout << c[A[i]][B[j]]; cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
def main():
    S = input()
    N = len(S)

    num1 = int((N - 1) / 2)
    num2 = int((N + 3) / 2)

    if S[: num1] == S[num2 - 1 :]:
        print('{}'.format('Yes'))
    else:
        print('{}'.format('No'))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;   
#define ll long long
#define pb push_back
#define mk make_pair
#define fir first
#define sec second
#define i1 insert
#define all(v)  v.begin(),v.end()
#define scan(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define scan1(a,n) for(ll i=0;i<n;i++){  ll z; cin>>z; a.pb(z);}
#define print(a) for(ll i=0;i<a.size();i++){    cout<<a[i]<<" " ;}
#define f(i,k,n) for(ll i=k;i<n;i++)
#define pi 6.28318530717958623200
ll gcd(ll a,ll b)
{
	ll m2=max(a,b);
	ll m1=min(a,b);
	if(m1==0)
	  return m2;
	  else
	   return gcd(m2%m1,m1);
}
ll fac(ll x)
{
	if(x==0||x==1)
	 return 1;
	 else
	   return x*fac(x-1);
}
bool check_prime(ll x)
{
	if(x<=1)
	 return false;
	 if(x<=3)
	  return true;
	if(x%2==0||x%3==0)
	  return false;
	else
	{
		for(int i=5;i*i<=x;i+=6)
		  {
		  	if(x%i==0||x%(i+2)==0)
		  	return false;
		  }
	}
	return true;
	
}
ll lcm(ll a,ll b)
{
	return a*b/gcd(a,b);
}

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q=1;
 //  cin>>q; 
    while(q--)
    {
        string s,t;
        cin>>s>>t;
       string e=t.substr(0,t.length()-1);
	   if(s==e)
	   cout<<"Yes"<<endl;
	   else
	    cout<<"No"<<endl;    
	
		
}
 	return 0;
} 

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, L;
  cin >> N >> L;
  int baf = 1000000000, sum = 0;
  for(int i = 0; i < N; i++){
    sum += i + L;
    if(abs(i + L) < abs(baf))baf = i + L;
  }
  cout << sum - baf << endl;
  return 0;
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;

int main ()
{
    int numS , numS2 , numB , time , cou = 0 ;
    cin >> numS >> numB >> time ;
    numS2 = numS ;
    while (numS <= (time + 0.5))
           {
                numS += numS2 ;
                cou ++ ;
           }
           cout << cou * numB << endl ;
    return 0 ;
}


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

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

Measured memory_bytes: 256
/*
  AOJ 0199
  Title:Chairs Where Demanding People Sit
  @kankichi573
*/
#include <stdio.h>
#include <string.h>
#define max(x,y) (((x)>(y))?(x):(y))
#define min(x,y) (((x)<(y))?(x):(y))

int n,m;
char seat[101];

void sit_down_D(char seat[])
{
  char dist[101];
  int i,j,max_,max_s;

  memset(dist,127,sizeof(dist));
  for(i=0;i<n;i++)
    if(seat[i]!='#')
      for(j=0;j<n;j++)
	{
	  if(i-j>=0) 
	    dist[i-j]=min(dist[i-j],j);
	  if(i+j<n) 
	    dist[i+j]=min(dist[i+j],j);
	}
#ifdef DEBUG
  for(i=0;i<n;i++)
    printf("%d",dist[i]);
  printf("\n");
#endif
  for(i=max_=0;i<n;i++)
    if(max_<dist[i])
      {
	max_=dist[i];
	max_s=i;
      }
  seat[max_s]='D';
}
void sit_down(char seat[],char guest,int order)
{
  char *p;
  int i;

  if(guest=='A')
    {
      p=strchr(seat,'#');
      *p='A';
    }
  else if(guest=='B')
    {
      if(seat[n-1]=='#' && seat[n-2]!='A')
	seat[n-1]='B';
      else 
	{
	  for(i=n-2;i>0;i--)
	    if(seat[i-1]!='A' && seat[i+1]!='A' && seat[i]=='#')
	      {
		seat[i]='B';
		return;
	      }
	  p=strchr(seat,'#');
	  *p='B';
	}
    }
  else if(guest=='C')
    {
      if(order==0)
	{
	  if(n & 1)
	    seat[(n+1)/2-1]='C';
	  else
	    seat[n/2]='C';
	}
      else
	{
	  for(i=0;i<n-1;i++)
	    if(strchr("ABCD",seat[i]))
	      {
		if(i<n-1 && seat[i+1]=='#')
		  {
		    seat[i+1]='C';
		    return;
		  }
		if(i>0 && seat[i-1]=='#')
		  {
		    seat[i-1]='C';
		    return;
		  }
	      }
	}
    }
  else if(guest=='D')
    {
      if(order==0)
	seat[0]='D';
      else
	sit_down_D(seat);
    }
}
void display()
{
  int i;
  for(i=0;i<n;i++)
    printf("%c",seat[i]);
  printf("\n");
}

main()
{
  int i,ret;
  char guest;
  
  while(scanf("%d %d ",&n,&m)  && (n||m))
    {
      memset(seat,'#',sizeof(seat));
      seat[100]='\0';
      for(i=0;i<m;i++)
	{
	  scanf("%c ",&guest);
	  sit_down(seat,guest,i);
#ifdef DEBUG
	  display();
#endif
	}
      display();
    }
  return(0);
}

Measured memory_bytes: 580
# Aさんは a[m] 地点、Bさんは b[m] 地点、Cさんは c[m] 地点
# 二人の人間は、距離が d[m] 以内のとき直接会話可能
# A・Cが直接的に会話ができる or A・Bさんが直接会話でき、かつB・Cが直接会話できる
# 会話できるなら Yes を, できないなら No を出力せよ。

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

# aとcの差の絶対値がd以下
if abs(c-a) <= d:
    print('Yes')
# aとbの差の絶対値がd以下かつbとcの差の絶対値がd以下
elif abs(b-a) <= d and abs(c-b) <= d:
    print('Yes')
else:
    print('No') 

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

int main() {
	int a, b;
	while (true) {
		cin >> a >> b;
		if (a == 0 && b == 0)break;
		if (a > b)cout << b << " " << a << endl;
		else cout << a << " " << b << endl;
	}
	return 0;
}

Measured memory_bytes: 3076
N = int(input())
D = list(map(int, input().split()))
M = 998244353
from collections import Counter

if D[0] != 0:
    print(0)
    exit(0)

cd = Counter(D)
if cd[0] != 1:
    print(0)
    exit(0)

tmp = sorted(cd.items(), key=lambda x: x[0])

ans = 1
for kx in range(2, max(D)+1):
# print(tmp)
# for kx in range(2, len(tmp)):
    # print(kx)
    # __, p = tmp[kx-1]
    # _, v = tmp[kx]
    p = cd[kx-1]
    v = cd[kx]
    # print("{}^{}".format(p, v))
    while v > 0:
        ans *= p
        ans %= M
        v -= 1
# print(cd)

# for kx in range(1, max(D)+1):
#     ans *= pow(cd[kx-1], cd[kx],M)
#     ans %= M

print(ans)

Measured memory_bytes: 26648
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[N][N];
int color[N],d[N],f[N],tt;

void dfs_visit(int u){
  int v;
  color[u] = GRAY;
  d[u] = ++tt;
  for(v=0;v<n;v++){
    if(M[u][v] == 0) continue;
    if(color[v] == WHITE){
      dfs_visit(v);
    }
  }
  color[u] = BLACK;
  f[u] = ++tt;
}

void dfs(){
  int u;

  for(u = 0; u < n; u++) color[u] = WHITE;
  tt = 0;

  for(u = 0; u < n; u++){
    if(color[u] == WHITE) dfs_visit(u);
  }
  for(u = 0; u < n; u++){
    printf("%d %d %d\n",u+1,d[u],f[u]);
  }
}

int main(){
  int u,v,k,i,j;

  scanf("%d",&n);
  for(i = 0; i<n; i++){
    for(j = 0; j<n;j++) M[i][j] = 0;
  }

  for(i = 0; i < n; i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j = 0; j < k; j++){
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }
  dfs();

  return 0;
}



Measured memory_bytes: 2112
#include<stdio.h>

int main(void){
  char S;
  int i, w;

  for (i=0; i<4; i++){
    S = getchar();
    if (i==1){
      if (S == 'R'){
        w = 0;
      }else{
        w = 1;
      }
    }else{}
  }

  if(w){
    printf("ARC");
  }else{
    printf("ABC");
  }

  return 0;
}


Measured memory_bytes: 1596
N,M = map(int, input().split())
AB = []
for _ in range(M):
    AB.append(list(map(int,input().split())))

AB.sort(key=lambda x:x[1])

cur = 0
ans = 0
for a,b in AB:
    if cur > a:
        continue
    
    ans += 1
    cur = b

print(ans)

Measured memory_bytes: 29076
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
const ll mod = 1e9+7;

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

  int n, k;
  cin >> n >> k;
  
  vector<vector<ll>> dp(k+1, vector<ll>(2, 1));
  
  for(int i = 0, x; i < n; ++i)
  {
    cin >> x;
    
  	for(int j = 0; j <= k; ++j)
    {
      dp[j][i%2] = mod + dp[j][(i+1)%2];
      if(j - x > 0)
        dp[j][i%2] -= dp[j-x-1][(i+1)%2];
      dp[j][i%2] %= mod;
    }
    
    for(int j = 1; j <= k; ++j)
    {
      dp[j][i%2] = (dp[j-1][i%2] + dp[j][i%2]) % mod;
    }
  }
  
  if(k)
    cout << (dp[k][(n+1)%2] + mod - dp[k-1][(n+1)%2]) % mod << endl;
  else
    cout << dp[0][(n+1)%2] % mod << endl;
}


Measured memory_bytes: 7808
#include <iostream>
#include <vector>

using namespace std;

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

  int ans = 100000;
  for(int i=1;i<N;i++)
    {
      int S1 = 0, S2 = 0;
      for( int j=0;j<i;j++)
	S1 += W[j];
      for( int j=i;j<N;j++)	  
	S2 += W[j];
      ans = min(ans, abs(S1-S2));
    }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

//#define int long long
#define endl "\n"
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}

int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}



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


Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)
A = [*0..N]
ID = lambda{|i|
	return i == A[i] ? i : (A[i]=ID[A[i]])
}
c = N
$<.each{|ln|
	x, y, = ln.split.map(&:to_i)
	a, b = ID[x], ID[y]
	next if a == b
	A[a] = A[b] = [a, b].min
	c -= 1
}
p c


Measured memory_bytes: 3452
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int x;
    cin >> x;
    for (ll a = 1; a <= 5000; a++) {
        ll fpa = a * a * a * a * a;
        ll fpb = fpa - x;
        for (ll b = -2000; b <= a; b++) {
            if (b * b * b * b * b == fpb) {
                cout << a << ' ' << b << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3592
from fractions import gcd

def lcm(a, b):
    return (a * b)//gcd(a,b)

N = int(input())
A = list(map(int,input().split()))

lcm_a = 1

for i in range(N):
    lcm_a = lcm(lcm_a,A[i])

ans = 0
for i in range(N):
    ans +=lcm_a//A[i] 
    
mod = int(1e9+7)
print(ans%mod)

Measured memory_bytes: 6112
#include <cmath>
#include <iostream>
#include <string>
#include <time.h>
#include <stdio.h>
#include <iomanip>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

void printArr(vector<int> &A)
{
    for (int i = 0; i < A.size(); i++)
    {
        cout << A[i] << endl;
    }
}

void insertionSort(vector<int> &a, int n, int g, int &cnt)
{
    for (int i = g; i < n; i++)
    {
        int v = a[i];
        int j = i - g;
        while (j >= 0 && a[j] > v)
        {
            a[j + g] = a[j];
            j = j - g;
            cnt++;
        }
        a[j + g] = v;
    }
}

void shellSort(vector<int> &a, int n)
{
    int cnt = 0;

    vector<int> g;
    int h = 0;
    g.push_back(1);
    for (int i = 0; n >= 3 * g[i] + 1; i++)
    {
        g.push_back(3 * g[i] + 1);
    }
    int m = g.size();
    cout << m << endl;
    for (int i = m - 1; i >= 0; i--)
    {
        cout << g[i] << " ";
        insertionSort(a, n, g[i], cnt);
    }
    cout << endl;
    cout << cnt << endl;
}

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    shellSort(a, n);
    printArr(a);
    return 0;
}


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

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n, c, k, t[100001] = {};
  cin >> n >> c >> k;
  rep(i, 0, n) cin >> t[i];
  sort(t, t + n);
  int ans = 1, z = t[0], co = 1;
  rep(i, 1, n) {
    co++;
    if(t[i] > z + k || co > c) ans++, z = t[i], co = 1;
  }

  cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <ext/rope>

#define min3(a,b,c)   min(a,min(b,c))
#define max3(a,b,c)   max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)    __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)       __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)       __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b)     __gcd(a,b)
#define lcm(a,b)     (a*(b/gcd(a,b)))

#define pb   push_back
#define PI   M_PI
#define endl "\n"
#define sc   scanf
#define pf   printf

#define ll  long long
#define ull unsigned long long

#define W(t)            while(t--)
#define rep1(i,n)       for(int i = 0; i < n; i++)
#define rep2(a,b)       for(int i = a; i <= b; i++)
#define rep3(a,b,c)     for(int i = a; i <= b; i+=c)
#define irep(a,b,c)     for(int i = b; i >=a; i-=c)
#define repit(it,type)  for(it = type.begin(); it != type.end(); it++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
using namespace __gnu_cxx;

int main()
{
     IOS
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int i;
    string s;
    stack<char> st;

    cin>>s;

    rep1(i,s.size())
    {
         if(i==0)
         {
              st.push(s[i]);
         }
         else
         {
              if(!st.empty() && st.top()!=s[i])
               st.pop();
              else
               st.push(s[i]);
         }
    }
    cout<<s.size()-st.size()<<endl;
     return 0;
}


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

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

  if ((N % 500) <= A) {
    cout << "Yes" << endl;
  }
  // ここにプログラムを追記
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
vector<int> adj[N];
int val[N];
void dfs(int s, int p) {
	for (int nbr : adj[s]) {
		if (nbr != p) {
			val[nbr] += val[s];
			dfs(nbr, s);
		}
	}
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n, q;
	cin >> n >> q;
	for (int i = 1; i < n; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	while (q--) {
		int p, x;
		cin >> p >> x;
		p--;
		val[p] += x;
	}
	dfs(0, -1);
	for (int i = 0; i < n; i++)
		cout << val[i] << ' ';
	return 0;
}


Measured memory_bytes: 27872
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
  #define pb push_back
#define f first
#define s second
  #define MAXN 100005
using namespace std;

int main()
{
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int arr[9]={111,222,333,444,555,666,777,888,999};
	int ans=lower_bound(arr,arr+9,n)-arr;
	cout<<arr[ans]<<endl;


	return 0;
}


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

using namespace std;

int main()
{
    int a,b;
   while(true){
    cin >> a >>b;
   if(a==0&&b==0){
        return 0;
   }
    int n=0;
    int mx=a+b;
    for(int i=1;i<5;i++){
        cin >>a >>b;
           if(a==0&&b==0){
                return 0;
            }
            if(mx<(a+b)){
                mx=a+b;
                n=i;
            }
    }
    cout <<(char)('A'+n)<<" " <<mx << endl;
   }
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
#include <iostream>
typedef long long ll;
#define rep(i,a,b) for(ll i =a ;i <= b;i++)
#define per(i,a,b) for(ll i =a ;i >= b;i--)
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
 
int main()
{
	//ifstream cin("input.txt");
	ll n, k,A;
	cin>>n>>k;
	vi graph(n);
	rep(i,0,n-1)
	{
		cin>>A;
		A--;
		graph[i] = A;
	}
	
	vi ordering(n, -1);
	int count = 1;
	int start = 0;
	int prev;
	while(ordering[start] == -1)
	{
		ordering[start] = count;
		count++;
		prev = start;
		start = graph[start];
	}
	ll z = ordering[prev] - ordering[start] + 1;

	if(k > ordering[start] - ordering[0])
		z = (k - (ordering[start] - ordering[0])) % z;
	else{
			z = k;
			start = 0;
	}
	rep(i, 1, z)
		start = graph[start];
	cout<<start +1;

}

Measured memory_bytes: 4772
#include <iostream>
using namespace std;
main () {
	string str;
	while (cin >> str, str != "-") {
		int m, h;
		cin >> m;
		for (int i=0; i<m; i++) {
			cin >> h;
			str = str.substr(h) + str.substr(0, h);
		}
		cout << str << endl;
	}
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> s(100001);
  for (int i = 1; i <= N; i++) {
    cin >> s.at(i);
  }
  int num = 1;

  int count = -1;
  for (int i = 1; i <= N; i++) {
    if (s.at(num) == 2) {

      count = i;
      break;
    }
    
    num = s.at(num);
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3776
#include <stdio.h>
int main(void)
{
  int a,b,c;
  char x[11];
  char y[11];
  char z[11];
  scanf("%s",x);
  scanf("%s",y);
  scanf("%s",z);
  for(a=0;x[a]!='\0';a++);
  for(b=0;y[b]!='\0';b++);
  for(c=0;z[c]!='\0';c++);
  if((x[a-1]==y[0])&&(y[b-1]==z[0])){
    printf("YES\n");
  }else{
    printf("NO\n");
  }
  return 0;
}


Measured memory_bytes: 1612
package main

import (
	"fmt"
	"math"
)

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func main() {
	var A, B, C, X, Y, P int
	fmt.Scan(&A, &B, &C, &X, &Y)
	min := math.MaxInt32
	for i := 0; i <= 100000; i++ {
		P = i*2*C + max(0, X-i)*A + max(0, Y-i)*B
		if min > P {
			min = P
		}
	}
	fmt.Println(min)
}


Measured memory_bytes: 512
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ok = []
ng = 0
ans = 0
for i, j in zip(a, b):
    if i >= j:
        ok.append(i-j)
    else:
        ans += 1
        ng += j-i

ok.sort()
while ng > 0 and ok:
    ans += 1
    ng -= ok.pop()

ans = -1 if ng > 0 else ans
print(ans)


Measured memory_bytes: 18396