akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using edge = struct {
  int to;
  int cost;
};
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define BITS(n, num) std::bitset<(n)>((num)).to_string()
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1};
int dy[4] = {1, 0, -1};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  map<pll, ll> F;
  ll H, W, N;
  cin >> H >> W >> N;
  vl A(N), B(N);
  REP(i, N) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    REP(x, 3) REP(y, 3) {
      if (a + dy[y] >= 1 && a + dy[y] < H - 1 && b + dx[x] >= 1 &&
          b + dx[x] < W - 1) {
        pll po = make_pair(a + dy[y], b + dx[x]);
        if (F.find(po) != F.end())
          F[po]++;
        else
          F[po] = 1;
      }
    }
  }
  vl ans(10, 0);
  ll sum = 0;
  AUTO(m, F) {
    ans[m.second]++;
    sum++;
  }
  cout << ((H - 2) * (W - 2)) - sum << endl;
  FOR(i, 1, 10) { cout << ans[i] << endl; }

  return 0;
}


Measured memory_bytes: 58112
#include<bits/stdc++.h>
using namespace std;
     
     
//#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define pld(x) printf("%lld\n",x)
#define pd(x) printf("%d\n",x)

int main(){
    string s;
    cin >> s;
    int k = s.size();
    int win = 0;
    for (int  i = 0; i < k; i++){
        if(s[i] == 'o')
            win++;
        if(win == 8)
            break;
    }
    if(win >= k-7)
        printf("YES\n");
    else 
        printf("NO\n");

    return 0;


}

Measured memory_bytes: 256
k = 38
n = k + (k - 1) * (k - 1)
v = [[] for i in xrange(n)]
for i in xrange(k):
    v[i].append(1)
    s = i * (k - 1) + 2
    for j in xrange(s, s + k - 1):
        v[i].append(j)
for i in xrange(2, k + 1):
    s = k + (i - 2) * (k - 1)
    for j in xrange(s, s + k - 1):
        v[j].append(i)
for i in xrange(k - 1):
    for x in xrange(k - 1):
        g = k + 1 + i * (k - 1) + x
        p = x
        for y in xrange(k - 1):
            v[k+y*(k-1)+p].append(g)
            p += i
            if p >= k - 1:
                p -= k - 1
print n, k
for i in xrange(n):
    print " ".join(map(str, v[i]))


Measured memory_bytes: 3588
import bisect
num = []
X, N = map(int, input().split())

num = list(map(int, input().split()))

if len(num) > 0:
    num.sort()
    id = bisect.bisect_left(num, X)

    #travel upward
    idDown = id
    down = X
    while (idDown >= 0) and (down == num[idDown]):
        down -= 1
        idDown -= 1

    idUp = id
    up = X
    while (idUp < N) and (up == num[idUp]):
        up += 1
        idUp += 1

    if (X - down) <= (up - X):
        print(down)
    else:
        print(up)

else:
    print(X)


Measured memory_bytes: 61744
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if ( a == 5 && b == 5 && c == 7 ||
         a == 5 && b == 7 && c == 5 ||
         a == 7 && b == 5 && c == 5 ) cout << "YES" << endl;
    else                              cout << "NO" << endl;
    return 0;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#define MOD (long)(1e9 + 7)

long long modPow(long long x, long long n){
  if(n == 0) return 1;
  if(n % 2 == 0) {
    long long sqrtX = modPow(x,n/2);
    return sqrtX * sqrtX % MOD ;
  }else{
    return x * modPow(x,n-1) % MOD;
  }
}

long long kaizyou(long long x){
  long long res = 1;
  for(int i = 1; i <= x; i++){
    res = (res * i) % MOD;
  }
  return res;
}

long long modCombi(long long a, long long b){
  if(b > a/2) return modCombi(a,a-b);
  return ((kaizyou(a) * modPow(kaizyou(b),MOD - 2)) % MOD)* modPow(kaizyou(a-b),MOD - 2) % MOD;
}

ll H(ll a,ll b){
  return modCombi(a+b-1,b);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,k;
  cin >> n >> k;

  rep(i,k){
    ll r = (n-k);
    ll b = k;
    ll sp = i;
    if(sp > r){
      cout << 0 << endl;
      continue;
    }
    // rの置き方
    ll res = H(sp + 2 , r - sp);
    //cout << "debug1: " << res << endl;
    // bの置き方
    res %= MOD;
    res *= H(sp+1, b - (sp+1));
    res %= MOD;
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <map>
#include <queue>
using namespace std;
#define N 3
#define N2 9

struct Puzzle{
  int f[N2];
  int space;
  string path;

  bool operator < (const Puzzle &p)const{
    for(int i = 0; i < N2; i++){
      if(f[i] == p.f[i]) continue;
      return f[i] > p.f[i];
    }
    return false;
  }
};

static const int dx[4] = {-1,0,1,0};
static const int dy[4] = {0,-1,0,1};
static const char dir[4] = {'u','l','d','r'};

bool isTarget(Puzzle p){
  for(int i = 0; i < N2; i++)
    if(p.f[i] != (i+1)) return false;
  return true;
}

string bfs(Puzzle s){
  queue<Puzzle> Q;
  map<Puzzle, bool> V;
  Puzzle u,v;
  s.path = "";
  Q.push(s);
  V[s] = true;

  while(!Q.empty()){
    u = Q.front(); Q.pop();
    if(isTarget(u)) return u.path;
    int sx = u.space / N;
    int sy = u.space % N;
    for(int r = 0; r < 4; r++){
      int tx = sx + dx[r];
      int ty = sy + dy[r];
      if(tx < 0 || ty < 0 || tx >= N || ty >= N) continue;
      v = u;
      swap(v.f[u.space], v.f[tx * N + ty]);
      v.space = tx * N + ty;
      if(!V[v]){
	V[v] = true;
	v.path += dir[r];
	Q.push(v);
      }
    }
  }
  return "unsolvable";
}

int main(){
  Puzzle in;

  for(int i = 0; i < N2; i++){
    cin >> in.f[i];
    if(in.f[i] == 0){
      in.f[i] = N2;
      in.space = i;
    }
  }
  string ans = bfs(in);
  cout << ans.size() << endl;

  return 0;
}



Measured memory_bytes: 30600
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

using vi = vector<int>;

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

    int n, m, k;
    cin >> n >> m >> k;
    vi psa(n + 1), psb(m + 1);
    for (int i = 1; i <= n; i++) {
        int a;
        cin >> a;
        psa.at(i) = min(k + 1, psa.at(i - 1) + a);
    }
    for (int i = 1; i <= m; i++) {
        int b;
        cin >> b;
        psb.at(i) = min(k + 1, psb.at(i - 1) + b);
    }

    int ans = 0;
    for (int i = upper_bound(psa.begin(), psa.end(), k) - psa.begin() - 1, j = 0; i >= 0; i--) {
        while (j <= m && psa.at(i) + psb.at(j) <= k) {
            j++;
        }
        ans = max(ans, i + j - 1);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4776
# C - Skill Up
from itertools import product


def main():
    N, M, X, *CA = map(int, open(0).read().split())
    conditions = tuple(zip(*[iter(CA)] * (M + 1)))
    ans = 1 << 30
    for p in product(range(2), repeat=N):
        cur = [0] * (M + 1)
        for is_available, condition in zip(p, conditions):
            if not is_available:
                continue
            for i, (x, y) in enumerate(zip(cur, condition)):
                cur[i] = x + y
        if all(i >= X for i in cur[1:]):
            ans = min(ans, cur[0])
    print(ans if ans != 1 << 30 else -1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9144
N, Y = map(int, input().split())

Y = Y/1000

# 1, 5, 10のN個の和で, Yとなるものがあるか探す

flag = False

i = -1
j = -1
k = -1
for x in range(N+1):
  for y in range(N+1-x):
    sum_ = 10 * x + 5 * y + (N-x-y)
    if sum_ == Y:
      i = x
      j = y
      k = N - x - y
      

print(i, j , k)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 100000000

typedef  long long ll;

using namespace std;

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

    bool flag = false;
    int oans = 0,ans = -1;

    rep(i,0,s.size()){
        if(s[i] == 'A' || s[i] == 'C' ||s[i] == 'G'||s[i] == 'T') flag = true;
        else flag = false;
        if(flag){
            oans++;
        }

        if(!flag || i == s.size()-1){
            ans = max(ans,oans);
            oans = 0;
        }
    }
    
    
    cout << ans  << endl;
    
}

   

/*
int main(){
    ll n;
}*/


Measured memory_bytes: 256
n = int(input())
s = [int(input()) for _ in range(n)]
max1 = max(s)
max2 = sorted(s)[-2]
max1_index = s.index(max1)
for i in range(n):
  if(max1_index == i):
    print(max2)
  else:
    print(max1)


Measured memory_bytes: 13384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h,w;
  cin>>h>>w;
  map<char,int> a;
  vector<int> cnt(4,0);
  rep(i,h)rep(j,w){
    char now;
    cin>>now;
    a[now]++;
  }
  for(auto itr:a){
    cnt[0]+=itr.se/4;
    itr.se%=4;
    if(itr.se==3){
      cnt[1]++;
      cnt[2]++;
    }else if(itr.se!=0) cnt[itr.se]++;
  }
  if(h%2==0){
    if(w%2==0){
      if(cnt[0]*4==h*w) cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
    }else{
      if(cnt[0]*4>=h*(w-1) && cnt[1]==0) cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
    }
  }else{
    if(w%2==0){
      if(cnt[0]*4>=(h-1)*w && cnt[1]==0) cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
    }else{
      if(cnt[0]*4>=(h-1)*(w-1) && cnt[1]==1) cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin>>a>>b;
	if(a%b==0){
		cout<<a/b;
	}
	else{
		cout<<a/b+1;
	}
	return 0;
}



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

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int cr = 0, cb = 0;
	for(int i = 0; i < n; i++)
	{
		if(s[i] == 'R') cr++;
		else cb++;
	}
	if(cr > cb) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
// Inshallah, Boys played well !!

#include <bits/stdc++.h>
using namespace std;
#define author Saurabh
#define pii pair<int,int> 
#define vpi vector<pair<int,int> >
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define ff(i,s,e) for(int i=s;i<=e;i++)
#define fb(i,e,s) for(int i=e;i>=s;i--)
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test int t;scanf("%d",&t);while(t--)
#define setp(x) setprecision(x)
#define int long long
signed main(){
    fast;
    int n,m,x;
    cin >> n;
    int s=0;
    int a[n];
    memset(a,0,sizeof(a));
    ff(i,1,n-1){
        cin >> x;
        a[x-1]++;
    }
    ff(i,0,n-1)
        cout << a[i] << endl;

}


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

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

    if((s[0]=='0' && !(s[1]=='0'))|| (s[0]=='1' &&(s[1]=='0' || s[1]=='1' || s[1]=='2'))){
        if(!((s[2]=='0' && !(s[3]=='0'))|| (s[2]=='1' &&(s[3]=='0' || s[3]=='1' || s[3]=='2')))){
            cout << "MMYY" <<endl;
            return 0;
        }
        cout << "AMBIGUOUS" <<endl;
        return 0;
    }

    if(!((s[0]=='0' && !(s[1]=='0'))|| (s[0]=='1' &&(s[1]=='0' || s[1]=='1' || s[1]=='2')))){
        if(((s[2]=='0' && !(s[3]=='0'))|| (s[2]=='1' &&(s[3]=='0' || s[3]=='1' || s[3]=='2')))){
            cout << "YYMM" <<endl;
            return 0;
        }
        cout << "NA" <<endl;
        return 0;
    }
}


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

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

  if (N <= A) {
    cout << "Yes" << endl;
  }
  else if (N % 500 <= A) {
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int X, Y;
    cin >> X >> Y;

    int ans = 0;
    ans += max(0, (4 - X) * 100000);
    ans += max(0, (4 - Y) * 100000);
    
    if (X == 1 && Y == 1) ans += 400000;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define rp(i,s,e) for(int i=(s);i<(e);++i)

void vprn(vector<int> &v){ for(int i=0;i<v.size();i++) cout<<v[i]<<(i<v.size()-1?",\t":"\n"); }

using PII = pair<int,int>;

int solve(int N, int MAX, vi &A){
	sort(all(A));
	vi C(MAX+1);
	rp(i,0,N) C[A[i]]++;
	// vprn(C);//

	int a = C[0];
	int b = C[1];
	int c = C[2];
	int ans = a+b+c;
	rp(i, 3, C.size()){
		if(C[i] != 0){
			a = b;
			b = c;
			c = C[i];
			ans = max(ans, a+b+c);
		}
	}
	return ans;
}

int main(){
	int N; cin>>N;
	vi A(N);
	int MAX = 0;
	rp(i,0,N){
		cin>>A[i];
		MAX = max(MAX, A[i]);
	}
	ote(solve(N, MAX, A));
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define maxn 100005 /*rem*/
#define mod 998244353
#define db double
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define pi pair<int, int>
#define fi first
#define se second
using namespace std;
int a[maxn];
int n, m;
int f[maxn], cnt = 0;
bool cmp(int a, int b) {
	return (a % 2) > (b % 2);
}
int pl;
void push(int a) {
	if (pl + a - 1 >= n) a = n + 1 - pl;
	f[cnt++] = a, pl += a;
}
int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++)
		cin >> a[i];
//	if (m <= 2) return 1;
	sort(a, a + m, cmp);
	int ans = 0;
	for (int i = 0; i < m; i++)
		ans += a[i] % 2;
	if (n % 2 == 0 && ans > 2) cout << "Impossible" << endl;
	else if (n % 2 == 1 && ans > 1) cout << "Impossible" << endl;
	else {
		pl = 1;
		if (a[1] % 2) swap(a[1], a[m - 1]);
		for (int i = 0; i < m; i++) {
			if (a[i] % 2) {
				if (i == 0) 
					for (int j = 0; j < a[i] / 2 + 1; j++)
						push(2);
				else for (int j = 0; j < a[i] / 2; j++)
					push(2);
			}
			else {
				if (i == 0) push(1);
				push(a[i]);
			}
		}
		for (int i = 0; i < m; i++)
			cout << a[i] << ' ';
		cout << endl;
		cout << cnt << endl;
		for (int i = 0; i < cnt; i++)
			printf("%d ", f[i]);
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 512
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	int ans = 0;
	int tmp;
	int a, b;
	cin >> a >> b;
	string s;
	cin >> s;
	bool ch = true;
	REP(i, a) if(s[i] == '-') ch = false;
	if(s[a] != '-') ch = false;
	REP(i, b) if(s[a+1+i] == '-') ch = false;
	if (ch) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	//cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int x, a, b; cin >> x >> a >> b;
  cout << (x-a)%b << '\n';
  return 0;
}


Measured memory_bytes: 256
def myAnswer(N:int,P:list) -> int:
   ans = 0
   counter = 0
   for i in range(1,N+1):
      if(i == P[i - 1]):
         counter += 1
      elif(counter != 0):
         ans += counter//2 + counter % 2 if(counter > 1) else 1
         counter = 0
   if(counter != 0):
      ans += counter//2 + counter % 2 if(counter > 1) else 1
   return ans

def modelAnswer():
   return
def main():
   N = int(input())
   P = list(map(int,input().split()))
   print(myAnswer(N,P[:]))
if __name__ == '__main__':
   main()

Measured memory_bytes: 14008
import scala.io.{StdIn => in}

object Main extends App {
  val n = in.readInt
  val a = in.readLine.split(" ").map(_.toInt).sorted(Ordering[Int].reverse)

  val alice = a.indices.withFilter(_ % 2 == 0).map(a(_)).sum
  val bob = a.indices.withFilter(_ % 2 == 1).map(a(_)).sum
  val ans = alice - bob
  println(ans)
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int X, t;
    cin >> X >> t;
    cout << max(X - t, 0) << endl;
    return 0;
}



Measured memory_bytes: 256
n = int(input())
x = [int(i) for i in input().split()]
a = x[:]
a.sort()

mid = n //2
m1 = a[mid-1]
m2 = a[mid]
for i in range(n):
    if x[i] <= m1:
        ans = m2
    else:
        ans = m1
 
    print(ans)

Measured memory_bytes: 26772
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}
int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
  string A,B;
  cin>>A>>B;
  int count=0;
  rep(i,0,3){
    if(A[i]==B[i]) count++;
  }
  cout<<count;
    
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//



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

int compare(const void *x, const void *y)
{
	return *(int*)y - *(int*)x;
}

int main() {
	int N;
	long a[300000], ans = 0;
	cin >> N;
	for (int i = 0; i < N * 3; ++i) cin >> a[i];
	qsort(a, N * 3, sizeof(long), compare);
	for (int i = 1; i < N * 2; i += 2) ans += a[i];
	cout << ans;
}

Measured memory_bytes: 4860
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n),b(n);
    int cnt=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[i]=a[i];
    }
    sort(All(b));
    map<int,int> D;
    for(int i=0;i<n;i++)D[b[i]]=i;
    int res=0;
    for(int i=0;i<n;i++)res+=abs(i-D[a[i]])%2;
    cout<<res/2<<endl;
}

Measured memory_bytes: 8064
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9


def dfs(cur, a, b, c):
  if cur == N:
#    print(cur, a, b, c)
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur+1, a, b, c)
  ret1 = dfs(cur+1, a + l[cur], b, c) + 10
  ret2 = dfs(cur+1, a, b + l[cur], c) + 10
  ret3 = dfs(cur+1, a, b, c + l[cur]) + 10
#  print(cur, ret0, ret1, ret2, ret3)
  return min(ret0, ret1, ret2, ret3)
  
print(dfs(0, 0, 0, 0))

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);
 
signed main(void){
    int n; cin >> n;
    vi a(n);
    for(auto & e : a) cin >> e;

    vi num_es(n);
    rep(loop, 2){
        vi cur_num_es(n);
        int cur = 0;

        rep(i, n){
            cur--;

            if(a[i] == 0){
                cur = inf;
            }
            else if(a[i] > 0){
                cur_num_es[i] = min(a[i], cur);
            }
            else {
                chmin(cur, -a[i]);
            }
        }

        reverse(_all(a));

        if(loop == 1) reverse(_all(cur_num_es));
        rep(i, n){
            chmax(num_es[i], cur_num_es[i]);
        }
    }

    int res = 0;
    for(auto & e : num_es){
        res += e;
    }
    
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K,i;
  int sumA=0;
  int sumB=0;
  int moto=1;
  cin >> N >> K;
 
  for(i=1;i<=N;i++){
	    sumA = moto * 2;
    	sumB = moto + K;
    if(sumA<sumB){
      moto = sumA;      
    }
    else{
     moto = sumB; 
    } 
    
  }
cout << moto << endl;
}
   

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cstring>
using namespace std;

#ifdef ENABLE_LL
#define int long long
#endif

#ifdef ENABLE_LL
#define I "%lld"
#define II "%lld%lld"
#define III "%lld%lld%lld"
#define IIII "%lld%lld%lld%lld"
#define IN "%lld\n"
#define IIN "%lld%lld\n"
#define IIIN "%lld%lld%lld\n"
#define IIIIN "%lld%lld%lld%lld\n"
#else
#define I "%d"
#define II "%d%d"
#define III "%d%d%d"
#define IIII "%d%d%d%d"
#define IN "%d\n"
#define IIN "%d%d\n"
#define IIIN "%d%d%d\n"
#define IIIIN "%d%d%d%d\n"
#endif

#ifdef __LOCALE__
#define see(a) std::cout << #a << "=" << a << std::endl
#define ses(a) std::cout << #a << "=" << a << " " 
#else
#define see(a) //std::cout << #a << "=" << a << std::endl
#define ses(a)
#endif
#define repe(a,b) for (int a=0;a<(int)b.size();a++)
#define rep(i,n) for (int i=0;i<n;i++)
#define repa(i,n) for (int i=1;i<=n;i++)
#define repi(i,a,b) for (int i=a;i<=b;i++) 
#define repb(i,a,b) for (int i=a;i>=b;i--)
typedef pair < int , int > pr; typedef pair < pr  , int > prr;
#define L first
#define R second
template <class T> inline bool checkMin(T& a , T b) { return (a > b ? a=b,1 : 0); }
template <class T> inline bool checkMax(T& a , T b) { return (a < b ? a=b,1 : 0); }
class Scanner{ private: istream& ist;public: Scanner(istream& in):ist(in){} string next(){ string r; ist >> r; return r; } string nextLine(){ string r; getline(ist,r); return r; } int nextInt(){ int r; ist >> r; return r; } double nextDouble(){ double r; ist >> r; return r; } char nextChar(){ char r; ist>>r; return r;} }; Scanner sc(cin);
void ALERT(bool judgememt, const char* phrase) { if (judgememt) { puts(phrase); throw "ALERT"; } }
bool alert(bool judgememt, const char* phrase) { if (judgememt) puts("phrase"); return judgememt; }


void init() {
     
}

void solve() {
    printf(IN,sc.nextInt() * sc.nextInt());
}


#ifdef ENABLE_LL
#undef int
#endif
int main(){
#ifndef CUSTOM_MAIN
#ifdef MULTIPLE_TEST_CASES_WITH_T

int T; scanf("%d",&T); while(T--) {init(); solve();}

#else
#ifdef MULTIPLE_TEST_CASES_WITHOUT_T

while(1) {try{init(); } catch(bool t){return 0;} solve(); }

#else

init(); solve();

#endif
#endif
#endif
    return 0;
}



Measured memory_bytes: 3748
#include <stdio.h>

int main() {
        int N;
        int A;
        int Ans[200001] = {0};
        int i;

        scanf("%d", &N);

        for(i = 2; i <= N; i++) {
                scanf("%d", &A);
                Ans[A]++;
        }

        for(i = 1; i <= N; i++) {
                printf("%d\n", Ans[i]);
        }

        return 0;
}


Measured memory_bytes: 2504
#include <bits/stdc++.h>     // [PRIMES]               1777 ~2^10.80  
using namespace std;                     //                       10333 ~2^13.33
using ll=long long;                      // seq 1 128 | factor   100333 ~2^16.61
using vl=vector<ll>;                     //   | grep -v ' .* '  1300111 ~2^20.31
using vvl=vector<vl>;                    //                    10300777 ~2^23.30
using vb=vector<bool>;                   //                   100400999 ~2^26.58
using vs=vector<string>;                 //                  1300400999 ~2^30.28
using pll=pair<ll,ll>;                   //                 10200500333 ~2^33.25
const ll oo =0x3f3f3f3f3f3f3f3fLL;       //                100200400777 ~2^36.54
const double eps=1e-9;                   //               1200300700111 ~2^40.13
#define sz(c) ll((c).size())             //              10200300500777 ~2^43.21
#define all(c) begin(c),end(c)           //             100200300400777 ~2^46.51
#define mp make_pair                     //            1200300400600999 ~2^50.09
#define mt make_tuple                    //           10200300400600111 ~2^53.18
#define pb push_back                     //          100200300400600333 ~2^56.48
#define eb emplace_back                  //         1200300400500800999 ~2^60.06
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

using namespace std;

ll n;
vl numbers;
ll dp[2][3001][3001];

ll getXY(bool taro, ll starting, ll ending) {
	if(starting > ending) return 0;
	if(dp[taro][starting][ending] != -1) return dp[taro][starting][ending];
	
	ll output;
	if(taro) {
		ll leftRemove = numbers[starting] + getXY(!taro, starting + 1, ending);
		ll rightRemove = numbers[ending] + getXY(!taro, starting, ending - 1);
		output = max(leftRemove, rightRemove);
	} else {
		ll leftRemove = -numbers[starting] + getXY(!taro, starting + 1, ending);
		ll rightRemove = -numbers[ending] + getXY(!taro, starting, ending - 1);
		output = min(leftRemove, rightRemove);
	}
	
	dp[taro][starting][ending] = output;
	return output;
}

int main(){
	cin.sync_with_stdio(0);
	FOR(i, 0, 2) {
		FOR(j, 0, 3001) {
			FOR(z, 0, 3001) {
				dp[i][j][z] = -1;
			}
		}
	}
	
	cin >> n;
	numbers = vl(n);
	
	FOR(i, 0, n) {
		cin >> numbers[i];
	}

	cout << getXY(1, 0, n - 1) << endl;
			
	return 0;
}


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


def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    h = sorted(h, reverse=True)

    count = 0
    for i in range(n):
        if h[i] >= k:
            count += 1
        else:
            break
    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 11916
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>

using namespace std;

class C {
	int N;
public:
	void solve()
	{
		ostringstream S;
		string ans;
		int quotient, remainder;

		if (N)
		{
			while (N)
			{
				quotient = N / (-2);
				remainder = N - (-2) * quotient;

				if (remainder == -1)
				{
					remainder = 1;
					quotient++;
				}

				S << remainder;
				N = quotient;
			}

			ans = S.str();
			reverse(ans.begin(), ans.end());
		}

		else ans = "0";

		cout << ans << endl;
	}

	C() { cin >> N; }
};


int main()
{
	C solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    res = ""

    for i in range(3):
        s = input()
        res += s[i]

    print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61896
#include<stdio.h>
#include<limits.h>
int main(){
  int n;
  scanf("%d",&n);
   long  sum=0,min=LONG_MAX,max=LONG_MIN;
  for (int i=0;i<n;i++){
    int x;
   
    scanf("%d",&x);
    if (x>max)max=x;
    if (x<min)min=x;
    sum+=x;
  }
  printf("%ld %ld %ld\n",min,max,sum);
  return 0;
  
}


Measured memory_bytes: 2104
# -*- coding: utf-8 -*-
s = input()
head = int(s[:2])
back = int(s[2:])
if 1<= head <= 12: # <- YY?? or MM??
    if 1<= back <= 12: # <- YYMM or MMYY
        print("AMBIGUOUS")
    else: # <- MMYY
        print("MMYY")
else: # <- YY??
    if 1<= back <= 12: # <- YYMM
        print("YYMM")
    else: # <- YYYY
        print("NA")


Measured memory_bytes: 2940
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))

N,P = mint()
A = lint()
odd = len([a for a in A if a%2!=0])
if odd==0:
    print(0 if P else 2**N)
else:
    print(2**(N-1))

Measured memory_bytes: 65652
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>
#include <unordered_map>

#define mod 1000000007
#define lim 1000000000

using namespace std;
using ll = long long;

void solve(){
    int n;
    int res = 0;
    unordered_map<int, int> um;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
        um[a[i]]++;
    }
    for(int i = 0; i < n; i++){
        if(um[a[i]] > 0 && um[a[i]] > a[i]){
            //cout << a[i] << ", " << um[a[i]] << endl;
            res += um[a[i]]-a[i];
            um[a[i]] = a[i];
        }else if(um[a[i]] > 0 && um[a[i]] < a[i]){
            //cout << a[i] << ", " << um[a[i]] << endl;
            res += um[a[i]];
            um[a[i]] = 0;
        }
    }
    cout << res << endl;
}

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



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

class C
{
	static void Main()
	{
		var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
		var l = new int[h[0]].Select(_ => int.Parse(Console.ReadLine())).ToArray();
		Console.WriteLine(GetMin(h, l, new int[4], new int[4], 0));
	}

	static int GetMin(int[] h, int[] l, int[] u, int[] sum, int k)
	{
		if (k == h[0]) return u.Take(3).Any(x => x == 0) ? int.MaxValue : u.Take(3).Select((x, i) => 10 * (x - 1) + Math.Abs(sum[i] - h[i + 1])).Sum();

		var m = int.MaxValue;
		for (int i = 0; i < 4; i++)
		{
			u[i]++; sum[i] += l[k];
			m = Math.Min(m, GetMin(h, l, u, sum, k + 1));
			u[i]--; sum[i] -= l[k];
		}
		return m;
	}
}


Measured memory_bytes: 17600
#include <iostream>
#include <cstdio>
#include <cmath>
#include<vector>
#include<algorithm>
using namespace std;
const int maxn=1e5+7;
int a[maxn],b[maxn],c[maxn];
int gcd(int x,int y){
	return y?gcd(y,x%y):x;
}
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>a[i];
	b[1]=a[1];
	for(int i=2;i<=n;i++){
		b[i]=gcd(b[i-1],a[i]);
	}
	c[n]=a[n];
	for(int i=n-1;i>=1;i--){
	c[i]=gcd(c[i+1],a[i]);
	}
	int g=0;
	for(int i=2;i<=n;i++){
		g=max(gcd(b[i-1],c[i+1]),g);
	}
	g=max(g,max(c[2],b[n-1]));
	cout<<g;
}

Measured memory_bytes: 4788
n = int(input())
big = 0
a = list(map(int, input().split()))
a.sort()
ans = 1
for num in a:
    if num == 0:
        print(0)
        big = 1
        break
    ans = ans * num
    if ans > 10 ** 18:
        print(-1)
        big = 1
        break
if big == 0:
    print(ans)

Measured memory_bytes: 21600
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, K;
    cin >> N >> K;

    double ret = max(0.0, (N - K + 1) * 1.0 / N);

    int upper = K;
    int lower = (int)ceil(upper * 1.0 / 2.0);

    bool last = false;
    for (int i = 1; lower >= 1; i++) {
      if (N >= lower) {
        int num = min(N + 1, upper) - lower;
        ret += (1.0 * num / N) / pow(2, i);
      }

      if (last) break;

      upper = lower;
      lower = (int)ceil(1.0 * lower / 2.0);
      if (lower == 1) last = true;
    }

    cout << setprecision(12) << ret << endl;

    return 0;
}

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


int main(){
    ll N,K;
    cin >> N >>K;
    vector<ll> A(N);
    for(int i=0;i<N;i++){
        ll a;
        cin >> a;
        --a;
        A[i] = a;
    }
    set<ll> already;
    map<ll,ll> visited;
    ll t=0;
    ll loup,initial;
    for(ll i=0;i<N;i++){
        already.insert(t);
        visited[t] = i;
        if(i==K){
            cout << t+1 << endl;
            return 0;
        }
        t = A[t]; 
        
        if(already.find(t) != already.end()){
            initial = i+1;
            loup = (i+1) -visited[t];
            // cerr << "initial=" << initial << "loup=" << loup << endl;
            break;
        }
    }
    K-= initial;
    K%=loup;
    for(int i=0;i<K;i++){
        t = A[t];
    }
    cout << t+1 << endl;
    return 0;
}


Measured memory_bytes: 22268
/*
    Author : zzugzx
    Lang : C++
    Blog : blog.csdn.net/qq_43756519
*/
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define SZ(x) (int)x.size()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int mod = 1e9+7;
//const int mod = 998244353;
const double eps = 1e-10;
const double pi = acos(-1.0);
const int maxn = 1e6+10;
const ll inf = 0x3f3f3f3f;
const int dir[][2]={{0, 1}, {1, 0}, {0, -1}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
    int a, b, c, d;
    a = b = c = d = 0;
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++){
        string s;
        cin >> s;
        if(s[0]=='A')a++;
        if(s[0]=='W')b++;
        if(s[0]=='T')c++;
        if(s[0]=='R')d++;
    }
    cout << "AC x " << a << endl;
    cout << "WA x " << b << endl;
    cout << "TLE x " << c << endl;
    cout << "RE x " << d << endl;
    return 0;
}


Measured memory_bytes: 3656
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<climits>
#include<stack>

using namespace std;

#define MAX 1000003

vector<int> vprimes;
bool *isPrime = new bool[MAX];

// Ååöñ
template<typename Integer>
Integer GCD(Integer a, Integer b){
  if(!b)return a;
  else return GCD(b,a%b);
}

void MakePrime(){
  for(int i=0;i<MAX;++i)
    isPrime[i]=true;
  isPrime[0]=false;
  isPrime[1]=false;
  for(long long int i=2;i<MAX;++i)
    if(isPrime[i])
      for(long long int j=2;i*j<MAX;++j)
	isPrime[i*j]=false;
  for(int i = 0; i < MAX; ++i)
    if( isPrime[i] )
      vprimes.push_back( i );
}

template<typename Integer>
void Factorization(Integer n, vector< pair<Integer,Integer> > &vp){
  if(n==1){vp.push_back(make_pair(1,1));return ;}
  for(int i = 0; i < vprimes.size(); ++i){
    while(n%vprimes[i]==0){
      n/=vprimes[i];
      if( vp.size()>0 && vp.back().first == vprimes[i] )
	vp.back().second++;
      else
	vp.push_back( make_pair(vprimes[i],1) );
    }
    if(n==1)return ;
  }
  vp.push_back( make_pair(n,1) );  
}

// ®ªÌñ,vvÉ½¢µÄÐÆÂÌªvª èAvÌ®Íå«¢ÉÀÔ
void partitions(int n, int max_n, vector<int>& v, vector<vector<int> >& vv) {
  if(n==0){vv.push_back(v);return;}
  for(int i=min(n,max_n);i>0;i--){v.push_back(i);partitions(n-i,i,v,vv);v.pop_back();}
}

template<typename Integer>
Integer divisorFunction0(Integer n){
  Integer ret=1;
  if(n==1)return 1;
  stack<pair<Integer,Integer> > st;
  vector< pair<Integer,Integer> > facts;
  Factorization(n,facts);
  for(int i = 0; i < facts.size(); ++i){
    ret *= facts[i].second+1;
  }
  return ret;
}

// æ1íñÖ@ñÌaðßé ½ªO(sqrt(n))+alpha­ç¢Å®­
template<typename Integer>
Integer divisorFunction1(Integer n, vector<Integer> &vdivs){
  Integer ret=0;
  if(n==1)return 1;
  stack<pair<Integer,Integer> > st;
  vector< pair<Integer,Integer> > facts;
  Factorization(n,facts);
  st.push(make_pair(0,1));
  while(!st.empty()){
    pair<Integer,Integer> nst=st.top();
    st.pop();
    if(nst.first>=facts.size()){
      vdivs.push_back(nst.second);
      continue;
    }
    Integer r=1;
    for(int i = 0; i < facts[nst.first].second+1; ++i){
      pair<Integer,Integer> nx(nst.first+1,nst.second*r);
      st.push(nx);
      r*=facts[nst.first].first;
    }
  }
  return ret;
}

int main()
{
  MakePrime();
  while(true){
    long long int res = 0;
    long long int L;
    vector<long long int> vdiv;
    cin >> L;
    if(L==0)break;
    divisorFunction1(L,vdiv);
    res += vdiv.size();
    //cout << vdiv.size() << endl;
    for(int i = 1; i < vdiv.size(); ++i){
      for(int j = i+1; j<vdiv.size()-1; ++j){
	if(GCD(vdiv[i],vdiv[j])==1){
	  ++res;
	  //break;
	}
      }
    }
    if(L==1)res=1;
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 2328
#include <bits/stdc++.h>
using namespace std;
#define Fast_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long

int32_t main() {
	Fast_IO

	map<int, int> visited;
	map<int, int> pos;
	int n; cin >> n;
	int k; cin >> k;
	vector<int> arr(n + 1);
	for (int i = 0; i < n; i++) {
		cin >> arr[i + 1];
	}
	int cur = 1;
	int times = 0;
	int t = 1;
	int cycleat = 0;
	while (true) {
		if (visited[cur]) {
			times = t - visited[cur];
			cycleat = cur;
			break;
		}
		visited[cur] = t++;
		pos[times++] = cur;
		cur = arr[cur];
		k--;
		if (k == 0) {
			cout << cur;
			return 0;
		}
	}

	int cyclelength = times;

	k = k % cyclelength;


	cur = cycleat;
	visited.clear();
	vector<int> pp;
	while (true) {
		if (visited[cur]) {
			times = t - visited[cur];
			cycleat = cur;
			break;
		}
		pp.push_back(cur);
		visited[cur] = t++;
		pos[times++] = cur;
		cur = arr[cur];
	}

	cout << pp[k];
	// cout << "\n";
	// for (auto &it : visited) {
	// 	cout << it.first << " " << it.second << "\n";
	// }
}

Measured memory_bytes: 29248
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVETSE(c) reverse((c).begin(),(c).end())
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define ALL(a)  (a).begin(),(a).end()
// int gcd(int a,int b){return b?gcd(b,a%b):a;}
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> T maxt(T x,T y) {
    if (x>y) return x;
    else return y;
}
template<class T> T mint(T x,T y) {
    if (x>y) return y;
    else return x;
}
//sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];});
//cout << fixed << setprecision(10) << ans << defaultfloat << endl;
typedef long long ll;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<double> Vd;
typedef vector<string> Vs;

//小数出力
double print_double(double d){printf("%.10f", d);}

long long m = 1e9+7, mod = 1e9+7;
//逆元　a/b の modをとるとき -> a*modinv(b)%mod
long long modinv(long long a, long long m = 1e9+7) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

//約数列挙
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}







int N;
vector<vector<vector<double>>> dp(302,vector<vector<double>>(302,vector<double>(302,-1))); 
double rec(int i,int j, int k) {
  if (dp[i][j][k] >= 0) return dp[i][j][k];
  if (i == 0 && j == 0 && k == 0) return 0.0;

  double res = 0.0;
  if (i > 0) res += rec(i-1, j, k) * i;
  if (j > 0) res += rec(i+1, j-1, k) * j;
  if (k > 0) res += rec(i, j+1, k-1) * k;
  res += N;
  res /= i+j+k;

  return dp[i][j][k]=res;
}

int main() {
  int ai;
  cin >> N;
  Vi a(N), count(4,0);
  rep(i,N) {
    cin >> ai;
    a[i] = ai;
    count[ai]++;
    }
  
  print_double(rec(count[1],count[2],count[3]));
}

Measured memory_bytes: 219776
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define ll long long
#define pp pair<int,int> 
const int INF = 1001001001;
//int 2×10の9乗
//vector<vector<int>> a(n, vector<int>(m));
  //rep(i,n) rep(j,m) cin >> a[i][j]; 
//cout << fixed << setprecision(10);

int gcd(int x, int y){
  if(y==0) return x;
  return gcd(y, x%y);
}
 
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int ans=0;
  rep(i,n) ans=gcd(a[i], ans);
  cout << ans << endl;
}    

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <cassert>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int n;
int cnts[101];
int dp[101][76];

signed main() {
	int i, j, k;
	
	cin >> n;
	for (i = 2; i <= n; i++) {
		int tmp = i;
		for (j = 2; j * j <= tmp; j++) {
			int cnt = 0;
			while (tmp % j == 0) {
				tmp /= j;
				cnt++;
			}
			cnts[j] += cnt;
		}
		if (tmp > 1) cnts[tmp]++;
	}
	
	dp[0][1] = 1;
	rep(i, 100) {
		rep(j, 76) {
			//cout << dp[i][j];
			for (k = 0; k <= cnts[i]; k++) {
				if (j * (k + 1) > 75) break;
				dp[i + 1][j * (k + 1)] += dp[i][j];
			}
		}
		//cout << endl;
	}
	
	cout << dp[100][75] << endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
L = list(map(int,input().split()))
count=0
for i in range(0,N):
    A =L[i]
    for j in range(i+1, N):
        B =L[j]
        for k in range(j + 1, N):
            C = L[k]
            X =[A,B,C]
            Y =sorted(X)
            if A==B or B == C or C ==A:
                pass
            elif Y[0] + Y[1] <= Y[2]:
                pass
            else:
                count =count +1

print(count)

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

using namespace std;
typedef long long ll;

const ll mod = 1e9 + 7;

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int s; cin >> s;
    vector<ll> x(s + 10);
    for (int i = 3; i <= s; i++) {
        x[i] = 1;
        for (int j = i - 3; j >= 3; j--) {
            x[i] += x[j];
        }
        x[i] %= mod;
    }
    cout << x[s] << endl;
    return 0;
}


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

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

	int ans=-1;
	for(int i=0;i<20000;i++){
		int x=(double)i*0.08, y=(double)i*0.1;

		if(x==a && y==b){
			ans=i;
			break;
		}
	}

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


Measured memory_bytes: 256