akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_DEPRECATE
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include "bits/stdc++.h"
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define int long long int
#define SYNC std::ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
typedef long double ld;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii>   vii;
//typedef tree<int, null_type, less<int>, rb_tree_tag, 
//             tree_order_statistics_node_update> 
//    ost;
#define rep(i,l,r)   for (int i = (l); i < (r); i++)
#define here cout << " Hey!!\n";
#define  pb push_back
#define  F  first
#define  S  second
#define all(v) (v).begin(),(v).end()
#define sz(a) (int)((a).size())
#define sq(x) ((x)*(x))
template <typename T>
void etch(T V) {
	for (auto x : V)	cout << x << ' ' ;
	cout << '\n';
}
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
const int MOD = 1e9+7;
const int MOD1 = 998244353;
const int N = 2e5+5;
const int INF = 1000111000111000111LL;
const ld EPS = 1e-12;
const ld PI = 3.141592653589793116;

int32_t main()
{
	SYNC
	int cnt = 0, ans = 0;
	char x;
	while (cin >> x) {
		if (x == 'R') {
			cnt++;
		} else {
			ans = max(ans, cnt);
			cnt = 0;
		}
	}
	ans = max(ans, cnt);
	cout << ans;
	return 0;
}

Measured memory_bytes: 3616
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int q;
    cin >> q;
    vector<set<int>> abc(26);

    for(int i = 0; i < s.size(); i++){
        int c = s[i] - 'a';
        abc[c].insert(i);
    }
    vector<vector<int>> qu(q, vector<int>(3));
    for(int i = 0; i < q; i++){
        int a, b;
        cin >> a >> b;
        qu[i][0] = a;
        qu[i][1] = b;
        if(a == 1){
            char c;
            cin >> c;
            qu[i][2] = c;
        } else {
            int c;
            cin >> c;
            qu[i][2] = c;
        }
        
    }

    for(int i = 0; i < q; i++){
        int t, a, b;
        t = qu[i][0];
        a = qu[i][1];
        b = qu[i][2];

        if(t == 1){
            a--;
            int c = s[a] - 'a';
            abc[c].erase(a);
            int nc = b - 'a';
            abc[nc].insert(a);
            s[a] = b;
        } else {
            int ans = 0;
            a--;
            b--;
            for(int j = 0; j < 26; j++){
                auto l = abc[j].lower_bound(a);
                if(l != abc[j].end()){
                    if(*l <= b){
                        ans++;
                    }
                }
            }
            cout << ans << endl;
        }
    }
}   

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

int main(){
  ll n,a,b,c,d,e;
  cin>>n>>a>>b>>c>>d;
  e=abs(a-b);
  fr(i,n){
    if(d*i-c*(n-1-i)>=e && e>=c*i-d*(n-1-i)){
      cout<<"YES"<<endl;
      return 0;
    }
  }
  cout<<"NO"<<endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val a = readLine()!!.toInt()
    val b = readLine()!!.toInt()
    val c = readLine()!!.toInt()
    val x = readLine()!!.toInt()
    var ans = 0
    for (i in 0..a) {
        for (j in 0..b) {
            for (k in 0..c) {
                if (500 * i + 100 * j + 50 * k == x) ans++
            }
        }
    }
    println(ans)
}


Measured memory_bytes: 31684
#include<bits/stdc++.h>
#define maxn 100050
#define inf 0x3f3f3f3f
#define LL long long
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define mm(a,b) memset(a,b,sizeof(a))
#define mp(a,b) make_pair(a,b)
const LL mod=1e9+7;
const LL INF=(LL)1e18;
using namespace std;
int a[maxn];
LL fun(int x){
	LL sum=1;
	while(x){
		sum=(sum*x)%mod;
		x--;
	}
	return sum;
}
int main(){
//	freopen("input.txt","r",stdin);
//	freopen("ouput.txt","w",sdout);
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	LL n,m;
	cin>>n>>m;
	if(n-m==1 || m-n==1) cout<<(fun(n)*fun(m))%mod<<endl;
	else if(n==m) cout<<(2LL*fun(n)*fun(m))%mod<<endl;
	else cout<<"0"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

/*
1 selectionSort(A, N) // N??????????´??????????0-?????????????????????A
2   for i ??? 0 ?????? N-1 ?????§
3     minj = i
4     for j ??? i ?????? N-1 ?????§
5       if A[j] < A[minj]
6         minj = j
7     A[i] ??¨ A[minj] ?????????
 */

#define		MXPRG		100

int			selectionSort( int *ARY , int );	//???????????°?????????

int			A[MXPRG];

int		main(void)
{
	int		i;
	int		N;
	int		chg;

	scanf("%d",&N);
	for(i=0; i<N; i++)
	{
		scanf("%d",&A[i]);
	}

	chg = selectionSort( A, N);
	for(i=0; i<N-1; i++)
	{
		printf("%d",A[i]);
		printf(" ");
	}
	printf("%d",A[N-1]);
	printf("\n");

	printf("%d\n",chg);
	return 0;
}

int		selectionSort( int ary[], int num )
{
	int		i;
	int		j;
	int		minj;
	int		chg;
	int		tmp;

	chg = 0;
	for(i=0; i<=num-1; i++)
	{
		minj = i;
		for(j=i; j<=num-1; j++ )
		{
			if( A[j] < A[minj] )
			{
				minj = j;
			}
		}
		if( A[minj] < A[i] )
		{
			tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			chg += 1;
		}
	}
	return chg;
}

Measured memory_bytes: 604
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == "?":
        break
    elif op == "+":
        c = a + b
    elif op == "-":
        c = a - b
    elif op == "*":
        c = a * b
    elif op == "/":
        c = a // b
    print(c)


Measured memory_bytes: 5592
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> >vvi;
const ll MOD=1000000007LL;
ll factorial(ll x){
  if(x==0)return 1;
  return x*factorial(x-1)%MOD;
}

ll modpow(ll a, ll n, ll mod) {
  
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll comb(ll n, ll r){
  ll res=1;
    for(ll i=0;i<r;i++){
      res*=n-i;
      res%=MOD;
    }
  res*=modpow(factorial(r),MOD-2,MOD);
  res%=MOD;
  return res;
}

ll modabs(ll x){
  if(x<0)return MOD+x;
  else return x;
}
int main(){
  ll n,k;
  cin>>n>>k;
  for(int i=1;i<=k;i++){
    cout<<comb(k-1,k-i)*comb(n-k+1,i)%MOD<<endl;
  }
}
    


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod = 1000000007;
struct mint{
	ll x;
	mint(ll x = 0):x((x%mod+mod)%mod){}
	mint operator-() const{return mint(-x);}
	mint& operator+=(const mint a){
		if((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a){
		if((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a){
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const{
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const{
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const{
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const{
		if(!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}
	mint inv() const{
		return pow(mod-2);
	}
	mint& operator/=(const mint a){
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const{
		mint res(*this);
		return res/=a;
	}
	bool operator==(const mint a){
		return x == a.x;
	}
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    vector<mint> dp(13, 0);
    dp[0] = 1;
    rep(i,n){
        vector<mint> ndp(13, 0);
        int val = (s[i] == '?' ? -1 : s[i] - '0');
        rep(j,13){
            if(val == -1){
                rep(k,10){
                    int nex = (j * 10 + k) % 13;
                    ndp[nex] += dp[j];
                }
            }
            else{
                int nex = (j * 10 + val) % 13;
                ndp[nex] += dp[j];
            }
        }
        dp = move(ndp);
    }
    cout << dp[5].x << endl;
    return 0;
}

Measured memory_bytes: 512
a = [1,2,1,0,1,0,1,1,0,1,0,1]    
x,y=map(int, input().split())
if(x==2 or y == 2):
  print("No")
  exit()
if(a[x-1] == a[y-1]):
  print("Yes")
else:
  print("No")

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	int a;
	cin >> a;
	if (a==0) {
		ce(1)
	}
	else {
		ce(0)
	}
    return 0;
}



Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long A = long.Parse(str[0]);
		long B = long.Parse(str[1]);
		long K = long.Parse(str[2]);
		long a1 = Math.Min(A,K);
		long a2 = Math.Min(B,K-a1);
		A -= a1;
		B -= a2;
		Console.WriteLine(A+" "+B);
	}
}

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

int main() {
    int n;
    cin >> n;
    set<int> st;
    rep(i,n){
        int a;
        cin >> a;
        st.insert(a);
    }
    cout << st.size() << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(void)
{

  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);

  if(a<=100 && b<=100 && c<=100)
    {
      if(a>=1 && b>=1 && c>=1)
	{
  int p, q;
  
  p = b-a;
  q = c-b;

  if(p==q)
    {
      printf("YES");
    }
  else
    printf("NO");
    }
    }

  return 0;
  
}

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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int main() {
    int N, M, C;
    cin >> N >> M >> C;
    vector<int> l(C);
    vector<vector<int>> vec;
    rep(i, C) cin >> l[i];
    rep(i, N) {
        int c, w;
        cin >> c >> w;
        c--;
        vec.push_back({w, c});
    }
    sort(all(vec));
    reverse(all(vec));
    long long ans = 0;
    int i = 0;
    while (M > 0 && i < vec.size()) {
		// cout << M << ", " << i << endl;
        int w = vec[i][0];
        int c = vec[i][1];
        // printf("debug c = %d, l[c] = %d\n", c, l[c]);
        if (l[c] > 0) {
            l[c]--;
            ans += w;
            M--;
        }
        i++;
    }
    cout << ans << endl;

    return 0;
}



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

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(1000010);
int main() {
  ll n, k; cin >> n >> k;
  mint ans = 0;
  for (ll i = k; i <= n+1; i++) {
    mint sum1 = 0, sum2 = 0;
    sum1 = (0 + i-1) * i / 2;
    sum2 = (n-i+1 + n) * i / 2;
    // cout << sum1.x << " " << sum2.x << endl;
    ans += sum2 - sum1 + 1;
  }
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 18616
a, b, k = gets.chomp.split(" ").map(&:to_i)

if a + k < b - k + 1 then
  k.times do |i|
    puts a + i
  end
  k.times do |i|
    puts b - k + 1 + i
  end
else
  a.upto(b) do |i|
    puts i
  end
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
typedef pair<char, int> pci;
typedef pair<int, char> pic;
const int MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

ll fac[1] = {1}, inv[1] = {1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll mp(ll a,ll b){ll ret=1;while(b){if(b&1)ret=ret*a%MOD;a=a*a%MOD;b>>=1;}return ret;}
ll cmb(ll r, ll c) {return (c>r||c<0) ? 0:fac[r] * inv[c] % MOD * inv[r - c] % MOD;}

int n;
ll dp[1000001][4];
ll go(int o, int bit) {
    if (o == n) return bit==3;
    if (dp[o][bit] != -1) return dp[o][bit];

    ll ret = 0;
    for (int i = 0; i < 10; i++) {
        if (i == 0) ret += go(o + 1, bit | 1);
        else if (i == 9) ret += go(o + 1, bit | 2);
        else ret += go(o + 1, bit);
    }

    return dp[o][bit] = ret % MOD;
}

int main() {
    memset(dp, -1, sizeof(dp));
    scanf("%d", &n);
    printf("%lld", go(0, 0));
}


// author: rdd6584


Measured memory_bytes: 97440
X, N = list(map(int, input().split()))
if N == 0:
    print(X)
else:
    p = list(map(int, input().split()))
    not_p = set(range(-100, 110)) - set(p)

    arg_min = 10000
    value_min = 10000
    for i in not_p:
        tmp = abs(X - i)
        if tmp < value_min or (tmp == value_min and i < arg_min):
            value_min = tmp
            arg_min = i
    print(arg_min)


Measured memory_bytes: 9196
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
#include<tuple>
#include<stack>


using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tpl;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

#define ARRAY_MAX 100005

const int INF = 1e16 + 7;
const int MOD = 1e9 + 7;

int main() {

	ll n;
	cin >> n;
	vector<ll> a(n), b(n);
	ll a_sum = 0, b_sum = 0;

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

	for (int i = 0; i < n; i++)
	{
		cin >> b[i];
		b_sum += b[i];
	}

	ll times = b_sum - a_sum;
	ll a_cnt = 0, b_cnt = 0;

	for (int i = 0; i < n; i++)
	{
		if (a[i] < b[i])
		{
			a_cnt += (b[i] - a[i] - 1) / 2 + 1;
		}
		else
		{
			b_cnt += (a[i] - b[i]);
		}
	}

	if (a_cnt <= times && b_cnt <= times)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}


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

using namespace std;

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

	int n,t,c;
	vector <int> v;
	int res = 1000000000;

	cin >> n >> c;

	for(int i=0;i<n;i++)
	{
		cin >> t;
		v.push_back(t);
	}

	sort(v.begin(),v.end());
	
	for(int i=c-1;i<n;i++)
	{
		res = min(res,v[i]-v[i-c+1]);
	}

	cout << res << '\n';

	return 0;
}

Measured memory_bytes: 892
x,y,n = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(n)]
a,b,c,d = [0,0],[x,0],[x,y],[0,y]

for i in range(n):
    if A[i][2] == 1:
        if A[i][0] >= b[0]:
            print(0)
            break
        else:
            a[0] = max(A[i][0],a[0])
            d[0] = a[0]
    if A[i][2] == 2:
        if A[i][0] <= a[0]:
            print(0)
            break
        else:
            b[0] = min(A[i][0],b[0])
            c[0] = b[0]
    if A[i][2] == 3:
        if A[i][1] >= d[1]:
            print(0)
            break
        else:
            a[1] = max(A[i][1],a[1])
            b[1] = a[1]
    if A[i][2] == 4:
        if A[i][1] <= a[1]:
            print(0)
            break
        else:
            c[1] = min(A[i][1],c[1])
            d[1] = c[1]
else:
    print((b[0]-a[0])*(d[1]-a[1]))



Measured memory_bytes: 3064
N=int(input())
ABCS=[[0 for i in range(28)] for j in range(N)]

for i in range(N):
    S=input()
    for j in range(10):
       #print(S[j:j+1],"a")
        ABCS[i][ord(S[j:j+1])-97]=ABCS[i][ord(S[j:j+1])-97]+1
ABCS.sort()
#print(ABCS)
dabu=[None]
ct=1
test=ABCS[0]
for i in range(N):
    if i>0:
        if ABCS[i]==test:
            ct=ct+1
        else:
            dabu.append(ct)
            test=ABCS[i]
            ct=1
    if i==N-1:
        dabu.append(ct)
kumi=0
for x in dabu:
    if x != None:
        kumi=kumi+x*(x-1)/2
    
#print(dabu)
print(int(kumi))

Measured memory_bytes: 40308
#include<iostream>
using namespace std;
int a;
int flag = 0;
int main(){
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a;
		if(a % 2 == 0){
			if(a % 3 != 0 && a % 5 != 0)
				flag = 1;
		}
	}
	if(flag == 1) cout << "DENIED" << endl;
	else cout << "APPROVED" <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, k;
    cin >> n >> k;
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        int a;
        cin >> a;
        ans += a >= k;
    }
    cout << ans;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    while(1)
    {
        c=c-b;
        if(c<=0)
        {
            cout << "Yes" << endl;
            break;
        }
        a=a-d;
        if(a<=0)
        {
            cout << "No" << endl;
            break;
        }
    }
}

Measured memory_bytes: 3632
def prime_table(n):
    prime = [True]*(n+1)
    prime[0]=prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not prime[i]:
            continue
        for j in range(2*i, n+1, i):
            prime[j] = False
    return prime

m = 10**6
x = int(input())
table = prime_table(m)
for i in range(x, m+1):
    if table[i]:
        print(i)
        exit()

Measured memory_bytes: 46704
#include <cstdio>
using namespace std;

const int N = 100;
bool u[N];
int n, k;

int main() 
{
	scanf("%d%d", &n, &k);
	for (int i = 0; i < k; ++i) {
		int d;
		scanf("%d", &d);
		for (int i = 0; i < d; ++i) {
			int v;
			scanf("%d", &v);
			u[v - 1] = true;
		}
	}
	int c = 0;
	for (int i = 0; i < n; ++i) c += !u[i];
	printf("%d\n", c);
	return 0;
}


Measured memory_bytes: 1696
import math
N = int(input())


oo = {}
for i in range(1, 2*(10**5)):
    if i > N:
        break
    a = str(i)
    if a[-1] == '0':
        continue
    k = (int(a[0]),int(a[-1]))

    if k not in oo:
        oo[k] = 0
    oo[k] += 1
#print(oo)

d1 = {}
for k, c in oo.items():
    if k[0] == k[1]:
        d1[k] = c
#print('d1', d1)

d2 = {}
for k, c in list(oo.items()):
    if k[0] == k[1]:
        continue
    if (k[1], k[0]) in oo:
        d2[k] = c * oo[(k[1], k[0])]
#print(d2)

a = list(d1.values())
#print(a)
a2 = list(map(lambda x:x*x,a))
#    print(a2)
#print('a2', sum(a2))
b = sum(d2.values())
#print(b, list(d2.values()))

print(sum(a2) + b)

Measured memory_bytes: 3188
N=int(input())
A=list(map(int,input().split()))

L=[0]*N
for a in A:
  L[a]+=1
#print(L)

if N%2==1:
  if L[0]==1 and L[2::2]==[2]*(N//2):
    print(2**(N//2)%(10**9+7))
  else:
    print(0)
else:
  if L[1::2]==[2]*(N//2):
    print(2**(N//2)%(10**9+7))
  else:
    print(0)

Measured memory_bytes: 14008
#include <cstdio>
#include <algorithm>
using namespace std;

int dp(int, int);

int N,W;
int w[1001];
int v[101];

int main(){
    scanf("%d %d",&N,&W);

    for(int i = 0; i < N; i++){
        scanf("%d %d",&v[i],&w[i]);
    }

    int dp[101][10001];
    for(int i = 0; i < W; i++){
        dp[0][i] = 0;
    }

    for(int i = 1;i <= N;i++){
        for(int j = 0;j <= W;j++){
            if(j - w[i - 1] < 0){
                dp[i][j] = dp[i - 1][j];
            }else{
                dp[i][j] = max(dp[i - 1][j],dp[i - 1][j - w[i - 1]] + v[i - 1]);
            }
        }
    }

    printf("%d\n",dp[N][W]);

    return 0;
}


Measured memory_bytes: 6660
n,k=map(int,input().split())
p=list(map(int,input().split()))
c=list(map(int,input().split()))
root=[]
mi=set(range(n))
while mi:
  v=mi.pop()
  r=[c[v]]
  while p[v]-1 in mi:
    r.append(c[p[v]-1])
    mi.discard(p[v]-1)
    v=p[v]-1
  root.append(r)
inf=float('inf')
ans=-inf
for r in root:
  ansr=-inf
  k1=k%len(r)
  k0=k//len(r)
  cr=[0]
  tmp=0
  for ri in r:
    tmp+=ri
    cr.append(tmp)
  sumr=cr[-1]
  for ri in r:
    tmp+=ri
    cr.append(tmp)
  for i in range(len(r)):
    for j in range(i,i+min(k,len(r))):
      ansr=max(ansr,cr[j+1]-cr[i])
  if sumr>0:
    ans=max(ans,ansr+sumr*(k0-1))
  else:
    ans=max(ans,ansr)
  if sumr>0:
    ansr=0
    for i in range(len(r)):
      for j in range(i,i+k1):
        ansr=max(ansr,cr[j+1]-cr[i])    
    ans=max(ans,ansr+sumr*k0)
print(ans)


Measured memory_bytes: 75000
N, Z, W = map(int, input().split())
a = list(map(int, input().split()))
dp1 = [0]*N
dp2 = [0]*N
dp1[N-2] = dp2[N-2] = abs(a[N-2]-a[-1])
for i in range(N-2)[::-1]:
    dp1[i] = max(abs(a[i]-a[-1]), max(dp2[j] for j in range(i+1, N-1)))
    dp2[i] = min(abs(a[i]-a[-1]), min(dp1[j] for j in range(i+1, N-1)))
if N==1:
    ans = abs(W-a[-1])
else:
    ans = max(abs(W-a[-1]), max(dp2[i] for i in range(N-1))) 
print(ans)

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

int main() {
  int a;
  cin>>a;
  int ans = 0;
  for(int i = 1; i <= a; i++)
  {
    int counter = 0;
    if(i%2==1)
    {
      for(int j = 1; j <= i; j++)
      {
          if(i%j == 0)
            counter++;

      }
    }
    
    
    if(counter==8)
    {
      ans++;
         //cout<<i<<counter<<endl;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;


int n;
int mini;

int main(void){
	scanf("%d",&n);
	int res=-(1<<30)+2;
	scanf("%d",&mini);
	for(int i=0;i<n-1;i++){
		int a;
		scanf("%d",&a);
		res=max(res,a-mini);
		mini=min(mini,a);
	}
	printf("%d\n",res);
	return 0;
}

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

const int MAXN = 100005;

vector<int> v[MAXN];

int dp[MAXN], n, m, p;

void dfs(int nd)
{
	for (auto i : v[nd])
		dfs(i);
	sort(v[nd].begin(), v[nd].end(), [](int a, int b) { return dp[a] < dp[b]; });
	dp[nd] = 0;
	for (auto i : v[nd]) 
		dp[nd] = max(dp[nd], dp[i])+1;
}

int main() 
{
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 2; i <= n; i++) {
		cin >> p;
		v[p].push_back(i);
	}
	dfs(1);
	cout << dp[1] << endl;
	return 0;
}


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

int main() {
	int a;
	cin >> a;
	cout << a + a*a + a*a*a << endl;
	return 0;
}


Measured memory_bytes: 3608
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long a = sc.nextLong();
        if (a == 0) {
            System.out.println(0);
            return;
        }
        long b = sc.nextLong();

        long count = n / (a + b);
        n %= a + b;
        long ans = count * a;

        System.out.println(ans + Math.min(a, n));
    }
}


Measured memory_bytes: 23252
#include<stdio.h>
int sort(void *a,void *b){
  return *(int*)b-*(int*)a;
}
int main(void){
  int n,k,l[50],i,ans;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++)scanf("%d",&l[i]);
  qsort(l,n,sizeof(int),sort);
  for(i=0,ans=0;i<k;i++)ans+=l[i];
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if ( abs(b-a) > abs(c-a) && ( b > a && c > a || b < a && c < a ) ) {
        cout << "Yes" << endl;
    } 
    else {
        cout << "No" << endl;
    }
    return 0;
}


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


//      DEEP


using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fwd(i,a,n) for(int i=a;i<=n;i++)
#define bak(i,a,n) for(int i=a;i>=n;i--)
#define all(v) v.begin(),v.end()
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef set<int> si;
const ll mod = 1e9 + 7;
ll inf=1e9;
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}
ull gcd(ull x,ull y){
   if(y==0)return x;
   return gcd(y,x%y);
}


int main(){
    boost;
    ll W, n; cin >> n >> W;
    vector<ll> w(n), val(n);
     ll dp[n+1][W+1];
    memset(dp, 0, sizeof(dp));

    for (int i = 0; i < n; i++) cin >> w[i] >> val[i];

    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= W; j++) {
            if (i == 0 || j == 0) dp[i][j] = 0;
            else if (w[i - 1] <= j) dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i - 1]] + val[i - 1]);
            else dp[i][j] = dp[i - 1][j];
        }
    }
    cout << dp[n][W]<<endl;
}








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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

ll gcd(ll x, ll y)
{
  if (x % y == 0)
  {
    return y;
  }
  return gcd(y, x % y);
}

int main()
{
  double A, B;
  cin >> A >> B;
  cout << ceil((A+B)/2) << endl;
  return 0;
}

Measured memory_bytes: 256
S,N,A,K,i,T,U,V;
main()
{
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%d%d",&A,&K);
		while(T=A/K+1,V=(T-1)*K,U=(A-V)%T)A=V-T+U;
		S^=T-1;
	}
	puts(S?"Takahashi":"Aoki");
}

Measured memory_bytes: 128
N, K = map(int,input().split())
A = list(map(int,input().split()))

s = 1
route = []
route.append(s)
arrive = [0]  * N
arrive[s-1] = 1
while True:
    s = A[s-1]
    route.append(s)
    if arrive[s-1] == 1:
        break
    arrive[s-1] = 1

# print(route)
ll = route[-1]
l = len(route)
# print(l)
f = route.index(ll)

if K < f:
    print(route[K])
else:
    roll = route[f::]
    print(roll[(K-f)%(l-1-f)])

Measured memory_bytes: 32212
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main(){
  ll n ; cin>> n;
  vector<string> A(n) ;
  rep(i,n) cin>>A[i] ;
  ll a = 0 ;
  ll b = 0 ;
  ll c= 0 ;
  ll d = 0;
  rep(i,n){
      if(A[i]=="AC") a++ ;
      else if(A[i]=="WA")  b++ ;
      else if(A[i]=="TLE") c++ ;
      else d++ ;
  }
  cout<< "AC"<<" "<<"x"<< " "<< a<<endl ;
  cout<< "WA"<<" "<<"x"<< " "<<b<<endl ;
  cout<< "TLE"<<" "<<"x"<<" "<< c<<endl ;
  cout<< "RE"<<" "<<"x"<<" "<< d<<endl ;
 return 0 ; 
}



Measured memory_bytes: 6420
import java.util.Scanner;

class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		long A=sc.nextInt(),B=sc.nextInt(),C=sc.nextInt();
		if(A%2==0||B%2==0||C%2==0) {
			System.out.println(0);
		}else {
			System.out.println(Math.min(A*B, Math.min(B*C, C*A)));
		}
	}
}

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

int main(){

  int a, b;

  cin>>a>>b;
  if(a==1) a+=13;
  if(b==1) b+=13;

  if(a>b) cout<<"Alice"<<endl;
  else if(a<b) cout<<"Bob"<<endl;
  else cout<<"Draw"<<endl;
  
  return 0;
}


Measured memory_bytes: 256
A = list(input().split())

num = []
for i in range(len(A)):
    if A[i]=='+':
        n = num[len(num)-2] + num[len(num)-1]
        del(num[len(num)-2:len(num)])
        num.append(n)
    elif A[i]=='-':
        n = num[len(num)-2] - num[len(num)-1]
        del(num[len(num)-2:len(num)])
        num.append(n)
    elif A[i]=='*':
        n = num[len(num)-2] * num[len(num)-1]
        del(num[len(num)-2:len(num)])
        num.append(n)
    else:
        num.append(int(A[i]))

print(num[0])


Measured memory_bytes: 5604
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main() {
  long int x, y;
  long int ans;
  scanf("%ld %ld", &x, &y);

  if(x*y<0) {
    ans = fabs(fabs(x) - fabs(y)) + 1;
  }
  else if (x*y == 0) {
    if (y>x) {
      ans = y - x;
    }
    else {
      ans = x - y + 1;
    }
  }
  else if(x<y) {
    ans = y - x;
  }
  else {
    ans = x - y + 2;
  }

  printf("%ld", ans);

  return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


MOD = int(1e09) + 7
INF = int(1e15)


fac = None
finv = None
inv = None


def combination(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


def solve():
    global fac, finv, inv
    CMB_MAX = 2010
    fac = [0 for _ in range(CMB_MAX)]
    finv = [0 for _ in range(CMB_MAX)]
    inv = [0 for _ in range(CMB_MAX)]
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, CMB_MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    N, K = Scanner.map_int()
    for i in range(1, K + 1):
        s = combination(N - K + 1, i)
        t = combination(K - 1, i - 1)
        ans = s * t % MOD
        print(ans)


def main():
    # sys.setrecursionlimit(1000000)
    # sys.stdin = open("sample.txt")
    # T = Scanner.int()
    # for _ in range(T):
    #     solve()
    # print('YNeos'[not solve()::2])
    solve()


if __name__ == "__main__":
    main()


Measured memory_bytes: 10944
// B - ROT N
#include <stdio.h>
#include <string.h>

int main(void){
    int n, i;
    char s[10010];
    scanf("%d%s",&n, s);
    int len = strlen(s);
    for(i=0; i<len; i++){
        int x = s[i]-'A';
        x=(x+n)%26;
        putchar('A'+x);
    }
    puts("");
    
    return 0;
}

Measured memory_bytes: 128
N = int(input())
S = input()

A = [0]*1000 
ans = 0

for i in range(1000):
  if i < 10:
    s = '00' + str(i)
  elif i < 100:
    s = '0' + str(i)
  else:
    s = str(i)
    
  for j in range(N):
    if S[j] == s[0]:
      for k in range(j+1,N):
        if S[k] == s[1]:
          for l in range(k+1,N):
            if S[l] == s[2]:
              A[i] = 1
              break
          break
      break

print(A.count(1))

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int n;
vi a;
vi ans;

void dfs(int now, int prev, const vvi &g, vi &len) {
  int tmp = a[now];
  auto it = lower_bound(ALL(len), tmp);
  int p = MOD;
  int pos = distance(len.begin(), it);
  bool end = it == len.end();
  if(end) {
    len.emplace_back(tmp);
  } else {
    p = len[pos];
    len[pos] = tmp;
  }
  ans[now] = SZ(len);

  REP(i, SZ(g[now])) {
    int nxt = g[now][i];
    if(nxt == prev) continue;
    dfs(nxt, now, g, len);
  }

  if(end) len.pop_back();
  else len[pos] = p;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  cin >> n;
  a.resize(n);
  REP(i, n) {
    cin >> a[i];
  }

  vvi g(n);
  REP(i, n-1) {
    int u, v; cin >> u >> v;
    u--; v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }

  vi len;
  ans.resize(n, 1);
  dfs(0, -1, g, len);

  REP(i, n) {
    cout << ans[i] << endl;
  }
}
























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

using namespace std;
using ll = long long;

int main() {
    ll n,m,k;
    cin>>n>>m>>k;
    vector<ll> a(n),b(m);
    for(int i = 0;i < n;++i) {
        cin>>a[i];
    }
    for(int i = 0;i < m;++i) {
        cin>>b[i];
    }
    vector<ll> ta(n+1,0);
    vector<ll> tb(m+1,0);
    for(int i = 1;i <= n;++i) {
        ta[i]+=a[i-1];
        ta[i]+=ta[i-1];
    }
    for(int i = 1;i <= m;++i) {
        tb[i]+=b[i-1];
        tb[i]+=tb[i-1];
    }
    int ans=0;
    for(int i = 0;i <= n;++i) {
        if(ta[i]>k)break;
        int tans=i;
        auto itl=upper_bound(tb.begin(),tb.end(),k-ta[i]);
        tans+=itl-tb.begin();
        --tans;
        ans=max(ans,tans);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 9596
#include<stdio.h>

int main()
{
	int i, j, n, m, k, a, ans = 0; 
	
	scanf("%d %d", &n, &m);
	
	int cnt[m];
	for(i = 0; i < m; i++){
		cnt[i] = 0;
	}
	
	for(i = 0; i < n; i++){
		scanf("%d", &k);
		for(j = 0; j < k; j++){
			scanf("%d", &a);
			cnt[a - 1]++;
		}
	}
	
	for(i = 0; i < m; i++){
		if(cnt[i] == n){
			ans++;
		}
	}
	
	printf("%d", ans);

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

#define ll long long int
#define vr vector
#define pb push_back
#define pf push_front
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define loop(i,n) for(i=0;i<n;i++)
#define inp !cin.eof()
#define sec itr->second
#define fir itr->first

ll power(ll x,ll y,ll p)
{
    ll res = 1;

    while (y > 0)
    {

        if (y & 1)
            res = (res*x)%p;


        y = y>>1;
        x = ((x%p)*(x%p))%p;
    }
    return res%p;
}



int main()
{
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     // iterating a loop until input is providing====!cin.eof()

   // ll t;cin>>t;
        //while(t--)
        {

         //ll n,m,i,x,y,p=0,z,j,k,flag=1,mi=mod,ans=0,sum=0,cnt=0;
            int ans=0;
            string n;
         cin>>n;
            for(ll i=0;i<n.size();i++)
            {
                ans+=int(n[i]-'0');
            }
             //cout<<ans;
          if(ans%9==0)
            cout<<"Yes";
          else
            cout<<"No";

           // cout<<ans;




         }
    return 0;
}



Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
std::ostream& operator<<(std::ostream& os, __int128 T)
{
    if (T<0) os<<"-";if (T>=10 ) os<<T/10;if (T<=-10) os<<(-(T/10));
    return os<<( (int) (T%10) >0 ? (int) (T%10) : -(int) (T%10) ) ;
}
const int maxn=1e5+10;
inline ll quickpow(ll base,int ind)
{
	ll ans=1;
	while(ind>0)
	{
		if(ind&1)ans=ans*1ll*base%MOD;
		ind>>=1;
		base=base*1ll*base%MOD;
	}
	return ans;
}
inline ll inv(ll x)
{
	return quickpow(x,MOD-2);
}
ll pw2[maxn],fact[maxn],invf[maxn],pw3[maxn],sum3[maxn];
char s[maxn];
int n,cnt;
ll dp[maxn];
int main()
{
	pw2[0]=1;
	for(int i=1;i<maxn;i++)
		pw2[i]=pw2[i-1]*2ll%MOD;
	pw3[0]=1;
	for(int i=1;i<maxn;i++)
		pw3[i]=pw3[i-1]*3ll%MOD;
	sum3[0]=1;
	for(int i=1;i<maxn;i++)
		sum3[i]=(sum3[i-1]+pw3[i])%MOD;
	fact[0]=1;
	for(int i=1;i<maxn;i++)
		fact[i]=fact[i-1]*1ll*i%MOD;
	invf[maxn-1]=inv(fact[maxn-1]);
	for(int i=maxn-2;i>=0;i--)
		invf[i]=invf[i+1]*1ll*(i+1)%MOD;
	ll tmp=1;
/*	for(int i=1;i<=100;i++)
	{
		ll ans=0;
		for(int j=0;j<=i;j++)
			(ans+=pw2[j]*1ll*fact[i]%MOD*1ll*invf[j]%MOD*1ll*invf[i-j]%MOD)%=MOD;
		tmp=tmp*3ll%MOD;
		printf("%lld %lld\n",ans,tmp);
	}*/
	scanf("%s",s);
	n=strlen(s);
	if(n==1)
	{
		printf("3\n");
		return 0;
	}
	
	if(s[n-1]=='1')dp[n-1]=3;
	else dp[n-1]=1;
	for(int i=n-2;i>=1;i--)
		if(s[i]=='0')dp[i]=dp[i+1];
		else dp[i]=((dp[i+1]+sum3[n-i-2])%MOD*2ll%MOD+1ll)%MOD;
	ll ans=((sum3[n-2]+dp[1])%MOD*2ll%MOD+1ll)%MOD;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
int x[1180][118][118],n,m,p,a,b,c;
main(){
while(true){
memset(x,0,sizeof(x));
std::cin>>n>>m>>p;if(!n){break;}
for(int i=0;i<m;i++){
std::cin>>a>>b>>c;
x[a][b][c]=1;x[a][c][b]=1;
}
for(int i=1000;i>0;i--){
for(int j=1;j<=n;j++){
if(x[i][p][j]==1){
p=j;
break;
}
}
}
printf("%d\n",p);
}
}

Measured memory_bytes: 65332
using System;
using System.Linq;
public class Hello{
    public static void Main(){
        int [] n = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        if((n[2] - n[4] < 0) || (n[2] + n[4] > n[0]) || (n[3] - n[4] < 0) || (n[3] + n[4] > n[1])){
            Console.WriteLine("No");
        }else{
            Console.WriteLine("Yes");
        }
        
    }
}


Measured memory_bytes: 20368
#include <bits/stdc++.h>
using namespace std;
#define WHOLE(v) (v).begin(), (v).end()

// ceil(log2(10 ** 12)) = 40
const int64_t MAX_BIT = 63;
int64_t N, K;
int64_t ans = 0;
int64_t B[MAX_BIT];
int64_t S[MAX_BIT];

void recursive(int i, int64_t a, bool b) {
    if(i < 0) {
        ans = max(ans, a);
        return;
    }
    if(b) {
        if( (K >> i) & 1 ) {
            recursive(i - 1, 2 * a + B[i], false);
            recursive(i - 1, 2 * a + (N - B[i]), true);
        } else {
            recursive(i - 1, 2 * a + B[i], true);
        }
    } else {
        a = (a << (i + 1)) + S[i];
        ans = max(ans, a);
    }
}

int main() {
    cin >> N >> K;
    for (int i = 0; i < MAX_BIT; i++) {
        B[i] = 0;
    }
    for(int a = 0; a < N; a++) {
        int64_t A;
        cin >> A;
        for(int i = 0; i < MAX_BIT; i++) {
            B[i] += (A >> i) & 1;
        }
    }
    for (int i = 0; i < MAX_BIT; i++) {
        S[i] = (max(B[i], N - B[i]) << i) + (i == 0 ? 0 : S[i - 1]);
    }
    recursive(MAX_BIT - 1, 0, true);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
// Author: getharshkumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll a, b, c;
    cin >> a >> b >> c;
    if (a + b + c >= 22)
        cout << "bust";
    else
        cout << "win";

    return 0;
}

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

k = N-4
a = A[N-1] - A[N-2] + A[N-3]

for i in range((N-1)//2 - 1):
    a -= A[k]
    k -= 1
    a += A[k]
    k -= 1

print(a,end=" ")
t = a
for i in range(N-1):
    t = (A[i] - t//2)*2
    print(t,end=" ")

Measured memory_bytes: 63856
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    cin>>s;
    int count=0;
    for (int i=0;i<s.size()/2;i++) {
        if (s.at(i)!=s.at(s.size()-1-i)) {
            count++;
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi; 
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(int)(b);i++)
#define per(i,a,b) for(int i=(a);i>=(int)(b);i--)
const int mod = 1e9+7;
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
int main()
{
    ios::sync_with_stdio(false);cin.tie(nullptr);
    int d,t,s;
    cin>>d>>t>>s;
    if(t*s>=d) cout<<"Yes"<<'\n';
    else cout<<"No"<<'\n';
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int, int>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) FOR(i, 0, n)
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define FILLINF(a) memset(a, 0x3f, sizeof(a))
#define POW(n) (1LL << (n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i, a, b) ((a) <= (i) && (i) <= (b))
using namespace std;
template <typename T> inline bool CHMIN(T& a, T b) { if(a > b) { a = b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a, T b) { if(a < b) { a = b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(begin(a), end(a)); }
template <typename T> inline void REV(T& a) { reverse(begin(a), end(a)); }
template <typename T> inline void UNI(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <typename S, typename T> inline T LB(S& v, T a) { return *lower_bound(begin(v), end(v), a); }
template <typename S, typename T> inline int LBP(S& v, T a) { return lower_bound(begin(v), end(v), a) - begin(v); }
template <typename S, typename T> inline T UB(S& v, T a) { return *upper_bound(begin(v), end(v), a); }
template <typename S, typename T> inline int UBP(S& v, T a) { return upper_bound(begin(v), end(v), a) - begin(v); }
template <typename S, typename T> ostream& operator << (ostream& os, const pair<S, T>& p) { os << p.first << " " << p.second; return os; }
template <typename S, typename T> istream& operator >> (istream& is, pair<S, T>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator << (ostream& os, const vector<T>& v) { for (int i = 0; i < v.size(); ++i) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator >> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) { for(auto &e : t) fill_v(e, v); }
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const lint MOD = 1000000007;

void _main() {
    string S;
    cin >> S;
    if (S[0] == S[1] && S[1] == S[2]) cout << "No" << endl;
    else cout << "Yes" << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i')) freopen("input.txt", "r", stdin);
        if (strchr(argv[1], 'o')) freopen("output.txt", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 256