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

using namespace std;

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

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

const ll maxn  = 3e6;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

int x;

int main(){
    migmig
    cin >> x;
    cout << 1000*(x/500) + 5*((x%500)/5);




    return(0);
}

//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.
//kuxtal jach uts chuchul u u páajtal máak jach táaj meyajilo'ob le castigadas tumen ch'aik descansos.


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

#include <functional>
template<typename T>
class SegmentTreeOneAll {
    using Func = function<T(T, T)>;

public:
    vector<T> data;
    int n;
    T init;
    Func update_func;
    Func query_func;
    SegmentTreeOneAll(int _n, T _init, Func up, Func qu) {
        init = _init;
        update_func = up;
        query_func = qu;
        for (n = 1; n < _n; n *= 2)
            ;
        data.resize(2 * n - 1, init);
    }
    void update(int pos, T val) {
        pos += n - 1;
        data[pos] = update_func(data[pos], val);
        while (pos > 0) {
            pos = (pos - 1) / 2;
            data[pos] = query_func(data[2 * pos + 1], data[2 * pos + 2]);
        }
    }
    T query(int l, int r) {
        T resL = init, resR = init;
        for (l += n - 1, r += n - 1; l < r; l = l / 2, r = (r - 1) / 2) {
            if (!(l & 1)) {
                resL = query_func(resL, data[l]);
            }
            if (!(r & 1)) {
                resR = query_func(data[r - 1], resR);
            }
        }
        return query_func(resL, resR);
    }
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    auto SUM = [](ll a, ll b) { return a + b; };
    SegmentTreeOneAll<ll> segtree(n, 0, SUM, SUM);
    REP(i, 0, q) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com) {
            cout << segtree.query(x - 1, y) << endl;
        } else {
            segtree.update(x - 1, y);
        }
    }
    return 0;
}



Measured memory_bytes: 4956
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() { int A, B;
  cin >> A >> B;
  A += B;
  while(A>23){
    A -= 24;
  }
  cout << A << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n = 0,i = 1,x = 0;

  scanf("%d",&n);

  for(i = 1;i <= n;i++){
    if ( i % 3 == 0 ){
      printf(" %d",i);
    }else {
      for (x = i;x;x/= 10){
        if(x % 10 == 3){
          printf(" %d",i);
          break;
        }
      }
    }
  }
  putchar('\n');
  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main() {
	long long a, b, c; cin >> a >> b >> c;
	if (b >= c - 1) {
		cout << b + c << endl;
		return 0;
	}
	else {
        long long original_c=c;
		c -= b;
		if (a >= c - 1) {
			cout << b + original_c<< endl;
			return 0;
		}
		else {
			cout << b + a + 1+b << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mkp make_pair
#define f(i,l,h) for(ll i=l;i<h;i++)
#define fr(i,h,l) for(ll i=h;i>=l;i--)
#define PI 3.141592653589793
using namespace std;

typedef pair<ll,ll> pll;
const ll INF=(ll)(1e9+7);
typedef vector<ll> vll;

int main()
{
    //cout << "Hello world!" << endl;
    ll n,m;
    cin>>n>>m;
    vll adj[n+1];
    ll a,b;
    for(ll i=0;i<m;i++){
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }

    ll par[n+1];
    memset(par,-1,sizeof(par));

    queue<ll>q;
    q.push(1);

    while(!q.empty()){
        ll tp=q.front();
        q.pop();
        for(auto u:adj[tp]){
            if(par[u]==-1){
                par[u]=tp;
                q.push(u);
            }
        }
    }

    bool flag=true;
    for(ll i=2;i<=n;i++){
        if(par[i]==-1){
            flag=false;
            break;
        }
    }
    if(!flag){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    for(ll i=2;i<=n;i++){
        cout<<par[i]<<endl;
    }


}


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

using namespace std;

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

ll C[51][51];

void comb_table(int n) {
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            if (j == 0 || j == i) {
                C[i][j] = 1LL;
            } else {
                C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]);
            }
        }
    }
}



int main() {
    int n, a, b;
    cin >> n >> a >> b;
    ll v[n];
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    
    comb_table(n);
    sort(v, v + n);
    reverse(v, v + n);
    double max_average = 0.0;
    for (int i = 0; i < a; i++) {
     max_average += v[i];
    }
    
    max_average /= a;
    
    int a_th_val_num = 0;
    int a_th_val_pos = 0;
    for (int i = 0; i < n; i++) {
        if (v[i] == v[a - 1]) {
            a_th_val_num++;
            if (i < a) {
                a_th_val_pos++;
            }
        }
    }
    
    ll cnt = 0LL;
    if (a_th_val_pos == a) {
        for (a_th_val_pos = a; a_th_val_pos <= b; a_th_val_pos++) {
            cnt += C[a_th_val_num][a_th_val_pos];
        }
    } else {
         cnt += C[a_th_val_num][a_th_val_pos];
    }
    
    cout.precision(20);
    cout << fixed << max_average << endl;
    cout << cnt << endl;
    return 0;
}

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

int main(){
    ll n, k; cin >> n >> k;
    ll ans_1 = n % k, ans_2 = abs(n % k - k);
    cout << min(ans_1, ans_2) << endl;
    return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long 
#define INF (ll)1e18 + 50
#define MAXN (int)2e5 + 50
#define fi first
#define se second
#define MOD 1000000007
#define all(v)((v).begin()), ((v).end())
#define A 911382323
#define B 972663749

map<char, int> vals;
map<char, char> jogs;

int32_t main() {
    
    jogs['r'] = 'p';
    jogs['s'] = 'r';
    jogs['p'] = 's';
    
    
    int n, k, a, b, c, ans = 0; cin >> n >> k;
    cin >>  a >> b >> c;
    vals['r'] = a, vals['s'] = b, vals['p'] = c;
	    
    string s, resp = ""; cin >> s;
	for(int i = 0; i < n; i++)
	{
		if(i < k) ans += vals[jogs[s[i]]];
		else if(s[i] != s[i-k] ) ans += vals[jogs[s[i]]];
		else s[i] = '0';
	}

	cout << ans << '\n';
    
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<cmath>
using namespace std;
typedef unsigned long long ll;
ll mod = (10e+8)+ 7;


int main(){
	int K,X;
	cin>>K>>X;
	for(int i = (X - K)+1; i < (X - K)+K*2; i++){
		cout<<i<<" ";
	}
	cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

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

    double ans = 0;
    rep(i,n)rep(j,i)
    {
        double p = 0, q = a[i]-a[j];
        int ct = 0;
        for(int k=n-1; k>=0; --k)
        {
            if(ct==2) break;

            if(k!=i && k!=j)
            {
                ++ct;
                p+=a[k];
            }
        }

        ans = max(ans,p/q);
    }

    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 3244
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int n = sc.nextInt();
		String ans = "ABC";

		if (n >= 1000) {
			ans = "ABD";
		}
		System.out.println(ans);

		sc.close();
	}
}


Measured memory_bytes: 21716
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int digits(int N){
        if(N<10){
                return N;
        }

        return N%10+digits(N/10);

        }

int main()
{
        //input->compute->output//
        int N;
        cin>>N;

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


        

        return 0;
}


Measured memory_bytes: 256
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

if N==1:
  if K%2:
    print(A[0])
  else:
    print('')
  exit()
  

#print(*range(10000))

def func(L):
  s = []
  for l in L:
    if l in s:
      del s[s.index(l):]
      #s_set.remove(l)
    else:
      s.append(l)
      #s_set.add(l)
  return s




index_dict={}
for i,a in enumerate(A):
  index_dict.setdefault(a,[]).append(i)

next_i = [0]*N
cycle_i = [0]*N
for k,v in index_dict.items():
  for i in range(len(v)):
    next_i[v[i]] = (v[(i+1)%len(v)]+1)%N
    cycle_i[v[i]] = (i+1)//len(v)
#print(next_i)
#print(cycle_i)

from_in_cycle=[]

i = 0
while True:
  j = next_i[i]
  if cycle_i[i]:
    from_in_cycle.append(i)
  i = j
  # 循環の評価
  if i==0:
    break
    
#print(from_in_cycle)

if from_in_cycle:
  k = K%(len(from_in_cycle)+1)
  #print(*func(A[from_in_cycle[k-1]:]))

  ans = []
  i = from_in_cycle[k-1]
  while i < N:
    if cycle_i[i]:
      ans.append(A[i])
      i += 1
    else:
      if next_i[i]==0:
        break
      i = next_i[i]
  print(*ans)


else:
  print('')

Measured memory_bytes: 68816
def main():
    N, M = map(int, input().split())

    A = list(set(map(int, input().split(" "))))
    G = A.copy()

    while not any(x % 2 for x in G):
        G = [i // 2 for i in G]

    if not all(x % 2 for x in G):
        print(0)
        exit(0)

    def gcd(a, b):
        while b:
            a, b = b, a % b
        return a

    def lcm(a, b):
        return a * b // gcd(a, b)

    total = 1

    for x in A:
        total = lcm(total, x // 2)

    print((M // total + 1) // 2)


if __name__ == '__main__':
    main()


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

int main() {
  int a,b,c,sum;
  cin>>a;
  vector<char> vec(a);
  
  for(int i=0;i<a;i++){
  	cin>>vec.at(i);
  }
 c=1;
  for(int i=0;i<a-1;i++){
   if(vec.at(i)!=vec.at(i+1))
     c++;
  }
  
  
  
  cout<<c<<endl;
  
  return 0;
}

Measured memory_bytes: 384
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: i32 = input();

    let mut ans = 0;
    for i in 1..n + 1 {
        let mut cnt = 0;
        let mut temp = i;
        while temp > 0 {
            cnt += 1;
            temp /= 10;
        }
        if cnt % 2 == 1 {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define deque vector
void Oli(){
    string a;
    cin>>a;
    int s =0;
    for(int i=0;i<a.size();i++){
        s+=(char)a[i] - 48;
    }
    if (s%9 == 0){
        cout<<"Yes"<<endl;
    }else {
    cout<<"No";}
}
int main(){
int times = 1;
//cin>>times;
while(times--)
Oli();
}


Measured memory_bytes: 3752
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt(),c=sc.nextInt();
		int x=sc.nextInt();//,k=sc.nextInt();
		long sum=0,count=0,flag=0,max=-999999,min=99999;
		long[] array=new long[a];
		//String s=sc.next();//,t=sc.next();
		String buff;
		//String[] arrays = new String[a];
		for(int i=0;i<=a;i++) {
			for(int j=0;j<=b;j++) {
				for(int k=0;k<=c;k++) {
					sum=i*500+j*100+50*k;
					if(sum==x)count++;
				}
			}
		}

		System.out.println(count);

	}
	public static int sample(int n) {
		return n;
	}

}


Measured memory_bytes: 23892
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-8;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SS stringstream
#define DBG1(a) rep(_X,sz(a)){printf("%d ",a[_X]);}puts("");
#define DBG2(a) rep(_X,sz(a)){rep(_Y,sz(a[_X]))printf("%d ",a[_X][_Y]);puts("");}
#define bitcount(b) __builtin_popcount(b)
#define REP(i, s, e) for ( int i = s; i <= e; i++ )  

const double INF = 1e12;
typedef complex<double> P,point;
typedef vector<P> G,polygon;
namespace std {bool operator < (const P& a, const P& b) {return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);}}
double cross(const P& a, const P& b) {return imag(conj(a)*b);}
double dot(const P& a, const P& b) {return real(conj(a)*b);}
struct L : public vector<P> {L(const P &a, const P &b) {push_back(a); push_back(b);}};
int ccw(P a, P b, P c) {b -= a; c -= a;if (cross(b, c) > 0)   return +1;if (cross(b, c) < 0)   return -1;if (dot(b, c) < 0) return +2;if (norm(b) < norm(c)) return -2;return 0;}

// Check Funcs //
bool intersectSS(const L &s, const L &t) {return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 && ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;}

// Where is Point in Polygon? //
#define curr(P, i) P[i]
#define next(P, i) P[(i+1)%P.size()]
enum { OUT, ON, IN };
int contains(const polygon& P, const point& p) {bool in = false;for (int i = 0; i < P.size(); ++i) {point a = curr(P,i) - p, b = next(P,i) - p;if (imag(a) > imag(b)) swap(a, b);if (imag(a) <= 0 && 0 < imag(b))if (cross(a, b) < 0) in = !in;if (cross(a, b) == 0 && dot(a, b) <= 0) return ON;}return in ? IN : OUT;}

/* graph check*/
int n,m;
int done[100];
bool info[100][100];

void dfs(int s){
	if(done[s])return;
	else done[s] = true;
	rep(i,m){
		if(info[s][i])dfs(i);
	}
}

int main(){
	while(cin >> n,n){
		rep(z,n){
			rep(i,100)rep(j,100)info[i][j]=false;
			cin >> m;
			vector<G> g(m); 
			rep(i,m){
				rep(j,4){
					double x,y;
					cin >> x >> y;
					g[i].push_back(P(x,y));
				}
			}
			/* cross check */
			rep(i,m){
				rep(j,m){
					rep(X,4)rep(Y,4){
						if( intersectSS(
							 L(g[i][X],g[i][(X+1)%4]),
							 L(g[j][Y],g[j][(Y+1)%4])
						    )
						){
							info[i][j] = info[j][i] = true;
						}
					}
				}
			}
			/* contain check */
			rep(i,m){
				rep(j,m){
					rep(k,4){
						if(contains(g[i],g[j][k]))
							info[i][j] = info[j][i] = true;	
					}
				}
			}
			rep(i,m)done[i] = false;
			int cnt = 0;
			rep(i,m)if(!done[i])cnt++,dfs(i);
			cout << cnt << endl;
		}
	}
}

Measured memory_bytes: 1000
def bubble_sort(A):
    count = 0
    for i in reversed(range(len(A))):
        for j in range(i):
            if A[j] > A[j+1]:
                temp = A[j]
                A[j] = A[j+1]
                A[j+1] = temp
                count += 1
    return count

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

count = bubble_sort(A)
print(" ".join(map(str,A)))
print(count)

Measured memory_bytes: 7696
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

n = int(input())

for i in range(1, 10):
    for j in range(1, 10):
        if i*j == n:
            print('Yes')
            sys.exit()
print('No')

Measured memory_bytes: 5332
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <climits>
#include <math.h>
 
using namespace std;
typedef unsigned long ul;
typedef pair<long, int> P;

void dj(long *dist, int s, int n, vector<P> *g) {
	bool used[100001];
	for(int i=1;i<=n;i++){
		dist[i]=9223372036854775807;
		used[i]=false;
	}
	priority_queue<P, vector<P>, greater<P> > q;
	q.push(P(0, s));
	while(!q.empty()){
		P tmp = q.top();q.pop();
		int i = tmp.second;
		if(used[i])continue;
		used[i]=true;
		dist[i]=tmp.first;
		for(P e:g[i]){
			long d=tmp.first+e.first;
			if(dist[e.second]<=d)continue;
			q.push(P(d,e.second));
		}
	}
}

int main() {
	int n,m,s,t;
	vector<P> yen[100001],snuke[100001];
	cin>>n>>m>>s>>t;
	for(int i=0;i<m;i++){
		int u,v,a,b;
		cin>>u>>v>>a>>b;
		yen[u].push_back(P(a,v));
		yen[v].push_back(P(a,u));
		snuke[u].push_back(P(b,v));
		snuke[v].push_back(P(b,u));
	}

	long dist1[100001];
	dj(dist1, s, n, yen);

	long dist2[100001];
	dj(dist2, t, n, snuke);

	for(int i=1;i<=n;i++)dist1[i]+=dist2[i];
	for(int i=n-1;i>=0;i--)dist1[i]=min(dist1[i],dist1[i+1]);
	for(int i=1;i<=n;i++){
		cout<<1000000000000000-dist1[i]<<endl;
	}
}

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

int main(){
    int n;
    cin >> n;
    int answer=0;
    cout << n * n * n << endl;
}

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


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

    string s;
    cin>>s;
    int cnt=0;
    string p="",b="";
    int q;
    cin>>q;
    while(q--){
        int t;
        cin>>t;
        if(t==1){
            cnt++;
        }
        else{
            int f;
            char c;
            cin>>f>>c;
            if(f==1){
                if(cnt%2==0) p += c;
                else b+=c;
            }
            else{
                if(cnt%2)p+=c;
                else b+=c;
            }
        }
    }
    reverse(p.begin(),p.end());
    s = p+s+b;
    if(cnt%2){
        reverse(s.begin(),s.end());
    }
    cout << s << endl;
   
}

Measured memory_bytes: 1200
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, m;
string str;

int main(){
	cin >> n;
	cout << n*n*n << endl;
	
	
	
	return 0;
}

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

#define endl "\n"

typedef long long ll;
typedef pair <ll, ll> pii;
typedef long double ld;

const ll D = 100007;
const ll Inf = 1000000007;
ll n,m,k;
ll a,b,c;
ll v[D];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n;
    for(ll i=1;i<=n;i++)
    {
        cin>>v[i];
    }
    ll ans=0;
    for(ll i=1;i<=n;i++)
    {cin>>a;
    ans+=max(ll(0),v[i]-a);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
s = gets.chomp.split("")
q = gets.to_i
arr = Array.new
while line = $stdin.gets
arr << line.chomp.split(" ")
end
t = 0
arr.each{|item|
    if item[0] == "1"
        t +=1
    else
        if (item[1].to_i + t )%2 == 1 then
            s.unshift(item[2])
        else
            s.push(item[2])
        end
    end
}
if t%2==1 then
    s.reverse!
end
s.each{|f|
    print f
}

Measured memory_bytes: 65532
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int MAX_N = 100;

int main()
{
    long int N;
    vector<string> data;
    string tmp;

    cin >> N;

    for (long int i = 0; i < N; i++)
    {
        cin >> tmp;
        data.push_back(tmp);
    }
    sort(data.begin(), data.end());

    long int counter=1;

    for (long int i = 0; i < N-1; i++)
    {
        if (data[i] != data[i+1])
        {
            counter++;
        }
    }
    cout << counter << endl;

    return 0;
}

// cout << "Yes" << endl;
// cout << "No" << endl;
// long double pi = 3.14159265358979323;

Measured memory_bytes: 11572
using System;
using System.Linq;
using static System.Math;
using System.Collections.Generic;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var A = ab[0];
            var B = ab[1];


            var gcdAB = GCD(A, B);

            int count = 1;
            var sqrt = (int)Ceiling(Sqrt(gcdAB));

            for (long i=2;i <= sqrt;i++)
            {
                if (gcdAB % i == 0)
                {
                    count++;
                    while (gcdAB % i == 0)
                    {
                        gcdAB /= i;
                    }
                }
            }

            if(gcdAB != 1) count++;

            Console.WriteLine(count);
        }

        static bool isPrime(long x)
        {
            if (x < 2) return false;
            else if (x == 2) return true;
            else if (x % 2 == 0) return false;

            double sqrtX = Math.Sqrt(x);

            for (int i = 3; i < sqrtX; i += 2)
            {
                if (x % i == 0)
                {
                    return false;
                }
            }
            return true;
        }


        static long LCM(long m, long n)
        {
            return m / GCD(m, n) * n;
        }

        static long GCD(long m, long n)
        {
            while (true)
            {
                if (n == 0) return m;
                m %= n;
                if (m == 0) return n;
                n %= m;
            }
        }
    }

}





Measured memory_bytes: 13396
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(10)
#define highest(x) (63 - __builtin_clzl(x))

int main(){
    long N;
    cin >> N;
    string ans;
    for(int i = 0; N; i++){
        if((abs(N) >> i) & 1){
            if(i % 2){
                N += power(2, i, 1e18);
            }else{
                N -= power(2, i, 1e18);
            }
            ans.insert(ans.begin(), '1');
        }else{
            ans.insert(ans.begin(), '0');
        }
    }
    if(ans == ""){
        cout << "0" << endl;
    }else{
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
#define vi vector<int>
#define vl vector<long long>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define vp vector<P>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORD(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define INF 1e18
#define INFTY 1e9
const int mod = 1000000007;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

template<class T> bool chmax(T &a, const T & b) {
    if (a<b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> bool chmin(T &a, const T & b) {
    if (a>b) {
        a = b;
        return true;
    }
    return false;
}

//cout << fixed << setprecision(10) << y << endl;
struct edge {int to, cost;};
vector< vector<edge> > es;

int gcd(int a, int b) {
    int r = a % b;
    if (r == 0) return b;
    return gcd(b, r);
}

ll lcm(ll a, ll b) {
    return a/gcd(a, b)*b;
}

int main() {
    int n, k;
    cin >> n >> k;
    vi p(n);
    REP(i, n) {
        cin >> p[i];
    }
    sort(p.begin(), p.end());
    int res = 0;
    REP(i, k) res += p[i];
    cout << res << endl;
    return 0;
}

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

using namespace std;

int main(){
	int n, d;
	static int size[100];
	static int pot[100][10001];
	pair<int,int> sum[100];
	while(cin >> n >> d, n){
		int lest = 0;
		for(int i=0;i<n;i++){
			cin >> size[i];
			lest += size[i];
			int cur = 0; pot[i][0] = 0;
			for(int j=1;j<=size[i];j++){
				int add; cin >> add;
				cur += add;
				pot[i][j] = cur;
			}
		}
		bool flag = true;
		while(flag){
			for(int i=0;i<n;i++){
				sum[i] = make_pair(pot[i][size[i]], i);
			}
			sort(sum, sum+n);
			int i;
			for(i=0;i<n;i++){
				if(size[i] == 0) continue;
				if(sum[n-1].second == i){
					int idx = sum[n-2].second;
					if(abs(pot[idx][size[idx]]-pot[i][size[i]-1]) > d) continue;
					else {
						size[i]--; lest--;
						flag = lest!=0;
						break;
					}
				} else {
					int idx = sum[n-1].second;
					if(abs(pot[idx][size[idx]]-pot[i][size[i]-1]) > d) continue;
					else {
						size[i]--; lest--;
						flag = lest!=0;
						break;
					}
				}
			}
			if(i==n) flag = false;
		}
		cout << (lest==0?"Yes":"No") << endl;
	}
}

Measured memory_bytes: 1344
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll INF = 9223372036854775807;
const ll MOD = 1000000007;
const long double PI = acos(-1);
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define o0(a) cout<<a<<" "
#define o1(a) cout<<a<<"\n"
#define o2(a, b) cout<<a<<" "<<b<<"\n"
#define o3(a, b, c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define o4(a, b, c, d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n"
#define i1(a) cin>>a
#define i2(a, b) cin>>a>>b
#define i3(a, b, c) cin>>a>>b>>c
#define i4(a, b, c, d) cin>>a>>b>>c>>d
#define fi first
#define se second

ll power(ll a, ll b, ll z = MOD)
{
	ll res = 1;
	a = (a%z);
	while(b)
	{
		if(b&1)
			res = (res*a)%z;
		a = (a*a)%z;
		b = b>>1;
	}
	return res;
}

ll inverse(ll a, ll z = MOD)
{
	return power(a, z-2, z);
}

ll extend(ll a, ll b, ll &x, ll &y)
{
	if(b == 0)
	{
		x = 1;
		y = 0;
		return a;
	}
	ll x1, y1;
	ll g = extend(b, a%b, x1, y1);
	x = y1;
	y = x1- (a/b)*y1;
	return g;
}

ll mat_power(ll a, ll b, ll c, ll d, ll n, ll z = MOD)
{
	ll a0 = 1, b0 = 0, c0 = 0, d0 = 1;
	while(n)
	{
		if(n&1)
		{
			ll a1 = a0, b1 = b0, c1 = c0, d1 = d0;
			a0 = (a1*a + b1*c)%z;
			b0 = (a1*b + b1*d)%z;
			c0 = (c1*a + d1*c)%z;
			d0 = (c1*b + d1*d)%z;
		}
		ll a1 = a, b1 = b, c1 = c, d1 = d;
		a = (a1*a1 + b1*c1)%z;
		b = (a1*b1 + b1*d1)%z;
		c = (c1*a1 + d1*c1)%z;
		d = (c1*b1 + d1*d1)%z;
		n = n>>1;
	}
	return c0;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int x;
	i1(x);
	if(x >= 30)
		o1("Yes");
	else
		o1("No");
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<limits>

int main(){
    int N;
    int minus_cnt = 0;
    unsigned long long int res = 0;
    unsigned long long int min = std::numeric_limits<unsigned long long int>::max();
    //std::vector<long long int> A;

    std::cin >> N;
    for(int i=0; i<N; i++){
        long long int _A;
        std::cin >> _A;
        if(_A < 0){
            minus_cnt++;
            res += -_A;
            if(min > -_A) min = -_A;
        }else{
            res += _A;
            if(min > _A) min = _A;
        }
        //A.emplace_back(_A);
    }

    if(minus_cnt%2 == 0){
        std::cout << res << std::endl;
    }else{
        std::cout << res-min*2 << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
//D
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5+10;
int raw[maxn];
int vis[maxn];
int main(){
	ll n,k,k1;
	cin >> n >> k;
	k1 = k;
	for(int i = 1;i <= n;i++)cin >> raw[i];
	vector<int>q;
	int d = 1;
	int cnt = 0,fk = 0;
	while(vis[d] != 2){
		if(vis[d] == 1){
			if(!fk)k -= cnt;
			fk = 1;
			q.push_back(d);
			vis[d] = 2;
		}
		else vis[d] = 1;
		cnt++;
		d = raw[d];
	}
	if(k >= 0){
			k %= q.size();
			cout << q[k];
	}
	else{
		k = k1;
		d = 1;
		while(k--){
			d = raw[d];
		}
		cout << d;
	}
	return 0;
}


Measured memory_bytes: 5776
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)

struct UnionFind {
    int data[40000];
    UnionFind() {
        memset(data, -1, sizeof(data));
    }
    void unite(int x, int y) {
        x = root(x); y = root(y);
        if(x != y){
            data[x] += data[y];
            data[y] = x;
        }
    }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]);}
    bool same(int a, int b) { return root(a) == root(b);}
};

int can_unite[2][100000];
int slime[40000][2];
int main() {
    int N, W, H;
    scanf("%d%d%d", &N, &W, &H);
    int x_, y_;
    bool edge = false;
    rep(i, N){
        scanf("%d%d", &x_, &y_); --x_; --y_;
        slime[i][0] = x_; slime[i][1] = y_;
        if(x_ == 0 || x_ == W - 1 || y_ == 0 || y_ == H - 1)
          edge = true;
    }
    
    memset(can_unite, -1, sizeof(can_unite));
    UnionFind uf;
    int ans = 0;
    rep(i, N) rep(j, 2) {
        int& a = can_unite[j][slime[i][j]];
        if(a == -1) a = i;
        else if(!uf.same(a, i)) {
            uf.unite(a, i);
            ans++;
        }
    }
    
    bitset<40000> roots(0);
    rep(i, N) roots[uf.root(i)] = 1;
    int temp = roots.count();
    if(temp == 1) printf("%d\n", ans);
    else {
        ans += temp * 2 - 1;
        if(edge) --ans;
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 2452
while true
  x, y, s = gets.chomp.split(" ").map(&:to_i)
  break if x == 0 && y == 0 && s == 0
  ret = 0
  (1...s).each do |i|
    (i...s).each do |j|
      i0 = i * (100 + x) / 100
      j0 = j * (100 + x) / 100
      if i0 + j0 == s then
        i1 = i * (100 + y) / 100 
        j1 = j * (100 + y) / 100
        ret = [ret, i1 + j1].max()
      end
    end
  end
  puts ret
end

Measured memory_bytes: 8788
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    REP(i,n) cin>>a[i];
    if(n==1){
        cout<<0;
        return 0;
    }
    sort(a.begin(),a.end());
    vector<int> b;
    int c=1;
    int d=0;
    REP(i,n-1){
        if(a[i]!=a[i+1]){
        b.push_back(c);
        c=1;
        }else{
       c++;}
    }
    b.push_back(c);
    sort(b.begin(),b.end());
    for(int i=0;i<b.size()+2;i++){
       if(b.size()-i<=k){
           cout<<d;
           return 0;
       }else{
           d+=b[i];
       }
    }
    return 0;
}


Measured memory_bytes: 2168
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%MOD;
        }
        x = (x*x)%MOD;
        n >>= 1;
    }
    return ret;
}

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

    vector<pair<ll,ll>> a;
    set<pair<ll,ll>> st;
    for(int i = 0; i < n; i++){
        ll x,y;
        cin >> x >> y;
        a.push_back(make_pair(x,y));
        st.insert(a.back());
    }

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

    ll ans = INF;

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i == j)continue;
            ll c = 0;
            for(int k = 0; k < n; k++){
                if(st.find(make_pair(a[k].first + a[i].first - a[j].first,a[k].second + a[i].second - a[j].second)) == st.end()){
                    c++;
                }
            }
            ans = min(c,ans);
        }
    }

    if(n == 1){
        cout << 1 << endl;
        return 0;
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
  long long n, m;
  cin >> n >> m;
  long long sum = n * 2 + m;

  long long ans;
  if(sum / 2 > m)
    ans = m / 2;
  else
    ans = sum / 4;

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
typedef long long int lli;
using namespace std;

lli gcd(lli,lli);

int main(void){
  lli A,B;
  cin >> A >> B;
  lli mdiv = gcd(A,B);
  vector<lli> v;
  v.push_back(1);
  int max = (int)sqrt((double)mdiv);
  lli mdivtmp = mdiv;
  //cout << mdiv << endl;
  int i;
  for(int i=2;i<=max+1;i++){
    //cout << max << i << endl;
    while(mdiv%i == 0){
      mdiv = mdiv/i;
      //cout << i << endl;
      if(i != v[v.size()-1]){
	//cout << i << endl;
	v.push_back(i);
      }
    }
  }
  if(mdiv != 1){
    v.push_back(mdivtmp);
  }
  cout << v.size() << endl;
  return 0;
 
}

lli gcd(lli a,lli b){
  lli r;
  if(b > a)
    swap(a,b);
  while ((r=a%b)) {
      a = b;
      b = r;
  }
  return b;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    c = collections.Counter(S().split())

    if len(c) == 3:
        return 'Three'
    return 'Four'


print(main())




Measured memory_bytes: 8132
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

// #define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

int h,w,k;
vector<vector<int>> black(10,vector<int>(10));

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(15); // 浮動小数の表示の精度

    cin>>h>>w>>k;
    rep(i,h) {
        rep(j,w) {
            char c; cin>>c;
            if (c == '#') { black[i][j] = 1; }
        }
    }

    int res = 0;
    rep(S, 1<<h) {
        rep(T, 1<<w) {
            int cnt = 0;
            rep(i, h) {
                rep(j, w) {
                    if (!((S >> i) & 1) && !((T >> j) & 1)) {
                        cnt += black[i][j];
                    }
                }
            }
            if (cnt == k) { res++; }
        }
    }
    cout << res << '\n';

    return 0;
}


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

using _i64 = int64_t;
using _u64 = uint64_t;
using _f64 = double;

#define _for(i, start, end) for(_i64 i = (_i64)start; i < (_i64)end; ++i)
#define _rep(i, number) _for(i, 0, number)
#define _foreach(e, data) for(auto& e : data)
#define _all(data) data.begin(), data.end()

template<typename type>
_i64 _size(const type& data) { return static_cast<_i64>(data.size()); }
template<typename type, size_t size>
_i64 _size(const type (&)[size]) { return static_cast<_i64>(size); }

enum _flag : bool { able = true, disable = false };

struct _time {
    _time(_flag flag) { check = flag; if(!check) { return; } gettime(start); }
    ~_time() {
        if(!check) { return; }; gettime(end);
        _i64 elapse = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cout << endl << "Time: " << elapse << " ms" << endl;
    }
    private:
    using _timer = chrono::time_point<chrono::system_clock>;
    _timer start, end; bool check;
    void gettime(_timer& time) { time = chrono::system_clock::now(); }
};

struct _ini { _ini() { ios::sync_with_stdio(false); cin.tie(nullptr); } } _ini;

int main() {
    {
        _time time(disable);
        _i64 a, b, c; _i64 count = 0; cin >> a >> b >> c;
        _for(i, a, b + 1) { if( c % i == 0 ) { count++; } }
        cout << count << endl;
    }
    return 0;
}


Measured memory_bytes: 3216
N, X, Y = gets.split(" ").map(&:to_i)

dp = (N + 2).times.map { [0] * (N + 2) }
# dp[X][Y] = 1

(1..(N - 1)).each do |x|
  ((x + 1)..N).each do |y|
    dp[x][y] = y - x
  end
end

dp[X][Y] = 1
modified_points = [[X, Y]]

loop do
  next_points = []
  modified_points.each do |(x, y)|
    v = dp[x][y] + 1
    if v < dp[x - 1][y]
      dp[x - 1][y] = v
      next_points << [x - 1, y]
    end

    if v < dp[x][y - 1]
      dp[x][y - 1] = v
      next_points << [x, y - 1]
    end

    if v < dp[x + 1][y]
      dp[x + 1][y] = v
      next_points << [x + 1, y]
    end

    if v < dp[x][y + 1]
      dp[x][y + 1] = v
      next_points << [x, y + 1]
    end
  end

  modified_points = next_points
  break if modified_points.empty?
end

numbers = [0] * N
dp.each do |row|
  row.each do |n|
    next if n.nil?

    numbers[n] += 1
  end
end

numbers[1..-1].each {|n| puts n }


Measured memory_bytes: 35480
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define V vector<int>
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;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 50;

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, p; cin >> n >> p;
	int ans = 1;
	// mapで素因数分解を実装する
	map<int, int>mp;
	for (int i = 2; i <= sqrt(p); i++) {
		// iが素数かどうか判定(無駄な処理を減らす)
		if (!prime(i))continue;
		while (p%i == 0) {
			// iで何回割り切れるか求める
			mp[i]++; p /= i;
		}
		ans *= pow(i, mp[i] / n);
	}
	if (p != 1) {
		mp[p] = 1;
	}
	ans *= pow(p, mp[p] / n);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int L;
	cin >> L;
	int N = 1, M = 0;
	vector< vector< pair<int, int> > > E_nxt(1);
	while(L > 1) {
		if(L%2 != 0) {
			E_nxt[N-1].push_back({-1, L-1});
			M++;
			L--;
		}
		E_nxt[N-1].push_back({N, 0});
		E_nxt[N-1].push_back({N, L/2});
		L /= 2;
		M += 2;
		E_nxt.push_back(vector< pair<int, int> >());
		N++;
	}
	cout << N << " " << M << "\n";
	for(int i = 0; i < N; i++) ALL_THE(E_nxt[i], it)
		cout << i+1 << " " << ((it->ff == -1) ? N : (it->ff+1)) << " " << it->ss << "\n";
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pf push_front
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
typedef pair<ii, ii> pii;

int main(int argc, char** argv) {
	int K, ans = -1, n = 0;
	scanf("%d", &K);
	REP(i, 1, 2*K) {
		n = ((n*10)+7)%K;
		if(!n) { ans = i; break; }
	}
	printf("%d\n", ans);
	return 0;
}


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

int main() {
	cin.tie(0)->sync_with_stdio(false);

	int n; cin >> n;
	vector<int> a(n);
	REP(i, n) cin >> a[i];

	vector<int> b(n);
	REP(i, n) b[i] = a[i] - i - 1;
	nth_element(b.begin(), b.begin() + b.size()/2, b.end());

	int med = 0;
	med = b[b.size()/2];
	// if (n % 2)  med = b[b.size()/2];
	// else med = (b[b.size()/2] + b[b.size()/2-1]) / 2;
	// cout << med << '\n';

	ll res = 0;
	REP(i, n) res += abs(b[i] - med);
	cout << res << '\n';
	return 0;
}


Measured memory_bytes: 4716
#include <iostream>
#include <cstdio>
using namespace std;
long long a[200005],sum[200005],x[200005];
int main(){
	int n, i, j;
	scanf("%d", &n);
	for(i = 1; i <= n; i++){
		scanf("%d", &a[i]);
	}
	for(i = 1; i <= n; i++){
		x[i] = x[i-1] ^ a[i];
		sum[i] = sum[i-1] + a[i];
	}
	long long ans = 0;
	int l = 1,r;
	for(r = 1; r <= n; r++){
		while((x[l-1] ^ x[r]) != (sum[r]-sum[l-1])) l++;
		ans += r - l + 1;
	}
	cout << ans;
	return 0; 
}

Measured memory_bytes: 4992