akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;

int table[10][10];

int crypt(vector<int> id)
{
	int ret=0;
	for(int i=0;i<id.size();i++)
	{
		ret=table[ret][id[i]];
	}
	return ret;
}

int main()
{
	int ans=0;
	for(int i=0;i<10;i++)
		for(int j=0;j<10;j++)
			cin>>table[i][j];
	
	for(int a=0;a<10;a++)
	{
		for(int b=0;b<10;b++)
		{
			for(int c=0;c<10;c++)
			{
				for(int d=0;d<10;d++)
				{
					vector<int> id={a,b,c,d};
					int e=crypt(id);
					id.push_back(e);
					int f=0;
					for(int i=0;i<5;i++)
					{
						for(int j=0;j<10;j++)
						{
							if(j==id[i])
								continue;
							vector<int> tmp=id;
							tmp[i]=j;
							if(crypt(tmp)==0)
							{
								f+=1;
								break;
							}
						}
						if(f>0)
							break;
					}
					
					for(int i=0;i<4;i++)
					{
						if(id[i]==id[i+1])
							continue;
						vector<int> tmp=id;
						int t=tmp[i];
						tmp[i]=tmp[i+1];
						tmp[i+1]=t;
						if(crypt(tmp)==0)
						{
							f+=2;
							break;
						}
					}
					
					if(f>0)
						ans++;
				}
			}
		}
	}

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


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

int main() {
    int a,b,c;cin >> a >> b >> c;
    if(a>c){
        if(b<c){
            cout << "Yes" << endl; 
        }else{
            cout << "No" << endl;
        }
    }else{
        if(b>c){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 256
import itertools,math,statistics
N = int(input())
town = []
for p in range(N):
    q = list(map(int, input().split()))
    town.append(q)
perm = itertools.permutations(town)
c = []
for i in list(perm):
    b = 0
    for j in range(N-1):
        a = math.sqrt((i[j][0]-i[j+1][0])**2 + (i[j][1]-i[j+1][1])**2)
        b += a
    c.append(b)
print(statistics.mean(c))

Measured memory_bytes: 11540
// Copyright 2020 yaito3014
#include <bits/stdc++.h>

int main() {
  using namespace std;
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N), f(N, 0);
  sort(begin(A), copy_n(istream_iterator<int>(cin), N, begin(A)));
  for_each(cbegin(A), cend(A),
           [&, m = *max_element(cbegin(A), cend(A))](int n) {
             ++f[distance(cbegin(A), lower_bound(cbegin(A), cend(A), n))];
             for (int i = 2; i * n <= m; ++i)
               if (auto iter = lower_bound(cbegin(A), cend(A), i * n);
                   iter != cend(A) && *iter == i * n)
                 ++++f[distance(cbegin(A), iter)];
           });
  cout << count(cbegin(f), cend(f), 1) << '\n';
}


Measured memory_bytes: 4752
#include<stdio.h>
#include<string>
#include<iostream>
using namespace std;

struct Node{
    int key;
    Node* parent;
    Node* left;
    Node* right;
};

Node* root, *NIL;

void insert(int _key){

    Node* y = NIL;
    Node* x = root;
    Node* z;

    z = new Node;
    z->key = _key;
    z->left = NIL;
    z->right = NIL;

    while(x != NIL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        }else{
            x = x->right;
        }
    }
    z->parent = y;
    if(y==NIL){
        root = z;
    }else{
        if(z->key < y->key){
            y->left = z;
        }else{
            y->right = z;
        }

    }
}

Node* find(Node* _root, int _key){
    while((_root!=NIL)&&(_key!=_root->key)){
        if(_key < _root->key){
            _root = _root->left;
        }else{
            _root = _root->right;
        }
    }
    return _root;
}

Node* treeMinimum(Node* x){
    while(x->left!=NIL) x = x->left;
    return x;
}

Node* treeSuccessor(Node* z){
    //右分部木の最小値
    if(z->right!=NIL) return treeMinimum(z->right);
    //
    Node* y = z->parent;
    while(y!=NIL && z==y->right){
        z = y;
        y = y->parent;  //最後の更新で右上の節点が返される
    }
    return y;
}

void treeDelete(Node* z){
    Node* y;    //削除する対象
    Node* x;    //yの子

    //削除する節点を探す
    if(z->left==NIL || z->right==NIL) y = z;
    else y = treeSuccessor(z);  //zの次の節点

    //yの子xを決める
    if(y->left!=NIL){
        x = y->left;
    }else{
        x = y->right;
    }

    if(x!=NIL){
        x->parent = y->parent;
    }

    if(y->parent==NIL){
        root = x;
    }else{
        if(y==y->parent->left){
            y->parent->left=x;
        }else{
            y->parent->right = x;
        }
    }

    if(y!=z){
        z->key = y->key;
    }

    delete y;
}

void inParse(Node* u){
    if(u==NIL) return;
    inParse(u->left);
    printf(" %d", u->key);
    inParse(u->right);
}

void preParse(Node* u){
    if(u==NIL) return;
    printf(" %d", u->key);
    preParse(u->left);
    preParse(u->right);
}

int main(){

    int n;
    scanf("%d", &n);

    for(int i=0; i<n; i++){
        string str;
        cin >> str;
        if(str == "insert"){
            int key;
            scanf("%d", &key);
            insert(key);
        }else if(str == "find"){
            int key;
            scanf("%d", &key);
            Node* t = find(root, key);
            if(t ==NIL) printf("no\n");
            else printf("yes\n");
        }else if(str == "print"){
            inParse(root);
            printf("\n");
            preParse(root);
            printf("\n");
        }else if(str == "delete"){
            int key;
            scanf("%d", &key);
            treeDelete(find(root, key));
        }
    }

    return 0;
}


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

using namespace std;

int main(){
	string s[3]; cin >> s[0] >> s[1] >> s[2];
	int turn = 0;
	while(1){
		if(!s[turn].size()){
			printf("%c\n", 'A' + turn);
			return 0;
		}else{
			int before_turn = turn;
			turn = (int)(s[turn][0] - 'a');
			s[before_turn].erase(s[before_turn].begin());
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <math.h>
using namespace std;
long long INF = 1000000009;
int main()
{
	int a, b, k;
	cin >> a >> b >> k;
	int counter = 0;
	for (int i = 100; i >= 1; i--) {
		if (a % i == 0 && b % i == 0) {
			counter++;
			if (counter == k) {
				cout << i << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<functional>
#include<set>
using namespace std;
#define int long long
int c[3][3];
signed main() {
	for (int i = 0; i < 3; i++)
		for (int j = 0; j < 3; j++)cin >> c[i][j];

	int flg = 0;
	
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			if (c[i][j] != c[i][i] + c[j][j] - c[j][i]) {
				puts("No"); return 0;
			}
		}
	}puts("Yes");
}

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

using namespace std;

int main() {
    int n = 1000000;

    vector<bool> prime(n, true);
    prime[0] = prime[1] = false;
    for (int i = 2; i < n; i++) {
        if (prime[i]) {
            for (int j = 2 * i; j < n; j += i) {
                prime[j] = false;
            }
        }
    }

    int x;
    cin >> x;

    int res = -1;
    for (int i = x; i < n; i++) {
        if (prime[i]) {
            res = i;
            break;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1e9+7LL;

int main() {
    int N, K; cin >> N >> K;
    vector<int> p(N);
    rep(i, N) cin >> p.at(i);
    
    sort(ALL(p));
    int ans = 0;
    rep(i, K) ans += p.at(i);
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;
typedef long long ll;

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

    int n,m,q;
    cin>>n>>m>>q;
    int a[600][600]={};
    for(int i=0;i<m;i++){
        int l,r;
        cin>>l>>r;
        a[l][r]++;
    }
    for(int i=0;i<=n;i++){
        for(int j=n;j>=0;j--){
            a[i][j]+=a[i][j+1];
        }
    }
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            a[i+1][j]+=a[i][j];
        }
    }

    for(int i=0;i<q;i++){
        int p,q;
        cin>>p>>q;
        printf("%d\n",a[n][0]-a[p-1][0]-a[n][q+1]+a[p-1][q+1]);
    }
    
}

Measured memory_bytes: 2304
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
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;
}

int main(){
    int n;
    cin >> n;
    vector<string>s(n);
    rep(i,n)cin >> s[i];
    int res = 0;
    rep(id,n){
        queue<pair<int,int> >q;
        q.push(MP(id,1));
        vector<bool>flag(n);
        vector<int>color(n);
        flag[id] = 1;
        color[id] = 1;
        while(!q.empty()){
            auto a = q.front();
            q.pop();
            int d = a.first;
            int c = a.second;
            chmax(res,c);
            for(int i=0;i<n;i++){
                if(s[d][i]=='1'&&color[i]==color[d]){
                    cout << -1 << endl;
                    return 0;
                }
                if(s[d][i]=='1'&&!flag[i]){
                    if(color[d]==1){
                        color[i] = 2;
                    }else{
                        color[i] = 1;
                    }
                    flag[i] = true;
                    q.push(MP(i,c+1));
                }
            }
        } 
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define DELNL        cin.ignore(numeric_limits<streamsize>::max(),'\n')
#define VV(T,h,w)    vector<vector<T>>(h,vector<T>(w))
#define VVI(T,h,w,i) vector<vector<T>>(h,vector<T>(w,i))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
    ll d = in(), g = in();
    vector<pair<ll, ll>>prob(d);
    REP(i, d) {
        ll p = in(), c = in();
        prob[i] = make_pair(p, c);
    }

    ll ans = INFLL;
    for (ll bi = 0; bi != (1 << d); ++bi) {
        ll cnt = 0, score = 0;
        REP(i, d) {
            if ((bi >> i) & 1) {
                ll solve = prob[i].first;
                cnt += solve;
                score += solve * 100 * (i + 1) + prob[i].second;
            }
        }
        if (score < g) {
            REPR(i, d) {
                if (!((bi >> i) & 1)) {
                    ll solve = min((g - score + 100 * (i + 1) - 1) / (100 * (i + 1)), prob[i].first - 1);
                    cnt += solve;
                    score += solve * 100 * (i + 1);
                }
                if (score >= g) {
                    ans = min(ans, cnt);
                    break;
                }
            }
        } else {
            ans = min(ans, cnt);
        }
    }
    cout << ans << endl;
}

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

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, arr[100000];
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> arr[i];
    sort(arr, arr + n);
    cout << arr[n / 2] - arr[n / 2 - 1] << '\n';

    return 0;
}


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

typedef long long ll;
#define int ll

using namespace std;

const int N=1e5+100;

int ans[N];

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int a;
        cin>>a;
        ans[a]=i;
    }
    for(int i=1;i<=n;i++)
        cout<<ans[i]<<" ";
}


Measured memory_bytes: 1664
/*
[abc135] D - Digits Parade
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

const int MAX_N = 1e5;
const int M = 13;
const int MOD = 1e9 + 7;

class gf {
public:
    int n;
    static int extgcd(int a, int b, int& x, int& y) {
        int d = a;
        if (b != 0) {
            d = extgcd(b, a % b, y, x);
            y -= (a / b) * x;
        } else {
            x = 1;
            y = 0;
        }
        return d;
    }
    static int mod_inv(int a, int m) {
        int x, y;
        extgcd(a, m, x, y);
        return (m + x) % m;
    }
    gf() : n(0) {}
    gf(int n) : n(n % MOD) {}
    gf operator+(const gf x) const { return gf((n + x.n) % MOD); }
    gf operator-(const gf x) const { return gf((n - x.n + MOD) % MOD); }
    gf operator*(const gf x) const { return gf((1LL * n * x.n) % MOD); }
    gf operator/(const gf x) const { return *this * x.inv(); }
    gf& operator+=(const gf x) { return *this = (*this + x); }
    gf& operator-=(const gf x) { return *this = (*this - x); }
    gf& operator*=(const gf x) { return *this = (*this * x); }
    gf& operator/=(const gf x) { return *this = (*this / x); }
    gf inv() const { return gf(mod_inv(n, MOD)); }
    gf pow(ll e) const {
        gf a = *this;
        gf x = 1;
        for (; e > 0; e >>= 1) {
            if (e & 1) {
                x = x * a;
            }
            a = a * a;
        }
        return x;
    }
};

int N;
string S;
gf dp[MAX_N + 1][M];

ll solve() {
    dp[0][0] = 1;
    for (int n = 0; n < N; n++) {
        for (int d = 0; d <= 9; d++) {
            if (S[n] == '?' || S[n] == '0' + d) {
                for (int m = 0; m < M; m++) {
                    dp[n + 1][(m * 10 + d) % M] += dp[n][m];
                }
            }
        }
    }

    return dp[N][5].n;
}

int main() {
    cin >> S;
    N = S.length();

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 5504
// Aizu 1142: Organize Your Train part II
// 2017.9.15 bal4u@uu

#include <stdio.h>
#include <string.h>

#define HSIZ 1201
typedef struct { char *w; int k; } HASH;
HASH hash[HSIZ + 5];
char s[600][75];
int ans;

int insert(char *w, int l, int k)
{
	int i;
	HASH *tp;
	i = (101 * *w + 103 * *(w + l - 1) + 107 * l) % HSIZ;
	tp = hash + i;
	if (tp->w != NULL) {
		int inc = *w + (*(w + 1) << 1);
		while (1) {
			if (!strcmp(tp->w, w)) return 0;
			i += inc; if (i >= HSIZ) i -= HSIZ;
			tp = hash + i;
			if (tp->w == NULL) break;
		}
	}
	tp->w = w, tp->k = k;
	return 1;
}

void combi(int k, char *s1, int w1, char *s2, int w2)
{
	char *d = s[k];
	memcpy(d, s1, w1), memcpy(d+w1, s2, w2), *(d+w1+w2) = 0;
	ans += insert(s[k], w1+w2, 0);
}

void reverse(char *r, char *s, int w)
{
	*(r+w) = 0,	r += w; while (w-- > 0) *--r = *s++; 
}

int main()
{
	int n, i, w, w1, w2;
	char *p, s1[75], s2[72], r1[75], r2[75];

	scanf("%d", &n);
	while (n-- > 0) {
		memset(hash, 0, sizeof(hash));
		scanf("%s", p = s[0]); w = strlen(p);
		ans = insert(p, w, 0);
		for (i = 1, w1 = 1; w1 < w; w1++) {
			w2 = w - w1;
			memcpy(s1, p, w1), s1[w1] = 0;
			memcpy(s2, p+w1, w2), s2[w2] = 0;
			reverse(r1, s1, w1), reverse(r2, s2, w2);

			combi(i++, s1, w1, r2, w2);
			combi(i++, r1, w1, s2, w2);
			combi(i++, r1, w1, r2, w2);
			combi(i++, s2, w2, s1, w1);
			combi(i++, s2, w2, r1, w1);
			combi(i++, r2, w2, s1, w1);
			combi(i++, r2, w2, r1, w1);
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1796
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
typedef long long           ll;
#define REP(i, n)           for (ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)       for (ll i = m ; i < (ll)n ; ++i)
#define INF                 (ll)1e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	vector<string> S(3);
	for_each(ALL(S), [](string &a){cin >> a;});

	int idx = 0;
	while (1) {
		if (S[idx].size() == 0) {
			break;
		}
		int nextIdx = S[idx][0] - 'a';
		S[idx].erase(0, 1);
		idx = nextIdx;
	}

	cout << char(idx + 'A') << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O2")
#pragma GCC optimize("Os")
#pragma GCC target("avx2")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
using namespace std;
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
void vok()
{
    FAST
    FO
    FI
}
int main()
{
    vok();
    ll n,k;
    IN n>>k;
    vll a(n);
    bitset<50> b[n];
    loop(i,0,n)
    {
        IN a[i];
        bitset<50> temp(a[i]);
        b[i]=temp;
    }
    bitset<50> ans(0);
    rloop(i,49,0)
    {
        int countt=0;
        loop(j,0,n)
        {
            if(b[j][i])
            {
                countt++;
            }
          	cout<<"";
        }
        ans[i]=1;
        if((countt*2)<n && ans.to_ullong()<=k)
        {
            //Do Nothing
        }
        else
        {
            ans[i]=0;
        }
    }
    ll fans=0LL;
    ll X=ans.to_ullong();
    loop(i,0,n)
    {
      	cout<<"";
        fans+=(X^a[i]);
    }
    OUT fans<<endl
    return 0;
}


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

int main(){
  string s; cin >> s;
  int n = s.length();
  if(s[0]==s[1]){ cout << 1 << " " << 2 << endl; return 0;}  	
  for(int i=0;i<n-2;i++) {
  	if(s[i]==s[i+1]||s[i+1]==s[i+2]||s[i]==s[i+2]){ cout << i+1 << " " << i+3 << endl; return 0;}  	
  }
  cout << -1 << " " << -1 << endl;
  return 0;
}

Measured memory_bytes: 512
t=list(input())
for i in range(1<<3):
    ans=""
    ans+=t[0]
    for j in range(3):
        if i&(1<<j):
            ans+="+"
            ans+=t[j+1]
        else:
            ans+="-"
            ans+=t[j+1]
    if eval(ans)==7:
        print(ans+"=7")
        exit()
    


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

const int N = 300 + 5;
double memo[N][N][N];
int n;
double rec(int _1, int _2, int _3)
{
  if (max({_1, _2, _3}) == 0) return 0;
  double& ret = memo[_1][_2][_3];
  if (ret != -1) return ret;

  double m = _1 + _2 + _3;
  double sum = n / m;

  if (_1) {
    double p = double(_1) / m;
    sum += p * rec(_1 - 1, _2, _3);
  }

  if (_2) {
    double p = double(_2) / m;
    sum += p * rec(_1 + 1, _2 - 1, _3);
  }

  if (_3) {
    double p = double(_3) / m;
    sum += p * rec(_1, _2 + 1, _3 - 1);
  }

  return ret = sum;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  while (cin >> n) {
    vector<int> a(n);
    cin >> a;

    fill(&memo[0][0][0], &memo[N - 1][N - 1][N - 1] + 1, -1);
    int _1 = count(a.begin(), a.end(), 1);
    int _2 = count(a.begin(), a.end(), 2);
    int _3 = count(a.begin(), a.end(), 3);
    printf("%.10lf\n", rec(_1, _2, _3));
  }

  return 0;
}


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

int main(void) {
    int H, N;
    int A;
    int sum = 0;
    
    cin >> H >> N;
    
    for (int i = 0; i < N; i ++) {
        cin >> A;
        sum += A;
    }
   
    if (sum >= H) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000001

template <typename T>
struct segtree{
	//元データx[i]はv[n+i]
	//v[i]の親はv[i/2],子はv[i*2]とv[i*2+1]
	vector<T> v;
	int n;
	
	const T init_value = 0;
	
	segtree(int sz){
		n=1;
		while(true){
			if(n>=sz)break;
			n*=2;
		}
		v.resize(2*n,init_value);

		for(int i=n-1;i>=0;i--){
			v[i]=func(v[i*2],v[i*2+1]);
		}
	}
	
	segtree(vector<T> &x){
		n=1;
		while(true){
			if(n>=x.size())break;
			n*=2;
		}
		v.resize(2*n,init_value);
		
		for(int i=0;i<x.size();i++){
			v[n+i]=x[i];
		}
		for(int i=n-1;i>=0;i--){
			v[i]=func(v[i*2],v[i*2+1]);
		}
	}

	void update(int x,T val){
		x+=n;
		v[x]=val;
		while(true){
			x=(x)/2;
			v[x]=func(v[x*2],v[x*2+1]);
			if(x<=0)break;
		}
	}
	
	//区間[l,r)におけるクエリ処理
	T query(int l,int r){
		T res1 = init_value;
		T res2 = init_value;
		if(l>=r)return res1;
		l+=n;
		r+=n;
		while(true){
			if(l%2==1){
				res1=func(res1,v[l]);
				l++;
			}
			if(r%2==1){
				res2=func(v[r-1],res2);
				r--;
			}
			if(l>=r)break;
			l/=2;r/=2;
		}
		return func(res1,res2);
	}
	T func(T a,T b){
		return mod(a+b);
	}
	
	void show(){
		int n = 1;
		for(int i=1;i<v.size();i++){
			for(int j=0;j<n;j++){
				if(j!=0)cout<<' ';
				cout<<v[i+j];
			}
			cout<<endl;
			i+=n-1;
			n*=2;
		}
	}
	
};

int main(){
	
	int N;
	cin>>N;
	
	long long A,B;
	cin>>A>>B;
	
	if(A>B)swap(A,B);
	
	vector<long long> S(N);
	for(int i=0;i<N;i++)cin>>S[i];
	
	for(int i=0;i<N-2;i++){
		if(S[i+2]-S[i]<A){
			cout<<0<<endl;
			return 0;
		}
	}
	
	S.insert(S.begin(),-Inf);
	
	segtree<int> seg(N+1);
	seg.update(0,1);
	
	int now = 0;
	
	for(int i=1;i<=N;i++){
		auto it = upper_bound(S.begin(),S.end(),S[i]-B);
		int d = distance(S.begin(),it);
		int x = seg.query(0,d);
		
		if(S[i]-S[i-1]<A){
			for(int j=now;j<=i-2;j++){
				seg.update(j,0);
				now=j;
			}
		}
		
		seg.update(i,x);
		
		//seg.show();
	}
	
	cout<<seg.query(0,N+1)<<endl;
	
	
	
    return 0;
}


Measured memory_bytes: 2160
m, k = map(int, input().split())

if m == 0:
    if k == 0:
        print(0, 0)
    else:
        print(-1)

elif m == 1:
    if k == 0:
        print(0, 0, 1, 1)
    else:
        print(-1)

else:
    if k >= 2 ** m:
        print(-1)
        exit()

    res = []
    for i in range(2 ** m):
        if i == k:
            continue
        res.append(i)

    ans = [k] + res + [k] + res[::-1]
    print(*ans)

Measured memory_bytes: 16912
import Control.Applicative
import Data.List
 
check :: [Integer] -> [Integer]
check [a, b, k] 
    | b - a <= 2 * k - 1 = [a..b]
    | otherwise = [a..(a + k - 1)] ++ [(b - k + 1)..(b)]
 
print_all :: [Integer] -> IO ()
print_all [] = return () :: IO ()
print_all (f:rest) = do
    print f
    print_all rest
 
main = do
    a <- check <$> map (\a -> read a :: Integer) <$> words <$> getLine
    print_all a


Measured memory_bytes: 764
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cstdio>
using namespace std;
int main(){
	int K,R,x,i,j,k;
	vector<vector<int> >v;
	for(scanf("%d%d",&K,&K),i=0;i<K;i++){
		vector<int>u;
		for(scanf("%d",&j);j;j--)scanf("%d",&x),u.push_back(x);
		sort(u.begin(),u.end());
		v.push_back(u);
	}
	map<int,vector<int> >m;
	for(scanf("%d",&R),i=0;i<R;i++){
		scanf("%d%d",&x,&j),m[x].push_back(j);
	}
	set<int>s;
	for(i=0;i<K;i++)
		for(j=0;j<v[i].size()-1;j++)
			for(k=j+1;k<v[i].size();k++)
				if(find(m[v[i][j]].begin(),m[v[i][j]].end(),v[i][k])!=m[v[i][j]].end())s.insert(v[i][j]),s.insert(v[i][k]);
	printf("%d\n",s.size());
}

Measured memory_bytes: 0
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args){
    	try {
    		InputStreamReader isr = new InputStreamReader(System.in);
    		BufferedReader br = new BufferedReader(isr);
    		String buf = br.readLine();
    		int x = Integer.parseInt(buf);
    		x=x*x*x;
    		System.out.println(x);

    	} catch(IOException e) {
		    System.err.println(e);
	}
    }
}

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

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

const int MOD = 1e9 + 7;

vector<long long> fact_inv, inv;

/*  init_nCk :二項係数のための前処理
    計算量:O(k)
*/
void init_nCk(int SIZE) {
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
}

/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(k)
*/
long long nCk(int n, int k) {
    assert(!(n < k));
    assert(!(n < 0 || k < 0));
    long long ans = 1;
    for (int i = n; i >= n - k + 1; i--) {
        ans *= i;
        ans %= MOD;
    }
    return ans * fact_inv[k] % MOD;
}

int main() {
	long long n, a, b;
	cin >> n >> a >> b;

	init_nCk(200000);

	long long ans = modpow(2, n, MOD) - 1 - nCk(n, a) - nCk(n, b);
	while (ans < 0) {
		ans += MOD;
	}

	cout << ans << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <cxxabi.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    ((ll)1ll<60)
#define INF     ((int)INT_MAX)
#define EPS     (1e-9)
#define MOD     (1000000007)
template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool b=1;for(auto s:t)os<<(exchange(b,0)||strlen(abi::__cxa_demangle(typeid(S).name(),0,0,0))>20?"":" ")<<s;return os<<endl;}

struct segTree{
	vi val,lazy;
	vector<bool> lazyFlag;
	int N;
	segTree():segTree(100000){}
	segTree(int n){
		N=1;
		while(N<n)N*=2;
		val.resize(N*2,INF);
		lazy.resize(N*2,0);
		lazyFlag.resize(N*2,false);
	}
	
	void eval(int k, int l, int r){
		if(lazyFlag[k]){
			val[k]=lazy[k];
			if(r-l>1){
				lazy[2*k]=lazy[2*k+1]=lazy[k];
				lazyFlag[2*k]=lazyFlag[2*k+1]=true;
			}
			lazyFlag[k]=false;
		}
	}

	void update(int a, int b, int x){return update(a,b,1,0,N,x);}
	void update(int a, int b, int k, int l, int r, int x){
		eval(k,l,r);
		if(r<=a or l>=b) return;
		if(a<=l and r<=b) {
			lazy[k]=x;
			lazyFlag[k]=true;
			eval(k,l,r);
		}else{
			int m=(l+r)/2;
			update(a,b,2*k,l,m,x);
			update(a,b,2*k+1,m,r,x);
			val[k]=min(val[2*k],val[2*k+1]);
		}
	}
	
	int minimum(int a, int b){return minimum(a,b,1,0,N);}
	int minimum(int a, int b, int k, int l, int r){
		eval(k,l,r);
		if(r<=a or l>=b) return INF;
		if(a<=l and r<=b) return val[k];
		int m=(l+r)/2;
		return min(minimum(a,b,k*2,l,m),minimum(a,b,k*2+1,m,r));
	}	
	
	int getData(int k){return minimum(k,k+1);}
};

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int n,q;
	while(cin>>n>>q){
		segTree st(n);
		rep(_,q){
			int c,s,t,x;
			cin>>c;
			if(c==0){
				cin>>s>>t>>x;
				st.update(s,t+1,x);
			} else {
				cin>>s>>t;
				cout<<st.minimum(s,t+1)<<endl;
			}
		}
	}
	return 0;
}
 



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

#define REP(i,n) for(int i=0,_n=n;i<(int)_n;++i)
#define ALL(a) (a).begin(),(a).end()
#define eb emplace_back
#define pb emplace_back
#define mt make_tuple

template<class T>bool chmin(T&a,const T&b){if(a<=b)return false;a=b;return true;}
template<class T>bool chmax(T&a,const T&b){if(a>=b)return false;a=b;return true;}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cerr<<*i<<" ";cout<<endl;}
typedef long long ll;
typedef vector<int> Vi;

int num[100000 + 10];
bool is[100000 + 10];

int main(){
  int N, M; scanf("%d%d", &N, &M);
  REP(i, N) num[i+1] = 1;
  is[1] = true;
  REP(nnn, M) {
    int a, b; scanf("%d%d", &a, &b);
    num[a]--;
    num[b]++;
    if (is[a]) is[b] = true;
    if (num[a] == 0) is[a] = false;
  }
  int ans = 0;
  REP(i, N) if (is[i+1]) ans++;
  cout << ans << endl;
}


Measured memory_bytes: 768
import sys,queue,math,copy,itertools,bisect,collections,heapq
LI = lambda : [float(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
N = NI()
p = [0.0] + LI()
dp = [[0] * (N+1) for _ in range(N+1)]
dp[0][0] = 1
for i in range(1,N+1):
    for j in range(0,i+1):
        if j > 0: dp[i][j] = dp[i-1][j-1] * p[i]
        dp[i][j] += dp[i-1][j] * (1-p[i])

print(sum(dp[-1][N//2+1:]))


Measured memory_bytes: 254856
#include<bits/stdc++.h>
using namespace std;
#define int long long
#undef int
#define INF 1000000009
#define INFL 1000000000000000018
#define mod 1000000007
#define pb push_back
typedef pair<int, pair<int, pair<int, int> > > PA;
typedef priority_queue<int> PQ;
typedef priority_queue<PA, vector<PA>, greater<PA> >PQG;
#define fi first
#define sf second.first
#define ssf second.second.first
#define sss second.second.second
#define MP make_pair

int h, w, a[40][40], dp[1000][40][40], d[5] = {0, 1, 0, -1, 0};

signed main()
{
    cin >> h >> w;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> a[i][j];
        }
    }
    for(int k = 0; k <= h * w; k++){
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                dp[k][i][j] = INF;
            }
        }
    }
    dp[0][0][0] = 0;
    for(int k = 1; k <= h * w; k++){
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                for(int r = 0; r < 4; r++){
                    int nx = i + d[r], ny = j + d[r + 1];
                    if(0 <= nx && nx < h && 0 <= ny && ny < w){
                        dp[k][i][j] = min(dp[k][i][j], dp[k - 1][nx][ny] + a[i][j] * (k - 1) * 2 + a[i][j]);
                    }
                }
            }
        }
    }
    int ans = INF;
    for(int i = 0; i <= h * w; i++){
        ans = min(ans, dp[i][h - 1][w - 1]);
    }
    cout << ans << endl;



    return 0;
}



Measured memory_bytes: 8776
#include <stdio.h>
#include <string.h>

int main(void) {
  int n = 0, m = 0;
  int i, j;
  int height[100000];
  int is_good[100000];
  
  scanf("%d %d", &n, &m);
  for(i = 0; i < n; i++) {
    is_good[i] = 1;
  }
  for(i = 0; i < n; i++) {
    scanf("%d", &height[i]);
  }
  
  for(i = 0; i < m; i++) {
    int path_a = 0, path_b = 0;
    scanf("%d %d", &path_a, &path_b);
    path_a--;
    path_b--;
    if(height[path_a] <= height[path_b]) {
      is_good[path_a] = 0;
    }
    if(height[path_a] >= height[path_b]) {
      is_good[path_b] = 0;
    }
    
    /*
    for(j = 0; j < n; j++) {
      printf("%d ", is_good[j]);
    }
    printf("\n");
    */
  }
  
  int number_of_good = 0;
  
  for(i = 0; i < n; i++) {
//    printf("%d ", is_good[i]);
    if(is_good[i] == 1) number_of_good++;
  }
//  printf("\n");
  
  printf("%d\n", number_of_good);
  
  return 0;
}

Measured memory_bytes: 2512
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;


#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;
typedef vector<int> VI;


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)


int main() {
	int n;

	cin >> n;

	int ans = 0;

	if (n < 105) {
		ANS(0);
	}
	else if (n < 135) {
		ANS(1);
	}
	else if (n < 165) {
		ANS(2);
	}
	else if (n < 189) {
		ANS(3);
	}
	else if (n < 195) {
		ANS(4);
	}
	else {
		ANS(5);
	}
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

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

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

int X, Y, A, B, C, num;
vector<int> p;
vector<pair<int, int> > others;

int main() {
    cin >> X >> Y >> A >> B >> C;

    for (int i = 0; i < A; i++) {
        cin >> num;
        p.push_back(num);
    }

    for (int i = 0; i < B; i++) {
        cin >> num;
        others.push_back({num, 0});
    }

    for (int i = 0; i < C; i++) {
        cin >> num;
        others.push_back({num, 1});
    }

    sort(p.begin(), p.end());
    reverse(p.begin(), p.end());

    sort(others.begin(), others.end());
    reverse(others.begin(), others.end());

    LL currentSumRed = 0;
    for (int i = 0; i < X; i++)
        currentSumRed += p[i];

    LL currentSumGreen = 0;
    for (int i = 0; i < Y; i++)
        currentSumGreen += others[i].first;

    int ptr1; //points to other color
    int ptr2 = Y - 1;

    for (int i = 0; i < others.size(); i++) {
        if (others[i].second == 1) {
            ptr1 = i;
            break;
        }
    }

    LL best = currentSumRed + currentSumGreen;
    for (int i = X - 1; i >= 0; i--) {
        currentSumRed -= p[i];
        currentSumRed += others[ptr1].first;

        if (ptr1 <= ptr2) {
            ptr2 += 1;

            currentSumGreen -= others[ptr1].first;
            currentSumGreen += others[ptr2].first;
        }

        ptr1 += 1;
        while (ptr1 < others.size() && others[ptr1].second != 1) ptr1 += 1;

        best = max(best, currentSumRed + currentSumGreen);
    }

    cout << best << endl;
}


Measured memory_bytes: 2804
li = list(map(int,input().split()))
cnt = 3
if li[0] == li[1]:
	cnt -= 1
if li[0] == li[2]:
	cnt -= 1
if li[1] == li[2]:
	cnt -= 1
if li[0] == li[1] and li[1] == li[2]:
	cnt = 1
print(cnt)

Measured memory_bytes: 3064
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;
using System.Runtime.InteropServices.ComTypes;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var S = ReadLine();
            var N = S.Length;
            var rem = new List<char>();
            for (var i = 0; i < N; ++i)
            {
                if (rem.Count == 0 || S[i] == rem.Last())
                    rem.Add(S[i]);
                else
                    rem.RemoveAt(rem.Count - 1);
            }
            WriteLine(N - rem.Count);
        }

        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
        static public (T a, T b, T c, T d) Slice4<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)),
            (T)Convert.ChangeType(t[3], typeof(T)));
        }
    }
}

Measured memory_bytes: 27448
n,m = map(int, input().split())
a_s = list(map(int, input().split()))
cnt = 0
b = sum(a_s) * 1/(4 * m)

for a in a_s:
    if a >= b:
        cnt += 1

if cnt >= m:
    print('Yes')
else:
    print('No')

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

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)

using namespace std;

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

int main() {
	int n, i, j, k;
	vi p;

	cin >> n;
	p.resize(n);

	rep(i, n) {
		cin >> p[i];
	}

	sort(p.begin(), p.end());

	p[n - 1] /= 2;

	k = 0;
	rep(i, n) {
		k += p[i];
	}

	cout << k;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int N, T[100], M, P[100], X[100];
	int tmpT[100], total, ans[100];
	int i, j;
	cin >> N;
	for (i = 0; i < N; i++){
		cin >> T[i];
	}
	cin >> M;
	for (i = 0; i < M; i++){
		cin >> P[i];
		cin >> X[i];
	}
	for (i = 0; i < M; i++){
		for (j = 0; j < N; j++){
			tmpT[j] = T[j];
		}
		tmpT[P[i] - 1] = X[i];
		total = 0;
		for (j = 0; j < N; j++){
			total = total + tmpT[j];
		}
		ans[i] = total;
	}
	for (i = 0; i < M; i++){
		cout << ans[i] <<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main(){
   int n,cnt=0,i,j;
   scanf("%d",&n);
   for(i=1;i<=n;i+=2){
     int d=i/2;
     int u=0;
     for(j=1;j<=d;j++){
          if(i%j==0) u++;
     }
     if(u>=7) cnt++;
   }
   printf("%d",cnt);

}


Measured memory_bytes: 128
/* *>>>>>Anshit_Bhardwaj<<<<<* */
#include <bits/stdc++.h>
#define ll long long
#define f(i, x, n) for(int i = x; i < n; i++)
#define dbg(x) cout << x << endl
#define dbg2(x, y) cout << x << ' ' << y << endl
#define dbg3(x, y, z) cout << x << ' ' << y << ' ' << z << endl
#define mod 1000000007
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll a, b;
    cin >> a >> b;
    cout << a*b << endl;
}

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

int main(){
 int a,b;
  cin >> a >> b;
  if (a-2*b >= 0){
  cout << a - b*2 << endl;
  }
  else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define pii Pi
#define pll PL
#define Fi first
#define Se second
#define pb(x) push_back(x)
//#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

const double PI = acos(-1);
const double EPS = 1e-9;

const int MX = 305;
const int MM = 998244353;

int L[MX], R[MX];
ll arr[2][MX][MX];
int N, C;

ll solve()
{
	auto *S = arr[0], *E = arr[1];

	memset(S, 0, sizeof arr[0]);
	S[0][L[N]*N] = 1;

	for(int i = 1; i < N; i++){
		memset(E, 0, sizeof arr[0]);
		for(int j = R[i-1]; j < N*C; j += N){
			for(int k = 0; k <= N*C; k++){
				if( !S[j][k] ) continue;	
				for(int st = R[i]; st <= k; st += N){
					if( st < j ) continue;
					E[st][min(N*C, max(st + L[i]*N, k))] += S[j][k];
				}
			}
		}
		swap(S, E);
	}
	ll ans = 0;
	for(int i = 0; i <= N*C; i++) ans += S[i][N*C];
	return ans;
}

int main()
{
	scanf("%d%d", &N, &C);
	int S[MX], D[MX];
	for(int i = 1; i <= N; i++) scanf("%d", D+i);
	sort(D+1, D+N+1);
	for(int i = 1; i < N; i++) R[i] = i;
	for(int i = 1; i <= N; i++) S[i] = i;
	ll ans = 0, cnt = 0;
	do{
		do{
			for(int i = 1; i <= N; i++) L[S[i]] = D[i];
			ans += solve();
		}while(next_permutation(S+1, S+N));
		cnt++;
	}while(next_permutation(R+1, R+N));

	double t = ans / (double)cnt;
	for(int i = 1; i < N; i++) t /= C;
	printf("%.20lf\n", t);
}


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

int main(void) {
	int A, B;
	cin >> A >> B;
	//int sum = 1;
	//int plg = A;
	//while (true) {
	//	if (B <= plg) {
	//		break;
	//	}
	//	sum++;
	//	plg += A - 1;
	//}
	//cout << sum << endl;

	int ans = 0;
	int outlet = 1;
	while (outlet < B) {
		--outlet;
		outlet += A;
		++ans;
	}
	cout << ans << endl;

}

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

int h_count[1500 * 1000 + 1], w_count[1500 * 1000 + 1];


int main() {
	int n, m;
	while(cin >> n >> m && (n || m)){
		int h[1501] = {0}, w[1501] = {0};
		for(int i = 1; i <= n; ++i){
			cin >> h[i];
			h[i] += h[i - 1];
		}
		for(int i = 1; i <= m; ++i){
			cin >> w[i];
			w[i] += w[i - 1];
		}
		memset(h_count, 0, sizeof(h_count));
		memset(w_count, 0, sizeof(w_count));
		for(int i = 0; i < n; ++i)
			for(int j = i + 1; j <= n; ++j)
				h_count[h[j] - h[i]]++;
				
		for(int i = 0; i < m; ++i)
			for(int j = i + 1; j <= m; ++j)
				w_count[w[j] - w[i]]++;
		
		int ans = 0;
		for(int i = 1; i <= 1500 * 1000; ++i)
			ans += (h_count[i] * w_count[i]);
			
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 12900
import java.util.*;
public class Main{
	public static void main(String args[]){
		
		Scanner ob = new Scanner(System.in);
		String S = ob.next();
		int A = 0;
		int B = 0;
	        
		for(int i = 0; i < 3; i++){
			if(S.charAt(i) == 'A'){
				++A;
			}
			else{
				++B;
			}	
		}
		
		if((A > 0) && (B > 0)){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23124
N,A,B = gets.split.map(&:to_i)

# 繰返し数
num = N / (A+B)

# 繰返し分のあまり
amari = N % (A+B)

# 青いボールの個数(最低でもこの個数)
ans = num * A

# 余りが全部Aの場合
if amari <= A
  puts ans + amari
else
  # 余りの一部がAの場合
  puts ans + A
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll=long long; 
using P = pair<int,int>;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
  vector<pair<ll,int>> factor(ll x) {
    vector<pair<ll,int>> res;
    for (int p : primes) {
      int y = 0;
      while (x%p == 0) x /= p, ++y;
      if (y != 0) res.emplace_back(p,y);
    }
    if (x != 1) res.emplace_back(x,1);
    return res;
  }
};


int main() {
  ll n;
  cin >> n;
  
Sieve s(1001005);
auto fs=s.factor(n);

int ans=0;
for(auto p:fs){
    int x=p.second;
    int b=1;
    while(b<=x){
        x-=b;
        b++;
        ans++;
    }
}
  cout << ans << endl;
}

Measured memory_bytes: 7820
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
const int N=2e5+10;
int n,m;
int col[N];
vector <int> g[N];
int cnt[4];
bool flag=0;
void dfs(int x,int c){
    col[x]=c;cnt[c]++;
    for(int i=0;i<g[x].size();i++){
        if(!col[g[x][i]]) dfs(g[x][i],3-c);
        if(col[g[x][i]]==col[x]) flag=1; 
    }
}
int main(){ 
    scanf("%d%d",&n,&m);
    for(int i=1,x,y;i<=m;i++){
        scanf("%d%d",&x,&y);
        g[x].push_back(y);
        g[y].push_back(x);
    }
    for(int i=1;i<=n;i++)
        if(!col[i]) dfs(i,1);
    if(flag) printf("%lld\n",(long long)n*(n-1)/2-m);
    else {
        printf("%lld\n",(long long)cnt[1]*cnt[2]-m);
    }
    return 0;
}

Measured memory_bytes: 13132
N = int(input())
A = map(int , input().split())
B = []

flg = True
before = 0
for a in A:
    if flg:
        flg = False
        B.append(0)
        before = a
    else:
        add = max(before - a, 0)
        B.append(add)
        before = a + add

print(sum(B))

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

using namespace std;

const int N = 410;

typedef long long ll;

ll dp[N][N];
int n;
ll a[N];

ll go(int l, int r) {
  if(l >= r) return 0;
  if(dp[l][r] != -1) return dp[l][r];
  ll ans = 1e18;
  ll sum = 0ll;
  for(int i = l; i <= r; i++) sum += a[i];
  for(int i = l; i < r; i++) {
    ans = min(ans, go(l, i) + go(i + 1, r) + sum);
  }
  return dp[l][r] = ans;
}

int main() {
  memset(dp, -1, sizeof dp);
  cin >> n;
  for(int i = 0; i < n; i++) cin >> a[i];
  cout << go(0, n - 1) << '\n';
}

Measured memory_bytes: 1536