akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
        }
        int sum = 0;
        for (int i = 0; i < a.length; i++) {
            int min = i;
            for (int j = i; j < a.length; j++) {
                if (a[j] < a[min]) {
                    min = j;
                }
            }
            if (min != i) {
                int temp = a[min];
                a[min] = a[i];
                a[i] = temp;
                sum++;
            }
        }
        for (int i = 0; i < a.length - 1; i++) {
            System.out.print(a[i] + " ");
        }
        System.out.print(a[n - 1] + "\n" + sum + "\n");
    }
}


Measured memory_bytes: 26316
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char>> data(H, vector<char>(W));
  
  for(int i = 0;i<H;i++){
    for(int j= 0;j<W;j++){
      cin >> data.at(i).at(j);
    }
  }

  for(int i = 0;i< H;i++){
    int c =0;
   for(int j = 0;j<W;j++){//各行毎に.の数を計算し、すべて.であれば.をxに変えていく
     if(data.at(i).at(j) == '.') c++;
   }
    if(c==W){
      for(int j =0;j<W;j++){
        data.at(i).at(j) = 'x';
      }
    }
  }
  for(int j = 0;j< W;j++){
    int c =0;
   for(int i = 0;i<H;i++){//各列毎に.の数を計算し、すべて.かxであれば.をxに変えていく
     if(data.at(i).at(j) != '#') c++;
   }
    if(c==H){
      for(int i =0;i<H;i++){
        data.at(i).at(j) = 'x';
      }
    }
  }
  
for(int i = 0;i<H;i++){
    for(int j= 0;j<W;j++){
      if(data.at(i).at(j) != 'x') cout << data.at(i).at(j);
      if(j == W-1) cout << endl;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> Pii;

int K, A, B;

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

    bool f = false;
    for (int i = A; i <= B; i++) {
        if (i % K == 0) f = true;
    } 

    cout << (f ? "OK" : "NG") << endl;
    
    return 0;
}


Measured memory_bytes: 3636
from fractions import gcd
a, b, c, d = map(int, input().split())

e = (c * d) // gcd(c, d)

c_min = a + (c - a % c) if (a % c) != 0 else a
c_max = b - b % c
d_min = a + (d - a % d) if (a % d) != 0 else a
d_max = b - b % d
e_min = a + (e - a % e) if (a % e) != 0 else a
e_max = b - b % e

n_c = (c_max - c_min) // c + 1 if c_min <= c_max else 0
n_d = (d_max - d_min) // d + 1 if d_min <= d_max else 0
n_e = (e_max - e_min) // e + 1 if e_min <= e_max else 0

ans = b - a + 1 - n_c - n_d + n_e

print(ans)

Measured memory_bytes: 5204
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m,k;
  int a,count=0,like[31];
  cin >> n >> m;
  for(int i=1; i<=m; i++){
    like[i] = 0;
  }
  for(int i=0; i<n; i++){
    cin >> k;
    for(int j=0; j<k; j++){
      cin >> a;
      like[a]++;
    }
  }
  for(int i=1; i<=m; i++){
    if(like[i] == n) count++;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    sc.nextLine
    val p = new Array[Int](n)
    for (i <- 0 until n) {
      p(i) = sc.nextInt
    }

    var count = 1
    var maxNum = p(0)
    var minNum = p(0)
    for (i <- 1 until n) {
      if (p(i) <= maxNum && p(i) <= minNum) count += 1

      maxNum = math.max(p(i), maxNum)
      minNum = math.min(p(i), minNum)
    }
    println(count)
  }
}


Measured memory_bytes: 70764
#include <iostream>
using namespace std;
int main(){
        int n,k,num,count=0;
        cin>>n;
        char A;
        int S[13]={1,2,3,4,5,6,7,8,9,10,11,12,13};
        int H[13]={1,2,3,4,5,6,7,8,9,10,11,12,13};
        int C[13]={1,2,3,4,5,6,7,8,9,10,11,12,13};
        int D[13]={1,2,3,4,5,6,7,8,9,10,11,12,13};
       while(cin>>A>>num){
        if(A=='S') S[num-1]=0;
        if(A=='H') H[num-1]=0;
        if(A=='C') C[num-1]=0;
        if(A=='D') D[num-1]=0;
               count++;
               if(count==n)break;
        }
        for(k=0;k<13;k++) if(S[k]!=0)cout<<"S"<<" "<<S[k]<<endl;
        for(k=0;k<13;k++) if(H[k]!=0)cout<<"H"<<" "<<H[k]<<endl;
        for(k=0;k<13;k++) if(C[k]!=0)cout<<"C"<<" "<<C[k]<<endl;
        for(k=0;k<13;k++) if(D[k]!=0)cout<<"D"<<" "<<D[k]<<endl;
}

Measured memory_bytes: 3104
//============================================================================
// Name        : d.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include<vector>
using namespace std;

int main() {
	int k;cin>>k;
	long long num=0;
	vector<int> v;
	v.push_back(1);
	for(int i=1;i<k;i++){
//		num=0;
//		for(int j=0;j<v.size();j++){
//			cout<<v[j]<<' ';
////				num*=10;
////				num+=v[v.size()-1-j];
//		}cout<<endl;
//		cout<<num<<endl;
		for(int j=0;j<v.size();j++){
			if(j<v.size()-1&&v[j]!=v[j+1]+1&&v[j]!=9){
				v[j]++;
				for(int l=j-1;l>=0;l--){
					v[l]=max(v[l+1]-1,0);
				}
				break;
			}
			if(j==v.size()-1){
				if(v[j]==9){
					for(int l=0;l<v.size();l++){
						v[l]=0;
					}
					v.push_back(1);
					break;
				}else{
					v[j]++;
					for(int l=j-1;l>=0;l--){
						v[l]=max(v[l+1]-1,0);
					}
					break;
				}
			}
		}

	}
	for(int i=0;i<v.size();i++){
		num*=10;
		num+=v[v.size()-1-i];
	}
	cout<<num<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long d[100100];
vector<pair<int,long long> > ga[100100];
int n;
int a,b;
long long c;
int q,k;
void dfs(int u,int prv=-1,long long dist=0LL){
	d[u]=dist;
	for(int i=0;i<ga[u].size();i++){
		int v=ga[u][i].first;
		if(v!=prv)
		{
			dfs(v,u,dist+ga[u][i].second);
		}
	}
}
int x,y;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=1;i<n;i++){
		cin>>a>>b>>c;
		ga[a].push_back(make_pair(b,c));
		ga[b].push_back(make_pair(a,c));
	}
	cin>>q>>k;
	dfs(k);
	while(q--){
		cin>>x>>y;
		cout<<d[x]+d[y]<<endl;
	}
	return 0;
}


Measured memory_bytes: 15872
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N,R = input_int()

ans = 0
if N>=10:
    print(R)
else:
    print(R + (100*(10-N)))
    

Measured memory_bytes: 2940
# H, W = [int(_) for _ in input().split()]
import sys
S = input()
if len(S) % 2 == 0:
    hi_list = []
    for i in range(0, len(S), 2):
        hi_list.append(S[i:i+2])
    if set(hi_list) == {'hi'}:
        print('Yes')
        sys.exit(0)
print('No')


Measured memory_bytes: 8924
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
int main()
{
     ll n, x, t;
     cin>>n>>x>>t;
     ll ans=(n/x);
     if(n%x!=0)
     {
         ans+=1;
     }
     ans=ans*t;
     cout<<ans<<endl;


    return 0;
}

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;

typedef unsigned long long ll;

const long long MOD = 1000000000 + 7;

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;
}

int main(){
    ll a, b, x;
    cin >> a >> b >> x;
    ll upper = b/x;
    ll lower = (a-1)/x;
    if ( a==0) {
        lower = 0;
        upper++;
    }
    cout << upper - lower << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a,ll b) {
    if (b==0) return 1;
    ll c = power(a,b>>1);
    c = (c*c)%mod;
    if (b&1) return (c*a)%mod;
    return c;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)2e5+5;
const int Q = 301;

vector<ll> st;
void apply(int i,ll val) {
    st[i] += val;
}
void update(int l,int r,ll val) {
    for (;l<r;l>>=1,r>>=1) {
        if (l&1) apply(l++,val);
        if (r&1) apply(--r,val);
    }
}
void build (int i) {
    REPN(h,20,1) {
        int p = i>>h;
        if (p>0) {
            apply(p<<1,st[p]);
            apply(p<<1|1,st[p]);
            st[p] = 0;
        }
    }
}
ll get_val(int i) {
    build(i);
    return st[i];
}
void solve() {
    int n,a; ll d;
    cin>>n>>d>>a;
    vector<pi> v(n);
    REP(i,0,n-1) {
        cin>>v[i].first>>v[i].second;
    }
    sort(all(v));
    st.resize(n<<1);
    ll ans = 0;
    for (int l=0,r=0;l<n;l++) {
        ll val = v[l].second+get_val(l+n);
        if (val>0) {
            r = max(l,r);
            while (r<n && v[r].first<=v[l].first+2*d) {
                r++;
            }
            ll s = (val+a-1)/a;
            ans += s;
            update(l+n,r+n,-a*s);
        }
    }
    cout<<ans;
}
int main() {
    //freopen("output.txt","r",stdin);
    //freopen("output.txt","w",stdout);

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

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main(){
    string s;
    cin>>s;
    int n=s.size();
    reverse(all(s));

    vector<ll> v;
    v.push_back(0LL);
    ll p=1;
    ll pre=0;
    rep(i,n){
        ll x=s[i]-'0';
        x=(x*p)%2019;
        x=(x+pre)%2019;
        v.push_back(x%2019);
        p=(p*10)%2019;
        pre=x;
    }
    map<int,int> m;
    rep(i,n+1){
        m[v[i]]++;
    }

    ll ans=0;
    for(auto e : m){
        int num=e.second;
        if(num>1){
            ans+=(num*(num-1))/2;
        }
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 5428
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
using namespace std;
#include <bits/stdc++.h>
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb(X) push_back(X)
#define x first
#define y second
#define all(x) (x).begin(), (x).end()
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
typedef long long ll;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef pair<int, int> pii;
//ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


const int INF = 1e9 + 7;
int _;

int main() {
	INIT
	int a, b, c;
	cin >> a >> b >> c;
	cout << c << ' ' << a << ' ' << b;

	return 0;
}

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

#define LLINF (1LL<<60)
typedef long long ll;

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

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

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

//C++14 (GCC 5.4.1)
int main() {
    int N,K;
    cin >>N>>K;

    
    //-----------------------------------
    int ans=0;
    if(K==1) ans=0;
    else ans=N-K;

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

Measured memory_bytes: 256
S = input()
count = 0
for i in range(len(S)):
  if i%2 == 0:
    if 'RUD'.count(S[i]) != 1:
      count +=1
  else:
    if 'LUD'.count(S[i]) != 1:
      count +=1
if count == 0:
  print('Yes')
else:
  print('No')
    

Measured memory_bytes: 9044
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

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

int main(){
  int A, B;
  cin >> A >> B;
  cout << (A+B)%24 << endl;
  return 0;
}

Measured memory_bytes: 256
let n, m, k = Scanf.scanf "%d %d %d" (fun n m k -> n, m, k)
let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun i-> i))
let b = Array.init m (fun _ -> Scanf.scanf " %d" (fun i-> i))

let rec f i a c n =
  if i < n then (
    c.(i + 1) <- c.(i) + a.(i);
    f (i + 1) a c n
  )

let c = Array.make (n + 1) 0
let d = Array.make (m + 1) 0

let rec g ans i j =
  if i = n + 1 || k < c.(i) then ans
  else
    let rec h i j =
      if k < c.(i) + d.(j) then h i (j - 1)
      else j in
    let j = h i j in
    g (max ans (i + j)) (i + 1) j

let () =
  f 0 a c n;
  f 0 b d m;
  let ans = g 0 0 m in
  Printf.printf "%d\n" ans


Measured memory_bytes: 12268
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]

n = i()
ab = mi(n)

ab.sort(key=ig(1))

nowt = 0
for i in range(n):
    nowt += ab[i][0]
    if nowt > ab[i][1]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 56064
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll x,y;
  cin >> x >> y;
  set<ll> a,b;
  a.in(1);
  b.in(1);
  for(ll i=2; i*i<=x; i++) {
    ll c=0;
    while(x%i==0) {
      c++;
      x/=i;
    }
    if(c) a.in(i);
  }
  if(x>1) a.in(x);
  for(ll i=2; i*i<=y; i++) {
    ll c=0;
    while(y%i==0) {
      c++;
      y/=i;
    }
    if(c) b.in(i);
  }
  if(y>1) b.in(y);
  ll ans=0;
  tr(it,a) {
    if(b.count(*it)) {
      ans++;
    }
  }
  pr(ans);
}

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


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

using namespace std;

int main(){
    int n,ans = 0,count = 0;
    cin >> n;
    vector<int>v(n);
    vector<int>vh(n+1,0);

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

    for(int i = 0;i < n-1;i++){
        vh[i+1] = v[i]-v[i+1];
    }

    for(int i = 1;i < n+1;i++){
        if(vh[i] >= 0 && i != n){
            count++;
        }else{
            ans = max(ans,count);
            count = 0;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <queue>

using namespace std;

int main(void) {
    int K;
    cin >> K;

    queue<int64_t> q;
    q.emplace(1);
    q.emplace(2);
    q.emplace(3);
    q.emplace(4);
    q.emplace(5);
    q.emplace(6);
    q.emplace(7);
    q.emplace(8);
    q.emplace(9);
    for(int i=0; i<K-1; i++) {
        int64_t tmp = q.front();
        int64_t res = tmp % 10;
        q.pop();
        if(tmp % 10 > 0) q.emplace(tmp * 10 + res - 1);
        q.emplace(tmp * 10 + res);
        if(tmp % 10 < 9) q.emplace(tmp * 10 + res + 1);
    }

    cout << q.front() << endl;
    return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("4 12 20");
            //3
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("14 14 14");
            //-1
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("454 414 444");
            //1
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();

        long A = wkArr[0];
        long B = wkArr[1];
        long C = wkArr[2];

        int Answer = 0;
        var VisitedSet = new HashSet<string>();
        VisitedSet.Add(GetHash(A, B, C));

        while (true) {
            if (A % 2 == 1 || B % 2 == 1 || C % 2 == 1) {
                break;
            }

            ExecExchange(ref A, ref B, ref C);
            if (VisitedSet.Add(GetHash(A, B, C)) == false) {
                Answer = -1;
                break;
            }
            Answer++;
        }
        Console.WriteLine(Answer);
    }

    static void ExecExchange(ref long pA, ref long pB, ref long pC)
    {
        long NewA = (pB + pC) / 2;
        long NewB = (pA + pC) / 2;
        long NewC = (pA + pB) / 2;

        pA = NewA;
        pB = NewB;
        pC = NewC;
    }

    static string GetHash(long pA, long pB, long pC)
    {
        return string.Format("{0},{1},{2}", pA, pB, pC);
    }
}


Measured memory_bytes: 13524
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(V) V.begin,V.end
const int N = 100005;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int m,k;
    cin >> m >> k;
    if(k>=pow(2,m))
    {
        cout << -1;
        return 0;
    }
    else
    {
        if(m==0 || m==1)
        {
            if(k==0)
            {
             if(m==0)
             cout << 0 << " " << 0;
             else
             cout << 0 << " " << 0 << " " << 1 << " " << 1;
            return 0;
            }
            else
            {
                cout << -1;
                return 0;
            }
            
        }
        else
        {
            for(int i=0;i<pow(2,m);++i)
            {
                if(i==k)
                continue;
                cout << i << " ";
            }
            cout << k << " ";
            for(int i=pow(2,m)-1;i>=0;--i)
            {
                if(i==k)
                continue;
                cout << i << " ";
            }
            cout << k ;
        }
        
    }
    
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

int dp[3050][6050];

signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,t;
  cin>>n>>t;
  pair<int,int> a[n];
  rep(i,n){
    cin>>a[i].fst>>a[i].scd;
  }
  sort(a,a+n);
  //int p=0,prev=a[0].fst;
  
      
    
  rep(i,n+1){
    rep(j,6050) dp[i][j]=-1;
  }
  dp[0][0]=0;
  rep(i,n){
    rep(j,t+a[i].fst){
      dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
      if(j-a[i].fst >= 0 && dp[i][j-a[i].fst]!=-1){
	dp[i+1][j]=max(dp[i][j-a[i].fst]+a[i].scd,dp[i+1][j]);
      }
    }
  }
 
  int ans=0;
  rep(i,6050){
    if(dp[n][i]!=-1) ans=max(ans,dp[n][i]);
  }
  cout<<ans<<endl;
	   
  return 0;
}


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

using namespace std;

bool is_prime[1 << 22];
vector<int> prime;

void sieve(int n) {
  fill(is_prime, is_prime + n, true);
  for (int i = 2; i <= n; i++) {
    if (!is_prime[i]) continue;
    prime.push_back(i);
    for (int j = 2 * i; j <= n; j += i) {
      is_prime[j] = false;
    }
  }
}

int main(void) {
  sieve(210000);

  int n, p;
  while (cin >> n >> p, n >= 0) {
    int l = 0;
    while (prime[l] <= n) l++;

    vector<int> sub, sum;
    for (int i = 0; i < 30; i++) {
      sub.push_back(prime[l + i]);
    }
    for (int i = 0; i < 30; i++) {
      for (int j = i; j < 30; j++) {
        sum.push_back(sub[i] + sub[j]);
      }
    }
    sort(sum.begin(), sum.end());

    cout << sum[p - 1] << endl;
  }

  return 0;
}


Measured memory_bytes: 3404
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
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;
const ll MOD = 1e9 + 7 ;
const ll N = 1e5 + 10 ;
int main(){
    fastio
    int n ;
    cin >> n ; 
    string s ;
    cin >> s ; 
    if ( n & 1 ) return cout << "No" << endl, 0 ; 
    string first = s.substr(0, n / 2) ; 
    string second = s.substr(n / 2) ; 
    if ( first == second ) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0 ; 
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		String str = scan.next();
		char[] c = str.toCharArray();
		c[5] = ' ';
		c[13] = ' ';
		str = new String(c);
		System.out.println(str);
	}
}


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

int main() {
  int N;
  cin >> N;
  
  bool test = 0;
  for (int i = 1; i < 10; i++) {
    if (N % i == 0 && N / i < 10) {
      test = 1;
      break;
    }
    else {
      continue;
    }
  }
  
  if (test) {
    cout << "Yes" << endl;
  }
  
  if (!test) {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
from collections import defaultdict
import sys
input = sys.stdin.readline

n = int(input())
S = input().rstrip()
L = S[:n]
R = S[n:][::-1]
C = defaultdict(int)
ans = 0
for i in range(1<<n):
  l = ""
  r = ""
  for j, s in enumerate(L):
    if i>>j & 1:
      l += s
    else:
      r += s
  C[l+"."+r] += 1
for i in range(1<<n):
  l = ""
  r = ""
  for j, s in enumerate(R):
    if i>>j & 1:
      l += s
    else:
      r += s
  ans += C[l+"."+r]
print(ans)

Measured memory_bytes: 237476
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

bool check(int a, int b) {
	return a > b;
}

int main() {
	llint n, m;
	cin >> n >> m;
	vector<vector<int>>a(m, vector<int>(2));
	rep(i, m) {
		cin >> a[i][0] >> a[i][1];
		a[i][0]--;
		a[i][1]--;
	}
	vllint ans(m);
	UnionFind Uni(n);
	ans[m - 1] = n*(n - 1) / 2;
	for (int i = m - 1;0 < i;i--) {
		if (Uni.root(a[i][0]) != Uni.root(a[i][1])) {
			ans[i - 1] = (llint)ans[i] - Uni.size(a[i][0])*Uni.size(a[i][1]);
			Uni.connect(a[i][0], a[i][1]);
		}
		else {
			ans[i - 1] = ans[i];
		}
	}
	rep(i, m) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 7936
#include <stdio.h>
int main()
{
  double r;
  double S,M;

  scanf("%lf",&r);
  S=r*r*3.141592653589;
  M=2*r*3.141592653589;
  printf("%.6lf %.6lf\n",S,M);
  
  return 0;
}

Measured memory_bytes: 652
#include <iostream>
using namespace std;
int main ()
{
	char a,b,c;
	while (cin >>a>>b>>c)
	{
		int sum=0;
		
		if (a=='A')
		sum++;
		else
		sum--;
		
		if (b=='A')
		sum++;
		else
		sum--;
		
		if (c=='A')
		sum++;
		else
		sum--;
		
		if (sum==3)
		cout <<"No"<<endl;
		else if (sum==-3)
		cout <<"No"<<endl;
		else
		cout <<"Yes"<<endl;
	}
	return 0;
}

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

int main() {
    int N; cin >> N;
    unordered_set<string> histo;
    while(N--) {
        string s, t; cin >> s >> t;
        if(s == "insert") {
            histo.insert(t);
        }
        else {
            cout << (histo.count(t) ? "yes" : "no") << endl;
        }
    }
}

Measured memory_bytes: 30056
<?php
fscanf(STDIN,'%d',$N);
$array=str_split($N);
for ($i=1; $i < 10 ; $i++) {
  // code...
  if($N<= $i*100+$i*10+$i){
    echo $i*100+$i*10+$i;
    break;
  }
}
 ?>


Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N=1e7+9;

int main()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin); 
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll k,mod=0;
    cin>>k;
    for(int i=1;i<N;i++){
    	mod=((mod*10)+7)%k;
    	if(mod==0){
    		cout<<i;
    		return 0;
    	}
    }
    cout<<-1;
}
        




Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <iomanip>
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    if((a*b)%2==1){
    	cout<<"Yes"<<endl;
    }
    else{
    	cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
S = sorted(A, reverse=True)
w, h = 0, 0

cnt = 0
tmp = S[0]
for i in range(N):
  if S[i] == tmp:
    cnt += 1
    if cnt == 2:
      if w == 0:
        w = tmp
        cnt = 0
      else:
        h = tmp
        break
  else:
    cnt = 1
    tmp = S[i]
        
ans = w * h
print(ans)


Measured memory_bytes: 19988
#include<iostream>
using namespace std;
int main (){

  int a,b,c;
  int count=0;
  cin >> a >> b >> c;
  
    if(a==b){
      count++;

    }
    if(a==c){
      count++;

    }
    if(b==c){
      count++;

    }
  
  

 if(count==1){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  
}


Measured memory_bytes: 256
/*starting with the name of almighty ALLAH*/
/*solved by RAKIB JOY*/
// Practice is the only shortcut to improve
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define vc vector
#define vi vc<int>
#define vl vc<ll>
#define dbg(x) cout<<x<<endl;
#define mp(x,y) make_pair(x,y)
#define yes dbg("YES")
#define no dbg("NO")
#define tst int t;cin>>t;while(t--)
#define srt(v) sort(v.begin(),v.end());
#define rsrt(v) sort(v.begin(),v.end(),greater<int>());
#define rj ios::sync_with_stdio(false);cin.tie(0);
#define rvs(v) reverse(v.begin(),v.end());
#define F first
#define S second
#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define PI 2*acos(0.0)
#define pii pair<int,int>
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define coutv(v) for(auto it:v)cout<<it<<' ';cout<<endl;
#define cinv(v) for(auto &it:v)cin>>it;
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using ordered_set =tree<T, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>;
*/
//sieve bool b[1000005];void primenire(){int i, j;b[0]=true;b[1]=true;for(i=4; i<=1000000; i+=2){b[i]=true;}for(i=3; i<=1001; i+=2){if(!b[i]){for(j=i*i; j<=1000001; j+=2*i){b[j]=true;}}}}
//power ll power(ll a,ll b){if(b==0) return 1LL;if(b&1) return a*power(a,b-1);else return power(a,b/2)*power(a,b/2);}
//bigmod long long int m(long long int a,long long int b,long long int c){if(b==0)return 1;if(b%2==0){long long int  tmp=m(a,b/2,c);return ((tmp%c)*(tmp%c))%c;}elsereturn ((a%c)*(m(a,b-1,c)%c))%c;}
//MaxSubarraySum ll mss(vector<ll>v){ll mx=v[0];ll sz=v.size();for(int i=1;i<=sz;i++){ll t=v[i]+v[i-1];if(t>=v[i]) v[i]=t;mx=max(mx,v[i]*1LL);}return mx;}
//combination ll com[1001][1001];void combination(){com[1][1]=1;com[1][0]=1;for(ll i=2; i<=1000; i++){com[i][0]=1;for(ll j=1; j<=i; j++){com[i][j]=com[i-1][j]+com[i-1][j-1];}}}
///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------

void solve()
{
   ll a,b,c,d;
   cin>>a>>b>>c>>d;
   vl v;
   v.pb(a*c);
   v.pb(a*d);
   v.pb(b*c);
   v.pb(b*d);
   srt(v)
   cout<<v[3]<<endl;
}
int main()
{
    rj
    solve();



    return 0;
}



Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 998244353;
ll t;
int main(){
	ll a,v,b,w,t;
	cin>>a>>v>>b>>w>>t;
	if(a==b) {
		puts("YES");
		exit(0);
	}
	if(v<=w){
		puts("NO");
		return 0;
	}
	double tt =(double)abs(b-a)/(v-w);
	if(tt<=t){
		puts("YES");
		return 0;
	}
	else puts("NO");
	return 0;
}




Measured memory_bytes: 3640
#include<iostream>

using namespace std;

int main()
{
    int h,m,s,t;
    cin >> t;
    s = t % 60;
    m = (t/60) % 60;
    h = t/60/60;
    
    cout << h << ":" << m << ":" << s << endl;
    
    return 0;
}


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

int main() {
    string s;
    cin >> s;
    int len = s.length();
    int sum = 0;
    for(int i = 1; i < len; i++) {
        if(s[i] != s[i-1]) {
            sum++;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 60) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

string s;

int main() {
	cin >> s;
	cout << s[0] << s.size() - 2 << s.back() << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace	std;
int main() {
  int n;
  cin >> n;
  long a[n];
  for (int i=0;	i <= n-1; i++)
    cin >> a[i];
  long min = a[0], max = a[0], sum = 0;
  for (int i=0;i <= n-1; i++) {
    if (min > a[i])
      min = a[i];
    if (max < a[i])
      max = a[i];
    sum	+= a[i];
  }
  cout << min << " " <<	max << " " << sum << endl;
  return 0;
}



Measured memory_bytes: 3144
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cnt = 0
beaten = min(a[0], b[0])
b[0] -= beaten
cnt += beaten
for i in range(1, len(b)):
    beaten = min(a[i], b[i-1])
    a[i] -= beaten
    cnt += beaten
    beaten = min(a[i], b[i])
    b[i] -= beaten
    cnt += beaten
beaten = min(a[len(a)-1], b[len(b)-1])
cnt += beaten

print(cnt)

Measured memory_bytes: 18752
L=input()
INF=10**9+7
N=len(L)
ans=0
c=0
for i in range(N):
    if L[i]=="0":
        continue
    ans+=pow(2,c,INF)*pow(3,N-1-i,INF)%INF
    c+=1
ans+=pow(2,c,INF)
print(ans%INF)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int N;
int M;
int p[110000];
int where[110000];
int Group[110000];
vector<int> R[110000];

void DFS(int num,int v) {
  Group[v] = num;
  if ((int)R[v].size() == 0) {
    return ;
  }
  for (int i = 0; i < (int)R[v].size(); i++) {
    if (Group[R[v][i]] == -1) {
      Group[R[v][i]] = num;
      DFS(num,R[v][i]);
    }
  }
  return ;
}
int main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    cin >> p[i];
    p[i]--;
    where[p[i]] = i;
  }
  int x[M],y[M];
  for (int i = 0; i < M; i++) {
    cin >> x[i] >> y[i];
    x[i]--; y[i]--;
    R[x[i]].push_back(y[i]);
    R[y[i]].push_back(x[i]);
  }
  for (int i = 0; i < N; i++) {
    Group[i] = -1;
  }
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (Group[i] == -1) {
      DFS(cnt,i);
      cnt++;
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (Group[where[i]] == Group[i]) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 14280
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
using namespace std;

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

    int ans = 1;

    for (int i = 0; i < n; i++)
    {
        if (a[i] % 2 == 0)
        {
            ans = ans * 2;
        }
    }

    cout << pow(3, n) - ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
#define ll long long 
#define pb push_back
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
constexpr long long  MOD=1000000007;
ll add(ll x, ll y) {ll res = x + y; return (res >= MOD ? res - MOD : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= MOD ? res % MOD : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + MOD : res);}
ll lcm(ll x, ll y) {ll res = (x * y) / __gcd(x, y); return res;}
ll power(ll x, ll y) {if (y < 0) return 1; ll res = 1; x %= MOD; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}

void iofoj(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
// bool visi[300004];
// vector<ll>v[300004];
// ll a[300004],b[300004],c[300004],d[300004];



void solution()
{
    ll q,n,m,i,j,k;
    cin>>n;
    ll a[100000]={0};
    for(i=1;i<=100;i++)
    {
        for(j=1;j<=100;j++)
        {
            for(k=1;k<=100;k++)
            {
                ll sum=i*i+j*j+k*k+i*j+j*k+k*i;
                if(sum<=n)
                a[sum]++;
                else
                {
                    break;
                }
                
            }
        }
    }
    for(i=1;i<=n;i++)
    cout<<a[i]<<"\n";
}

int main(){
    fio
    //iofoj();
    // ll t;
    // cin>>t;
    // while(t--)
    solution();
    return 0; 
}

Measured memory_bytes: 4436
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

import java.util.*;
import java.util.Collections; // sorting use
import java.io.*;
import static java.lang.System.*;

public class Main{
	public static void main(String[] args){
	  int tmp;
		ArrayList<Integer> clz = new ArrayList<Integer>(203);
		Scanner sc = new Scanner(System.in);
		clz.add(sc.nextInt());
      
		for (int i = 1; i <= 200; ++i){
		  tmp = clz.get(i - 1);
		  if(tmp % 2 == 0) clz.add(tmp / 2);
		  else clz.add(3 * tmp + 1);
		  
			if(clz.size() >= 4){
			  if(clz.get(i - 3) == clz.get(i)){
  				out.println(i + 1);
  				break;
			  }
			}
		}
	}
}


Measured memory_bytes: 23380
#include<stdio.h>


int main( void )
{
	int N ,t ;
	scanf( "%d %d" ,&N ,&t ) ;

	int x ,y ;
	double maxH = 0 ;
	
	int i ;
	for( i = 0 ; i < N ; ++i )
	{
		scanf( "%d %d" ,&x ,&y ) ;

		double high = (1.0 / (double)x) * (double)y ;
		if( high > maxH )
		{
			maxH = high ;
		}
	}

	printf( "%lf\n" ,maxH * t ) ;

	return 0 ;
}


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

int main() {
  int N, t, x, y;
  int a, b, c;
  bool result = true;
  cin >> N;
  
  vector<int> point;
  for (int i = 0; i < N; i++) {
      cin >> t >> x >> y;
      point.push_back(t);
      point.push_back(x);
      point.push_back(y);
  }

  int j = 0;
  for (int i = 0; i < N; i++) {
      a = i + j;
      b = i + j + 1;
      c = i + j + 2;
      if ((point[a] - (point[b] + point[c])) % 2 != 0 || point[a] < (point[b] + point[c])) {
          result = false;
          cout << "No" << endl;
          break;
      }
      j = j + 2;
  }

  if (result) {
      cout << "Yes" << endl;
  }
  
}

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

int main()
{
    int N;
    cin >> N;
    string S;
    long long count[5] = {};
    for (int i = 0; i < N; i++)
    {
        cin >> S;
        switch (S[0])
        {
        case 'M':
            count[0]++;
            break;
        case 'A':
            count[1]++;
            break;
        case 'R':
            count[2]++;
            break;
        case 'C':
            count[3]++;
            break;
        case 'H':
            count[4]++;
            break;
        default:
            break;
        }
    }
    long long ans = 0;
    for (int i = 0; i < 5; i++)
    {
        for (int j = i + 1; j < 5; j++)
        {
            for (int k = j + 1; k < 5; k++)
            {
                ans += count[i] * count[j] * count[k];
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n,l = map(int,input().split())
taste = [l+i-1 for i in range(1,n+1)]
ideal = sum(taste)
bited = [ideal-taste[i] for i in range(n)]
dif = [abs(ideal-bited[i]) for i in range(n)]
print(bited[dif.index(min(dif))]) 


Measured memory_bytes: 38384
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

int main(){
  int n;
  cin>>n;
  
  vector<int> A(n);
  rep(i,n) cin>>A[i];
  sort(ALL(A),greater<int>());
  
  int sum1=0,sum2=0;
  for(int i=0;i<n;i+=2) sum1+=A[i];
  for(int i=1;i<n;i+=2) sum2+=A[i];
  
  cout<<sum1-sum2<<endl;
  
  return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  int check = 1;
  cin >> S;
  int N = S.size();
  for (int i = 0; i < (N - 1)/2; i++) {
    if (S.at(i) != S.at(N - i - 1)) {
      check = 0;
      break;
    }
    if (S.at(i) != S.at((N - 1)/2 - 1 - i)) {
        check = 0;
        break;
    }
    if (S.at((N + 3)/2 - 1 + i) != S.at(N - i - 1)) {
      check = 0;
      break;
    }
  }
  if (check == 1) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <vector>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>

using namespace std;

int isKaibun(string s){
    int len = s.length();
    int half = len / 2;

    for(int i = 0; i < half; ++i){
        if(s[i] != s[len - 1 - i]){
            return false;
        }
    }

    return true;
}


int main(int argc, char* argv[]){
    string s;
    cin >> s;

    if(!isKaibun(s)){
        cout << "No" << endl;
    }
    else{
        int len = s.length();
        string sub_s = s.substr(0, (len-1)/2);
        if(!isKaibun(sub_s)){
            cout << "No" << endl;
        }
        else{
            sub_s = s.substr((len+3)/2 - 1);
            if(isKaibun(sub_s)){
                cout << "Yes" << endl;
            }
            else{
                cout << "No" << endl;
            }
        }
    }

}


Measured memory_bytes: 256
//高知能系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 INT_MAX
#define LLINF LLONG_MAX
#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 

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
    for (T& x: vec) { is >> x; }
    return is;
}

int main() {
	ll ans = 0;
	ll tmp;
	//int n; cin >> n;
	string s; cin >> s;
	int n = s.size();
	s = "0" + s;
	bool ch = true;
	REP1(i, n-1) if(s[i] != s[n-i]) ch = false;
	if(s[n] == '1') ch = false;
	if(s[1] == '0') ch = false;
	if(ch){
		queue<int> q;
		REP1(i, n/2) if(s[i] == '1') q.push(i);
		int ed = 1, now = 0, root = 1, prev = 0;
		while(!q.empty()){
			now = q.front();
			q.pop();
			REP(i, now - prev){
				cout << root << " " << ed + 1 << endl;
				ed++;
			}
			root = ed;
			prev = now;
		}
		while (ed < n)
		{
			cout << root << " " << ed + 1 << endl;
			ed++;
		}
		
	}
	else cout << -1 << endl;
}

Measured memory_bytes: 3932
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	int n = int.Parse(ReadLine());
	int[] a = ReadIntArray();

	long[] s = new long[n];
	s[0] = a[0];
	for (int i = 1; i < n; i++)
	{
	    s[i] = s[i-1] + a[i];
	}
		 
	// ty1: +-+-..., ty2: -+-+...
	long n1 = 0, n2 = 0;
	long offset1 = 0, offset2 = 0;

	for (int i = 0; i < n; i++)
	{
	    long gap1 = 0, gap2 = 0;
	    if ((i&1) == 0)
	    {
		if (s[i] + offset1 <= 0)
		{
		    gap1 =  1 - (s[i] + offset1);
		}

		if (s[i] + offset2 >= 0)
		{
		    gap2 = -1 - (s[i] + offset2);
		}
	    }
	    else
	    {
		if (s[i] + offset1 >= 0)
		{
		    gap1 =  -1 - (s[i] + offset1);
		}

		if (s[i] + offset2 <= 0)
		{
		    gap2 = 1 - (s[i] + offset2);
		}
	    }
	    n1 += Math.Abs(gap1);
	    offset1 += gap1;
	    n2 += Math.Abs(gap2);
	    offset2 += gap2;
	}
	WriteLine(Math.Min(n1, n2));
    }
}


Measured memory_bytes: 28764
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

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

void Main() {
	ll N; cin >> N;

	int MAX = 10000000;
	vl prepare(MAX);
	REP(i,MAX) {
		prepare[i] = (ll)i * (ll)(i + 1) / (ll)2;
	}

	auto pf = prime_factor(N);
	ll res = 0;
    for (auto p : pf) {
		auto lb = lower_bound(ALL(prepare), p.second);
		ll diff = lb - prepare.begin();
		ll num = *lb;
		if (num > p.second) --diff;
		// debug(diff);
		res += diff;
    }
	cout << res << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 81344