akhauriyash/Code-Regression huggingface dataset:
// Author : MohamedSameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
void fo (){fflush(stdout);}
using namespace std;

int main ()
{
  int n ;
  cin >> n ;
  cout << 24 + (24 - n) <<"\n";

  //cerr << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


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

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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() {
	//2^(x-1) < K となる最大のx=e
	ll N,K;
	cin >> N >> K;
	double ans;
	vector<ll> domi;
	ll maxdom = 1;

	FORq(T,1,N){
		int e = 0;
		ll pow = T;
		if (pow >= K) {
			domi.PB(1);
			continue;
		}

		while (pow < K) pow *= (ll)2, ++e;

		ll dom = 1;
		REP(i,e){
			dom *= (ll)2;
		}

		domi.PB(dom);
		chmax(maxdom,dom);
	}

	ll bunsi = 0;
	REP(i,domi.size()){
		bunsi += maxdom / domi[i];
	}

	ans = (bunsi / (double)(maxdom)) / N;
	printf("%.20f",ans);



}


Measured memory_bytes: 1400
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		if(A*B>=C*D)System.out.println(A*B);
		if(A*B<C*D)System.out.println(C*D);
	}
}

Measured memory_bytes: 23124
#include <iostream>
#include <algorithm>
#include <vector>

using std::vector;

bool greater(long long int a , long long int b)
{
    return a > b;
}

long long int optimal_weight(long long int W, vector<long long int> &w,vector<long long int> &v) 
{
    vector<vector<long long int> >K(w.size() + 1 , vector<long long int>(W + 1 , 0));

    for (long long int i = 0; i <= w.size(); ++i)
    {
        for (long long int j = 0; j <= W; ++j)
        {
            if (i == 0 || j == 0)
                K.at(i).at(j) = 0;
            else if (w[i - 1] <= j)
                K.at(i).at(j) = std::max(K.at(i - 1).at(j) , v[i - 1] + K.at(i - 1).at(j - w[i - 1]));
            else
                K.at(i).at(j) = K.at(i - 1).at(j);
        }
    }
    return K.at(w.size()).at(W);
}

int main() 
{
    long long int n, W;
    std::cin >> n >> W;
    vector<long long int> w(n);
    vector<long long int> v(n);
    for (long long int i = 0; i < n; i++) 
    {
        std::cin >> w[i]>>v[i];;
    }
    long long int sum=optimal_weight(W,w,v);
    std::cout<<sum;
    return 0;
}

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

int main() {
  int K;


  // 配列
  vector<int> vec; // int型の配列変数vecを宣言

  vec = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}; // 25, 100, 64 という整数(int)の列を代入
  cin >> K ;
  cout << vec.at(K-1)<< endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int dp[100110][3];

int main(int argc, char const *argv[])
{
	int n; cin >> n;
	vector<int> a(n), b(n), c(n); {
		rep(i, n) cin >> a[i] >> b[i] >> c[i];
	}

	rep(i, 100110)rep(j, 3) dp[i][j] = -1;
	dp[0][0] = dp[0][1] = dp[0][2] = 0;

	rep(i, n)rep(j, 3)rep(k, 3) {
		if (j == k) continue;
		if (dp[i][j] == -1) continue;
		int cost[3] = {a[i], b[i], c[i]};
		dp[i + 1][k] = max(dp[i][j] + cost[k], dp[i + 1][k]);
	}

	int ans = 0;
	rep(i, 3) ans = max(ans, dp[n][i]);
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 2560
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

using namespace std;
typedef long long int64;

int64 b_right(int64 a,int64 b,int64 n){
  int64 dist=b-a-1;
  int64 result=n-b+1;
  result+=dist/2;
  return result;
}

int64 a_left(int64 a,int64 b,int64 n){
  int64 dist=b-a-1;
  int64 result=a;
  result+=dist/2;
  return result;
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int64 n,a,b;
  cin>>n>>a>>b;
  if(b<a) swap(a,b);

  if((b-a)%2==0){
    cout<<(b-a)/2<<endl;
  }else{
    int64 left=b-1,right=n-a;

    cout<<min({left,right,b_right(a,b,n),a_left(a,b,n)})<<endl;
  }




  return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;



int main(void){
    while(true){
        int n,a,b,c,x;
        cin>>n>>a>>b>>c>>x;
        if(n==0 && a==0 && b==0 && c==0 && x==0)break;
        vector<int>ra(n);
        for(int i=0;i<n;i++)cin>>ra[i];
        int origin=x;
        vector<int>pro;
        pro.push_back(x);
        int index=0;
        while(index++<10005){
            origin=(a*origin+b)%c;
            pro.push_back(origin);
        }
        index=0;
        int ans=0;
        int j=index,i=0;
        for(;i<n;){
            if(ans>10000){
                ans=-1;
                break;
            }
            for(;j<(int)pro.size();){
                if(ra[i]==pro[j]){
                    j++;
                    i++;
                    if(i==n)break;
                    else{
                        ans++;
                        break;
                    }
                }
                else {
                    ans++;
                    j++;
                }
            }
            if(j==(int)pro.size()-1){
                ans=-1;
                break;
            }
            if(ans>10000){
                ans=-1;
                break;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3196
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP_AB(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
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; }
// template end


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

    string n;
    in >> n;
    string n_tmp = n;
    reverse(ALL(n));
    if (n == n_tmp){
        out << "Yes" << endl;
    }else{
        out << "No" << endl;
    }
}


Measured memory_bytes: 256
N, M = map(int, input().split())

A = [False] * (N + 1)

for _ in range(M):
    A[int(input())] = True

step = [0] * (N + 1)

step[0] = 1

for s in range(1, N + 1):
    if A[s]:
        step[s] = 0
        continue
    if s == 1:
        step[s] = 1
        continue
    else:
        step[s] = step[s - 1] + step[s - 2]
        step[s] %= 1000000007

print(step[N])


Measured memory_bytes: 7668
#include <iostream>
using namespace std;
int n,m,a,b,s[101],ans;
int main(void){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a;
        for(int i=0;i<a;i++){
            cin>>b;
            s[b]++;
        }
    }
    for(int i=1;i<=n;i++){
        if(s[i]==0)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
const int INF=2E5;
typedef pair<int,int> Pair;

int main(){
    int K,N;
    map<int,int> mp;
    int tmp;
    cin >> N >> K;
    for(int i=0;i<N;i++){
        cin >> tmp;
        mp[tmp]++;
    }
    vector<int> v;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        v.push_back(itr->second);
    }
    sort(v.begin(),v.end());
    int cnt=0;
    int syu=v.size()-K;
    for(int i=0;i<syu;i++){
        cnt+=v[i];
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 10748
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(N: int, W: int, w: "List[int]", v: "List[int]"):
    base = w[0]
    max_w = 3 * N
    dp = [[-1] * (max_w + 1)  for _ in range(N + 1)]
    dp[0][0] = 0
    for i in range(N):
        for j in range(N, -1, -1):
            for k in range(max_w, -1, -1):
                if dp[j][k] >= 0:
                    dp[j + 1][k + w[i] - base] = max(dp[j + 1][k + w[i] - base], dp[j][k] + v[i])
    ret = 0
    for j in range(N + 1):
        for k in range(max_w + 1):
            if base * j + k <= W:
                ret = max(ret, dp[j][k])
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    w = [int()] * (N)  # type: "List[int]" 
    v = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        w[i] = int(next(tokens))
        v[i] = int(next(tokens))
    solve(N, W, w, v)

if __name__ == '__main__':
    main()


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

int main(){
    vector<string>vec;
    string str,s;
    getline(cin,str);
    int i;
    for(i=0;i<str.length();i++){
        if(str[i]!='.'&&str[i]!=','&&str[i]!=' ')
            s+=str[i];
        else{
            if(s.length()>2&&s.length()<7)
                vec.push_back(s);
            s="";
        }
    }
    for(i=0;i<vec.size()-1;i++)
        cout<<vec[i]<<" ";
    cout<<vec[i]<<endl;
}

Measured memory_bytes: 1180
#include <iostream>

using namespace std;

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

    int ans = 1;
    for(int i = 0; i < N; ++i){
        if(N > (D*2+1)*ans){
            ans++;
        }else{
            cout << ans << endl;
            break;
        }
    }


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include <complex>

using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
//#define double float

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const double EPS = 1e-6;
const int MAX = 2000 +47;
const int MIN = 50 + 7;
const int MOD = INF;

int gcd(int a, int b)
{
    if (a == 0)return b;
    return gcd(b % a, a);
}

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    int g = 0;
    int mx = 0;
    FOR(i, 0, n)
    {
        int x;
        scanf("%d", &x);
        if (x == m)
        {
            cout << "POSSIBLE" << endl;
            return 0;
        }
        mx = max(mx, x);
        g = gcd(g, x);
    }
    
    if (m > mx || m % g)
    {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    cout << "POSSIBLE" << endl;
    
    
}


Measured memory_bytes: 256
def read():
    N, K = map(int, input().split())
    D = []
    A = []
    for i in range(K):
        d = int(input())
        D.append(d)
        a = list(map(int, input().split()))
        A.append(a)
    return N, K, D, A

def solve(N, K, D, A):
    c = [False for i in range(N+1)]
    for i in range(K):
        for a in A[i]:
            c[a] = True
    ans = sum([1 for x in c[1:] if not x])
    return ans
    

if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))


Measured memory_bytes: 9216
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#define inl inline
#define re register
#define LL long long
#define MAXN 10100
using namespace std;
struct con
{
	int p;LL sum;
}hh[100100];
LL read()
{
    LL f=1,p=0;
    char c=getchar();
    while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){p=p*10+c-'0';c=getchar();}
    return f*p;
}
void write(LL x)
{
    if(x<0)putchar('-'),x=-x;
    if(x/10)write(x/10);
    putchar(x%10+'0');
}
LL n,a[100100];
LL l=1000000000l,r,mid,ans,f[100100];
LL sum[100100];
inl LL lowbit(LL x){return x&(-x);}
inl bool cmp(const con&a,const con &b)
{
	if(a.sum==b.sum)return a.p<b.p;
	return a.sum<b.sum;
}
void add(int b){for(int i=b;i<=n;i+=lowbit(i))f[i]++;}
LL find(int a)
{
	LL u=0;
	for(int i=a;i>0;i-=lowbit(i))u+=f[i];
	return u;
}
bool check()
{
	ans=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]<mid)hh[i].sum=-1;
		else hh[i].sum=1;
	}
	for(int i=1;i<=n;i++)
		hh[i].sum+=hh[i-1].sum;
	for(int i=1;i<=n;i++)hh[i].p=i;
	sort(hh+1,hh+n+1,cmp);
	memset(f,0,sizeof(f));
	for(int i=1;i<=n;i++)
	{
		add(hh[i].p);
		ans+=find(hh[i].p-1);
		if(hh[i].sum>=0)ans++; 
	}
	return 4*ans <n*(n+1);
}
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
	{
		a[i]=read();
		l=min(l,a[i]);
		r=max(r,a[i]);
	}
	while(l<r)
	{
		mid=(l+r+1)/2;
		if(check()) r=mid-1;
		else l=mid;
	}
	write(l);
	return 0;
}

Measured memory_bytes: 3328
/*
 _ _ _   _    _   _    _   _ _ _   _    _   _ __ _   __       __
|  _ _| | |  | | | |  | | |  _  | | |  | | |  __  | |   \   /   |
| |_ _  | |__| | | |  | | | |_| | | |__| | | |__| | | |\ \_/ /| |
|_ _  | |  __  | | |  | | |  _ <  |  __  | |  __  | | | \   / | |
 _ _| | | |  | | | |__| | | |_| | | |  | | | |  | | | |  \_/  | |  _   _   _
|_ _ _| |_|  |_| |_ __ _| |_ _ _| |_|  |_| |_|  |_| |_|       |_| |_| |_| |_|

*/

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

#define ll long long int
#define fi first
#define se second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define debug(a) cout << #a << " = " << a << " ";
#define endl "\n"
const int  MOD=1000000007;
const int N=100010;

void solve(){
    ll n,m;
    cin>>n>>m;
    ll sum=n+m;
    if(sum==5) cout<<"1";
    else if(sum==4) cout<<"2";
    else cout<<"3";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long int t = 1;
    // cin>>t;
    for (long int tt = 1; tt <= t; tt++) {
        solve();
    }
    return 0;
}


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

long long binomial(int N, int K) {
    if(K < 0 || N < K) return 0;
    long long ret = 1;
    for(long long i = 1; i <= K; ++i) {
        ret *= N--;
        ret /= i;
    }
    return ret;
}

int N,K;

signed main() {
  cin >> N >> K;
  int mx = binomial(N-1, 2);
  if( K > mx ){puts("-1"); return 0;}

  int addition = mx - K;

  int M = N-1 + addition;
  cout << M << endl;
  for(int i=2; i<=N; i++) cout << "1 " << i << endl;
  for(int i=2; i<=N; i++) for(int j=i+1; j<=N; j++) {
    if(addition-- == 0) return 0;
    cout << i << " " << j << endl;
  }
}


Measured memory_bytes: 256
def d_XorSum(N):
    MOD = 10**9 + 7
    memo = {0: 1, 1: 2}
    # N=0のとき(u,v)の組は(0,0)の1通り
    # N=1のとき(0,0),(1,1)の2通り

    def f(k):
        # a+b<=k,a xor b <= k を満たす正整数(a,b)の組の個数(ただしa>=b)
        if k in memo:
            return memo[k]
        ret = (f(k // 2) + f((k - 1) // 2) + f((k - 2) // 2)) % MOD
        memo[k] = ret
        return ret
    return f(N)

N = int(input())
print(d_XorSum(N))

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
typedef long long ll;
//template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
/*
string S_str[H];
cins(S_str, S_str + H);
S_str[i][j];
*/
inline int at(ll x, int k){ return (x >> k) & 1; }
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)

int N;
string S;
int cnt[2019];
int main() {
	cin >> S;
	ll ans = 0;
  ll N = S.length();


		int cu = 0; int dg = 1;

		rrep(i, N - 1, 0) {
			cu = (cu + dg * (S[i] - '0')) % 2019;
			dg = (dg * 10) % 2019;

			ans += cnt[cu];
			if (cu == 0) ans++;

			cnt[cu]++;
		}


	cout << ans << endl;
}

/*
int main(){
  string s;
  cin >> s;
  int n = s.length();

  ll num[n];
  ll cnt[2019]={0};
  ll ans=0;
  rep(i,n){
    num[i]=  stoll(s.substr(i));


    ans += cnt[num[i]%2019];
    cnt[num[i]%2019]++;
  }
  ans += cnt[0];


  cout <<ans<<endl;


}
*/


Measured memory_bytes: 3748
/**
 *    author:  Daredevil666
 *    institution: IIT Patna
**/
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define nl cout<<"\n";
#define ll unsigned long long int
#define IOS  ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const ll mod=1e9+7;
int main()
{
IOS
vector<ll> v(10001);
for(ll x=1;x<=100;x++)
{
    for(ll y=1;y<=100;y++)
    {
        for(ll z=1;z<=100;z++)
        {
           ll p=(x*x)+(y*y)+(z*z)+(x*y)+(y*z)+(x*z);
           if(p<=10000)
                v[p]++;
        }
    }
}
ll n;
cin>>n;
for(ll i=1;i<=n;i++)
{
    cout<<v[i];nl
}
return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int n,m,c;
    cin >> n >> m >> c;
    vector<vi>  a(n);
    vi b(m);
    rep(i,m){
        cin >> b[i];
    }
    rep(i,n){
        rep(j,m){
            int x = 0;
            cin >> x;
            a[i].pb(x);
        }
    }
    int ans = 0;
    rep(i,n){
        int y = c;
        rep(j,m){
            y += (a[i][j]*b[j]);
        }
        if(y>0)ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, from, to) for (int i = from; i < (to); ++i)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<pair<int, int>> vii;

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

    int k;
    cin >> k;

    ll cur_min = 2;
    ll cur_max = 2;
    vector<ll> a;
    rep(i,0,k) {
        ll ai;
        cin >> ai;
        a.push_back(ai);
    }
    if (a[k-1] > 2) {
        cout << (-1) << endl;
        return 0;
    }
    for (int i = k-1; i >= 1; i--) {
        ll new_min = cur_min;
        ll next_max = cur_max + a[i] - 1;
        ll t = new_min / a[i-1];
        new_min = t * a[i-1];
        if (new_min < cur_min) {
            new_min += a[i-1];
        }
        if (new_min > next_max) {
            cout << (-1) << endl;
            return 0;
        }
        ll new_max = next_max;
        ll nt = new_max / a[i-1];
        new_max = nt * a[i-1];
        cur_min = new_min;
        cur_max = new_max;
    }
    cout << cur_min << " " << (cur_max + a[0] - 1) << endl;


    return 0;
}


Measured memory_bytes: 1400
N, A, B = map(int, input().split())
ans = 0
for num in range(1, N+1):
    num = str(num)
    tmp_sum = 0
    for num_i in num:
        tmp_sum += int(num_i)
    if (tmp_sum >= A) & (tmp_sum <= B):
        ans += int(num)
print(ans)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] nums = new int[n + 1];
        long MOD = (long) 1e9 + 7;
        for (int i = 0; i < n + 1; i++) {
            nums[i] = i;
        }

        long count = 0;
        for (int i = k; i <= n + 1; i++) {
            // i個選んだ
            long min = (long) (i - 1) * i / 2;
            long max = (long) n * (n + 1) / 2 - (long) (n - i) * (n + 1 - i) / 2;
            count += (max - min + 1) % MOD;
        }
        System.out.println(count % MOD);

    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 27952
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

const double PI = 3.141592653589793238463;

using namespace std;

const int MAXN = 1000500;
// const int MAXN = 1050;
// const long long int mod = 1000003;
//const int MAXVALUE = 1000000500;
//const long double EPS = 1e-7;

i64 mod = 1000000009;

i64 n, m, r;
i64 a[MAXN];

vector <i64> x;

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

	cout.precision(16);

	cin >> n;
	i64 s = 0;

	x.assign(n + 1, 0);

	for (int i = 2; i <= n; ++i) {
		cin >> s;
		x[s] += 1;
	}

	for (int i = 1; i <= n; ++i) {
		cout << x[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 4472
def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

a = inp[0]
b = inp[0]
p b*2 - a

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

int main()
{
    ll x;
    cin >> x;
    ll count=0;

    while (x > 4)
    {
        ll i = x / 500;
        count+=i*1000;
        x %= 500;
        if (i==0){
            x/=5;
            count+=x*5;
            x%=5;
        }
    }
    cout<<count<<endl;
}


Measured memory_bytes: 256
a, b=map(int,input().split())
s=[i for i in input()]


def check(a,b,s):
    number=[str(i) for i in range(10)]
    if s[a]!="-":
        return False
    del s[a]
    if a+b!=len(s):
        return False
    for i in s:
        if not i in number:
            return False
    return True

if check(a,b,s):
    print("Yes")
else:
    print("No")




Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int INF=1001001001;

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> hig(n);
  for(int i=0; i<n; ++i){
    cin >> hig.at(i);
  }
  vector<int> dp(n, INF);
  dp.at(0) = 0;
  for(int i=0; i<n; ++i){
    for(int j=1; j<=k; ++j){
      if(i-j < 0) break;
      int hsa=0;
      hsa = abs(hig.at(i)- hig.at(i-j));
      dp.at(i) = min(dp.at(i), dp.at(i-j)+hsa);
    }
  }
  cout << dp.at(n-1) << endl;
}

Measured memory_bytes: 1024
use proconio::input;

fn main() {
    input! {
        p: (i64, i64, i64, i64),
    };
    let a = p.0;
    let b = p.1;
    let c = p.2;
    let d = p.3;
    let xs = vec![a*c, a*d, b*c, b*d];
    println!("{}", xs.iter().max().unwrap());
}


Measured memory_bytes: 2160
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef long double ld;
#define int long long
signed main() {
	int a[13] = { 0,0,2,0,1,0,1,0,0,1,0,1,0 };
	int x, y;
	cin >> x >> y;
	if (a[x] == a[y])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	getchar(); getchar();
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n, m;
  scanf("%d %d", &n, &m);

  vector<llong> x(n), y(n), z(n);
  REP(i,n){
    scanf("%lld %lld %lld", &x[i], &y[i], &z[i]);
  }

  llong res = 0;
  REP(k,8){
    llong xx[1000], yy[1000], zz[1000];
    REP(i,n){
    if(k < 4){
      xx[i] = x[i];
    }else{
      xx[i] = x[i] * -1;
    }

    if(k % 2 == 0){
      yy[i] = y[i];
    }else{
      yy[i] = y[i] * -1;
    }

    if((k % 4) < 2){
      zz[i] = z[i];
    }else{
      zz[i] = z[i] * -1;
    }
    }
    llong sum[1000] = {};
    REP(j,n){
      sum[j] = xx[j] + yy[j] + zz[j];
    }

    sort(sum, sum + n, greater<llong>());
    llong ans = 0;
    REP(j,m){
      ans += sum[j];
    }
    res = max(res, ans);
  }

  printf("%lld\n", res);
  return 0;
}



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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

pii BA[200200];

signed main() {
    int N;
    cin >> N;
    rep(i, N) {
        int a, b;
        cin >> a >> b;
        BA[i] = pii(b, a);
    }
    sort(BA, BA + N);
    int t = 0;
    rep(i, N) {
        t += BA[i].second;
        if (t > BA[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3328
#include<stdio.h>


int main()
{



   // scanf("%s", &s);

    int n, k;

    scanf("%d", &n);

    char s[n+2];

    scanf("%s", &s);

    scanf("%d", &k);

    char ch = s[k-1];


    for(int i = 0; i < n; i++)
    {
        if(s[i] != ch)
        {
            s[i] = '*';
        }
    }

    printf("%s", s);




    return 0;
}


Measured memory_bytes: 128
import sys
read = sys.stdin.buffer.read

n, *X = map(int, read().split())
mod = 10**9 + 7
last = X[-1]
X = [last - i for i in X[:-1]]
a, left = 1, [1]
for i in range(1, n - 1):
    a *= i  # メモリ
    a %= mod  # メモリ
    left.append(a)
b, right = 1, [1]
for i in range(n - 1, 1, -1):
    b *= i  # メモリ
    b %= mod  # メモリ
    right.append(b)
right.reverse()
flst = [(i * j % mod) % mod for i, j in zip(left, right)]
s = sum(i * j % mod for i, j in zip(X, flst))
print(s % mod)


Measured memory_bytes: 19404
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
#define YMAX 250001
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int MAX=30000;
	int N;
	vint ni,san,roku;
	scan(N);
	rep1(i,MAX){
		if(i%6==0){
			roku.push_back(i);
		}
		else if(i%2==0){
			ni.push_back(i);
		}
		else if(i%3==0){
			san.push_back(i);
		}
	}
	int nikosu,sankosu,rokukosu;
	if(N==3) printf("2 5 63\n");
	else{
		if(N>=15000){
			nikosu=10000;
			sankosu=5000;
			rokukosu=N-15000;
		}
		else if(N>=10002){
			nikosu=10000;
			sankosu=N-10000;
			rokukosu=0;
			if(sankosu%2==1){
				sankosu--;
				rokukosu++;
			}
		}
		else{
			nikosu=N-2;
			sankosu=2;
			rokukosu=0;
			if(nikosu%2==1){
				nikosu--;
				rokukosu++;
			}
		}
		rep(i,nikosu){
			printf("%d ",ni[i]);
		}
		rep(i,sankosu){
			printf("%d ",san[i]);
		}
		rep(i,rokukosu){
			printf("%d ",roku[i]);
		}
		kaigyo;
	}
	return 0;
}


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

using namespace std;

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)
#define INF 1000000000
#define MOD 1000000007

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

const double PI=acos(-1);
const double EPS=1e-4;

int N,M;
double x[22],y[22];

bool check(double mid){
	vector<int> m_list;
	
	REP(i,N){
		m_list.PB(1<<i);
	}
	
	REP(i,N)REP(j,N){
		if(i==j)continue;
		double dx=x[i]-x[j],dy=y[i]-y[j];
		double d=sqrt(dx*dx+dy*dy);
		if(d>mid*2+EPS)continue;
		double r=sqrt(mid*mid-d*d/4);
		double vx=-dy/d*r;
		double vy=dx/d*r;

		double xx=(x[i]+x[j])/2+vx;
		double yy=(y[i]+y[j])/2+vy;
		int cnt=0;
		REP(k,N){
			if((x[k]-xx)*(x[k]-xx)+(y[k]-yy)*(y[k]-yy)<mid*mid+EPS)cnt |= (1<<k);
		}
		m_list.PB(cnt);
	}

	/*
	REP(i,m_list.size()){
		cout << (static_cast<bitset<(unsigned)(10)>>(m_list[i])) << endl;
	}
*/	
	
	vector<int> dp(1 << N,INF);
	dp[0] = 0;
	REP(i,dp.size()){
		REP(j,m_list.size()){
			dp[i | m_list[j]] = min(dp[i] + 1 , dp[i | m_list[j]]);
		}
	}
	
	if(dp[(1 << N )- 1] == INF){
		REP(i,dp.size()){
			cout << (static_cast<bitset<(unsigned)(10)>>(dp[i])) << ' ' << dp[i] << endl;
		}
	}
	
	//cout << dp[(1 << N)-1] << endl;
	return (dp[(1 << N)-1] <= M);
}

int main()
{
	cin >> N >> M;
	vector<pair<int,int>> v;
	REP(i,N){
		int a,b;cin >> a >> b;
		v.PB(MP(a,b));
	}
	
	sort(ALL(v));
	
	v.erase(unique(ALL(v)),v.end());
	
	REP(i,v.size()){
		x[i] = v[i].FI;
		y[i] = v[i].SE;
	}
	
	N = v.size();
	
	double top = 1000000;
	double under = 0;
		
	REP(i,100){
		double mid = (top + under) / 2;
	//	cout << mid << endl;
		if(check(mid))top = mid;
		else under = mid;
	}
	
	cout << Decimal << top << endl;	

	
	return 0;
}


Measured memory_bytes: 3424
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    vector<int> C(n),S(n),F(n);
    REP(i,n-1) cin>>C[i]>>S[i]>>F[i];

    REP(i,n){
        int t=0;
        for(int j=i;j<n-1;j++){
            if(t<S[j]) t=S[j];
            else if(t%F[j]==0);
            else t = t+F[j]-t%F[j];
            t+=C[j];
        }
        cout<<t<<endl;
    }
}

Measured memory_bytes: 256
//arc073_q2
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <numeric>
#include <tuple>
#define pb push_back
#define mkt make_tuple
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef tuple<int, int> tii;
const int INF =  2147483647;
const ll INFLL = 9223372036854775807;

map<tuple<int, int>, int> cache;
vi VS;
vi WS;

ll knapsack(int n, int maxw) {
  if (n == -1) {
    return 0;
  }
  int v = VS[n];
  int w = WS[n];
  tuple<int, int> keys = mkt(n, maxw);
  if (cache.find(keys) != cache.end()) {
    return cache[keys];
  } else {
    ll ans = 0;
    if (maxw < w) {
      ans = knapsack(n-1, maxw);
    } else {
      ans = max(knapsack(n-1, maxw-w) + v, knapsack(n-1, maxw));
    }
    cache[keys] = ans;
    return ans;
  }
}

int main() {
  int n, maxw;
  scanf("%d%d", &n, &maxw);
  VS = vi(n, 0);
  WS = vi(n, 0);
  for (size_t i = 0; i < n; i++) {
    int w, v;
    scanf("%d%d", &w, &v);
    WS[i] = w;
    VS[i] = v;
  }
  ll ans = knapsack(n-1, maxw);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6272
//#include<atcoder/all>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
//using namespace atcoder;

#define ll long long
#define pal pair<ll,ll>
#define pad pair<double,double>
#define PB push_back
#define MP make_pair
#define F first
#define S second

const ll MOD = 1e9+7;
const ll INF = 1e18;
const double EPS = 1e-8;

template<typename T,typename U>
bool chmax(T& max, const U& x){
	if(max<x){
		max = x;
		return true;
	}
	return false;
}

template<typename T,typename U>
bool chmin(T& min, const U& x){
	if(min>x){
		min = x;
		return true;
	}
	return false;
}


int main(){
	string s;
    cin >> s;
    int n=s.size();
    if(s[n-1]=='s'){
        cout << s+"es"<< endl;
    }else{
        cout << s+"s"<<endl;
    }
}

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Abc170D
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            var max = a.Max();
            var divisible = new bool[max + 1];
            var exist = new bool[max + 1];

            foreach (var x in a)
            {
                if (divisible[x])
                    continue;

                if (exist[x])
                    divisible[x] = true;
                else
                    exist[x] = true;

                int y = x * 2;
                while (y <= max)
                {
                    divisible[y] = true;
                    y += x;
                }
            }

            int count = 0;
            for (int i = 0; i <= max; i++)
                if (exist[i] && !divisible[i])
                    count++;

            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 45356
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

typedef pair<double,pair<int,int> > ppi;
int ti[9];
vector<pair<double,int> > vp[31];
double d[31][1<<8];
double INF=1000100010;
int m,n,b;
double dijkstra(int st){
    priority_queue<ppi,vector<ppi>,greater<ppi> > pq;
    rep(i,m)rep(j,1<<n) d[i][j]=INF;
    d[st][0]=0;
    pq.push({0.0,{0,st}});
    while(!pq.empty()){
        ppi pi=pq.top();pq.pop();
        int t=pi.second.second;
        int u=pi.second.first;
        double cost=pi.first;
        if(t==b) return cost;
        for(auto it:vp[t]){
            rep(i,n){
                if((u>>i)&1) continue;
                double sc=cost+it.first/ti[i];
                if(sc<d[it.second][u|(1<<i)]){
                    d[it.second][u|(1<<i)]=sc;
                    pq.push({sc,{u|(1<<i),it.second}});
                }
            }
        }
    }
    return -1;
}
int main(){
    int p,a;
    while(cin>>n>>m>>p>>a>>b,n|m|p|a|b){
        rep(i,m) vp[i].clear();
        rep(i,n) cin>>ti[i];
        int x,y;
        double z;
        rep(i,p){
            cin>>x>>y>>z;
            --x,--y;
            vp[x].pb(z,y);
            vp[y].pb(z,x);
        }
        --a,--b;
        double ans=dijkstra(a);
        if(ans==-1) cout<<"Impossible"<<endl;
        else cout<<fixed<<setprecision(12)<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 4652
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n;
    string s;
    cin>>s;
    cin>>k;
    for(int i=0; i<n; i++)
    {
        if(s[i]==s[k-1])
            cout<<s[i];
        else
            cout<<"*";
    }
    cout<<"\n";
    return 0;
}


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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> A(N*M);
  for(int i=0;i<N*M;i++){
    A.at(i)=0;
  }
  for(int i=0;i<N;i++){
    int K;
    cin>>K;
    for(int j=0;j<K;j++){
      cin>>A.at(i*M+j);
    }
  }
  int sum=0;
  for(int i=1;i<=M;i++){
    int a=0;
    for(int j=0;j<N*M;j++){
      if(A.at(j)==i)a++;
    }
    if(a==N)sum++;
  }
  cout<<sum<<endl;
  
}

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(N+M);
    for(int i=N;i<N+M;i++) A[i] = 1;
    int ans = 0;
    for(int i=0;i<N+M;i++){
        for(int j=i+1;j<N+M;j++){
            if((A[i]+A[j])%2 == 0) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/*****************************************************
 				*	Logged in : HABIBUR RAHMAN						 *
				*	Dept	  : COMPUTER SCIENCE AND ENGINEERING	 *
				*													 *
				*	KHULNA UNIVERSITY OF ENGINEERING AND TECHNOLOGY  *
				******************************************************/


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<string> vs;
typedef pair<ll,ll> pll;
#define fast_io 			ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) 				v.begin(),v.end()
#define allr(v) 			v.rbegin(),v.rend()
#define rep(i,a,b) 			for(ll i=a;i<=b;i++)
#define rep0(i,n)			for(ll i=0;i<n;i++)
#define rrep0(i, n) 		for(ll i=(ll)(n);i>0;--i)
#define rrep(i, a, b) 		for(ll i=(ll)(a);i>=(ll)(b);--i)
#define pb(z) 				push_back(z)
#define ff					first
#define ss 					second
#define caset 				int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define sz(X) 				((ll)(X).size())
#define scan(X) 			scanf("%s", (X))
#define ms(v,val)			memset((v),(val),sizeof((v)))
#define ms0(X) 				memset((X), 0, sizeof((X)))
#define ms1(X) 				memset((X), -1, sizeof((X)))
#define m_p(a,b)            make_pair(a,b)
#define get_pos(c,x) 		(lower_bound(c.begin(),c.end(),x)-c.begin())
#define lcm(a,b)            (a*b)/__gcd(a,b)
#define INF9                1000000010
#define INF18               4000000000000000010
#define bpll(a)             __builtin_popcountll(a)
#define sqr(a)              ((a)*(a))
#define nl					"\n"
#define mod					1e9+7;
#define mx_el(v)			*max_element(all(v));
#define mn_el(v)			*min_element(all(v));
#define pcase(z,x)    		cout<<"Case "<<z<<": "<<x<<"\n"
const double pi = 2*acos(0) ;
#define display(v)			vi :: iterator it;for(it=(v).begin();it!=(v).end();it++){cout << *it << " " ;}cout << endl;
#define taking(n,v) 		for(ll i=0;i<(n);i++){ll inp;cin>>inp;(v).push_back(inp);}

void start(){
      #ifndef ONLINE_JUDGE 
      freopen("input.txt" , "r" , stdin) ;
      freopen("output.txt" , "w" , stdout) ;
      #endif
}

void solve()
{
	int a,b;cin>>a>>b;
	cout << a*b ;
}
int main() {
	fast_io
	//start();
    //caset{
		  solve();
	//}
	
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 2e5 + 10; 

int n,k;
int P[N][62];

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   cin >> n >> k;
   f(i,1,n+1){
      int x;
      cin >> x;
      P[i][0] = x;
   }
   f(j,1,62){
      f(i,1,n+1){
         P[i][j] = P[P[i][j-1]][j-1];
      }
   }
   int cur = 1;
   f(i,0,62){
      if((1ll<<i)&k){
         cur = P[cur][i];
      }
   }
   cout << cur << '\n';
   return 0;
} 

Measured memory_bytes: 100532
package main

import (
	"fmt"
)

func main() {
	var n, m, x, inf int
	fmt.Scan(&n, &m, &x)
	a := make([][]int, n)
	c := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&c[i])
		a[i] = make([]int, m)
		for j := 0; j < m; j++ {
			fmt.Scan(&a[i][j])
		}
		inf += c[i]
	}
	inf++

	l := 1 << n
	ans := inf
	for i := 0; i <= l; i++ {
		cost := 0
		s := make([]int, m)
		for j := 0; j < n; j++ {
			if (i>>j)&1 == 1 {
				cost += c[j]
				for k := 0; k < m; k++ {
					s[k] += a[j][k]
				}
			}
		}

		for k := 0; k < m; k++ {
			if s[k] < x {
				cost = inf
			}
		}
		if ans > cost {
			ans = cost
		}
	}

	if ans == inf {
		ans = -1
	}
	fmt.Println(ans)
}


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

using namespace std;

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


int main()
{
  int a, b, x;
  cin >> a >> b >> x;
  if (a + b >= x && a <= x) {
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

public class Main{
   /* static class Pair{
        int first,second;
        public  Pair(int x,int y){
            first=x;
            second=y;
        }
    }*/
    public static void main(String []args){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        //Scanner in=new Scanner(System.in);
        int x=in.nextInt();
        int y=in.nextInt();
        long sum=0;
        if(x==1)
          sum+=300000;
        else if(x==2)
          sum+=200000;
        else if(x==3)
          sum+=100000;
                if(y==1)
          sum+=300000;
        else if(y==2)
          sum+=200000;
        else if(y==3)
          sum+=100000;
        if(x==y&&x==1)
          sum+=400000;
        out.println(sum);
        out.close(); 
   }
   static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
 
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

Measured memory_bytes: 21716
import numpy as np

N, M, X = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(N)]

cost = float("inf")
for i in range(2**N):
  tmp = np.array([0 for _ in range(M+1)])
  for j in range(N):
    if (i>>j) & 1:
      tmp += np.array(C[j])
  if min(tmp[1:]) >= X:
    cost = min(cost, tmp[0])

print(-1 if cost == float("inf") else cost)

Measured memory_bytes: 27160
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

int main() {
  int k, x;
  cin >> k >> x;
  for ( int num =  (x - k + 1); num <= k + x - 1 ; ++num) {
    cout << num << endl;
  } 
  return 0;
}


Measured memory_bytes: 256