akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

/*
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("-O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define md(l, r) l + (r - l) / 2
#define ll long long
#define btw(a, l, r) a.begin() + l, a.begin() + r + 1
#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) (int(x.size()))
#define sqr(x) (x) * (x)
#define endl '\n'

#define getfiles ifstream cin("input.txt"); ofstream cout("output.txt");
#define clr(x, y) memset((x), (y), sizeof (x))
#define ld long double

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<vector<pair<int, int> > > vvpii;
typedef pair<int, pair<int, int> > piii;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef vector<pair<ll, pair<ll, ll> > > vplll;

const ld eps = -1e9;
const long long N = 200001, P = 1e9 + 7, P1 = 1e9 + 13, iINF = INT_MAX, INF = 2e9, K = 73, K1 = 79;

ll dstF(ll x, ll y, ll xx, ll yy) {
    return (sqr(x - xx) + sqr(y - yy));
}

ld dstSqrtF(ll x, ll y, ll xx, ll yy) {
    return (sqrt(sqr(x - xx) + sqr(y - yy)));
}

ll _bp(ll val, ll st, ll p) {
    if (st == 0) {
        return 1;
    }
    ll temp = _bp(val, st / 2, p);
    temp = sqr(temp);
    temp %= p;
    if (st % 2 == 1) {
        temp *= val;
        temp %= p;
    }
    return temp;
}

ll _bp(ll val, ll st) {
    if (st == 0) {
        return 1;
    }
    ll temp = _bp(val, st / 2);
    temp = sqr(temp);
    if (st % 2 == 1) {
        temp *= val;
    }
    return temp;
}

ll nok(ll a, ll b) {
    return (a / __gcd(a, b) * b);
}

/*
ll fact[N];

void buildFacts(ll n, ll p) {
    fact[0] = 1;
    for (ll i = 1; i <= n; i++) {
        fact[i] = (fact[i - 1] * i) % p;
    }
}

ll C(ll n, ll k, ll p = -1) {
    if (p == -1) {
        ll x = fact[n];
        ll y = (fact[k] * fact[n - k]);
        return (x / y);
    } else {
        ll x = fact[n];
        ll y = (fact[k] * fact[n - k]) % p;
        x = (x * _bp(y, p - 2, p)) % p;
        return x;
    }
}
*/

long long a;

void solve() {
    cin >> a;
    cout << a + a * a + a * a * a;
}

signed main() {
    fast_io;
    int q;
    q = 1;
    //cin >> q;
    while (q != 0) {
        solve();
        --q;
    }
}

/*
adsdads
*/



Measured memory_bytes: 3692
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 1> { using type = vector<T>; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  ll N;
  while (cin >> N) {
    if (N == 0) {
      cout << "0" << endl;
      continue;
    }
    string res = "";
    while (N != 0) {
      if (abs(N) % 2 == 1) {
        res += '1';
        --N;
      } else {
        res += '0';
      }
      N /= -2;
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String []args){
		//????????£?????????????????????
		Scanner sc = new Scanner(System.in);

		int A = 0;
		//??°?????????
		while(true){
			//?????????????????? ????????????
			String cardword = sc.next();
			//"-"?????\?????????????????????
			if(cardword.equals("-")){
				break;
			}
			//??°??????????????°????????????
			int n = sc.nextInt();



			//????????°????????????
			for(int i = 0;i < n; i++){
				//????????????????????????
				A = sc.nextInt();
				cardword = cardword.substring(A)+cardword.substring(0,A);
			}
			System.out.println(cardword);
		}
	}
}

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

typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;

    vector<int> p(n);
    vector<double> t(n);

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

        t[i] = p[i] * (p[i] + 1) / 2.0 / p[i];
    }

    double best = 0.0, cur = 0.0;

    for(int i = 0; i < n; i++) {
        cur += t[i];
        if(i >= k) cur -= t[i - k];

        best = max(best, cur);
    }

    printf("%0.12f\n", best);
}


Measured memory_bytes: 2560
n, m = map(int,input().split())
lst = []
for _ in range(m):
    lst.append(list(map(int,input().split())))

number = [[] for _ in range(n)]
for v in lst:
    keta,num = v[0]-1,v[1]
    if number[keta] == []:
        number[keta] = num

    if number[keta] != num:
        print(-1)
        exit()

if n == 1:
    if not number[0]:
        print(0)
    else:
        print(''.join([str(i) for i in number]))
elif n == 2:
    if number[0] == 0:
        print(-1)
        exit()
    else:
        if not number[0]:
            number[0] = 1
        if not number[1]:
            number[1] = 0
        print(''.join([str(i) for i in number]))
else:
    if number[0] == 0:
        print(-1)
        exit()
    else:
        if not number[0]:
            number[0] = 1
        if not number[1]:
            number[1] = 0
        if not number[2]:
            number[2] = 0
        print(''.join([str(i) for i in number]))


Measured memory_bytes: 9224
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void) {
	int N;
	cin >> N;
	string str;
	cin >> str;
	vector<int> east(N),west(N);
	east[0] = west[N-1] = 0;
	for (int i = 1; i < N; ++i) {
		if (str[i-1] == 'W') {
			east[i] = east[i-1] + 1;
		}
		else {
			east[i] = east[i-1];
		}

		if (str[N-i] == 'E') {
			west[N-i-1] = west[N-i] + 1;
		}
		else {
			west[N-i-1] = west[N-i];
		}
	}

	int res = N;
	for (int i = 0; i < N; ++i) {
		res = min(res,east[i]+west[i]);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3076
//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define minval -2e9
#define maxval 2e9
long double PI =3.14159265358979323846;
 
const ll M=1e9+7;
const ll inf=1e18;
const ll ms=2e5+5;
fast;
bool com(pi &a,pi&b)
{
       return a.first-a.second>b.first-b.second;
}

void solve()
{
    ll n;cin>>n;
    for(ll i=-118;i<=119;i++)
    {
        ll a=pow(i,5),b;
        for(ll j=-119;j<=118;j++)
        {
            b=pow(j,5);
            if(a-b==n)
                {cout<<i<<" "<<j<<endl;return;}
            else if(b-a==n)
                {cout<<j<<" "<<i<<endl;return;}
                
        }
    }
}
int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    //int t;cin>>t;while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 4088
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <regex>
#include <stack>
#include <queue>
#include <vector>
#define MAX_N 100
#define INF 10000000

using namespace std;

int n,m;
int a[200000];

void solve() {
	int x, y, z;
	x = n + m;
	y = n - m;
	z = n*m;
	int ans = max(x, max(y, z));
	cout<< ans << endl;
}

int main() {
	cin >> n >> m;
	solve();
	return 0;
}

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

int main() {
    int a, b, c; cin >> a >> b >> c;
    int ans = 0;
    
    for(int i=a; i<=b; i++) {
        if(c%i==0) ans++;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3124
/**
 *    author:  tourist
 *    created: 17.12.2019 17:41:54       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, w;
  cin >> n >> w;
  vector<long long> dp(w + 1, 0);
  while (n--) {
    int x, y;
    cin >> x >> y;
    for (int i = w - x; i >= 0; i--) {
      dp[i + x] = max(dp[i + x], dp[i] + y);
    }
  }
  cout << dp.back() << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <ctype.h>

int main(void) {
	int iguti_yuka;
	int sakurai_takahiro[26] = {0};
	while ((iguti_yuka = getchar()) != EOF) {
		int kosimizu_ami = (tolower(iguti_yuka) - 'a');
		if (0 <= kosimizu_ami && kosimizu_ami < 26) sakurai_takahiro[kosimizu_ami]++;
	}
	for (iguti_yuka = 0; iguti_yuka < 26; iguti_yuka++) {
		printf("%c : %d\n", iguti_yuka + 'a', sakurai_takahiro[iguti_yuka]);
	}
	return 0;
}




Measured memory_bytes: 2112
R, G, B, N = map(int, input().split())

ans = 0
for r in range(3001):
    for g in range(3001):
        tmp = (R*r+G*g)
        if tmp > N:
            break

        if (N-tmp) % B == 0 or tmp == N:
            ans += 1
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <ctime>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <assert.h>
#include <iomanip>
#include <bitset>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define inf 1000000007
#define mod 1000000007
#define x first
#define y second
#define pi acos(-1.0)
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";

#define FOREACH(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define ull unsigned long long
#define ll long long
#define N 1000005

template <class T,class U>inline void Max(T &a,U b){if(a<b)a=b;}
template <class T,class U>inline void Min(T &a,U b){if(a>b)a=b;}

//FILE* outFile;

inline void add(int &a,int b){a+=b;while(a>=mod)a-=mod;}
inline int gcd(int a, int b){if(b == 0)return a; return gcd(b, a%b);}
int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=ans*(ll)a%mod;
        a=(ll)a*a%mod;b>>=1;
    }
    return ans;
}

const int M = 11;
ll a[11][11], f[11];
int id[11];
int main(){
    int j,k,i,T,ca=0, m = 0, K = 0, n;
    scanf("%d", &n);
    f[0] = 1, f[1] = 2;
    map<int, int>use;
    rep(i, 2, M){
        rep(j, 0, i){
            use[f[j]] = 1;
            rep(k, 0, j)use[f[j] + f[k]] = 1;
        }
        f[i] = 3;
        while(1){
            int ok = !use[f[i]];
            rep(j, 0, i)ok &= !use[f[j] + f[i]];
            if(ok)break;
            f[i]++;
        }
    }
    ll mul = 1;
    rep(i, 1, M){
        rep(j, 0, i)a[i][j] = a[j][i] = f[j] * mul;
        if(i==1)mul <<= 1;
        else{
            mul *= f[i-2] + f[i-1];
            mul++;
        }
    }
    /*
    map<ll, int>cnt;
    int ok = 0;
    ll mx = 1e11;
    rep(i, 0, n)id[i] = i;
    ok = 1;
    do{
        ll sum = 0;
        rep(i, 1, n){
            sum += a[id[i-1]][id[i]];
        }
        cnt[sum]++;
        if(cnt[sum] > 2 || sum > mx){ok = 0;break;}
    }while(next_permutation(id, id+n));
    */
    rep(i, 0, n){
        rep(j, 0, n)printf("%lld ", a[i][j]);
        puts("");
    }
}




Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
// #include<cmath>
// #include<cstdio>
// #include<cctype>
// #include<cstring>
// #include<iomanip>
// #include<iostream>
// #include<algorithm>
using namespace std;
#define maxn 200010
#define maxm 2000010
#define ll long long
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define rint register ll
#define uint unsigned ll
#define pir pair <ll ,ll >
#define ull unsigned long long

#define fir first
#define sec second
#define LS(x) ((x)<<1)
#define RS(x) ((x)<<1|1)
#define lowbit(i) (i&-i)
#define MID(l,r) ((l)+(r)>>1)

const ll INF=4e18;
const int BASE=131;
const double eps=1e-8;
const int mod=998244353;
const int inf=1061109567;
const double pi=acos(-1);
const int inv2=(mod+1)>>1;

namespace Math{

	inline ll popcount(ll x){
		x = (x&0x55555555) + ((x>>1)&0x55555555);
		x = (x&0x33333333) + ((x>>2)&0x33333333);
		x = (x&0x0F0F0F0F) + ((x>>4)&0x0F0F0F0F);
		x = (x&0x00FF00FF) + ((x>>8)&0x00FF00FF);
		x = (x&0x0000FFFF) + ((x>>16)&0x0000FFFF);
		return x;
	}

	inline ll F(ll x,ll p){return x>=p?x-p:x;}
	inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
	inline ll ksm(ll x,ll t,ll p){
		ll res=1;while(t){
			if(t&1)res=1LL*res*x%p;
			x=1LL*x*x%p;t>>=1;
		}return res;
	}
	
}

using Math::popcount;
using Math::ksm;
using Math::F;

template < typename tp >
inline void read ( tp & dig ) {
	char ch=getchar();ll flag=0;dig=0;
	while(!isdigit(ch)){ if(ch=='-')flag=1;ch=getchar(); }
	while(isdigit(ch))dig=dig*10+ch-'0',ch=getchar();
	if(flag)dig=-dig;
}

template < typename tp , typename ...Args >
inline void read ( tp & dig , Args & ...args ){
	read(dig);read(args...);
}

int n,m,X,Y,lnum,flag,vis[maxn],stk[maxn];
int fst[maxn],nxt[maxn],to[maxn];
ll ans,a[maxn],k[maxn],b[maxn];

inline void add_edge(int u,int v){
    nxt[++lnum]=fst[u];fst[u]=lnum;to[lnum]=v;
    nxt[++lnum]=fst[v];fst[v]=lnum;to[lnum]=u;
}

inline void dfs(int u,int fa){
    a[u]=a[fa]^1;vis[u]=1;
    for(int i=fst[u];i;i=nxt[i]){
        if(to[i]==fa)continue;
        if(vis[to[i]]){
            if(a[u]^a[to[i]])flag=1;
            X=u,Y=to[i];continue;
        }dfs(to[i],u);
    }
}

inline void Dfs(int u,int fa){
    for(int i=fst[u];i;i=nxt[i]){
        if(to[i]==fa||(X==u&&Y==to[i])||(X==to[i]&&Y==u))continue;
        Dfs(to[i],u);k[u]+=k[to[i]];b[u]+=b[to[i]];
    }
}

int main()
{

    read(n);read(m);
    if(n&1){printf("-1\n");return 0;}
    for(int i=1,x,y;i<=m;++i){
        read(x);read(y);
        add_edge(x,y);
    }dfs(1,0);int tot=0;
    for(int i=1;i<=n;++i)
        b[i]=(a[i]?1:-1),tot+=b[i];
    if(m<n){
        if(tot){printf("-1\n");return 0;}
    }else {
        if(!flag){
            if(tot&1){printf("-1\n");return 0;}
            b[X]-=tot>>1,b[Y]-=tot>>1;
            ans+=abs(tot>>1);
        }else {
            if(tot){printf("-1\n");return 0;}
            k[X]=1,k[Y]=-1;
        }
    }Dfs(1,0);
    for(int i=1;i<=n;++i)
        if(!k[i])ans+=abs(b[i]);
        else stk[++stk[0]]=b[i];
    stk[++stk[0]]=0;
    sort(stk+1,stk+stk[0]+1);
    for(int i=1;i<=stk[0];++i)
        ans+=abs(stk[i]-stk[stk[0]+1>>1]);
    printf("%lld\n",ans);
    return 0;

}

Measured memory_bytes: 10112
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

int get_gcd(int a, int b) {
    if (a < b)
        std::swap(a, b);
    int r;
    while (1) {
        r = a % b;
        if (r == 0) {
            return b;
        } else {
            a = b;
            b = r;
        }
    }
}

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

    int n, k;
    cin >> n >> k;
    std::vector<int> ball;
    int m1;
    bool is_ok = false;
    for (int i = 0; i < n; i++) {
        cin >> m1;
        ball.push_back(m1);
    }
    std::sort(ball.begin(), ball.end());
    int max = *(ball.end() - 1);
    if (max < k) {
        is_ok = false;
    } else if (max == k) {
        is_ok = true;
    } else {
        int min = *(ball.begin());
        int gcd = ball[0];
        for (int i = 1; i < n; i++) {
            gcd = get_gcd(gcd, ball[i]);
        }
        if (k % gcd == 0) {
            is_ok = true;
        } else {
            is_ok = false;
        }
    }

    if (is_ok) {
        cout << "POSSIBLE" << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

ll X,Y,Z,K;
vector<ll> A,B,C;

int main ()
{
    cin >> X >> Y >> Z >> K;
    
    REP(i,X) {
        ll t; cin >> t;
        A.push_back(t);
    }
    REP(i,Y) {
        ll t; cin >> t;
        B.push_back(t);
    }
    REP(i,Z) {
        ll t; cin >> t;
        C.push_back(t);
    }

    sort(A.begin(), A.end(), [](const ll &a, const ll &b){return a > b;});
    sort(B.begin(), B.end(), [](const ll &a, const ll &b){return a > b;});
    sort(C.begin(), C.end(), [](const ll &a, const ll &b){return a > b;});

    priority_queue<tuple<ll, ll, ll, ll>> que;
    que.push(make_tuple(A[0] + B[0] + C[0], 0, 0, 0));
    set<tuple<ll,ll,ll>> used;
    used.insert(make_tuple(0, 0, 0));

    vector<ll> cnd;
    for (int i = 0; i < K; i++) {
        ll sum,idx1,idx2,idx3;
        tie(sum, idx1, idx2, idx3) = que.top();
        que.pop();
        cnd.push_back(sum);
        if (idx1 + 1 < A.size()) {
            if (used.find(make_tuple(idx1 + 1, idx2, idx3)) == used.end()) {
                used.insert(make_tuple(idx1 + 1, idx2, idx3));
                que.push(make_tuple(A[idx1 + 1] + B[idx2] + C[idx3], idx1 + 1, idx2, idx3));
            }
        }
        if (idx2 + 1 < B.size()) {
            if (used.find(make_tuple(idx1, idx2 + 1, idx3)) == used.end()) {
                used.insert(make_tuple(idx1, idx2 + 1, idx3));
                que.push(make_tuple(A[idx1] + B[idx2 + 1] + C[idx3], idx1, idx2 + 1, idx3));
            }
        }
        if (idx3 + 1 < C.size()) {
            if (used.find(make_tuple(idx1, idx2, idx3 + 1)) == used.end()) {
                used.insert(make_tuple(idx1, idx2, idx3 + 1));
                que.push(make_tuple(A[idx1] + B[idx2] + C[idx3 + 1], idx1, idx2, idx3 + 1));
            }
        }
    }

    sort(cnd.begin(), cnd.end(), [](const ll &a, const ll &b){return a > b;});
    for (auto x: cnd) {
        cout << x << endl;
    }

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;

int N;

bool isPrime(int n) {
    for (int i = 2; i*i <= n; i++) {
        if (n % i == 0) return false;
    }
    return true;
}

vector<int> getPrimes(int N) {
    vector<int> ret;
    int tr = 11;
    while (ret.size() != N) {
       if (isPrime(tr)) ret.push_back(tr);
       tr += 10;
    }
    return ret;
}

int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> N;
    vector<int> primes = getPrimes(N);
    for (int i: primes) {
        cout << i << ' ';
    }



    return 0;
}


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


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>

ll n, s[2100], ans;
int main() {
	cin >> n;
	REP(i, n)cin >> s[i];
	sort(s, s + n);
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
				if (s[i] + s[j] <= s[k])break;
				ans++;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>
#include<numeric>

#define pb push_back
#define mp make_pair
#define all(a)  (a).begin(),(a).end()
#define dwn(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;
const ll inf = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int main() {
	int k, t;
	cin >> k >> t;
	vector<int> a(t);
	int ma = 0;
	rep(i, t) {
		cin >> a[i];
		ma = max(ma, a[i]);
	}
	cout << max(ma - 1 - (k - ma), 0) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.*
import java.util.*

var pw = PrintWriter(System.out)
fun solve(A: Long, B: Long, C: Long){
    pw.println(Math.min(C, B / A))
    pw.flush()
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val A = sc.next().toLong()
    val B = sc.next().toLong()
    val C = sc.next().toLong()
    solve(A, B, C)
}



Measured memory_bytes: 31400
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long X = scanner.nextLong();
        long Y = scanner.nextLong();
        int cnt = 0;
        long now = X;
        while (now <= Y) {
            cnt++;
            now *= 2;
        }
        System.out.println(cnt);
    }
}

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

const int N = 2e6;

pair <int, int> p[N];

int main() {
	clog << "Ready\n";
	int n, t;
	cin >> n >> t;
	for (int i = 1; i <= n; ++ i) {
		cin >> p[i].first >> p[i].second;
	}
	sort(p + 1, p + 1 + n);
	for (int i = 1; i <= n; ++ i) {
		if (p[i].second <= t)
			return cout << p[i].first, 0;
	}
	cout << "TLE";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>

using namespace std;
vector<int> prime;
bool isPrime[1000001];
bool dp[1000001];
vector<int> price;

void PrimeCalc()
{
	memset(isPrime, 1, sizeof(isPrime));
	isPrime[0] = isPrime[1] = false;
	for(int i = 2; i < 1000001; ++i)
	{
		if(isPrime[i])
		{
			for(int j = 2 * i; j < 1000001; j += i)
			{
				isPrime[j] = false;
			}
		}
	}
}

void solve()
{
	PrimeCalc();
	int n, x;
	while(cin >> n >> x, n || x)
	{
		price.clear();
		price.resize(n);
		for(int i = 0; i < n; ++i)
		{
			cin >> price[i];
		}
		memset(dp, 0, sizeof(dp));
		for(int i = 0; i < n; ++i)
		{
			dp[price[i]] = true;
		}
		for(int i = 0; i < n; ++i)
		{
			for(int j = 0; j <= x; ++j)
			{
				if(dp[j] && j + price[i] <= x)
				{
					dp[j + price[i]] = true;
				}
			}
		}
		bool ok_flag = false;
		for(int i = x; i >= 1; --i)
		{
			if(dp[i] == true && isPrime[i] == true)
			{
				cout << i << endl;
				ok_flag = true;
				break;
			}
		}
		if(!ok_flag)
		{
			cout << "NA" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int N = 1e3 + 1;
const int INF = 1 << 29;
 
struct IOsetup{
  IOsetup(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout << fixed;
    cout << setprecision(20);
  }
} IO;

int32_t main(){
  string s, t;
  cin >> s >> t;
  int a, b;
  map<string, int> m;
  cin >> a >> b;
  m[s] = a, m[t] = b;
  string u; cin >> u;
  m[u]--;
  cout << m[s] << " " << m[t] << endl;
}

Measured memory_bytes: 256
/**
 * Title: A - We Love Golf
 * Url: https://atcoder.jp/contests/abc165/tasks/abc165_a
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main() {

    int k, a, b;
    cin >> k;
    cin >> a >> b;
    int largest = b/k * k;
    if(largest>=a) {
        cout << "OK" << endl;
    } else {
        cout << "NG" << endl;
    }
    return 0;
}

Measured memory_bytes: 3600
import java.util.*;
import java.io.*;

class Main {

	void solve() {
		
		out.println(instr().replace(",", " "));

	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

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

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}

	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

}

Measured memory_bytes: 21460
main(){
int a,b,m,n,o=1;
scanf("%d%d",&a,&b);
char c[a+2][b+2];
for(m=0;m<(b+2);m++)c[0][m]='.';
for(n=0;n<(a+2);n++)c[n][0]='.';
for(m=0;m<(b+2);m++)c[a+1][m]='.';
for(n=0;n<(a+2);n++)c[n][b+1]='.';
for(n=1;n<(a+1);n++)scanf("%s",c[n]+1);
for(n=1;n<(a+1);n++)for(m=1;m<(b+1);m++)if(c[n][m]=='#'){
if((c[n][m-1]=='.')&&(c[n][m+1]=='.')&&(c[n-1][m]=='.')&&(c[n+1][m]=='.')){
printf("No\n");return 0;}}
printf("Yes\n");}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;

void yesno(bool b) {
    if (b) {
        cout << "Yes" << endl;
    }     else {
        cout << "No" << endl;
    }

}

const int INF = 100100100;
int c[10][1005];
int main(){
    int H, W, K;
    cin >> H >> W >> K;

    string M[H];
    rep(i, H) {
        cin >> M[i];
    }

    int ans = INF;
    rep(div, 1 << (H-1)) {
        int g = 0;
        vector<int> id(H);
        rep(i, H) {
            id[i] = g;
            if (div >> i & 1) ++g;

        }
        ++g;
        rep(i, g) {
            rep(j, W) {
                c[i][j] = 0;
            }
        }

        rep(i, H){
            rep(j, W) {
                c[id[i]][j] += (M[i][j] - '0');
            }
        }

        int num = g-1;
        vector<int> now(g);
        auto add = [&](int j) {
            rep(i, g) now[i] += c[i][j];
            rep(i, g) if (now[i] > K) return false;
            return true;
        };
        rep(j, W) {
            if (!add(j)) {
                num++;
                now = vector<int>(g);
                if (!add(j)) {
                    num = INF;
                    break;

                }
            }
        }

        ans = min(ans, num);

    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll n; cin >> n;
    int q; cin >> q;
    ll a[n];
    rep(i,n)cin >> a[i];

    rep(i,q){
        ll s; cin >> s;
        ll ans[n];
        ll tmp = 0;
        ll j = 0;
        rep(i,n){
            tmp += a[i];
            if(tmp <= s){
                ans[i] = 0;
            }else{
                while(tmp - a[j] > s){
                    tmp -= a[j];
                    j++;
                }
                ll ii = i;
                ans[i] = ii - j + 1;
            }
        }

        ll res = n * (n+1) / 2;
        rep(i,n){
            if(ans[i] == 0)continue;
            ll ii = i;
            res -= ii - ans[i] + 2;
        }
        
        cout << res << endl;  
    }

    
    return 0;
}
 
 



Measured memory_bytes: 4660
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	ll N, K;
	cin >> N >> K;
	ll tmp = N % K;
	cout << min(tmp, K - tmp) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
	
int main(){
	int N;
	cin >> N;
	vector<int> a(N + 1);
	a[0] = 0;
	rep(i, N) cin >> a[i + 1];
	
	int cnt = 0;//ボタンを押した回数
	int now = 1;//光っているランプ
	bool jdg = false;//２にたどり着けるか
	
	while(cnt <= N){
		cnt++;
		now = a[now];
		if(now == 2){
			jdg = true;
			break;
		}
	}
		
	if(jdg) cout << cnt << endl;
	else cout << -1 << endl;
}

Measured memory_bytes: 1148
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
typedef long long ll;
map<int,int> mp;
int n,a[200005];
ll ans=0;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		ans+=mp[a[i]-i];
		mp[-a[i]-i]++;
	}
	cout<<ans;
}


Measured memory_bytes: 21400
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		int K = int.Parse(str[1]);
		int[]A = new int[N];
		string[] str2 = Console.ReadLine().Split();
		for(var i=0;i<N;i++){
			A[i] = int.Parse(str2[i]);
		}
		Array.Sort(A);
		int ans = 0;
		for(var i=0;i<K;i++){
			ans += A[i];
		}
		Console.WriteLine(ans);
	}
}


Measured memory_bytes: 18564
#include <stdio.h>
#include <algorithm>
#include <deque>
using namespace std;

struct Hi{
	long long m; int g,d;
	bool operator <(const Hi &t)const{
		return m * t.g < t.m * g;
	}
}H[55];
int P[55];

long long X[55*55*55];
const long long non = 1e16;

int main()
{
	int N, M, D, L = 1;
	scanf ("%d %d %d %lld",&N,&M,&D,&H[1].m); H[1].d = 1000000000;
	for (int i=2;i<=N;i++) scanf ("%lld %d",&H[i].m,&P[i]), H[i].d = D;
	for (int i=N;i>=1;i--){
		int p = P[i];
		H[p].m += H[i].m;
		H[p].g += ++H[i].g;
		if (L < H[i].g)
			L = H[i].g;
	}

	int S = 0;
	for (int i=1;i<=N;i++) S += min(H[i].d, L) * H[i].g;

	X[0] = 0;
	for (int i=1;i<=S;i++) X[i] = non;

	for (int i=1,s=0;i<=N;i++){
		int d = min(H[i].d, L);
		s += d * H[i].g;
		for (int j=0;j<H[i].g;j++){
			deque<pair<long long, int> > Q;
			for (int k=j,v=0;k<=s;k+=H[i].g,v++){
				while (!Q.empty() && v - Q.front().second > d) Q.pop_front();
				long long c = X[k] - H[i].m * v;
				while (!Q.empty() && Q.back().first >= c) Q.pop_back();
				Q.push_back({c,v});
				X[k] = Q.front().first + H[i].m * v;
			}
		}
	}

	int a = 0;
	sort(H+1,H+N+1);
	for (int j=0;j<=S;j++) if (X[j] <= M){
		int u = j; long long m = M - X[j];
		for (int i=1;i<=N;i++){
			int w = min((int)(m / H[i].m), H[i].d - min(H[i].d, L));
			u += w * H[i].g;
			m -= H[i].m * w;
		}
		if (a < u)
			a = u;
	}

	printf ("%d\n",a);

	return 0;
}


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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer cur = nil->next;
  while(cur!=nil&&cur->key!=key){
    cur=cur->next;
  }
  return cur;
  /* your code */
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
  if(t==nil)return;
  t->prev->next=t->next;
  t->next->prev=t->prev;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  /* your code */
  deleteNode(nil->prev);
}

void delete(int key){
  /* your code */
  deleteNode(listSearch(key));
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
  /*

   your code


  */

}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++;
      }
      size--;
    }
  }

  printList();
  return 0;
}



Measured memory_bytes: 32968
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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

	
	string S;
	cin >> S;

	int A[300] = {};
	rep(i, S.size()) {
		A[S[i]]++;
	}
	int beautiful = 1;
	rep(i, 300) {
		if (A[i] % 2) beautiful = 0;
	}
	if (beautiful) co("Yes");
	else co("No");

	Would you please return 0;
}

Measured memory_bytes: 256
//
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
#define vec vector 


void solve(){
    ll n;
    cin >> n;
    ll sum = 0;
    for(int i = 1; i <= n; ++i){
        if(i % 3 != 0 && i % 5 != 0){
            sum += i;
        }
    }
    cout << sum << endl;
}

int main(){
    solve();
}



Measured memory_bytes: 3568
from math import * 
R=6378.1
while 1:
	a,b,c,d=map(float,raw_input().split())
	if (a,b,c,d)==(-1,-1,-1,-1):break
	rd=pi/180
	a,b,c,d=a*rd,b*rd,c*rd,d*rd
	cosin=cos(a)*cos(c)*cos(b-d)+sin(a)*sin(c)
	print int(round(R*acos(cosin)))

Measured memory_bytes: 4464
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n;
ll a[3][3];
Vi b;


int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    rep(i,3){
        rep(j,3){
            cin>>a[j][i];
        }
    }
    cin>>n;
    b.resize(n);
    rep(i,n){
        cin>>b[i];
        rep(j,3){
            rep(k,3){
                if(a[j][k]==b[i])a[j][k]=-1;
            }
        }
    }
    ll ans = 0;
        bool flg = true;
    rep(i,3){
        flg = true;
        rep(j,3){
            if(a[j][i]!=-1)flg = false;
        }
        if(flg == true)break;
        flg = true;
        rep(j,3){
            if(a[i][j]!=-1)flg = false;
        }
        if(flg)break;
    }
    if(!flg){
        if(a[1][1]==-1){
            if(a[0][0] == -1 && a[2][2]==-1){
                flg = true;
            }else if(a[0][2]==-1 && a[2][0]==-1){
                flg = true;
            }
        }
    }
    Yes(flg);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 998244353
#define MAX 5100000
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

////////// 二項係数(N<=10^7) //////////

ll fac[MAX],finv[MAX],inv[MAX];
// fac[i] i!
// finv[i] i!の逆元
// inv[i] iの逆元

// テーブルを作る前処理
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;
}

//////////////////////////////////////////////////

ll sub(ll n,ll a,ll b){
  chmin(b,n);
  COMinit();
  ll ans=0;
  for(int i=a%2; i<=min({n,a,b}); i+=2){
    ans+=COM((a-i)/2+n-1,n-1)*COM(n,i);
    ans%=MOD;
    if(ans<0) ans+=MOD;
  }
  return ans;
}

int main(){
  ll N,M;
  cin>>N>>M;
  
  ll ans=sub(N,3*M,M);
  ans-=N*(sub(N,M,M)-sub(N-1,M,M));
  
  ans%=MOD;
  if(ans<0) ans+=MOD;
  co(ans);
  return 0;
}

Measured memory_bytes: 123132
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		System.out.println(String.format("%d %d %.9f", a / b, a % b, (double)a / (double)b));
	}
}



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

int64_t comb(int64_t n, int64_t r) {
  int64_t ret = 1;
  for (int64_t i = 1; i <= r; i++) {
    ret = ret * (n - i + 1) / i;
  }
  return ret;
}

int main(void) {
  ios::sync_with_stdio(false);
  int N, A, B;
  cin >> N >> A >> B;
  vector<int64_t> V(N);
  unordered_map<int, int> cnt;
  rep(i, N) {
    cin >> V[i];
    cnt[V[i]]++;
  }
  sort(V.begin(), V.end(), greater<int64_t>());
  int64_t SUM = 0;
  rep(i, A) { SUM += V[i]; }
  double AVG = (double)SUM / (double)A;
  cout << setprecision(20) << AVG << endl;

  int anum = cnt[V[A - 1]];
  int commit = 0;
  rep(i, A) {
    if (V[i] == V[A - 1]) break;
    ++commit;
  }

  int64_t count = 0;
  if (commit == 0) {
    for (int i = A; i <= B; ++i) {
      count += comb(anum, i);
    }
  } else {
    count += comb(anum, A - commit);
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 3796
#include <iostream>
#include <algorithm>
using namespace std;
int n;
int main()
{
    cin>>n;
    for(int i=n; i>0 ;i--)
	{
		if(i==64||i==32||i==16||i==8||i==4||i==2)
		{
			cout<<i;
			return 0;
		}
	}
	cout<<"1";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int n,i,a[1001];

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

	return 0;
}



Measured memory_bytes: 1944
mod=998244353
a,b,c,d=map(int,input().split())
if a==c and b==d:
  print(1)
  exit()
dp=[[0]*d for _ in range(c)]
tmp=1
for i in range(a,c):
  tmp*=b
  tmp%=mod
  dp[i][b-1]=tmp
tmp=1
for i in range(b,d):
  tmp*=a
  tmp%=mod
  dp[a-1][i]=tmp
for i in range(b,d):
  tmp=0
  for j in range(a,c):
    tmp*=i
    tmp+=dp[j-1][i]
    tmp%=mod
    dp[j][i]=tmp+(j+1)*dp[j][i-1]
    dp[j][i]%=mod
print(dp[c-1][d-1])

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

int main()
{

	string s;
	cin >> s;

	int len=s.size();
	map<int,int> modulocount;
	int current_mod=0;
	int mod10n=0;

	modulocount[0]=1;
	mod10n=1;
	for (int i=len-1;i>=0;--i)
	{
		current_mod+=(mod10n*(s[i]-'0'));
		while (current_mod>=2019)
		{
			current_mod-=2019;
		}

		modulocount[current_mod]++;
		//fprintf(stderr,"i:%d current:%d mod10n:%d\n",i,current_mod,mod10n);

		mod10n*=10;
		while (mod10n>=2019)
		{
			mod10n-=2019;
		}
	}

	int count=0;
	for (pair<int,int> p: modulocount)
	{
		int combination=p.second*(p.second-1)/2;
		//fprintf(stderr,"mod %d, count %d, combination %d\n",p.first,p.second,combination);
		count+=combination;
	}
	cout << count << endl;
}




Measured memory_bytes: 3760
#include <iostream>
#include <cstring>
#define MAXN 3002

using namespace std;

int N;							//Number of numbers in set
int a[MAXN];					//Set of numbers
long long dp[MAXN][MAXN];	//dp[i][j] corresponds to maximum score obtained, when the gaame is played on [i,j]
bool cal[MAXN][MAXN];		//memoisation table to avoid extra calculations

long long solve(int i,int j){
	if(cal[i][j]==false){
		if(i==j)
			dp[i][j] = a[i];
		else
			dp[i][j] = max(a[i]-solve(i+1,j),a[j]-solve(i,j-1));
		cal[i][j]=true;
	}
	return dp[i][j];
}

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

	memset(cal,false,N*N);

	cout<<solve(0,N-1)<<endl;
}


Measured memory_bytes: 78592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    string s;
    int K;
    cin >> s >> K;
    int size = s.size();
    map<string, ll> mp;
    rep(1, i, 6)
    {
        rep(0, j, size - i + 1)
        {
            string sub = s.substr(j, i);
            mp[sub];
        }
    }
    int k = 1;
    for (auto m : mp)
    {
        if (k == K)
        {
            cout << m.first << endl;
        }
        k++;
    }
}

Measured memory_bytes: 1920
import sys
input = sys.stdin.readline

def main():
	n, m = map(int, input().strip().split())
	A = [0] * n
	for i in range(m):
		sw = list(map(int, input().strip().split()))[1:]
		for e in sw:
			e -= 1
			A[e] |= 1 << i

	pl = list(map(int, input().strip().split()))
	p = 0
	for i, e in enumerate(pl):
		p |= e << i
		# p = p << i

	j = 0
	ans = 0
	while j < (1 << n):
		t = 0
		for i in range(n):
			if j >> i & 1:
				t ^= A[i]
		if t == p:
			ans += 1
		j += 1

	print(ans)

if __name__ == '__main__':
	main()


Measured memory_bytes: 39920
//============================================================================
// Name        : ProjG.cpp
// Author      : Yong Kiat
// Version     :
// Copyright   : By Algotae.
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <vector>

using namespace std;


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

	vector<int> nums;
	for (int n = 0; n < N; n++) {
		int num;
		cin >> num;
		nums.push_back(num);
	}

	vector<int> dp(N, 0);
	dp[N - 1] = 0;
	dp[N - 2] = abs(nums[N - 2] - nums[N - 1]);
	for (int i = N - 3; i >= 0; i--) {
		int step1 = abs(nums[i] - nums[i + 1]) + dp[i + 1];
		int step2 = abs(nums[i] - nums[i + 2]) + dp[i + 2];
		dp[i] = min(step1, step2);
	}

	cout << dp[0];

	return 0;
}


Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
using pii = pair<int, int>;
double dp[3050][3050];
int main() {
  int n;
  cin >> n;
  vector<double> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }

  // dp[i+1][j] := i枚目まで見たとき、表がj枚出ている
  dp[0][0] = 1;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i; j++) {
      dp[i + 1][j] += dp[i][j] * (1 - p[i]);
      dp[i + 1][j + 1] += dp[i][j] * p[i];
    }
  }
  double ans = 0;

  for (int i = n; i > n / 2; i--) {
    ans += dp[n][i];

    // cout << " aa";
  }

  // cout << ans << endl;
  printf("%.17lf\n", ans);
}

Measured memory_bytes: 50116