akhauriyash/Code-Regression huggingface dataset:
#include <cmath>
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
    int n; cin >> n;
    int a[n]; for (int i = 0; i < n; i++) cin >> a[i];
    double avg = 0;
    for (int i = 0; i < n; i++) avg += a[i];
    avg /= n;
    double d = 1000000;
    int ans = -1;
    for (int i = 0; i < n; i++) {
        if (abs(avg - a[i]) < d) {
            d = abs(avg - a[i]);
            ans = i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>
 
using namespace std;
using namespace __gnu_pbds;
 
#define endl '\n'
 
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template<typename T>
static T randint(T lo, T hi){
	return uniform_int_distribution<T>(lo, hi)(rng);
}


int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	// freopen("settling.in", "r", stdin);
	// freopen("settling.out", "w", stdout);

	int n;
	cin >> n;

	map<string, int> mp;
	while(n--){
		string s;
		cin >> s;
		mp[s]++;
	}

	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;

	return 0;
}


Measured memory_bytes: 3640
I=lambda:map(int,input().split());
n,q=I();r=[0]*n;e=[[]for _ in range(n)];y=[0]+[1]*n;s=[0]
for _ in range(n-1):a,b=I();e[a-1]+=b-1,;e[b-1]+=a-1,;
for _ in range(q):p,x=I();r[p-1]+=x;
while s:
  u=s.pop();v=r[u];
  for c in e[u]:
    if y[c]:y[c]=0;r[c]+=v;s+=c,;
print(*r)

Measured memory_bytes: 108208
//#pragma region ALL(include define etc)
#include <iostream>   // swap(a, b)
#include <string>
#include <cmath>      // abs(絶対値) sin cos tan(角度 / 180.0 * 3.141592)
#include <vector>     // vec.push_back(a) vec.pop_back()
#include <algorithm>  // max(a, b) min(a, b) reverse() sort()
#include <functional> // sort(a, a + N, greater<型>());
#include <math.h>
#include <iomanip>
#define int long long
#define ll long long
#define double long double
using namespace std;
//#pragma endregion

signed main()
{
	// 10^18 = 1000000000000000000

	//int h1, h2, m1, m2, k;
	//int box, box1,box2;

	//int N;
	int n;
	int a = -111, b = -111;
	//int m;
	//int k;
	//string s;
	//string t;
	//int m1, m2;
	//int a, b, c, k;
	int x, y;

	//int box[1000000000000000000];
	//int box;
	//int box2;
	int p[111];

	//long double aaa;

	//int k, d;
	int all = 0;
	//double all;
	//double a, b;
	//double h, m;
	//int a[30000] = { 0 };
	//double c, d, e;

	//double mbox, hbox;
	//double box, box2;

	//int box[10000] = { 0 };

	//bool flag = true;
	bool flag = false;

	//string str;

	//cin >> h1 >> m1 >> h2 >> m2 >> k;
	//cin >> n;
	//cin >> a >> b;
	cin >> x >> n;

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

	if (n == 0)
	{
		cout << x;
		return 0;
	}

	sort(p, p + n);

	for (int i = 0; i < n; i++)
	{
		//cout << p[i] << "\n";
		if (p[i] == x)
		{
			a = i;
			b = i;
		}
	}
	if (a == -111)
	{
		cout << x;
		return 0;
	}

	for (int i = 0; i < n; i++)
	{
		if (p[a] != (x - i))
		{
			all = (x - i);
			break;
		}
		else if (p[b] != (x + i))
		{
			all = (x + i);
			break;
		}
		a--;
		b++;
	}
	//n = t.length();

	cout << all << "\n";

	/*if (flag == true)
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}*/

	/*if (n == 0)
	{
		cout << x;
	}*/

	//cout << fixed << setprecision(111) << all;
}


Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
const long long mod = 1e9 + 7;
typedef long long ll;  // ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>  // chmin(min,a)
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>  // operator << (cout,a);
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp

int main() {
  ll z=0,k,n,m,h,w,ans=0,sum=0,Max=1,Min=1e9+1;
  bool ok = false;
  string s,t,r;
  cin >> n;
  m = (n/500)*1000;
  h = ((n%500)/5)*5;
  cout << m+h << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3") 
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx") 
#define __USE_MINGW_ANSI_STDIO 0
#include<bits/stdc++.h>                               
using namespace std;

#define PI acos(-1)
#define pb push_back
#define fi first
#define se second
#define TASK ""
#define sz(a) (int)(a).size()
#define all(c) (c).begin(), (c).end()
#define TIMESTAMP fprintf(stderr, "Execution time: %.3lf s.\n", (double)clock()/CLOCKS_PER_SEC)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair <int, int> pii;
typedef vector <vi> vvi;
typedef vector <pii> vpii;
typedef vector <string> vs;

const int MAXN = 1e5 + 9;
const int MOD = (int)(1e9 + 7);
const int INF = 100500;

int di[] = {0, 1, 0, -1};
int dj[] = {1, 0, -1, 0};

ll dp[55][100 * 55];

void input() {
	int n, p;
	cin >> n >> p;
	vi aa(n + 1);
	ll ans = 0;	
	for(int i = 1; i <= n; i++) {
		cin >> aa[i];
	}
	dp[0][0] = 1;
	for(int i = 1; i <= n; i++) {
		for(int j = 100 * 55 - 1; j >= 0; j--) {
			dp[i][j] = dp[i - 1][j];
			if(aa[i] <= j) {
				dp[i][j] += dp[i - 1][j - aa[i]];
			}
		}
	}
	for(int i = 0; i < 100 * 55; i++) if(i % 2 == p) ans += dp[n][i];
	cout << ans;
}

void solve() {

}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#ifdef LOCAL
	freopen("xxx.in", "r", stdin);
	freopen("xxx.out", "w", stdout);
#else
	//freopen(TASK".in", "r", stdin);
	//freopen(TASK".out", "w", stdout);
#endif	
	input();
	solve();
#ifdef LOCAL
	TIMESTAMP;
#endif	
	return 0;
}

Measured memory_bytes: 2432
N,Y=map(int,input().split())
ichiman=0
gosen=0
sen=0
se_ichi=0
go_ichi=0
sen_go_ichi=0
mismatch=0
max_ichiman=int(2*(10**7)/(10**4))
for i in range(max_ichiman+1):
    if i*10**4==Y:
        ichiman=i
        break
    if i*10**4>Y:
        ichiman=i-1
        break
Y=Y-ichiman*10**4
for j in range(2+1):
    if j*5*10**3>Y:
        gosen=j-1
        break
Y=Y-gosen*5*10**3
for k in range(5):
    if k*10**3==Y:
        sen=k
min_N=ichiman+gosen+sen
if N-min_N<0:
    mismatch=1
#print(ichiman, gosen, sen,N)
for i2 in range(N-min_N+1):
    if N-min_N<0:
        mismatch=1
    if i2*9>N-min_N:
        se_ichi=i2-1
        break
N=N-se_ichi*9
for j2 in range(N-min_N+1):
    if N-min_N<0:
        mismatch=1
    if j2*5>N-min_N:
        sen_go_ichi=j2-1
        break
N=N-sen_go_ichi*5
for k2 in range(N-min_N+1):
    if N-min_N<0:
        mismatch=1
    if k2==N-min_N:
        go_ichi=k2
        break
N=N-go_ichi
if N-min_N<0:
    mismatch=1
#print(ichiman, gosen, sen,N)
ichiman=ichiman-se_ichi-sen_go_ichi-go_ichi
gosen=gosen+2*go_ichi+sen_go_ichi
sen=sen+5*sen_go_ichi+10*se_ichi

if sen|gosen|ichiman<0:
    mismatch=1
if mismatch==1:
    sen=-1
    ichiman=-1
    gosen=-1
#print(se_ichi,go_ichi,sen_go_ichi,mismatch)
print(ichiman, gosen, sen)

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

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

  for (int i = 0; i < 3; i++) {
    if (s[i] == s[i + 1]) {
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n=0,m;
  cin>>m;
  for(long long i=1;i<=m;i++){
    if(i%5!=0 && i%3!=0) n+=i;
  }
  cout<<n<<"\n";
  return(0);
}

Measured memory_bytes: 3624
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef  vector<int> vi;
typedef  pair<int,int> ii;
typedef  pair<int,string> pis;
double   pi=3.1415926535898;
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define lp(i,n)    for(int i=0;i<int(n);i++)
#define ff(i,a,b)  for(int i=a;i<=int(b);++i)
#define fr(i,a,b)  for(int i=a;i>=int(b);i--)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define r0         return 0;
#define CC         continue;
#define bb(x)      cerr<< x <<endl;
#define F          first
#define S          second       //  __builtin_popcount;
//freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
string ys = "Yes\n";
string no = "No\n" ;
const double EPS = 1e-6;
const int inf = 1<<20;
const ll M  = 1e9+7 ;
//const int N = 100100;
//////////////////////    Hi    ^_^  hack me if you can :P


int main()
{
    char c;
    while(cin >> c){
        if ( c == '9'){
            cout << ys ;
            return 0;
        }
    }
    cout << no;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef double ld;
const long long INF=(1LL<<62);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
const ll MOD = 4000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

std::vector<bool> IsPrime;

void sieve(size_t max){
    if(max+1 > IsPrime.size()){ 
        IsPrime.resize(max+1,true); 
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i)
        if(IsPrime[i])
            for(size_t j=2; i*j<=max; ++j) 
                IsPrime[i*j] = false;     
}

int main(){
	init();
	ll K,X;cin>>K>>X;
	if(500*K>=X)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,x;
  cin>>N>>x;
  
  vector<int> vec(N);
for (int i = 0; i < N; i++) {
  cin >> vec.at(i);}

  int d=0; int k=1;
  for(int i=0; i<N; i++){
    d=d+vec.at(i);
    if(d<=x){
      k++;}
    else{break;}
  }
  
  cout<<k<<endl;
}
    


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	/*#ifndef ONLINE_JUDGE
	freopen("input.txt","r", stdin);
	freopen("output.txt","w", stdout);
	freopen("error.txt","w", stderr);
	#endif*/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int n; cin>>n;
	ll ans = 0;
	for(int i = 1; i <= n; i++) {
		if(i%3 != 0 && i%5 != 0)
			ans += i;
	}	
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h> // {{{
// clang-format off
#define ARG4(_1, _2, _3, _4, ...) _4
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define REP(i, a) FOR(i, 0, a)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i, 0, a)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(n) ((ll)(1e##n))
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define USE1(T) template <typename T> inline
#define USE2(T, U) template <typename T, typename U> inline
#define mygc(c) (c) = getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
 
template<typename T> using vec = std::vector<T>;
template<typename T> using withi = std::pair<T, int>;
using ll = long long;
USE2(T,U)bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE2(T,U)bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE1(T=int)T in(){T x;std::cin>>x;return x;}
USE1(T=int)vec<T>in(int n){vec<T>v;v.reserve(n);rep(i,n)v.pb(in<T>());return v;}
USE2(T,U=withi<T>)vec<U>zipi(const vec<T>&x,int s=0){int N=x.size();vec<U>v;v.reserve(N);rep(i,N)v.pb(x[i],s+i);return v;}
USE1(T)vec<T>ndvec(T v,int n){return vec<T>(n,v);}
USE2(T,...Ts)auto ndvec(T v,int n,Ts...ns)->vec<decltype(ndvec(v,ns...))>{return ndvec(ndvec(v,ns...),n);}
USE1(T)void pr(T x){std::cout<<x<<'\n';}
USE2(T,...Ts)void pr(T x,Ts...xs){std::cout<<x<<' ';pr(xs...);}
USE1(T=int)T rd(){T x=0,m=0,k;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||'9'<k)break;x=x*10+k-'0';}return x;}
USE1(T=int)void wr(T x,char c='\n'){int s=0,m=0;char b[32];if(x<0)m=1,x=-x;for(;x;x/=10)b[s++]=x%10;if(!s)b[s++]=0;if(m)mypc('-');for(;s--;)mypc(b[s]+'0');mypc(c);}
// clang-format on
// }}}
struct IoSetup { // {{{
  IoSetup() {
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.precision(10);
    std::cerr.precision(10);
  }
} iosetup; //}}}
using namespace std;
const int inf = 1001001001;
const ll infl = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};

signed main() {
  int D, E;
  while (D = in(), E = in(), D || E) {
    double mini = 1e9;
    rep(y, D + 1) {
      int x = D - y;
      chmin(mini, abs(sqrt(y * y + x * x) - E));
    }
    pr(mini);
  }
  return 0;
}

Measured memory_bytes: 3244
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
int dp[3010][3010];
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;
	for (int i = 0; i < 3010; i++) {
		for (int j = 0; j < 3010; j++) {
			dp[i][j] = 0;
		}
	}
	dp[0][0] = 1;
	int j;
	for (int i = 0; i <= F; i++) {
		for (int j = 0; j <= F; j++) {
			if (dp[i][j] == 1) {
				if (i + 100 * A <= F) {
					dp[i + 100 * A][j] = 1;
				}
				if (i + 100 * B <= F) {
					dp[i + 100 * B][j] = 1;
				}
				if (i + C <= F && j + C <= F) {
					dp[i + C][j + C] = 1;
				}
				if (i + D <= F && j + D <= F) {
					dp[i + D][j + D] = 1;
				}
			}
		}
	}
	int mx1 = 100 * A;
	int mx2 = 0;
	for (int i = 1; i <= F; i++) {
		for (int j = 1; j <= F; j++) {
			if (dp[i][j] == 1) {
				if (i * E >= j * (100+E)) {
					if (i*mx2 <= j * mx1) {
						mx1 = i;
						mx2 = j;
					}
				}
			}
		}
	}

	cout << mx1 << " " << mx2 << endl;
}

Measured memory_bytes: 71040
def A_divide_B(a,b):
    d = int(a/b)
    r = int(a%b)
    f = round(float(a)/b,5)
    return d,r,f


def main():
    a, b= map(int, input().split())
    d,r,f = A_divide_B(a,b)
    print("%d %d %.5f"%(d,r,f))

if __name__ == "__main__":
    main()


Measured memory_bytes: 5624
package main

import "fmt"

const inf = 1 << 60
const mod int = 1e9 + 7

func main() {
	var n int
	fmt.Scan(&n)
	pf := make([]int, 1001)
	for i := 2; i <= n; i++ {
		x := i
		for j := 2; j*j <= n; j++ {
			for ; x%j == 0; x /= j {
				pf[j]++
			}
		}
		if x >= 2 {
			pf[x]++
		}
	}
	ans := 1
	for _, f := range pf[2:] {
		ans = ans * (f + 1) % mod
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
import math
A,B,H,M =map(int,input().split(" "))
h_deg = math.radians(30*H+0.5*M)
m_deg = math.radians(6*M)
hx_point = A*math.sin(h_deg)
hy_point = A*math.cos(h_deg)
mx_point = B*math.sin(m_deg)
my_point = B*math.cos(m_deg)
print(math.sqrt(abs(hx_point-mx_point)**2+abs(hy_point-my_point)**2))


Measured memory_bytes: 9504
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
//#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end());
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)
#define sz(x) ((ll)x.size())
const int M=1000000007;
const int MM=998244353;
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";

 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(m<=1)return 0;
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=5e5+5;

ll sp[N];

void fill(){
  for(int i=1;i<N;i++)sp[i]=i;

    for(int i=2;i<N;i++){
      for(int j=i;j<N;j+=i){
        if(sp[j]==j)sp[j]=i;
      }
    }
}

bool prime(ll x){
  if(x==2)return true;

for(ll i=2;i*i<=x;i++){
  if(x%i==0)return false;
}

  return true;
}

ll fac[N];

ll inv[N];

void gg(){
  fac[0]=inv[0]=1;

  for(int i=1;i<N;i++){
    fac[i]=fac[i-1]*i%M;
    inv[i]=powM(fac[i],M-2,M);
  }
}

ll c(ll a,ll b,ll M){
  if(b>a)return 0;

  return (fac[a]*inv[a-b]%M)*(inv[b])%M;
}


int main()
{ 

IOS;

ll n,k;
cin>>n>>k;

gg();


if(k>=n-1){
  cout<<c(2*n-1,n-1,M);
  return 0;
}

ll ans=0;



for(int i=0;i<=k;i++){
  ll temp=c(n,i,M)*c(n-1,i,M)%M;
  ans=(ans+temp)%M;
}

/*brief explanation:

 here, i denotes number of rooms with zero people.

 since this event is mutually exclusive for different

values of i in [0,k],we can simple add them

without worrying about overcounting.

now we now that sum of people is always n (const.)

if we take out i people from their rooms(in nCi ways),

then we can place them in the remaining

(n-i) rooms in (i+(n-i)-1)Ci ways (i.e (n-1)Ci) ways.

so all we need to do is take the summation of

nCi*((n-1)Ci) from i=0 to i=k.


*/

cout<<ans;

//end_routine();

return 0;
 
}


Measured memory_bytes: 11484
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INF = 1000000007;
const int mod = 1000000007;

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

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

int main()
{
    long long x, i = 0, sum = 0;
    cin >> x;
    while (sum < x)
    {
        i++;
        sum += i;
    }
    cout << i;
}


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

int main(void)
{
    long long N, K;
    cin >> N >> K;
    int digit = 1;
    long tmp = K;
    while (1) {
        if ((N / tmp) >= 1) {
            tmp *= K;
            digit++;
        }
        else {
            break;
        }
    }
    cout << digit << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>
#include <cstdlib>
using namespace std;

map<char, string> m1;
char m2[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-\'?";

string strToBitSeq(const string& str)
{
    string result;
    for(int i = 0; i < str.size(); ++i) result += m1[str[i]];
    if(result.size() % 5 != 0) result.append(5 - result.size() % 5, '0');
    return result;
}

string bitSeqToStr(const string& str)
{
    string result;
    for(int i = 0; i < str.size(); i += 5){
        result += m2[strtol(str.substr(i, 5).c_str(), NULL, 2)];
    }
    return result;
}

int main()
{
    m1[' '] = "101"; m1['\''] = "000000"; m1[','] = "000011"; m1['-'] = "10010001"; m1['.'] = "010001";
    m1['?'] = "000001"; m1['A'] = "100101"; m1['B'] = "10011010"; m1['C'] = "0101"; m1['D'] = "0001";
    m1['E'] = "110"; m1['F'] = "01001"; m1['G'] = "10011011"; m1['H'] = "010000"; m1['I'] = "0111";
    m1['J'] = "10011000"; m1['K'] = "0110"; m1['L'] = "00100"; m1['M'] = "10011001"; m1['N'] = "10011110";
    m1['O'] = "00101"; m1['P'] = "111"; m1['Q'] = "10011111"; m1['R'] = "1000"; m1['S'] = "00110";
    m1['T'] = "00111"; m1['U'] = "10011100"; m1['V'] = "10011101"; m1['W'] = "000010"; m1['X'] = "10010010";
    m1['Y'] = "10010011"; m1['Z'] = "10010000";
    
    string str;
    while(getline(cin, str)){
        cout << bitSeqToStr(strToBitSeq(str)) << endl;
    }
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
#define stop exit(0)
#define pb push_back
#define skip continue
#define ll long long
long long a,b,c,d=0,e=0,i,f=0,g=0,j,k=0,l=0,r,m,h[200001],p[200001],df[51];
string t,x,q,s;
double w;
vector<ll>dv[101],v,z;
vector<string>u;
map<string,ll>n;
set<ll>y;
void dfs(ll x){
    df[x]=1;
    for(ll i=0;i<dv[x].size();i++){
        if(dv[x][i]==0){
            dfs(dv[x][i]);
            df[dv[x][i]]=1;
        }
    }
}
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin>>a;
    h[0]=0;
    for(i=1;i<=a;i++){
        cin>>p[i];
        h[i]=h[i-1]+p[i];
    }
    d=0;
    for(i=a;i>=2;i--){
        d+=(p[i]*(h[i-1]%1000000007));
        d=d%1000000007;
    }
    cout<<d;
}

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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int n,m,x;cin>>n>>m>>x;
  int a[200];for(int i=0;i<m;i++)cin>>a[i];
  int t1=0, t2=0;
  for(int i=0;i<m;i++){
    if(a[i]<x)t1++;
    if(a[i]>x)t2++;
  }
  cout<<min(t1,t2)<<endl;

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
 
using namespace std;
 
int N;
int arr[100123];
int memo[100123];
 
int solve(int n) {
  if (n == N - 1) return 0;
  if (n == N - 2) return abs(arr[n] - arr[n + 1]);
  if (memo[n] != -1) return memo[n];
  int opt1 = abs(arr[n] - arr[n + 1]) + solve(n + 1);
  int opt2 = abs(arr[n] - arr[n + 2]) + solve(n + 2);
  return memo[n] = min(opt1, opt2);
}
int main() {
  ios_base::sync_with_stdio(false);
  memset(memo, -1, sizeof memo);
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> arr[i];
  
  int ans = solve(0);
  cout << ans << '\n';
}

Measured memory_bytes: 4224
A = list(map(int, input().split()))
N = A[0]
M = A[1]
 
# 偶数＋偶数
pattern_1 = N*(N-1)/2
 
# 奇数＋奇数
pattern_2 = M*(M-1)/2
 
print(int(pattern_1 + pattern_2))

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <queue>
using namespace std;

int main() {
    long long N,K,A;
    vector<long long> H;
    cin >> N >> K;
    H.reserve(N);
    for (auto i = 0; i < N; ++i) {
        cin >> A;
        H.push_back(A);
    }
    sort(H.begin(), H.end(), greater<long long>());
    long long res = 0;
    for (auto i = 0; i < N; ++i) {
        if (K > 0) {
            K --;
            continue;
        }
        res += H[i];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=b-1; (ll)(a)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};


int main(){
    string s, t;    cin >> s >> t;
    ll res = t.size();
    rep(i, s.size()){
        if(s.size()<i+t.size()) break;
        ll tmp=0;
        rep(j, t.size()){
            tmp += s[i+j] != t[j];
        }
        res = min(tmp, res);
    }
    cout << res << endl;
}


Measured memory_bytes: 3628
//BISMILLAHIR RAHMANIR RAHEEM
//ALLAH IS WATCHING ME
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cmath>
#include<iterator>
#include<cstdlib>
#define IOS   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test IOS long long t;cin >> t;while(t--)
#define ses   "\n"
#define whp   " "
#define mxi 200003
#define rep0(i,a,b) for(int i=a; i<b; i++)
#define rep1(i,a,b) for(int i=a; i<=b; i++)
#define rep0in(i,a,b) for(int i=a-1; i>=b; i--)
#define rep1in(i,a,b) for(int i=a; i>b; i--)
#define repv(i,a) for(auto i=a.begin(); i!=a.end();++i)
#define INF 0x3f3f3f3f
#define CLR(a,b) memset(a,b,sizeof(a));
#define PI acos(-1)
#define what_is(x) cout<<x<<ses;
//set <int, greater <int> > ::iterator it;
//vector<pair<int,int> >a;
//memset(arr,0,sizeof(hg));
//priority_queue <int, vector<int>, greater<int> > pq;
///  string single character erase-
///             s.erase(s.begin()+x); where s is st ring name
///               ans x is index;
///    transform(sl.begin(), sl.end(), sl.begin(), ::tolower);
///    transform(su.begin(), su.end(), su.begin(), ::toupper);
typedef long long v99;
typedef unsigned long long ull;
using namespace std;
v99 fx[4]= {1,-1,0,0};
v99 fy[4]= {0,0,1,-1};
v99 ox8[] = {0, 0, 1, 1, 1, -1, -1, -1};
v99 oy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
bool sort2val(const pair<int,int> &a,const pair<int,int> &b)
{
    if(a.second==b.second)return a.first<b.first;
    return a.second<b.second;
}
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
/**
bool prime[1000020];vector<v99>prm;
void SieveOfEratosthenes(v99 n)
{
	memset(prime, true, sizeof(prime));
	for(v99 i=4;i<=n;i+=2)prime[i]=false;
	for (v99 p=3; p*p<=n; p++)
	{
		if (prime[p] == true)
		{
			/// Update all multiples of p
			for (v99 i=p*p; i<=n; i += 2*p)
				prime[i] = false;
		}
	}
	rep1(i,2,n)if(prime[i])prm.push_back(i);

}*/
v99 pw(v99 a, v99 b)
{
	v99 ans = 1;
	for(v99 i = 1; i <= b; ++i)
		ans = (ans * a);
	return ans;
}

template <class T> inline T bigmod(T n,T p,T m)
{
    if(p==0)return 1;
    else if(p%2==0)
    {
        v99 val=bigmod(n,p/2,m);
        return (T)((val*val)%m);
    }
    else return (T)(((v99)n*(v99)bigmod(n,p-1,m))%m);
}


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



int main()
{

    //freopen("data.out","w",stdout);
    //test
    //while(1)
    {
        v99 n;map<string,v99>mpp;cin>>n;
        ///AC, WA, TLE, or RE
        rep0(i,0,n)
        {
            string s;cin>>s;
            mpp[s]++;
        }
        cout<<"AC x "<<mpp["AC"]<<ses;
        cout<<"WA x "<<mpp["WA"]<<ses;
        cout<<"TLE x "<<mpp["TLE"]<<ses;
        cout<<"RE x "<<mpp["RE"]<<ses;
    }
    return 0;
}





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

typedef vector<int> VI;
bool dp[301][601][301];

string rows[301];
string cols[301];

void buildPi(string& p, VI& pi)
{
  pi = VI(p.length());
  int k = -2;
  for(int i = 0; i < p.length(); i++) {
    while(k >= -1 && p[k+1] != p[i])
      k = (k == -1) ? -2 : pi[k];
    pi[i] = ++k;
  }
}

vector<int> KMP(string& t, string& p)
{
  VI pi;
  buildPi(p, pi);
  vector<int> ans;
  int k = -1;
  for(int i = 0; i < t.length(); i++) {
    while(k >= -1 && p[k+1] != t[i])
      k = (k == -1) ? -2 : pi[k];
    k++;
    if(k == p.length() - 1) {
      ans.push_back(i-k);
      k = (k == -1) ? -2 : pi[k];
    }
  }
  return ans;
}
int main(){
	int N;cin>>N;
	for(int i=0;i<N;i++) cin>>rows[i];
	for(int i=0;i<N;i++){
		string s;
		for(int j=0;j<N;j++) s += rows[j][i];
		s = s + s;
		cols[i] = s;
	}
	
	for(int i=0;i<N;i++) for(int j=0;j<N;j++){
		auto ret = KMP(cols[j],rows[i]);
		for(auto x: ret) dp[i][j][x] = dp[i][j+N][x] = true;
	}
	
	int total = 0;
	for(int a=0;a<N;a++) for(int b=0;b<N;b++){
		int dx = (a-b+N)%N,dy = (b-a+N)%N;
		bool possib = true;
		for(int i=0;i<N;i++) if(!dp[i][i+dx][dy]){
			possib = false;
			break;
		}
		if(possib) total += 1;
	}
	cout<<total<<endl;
}


Measured memory_bytes: 53760
#include "bits/stdc++.h"

#pragma warning(disable:4996)
using namespace std;
using ld=long double;
ld eps=1e-9;

struct Edge {
	int from;
	int to;
	long long int val;
};

struct Status {
	int now;
	int hot;
	int rest;
	long long int cost;
};
bool operator<(const Status&l, const Status&r) {
	return l.cost>r.cost;
}

void add_edge(vector<vector<Edge>>&graph,int a, int b, int c) {
	graph[a].push_back(Edge{ a,b,c });
	graph[b].push_back(Edge{ b,a,c });
}

long long int value(const long long int sa, const long long int S, const long long int T) {
	if (sa > 0) {
		return - sa*S;
	}
	else {
		return - sa*T;
	}
}

int main() {
	int N,Q;cin>>N>>Q;
	long long int S,T;cin>>S>>T;
	long long int pre;
	vector<long long int>sas;
	long long int ans=0;
	for (int i = 0; i <= N; ++i) {
		long long int h;cin>>h;
		if (i) {
			long long int sa=h-pre;
			ans+=value(sa,S,T);
			sas.push_back(sa);
		}
		pre=h;
	}
	sas.push_back(0);
	while (Q--) {
		int a,b;cin>>a>>b;
		long long int t;cin>>t;

		a--;
		ans-=value(sas[a],S,T);
		if(b!=N)ans-=value(sas[b],S,T);

		sas[a]+=t;
		if(b!=N)sas[b]-=t;

		ans+=value(sas[a],S,T);
		if(b!=N)ans+=value(sas[b],S,T);

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


Measured memory_bytes: 4968
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
//#define MOD (ll)(998244353)
#define MOD (ll)(1e9+7)
#define INF (1e17)
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	b%=MOD;
	int ans=1;
	while(p>0){
		if(p&1) ans=(ans*b)%MOD;
		p/=2;
		b=(b*b)%MOD;
	}
	return ans;
}

int32_t main() {
#ifdef LOCAL_TEST
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\input.in","r",stdin);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\output.out","w",stdout);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	//code...
	int a,b,c; cin>>a>>b>>c;
	if(a+b+c>=22) cout<<"bust\n";
	else cout<<"win"<<"\n";
	return 0;
}


Measured memory_bytes: 256
// 

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

int N;

int main() {
    cin >> N;
    int a[N + 1];
    int b[N + 1];
    int count = 0;
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
        if (N / 2 < i) {
            if (a[i] == 1) {
                count++;
            }
            b[i] = a[i];
        }
    }

    for (int i = N / 2; 0 < i; i--) {
        int tmp = a[i];
        for (int j = 2 * i; j <= N; j += i) {
            tmp ^= b[j];
        }
        b[i] = tmp;
        if (b[i] == 1) {
            count++;
        }
    }

    cout << count << endl;

    int printCount = 0;
    for (int i = 1; i <= N; i++) {
        if (b[i] == 1) {
            printCount++;
            if (printCount == count) {
                cout << i << endl;
            } else {
                cout << i << " ";
            }
            
        }
    }


    return 0;
}

// 10
// 1 0 1 1 0 1 0 1 1 0

Measured memory_bytes: 2432
#-*- coding:utf-8 -*-

N, M = map(int, input().split())
hsh = {}
for i in range(M):
    hsh[int(input())] = True

acc = [0 for _ in range(N+1)]
acc[0] = 1
if 1 in hsh:
    acc[1] = 0
else:
    acc[1] = 1

for i in range(2,N+1):
    if i-2 in hsh:  # 2段前が穴
        if i-1 in hsh: # 1段前が穴
            d = 0
        else:
            d = acc[i-1]
    else:  # 2段前が穴ではない
        if i-1 in hsh:  # 1段前が穴
            d = acc[i-2]
        else: 
            d = acc[i-1] + acc[i-2]
    acc[i] = d

# print(hsh)
# print(acc)
print(acc[-1]%1000000007)


Measured memory_bytes: 460056
using static System.Console;

class Program {
	static void Main() {
		var A = ReadLine();
		var B = ReadLine();
		WriteLine(new string[] { "GREATER", "LESS", "EQUAL" }[Judge(A, B)]);
	}

	static int Judge(string A, string B) {
		if (A.Length > B.Length) {
			return 0;
		} else if (A.Length < B.Length) {
			return 1;
		} else {
			for (var i = 0; i < A.Length; i++) {
				if (A[i] > B[i]) {
					return 0;
				}
				if (B[i] > A[i]) {
					return 1;
				}
			}
		}
		return 2;
	}
}


Measured memory_bytes: 11092
#include<stdio.h>
int main()
{
    long long int a,b,x,y,p;
    scanf("%lld %lld",&a,&b);
    if(a>=b)
    {
        x=a; y=b;
    }
    else
    {
        x=b; y=a;
    }
    p=x-y;
    if(p%2!=0) printf("IMPOSSIBLE\n");
    else printf("%lld\n",(p/2)+y);
}


Measured memory_bytes: 128
#include <iostream>

int main()
{
	int n, x;
	while (std::cin >> n >> x) {
		if (!n && !x) {
			break;
		}
		int c = 0;
		for (int i = 1; i <= n; ++i) {
			for (int j = i + 1; j <= n; ++j) {
				for (int k = j + 1; k <= n; ++k) {
					if (x - i - j - k == 0) {
						c++;
					}
				}
			}
		}
		std::cout << c << std::endl;
	}

	return 0;
}


Measured memory_bytes: 3124
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	N := sc.nextInt()
	d := sc.nextIntSlice(N)
	sum := 0
	for i := 0; i < N; i++ {
		for j := i + 1; j < N; j++ {
			sum += d[i] * d[j]
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, Npow, divisor, modinv, bitSearch, bitList, dfs, bfs//
//dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z;
ll MOD = 1000000007; ll INF = 1LL << 60; ll ans = -INF; ll z = 0, o = 1;
vl flag, color, D; vector<vector<tuple<ll, ll, ll>>> path;
//***********//
vl bitList(ll n, ll k, ll f) {
	vl bitList(k);
	for (ll i = 0; i < k; i++) {
		bitList[i] = f % n;
		f /= n;
	}
	return bitList;
}
int main() {
	cin >> N;
	vll F(N, vl(10, 0));
	for (i = 0; i < N; i++) {
		for (j = 0; j < 10; j++) {
			cin >> F[i][j];
		}
	}
	vll P(N, vl(11, 0));
	for (i = 0; i < N; i++) {
		for (j = 0; j < 11; j++) {
			cin >> P[i][j];
		}
	}
	for (i = 1; i < pow(2,10); i++) {
		ll pre = 0;
		vl Q = bitList(2, 10, i);
		for (j = 0; j < N; j++) {
			ll count = 0;
			for (k = 0; k < 10; k++) {
				if (Q[k] && F[j][k]) count++;
			}
			pre += P[j][count];
		}
		ans = max(ans, pre);
	}
	cout << ans;
}


Measured memory_bytes: 256
#![allow(dead_code, unused_imports, deprecated)]
use std::cmp::{max, min, Reverse};

use proconio::input;
use proconio::marker::*;
use proconio::fastout;

const INF: usize = 1_000_000_007;

#[fastout]
fn solve() {
  input!{
    n: usize,
    a: [i64; n],
  };

  let mut a = a
    .iter()
    .enumerate()
    .collect::<Vec<_>>();
  a.sort_by_key(|&(i, &x)| Reverse(x));
  let mut dp = vec![vec![0i64; n + 1]; n + 1];
  dp[1][1] = a[0].0 as i64 * a[0].1;
  dp[1][0] = (n as i64 - 1 - a[0].0 as i64) * a[0].1;
  for k in 2..=n {
    for l in 0..=k {
      let r = k - l;
      
      let mut act = vec![];
      
      if l > 0 {
        act.push(dp[k - 1][l - 1] + ((l - 1) as i64 - a[k - 1].0 as i64).abs() * a[k - 1].1);
      }
      if l < k {
        act.push(dp[k - 1][l] + ((n - r) as i64 - a[k - 1].0 as i64).abs() * a[k - 1].1);
      }
      dp[k][l] = *act.iter().max().unwrap();
    }
  }
  
  println!("{}", dp[n].iter().max().unwrap());
}

fn main() {
  std::thread::Builder::new()
    .name("big stack size".into())
    .stack_size(32 * 1024 * 1024)
    .spawn(|| {
      solve();
    })
    .unwrap()
    .join()
    .unwrap();
}

Measured memory_bytes: 32504
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define fio() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define MOD 1000000007
#define nl '\n'
#define pb push_back
#define mp make_pair

using namespace std;
const int N = 3005;
int32_t main()
{
	fio();
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	int mex[k+1];
	mex[0]=0;
	for(int i=1;i<=k;i++)
	{
		set<int> st;
		for(int j=0;j<n;j++)
			if(i-a[j]>=0)
				st.insert(mex[i-a[j]]);
		int j=0;
		auto it=st.begin();
		while(it!=st.end())
		{
			if((*it)!=j)
			{
				mex[i]=j;
				break;
			}
			it++;
			j++;
		}
		if(it==st.end())
			mex[i]=j;
	}
	if(mex[k]>0)
		cout<<"First";
	else
		cout<<"Second";
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;

void solve(long long X){
    int k=0,frag=0,kk=0;
for(ll i=0; i<1000; i++){
        ll a=(i*i*i*i*i);
    for(ll j=1; j<500; j++){
        ll b=((i-j)*(i-j)*(i-j)*(i-j)*(i-j));
        if(a-b==X){
            k=b;
            cout<< i << " " << i-j <<endl;
            break;
   }     
    }
    if(a-k==X){
        frag=1;
        break;
    }

}
for(ll i=-250; i<1; i++){
    if(frag=1)break;
    ll aa=(i*i*i*i*i);
    for(ll j=1; j<500; j++){
        ll bb=((i-j)*(i-j)*(i-j)*(i-j)*(i-j));
        if(aa-bb==X){
            kk=bb;
            cout<< i << " " << i-j <<endl;
            break;
   }     
    }
    
    if(aa-kk==X)break;

}
}


int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


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

int seiyaku_check(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	
	int a,b,c,d,e;
	cin >> a;
	
	seiyaku_check(a,1,100);
	
	cout << 3*a*a << endl;
	
	
return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            Solve();
        }
        private const long MOD = 1000000007;
        
        static void Solve()
        {
            var o = ReadAndParseLongArr();
            long a = o[0];
            long b = o[1];
            long x = o[2];

            long ans = GetTotal(b, x) - GetTotal(a - 1, x);
            Console.WriteLine(ans);
        }
        private static long GetTotal(long n, long x)
        {
            if( n >= 0)
            {
                return n / x + 1;
            }
            else
            {
                return 0;
            }
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 11092
#include <string>
#include <algorithm>
#include <vector> 
#include <math.h>
#include <iostream>
using namespace std;

int uc(int x, int y) {
	int r = max(x, y);
	y = min(x, y);
	x = r;
	r = y;
	while (1) {
		r = x % y;
		x = y;
		y = r;

		if (r == 0) {
			break;
		}
	}

	return x;
}

int main()
{
	int n;
	cin >> n;
	vector<int> a;
	int q;
	for (int i = 0; i < n; i++) {
		cin >> q;
		a.push_back(q);
	}
	
	q = a[0];
	for (int i = 0; i < n - 1; i++) {
		q = uc(q, a[i + 1]);
	}
	
	cout << q << endl;

	return 0;

}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

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

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

	ll k, a, b;

	cin >> k >> a >> b;

	ll bis = 1;
	ll cost;
	ll unexchanged = 1 + k;

	while (k) {
		if (a <= bis) cost = 2;
		else cost = (a - bis) + 2;
	    
		if (cost <= k) {
			k -= cost;

			if (a <= bis) bis -= a;
			else bis = 0;

			bis += b;
		} else {
			break;
		}
	}

	bis += k;

	Out(max(bis, unexchanged));
	
	return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class CTypicalStairs {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            long mod = 10000_0000_7;
            long dp[] = new long[n + 1];
            dp[0] = 1;
            HashSet<Integer> hs = new HashSet<>();
            for (int i = 0; i < m; i++) hs.add(in.nextInt());
            if (!hs.contains(1)) dp[1] = 1;
            for (int i = 2; i <= n; i++) if (!hs.contains(i)) dp[i] = (dp[i] + dp[i - 1] + dp[i - 2] + mod) % mod;
            out.println(dp[n]);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

int main(void){
    int n, ans = 0; cin >> n;
    vector<int> v(n);
    for(int i=0; i<n; i++) cin >> v[i];
    sort(v.begin(), v.end());
    for (int i = 0; i < n; i++)
    {
        for (int j = i; j < n; j++)
        {
            for (int k = j; k < n; k++)
            {
                if(v[i] != v[j] and v[j] != v[k] and (v[i]+v[j]) > v[k]){
                    ans++;
                }
            }
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 3632