Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cstring>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

ll gcd(ll  a,ll b){
    ll r;
    if(a < b){
        ll tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}
/*
ll Integer_factorization(ll n){
    ll num = 0;
    ll ndash = n;
    if(n == 1) return 1;
    ll a = 2;
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    return num;
}
*/

ll r_fuct[2000];
ll fuct[2000];

//MOD逆元
void conb(ll n,ll k){
    fuct[0] = 1;
    for(int i = 1;i < k+1;i++){
        fuct[i] *= fuct[i-1]%MOD;
        
        ll b = MOD, u = 1, v = 0;
        ll value = fuct[i];
        while (b) {
            ll t = value / b;
            value -= t * b;
            swap(value, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        r_fuct[i] = u;
    }
}

ll factrial(ll n){
    if(n == 0) return 1;
    ll p = factrial(n-1)*n%MOD;
    return p;
}

//MOD逆元
ll farmat(ll n,ll p){    
    if(p == 0) return 1;
    else if(p == 1) return n%MOD;
    ll d = farmat(n,p/2);
    if(p%2 == 0){
        return (d*d)%MOD;
    }else{
        return ((n*d)%MOD*d)%MOD;
    }
}

ll conbination(ll n,ll k){
    ll a = factrial(n);
    ll b = factrial(k);
    ll c = factrial(n-k);
    return (a*farmat(b,MOD-2)%MOD*farmat(c,MOD-2))%MOD;
}

int memo[10000000];

int fib(int i){
    if(i <= 1) return i;
    if(memo[i] != 0) return memo[i];
    return memo[i] = fib(i-1)+fib(i-2);
}

ll dig(ll n){
    ll d = 0;
    while(n != 0){
        n/=10;
        d++;
    }
    return d;
}

void solve() {
    int n,m;
    cin >> n >> m;
    int k[n];
    int map[m+1];
    memset(map,0,sizeof(map));
    for(int i = 0;i < n;i++){
        cin >> k[i];
        
        for(int j = 1; j < k[i]+1;j++){
            int a;
            cin >> a;
            map[a]++;
        }
         
    }
    int ans = 0;
    for(int i = 1; i < m+1;i++){
        if(map[i] == n) ans++;
    }
    cout << ans << endl;

}




int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cstring>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

ll gcd(ll  a,ll b){
    ll r;
    if(a < b){
        ll tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}
/*
ll Integer_factorization(ll n){
    ll num = 0;
    ll ndash = n;
    if(n == 1) return 1;
    ll a = 2;
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    return num;
}
*/

ll r_fuct[2000];
ll fuct[2000];

//MOD逆元
void conb(ll n,ll k){
    fuct[0] = 1;
    for(int i = 1;i < k+1;i++){
        fuct[i] *= fuct[i-1]%MOD;
        
        ll b = MOD, u = 1, v = 0;
        ll value = fuct[i];
        while (b) {
            ll t = value / b;
            value -= t * b;
            swap(value, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        r_fuct[i] = u;
    }
}

ll factrial(ll n){
    if(n == 0) return 1;
    ll p = factrial(n-1)*n%MOD;
    return p;
}

//MOD逆元
ll farmat(ll n,ll p){    
    if(p == 0) return 1;
    else if(p == 1) return n%MOD;
    ll d = farmat(n,p/2);
    if(p%2 == 0){
        return (d*d)%MOD;
    }else{
        return ((n*d)%MOD*d)%MOD;
    }
}

ll conbination(ll n,ll k){
    ll a = factrial(n);
    ll b = factrial(k);
    ll c = factrial(n-k);
    return (a*farmat(b,MOD-2)%MOD*farmat(c,MOD-2))%MOD;
}

int memo[10000000];

int fib(int i){
    if(i <= 1) return i;
    if(memo[i] != 0) return memo[i];
    return memo[i] = fib(i-1)+fib(i-2);
}

ll dig(ll n){
    ll d = 0;
    while(n != 0){
        n/=10;
        d++;
    }
    return d;
}

void solve() {
    int n,m;
    cin >> n >> m;
    int k[n];
    int map[m+1];
    memset(map,0,sizeof(map));
    for(int i = 0;i < n;i++){
        cin >> k[i];
        
        for(int j = 1; j < k[i]+1;j++){
            int a;
            cin >> a;
            map[a]++;
        }
         
    }
    int ans = 0;
    for(int i = 1; i < m+1;i++){
        if(map[i] == n) ans++;
    }
    cout << ans << endl;

}




int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}


}



Compiler output:
a.cc:176:18: error: stray '#' in program
  176 |         return 0;#include<iostream>
      |                  ^
a.cc: In function 'int main()':
a.cc:176:19: error: 'include' was not declared in this scope
  176 |         return 0;#include<iostream>
      |                   ^~~~~~~
a.cc:176:35: error: expected primary-expression before '>' token
  176 |         return 0;#include<iostream>
      |                                   ^
a.cc:194:1: error: expected primary-expression before 'typedef'
  194 | typedef  long long ll;
      | ^~~~~~~
a.cc:198:1: error: a template declaration cannot appear at block scope
  198 | template<class T> inline bool chmin(T& a, T b) {
      | ^~~~~~~~
a.cc:214:42: error: a function-definition is not allowed here before '{' token
  214 | double euclid_distance(double a,double b){
      |                                          ^
a.cc:218:19: error: a function-definition is not allowed here before '{' token
  218 | ll gcd(ll  a,ll b){
      |                   ^
a.cc:257:21: error: a function-definition is not allowed here before '{' token
  257 | void conb(ll n,ll k){
      |                     ^
a.cc:277:18: error: a function-definition is not allowed here before '{' token
  277 | ll factrial(ll n){
      |                  ^
a.cc:284:21: error: a function-definition is not allowed here before '{' token
  284 | ll farmat(ll n,ll p){
      |                     ^
a.cc:295:26: error: a function-definition is not allowed here before '{' token
  295 | ll conbination(ll n,ll k){
      |                          ^
a.cc:304:15: error: a function-definition is not allowed here before '{' token
  304 | int fib(int i){
      |               ^
a.cc:310:13: error: a function-definition is not allowed here before '{' token
  310 | ll dig(ll n){
      |             ^
a.cc:319:14: error: a function-definition is not allowed here before '{' token
  319 | void solve() {
      |              ^
a.cc:346:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  346 | int main() {
      |         ^~
a.cc:346:9: note: remove parentheses to default-initialize a variable
  346 | int main() {
      |         ^~
      |         --
a.cc:346:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:346:12: error: a function-definition is not allowed here before '{' token
  346 | int main() {
      |            ^