akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,l,r) for (int i=l,i##end=r;i<=i##end;++i)
#define per(i,r,l) for (int i=r,i##end=l;i>=i##end;--i)
#define rep0(i,r) for (int i=0,i##end=r;i<i##end;++i)
#define pr pair<db,int>
#define mp make_pair
#define fi first
#define se second
#define db long double
using namespace std;
const int N=1e6+6; const db eps=1e-10,INF=1e18;
struct line{ db k,b; }l[N];
bool cmp(line l1,line l2){ return l1.k>l2.k; }
pr a[N]; int C[N],n;
void add(int x){ for (;x<=n;x+=x&-x) ++C[x]; }
int sum(int x){ int s=0; for (;x;x-=x&-x) s+=C[x]; return s; }
db solve(){
    sort(l+1,l+1+n,cmp);
    db p=-INF,q=INF;
    while (q-p>eps){
        db m=(p+q)/2;
        rep(i,1,n) a[i]=mp(l[i].k*m+l[i].b,i);
        sort(a+1,a+1+n);
        rep(i,1,n) C[i]=0;
        int c=0;
        per(i,n,1) c+=sum(a[i].se),add(a[i].se);
        if (2*c>=n*(n-1)/2) q=m;
        else p=m;
    }
    return q;
}
int main(){
    scanf("%d",&n);
    rep(i,1,n){
        db a,b,c; scanf("%Lf%Lf%Lf",&a,&b,&c);
        if (c) a/=c,b/=c,l[i].k=-a/b,l[i].b=1/b;
        else l[i].k=-a/b;
    }
    printf("%.10Lf ",solve());
    rep(i,1,n) l[i].b/=-l[i].k,l[i].k=1/l[i].k;
    printf("%.10Lf\n",solve());
    return 0;
}


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

int main() {
  char c;
  cin >> c;

  vector<char> alphabet(26);
  iota(alphabet.begin(), alphabet.end(), 'a');

  for(int i=0;i<26;i++) {
    if(alphabet[i] == c) {
      if(i == 25) cout << alphabet[0] << endl;
      else cout << alphabet[i+1] << endl;
    }
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// using namespace std;

using ll = long long;

const ll INF = 1001001001001001;

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

void Main() {
  int L, R;
  std::cin >> L >> R;
  if (R - L > 2019) {
    std::cout << 0 << std::endl;
    return;
  }

  L = L % 2019;
  R = R % 2019;
  if (L >= R) {
    R += 2019;
  }

  ll res = INF;
  for (int i = L; i < R; ++i) {
    for (int j = i + 1; j <= R; ++j) {
      ll p = i * j % 2019;
      chmin(res, p);
    }
  }
  std::cout << res << std::endl;
}

int main() {
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <vector>
using namespace std;

bool checkRightTriangle(int side1, int side2, int side3) {
  std::vector<int> edges;
  edges.push_back(side1);
  edges.push_back(side2);
  edges.push_back(side3);
  std::sort(edges.begin(), edges.end(), std::greater<int>());
  if (pow(edges[0], 2) == pow(edges[1], 2) + pow(edges[2], 2)) {
    return true;
  } else {
    return false;
  }
}

int main(int argc, char const *argv[]) {
  int data_num;
  std::cin >> data_num;

  int a, b, c;
  std::vector<bool> results;

  for (size_t i = 0; i < data_num; i++) {
    std::cin >> a >> b >> c;
    results.push_back(checkRightTriangle(a, b, c));
  }

  for (bool result : results) {
    if (result) {
      std::cout << "YES" << '\n';
    } else {
      std::cout << "NO" << '\n';
    }
  }
  return 0;
}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
 
#define fastIO ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define ll long long
ll mod = 1e9+7;

int main() {
    fastIO
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for (ll int i = 0; i < n; ++i)
    {
        cin>>a[i];
    }
    
    ll dp[n+1][k+1];
    ll sum[n+1][k+1];
    for (ll int children = 0; children <= n; ++children)
    {
        for (ll int candies = 0; candies <= k; ++candies)
        {
            if(candies==0){
                dp[children][candies] = 1;
                sum[children][candies] = 1;
            }
            else if(children==0){
                dp[children][candies] = 0;
                sum[children][candies] = 1;
            }
            else{
                ll candiesRangeStart = candies - min(candies,a[children-1]);
                dp[children][candies] = (mod + sum[children-1][candies] - sum[children-1][candiesRangeStart])%mod;
                dp[children][candies] = (dp[children][candies] + dp[children-1][candiesRangeStart]) % mod;
                sum[children][candies] = (dp[children][candies] + sum[children][candies-1]) % mod;
            }
        }
    }

    ll ans = dp[n][k];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 158080
#include <iostream>
#include <cstring>
 
long long dp[11][1010];

int main(){
    dp[0][0] = 1;
         
    for(int j = 0; j <= 100; ++j){
        for(int k = 1010; k >= 0; --k){
            for(int i = 10; i >= 1; --i){
                if(k - j < 0) continue;
                 
                dp[i][k] += dp[i - 1][k - j];
            }
        }
    }

    int n, s;
    while(std::cin >> n >> s, n != 0 || s != 0){
        std::cout << dp[n][s] << std::endl;
    }
}

Measured memory_bytes: 1240
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX/2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}





//-----CODE------//
//-----CODE------//

void solve(void)
{
  int N;
  cin>>N;
  string str;
  cin>>str;
  int ANS = 0;
  int X = 0;
  for (int i = 0; i < str.size(); i++)
  {
    if(str[i] == 'I')
    {
      X++;
      ANS = max(ANS,X);
    }
    else
    {
            X--;
      ANS = max(ANS,X);
    }
    
  }

  cout<<ANS<<endl;
  
  return; 
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
const int MOD = (int)1e9 + 7;
const double PI = 3.14159265358979323846;
typedef long long ll;

int main(void) {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  rep(i, N) cin >> a[i];
  sort(a.begin(), a.end());
  int sum = 0;
  rep(i, K) sum += a[i];
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int
#define pll				pair<int , int>

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007
#define hell            998244353 

ll mod_pow(ll a,ll b,ll m) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2 , mod);
}

void solve()
{
	int n , m;
	
	cin >> n >> m;
	
	int a[n];
	
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	
	sort(a , a + n);
	
	vector< pair < int,int> > b(m);
	
	for(int i = 0; i < m; ++i) {
		cin >> b[i].S >> b[i].F;
	}
	
	sort(ALL(b));
	
	int j = m-1;
	
	for(int i = 0; i < n; ++i) {
		if(j < 0) {
			break;
		}
		
		if(b[j].S == 0) {
			j--;
		}
		
		if(a[i] <= b[j].F) {
			a[i] = b[j].F;
			b[j].S--;
		}
	}
	
	int sm = 0;
	
	for(int i = 0 ; i < n; ++i) {
		sm += a[i];
	}
	
	cout << sm;
}

signed main() {
    fast;
    
    int t = 1;
    
	//cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 5516
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	ll m;
	cin>>n;
	cin>>m;
	ll a=0;
	ll b=0;
	a=(n*(n-1))/2;
	b=(m*(m-1))/2;
	cout<<a+b<<"\n";
	return 0;
}


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

int main() {
    int a, b, c, x;
    cin >> a >> b >> c >> x;
    int ans = 0;
    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= c; k++) {
                if (i * 500 + j * 100 + k * 50 == x) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long llint;

const int MAXN = 52;

int n, s;
llint a[MAXN];
llint dp[MAXN][MAXN][MAXN*MAXN];

llint f (int pos, int ost, int val) {
    if (pos == n) {
        if (ost == 0 && val == 0) return 1;
        return 0;
    }
    if (dp[pos][ost][val] != -1) return dp[pos][ost][val];
    llint res = f(pos + 1, ost, val);
    if (ost > 0 && val >= a[pos]) res += f(pos + 1, ost - 1, val - a[pos]);
    return dp[pos][ost][val] = res;
}

int main () {
    memset(dp, -1, sizeof dp);
    cin >> n >> s;
    for (int i=0; i<n; i++) {
        cin >> a[i];
    }
    llint sol = 0;
    for (int i=1; i<=n; i++) {
        sol += f(0, i, s * i);
    }
    cout << sol;
    return 0;
}


Measured memory_bytes: 57344
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

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

int n;
int a[105000];

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	vector<P>v;
	v.push_back(P(a[0],1));
	for (int i = 1; i < n; i++) {
		if (a[i] == a[i - 1])v[v.size() - 1].second++;
		else v.push_back(P(a[i], 1));
	}
	int ans = 0;
	for (int i = 0; i < v.size(); i++) {
		if (v[i].second > v[i].first)ans += v[i].second - v[i].first;
		else if (v[i].second < v[i].first)ans += v[i].second;
	}
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 1784
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

#define mod 1000000007
using namespace std;
typedef long long ll;

const int maxn = 1e8 + 8;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a*b%2==0)
    {
        printf("No");
    }
    else{
            printf("Yes");
    }

    return 0;
}





Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >> k;

    if (e-a > k) {
        cout << ":(" << endl;
    } else {
        cout << "Yay!" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int main(){
  int N,M;
  cin >> N >> M;
  vector<i64> x(N),y(M);
  i64 MOD = 1e9 + 7;
  i64 X = 0;
  rep(i,0,N - 1){
    cin >> x[i];
    if(i > 0){
      i64 d = x[i] - x[i - 1];
      X += d * (i) % MOD * (N - i);
      X %= MOD;
    }
  }
  i64 Y = 0;
  rep(i,0,M - 1){
    cin >> y[i];
    if(i > 0){
      i64 d = y[i] - y[i - 1];
      Y += d * (i) % MOD * (M - i);
      Y %= MOD;
    }
  }
  cout << X * Y % MOD << endl;
}


Measured memory_bytes: 1792
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception{
		new Main(new Scanner(System.in), System.out, System.err).exec();
	}
	public final Scanner sc;
	public final PrintStream out, err;
	public Main(final Scanner sc, final PrintStream out, final PrintStream err) {
		this.sc = sc;this.out = out;this.err = err;
	}
	static public final long pair(int a, int b) {return (((long)a) << 32) + b;}
	static public final int getPair1(long v) {return (int)(v >> 32);}
	static public final int getPari2(long v) {return (int)(v & 0xFFFFFFFF);}

	static public final long quad(long a, long b, long c, long d) {
		return ((a&0xFFFF)<< 48) + ((b&0xFFFF)<< 32) + ((c&0xFFFF)<< 16) +(d&0xFFFF);}
	static public final int getQuad1(long v) {return (int)( v >> 48          );}
	static public final int getQuad2(long v) {return (int)((v >> 32) & 0xFFFF);}
	static public final int getQuad3(long v) {return (int)((v >> 16) & 0xFFFF);}
	static public final int getQuad4(long v) {return (int)( v        & 0xFFFF);}

	static public final long record(int e, int m, int i) {
		return quad(-1, e, m, i);
	}
	static public final int re(long record) {
		return getQuad2(record);
	}
	static public final int rm(long record) {
		return getQuad3(record);
	}
	static public final int ri(long record) {
		return getQuad4(record);
	}

	//------------------------------------------

	private int p;
	private int[] inv;
	private int[] fact;
	private int[] finv;
	public final int mod(long v) {
		v %= p;
		return (int)(v < 0 ? v+p : v);
	}
	public final int mul(long a, long b) {
		return mod(a*b);
	}
	public final void initFact(double limit, double p) {
		initFact((int)limit, (int)p);
	}
	public final void initFact(int limit, int p) {
		this.p = p;
		this.inv = new int[limit+1];
		this.fact = new int[limit+1];
		this.finv = new int[limit+1];
		fact[1] = finv[1] = inv[0] = inv[1] = 1;
		for(int i=2;i<=limit;i++) {
			int a = p / i;
			int b = p % i;
			inv[i]  = mul(-a, inv[b]);
			fact[i] = mul(fact[i-1], i);
			finv[i] = mul(finv[i-1], inv[i]);
		}
	}
	public final int comb(int m, int n) {
		return mul(mul(fact[m], finv[n]), finv[m-n]);
	}

	//------------------------------------------
	static long lcm (long a, long b) {
		long temp;
		long c = a;
		c *= b;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return (long)(c/b);
	}
	//------------------------------------------

	public void exec() throws Exception{
		final int A = sc.nextInt();
		final int B = sc.nextInt();
		out.println(lcm(A, B));
	}
}


Measured memory_bytes: 21844
n,k = map(int,input().split())
answer = 0
MOD = 10**9+7
for i in range(n+2):
    if i < k:
        continue
    min= i*(i-1)/2
    max= i*(2*n-i+1)/2
    answer += max%MOD-min%MOD+1
print(int(answer%MOD))


Measured memory_bytes: 9184
//Author : Sukarna Paul

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1)
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define MAX 300005
#define INF 0x3f3f3f3f
template <class T> inline T bigmod(T p,T e,T M){ll ret = 1LL;for(; e > 0LL; e >>= 1LL){if(e & 1LL) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}   // M is prime}

using namespace std;
using namespace __gnu_pbds;

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update>pref_trie;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;




int main(){
    IOS
    //freopen("output.txt","w",stdout);
    int n;
    cin>>n;

    ll arr[n];
    map<ll,ll>mp;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        mp[arr[i]]++;
    }

    ll tot=0;
    for(auto it=mp.begin();it!=mp.end();it++){
        ll x = (*it).second;
        tot+=(x*(x-1))/2;
    }

    for(int i=0;i<n;i++){
        int cur = arr[i];
        mp[cur];

        ll x = mp[cur];
        tot-=(x*(x-1))/2;
        x--;
        tot+=(x*(x-1))/2;
        cout<<tot<<"\n";
        tot-=(x*(x-1))/2;
        x++;
        tot+=(x*(x-1))/2;
    }

}


Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
#include <cassert>
using namespace std;

typedef long long ll;


int main() {
	double a, b, c; cin >> a >> b >> c;
	double s = (a + b + c) / 2.;
	double S = sqrt(s*(s - a)*(s - b)*(s - c));
	cout << (int)(S + 0.1) << endl;
	return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/agc034/tasks/agc034_a

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

int main()
{
  int N, A, B, C, D;
  string S;

  cin >> N >> A >> B >> C >> D;
  cin >> S;

  if (S.substr(A - 1, C - A + 1).find("##") == string::npos && S.substr(B - 1, D - B + 1).find("##") == string::npos)
    if (C < D)
      cout << "Yes" << '\n';
    else if (S.substr(B - 2, D - B + 3).find("...") != string::npos)
      cout << "Yes" << '\n';
    else
      cout << "No" << '\n';
  else
    cout << "No" << '\n';

  return 0;
}


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

int main(void){

	int a;
	int s=1;

	scanf("%d",&a);

	while(1){
		if((s*2) > a){
			printf("%d\n",s);
			break;
		}
		s*=2;
	}
	


    return 0;
}


Measured memory_bytes: 2108
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.LinkedHashSet;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int N = in.nextInt();
            long K = in.nextLong();
            int moves[] = CPUtils.readIntArray(N, in);

            List<Integer> t = new ArrayList<>(N);
            Set<Integer> visited = new LinkedHashSet<>(N);
            visited.add(1);
            t.add(1);

            long tempK = K;
            int current = 1;
            int repeat = -1;
            while (tempK > 0)
            {
                int next = moves[current - 1];
                if (visited.contains(next))
                {
                    repeat = next;
                    break;
                }
                current = next;
                t.add(current);
                visited.add(current);
                tempK--;
            }
            int repeat_start_index = t.indexOf(repeat);

            if (repeat_start_index == -1)
            {
                out.println(t.get((int) K));
                return;
            }

            K -= repeat_start_index;

            int cycle_size = t.size() - repeat_start_index;

            int offset = (int) (K % cycle_size);
            out.println(t.get(repeat_start_index + offset));
        }

    }

    static class CPUtils
    {
        public static int[] readIntArray(int size, Scanner in)
        {
            int[] array = new int[size];
            for (int i = 0; i < size; i++)
            {
                array[i] = in.nextInt();
            }
            return array;
        }

    }
}



Measured memory_bytes: 60016
#include<cstring>
#include<cstdio>
#include<iostream>
using namespace std;
typedef long long LL;
const int MaxN = 2e5 + 5;

int tt[MaxN];

int main() {
	int n, t;
	scanf("%d %d", &n, &t);
	LL sum = t; tt[1] = 0;
	for(int i = 1; i <= n; i++) scanf("%d", &tt[i]);
	for(int i = 1; i < n; i++) sum += min(t, tt[i + 1] - tt[i]);
	printf("%lld\n", sum);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include<math.h>
using namespace std;

int main() {
	long long int n,m,s1,s2,ans;
	cin>>n>>m;
	
	s1=fminl(n,m/2);
	n=n-s1;
	m=m-2*s1;
	
	s2=m/4;
	
	ans=s1+s2;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
S = input().strip()
N = len(S)
x = "keyence"
n = len(x)
if N<n:
    flag = 0
else:
    flag = 0
    for i in range(7):
        for j in range(1,8):
            if S[:i]+S[-j:]==x:
                flag = 1
                break
        if flag==1:break
if flag==1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 38256
#include <iostream>

using namespace std;

int main() {
    int H,W;
    while(1){
        cin>>H>>W;
        if( H==0 && W==0) break;
        for(int j =0; j < H; ++j){
            for (int i = 0; i <W ; ++i) {
                        cout<<"#";
                }
                    cout<<endl;
            }
        cout<<endl;
        }
    return 0;}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
	int n; cin >> n;
	string s; cin >> s;
	int cnt[3] = {};
	for (char c : s) {
		if (c == 'R') ++cnt[0];
		else if (c == 'G') ++cnt[1];
		else ++cnt[2];
	}
	ll ans = 1;
	for (int i : cnt) ans *= i;
	for (int i = 0; i < n - 2; i++) {
		for (int d = 1; i + d + d < n; d++) {
			if (s[i] != s[i + d] and s[i] != s[i + d + d] and s[i + d] != s[i + d + d]) {
				--ans;
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long 
#define rep(i,a,b) for(ll i=a; i<b; ++i)
#define BOOST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(v) v.begin(),v.end()
#define sl(a) a.size()
#define mod 1000000007 
#define lcm(a,b) (a*b)/__gcd(a,b)
#define MAX 10000003
using namespace std;
ll c=0;
void count(vector<vector<char>> arr, ll n, ll m, ll i, ll j)
{
    if(i>=n||j>=m||arr[i][j]=='#') return;
    if(i==n-1 and j==m-1) { c++; c%=mod; return; }
    if(i==n-1 and j<m) count(arr,n,m,i,j+1);
    if(j==m-1 and i<n) count(arr,n,m,i+1,j);
    else 
    {
        count(arr,n,m,i,j+1);
        count(arr,n,m,i+1,j);
    }
}
void solve()
{
    ll n,m;  cin>>n>>m;
    string str;
    vector<vector<char>> arr(n,vector<char>(m));
    rep(i,0,n)
    {
        cin>>str;
        rep(j,0,m) arr[i][j]=str[j];

    }
    vector<vector<ll>> dp(n,vector<ll>(m,0));
    dp[0][0]=1;
    rep(i,0,n)
    {
        rep(j,0,m)
        {
            if(arr[i][j]=='#') {  dp[i][j]=0;  continue;   }
            if(i>0 and j>0) dp[i][j]=(dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
            else if(j==0 and i>0) dp[i][j]=dp[i-1][j]%mod;
            else if(i==0 and j>0) dp[i][j]=dp[i][j-1]%mod;
            dp[i][j]%=mod;
        }
    }cout<<dp[n-1][m-1]%mod;
}
int main()
{
    BOOST
    int T=1;  //cin>>T;
    while(T--) solve();
    return 0;
}

Measured memory_bytes: 12156
#include<bits/stdc++.h>
using namespace std;
int a,b,c[200005],d,e;
int main()
{
    cin>>a;
    d=ceil((double)(a+1)/2);
    e=(a%2==0)?(-1):(1);
    for(int i=1;i<=a;i++)
	{
        cin>>b;
        c[d]=b;
        d+=i*e;
        e*=-1;
    }
    for(int i=1;i<=a;i++)
    	cout<<c[i]<<" ";
    return 0;
}

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

int main() {
    string w;
    cin >> w;

    vector<int> a(26, 0);

    for (char c : w)
        a.at(c - 'a')++;

    bool b = true;
    for (int i : a)
        if (i % 2 == 1) {
            b = false;
            break;
        }

    cout << (b ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3608
#include <cstdio>

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

    return 0;
}

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

public class Main {

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

        int N = sc.nextInt();
        int[] d = new int[N];
        Arrays.setAll(d, (e) -> sc.nextInt());

        long sum = 0;
        for (int i = 0; i < N-1; i++) {
            for (int j = i+1; j < N; j++) {
                sum += d[i] * d[j];
            }
        }
        System.out.println(sum);
    }

}

Measured memory_bytes: 28372
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;

int main(){
    double a,b,x;
    cin>>a>>b>>x;

    double v = a*a*b;
    double ans;

    if(x >= v / 2.0){
        ans = atan( 2.0*(a*a*b-x) / (a*a*a) ) * (180.0/M_PI);
    }
    else{
        ans = atan( (a*b*b) / (2.0*x) ) * (180.0/M_PI);
    }

    //ans = ans * 180.0 /M_PI;

    printf("%.10f\n", ans);
}

Measured memory_bytes: 384
using System;

namespace questionB
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var line1 = Console.ReadLine().Split(' ');

            var N = Int32.Parse(line1[0]);
            var L = Int32.Parse(line1[1]);

            var a = N * (L - 1);
            var b = (N * (N + 1)) / 2;
            var plan = a + b;
            int eaten = 0;

            if(0 < L)
            {
                eaten = L;
            }
            else if (L - 1 + N < 0)
            {
                eaten = L - 1 + N;
            }

            Console.WriteLine(plan - eaten);
        }
    }
}


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

struct UnionFind {
  vector<int> data;

  UnionFind(int N) : data(N, -1) { }

  bool unite(int x, int y) {
    x = root(x); y = root(y);

    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }

    return x != y;
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }

  int size(int x) {
    return -data[root(x)];
  }
};

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

  vector<int> ps(N);

  for (int i = 0; i < N; i++) {
    cin >> ps[i];
  }

  UnionFind tree(N);

  for (int i = 0; i < M; i++) {
    int x, y;
    cin >> x >> y;
    tree.unite(x-1, y-1);
  }

  vector<set<int>> s(N);

  for (int i = 0; i < N; i++) {
    s[tree.root(i)].insert(i);
  }

  int answer = 0;

  for (int i = 0; i < N; i++) {
    int root = tree.root(i);

    if (s[root].find(ps[i] - 1) != s[root].end()) {
      answer++;
    }
  }

  cout << answer << endl;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long 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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//}

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int dp[1010][1010];
int bingo[3][3];
bool flag[3][3];
int I[100][20];
char s[100][100];

int main() {
	rep(i, 3) {
		rep(j, 3) {
			cin >> bingo[i][j];
		}
	}
	bool flag = true;
	vector<int>a(3), b(3);
	a[0] = 0, b[0] = bingo[0][0], b[1] = bingo[0][1], b[2] = bingo[0][2];
	a[1] = bingo[1][0] - b[0], a[2] = bingo[2][0] - b[0];
	rep(i, 3) {
		rep(j, 3) {
			if (a[i] + b[j] != bingo[i][j])flag = false;
		}
	}
	if (flag)puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reve(a) reverse(a.begin(), a.end())
typedef long long ll;
const ll MOD = 1e9+7;


int main(){
  int n, sz, t=0, sum=0;
  string s;
  cin >> n;
  vector<string> S(n);
  rep(i, n) cin >> S[i];
  vector<int> A(26, 100);
  rep(i, n){
    s = S[i];
    sz = s.size();
    for(char c='a'; c<='z'; c++){
      rep(j, sz){
        if(s.at(j)==c) sum++;
      }
      A[t] = min(A[t], sum);
      sum = 0;
      t++;
    }
    t = 0;
  }
  string ans=""; int m, g=0;
  for(char c='a'; c<='z'; c++){
    m = A[g];
    rep(i, m) ans += c;
    g++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <utility>
#include <map>
#include <set>
#include <algorithm>
#include<cmath>

#define rep(i, a, b) for (int i=a; i <b; i++)
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef vector< int > vi;

const long long mod = 1e9 + 7;
ll f[200010] = {0}; // f(n) = n!

ll mod_pow(ll x, ll n) { // x^n mod m
    ll res = 1LL;
    while(n > 0) {
        if (n  & 1) {
            res = (res * x ) % mod; 
        }
        x = (x * x) % mod;
        n >>= 1;
    }

    return res;
}

ll mod_inv(ll x) {
    return mod_pow(x, mod -2) % mod;
}

// nCr % mod
ll comb(int n, int r) {
    return (((f[n] * mod_inv(f[r])) % mod) * mod_inv(f[n-r])) % mod;
}

int main() {

    ll n, m; cin >> n; cin >> m;
    ll sm = sqrt(double(m)) + 1;
    map<int, int> res;
    ll ma = m;
    rep(i, 2, sm) {
        while(ma % i == 0) {
            res[i]++;
            ma /= i;
        }
    }
    if(ma != 1) {res[ma] = 1;}

    //cout << ma << endl;
    //for(auto i = res.begin(); i != res.end(); i++) {
    //    cout << i->first << ": " << i->second << "\n";
    //}
    ll ans = 1;
    f[0] = f[1] = 1;
    for(int i=2; i <= n + sm; i++) f[i] = (i * f[i-1]) % mod;

    for(auto i = res.begin(); i != res.end(); i++) {
        ans = ans * comb(((i->second) + n -1 ), i->second ) % mod;
    }
    cout << ans << endl;
    return 0;
} 

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) ll(i.size())
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

template<class T> inline bool cmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool cmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MOD=1000000007;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll MAXN=3002;
const ll MAXLG=__lg(MAXN)+2;

string s;
ll n;
ll dp[MAXN][MAXN];
ll pre[MAXN][MAXN];
/********** Good Luck :) **********/
int main()
{
    IOS();
    cin >> n;
    cin >> s;

    dp[0][1] = 1;
    REP1 (i,n) {
        pre[0][i] = 1;
    }

    REP1 (i,n-1) {
        REP1 (j,i+1) {
            if (s[i-1] == '>') {
                dp[i][j] = (pre[i-1][i] - pre[i-1][j-1] + MOD) % MOD;
            } else {
                dp[i][j] = pre[i-1][j-1];
            }
            pre[i][j] = (pre[i][j-1] + dp[i][j]) % MOD;
            // debug(i,j,dp[i][j],pre[i][j]);
        }
    }

    ll ans = 0;
    REP1 (i,n) {
        ans += dp[n-1][i];
        ans %= MOD;
    }

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


Measured memory_bytes: 139392
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

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

    int n,h;

    cin >> n >> h;

    vector<int> a(n),b(n);

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

    sort(a.begin(),a.end(),greater<int>());
    sort(b.begin(),b.end(),greater<int>());

    int a_max = a[0];

    int count = 0;

    for(int i = 0; i < n; i++){
        if(a_max < b[i] && h > 0){
            h -= b[i];
            count++;
        }else{
            break;
        }
    }

    if(h > 0){
        count += h/a_max;
        if(h%a_max != 0){
            count++;
        }
    }

    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

int main() {
  int n;
  int a[100000];
  long long ans;
  long long r = 2;
  std::cin >> n;
  for (int ni = 0; ni < n; ++ni) {
    std::cin >> a[ni];
  }
  ans = a[0] - 1;
  for (int ni = 1; ni < n; ++ni) {
    if (a[ni] > r) {
      if (a[ni] % r == 0) {
        a[ni] -= r + 1;
        ++ans;
      }
      ans += a[ni] / r;
      a[ni] %= r;
    } else if (a[ni] == r) {
      ++r;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 640
from sys import stdin
from sys import setrecursionlimit
from collections import Counter
from numba import jit

setrecursionlimit(10 ** 7)

n = int(stdin.readline().rstrip())
a = list(map(int,stdin.readline().rstrip().split()))
a.sort()
b = list(set(a))
b.sort()
c = Counter(a)

se = set()

@jit
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

for i in b:
    k = make_divisors(i)
    flag = True
    for j in k:
        if j in se:
            flag = False
            break
    if flag:
        se.add(i)

point = len(se)

for i in se:
    if c[i] > 1:
        point -= 1

print(point)

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

int main() {
  long long x,n=100;
  cin>>x;
  for(int i=1;i<1000000;i++){
     n=n*1.01;
       if(n>=x){
         cout<<i<<endl;
         return 0;
              }
  }
  
   
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int n,tot=0,head[100001];
struct data {
    int next,num;
}edge[200001];
void add(int u,int v) {
    edge[++tot].next=head[u];
    edge[tot].num=v;
    head[u]=tot;
}
int dfs(int x,int fa) {
    int ans=0;
    for (int i=head[x];i!=-1;i=edge[i].next) {
	int kx=edge[i].num;
	if (kx==fa) continue;
	ans^=dfs(kx,x)+1;
    }
    return ans;
}
int main() {
    memset(head,-1,sizeof(head));
    scanf("%d",&n);
    for (int i=1;i<n;i++) {
	int u,v;
	scanf("%d%d",&u,&v);
	add(u,v);
	add(v,u);
    }
    int ans=dfs(1,-1);
    if (ans) printf("Alice\n");
    else printf("Bob\n");
    return 0;
}


Measured memory_bytes: 6912
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>

int main()
{
int i,j,count=0;
int n;
scanf("%d",&n);
char str[n+1];
scanf ("%s",str);
for (i=0;i<n;i++)
{
    if (str[i-1]==str[i])
    {
        count++;
    }
}
printf ("%d",n-count);
}


Measured memory_bytes: 256
n, k = map(int, input().split())
snuke = [1 for i in range(n)]
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        aj = a[j] - 1
        snuke[aj] = 0

print(sum(snuke))

Measured memory_bytes: 67784
let m = 1000000007
let ( +^ ) x y = (x + y) mod m
let ( *^ ) x y = (x * y) mod m

module IntMap = Map.Make (struct
  type t = int
  let compare = compare
end)

let rec drop n = function
  | [] -> []
  | (_ :: t) as l ->
      if n = 0
      then l
      else drop (n - 1) t

let inversion ( <= ) xs =

  let rec merge_count acc xs ys n cnt =
    match xs, ys with
    | _, [] -> cnt, List.rev_append acc xs
    | [], _ -> cnt, List.rev_append acc ys
    | x :: xs', y :: ys' ->
        if x <= y
        then merge_count (x :: acc) xs' ys (n - 1) cnt 
        else merge_count (y :: acc) xs ys' n (n + cnt) in

  let rec sort_count xs = function
    | 0 -> 0, []
    | 1 -> 0, [List.hd xs]
    | n ->
        let c, ys = sort_count xs (n / 2) in
        let d, zs = sort_count (drop (n / 2) xs) ((n + 1) / 2) in
        merge_count [] ys zs (n / 2) (c + d) in

  fst @@ sort_count xs (List.length xs)

let () = Scanf.scanf "%d %d\n" @@ fun n k ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  Printf.printf "%d\n" @@
  ( +^ ) (k *^ inversion ( <= ) (Array.to_list as_)) @@
  ( *^ ) (k * (k - 1) / 2 mod m) @@
  fst @@
  IntMap.fold (fun _ n (acc, sum) -> (acc + n * sum, sum + n))
    (Array.fold_left (fun m a ->
      IntMap.add a (1 +
        try IntMap.find a m
        with Not_found -> 0) m) IntMap.empty as_) (0, 0)


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

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

int main()
{
    int r, d, x;
    scanf("%d %d %d", &r, &d, &x);

    for (int i = 0; i < 10; i++)
        x = r * x - d, printf("%d\n", x);

    return 0;
}


Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
const ll MAX = 200001;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){
    COMinit();
    ll n,k;cin >> n >> k;
    if(k>=n)k=n-1;
    ll ans=0;
    REP(i,k+1){
        ans+=(COM(n,i)*COM(n-1,n-i-1));
        ans%=MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1<<30;
const ll MOD = 1000000007;

int main(void) {

    ll n; cin >> n;
    string s;
    while(n != 0) {
        int a = n % 26;
        if (a == 0) {
            s += 'z';
            n /= 26;
            n--;
            continue;
        }

        char c = 96 + a;
        s += c; 
        n /= 26;
    }
    reverse(s.begin(), s.end());

    cout << s << endl;


    return 0;
}

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

typedef long long ll;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n,w;
    cin >> n >> w;
    vector<vector<ll>> dp(n+1,vector<ll>(w+1,0));
    for (int i = 0;i < n;++i) {
        ll x,y;
        cin >> x >> y;
        for (int j = 0;j < w+1;++j) {
            dp[i+1][j] = dp[i][j];
            if (j-x >= 0 && dp[i+1][j] < dp[i][j-x]+y) dp[i+1][j] = dp[i][j-x]+y;
        }
    }
    cout << dp[n][w] << endl;
    return 0;
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
#define pi acos(-1.0)
using namespace std;
const int maxn = 1e5+5;

ll p(ll x){
	return x*x*x*x*x;
}

int main(){
	ll x; cin >> x;
	for(ll i = -1000; i <= 1000; i++){	
		for(ll j = -1000; j <= 1000; j++){ 
			if(p(i) == p(j) + x){
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 3592
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	private static final int CARD_NUM = 4; //?????????????????°

	public static void main(String[] args) {
		int[][] numbers = new int[2][CARD_NUM]; //??????????????????

		while(sc.hasNext()) {
			int hit = 0; //???????????°
			int blow = 0; //???????????°

			//?????£???????????????????????\?????????
			for(int $ = 0; $ < 2; $++) { //?????¬????????°??¶?????°?????????
				for(int i = 0; i < CARD_NUM; i++) { //?????????????????°??¶?????°?????????
					numbers[$][i] = sc.nextInt();
				}
			}

			//??????????????°?????°??????
			for(int $ = 0; $ < CARD_NUM; $++) {
				if(numbers[0][$] == numbers[1][$]) {
					hit++;
				} else {
					for(int i = 0; i < CARD_NUM; i++) {
						if(numbers[0][$] == numbers[1][i]) {
							blow++;
						}
					}
				}
			}

			System.out.println(hit + " " + blow);
		}
	}
}

Measured memory_bytes: 25952
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e7;
// l, r, v
using Data = tuple<int, int, int>;
int main() {
    int N;
    cin >> N;
    vector<Data> data;
    data.emplace_back(0, 0, 0);
    int T = 0;
    {
        vector<int> t(N), v(N);
        for(int i = 0; i < N; i++) {
            cin >> t[i];
            t[i] *= 2;
        }
        for(int i = 0; i < N; i++) {
            cin >> v[i];
            v[i] *= 2;
        }
        for(int i = 0; i < N; i++) {
            data.emplace_back(T, T + t[i], v[i]);
            T += t[i];
        }
    }
    data.emplace_back(T, T, 0);
    vector<int> V(T + 1, INF);
    for(int j = 0; j <= T; j++) {
        for(int i = 0; i < N + 2; i++) {
            int l, r, v;
            tie(l, r, v) = data[i];
            if(j < l) {
                V[j] = min(V[j], v + l - j);
            } else if(r < j) {
                V[j] = min(V[j], v + j - r);
            } else {
                V[j] = min(V[j], v);
            }
        }
    }
    double ans = 0;
    for (int j = 0; j < T; j++) {
        ans += V[j] + V[j + 1];
    }
    cout << std::fixed << std::setprecision(6) << ans / 8 << endl;
    return 0;
}


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

#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define BUFF ios::sync_with_stdio(false);

typedef long long int ll;
typedef long double ld;
typedef vector < int > vi;
typedef vector < vi > vvi;
typedef pair < int, int > ii;
typedef vector < ii > vii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const int MOD = 1e9+7;
const ld pi = acos(-1);

int n, m;
int mm[31];
int main() { BUFF
  cin >> n >> m;
  memset(mm, 0, sizeof(mm));
  for(int i=0; i<n; i++){
    int k, x;
    cin >> k;
    while(k-- > 0) {
      cin >> x;
      mm[x]++;
    }
  }
  int acc = 0;
  for(int i=1; i <= m; i++) 
    if(mm[i] == n)
      acc++;
  cout << acc << endl;
  return 0;
}


Measured memory_bytes: 256