akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<(n); i++)
#define int long long
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
using namespace std;
signed main(void){
    int n,m,k,s,p,q;cin>>n>>m>>k>>s>>p>>q;
    int zom[k];rep(i,k){cin>>zom[i];zom[i]--;}
    vector<int>G[n];
    int f,t;
    rep(i,m){
        cin>>f>>t;f--;t--;
        G[f].push_back(t);
        G[t].push_back(f);
    }
    queue<int>Q;
    rep(i,k)Q.push(zom[i]);
    int dist[n];fill(dist,dist+n,-1);rep(i,k)dist[zom[i]]=0;
    int Ver[n];fill(Ver,Ver+n,p);
    int z=0;
    while(!Q.empty()){
        f=Q.front();Q.pop();
        for(auto x:G[f]){
            if(dist[x]==-1){dist[x]=dist[f]+1;Q.push(x);}
        }
    }
    rep(i,n){
        if(dist[i]<=s)Ver[i]=q;
    }
    rep(i,k)Ver[zom[i]]=INF;
    Ver[0]=Ver[n-1]=0;
    //rep(i,n)cout<<Ver[i]<<' ';
    //for(auto x:dist)cout<<x<<' ';
    //dijkstra
    int Cost[n];fill(Cost,Cost+n,INF);Cost[0]=0;
    priority_queue<P,vector<P>,greater<P>>que;que.push(P(0,0));
    while(!que.empty()){
        int c=que.top().F,f=que.top().S;que.pop();
        if(Cost[f]>c)continue;
        for(auto x:G[f]){
            if(Cost[x]>c+Ver[x]){
                Cost[x]=c+Ver[x];
                que.push(P(Cost[x],x));
            }
        }
    }
    cout<<Cost[n-1]<<endl;
}


Measured memory_bytes: 14520
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

signed main(){
    
    while(1){
        double n, m, k; cin >> n >> m >> k;
        if(n == 0.0) break;

        //dp[i][j] := i 番目までの賽を振って和が j になるときの確率
        vector<vector<double> > dp(n + 1, vector<double> (n * m + 1, 0.0));
        dp[0][0] = 1.0;
        for(int i = 0; i < n; i++){
            for(int j = 0; j <= n*m; j++){
                if(dp[i][j] == 0.0) continue;

                for(int k = 1; k <= m; k++){
                    dp[i + 1][j + k] += dp[i][j] * 1.0 / m;

                }
            }
        }

        double ans = 0.0;
        for(int j = 1; j <= n * m; j++) ans += max(1.0, j - k) * dp[n][j];
        printf("%.10f\n", ans);
    
    }

    return 0;
}




Measured memory_bytes: 3376
#include <cstdio>
int N,count=0;
void dfs(long long,unsigned char);
int main(void)
{
    scanf("%d",&N);
    dfs(0,0);
    printf("%d\n",count);
    return 0;
}
void dfs(long long nextNum,unsigned char flag357)
{
    if(nextNum<=N)
    {
        if(flag357==07)    // 07 is BIN 111
            count++;
        dfs(nextNum*10+3,flag357|01); // BIN 001
        dfs(nextNum*10+5,flag357|02); // BIN 010
        dfs(nextNum*10+7,flag357|04); // BIN 100
    }
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int 
#define double /*long*/ double
#define endl '\n'
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vppll vector<pair<pll,pll>>
#define mp make_pair
#define pb push_back
#define mapll map<ll,ll>
#define fir first
#define sec second
#define _cin ios_base::sync_with_stdio(0);  cin.tie(0);
#define fo(i,b) for(i=0;i<b;i++)
#define repa(i,a,b) for(i=a;i<b;i++)
#define repb(i,a,b) for(i=a;i>=b;i--)
#define all(x) (x).begin(), (x).end()
#define s(v) v.size()
const long long int MAX = (ll)(1e18+1);
const long long int MIN = (ll)(-1e18-1);
const long long int mod = (ll)(1e9+7);
using namespace std;

ll max(ll a,ll b,ll c) {return max(max(a, b), c);}
ll min(ll a,ll b,ll c) { return min(min(a, b), c);}
ll max(ll a,ll b) {return (a>b) ? a : b;}
ll min(ll a,ll b) {return (a<b) ? a : b;}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power_mod(ll a, ll n, ll mod_){ ll p=1; while(n){ if(n%2){ p=(p*a)%mod_;} n/=2; a=(a*a)%mod_;} return p%mod_;}
                                                 /*Code Begins*/


int main(){
    
    _cin;
    cout << setprecision(15);
    ll mn = MAX, mx = MIN;
    ll n, t, m, k, i, j,  sum=0,  prev, flag=0, cnt=0;
    ll x=0, y=0, fx, diff, tot=0, l , r;
    int TC=1;
    // cin >> TC;
while(TC--){
    cin >> n;
    double d = (double)(n/3.0);
    double vol = d*d*d;
    cout << vol;
}
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A,B,K;
  cin >> A >> B >> K;
  int c=0;
  for(int i=A; i>=0; i--){
    if(A/i * i == A && B/i * i ==B){
      c++;
      //      cout << i << endl;
    }
    if(c==K){
      cout << i << endl;
      break;
    }    
  }

  
  return 0;
    

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(), v.end()
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define um unordered_multiset
#define us unordered_set
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define cc continue
#define bb break
#define rem 1000000007
#define debug(n1) cout<<"debug... "<<n1<<"\n"
#define PI 3.141592653589793238462643383279502
//fflush(stdin);
// do {
// // process permutation
// } while (next_permutation(permutation.begin(),permutation.end()));
class abc
{
    public:
    ll l,r;
};
bool fun(abc a,abc b)
{
    return a.r<b.r;
}
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll n;
    cin>>n;
    abc arr[n];
    rep (i,0,n)
    {
        ll a,b;
        cin>>a>>b;
        arr[i].l=a-b;
        arr[i].r=a+b;
    }
    sort(arr,arr+n,fun);
    ll x1=-1e15;
    ll ans=0;
    rep (i,0,n)
    {
        if (arr[i].l>=x1)
        {
            ans++;
            x1=max(arr[i].r,x1);
        }
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 1792
//https://atcoder.jp/contests/tenka1-2019/tasks/tenka1_2019_c
#include<bits/stdc++.h>
using namespace std;
#define TEMPLATE
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
template<typename T>inline T& unused_var(T& v){return v;}
class reverse_range {private:struct I {int x;int operator*() {return x-1;}bool operator!=(I& lhs) {return x>lhs.x;}void operator++() {--x;}};I i, n;public:reverse_range(int n) :i({ 0 }), n({ n }){}reverse_range(int i, int n) :i({ i }), n({ n }){}I& begin() {return n;}I& end() {return i;}};
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }reverse_range operator!(){return reverse_range(*i,*n);}};
using LL = long long;

int bw[212345];
int bws[212345];
int BWS(int l,int r){
    return bws[r]-bws[l];
}
int main(){
    int N;
    cin>> N;
    string S;
    cin>>S;
    for(int i:range(N)){
        bw[i]=(S[i]=='#')?1:0;
    }
    for(int i:range(N)){
        bws[i+1]=bws[i]+bw[i];
    }
    int ret=BWS(0,N);
    ret=min(ret,N-ret);
    for(int i:range(N)){
        int lb = i;
        int ub = N-i;
        chmin(ret,BWS(0,i)+(ub-BWS(i,N)));
    }
    cout<<ret<<endl;


    return 0;
}

Measured memory_bytes: 2196
#include<iostream>
#include<utility>

using namespace std;

#define allof(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll mod = 1e9 + 7;
const int MAXN = 2e3 + 3;

int N, M;
int S[MAXN], T[MAXN];
ll dp[MAXN][MAXN];

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

    cin >> N >> M;
    dp[0][0] = 1;
    for (int a = 1; a <= N; a++) {
        cin >> S[a];
    }

    for (int b = 1; b <= M; b++) {
        cin >> T[b];
    }

    for (int a = 0; a <= N; a++) {
        for (int b = 0; b <= M; b++) {
            if (b) dp[a][b] += dp[a][b - 1];
            if (a && b && S[a] == T[b]) {
                dp[a][b] += dp[a - 1][b - 1];
            }

            dp[a][b] %= mod;
        }

        for (int b = 0; b <= M; b++) {
            if (a) dp[a][b] += dp[a - 1][b];

            dp[a][b] %= mod;
        }
    }

    cout << dp[N][M] % mod;
}


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int N, K; cin >> N >> K;
	vint H(N); cin >> H;
	int cnt = 0;
	for (auto &v : H) {
		if (v >= K) {
			cnt++;
		}
	}
	cout << cnt << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 640
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

typedef pair<int,int> pii;
#define fi first
#define se second

vector<vector<int> > e;
bool check[100100];

bool foo(int n, int pre) {
	if(check[n])
		return false;
	check[n] = true;

	if(e[n].size() > 2)
		return false;
	bool res = true;
	for(int i = 0; i < e[n].size(); i++) {
		if(e[n][i] != pre)
			res &= foo(e[n][i], n);
	}
	return res;
}

int main() {
	int n, m;
	while(cin >> n >> m, n || m) {
		e.clear();
		e.resize(n);
		for(int i = 0; i < m; i++) {
			int a, b;
			cin >> a >> b;
			a--; b--;
			e[a].push_back(b);
			e[b].push_back(a);
		}
		for(int i = 0; i < n; i++)
			check[i] = false;
		bool flg = true;
		for(int i = 0; i < n; i++) {
			if(!check[i])
				flg &= foo(i, -1);
		}
		cout << (flg ? "yes" : "no") << endl;
	}
}

Measured memory_bytes: 4620
M=10**9+7
n,*x=$<.read.split.map &:to_i
a,b,v=1,3,0
1.upto(n-1){|i|
  y=x[i]
  if y>=b
    b+=2
  else
    a=a*(i+2-v+=1)%M
  end
}
p (2..n-v).reduce(a){|s,e|s*e%M}


Measured memory_bytes: 9340
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <iostream>
//end of libraries ;
#define INF 9999999999
#define N 300003
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
int main(){
fcin;
int x,  y, z;
cin>>x>>y>>z;
cout<<z<<" "<<x<<" "<<y<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    ll power =1;
    for(int i=1;i<=N;i++){
        power*=i;
        if(power >= (ll)1e9+7){
            power = power % (ll)(1e9 + 7);
        }
    }
    cout << power << endl;
}

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

using namespace std;

int main()
{
    long long N;
    cin >> N;

    vector<long long> A, B, C;

    long long tmp = 0;
    for (long long i = 0; i < 3; i++)
    {
        for (long long j = 0; j < N; j++)
        {
            cin >> tmp;
            if (i == 0)
            {
                A.push_back(tmp);
            }
            else if (i == 1)
            {
                B.push_back(tmp);
            }
            else
            {
                C.push_back(tmp);
            }
        }
    }

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    vector<long long> U(N, (long long)-1), D(N, (long long)-1);

    long long cnt = 0;
    tmp = 0;

    long long i = 0;
    while (i < N)
    {
        if (A[i] >= B[cnt])
        {
            U[cnt] = tmp;
            cnt++;
            if (cnt >= N)
            {
                break;
            }
            continue;
        }
        tmp++;
        i++;
    }

    cnt = N - 1;
    tmp = 0;

    i = N - 1;
    while (i >= 0)
    {
        if (C[i] <= B[cnt])
        {
            D[cnt] = tmp;
            cnt--;
            if (cnt < 0)
            {
                break;
            }
            continue;
        }
        tmp++;
        i--;
    }

    replace(U.begin(), U.end(), (long long)-1, N);
    replace(D.begin(), D.end(), (long long)-1, N);

    long long ans = 0;
    for (long long i = 0; i < N; i++)
    {
        ans += U[i] * D[i];
    }

    cout << ans << endl;
    return 0;
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll dp[302][302][302];

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  memset(dp, 0ll, sizeof dp);

  int K;
  string s;
  cin >> s >> K;

  ckmin(K, 300);
  s.pb('0');

  vi a;
  int cnt = 0;
  for (auto x: s) {
    if (x=='0') {
      a.pb(cnt);
      cnt = 0;
    } else {
      ++cnt;
    }
  }

  int n = sz(a);
  vi pref = a;
  rep(i,1,n) pref[i] += pref[i-1];

  const ll mod = 998244353;

  // dp[i][j][k] => # sequences w [0...i) having prefix sum j and k needed operations
  dp[0][0][0] = 1;
  rep(i,0,n) {
    rep(j,0,301) {
      rep(k,0,K+1) {
        if (dp[i][j][k]==0) continue;
        rep(nxt,max(0, pref[i]-j), pref[n-1]-j+1) {
          if (max(0, nxt-a[i])+k>K) break;
          dp[i+1][j+nxt][k+max(0,nxt-a[i])] += dp[i][j][k];
          dp[i+1][j+nxt][k+max(0,nxt-a[i])] %= mod;
        }
      }
    }
  }

  ll ans = 0;
  rep(j,0,301) {
    rep(k,0,K+1) {
      ans += dp[n][j][k];
      ans %= mod;
    }
  }
  cout << ans << '\n';

}

Measured memory_bytes: 218796
#include <stdio.h>

int main(void)
{
 int a,b,d,r;
 double f;

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

 d = a/b;
 r = a%b;
 f = 1.0*a/b;

 printf("%d %d %5lf",d,r,f);

 return 0;

}

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

int sti(string s){
  int res=0;int k=1;
  reverse(s.begin(),s.end());
  for(int i=0;i<s.size();i++){
    res+=(s[i]-'0')*k;
    k*=10;
  }
  return res;
}

signed main() {
  string s;cin>>s;
  string y=s.substr(0,4);
  string m=s.substr(5,2);
  if(sti(y)<2019||(sti(y)==2019&&sti(m)<=4))cout<<"Heisei"<<endl;
  else cout<<"TBD"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(void) {
    int length;
    int c = 0;

    scanf("%d", &length);

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

    for(int i = 1; i < length - 1; i++){
        if((a[i-1] <= a[i]) && (a[i] <= a[i+1])){
            c++;
        }else if((a[i-1] >= a[i]) && (a[i] >= a[i+1])){
            c++;
        }
    }
    printf("%d\n",c);
    
    return 0;
}

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

typedef long long int ll;

const ll mod = 1e9+7;

using namespace std;

int main(void){

    int n, m;

    cin >> n >> m;

    vector<int> a(n+1, true);

    for(int i = 0;i < m;i++){
        int x;
        cin >> x;
        a[x] = false;
    }

    vector<ll> dp(n+2);
    dp[n] = 1;
    dp[n-1] = 1;
    for(int i = n-1;i >= 0;i--){
        if(a[i]){
            dp[i] = dp[i+1] + dp[i+2];
            dp[i] %= mod;
        }else{
            dp[i] = 0;
        }
    }

    cout << dp[0] << endl;

    return 0;
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int l = sc.nextInt();
		long[][] a = new long[100][101];
		long[][] b = new long[101][100];
		long[][] c = new long[100][100];
		int i  = 0;
		int j  = 0;
		int k  = 0;

		for(i = 0; i < n; i++) {
			for(k = 1; k <= m; k++) {
				a[i][k] = sc.nextInt();
			}
		}

		for(k = 1; k <= m; k++) {
			for(j = 0; j < l; j++) {
				b[k][j] = sc.nextInt();
			}
		}

		for(i = 0; i < n; i++) {
			for(j = 0; j < l; j++) {
				for(k = 1; k <= m; k++) {
					c[i][j] += a[i][k] * b[k][j];
				}
				if(j < l-1) {
					System.out.print(c[i][j] + " ");
				}else {
					System.out.print(c[i][j]);
				}
			}
			System.out.println();
		}
		sc.close();
	}
}



Measured memory_bytes: 53860
import java.io.*;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Scanner;
public class Main {
	static int[][] list = new int[12][100000];
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		solv(0,1,new boolean[10]);
		while(sc.hasNext()) {
			int n = (int)sc.nextLong();
			int s = (int)sc.nextLong();
			int ans = 0;
			out.println(list[n+1][s]);
		}
		out.flush();
	}
	
	static void solv(int sum, int i,boolean[] use) {
		if(i == 12) return;
		list[i][sum]++;
		for(int j = 0; j < 10; j++) {
			if(!use[j]) {
				use[j] = true;
				solv(sum+j*i,i+1,use);
				use[j] = false;
			}
		}
		return ;
	}
}
//------------------------------//
//-----------//
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    

}

Measured memory_bytes: 24280
#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>;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    int sum=0;
    rep(i,N){
        cin >> a[i];
        sum = sum ^ a[i];
    }
    rep(i,N){
        cout << (sum ^ a[i]);
        if(i != N-1){
            cout << " ";
        }
    }
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 4016
#include<iostream>
#include<set>
#include<sstream>

using namespace std;

int str2int(string str) {
  stringstream ss;
  int ans;
  ss<<str;
  ss>>ans;
  return ans;
}

string int2str(int num) {
  stringstream ss;
  string str;
  ss<<num;
  ss>>str;
  return str;
}

int main() {
  int q;
  cin>>q;
  for(int i=0; i<q; i++) {
    string n;
    set<int> alreadyUsed;
    cin>>n;

    int ans = 0;
    while(true) {
      if(str2int(n)/10 == 0) { // 1桁なら終了
	break;
      }
      set<int>::iterator itr = alreadyUsed.find(str2int(n));
      if(itr != alreadyUsed.end()) { // 同じ値が2度出たら無限ループ
	//ans = -1;
	break;
      }
      alreadyUsed.insert(str2int(n));
      int tmpMax = -1;
      for(int j=1; j<n.length(); j++) {
	string front, back;
	for(int k=0; k<j; k++) {
	  front += n[k];
	}
	for(int k=j; k<n.length(); k++) {
	  back += n[k];
	}
	int tmp = str2int(front)*str2int(back);
	if(tmp > tmpMax) {
	  tmpMax = tmp;
	}
      }
      n = int2str(tmpMax);
      //cout<<"next is "<<n<<endl;
      ans++;
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
using namespace std;
static const int MAX=200000;
int main(){
int R[MAX],n;
cin>>n;
for(int i=0;i<n;i++)cin>>R[i];
int maxv = -2000000000;
int minv=R[0];
for(int i=1;i<n;i++){
maxv = max(R[i]-minv,maxv);
minv = min(R[i],minv);
}
cout<<maxv<<endl;
return 0;
}

Measured memory_bytes: 1940
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MAX=1e5+4;
LL a[MAX];
LL root[MAX];




int main(){
        int n;
        cin>>n;
        LL a[n];
        int flg=0;
        for(int i=0;i<n;i++)
        {
                cin>>a[i];
                if(a[i]%2!=0)
                        flg=1;
        }
        if(flg) cout<<"first"<<endl;
        else cout<<"second"<<endl;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    vi a(n);
    rep(i,n)cin>>a[i];
    int x=0;
    rep(i,n)x+=(i%2?-a[i]:a[i]);
    cout<<x<<sp;
    rep(i,n-1){
        x/=2;
        x=a[i]-x;
        x*=2;
        cout<<x<<sp;
    }
}

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


int A[10001];

int main(){
	int n,sum=0;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> A[i];
	}
	sort(A,A+n);
	reverse(A,A+n);
	
	for(int i=0;i<n;i++){
		if(i%2) sum-=A[i];
		else sum+=A[i];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 998244353

using namespace std;
typedef pair<llint, llint> P;

struct edge{
	llint to, cap, rev;
	edge(llint a, llint b, llint c){
		to = a, cap = b, rev = c;
	}
};

llint n;
llint a[255];
vector<edge> G[255];
int S, T;
llint level[255], iter[255];

void bfs(llint s)
{
	for(int i = 1; i <= T; i++) level[i] = inf;
	level[s] = 0;
	
	queue<int> Q;
	Q.push(s);
	while(Q.size()){
		int v = Q.front();
		Q.pop();
		for(int i = 0; i < G[v].size(); i++){
			int u = G[v][i].to;
			if(G[v][i].cap <= 0 || level[u] < inf) continue;
			level[u] = level[v] + 1;
			Q.push(u);
		}
	}
}

llint dfs(int v, llint f)
{
	if(v == T) return f;
	
	llint ret;
	for(llint &i = iter[v]; i < G[v].size(); i++){
		if(level[v] >= level[G[v][i].to] || G[v][i].cap <= 0) continue;
		ret = dfs(G[v][i].to, min(f, G[v][i].cap));
		if(ret > 0){
			G[v][i].cap -= ret;
			G[G[v][i].to][G[v][i].rev].cap += ret;
			return ret;
		}
	}
	return 0;
}

void add_edge(int s, int t, llint cap)
{
	G[s].push_back(edge(t, cap, G[t].size()));
	G[t].push_back(edge(s, 0, G[s].size()-1));
}

int main(void)
{
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i], a[i] *= -1;
	
	for(int i = 1; i <= n; i++){
		for(int j = 2*i; j <= n; j+=i){
			add_edge(j, i, inf);
		}
	}
	S = n+1, T = n+2;
	
	llint sum = 0;
	for(int i = 1; i <= n; i++){
		if(a[i] >= 0) add_edge(i, T, a[i]);
		else add_edge(S, i, -a[i]), sum += a[i];
	}
	
	llint ans = 0, flow;
	while(1){
		bfs(S);
		if(level[T] >= inf) break;
		for(int i = 1; i <= T; i++) iter[i] = 0;
		while(1){
			flow = dfs(S, inf);
			if(flow <= 0) break;
			ans += flow;
		}
	}
	cout << -(ans+sum) << endl;
	
	return 0;
}


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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif




signed main(){
    string S, T;
    cin >> S >> T;
    cout << T+S << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define MAX_N 5005
using namespace std;
struct edge{int from,to,cap,rev;};

bool used[MAX_N];
vector< edge > G[MAX_N];
int N,M;

void add_edge(int from,int to,int cap){
  int A=G[from].size();
  int B=G[to].size();
  G[from].push_back( (edge){from,to,cap,B} );
  G[to].push_back( (edge){to,from,cap,A} );
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  used[v]=true;
  for(int i=0;i<(int)G[v].size();i++){
    edge &e=G[v][i];
    if(!used[e.to] && e.cap>0){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
        e.cap-=d;
        G[e.to][e.rev].cap+=d;
        return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow=0;
  for(;;){
    memset(used,0,sizeof(used));
    int f=dfs(s,t,INF);
    if(f==0)break;
    flow+=f;
  }
  return flow;
}

bool check(int s,int t){
  memset(used,0,sizeof(used));
  return dfs(s,t,1);
}

int main(){
  cin>>N>>M;
  for(int i=0;i<M;i++){
    int a,b,c;
    cin>>a>>b>>c;
    add_edge(a,b,c);
  }
  
  int ans=max_flow(0,N-1);
  
  if(ans>10005){
    cout<<-1<<endl;
    return 0;
  }
  
  for(int i=0;i<N;i++){
    for(int j=0;j<(int)G[i].size();j++){
      edge &e=G[i][j];
      edge &e2=G[e.to][e.rev];
      //      cout<<e.from<<' '<<e.to<<' '<<e.cap<<endl;
      //      cout<<e2.from<<' '<<e2.to<<' '<<e2.cap<<endl;
      if(e.cap!=0)continue;
      if(e2.cap!=2)continue;

      if(check(e.from,e.to)){
        e.cap++;
        e2.cap--;
        continue;
      }

      check(e.from,0);
      check(N-1,e.to);
      if( check(0,N-1) ){
        e.cap++;
        e2.cap--;
      }else{
        cout<<ans-1<<endl;
        return 0;
      }

      
    }
  }
  if(ans>10000)ans=-1;
  cout<<ans<<endl;
  return 0;  
}

Measured memory_bytes: 3676
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()

a=n//100

if a*100<= n <=a*105:
    print(1)
else:
    print(0)



Measured memory_bytes: 63980
#include <iostream>
#include <cmath>
#include <stdio.h>

using namespace std;

int main() {
	int N;
	string S;
	cin >> N;
	cin >> S;
	for (int i = 0; i < S.length(); i++) {
		if (S[i] - 'A' + N < 26) {
			S[i] = S[i] + N;
		}
		else {
			S[i] = S[i] + N - 26;
		}

	};
	cout << S << endl;
	return 0;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

int p[MAXN];

ll c0[MAXN], c1[MAXN];
int par[MAXN];

int get_par(int v){
	return par[v] == v ? v : par[v] = get_par(par[v]);
}

struct comparator {
	bool operator () (const int &a, const int &b){
		if (a == 1) {
			return false;
		}
		if (b == 1) {
			return true;
		}
		ll d = c0[a] * c1[b] - c0[b] * c1[a];
		if (d) {
			return d > 0;
		}
		return a < b;
	}
};

void solve(){
	int n;
	scanf("%d", &n);
	REPN(i, 2, n){
		scanf("%d", &p[i]);
	}
	
	set<int, comparator> st;
	
	REPN(i, 1, n){
		int a;
		scanf("%d", &a);
		if (a){
			c1[i]++;
		} else {
			c0[i]++;
		}
		
		par[i] = i;
		st.insert(i);
	}
	
	ll ans = 0ll;
	
	REPN(i, 2, n){
		int a = *st.begin();
		int b = get_par(p[a]);
		st.erase(a);
		st.erase(b);
		
		//printf("%d->%d\n%d %d %d %d %lld\n", a, b, c0[a], c1[a], c0[b], c1[b], c1[b] * c0[a]);
		
		ans += c1[b] * c0[a];
		c0[b] += c0[a];
		c1[b] += c1[a];
		par[a] = b;
		st.insert(b);
	}
	
	printf("%lld\n", ans);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 14336
import math
from functools import reduce
N=int(input())
MOD=10**9+7
'''
def all_multiple(a):
    return reduce(lambda a,b:a*b,a)
'''
def all_multiple_mod(a,m):
    return reduce(lambda a,b:((a%m)*(b%m))%m,a)

def is_prime(n):
    if n<=1 or (n!=2 and n%2==0):#nが１以下、あるいは、2ではない偶数
        return False
    elif 2<=n<=9:#n1が2以上９以下かつ2以外の偶数ではない
        return True
    else:#nが10以上の奇数〜√nまでの数で割り切れない場合は素数
        res=True
        for d in range(3,int(math.sqrt(n))+1,2):
            if n%d==0:
                res=False
                break
        return res
#print(is_prime(N))

'''
def is_prime(n):
    if n==1: return False
    for k in range(2,int(math.sqrt(n))+1):
        if n%k==0:
            return False
    return True
'''

A=[1]*(N+1)#indexと割られる数を合わせる
ans=1
for N_t in range(2,N+1):
    for num in range(1,N_t+1):
        if is_prime(num):
            cnt=0
            while N_t%num==0:
                N_t=N_t//num
                cnt+=1
            A[num]+=cnt 

print(all_multiple_mod(A,MOD)%MOD)

            


Measured memory_bytes: 3668
let print_list l =
  List.map string_of_int l |> String.concat " " |> print_endline;;

let () =
  let ct = ref 0 in
  let insertion_sort a n g =
    for i = g to n-1 do
      let v = a.(i) in
      let rec loop j =
        if j < 0 || a.(j) <= v then a.(j+g) <-v
        else begin a.(j+g) <- a.(j);incr ct;loop (j-g) end
      in loop (i - g)
    done;
  in
  let n = read_int () in
  let rec gen g b =
    let b2 = ceil ((float_of_int b)*.2.25+.1.) |> int_of_float in
    if b2 > n then g
    else gen (b2::g) b2
  in
  let a = Array.init n (fun x -> read_int ()) and
      g = gen [] 0 in
  let m = List.length g in
  let rec loop = function
      [] -> print_int m;print_newline ();
            print_list g;
            print_int !ct;print_newline ();
            Array.iter (fun x -> print_int x;print_newline ()) a
    | h::t ->insertion_sort a n h;loop t
  in loop g
;;

Measured memory_bytes: 12300
#include<iostream>
#include<cstring>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int w,h,sy,sx,gy,gx;
char g[20][20];
int ice[20][20],num[10000],n;
int dis[20][20],ans;
const int dy[] = {1,0,-1,0}, dx[] = {0,1,0,-1};
const int INF = 1000000;

void group(int y, int x, int c){
  num[c]++;
  ice[y][x] = c;

  rep(i,4){
    int ny = y + dy[i], nx = x + dx[i];
    if(ny<0 || nx<0 || ny>=h || nx>=w)continue;
    if(ice[ny][nx]<0 && g[ny][nx] == 'X')group(ny,nx,c);
  }
}

void dfs(int y, int x, int d, int py, int px){
  if(g[y][x] == '#' || g[y][x] == 'v')return;
  if(ans <= d + abs(y-gy) + abs(x-gx) )return;
  if(g[y][x] == 'G'){ans = d; return;}

  rep(i,4){
    int ny = y + dy[i], nx = x + dx[i];
    if(ny<0 || nx<0 || ny>=h || nx>=w)continue;
    if(py == ny && px == nx)continue;
    if(g[ny][nx] == 'v')return;
  }

  char cur = g[y][x];
  g[y][x] = 'v';

  rep(i,4){
    int ny = y + dy[i], nx = x + dx[i];
    if(ny<0 || nx<0 || ny>=h || nx>=w)continue;
    //if(g[ny][nx] == 'v' || g[ny][nx] == '#')continue;
    if(g[ny][nx] == 'X'){
      int curg = ice[ny][nx];
      if(num[curg]>0){
	num[curg]--;
	dfs(ny,nx,d+1,y,x);
	num[curg]++;
      }
    }else{
      dfs(ny,nx,d+1,y,x);
    }
  }
  g[y][x] = cur;
  return;
}
    
int main(){
  ios_base::sync_with_stdio(false);
  while(cin >> w >> h){
    if(w==0 && h==0)break;
    rep(i,h)rep(j,w)cin >> g[i][j];
    
    n = 0;
    memset(ice,-1,sizeof(ice));

    rep(i,h)rep(j,w){
      if(ice[i][j]<0 && g[i][j] == 'X'){
	num[n] = 0;
	group(i,j,n);
	num[n]/=2;
	n++;
      }
      if(g[i][j] == 'S'){sy = i; sx = j; g[i][j] = '.';}
      if(g[i][j] == 'G'){gy = i; gx = j;}
    }

    ans = INF;
    dfs(sy,sx,0,-1,-1);
    cout << ans << endl;
  }
  return 0;
}

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

using namespace std;

int main(){
    int N, M, k, a;
    cin >> N >> M;
    vector<int> table(M, 0);
    for(int i = 0; i < N; ++i){
        cin >> k;
        for(int j = 0; j < k; ++j){
            cin >> a;
            table[a-1]++;
        }
    }
    int ans = 0;
    for(int i = 0; i < M; ++i){
        if(table[i] == N){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize(4)
#include<bits/stdc++.h>
using namespace std;
#define y1 y11
#define fi first
#define se second
#define pi acos(-1.0)
#define LL long long
//#define mp make_pair
#define pb emplace_back
#define ls rt<<1, l, m
#define rs rt<<1|1, m+1, r
#define ULL unsigned LL
#define pll pair<LL, LL>
#define pli pair<LL, int>
#define pii pair<int, int>
#define piii pair<int, pii>
#define puu pair<ULL, ULL>
#define pdd pair<long double, long double>
#define mem(a, b) memset(a, b, sizeof(a))
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stout);
//head

int l, r;
int main() {
	scanf("%d %d", &l, &r);
	if(r-l <= 2019) {
		LL ans = 2018;
		for (int i = l; i <= r; ++i) {
			for (int j = i+1; j <= r; ++j) ans = min(ans, (i*1LL*j)%2019);
		}
		printf("%lld\n", ans);
	}
	else printf("0\n");
	return 0;
}

Measured memory_bytes: 256
N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(N):
    for j in range(i+1, N):
        d = sum([(y - z)**2 for y, z in zip(X[i], X[j])])**0.5
        if isinstance(d, int) or d.is_integer():
            ans += 1
print(ans)

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

l = list(map(int, input().split()))

l.sort(reverse=True)

if l[-1] == 0:
	print(0)
else:
	ans = 1
	for x in l:
		if x*ans > 10**18:
			print(-1)
			exit()
		else:
			ans = x*ans
	print(ans)

Measured memory_bytes: 84640
#include <stdio.h>

int memo[10][10][0x400][331];

int tansaku(int flags,int now,int max,int target) {
	int i;
	int result=0;
	if(now>=max)return (target==0)?1:0;
	if(target<0 || target>330)return 0;
	if(memo[max-1][now][flags][target]>0) {
		return memo[max-1][now][flags][target]-1;
	}
	for(i=0;i<=9;i++) {
		if(flags & (1<<i)) {
			result+=tansaku(flags & ~(1<<i),
				now+1,max,target-i*(now+1));
		}
	}
	memo[max-1][now][flags][target]=result+1;
	return result;
}

int main(void) {
	int n,s;
	while(scanf("%d%d",&n,&s)==2) {
		printf("%d\n",tansaku(0x3FF,0,n,s));
	}
	return 0;
}

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

int main() {
  int l, r, d;
  cin >>l >>r >>d;

  int ret = 0;
  for (int i = l; i <= r; i++) {
    if (i%d==0) ret++;
  }

  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 3624
/*
    @uthor: Amit Kumar
    user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define ll    long long
#define ld    long double
#define ull   unsigned long long
#define endl "\n"
ll google_itr = 1;
#define google(x) cout<<"Case #"<<x<<":"
#define pi 3.14159265358979323846264338327950L

const ll mod = 1e9+7;
const ll inf = 1e18;

ll popcount(ll num){
    num = num - ((num >> 1) & 0x55555555);
    num = (num & 0x33333333) + ((num >> 2) & 0x33333333);
    return ((num + (num >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}

vector<pair<ll,ll>> factor_arr;

void myfactor(ll num){ 
    ll count = 0;   
    while (!(num % 2)) { 
        num >>= 1; count++; 
    }  
    if (count) factor_arr.push_back({2,count}); 
    for (auto i = 3; i <= sqrt(num); i += 2) { 
        count = 0; 
        while (num % i == 0) { 
            count++; 
            num /= i; 
        } 
        if (count) factor_arr.push_back({i,count}); 
    } 
    if (num > 2) factor_arr.push_back({num,1});
}
string glb = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
void virus(){
        ll len;
        cin>>len;
        vector<string> arr = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
        string tod;
        cin>>tod;
        for(auto i:tod){
            cout<<glb[((i - 'A')+len)%26];
        }
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    ll t=1;
    //cin>>t;
    while(t--){
           auto start = high_resolution_clock::now();
           virus();
           auto stop = high_resolution_clock::now();
           auto duration = duration_cast<seconds>(stop - start);
         //cout << "Time: "<<duration.count()<<endl;
        //your code goes here
    }
    return 0;
}

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

#define ll long long
using namespace std;

ll num, rest, ans;

int main()
{
  cin >> num;
  
  if ( num % 500 ) {
    ans = num / 500;
    ans *= 1000;
    num %= 500;
    ans += ( num - ( num % 5 ) );
  }
  else 
    ans = num * 2;
 
  cout << ans << "\n";
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
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; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
const ll N = 1e18;
int main() {
	int n;
	cin >> n;
	ll ans = 1;
	VL a(n);
	rep(i, n) {
		cin >> a[i];
		if (a[i] == 0) {
			puts("0");
			return 0;
		}
	}
	rep(i, n) {
		if (ans > N / a[i]) {
			puts("-1");
			return 0;
		}
		ans *= a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4052
program kadai
implicit none
character(len=100)  ::  S
integer  ::  i,size,flag,gu

read(*,*) S

size=len_trim(S)
flag=0

do i=1,size
    gu=mod(i,2)
    if (gu==0) then
        if (S(i:i)=="R") then
            flag=1
            exit
        end if
    else if (gu==1) then
    if (S(i:i)=="L") then
            flag=1
            exit
        end if
    end if
end do

if (flag==1) then
    write(*,*) "No"
else
    write(*,*) "Yes"
end if
stop
contains

end program kadai

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define INF 0x7fffffffffffffff

typedef long long ll;
const double PI=3.1415926535897931;
const long long mod=1e9+7;
const int MA= 1e6+10;
const int ma= 2*1e5+10;
const int few=1e3+10;
const int maxn=1e8+10;
using namespace std;
//////////////////////////////////////////////
int main()
{
    int n, k, s;
    cin >> n >> k >> s;
    for (int i = 0; i < k; i++)
    {
        cout<<s<<' ';
    }
    if(s==1e9)
    {
        for(int i=0; i<n-k; i++)
            cout<<"1"<<' ';
    }
    else
    {
        for(int i=0; i<n-k; i++)
            cout<<s+1<<' ';
    }
    cout<<endl;
    return 0;
}




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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)

typedef unsigned long long ull;
typedef long long ll;

const int INF = 1001001001;

int main() {
    int a, b, k;
    cin >> a >> b >> k;

    int count = 0;
    for (int i = b; i > 0; i--) {
        if (b%i == 0 && a%i == 0) count++;
        if (count == k)
        {
            /* code */
            cout << i << endl;
            break;
        }
    }
}

Measured memory_bytes: 256