akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;


int main()
{
	int n, m;
	int q;
	vector<int> a;

	scanf("%d%d%d", &n, &m, &q);
	a.resize(q);
	for(int i = 0; i < q; ++i)
		scanf("%d", &a[i]);

	vector<int> sample;
	vector<bool> exist(m);

	for(int i = q - 1; i >= 0; --i) {
		int x = a[i];
		if(exist[x]) continue;
		exist[x] = true;
		sample.push_back(x);
	}
	for(int x = 1; x <= m; ++x) {
		if(exist[x]) continue;
		sample.push_back(x);
	}

	vector<int> pos(m + 1, -1);

	for(int i = 0; i < m; ++i)
		pos[sample[i]] = i;

	vector<int> count(m + 1);
	count[0] = n;

	for(int i = q - 1; i >= 0; --i) {

		int x = a[i];
		int p = pos[x];

		if(count[p] > 0) {
			count[p] -= 1;
			count[p + 1] += 1;
		}
	}

	int border = m;

	for(int p = m - 1; p >= 1; --p) {
		if(sample[p - 1] > sample[p]) break;
		border = p;
	}
	if(border == 1) border -= 1;

	bool ok = true;

	for(int i = 0; i < border - 1; ++i) {
		if(count[i] > 0)
			ok = false;
	}

	/*for(int i = 0; i <= m; ++i) {
		printf("count[%d] = %d\n", i, count[i]);
	}
	for(int i = 0; i < m; ++i) {
		printf("sample[%d] = %d\n", i, sample[i]);
	}
	printf("border: %d\n", border);*/

	printf("%s\n", ok ? "Yes" : "No");

	return 0;
}


Measured memory_bytes: 1916
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

const int L=1e6;
LL A[L];
LL S[L];
int N;
int main() {
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> A[i];
	}
	S[0]=A[0];
	for(int i=1;i<N;i++){
		S[i]=S[i-1]+A[i];
	}
	LL ret=1LL<<60;
	for(int i=1;i<=N;i++){
		int p=lower_bound(S,S+i,S[i-1]/2)-S;
		int q=lower_bound(S+i,S+N,(S[N-1]-S[i-1])/2+S[i-1])-S;
#if 0
		if(i==3){
			cout << p << ", " << q << endl;
		}
#endif
		for(int u=p-2;u<p+3;u++){
			if(u<0)continue;
			if(i-1-u<=0)continue;
			LL c=S[u];
			LL d=S[i-1]-S[u];
			for(int v=q-2;v<q+3;v++){
				if(v-(i-1)<=0)continue;
				if(N-1-v<=0)continue;
				LL e=S[v]-S[i-1];
				LL f=S[N-1]-S[v];
				ret=min(ret,max({c,d,e,f})-min({c,d,e,f}));
				
			}
		}
	}
#if 0
	for(int i=0;i<N;i++)for(int j=i+1;j<N;j++)for(int k=j+1;k<N-1;k++){
		LL a=S[i];
		LL b=S[j]-S[i];
		LL c=S[k]-S[j];
		LL d=S[N-1]-S[k];
		LL r=max({a,b,c,d})-min({a,b,c,d});
		if(r==36){
			cout << a << ", " << i << endl;
			cout << b << ", " << j << endl;
			cout << c << ", " << k << endl;
			cout << d << endl;
		}
	}
#endif
	cout << ret << endl;


	return 0;
}



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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i, n) cin >> v[i];

  vector<int> even(100001), odd(100001);
  rep(i, n) {
    if (i % 2 == 1) odd[v[i]]++;
    else even[v[i]]++;
  }
  int e1 = 0, e2 = 0, o1 = 0, o2 = 0, en1, en2, on1, on2;
  rep(i, 100001) {
    if (even[i] > e1) e1 = even[i], en1 = i;
    if (odd[i] > o1) o1 = odd[i], on1 = i;
  }
  rep(i, 100001) {
    if (even[i] > e2 && en1 != i) e2 = even[i], en2 = i;
    if (odd[i] > o2 && on1 != i) o2 = odd[i], on2 = i;
  }
  int ans1 = 0, ans2 = 0, ans = 0;
  if (en1 != on1) {
    rep(i, n) {
      if (i % 2 == 1) {
        if (on1 != v[i]) ans++;
      }
      else {
        if (en1 != v[i]) ans++;
      }
    }
  } 
  else {
    rep(i, n) {
      if (i % 2 == 1) {
        if (on1 != v[i]) ans1++;
        if (on2 != v[i]) ans2++;
      }
      else {
        if (en1 != v[i]) ans2++;
        if (en2 != v[i]) ans1++;
      }
    }
    ans = min(ans1, ans2);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n;
    cin>>n;
    string a;
    cin>>a;
    vector<int>b(n);
    if(a.at(0)=='W'){
        b.at(0)=-1;
    }
    else{
        b.at(0)=1;
    }
    for(int i=1;i<n;i++){
        if(a.at(i)=='W'){
            b.at(i)=b.at(i-1)-1;
        }
        else{
            b.at(i)=b.at(i-1)+1;
        }
    }
    // for(int i=0;i<n;i++){
    //     cout<<b.at(i)<<endl;
    // }
    int MAX=-500;
    int index=0;
    for(int i=0;i<n;i++){
        if(MAX<=b.at(i)){
            index=i;
            MAX=b.at(i);
        }
    }
    int ans=0;
    for(int i=0;i<index;i++){
        if(a.at(i)=='W'){
            ans++;
        }
    }
    for(int i=index+1;i<n;i++){
        if(a.at(i)=='E'){
            ans++;
        }
    }
    cout<<ans<<endl;
    // cout<<index<<endl;
    // cout<<"AAAA"<<endl;
    // for(int i=0;i<n;i++){
    //     cout<<b.at(i)<<endl;
    // }








    return 0;
}


Measured memory_bytes: 1796
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

ll a, b, c, k;
ll ans;

int main()
{
    cin>>a>>b>>c>>k;
    ll aa = min(a, k);
    ans += aa;
    a -= aa;
    k -= aa;
    ll bb = min(b, k);
    b -= bb;
    k -= bb;
    ll cc = min(c, k);
    ans -= cc;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3748
N,T = (int(x) for x in input().split())

min_c = 10000
for i in range(1, N+1):
    ci, ti = (int(x) for x in input().split())
    if ti <= T:
        min_c = min(min_c, ci)

if min_c > 1000:
    print("TLE")
else:
    print(min_c)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1e09+7;



#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back





int main(){

  int n,k;
  cin>>n>>k;
  int r,s,p;
  cin>>r>>s>>p;
  string t;
  cin>>t;
  
  int answer=0;
  string myhand;
  rep(i,n){
    myhand+=" ";
  }
  
  rep(i,k){
    if (t.at(i)=='r'){
      answer+=p;
      myhand.at(i)='p';
    }
    else if (t.at(i)=='s'){
      answer+=r;
      myhand.at(i)='r';
    }
    else if (t.at(i)=='p'){
      answer+=s;
      myhand.at(i)='s';
    }
  }
  
  for (int i=k;i<n;i++){
    if (t.at(i)=='r'){
      if (t.at(i-k)!='r' or myhand.at(i-k)!='p'){
        answer+=p;
        myhand.at(i)='p';
      }
      else {
        myhand.at(i)='r';
      }
    }
    else if (t.at(i)=='s'){
      if (t.at(i-k)!='s' or myhand.at(i-k)!='r'){
        answer+=r;
        myhand.at(i)='r';
      }
      else {
        myhand.at(i)='s';
      }
    }
    else if (t.at(i)=='p'){
      if (t.at(i-k)!='p' or myhand.at(i-k)!='s'){
        answer+=s;
        myhand.at(i)='s';
      }
      else {
        myhand.at(i)='p';
      }
    }
  }
  
  cout<<answer<<endl;
  
    
  
  

}




















Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
int main(void){
	char s[100];
	int i,len,cnt=0;
	scanf("%s",s);
	len=strlen(s);
	for(i=0;i<len/2;i++){
		if(s[i]!=s[len-i-1]){
			cnt++;
		}
	}
	printf("%d",cnt);
	return 0;
}

Measured memory_bytes: 1732
from collections import Counter

N = int(input())
As = list(map(int, input().split()))

cntA = Counter(As)
cntCntA = Counter(cntA.values())

accDs = [cntCntA[0]]
for i in range(1, N+1):
    accDs.append(accDs[-1] + cntCntA[i])

accKDs = [0]
for i in range(1, N+1):
    accKDs.append(accKDs[-1] + i*cntCntA[i])

fXs = [0]
for X in range(1, N+1):
    fXs.append((accKDs[X] + X*(accDs[N]-accDs[X])) // X)

anss = [0] * (N+1)
for X, fX in enumerate(fXs):
    anss[fX] = X

for i in reversed(range(N)):
    if anss[i] == 0:
        anss[i] = anss[i+1]

print('\n'.join(map(str, anss[1:])))


Measured memory_bytes: 81100
#include <bits/stdc++.h>
//F6編譯，右上三角形執行，ctrl+c強制停止執行  F5開啟exe
#define ll long long
#define maxn 100005
#define mod 1000000007
using namespace std;

typedef pair<int, int> P;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b + c >= 22)
        cout << "bust";
    else
        cout << "win";

    return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  if(n<105)cout<<0<<endl;
  else if(n<135)cout<<1<<endl;
  else if(n<165)cout<<2<<endl;
  else if(n<189)cout<<3<<endl;
  else if(n<195)cout<<4<<endl;
  else cout<<5<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define int long long
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
signed main() {
	cin >> N >> M;
	vector< int > S(N + 1), T(M + 1);
	rep(i, N) cin >> S[i + 1];
	rep(j, M) cin >> T[j + 1];
	vector< vector< int > > dp(N + 1, vector< int >(M + 1, 0));
	vector< vector< int > > sum(N + 1, vector< int >(M + 1, 0));
	for (int i = 1; i <= N; i++)
		for (int j = 1; j <= M; j++) {
			if (S[i] == T[j]) {
				dp[i][j] = (sum[i - 1][j - 1] + 1) % MOD;
			}
			sum[i][j] = ((sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + dp[i][j]) % MOD + MOD) % MOD;
		}
	cout << (sum[N][M] + 1) % MOD << endl;
	return 0;
}

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

#define ll long long
#define rep(i,N) for(ll i=0; i<N; i++)
const int mx = 2e5;

int main(void){
  double a;
  cin >> a;
  
  cout << a*6.2831853;

  return 0;
}


Measured memory_bytes: 3756
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    int dig, k;
    cin >> s >> k;
    dig = s.size();
    ll dp[102][2][5] = {};
    dp[1][1][0] = 1;
    dp[1][0][1] = 1;
    dp[1][1][1] = (int)(s[0] - '1');
    repp (i, 1, dig) {
        reprev (k, 4) {
            dp[i + 1][0][k]     += (s[i] == '0' ? dp[i][0][k] : 0);
            dp[i + 1][0][k + 1] += (s[i] != '0' ? dp[i][0][k] : 0);
            dp[i + 1][1][k]     += (s[i] != '0' ? dp[i][0][k] : 0);
            dp[i + 1][1][k + 1] += (s[i] != '0' ? dp[i][0][k] * (int)(s[i] - '1') : 0);
            dp[i + 1][1][k]     += dp[i][1][k];
            dp[i + 1][1][k + 1] += dp[i][1][k] * 9;
            
        }
    }
    rep (i, dig + 1) {
        rep (j, 2) {
            rep (k, 5) {
                eprintf("%lld ", dp[i][j][k]);
            }
            eprintf("\n");
        }
        eprintf("\n");
    }
    int ans = 0;
    cout << dp[dig][0][k] + dp[dig][1][k] << "\n";
    return 0;
}

Measured memory_bytes: 256
/* Manish Pant - insider_pants */

#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#include "debug.h"
#endif

#define F first
#define S second
#define endl "\n"
#define pb push_back
typedef long long ll;
typedef long double ldob;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

const int N = 1e7 + 5;
vector<ll> v(N);

int main()
{
    fast();
    int n; cin >> n;

    ll ans = 0;
    for(int i = 1; i <= n; i++)
    {
        for(int j = i; j <= n; j += i)
            v[j]++;
        ans += v[i] * i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 81212
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1000000007;
const ll LINF = (1LL << 62);
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int n; cin >> n;
	ll a; vector<ll> l(n, 0);
	REP(i, n) {
		cin >> a;
		if (i != 0)
			l[i] = l[i - 1] + a;
		else
			l[i] = a;
	}
	ll ans = LINF;
	REP(i, n) {
		ans = min(ans, abs(l[n - 1] - l[i] * 2));
	}
	cout << ans;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <cassert>
using namespace std;

int main(){
    int N;
    cin >> N;
    int ans = 0;
    for(int i=1; i<=N; i++){
        string S = to_string(i);
        if(S.size()%2) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <algorithm>
#include <functional>
#include <utility>
#include <string>
#define typeof(x) __typeof__(x)
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);--i)

#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) UB(c,x)-LB(c,x)
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (s).find(e)!=(s).end()
#define PB push_back
#define MP make_pair
#define vec vector

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

using namespace std;

typedef pair<int,int> P;
struct edge { int to, cost; };

const int INF = 1e18;
const int MOD = 1e9+7;

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

signed main()
{
  int N, X; cin >> N >> X;
  vec<int> x(N+1);
  x[0] = 0;
  rep(i, 1, N+1) {
    cin >> x[i];
  }
  vec<int> s(N+1);
  s[0] = 0;
  rep(i, 1, N+1) {
    s[i] = s[i-1] + x[i];
  }

  int MIN = INF;
  rep(k, 1, N+1) {
    int score = 0;

    score += 5 * (s[N] - s[max((int)0,N-k)]);

    for (int i = 1; N - k*i > 0; i++) {
      if (score > INF/2) {
        continue;
      }
      score += (2*i + 3) * (s[N-k*i] - s[max((int)0,N-k*(i+1))]);
    }

    score += X*k;
    score += N*X;
    MIN = min(MIN, score);
  }

  cout << MIN << endl;

  return 0;
}


Measured memory_bytes: 3328
#pragma GCC optimize ("Ofast")
#pragma GCC target(*sse4.2*)
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define PB push_back
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define vvii vector<vii>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define read(x) long long x;cin>>x;
#define FOR(a,b,c,d) for(int a=b;a<=c;a+=d)
#define MP make_pair
#define F first
#define S second
#define debug(x) cout<<(#x)<<": "<<(x)<<"\n"
#define SZ(x) x.size()
#define mod 1000000007
#define lg2(x) 63-(__builtin_ctzll(x))
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
typedef unsigned long long ull;
typedef long double d64;

int main(){
read(x);
if(x>=30)cout<<"Yes";
else cout<<"No";
return 0;
}


Measured memory_bytes: 3616
#include <iostream>

using namespace std;

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

    int aux_5 = 0;
    int aux_7 = 0;

    if(a==5) {
        aux_5++;
    } else if(a==7) {
        aux_7++;
    }
    
    if(b==5) {
        aux_5++;
    } else if(b==7) {
        aux_7++;
    }
    
    if(c==5) {
        aux_5++;
    } else if(c==7) {
        aux_7++;
    }

    if(aux_5==2 && aux_7==1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
package main

import (
	"fmt"
	"sort"
)

type prefecture struct {
	arr [][]int
}

func (p *prefecture) init(n int) {
	p.arr = make([][]int, n)
	for i := 0; i < n; i++ {
		p.arr[i] = make([]int, 0)
	}
}

func (p *prefecture) add(n int, val int) {
	p.arr[n-1] = append(p.arr[n-1], val)
}

func (p *prefecture) sort() {
	for n := 0; n < len(p.arr); n++ {
		sort.Sort(sort.IntSlice(p.arr[n]))
	}
}

func (p *prefecture) print(n int, val int) {
	index := sort.SearchInts(p.arr[n-1], val)
	fmt.Printf("%06d%06d\n", n, index+1)
}

func main() {
	var n, m int
	var p, y int
	fmt.Scan(&n)
	fmt.Scan(&m)
	var pre prefecture
	pre.init(n)

	arr := make([][]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&p)
		fmt.Scan(&y)
		pre.add(p, y)
		arr[i] = []int{p, y}
	}
	pre.sort()
	for i := 0; i < m; i++ {
		pre.print(arr[i][0], arr[i][1])
	}
}


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

int main() {
int N;
string S;
cin >> N;
cin >> S;
int A = 0;
for (int i = 0; i < N; i++) {
    if (i + 1 < N){
    if (S.at(i) == S.at(i + 1)) {
        A++;
}
}
}
cout << N - A << endl;
}


Measured memory_bytes: 512
using System;
using System.Linq;

class Program
{
  public static void Main(string[] args)
  {
    int n = int.Parse(Console.ReadLine());
    int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
    Array.Sort(s);
    Array.Reverse(s);
    int alice = 0;
    int bob = 0;
    for (int i = 0; i < n; i ++) {
      if (i % 2 == 0) alice += s[i];
      else bob += s[i];
    }
    Console.WriteLine(alice - bob);
  }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef vector<lint> vlint;

#define inf 1e+9
#define endl "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

#define pb push_back
#define eb emplace_back
#define Size(c) (int)(c).size()

#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))

template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;

template <class T, class S> inline bool chmax(T &a, S b) {
    if(a < b) {a = b;return 1;} return 0;
}
template <class T, class S> inline bool chmin(T &a, S b) {
    if(a > b) {a = b;return 1;} return 0;
}
template <class T>
void line(vector<T> &x){for (auto&& xi : x) cin >> xi;}

inline void IN(void){ return;}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){ cin >> first; IN(rest...); return;}

#define INT(...) int __VA_ARGS__; IN (__VA_ARGS__)
#define LINT(...) lint __VA_ARGS__; IN (__VA_ARGS__)
#define STR(...) string __VA_ARGS__; IN(__VA_ARGS__)

template <class T> void UNIQUE(vector<T> &x) {
    sort(all(x)); x.erase(unique(all(x)), x.end());
}
template <class T> void print_vec(vector<T> a){
    for (const auto& ai : a) cout << ai << " ";
    cout << endl;
}
vector<string> Yes = {"No", "Yes"};

int main(){
    INT(n, m);
    vlint a(n); line(a);
    int sum = accumulate(all(a), 0);
    int ret = 0;
    for (auto&& p : a){
        if (sum <= p * 4 * m) ret++;
    }
    int y = 0;
    if (ret >= m){
        y = 1;
    }
    cout << Yes[y] << endl;
    
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-10;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int a,b,x;

int main(){
	cin>>x>>a>>b;
	cout<<(x-a)%b<<endl;
}

Measured memory_bytes: 256
//Code by Anshuman Das Gupta

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define MOD 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define loop(I,N) for(int i=I;i<N;i++)
#define sortvec(V) sort(V.begin(),V.end())
#define vec vector<int>
#define endl "\n"
using namespace std;
#define PI 3.14159265359
int fast_power(int base, int power) {
    int result = 1;
    while (power > 0) {

        if (power & 1) {
            result = (result * base) % MOD;
        }
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result % MOD;
}

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

int binsearch(int a[], int f, int r, int x) {
    while (f <= r) {
        int mid = (f + r) / 2;
        if (a[mid] == x)
            return mid;
        else if (a[mid] > x) {
            r = mid - 1;
        }
        else {
            f = mid + 1;
        }
    }
    return -1;
}
void sieve(int a[], int n) {
    a[0] = 0;
    a[1] = 0;
    for (int i = 2; i <= n; i++) {
        if (a[i] == 1) {
            for (int j = i + i; j <= n; j += i) {
                a[j] = 0;
            }
        }
    }
}
int32_t main() {
#ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt", "r", stdin);
    //for writing output to output.txt
    freopen("out.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
    while (t--) {
        int r;
        cin >> r;
        long double ans = 2.0 * PI * r;
        cout << setprecision(20) << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3836
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 1000000007
  #define N 50000005
  #define INF 1000000000000
  #define eps 1e-6


  int32_t main()
  {         


    IOS

    int n,k;
    cin >> n >> k;
    vector<int> v;

    for(int i = 1; i <= n; i++)
    {
      int x;
      cin >> x;
      v.PB(x);
    }

    sort(all(v));

    int y = v.size() - k;
    if(y <0) y = 0;
    for(int i = v.size()- 1; i >=y; i--)
    {
      v[i] = 0;
    }

    int ans =0;

    for(int i = 0; i < v.size(); i++)
    {
      ans += v[i];
    }

    cout << ans;
    return 0; 
}

Measured memory_bytes: 2420
#include <stdio.h>


int main(){
	int i;
	int n0, m0;
	int a0, b0;
	scanf("%d %d", &n0, &m0);
	int ans[n0];


	for(i=0;i<n0;i++){
		ans[i]=0;
	}
	for(i=0;i<m0;i++){
		scanf("%d %d", &a0, &b0);
		ans[--a0]++;
		ans[--b0]++;
	}


	for(i=0;i<n0;i++){
		printf("%d\n", ans[i]);
	}

	return 0;
}


Measured memory_bytes: 128
N = int(input())
As = list(map(int, input().split()))
ss = [0]
s = 0
for A in As:
  s += A
  ss.append(s)
#print(ss)
nss = {}
for s in ss:
  if s not in nss: nss[s] = 0
  nss[s] += 1
#print(nss)
r = 0
for s in nss:
  n = nss[s]
  r += n*(n-1)//2
print(r)


Measured memory_bytes: 41108
import sys
from collections import deque
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

s = input()
t = input()
ans = "No"
s = deque(s)
for i in range(len(s)):
    if list(s) == list(t):
        ans = "Yes"
        break
    s.appendleft(s.pop())
print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define smax(a, b) ((a) < (b) ? ((a)=(b), true) : false)
#define smin(a, b) ((a) > (b) ? ((a)=(b), true) : false)
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using namespace std;

char a[3001];
char b[3001];
int dp[3001][3001];
int dir[3001][3001];
char add[3001][3001];
stack <char> ans;


int main() {
    cin >> a >> b;
    int alen = strlen(a);
    int blen = strlen(b);
    for(int i = 1; i <= alen; i++)
    {
        for(int j = 1; j <= blen; j++)
        {
            int x = dp[i-1][j-1];
            int y = dp[i-1][j];
            int z = dp[i][j-1];
            if(a[i-1] == b[j-1]) x++;

            dp[i][j] = max({x, y, z});
            if(dp[i][j] == x)
            {
                dir[i][j] = 1;
                if(a[i-1] == b[j-1])
                {
                    add[i][j] = a[i-1];
                }
            }
            else if(dp[i][j] == y)
            {
                dir[i][j] = 2;
            }
            else if(dp[i][j] == z)
            {
                dir[i][j] = 3;
            }
        }
    }

    int dx = alen;
    int dy = blen;
    while(dx > 0 && dy > 0)
    {
        if(add[dx][dy] != 0)
        {
            ans.push(add[dx][dy]);
        }
        if(dir[dx][dy] == 1)
        {
            dx--;
            dy--;
        }
        else if(dir[dx][dy] == 2)
        {
            dx--;
        }
        else if(dir[dx][dy] == 3)
        {
            dy--;
        }
    }

    while(!ans.empty())
    {
        cout << ans.top();
        ans.pop();
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 79360
using System;
using System.Linq;

namespace ARC059
{
    class C
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int sum = a.Sum();
            int c = 0;
            if (sum % N == 0) c = sum / N;
            else if ((double)N / 2d < sum % N) c = sum / N + 1;
            else c = sum / N;

            double res = 0;
            for (int i = 0; i < N; i++)
            {
                res += Math.Pow(a[i] - c, 2);
            }
            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 11732
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <array>
#include <deque>
#include <bitset>
typedef long long ll;
using namespace std;
#define trace(x) cerr << #x << " is " << x << endl;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    vector<int> res(N + 1, 0);
    int t;
    for (int i = 2; i <= N; i++) {
        cin >> t;
        res[t]++;
    }
    for (int i = 1; i <= N; i++) {
        cout << res[i] <<endl;
    }
    return 0;
}

Measured memory_bytes: 3976
unittest
{
	assert( [ "6", "khabarovsk 20", "moscow 10", "kazan 50", "kazan 35", "moscow 60", "khabarovsk 40" ].parse.expand.solve == "3\n4\n6\n1\n5\n2" );
	assert( [ "10", "yakutsk 10", "yakutsk 20", "yakutsk 30", "yakutsk 40", "yakutsk 50", "yakutsk 60", "yakutsk 70", "yakutsk 80", "yakutsk 90", "yakutsk 100" ].parse.expand.solve == "10\n9\n8\n7\n6\n5\n4\n3\n2\n1" );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	auto spis = new Tuple!( string, long, long )[]( n );
	foreach( i, ref spi; spis )
	{
		input.popFront;
		auto ts = input.front.split;
		spi = tuple( ts[ 0 ], ts[ 1 ].to!( long ), i + 1 );
	}
	return tuple( spis );
}

auto solve( Tuple!( string, long, long )[] spis )
{
	spis.multiSort!( ( a, b ) => a[ 0 ] < b[ 0 ], ( a, b ) => b[ 1 ] < a[ 1 ] );
	return spis.map!( ( a ) => a[ 2 ].to!( string ) ).join( "\n" );
}


Measured memory_bytes: 2300
#include<iostream>
using namespace std;
int main(){
  int gp=0,wr=0;
  string s;
  cin >> s;
  for(int i=0;i<s.size();i++){
    if(gp>=1){
      gp--;
      if(s[i]=='g')wr++;
    }else{
      gp++;
      if(s[i]=='p')wr--;
    }
  }
  cout <<wr<<endl;
}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

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

	int cnt = 0;
	for (int i = 0; i <= a; i++)
	{
		for (int j = 0; j <= b; j++)
		{
			for (int k = 0; k <= c; k++)
			{
				int a0 = 500 * i;
				int b0 = 100 * j;
				int c0 = 50 * k;
				if (a0 + b0 + c0 == x)
				{
					cnt++;
				}
			}
		}
	}

	cout << cnt << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main() {
	ll n;
	cin >> n;
	vector<ll>a(n);
	repp(i, 0, n)cin >> a[i];
	//しゃくとり法
	ll right = 0,sum=0,cnt=0;
	for (ll left = 0; left < n; ++left) {
		while (right < n && (sum^a[right]) == (sum+a[right])) {
			sum += a[right++];
		}
		cnt += right - left;//[left,right)より
		if (left == right)++right;//leftはrightを追い越さない
		else {
			sum -= a[left];//しゃくとりむしの尾が進む
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
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; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

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

    int N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N)cin >> A[i];
    sort(all(A));
    ll ans = 0;
    rep(i,K){
        ans += A[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3664
#include<iostream>//树状数组
#include<iomanip> 
#include<map>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
#define debug(x) cerr<<#x<<"="<<x<<endl;
#define m(a,b) memset(a,b,sizeof(a))
typedef long long ll;
const int maxn=1e5+100;

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

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

int main() {
    ll N;
    cin >> N;
    int divisors[N + 1] = {0};
    for(int i = 1; i <= N; i++) {
        for(int j = 1; i * j <= N; ++j) {
            ++divisors[i * j];
        }
    }

    ll res = 0;
    for(int i = 1; i <= N; i++) {
        res += ll(i) * divisors[i];
    }
    cout << res << endl;

    return 0;
}


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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

#define POS(i,j) ((i)*8+(j))

int calc(int k,int *c,int *used,int depth,int n){
  if(used[k]) return 0;
  if(depth==n-1) return 1;
  used[k]=1;
  int res=0;
  int i;
  for(i=0;i<n;i++){
    if(c[POS(k,i)]==0) continue;
    res+=calc(i,c,used,depth+1,n);
  }
  used[k]=0;
  return res;
}

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  int c[64]={};
  int i;
  for(i=0;i<m;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    a--;b--;
    c[POS(a,b)]=1;
    c[POS(b,a)]=1;
  }
  int used[8]={};
  int ans=calc(0,c,used,0,n);
  printf("%d\n",ans);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
import numpy as np

N, M, C = map(int, input().split())
ans = 0
B = np.array(list(map(int, input().split())))
for i in range(N):
    A = np.array(list(map(int, input().split())))
    if np.sum(A * B) + C > 0:
        ans += 1
print(ans)

Measured memory_bytes: 22028
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
int op[N];
int main()
{
    FASTINOUT;
    int x,k,q,l;
    cin>>x>>k>>q;
    for (int i=0;i<q;i++){
        cin>>l;
        op[l]++;
    }
    for (int i=1;i<=x;i++){
        if (k-q+op[i]>0)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

char c[9];

int main() {
    REP(i,9) {
        cin >> c[i];
    }
    cout << c[0] << c[4] << c[8] << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

const mod int = 1e9 + 7

func main() {
	var n int
	fmt.Scan(&n)

	a := pow(10, n)
	c0 := sub(a, pow(9, n))
	c9 := c0
	c09 := sub(a, pow(8, n))
	ans := sub(add(c0, c9), c09)
	fmt.Println(ans)
}

func pow(n, k int) int {
	if k == 0 {
		return 1
	} else if k%2 == 1 {
		return pow(n, k-1) * n % mod
	} else {
		t := pow(n, k/2)
		return t * t % mod
	}
}

func add(a, b int) int {
	return (a + b) % mod
}

func sub(a, b int) int {
	return (a + mod - b) % mod
}

func mul(a, b int) int {
	return a % mod * b % mod % mod
}


Measured memory_bytes: 1772
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>

/*
 *変数
 */
int p[5],k=0;

/*
 *関数
 */
int ctoi(char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

/*
 *解 
 */
void solve(){
    std::sort(p,p+5);
    if(p[4]-p[0]<=k)printf("Yay!");
    else printf(":(");
}

/*
 *入力 
 */
int main(){
       std::cin.tie(0);
       std::ios::sync_with_stdio(false);
       for(int i=0;i<5;i++){
         std::cin>>k;
         p[i]=k;
       }
       std::cin>>k;
       solve();
       return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std;
template<class T>il read(T &x){
	int f=1;char k=getchar();x=0;
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x/10) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
ll mul(ll a,ll b,ll mod){long double c=1.;return (a*b-(ll)(c*a*b/mod)*mod)%mod;}
it qpow(int x,int m,int mod){
	int res=1,bas=x;
	while(m){
		if(m&1) res=(1ll*res*bas)%mod;
		bas=(1ll*bas*bas)%mod,m>>=1;
	}
	return res;
}
const int N = 4e3+5;
int n,cnt[N][4],val[N];
ll ans;
char s[N];
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n),scanf("%s",s+1);
	for(ri i=1;i<=n;++i){
		if(s[i]=='R') val[i]=1;
		if(s[i]=='G') val[i]=2;
		if(s[i]=='B') val[i]=3;
	}
	for(ri i=1;i<=n;++i) for(ri j=1;j<=3;++j) cnt[i][j]=cnt[i-1][j]+(val[i]==j);
	for(ri i=1;i<n;++i){
		for(ri j=i+1;j<=n;++j){
			if(val[i]==val[j]) continue;
			int k=6-val[i]-val[j];
			ans+=cnt[j][k]-cnt[i][k];
			if((i+j)%2==0) ans-=val[(i+j)/2]==k;
		}
	}
	print(ans);
	return 0;
}

Measured memory_bytes: 3744
/**
*    created: 28.06.2020 02:10:44
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pcnt(bit) __builtin_popcountll(bit)
using namespace std;
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;}
const int mod = 1000000007;
const long double pi = acos(-1.0);
const int inf = 1LL << 60;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    int i = 0;
    while (true) {
        if (k * i >= n + i - 1) break;
        i++;
    }
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 3656
s = input()

if s == "hi":
    print("Yes")
elif s == "hihi":
    print("Yes")
elif s == "hihihi":
    print("Yes")
elif s == "hihihihi":
    print("Yes")
elif s == "hihihihihi":
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
n = int(input())
primes = []
t = 2
n_ = n
while t*t <= n_ and t*t < n:
    if n % t == 0:
        cnt = 1
        while n % (t ** (cnt+1)) == 0:
            cnt += 1
        primes.append([t,cnt])
        n //= (t**cnt)
    t += 1
if n != 1:
    primes.append([n,1])

def largest_tri(m):
    cnt = 0
    for i in range(1,m+3):
        cnt += i
        if cnt > m:
            return i - 1

ret = 0
for p in primes:
    ret += largest_tri(p[1])
print(ret)

Measured memory_bytes: 63184
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>

int main() {
    int N;
    std::cin >> N;
    std::vector<int> v(N);
    std::iota(v.begin(), v.end(), 1);

    do {
        for (int i = 0; i < v.size(); ++i) {
            std::cout << v[i] << " \n"[i == v.size() - 1];
        }
    } while (std::next_permutation(v.begin(), v.end()));
}



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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

bool func(vector<int>& A, int mid) {
    int size = A[mid];
    rep(i, A.size()) {
        if (i == mid) continue;

        if (size * 2 >= A[i]) {
            size += A[i];
        }
    }

    return size >= A.back();
}

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

    vector<int> A(N);
    rep(i, N) cin >> A[i];

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

    int l = -1, r = N;
    while (r - l > 1) {
        int mid = (l + r) / 2;
        (func(A, mid) ? r : l) = mid;
    }

    int ans = N - r;

    cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int H,W;
int d[30];
int main(){
    REP(i,30){
        d[i]=0;
    }
    cin>>H>>W;
    REP(i,H){
        string s;
        cin>>s;
        REP(i,W){
            d[s[i]-'a']++;
        }
    }
    int two=0;
    int one=0;
    int three=0;
    REP(i,30){
        if(d[i]%4==1){
           one++;
        }
        if(d[i]%4==2){
           two++;
        }
        if(d[i]%4==3){
           one++;
           two++;
        }
    }
    if(H%2==0&&W%2==0){
       if(one==0&&two==0){
          cout<<"Yes"<<endl;
       }else{
          cout<<"No"<<endl;
       }
    }
    if(H%2==0&&W%2==1){
       if(one!=0){
          cout<<"No"<<endl;
       }else if(two<=H/2){
          cout<<"Yes"<<endl;
       }else{
          cout<<"No"<<endl;
       }
    }
    if(H%2==1&&W%2==0){
       if(one!=0){
          cout<<"No"<<endl;
       }else if(two<=W/2){
          cout<<"Yes"<<endl;
       }else{
          cout<<"No"<<endl;
       }
    }
    if(H%2==1&&W%2==1){
       if(one!=1){
          cout<<"No"<<endl;
       }else if(two<=H/2+W/2){
          cout<<"Yes"<<endl;
       }else{
          cout<<"No"<<endl;
       }
    }
    return(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
const int inf=0x3f3f3f3f;
#define endl '\n'

int n,a[N],sq[N],cnt,start,t;
ll k;

int main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sq[i]=-1;
	}
	cnt=-1;
	for(int i=1;;){
		cnt++;
		if(cnt==k) {
			cout<<i<<endl;
			return 0;
		}
		if(sq[i]==-1) {
			sq[i]=cnt;
			i=a[i];
		}
		else {
			t=cnt-sq[i];
			if(i==1){
				start=a[1];
				k=(k-1)%t;
			}
			else {
				start=i;
				k=(k-sq[i])%t;
			}
			break;
		}
	}
	cnt=-1;
	for(int i=start;;i=a[i]){
		cnt++;
		if(cnt==k) {
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}
/*
k可能比较小，直接模拟得到。
也可能比较多，会进入循环， 
要找周期，来减少模拟的步数。
注意循环起点为1和非1的处理是不一样的。 
*/

Measured memory_bytes: 5212
// ConsoleApplication11.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdio.h"

int main()
{
	int N;
	int a;
	int i;
	i = 1;
	a = 1;
	scanf("%d", &N);
	if (N == 3 || N == 5 || N == 7){

		printf("YES\n");
	}
	else {
		printf("NO\n");
	}

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define LINT long long

int main(){
  int A, B;
  cin >> A;
  cin >> B;

  if(A<9 && B<9) cout << "Yay!";
  else cout << ":(";


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#define FIN freopen("inputs.txt", "r", stdin)
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
#define f first
#define s second
bool isPrime(int n){
    for (int i = 2; i < (int)sqrt(n); i++)
    {
        if(n % i == 0) return false;
    }
    return true;
}
int main(){
//FIN;
    long maxint = 0x7fffff;
    long n;
    cin>>n;
    while(!isPrime(n)) n++;
    cout<<n<<endl;
    return 0;
}

Measured memory_bytes: 384