akhauriyash/Code-Regression huggingface dataset:
n,m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
ans = [0]*n
for a,b in ab:
    if h[a-1] > h[b-1]: ans[b-1] = -1
    elif h[b-1] > h[a-1]: ans[a-1] = -1
    elif h[b-1] == h[a-1]:
        ans[b-1] = -1
        ans[a-1] = -1
print(ans.count(0))

Measured memory_bytes: 32032
import sys
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.sort(reverse=True)

ans = 0
if k >= len(h):
  print(0)
  sys.exit()

for i in h:
  if k > 0:
    k -= 1
    continue
  ans += i

print(ans)

Measured memory_bytes: 26024
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

char dn[1400000], * di = dn;
int keta1 = 1, keta2;
char C1[10] = { '1', '0', '0', '0', '0', '0' };
char C2[10] = { '0', '0', '0', '0', '0', '0' };

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


	int N, M;
	scanf("%d %d", &N, &M);

	if (N % 2) {
		int n = N - 1;
		keta2 = 0;
		while (n) {
			*(C2 + keta2) = '0' + n % 10;
			n /= 10;
			keta2++;
		}

		rep1(i, M) {
			for (int i = keta1 - 1; i >= 0; i--)* di++ = (*(C1 + i));
			*di++ = ' ';
			for (int i = keta2 - 1; i >= 0; i--)* di++ = (*(C2 + i));
			*di++ = '\n';

			C1[0]++;
			int tmp = 0;
			while (C1[tmp] > '9') {
				C1[tmp++] -= 10;
				C1[tmp]++;
				if (keta1 <= tmp) keta1 = tmp + 1;
			}
			C2[0]--;
			tmp = 0;
			while (C2[tmp] < '0') {
				C2[tmp++] += 10;
				C2[tmp]--;
				if (C2[keta2 - 1] == '0') keta2--;
			}
		}
	}
	else {
		int n = N;
		keta2 = 0;
		while (n) {
			*(C2 + keta2) = '0' + n % 10;
			n /= 10;
			keta2++;
		}
		rep1(i, (M + 1) / 2) {
			for (int i = keta1 - 1; i >= 0; i--)* di++ = (*(C1 + i));
			*di++ = ' ';
			for (int i = keta2 - 1; i >= 0; i--)* di++ = (*(C2 + i));
			*di++ = '\n';

			C1[0]++;
			int tmp = 0;
			while (C1[tmp] > '9') {
				C1[tmp++] -= 10;
				C1[tmp]++;
				if (keta1 <= tmp) keta1 = tmp + 1;
			}
			C2[0]--;
			tmp = 0;
			while (C2[tmp] < '0') {
				C2[tmp++] += 10;
				C2[tmp]--;
				if (C2[keta2 - 1] == '0') keta2--;
			}
		}
		C2[0]--;
		int tmp = 0;
		while (C2[tmp] < '0') {
			C2[tmp++] += 10;
			C2[tmp]--;
			if (C2[keta2 - 1] == '0') keta2--;
		}
		for (int i = (M + 1) / 2 + 1; i <= M; i++) {
			for (int i = keta1 - 1; i >= 0; i--)* di++ = (*(C1 + i));
			*di++ = ' ';
			for (int i = keta2 - 1; i >= 0; i--)* di++ = (*(C2 + i));
			*di++ = '\n';

			C1[0]++;
			int tmp = 0;
			while (C1[tmp] > '9') {
				C1[tmp++] -= 10;
				C1[tmp]++;
				if (keta1 <= tmp) keta1 = tmp + 1;
			}
			C2[0]--;
			tmp = 0;
			while (C2[tmp] < '0') {
				C2[tmp++] += 10;
				C2[tmp]--;
				if (C2[keta2 - 1] == '0') keta2--;
			}
		}
	}

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 2728
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionC
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            var n = inputLongArray[0];
            var m = inputLongArray[1];

            var hArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            bool[] target = Enumerable.Repeat<bool>(true, (int)n).ToArray();

            for (int i = 0; i < m; i++)
            {
                inputLongArray = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
                var a = inputLongArray[0];
                var b = inputLongArray[1];

                if (hArray[a-1] == hArray[b-1])
                {
                    target[a - 1] = false;
                    target[b - 1] = false;
                }
                else if (hArray[a-1] > hArray[b-1])
                {
                    target[b - 1] = false;
                }
                else
                {
                    target[a - 1] = false;
                }
            }

            var result = target.Count(x => x == true);

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 49260
// Template by [thunder_blade]
// IIIT ALLAHABAD
// includes :)

#include <bits/stdc++.h>
using namespace std;
#define TEST  int test_case; cin>>test_case; while(test_case--)
#define all(v) (v).begin(),(v).end()
#define fi  first
#define se  second
#define pb push_back
#define mp make_pair
#define ll long long int
#define SPEED ios_base::sync_with_stdio(false);  cin.tie(0);  cout.tie(0);
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define pf(x) printf("%f\n",x)
#define ps(x) printf("%s\n",x)
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define sf(x) scanf("%f",&x)
#define ss(x) scanf("%s",x)
#define pis(x) printf("%d ",x)
#define pls(x) printf("%lld ",x)
#define pfs(x) printf("%f ",x)
#define pss(x) printf("%s ",x)
#define FOR(i,a,b) for(i=a;i<b;i++)
#define mod 1000003
#define pii pair<int,int>
#define tr(container, it)  for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
ll power(ll a, ll n) {
  ll p = 1;
  while (n > 0) {
    if(n&1) {
      p = ((p%mod) * (a%mod))%mod; 
    } 
    n >>= 1; 
    a = ((a%mod)*(a%mod))%mod;
  } 
  return p%mod;
}

const long long B = 100000007; 
const long long C = 10010107; 
const int N = 500005;

int dp[3][N], a[3][N];

int main()
{
  int n;
  si(n);

  for(int i=1;i<=2;i++){
    for(int j=1;j<=n;j++){
      si(a[i][j]);
      dp[i][j] = max(dp[i-1][j], dp[i][j-1]) + a[i][j];
    }
  }
  cout<<dp[2][n]<<endl; 
}

Measured memory_bytes: 6400
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1){
            res *= a; if(mod>=1) res %= mod;
        }
        a *= a; if(mod>=1) a %= mod;
        n >>= 1;
    }
    return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k,a,b,h;
  ld hh,mm,ss;
  ld result=0.0;
  char s[LIMIT1];
  
  scanf("%lld %lld %lld %lld",&a,&b,&h,&m);
  hh = 30*h+0.5*m;
  mm = 6*m;
  ss = zt(hh,mm);
  if(ss>180.0) ss=360.0-ss;
  result = powl(a,2)+powl(b,2)-2*a*b*cosl((ss*M_PI)/180.0);
  
  printf("%.20Lf",sqrtl(result));
  
  return 0;
}



Measured memory_bytes: 2536
#include<stdio.h>
#include<string.h>
#include<math.h>
#define max(a,b) (a<b?b:a)
int N,M,K,i,j,t,C[40];
double R;

void dfs(int d)
{
	int i,a=0;
	if(d==N)
	{
		for(i=0;i<d;i++)a+=C[i];
		R+=(1.0*max(1,a-K)/pow(1.0*M,N));
	}
	else
		for(i=1;i<=M;i++)
		{
			C[d]=i;
			dfs(d+1);
		}
}

int main()
{
	for(;scanf("%d%d%d",&N,&M,&K),N;)
	{
		R=0;
		dfs(0);
		printf("%.9f\n",R);
	}
	return 0;
}

Measured memory_bytes: 688
#include<iostream>
using namespace std;
static int prime[300000 + 1];
static int primeLength = 0;
void setPrime()
{
	prime[primeLength] = 7 * 0 + 6;
	primeLength++;
	for (int i = 1; 7 * i + 6 <= 300000; i++)
	{
		bool flag = false;
		for (int j = 0; j < primeLength; j++)
		{
			if ((i * 7 + 1) % prime[j] == 0)
			{
				flag = true;
				break;
			}
		}
		if(!flag)prime[primeLength++] = i * 7 + 1;
		flag = false;
		for (int j = 0; j < primeLength; j++)
		{
			if ((i * 7 + 6) % prime[j] == 0)
			{
				flag = true;
				break;
			}
		}
		if(!flag)prime[primeLength++] = i * 7 + 6;
	}
}
int main()
{
	setPrime();
	int n;
	while(cin >> n && n != 1)
	{
		int ansList[150000];
		int ansCount = 0;
		int i = 0;
		while (i < primeLength && prime[i] <= n)
		{
			if (n % prime[i] == 0)
			{
				ansList[ansCount++] = prime[i];
			}
			i++;
		}
		cout << n << ":";
		for (int i = 0; i < ansCount; i++)
		{
			cout << " "<< ansList[i];
		}

		cout <<endl;
	}
	return 0;
}

Measured memory_bytes: 1304
#include<bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; i++)
typedef long long ll;

long long INF = 1e18;

int main(){
    int n;
    cin>>n;
    int x[n + 100];
    for (int i = 1; i <= n;i++){
        cin >> x[i];
    }
    ll sum = 0;
    ll max = INF;
    for (int i = 1; i <= 100;i++){
        for (int j = 1; j <= n;j++){
            sum += (x[j] - i) * (x[j] - i);
        }
        if(max>sum){
            max = sum;
        }
        
        sum = 0;
    }
    cout << max << endl;
    return 0;
}


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

typedef long long ll;
const int N = 110;
int x, n;
int p[N];

void solve() {
    scanf("%d%d", &x, &n);
    for(int i = 1; i <= n; i++) scanf("%d", &p[i]);
    sort(p + 1, p + 1 + n);
    int res = 0x3f3f3f3f;

    int g = 1;
    for(int i = 0; i <= 101; i++) {
        if(g <= n && i == p[g]) {
            g++;
            continue;
        }
        if(abs(res - x) > abs(x - i)) res = i; 
    }
    printf("%d\n", res);

}

int main()
{
    //freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);

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

Measured memory_bytes: 3804
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] C = new int[500];
        int[] S = new int[500];
        int[] F = new int[500];
        for(int i = 0; i < N - 1 ; i++) {
            C[i] = sc.nextInt();
            S[i] = sc.nextInt();
            F[i] = sc.nextInt();
        }

        for(int i = 0;i < N;i++){
            int t = 0;
            for(int j = i; j < N - 1; j++) {
                if(t < S[j])
                    t = S[j];
                else if(t % F[j] == 0);
                else t = t + F[j] - t % F[j];
                t += C[j];
            }
            System.out.println(t);
        }

    }
}


Measured memory_bytes: 27680
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
int main(){
    string s;
    cin>>s;
    if(s.size()==3) reverse(all(s));
    cout<<s<<endl;
}


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

using namespace std;

int n, k;
vector<int> G[100005];
int depth[100005];
int pre[17][100005];
int prek[100005];
bool mark[100005];
vector<pair<int, int> > vec;

void depdfs(int v, int dep)
{
	depth[v] = dep;
	for(int i = 0; i < G[v].size(); i++){
		depdfs(G[v][i], dep+1);
	}
}

void markdfs(int v)
{
	mark[v] = true;
	for(int i = 0; i < G[v].size(); i++){
		if(mark[G[v][i]]) continue;
		markdfs(G[v][i]);
	}
}

int main(void)
{
	int ans = 0;
	cin >> n >> k;
	
	int a;
	cin >> a;
	if(a != 1) ans++;
	for(int i = 2; i <= n; i++){
		cin >> a;
		G[a].push_back(i);
	}
	
	if(k > n){
		cout << ans << endl;
		return 0;
	}
	
	depdfs(1, 0);
	for(int i = 1; i <= n; i++) vec.push_back(make_pair(depth[i], i));
	sort(vec.begin(), vec.end());
	reverse(vec.begin(), vec.end());
	
	for(int i = 1; i <= n; i++){
		for(int j = 0; j < G[i].size(); j++){
			pre[0][G[i][j]] = i;
		}
	}
	pre[0][1] = -1;
	
	for(int i = 1; i < 17; i++){
		for(int j = 1; j <= n; j++){
			pre[i][j] = pre[i-1][pre[i-1][j]];
		}
	}
	for(int i = 1; i <= n; i++){
		int p = i;
		for(int j = 0; j < 17; j++){
			if((k-1) & (1<<j)) p = pre[j][p];
		}
		prek[i] = p;
	}
	
	for(int i = 0; i < vec.size(); i++){
		if(vec[i].first <= k) break;
		int v = vec[i].second;
		if(mark[v]) continue;
		ans++;
		markdfs(prek[v]);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 18804
#define _CRT_SECURE_NO_WARNINGS
#define lp(i,n) for(int i=0;i<n;i++)
#include"bits/stdc++.h"


using namespace std;
int main() {
	int n, a;
	int i = 0;
	cin >> n >> a;
	while (n % 500 != 0) {
		n -= 1;
		i++;
	}
	if (i <= a)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;

}

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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    int n, k;
    cin >> n >> k;
    COMinit();
    rep(i, 1, k+1){
        cout << COM(n-k+1,i)*COM(k-1,i-1)%MOD << endl;
    }
}

Measured memory_bytes: 26964
#include <cstdio>
using namespace std;

int main(){
	int B, C;
	int N;
	int ball[10];
	bool bo;
	
	scanf("%d", &N);
	while(N--){
		for(int i = 0; i < 10; i++) scanf("%d", &ball[i]);
		
		B = 0; C = 0;
		
		bo = true;
		for(int i = 0; i < 10; i++){
			if(ball[i] > B) B = ball[i];
			else if(ball[i] > C) C = ball[i];
			else{
				bo = false;
				break;
			}
		}
		
		if(bo) printf("YES\n");
		else printf("NO\n");
	}
	
	return 0;
}

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

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

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



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

int main() {
   int h1,m1,h2,m2,k;
   cin >> h1 >> m1 >> h2 >> m2 >> k;
   
   cout << (h2*60+m2)-(h1*60+m1)-k;
return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

bool CanBeMonth(int m){
  if(1<=m && m<=12)return true;
  else return false;
}

int main(){
  int n;
  cin >> n;
  int back=n%100;
  int front=(n-n%100)/100;
  if(CanBeMonth(front) && CanBeMonth(back))cout << "AMBIGUOUS" << endl;
  else if(CanBeMonth(front))cout << "MMYY" << endl;
  else if(CanBeMonth(back))cout << "YYMM" << endl;
  else cout << "NA" << endl;
return 0;}

Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 

int main(){
    fastio
    ll n ; 
    cin >> n ;
    vector<ll> v(n+1) ; 
    for(ll i=0;i<=n;i++){
    	cin >> v[i] ; 
    }
    ll ans = 0 ; 
    for(ll i=0;i<n;i++){
    	ll x ; 
    	cin >> x ; 
    	if ( x > v[i] ){
    		ans += v[i] ; 
    		ll t = min(v[i+1],x-v[i]);
    		v[i+1] -= t ;
    		ans += t ; 
    	}
    	else ans += x ; 
    }
    cout << ans << endl;
    return 0 ;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		String s="";
		long[] a=new long [5];
		for(int i=0;i<n;i++) {
			s=sc.next();
			if(s.charAt(0)=='M'){
				a[0]++;
			}
			else if(s.charAt(0)=='A'){
				a[1]++;
			}
			else if(s.charAt(0)=='R'){
				a[2]++;
			}
			else if(s.charAt(0)=='C'){
				a[3]++;
			}
			else if(s.charAt(0)=='H'){
				a[4]++;
			}

		}
		long ans=0;
		for(int i=0;i<3;i++) {
			for(int j=i+1;j<4;j++) {
				for(int k=j+1;k<5;k++) {
					ans+=a[i]*a[j]*a[k];
				}
			}
		}
		System.out.println(ans);
		
	
	}
}


Measured memory_bytes: 46720
n = gets.chomp.to_i
arr = gets.chomp.split.map(&:to_i)
count = 0

while n > 1
    flg = 0
    for i in 1..n-1
        arr[i] > arr[i-1] && next
        if arr[i] < arr[i-1]
            arr[i],arr[i-1] = arr[i-1],arr[i]
            count += 1
            flg += 1
        end
    end
    flg == 0 && break
end

puts arr.join(" ")
puts count

Measured memory_bytes: 8716
let n, m, c = Scanf.scanf " %d %d %d" @@ fun a b c -> a, b, c
let bs = Array.init m @@ fun _ -> Scanf.scanf " %d" (+) 0
let ss = Array.init n @@ fun _ -> Array.fold_left (+) c @@ Array.init m @@ fun i -> Scanf.scanf " %d" @@ fun a -> a * bs.(i)
let _ = Array.fold_left (fun a s -> a + if s > 0 then 1 else 0) 0 ss |> Printf.printf "%d\n"

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

char a[4][100005];
char s[100005];

bool check(int x, int y, int z, int j){
    bool flag = false;
    if(s[y] == 'o'){
        if(a[j][y] == 'S'){
            if(a[j][x] == 'S' && a[j][z] == 'S'){
                flag = true;
            }else if(a[j][x] == 'W' && a[j][z] == 'W'){
                flag = true;
            }
        }else if(a[j][y] == 'W'){
            if(a[j][x] == 'S' && a[j][z] == 'W'){
                flag = true;
            }else if(a[j][x] == 'W' && a[j][z] == 'S'){
                flag = true;
            }
        }
    }else if(s[y] == 'x'){
        if(a[j][y] == 'S'){
            if(a[j][x] == 'S' && a[j][z] == 'W'){
                flag = true;
            }else if(a[j][x] == 'W' && a[j][z] == 'S'){
                flag = true;
            }
        }else if(a[j][y] == 'W'){
            if(a[j][x] == 'S' && a[j][z] == 'S'){
                flag = true;
            }else if(a[j][x] == 'W' && a[j][z] == 'W'){
                flag = true;
            }
        }
    }
    return flag;
}

int main(void){
    long n;
    int cnt = 0;
    bool flag2 = false;
    
    cin >> n;

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

    a[0][0] = 'S';
    a[0][1] = 'S';
    
    a[1][0] = 'S';
    a[1][1] = 'W';
    
    a[2][0] = 'W';
    a[2][1] = 'S';
    
    a[3][0] = 'W';
    a[3][1] = 'W';

    for(int j=0;j<4;j++){
        for(int i=2;i<n;i++){
            if(a[j][i-2] == 'S'){
                if(a[j][i-1] == 'S'){
                    if(s[i-1] == 'o'){
                        a[j][i] = 'S';
                    }else if(s[i-1] == 'x'){
                        a[j][i] = 'W';
                    }
                }else if(a[j][i-1] == 'W'){
                    if(s[i-1] == 'o'){
                        a[j][i] = 'W';
                    }else if(s[i-1] == 'x'){
                        a[j][i] = 'S';
                    }
                }
            }else if(a[j][i-2] == 'W'){
                if(a[j][i-1] == 'S'){
                    if(s[i-1] == 'o'){
                        a[j][i] = 'W';
                    }else if(s[i-1] == 'x'){
                        a[j][i] = 'S';
                    }
                }else if(a[j][i-1] == 'W'){
                    if(s[i-1] == 'o'){
                        a[j][i] = 'S';
                    }else if(s[i-1] == 'x'){
                        a[j][i] = 'W';
                    }
                }
            }
        }
        if(check(n-3,n-2,n-1,j) == true && check(n-2,n-1,0,j) == true && check(n-1,0,1,j) == true){
            for(int i=0;i<n;i++){
                cout << a[j][i];
            }
            cout << endl;
            return 0;
        }
    }
    cout << "-1" << endl;
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;


void solve(){
    string a,b,c;
    cin >> a >> b >> c;
    cout << a[0] << b[1] << c[2] << endl;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
typedef vector<int> VI;
typedef vector<ll> VLL;

int main(){
    VI t(5);
    for(int i=0; i<5 ;++i)cin >> t[i];
    int min=10, ans=0, tmp = 0;

    for(int i=0; i<5; ++i){
        if(t[i]%10 < min && t[i] % 10 != 0){
            min = t[i] % 10;
            tmp = i;
        }
    }
    ans += t[tmp];
    swap(t[tmp], t[0]);

    for(int i=1 ; i<5 ; ++i){
        if(t[i] % 10 == 0)ans += t[i];
        else ans += (t[i]/10+1)*10;
    }

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define inf 100000000000000007
#define N 1000005
using namespace std;
typedef long long ll;
typedef pair < ll , ll > ii;

ll n, m, top, x[N], y[N], z[N], dp[N], seg[4*N], laz[4*N];
vector < ii > g[N];

void put(ll k, ll z){
	seg[k] += z;
	laz[k] += z;
}

void push(ll k){
	put(sol, laz[k]);
	put(sag, laz[k]);
	laz[k] = 0;
}

ll qu(ll k, ll bas, ll son, ll x, ll y){
	if(bas > y or son < x)
		return inf;
	if(bas >= x and son <= y)
		return seg[k];
	push(k);
	return min(qu(sol, bas, orta, x, y), qu(sag, orta + 1, son, x, y));
}

void up(ll k, ll bas, ll son, ll x, ll y, ll z){
	if(bas > y or son < x)
		return;
	if(bas >= x and son <= y){
		put(k, z);
		return;
	}
	push(k);
	up(sol, bas, orta, x, y, z);
	up(sag, orta + 1, son, x, y, z);
	seg[k] = min(seg[sol], seg[sag]);
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%lld %lld",&n ,&m);
	for(ll i = 1; i <= m; i++){
		scanf("%lld %lld %lld",x + i, y + i, z + i);
		top += z[i];
		g[x[i]].pb(mp(y[i], z[i]));
	}
	for(ll i = n; i >= 0; i--){
		dp[i] = qu(1, 1, n + 1, i + 1, n + 1);
		up(1, 1, n + 1, i, i, dp[i]);
		for(ll j = 0; j < g[i].size(); j++)
			up(1, 1, n + 1, g[i][j].st + 1, n + 1, g[i][j].nd);
	}
	printf("%lld\n", top - dp[0]);
	return 0;
}

Measured memory_bytes: 57728
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
    string K;
    cin>>K;
    int a=K.length();
         if (K[2]==K[3] && K[4]==K[5])
            cout<<"Yes"<<endl;
         else
            cout<<"No"<<endl;

     return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long x,y,ba=0,bb=0;
int flag1=0,flag2=0;
long long ans=0;
int main()
{
	cin>>x>>y;
	if((x==0||x==-0)&&y>0)
	{
		ba=y;
		cout<<ba+bb;
		return 0;
	}
	if((x==0||x==-0)&&y<0)
	{
		y=-y,bb=bb+1,ba=y;
		cout<<ba+bb;
		return 0;
	}
	if((y==0||y==-0)&&x>0)
	{
		ba=x,bb=bb+1;
		cout<<ba+bb;
		return 0;
	}
	if((y==0||y==-0)&&x<0)
	{
		ba=-x;
		cout<<ba+bb;
		return 0;
	}
	if(x>0)
		flag1=1;
	if(y>0)
		flag2=1;
	if(flag1==flag2)
	{
		if(flag1==0)
		{
			if(x<y)
			{
				ba=abs(x)-abs(y);
				cout<<ba+bb;
				return 0;
			}
			x=-x,y=-y,bb=bb+1,ba=abs(y-x),bb=bb+1;
			cout<<ba+bb;
			return 0;
		}
		if(flag1==1)
		{
			if(x>y)
			{
				ba=abs(y-x),bb=bb+2;
				cout<<ba+bb;
				return 0;				
			}
			ba=abs(y-x);	
			cout<<ba+bb;
			return 0;			
		}
	}
	else 
	{
		if(flag1==0)
		{
			x=-x,bb=bb+1,ba=abs(y-x);
			cout<<ba+bb;
			return 0;
		}
		if(flag1==1)
		{
			y=-y,bb=bb+1,ba=abs(y-x);
			cout<<ba+bb;
			return 0;
		}						
	}
	cout<<ba+bb;
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

int solve() {
    string s, t; cin >> s >> t;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) return -1;
    }
    return 0;
}

int main() {
    int T = 1; 
    // cin >> T;
    for (int t = 1; t <= T; t++)
        // cout << "Case #" << t << ": " << solve() << "\n";
        if (solve() == 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

int main(){
    int a=0,b=0,c=0,d,n=0,x;
    string s,s1,s2;
    cin >> a >> b;   
    if (a<=b) c = a;
    else c = a-1;
    

    cout << c << endl;
    return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
     
int main(){
  string s, ans = "yes";
  cin >> s;

  for(int i=0;i<=s.size();i++)
  {
  for(int j=i+1;j<s.size();j++)
    {
    if(s[i]==s[j])ans = "no";
    }
    
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
using namespace std;

int main(){ 
  int n;
  cin>>n;
  int c=0,d=0,ans=10000,a,b,x,y;
  int aa[n];
  rep(i,0,n) cin>>aa[i];
  rep(i,0,n-1){
    if(aa[i]==aa[i+1]) c++;
    else{
      d+=(c+1)/2;
      c=0;
    }
  }
  d+=(c+1)/2;
  
  co(d);
  
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import copy
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def solve():
    N, M = Scanner.map_int()
    uni = UnionFind(N)
    for _ in range(M):
        a, b = Scanner.map_int()
        a -= 1
        b -= 1
        uni.union(a, b)
    ls = [0 for _ in range(N)]
    for i in range(N):
        ls[uni.find(i)] += 1
    print(max(ls))


def main():
    # sys.setrecursionlimit(1000000)
    # sys.stdin = open("sample.txt")
    solve()


if __name__ == "__main__":
    main()


Measured memory_bytes: 17820
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ve vector
#define chmin(x,y) x = min(x,y)

const int mod = 1000000007;

struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
 
  // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
    mint P(int n, int k){
        return fact[n] * ifact[n-k];
    }
};

int main(){
    int n,m;
    cin >> n >> m;
    map<int,int> fac;
    
    for (int i = 2; i<=m; i++) {
        while(m%i == 0){
            m /= i;
            fac[i]++;
        }
    }
    if(m!=1) fac[m]++;
    combination c(n + 100);
    
    mint ans = mint(1);
    
    for(P x: fac){
        int cnt = (int)x.second;
        ans *= c(n+cnt-1,cnt);
    }
    cout << ans.x << endl;
    return 0;
}


Measured memory_bytes: 4852
import queue

n, m = [int(_) for _ in input().split(' ')]
a = [int(_) for _ in input().split(' ')]

q = queue.PriorityQueue()
for i in a:
    q.put(-i)

for _ in range(m):
    i = -(q.get())
    q.put(-(i >> 1))

answer = 0
for _ in range(n):
    answer -= q.get()

print(answer)


Measured memory_bytes: 20796
fn whitespace_three() -> (usize, usize, usize) {
    use std::io;
    use std::str::FromStr;
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
    (
        it.next().unwrap(), 
        it.next().unwrap(),
        it.next().unwrap(),
    )
}

fn main() {
    let (n, a, b) = whitespace_three();
    let train = n * a;
    let res = if train < b { train } else { b };
    println!("{}", res);
}

Measured memory_bytes: 4352
N=1000000007

def power(x,y)
        if(y.to_i==0) then return 1; end
        if(y.to_i==1) then return x; end
        if(y.to_i%2==0) then
                a = power(x.to_i,y.to_i/2);
                return (a*a)%N;
        else
                a = power(x.to_i,(y.to_i-1)/2);
                return (a*a*x%N);
        end
end

m,n=gets.split(" ");
puts power(m.to_i,n.to_i);

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}

//char->int
int ctoi(char c){
    return c-'0';
}

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}



int main(){
    bool a[101];
    rep(i,101){
        a[i]=false;
    }
    int x,n;
    cin >> x >> n;
    
    rep(i,n){
        int w;
        cin >> w;
        a[w]=true;
    }

    int mi = 100;
    int ma = 0;


    for(int i=x;;i--){
        if(!a[i]||i<0){
            mi = i;
            break;
        }
    }

    for(int i=x;;i++){
        if(!a[i]||i>100){
            ma = i;
            break;
        }
    }

    if(abs(x-mi)<=abs(x-ma)){
        cout << mi << endl;
    }else{
        cout << ma << endl;
    }
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (int i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define fi first
#define se second
#define int long long
using namespace std;
using ll = long long;
using II = pair<int, int>; using VII = vector<II>; using VVII = vector<VII>;
using VI = vector<int>; using VVI = vector<VI>; using VVVI = vector<VVI>;
template <class T = int> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T = int> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <class T> ostream& operator<<(ostream &s, const vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream &s, const vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream &s, const pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, const map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
constexpr int MOD = 1e9 + 7;

const VI x = {0, 1, 0, -1};
const VI y = {1, 0, -1, 0};
signed main() {
  int H, W; cin >> H >> W;
  vector<string> S(H);
  REP (i, H) cin >> S[i];

  auto valid = [&](int i, int j) {
    return 0 <= i && i < H && 0 <= j && j < W;
  };
  VVI visited(H, VI(W));
  function<II(int, int)> dfs = [&](int i, int j) {
    II acc = {0, 0};
    if (visited[i][j]) return acc;
    (S[i][j] == '.' ? acc.fi : acc.se) = 1;
    visited[i][j] = true;
    REP (k, 4) {
      int i2 = i + x[k];
      int j2 = j + y[k];
      if (!valid(i2, j2) || S[i][j] == S[i2][j2]) continue;
      II tmp = dfs(i2, j2);
      acc.fi += tmp.fi;
      acc.se += tmp.se;
    }
    return acc;
  };
  int ans = 0;
  REP (i, H) {
    REP (j, W) {
      II num = dfs(i, j);
      ans += num.fi * num.se;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 21760
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod2 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2e9

int main()
{
    int n;
    cin >> n;
    vector<int>v(n+1,0);
    for(int i=1;i<=100;i++)
    {
        for(int j=1;j<=100;j++)
        {
            for(int k=1;k<=100;k++)
            {
                int a=i*i+j*j+k*k+i*j+i*k+j*k;
                if(a<=n)
                    v[a]+=1;
            }
        }
    }
    for(int i=1;i<=n;i++)
        cout << v[i] << endl;
}

Measured memory_bytes: 3496
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:1024000000")
#pragma warning( disable : 6031)
#pragma warning( disable : 4244)
#pragma warning( disable : 26451)
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#  define __builtin_popcountll __popcnt64
#endif
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdint>
#include <climits>
#include <cassert>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <chrono>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef vector<ll> vl;
typedef vector<vector<long long>> vvl;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef tuple<int, int, int> tiii;
const long long mod = int(1e9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;


ll stupid_solve(ll h, ll w)
{
	ll res = 0;
	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++)
		{
			if ((i + j) % 2 == 0)
				res++;
		}
	return res;
}

ll solve(ll h, ll w)
{
	ll res = ((w + 1LL) / 2LL) * ((h + 1) / 2LL);
	res += (w / 2LL) * (h / 2LL);
	return res;
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	ll h, w;
	cin >> h >> w;
	if (h == 1 || w == 1)
	{
		cout << 1;
	}
	else
		cout << solve(h, w);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define endl '\n';
typedef long long ll;
typedef long double ld;
using namespace std;

const int mod = 1e9 + 7;
const int N = 1e5 + 10;
char s[N];
int n;
int pw3[N];

int main() {
  pw3[0] = 1;
  for (int i = 1; i < N; i++) {
    pw3[i] = pw3[i - 1] * 1ll * 3 % mod;
  }

  scanf("%s", s);
  n = strlen(s);
  int ans = 0;
  int p2 = 1;
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') {
      ans = (ans + ll(p2) * pw3[n - i - 1]) % mod;
      p2 = p2 * 2 % mod;
    }
  }
  ans = (ans + p2) % mod;
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ins insert
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define up_b upper_bound
#define low_b lower_bound
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define rev(i,a,b) for(int i=b;i>=a;i--)
#define boost ios_base::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL)
#define nl '\n'

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;

const int N=200001;
const int MXN=1000001;
const int inf=1e9;
const ll INF=1e18;

int main(){
  boost;
  int a,b,c;
  cin>>a>>b>>c;
  int d=a+b;
  if(d>=c)cout<<b+c;
  else{
    cout<<d+b+1;
  }
  return 0;
}


Measured memory_bytes: 256
#B
s = input()
# print(int(s[0:2]), int(s[2:4]))
if 1 <= int(s[0:2]) <= 12 and 1 <= int(s[2:4]) <= 12:
    print('AMBIGUOUS')
elif 1 <= int(s[0:2]) <= 12:
    print('MMYY')
elif 1 <= int(s[2:4]) <= 12:
    print('YYMM')
else:
    print('NA')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct UnionFind {
    vector<int> par;

    UnionFind(int n) {
        par.resize(n);
        rep(i, n) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        par[x] = root(par[x]);
        return par[x];
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[ry] = rx;
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

int main() {
    int n, m;
    cin >> n >> m;

    UnionFind tree(n);
    rep(i, m) {
        int x, y, z;
        cin >> x >> y >> z;
        x--; y--;
        tree.unite(x, y);
    }

    set<int> s;
    rep(i, n) {
        s.insert(tree.root(i));
    }
    cout << s.size() << endl;
}


Measured memory_bytes: 5376
#include <iostream>
using namespace std;
int main(){
  string str;
  cin >> str;
  int kai;
  cin >> kai;
  for(int i = 0; str.size()/kai >= i + 1; i++){
    cout << str.at((i) * kai);
  }
  if(str.size() % kai != 0){
    cout << str.at(str.size()/kai * kai);
  }
  cout << endl;
}

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

int main() {
  int N[4];
  cin >> N[0] >> N[1] >> N[2] >> N[3];
  int n[10] = {};
  n[N[0]]++, n[N[1]]++, n[N[2]]++, n[N[3]]++;
  if (n[1] == 1 && n[9] == 1 && n[7] == 1 && n[4] == 1) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
//In The Name Of Allah
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define double long double 
#define fi first
#define se second
#define pii pair<int, int>

signed main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  multiset<int> st;
  for (int i = 0; i < n; i++) {
    if (st.upper_bound(-a[i]) == st.end()) {
      st.insert(-a[i]);
    } else {
      auto it = st.upper_bound(-a[i]);
      st.erase(it);
      st.insert(-a[i]);
    }
  }
  cout << sz(st) << "\n";
}



Measured memory_bytes: 5760
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int ans = 0;
    int idx1 = 0;
    int idx2 = S.length() - 1;
    while(idx1 < idx2) {
        if (S[idx1] == S[idx2]) {
            idx1++;
            idx2--;
        }
        else if(S[idx1] == 'x' && S[idx2] != 'x') {
            idx1++;
            ans++;
        }
        else if (S[idx1] != 'x' && S[idx2] == 'x') {
            idx2--;
            ans++;
        }
        else {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val s = br.readLine()!!.toCharArray().sorted().joinToString("")
    val t = br.readLine()!!.toCharArray().sortedDescending().joinToString("")
    val ans = if (s < t) "Yes" else "No"
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 40056